idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
53,100
public static function controlGroup ( $ type , $ name , $ value = '' , $ htmlOptions = array ( ) , $ data = array ( ) ) { $ color = TbArray :: popValue ( 'color' , $ htmlOptions ) ; $ groupOptions = TbArray :: popValue ( 'groupOptions' , $ htmlOptions , array ( ) ) ; $ controlOptions = TbArray :: popValue ( 'controlOptions' , $ htmlOptions , array ( ) ) ; $ label = TbArray :: popValue ( 'label' , $ htmlOptions ) ; $ labelOptions = TbArray :: popValue ( 'labelOptions' , $ htmlOptions , array ( ) ) ; if ( in_array ( $ type , array ( self :: INPUT_TYPE_CHECKBOX , self :: INPUT_TYPE_RADIOBUTTON ) ) ) { $ htmlOptions [ 'label' ] = $ label ; $ htmlOptions [ 'labelOptions' ] = $ labelOptions ; $ label = false ; } $ help = TbArray :: popValue ( 'help' , $ htmlOptions , '' ) ; $ helpOptions = TbArray :: popValue ( 'helpOptions' , $ htmlOptions , array ( ) ) ; if ( ! empty ( $ help ) ) { $ help = self :: inputHelp ( $ help , $ helpOptions ) ; } $ input = isset ( $ htmlOptions [ 'input' ] ) ? $ htmlOptions [ 'input' ] : self :: createInput ( $ type , $ name , $ value , $ htmlOptions , $ data ) ; self :: addCssClass ( 'control-group' , $ groupOptions ) ; if ( ! empty ( $ color ) ) { self :: addCssClass ( $ color , $ groupOptions ) ; } self :: addCssClass ( 'control-label' , $ labelOptions ) ; $ output = self :: openTag ( 'div' , $ groupOptions ) ; if ( $ label !== false ) { $ output .= parent :: label ( $ label , $ name , $ labelOptions ) ; } $ output .= self :: controls ( $ input . $ help , $ controlOptions ) ; $ output .= '</div>' ; return $ output ; }
Generates a form control group .
53,101
public static function createInput ( $ type , $ name , $ value , $ htmlOptions = array ( ) , $ data = array ( ) ) { switch ( $ type ) { case self :: INPUT_TYPE_TEXT : return self :: textField ( $ name , $ value , $ htmlOptions ) ; case self :: INPUT_TYPE_PASSWORD : return self :: passwordField ( $ name , $ value , $ htmlOptions ) ; case self :: INPUT_TYPE_URL : return self :: urlField ( $ name , $ value , $ htmlOptions ) ; case self :: INPUT_TYPE_EMAIL : return self :: emailField ( $ name , $ value , $ htmlOptions ) ; case self :: INPUT_TYPE_NUMBER : return self :: numberField ( $ name , $ value , $ htmlOptions ) ; case self :: INPUT_TYPE_RANGE : return self :: rangeField ( $ name , $ value , $ htmlOptions ) ; case self :: INPUT_TYPE_DATE : return self :: dateField ( $ name , $ value , $ htmlOptions ) ; case self :: INPUT_TYPE_TEXTAREA : return self :: textArea ( $ name , $ value , $ htmlOptions ) ; case self :: INPUT_TYPE_FILE : return self :: fileField ( $ name , $ value , $ htmlOptions ) ; case self :: INPUT_TYPE_RADIOBUTTON : return self :: radioButton ( $ name , $ value , $ htmlOptions ) ; case self :: INPUT_TYPE_CHECKBOX : return self :: checkBox ( $ name , $ value , $ htmlOptions ) ; case self :: INPUT_TYPE_DROPDOWNLIST : return self :: dropDownList ( $ name , $ value , $ data , $ htmlOptions ) ; case self :: INPUT_TYPE_LISTBOX : return self :: listBox ( $ name , $ value , $ data , $ htmlOptions ) ; case self :: INPUT_TYPE_CHECKBOXLIST : return self :: checkBoxList ( $ name , $ value , $ data , $ htmlOptions ) ; case self :: INPUT_TYPE_INLINECHECKBOXLIST : return self :: inlineCheckBoxList ( $ name , $ value , $ data , $ htmlOptions ) ; case self :: INPUT_TYPE_RADIOBUTTONLIST : return self :: radioButtonList ( $ name , $ value , $ data , $ htmlOptions ) ; case self :: INPUT_TYPE_INLINERADIOBUTTONLIST : return self :: inlineRadioButtonList ( $ name , $ value , $ data , $ htmlOptions ) ; case self :: INPUT_TYPE_UNEDITABLE : return self :: uneditableField ( $ value , $ htmlOptions ) ; case self :: INPUT_TYPE_SEARCH : return self :: searchQueryField ( $ name , $ value , $ htmlOptions ) ; default : throw new CException ( 'Invalid input type "' . $ type . '".' ) ; } }
Creates a form input of the given type .
53,102
protected static function createCheckBoxAndRadioButtonLabel ( $ label , $ input , $ htmlOptions ) { list ( $ hidden , $ input ) = self :: normalizeCheckBoxAndRadio ( $ input ) ; return $ hidden . ( $ label !== false ? self :: tag ( 'label' , $ htmlOptions , $ input . ' ' . $ label ) : $ input ) ; }
Generates a label for a checkbox or radio input by wrapping the input .
53,103
protected static function normalizeCheckBoxAndRadio ( $ input ) { $ parts = preg_split ( "/(<.*?>)/" , $ input , 2 , PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ) ; if ( isset ( $ parts [ 1 ] ) ) { return $ parts ; } else { return array ( '' , $ parts [ 0 ] ) ; } }
Normalizes the inputs in the given string by splitting them up into an array .
53,104
public static function activeInlineRadioButtonList ( $ model , $ attribute , $ data , $ htmlOptions = array ( ) ) { $ htmlOptions [ 'inline' ] = true ; return self :: activeRadioButtonList ( $ model , $ attribute , $ data , $ htmlOptions ) ; }
Generates an inline radio button list for a model attribute .
53,105
public static function activeInlineCheckBoxList ( $ model , $ attribute , $ data , $ htmlOptions = array ( ) ) { $ htmlOptions [ 'inline' ] = true ; return self :: activeCheckBoxList ( $ model , $ attribute , $ data , $ htmlOptions ) ; }
Generates an inline check box list for a model attribute .
53,106
public static function activeUneditableField ( $ model , $ attribute , $ htmlOptions = array ( ) ) { parent :: resolveNameID ( $ model , $ attribute , $ htmlOptions ) ; $ value = parent :: resolveValue ( $ model , $ attribute ) ; TbArray :: removeValues ( array ( 'name' , 'id' ) , $ htmlOptions ) ; return self :: uneditableField ( $ value , $ htmlOptions ) ; }
Generates an uneditable input for a model attribute .
53,107
public static function activeSearchQueryField ( $ model , $ attribute , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'search-query' , $ htmlOptions ) ; return self :: activeTextField ( $ model , $ attribute , $ htmlOptions ) ; }
Generates a search query input for a model attribute .
53,108
public static function activeUrlFieldControlGroup ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return self :: activeControlGroup ( self :: INPUT_TYPE_URL , $ model , $ attribute , $ htmlOptions ) ; }
Generates a control group with a url field for a model attribute .
53,109
public static function activeEmailFieldControlGroup ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return self :: activeControlGroup ( self :: INPUT_TYPE_EMAIL , $ model , $ attribute , $ htmlOptions ) ; }
Generates a control group with a email field for a model attribute .
53,110
public static function activeUneditableFieldControlGroup ( $ model , $ attribute , $ htmlOptions = array ( ) ) { return self :: activeControlGroup ( self :: INPUT_TYPE_UNEDITABLE , $ model , $ attribute , $ htmlOptions ) ; }
Generates a control group with a uneditable field for a model attribute .
53,111
public static function activeControlGroup ( $ type , $ model , $ attribute , $ htmlOptions = array ( ) , $ data = array ( ) ) { $ color = TbArray :: popValue ( 'color' , $ htmlOptions ) ; $ groupOptions = TbArray :: popValue ( 'groupOptions' , $ htmlOptions , array ( ) ) ; $ controlOptions = TbArray :: popValue ( 'controlOptions' , $ htmlOptions , array ( ) ) ; $ label = TbArray :: popValue ( 'label' , $ htmlOptions ) ; $ labelOptions = TbArray :: popValue ( 'labelOptions' , $ htmlOptions , array ( ) ) ; if ( in_array ( $ type , array ( self :: INPUT_TYPE_CHECKBOX , self :: INPUT_TYPE_RADIOBUTTON ) ) ) { $ htmlOptions [ 'label' ] = isset ( $ label ) ? $ label : $ model -> getAttributeLabel ( $ attribute ) ; $ htmlOptions [ 'labelOptions' ] = $ labelOptions ; $ label = false ; } if ( isset ( $ label ) && $ label !== false ) { $ labelOptions [ 'label' ] = $ label ; } $ help = TbArray :: popValue ( 'help' , $ htmlOptions , '' ) ; $ helpOptions = TbArray :: popValue ( 'helpOptions' , $ htmlOptions , array ( ) ) ; if ( ! empty ( $ help ) ) { $ help = self :: inputHelp ( $ help , $ helpOptions ) ; } $ error = TbArray :: popValue ( 'error' , $ htmlOptions , '' ) ; $ input = isset ( $ htmlOptions [ 'input' ] ) ? $ htmlOptions [ 'input' ] : self :: createActiveInput ( $ type , $ model , $ attribute , $ htmlOptions , $ data ) ; self :: addCssClass ( 'control-group' , $ groupOptions ) ; if ( ! empty ( $ color ) ) { self :: addCssClass ( $ color , $ groupOptions ) ; } self :: addCssClass ( 'control-label' , $ labelOptions ) ; $ output = self :: openTag ( 'div' , $ groupOptions ) ; if ( $ label !== false ) { $ output .= parent :: activeLabelEx ( $ model , $ attribute , $ labelOptions ) ; } $ output .= self :: controls ( $ input . $ error . $ help , $ controlOptions ) ; $ output .= '</div>' ; return $ output ; }
Generates an active form row .
53,112
public static function createActiveInput ( $ type , $ model , $ attribute , $ htmlOptions = array ( ) , $ data = array ( ) ) { switch ( $ type ) { case self :: INPUT_TYPE_TEXT : return self :: activeTextField ( $ model , $ attribute , $ htmlOptions ) ; case self :: INPUT_TYPE_PASSWORD : return self :: activePasswordField ( $ model , $ attribute , $ htmlOptions ) ; case self :: INPUT_TYPE_URL : return self :: activeUrlField ( $ model , $ attribute , $ htmlOptions ) ; case self :: INPUT_TYPE_EMAIL : return self :: activeEmailField ( $ model , $ attribute , $ htmlOptions ) ; case self :: INPUT_TYPE_NUMBER : return self :: activeNumberField ( $ model , $ attribute , $ htmlOptions ) ; case self :: INPUT_TYPE_RANGE : return self :: activeRangeField ( $ model , $ attribute , $ htmlOptions ) ; case self :: INPUT_TYPE_DATE : return self :: activeDateField ( $ model , $ attribute , $ htmlOptions ) ; case self :: INPUT_TYPE_TEXTAREA : return self :: activeTextArea ( $ model , $ attribute , $ htmlOptions ) ; case self :: INPUT_TYPE_FILE : return self :: activeFileField ( $ model , $ attribute , $ htmlOptions ) ; case self :: INPUT_TYPE_RADIOBUTTON : return self :: activeRadioButton ( $ model , $ attribute , $ htmlOptions ) ; case self :: INPUT_TYPE_CHECKBOX : return self :: activeCheckBox ( $ model , $ attribute , $ htmlOptions ) ; case self :: INPUT_TYPE_DROPDOWNLIST : return self :: activeDropDownList ( $ model , $ attribute , $ data , $ htmlOptions ) ; case self :: INPUT_TYPE_LISTBOX : return self :: activeListBox ( $ model , $ attribute , $ data , $ htmlOptions ) ; case self :: INPUT_TYPE_CHECKBOXLIST : return self :: activeCheckBoxList ( $ model , $ attribute , $ data , $ htmlOptions ) ; case self :: INPUT_TYPE_INLINECHECKBOXLIST : return self :: activeInlineCheckBoxList ( $ model , $ attribute , $ data , $ htmlOptions ) ; case self :: INPUT_TYPE_RADIOBUTTONLIST : return self :: activeRadioButtonList ( $ model , $ attribute , $ data , $ htmlOptions ) ; case self :: INPUT_TYPE_INLINERADIOBUTTONLIST : return self :: activeInlineRadioButtonList ( $ model , $ attribute , $ data , $ htmlOptions ) ; case self :: INPUT_TYPE_UNEDITABLE : return self :: activeUneditableField ( $ model , $ attribute , $ htmlOptions ) ; case self :: INPUT_TYPE_SEARCH : return self :: activeSearchQueryField ( $ model , $ attribute , $ htmlOptions ) ; default : throw new CException ( 'Invalid input type "' . $ type . '".' ) ; } }
Creates an active form input of the given type .
53,113
protected static function normalizeInputOptions ( $ options ) { self :: addSpanClass ( $ options ) ; self :: addTextAlignClass ( $ options ) ; $ size = TbArray :: popValue ( 'size' , $ options ) ; if ( TbArray :: popValue ( 'block' , $ options , false ) ) { self :: addCssClass ( 'input-block-level' , $ options ) ; } else { if ( ! empty ( $ size ) ) { self :: addCssClass ( 'input-' . $ size , $ options ) ; } } return $ options ; }
Normalizes input options .
53,114
public static function formActions ( $ actions , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'form-actions' , $ htmlOptions ) ; if ( is_array ( $ actions ) ) { $ actions = implode ( ' ' , $ actions ) ; } return self :: tag ( 'div' , $ htmlOptions , $ actions ) ; }
Generates form actions .
53,115
public static function searchForm ( $ action , $ method = 'post' , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'form-search' , $ htmlOptions ) ; $ inputOptions = TbArray :: popValue ( 'inputOptions' , $ htmlOptions , array ( ) ) ; $ inputOptions = TbArray :: merge ( array ( 'type' => 'text' , 'placeholder' => 'Search' ) , $ inputOptions ) ; $ name = TbArray :: popValue ( 'name' , $ inputOptions , 'search' ) ; $ value = TbArray :: popValue ( 'value' , $ inputOptions , '' ) ; $ output = self :: beginFormTb ( self :: FORM_LAYOUT_SEARCH , $ action , $ method , $ htmlOptions ) ; $ output .= self :: searchQueryField ( $ name , $ value , $ inputOptions ) ; $ output .= parent :: endForm ( ) ; return $ output ; }
Generates a search form .
53,116
public static function ajaxButton ( $ label , $ url , $ ajaxOptions = array ( ) , $ htmlOptions = array ( ) ) { $ ajaxOptions [ 'url' ] = $ url ; $ htmlOptions [ 'ajaxOptions' ] = $ ajaxOptions ; return self :: btn ( self :: BUTTON_TYPE_AJAXBUTTON , $ label , $ htmlOptions ) ; }
Generates a push button that can initiate AJAX requests .
53,117
protected static function createButton ( $ type , $ label , $ htmlOptions ) { $ url = TbArray :: popValue ( 'url' , $ htmlOptions , '#' ) ; $ ajaxOptions = TbArray :: popValue ( 'ajaxOptions' , $ htmlOptions , array ( ) ) ; switch ( $ type ) { case self :: BUTTON_TYPE_HTML : return parent :: htmlButton ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_SUBMIT : $ htmlOptions [ 'type' ] = 'submit' ; return parent :: htmlButton ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_RESET : $ htmlOptions [ 'type' ] = 'reset' ; return parent :: htmlButton ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_IMAGE : return parent :: imageButton ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_LINKBUTTON : return parent :: linkButton ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_AJAXLINK : return parent :: ajaxLink ( $ label , $ url , $ ajaxOptions , $ htmlOptions ) ; case self :: BUTTON_TYPE_AJAXBUTTON : $ htmlOptions [ 'ajax' ] = $ ajaxOptions ; return parent :: htmlButton ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_INPUTBUTTON : return parent :: button ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_INPUTSUBMIT : $ htmlOptions [ 'type' ] = 'submit' ; return parent :: button ( $ label , $ htmlOptions ) ; case self :: BUTTON_TYPE_LINK : return self :: link ( $ label , $ url , $ htmlOptions ) ; default : throw new CException ( 'Invalid button type "' . $ type . '".' ) ; } }
Creates a button the of given type .
53,118
public static function imageRounded ( $ src , $ alt = '' , $ htmlOptions = array ( ) ) { $ htmlOptions [ 'type' ] = self :: IMAGE_TYPE_ROUNDED ; return self :: image ( $ src , $ alt , $ htmlOptions ) ; }
Generates an image tag with rounded corners .
53,119
public static function imageCircle ( $ src , $ alt = '' , $ htmlOptions = array ( ) ) { $ htmlOptions [ 'type' ] = self :: IMAGE_TYPE_CIRCLE ; return self :: image ( $ src , $ alt , $ htmlOptions ) ; }
Generates an image tag with circle .
53,120
public static function imagePolaroid ( $ src , $ alt = '' , $ htmlOptions = array ( ) ) { $ htmlOptions [ 'type' ] = self :: IMAGE_TYPE_POLAROID ; return self :: image ( $ src , $ alt , $ htmlOptions ) ; }
Generates an image tag within polaroid frame .
53,121
protected static function dropdown ( $ items , $ htmlOptions = array ( ) ) { TbArray :: defaultValue ( 'role' , 'menu' , $ htmlOptions ) ; self :: addCssClass ( 'dropdown-menu' , $ htmlOptions ) ; return self :: menu ( $ items , $ htmlOptions ) ; }
Generates a dropdown menu .
53,122
protected static function dropdownToggle ( $ type , $ label , $ htmlOptions ) { self :: addCssClass ( 'dropdown-toggle' , $ htmlOptions ) ; $ label .= ' <b class="caret"></b>' ; $ htmlOptions [ 'data-toggle' ] = 'dropdown' ; return self :: btn ( $ type , $ label , $ htmlOptions ) ; }
Generates a dropdown toggle element .
53,123
public static function dropdownToggleMenuLink ( $ label , $ url = '#' , $ htmlOptions = array ( ) , $ depth = 0 ) { self :: addCssClass ( 'dropdown-toggle' , $ htmlOptions ) ; if ( $ depth === 0 ) { $ label .= ' <b class="caret"></b>' ; } $ htmlOptions [ 'data-toggle' ] = 'dropdown' ; return self :: link ( $ label , $ url , $ htmlOptions ) ; }
Generates a dropdown toggle menu item .
53,124
public static function buttonToolbar ( array $ groups , $ htmlOptions = array ( ) ) { if ( ! empty ( $ groups ) ) { self :: addCssClass ( 'btn-toolbar' , $ htmlOptions ) ; $ parentOptions = array ( 'color' => TbArray :: popValue ( 'color' , $ htmlOptions ) , 'size' => TbArray :: popValue ( 'size' , $ htmlOptions ) , 'disabled' => TbArray :: popValue ( 'disabled' , $ htmlOptions ) ) ; $ output = self :: openTag ( 'div' , $ htmlOptions ) ; foreach ( $ groups as $ groupOptions ) { if ( isset ( $ groupOptions [ 'visible' ] ) && $ groupOptions [ 'visible' ] === false ) { continue ; } $ items = TbArray :: popValue ( 'items' , $ groupOptions , array ( ) ) ; if ( empty ( $ items ) ) { continue ; } $ options = TbArray :: popValue ( 'htmlOptions' , $ groupOptions , array ( ) ) ; if ( ! empty ( $ options ) ) { $ groupOptions = TbArray :: merge ( $ options , $ groupOptions ) ; } $ groupOptions = TbArray :: copyValues ( array ( 'color' , 'size' , 'disabled' ) , $ parentOptions , $ groupOptions ) ; $ output .= self :: buttonGroup ( $ items , $ groupOptions ) ; } $ output .= '</div>' ; return $ output ; } return '' ; }
Generates a button toolbar .
53,125
public static function splitButtonDropdown ( $ label , $ items , $ htmlOptions = array ( ) ) { $ htmlOptions [ 'split' ] = true ; return self :: buttonDropdown ( $ label , $ items , $ htmlOptions ) ; }
Generates a button with a split dropdown menu .
53,126
public static function navList ( $ items , $ htmlOptions = array ( ) ) { foreach ( $ items as $ i => $ itemOptions ) { if ( is_string ( $ itemOptions ) ) { continue ; } if ( ! isset ( $ itemOptions [ 'url' ] ) && ! isset ( $ itemOptions [ 'items' ] ) ) { $ label = TbArray :: popValue ( 'label' , $ itemOptions , '' ) ; $ items [ $ i ] = self :: menuHeader ( $ label , $ itemOptions ) ; } } return self :: nav ( self :: NAV_TYPE_LIST , $ items , $ htmlOptions ) ; }
Generates a list navigation .
53,127
public static function nav ( $ type , $ items , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'nav' , $ htmlOptions ) ; if ( ! empty ( $ type ) ) { self :: addCssClass ( 'nav-' . $ type , $ htmlOptions ) ; } $ stacked = TbArray :: popValue ( 'stacked' , $ htmlOptions , false ) ; if ( $ type !== self :: NAV_TYPE_LIST && $ stacked ) { self :: addCssClass ( 'nav-stacked' , $ htmlOptions ) ; } return self :: menu ( $ items , $ htmlOptions ) ; }
Generates a navigation menu .
53,128
public static function menuLink ( $ label , $ url , $ htmlOptions = array ( ) ) { TbArray :: defaultValue ( 'role' , 'menuitem' , $ htmlOptions ) ; $ linkOptions = TbArray :: popValue ( 'linkOptions' , $ htmlOptions , array ( ) ) ; $ content = self :: link ( $ label , $ url , $ linkOptions ) ; return self :: tag ( 'li' , $ htmlOptions , $ content ) ; }
Generates a menu link .
53,129
protected static function menuDropdown ( $ label , $ url , $ items , $ htmlOptions , $ depth = 0 ) { self :: addCssClass ( $ depth === 0 ? 'dropdown' : 'dropdown-submenu' , $ htmlOptions ) ; TbArray :: defaultValue ( 'role' , 'menuitem' , $ htmlOptions ) ; $ linkOptions = TbArray :: popValue ( 'linkOptions' , $ htmlOptions , array ( ) ) ; $ menuOptions = TbArray :: popValue ( 'menuOptions' , $ htmlOptions , array ( ) ) ; self :: addCssClass ( 'dropdown-menu' , $ menuOptions ) ; if ( $ depth === 0 ) { $ defaultId = parent :: ID_PREFIX . parent :: $ count ++ ; TbArray :: defaultValue ( 'id' , $ defaultId , $ menuOptions ) ; $ menuOptions [ 'aria-labelledby' ] = $ menuOptions [ 'id' ] ; $ menuOptions [ 'role' ] = 'menu' ; } $ output = self :: openTag ( 'li' , $ htmlOptions ) ; $ output .= self :: dropdownToggleMenuLink ( $ label , $ url , $ linkOptions , $ depth ) ; $ output .= self :: menu ( $ items , $ menuOptions , $ depth + 1 ) ; $ output .= '</li>' ; return $ output ; }
Generates a menu dropdown .
53,130
public static function tabbable ( $ type , $ tabs , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'tabbable' , $ htmlOptions ) ; $ placement = TbArray :: popValue ( 'placement' , $ htmlOptions ) ; if ( ! empty ( $ placement ) ) { self :: addCssClass ( 'tabs-' . $ placement , $ htmlOptions ) ; } $ menuOptions = TbArray :: popValue ( 'menuOptions' , $ htmlOptions , array ( ) ) ; $ contentOptions = TbArray :: popValue ( 'contentOptions' , $ htmlOptions , array ( ) ) ; self :: addCssClass ( 'tab-content' , $ contentOptions ) ; $ panes = array ( ) ; $ items = self :: normalizeTabs ( $ tabs , $ panes ) ; $ menu = self :: nav ( $ type , $ items , $ menuOptions ) ; $ content = self :: tag ( 'div' , $ contentOptions , implode ( '' , $ panes ) ) ; $ output = self :: openTag ( 'div' , $ htmlOptions ) ; $ output .= $ placement === self :: TABS_PLACEMENT_BELOW ? $ content . $ menu : $ menu . $ content ; $ output .= '</div>' ; return $ output ; }
Generates a tabbable menu .
53,131
public static function navbarText ( $ text , $ htmlOptions = array ( ) , $ tag = 'p' ) { self :: addCssClass ( 'navbar-text' , $ htmlOptions ) ; return self :: tag ( $ tag , $ htmlOptions , $ text ) ; }
Generates a text for the navbar .
53,132
public static function navbarForm ( $ action , $ method = 'post' , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'navbar-form' , $ htmlOptions ) ; return self :: form ( $ action , $ method , $ htmlOptions ) ; }
Generates a navbar form .
53,133
public static function navbarSearchForm ( $ action , $ method = 'post' , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'navbar-search' , $ htmlOptions ) ; return self :: searchForm ( $ action , $ method , $ htmlOptions ) ; }
Generates a navbar search form .
53,134
public static function breadcrumbs ( $ links , $ htmlOptions = array ( ) ) { $ divider = TbArray :: popValue ( 'divider' , $ htmlOptions , '/' ) ; self :: addCssClass ( 'breadcrumb' , $ htmlOptions ) ; $ output = self :: openTag ( 'ul' , $ htmlOptions ) ; foreach ( $ links as $ label => $ url ) { if ( is_string ( $ label ) ) { $ output .= self :: openTag ( 'li' ) ; $ output .= self :: link ( $ label , $ url ) ; $ output .= self :: tag ( 'span' , array ( 'class' => 'divider' ) , $ divider ) ; $ output .= '</li>' ; } else { $ output .= self :: tag ( 'li' , array ( 'class' => 'active' ) , $ url ) ; } } $ output .= '</ul>' ; return $ output ; }
Generates a breadcrumb menu .
53,135
public static function pagination ( array $ items , $ htmlOptions = array ( ) ) { if ( ! empty ( $ items ) ) { self :: addCssClass ( 'pagination' , $ htmlOptions ) ; $ size = TbArray :: popValue ( 'size' , $ htmlOptions ) ; if ( ! empty ( $ size ) ) { self :: addCssClass ( 'pagination-' . $ size , $ htmlOptions ) ; } $ align = TbArray :: popValue ( 'align' , $ htmlOptions ) ; if ( ! empty ( $ align ) ) { self :: addCssClass ( 'pagination-' . $ align , $ htmlOptions ) ; } $ listOptions = TbArray :: popValue ( 'listOptions' , $ htmlOptions , array ( ) ) ; $ output = self :: openTag ( 'div' , $ htmlOptions ) ; $ output .= self :: openTag ( 'ul' , $ listOptions ) ; foreach ( $ items as $ itemOptions ) { $ options = TbArray :: popValue ( 'htmlOptions' , $ itemOptions , array ( ) ) ; if ( ! empty ( $ options ) ) { $ itemOptions = TbArray :: merge ( $ options , $ itemOptions ) ; } $ label = TbArray :: popValue ( 'label' , $ itemOptions , '' ) ; $ url = TbArray :: popValue ( 'url' , $ itemOptions , false ) ; $ output .= self :: paginationLink ( $ label , $ url , $ itemOptions ) ; } $ output .= '</ul></div>' ; return $ output ; } return '' ; }
Generates a pagination .
53,136
public static function heroUnit ( $ heading , $ content , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'hero-unit' , $ htmlOptions ) ; $ headingOptions = TbArray :: popValue ( 'headingOptions' , $ htmlOptions , array ( ) ) ; $ output = self :: openTag ( 'div' , $ htmlOptions ) ; $ output .= self :: tag ( 'h1' , $ headingOptions , $ heading ) ; $ output .= $ content ; $ output .= '</div>' ; return $ output ; }
Generates a hero unit .
53,137
public static function pageHeader ( $ heading , $ subtext , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'page-header' , $ htmlOptions ) ; $ headerOptions = TbArray :: popValue ( 'headerOptions' , $ htmlOptions , array ( ) ) ; $ subtextOptions = TbArray :: popValue ( 'subtextOptions' , $ htmlOptions , array ( ) ) ; $ output = self :: openTag ( 'div' , $ htmlOptions ) ; $ output .= self :: openTag ( 'h1' , $ headerOptions ) ; $ output .= parent :: encode ( $ heading ) . ' ' . self :: tag ( 'small' , $ subtextOptions , $ subtext ) ; $ output .= '</h1>' ; $ output .= '</div>' ; return $ output ; }
Generates a pager header .
53,138
public static function thumbnail ( $ content , $ htmlOptions = array ( ) ) { $ itemOptions = TbArray :: popValue ( 'itemOptions' , $ htmlOptions , array ( ) ) ; self :: addCssClass ( 'thumbnail' , $ htmlOptions ) ; $ output = self :: openTag ( 'li' , $ itemOptions ) ; $ output .= self :: tag ( 'div' , $ htmlOptions , $ content ) ; $ output .= '</li>' ; return $ output ; }
Generates a thumbnail .
53,139
public static function thumbnailLink ( $ content , $ url = '#' , $ htmlOptions = array ( ) ) { $ itemOptions = TbArray :: popValue ( 'itemOptions' , $ htmlOptions , array ( ) ) ; self :: addCssClass ( 'thumbnail' , $ htmlOptions ) ; $ content = self :: link ( $ content , $ url , $ htmlOptions ) ; return self :: tag ( 'li' , $ itemOptions , $ content ) ; }
Generates a link thumbnail .
53,140
public static function alert ( $ color , $ message , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'alert' , $ htmlOptions ) ; if ( ! empty ( $ color ) ) { self :: addCssClass ( 'alert-' . $ color , $ htmlOptions ) ; } if ( TbArray :: popValue ( 'in' , $ htmlOptions , true ) ) { self :: addCssClass ( 'in' , $ htmlOptions ) ; } if ( TbArray :: popValue ( 'block' , $ htmlOptions , false ) ) { self :: addCssClass ( 'alert-block' , $ htmlOptions ) ; } if ( TbArray :: popValue ( 'fade' , $ htmlOptions , true ) ) { self :: addCssClass ( 'fade' , $ htmlOptions ) ; } $ closeText = TbArray :: popValue ( 'closeText' , $ htmlOptions , self :: CLOSE_TEXT ) ; $ closeOptions = TbArray :: popValue ( 'closeOptions' , $ htmlOptions , array ( ) ) ; $ closeOptions [ 'dismiss' ] = self :: CLOSE_DISMISS_ALERT ; $ output = self :: openTag ( 'div' , $ htmlOptions ) ; $ output .= $ closeText !== false ? self :: closeLink ( $ closeText , '#' , $ closeOptions ) : '' ; $ output .= $ message ; $ output .= '</div>' ; return $ output ; }
Generates an alert .
53,141
public static function blockAlert ( $ color , $ message , $ htmlOptions = array ( ) ) { $ htmlOptions [ 'block' ] = true ; return self :: alert ( $ color , $ message , $ htmlOptions ) ; }
Generates an alert block .
53,142
public static function stackedProgressBar ( array $ bars , $ htmlOptions = array ( ) ) { if ( ! empty ( $ bars ) ) { self :: addCssClass ( 'progress' , $ htmlOptions ) ; $ output = self :: openTag ( 'div' , $ htmlOptions ) ; $ totalWidth = 0 ; foreach ( $ bars as $ barOptions ) { if ( isset ( $ barOptions [ 'visible' ] ) && ! $ barOptions [ 'visible' ] ) { continue ; } $ width = TbArray :: popValue ( 'width' , $ barOptions , 0 ) ; $ tmp = $ totalWidth ; $ totalWidth += $ width ; if ( $ totalWidth > 100 ) { $ width = 100 - $ tmp ; } $ output .= self :: bar ( $ width , $ barOptions ) ; } $ output .= '</div>' ; return $ output ; } return '' ; }
Generates a stacked progress bar .
53,143
public static function mediaList ( array $ items , $ htmlOptions = array ( ) ) { if ( ! empty ( $ items ) ) { self :: addCssClass ( 'media-list' , $ htmlOptions ) ; $ output = '' ; $ output .= self :: openTag ( 'ul' , $ htmlOptions ) ; $ output .= self :: medias ( $ items , 'li' ) ; $ output .= '</ul>' ; return $ output ; } return '' ; }
Generates a list of media objects .
53,144
public static function medias ( array $ items , $ tag = 'div' ) { if ( ! empty ( $ items ) ) { $ output = '' ; foreach ( $ items as $ itemOptions ) { if ( isset ( $ itemOptions [ 'visible' ] ) && $ itemOptions [ 'visible' ] === false ) { continue ; } $ options = TbArray :: popValue ( 'htmlOptions' , $ itemOptions , array ( ) ) ; if ( ! empty ( $ options ) ) { $ itemOptions = TbArray :: merge ( $ options , $ itemOptions ) ; } $ image = TbArray :: popValue ( 'image' , $ itemOptions ) ; $ heading = TbArray :: popValue ( 'heading' , $ itemOptions , '' ) ; $ content = TbArray :: popValue ( 'content' , $ itemOptions , '' ) ; TbArray :: defaultValue ( 'tag' , $ tag , $ itemOptions ) ; $ output .= self :: media ( $ image , $ heading , $ content , $ itemOptions ) ; } return $ output ; } return '' ; }
Generates multiple media objects .
53,145
public static function media ( $ image , $ heading , $ content , $ htmlOptions = array ( ) ) { $ tag = TbArray :: popValue ( 'tag' , $ htmlOptions , 'div' ) ; self :: addCssClass ( 'media' , $ htmlOptions ) ; $ linkOptions = TbArray :: popValue ( 'linkOptions' , $ htmlOptions , array ( ) ) ; TbArray :: defaultValue ( 'pull' , self :: PULL_LEFT , $ linkOptions ) ; $ imageOptions = TbArray :: popValue ( 'imageOptions' , $ htmlOptions , array ( ) ) ; self :: addCssClass ( 'media-object' , $ imageOptions ) ; $ contentOptions = TbArray :: popValue ( 'contentOptions' , $ htmlOptions , array ( ) ) ; self :: addCssClass ( 'media-body' , $ contentOptions ) ; $ headingOptions = TbArray :: popValue ( 'headingOptions' , $ htmlOptions , array ( ) ) ; self :: addCssClass ( 'media-heading' , $ headingOptions ) ; $ items = TbArray :: popValue ( 'items' , $ htmlOptions ) ; $ output = self :: openTag ( $ tag , $ htmlOptions ) ; $ alt = TbArray :: popValue ( 'alt' , $ imageOptions , '' ) ; $ href = TbArray :: popValue ( 'href' , $ linkOptions , '#' ) ; if ( ! empty ( $ image ) ) { $ output .= self :: link ( parent :: image ( $ image , $ alt , $ imageOptions ) , $ href , $ linkOptions ) ; } $ output .= self :: openTag ( 'div' , $ contentOptions ) ; $ output .= self :: tag ( 'h4' , $ headingOptions , $ heading ) ; $ output .= $ content ; if ( ! empty ( $ items ) ) { $ output .= self :: medias ( $ items ) ; } $ output .= '</div>' ; $ output .= self :: closeTag ( $ tag ) ; return $ output ; }
Generates a single media object .
53,146
public static function well ( $ content , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'well' , $ htmlOptions ) ; $ size = TbArray :: popValue ( 'size' , $ htmlOptions ) ; if ( ! empty ( $ size ) ) { self :: addCssClass ( 'well-' . $ size , $ htmlOptions ) ; } return self :: tag ( 'div' , $ htmlOptions , $ content ) ; }
Generates a well element .
53,147
protected static function close ( $ tag , $ label , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'close' , $ htmlOptions ) ; $ dismiss = TbArray :: popValue ( 'dismiss' , $ htmlOptions ) ; if ( ! empty ( $ dismiss ) ) { $ htmlOptions [ 'data-dismiss' ] = $ dismiss ; } $ htmlOptions [ 'type' ] = 'button' ; return self :: tag ( $ tag , $ htmlOptions , $ label ) ; }
Generates a close element .
53,148
public static function collapseLink ( $ label , $ target , $ htmlOptions = array ( ) ) { $ htmlOptions [ 'data-toggle' ] = 'collapse' ; return self :: link ( $ label , $ target , $ htmlOptions ) ; }
Generates a collapse link .
53,149
public static function modalBody ( $ content , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'modal-body' , $ htmlOptions ) ; return self :: tag ( 'div' , $ htmlOptions , $ content ) ; }
Generates a modal body .
53,150
public static function modalFooter ( $ content , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'modal-footer' , $ htmlOptions ) ; return self :: tag ( 'div' , $ htmlOptions , $ content ) ; }
Generates a modal footer .
53,151
public static function tooltip ( $ label , $ url , $ content , $ htmlOptions = array ( ) ) { $ htmlOptions [ 'rel' ] = 'tooltip' ; return self :: tooltipPopover ( $ label , $ url , $ content , $ htmlOptions ) ; }
Generates a tooltip .
53,152
public static function popover ( $ label , $ title , $ content , $ htmlOptions = array ( ) ) { $ htmlOptions [ 'rel' ] = 'popover' ; $ htmlOptions [ 'data-content' ] = $ content ; $ htmlOptions [ 'data-toggle' ] = 'popover' ; return self :: tooltipPopover ( $ label , '#' , $ title , $ htmlOptions ) ; }
Generates a popover .
53,153
protected static function tooltipPopover ( $ label , $ url , $ title , $ htmlOptions ) { $ htmlOptions [ 'title' ] = $ title ; if ( TbArray :: popValue ( 'animation' , $ htmlOptions ) ) { $ htmlOptions [ 'data-animation' ] = 'true' ; } if ( TbArray :: popValue ( 'html' , $ htmlOptions ) ) { $ htmlOptions [ 'data-html' ] = 'true' ; } $ selector = TbArray :: popValue ( 'selector' , $ htmlOptions ) ; if ( ! empty ( $ selector ) ) { $ htmlOptions [ 'data-selector' ] = $ selector ; } $ placement = TbArray :: popValue ( 'placement' , $ htmlOptions ) ; if ( ! empty ( $ placement ) ) { $ htmlOptions [ 'data-placement' ] = $ placement ; } $ trigger = TbArray :: popValue ( 'trigger' , $ htmlOptions ) ; if ( ! empty ( $ trigger ) ) { $ htmlOptions [ 'data-trigger' ] = $ trigger ; } if ( ( $ delay = TbArray :: popValue ( 'delay' , $ htmlOptions ) ) !== null ) { $ htmlOptions [ 'data-delay' ] = $ delay ; } return self :: link ( $ label , $ url , $ htmlOptions ) ; }
Generates a base tooltip .
53,154
public static function carouselItem ( $ content , $ label , $ caption , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'item' , $ htmlOptions ) ; $ overlayOptions = TbArray :: popValue ( 'overlayOptions' , $ htmlOptions , array ( ) ) ; self :: addCssClass ( 'carousel-caption' , $ overlayOptions ) ; $ labelOptions = TbArray :: popValue ( 'labelOptions' , $ htmlOptions , array ( ) ) ; $ captionOptions = TbArray :: popValue ( 'captionOptions' , $ htmlOptions , array ( ) ) ; $ url = TbArray :: popValue ( 'url' , $ htmlOptions , false ) ; if ( $ url !== false ) { $ content = self :: link ( $ content , $ url ) ; } $ output = self :: openTag ( 'div' , $ htmlOptions ) ; $ output .= $ content ; if ( isset ( $ label ) || isset ( $ caption ) ) { $ output .= self :: openTag ( 'div' , $ overlayOptions ) ; if ( $ label ) { $ output .= self :: tag ( 'h4' , $ labelOptions , $ label ) ; } if ( $ caption ) { $ output .= self :: tag ( 'p' , $ captionOptions , $ caption ) ; } $ output .= '</div>' ; } $ output .= '</div>' ; return $ output ; }
Generates a carousel item .
53,155
public static function carouselPrevLink ( $ label , $ url = '#' , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'carousel-control left' , $ htmlOptions ) ; $ htmlOptions [ 'data-slide' ] = 'prev' ; return self :: link ( $ label , $ url , $ htmlOptions ) ; }
Generates a previous link for the carousel .
53,156
public static function carouselNextLink ( $ label , $ url = '#' , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'carousel-control right' , $ htmlOptions ) ; $ htmlOptions [ 'data-slide' ] = 'next' ; return self :: link ( $ label , $ url , $ htmlOptions ) ; }
Generates a next link for the carousel .
53,157
public static function carouselIndicators ( $ target , $ numSlides , $ htmlOptions = array ( ) ) { self :: addCssClass ( 'carousel-indicators' , $ htmlOptions ) ; $ output = self :: openTag ( 'ol' , $ htmlOptions ) ; for ( $ i = 0 ; $ i < $ numSlides ; $ i ++ ) { $ itemOptions = array ( 'data-target' => $ target , 'data-slide-to' => $ i ) ; if ( $ i === 0 ) { $ itemOptions [ 'class' ] = 'active' ; } $ output .= self :: tag ( 'li' , $ itemOptions , '' , true ) ; } $ output .= '</ol>' ; return $ output ; }
Generates an indicator for the carousel .
53,158
public static function addCssClass ( $ className , & $ htmlOptions ) { if ( is_string ( $ className ) ) { $ className = explode ( ' ' , $ className ) ; } if ( isset ( $ htmlOptions [ 'class' ] ) ) { $ classes = array_filter ( explode ( ' ' , $ htmlOptions [ 'class' ] ) ) ; foreach ( $ className as $ class ) { $ class = trim ( $ class ) ; if ( array_search ( $ class , $ classes ) === false ) { $ classes [ ] = $ class ; } } $ className = $ classes ; } $ htmlOptions [ 'class' ] = implode ( ' ' , $ className ) ; }
Appends new class names to the given options ..
53,159
public static function addCssStyle ( $ style , & $ htmlOptions ) { if ( is_array ( $ style ) ) { $ style = implode ( '; ' , $ style ) ; } $ style = rtrim ( $ style , ';' ) ; $ htmlOptions [ 'style' ] = isset ( $ htmlOptions [ 'style' ] ) ? rtrim ( $ htmlOptions [ 'style' ] , ';' ) . '; ' . $ style : $ style ; }
Appends a CSS style string to the given options .
53,160
protected static function addPullClass ( & $ htmlOptions ) { $ pull = TbArray :: popValue ( 'pull' , $ htmlOptions ) ; if ( ! empty ( $ pull ) ) { self :: addCssClass ( 'pull-' . $ pull , $ htmlOptions ) ; } }
Adds the pull class to the given options is applicable .
53,161
protected static function addTextAlignClass ( & $ htmlOptions ) { $ align = TbArray :: popValue ( 'textAlign' , $ htmlOptions ) ; if ( ! empty ( $ align ) ) { self :: addCssClass ( 'text-' . $ align , $ htmlOptions ) ; } }
Adds the text align class to the given options if applicable .
53,162
protected function registerCssPackagesIfEnabled ( ) { if ( ! $ this -> coreCss ) return ; if ( ! $ this -> ajaxCssLoad && Yii :: app ( ) -> request -> isAjaxRequest ) return ; if ( $ this -> bootstrapCss ) $ this -> registerBootstrapCss ( ) ; if ( $ this -> fontAwesomeCss ) $ this -> registerFontAwesomeCss ( ) ; if ( $ this -> responsiveCss ) $ this -> registerMetadataForResponsive ( ) ; if ( $ this -> yiiCss !== false ) { $ this -> registerYiiCss ( ) ; } elseif ( $ this -> customTheme !== false && ! is_null ( $ this -> customThemeName ) ) { $ this -> registerCustomTheme ( ) ; } if ( $ this -> jqueryCss !== false ) $ this -> registerJQueryCss ( ) ; }
If we did not disabled registering CSS packages register them .
53,163
protected function registerJsPackagesIfEnabled ( ) { if ( ! $ this -> enableJS ) return ; if ( ! $ this -> ajaxJsLoad && Yii :: app ( ) -> request -> isAjaxRequest ) return ; $ this -> registerPackage ( 'bootstrap.js' ) ; $ this -> registerPackage ( 'bootstrap-noconflict' ) ; if ( $ this -> enableBootboxJS ) $ this -> registerPackage ( 'bootbox' ) ; if ( $ this -> enableNotifierJS ) $ this -> registerPackage ( 'notify' ) ; if ( $ this -> enablePopover ) $ this -> registerPopoverJs ( ) ; if ( $ this -> enableTooltip ) $ this -> registerTooltipJs ( ) ; }
If enableJS is not false register our Javascript packages
53,164
public function registerAssetJs ( $ name , $ position = CClientScript :: POS_END ) { $ this -> cs -> registerScriptFile ( $ this -> getAssetsUrl ( ) . "/js/{$name}" , $ position ) ; }
Register a javascript file in the asset s js folder
53,165
protected function createSelect2Package ( ) { $ jsFiles = array ( $ this -> minify ? 'select2.min.js' : 'select2.js' ) ; if ( strpos ( Yii :: app ( ) -> language , 'en' ) !== 0 ) { $ locale = 'select2_locale_' . substr ( Yii :: app ( ) -> language , 0 , 2 ) . '.js' ; if ( @ file_exists ( Yii :: getPathOfAlias ( 'booster.assets.select2' ) . DIRECTORY_SEPARATOR . $ locale ) ) { $ jsFiles [ ] = $ locale ; } else { $ locale = 'select2_locale_' . Yii :: app ( ) -> language . '.js' ; if ( @ file_exists ( Yii :: getPathOfAlias ( 'booster.assets.select2' ) . DIRECTORY_SEPARATOR . $ locale ) ) { $ jsFiles [ ] = $ locale ; } else { $ locale = 'select2_locale_' . substr ( Yii :: app ( ) -> language , 0 , 2 ) . '-' . strtoupper ( substr ( Yii :: app ( ) -> language , 3 , 2 ) ) . '.js' ; if ( @ file_exists ( Yii :: getPathOfAlias ( 'booster.assets.select2' ) . DIRECTORY_SEPARATOR . $ locale ) ) { $ jsFiles [ ] = $ locale ; } } } } return array ( 'select2' => array ( 'baseUrl' => $ this -> getAssetsUrl ( ) . '/select2/' , 'js' => $ jsFiles , 'css' => array ( 'select2.css' , 'select2-bootstrap.css' ) , 'depends' => array ( 'jquery' ) , ) ) ; }
Make select2 package definition
53,166
public static function attachAjaxUpdateEvent ( $ widget ) { $ trigger = '$("#' . $ widget -> id . '").trigger("ajaxUpdate.editable");' ; if ( strpos ( $ widget -> afterAjaxUpdate , $ trigger ) !== false ) return ; if ( strlen ( $ widget -> afterAjaxUpdate ) ) { $ orig = $ widget -> afterAjaxUpdate ; if ( strpos ( $ orig , 'js:' ) === 0 ) $ orig = substr ( $ orig , 3 ) ; $ orig = "\n($orig).apply(this, arguments);" ; } else { $ orig = '' ; } $ widget -> afterAjaxUpdate = "js: function(id, data) { $trigger $orig }" ; $ widget -> registerClientScript ( ) ; }
injects ajaxUpdate event into widget
53,167
protected function registerJQueryUI ( ) { $ cs = Yii :: app ( ) -> getClientScript ( ) ; if ( $ this -> themeUrl === null ) { $ this -> themeUrl = $ cs -> getCoreScriptUrl ( ) . '/jui/css' ; } $ cs -> registerCssFile ( $ this -> themeUrl . '/' . $ this -> theme . '/' . $ this -> cssFile ) ; $ cs -> registerPackage ( 'jquery.ui' ) ; }
method to register jQuery UI with build - in or custom theme
53,168
public function registerClientScript ( $ id ) { Booster :: getBooster ( ) -> cs -> registerPackage ( 'timepicker' ) ; $ options = ! empty ( $ this -> options ) ? CJavaScript :: encode ( $ this -> options ) : '' ; ob_start ( ) ; echo "jQuery('#{$id}').timepicker({$options})" ; foreach ( $ this -> events as $ event => $ handler ) { echo ".on('{$event}', " . CJavaScript :: encode ( $ handler ) . ")" ; } Yii :: app ( ) -> getClientScript ( ) -> registerScript ( __CLASS__ . '#' . $ id , ob_get_clean ( ) . ';' ) ; }
Registers required javascript files
53,169
protected function getSeparatedSelectableInput ( ) { switch ( $ this -> type ) { case self :: TYPE_CHECKBOX : $ method = 'checkBox' ; break ; case self :: TYPE_RADIO : $ method = 'radioButton' ; break ; default : throw new CException ( 'This method can be used with only selectable control' , E_USER_ERROR ) ; } $ control = $ this -> form -> { $ method } ( $ this -> model , $ this -> attribute , $ this -> htmlOptions ) ; $ hidden = '' ; $ hasHiddenField = ( array_key_exists ( 'uncheckValue' , $ this -> htmlOptions ) && $ this -> htmlOptions [ 'uncheckValue' ] === null ) ? false : true ; if ( $ hasHiddenField && preg_match ( '/\<input .*?type="hidden".*?\/\>/' , $ control , $ matches ) ) { $ hidden = $ matches [ 0 ] ; $ control = str_replace ( $ hidden , '' , $ control ) ; } return array ( $ hidden , $ control ) ; }
Obtain separately hidden and visible field
53,170
public function processValue ( $ value ) { $ clean = strip_tags ( $ value ) ; $ this -> total += ( ( float ) $ this -> extractNumber ( $ clean ) ) ; }
Process the value to calculate
53,171
public function displaySummary ( ) { echo strtr ( $ this -> template , array ( '{label}' => $ this -> label , '{value}' => $ this -> total === null ? '' : Yii :: app ( ) -> format -> format ( $ this -> total , $ this -> column -> type ) ) ) ; }
Displays the summary
53,172
protected function getTotal ( ) { if ( null == $ this -> _total ) { $ this -> _total = 0 ; foreach ( $ this -> types as $ type ) { if ( isset ( $ type [ 'value' ] ) ) { $ this -> _total += $ type [ 'value' ] ; } } } return $ this -> _total ; }
Returns the total of types
53,173
private function getFileValidatorProperty ( $ model = null , $ attribute = null , $ property = null ) { if ( ! isset ( $ model , $ attribute , $ property ) ) { return null ; } foreach ( $ model -> getValidators ( $ attribute ) as $ validator ) { if ( $ validator instanceof CFileValidator ) { $ ret = $ validator -> $ property ; } } return isset ( $ ret ) ? $ ret : null ; }
Check for a property of CFileValidator
53,174
public function renderItems ( ) { echo CHtml :: openTag ( $ this -> itemsTagName , array ( 'class' => $ this -> itemsCssClass ) ) . "\n" ; $ data = $ this -> dataProvider -> getData ( ) ; if ( ! empty ( $ data ) ) { echo CHtml :: openTag ( 'div' , array ( 'class' => 'row' ) ) ; $ owner = $ this -> getOwner ( ) ; $ render = $ owner instanceof CController ? 'renderPartial' : 'render' ; foreach ( $ data as $ i => $ item ) { $ data = $ this -> viewData ; $ data [ 'index' ] = $ i ; $ data [ 'data' ] = $ item ; $ data [ 'widget' ] = $ this ; $ owner -> $ render ( $ this -> itemView , $ data ) ; } echo '</div>' ; } else { $ this -> renderEmptyText ( ) ; } echo CHtml :: closeTag ( $ this -> itemsTagName ) ; }
Renders the data items for the view . Each item is corresponding to a single data model instance . Child classes should override this method to provide the actual item rendering logic .
53,175
protected function radioButtonGroupsList ( ) { if ( isset ( $ this -> htmlOptions [ 'for' ] ) && ! empty ( $ this -> htmlOptions [ 'for' ] ) ) { $ label_for = $ this -> htmlOptions [ 'for' ] ; unset ( $ this -> htmlOptions [ 'for' ] ) ; } else if ( isset ( $ this -> data ) && ! empty ( $ this -> data ) ) { $ label_for = CHtml :: getIdByName ( get_class ( $ this -> model ) . '[' . $ this -> attribute . '][' . key ( $ this -> data ) . ']' ) ; } if ( isset ( $ label_for ) ) { $ this -> labelOptions = array ( 'for' => $ label_for ) ; } echo $ this -> getLabel ( ) ; echo $ this -> form -> radioButtonGroupsList ( $ this -> model , $ this -> attribute , $ this -> data , $ this -> htmlOptions ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; }
Renders a list of radio buttons using Button Groups .
53,176
protected function colorpickerField ( ) { $ format = 'hex' ; if ( isset ( $ this -> htmlOptions [ 'format' ] ) ) { $ format = $ this -> htmlOptions [ 'format' ] ; unset ( $ this -> htmlOptions [ 'format' ] ) ; } if ( isset ( $ this -> htmlOptions [ 'events' ] ) ) { $ events = $ this -> htmlOptions [ 'events' ] ; unset ( $ this -> htmlOptions [ 'events' ] ) ; } echo $ this -> getLabel ( ) ; echo $ this -> getPrepend ( ) ; $ this -> widget ( 'booster.widgets.TbColorPicker' , array ( 'model' => $ this -> model , 'attribute' => $ this -> attribute , 'format' => $ format , 'events' => isset ( $ events ) ? $ events : array ( ) , 'htmlOptions' => $ this -> htmlOptions , ) ) ; echo $ this -> getAppend ( ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; }
Renders a colorpicker field .
53,177
protected function select2Field ( ) { if ( isset ( $ this -> htmlOptions [ 'options' ] ) ) { $ options = $ this -> htmlOptions [ 'options' ] ; unset ( $ this -> htmlOptions [ 'options' ] ) ; } if ( isset ( $ this -> htmlOptions [ 'events' ] ) ) { $ events = $ this -> htmlOptions [ 'events' ] ; unset ( $ this -> htmlOptions [ 'events' ] ) ; } if ( isset ( $ this -> htmlOptions [ 'data' ] ) ) { $ data = $ this -> htmlOptions [ 'data' ] ; unset ( $ this -> htmlOptions [ 'data' ] ) ; } if ( isset ( $ this -> htmlOptions [ 'asDropDownList' ] ) ) { $ asDropDownList = $ this -> htmlOptions [ 'asDropDownList' ] ; unset ( $ this -> htmlOptions [ 'asDropDownList' ] ) ; } if ( isset ( $ this -> htmlOptions [ 'val' ] ) ) { $ val = $ this -> htmlOptions [ 'val' ] ; unset ( $ this -> htmlOptions [ 'val' ] ) ; } echo $ this -> getLabel ( ) ; echo $ this -> getPrepend ( ) ; $ this -> widget ( 'booster.widgets.TbSelect2' , array ( 'model' => $ this -> model , 'attribute' => $ this -> attribute , 'options' => isset ( $ options ) ? $ options : array ( ) , 'events' => isset ( $ events ) ? $ events : array ( ) , 'data' => isset ( $ data ) ? $ data : array ( ) , 'asDropDownList' => isset ( $ asDropDownList ) ? $ asDropDownList : true , 'val' => isset ( $ val ) ? $ val : null , 'htmlOptions' => $ this -> htmlOptions , 'form' => $ this -> form ) ) ; echo $ this -> getAppend ( ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; }
Renders a select2Field
53,178
protected function typeAheadField ( ) { echo $ this -> getLabel ( ) ; echo $ this -> getPrepend ( ) ; echo $ this -> form -> typeAheadField ( $ this -> model , $ this -> attribute , $ this -> data , $ this -> htmlOptions ) ; echo $ this -> getAppend ( ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; }
Renders a typeahead field
53,179
protected function numberField ( ) { echo $ this -> getLabel ( ) ; echo $ this -> getPrepend ( ) ; echo $ this -> form -> numberField ( $ this -> model , $ this -> attribute , $ this -> htmlOptions ) ; echo $ this -> getAppend ( ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; }
Renders a number field .
53,180
protected function customField ( ) { echo $ this -> getLabel ( ) ; echo $ this -> getPrepend ( ) ; echo $ this -> htmlOptions [ 'input' ] ; echo $ this -> getAppend ( ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; }
Renders a pre - rendered custom field
53,181
protected function radioButton ( ) { $ attribute = $ this -> attribute ; list ( $ hidden , $ radioButton ) = $ this -> getSeparatedSelectableInput ( ) ; echo '<div class="controls">' ; echo ( $ hidden ) ? $ hidden . PHP_EOL : '' ; echo '<label class="radio" for="' . $ this -> getAttributeId ( $ attribute ) . '">' ; echo $ radioButton . PHP_EOL ; echo $ this -> model -> getAttributeLabel ( $ attribute ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; echo '</label></div>' ; }
Renders a radio button .
53,182
protected function captcha ( ) { echo $ this -> getLabel ( ) ; echo '<div class="controls"><div class="captcha">' ; echo '<div class="widget">' . $ this -> widget ( 'CCaptcha' , $ this -> captchaOptions , true ) . '</div>' ; echo $ this -> form -> textField ( $ this -> model , $ this -> attribute , $ this -> htmlOptions ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; echo '</div></div>' ; }
Renders a CAPTCHA .
53,183
protected function uneditableField ( ) { echo $ this -> getLabel ( ) ; echo '<div class="controls">' ; echo CHtml :: tag ( 'span' , $ this -> htmlOptions , $ this -> model -> { $ this -> attribute } ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; echo '</div>' ; }
Renders an uneditable field .
53,184
protected function ckEditor ( ) { if ( isset ( $ this -> htmlOptions [ 'options' ] ) ) { $ options = $ this -> htmlOptions [ 'options' ] ; unset ( $ this -> htmlOptions [ 'options' ] ) ; } echo $ this -> getLabel ( ) ; echo '<div class="controls">' ; $ this -> widget ( 'booster.widgets.TbCKEditor' , array ( 'model' => $ this -> model , 'attribute' => $ this -> attribute , 'editorOptions' => isset ( $ options ) ? $ options : array ( ) , 'htmlOptions' => $ this -> htmlOptions ) ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; echo '</div>' ; }
Renders a ckEditor .
53,185
protected function dateRangeField ( ) { if ( isset ( $ this -> htmlOptions [ 'options' ] ) ) { $ options = $ this -> htmlOptions [ 'options' ] ; unset ( $ this -> htmlOptions [ 'options' ] ) ; } if ( isset ( $ options [ 'callback' ] ) ) { $ callback = $ options [ 'callback' ] ; unset ( $ options [ 'callback' ] ) ; } echo $ this -> getLabel ( ) ; echo '<div class="controls">' ; echo $ this -> getPrepend ( ) ; $ this -> widget ( 'booster.widgets.TbDateRangePicker' , array ( 'model' => $ this -> model , 'attribute' => $ this -> attribute , 'options' => isset ( $ options ) ? $ options : array ( ) , 'callback' => isset ( $ callback ) ? $ callback : '' , 'htmlOptions' => $ this -> htmlOptions , ) ) ; echo $ this -> getAppend ( ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; echo '</div>' ; }
Renders a daterange field .
53,186
private function renderExtraRow ( $ beforeRow , $ change , $ columnsInExtra ) { $ data = $ this -> dataProvider -> data [ $ beforeRow ] ; if ( $ this -> extraRowExpression ) { $ content = $ this -> evaluateExpression ( $ this -> extraRowExpression , array ( 'data' => $ data , 'row' => $ beforeRow , 'values' => $ change [ 'columns' ] ) ) ; } else { $ values = array ( ) ; foreach ( $ columnsInExtra as $ c ) { $ values [ ] = $ change [ 'columns' ] [ $ c ] [ 'value' ] ; } $ content = '<strong>' . implode ( ' :: ' , $ values ) . '</strong>' ; } $ colspan = count ( $ this -> columns ) ; echo '<tr class="extrarow">' ; $ this -> extraRowHtmlOptions [ 'colspan' ] = $ colspan ; echo CHtml :: openTag ( 'td' , $ this -> extraRowHtmlOptions ) ; echo $ content ; echo CHtml :: closeTag ( 'td' ) ; echo '</tr>' ; }
renders extra row
53,187
protected function response ( $ data , $ statusCode = 200 , array $ headers = [ ] ) { if ( $ data instanceof Arrayable && ! $ data instanceof JsonSerializable ) { $ data = $ data -> toArray ( ) ; } return new JsonResponse ( $ data , $ statusCode , $ headers ) ; }
Create a json response
53,188
protected function parseData ( $ data , array $ options , $ key = null ) { $ architect = new Architect ( ) ; return $ architect -> parseData ( $ data , $ options [ 'modes' ] , $ key ) ; }
Parse data using architect
53,189
protected function parseIncludes ( array $ includes ) { $ return = [ 'includes' => [ ] , 'modes' => [ ] ] ; foreach ( $ includes as $ include ) { $ explode = explode ( ':' , $ include ) ; if ( ! isset ( $ explode [ 1 ] ) ) { $ explode [ 1 ] = $ this -> defaults [ 'mode' ] ; } $ return [ 'includes' ] [ ] = $ explode [ 0 ] ; $ return [ 'modes' ] [ $ explode [ 0 ] ] = $ explode [ 1 ] ; } return $ return ; }
Parse include strings into resource and modes
53,190
protected function parseResourceOptions ( $ request = null ) { if ( $ request === null ) { $ request = request ( ) ; } $ this -> defaults = array_merge ( [ 'includes' => [ ] , 'sort' => [ ] , 'limit' => null , 'page' => null , 'mode' => 'embed' , 'filter_groups' => [ ] ] , $ this -> defaults ) ; $ includes = $ this -> parseIncludes ( $ request -> get ( 'includes' , $ this -> defaults [ 'includes' ] ) ) ; $ sort = $ this -> parseSort ( $ request -> get ( 'sort' , $ this -> defaults [ 'sort' ] ) ) ; $ limit = $ request -> get ( 'limit' , $ this -> defaults [ 'limit' ] ) ; $ page = $ request -> get ( 'page' , $ this -> defaults [ 'page' ] ) ; $ filter_groups = $ this -> parseFilterGroups ( $ request -> get ( 'filter_groups' , $ this -> defaults [ 'filter_groups' ] ) ) ; if ( $ page !== null && $ limit === null ) { throw new InvalidArgumentException ( 'Cannot use page option without limit option' ) ; } return [ 'includes' => $ includes [ 'includes' ] , 'modes' => $ includes [ 'modes' ] , 'sort' => $ sort , 'limit' => $ limit , 'page' => $ page , 'filter_groups' => $ filter_groups ] ; }
Parse GET parameters into resource options
53,191
protected function applyResourceOptions ( Builder $ queryBuilder , array $ options = [ ] ) { if ( empty ( $ options ) ) { return $ queryBuilder ; } extract ( $ options ) ; if ( isset ( $ includes ) ) { if ( ! is_array ( $ includes ) ) { throw new InvalidArgumentException ( 'Includes should be an array.' ) ; } $ queryBuilder -> with ( $ includes ) ; } if ( isset ( $ filter_groups ) ) { $ filterJoins = $ this -> applyFilterGroups ( $ queryBuilder , $ filter_groups ) ; } if ( isset ( $ sort ) ) { if ( ! is_array ( $ sort ) ) { throw new InvalidArgumentException ( 'Sort should be an array.' ) ; } if ( ! isset ( $ filterJoins ) ) { $ filterJoins = [ ] ; } $ sortingJoins = $ this -> applySorting ( $ queryBuilder , $ sort , $ filterJoins ) ; } if ( isset ( $ limit ) ) { $ queryBuilder -> limit ( $ limit ) ; } if ( isset ( $ page ) ) { if ( ! isset ( $ limit ) ) { throw new InvalidArgumentException ( 'A limit is required when using page.' ) ; } $ queryBuilder -> offset ( $ page * $ limit ) ; } if ( isset ( $ distinct ) ) { $ queryBuilder -> distinct ( ) ; } return $ queryBuilder ; }
Apply resource options to a query builder
53,192
public function serialize ( OpenQuestion $ wordsQuestion , array $ options = [ ] ) { $ serialized = [ ] ; if ( in_array ( Transfer :: INCLUDE_SOLUTIONS , $ options ) ) { $ serialized [ 'solutions' ] = $ this -> serializeSolutions ( $ wordsQuestion , $ options ) ; } return $ serialized ; }
Converts a Words question into a JSON - encodable structure .
53,193
public function deserialize ( $ data , OpenQuestion $ wordsQuestion = null , array $ options = [ ] ) { if ( empty ( $ wordsQuestion ) ) { $ wordsQuestion = new OpenQuestion ( ) ; } $ this -> deserializeSolutions ( $ wordsQuestion , $ data [ 'solutions' ] , $ options ) ; return $ wordsQuestion ; }
Converts raw data into an Words question entity .
53,194
public function parse ( $ text , $ replaceLinks = true ) { $ resources = [ ] ; $ regex = '#[src|href]+="([^"]*file/resource/media/([^\'"]+))"#' ; preg_match_all ( $ regex , $ text , $ matches , PREG_SET_ORDER ) ; if ( count ( $ matches ) > 0 ) { foreach ( $ matches as $ match ) { $ node = $ this -> resourceManager -> getNode ( $ match [ 2 ] ) ; if ( $ node ) { $ resources = $ this -> storeResource ( $ resources , $ node ) ; if ( $ replaceLinks ) { $ text = $ this -> replaceLink ( $ text , $ match [ 1 ] , '../files/file_' . $ match [ 2 ] ) ; } } } } $ regex = '#[src|href]+="([^"]*video-player/api/video/([^\'"]+)/stream)"#' ; preg_match_all ( $ regex , $ text , $ matches , PREG_SET_ORDER ) ; if ( count ( $ matches ) > 0 ) { foreach ( $ matches as $ match ) { $ resource = $ this -> om -> getRepository ( 'ClarolineCoreBundle:Resource\File' ) -> find ( $ match [ 2 ] ) ; if ( $ resource ) { $ node = $ resource -> getResourceNode ( ) ; $ resources = $ this -> storeResource ( $ resources , $ node ) ; if ( $ replaceLinks ) { $ text = $ this -> replaceLink ( $ text , $ match [ 1 ] , '../files/file_' . $ node -> getId ( ) ) ; } } } } $ regex = '#[src|href]+="([^"]*resource/open/([^/]+)/([^\'"]+))"#' ; preg_match_all ( $ regex , $ text , $ matches , PREG_SET_ORDER ) ; if ( count ( $ matches ) > 0 ) { foreach ( $ matches as $ match ) { $ node = $ this -> resourceManager -> getNode ( $ match [ 3 ] ) ; if ( $ node ) { $ resources = $ this -> storeResource ( $ resources , $ node ) ; if ( $ replaceLinks ) { $ text = $ this -> replaceLink ( $ text , $ match [ 1 ] , '../scos/resource_' . $ match [ 3 ] . '.html' ) ; } } } } return [ 'text' => $ text , 'resources' => $ resources , ] ; }
Parses a rich text to extract the resource list .
53,195
public function getNotificationsReadAction ( User $ user ) { $ this -> notificationManager -> markAllNotificationsAsViewed ( $ user -> getId ( ) ) ; return $ this -> notificationManager -> getUserNotifications ( $ user ) ; }
Mark all notifications as read .
53,196
public function load ( $ pluginFqcn , $ pluginPath = null ) { if ( ! $ pluginPath ) { $ rPlugin = new \ ReflectionClass ( $ pluginFqcn ) ; $ pluginPath = $ rPlugin -> getFileName ( ) ; } if ( ! file_exists ( $ pluginPath ) ) { throw new RuntimeException ( "No bundle class file matches the FQCN '{$pluginFqcn}' " . '(expected path was : ' . $ pluginPath . ')' , self :: NO_PLUGIN_FOUND ) ; } return $ this -> getPluginInstance ( $ pluginPath , $ pluginFqcn ) ; }
Searches a plugin bundle by its FQCN and returns an instance of it .
53,197
public function findWithStatus ( ) { $ scales = $ this -> createQueryBuilder ( 's' ) -> select ( 's.id' , 's.name' , 'COUNT(c) AS competencies' ) -> leftJoin ( 's.competencies' , 'c' ) -> groupBy ( 's' ) -> getQuery ( ) -> getArrayResult ( ) ; $ abilityCounts = $ this -> createQueryBuilder ( 's' ) -> select ( 's.id' , 'COUNT (ca) AS abilities' ) -> leftJoin ( 's.levels' , 'l' ) -> leftJoin ( 'l.competencyAbilities' , 'ca' ) -> groupBy ( 's' ) -> getQuery ( ) -> getArrayResult ( ) ; return array_map ( function ( $ element ) use ( $ abilityCounts ) { foreach ( $ abilityCounts as $ counts ) { if ( $ counts [ 'id' ] === $ element [ 'id' ] ) { $ element [ 'abilities' ] = $ counts [ 'abilities' ] ; return $ element ; } } } , $ scales ) ; }
Returns an array representation of registered scales including information about linked frameworks and abilities .
53,198
public function findCompetencyCount ( Scale $ scale ) { return $ this -> createQueryBuilder ( 's' ) -> select ( 'COUNT(c) AS competencies' ) -> leftJoin ( 's.competencies' , 'c' ) -> where ( 's = :scale' ) -> groupBy ( 's' ) -> getQuery ( ) -> setParameter ( ':scale' , $ scale ) -> getSingleScalarResult ( ) ; }
Returns the number of competency frameworks linked to a scale .
53,199
public function indexAction ( $ publicUrl ) { $ this -> checkAccess ( ) ; try { $ user = $ this -> userRepo -> findOneByIdOrPublicUrl ( $ publicUrl ) ; $ evaluations = $ this -> resourceUserEvaluationRepo -> findBy ( [ 'user' => $ user ] , [ 'date' => 'desc' ] ) ; return [ 'user' => $ this -> serializer -> serialize ( $ user ) , 'evaluations' => array_map ( function ( ResourceUserEvaluation $ rue ) { return $ this -> serializer -> serialize ( $ rue ) ; } , $ evaluations ) , ] ; } catch ( NoResultException $ e ) { throw new NotFoundHttpException ( 'Page not found' ) ; } }
Displays a user tracking .