idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
32,700 | public function should_show_for_user ( ) { if ( ! $ this -> is_enabled ( ) ) { return false ; } if ( $ tourcompletiondate = get_user_preferences ( self :: TOUR_LAST_COMPLETED_BY_USER . $ this -> get_id ( ) , null ) ) { if ( $ tourresetdate = get_user_preferences ( self :: TOUR_REQUESTED_BY_USER . $ this -> get_id ( ) ,... | Whether this tour should be displayed to the user . |
32,701 | public function get_tour_key ( ) { global $ USER ; $ tourtime = $ this -> get_config ( 'majorupdatetime' , null ) ; if ( $ tourtime === null ) { $ this -> set_config ( 'majorupdatetime' , time ( ) ) ; $ this -> persist ( ) ; $ tourtime = $ this -> get_config ( 'majorupdatetime' , null ) ; } if ( $ userresetdate = get_u... | Get the key for this tour . This is used in the session cookie to determine whether the user has seen this tour before . |
32,702 | public function mark_major_change ( ) { global $ DB ; $ DB -> delete_records ( 'user_preferences' , [ 'name' => self :: TOUR_LAST_COMPLETED_BY_USER . $ this -> get_id ( ) ] ) ; $ DB -> delete_records ( 'user_preferences' , [ 'name' => self :: TOUR_REQUESTED_BY_USER . $ this -> get_id ( ) ] ) ; $ this -> set_config ( 'm... | Update a tour giving it a new major update time . This will ensure that it is displayed to all users even those who have already seen it . |
32,703 | public function get_filter_values ( $ filter ) { if ( $ allvalues = ( array ) $ this -> get_config ( 'filtervalues' ) ) { if ( isset ( $ allvalues [ $ filter ] ) ) { return $ allvalues [ $ filter ] ; } } return [ ] ; } | Get the configured filter values . |
32,704 | public function set_filter_values ( $ filter , array $ values = [ ] ) { $ allvalues = ( array ) $ this -> get_config ( 'filtervalues' , [ ] ) ; $ allvalues [ $ filter ] = $ values ; return $ this -> set_config ( 'filtervalues' , $ allvalues ) ; } | Set the values for the specified filter . |
32,705 | public function matches_all_filters ( \ context $ context ) { $ filters = helper :: get_all_filters ( ) ; foreach ( $ filters as $ filterclass ) { if ( ! $ filterclass :: filter_matches ( $ this , $ context ) ) { return false ; } } return true ; } | Check whether this tour matches all filters . |
32,706 | private function create_course ( ) { $ this -> log ( 'createcourse' , $ this -> shortname ) ; $ courserecord = array ( 'shortname' => $ this -> shortname , 'fullname' => $ this -> fullname , 'numsections' => self :: $ paramsections [ $ this -> size ] , 'startdate' => usergetmidnight ( time ( ) ) ) ; if ( strlen ( $ thi... | Creates the actual course . |
32,707 | private function create_user_accounts ( $ first , $ last ) { global $ CFG ; $ this -> log ( 'createaccounts' , ( object ) array ( 'from' => $ first , 'to' => $ last ) , true ) ; $ count = $ last - $ first + 1 ; $ done = 0 ; for ( $ number = $ first ; $ number <= $ last ; $ number ++ , $ done ++ ) { $ textnumber = ( str... | Creates user accounts with a numeric range . |
32,708 | private function create_assignments ( ) { $ assigngenerator = $ this -> generator -> get_plugin_generator ( 'mod_assign' ) ; $ number = self :: $ paramassignments [ $ this -> size ] ; $ this -> log ( 'createassignments' , $ number , true ) ; for ( $ i = 0 ; $ i < $ number ; $ i ++ ) { $ record = array ( 'course' => $ t... | Creates a number of Assignment activities . |
32,709 | private function create_pages ( ) { $ pagegenerator = $ this -> generator -> get_plugin_generator ( 'mod_page' ) ; $ number = self :: $ parampages [ $ this -> size ] ; $ this -> log ( 'createpages' , $ number , true ) ; for ( $ i = 0 ; $ i < $ number ; $ i ++ ) { $ record = array ( 'course' => $ this -> course ) ; $ op... | Creates a number of Page activities . |
32,710 | private function create_small_files ( ) { $ count = self :: $ paramsmallfilecount [ $ this -> size ] ; $ this -> log ( 'createsmallfiles' , $ count , true ) ; $ resourcegenerator = $ this -> generator -> get_plugin_generator ( 'mod_resource' ) ; $ record = array ( 'course' => $ this -> course , 'name' => get_string ( '... | Creates one resource activity with a lot of small files . |
32,711 | private function create_big_files ( ) { $ count = self :: $ parambigfilecount [ $ this -> size ] ; $ filesize = $ this -> limit_filesize ( self :: $ parambigfilesize [ $ this -> size ] ) ; $ blocks = ceil ( $ filesize / 65536 ) ; $ blocksize = floor ( $ filesize / $ blocks ) ; $ this -> log ( 'createbigfiles' , $ count... | Creates a number of resource activities with one big file each . |
32,712 | private function create_forum ( ) { global $ DB ; $ discussions = self :: $ paramforumdiscussions [ $ this -> size ] ; $ posts = self :: $ paramforumposts [ $ this -> size ] ; $ totalposts = $ discussions * $ posts ; $ this -> log ( 'createforum' , $ totalposts , true ) ; $ forumgenerator = $ this -> generator -> get_p... | Creates one forum activity with a bunch of posts . |
32,713 | private function get_target_section ( ) { if ( ! $ this -> fixeddataset ) { $ key = rand ( 1 , self :: $ paramsections [ $ this -> size ] ) ; } else { $ key = 1 ; } return $ key ; } | Gets a section number . |
32,714 | private function get_target_user ( ) { if ( ! $ this -> fixeddataset ) { $ userid = $ this -> userids [ rand ( 1 , self :: $ paramusers [ $ this -> size ] ) ] ; } else if ( $ userid = current ( $ this -> userids ) ) { next ( $ this -> userids ) ; } else { $ userid = reset ( $ this -> userids ) ; } return $ userid ; } | Gets a user id . |
32,715 | private function limit_filesize ( $ length ) { if ( is_numeric ( $ this -> filesizelimit ) && $ length > $ this -> filesizelimit ) { $ length = floor ( $ this -> filesizelimit ) ; } return $ length ; } | Restricts the binary file size if necessary |
32,716 | public function toFlowed ( $ quote = false , array $ opts = array ( ) ) { $ txt = '' ; $ this -> _reformat ( true , $ quote , empty ( $ opts [ 'nowrap' ] ) ) ; foreach ( $ this -> _output as $ line ) { $ txt .= $ line [ 'text' ] . "\n" ; } return $ txt ; } | Reformats the input string where the string is format = fixed plain text as described in RFC 2646 . |
32,717 | public function load_settings ( \ part_of_admin_tree $ adminroot , $ parentnodename , $ hassiteconfig ) { global $ CFG , $ USER , $ DB , $ OUTPUT , $ PAGE ; $ ADMIN = $ adminroot ; $ plugininfo = $ this ; if ( ! $ this -> is_installed_and_upgraded ( ) ) { return ; } if ( file_exists ( $ this -> full_path ( 'settings.ph... | Loads plugin settings to the settings tree |
32,718 | public function execute ( ) { global $ CFG , $ DB ; $ sql = "SELECT w.* FROM {workshopallocation_scheduled} a JOIN {workshop} w ON a.workshopid = w.id WHERE a.enabled = 1 AND w.phase = 20 AND w.submissionend > 0 AND ... | Run scheduled allocation cron . |
32,719 | public static function convertCharset ( $ input , $ from , $ to , $ force = false ) { if ( is_numeric ( $ input ) ) { return $ input ; } if ( ! $ force && $ from == $ to ) { return $ input ; } $ from = self :: lower ( $ from ) ; $ to = self :: lower ( $ to ) ; if ( ! $ force && $ from == $ to ) { return $ input ; } if ... | Converts a string from one charset to another . |
32,720 | protected static function _convertCharset ( $ input , $ from , $ to ) { if ( Horde_Util :: extensionExists ( 'xml' ) && ( ( strlen ( $ input ) < 16777216 ) || ! Horde_Util :: extensionExists ( 'iconv' ) || ! Horde_Util :: extensionExists ( 'mbstring' ) ) ) { if ( ( $ to == 'utf-8' ) && in_array ( $ from , array ( 'iso-... | Internal function used to do charset conversion . |
32,721 | public static function lower ( $ string , $ locale = false , $ charset = null ) { if ( $ locale ) { if ( Horde_Util :: extensionExists ( 'mbstring' ) ) { if ( is_null ( $ charset ) ) { throw new InvalidArgumentException ( '$charset argument must not be null' ) ; } $ ret = @ mb_strtolower ( $ string , self :: _mbstringC... | Makes a string lowercase . |
32,722 | public static function upper ( $ string , $ locale = false , $ charset = null ) { if ( $ locale ) { if ( Horde_Util :: extensionExists ( 'mbstring' ) ) { if ( is_null ( $ charset ) ) { throw new InvalidArgumentException ( '$charset argument must not be null' ) ; } $ ret = @ mb_strtoupper ( $ string , self :: _mbstringC... | Makes a string uppercase . |
32,723 | public static function ucfirst ( $ string , $ locale = false , $ charset = null ) { if ( $ locale ) { if ( is_null ( $ charset ) ) { throw new InvalidArgumentException ( '$charset argument must not be null' ) ; } $ first = self :: substr ( $ string , 0 , 1 , $ charset ) ; if ( self :: isAlpha ( $ first , $ charset ) ) ... | Returns a string with the first letter capitalized if it is alphabetic . |
32,724 | public static function ucwords ( $ string , $ locale = false , $ charset = null ) { $ words = preg_split ( '/(\s+)/' , $ string , - 1 , PREG_SPLIT_DELIM_CAPTURE ) ; for ( $ i = 0 , $ c = count ( $ words ) ; $ i < $ c ; $ i += 2 ) { $ words [ $ i ] = self :: ucfirst ( $ words [ $ i ] , $ locale , $ charset ) ; } return ... | Returns a string with the first letter of each word capitalized if it is alphabetic . |
32,725 | protected static function _pos ( $ haystack , $ needle , $ offset , $ charset , $ func ) { if ( Horde_Util :: extensionExists ( 'mbstring' ) ) { unset ( $ php_errormsg ) ; $ track_errors = ini_set ( 'track_errors' , 1 ) ; $ ret = @ call_user_func ( 'mb_' . $ func , $ haystack , $ needle , $ offset , self :: _mbstringCh... | Perform string position searches . |
32,726 | public static function truncate ( $ text , $ length = 100 ) { return ( self :: length ( $ text ) > $ length ) ? rtrim ( self :: substr ( $ text , 0 , $ length - 3 ) ) . '...' : $ text ; } | Return a truncated string suitable for notifications . |
32,727 | public static function abbreviate ( $ text , $ length = 20 ) { return ( self :: length ( $ text ) > $ length ) ? rtrim ( self :: substr ( $ text , 0 , round ( ( $ length - 3 ) / 2 ) ) ) . '...' . ltrim ( self :: substr ( $ text , ( ( $ length - 3 ) / 2 ) * - 1 ) ) : $ text ; } | Return an abbreviated string with characters in the middle of the excessively long string replaced by ... . |
32,728 | public static function common ( $ str1 , $ str2 ) { for ( $ result = '' , $ i = 0 ; isset ( $ str1 [ $ i ] ) && isset ( $ str2 [ $ i ] ) && $ str1 [ $ i ] == $ str2 [ $ i ] ; $ i ++ ) { $ result .= $ str1 [ $ i ] ; } return $ result ; } | Returns the common leading part of two strings . |
32,729 | public static function isAlpha ( $ string , $ charset ) { if ( ! Horde_Util :: extensionExists ( 'mbstring' ) ) { return ctype_alpha ( $ string ) ; } $ charset = self :: _mbstringCharset ( $ charset ) ; $ old_charset = mb_regex_encoding ( ) ; if ( $ charset != $ old_charset ) { @ mb_regex_encoding ( $ charset ) ; } $ a... | Returns true if the every character in the parameter is an alphabetic character . |
32,730 | public static function isLower ( $ string , $ charset ) { return ( ( self :: lower ( $ string , true , $ charset ) === $ string ) && self :: isAlpha ( $ string , $ charset ) ) ; } | Returns true if ever character in the parameter is a lowercase letter in the current locale . |
32,731 | public static function isUpper ( $ string , $ charset ) { return ( ( self :: upper ( $ string , true , $ charset ) === $ string ) && self :: isAlpha ( $ string , $ charset ) ) ; } | Returns true if every character in the parameter is an uppercase letter in the current locale . |
32,732 | public static function regexMatch ( $ text , $ regex , $ charset = null ) { if ( ! empty ( $ charset ) ) { $ regex = self :: convertCharset ( $ regex , $ charset , 'utf-8' ) ; $ text = self :: convertCharset ( $ text , $ charset , 'utf-8' ) ; } $ matches = array ( ) ; foreach ( $ regex as $ val ) { if ( preg_match ( '/... | Performs a multibyte safe regex match search on the text provided . |
32,733 | public static function validUtf8 ( $ text ) { $ text = strval ( $ text ) ; if ( preg_match ( '/\xE0[\x80-\x9F][\x80-\xBF]|\xED[\xA0-\xBF][\x80-\xBF]/S' , $ text ) ) { return false ; } for ( $ i = 0 , $ len = strlen ( $ text ) ; $ i < $ len ; ++ $ i ) { $ c = ord ( $ text [ $ i ] ) ; if ( $ c > 128 ) { if ( $ c > 247 ) ... | Check to see if a string is valid UTF - 8 . |
32,734 | public static function get_instance_info ( $ instanceid ) { global $ DB , $ CFG ; require_once ( $ CFG -> libdir . '/enrollib.php' ) ; $ params = self :: validate_parameters ( self :: get_instance_info_parameters ( ) , array ( 'instanceid' => $ instanceid ) ) ; $ enrolplugin = enrol_get_plugin ( 'self' ) ; if ( empty (... | Return self - enrolment instance information . |
32,735 | public function handle ( $ exception ) { $ message = $ exception -> getMessage ( ) ; if ( debugging ( '' , DEBUG_DEVELOPER ) ) { $ message .= "\n" . format_backtrace ( get_exception_info ( $ exception ) -> backtrace , true ) ; } $ type = str_replace ( 'Request' , 'Response' , $ this -> type ) ; $ response = lti_get_res... | Echo an exception message encapsulated in XML . |
32,736 | static public function clear_backup_dir ( $ backupid , \ core \ progress \ base $ progress = null ) { $ backupiddir = make_backup_temp_directory ( $ backupid , false ) ; if ( ! self :: delete_dir_contents ( $ backupiddir , '' , $ progress ) ) { throw new backup_helper_exception ( 'cannot_empty_backup_temp_dir' ) ; } re... | Given one backupid ensure its temp dir is completely empty |
32,737 | static public function delete_backup_dir ( $ backupid , \ core \ progress \ base $ progress = null ) { $ backupiddir = make_backup_temp_directory ( $ backupid , false ) ; self :: clear_backup_dir ( $ backupid , $ progress ) ; return rmdir ( $ backupiddir ) ; } | Given one backupid delete completely its temp dir |
32,738 | static public function delete_old_backup_dirs ( $ deletefrom , \ core \ progress \ base $ progress = null ) { $ status = true ; $ backuptempdir = make_backup_temp_directory ( '' ) ; $ list = get_directory_list ( $ backuptempdir , '' , false , true , true ) ; foreach ( $ list as $ file ) { $ file_path = $ backuptempdir ... | Delete all the temp dirs older than the time specified . |
32,739 | public function destroy ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> _storage ) ) { trigger_error ( "Attempted to destroy non-existent variable $name" , E_USER_ERROR ) ; return ; } unset ( $ this -> _storage [ $ name ] ) ; } | Destroys a variable in the context . |
32,740 | public function loadArray ( $ context_array ) { foreach ( $ context_array as $ key => $ discard ) { $ this -> register ( $ key , $ context_array [ $ key ] ) ; } } | Loads a series of variables from an associative array |
32,741 | public function add_logger ( base_logger $ logger ) { $ existing = $ this -> logger ; while ( $ existing -> get_next ( ) ) { $ existing = $ existing -> get_next ( ) ; } $ existing -> set_next ( $ logger ) ; } | Inserts a new logger at end of logging chain . |
32,742 | private function register_link_encoders ( ) { global $ LINKS_ENCODERS_CACHE ; if ( ! empty ( $ LINKS_ENCODERS_CACHE ) ) { return $ LINKS_ENCODERS_CACHE ; } $ encoders = array ( ) ; $ encoders [ 'backup_course_task' ] = 'encode_content_links' ; $ mods = core_component :: get_plugin_list ( 'mod' ) ; foreach ( $ mods as $... | Register all available content link encoders |
32,743 | public function get_document_recordset ( $ modifiedfrom = 0 , \ context $ context = null ) { global $ DB ; $ where = 'timemodified >= ? AND deleted = ? AND confirmed = ?' ; $ params = [ $ modifiedfrom , 0 , 1 ] ; if ( ! $ context ) { $ context = \ context_system :: instance ( ) ; } switch ( $ context -> contextlevel ) ... | Returns recordset containing required data attributes for indexing . |
32,744 | public function get_document ( $ record , $ options = array ( ) ) { $ context = \ context_system :: instance ( ) ; $ doc = \ core_search \ document_factory :: instance ( $ record -> id , $ this -> componentname , $ this -> areaname ) ; $ array = [ ] ; foreach ( get_all_user_name_fields ( false , null , null , null , tr... | Returns document instances for each record in the recordset . |
32,745 | public function get_document_display_title ( \ core_search \ document $ doc ) { $ user = \ core_user :: get_user ( $ doc -> get ( 'itemid' ) ) ; return fullname ( $ user ) ; } | Returns the user fullname to display as document title |
32,746 | public function check_access ( $ id ) { global $ DB , $ USER ; $ user = $ DB -> get_record ( 'user' , array ( 'id' => $ id ) ) ; if ( ! $ user || $ user -> deleted ) { return \ core_search \ manager :: ACCESS_DELETED ; } if ( user_can_view_profile ( $ user ) ) { return \ core_search \ manager :: ACCESS_GRANTED ; } retu... | Checking whether I can access a document |
32,747 | public function fetch_from_cursor ( $ cursorname ) { $ count = $ this -> get_fetch_buffer_size ( ) ; $ sql = 'FETCH ' . $ count . ' FROM ' . $ cursorname ; $ this -> query_start ( $ sql , [ ] , SQL_QUERY_AUX ) ; $ result = pg_query ( $ this -> pgsql , $ sql ) ; $ last = pg_num_rows ( $ result ) !== $ count ; $ this -> ... | Retrieves data from cursor . For use by recordset only ; do not call directly . |
32,748 | public function close_cursor ( $ cursorname ) { $ sql = 'CLOSE ' . $ cursorname ; $ this -> query_start ( $ sql , [ ] , SQL_QUERY_AUX ) ; $ result = pg_query ( $ this -> pgsql , $ sql ) ; $ this -> query_end ( $ result ) ; if ( $ result ) { pg_free_result ( $ result ) ; } return true ; } | Closes a cursor . For use by recordset only ; do not call directly . |
32,749 | protected function insert_chunk ( $ table , array $ chunk , array $ columns ) { $ i = 1 ; $ params = array ( ) ; $ values = array ( ) ; foreach ( $ chunk as $ dataobject ) { $ vals = array ( ) ; foreach ( $ columns as $ field => $ column ) { $ params [ ] = $ this -> normalise_value ( $ column , $ dataobject [ $ field ]... | Insert records in chunks strict param types ... |
32,750 | public function delete_records_select ( $ table , $ select , array $ params = null ) { if ( $ select ) { $ select = "WHERE $select" ; } $ sql = "DELETE FROM {$this->prefix}$table $select" ; list ( $ sql , $ params , $ type ) = $ this -> fix_sql_params ( $ sql , $ params ) ; $ this -> query_start ( $ sql , $ params , SQ... | Delete one or more records from a table which match a particular WHERE clause lobs not supported . |
32,751 | public function getPos ( ) { if ( $ this -> _mode == 0 ) { if ( feof ( $ this -> file ) ) { $ stat = fstat ( $ this -> file ) ; fseek ( $ this -> file , $ stat [ 'size' ] ) ; } $ pos = ftell ( $ this -> file ) ; return $ pos ; } else { return 0 ; } } | Get the position in the file stream |
32,752 | public function reset ( $ pos = null , $ l = 100 ) { if ( $ this -> _mode == 0 ) { if ( ! is_null ( $ pos ) ) { fseek ( $ this -> file , $ pos ) ; } $ this -> buffer = $ l > 0 ? fread ( $ this -> file , $ l ) : '' ; $ this -> length = strlen ( $ this -> buffer ) ; if ( $ this -> length < $ l ) $ this -> increaseLength ... | Reset the position in the file stream . |
32,753 | public function find_users ( $ search ) { global $ DB ; $ whereconditions = array ( ) ; list ( $ wherecondition , $ params ) = $ this -> search_sql ( $ search , 'u' ) ; if ( $ wherecondition ) { $ whereconditions [ ] = $ wherecondition ; } if ( ! $ this -> forcesubscribed ) { $ existingids = array ( ) ; foreach ( $ thi... | Finds all potential users |
32,754 | private static function get_grade_item ( $ courseid , $ itemtype , $ itemmodule = null , $ iteminstance = null , $ itemnumber = null ) { $ gradeiteminstance = null ; if ( $ itemtype == 'course' ) { $ gradeiteminstance = grade_item :: fetch ( array ( 'courseid' => $ courseid , 'itemtype' => $ itemtype ) ) ; } else { $ g... | Get a grade item |
32,755 | public static function update_grades ( $ source , $ courseid , $ component , $ activityid , $ itemnumber , $ grades = array ( ) , $ itemdetails = array ( ) ) { global $ CFG ; $ params = self :: validate_parameters ( self :: update_grades_parameters ( ) , array ( 'source' => $ source , 'courseid' => $ courseid , 'compon... | Update a grade item and optionally student grades |
32,756 | function _findOperator ( $ name ) { if ( empty ( $ name ) ) { return '==' ; } elseif ( isset ( $ this -> _operators [ $ name ] ) ) { return $ this -> _operators [ $ name ] ; } elseif ( in_array ( $ name , $ this -> _operators ) ) { return $ name ; } else { return '==' ; } } | Returns the operator to use for comparing the values |
32,757 | public static function is_valid_issuer ( \ core \ oauth2 \ issuer $ issuer ) { $ endpointwebdav = false ; $ endpointocs = false ; $ endpointtoken = false ; $ endpointauth = false ; $ endpointuserinfo = false ; $ endpoints = \ core \ oauth2 \ api :: get_endpoints ( $ issuer ) ; foreach ( $ endpoints as $ endpoint ) { $ ... | Check if an issuer provides all endpoints that are required by repository_nextcloud . |
32,758 | public static function parse_endpoint_url ( string $ endpointname , \ core \ oauth2 \ issuer $ issuer ) : array { $ url = $ issuer -> get_endpoint_url ( $ endpointname ) ; if ( empty ( $ url ) ) { throw new configuration_exception ( get_string ( 'endpointnotdefined' , 'repository_nextcloud' , $ endpointname ) ) ; } ret... | Returns the parsed url parts of an endpoint of an issuer . |
32,759 | public function allowsElement ( $ name ) { if ( ! empty ( $ this -> currentNesting ) ) { $ parent_token = array_pop ( $ this -> currentNesting ) ; $ this -> currentNesting [ ] = $ parent_token ; $ parent = $ this -> htmlDefinition -> info [ $ parent_token -> name ] ; } else { $ parent = $ this -> htmlDefinition -> info... | Tests if the context node allows a certain element |
32,760 | public static function Regen ( $ less_files , $ parser_options = array ( ) , $ modify_vars = array ( ) ) { $ parser_options [ 'use_cache' ] = false ; return self :: Get ( $ less_files , $ parser_options , $ modify_vars ) ; } | Force the compiler to regenerate the cached css file |
32,761 | static function ListFiles ( $ list_file , & $ list , & $ css_file_name ) { $ list = explode ( "\n" , file_get_contents ( $ list_file ) ) ; $ css_file_name = array_pop ( $ list ) ; if ( ! preg_match ( '/^' . Less_Cache :: $ prefix . '[a-f0-9]+\.css$/' , $ css_file_name ) ) { $ list [ ] = $ css_file_name ; $ css_file_nam... | Get the list of less files and generated css file from a list file |
32,762 | public function get_contexts ( ) : array { $ contexts = [ ] ; foreach ( $ this -> contextids as $ contextid ) { try { $ contexts [ ] = \ context :: instance_by_id ( $ contextid ) ; } catch ( \ Exception $ e ) { unset ( $ this -> contextids [ $ this -> iteratorposition ] ) ; } } return $ contexts ; } | Get the complete list of context objects that relate to this request . |
32,763 | public function current ( ) { try { $ context = \ context :: instance_by_id ( $ this -> contextids [ $ this -> iteratorposition ] ) ; } catch ( \ Exception $ e ) { unset ( $ this -> contextids [ $ this -> iteratorposition ] ) ; if ( $ this -> count ( ) ) { $ this -> next ( ) ; $ context = $ this -> current ( ) ; } else... | Return the current context . |
32,764 | protected function get_this_slot ( $ slots , $ slotnumber ) { foreach ( $ slots as $ key => $ slot ) { if ( $ slot -> slot == $ slotnumber ) { return $ slot ; } } return null ; } | Return current slot object . |
32,765 | protected function get_slots_by_slot_number ( $ slots ) { if ( ! $ slots ) { return array ( ) ; } $ newslots = array ( ) ; foreach ( $ slots as $ slot ) { $ newslots [ $ slot -> slot ] = $ slot ; } return $ newslots ; } | Return array of slots with slot number as key |
32,766 | protected function get_slots_by_slotid ( $ slots ) { if ( ! $ slots ) { return array ( ) ; } $ newslots = array ( ) ; foreach ( $ slots as $ slot ) { $ newslots [ $ slot -> id ] = $ slot ; } return $ newslots ; } | Return array of slots with slot id as key |
32,767 | public function repaginate_slots ( $ nextslotnumber , $ type ) { global $ DB ; $ this -> slots = $ DB -> get_records ( 'quiz_slots' , array ( 'quizid' => $ this -> quizid ) , 'slot' ) ; $ nextslot = null ; $ newslots = array ( ) ; foreach ( $ this -> slots as $ slot ) { if ( $ slot -> slot < $ nextslotnumber ) { $ news... | Repaginate update DB and slots object |
32,768 | public function repaginate_next_slot ( $ nextslotnumber , $ type ) { $ currentslotnumber = $ nextslotnumber - 1 ; if ( ! ( $ currentslotnumber && $ nextslotnumber ) ) { return null ; } $ currentslot = $ this -> get_this_slot ( $ this -> slots , $ currentslotnumber ) ; $ nextslot = $ this -> get_this_slot ( $ this -> sl... | Repaginate next slot and return the modified slot object |
32,769 | public function repaginate_n_question_per_page ( $ slots , $ number ) { $ slots = $ this -> get_slots_by_slot_number ( $ slots ) ; $ newslots = array ( ) ; $ count = 0 ; $ page = 1 ; foreach ( $ slots as $ key => $ slot ) { for ( $ page + $ count ; $ page < ( $ number + $ count + 1 ) ; $ page ++ ) { if ( $ slot -> slot... | Return the slots with the new pagination regardless of current pagination . |
32,770 | public function repaginate_the_rest ( $ quizslots , $ slotfrom , $ type , $ dbupdate = true ) { global $ DB ; if ( ! $ quizslots ) { return null ; } $ newslots = array ( ) ; foreach ( $ quizslots as $ slot ) { if ( $ type == self :: LINK ) { if ( $ slot -> slot <= $ slotfrom ) { continue ; } $ slot -> page = $ slot -> ... | Repaginate the rest . |
32,771 | public static function delete_feedback_for_grade ( assign_plugin_request_data $ requestdata ) { global $ DB ; $ fs = new \ file_storage ( ) ; $ fs -> delete_area_files ( $ requestdata -> get_context ( ) -> id , ASSIGNFEEDBACK_COMMENTS_COMPONENT , ASSIGNFEEDBACK_COMMENTS_FILEAREA , $ requestdata -> get_pluginobject ( ) ... | Calling this function should delete all user data associated with this grade entry . |
32,772 | public function validation ( $ data , $ files ) { $ errors = array ( ) ; if ( array_key_exists ( 'plugin' , $ this -> _customdata ) && is_object ( $ this -> _customdata [ 'plugin' ] ) ) { $ pluginerrors = $ this -> _customdata [ 'plugin' ] -> export_config_validation ( $ data ) ; if ( is_array ( $ pluginerrors ) ) { $ ... | Validate portfolio export form |
32,773 | public function validation ( $ data , $ files ) { global $ DB ; $ errors = array ( ) ; if ( $ DB -> count_records ( 'portfolio_instance' , array ( 'name' => $ data [ 'name' ] , 'plugin' => $ data [ 'plugin' ] ) ) > 1 ) { $ errors = array ( 'name' => get_string ( 'err_uniquename' , 'portfolio' ) ) ; } $ pluginerrors = a... | Validate admin config form |
32,774 | function definition ( ) { $ this -> caller = $ this -> _customdata [ 'caller' ] ; $ options = $ this -> _customdata [ 'options' ] ; $ mform = & $ this -> _form ; $ mform -> addElement ( 'select' , 'instance' , get_string ( 'selectplugin' , 'portfolio' ) , $ options ) ; $ mform -> addElement ( 'hidden' , 'id' , $ this -... | The required basic elements to the form . |
32,775 | public function process ( ) { if ( $ this -> progress >= self :: PROGRESS_PROCESSED ) { throw new restore_ui_exception ( 'restoreuialreadyprocessed' ) ; } $ this -> progress = self :: PROGRESS_PROCESSED ; if ( optional_param ( 'previous' , false , PARAM_BOOL ) && $ this -> stage -> get_stage ( ) > self :: STAGE_CONFIRM... | This processes the current stage of the restore |
32,776 | public function execute ( ) { if ( $ this -> progress >= self :: PROGRESS_EXECUTED ) { throw new restore_ui_exception ( 'restoreuialreadyexecuted' ) ; } if ( $ this -> stage -> get_stage ( ) < self :: STAGE_PROCESS ) { throw new restore_ui_exception ( 'restoreuifinalisedbeforeexecute' ) ; } if ( $ this -> controller ->... | Executes the restore plan |
32,777 | public function cleanup ( ) { global $ DB ; $ courseid = $ this -> controller -> get_courseid ( ) ; if ( $ this -> is_temporary_course_created ( $ courseid ) && $ course = $ DB -> get_record ( 'course' , array ( 'id' => $ courseid ) ) ) { $ course -> deletesource = 'restore' ; delete_course ( $ course , false ) ; } } | Delete course which is created by restore process |
32,778 | protected function is_temporary_course_created ( $ courseid ) { global $ DB ; if ( $ this -> controller -> get_target ( ) == backup :: TARGET_NEW_COURSE ) { $ results = $ DB -> record_exists_sql ( "SELECT bc.itemid FROM {backup_controllers} bc, {course} c ... | Checks if the course is not restored fully and current controller has created it . |
32,779 | final public static function load_controller ( $ restoreid = false ) { if ( $ restoreid ) { try { $ controller = restore_controller :: load_controller ( $ restoreid ) ; return $ controller ; } catch ( Exception $ e ) { return false ; } } return $ restoreid ; } | Loads the restore controller if we are tracking one |
32,780 | final public static function engage_independent_stage ( $ stage , $ contextid ) { if ( ! ( $ stage & self :: STAGE_CONFIRM + self :: STAGE_DESTINATION ) ) { throw new restore_ui_exception ( 'dependentstagerequested' ) ; } $ class = 'restore_ui_stage_' . self :: $ stages [ $ stage ] ; if ( ! class_exists ( $ class ) ) {... | Initialised the requested independent stage |
32,781 | public function cancel_process ( ) { if ( $ this -> controller -> get_target ( ) == backup :: TARGET_NEW_COURSE ) { $ this -> cleanup ( ) ; } parent :: cancel_process ( ) ; } | Cancels the current restore and redirects the user back to the relevant place |
32,782 | protected function getCostFunction ( ) { $ penalty = 0 ; if ( $ this -> penalty == 'L2' ) { $ penalty = $ this -> lambda ; } switch ( $ this -> costFunction ) { case 'log' : $ callback = function ( $ weights , $ sample , $ y ) use ( $ penalty ) { $ this -> weights = $ weights ; $ hX = $ this -> output ( $ sample ) ; if... | Returns the appropriate callback function for the selected cost function |
32,783 | public function get_config_for_javascript ( moodle_page $ page , renderer_base $ renderer ) { global $ CFG ; if ( empty ( $ this -> M_cfg ) ) { $ iconsystem = \ core \ output \ icon_system :: instance ( ) ; $ contextid = null ; if ( ! is_null ( $ page -> context ) ) { $ contextid = $ page -> context -> id ; } $ this ->... | Return the safe config values that get set for javascript in M . cfg . |
32,784 | protected function init_requirements_data ( moodle_page $ page , core_renderer $ renderer ) { global $ CFG ; $ this -> get_config_for_javascript ( $ page , $ renderer ) ; $ this -> skip_link_to ( 'maincontent' , get_string ( 'tocontent' , 'access' ) ) ; $ this -> string_for_js ( 'confirmation' , 'admin' ) ; $ this -> s... | Initialise with the bits of JavaScript that every Moodle page should have . |
32,785 | protected function get_jsrev ( ) { global $ CFG ; if ( empty ( $ CFG -> cachejs ) ) { $ jsrev = - 1 ; } else if ( empty ( $ CFG -> jsrev ) ) { $ jsrev = 1 ; } else { $ jsrev = $ CFG -> jsrev ; } return $ jsrev ; } | Determine the correct JS Revision to use for this load . |
32,786 | public function js ( $ url , $ inhead = false ) { $ url = $ this -> js_fix_url ( $ url ) ; $ where = $ inhead ? 'head' : 'footer' ; $ this -> jsincludes [ $ where ] [ $ url -> out ( ) ] = $ url ; } | Ensure that the specified JavaScript file is linked to from this page . |
32,787 | public function jquery_override_plugin ( $ oldplugin , $ newplugin ) { if ( $ this -> headdone ) { debugging ( 'Can not override jQuery plugins after starting page output!' ) ; return ; } $ this -> jquerypluginoverrides [ $ oldplugin ] = $ newplugin ; } | Request replacement of one jQuery plugin by another . |
32,788 | protected function get_jquery_headcode ( ) { if ( empty ( $ this -> jqueryplugins [ 'jquery' ] ) ) { return '' ; } $ included = array ( ) ; $ urls = array ( ) ; foreach ( $ this -> jqueryplugins as $ name => $ unused ) { if ( isset ( $ included [ $ name ] ) ) { continue ; } if ( array_key_exists ( $ name , $ this -> jq... | Return jQuery related markup for page start . |
32,789 | protected function js_fix_url ( $ url ) { global $ CFG ; if ( $ url instanceof moodle_url ) { return $ url ; } else if ( strpos ( $ url , '/' ) === 0 ) { if ( $ CFG -> admin !== 'admin' ) { if ( strpos ( $ url , "/admin/" ) === 0 ) { $ url = preg_replace ( "|^/admin/|" , "/$CFG->admin/" , $ url ) ; } } if ( debugging (... | Returns the actual url through which a script is served . |
32,790 | protected function js_module_loaded ( $ module ) { if ( is_string ( $ module ) ) { $ modulename = $ module ; } else { $ modulename = $ module [ 'name' ] ; } return array_key_exists ( $ modulename , $ this -> YUI_config -> modules ) || array_key_exists ( $ modulename , $ this -> extramodules ) ; } | Returns true if the module has already been loaded . |
32,791 | public function css ( $ stylesheet ) { global $ CFG ; if ( $ this -> headdone ) { throw new coding_exception ( 'Cannot require a CSS file after <head> has been printed.' , $ stylesheet ) ; } if ( $ stylesheet instanceof moodle_url ) { } else if ( strpos ( $ stylesheet , '/' ) === 0 ) { $ stylesheet = new moodle_url ... | Ensure that the specified CSS file is linked to from this page . |
32,792 | public function js_call_amd ( $ fullmodule , $ func = null , $ params = array ( ) ) { global $ CFG ; list ( $ component , $ module ) = explode ( '/' , $ fullmodule , 2 ) ; $ component = clean_param ( $ component , PARAM_COMPONENT ) ; $ module = clean_param ( $ module , PARAM_ALPHANUMEXT ) ; if ( $ func !== null ) { $ f... | Load an AMD module and eventually call its method . |
32,793 | public function yui_module ( $ modules , $ function , array $ arguments = null , $ galleryversion = null , $ ondomready = false ) { if ( ! is_array ( $ modules ) ) { $ modules = array ( $ modules ) ; } if ( $ galleryversion != null ) { debugging ( 'The galleryversion parameter to yui_module has been deprecated since Mo... | Creates a JavaScript function call that requires one or more modules to be loaded . |
32,794 | public function js_init_call ( $ function , array $ extraarguments = null , $ ondomready = false , array $ module = null ) { $ jscode = js_writer :: function_call_with_Y ( $ function , $ extraarguments ) ; if ( ! $ module ) { if ( preg_match ( '/M\.([a-z0-9]+_[^\.]+)/' , $ function , $ matches ) ) { $ module = $ this -... | Ensure that the specified JavaScript function is called from an inline script from page footer . |
32,795 | public function js_init_code ( $ jscode , $ ondomready = false , array $ module = null ) { $ jscode = trim ( $ jscode , " ;\n" ) . ';' ; $ uniqid = html_writer :: random_id ( ) ; $ startjs = " M.util.js_pending('" . $ uniqid . "');" ; $ endjs = " M.util.js_complete('" . $ uniqid . "');" ; if ( $ module ) { $ this -> js... | Add short static javascript code fragment to page footer . This is intended primarily for loading of js modules and initialising page layout . Ideally the JS code fragment should be stored in plugin renderer so that themes may override it . |
32,796 | public function string_for_js ( $ identifier , $ component , $ a = null ) { if ( ! $ component ) { throw new coding_exception ( 'The $component parameter is required for page_requirements_manager::string_for_js().' ) ; } if ( isset ( $ this -> stringsforjs_as [ $ component ] [ $ identifier ] ) and $ this -> stringsforj... | Make a language string available to JavaScript . |
32,797 | public function strings_for_js ( $ identifiers , $ component , $ a = null ) { foreach ( $ identifiers as $ key => $ identifier ) { if ( is_array ( $ a ) && array_key_exists ( $ key , $ a ) ) { $ extra = $ a [ $ key ] ; } else { $ extra = $ a ; } $ this -> string_for_js ( $ identifier , $ component , $ extra ) ; } } | Make an array of language strings available for JS . |
32,798 | public function event_handler ( $ selector , $ event , $ function , array $ arguments = null ) { $ this -> eventhandlers [ ] = array ( 'selector' => $ selector , 'event' => $ event , 'function' => $ function , 'arguments' => $ arguments ) ; } | Creates a YUI event handler . |
32,799 | protected function get_event_handler_code ( ) { $ output = '' ; foreach ( $ this -> eventhandlers as $ h ) { $ output .= js_writer :: event_handler ( $ h [ 'selector' ] , $ h [ 'event' ] , $ h [ 'function' ] , $ h [ 'arguments' ] ) ; } return $ output ; } | Returns code needed for registering of event handlers . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.