idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
28,900 | public function get_paths ( ) { $ paths = array ( new convert_path ( 'question_categories' , '/MOODLE_BACKUP/COURSE/QUESTION_CATEGORIES' ) , new convert_path ( 'question_category' , '/MOODLE_BACKUP/COURSE/QUESTION_CATEGORIES/QUESTION_CATEGORY' , array ( 'newfields' => array ( 'infoformat' => 0 ) ) ) , new convert_path ... | Registers path that are not qtype - specific |
28,901 | public function on_question_categories_start ( ) { $ this -> open_xml_writer ( 'questions.xml' ) ; $ this -> xmlwriter -> begin_tag ( 'question_categories' ) ; if ( is_null ( $ this -> fileman ) ) { $ this -> fileman = $ this -> converter -> get_file_manager ( ) ; } } | Starts writing questions . xml and prepares the file manager instance |
28,902 | public function on_question_category_start ( ) { $ this -> currentcategory = array ( ) ; $ this -> currentcategoryraw = array ( ) ; $ this -> currentcategorywritten = false ; $ this -> questionswrapperwritten = false ; } | Initializes the current category cache |
28,903 | public function process_question_category ( $ data , $ raw ) { $ this -> currentcategory = array_merge ( $ this -> currentcategory , $ data ) ; $ this -> currentcategoryraw = array_merge ( $ this -> currentcategoryraw , $ raw ) ; } | Populates the current question category data |
28,904 | public function process_question_category_context ( $ data ) { switch ( $ data [ 'level' ] ) { case 'module' : $ this -> currentcategory [ 'contextid' ] = $ this -> converter -> get_contextid ( CONTEXT_MODULE , $ data [ 'instance' ] ) ; $ this -> currentcategory [ 'contextlevel' ] = CONTEXT_MODULE ; $ this -> currentca... | Inject the context related information into the current category |
28,905 | protected function get_qtype_handler ( $ qtype ) { if ( is_null ( $ this -> qtypehandlers ) ) { $ this -> qtypehandlers = array ( ) ; foreach ( core_component :: get_plugin_list ( 'qtype' ) as $ qtypename => $ qtypelocation ) { $ filename = $ qtypelocation . '/backup/moodle1/lib.php' ; if ( file_exists ( $ filename ) )... | Provides access to the qtype handlers |
28,906 | public function on_scales_start ( ) { $ syscontextid = $ this -> converter -> get_contextid ( CONTEXT_SYSTEM ) ; $ this -> fileman = $ this -> converter -> get_file_manager ( $ syscontextid , 'grade' , 'scale' ) ; } | Prepare the file manager for the files embedded in the scale description field |
28,907 | public function on_gradebook_grade_outcomes_start ( ) { $ syscontextid = $ this -> converter -> get_contextid ( CONTEXT_SYSTEM ) ; $ this -> fileman = $ this -> converter -> get_file_manager ( $ syscontextid , 'grade' , 'outcome' ) ; $ this -> open_xml_writer ( 'outcomes.xml' ) ; $ this -> xmlwriter -> begin_tag ( 'out... | Prepares the file manager and starts writing outcomes . xml |
28,908 | public function process_gradebook_grade_outcome ( array $ data , array $ raw ) { global $ CFG ; if ( $ CFG -> texteditors !== 'textarea' ) { $ data [ 'description' ] = text_to_html ( $ data [ 'description' ] , false , false , true ) ; $ data [ 'descriptionformat' ] = FORMAT_HTML ; } $ this -> fileman -> itemid = $ data... | Processes GRADE_OUTCOME tags progressively |
28,909 | public function process_gradebook_grade_category ( array $ data , array $ raw ) { $ this -> categoryparent [ $ data [ 'id' ] ] = $ data [ 'parent' ] ; $ this -> converter -> set_stash ( 'gradebook_gradecategory' , $ data , $ data [ 'id' ] ) ; } | Processes one GRADE_CATEGORY data |
28,910 | public function process_gradebook_grade_item ( array $ data , array $ raw ) { $ data [ 'sortorder' ] = $ this -> converter -> get_nextid ( ) ; if ( $ data [ 'itemtype' ] === 'mod' ) { return $ this -> process_mod_grade_item ( $ data , $ raw ) ; } else if ( in_array ( $ data [ 'itemtype' ] , array ( 'manual' , 'course' ... | Processes one GRADE_ITEM data |
28,911 | protected function process_mod_grade_item ( array $ data , array $ raw ) { $ stashname = 'gradebook_modgradeitem_' . $ data [ 'itemmodule' ] ; $ stashitemid = $ data [ 'iteminstance' ] ; $ gradeitems = $ this -> converter -> get_stash_or_default ( $ stashname , $ stashitemid , array ( ) ) ; $ gradeitems [ $ data [ 'ite... | Processes one GRADE_ITEM of the type mod |
28,912 | protected function process_nonmod_grade_item ( array $ data , array $ raw ) { $ stashname = 'gradebook_nonmodgradeitem' ; $ stashitemid = $ data [ 'id' ] ; $ this -> converter -> set_stash ( $ stashname , $ data , $ stashitemid ) ; return $ data ; } | Processes one GRADE_ITEM of te type manual or course or category |
28,913 | public function on_gradebook_end ( ) { $ this -> open_xml_writer ( 'gradebook.xml' ) ; $ this -> xmlwriter -> begin_tag ( 'gradebook' ) ; $ this -> write_grade_categories ( ) ; $ this -> write_grade_items ( ) ; $ this -> write_grade_letters ( ) ; $ this -> xmlwriter -> end_tag ( 'gradebook' ) ; $ this -> close_xml_writ... | Writes the collected information into gradebook . xml |
28,914 | protected function calculate_category_path ( $ categoryid ) { if ( ! array_key_exists ( $ categoryid , $ this -> categoryparent ) ) { throw new moodle1_convert_exception ( 'gradebook_unknown_categoryid' , null , $ categoryid ) ; } $ path = array ( $ categoryid ) ; $ parent = $ this -> categoryparent [ $ categoryid ] ; ... | Calculates the path to the grade_category |
28,915 | protected function write_answers ( array $ answers , $ qtype ) { $ this -> xmlwriter -> begin_tag ( 'answers' ) ; foreach ( $ answers as $ elementname => $ elements ) { foreach ( $ elements as $ element ) { $ answer = $ this -> convert_answer ( $ element , $ qtype ) ; if ( $ answer [ 'answerformat' ] == FORMAT_HTML ) {... | Converts the answers and writes them into the questions . xml |
28,916 | protected function migrate_files ( $ text , $ component , $ filearea , $ itemid ) { $ context = $ this -> qbankhandler -> get_current_category_context ( ) ; $ fileman = $ this -> qbankhandler -> get_file_manager ( ) ; $ fileman -> contextid = $ context [ 'contextid' ] ; $ fileman -> component = $ component ; $ fileman ... | Migrate files belonging to one qtype plugin text field . |
28,917 | protected function write_numerical_units ( array $ numericalunits ) { $ this -> xmlwriter -> begin_tag ( 'numerical_units' ) ; foreach ( $ numericalunits as $ elementname => $ elements ) { foreach ( $ elements as $ element ) { $ element [ 'id' ] = $ this -> converter -> get_nextid ( ) ; $ this -> write_xml ( 'numerical... | Writes the grouped numerical_units structure |
28,918 | protected function write_numerical_options ( array $ numericaloption ) { $ this -> xmlwriter -> begin_tag ( 'numerical_options' ) ; if ( ! empty ( $ numericaloption ) ) { $ this -> write_xml ( 'numerical_option' , $ numericaloption , array ( '/numerical_option/id' ) ) ; } $ this -> xmlwriter -> end_tag ( 'numerical_opt... | Writes the numerical_options structure |
28,919 | protected function get_default_numerical_options ( $ oldquestiontextformat , $ units ) { global $ CFG ; $ options = array ( 'id' => $ this -> converter -> get_nextid ( ) , 'instructions' => null , 'instructionsformat' => 0 , 'showunits' => 0 , 'unitsleft' => 0 , 'unitgradingtype' => 0 , 'unitpenalty' => 0.1 ) ; if ( $ ... | Returns default numerical_option structure |
28,920 | protected function write_dataset_definitions ( array $ datasetdefinitions ) { $ this -> xmlwriter -> begin_tag ( 'dataset_definitions' ) ; foreach ( $ datasetdefinitions as $ datasetdefinition ) { $ this -> xmlwriter -> begin_tag ( 'dataset_definition' , array ( 'id' => $ this -> converter -> get_nextid ( ) ) ) ; forea... | Writes the dataset_definitions structure |
28,921 | protected function get_cminfo ( $ instance , $ modname = null ) { if ( is_null ( $ modname ) ) { $ modname = $ this -> pluginname ; } return $ this -> converter -> get_stash ( 'cminfo_' . $ modname , $ instance ) ; } | Returns course module information for the given instance id |
28,922 | public function execute ( ) { global $ CFG , $ DB ; require_once ( "{$CFG->libdir}/simplepie/moodle_simplepie.php" ) ; $ starttime = microtime ( ) ; $ starttimesec = time ( ) ; $ rs = $ DB -> get_recordset ( 'block_rss_client' ) ; $ counter = 0 ; mtrace ( '' ) ; foreach ( $ rs as $ rec ) { mtrace ( ' ' . $ rec -> ur... | This task goes through all the feeds . If the feed has a skipuntil value that is less than the current time cron will attempt to retrieve it with the cache duration set to 0 in order to force the retrieval of the item and refresh the cache . |
28,923 | protected function fetch_feed ( string $ url ) : \ moodle_simplepie { \ core_php_time_limit :: raise ( 60 ) ; $ feed = new \ moodle_simplepie ( ) ; $ feed -> set_timeout ( 40 ) ; $ feed -> set_cache_duration ( 0 ) ; $ feed -> set_feed_url ( $ url ) ; $ feed -> init ( ) ; return $ feed ; } | Fetch a feed for the specified URL . |
28,924 | protected function calculate_skiptime ( int $ currentskip ) : int { $ newskiptime = max ( MINSECS * 5 , ( $ currentskip * 2 ) ) ; return min ( $ newskiptime , self :: CLIENT_MAX_SKIPTIME ) ; } | Calculates a new skip time for a record based on the current skip time . |
28,925 | public static function delete_calendar_events ( $ events ) { global $ DB ; $ params = self :: validate_parameters ( self :: delete_calendar_events_parameters ( ) , array ( 'events' => $ events ) ) ; $ transaction = $ DB -> start_delegated_transaction ( ) ; foreach ( $ params [ 'events' ] as $ event ) { $ eventobj = cal... | Delete Calendar events |
28,926 | public static function get_calendar_action_events_by_timesort ( $ timesortfrom = 0 , $ timesortto = null , $ aftereventid = 0 , $ limitnum = 20 , $ limittononsuspendedevents = false , $ userid = null ) { global $ PAGE , $ USER ; $ params = self :: validate_parameters ( self :: get_calendar_action_events_by_timesort_par... | Get calendar action events based on the timesort value . |
28,927 | public static function get_calendar_action_events_by_course ( $ courseid , $ timesortfrom = null , $ timesortto = null , $ aftereventid = 0 , $ limitnum = 20 ) { global $ PAGE , $ USER ; $ user = null ; $ params = self :: validate_parameters ( self :: get_calendar_action_events_by_course_parameters ( ) , [ 'courseid' =... | Get calendar action events for the given course . |
28,928 | public static function get_calendar_action_events_by_courses ( array $ courseids , $ timesortfrom = null , $ timesortto = null , $ limitnum = 10 ) { global $ PAGE , $ USER ; $ user = null ; $ params = self :: validate_parameters ( self :: get_calendar_action_events_by_courses_parameters ( ) , [ 'courseids' => $ coursei... | Get calendar action events for a given list of courses . |
28,929 | public static function create_calendar_events ( $ events ) { global $ DB , $ USER ; $ params = self :: validate_parameters ( self :: create_calendar_events_parameters ( ) , array ( 'events' => $ events ) ) ; $ transaction = $ DB -> start_delegated_transaction ( ) ; $ return = array ( ) ; $ warnings = array ( ) ; foreac... | Delete Calendar events . |
28,930 | public static function get_calendar_event_by_id ( $ eventid ) { global $ PAGE , $ USER ; $ params = self :: validate_parameters ( self :: get_calendar_event_by_id_parameters ( ) , [ 'eventid' => $ eventid ] ) ; $ context = \ context_user :: instance ( $ USER -> id ) ; self :: validate_context ( $ context ) ; $ warnings... | Get calendar event by id . |
28,931 | public static function get_calendar_day_view ( $ year , $ month , $ day , $ courseid , $ categoryid ) { global $ DB , $ USER , $ PAGE ; $ params = self :: validate_parameters ( self :: get_calendar_day_view_parameters ( ) , [ 'year' => $ year , 'month' => $ month , 'day' => $ day , 'courseid' => $ courseid , 'categoryi... | Get data for the daily calendar view . |
28,932 | public static function update_event_start_day ( $ eventid , $ daytimestamp ) { global $ USER , $ PAGE ; $ params = self :: validate_parameters ( self :: update_event_start_day_parameters ( ) , [ 'eventid' => $ eventid , 'daytimestamp' => $ daytimestamp , ] ) ; $ vault = event_container :: get_event_vault ( ) ; $ mapper... | Change the start day for the given calendar event to the day that corresponds with the provided timestamp . |
28,933 | public static function get_calendar_access_information ( $ courseid = 0 ) { $ params = self :: validate_parameters ( self :: get_calendar_access_information_parameters ( ) , [ 'courseid' => $ courseid ] ) ; if ( empty ( $ params [ 'courseid' ] ) || $ params [ 'courseid' ] == SITEID ) { $ context = \ context_system :: i... | Convenience function to retrieve some permissions information for the given course calendar . |
28,934 | public static function get_allowed_event_types ( $ courseid = 0 ) { $ params = self :: validate_parameters ( self :: get_allowed_event_types_parameters ( ) , [ 'courseid' => $ courseid ] ) ; if ( empty ( $ params [ 'courseid' ] ) || $ params [ 'courseid' ] == SITEID ) { $ context = \ context_system :: instance ( ) ; } ... | Get the type of events a user can create in the given course . |
28,935 | public static function get_comments ( ) { global $ DB , $ USER ; $ comments = array ( ) ; $ records = $ DB -> get_records ( 'assignfeedback_editpdf_quick' , array ( 'userid' => $ USER -> id ) ) ; return $ records ; } | Get all comments for the current user . |
28,936 | public static function add_comment ( $ commenttext , $ width , $ colour ) { global $ DB , $ USER ; $ comment = new \ stdClass ( ) ; $ comment -> userid = $ USER -> id ; $ comment -> rawtext = $ commenttext ; $ comment -> width = $ width ; $ comment -> colour = $ colour ; $ comment -> id = $ DB -> insert_record ( 'assig... | Add a comment to the quick list . |
28,937 | public function getStatus ( $ entry ) { if ( isset ( $ this -> _status [ $ entry ] ) ) { return $ this -> _status [ $ entry ] ; } switch ( $ entry ) { case Horde_Imap_Client :: STATUS_FLAGS : case Horde_Imap_Client :: STATUS_SYNCFLAGUIDS : case Horde_Imap_Client :: STATUS_SYNCVANISHED : return array ( ) ; case Horde_Im... | Get status information for the mailbox . |
28,938 | public function setStatus ( $ entry , $ value ) { switch ( $ entry ) { case Horde_Imap_Client :: STATUS_FIRSTUNSEEN : case Horde_Imap_Client :: STATUS_HIGHESTMODSEQ : case Horde_Imap_Client :: STATUS_MESSAGES : case Horde_Imap_Client :: STATUS_UNSEEN : case Horde_Imap_Client :: STATUS_UIDNEXT : case Horde_Imap_Client :... | Set status information for the mailbox . |
28,939 | public function reset ( ) { $ keep = array ( Horde_Imap_Client :: STATUS_SYNCFLAGUIDS , Horde_Imap_Client :: STATUS_SYNCMODSEQ , Horde_Imap_Client :: STATUS_SYNCVANISHED ) ; foreach ( array_diff ( array_keys ( $ this -> _status ) , $ keep ) as $ val ) { unset ( $ this -> _status [ $ val ] ) ; } $ this -> map = new Hord... | Reset the mailbox information . |
28,940 | public function getResourceLink ( ) { if ( is_null ( $ this -> resourceLink ) && ! is_null ( $ this -> resourceLinkId ) ) { $ this -> resourceLink = ResourceLink :: fromRecordId ( $ this -> resourceLinkId , $ this -> getDataConnector ( ) ) ; } return $ this -> resourceLink ; } | Get resource link . |
28,941 | public static function fromResourceLink ( $ resourceLink , $ ltiUserId ) { $ user = new User ( ) ; $ user -> resourceLink = $ resourceLink ; if ( ! is_null ( $ resourceLink ) ) { $ user -> resourceLinkId = $ resourceLink -> getRecordId ( ) ; $ user -> dataConnector = $ resourceLink -> getDataConnector ( ) ; } $ user ->... | Class constructor from resource link . |
28,942 | private function hasRole ( $ role ) { if ( substr ( $ role , 0 , 4 ) !== 'urn:' ) { $ role = 'urn:lti:role:ims/lis/' . $ role ; } return in_array ( $ role , $ this -> roles ) ; } | Check whether the user has a specified role name . |
28,943 | public function addNodes ( $ nodes , $ weight = 1 ) { foreach ( $ nodes as $ node ) { $ this -> _nodes [ ] = array ( 'n' => $ node , 'w' => $ weight ) ; $ this -> _nodeCount ++ ; $ nodeIndex = $ this -> _nodeCount - 1 ; $ nodeString = serialize ( $ node ) ; $ numberOfReplicas = ( int ) ( $ weight * $ this -> _numberOfR... | Add multiple nodes to the hash with the same weight . |
28,944 | protected function _updateCircle ( ) { ksort ( $ this -> _circle ) ; $ this -> _pointMap = array_keys ( $ this -> _circle ) ; $ this -> _pointCount = count ( $ this -> _pointMap ) ; } | Maintain the circle and arrays of points . |
28,945 | public function fetch_request ( $ request ) { throw new coding_exception ( 'Sorry, this function has been deprecated in Moodle 2.8.8, 2.9.2 and 3.0. Use block_tag_youtube::get_service instead.' ) ; $ c = new curl ( array ( 'cache' => true , 'module_cache' => 'tag_youtube' ) ) ; $ c -> setopt ( array ( 'CURLOPT_TIMEOUT'... | Sends a request to fetch data . |
28,946 | protected function get_error_message ( $ message = null ) { global $ OUTPUT ; if ( empty ( $ message ) ) { $ message = get_string ( 'apierror' , 'block_tag_youtube' ) ; } return $ OUTPUT -> notification ( $ message ) ; } | Returns an error message . |
28,947 | protected function get_service ( ) { global $ CFG ; if ( ! $ apikey = get_config ( 'block_tag_youtube' , 'apikey' ) ) { return false ; } if ( ! isset ( $ this -> service ) ) { require_once ( $ CFG -> libdir . '/google/lib.php' ) ; $ client = get_google_client ( ) ; $ client -> setDeveloperKey ( $ apikey ) ; $ client ->... | Gets the youtube service object . |
28,948 | protected function render_items ( $ videosdata ) { if ( ! $ videosdata || empty ( $ videosdata -> items ) ) { if ( ! empty ( $ videosdata -> error ) ) { debugging ( 'Error fetching data from youtube: ' . $ videosdata -> error -> message , DEBUG_DEVELOPER ) ; } return '' ; } $ service = $ this -> get_service ( ) ; $ tex... | Renders the list of items . |
28,949 | public static function count_templates ( $ competencyid , $ onlyvisible ) { global $ DB ; $ sql = 'SELECT COUNT(tpl.id) FROM {' . self :: TABLE . '} tplcomp JOIN {' . template :: TABLE . '} tpl ON tplcomp.templateid = tpl.id WHERE tplcomp.competencyid... | Count the templates using a competency . |
28,950 | public static function list_templates ( $ competencyid , $ onlyvisible ) { global $ DB ; $ sql = 'SELECT tpl.* FROM {' . template :: TABLE . '} tpl JOIN {' . self :: TABLE . '} tplcomp ON tplcomp.templateid = tpl.id WHERE tplcomp.competencyid = ? ' ; ... | List the templates using a competency . |
28,951 | public static function count_competencies_with_no_courses ( $ templateid ) { global $ DB ; $ sql = 'SELECT COUNT(comp.id) FROM {' . self :: TABLE . '} tplcomp JOIN {' . competency :: TABLE . '} comp ON tplcomp.competencyid = comp.id LEFT JOIN {' . co... | Count the competencies in a template with no links to courses . |
28,952 | public static function list_competencies ( $ templateid ) { global $ DB ; $ sql = 'SELECT comp.* FROM {' . competency :: TABLE . '} comp JOIN {' . self :: TABLE . '} tplcomp ON tplcomp.competencyid = comp.id WHERE tplcomp.templateid = ? O... | List the competencies in this template . |
28,953 | public static function create_from_record ( $ record ) { $ event = static :: create ( [ 'objectid' => $ record -> id , 'relateduserid' => $ record -> userid , 'context' => \ context_user :: instance ( $ record -> userid ) , 'other' => [ 'policyversionid' => $ record -> policyversionid , 'note' => $ record -> note , 'st... | Create event from record . |
28,954 | public static function isRequestCacheable ( Google_Http_Request $ resp ) { $ method = $ resp -> getRequestMethod ( ) ; if ( ! in_array ( $ method , self :: $ CACHEABLE_HTTP_METHODS ) ) { return false ; } if ( $ resp -> getRequestHeader ( "authorization" ) ) { return false ; } return true ; } | Check if an HTTP request can be cached by a private local cache . |
28,955 | public static function isResponseCacheable ( Google_Http_Request $ resp ) { if ( false == self :: isRequestCacheable ( $ resp ) ) { return false ; } $ code = $ resp -> getResponseHttpCode ( ) ; if ( ! in_array ( $ code , self :: $ CACHEABLE_STATUS_CODES ) ) { return false ; } $ etag = $ resp -> getResponseHeader ( "eta... | Check if an HTTP response can be cached by a private local cache . |
28,956 | public function get_document_recordset ( $ modifiedfrom = 0 , \ context $ context = null ) { global $ DB ; list ( $ contextjoin , $ contextparams ) = $ this -> get_context_restriction_sql ( $ context , $ this -> get_module_name ( ) , 'modtable' ) ; if ( $ contextjoin === null ) { return null ; } return $ DB -> get_reco... | Returns recordset containing all activities within the given context . |
28,957 | public function get_context_url ( \ core_search \ document $ doc ) { $ cminfo = $ this -> get_cm ( $ this -> get_module_name ( ) , strval ( $ doc -> get ( 'itemid' ) ) , $ doc -> get ( 'courseid' ) ) ; return new \ moodle_url ( '/mod/' . $ this -> get_module_name ( ) . '/view.php' , array ( 'id' => $ cminfo -> id ) ) ;... | Link to the module instance . |
28,958 | protected function get_activity ( $ instanceid ) { global $ DB ; if ( empty ( $ this -> activitiesdata [ $ this -> get_module_name ( ) ] [ $ instanceid ] ) ) { $ this -> activitiesdata [ $ this -> get_module_name ( ) ] [ $ instanceid ] = $ DB -> get_record ( $ this -> get_module_name ( ) , array ( 'id' => $ instanceid ... | Returns an activity instance . Internally uses the class component to know which activity module should be retrieved . |
28,959 | public function get_legacy_logdata ( ) { return array ( $ this -> courseid , 'data' , 'update' , 'view.php?d=' . $ this -> other [ 'dataid' ] . '&rid=' . $ this -> objectid , $ this -> other [ 'dataid' ] , $ this -> contextinstanceid ) ; } | Get the legacy event log data . |
28,960 | public function is_uninstall_allowed ( ) { if ( $ this -> name === 'upload' || $ this -> name === 'coursefiles' || $ this -> name === 'user' || $ this -> name === 'recent' ) { return false ; } else { return true ; } } | Defines if there should be a way to uninstall the plugin via the administration UI . |
28,961 | public function uninstall_cleanup ( ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/repository/lib.php' ) ; $ repo = \ repository :: get_type_by_typename ( $ this -> name ) ; if ( $ repo ) { $ repo -> delete ( true ) ; } parent :: uninstall_cleanup ( ) ; } | Pre - uninstall hook . This is intended for disabling of plugin some DB table purging etc . Converts all linked files to standard files when repository is removed and cleans up all records in the DB for that repository . |
28,962 | function decodeBase64 ( $ info ) { $ keysNoEncode = array ( "lti_version" , "lti_message_type" , "tool_consumer_instance_description" , "tool_consumer_instance_guid" , "oauth_consumer_key" , "custom_lti_message_encoded_base64" , "oauth_nonce" , "oauth_version" , "oauth_callback" , "oauth_timestamp" , "basiclti_submit" ... | Data submitter are in base64 then we have to decode |
28,963 | public static function attachment_options ( $ forum ) { global $ COURSE , $ PAGE , $ CFG ; $ maxbytes = get_user_max_upload_file_size ( $ PAGE -> context , $ CFG -> maxbytes , $ COURSE -> maxbytes , $ forum -> maxbytes ) ; return array ( 'subdirs' => 0 , 'maxbytes' => $ maxbytes , 'maxfiles' => $ forum -> maxattachment... | Returns the options array to use in filemanager for forum attachments |
28,964 | public static function editor_options ( context_module $ context , $ postid ) { global $ COURSE , $ PAGE , $ CFG ; $ maxbytes = get_user_max_upload_file_size ( $ PAGE -> context , $ CFG -> maxbytes , $ COURSE -> maxbytes ) ; return array ( 'maxfiles' => EDITOR_UNLIMITED_FILES , 'maxbytes' => $ maxbytes , 'trusttext' =>... | Returns the options array to use in forum text editor |
28,965 | public static function send_export_xml ( $ roleid ) { global $ CFG , $ DB ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; $ role = $ DB -> get_record ( 'role' , array ( 'id' => $ roleid ) , '*' , MUST_EXIST ) ; if ( $ role -> shortname ) { $ filename = $ role -> shortname . '.xml' ; } else { $ filename = 'role.xm... | Send role export xml file to browser . |
28,966 | public static function is_valid_preset ( $ xml ) { $ dom = new DOMDocument ( ) ; if ( ! $ dom -> loadXML ( $ xml ) ) { return false ; } else { $ val = @ $ dom -> schemaValidate ( __DIR__ . '/../role_schema.xml' ) ; if ( ! $ val ) { return false ; } } return true ; } | Is this XML valid role preset? |
28,967 | public function addValue ( $ mValue , $ sType = ' ' ) { if ( ! is_array ( $ mValue ) ) { $ mValue = array ( $ mValue ) ; } if ( ! $ this -> mValue instanceof RuleValueList || $ this -> mValue -> getListSeparator ( ) !== $ sType ) { $ mCurrentValue = $ this -> mValue ; $ this -> mValue = new RuleValueList ( $ sType , $ ... | Adds a value to the existing value . Value will be appended if a RuleValueList exists of the given type . Otherwise the existing value will be wrapped by one . |
28,968 | public static function get_autologin_key ( ) { global $ USER ; delete_user_key ( 'tool_mobile' , $ USER -> id ) ; $ iprestriction = getremoteaddr ( ) ; $ validuntil = time ( ) + self :: LOGIN_KEY_TTL ; return create_user_key ( 'tool_mobile' , $ USER -> id , null , $ iprestriction , $ validuntil ) ; } | Creates an auto - login key for the current user this key is restricted by time and ip address . |
28,969 | public static function get_potential_config_issues ( ) { global $ CFG ; require_once ( $ CFG -> dirroot . "/lib/filelib.php" ) ; require_once ( $ CFG -> dirroot . '/message/lib.php' ) ; $ warnings = array ( ) ; $ curl = new curl ( ) ; $ curl -> setopt ( array ( 'CURLOPT_CERTINFO' => 1 , 'CURLOPT_SSL_VERIFYPEER' => true... | This function check the current site for potential configuration issues that may prevent the mobile app to work . |
28,970 | public function html ( ) { $ attributes = array ( 'type' => 'checkbox' , 'name' => $ this -> name , 'value' => 1 , 'id' => $ this -> name ) ; if ( $ this -> locked ) { $ attributes [ 'disabled' ] = 'DISABLED' ; } $ hidden = array ( 'type' => 'hidden' , 'name' => 'old' . $ this -> name ) ; if ( $ this -> ischecked ) { $... | Generate the HTML |
28,971 | protected function need_restore_numsections ( ) { $ backupinfo = $ this -> step -> get_task ( ) -> get_info ( ) ; $ backuprelease = $ backupinfo -> backup_release ; return version_compare ( $ backuprelease , '3.3' , 'lt' ) ; } | Checks if backup file was made on Moodle before 3 . 3 and we should respect the numsections and potential orphaned sections in the end of the course . |
28,972 | public function user_login ( $ username , $ password ) { $ cached = $ this -> get_static_user_info ( ) ; if ( empty ( $ cached ) ) { return false ; } $ verifyusername = $ cached [ 'username' ] ; if ( $ verifyusername == $ username ) { return true ; } return false ; } | Returns true if the username and password work or don t exist and false if the user exists and the password is wrong . |
28,973 | public function get_userinfo ( $ username ) { $ cached = $ this -> get_static_user_info ( ) ; if ( ! empty ( $ cached ) && $ cached [ 'username' ] == $ username ) { return $ cached ; } return false ; } | Return the userinfo from the oauth handshake . Will only be valid for the logged in user . |
28,974 | private function is_ready_for_login_page ( \ core \ oauth2 \ issuer $ issuer ) { return $ issuer -> get ( 'enabled' ) && $ issuer -> is_configured ( ) && ! empty ( $ issuer -> get ( 'showonloginpage' ) ) ; } | Do some checks on the identity provider before showing it on the login page . |
28,975 | private function update_picture ( $ user ) { global $ CFG , $ DB , $ USER ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; require_once ( $ CFG -> libdir . '/gdlib.php' ) ; require_once ( $ CFG -> dirroot . '/user/lib.php' ) ; $ fs = get_file_storage ( ) ; $ userid = $ user -> id ; if ( ! empty ( $ user -> picture... | If this user has no picture - but we got one from oauth - set it . |
28,976 | private function update_user ( array $ externaldata , $ userdata ) { $ user = ( object ) [ 'id' => $ userdata -> id , ] ; if ( $ userdata -> auth !== $ this -> authtype ) { return $ userdata ; } foreach ( $ externaldata as $ fieldname => $ value ) { if ( ! in_array ( $ fieldname , $ this -> userfields ) ) { continue ; ... | Update user data according to data sent by authorization server . |
28,977 | public function print_confirm_required ( $ title , $ message ) { global $ PAGE , $ OUTPUT , $ CFG ; $ PAGE -> navbar -> add ( $ title ) ; $ PAGE -> set_title ( $ title ) ; $ PAGE -> set_heading ( $ PAGE -> course -> fullname ) ; echo $ OUTPUT -> header ( ) ; notice ( $ message , "$CFG->wwwroot/index.php" ) ; } | Print a page showing that a confirm email was sent with instructions . |
28,978 | protected function parseCookieHeader ( $ line , $ defaultDomain ) { if ( ! $ defaultDomain ) { throw new CAS_InvalidArgumentException ( '$defaultDomain was not provided.' ) ; } $ cookie = array ( 'domain' => $ defaultDomain , 'path' => '/' , 'secure' => false , ) ; $ line = preg_replace ( '/^Set-Cookie2?: /i' , '' , tr... | Parse a single cookie header line . |
28,979 | protected function discardCookie ( $ cookie ) { if ( ! isset ( $ cookie [ 'domain' ] ) || ! isset ( $ cookie [ 'path' ] ) || ! isset ( $ cookie [ 'path' ] ) ) { throw new CAS_InvalidArgumentException ( 'Invalid Cookie array passed.' ) ; } foreach ( $ this -> _cookies as $ key => $ old_cookie ) { if ( $ cookie [ 'domain... | Discard an existing cookie |
28,980 | protected function expireCookies ( ) { foreach ( $ this -> _cookies as $ key => $ cookie ) { if ( isset ( $ cookie [ 'expires' ] ) && $ cookie [ 'expires' ] < time ( ) ) { unset ( $ this -> _cookies [ $ key ] ) ; } } } | Go through our stored cookies and remove any that are expired . |
28,981 | protected function cookieMatchesTarget ( $ cookie , $ target ) { if ( ! is_array ( $ target ) ) { throw new CAS_InvalidArgumentException ( '$target must be an array of URL attributes as generated by parse_url().' ) ; } if ( ! isset ( $ target [ 'host' ] ) ) { throw new CAS_InvalidArgumentException ( '$target must be an... | Answer true if cookie is applicable to a target . |
28,982 | protected static function delete_user_evidence_of_prior_learning ( $ userid ) { global $ DB ; $ usercontext = context_user :: instance ( $ userid ) ; $ ueids = $ DB -> get_fieldset_select ( user_evidence :: TABLE , 'id' , 'userid = :userid' , [ 'userid' => $ userid ] ) ; if ( empty ( $ ueids ) ) { return ; } list ( $ i... | Delete evidence of prior learning . |
28,983 | protected static function delete_user_plans ( $ userid ) { global $ DB ; $ usercontext = context_user :: instance ( $ userid ) ; \ core_comment \ privacy \ provider :: delete_comments_for_all_users ( $ usercontext , 'competency' , 'plan' ) ; $ planids = $ DB -> get_fieldset_select ( plan :: TABLE , 'id' , 'userid = :us... | User plans . |
28,984 | protected static function delete_user_competencies ( $ userid ) { global $ DB ; $ usercontext = context_user :: instance ( $ userid ) ; \ core_comment \ privacy \ provider :: delete_comments_for_all_users ( $ usercontext , 'competency' , 'user_competency' ) ; $ ucids = $ DB -> get_fieldset_select ( user_competency :: T... | Delete user competency data . |
28,985 | protected static function export_user_data_in_user_contexts ( $ userid , array $ contexts ) { global $ DB ; $ mycontext = context_user :: instance ( $ userid ) ; $ contextids = array_map ( function ( $ context ) { return $ context -> id ; } , $ contexts ) ; $ exportowncontext = in_array ( $ mycontext -> id , $ contexti... | Export the user data in user context . |
28,986 | protected static function export_user_data_in_system_context ( $ userid ) { static :: export_user_data_frameworks_in_context ( $ userid , context_system :: instance ( ) ) ; static :: export_user_data_templates_in_context ( $ userid , context_system :: instance ( ) ) ; } | Export the user data in systen context . |
28,987 | protected static function export_user_data_in_category_contexts ( $ userid , array $ contexts ) { $ contexts = array_filter ( $ contexts , function ( $ context ) { return $ context -> contextlevel == CONTEXT_COURSECAT ; } ) ; if ( empty ( $ contexts ) ) { return ; } foreach ( $ contexts as $ context ) { static :: expor... | Export the user data in category contexts . |
28,988 | protected static function export_user_data_in_course_contexts_rated_by_me ( $ userid , $ courseids , $ path , performance_helper $ helper ) { global $ DB ; $ ffields = competency_framework :: get_sql_fields ( 'f' , 'f_' ) ; $ compfields = competency :: get_sql_fields ( 'c' , 'c_' ) ; $ uccfields = user_competency_cours... | Export the ratings given in a course . |
28,989 | protected static function export_user_data_in_course_contexts_associations ( $ userid , $ courseids , $ path ) { global $ DB ; $ compfields = competency :: get_sql_fields ( 'c' , 'c_' ) ; $ ccfields = course_competency :: get_sql_fields ( 'cc' , 'cc_' ) ; $ ctxfields = context_helper :: get_preload_record_columns_sql (... | Export user data in course contexts related to linked competencies . |
28,990 | protected static function export_user_data_in_course_contexts_settings ( $ userid , $ courseids , $ path ) { global $ DB ; $ ccsfields = course_competency_settings :: get_sql_fields ( 'ccs' , 'ccs_' ) ; list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ courseids , SQL_PARAMS_NAMED ) ; $ sql = " SEL... | Export user data in course contexts related to course settings . |
28,991 | protected static function export_user_data_in_module_contexts ( $ userid , array $ contexts ) { global $ DB ; $ contexts = array_filter ( $ contexts , function ( $ context ) { return $ context -> contextlevel == CONTEXT_MODULE ; } ) ; if ( empty ( $ contexts ) ) { return ; } $ path = [ get_string ( 'competencies' , 'co... | Export the user data in module contexts . |
28,992 | protected static function export_user_data_competencies ( context_user $ context ) { global $ DB ; $ userid = $ context -> instanceid ; $ path = [ get_string ( 'competencies' , 'core_competency' ) , get_string ( 'competencies' , 'core_competency' ) ] ; $ helper = new performance_helper ( ) ; $ cfields = competency :: g... | Export a user s competencies . |
28,993 | protected static function export_user_data_user_evidence ( context_user $ context ) { global $ DB ; $ userid = $ context -> instanceid ; $ path = [ get_string ( 'competencies' , 'core_competency' ) , get_string ( 'privacy:path:userevidence' , 'core_competency' ) ] ; $ uefields = user_evidence :: get_sql_fields ( 'ue' ,... | Export the evidence of prior learning of a user . |
28,994 | protected static function transform_competency_brief ( competency $ competency ) { global $ OUTPUT ; $ exporter = new \ core_competency \ external \ competency_exporter ( $ competency , [ 'context' => $ competency -> get_context ( ) ] ) ; $ data = $ exporter -> export ( $ OUTPUT ) ; return [ 'idnumber' => $ data -> idn... | Transform a competency into a brief description . |
28,995 | protected static function transform_competency_grade ( competency $ competency , $ grade , performance_helper $ helper ) { if ( $ grade === null ) { return '-' ; } $ scale = $ helper -> get_scale_from_competency ( $ competency ) ; return $ scale -> scale_items [ $ grade - 1 ] ; } | Transform a competency rating . |
28,996 | protected static function transform_evidence ( $ userid , evidence $ evidence , competency $ competency , performance_helper $ helper ) { $ action = $ evidence -> get ( 'action' ) ; $ actiontxt = '?' ; if ( $ action == evidence :: ACTION_LOG ) { $ actiontxt = get_string ( 'privacy:evidence:action:log' , 'core_competenc... | Transform an evidence . |
28,997 | protected static function transform_framework_brief ( competency_framework $ framework ) { global $ OUTPUT ; $ exporter = new \ core_competency \ external \ competency_framework_exporter ( $ framework ) ; $ data = $ exporter -> export ( $ OUTPUT ) ; return [ 'name' => $ data -> shortname , 'idnumber' => $ data -> idnum... | Transform a framework into a brief description . |
28,998 | protected static function transform_template_brief ( template $ template ) { global $ OUTPUT ; $ exporter = new \ core_competency \ external \ template_exporter ( $ template ) ; $ data = $ exporter -> export ( $ OUTPUT ) ; return [ 'name' => $ data -> shortname , 'description' => $ data -> description ] ; } | Transform a template into a brief description . |
28,999 | protected static function transform_user_competency ( $ userid , $ uc , competency $ competency , performance_helper $ helper ) { $ data = [ 'proficient' => static :: transform_proficiency ( $ uc -> get ( 'proficiency' ) ) , 'rating' => static :: transform_competency_grade ( $ competency , $ uc -> get ( 'grade' ) , $ h... | Transform user competency . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.