idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
26,900 | public function path_start_reached ( $ path ) { if ( $ path === '/MOODLE_BACKUP/COURSE/MODULES/MOD' ) { $ this -> currentmod = null ; $ forbidden = true ; } else if ( strpos ( $ path , '/MOODLE_BACKUP/COURSE/MODULES/MOD' ) === 0 ) { $ path = str_replace ( '/MOODLE_BACKUP/COURSE/MODULES/MOD' , '/MOODLE_BACKUP/COURSE/MOD... | Executes operations required at the start of a watched path |
26,901 | public function path_end_reached ( $ path ) { if ( $ path === '/MOODLE_BACKUP/COURSE/MODULES/MOD' ) { $ path = '/MOODLE_BACKUP/COURSE/MODULES/MOD/' . $ this -> currentmod ; } else if ( strpos ( $ path , '/MOODLE_BACKUP/COURSE/MODULES/MOD' ) === 0 ) { $ path = str_replace ( '/MOODLE_BACKUP/COURSE/MODULES/MOD' , '/MOODLE... | Executes operations required at the end of a watched path |
26,902 | public function set_stash ( $ stashname , $ info , $ itemid = 0 ) { try { restore_dbops :: set_backup_ids_record ( $ this -> get_id ( ) , $ stashname , $ itemid , 0 , null , $ info ) ; } catch ( dml_exception $ e ) { throw new moodle1_convert_storage_exception ( 'unable_to_restore_stash' , null , $ e -> getMessage ( ) ... | Stores some information for later processing |
26,903 | public function get_stash_or_default ( $ stashname , $ itemid = 0 , $ default = null ) { try { return $ this -> get_stash ( $ stashname , $ itemid ) ; } catch ( moodle1_convert_empty_storage_exception $ e ) { return $ default ; } } | Restores a given stash or returns the given default if there is no such stash |
26,904 | public function get_contextid ( $ level , $ instance = 0 ) { $ stashname = 'context' . $ level ; if ( $ level == CONTEXT_SYSTEM or $ level == CONTEXT_COURSE ) { $ instance = 0 ; } try { return $ this -> get_stash ( $ stashname , $ instance ) ; } catch ( moodle1_convert_empty_storage_exception $ e ) { $ newid = $ this -... | Generates an artificial context id |
26,905 | public function get_file_manager ( $ contextid = null , $ component = null , $ filearea = null , $ itemid = 0 , $ userid = null ) { return new moodle1_file_manager ( $ this , $ contextid , $ component , $ filearea , $ itemid , $ userid ) ; } | Creates and returns new instance of the file manager |
26,906 | public static function migrate_referenced_files ( $ text , moodle1_file_manager $ fileman ) { $ files = self :: find_referenced_files ( $ text ) ; if ( ! empty ( $ files ) ) { foreach ( $ files as $ file ) { try { $ fileman -> migrate_file ( 'course_files' . $ file , dirname ( $ file ) ) ; } catch ( moodle1_convert_exc... | Migrates all course files referenced from the hypertext using the given filemanager |
26,907 | public function process ( $ content ) { if ( is_array ( $ content ) ) { debugging ( 'Moodle1 XML transformer should not process arrays but plain content always' , DEBUG_DEVELOPER ) ; foreach ( $ content as $ key => $ plaincontent ) { $ content [ $ key ] = $ this -> process ( $ plaincontent ) ; } return $ content ; } el... | Modify the content before it is writter to a file |
26,908 | public function apply_recipes ( array $ data ) { $ cooked = array ( ) ; foreach ( $ data as $ name => $ value ) { $ name = strtolower ( $ name ) ; if ( is_array ( $ value ) ) { if ( $ this -> is_grouped ( ) ) { $ value = $ this -> apply_recipes ( $ value ) ; } else { throw new convert_path_exception ( 'non_grouped_path... | Cooks the parsed tags data by applying known recipes |
26,909 | protected function validate_name ( $ name ) { if ( empty ( $ name ) ) { throw new convert_path_exception ( 'convert_path_emptyname' , $ name ) ; } if ( preg_replace ( '/\s/' , '' , $ name ) != $ name ) { throw new convert_path_exception ( 'convert_path_whitespace' , $ name ) ; } if ( preg_replace ( '/[^\x30-\x39\x41-\x... | Makes sure the given name is a valid element name |
26,910 | protected function validate_pobject ( $ pobject ) { if ( ! is_object ( $ pobject ) ) { throw new convert_path_exception ( 'convert_path_no_object' , get_class ( $ pobject ) ) ; } if ( ! method_exists ( $ pobject , $ this -> get_processing_method ( ) ) and ! method_exists ( $ pobject , $ this -> get_end_method ( ) ) and... | Makes sure that the given object is a valid processing object |
26,911 | public function migrate_file ( $ sourcepath , $ filepath = '/' , $ filename = null , $ sortorder = 0 , $ timecreated = null , $ timemodified = null ) { $ sourcepath = str_replace ( '\\' , '/' , $ sourcepath ) ; if ( $ sourcepath !== clean_param ( $ sourcepath , PARAM_PATH ) ) { throw new moodle1_convert_exception ( 'fi... | Migrates one given file stored on disk |
26,912 | public function migrate_directory ( $ rootpath , $ relpath = '/' ) { if ( substr ( $ rootpath , - 1 ) === '/' ) { debugging ( 'moodle1_file_manager::migrate_directory() expects $rootpath without the trailing slash' , DEBUG_DEVELOPER ) ; $ rootpath = substr ( $ rootpath , 0 , strlen ( $ rootpath ) - 1 ) ; } if ( ! file_... | Migrates all files in the given directory |
26,913 | protected function make_file_record ( array $ fileinfo ) { $ defaultrecord = array ( 'contenthash' => file_storage :: hash_from_string ( '' ) , 'contextid' => $ this -> contextid , 'component' => $ this -> component , 'filearea' => $ this -> filearea , 'itemid' => $ this -> itemid , 'filepath' => null , 'filename' => n... | Prepares a fake record from the files table |
26,914 | protected function add_file_to_pool ( $ pathname ) { if ( ! is_readable ( $ pathname ) ) { throw new moodle1_convert_exception ( 'file_not_readable' ) ; } $ contenthash = file_storage :: hash_from_path ( $ pathname ) ; $ filesize = filesize ( $ pathname ) ; $ hashpath = $ this -> converter -> get_workdir_path ( ) . '/f... | Copies the given file to the pool directory |
26,915 | protected function stash_file ( array $ filerecord ) { $ this -> converter -> set_stash ( 'files' , $ filerecord , $ filerecord [ 'id' ] ) ; $ this -> fileids [ ] = $ filerecord [ 'id' ] ; } | Stashes the file record into files stash and adds the record id to list of migrated files |
26,916 | public function add_ref ( $ item , $ id ) { $ this -> validate_item ( $ item ) ; $ this -> refs [ $ item ] [ $ id ] = true ; } | Adds a reference |
26,917 | public function add_refs ( $ item , array $ ids ) { $ this -> validate_item ( $ item ) ; foreach ( $ ids as $ id ) { $ this -> refs [ $ item ] [ $ id ] = true ; } } | Adds a bulk of references |
26,918 | public function write_refs ( xml_writer $ xmlwriter ) { $ xmlwriter -> begin_tag ( 'inforef' ) ; foreach ( $ this -> refs as $ item => $ ids ) { $ xmlwriter -> begin_tag ( $ item . 'ref' ) ; foreach ( array_keys ( $ ids ) as $ id ) { $ xmlwriter -> full_tag ( $ item , $ id ) ; } $ xmlwriter -> end_tag ( $ item . 'ref' ... | Writes the current references using a given opened xml writer |
26,919 | protected function validate_item ( $ item ) { $ allowed = array ( 'user' => true , 'grouping' => true , 'group' => true , 'role' => true , 'file' => true , 'scale' => true , 'outcome' => true , 'grade_item' => true , 'question_category' => true ) ; if ( ! isset ( $ allowed [ $ item ] ) ) { throw new coding_exception ( ... | Makes sure that the given name is a valid citizen of inforef . xml file |
26,920 | public function definition ( ) { $ mform = $ this -> _form ; $ installer = $ this -> _customdata [ 'installer' ] ; $ mform -> addElement ( 'header' , 'general' , get_string ( 'installfromzip' , 'tool_installaddon' ) ) ; $ mform -> addHelpButton ( 'general' , 'installfromzip' , 'tool_installaddon' ) ; $ mform -> addElem... | Defines the form elements |
26,921 | public function require_explicit_plugintype ( ) { $ mform = $ this -> _form ; $ mform -> addRule ( 'plugintype' , get_string ( 'required' ) , 'required' , null , 'client' ) ; $ mform -> setAdvanced ( 'plugintype' , false ) ; $ mform -> setAdvanced ( 'permcheck' , false ) ; $ typedetectionfailed = $ mform -> createEleme... | Switch the form to a mode that requires manual selection of the plugin type |
26,922 | public function selected_plugintype_mismatch ( $ detected ) { $ mform = $ this -> _form ; $ mform -> addRule ( 'plugintype' , get_string ( 'required' ) , 'required' , null , 'client' ) ; $ mform -> setAdvanced ( 'plugintype' , false ) ; $ mform -> setAdvanced ( 'permcheck' , false ) ; $ mform -> insertElementBefore ( $... | Warn that the selected plugin type does not match the detected one . |
26,923 | public function validation ( $ data , $ files ) { $ pluginman = core_plugin_manager :: instance ( ) ; $ errors = parent :: validation ( $ data , $ files ) ; if ( ! empty ( $ data [ 'plugintype' ] ) ) { if ( ! $ pluginman -> is_plugintype_writable ( $ data [ 'plugintype' ] ) ) { $ path = $ pluginman -> get_plugintype_ro... | Validate the form fields |
26,924 | public function populate_submissions_and_grades ( ) { global $ DB ; if ( empty ( $ this -> get_userids ( ) ) ) { throw new \ coding_exception ( 'Please use set_userids() before calling this method.' ) ; } list ( $ sql , $ params ) = $ DB -> get_in_or_equal ( $ this -> get_userids ( ) , SQL_PARAMS_NAMED ) ; $ params [ '... | Fetches all of the submissions and grades related to the User IDs provided . Use get_grades get_submissions etc to retrieve this information . |
26,925 | public static function makeFromSerial ( ) { $ contents = file_get_contents ( HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema.ser' ) ; $ r = unserialize ( $ contents ) ; if ( ! $ r ) { $ hash = sha1 ( $ contents ) ; trigger_error ( "Unserialization of configuration schema failed, sha1 of file was $hash" , E_USE... | Unserializes the default ConfigSchema . |
26,926 | public static function instance ( $ prototype = null ) { if ( $ prototype !== null ) { HTMLPurifier_ConfigSchema :: $ singleton = $ prototype ; } elseif ( HTMLPurifier_ConfigSchema :: $ singleton === null || $ prototype === true ) { HTMLPurifier_ConfigSchema :: $ singleton = HTMLPurifier_ConfigSchema :: makeFromSerial ... | Retrieves an instance of the application - wide configuration definition . |
26,927 | public function addValueAliases ( $ key , $ aliases ) { if ( ! isset ( $ this -> info [ $ key ] -> aliases ) ) { $ this -> info [ $ key ] -> aliases = array ( ) ; } foreach ( $ aliases as $ alias => $ real ) { $ this -> info [ $ key ] -> aliases [ $ alias ] = $ real ; } } | Defines a directive value alias . |
26,928 | public function addAlias ( $ key , $ new_key ) { $ obj = new stdClass ; $ obj -> key = $ new_key ; $ obj -> isAlias = true ; $ this -> info [ $ key ] = $ obj ; } | Defines a directive alias for backwards compatibility |
26,929 | public function postProcess ( ) { foreach ( $ this -> info as $ key => $ v ) { if ( count ( ( array ) $ v ) == 1 ) { $ this -> info [ $ key ] = $ v -> type ; } elseif ( count ( ( array ) $ v ) == 2 && isset ( $ v -> allow_null ) ) { $ this -> info [ $ key ] = - $ v -> type ; } } } | Replaces any stdClass that only has the type property with type integer . |
26,930 | protected static function validate_access_and_filters ( $ rawwsfilters ) { global $ CFG ; if ( empty ( $ CFG -> enableblogs ) ) { throw new moodle_exception ( 'blogdisable' , 'blog' ) ; } $ filterstype = array ( 'courseid' => PARAM_INT , 'groupid' => PARAM_INT , 'userid' => PARAM_INT , 'tagid' => PARAM_INT , 'tag' => P... | Validate access to the blog and the filters to apply when listing entries . |
26,931 | public static function get_entries ( $ filters = array ( ) , $ page = 0 , $ perpage = 10 ) { global $ PAGE ; $ warnings = array ( ) ; $ params = self :: validate_parameters ( self :: get_entries_parameters ( ) , array ( 'filters' => $ filters , 'page' => $ page , 'perpage' => $ perpage ) ) ; list ( $ context , $ filter... | Return blog entries . |
26,932 | public static function view_entries ( $ filters = array ( ) ) { $ warnings = array ( ) ; $ params = self :: validate_parameters ( self :: view_entries_parameters ( ) , array ( 'filters' => $ filters ) ) ; list ( $ context , $ filters , $ courseid , $ userid ) = self :: validate_access_and_filters ( $ params [ 'filters'... | Trigger the blog_entries_viewed event . |
26,933 | public function write ( PHPExcel $ pPHPExcel = null ) { if ( ! $ pPHPExcel ) { $ pPHPExcel = $ this -> getParentWriter ( ) -> getPHPExcel ( ) ; } $ objWriter = null ; if ( $ this -> getParentWriter ( ) -> getUseDiskCaching ( ) ) { $ objWriter = new PHPExcel_Shared_XMLWriter ( PHPExcel_Shared_XMLWriter :: STORAGE_DISK ,... | Write styles . xml to XML format |
26,934 | public function navigation_tree ( global_navigation $ navigation , $ expansionlimit , array $ options = array ( ) ) { $ navigation -> add_class ( 'navigation_node' ) ; $ navigationattrs = array ( 'class' => 'block_tree list' , 'role' => 'tree' , 'data-ajax-loader' => 'block_navigation/nav_loader' ) ; $ content = $ this... | Returns the content of the navigation tree . |
26,935 | public function add_assign_info ( $ cmid , $ cmname , $ sectionname , $ timedue , $ submissioninfo , $ gradeinfo ) { $ this -> assignments [ ] = array ( 'cmid' => $ cmid , 'cmname' => $ cmname , 'sectionname' => $ sectionname , 'timedue' => $ timedue , 'submissioninfo' => $ submissioninfo , 'gradeinfo' => $ gradeinfo )... | Add a row of data to display on the course index page |
26,936 | public function preprocess ( $ dir , $ filearea , $ component ) { global $ CFG ; foreach ( $ dir [ 'subdirs' ] as $ subdir ) { $ this -> preprocess ( $ subdir , $ filearea , $ component ) ; } foreach ( $ dir [ 'files' ] as $ file ) { $ file -> portfoliobutton = '' ; $ file -> timemodified = userdate ( $ file -> get_tim... | Preprocessing the file list to add the portfolio links if required . |
26,937 | protected function get_next_range ( \ DateTimeImmutable $ next ) { $ start = $ next -> getTimestamp ( ) ; $ end = $ next -> add ( $ this -> periodicity ( ) ) -> getTimestamp ( ) ; return [ 'start' => $ start , 'end' => $ end , 'time' => $ start ] ; } | The next range indicator calculations should be based on upcoming dates . |
26,938 | protected function get_first_start ( ) { global $ DB ; $ cache = \ cache :: make ( 'core' , 'modelfirstanalyses' ) ; $ key = $ this -> modelid . '_' . $ this -> analysable -> get_id ( ) ; $ firstanalysis = $ cache -> get ( $ key ) ; if ( ! empty ( $ firstanalysis ) ) { return $ firstanalysis ; } return time ( ) - 1 ; } | Get the start of the first time range . |
26,939 | protected function header ( $ title = null ) { global $ OUTPUT ; echo $ OUTPUT -> header ( ) ; if ( $ title === null ) { $ title = get_string ( 'tours' , 'tool_usertours' ) ; } echo $ OUTPUT -> heading ( $ title ) ; } | Print out the page header . |
26,940 | protected function print_tour_list ( ) { global $ PAGE , $ OUTPUT ; $ this -> header ( ) ; echo \ html_writer :: span ( get_string ( 'tourlist_explanation' , 'tool_usertours' ) ) ; $ table = new table \ tour_list ( ) ; $ tours = helper :: get_tours ( ) ; foreach ( $ tours as $ tour ) { $ table -> add_data_keyed ( $ tab... | Print the the list of tours . |
26,941 | protected function get_edit_tour_link ( $ id = null ) { $ addlink = helper :: get_edit_tour_link ( $ id ) ; return \ html_writer :: link ( $ addlink , get_string ( 'newtour' , 'tool_usertours' ) ) ; } | Return the edit tour link . |
26,942 | protected function edit_tour ( $ id = null ) { global $ PAGE ; if ( $ id ) { $ tour = tour :: instance ( $ id ) ; $ PAGE -> navbar -> add ( $ tour -> get_name ( ) , $ tour -> get_edit_link ( ) ) ; } else { $ tour = new tour ( ) ; $ PAGE -> navbar -> add ( get_string ( 'newtour' , 'tool_usertours' ) , $ tour -> get_edit... | Print the edit tour page . |
26,943 | protected function export_tour ( $ id ) { $ tour = tour :: instance ( $ id ) ; $ export = $ tour -> to_record ( ) ; unset ( $ export -> id ) ; $ export -> version = get_config ( 'tool_usertours' , 'version' ) ; $ export -> steps = [ ] ; foreach ( $ tour -> get_steps ( ) as $ step ) { $ record = $ step -> to_record ( ) ... | Print the export tour page . |
26,944 | protected function import_tour ( ) { global $ PAGE ; $ PAGE -> navbar -> add ( get_string ( 'importtour' , 'tool_usertours' ) , helper :: get_import_tour_link ( ) ) ; $ form = new forms \ importtour ( ) ; if ( $ form -> is_cancelled ( ) ) { redirect ( helper :: get_list_tour_link ( ) ) ; } else if ( $ form -> get_data ... | Handle tour import . |
26,945 | protected function view_tour ( $ tourid ) { global $ PAGE ; $ tour = helper :: get_tour ( $ tourid ) ; $ PAGE -> navbar -> add ( $ tour -> get_name ( ) , $ tour -> get_view_link ( ) ) ; $ this -> header ( $ tour -> get_name ( ) ) ; echo \ html_writer :: span ( get_string ( 'viewtour_info' , 'tool_usertours' , [ 'tourna... | Print the view tour page . |
26,946 | protected function show_hide_tour ( $ tourid , $ visibility ) { global $ DB ; require_sesskey ( ) ; $ tour = $ DB -> get_record ( 'tool_usertours_tours' , array ( 'id' => $ tourid ) ) ; $ tour -> enabled = $ visibility ; $ DB -> update_record ( 'tool_usertours_tours' , $ tour ) ; redirect ( helper :: get_list_tour_link... | Show or Hide the tour . |
26,947 | protected function delete_tour ( $ tourid ) { require_sesskey ( ) ; $ tour = tour :: instance ( $ tourid ) ; $ tour -> remove ( ) ; redirect ( helper :: get_list_tour_link ( ) ) ; } | Delete the tour . |
26,948 | protected function reset_tour_for_all ( $ tourid ) { require_sesskey ( ) ; $ tour = tour :: instance ( $ tourid ) ; $ tour -> mark_major_change ( ) ; redirect ( helper :: get_view_tour_link ( $ tourid ) , get_string ( 'tour_resetforall' , 'tool_usertours' ) ) ; } | Reset the tour state for all users . |
26,949 | public static function get_current_tour ( $ reset = false ) { global $ PAGE ; static $ tour = false ; if ( $ tour === false || $ reset ) { $ tour = self :: get_matching_tours ( $ PAGE -> url ) ; } return $ tour ; } | Get the first tour matching the current page URL . |
26,950 | public static function get_matching_tours ( \ moodle_url $ pageurl ) { global $ PAGE ; $ tours = cache :: get_matching_tourdata ( $ pageurl ) ; foreach ( $ tours as $ record ) { $ tour = tour :: load_from_record ( $ record ) ; if ( $ tour -> is_enabled ( ) && $ tour -> matches_all_filters ( $ PAGE -> context ) ) { retu... | Get the first tour matching the specified URL . |
26,951 | public static function import_tour_from_json ( $ json ) { $ tourconfig = json_decode ( $ json ) ; unset ( $ tourconfig -> version ) ; $ steps = $ tourconfig -> steps ; unset ( $ tourconfig -> steps ) ; $ tourconfig -> id = null ; $ tourconfig -> sortorder = null ; $ tour = tour :: load_from_record ( $ tourconfig , true... | Import the provided tour JSON . |
26,952 | protected function print_edit_step_link ( $ tourid , $ stepid = null ) { $ addlink = helper :: get_edit_step_link ( $ tourid , $ stepid ) ; $ attributes = [ ] ; if ( empty ( $ stepid ) ) { $ attributes [ 'class' ] = 'createstep' ; } echo \ html_writer :: link ( $ addlink , get_string ( 'newstep' , 'tool_usertours' ) , ... | Print the edit step link . |
26,953 | protected function edit_step ( $ id ) { global $ PAGE ; if ( isset ( $ id ) ) { $ step = step :: instance ( $ id ) ; } else { $ step = new step ( ) ; $ step -> set_tourid ( required_param ( 'tourid' , PARAM_INT ) ) ; } $ tour = $ step -> get_tour ( ) ; if ( ! empty ( $ tour -> get_config ( self :: CONFIG_SHIPPED_TOUR )... | Display the edit step form for the specified step . |
26,954 | protected function move_tour ( $ id ) { require_sesskey ( ) ; $ direction = required_param ( 'direction' , PARAM_INT ) ; $ tour = tour :: instance ( $ id ) ; self :: _move_tour ( $ tour , $ direction ) ; redirect ( helper :: get_list_tour_link ( ) ) ; } | Move a tour up or down and redirect once complete . |
26,955 | protected static function _move_tour ( tour $ tour , $ direction ) { $ currentsortorder = $ tour -> get_sortorder ( ) ; $ targetsortorder = $ currentsortorder + $ direction ; $ swapwith = helper :: get_tour_from_sortorder ( $ targetsortorder ) ; $ tour -> set_sortorder ( - 1 ) ; $ tour -> persist ( ) ; $ swapwith -> se... | Move a tour up or down . |
26,956 | protected function move_step ( $ id ) { require_sesskey ( ) ; $ direction = required_param ( 'direction' , PARAM_INT ) ; $ step = step :: instance ( $ id ) ; $ currentsortorder = $ step -> get_sortorder ( ) ; $ targetsortorder = $ currentsortorder + $ direction ; $ tour = $ step -> get_tour ( ) ; $ swapwith = helper ::... | Move a step up or down . |
26,957 | protected function delete_step ( $ stepid ) { require_sesskey ( ) ; $ step = step :: instance ( $ stepid ) ; $ tour = $ step -> get_tour ( ) ; $ step -> remove ( ) ; redirect ( $ tour -> get_view_link ( ) ) ; } | Delete the step . |
26,958 | public static function update_shipped_tours ( ) { global $ DB , $ CFG ; $ shippedtours = [ '36_dashboard.json' => 3 ] ; $ unshippedtours = [ 'boost_administrator.json' => 1 , 'boost_course_view.json' => 1 , ] ; if ( $ CFG -> messaging ) { $ shippedtours [ '36_messaging.json' ] = 3 ; } else { $ unshippedtours [ '36_mess... | Make sure all of the default tours that are shipped with Moodle are created and up to date with the latest version . |
26,959 | public function instance_form_definition ( \ MoodleQuickForm $ mform ) { $ field = $ this -> get_field ( ) ; $ calendartype = \ core_calendar \ type_factory :: get_calendar_instance ( ) ; $ config = $ field -> get ( 'configdata' ) ; $ attributes = [ 'optional' => true ] ; if ( ! empty ( $ config [ 'mindate' ] ) ) { $ a... | Add fields for editing data of a date field on a context . |
26,960 | function addPattern ( $ pattern , $ label = true ) { $ count = count ( $ this -> _patterns ) ; $ this -> _patterns [ $ count ] = $ pattern ; $ this -> _labels [ $ count ] = $ label ; $ this -> _regex = null ; } | Adds a pattern with an optional label . |
26,961 | function match ( $ subject , & $ match ) { if ( count ( $ this -> _patterns ) == 0 ) { return false ; } if ( ! preg_match ( $ this -> _getCompoundedRegex ( ) , $ subject , $ matches ) ) { $ match = "" ; return false ; } $ match = $ matches [ 0 ] ; for ( $ i = 1 ; $ i < count ( $ matches ) ; $ i ++ ) { if ( $ matches [ ... | Attempts to match all patterns at once against a string . |
26,962 | function addPattern ( $ pattern , $ mode = "accept" ) { if ( ! isset ( $ this -> _regexes [ $ mode ] ) ) { $ this -> _regexes [ $ mode ] = new ParallelRegex ( $ this -> _case ) ; } $ this -> _regexes [ $ mode ] -> addPattern ( $ pattern ) ; } | Adds a token search pattern for a particular parsing mode . The pattern does not change the current mode . |
26,963 | function parse ( $ raw ) { if ( ! isset ( $ this -> _parser ) ) { return false ; } $ length = strlen ( $ raw ) ; while ( is_array ( $ parsed = $ this -> _reduce ( $ raw ) ) ) { list ( $ unmatched , $ matched , $ mode ) = $ parsed ; if ( ! $ this -> _dispatchTokens ( $ unmatched , $ matched , $ mode ) ) { return false ;... | Splits the page text into tokens . Will fail if the handlers report an error or if no content is consumed . If successful then each unparsed and parsed token invokes a call to the held listener . |
26,964 | function _dispatchTokens ( $ unmatched , $ matched , $ mode = false ) { if ( ! $ this -> _invokeParser ( $ unmatched , LEXER_UNMATCHED ) ) { return false ; } if ( $ mode === "__exit" ) { if ( ! $ this -> _invokeParser ( $ matched , LEXER_EXIT ) ) { return false ; } return $ this -> _mode -> leave ( ) ; } if ( strncmp (... | Sends the matched token and any leading unmatched text to the parser changing the lexer to a new mode if one is listed . |
26,965 | function _invokeParser ( $ content , $ is_match ) { if ( ( $ content === "" ) || ( $ content === false ) ) { return true ; } $ handler = $ this -> _mode -> getCurrent ( ) ; if ( isset ( $ this -> _mode_handlers [ $ handler ] ) ) { $ handler = $ this -> _mode_handlers [ $ handler ] ; } return $ this -> _parser -> $ hand... | Calls the parser method named after the current mode . Empty content will be ignored . |
26,966 | function _reduce ( & $ raw ) { if ( ! isset ( $ this -> _regexes [ $ this -> _mode -> getCurrent ( ) ] ) ) { return false ; } if ( $ raw === "" ) { return true ; } if ( $ action = $ this -> _regexes [ $ this -> _mode -> getCurrent ( ) ] -> match ( $ raw , $ match ) ) { $ count = strpos ( $ raw , $ match ) ; $ unparsed ... | Tries to match a chunk of text and if successful removes the recognised chunk and any leading unparsed data . Empty strings will not be matched . |
26,967 | public function process_gradingform_rubric_level ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ oldid = $ data -> id ; $ data -> criterionid = $ this -> get_new_parentid ( 'gradingform_rubric_criterion' ) ; $ newid = $ DB -> insert_record ( 'gradingform_rubric_levels' , $ data ) ; $ this -> set_mapping ( 'gr... | Processes level element data |
26,968 | public function get_attachments_for_posts ( context $ context , array $ posts ) { $ itemids = array_map ( function ( $ post ) { return $ post -> get_id ( ) ; } , $ posts ) ; $ files = $ this -> filestorage -> get_area_files ( $ context -> id , self :: COMPONENT , self :: FILE_AREA , $ itemids , self :: SORT , self :: I... | Get the attachments for the given posts . The results are indexed by post id . |
26,969 | public function add_pretend_calendar_block ( block_contents $ bc , $ pos = BLOCK_POS_RIGHT ) { $ this -> page -> blocks -> add_fake_block ( $ bc , $ pos ) ; } | Adds a pretent calendar block |
26,970 | public function add_event_button ( $ courseid , $ unused1 = null , $ unused2 = null , $ unused3 = null , $ unused4 = null ) { $ data = [ 'contextid' => ( \ context_course :: instance ( $ courseid ) ) -> id , ] ; return $ this -> render_from_template ( 'core_calendar/add_event_button' , $ data ) ; } | Creates a button to add a new event . |
26,971 | public function course_filter_selector ( moodle_url $ returnurl , $ label = null , $ courseid = null ) { global $ CFG , $ DB ; if ( ! isloggedin ( ) or isguestuser ( ) ) { return '' ; } $ contextrecords = [ ] ; $ courses = calendar_get_default_courses ( $ courseid , 'id, shortname' ) ; if ( ! empty ( $ courses ) && cou... | Displays a course filter selector |
26,972 | public function subscription_details ( $ unused = null , $ subscriptions , $ importresults = '' ) { $ table = new html_table ( ) ; $ table -> head = array ( get_string ( 'colcalendar' , 'calendar' ) , get_string ( 'collastupdated' , 'calendar' ) , get_string ( 'eventkind' , 'calendar' ) , get_string ( 'colpoll' , 'cale... | Renders a table containing information about calendar subscriptions . |
26,973 | protected function subscription_action_form ( $ subscription ) { $ html = html_writer :: start_tag ( 'form' , array ( 'action' => new moodle_url ( '/calendar/managesubscriptions.php' ) , 'method' => 'post' ) ) ; if ( empty ( $ subscription -> url ) ) { $ html .= html_writer :: empty_tag ( 'input' , array ( 'type' => 'h... | Creates a form to perform actions on a given subscription . |
26,974 | protected function startSheet ( ) { $ this -> sheetFilePointer = fopen ( $ this -> worksheetFilePath , 'w' ) ; $ this -> throwIfSheetFilePointerIsNotAvailable ( ) ; fwrite ( $ this -> sheetFilePointer , self :: SHEET_XML_FILE_HEADER ) ; fwrite ( $ this -> sheetFilePointer , '<sheetData>' ) ; } | Prepares the worksheet to accept data |
26,975 | protected function isEmptyRow ( $ dataRow ) { $ numCells = count ( $ dataRow ) ; return ( $ numCells === 1 && CellHelper :: isEmpty ( reset ( $ dataRow ) ) ) ; } | Returns whether the given row is empty |
26,976 | protected function addNonEmptyRow ( $ dataRow , $ style ) { $ cellNumber = 0 ; $ rowIndex = $ this -> lastWrittenRowIndex + 1 ; $ numCells = count ( $ dataRow ) ; $ rowXML = '<row r="' . $ rowIndex . '" spans="1:' . $ numCells . '">' ; foreach ( $ dataRow as $ cellValue ) { $ rowXML .= $ this -> getCellXML ( $ rowIndex... | Adds non empty row to the worksheet . |
26,977 | protected function getCellXML ( $ rowIndex , $ cellNumber , $ cellValue , $ styleId ) { $ columnIndex = CellHelper :: getCellIndexFromColumnIndex ( $ cellNumber ) ; $ cellXML = '<c r="' . $ columnIndex . $ rowIndex . '"' ; $ cellXML .= ' s="' . $ styleId . '"' ; if ( CellHelper :: isNonEmptyString ( $ cellValue ) ) { $... | Build and return xml for a single cell . |
26,978 | protected function getCellXMLFragmentForNonEmptyString ( $ cellValue ) { if ( $ this -> stringHelper -> getStringLength ( $ cellValue ) > self :: MAX_CHARACTERS_PER_CELL ) { throw new InvalidArgumentException ( 'Trying to add a value that exceeds the maximum number of characters allowed in a cell (32,767)' ) ; } if ( $... | Returns the XML fragment for a cell containing a non empty string |
26,979 | public function close ( ) { if ( ! is_resource ( $ this -> sheetFilePointer ) ) { return ; } fwrite ( $ this -> sheetFilePointer , '</sheetData>' ) ; fwrite ( $ this -> sheetFilePointer , '</worksheet>' ) ; fclose ( $ this -> sheetFilePointer ) ; } | Closes the worksheet |
26,980 | protected function get_legacy_eventdata ( ) { $ user = $ this -> get_record_snapshot ( 'user' , $ this -> objectid ) ; $ user -> deleted = 0 ; $ user -> username = $ this -> other [ 'username' ] ; $ user -> email = $ this -> other [ 'email' ] ; $ user -> idnumber = $ this -> other [ 'idnumber' ] ; $ user -> picture = $... | Return user_deleted legacy event data . |
26,981 | public function command ( $ command , array $ options = [ ] ) { if ( ! isset ( $ options [ 'readPreference' ] ) ) { $ options [ 'readPreference' ] = $ this -> readPreference ; } if ( ! isset ( $ options [ 'typeMap' ] ) ) { $ options [ 'typeMap' ] = $ this -> typeMap ; } $ operation = new DatabaseCommand ( $ this -> dat... | Execute a command on this database . |
26,982 | public function createCollection ( $ collectionName , array $ options = [ ] ) { if ( ! isset ( $ options [ 'typeMap' ] ) ) { $ options [ 'typeMap' ] = $ this -> typeMap ; } $ server = $ this -> manager -> selectServer ( new ReadPreference ( ReadPreference :: RP_PRIMARY ) ) ; if ( ! isset ( $ options [ 'writeConcern' ] ... | Create a new collection explicitly . |
26,983 | public function listCollections ( array $ options = [ ] ) { $ operation = new ListCollections ( $ this -> databaseName , $ options ) ; $ server = $ this -> manager -> selectServer ( new ReadPreference ( ReadPreference :: RP_PRIMARY ) ) ; return $ operation -> execute ( $ server ) ; } | Returns information for all collections in this database . |
26,984 | public function modifyCollection ( $ collectionName , array $ collectionOptions , array $ options = [ ] ) { if ( ! isset ( $ options [ 'typeMap' ] ) ) { $ options [ 'typeMap' ] = $ this -> typeMap ; } $ server = $ this -> manager -> selectServer ( new ReadPreference ( ReadPreference :: RP_PRIMARY ) ) ; if ( ! isset ( $... | Modifies a collection or view . |
26,985 | public function selectGridFSBucket ( array $ options = [ ] ) { $ options += [ 'readConcern' => $ this -> readConcern , 'readPreference' => $ this -> readPreference , 'typeMap' => $ this -> typeMap , 'writeConcern' => $ this -> writeConcern , ] ; return new Bucket ( $ this -> manager , $ this -> databaseName , $ options... | Select a GridFS bucket within this database . |
26,986 | public function withOptions ( array $ options = [ ] ) { $ options += [ 'readConcern' => $ this -> readConcern , 'readPreference' => $ this -> readPreference , 'typeMap' => $ this -> typeMap , 'writeConcern' => $ this -> writeConcern , ] ; return new Database ( $ this -> manager , $ this -> databaseName , $ options ) ; ... | Get a clone of this database with different options . |
26,987 | public static function errorHandlerCallback ( $ code , $ string , $ file , $ line , $ context ) { $ e = new self ( $ string , $ code ) ; $ e -> line = $ line ; $ e -> file = $ file ; throw $ e ; } | Error handler callback |
26,988 | public function get_my_dependency_properties ( $ settingname = null ) { if ( $ settingname == null ) { $ settingname = $ this -> get_ui_name ( ) ; } $ dependencies = array ( ) ; foreach ( $ this -> dependenton as $ dependenton ) { $ properties = $ dependenton -> get_moodleform_properties ( ) ; $ properties [ 'setting' ... | Gets an array of properties for all of the dependencies that will affect this setting . |
26,989 | public function register_dependency ( setting_dependency $ dependency ) { if ( $ this -> is_circular_reference ( $ dependency -> get_dependent_setting ( ) ) ) { $ a = new stdclass ( ) ; $ a -> alreadydependent = $ this -> name ; $ a -> main = $ dependency -> get_dependent_setting ( ) -> get_name ( ) ; throw new base_se... | Adds a dependency where another setting depends on this setting . |
26,990 | public function add_dependency ( base_setting $ dependentsetting , $ type = null , $ options = array ( ) ) { if ( $ this -> is_circular_reference ( $ dependentsetting ) ) { $ a = new stdclass ( ) ; $ a -> alreadydependent = $ this -> name ; $ a -> main = $ dependentsetting -> get_name ( ) ; throw new base_setting_excep... | Quick method to add a dependency to this setting . |
26,991 | public function get_param_validation ( ) { switch ( $ this -> vtype ) { case self :: IS_BOOLEAN : return PARAM_BOOL ; case self :: IS_INTEGER : return PARAM_INT ; case self :: IS_FILENAME : return PARAM_FILE ; case self :: IS_PATH : return PARAM_PATH ; case self :: IS_TEXT : return PARAM_TEXT ; } return null ; } | Get the PARAM_XXXX validation to be applied to the setting |
26,992 | protected function get_correct_answers ( $ question ) { $ arrayofchoices = $ this -> get_array_of_choices ( $ question ) ; $ arrayofplaceholdeers = $ this -> get_array_of_placeholders ( $ question ) ; $ correctplayers = array ( ) ; foreach ( $ arrayofplaceholdeers as $ ph ) { foreach ( $ arrayofchoices as $ key => $ ch... | This method gets the correct answers in a 2 dimentional array . |
26,993 | protected function get_array_of_placeholders ( $ question ) { $ qtext = $ question -> questiontext ; $ error = '<b> ERROR</b>: Please check the form for this question. ' ; if ( ! $ qtext ) { echo $ error . 'The question text is empty!' ; return false ; } $ slots = $ this -> getEmbeddedTextArray ( $ question ) ; if ( ! ... | Return the list of groups used in a question . |
26,994 | public function is_enabled ( $ cm = null ) { global $ CFG , $ DB ; if ( ! isset ( $ CFG -> enablecompletion ) || $ CFG -> enablecompletion == COMPLETION_DISABLED ) { return COMPLETION_DISABLED ; } if ( ! isset ( $ this -> course -> enablecompletion ) ) { $ this -> course = get_course ( $ this -> course_id ) ; } if ( $ ... | Checks whether completion is enabled in a particular course and possibly activity . |
26,995 | public function display_help_icon ( ) { global $ PAGE , $ OUTPUT , $ USER ; $ result = '' ; if ( $ this -> is_enabled ( ) && ! $ PAGE -> user_is_editing ( ) && $ this -> is_tracked_user ( $ USER -> id ) && isloggedin ( ) && ! isguestuser ( ) ) { $ result .= html_writer :: tag ( 'div' , get_string ( 'yourprogress' , 'co... | Returns the Your progress help icon if completion tracking is enabled . |
26,996 | public function get_completion ( $ user_id , $ criteriatype ) { $ completions = $ this -> get_completions ( $ user_id , $ criteriatype ) ; if ( empty ( $ completions ) ) { return false ; } elseif ( count ( $ completions ) > 1 ) { print_error ( 'multipleselfcompletioncriteria' , 'completion' ) ; } return $ completions [... | Get a course completion for a user |
26,997 | public function get_completions ( $ user_id , $ criteriatype = null ) { $ criteria = $ this -> get_criteria ( $ criteriatype ) ; $ completions = array ( ) ; foreach ( $ criteria as $ criterion ) { $ params = array ( 'course' => $ this -> course_id , 'userid' => $ user_id , 'criteriaid' => $ criterion -> id ) ; $ comple... | Get all course criteria s completion objects for a user |
26,998 | public function get_user_completion ( $ user_id , $ criteria ) { $ params = array ( 'course' => $ this -> course_id , 'userid' => $ user_id , 'criteriaid' => $ criteria -> id , ) ; $ completion = new completion_criteria_completion ( $ params ) ; return $ completion ; } | Get completion object for a user and a criteria |
26,999 | public function get_criteria ( $ criteriatype = null ) { if ( ! is_array ( $ this -> criteria ) ) { global $ DB ; $ params = array ( 'course' => $ this -> course -> id ) ; $ records = ( array ) $ DB -> get_records ( 'course_completion_criteria' , $ params ) ; if ( $ records ) { $ activitiesorder = array_keys ( get_fast... | Get course completion criteria |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.