idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
45,500
protected function formatOption ( $ name , $ value , $ label ) { return '<option value="' . $ value . '"' . ( isset ( $ this -> filters [ $ name ] ) && strpos ( $ this -> filters [ $ name ] , $ value ) === 0 ? ' selected' : '' ) . '>' . ( isset ( $ label ) ? $ label : $ value ) . '</option>' ; }
Render option for select
45,501
public function setFrom ( $ table , $ alias = null ) { $ this -> table = $ table ; $ this -> aliasTable = $ alias === null ? $ table : $ alias ; return $ this ; }
Set the mysql table to request
45,502
public function setJoin ( $ table , $ on , $ join = 'LEFT JOIN' , $ duplicate = false ) { $ this -> join [ ] = $ join . ' ' . $ table . ' ON ' . Helper :: formatOn ( $ on ) ; if ( $ duplicate !== false ) { $ this -> patchDuplicateRow [ 'pKey' ] = $ duplicate [ 0 ] ; if ( is_array ( $ duplicate [ 1 ] ) ) { $ this -> pat...
Join data from other tables
45,503
public function setGroupBy ( $ column ) { $ this -> groupBy = ( isset ( $ this -> groupBy ) ? $ this -> groupBy . ',' : '' ) . $ column ; return $ this ; }
Group by a SQL column
45,504
protected function initFilters ( ) { $ initColumnSearch = $ this -> initColumnSearch ; foreach ( $ this -> columns as $ c ) { if ( isset ( $ c [ 'sqlFilter' ] ) ) { $ where_condition = $ this -> generateSQLColumnFilter ( $ this -> toSQLColumn ( $ c , 2 ) , $ c [ 'sqlFilter' ] ) ; if ( ! $ this -> setHaving ( $ where_co...
SQL Rendering for the initial filters set
45,505
public function globalFilter ( ) { $ globalSearch = [ ] ; if ( isset ( $ this -> request [ 'search' ] ) && ! empty ( $ this -> request [ 'search' ] [ 'value' ] ) ) { for ( $ i = 0 , $ ien = count ( $ this -> request [ 'columns' ] ) ; $ i < $ ien ; $ i ++ ) { if ( self :: isSearchable ( $ this -> columns [ $ i ] ) ) { $...
SQL Rendering for the global search
45,506
protected function individualColumnFilters ( ) { $ columnSearch = [ ] ; if ( isset ( $ this -> individualColumnFiltering ) ) { $ this -> sRangeSeparator = isset ( $ this -> sRangeSeparator ) ? $ this -> sRangeSeparator : '~' ; for ( $ i = 0 , $ ien = count ( $ this -> columns ) ; $ i < $ ien ; $ i ++ ) { if ( self :: i...
SQL Rendering for the invidividual column filters
45,507
protected function toSQLColumn ( $ column , $ onlyAlias = 0 , $ filter = false ) { if ( ! isset ( $ column [ 'sql_name' ] ) && ! isset ( $ column [ 'data' ] ) ) { self :: sendFatal ( 'Houston, we have a problem with one of your column : can\'t draw it SQL name because it don\'t have data or sql_name define.' . "\n" . j...
Give a column s sql name
45,508
protected function patchDuplicateRow ( $ d , $ pKey , array $ columns ) { $ id = $ d [ $ pKey ] ; if ( isset ( $ this -> rData [ $ id ] ) ) { foreach ( $ columns as $ c => $ separator ) { $ this -> rData [ $ id ] [ $ c ] .= $ separator . $ d [ $ c ] ; } } else { $ this -> rData [ $ id ] = $ d ; } }
To avoid duplicate row when LEFT JOIN if GROUP BY is not set
45,509
public function exec ( array $ request , $ csv = false ) { if ( $ csv ) { $ this -> request [ 'length' ] = - 1 ; } $ queries = $ this -> generateSQLRequest ( $ request ) ; $ this -> addToSend ( 'sqlQuery' , $ queries [ 'data' ] ) ; $ pdo = $ this -> pdoLink ; try { $ q = $ pdo -> query ( $ queries [ 'data' ] ) ; $ this...
Execute the ajax request and send the result in json
45,510
protected function sendData ( $ data , $ recordsFiltered , $ recordsTotal ) { $ toJson = array ( 'draw' => intval ( $ this -> request [ 'draw' ] ) , 'recordsTotal' => intval ( $ recordsTotal ) , 'recordsFiltered' => intval ( $ recordsFiltered ) , 'data' => $ this -> dataOutput ( $ data ) , ) ; if ( isset ( $ this -> to...
Send the json encoded result for DataTables . js
45,511
protected static function sendCsv ( $ data ) { header ( "Content-Disposition: attachment; filename=" . uniqid ( 'dataExpl' ) . '.csv' ) ; header ( "Content-Type: application/force-download" ) ; header ( "Content-Type: application/octet-stream" ) ; header ( "Content-Type: application/download" ) ; header ( "Content-Desc...
Return the csv
45,512
public static function sendFatal ( $ error , $ toSend = null ) { $ toJson = [ 'error' => utf8_encode ( $ error ) ] ; if ( isset ( $ toSend ) ) { $ toJson = array_merge ( $ toSend , $ toJson ) ; } exit ( json_encode ( $ toJson ) ) ; }
Throw a fatal error . This writes out an error message in a JSON string which DataTables will see and show to the user in the browser .
45,513
public static function getInstance ( ) : SessionInterface { if ( static :: $ session instanceof SessionInterface ) { return static :: $ session ; } if ( strlen ( static :: $ name ) < 1 ) { throw new \ Exception ( "Cannot start session, no name has been specified, you must call Session::name() before using this class" )...
Ensure the session instance has been created .
45,514
public function createNamespace ( string $ name ) : SessionInterface { $ name = $ this -> getNamespacedKey ( $ name ) ; return new SessionNamespace ( $ name , $ this -> session ) ; }
Create a new namespaced section of this session to avoid clashes .
45,515
public function getAll ( ) : array { $ namespace = $ this -> getNamespace ( ) ; $ length = mb_strlen ( $ namespace ) ; $ values = [ ] ; $ data = $ this -> session -> getAll ( ) ; foreach ( $ data as $ key => $ val ) { if ( mb_substr ( $ key , 0 , $ length ) === $ namespace ) { $ key = mb_substr ( $ key , $ length ) ; $...
Get all the current session data .
45,516
public function updateInstances ( $ route , $ request ) { $ this -> request = $ request ; if ( $ request ) { $ this -> uri = urldecode ( $ request -> path ( ) ) ; } $ this -> route = $ route ; if ( $ route ) { $ this -> action = $ route -> getActionName ( ) ; $ actionSegments = Str :: parseCallback ( $ this -> action ,...
Update the route and request instances
45,517
public function checkUri ( $ uris ) { if ( ! $ this -> request ) { return false ; } foreach ( ( array ) $ uris as $ uri ) { if ( $ this -> uri == $ uri ) { return true ; } } return false ; }
Check if the URI of the current request matches one of the specific URIs
45,518
public function checkRoute ( $ routeNames ) { if ( ! $ this -> route ) { return false ; } $ routeName = $ this -> route -> getName ( ) ; if ( in_array ( $ routeName , ( array ) $ routeNames ) ) { return true ; } return false ; }
Check if the name of the current route matches one of specific values
45,519
public function checkRoutePattern ( $ patterns ) { if ( ! $ this -> route ) { return false ; } $ routeName = $ this -> route -> getName ( ) ; if ( $ routeName == null ) { return in_array ( null , $ patterns ) ; } foreach ( ( array ) $ patterns as $ p ) { if ( str_is ( $ p , $ routeName ) ) { return true ; } } return fa...
Check the current route name with one or some patterns
45,520
public function checkRouteParam ( $ param , $ value ) { if ( ! $ this -> route ) { return false ; } $ paramValue = $ this -> route -> parameter ( $ param ) ; if ( is_a ( $ paramValue , Model :: class ) ) { return $ paramValue -> { $ paramValue -> getKeyName ( ) } == $ value ; } return $ paramValue == $ value ; }
Check if the parameter of the current route has the correct value
45,521
public function checkAction ( $ actions ) { if ( ! $ this -> action ) { return false ; } if ( in_array ( $ this -> action , ( array ) $ actions ) ) { return true ; } return false ; }
Return active class if current route action match one of provided action names
45,522
public function checkController ( $ controllers ) { if ( ! $ this -> controller ) { return false ; } if ( in_array ( $ this -> controller , ( array ) $ controllers ) ) { return true ; } return false ; }
Check if the current controller class matches one of specific values
45,523
public function getFileNameVersioned ( ) { return static :: buildFileNameVersioned ( $ this -> strFileName , static :: getVersionForFileName ( $ this -> intVersionMajor , $ this -> intVersionMinor , $ this -> intVersionPatch ) , $ this -> strFileType ) ; }
Return the complete versioned filename string for this document .
45,524
public function getFileSize ( $ strUnit , $ blnFormatted = false ) { $ doubleFileSize = \ Document :: convertFileSize ( $ this -> intFileSize , self :: FILE_SIZE_UNIT_BYTE , $ strUnit ) ; if ( $ doubleFileSize < 0 ) { throw new \ Exception ( sprintf ( 'Invalid file size [%s] or unit [%s] for document.' , $ this -> intF...
Return the file size for the given unit .
45,525
public static function convertFileSize ( $ doubleFileSize , $ strSourceUnit , $ strTargetUnit ) { if ( $ strSourceUnit == $ strTargetUnit ) { return $ doubleFileSize ; } if ( $ strSourceUnit == \ Document :: FILE_SIZE_UNIT_BYTE ) { switch ( $ strTargetUnit ) { case \ Document :: FILE_SIZE_UNIT_KB : return $ doubleFileS...
Utility function to convert file size from a source unit into a target unit .
45,526
public static function formatFileSize ( $ doubleFileSize , $ strUnit ) { $ value = number_format ( $ doubleFileSize , 2 , $ GLOBALS [ 'TL_LANG' ] [ 'DMS' ] [ 'file_size_format' ] [ 'dec_point' ] , $ GLOBALS [ 'TL_LANG' ] [ 'DMS' ] [ 'file_size_format' ] [ '$thousands_sep' ] ) ; if ( substr ( $ value , - 3 ) == ( $ GLOB...
Utility function to format file size values
45,527
private function applyReadPermissionsToCategories ( Array $ arrCategories ) { $ arrSecureCategories = $ arrCategories ; foreach ( $ arrSecureCategories as $ category ) { if ( ! $ category -> isPublished ( ) || ( $ this -> dmsHideEmptyCategories && ! $ category -> hasPublishedDocuments ( ) ) || ( $ this -> dmsHideLocked...
Apply the read permissions to the categories .
45,528
public function isPublished ( ) { $ time = time ( ) ; $ published = ( $ this -> published && ( $ this -> publicationStart == '' || $ this -> publicationStart < $ time ) && ( $ this -> publicationStop == '' || $ this -> publicationStop > $ time ) ) ; return $ published ; }
Return if this category is published .
45,529
public function shouldPublishDocumentsPerDefault ( ) { if ( $ this -> strPublishDocumentsPerDefault == self :: PUBLISH_DOCUMENTS_PER_DEFAULT_ENABLE ) { return true ; } else if ( $ this -> strPublishDocumentsPerDefault == self :: PUBLISH_DOCUMENTS_PER_DEFAULT_INHERIT && $ this -> hasParentCategory ( ) ) { return $ this ...
Return if documents uploaded to this category should be published per default .
45,530
public function hasDocumentsInSubCategories ( ) { if ( $ this -> hasSubCategories ( ) ) { foreach ( $ this -> arrSubCategories as $ subCategory ) { if ( $ subCategory -> hasDocuments ( ) || $ subCategory -> hasDocumentsInSubCategories ( ) ) { return true ; } } } return false ; }
Return if this category has documents in any of its subcategories .
45,531
public function getPublishedDocumentCount ( ) { $ count = 0 ; foreach ( $ this -> arrDocuments as $ document ) { if ( $ document -> isPublished ( ) ) { $ count ++ ; } } return $ count ; }
Get the number of published documents .
45,532
public function isReadableForCurrentMember ( ) { if ( $ this -> generalReadPermission == self :: GENERAL_READ_PERMISSION_ALL ) { return true ; } else if ( $ this -> generalReadPermission == self :: GENERAL_READ_PERMISSION_LOGGED_USER && FE_USER_LOGGED_IN ) { return true ; } else if ( $ this -> generalReadPermission == ...
Return if this category is readable for the current logged member .
45,533
public function isAccessibleForCurrentMember ( $ strAccessRight ) { if ( $ this -> generalManagePermission == self :: GENERAL_MANAGE_PERMISSION_LOGGED_USER && FE_USER_LOGGED_IN ) { return true ; } else if ( $ this -> generalManagePermission == self :: GENERAL_MANAGE_PERMISSION_CUSTOM && FE_USER_LOGGED_IN ) { $ blnIsAcc...
Return if the current logged member has access with the given right to this category .
45,534
public function getPath ( $ blnSkipThis ) { $ arrPath = array ( ) ; if ( ! $ this -> isRootCategory ( ) && $ this -> hasParentCategory ( ) ) { $ arrPath = $ this -> parentCategory -> getPath ( false ) ; } if ( ! $ blnSkipThis ) { $ arrPath [ ] = $ this ; } return $ arrPath ; }
Returns the path from the root node of this category to this category in context of the current structure of categories .
45,535
public function getPathNames ( $ blnSkipThis ) { $ arrPath = array ( ) ; if ( ! $ this -> isRootCategory ( ) && $ this -> hasParentCategory ( ) ) { $ arrPath = $ this -> parentCategory -> getPathNames ( false ) ; } if ( ! $ blnSkipThis ) { $ arrPath [ ] = $ this -> name ; } return $ arrPath ; }
Returns the names in the path from the root node of this category to this category in context of the current structure of categories .
45,536
public function getAllowedFileTypes ( ) { $ arrFileTypesOfParents = array ( ) ; if ( $ this -> fileTypesInherit && ! $ this -> isRootCategory ( ) && $ this -> hasParentCategory ( ) ) { $ arrFileTypesOfParents = $ this -> parentCategory -> getAllowedFileTypes ( ) ; } $ arrFileTypes = DmsUtils :: getUniqueFileTypes ( $ t...
Returns an array of file types which are allowed to be uploaded into this category .
45,537
public function isFileTypeAllowed ( $ strFileType , $ blnCaseSensitive = false ) { $ arrAllowedFileTypes = $ this -> getAllowedFileTypes ( ) ; if ( ! $ blnCaseSensitive ) { $ strFileType = strtolower ( $ strFileType ) ; } return in_array ( $ strFileType , $ arrAllowedFileTypes ) ; }
Returns if the given file type is allowed to be uploaded into this category .
45,538
protected function encodeSetOf ( SetOfType $ setOf ) { if ( \ count ( $ setOf -> getChildren ( ) ) === 0 ) { return '' ; } $ children = [ ] ; foreach ( $ setOf as $ type ) { $ child = [ 'original' => $ this -> encode ( $ type ) ] ; $ child [ 'length' ] = \ strlen ( $ child [ 'original' ] ) ; $ children [ ] = $ child ; ...
X . 690 Section 11 . 6
45,539
public function addAlias ( $ alias , $ tagName ) { if ( $ this -> getComponentFactory ( $ tagName ) ) { $ this -> alias [ ( string ) $ alias ] = ( string ) $ tagName ; } return $ this ; }
Adds an alisa for a component
45,540
public function getComponentFactory ( $ tagName ) { if ( isset ( $ this -> alias [ $ tagName ] ) ) { $ tagName = $ this -> alias [ $ tagName ] ; } if ( isset ( $ this -> componentFactory [ $ tagName ] ) && $ this -> componentFactory [ $ tagName ] instanceof ComponentFactoryInterface ) { return $ this -> componentFactor...
returns a Component Factory for a given tag or alias
45,541
public function handle ( WillSerializeData $ event ) { if ( $ event -> isController ( Controller \ ShowDiscussionController :: class ) ) { $ posts = $ event -> data -> posts ; } elseif ( $ event -> isController ( Controller \ ShowPostController :: class ) || $ event -> isController ( Controller \ CreatePostController :...
Apply visibility permissions to API data .
45,542
private function uploadSelectFile ( & $ params , & $ dmsLoader , & $ uploadCategory , & $ arrMessages , & $ blnShowStart ) { $ params -> loadRootCategory = true ; $ params -> loadAccessRights = true ; $ params -> loadDocuments = false ; $ category = $ dmsLoader -> loadCategory ( $ uploadCategory , $ params ) ; if ( $ c...
Display the file select screen for upload
45,543
private function manageSelectDocument ( & $ params , & $ dmsLoader , & $ manageCategory , & $ arrMessages , & $ blnShowStart ) { $ params -> loadRootCategory = true ; $ params -> loadAccessRights = true ; $ params -> loadDocuments = true ; $ category = $ dmsLoader -> loadCategory ( $ manageCategory , $ params ) ; if ( ...
Display the document select screen for managing
45,544
private function managePublishDocument ( & $ params , & $ dmsLoader , & $ manageCategory , & $ arrMessages , & $ blnShowStart , $ documentId ) { $ params -> loadRootCategory = true ; $ params -> loadAccessRights = true ; $ params -> loadDocuments = false ; $ category = $ dmsLoader -> loadCategory ( $ manageCategory , $...
Execute publishing documents
45,545
private function manageDeleteDocument ( & $ params , & $ dmsLoader , & $ manageCategory , & $ arrMessages , & $ blnShowStart , $ documentId ) { $ params -> loadRootCategory = true ; $ params -> loadAccessRights = true ; $ params -> loadDocuments = false ; $ category = $ dmsLoader -> loadCategory ( $ manageCategory , $ ...
Execute unpublishing documents
45,546
private function manageEditDocumentEnterProperties ( & $ params , & $ dmsLoader , & $ manageCategory , & $ arrMessages , & $ blnShowStart , $ documentId ) { $ params -> loadRootCategory = true ; $ params -> loadAccessRights = true ; $ params -> loadDocuments = false ; $ category = $ dmsLoader -> loadCategory ( $ manage...
Edit a document
45,547
private function applyAccessPermissionsToCategories ( Array $ arrCategories ) { $ arrSecureCategories = $ arrCategories ; foreach ( $ arrSecureCategories as $ category ) { if ( ! $ category -> isPublished ( ) || ( $ this -> dmsHideLockedCategories && ( ! $ category -> isUploadableForCurrentMember ( ) && ! $ category ->...
Apply the access permissions to the categories .
45,548
public function addBreadcrumb ( \ DataContainer $ dc ) { if ( isset ( $ _GET [ 'cat' ] ) ) { $ this -> Session -> set ( 'tl_category_id' , $ this -> Input -> get ( 'cat' ) ) ; $ this -> redirect ( preg_replace ( '/&cat=[^&]*/' , '' , $ this -> Environment -> request ) ) ; } $ intCategoryId = $ this -> Session -> get ( ...
Add the breadcrumb menu
45,549
public function checkPermission ( ) { switch ( $ this -> Input -> get ( 'act' ) ) { case 'delete' : if ( ! $ this -> isCategoryDeletable ( $ this -> Input -> get ( 'id' ) ) ) { $ this -> log ( 'Deleting the non empty category with ID "' . $ this -> Input -> get ( 'id' ) . '" is not allowed.' , 'tl_dms_categories checkP...
Check permissions to avoid not allowd deleting
45,550
public function getDeleteButton ( $ row , $ href , $ label , $ title , $ icon , $ attributes ) { if ( ! $ this -> isCategoryDeletable ( $ row [ 'id' ] ) ) { return $ this -> generateImage ( 'delete_.gif' , $ GLOBALS [ 'TL_LANG' ] [ 'tl_dms_categories' ] [ 'delete_' ] [ 0 ] , 'title="' . sprintf ( $ GLOBALS [ 'TL_LANG' ...
Return the delete button
45,551
public function saveFileTypes ( $ varValue , DataContainer $ dc ) { if ( strlen ( $ varValue ) > 0 ) { $ arrFileTypes = \ DmsUtils :: getUniqueFileTypes ( $ varValue ) ; $ varValue = implode ( "," , $ arrFileTypes ) ; } return $ varValue ; }
Cleanup the files types before saving
45,552
private function getPhpUploadMaxFilesize ( ) { $ param = trim ( ini_get ( 'upload_max_filesize' ) ) ; $ unit = strtolower ( substr ( $ param , - 1 ) ) ; $ val = ( double ) $ param ; switch ( $ unit ) { case 'k' : $ val = \ Document :: convertFileSize ( ( double ) substr ( $ param , 0 , - 1 ) , \ Document :: FILE_SIZE_U...
Get the value of the upload_max_filesize set in PHP .
45,553
public function add ( $ item ) { if ( is_array ( $ item ) ) { return array_map ( [ $ this , 'add' ] , $ item ) ; } if ( ! $ item | strlen ( trim ( $ item ) ) === 0 ) { return false ; } $ this -> collection [ ] = trim ( strip_tags ( $ item ) ) ; }
Add an item to the collection .
45,554
public function get ( $ direction = 'regular' ) { if ( $ this -> count ( ) == 0 ) { return $ this -> default ; } if ( $ direction === 'downward' ) { $ this -> collection = array_reverse ( $ this -> collection ) ; } $ this -> addPageName ( ) ; if ( $ direction === 'reverse' ) { $ this -> collection = array_reverse ( $ t...
Get the page title .
45,555
protected function addPageName ( ) { if ( ! empty ( $ this -> getPageName ( ) ) && ! in_array ( $ this -> getPageName ( ) , $ this -> collection ) ) { $ this -> add ( $ this -> getPageName ( ) ) ; } }
Add the page name to the collection .
45,556
public function isActive ( ) { $ time = time ( ) ; $ active = ( $ this -> active && ( $ this -> activationStart == '' || $ this -> activationStart < $ time ) && ( $ this -> activationStop == '' || $ this -> activationStop > $ time ) ) ; return $ active ; }
Return if this access right is active .
45,557
public function toBinary ( ) { $ bytes = '' ; foreach ( str_split ( $ this -> value , 8 ) as $ piece ) { $ bytes .= chr ( bindec ( $ piece ) ) ; } return $ bytes ; }
Get the packed binary representation .
45,558
public static function fromBinary ( $ bytes , ? int $ minLength = null ) { $ bitstring = '' ; $ length = strlen ( $ bytes ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ bitstring .= sprintf ( '%08d' , decbin ( ord ( $ bytes [ $ i ] ) ) ) ; } if ( $ minLength && strlen ( $ bitstring ) < $ minLength ) { $ bitstring = ...
Construct the bit string from a binary string value .
45,559
public static function fromInteger ( int $ int , ? int $ minLength = null ) { $ pieces = str_split ( decbin ( $ int ) , 8 ) ; $ num = count ( $ pieces ) ; if ( $ num === 1 && strlen ( $ pieces [ 0 ] ) !== 8 ) { $ pieces [ 0 ] = str_pad ( $ pieces [ 0 ] , 8 , '0' , STR_PAD_LEFT ) ; } elseif ( $ num > 0 && strlen ( $ pie...
Construct the bit string from an integer .
45,560
public function storeDocument ( \ Document $ document ) { $ arrSet = $ this -> buildDocumentDataArray ( $ document , false ) ; $ objDocument = $ this -> Database -> prepare ( "INSERT INTO tl_dms_documents %s" ) -> set ( $ arrSet ) -> execute ( ) ; $ document -> id = $ objDocument -> insertId ; return $ document ; }
Store the new document in the given category .
45,561
public function updateDocument ( \ Document $ document ) { $ arrSet = $ this -> buildDocumentDataArray ( $ document , false ) ; $ this -> Database -> prepare ( "UPDATE tl_dms_documents %s WHERE id=?" ) -> set ( $ arrSet ) -> execute ( $ document -> id ) ; return $ document ; }
Update the document .
45,562
public function addEncore ( PageModel $ page , LayoutModel $ layout , PageRegular $ pageRegular ) { $ this -> doAddEncore ( $ page , $ layout , $ pageRegular ) ; }
Modify the page object .
45,563
public static function getValidFileTypesForCategory ( ) { $ db = \ Database :: getInstance ( ) ; $ input = \ Input :: getInstance ( ) ; if ( $ db -> tableExists ( 'tl_dms_categories' ) && $ db -> tableExists ( 'tl_dms_documents' ) ) { $ objCategory = $ db -> prepare ( 'SELECT cat.* FROM tl_dms_categories cat JOIN tl_dm...
Determine the valid file types for the current category
45,564
public function resortDocuments ( \ DataContainer $ dc ) { if ( ! $ this -> Input -> get ( 'act' ) ) { $ db = \ Database :: getInstance ( ) ; $ stmt = "UPDATE tl_dms_documents doc, " . " (SELECT @rownum := @rownum + 1 ROWNUM, t.id ID " . " FROM " . " (SELECT @rownum := 0) r, " . " (SELECT * FROM tl_dms_documents ORDER ...
Resort the document sorting value
45,565
public function pasteDocument ( \ DataContainer $ dc , $ row , $ table , $ cr , $ arrClipboard = null ) { $ imagePasteAfter = $ this -> generateImage ( 'pasteafter.gif' , sprintf ( $ GLOBALS [ 'TL_LANG' ] [ $ dc -> table ] [ 'pasteafter' ] [ 1 ] , $ row [ 'id' ] ) , 'class="blink"' ) ; $ imagePasteInto = $ this -> gene...
Return the paste document button
45,566
public function deleteFile ( \ DataContainer $ dc ) { $ filePath = TL_ROOT . '/' . $ this -> getFullFilePath ( $ dc -> activeRecord -> data_file_name , $ dc ) ; if ( file_exists ( $ filePath ) ) { unlink ( $ filePath ) ; } }
Delete the file if the document will be deleted .
45,567
public function loadCategories ( \ DmsLoaderParams $ params ) { $ rootCategory = null ; if ( $ params -> loadRootCategory && $ params -> rootCategoryId > 0 ) { $ rootCategory = $ this -> loadCategory ( $ params -> rootCategoryId , $ params ) ; $ arrCategories = $ this -> getCategoryLevel ( $ params -> rootCategoryId , ...
Load the categories structure without consideration of access rights .
45,568
public static function flattenCategories ( Array $ arrCategories ) { $ arrFlattend = array ( ) ; foreach ( $ arrCategories as $ category ) { $ arrFlattend [ ] = $ category ; if ( $ category -> hasSubCategories ( ) ) { $ arrFlattend = array_merge ( $ arrFlattend , \ DmsLoader :: flattenCategories ( $ category -> subCate...
Flatten a categories structure .
45,569
public function loadCategory ( $ categoryId , \ DmsLoaderParams $ params ) { $ objCategory = $ this -> Database -> prepare ( "SELECT * FROM tl_dms_categories WHERE id = ?" ) -> limit ( 1 ) -> execute ( $ categoryId ) ; $ category = null ; if ( $ objCategory -> numRows ) { $ category = $ this -> buildCategory ( $ objCat...
Load the category with the given id .
45,570
public function loadDocument ( $ documentId , \ DmsLoaderParams $ params ) { $ objDocument = $ this -> Database -> prepare ( "SELECT d.*, CONCAT(m1.firstname, ' ', m1.lastname) AS upload_member_name, CONCAT(m2.firstname, ' ', m2.lastname) AS lastedit_member_name " . "FROM tl_dms_documents d " . "LEFT JOIN tl_member m1 ...
Load the document with the given id .
45,571
public function loadDocuments ( $ strFileName , $ strFileType , \ DmsLoaderParams $ params ) { $ arrDocuments = array ( ) ; $ objDocument = $ this -> Database -> prepare ( "SELECT d.*, CONCAT(m1.firstname, ' ', m1.lastname) AS upload_member_name, CONCAT(m2.firstname, ' ', m2.lastname) AS lastedit_member_name " . "FROM ...
Load the documents for the given file name and type .
45,572
protected function getCategoryLevel ( $ parentCategoryId , \ Category $ parentCategory = null , \ DmsLoaderParams $ params ) { $ arrCategories = array ( ) ; $ objCategory = $ this -> Database -> prepare ( "SELECT * FROM tl_dms_categories WHERE pid = ? ORDER BY sorting" ) -> execute ( $ parentCategoryId ) ; $ category =...
Recursively reading the categories
45,573
private function getAccessRights ( \ Category $ category , \ DmsLoaderParams $ params ) { $ objAccessRight = $ this -> Database -> prepare ( "SELECT * FROM tl_dms_access_rights WHERE pid = ?" ) -> execute ( $ category -> id ) ; $ arrAccessRights = array ( ) ; while ( $ objAccessRight -> next ( ) ) { $ accessRight = $ t...
Get all access rights for the given category .
45,574
private function getDocuments ( \ Category $ category , \ DmsLoaderParams $ params ) { $ whereClause = "WHERE d.pid = ? " ; $ whereParams = array ( ) ; $ whereParams [ ] = $ category -> id ; if ( $ params -> hasDocumentSearchText ( ) ) { if ( $ params -> documentSearchType == \ DmsLoaderParams :: DOCUMENT_SEARCH_LIKE )...
Get all documents for the given category .
45,575
private function buildCategory ( $ objCategory ) { $ category = new \ Category ( $ objCategory -> id , $ objCategory -> name ) ; $ category -> parentCategoryId = $ objCategory -> pid ; $ category -> description = $ objCategory -> description ; $ category -> fileTypes = $ objCategory -> file_types ; $ category -> fileTy...
Builds a category from a database result .
45,576
private function buildAccessRight ( $ objAccessRight ) { $ accessRight = new \ AccessRight ( $ objAccessRight -> id , $ objAccessRight -> member_group ) ; $ accessRight -> categoryId = $ objAccessRight -> pid ; $ strRight = \ AccessRight :: READ ; $ accessRight -> $ strRight = $ objAccessRight -> right_read ; $ strRigh...
Builds an access right from a database result .
45,577
public static function getBaseDirectory ( $ blnAppendTrailingSlash ) { $ path = \ FilesModel :: findByUuid ( $ GLOBALS [ 'TL_CONFIG' ] [ 'dmsBaseDirectory' ] ) -> path ; if ( $ blnAppendTrailingSlash ) { $ path .= "/" ; } return $ path ; }
Return base directory for the DMS documents defined in system settings .
45,578
public static function getPreviewDirectory ( $ blnAppendTrailingSlash ) { $ path = self :: getBaseDirectory ( true ) . self :: DIRECTORY_NAME_PREVIEW ; if ( $ blnAppendTrailingSlash ) { $ path .= "/" ; } return $ path ; }
Return preview directory for the DMS document preview images .
45,579
public static function getTempDirectory ( $ blnAppendTrailingSlash ) { $ path = self :: getBaseDirectory ( true ) . self :: DIRECTORY_NAME_TEMP ; if ( $ blnAppendTrailingSlash ) { $ path .= "/" ; } return $ path ; }
Return temp directory for the DMS documents .
45,580
public static function getMaxUploadFileSize ( $ strUnit , $ blnFormatted ) { $ arrValue = deserialize ( $ GLOBALS [ 'TL_CONFIG' ] [ 'dmsMaxUploadFileSize' ] ) ; $ dmsUnit = $ arrValue [ 'unit' ] ; $ dmsVal = \ Document :: convertFileSize ( ( double ) $ arrValue [ 'value' ] , $ dmsUnit , $ strUnit ) ; if ( $ blnFormatte...
Return the maximum allowed upload file size defined in system settings .
45,581
private function initDirectoryStructure ( ) { if ( ! file_exists ( TL_ROOT . '/' . $ this -> getDmsBaseDirectory ( ) ) ) { mkdir ( TL_ROOT . '/' . $ this -> getDmsBaseDirectory ( ) , 0775 , true ) ; $ objDir = \ Dbafs :: addResource ( $ this -> getDmsBaseDirectory ( ) ) ; $ objFolder = new \ Folder ( $ this -> getDmsBa...
Init the directory structure Create structure if not exists
45,582
private function initSystemSettings ( ) { if ( \ Config :: get ( self :: DMS_BASE_DIRECTORY_KEY ) && \ Config :: get ( self :: DMS_MAX_UPLOAD_FILE_SIZE_KEY ) ) { return ; } \ System :: log ( 'Running init script for setting default DMS settings, if missing.' , __METHOD__ , TL_CONFIGURATION ) ; if ( ! \ Config :: get ( ...
Init the system setting Set base directoy if not set
45,583
public function setTagMap ( int $ class , array $ map ) { if ( isset ( $ this -> tagMap [ $ class ] ) ) { $ this -> tagMap [ $ class ] = $ map ; } return $ this ; }
Map universal types to specific tag class values when decoding .
45,584
public function setOptions ( array $ options ) { if ( isset ( $ options [ 'bitstring_padding' ] ) && \ is_string ( $ options [ 'bitstring_padding' ] ) ) { $ this -> options [ 'bitstring_padding' ] = $ options [ 'bitstring_padding' ] ; } return $ this ; }
Set the options for the encoder .
45,585
protected function getVlqBytesToInt ( ) { $ value = 0 ; $ isBigInt = false ; for ( $ this -> pos ; $ this -> pos < $ this -> maxLen ; $ this -> pos ++ ) { if ( ! $ isBigInt ) { $ lshift = $ value << 7 ; if ( $ lshift < 0 ) { $ isBigInt = true ; $ this -> throwIfBigIntGmpNeeded ( true ) ; $ value = \ gmp_init ( $ value ...
Given what should be VLQ bytes represent an int get the int and the length of bytes .
45,586
protected function intToVlqBytes ( $ int ) { $ bigint = \ is_float ( $ int + 0 ) ; $ this -> throwIfBigIntGmpNeeded ( $ bigint ) ; if ( $ bigint ) { $ int = \ gmp_init ( $ int ) ; $ bytes = \ chr ( \ gmp_intval ( \ gmp_and ( \ gmp_init ( 0x7f ) , $ int ) ) ) ; $ int = \ gmp_div ( $ int , \ gmp_pow ( 2 , 7 ) ) ; $ intVa...
Get the bytes that represent variable length quantity .
45,587
public function import ( Event $ event , ImportRecordsDataTable $ importRecordsDataTable ) { return $ importRecordsDataTable -> with ( [ 'resource' => $ event , 'tabs' => 'adminarea.events.tabs' , 'url' => route ( 'adminarea.events.stash' ) , 'id' => "adminarea-events-{$event->getRouteKey()}-import-table" , ] ) -> rend...
Import events .
45,588
public function import ( Service $ service , ImportRecordsDataTable $ importRecordsDataTable ) { return $ importRecordsDataTable -> with ( [ 'resource' => $ service , 'tabs' => 'adminarea.services.tabs' , 'url' => route ( 'adminarea.services.stash' ) , 'id' => "adminarea-services-{$service->getRouteKey()}-import-table"...
Import services .
45,589
public function hoard ( ImportFormRequest $ request ) { foreach ( ( array ) $ request -> get ( 'selected_ids' ) as $ recordId ) { $ record = app ( 'cortex.foundation.import_record' ) -> find ( $ recordId ) ; try { $ fillable = collect ( $ record [ 'data' ] ) -> intersectByKeys ( array_flip ( app ( 'rinvex.bookings.serv...
Hoard services .
45,590
public function update ( BookingFormRequest $ request , ServiceBooking $ serviceBooking ) : int { return $ this -> process ( $ request , $ serviceBooking ) ; }
Update given booking .
45,591
public function destroy ( Service $ service , ServiceBooking $ serviceBooking ) { $ service -> bookings ( ) -> where ( $ serviceBooking -> getKeyName ( ) , $ serviceBooking -> getKey ( ) ) -> first ( ) -> delete ( ) ; return intend ( [ 'url' => route ( 'adminarea.services.bookings.index' ) , 'with' => [ 'warning' => tr...
Destroy given booking .
45,592
public function import ( Contact $ contact , ImportRecordsDataTable $ importRecordsDataTable ) { return $ importRecordsDataTable -> with ( [ 'resource' => $ contact , 'tabs' => 'adminarea.contacts.tabs' , 'url' => route ( 'adminarea.contacts.stash' ) , 'id' => "adminarea-contacts-{$contact->getRouteKey()}-import-table"...
Import contacts .
45,593
public function stash ( ImportFormRequest $ request , DefaultImporter $ importer , Event $ event ) { $ importer -> config [ 'resource' ] = $ this -> resource ; $ importer -> handleImport ( ) ; }
Stash events .
45,594
public function index ( Event $ event , MediaDataTable $ mediaDataTable ) { return $ mediaDataTable -> with ( [ 'resource' => $ event , 'tabs' => 'adminarea.events.tabs' , 'id' => "adminarea-events-{$event->getRouteKey()}-media-table" , 'url' => route ( 'adminarea.events.media.store' , [ 'event' => $ event ] ) , ] ) ->...
List event media .
45,595
public function store ( ImageFormRequest $ request , Event $ event ) : void { $ event -> addMediaFromRequest ( 'file' ) -> sanitizingFileName ( function ( $ fileName ) { return md5 ( $ fileName ) . '.' . pathinfo ( $ fileName , PATHINFO_EXTENSION ) ; } ) -> toMediaCollection ( 'default' , config ( 'cortex.bookings.medi...
Store new event media .
45,596
public function destroy ( Event $ event , Media $ media ) { $ event -> media ( ) -> where ( $ media -> getKeyName ( ) , $ media -> getKey ( ) ) -> first ( ) -> delete ( ) ; return intend ( [ 'url' => route ( 'adminarea.events.media.index' , [ 'event' => $ event ] ) , 'with' => [ 'warning' => trans ( 'cortex/foundation:...
Destroy given event media .
45,597
public function connect ( array $ config , string $ name = 'main' ) : Connection { if ( isset ( $ this -> connections [ $ name ] ) ) { throw new InvalidArgumentException ( "Connection [$name] is already configured." ) ; } $ this -> connections [ $ name ] = new Connection ( $ config ) ; return $ this -> connections [ $ ...
Connect to the given connection .
45,598
public function destroy ( Service $ service ) { $ service -> delete ( ) ; return intend ( [ 'url' => route ( 'adminarea.services.index' ) , 'with' => [ 'warning' => trans ( 'cortex/foundation::messages.resource_deleted' , [ 'resource' => trans ( 'cortex/bookings::common.service' ) , 'identifier' => $ service -> name ] ...
Destroy given service .
45,599
public function api ( string $ name ) : API \ AbstractAPI { $ name = ucfirst ( $ name ) ; $ class = "ArkEcosystem\\Client\\API\\{$name}" ; if ( ! class_exists ( $ class ) ) { throw new RuntimeException ( "Class [$class] does not exist." ) ; } return new $ class ( $ this ) ; }
Make a new resource instance .