idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
52,300
public function getMemUsage ( $ realmem = FALSE ) { if ( $ this -> isRunning ( ) ) { $ this -> stop ( ) ; $ this -> start ( ) ; } return ( $ realmem !== FALSE ) ? $ this -> data [ "realmem" ] : $ this -> data [ "emalloc" ] ; }
Returns the amount of memory allocated to PHP in bytes .
52,301
protected function init ( $ ftkey ) { if ( strlen ( $ ftkey ) != 32 && strlen ( $ ftkey ) != 16 ) { throw new TeamSpeak3_Adapter_FileTransfer_Exception ( "invalid file transfer key format" ) ; } $ this -> getProfiler ( ) -> start ( ) ; $ this -> getTransport ( ) -> send ( $ ftkey ) ; TeamSpeak3_Helper_Signal :: getInst...
Sends a valid file transfer key to the server to initialize the file transfer .
52,302
public function upload ( $ ftkey , $ seek , $ data ) { $ this -> init ( $ ftkey ) ; $ size = strlen ( $ data ) ; $ seek = intval ( $ seek ) ; $ pack = 4096 ; TeamSpeak3_Helper_Signal :: getInstance ( ) -> emit ( "filetransferUploadStarted" , $ ftkey , $ seek , $ size ) ; for ( ; $ seek < $ size ; ) { $ rest = $ size - ...
Sends the content of a file to the server .
52,303
public function download ( $ ftkey , $ size , $ passthru = FALSE ) { $ this -> init ( $ ftkey ) ; if ( $ passthru ) { return $ this -> passthru ( $ size ) ; } $ buff = new TeamSpeak3_Helper_String ( "" ) ; $ size = intval ( $ size ) ; $ pack = 4096 ; TeamSpeak3_Helper_Signal :: getInstance ( ) -> emit ( "filetransferDo...
Returns the content of a downloaded file as a TeamSpeak3_Helper_String object .
52,304
protected function initTransport ( $ options , $ transport = "TeamSpeak3_Transport_TCP" ) { if ( ! is_array ( $ options ) ) { throw new TeamSpeak3_Adapter_Exception ( "transport parameters must provided in an array" ) ; } $ this -> transport = new $ transport ( $ options ) ; }
Loads the transport object object used for the connection adapter and passes a given set of options .
52,305
public function fetchObject ( TeamSpeak3_Node_Abstract $ node , array $ siblings = array ( ) ) { $ this -> currObj = $ node ; $ this -> currSib = $ siblings ; $ obj = new stdClass ( ) ; $ obj -> ident = $ this -> getId ( ) ; $ obj -> parent = $ this -> getParent ( ) ; $ obj -> children = $ node -> count ( ) ; $ obj -> ...
Assembles an stdClass object for the current element .
52,306
public function copy ( $ name = null , $ tsgid = 0 , $ type = TeamSpeak3 :: GROUP_DBTYPE_REGULAR ) { return $ this -> getParent ( ) -> serverGroupCopy ( $ this -> getId ( ) , $ name , $ tsgid , $ type ) ; }
Creates a copy of the server group and returns the new groups ID .
52,307
public function subChannelList ( array $ filter = array ( ) ) { $ channels = array ( ) ; foreach ( $ this -> getParent ( ) -> channelList ( ) as $ channel ) { if ( $ channel [ "pid" ] == $ this -> getId ( ) ) { $ channels [ $ channel -> getId ( ) ] = $ channel ; } } return $ this -> filterList ( $ channels , $ filter )...
Returns an array filled with TeamSpeak3_Node_Channel objects .
52,308
public function clientList ( array $ filter = array ( ) ) { $ clients = array ( ) ; foreach ( $ this -> getParent ( ) -> clientList ( ) as $ client ) { if ( $ client [ "cid" ] == $ this -> getId ( ) ) { $ clients [ $ client -> getId ( ) ] = $ client ; } } return $ this -> filterList ( $ clients , $ filter ) ; }
Returns an array filled with TeamSpeak3_Node_Client objects .
52,309
public function clientGetById ( $ clid ) { if ( ! array_key_exists ( $ clid , $ this -> clientList ( ) ) ) { throw new TeamSpeak3_Adapter_ServerQuery_Exception ( "invalid clientID" , 0x200 ) ; } return $ this -> clientList [ intval ( $ clid ) ] ; }
Returns the TeamSpeak3_Node_Client object matching the given ID .
52,310
public function clientPermList ( $ cldbid , $ permsid = FALSE ) { return $ this -> getParent ( ) -> channelClientPermList ( $ this -> getId ( ) , $ cldbid , $ permsid ) ; }
Returns a list of permissions defined for a client in the channel .
52,311
public function clientPermAssign ( $ cldbid , $ permid , $ permvalue ) { $ this -> getParent ( ) -> channelClientPermAssign ( $ this -> getId ( ) , $ cldbid , $ permid , $ permvalue ) ; }
Adds a set of specified permissions to a client in a specific channel . Multiple permissions can be added by providing the two parameters of each permission .
52,312
public function fileInfo ( $ cpw = "" , $ name = "/" ) { return $ this -> getParent ( ) -> channelFileInfo ( $ this -> getId ( ) , $ cpw , $ name ) ; }
Returns detailed information about the specified file stored in the channels file repository .
52,313
public function toLines ( ) { if ( ! count ( $ this -> rpl ) ) return array ( ) ; $ list = $ this -> toString ( 0 ) -> split ( TeamSpeak3 :: SEPARATOR_LIST ) ; if ( ! func_num_args ( ) ) { for ( $ i = 0 ; $ i < count ( $ list ) ; $ i ++ ) $ list [ $ i ] -> unescape ( ) ; } return $ list ; }
Returns the reply as a standard PHP array where each element represents one item .
52,314
public function toTable ( ) { $ table = array ( ) ; foreach ( $ this -> toLines ( 0 ) as $ cells ) { $ pairs = $ cells -> split ( TeamSpeak3 :: SEPARATOR_CELL ) ; if ( ! func_num_args ( ) ) { for ( $ i = 0 ; $ i < count ( $ pairs ) ; $ i ++ ) $ pairs [ $ i ] -> unescape ( ) ; } $ table [ ] = $ pairs ; } return $ table ...
Returns the reply as a standard PHP array where each element represents one item in table format .
52,315
public function toObjectArray ( ) { $ array = ( func_num_args ( ) > 1 ) ? $ this -> toArray ( 1 ) : $ this -> toArray ( ) ; for ( $ i = 0 ; $ i < count ( $ array ) ; $ i ++ ) { $ array [ $ i ] = ( object ) $ array [ $ i ] ; } return $ array ; }
Returns an array containing stdClass objects .
52,316
public function getErrorProperty ( $ ident , $ default = null ) { return ( array_key_exists ( $ ident , $ this -> err ) ) ? $ this -> err [ $ ident ] : $ default ; }
Returns the value for a specified error property .
52,317
public static function version ( $ version , $ format = "Y-m-d h:i:s" ) { if ( ! $ version instanceof TeamSpeak3_Helper_String ) { $ version = new TeamSpeak3_Helper_String ( $ version ) ; } $ buildno = $ version -> section ( "[" , 1 ) -> filterDigits ( ) -> toInt ( ) ; return ( $ buildno <= 15001 ) ? $ version : $ vers...
Returns a client - like formatted version of the TeamSpeak 3 version string .
52,318
protected function getPrefix ( ) { $ prefix = "" ; if ( count ( $ this -> currSib ) ) { $ last = array_pop ( $ this -> currSib ) ; foreach ( $ this -> currSib as $ sibling ) { $ prefix .= ( $ sibling ) ? $ this -> getImage ( "tree_line.gif" ) : $ this -> getImage ( "tree_blank.png" ) ; } $ prefix .= ( $ last ) ? $ this...
Returns the HTML img tags to display the prefix of the current node .
52,319
protected function getSuffixFlag ( ) { if ( ! $ this -> currObj instanceof TeamSpeak3_Node_Client ) return ; if ( $ this -> flagpath && $ this -> currObj [ "client_country" ] ) { return $ this -> getImage ( $ this -> currObj [ "client_country" ] -> toLower ( ) . ".png" , $ this -> currObj [ "client_country" ] , null , ...
Returns a HTML img tag which can be used to display the country flag for a TeamSpeak_Node_Client object .
52,320
protected function getImage ( $ name , $ text = "" , $ class = null , $ iconpath = TRUE , $ flagpath = FALSE ) { $ src = "" ; if ( $ iconpath ) { $ src = $ this -> iconpath ; } if ( $ flagpath ) { $ src = $ this -> flagpath ; } return "<img src='" . $ src . $ name . "' title='" . $ text . "' alt='' align='top' />" ; }
Returns the code to display a custom HTML img tag .
52,321
public function encrypt ( $ string ) { $ string = trim ( $ string ) ; $ encryp = "" ; $ length = strlen ( $ string ) ; $ string .= str_repeat ( chr ( 0 ) , ( 8 - ( $ length % 8 ) ) % 8 ) ; for ( $ i = 0 ; $ i < $ length ; $ i += 8 ) { list ( , $ xl , $ xr ) = unpack ( "N2" , substr ( $ string , $ i , 8 ) ) ; $ this -> ...
Encrypts a given string .
52,322
public function decrypt ( $ string ) { $ string = base64_decode ( $ string ) ; $ decryp = "" ; $ length = strlen ( $ string ) ; $ string .= str_repeat ( chr ( 0 ) , ( 8 - ( $ length % 8 ) ) % 8 ) ; for ( $ i = 0 ; $ i < $ length ; $ i += 8 ) { list ( , $ xl , $ xr ) = unpack ( "N2" , substr ( $ string , $ i , 8 ) ) ; $...
Decrypts a given string .
52,323
protected function encipher ( & $ xl , & $ xr ) { for ( $ i = 0 ; $ i < 16 ; $ i ++ ) { $ temp = $ xl ^ $ this -> p [ $ i ] ; $ xl = ( ( ( $ this -> s [ 0 ] [ ( $ temp >> 24 ) & 255 ] + $ this -> s [ 1 ] [ ( $ temp >> 16 ) & 255 ] ) ^ $ this -> s [ 2 ] [ ( $ temp >> 8 ) & 255 ] ) + $ this -> s [ 3 ] [ $ temp & 255 ] ) ...
Enciphers a single 64 - bit block .
52,324
protected function decipher ( & $ xl , & $ xr ) { for ( $ i = 17 ; $ i > 1 ; $ i -- ) { $ temp = $ xl ^ $ this -> p [ $ i ] ; $ xl = ( ( ( $ this -> s [ 0 ] [ ( $ temp >> 24 ) & 255 ] + $ this -> s [ 1 ] [ ( $ temp >> 16 ) & 255 ] ) ^ $ this -> s [ 2 ] [ ( $ temp >> 8 ) & 255 ] ) + $ this -> s [ 3 ] [ $ temp & 255 ] ) ...
Deciphers a single 64 - bit block
52,325
public function version ( $ ident = null ) { if ( $ this -> version === null ) { $ this -> version = $ this -> request ( "version" ) -> toList ( ) ; } return ( $ ident && isset ( $ this -> version [ $ ident ] ) ) ? $ this -> version [ $ ident ] : $ this -> version ; }
Returns the servers version information including platform and build number .
52,326
public function serverGetByName ( $ name ) { foreach ( $ this -> serverList ( ) as $ server ) { if ( $ server [ "virtualserver_name" ] == $ name ) return $ server ; } throw new TeamSpeak3_Adapter_ServerQuery_Exception ( "invalid serverID" , 0x400 ) ; }
Returns the first TeamSpeak3_Node_Server object matching the given name .
52,327
public function serverGetByUid ( $ uid ) { foreach ( $ this -> serverList ( ) as $ server ) { if ( $ server [ "virtualserver_unique_identifier" ] == $ uid ) return $ server ; } throw new TeamSpeak3_Adapter_ServerQuery_Exception ( "invalid serverID" , 0x400 ) ; }
Returns the first TeamSpeak3_Node_Server object matching the given unique identifier .
52,328
public function serverCreate ( array $ properties = array ( ) ) { $ this -> serverListReset ( ) ; $ detail = $ this -> execute ( "servercreate" , $ properties ) -> toList ( ) ; $ server = new TeamSpeak3_Node_Server ( $ this , array ( "virtualserver_id" => intval ( $ detail [ "sid" ] ) ) ) ; TeamSpeak3_Helper_Signal :: ...
Creates a new virtual server using given properties and returns an assoc array containing the new ID and initial admin token .
52,329
public function serverList ( array $ filter = array ( ) ) { if ( $ this -> serverList === null ) { $ servers = $ this -> request ( "serverlist -uid" ) -> toAssocArray ( "virtualserver_id" ) ; $ this -> serverList = array ( ) ; foreach ( $ servers as $ sid => $ server ) { $ this -> serverList [ $ sid ] = new TeamSpeak3_...
Returns an array filled with TeamSpeak3_Node_Server objects .
52,330
public function permissionTree ( ) { $ permtree = array ( ) ; foreach ( $ this -> permissionCats ( ) as $ key => $ val ) { $ permtree [ $ val ] [ "permcatid" ] = $ val ; $ permtree [ $ val ] [ "permcathex" ] = "0x" . dechex ( $ val ) ; $ permtree [ $ val ] [ "permcatname" ] = TeamSpeak3_Helper_String :: factory ( TeamS...
Returns an array filled with all permission categories known to the server including their ID name and parent .
52,331
public function permissionFind ( $ permid ) { if ( ! is_array ( $ permid ) ) { $ permident = ( is_numeric ( $ permid ) ) ? "permid" : "permsid" ; } else { $ permident = ( is_numeric ( current ( $ permid ) ) ) ? "permid" : "permsid" ; } return $ this -> execute ( "permfind" , array ( $ permident => $ permid ) ) -> toArr...
Returns the IDs of all clients channels or groups using the permission with the specified ID .
52,332
public function permissionGetCategoryById ( $ permid ) { if ( ! is_numeric ( $ permid ) ) { $ permid = $ this -> permissionGetIdByName ( $ permid ) ; } if ( $ permid < 0x1000 ) { if ( $ this -> permissionEnds === null ) { $ this -> fetchPermissionList ( ) ; } if ( $ this -> permissionCats === null ) { $ this -> fetchPe...
Returns the internal category of the permission matching the given ID .
52,333
public function selfPermCheck ( $ permid ) { if ( ! is_array ( $ permid ) ) { $ permident = ( is_numeric ( $ permid ) ) ? "permid" : "permsid" ; } else { $ permident = ( is_numeric ( current ( $ permid ) ) ) ? "permid" : "permsid" ; } return $ this -> execute ( "permget" , array ( $ permident => $ permid ) ) -> toAssoc...
Returns an array containing the value of a specified permission for your own client .
52,334
public function logAdd ( $ logmsg , $ loglevel = TeamSpeak3 :: LOGLEVEL_INFO ) { $ sid = $ this -> serverSelectedId ( ) ; $ this -> serverDeselect ( ) ; $ this -> execute ( "logadd" , array ( "logmsg" => $ logmsg , "loglevel" => $ loglevel ) ) ; $ this -> serverSelect ( $ sid ) ; }
Writes a custom entry into the server instance log .
52,335
public function login ( $ username , $ password ) { $ this -> execute ( "login" , array ( "client_login_name" => $ username , "client_login_password" => $ password ) ) ; $ this -> whoamiReset ( ) ; $ crypt = new TeamSpeak3_Helper_Crypt ( $ username ) ; $ this -> setStorage ( "_login_user" , $ username ) ; $ this -> set...
Authenticates with the TeamSpeak 3 Server instance using given ServerQuery login credentials .
52,336
public function logout ( ) { $ this -> request ( "logout" ) ; $ this -> whoamiReset ( ) ; $ this -> delStorage ( "_login_user" ) ; $ this -> delStorage ( "_login_pass" ) ; TeamSpeak3_Helper_Signal :: getInstance ( ) -> emit ( "notifyLogout" , $ this ) ; }
Deselects the active virtual server and logs out from the server instance .
52,337
public function whoami ( ) { if ( $ this -> whoami === null ) { $ this -> whoami = $ this -> request ( "whoami" ) -> toList ( ) ; } return $ this -> whoami ; }
Returns information about your current ServerQuery connection .
52,338
public function whoamiGet ( $ ident , $ default = null ) { if ( array_key_exists ( $ ident , $ this -> whoami ( ) ) ) { return $ this -> whoami [ $ ident ] ; } return $ default ; }
Returns a single value from the current ServerQuery connection info .
52,339
public function whoamiSet ( $ ident , $ value = null ) { $ this -> whoami ( ) ; $ this -> whoami [ $ ident ] = ( is_numeric ( $ value ) ) ? ( int ) $ value : TeamSpeak3_Helper_String :: factory ( $ value ) ; }
Sets a single value in the current ServerQuery connection info .
52,340
public function copy ( $ name = null , $ tcgid = 0 , $ type = TeamSpeak3 :: GROUP_DBTYPE_REGULAR ) { return $ this -> getParent ( ) -> channelGroupCopy ( $ this -> getId ( ) , $ name , $ tcgid , $ type ) ; }
Creates a copy of the channel group and returns the new groups ID .
52,341
public function permAssign ( $ permid , $ permvalue ) { $ this -> getParent ( ) -> channelGroupPermAssign ( $ this -> getId ( ) , $ permid , $ permvalue ) ; }
Adds a set of specified permissions to the channel group . Multiple permissions can be added by providing the two parameters of each permission in separate arrays .
52,342
public function clientList ( $ cid = null , $ cldbid = null , $ resolve = FALSE ) { return $ this -> getParent ( ) -> channelGroupClientList ( $ this -> getId ( ) , $ cid , $ cldbid , $ resolve ) ; }
Returns a list of clients assigned to the channel group specified .
52,343
public function getHost ( ) { if ( $ this -> host === null ) { $ this -> host = new TeamSpeak3_Node_Host ( $ this ) ; } return $ this -> host ; }
Returns the TeamSpeak3_Node_Host object of the current connection .
52,344
protected function prepareCustomMessage ( TeamSpeak3_Helper_String $ mesg ) { $ args = array ( "code" => $ this -> getCode ( ) , "mesg" => $ this -> getMessage ( ) , "line" => $ this -> getLine ( ) , "file" => $ this -> getFile ( ) , ) ; return $ mesg -> arg ( $ args ) -> toString ( ) ; }
Prepares a custom error message by replacing pre - defined signs with given values .
52,345
public function link ( FieldConfig $ column , $ direction ) { return ( new GridInputProcessor ( $ this -> grid ) ) -> setSorting ( $ column , $ direction ) -> getUrl ( ) ; }
Returns URL for sorting control .
52,346
public function apply ( ) { $ input = $ this -> grid -> getInputProcessor ( ) -> getInput ( ) ; $ sort = null ; if ( isset ( $ input [ 'sort' ] ) ) { foreach ( $ input [ 'sort' ] as $ field => $ direction ) { $ sort = [ $ field , $ direction ] ; break ; } } foreach ( $ this -> grid -> getConfig ( ) -> getColumns ( ) as...
Applies sorting to data provider .
52,347
protected function renderCells ( ) { $ row = $ this -> getDataRow ( ) ; $ out = '' ; foreach ( $ this -> grid -> getConfig ( ) -> getColumns ( ) as $ column ) { $ component = new TableCell ( $ column ) ; $ component -> initialize ( $ this -> grid ) ; $ component -> setContent ( $ column -> getValue ( $ row ) ) ; $ out ...
Renders row cells .
52,348
public function getInputName ( ) { $ key = $ this -> grid -> getInputProcessor ( ) -> getKey ( ) ; $ name = $ this -> config -> getId ( ) ; return "{$key}[filters][{$name}]" ; }
Returns input name for the filter .
52,349
public function getValue ( ) { $ from_input = $ this -> grid -> getInputProcessor ( ) -> getFilterValue ( $ this -> config -> getId ( ) ) ; if ( $ from_input === null ) { return $ this -> config -> getDefaultValue ( ) ; } else { return $ from_input ; } }
Returns filters value .
52,350
public function render ( ) { $ data = $ this -> grid -> getViewData ( ) ; $ data [ 'column' ] = $ this -> column ; $ data [ 'filter' ] = $ this ; $ data [ 'label' ] = $ this -> config -> getLabel ( ) ; return View :: make ( $ this -> getTemplate ( ) , $ data ) -> render ( ) ; }
Renders filtering control .
52,351
protected function getTemplate ( ) { $ filter_tpl = $ this -> config -> getTemplate ( ) ; $ grid_tpl = $ this -> grid -> getConfig ( ) -> getTemplate ( ) ; return str_replace ( '*.' , "$grid_tpl.filters." , $ filter_tpl ) ; }
Returns name of template for filtering control .
52,352
public function apply ( ) { $ value = $ this -> getValue ( ) ; if ( null === $ value || '' === $ value ) { return ; } if ( $ func = $ this -> config -> getFilteringFunc ( ) ) { $ func ( $ value , $ this -> grid -> getConfig ( ) -> getDataProvider ( ) ) ; return ; } $ isLike = $ this -> config -> getOperator ( ) === Fil...
Applies filtering to data source .
52,353
protected function provideName ( ) { $ bt_len = 10 ; $ backtrace = debug_backtrace ( null , $ bt_len ) ; $ str = '' ; for ( $ id = 2 ; $ id < $ bt_len ; $ id ++ ) { $ trace = isset ( $ backtrace [ $ id ] ) ? $ backtrace [ $ id ] : [ ] ; if ( empty ( $ trace [ 'class' ] ) || ! $ this instanceof $ trace [ 'class' ] ) { i...
Provides unique name for each grid on the page
52,354
protected function needToSortColumns ( ) { foreach ( $ this -> config -> getColumns ( ) as $ column ) { if ( $ column -> getOrder ( ) !== 0 ) { return true ; } } return false ; }
Returns true if columns must be sorted .
52,355
protected function sortColumns ( ) { $ this -> config -> getColumns ( ) -> sort ( function ( FieldConfig $ a , FieldConfig $ b ) { return $ a -> getOrder ( ) > $ b -> getOrder ( ) ; } ) ; }
Sorts columns according to its order .
52,356
public function getSorter ( ) { if ( null === $ this -> sorter ) { $ this -> sorter = new Sorter ( $ this ) ; } return $ this -> sorter ; }
Returns data sorting manager .
52,357
public function getInputProcessor ( ) { if ( null === $ this -> input_processor ) { $ this -> input_processor = new GridInputProcessor ( $ this ) ; } return $ this -> input_processor ; }
Returns instance of GridInputProcessor .
52,358
public function render ( ) { $ key = $ this -> getInputProcessor ( ) -> getUniqueRequestId ( ) ; $ caching_time = $ this -> config -> getCachingTime ( ) ; if ( $ caching_time && ( $ output = Cache :: get ( $ key ) ) ) { return $ output ; } else { $ this -> prepare ( ) ; $ provider = $ this -> config -> getDataProvider ...
Renders grid .
52,359
public function getFiltering ( ) { if ( $ this -> filtering === null ) { $ this -> filtering = new Filtering ( $ this ) ; } return $ this -> filtering ; }
Returns data filtering manager .
52,360
public function getColumn ( $ name ) { foreach ( $ this -> getColumns ( ) as $ column ) { if ( $ column -> getName ( ) === $ name ) { return $ column ; } } }
Returns column by name .
52,361
public function addColumn ( FieldConfig $ column ) { if ( $ this -> columns === null ) { $ this -> setColumns ( [ ] ) ; } $ this -> columns -> push ( $ column ) ; return $ this ; }
Adds column to grid .
52,362
private function suggestTagName ( ) { $ class_name = get_class ( $ this ) ; $ parts = explode ( '\\' , $ class_name ) ; $ base_name = array_pop ( $ parts ) ; return ( $ base_name === 'HtmlTag' ) ? 'div' : strtolower ( $ base_name ) ; }
Suggests tag name by class name .
52,363
protected function createFilters ( ) { $ filters = [ ] ; foreach ( $ this -> grid -> getConfig ( ) -> getColumns ( ) as $ column ) { if ( $ column -> hasFilters ( ) ) { foreach ( $ column -> getFilters ( ) as $ filterConfig ) { $ filters [ $ filterConfig -> getId ( ) ] = new Filter ( $ filterConfig , $ column , $ this ...
Creates filter objects .
52,364
public function getFilter ( $ idOrConfig ) { if ( $ idOrConfig instanceof FilterConfig ) { $ idOrConfig = $ idOrConfig -> getId ( ) ; } return $ this -> getFilters ( ) [ $ idOrConfig ] ; }
Returns filter instance .
52,365
public function setMultipleMode ( $ multipleMode ) { $ this -> multipleMode = $ multipleMode ; if ( $ multipleMode ) { $ this -> operator = FilterConfig :: OPERATOR_IN ; } return $ this ; }
Enabled multiple mode . This will switch the selected operator to IN as any other operator does not work with multiple selections .
52,366
public function setFilters ( $ filters ) { $ this -> filters = Collection :: make ( $ filters ) ; foreach ( $ this -> filters as $ filterConfig ) { $ filterConfig -> attach ( $ this ) ; } return $ this ; }
Allows to specify filtering controls for column .
52,367
public function addFilter ( FilterConfig $ filter ) { $ this -> getFilters ( ) -> push ( $ filter ) ; $ filter -> attach ( $ this ) ; return $ this ; }
Allows to add filtering control to column .
52,368
public function getComponentByName ( $ name ) { foreach ( $ this -> getComponents ( ) as $ component ) { if ( $ component -> getName ( ) === $ name ) { return $ component ; } } }
Finds child component by name .
52,369
public function getComponentByNameRecursive ( $ name ) { foreach ( $ this -> getComponents ( ) as $ component ) { if ( $ component -> getName ( ) === $ name ) { return $ component ; } if ( $ component instanceof TRegistry || $ component instanceof RegistryInterface ) { if ( $ res = $ component -> getComponentByNameRecu...
Finds child component by name recursively .
52,370
public function addComponent ( ComponentInterface $ component ) { $ this -> getComponents ( ) -> push ( $ component ) ; $ component -> attachTo ( $ this ) ; return $ this ; }
Adds component to the collection of child components .
52,371
public function setComponents ( $ components ) { $ this -> components = Collection :: make ( $ components ) ; foreach ( $ components as $ component ) { $ component -> attachTo ( $ this ) ; } return $ this ; }
Allows to specify collection of child components .
52,372
public function initializeComponents ( Grid $ grid ) { foreach ( $ this -> getComponents ( ) as $ component ) { $ component -> initialize ( $ grid ) ; } }
Initializes child components .
52,373
public function getCellValue ( $ field ) { $ fieldName = $ field instanceof FieldConfig ? $ field -> getName ( ) : $ field ; return $ this -> extractCellValue ( $ fieldName ) ; }
Returns value of specified column from row .
52,374
public function render ( ) { $ this -> is_rendered = true ; return View :: make ( $ this -> getTemplate ( ) , $ this -> getViewData ( ) ) -> render ( ) ; }
Renders object .
52,375
public function getUniqueRequestId ( ) { $ cookies_str = '' ; foreach ( $ _COOKIE as $ key => $ val ) { if ( strpos ( $ key , $ this -> getKey ( ) ) !== false ) { $ cookies_str .= $ key . json_encode ( $ val ) ; } } return md5 ( $ cookies_str . $ this -> getKey ( ) . json_encode ( $ this -> getInput ( ) ) ) ; }
Returns UID for current grid state .
52,376
public function getFilterValue ( $ filterName ) { if ( isset ( $ this -> input [ 'filters' ] [ $ filterName ] ) ) { return $ this -> input [ 'filters' ] [ $ filterName ] ; } else { return null ; } }
Returns input value for filter .
52,377
public function getQueryString ( array $ new_params = [ ] ) { $ params = $ _GET ; if ( ! empty ( $ this -> input ) ) { $ params [ $ this -> getKey ( ) ] = $ this -> input ; } if ( ! empty ( $ new_params ) ) { if ( empty ( $ params [ $ this -> getKey ( ) ] ) ) { $ params [ $ this -> getKey ( ) ] = [ ] ; } foreach ( $ ne...
Returns current query string extended by specified GET parameters .
52,378
public function getUrl ( array $ new_params = [ ] ) { if ( null !== $ query_string = $ this -> getQueryString ( $ new_params ) ) { $ query_string = '?' . $ query_string ; } $ request = Request :: instance ( ) ; return $ request -> getSchemeAndHttpHost ( ) . $ request -> getBaseUrl ( ) . $ request -> getPathInfo ( ) . $...
Returns current URL extended by specified GET parameters .
52,379
public function getValue ( ) { $ from_input = $ this -> grid -> getInputProcessor ( ) -> getFilterValue ( $ this -> name ) ; if ( $ from_input === null ) { return $ this -> getDefaultValue ( ) ; } else { return $ from_input ; } }
Returns filter value from input or default if there is no input .
52,380
public function run ( ) { $ this -> blueprints = Env :: instance ( ) -> blueprints ( ) ; $ this -> blueprints -> add ( $ this -> makeFilterBlueprint ( ) ) -> add ( $ this -> makeFieldBlueprint ( ) ) -> add ( $ this -> makeComponentBlueprint ( ) ) -> add ( $ config_blueprint = $ this -> makeConfigBlueprint ( ) ) ; retur...
Creates blueprints required to construct grids from configuration .
52,381
protected function makeConfigBlueprint ( ) { $ component_blueprint = $ this -> blueprints -> getFor ( self :: COMPONENT_CLASS ) ; if ( ! $ component_blueprint ) { throw new LogicException ( 'Blueprint for grid components must be created before main blueprint.' ) ; } $ column_blueprint = $ this -> blueprints -> getFor (...
Creates main blueprint of grid configuration .
52,382
protected function makeComponentBlueprint ( ) { $ blueprint = new Blueprint ( self :: COMPONENT_CLASS , [ new CustomInstruction ( function ( Scaffold $ s ) { if ( $ s -> input instanceof Closure ) { $ s -> class = 'Nayjest\Grids\Components\RenderFunc' ; $ s -> constructor_arguments = [ $ s -> input ] ; $ s -> input = [...
Creates blueprint for grid components .
52,383
protected function makeFilterBlueprint ( ) { return new Blueprint ( self :: FILTER_CLASS , [ new SimpleValueAsField ( 'name' ) , new CustomMapping ( 'type' , function ( $ type , Scaffold $ s ) { switch ( $ type ) { case 'select' : $ s -> class = 'Nayjest\Grids\SelectFilterConfig' ; break ; default : break ; } } , null ...
Creates blueprint for filters .
52,384
protected function makeFieldBlueprint ( ) { $ filter_blueprint = $ this -> blueprints -> getFor ( self :: FILTER_CLASS ) ; if ( ! $ filter_blueprint ) { throw new LogicException ( 'Blueprint for grid filters must be created before grid columns blueprint.' ) ; } return new Blueprint ( self :: COLUMN_CLASS , [ new Simple...
Creates blueprint for grid columns .
52,385
protected function createHeaders ( Grid $ grid ) { foreach ( $ grid -> getConfig ( ) -> getColumns ( ) as $ column ) { $ this -> addComponent ( new ColumnHeader ( $ column ) ) ; } }
Creates children components for rendering column headers .
52,386
protected function links ( ) { $ paginator = $ this -> grid -> getConfig ( ) -> getDataProvider ( ) -> getPaginator ( ) ; $ input = $ this -> grid -> getInputProcessor ( ) -> getInput ( ) ; if ( isset ( $ input [ 'page' ] ) ) { unset ( $ input [ 'page' ] ) ; } return str_replace ( '/?' , '?' , $ paginator -> appends ( ...
Renders pagination links & returns rendered html .
52,387
public function renderComponents ( $ sectionName = null ) { $ output = '' ; $ components = $ this -> getSectionComponents ( $ sectionName ) ; foreach ( $ components as $ component ) { $ output .= $ component -> render ( ) ; } return $ output ; }
Renders components related to specified section .
52,388
public function getSectionComponents ( $ sectionName ) { return $ this -> getComponents ( ) -> filter ( function ( ComponentInterface $ component ) use ( $ sectionName ) { return $ component instanceof RenderableComponentInterface && $ component -> getRenderSection ( ) === $ sectionName ; } ) ; }
Returns components filtered by section name .
52,389
protected function renderInnerComponents ( ) { return $ this -> renderComponents ( self :: SECTION_BEGIN ) . $ this -> renderComponents ( ) . $ this -> renderComponents ( self :: SECTION_END ) ; }
Renders inner components .
52,390
protected function listen ( DataProvider $ provider ) { Event :: listen ( DataProvider :: EVENT_FETCH_ROW , function ( DataRow $ row , DataProvider $ currentProvider ) use ( $ provider ) { if ( $ currentProvider !== $ provider ) return ; $ this -> rows_processed ++ ; foreach ( $ this -> fields as $ field ) { $ name = $...
Creates listener for grid . dp . fetch_row event .
52,391
public function initialize ( Grid $ grid ) { $ this -> initializeComponent ( $ grid ) ; $ this -> provideFields ( ) ; $ this -> listen ( $ this -> grid -> getConfig ( ) -> getDataProvider ( ) ) ; return null ; }
Performs component initialization .
52,392
public function uses ( FieldConfig $ field ) { return in_array ( $ field , $ this -> fields -> toArray ( ) ) || $ field instanceof IdFieldConfig ; }
Returns true if the component uses specified column for totals calculation .
52,393
public function setFieldNames ( array $ fieldNames ) { $ this -> field_names = $ fieldNames ; $ this -> src = [ ] ; foreach ( $ this -> field_names as $ name ) { $ this -> src [ $ name ] = 0 ; } return $ this ; }
Allows to specify list of fields which will be used for totals calculation .
52,394
protected function hasValue ( ) { list ( $ start , $ end ) = $ this -> getValue ( ) ; return $ start !== null && $ start !== '' && $ end !== null && $ end !== '' ; }
Returns true if non - empty value specified for the filter .
52,395
protected function getDefaultJsOptions ( ) { $ carbon = new Carbon ( ) ; $ prev_month = Carbon :: now ( ) -> startOfMonth ( ) -> subWeek ( ) ; $ today = Carbon :: now ( ) ; $ res = [ 'format' => 'YYYY-MM-DD' , 'ranges' => [ 'previous_month' => [ 'Previous month (' . $ prev_month -> format ( 'F' ) . ')' , [ $ prev_month...
Returns default javascript options
52,396
public function getValue ( ) { $ from_input = $ this -> grid -> getInputProcessor ( ) -> getFilterValue ( 'records_per_page' ) ; if ( $ from_input === null ) { return $ this -> grid -> getConfig ( ) -> getPageSize ( ) ; } else { return ( int ) $ from_input ; } }
Returns current value from input . Default grids pre - configured page size will be returned if there is no input .
52,397
public function initialize ( Grid $ grid ) { $ this -> grid = $ grid ; if ( method_exists ( $ this , 'initializeComponents' ) ) { $ this -> initializeComponents ( $ grid ) ; } }
Initializes component with grid .
52,398
protected static function getBuilder ( ) { if ( self :: $ builder === null ) { $ setup = new Setup ( ) ; self :: $ builder = $ setup -> run ( ) ; } return self :: $ builder ; }
Returns builder instance .
52,399
public static function make ( array $ config ) { $ builder = self :: getBuilder ( ) ; $ configObject = $ builder -> build ( $ config ) ; $ grid = new Grid ( $ configObject ) ; return $ grid ; }
Creates grid using configuration .