idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
30,200 | protected function is_user_suspended ( $ user ) { if ( ! $ this -> config -> suspended_attribute || ! isset ( $ user -> suspended ) ) { return false ; } if ( $ this -> config -> suspended_attribute == 'useraccountcontrol' && $ this -> config -> user_type == 'ad' ) { return ( bool ) ( $ user -> suspended & AUTH_AD_ACCOU... | Check if a user is suspended . This function is intended to be used after calling get_userinfo_asobj . This is needed because LDAP doesn t have a notion of disabled users however things like MS Active Directory support it and expose information through a field . |
30,201 | protected function get_profile_keys ( $ fetchall = false ) { $ keys = array_keys ( get_object_vars ( $ this -> config ) ) ; $ updatekeys = [ ] ; foreach ( $ keys as $ key ) { if ( preg_match ( '/^field_updatelocal_(.+)$/' , $ key , $ match ) ) { if ( ! empty ( $ this -> config -> { 'field_map_' . $ match [ 1 ] } ) ) { ... | Get the list of profile fields . |
30,202 | public function validate ( $ interchange ) { $ this -> interchange = $ interchange ; $ this -> aliases = array ( ) ; foreach ( $ interchange -> directives as $ i => $ directive ) { $ id = $ directive -> id -> toString ( ) ; if ( $ i != $ id ) { $ this -> error ( false , "Integrity violation: key '$i' does not match int... | Validates a fully - formed interchange object . |
30,203 | public function validateId ( $ id ) { $ id_string = $ id -> toString ( ) ; $ this -> context [ ] = "id '$id_string'" ; if ( ! $ id instanceof HTMLPurifier_ConfigSchema_Interchange_Id ) { $ this -> error ( false , 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id' ) ; } $ this -> with ( $ id , 'key' ) -> a... | Validates a HTMLPurifier_ConfigSchema_Interchange_Id object . |
30,204 | public function validateDirective ( $ d ) { $ id = $ d -> id -> toString ( ) ; $ this -> context [ ] = "directive '$id'" ; $ this -> validateId ( $ d -> id ) ; $ this -> with ( $ d , 'description' ) -> assertNotEmpty ( ) ; $ this -> with ( $ d , 'type' ) -> assertNotEmpty ( ) ; $ this -> with ( $ d , 'typeAllowsNull' )... | Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object . |
30,205 | protected function error ( $ target , $ msg ) { if ( $ target !== false ) { $ prefix = ucfirst ( $ target ) . ' in ' . $ this -> getFormattedContext ( ) ; } else { $ prefix = ucfirst ( $ this -> getFormattedContext ( ) ) ; } throw new HTMLPurifier_ConfigSchema_Exception ( trim ( $ prefix . ' ' . $ msg ) ) ; } | Emits an error providing helpful context . |
30,206 | public function recent_activity ( $ course , $ timestart , $ recentenrolments , $ structuralchanges , $ modulesrecentactivity ) { $ output = html_writer :: tag ( 'div' , get_string ( 'activitysince' , '' , userdate ( $ timestart ) ) , array ( 'class' => 'activityhead' ) ) ; $ output .= html_writer :: tag ( 'div' , html... | Renders HTML to display recent_activity block |
30,207 | protected function structural_change ( $ change ) { $ cm = $ change [ 'module' ] ; switch ( $ change [ 'action' ] ) { case 'delete mod' : $ text = get_string ( 'deletedactivity' , 'moodle' , $ cm -> modfullname ) ; break ; case 'add mod' : $ text = get_string ( 'added' , 'moodle' , $ cm -> modfullname ) . '<br />' . ht... | Renders HTML for one change in course structure |
30,208 | public function search ( $ search_text , $ page = 0 ) { $ ret = array ( ) ; $ ret [ 'nologin' ] = true ; $ ret [ 'list' ] = $ this -> _get_collection ( $ this -> keyword , $ this -> author ) ; return $ ret ; } | Look for a link in merlot . org |
30,209 | public function get_listing ( $ path = '' , $ page = '' ) { $ ret = array ( ) ; $ ret [ 'nologin' ] = true ; $ ret [ 'list' ] = $ this -> _get_collection ( $ this -> keyword ) ; return $ ret ; } | Get a list of links |
30,210 | public function print_login ( ) { $ ret = array ( ) ; $ search = new stdClass ( ) ; $ search -> type = 'text' ; $ search -> id = 'merlog_search' ; $ search -> name = 'merlot_keyword' ; $ search -> label = get_string ( 'search' ) . ': ' ; $ author = new stdClass ( ) ; $ author -> type = 'text' ; $ author -> id = 'merlog... | Define a search form |
30,211 | public function createFolder ( $ parentFolderPath , $ folderName ) { $ this -> throwIfOperationNotInBaseFolder ( $ parentFolderPath ) ; $ folderPath = $ parentFolderPath . '/' . $ folderName ; $ wasCreationSuccessful = mkdir ( $ folderPath , 0777 , true ) ; if ( ! $ wasCreationSuccessful ) { throw new IOException ( "Un... | Creates an empty folder with the given name under the given parent folder . |
30,212 | public function createFileWithContents ( $ parentFolderPath , $ fileName , $ fileContents ) { $ this -> throwIfOperationNotInBaseFolder ( $ parentFolderPath ) ; $ filePath = $ parentFolderPath . '/' . $ fileName ; $ wasCreationSuccessful = file_put_contents ( $ filePath , $ fileContents ) ; if ( $ wasCreationSuccessful... | Creates a file with the given name and content in the given folder . The parent folder must exist . |
30,213 | public function deleteFile ( $ filePath ) { $ this -> throwIfOperationNotInBaseFolder ( $ filePath ) ; if ( file_exists ( $ filePath ) && is_file ( $ filePath ) ) { unlink ( $ filePath ) ; } } | Delete the file at the given path |
30,214 | public function deleteFolderRecursively ( $ folderPath ) { $ this -> throwIfOperationNotInBaseFolder ( $ folderPath ) ; $ itemIterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ folderPath , \ RecursiveDirectoryIterator :: SKIP_DOTS ) , \ RecursiveIteratorIterator :: CHILD_FIRST ) ; foreac... | Delete the folder at the given path as well as all its contents |
30,215 | public function getChartByIndex ( $ index = null ) { $ chartCount = count ( $ this -> chartCollection ) ; if ( $ chartCount == 0 ) { return false ; } if ( is_null ( $ index ) ) { $ index = -- $ chartCount ; } if ( ! isset ( $ this -> chartCollection [ $ index ] ) ) { return false ; } return $ this -> chartCollection [ ... | Get a chart by its index position |
30,216 | public function getChartByName ( $ chartName = '' ) { $ chartCount = count ( $ this -> chartCollection ) ; if ( $ chartCount == 0 ) { return false ; } foreach ( $ this -> chartCollection as $ index => $ chart ) { if ( $ chart -> getName ( ) == $ chartName ) { return $ this -> chartCollection [ $ index ] ; } } return fa... | Get a chart by name |
30,217 | public function refreshColumnDimensions ( ) { $ currentColumnDimensions = $ this -> getColumnDimensions ( ) ; $ newColumnDimensions = array ( ) ; foreach ( $ currentColumnDimensions as $ objColumnDimension ) { $ newColumnDimensions [ $ objColumnDimension -> getColumnIndex ( ) ] = $ objColumnDimension ; } $ this -> colu... | Refresh column dimensions |
30,218 | public function cellExists ( $ pCoordinate = 'A1' ) { if ( strpos ( $ pCoordinate , '!' ) !== false ) { $ worksheetReference = PHPExcel_Worksheet :: extractSheetTitle ( $ pCoordinate , true ) ; return $ this -> parent -> getSheetByName ( $ worksheetReference [ 0 ] ) -> cellExists ( strtoupper ( $ worksheetReference [ 1... | Does the cell at a specific coordinate exist? |
30,219 | public function setDefaultStyle ( PHPExcel_Style $ pValue ) { $ this -> parent -> getDefaultStyle ( ) -> applyFromArray ( array ( 'font' => array ( 'name' => $ pValue -> getFont ( ) -> getName ( ) , 'size' => $ pValue -> getFont ( ) -> getSize ( ) , ) , ) ) ; return $ this ; } | Set default style - should only be used by PHPExcel_IReader implementations! |
30,220 | public function getStyleByColumnAndRow ( $ pColumn = 0 , $ pRow = 1 , $ pColumn2 = null , $ pRow2 = null ) { if ( ! is_null ( $ pColumn2 ) && ! is_null ( $ pRow2 ) ) { $ cellRange = PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn ) . $ pRow . ':' . PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn2 ) . $ pRow2 ; re... | Get style for cell by using numeric cell coordinates |
30,221 | public function setSharedStyle ( PHPExcel_Style $ pSharedCellStyle = null , $ pRange = '' ) { $ this -> duplicateStyle ( $ pSharedCellStyle , $ pRange ) ; return $ this ; } | Set shared cell style to a range of cells |
30,222 | public function duplicateStyleArray ( $ pStyles = null , $ pRange = '' , $ pAdvanced = true ) { $ this -> getStyle ( $ pRange ) -> applyFromArray ( $ pStyles , $ pAdvanced ) ; return $ this ; } | Duplicate cell style array to a range of cells |
30,223 | public function setBreakByColumnAndRow ( $ pColumn = 0 , $ pRow = 1 , $ pBreak = PHPExcel_Worksheet :: BREAK_NONE ) { return $ this -> setBreak ( PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn ) . $ pRow , $ pBreak ) ; } | Set break on a cell by using numeric cell coordinates |
30,224 | public function mergeCellsByColumnAndRow ( $ pColumn1 = 0 , $ pRow1 = 1 , $ pColumn2 = 0 , $ pRow2 = 1 ) { $ cellRange = PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn1 ) . $ pRow1 . ':' . PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn2 ) . $ pRow2 ; return $ this -> mergeCells ( $ cellRange ) ; } | Set merge on a cell range by using numeric cell coordinates |
30,225 | public function unmergeCells ( $ pRange = 'A1:A1' ) { $ pRange = strtoupper ( $ pRange ) ; if ( strpos ( $ pRange , ':' ) !== false ) { if ( isset ( $ this -> mergeCells [ $ pRange ] ) ) { unset ( $ this -> mergeCells [ $ pRange ] ) ; } else { throw new PHPExcel_Exception ( 'Cell range ' . $ pRange . ' not known as mer... | Remove merge on a cell range |
30,226 | public function unmergeCellsByColumnAndRow ( $ pColumn1 = 0 , $ pRow1 = 1 , $ pColumn2 = 0 , $ pRow2 = 1 ) { $ cellRange = PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn1 ) . $ pRow1 . ':' . PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn2 ) . $ pRow2 ; return $ this -> unmergeCells ( $ cellRange ) ; } | Remove merge on a cell range by using numeric cell coordinates |
30,227 | public function protectCells ( $ pRange = 'A1' , $ pPassword = '' , $ pAlreadyHashed = false ) { $ pRange = strtoupper ( $ pRange ) ; if ( ! $ pAlreadyHashed ) { $ pPassword = PHPExcel_Shared_PasswordHasher :: hashPassword ( $ pPassword ) ; } $ this -> protectedCells [ $ pRange ] = $ pPassword ; return $ this ; } | Set protection on a cell range |
30,228 | public function protectCellsByColumnAndRow ( $ pColumn1 = 0 , $ pRow1 = 1 , $ pColumn2 = 0 , $ pRow2 = 1 , $ pPassword = '' , $ pAlreadyHashed = false ) { $ cellRange = PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn1 ) . $ pRow1 . ':' . PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn2 ) . $ pRow2 ; return $ this... | Set protection on a cell range by using numeric cell coordinates |
30,229 | public function unprotectCellsByColumnAndRow ( $ pColumn1 = 0 , $ pRow1 = 1 , $ pColumn2 = 0 , $ pRow2 = 1 , $ pPassword = '' , $ pAlreadyHashed = false ) { $ cellRange = PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn1 ) . $ pRow1 . ':' . PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn2 ) . $ pRow2 ; return $ th... | Remove protection on a cell range by using numeric cell coordinates |
30,230 | public function setAutoFilterByColumnAndRow ( $ pColumn1 = 0 , $ pRow1 = 1 , $ pColumn2 = 0 , $ pRow2 = 1 ) { return $ this -> setAutoFilter ( PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn1 ) . $ pRow1 . ':' . PHPExcel_Cell :: stringFromColumnIndex ( $ pColumn2 ) . $ pRow2 ) ; } | Set Autofilter Range by using numeric cell coordinates |
30,231 | public function insertNewRowBefore ( $ pBefore = 1 , $ pNumRows = 1 ) { if ( $ pBefore >= 1 ) { $ objReferenceHelper = PHPExcel_ReferenceHelper :: getInstance ( ) ; $ objReferenceHelper -> insertNewBefore ( 'A' . $ pBefore , 0 , $ pNumRows , $ this ) ; } else { throw new PHPExcel_Exception ( "Rows can only be inserted ... | Insert a new row updating all possible related data |
30,232 | public function getComment ( $ pCellCoordinate = 'A1' ) { $ pCellCoordinate = strtoupper ( $ pCellCoordinate ) ; if ( strpos ( $ pCellCoordinate , ':' ) !== false || strpos ( $ pCellCoordinate , ',' ) !== false ) { throw new PHPExcel_Exception ( 'Cell coordinate string can not be a range of cells.' ) ; } elseif ( strpo... | Get comment for cell |
30,233 | public function toArray ( $ nullValue = null , $ calculateFormulas = true , $ formatData = true , $ returnCellRef = false ) { $ this -> garbageCollect ( ) ; $ maxCol = $ this -> getHighestColumn ( ) ; $ maxRow = $ this -> getHighestRow ( ) ; return $ this -> rangeToArray ( 'A1:' . $ maxCol . $ maxRow , $ nullValue , $ ... | Create array from worksheet |
30,234 | public static function extractSheetTitle ( $ pRange , $ returnRange = false ) { if ( ( $ sep = strpos ( $ pRange , '!' ) ) === false ) { return '' ; } if ( $ returnRange ) { return array ( trim ( substr ( $ pRange , 0 , $ sep ) , "'" ) , substr ( $ pRange , $ sep + 1 ) ) ; } return substr ( $ pRange , $ sep + 1 ) ; } | Extract worksheet title from range . |
30,235 | public static function copy_file_moodle2backup ( $ backupid , $ filerecorid ) { global $ DB ; if ( ! backup_controller_dbops :: backup_includes_files ( $ backupid ) ) { return ; } if ( ! is_object ( $ filerecorid ) ) { $ filerecorid = $ DB -> get_record ( 'files' , array ( 'id' => $ filerecorid ) ) ; } if ( $ filerecor... | Copy one file from moodle storage to backup storage |
30,236 | public function execute ( ) { global $ DB ; $ started = time ( ) ; $ restoreid = $ this -> get_custom_data ( ) -> backupid ; $ restorerecordid = $ DB -> get_field ( 'backup_controllers' , 'id' , array ( 'backupid' => $ restoreid ) , MUST_EXIST ) ; mtrace ( 'Processing asynchronous restore for id: ' . $ restoreid ) ; $ ... | Run the adhoc task and preform the restore . |
30,237 | function supportedPlatform ( $ platform = NULL ) { return is_object ( $ this -> parent ) ? $ this -> parent -> supportedPlatform ( $ platform ) : TRUE ; } | Checks whether the specified RDBMS is supported by the current database object or its ranking ancestor . |
30,238 | function prefix ( $ name = '' ) { return is_object ( $ this -> parent ) ? $ this -> parent -> prefix ( $ name ) : $ name ; } | Returns the prefix set by the ranking ancestor of the database object . |
30,239 | function addIndex ( $ attributes ) { $ name = strtoupper ( $ attributes [ 'NAME' ] ) ; $ this -> indexes [ $ name ] = new dbIndex ( $ this , $ attributes ) ; return $ this -> indexes [ $ name ] ; } | Adds an index to a table object |
30,240 | function addData ( $ attributes ) { if ( ! isset ( $ this -> data ) ) { $ this -> data = new dbData ( $ this , $ attributes ) ; } return $ this -> data ; } | Adds data to a table object |
30,241 | function addField ( $ name , $ type , $ size = NULL , $ opts = NULL ) { $ field_id = $ this -> FieldID ( $ name ) ; $ this -> current_field = $ field_id ; $ this -> fields [ $ field_id ] [ 'NAME' ] = $ name ; $ this -> fields [ $ field_id ] [ 'TYPE' ] = $ type ; if ( isset ( $ size ) ) { $ this -> fields [ $ field_id ]... | Adds a field to a table object |
30,242 | function addFieldOpt ( $ field , $ opt , $ value = NULL ) { if ( $ this -> currentPlatform ) { if ( ! isset ( $ value ) ) { $ this -> fields [ $ this -> FieldID ( $ field ) ] [ 'OPTS' ] [ ] = $ opt ; } else { $ this -> fields [ $ this -> FieldID ( $ field ) ] [ 'OPTS' ] [ ] = array ( $ opt => $ value ) ; } } } | Adds a field option to the current field specifier |
30,243 | function addTableOpt ( $ opt ) { if ( isset ( $ this -> currentPlatform ) ) { $ this -> opts [ $ this -> parent -> db -> databaseType ] = $ opt ; } return $ this -> opts ; } | Adds an option to the table |
30,244 | function drop ( ) { if ( isset ( $ this -> current_field ) ) { logMsg ( "Dropping field '{$this->current_field}' from table '{$this->name}'" ) ; $ this -> drop_field [ $ this -> current_field ] = $ this -> current_field ; } else { logMsg ( "Dropping table '{$this->name}'" ) ; $ this -> drop_table = TRUE ; } } | Marks a field or table for destruction |
30,245 | function addField ( $ attributes ) { if ( ! isset ( $ this -> row ) || ! isset ( $ this -> data [ $ this -> row ] ) ) { return ; } if ( isset ( $ attributes [ 'NAME' ] ) ) { $ this -> current_field = $ this -> FieldID ( $ attributes [ 'NAME' ] ) ; } else { $ this -> current_field = count ( $ this -> data [ $ this -> ro... | Adds a field to the insert |
30,246 | function buildQuery ( $ sql = NULL ) { if ( ! isset ( $ this -> query ) OR empty ( $ sql ) ) { return FALSE ; } $ this -> query .= $ sql ; return $ this -> query ; } | Appends a line to a query that is being built line by line |
30,247 | function addQuery ( ) { if ( ! isset ( $ this -> query ) ) { return FALSE ; } $ this -> queries [ ] = $ return = trim ( $ this -> query ) ; unset ( $ this -> query ) ; return $ return ; } | Adds a completed query to the query list |
30,248 | function create ( & $ xmls ) { foreach ( $ this -> queries as $ id => $ query ) { switch ( $ this -> prefixMethod ) { case 'AUTO' : $ query = $ this -> prefixQuery ( '/^\s*((?is)INSERT\s+(INTO\s+)?)((\w+\s*,?\s*)+)(\s.*$)/' , $ query , $ xmls -> objectPrefix ) ; $ query = $ this -> prefixQuery ( '/^\s*((?is)UPDATE\s+(F... | Creates and returns the current query set |
30,249 | function prefixQuery ( $ regex , $ query , $ prefix = NULL ) { if ( ! isset ( $ prefix ) ) { return $ query ; } if ( preg_match ( $ regex , $ query , $ match ) ) { $ preamble = $ match [ 1 ] ; $ postamble = $ match [ 5 ] ; $ objectList = explode ( ',' , $ match [ 3 ] ) ; $ prefixedList = '' ; foreach ( $ objectList as ... | Rebuilds the query with the prefix attached to any objects |
30,250 | protected function define_settings ( ) { global $ CFG ; require_once ( $ CFG -> libdir . '/questionlib.php' ) ; $ settingprefix = $ this -> modulename . '_' . $ this -> moduleid . '_' ; $ settingname = $ settingprefix . 'included' ; $ activity_included = new backup_activity_generic_setting ( $ settingname , base_settin... | Defines the common setting that any backup activity will have |
30,251 | public function update_course_format_options ( $ data , $ oldcourse = null ) { $ data = ( array ) $ data ; if ( $ oldcourse !== null ) { $ oldcourse = ( array ) $ oldcourse ; $ options = $ this -> course_format_options ( ) ; foreach ( $ options as $ key => $ unused ) { if ( ! array_key_exists ( $ key , $ data ) ) { if ... | Updates format options for a course |
30,252 | public static function create_delete_data_request ( \ core \ event \ user_deleted $ event ) { if ( get_config ( 'tool_dataprivacy' , 'automaticdeletionrequests' ) ) { $ requesttypes = [ api :: DATAREQUEST_TYPE_DELETE ] ; $ requeststatuses = [ api :: DATAREQUEST_STATUS_COMPLETE , api :: DATAREQUEST_STATUS_DELETED ] ; $ ... | Create user data deletion request when the user is deleted . |
30,253 | protected function feedback_viewed ( \ cm_info $ cm , $ contextid , $ userid , $ after = null ) { if ( ! empty ( $ this -> instancedata [ $ cm -> instance ] -> publish_stats ) ) { $ user = ( object ) [ 'id' => $ userid ] ; return $ this -> any_write_log ( $ contextid , $ user ) ; } return parent :: feedback_viewed ( $ ... | Overwritten to mark as viewed if stats are published . |
30,254 | public static function register ( ) { if ( self :: $ registered ) { return ; } self :: $ libDir = dirname ( __FILE__ ) ; if ( false === spl_autoload_register ( array ( 'Less_Autoloader' , 'loadClass' ) ) ) { throw new Exception ( 'Unable to register Less_Autoloader::loadClass as an autoloading method.' ) ; } self :: $ ... | Register the autoloader in the spl autoloader |
30,255 | public static function loadClass ( $ className ) { if ( strpos ( $ className , 'Less_' ) !== 0 ) { return ; } $ className = substr ( $ className , 5 ) ; $ fileName = self :: $ libDir . DIRECTORY_SEPARATOR . str_replace ( '_' , DIRECTORY_SEPARATOR , $ className ) . '.php' ; if ( file_exists ( $ fileName ) ) { require $ ... | Loads the class |
30,256 | public function export_data ( array $ subcontext , \ stdClass $ data ) : content_writer { $ path = $ this -> get_path ( $ subcontext , 'data.json' ) ; $ this -> write_data ( $ path , json_encode ( $ data , JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT ) ) ; return $ this ; } | Export the supplied data within the current context at the supplied subcontext . |
30,257 | public function export_metadata ( array $ subcontext , string $ key , $ value , string $ description ) : content_writer { $ path = $ this -> get_full_path ( $ subcontext , 'metadata.json' ) ; if ( file_exists ( $ path ) ) { $ data = json_decode ( file_get_contents ( $ path ) ) ; } else { $ data = ( object ) [ ] ; } $ d... | Export metadata about the supplied subcontext . |
30,258 | public function export_related_data ( array $ subcontext , $ name , $ data ) : content_writer { $ path = $ this -> get_path ( $ subcontext , "{$name}.json" ) ; $ this -> write_data ( $ path , json_encode ( $ data , JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT ) ) ; return $ this ; } | Export a piece of related data . |
30,259 | public function export_custom_file ( array $ subcontext , $ filename , $ filecontent ) : content_writer { $ filename = clean_param ( $ filename , PARAM_FILE ) ; $ path = $ this -> get_path ( $ subcontext , $ filename ) ; $ this -> write_data ( $ path , $ filecontent ) ; return $ this ; } | Export a piece of data in a custom format . |
30,260 | public function rewrite_pluginfile_urls ( array $ subcontext , $ component , $ filearea , $ itemid , $ text ) : string { $ subcontextpath = '' ; if ( ! empty ( $ subcontext ) ) { $ subcontextpath = DIRECTORY_SEPARATOR . implode ( DIRECTORY_SEPARATOR , $ subcontext ) ; } $ path = $ this -> get_context_path ( ) ; $ path ... | Prepare a text area by processing pluginfile URLs within it . |
30,261 | public function export_area_files ( array $ subcontext , $ component , $ filearea , $ itemid ) : content_writer { $ fs = get_file_storage ( ) ; $ files = $ fs -> get_area_files ( $ this -> context -> id , $ component , $ filearea , $ itemid ) ; foreach ( $ files as $ file ) { $ this -> export_file ( $ subcontext , $ fi... | Export all files within the specified component filearea itemid combination . |
30,262 | public function export_file ( array $ subcontext , \ stored_file $ file ) : content_writer { if ( ! $ file -> is_directory ( ) ) { $ pathitems = array_merge ( $ subcontext , [ $ this -> get_files_target_path ( $ file -> get_component ( ) , $ file -> get_filearea ( ) , $ file -> get_itemid ( ) ) ] , [ $ file -> get_file... | Export the specified file in the target location . |
30,263 | protected function get_context_path ( ) : array { $ path = [ ] ; $ contexts = array_reverse ( $ this -> context -> get_parent_contexts ( true ) ) ; foreach ( $ contexts as $ context ) { $ name = $ context -> get_context_name ( ) ; $ id = ' _.' . $ context -> id ; $ path [ ] = shorten_text ( clean_param ( $ name , PARAM... | Determine the path for the current context . |
30,264 | protected function get_path ( array $ subcontext , string $ name ) : string { $ subcontext = shorten_filenames ( $ subcontext , MAX_FILENAME_SIZE , true ) ; $ name = shorten_filename ( $ name , MAX_FILENAME_SIZE , true ) ; $ subcontext = array_map ( function ( $ data ) { if ( stripos ( $ data , DIRECTORY_SEPARATOR ) !=... | Get the relative file path within the current context and subcontext using the specified filename . |
30,265 | protected function get_full_path ( array $ subcontext , string $ name ) : string { $ path = array_merge ( [ $ this -> path ] , [ $ this -> get_path ( $ subcontext , $ name ) ] ) ; $ filepath = implode ( DIRECTORY_SEPARATOR , $ path ) ; $ separator = str_replace ( '\\' , '\\\\' , DIRECTORY_SEPARATOR ) ; return preg_repl... | Get the fully - qualified file path within the current context and subcontext using the specified filename . |
30,266 | protected function get_files_target_path ( $ component , $ filearea , $ itemid ) : string { $ parts = [ '_files' , $ filearea ] ; if ( ! empty ( $ itemid ) ) { $ parts [ ] = $ itemid ; } return implode ( DIRECTORY_SEPARATOR , $ parts ) ; } | Get a path within a subcontext where exported files should be written to . |
30,267 | protected function get_files_target_url ( $ component , $ filearea , $ itemid ) : string { $ parts = [ '_files' , $ filearea ] ; if ( ! empty ( $ itemid ) ) { $ parts [ ] = '_' . $ itemid ; } return implode ( '/' , $ parts ) ; } | Get a relative url to the directory of the exported files within a subcontext . |
30,268 | protected function write_data ( string $ path , string $ data ) { $ targetpath = $ this -> path . DIRECTORY_SEPARATOR . $ path ; check_dir_exists ( dirname ( $ targetpath ) , true , true ) ; if ( file_put_contents ( $ targetpath , $ data ) === false ) { throw new \ moodle_exception ( 'cannotsavefile' , 'error' , '' , $... | Write the data to the specified path . |
30,269 | protected function copy_data ( array $ path , array $ destination ) { global $ CFG ; $ filename = array_pop ( $ destination ) ; $ destdirectory = implode ( DIRECTORY_SEPARATOR , $ destination ) ; $ fulldestination = $ this -> path . DIRECTORY_SEPARATOR . $ destdirectory ; check_dir_exists ( $ fulldestination , true , t... | Copy a file to the specified path . |
30,270 | protected function make_tree_object ( array $ tree , array $ treekey , array $ currentkey = [ ] ) : Array { $ newtree = [ ] ; $ addcontext = function ( $ index , $ object ) { if ( stripos ( $ index , '_.' ) !== false ) { $ namearray = explode ( '_.' , $ index ) ; $ contextid = array_pop ( $ namearray ) ; if ( is_numeri... | Add more detail to the tree to help with sorting and display in the renderer . |
30,271 | protected function check_plugin_is_installed ( string $ component ) : Bool { if ( ! isset ( $ this -> checkedplugins [ $ component ] ) ) { $ pluginmanager = \ core_plugin_manager :: instance ( ) ; $ plugin = $ pluginmanager -> get_plugin_info ( $ component ) ; $ this -> checkedplugins [ $ component ] = ! is_null ( $ pl... | Check to see if a specified plugin is installed . |
30,272 | public function finalise_content ( ) : string { $ this -> write_html_data ( ) ; $ exportfile = make_request_directory ( ) . '/export.zip' ; $ fp = get_file_packer ( ) ; $ fp -> archive_to_pathname ( $ this -> files , $ exportfile ) ; writer :: reset ( ) ; return $ exportfile ; } | Perform any required finalisation steps and return the location of the finalised export . |
30,273 | protected function generate_count_records_sql ( string $ wheresql = null ) : string { $ alias = $ this -> get_table_alias ( ) ; $ db = $ this -> get_db ( ) ; $ selectsql = "SELECT COUNT(1) FROM {" . self :: TABLE . "} {$alias}" ; $ selectsql .= $ wheresql ? ' WHERE ' . $ wheresql : '' ; return $ selectsql ; } | Build the SQL to be used in count_records_sql . |
30,274 | protected function from_db_records ( array $ results ) { $ entityfactory = $ this -> get_entity_factory ( ) ; return array_map ( function ( array $ result ) use ( $ entityfactory ) { [ 'discussion' => $ discussion , 'firstpost' => $ firstpost , 'firstpostauthor' => $ firstpostauthor , 'latestpostauthor' => $ latestpost... | Convert the DB records into discussion list entities . |
30,275 | protected function get_keyfield ( ? int $ sortmethod ) : string { switch ( $ sortmethod ) { case self :: SORTORDER_CREATED_DESC : case self :: SORTORDER_CREATED_ASC : return 'fp.created' ; case self :: SORTORDER_REPLIES_DESC : case self :: SORTORDER_REPLIES_ASC : return 'replycount' ; default : global $ CFG ; $ alias =... | Get the field to sort by . |
30,276 | protected function get_sort_direction ( ? int $ sortmethod ) : string { switch ( $ sortmethod ) { case self :: SORTORDER_LASTPOST_ASC : case self :: SORTORDER_CREATED_ASC : case self :: SORTORDER_REPLIES_ASC : return "ASC" ; case self :: SORTORDER_LASTPOST_DESC : case self :: SORTORDER_CREATED_DESC : case self :: SORTO... | Get the sort direction . |
30,277 | private function get_sort_order ( ? int $ sortmethod , bool $ includefavourites = true ) : string { $ alias = $ this -> get_table_alias ( ) ; $ keyfield = $ this -> get_keyfield ( $ sortmethod ) ; $ direction = $ this -> get_sort_direction ( $ sortmethod ) ; $ favouritesort = '' ; if ( $ includefavourites ) { $ favalia... | Get the sort order SQL for a sort method . |
30,278 | protected function get_hidden_post_sql ( bool $ includehiddendiscussions , ? int $ includepostsforuser ) { $ wheresql = '' ; $ params = [ ] ; if ( ! $ includehiddendiscussions ) { $ now = time ( ) ; $ wheresql = " AND ((d.timestart <= :timestart AND (d.timeend = 0 OR d.timeend > :timeend))" ; $ params [ 'timestart' ] =... | Fetch any required SQL to respect timed posts . |
30,279 | public function get_from_forum_id ( int $ forumid , bool $ includehiddendiscussions , ? int $ includepostsforuser , ? int $ sortorder , int $ limit , int $ offset ) { $ alias = $ this -> get_table_alias ( ) ; $ wheresql = "{$alias}.forum = :forumid" ; [ 'wheresql' => $ hiddensql , 'params' => $ hiddenparams ] = $ this ... | Get each discussion first post first and last post author for the given forum considering timed posts and pagination . |
30,280 | public function get_from_forum_id_and_group_id ( int $ forumid , array $ groupids , bool $ includehiddendiscussions , ? int $ includepostsforuser , ? int $ sortorder , int $ limit , int $ offset ) { $ alias = $ this -> get_table_alias ( ) ; $ wheresql = "{$alias}.forum = :forumid AND " ; $ groupparams = [ ] ; if ( empt... | Get each discussion first post first and last post author for the given forum and the set of groups to display considering timed posts and pagination . |
30,281 | public function get_total_discussion_count_from_forum_id ( int $ forumid , bool $ includehiddendiscussions , ? int $ includepostsforuser ) { $ alias = $ this -> get_table_alias ( ) ; $ wheresql = "{$alias}.forum = :forumid" ; [ 'wheresql' => $ hiddensql , 'params' => $ hiddenparams ] = $ this -> get_hidden_post_sql ( $... | Count the number of discussions in the forum . |
30,282 | public function get_total_discussion_count_from_forum_id_and_group_id ( int $ forumid , array $ groupids , bool $ includehiddendiscussions , ? int $ includepostsforuser ) { $ alias = $ this -> get_table_alias ( ) ; $ wheresql = "{$alias}.forum = :forumid AND " ; $ groupparams = [ ] ; if ( empty ( $ groupids ) ) { $ whe... | Count the number of discussions in all groups and the list of groups provided . |
30,283 | private function get_favourite_sql ( int $ userid ) : array { $ usercontext = \ context_user :: instance ( $ userid ) ; $ alias = $ this -> get_table_alias ( ) ; $ ufservice = \ core_favourites \ service_factory :: get_service_for_user_context ( $ usercontext ) ; list ( $ favsql , $ favparams ) = $ ufservice -> get_joi... | Get the standard favouriting sql . |
30,284 | public static function get_list_of_timezones ( $ currentvalue = null , $ include99 = false ) { self :: init_zones ( ) ; $ timezones = array ( ) ; foreach ( self :: $ goodzones as $ tzkey => $ ignored ) { $ timezones [ $ tzkey ] = self :: get_localised_timezone ( $ tzkey ) ; } core_collator :: asort ( $ timezones ) ; if... | Returns a localised list of timezones . |
30,285 | public static function get_localised_timezone ( $ tz ) { if ( $ tz == 99 ) { $ tz = self :: get_server_timezone ( ) ; $ tz = self :: get_localised_timezone ( $ tz ) ; return get_string ( 'timezoneserver' , 'core_admin' , $ tz ) ; } if ( get_string_manager ( ) -> string_exists ( strtolower ( $ tz ) , 'core_timezones' ) ... | Returns localised timezone name . |
30,286 | public static function get_server_timezone ( ) { global $ CFG ; if ( ! isset ( $ CFG -> timezone ) or $ CFG -> timezone == 99 or $ CFG -> timezone === '' ) { return self :: get_default_php_timezone ( ) ; } return self :: normalise_timezone ( $ CFG -> timezone ) ; } | Returns server timezone . |
30,287 | public static function get_user_timezone ( $ userorforcedtz = null ) { global $ USER , $ CFG ; if ( $ userorforcedtz instanceof DateTimeZone ) { return $ userorforcedtz -> getName ( ) ; } if ( isset ( $ userorforcedtz ) and ! is_object ( $ userorforcedtz ) and $ userorforcedtz != 99 ) { return self :: normalise_timezon... | Returns user timezone . |
30,288 | public function options ( ) { $ result = array ( ) ; foreach ( $ this -> items as $ itemid => $ item ) { $ result [ $ itemid ] = $ item -> get_name ( ) ; } return $ result ; } | Convert the list of items to a list of options . |
30,289 | public function init ( $ selfitemisempty = false ) { global $ DB ; if ( ! $ selfitemisempty ) { $ validusers = $ this -> load_users ( ) ; if ( ! isset ( $ validusers [ $ this -> itemid ] ) ) { $ this -> item = reset ( $ validusers ) ; $ this -> itemid = $ this -> item -> id ; } else { $ this -> item = $ validusers [ $ ... | Init the screen |
30,290 | public function original_headers ( ) { return array ( '' , get_string ( 'assessmentname' , 'gradereport_singleview' ) , get_string ( 'gradecategory' , 'grades' ) , get_string ( 'range' , 'grades' ) , get_string ( 'grade' , 'grades' ) , get_string ( 'feedback' , 'grades' ) , $ this -> make_toggle_links ( 'override' ) , ... | Get the list of headers for the table . |
30,291 | public function format_line ( $ item ) { global $ OUTPUT ; $ grade = $ this -> fetch_grade_or_default ( $ item , $ this -> item -> id ) ; $ lockicon = '' ; $ lockeditem = $ lockeditemgrade = 0 ; if ( ! empty ( $ grade -> locked ) ) { $ lockeditem = 1 ; } if ( ! empty ( $ grade -> grade_item -> locked ) ) { $ lockeditem... | Format each row of the table . |
30,292 | private function category ( $ item ) { global $ DB ; if ( empty ( $ item -> categoryid ) ) { if ( $ item -> itemtype == 'course' ) { return $ this -> course -> fullname ; } $ params = array ( 'id' => $ item -> iteminstance ) ; $ elem = $ DB -> get_record ( 'grade_categories' , $ params ) ; return $ elem -> fullname ; }... | Helper to get the category for an item . |
30,293 | public function process ( $ data ) { $ bulk = new bulk_insert ( $ this -> item ) ; if ( $ bulk -> is_applied ( $ data ) ) { $ filter = $ bulk -> get_type ( $ data ) ; $ insertvalue = $ bulk -> get_insert_value ( $ data ) ; $ userid = $ this -> item -> id ; foreach ( $ this -> items as $ gradeitemid => $ gradeitem ) { $... | Process the data from the form . |
30,294 | protected function define_my_steps ( ) { $ this -> add_step ( new backup_quiz_activity_structure_step ( 'quiz_structure' , 'quiz.xml' ) ) ; $ this -> add_step ( new backup_calculate_question_categories ( 'activity_question_categories' ) ) ; $ this -> add_step ( new backup_delete_temp_questions ( 'clean_temp_questions' ... | Defines backup steps to store the instance data and required questions |
30,295 | public function bulkWrite ( array $ operations , array $ options = [ ] ) { if ( ! isset ( $ options [ 'writeConcern' ] ) ) { $ options [ 'writeConcern' ] = $ this -> writeConcern ; } $ operation = new BulkWrite ( $ this -> databaseName , $ this -> collectionName , $ operations , $ options ) ; $ server = $ this -> manag... | Executes multiple write operations . |
30,296 | public function createIndex ( $ key , array $ options = [ ] ) { $ commandOptionKeys = [ 'maxTimeMS' => 1 , 'session' => 1 , 'writeConcern' => 1 ] ; $ indexOptions = array_diff_key ( $ options , $ commandOptionKeys ) ; $ commandOptions = array_intersect_key ( $ options , $ commandOptionKeys ) ; return current ( $ this -... | Create a single index for the collection . |
30,297 | public function createIndexes ( array $ indexes , array $ options = [ ] ) { $ server = $ this -> manager -> selectServer ( new ReadPreference ( ReadPreference :: RP_PRIMARY ) ) ; if ( ! isset ( $ options [ 'writeConcern' ] ) && \ MongoDB \ server_supports_feature ( $ server , self :: $ wireVersionForWritableCommandWrit... | Create one or more indexes for the collection . |
30,298 | public function deleteMany ( $ filter , array $ options = [ ] ) { if ( ! isset ( $ options [ 'writeConcern' ] ) ) { $ options [ 'writeConcern' ] = $ this -> writeConcern ; } $ operation = new DeleteMany ( $ this -> databaseName , $ this -> collectionName , $ filter , $ options ) ; $ server = $ this -> manager -> select... | Deletes all documents matching the filter . |
30,299 | public function deleteOne ( $ filter , array $ options = [ ] ) { if ( ! isset ( $ options [ 'writeConcern' ] ) ) { $ options [ 'writeConcern' ] = $ this -> writeConcern ; } $ operation = new DeleteOne ( $ this -> databaseName , $ this -> collectionName , $ filter , $ options ) ; $ server = $ this -> manager -> selectSe... | Deletes at most one document matching the filter . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.