idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
27,000 | public function get_aggregation_method ( $ criteriatype = null ) { $ params = array ( 'course' => $ this -> course_id , 'criteriatype' => $ criteriatype ) ; $ aggregation = new completion_aggregation ( $ params ) ; if ( ! $ aggregation -> id ) { $ aggregation -> method = COMPLETION_AGGREGATION_ALL ; } return $ aggregat... | Get aggregation method |
27,001 | public function clear_criteria ( ) { global $ DB ; $ DB -> delete_records ( 'course_completion_criteria' , array ( 'course' => $ this -> course_id ) ) ; $ DB -> delete_records ( 'course_completion_aggr_methd' , array ( 'course' => $ this -> course_id ) ) ; $ this -> delete_course_completion_data ( ) ; } | Clear old course completion criteria |
27,002 | public function is_course_complete ( $ user_id ) { $ params = array ( 'userid' => $ user_id , 'course' => $ this -> course_id ) ; $ ccompletion = new completion_completion ( $ params ) ; return $ ccompletion -> is_complete ( ) ; } | Has the supplied user completed this course |
27,003 | public function internal_get_state ( $ cm , $ userid , $ current ) { global $ USER , $ DB , $ CFG ; if ( ! $ userid ) { $ userid = $ USER -> id ; } if ( $ cm -> completionview == COMPLETION_VIEW_REQUIRED && $ current -> viewed == COMPLETION_NOT_VIEWED ) { return COMPLETION_INCOMPLETE ; } if ( ! isset ( $ cm -> modname ... | Calculates the completion state for an activity and user . |
27,004 | public function set_module_viewed ( $ cm , $ userid = 0 ) { global $ PAGE ; if ( $ PAGE -> headerprinted ) { debugging ( 'set_module_viewed must be called before header is printed' , DEBUG_DEVELOPER ) ; } if ( $ cm -> completionview == COMPLETION_VIEW_NOT_REQUIRED || ! $ this -> is_enabled ( $ cm ) ) { return ; } $ dat... | Marks a module as viewed . |
27,005 | public function count_course_user_data ( $ user_id = null ) { global $ DB ; $ sql = ' SELECT COUNT(1) FROM {course_completion_crit_compl} WHERE course = ? ' ; $ params = array ( $ this -> course_id ) ; if ( $ user_id ) { $ sql .= ' AND userid = ?' ; $ params [ ] = $ user_id ; } retu... | Determines how much course completion data exists for a course . This is used when deciding whether completion information should be locked in the completion settings form and activity completion settings . |
27,006 | public function delete_course_completion_data ( ) { global $ DB ; $ DB -> delete_records ( 'course_completions' , array ( 'course' => $ this -> course_id ) ) ; $ DB -> delete_records ( 'course_completion_crit_compl' , array ( 'course' => $ this -> course_id ) ) ; cache :: make ( 'core' , 'completion' ) -> purge ( ) ; c... | Deletes all course completion completion data . |
27,007 | public function delete_all_state ( $ cm ) { global $ DB ; $ DB -> delete_records ( 'course_modules_completion' , array ( 'coursemoduleid' => $ cm -> id ) ) ; $ criteria = $ this -> get_criteria ( COMPLETION_CRITERIA_TYPE_ACTIVITY ) ; $ acriteria = false ; foreach ( $ criteria as $ criterion ) { if ( $ criterion -> modu... | Deletes completion state related to an activity for all users . |
27,008 | public function reset_all_state ( $ cm ) { global $ DB ; if ( $ cm -> completion == COMPLETION_TRACKING_MANUAL ) { $ this -> delete_all_state ( $ cm ) ; return ; } $ rs = $ DB -> get_recordset ( 'course_modules_completion' , array ( 'coursemoduleid' => $ cm -> id ) , '' , 'userid' ) ; $ keepusers = array ( ) ; foreach ... | Recalculates completion state related to an activity for all users . |
27,009 | public function has_activities ( ) { $ modinfo = get_fast_modinfo ( $ this -> course ) ; foreach ( $ modinfo -> get_cms ( ) as $ cm ) { if ( $ cm -> completion != COMPLETION_TRACKING_NONE ) { return true ; } } return false ; } | Return whether or not the course has activities with completion enabled . |
27,010 | public function get_activities ( ) { $ modinfo = get_fast_modinfo ( $ this -> course ) ; $ result = array ( ) ; foreach ( $ modinfo -> get_cms ( ) as $ cm ) { if ( $ cm -> completion != COMPLETION_TRACKING_NONE && ! $ cm -> deletioninprogress ) { $ result [ $ cm -> id ] = $ cm ; } } return $ result ; } | Obtains a list of activities for which completion is enabled on the course . The list is ordered by the section order of those activities . |
27,011 | public function is_tracked_user ( $ userid ) { return is_enrolled ( context_course :: instance ( $ this -> course -> id ) , $ userid , 'moodle/course:isincompletionreports' , true ) ; } | Checks to see if the userid supplied has a tracked role in this course |
27,012 | public function get_num_tracked_users ( $ where = '' , $ whereparams = array ( ) , $ groupid = 0 ) { global $ DB ; list ( $ enrolledsql , $ enrolledparams ) = get_enrolled_sql ( context_course :: instance ( $ this -> course -> id ) , 'moodle/course:isincompletionreports' , $ groupid , true ) ; $ sql = 'SELECT COUNT(eu.... | Returns the number of users whose progress is tracked in this course . |
27,013 | public function get_tracked_users ( $ where = '' , $ whereparams = array ( ) , $ groupid = 0 , $ sort = '' , $ limitfrom = '' , $ limitnum = '' , context $ extracontext = null ) { global $ DB ; list ( $ enrolledsql , $ params ) = get_enrolled_sql ( context_course :: instance ( $ this -> course -> id ) , 'moodle/course:... | Return array of users whose progress is tracked in this course . |
27,014 | public function get_progress_all ( $ where = '' , $ where_params = array ( ) , $ groupid = 0 , $ sort = '' , $ pagesize = '' , $ start = '' , context $ extracontext = null ) { global $ CFG , $ DB ; $ users = $ this -> get_tracked_users ( $ where , $ where_params , $ groupid , $ sort , $ start , $ pagesize , $ extracont... | Obtains progress information across a course for all users on that course or for all users in a specific group . Intended for use when displaying progress . |
27,015 | public function inform_grade_changed ( $ cm , $ item , $ grade , $ deleted ) { if ( ! $ this -> is_enabled ( $ cm ) || $ cm -> completion == COMPLETION_TRACKING_MANUAL || is_null ( $ cm -> completiongradeitemnumber ) || $ item -> itemnumber != $ cm -> completiongradeitemnumber ) { return ; } if ( $ deleted ) { $ possib... | Called by grade code to inform the completion system when a grade has been changed . If the changed grade is used to determine completion for the course - module then the completion status will be updated . |
27,016 | public static function member_added ( \ core \ event \ cohort_member_added $ event ) { global $ DB , $ CFG ; require_once ( "$CFG->dirroot/group/lib.php" ) ; if ( ! enrol_is_enabled ( 'cohort' ) ) { return true ; } $ sql = "SELECT e.*, r.id as roleexists FROM {enrol} e LEFT JOIN {role} r ON... | Event processor - cohort member added . |
27,017 | public static function member_removed ( \ core \ event \ cohort_member_removed $ event ) { global $ DB ; if ( ! $ instances = $ DB -> get_records ( 'enrol' , array ( 'customint1' => $ event -> objectid , 'enrol' => 'cohort' ) , 'id ASC' ) ) { return true ; } $ plugin = enrol_get_plugin ( 'cohort' ) ; $ unenrolaction = ... | Event processor - cohort member removed . |
27,018 | public static function deleted ( \ core \ event \ cohort_deleted $ event ) { global $ DB ; if ( ! $ instances = $ DB -> get_records ( 'enrol' , array ( 'customint1' => $ event -> objectid , 'enrol' => 'cohort' ) , 'id ASC' ) ) { return true ; } $ plugin = enrol_get_plugin ( 'cohort' ) ; $ unenrolaction = $ plugin -> ge... | Event processor - cohort deleted . |
27,019 | protected function define_workshop_subplugin_structure ( ) { $ subplugin = $ this -> get_subplugin_element ( ) ; $ subplugin_wrapper = new backup_nested_element ( $ this -> get_recommended_name ( ) ) ; $ subplugin_table_settings = new backup_nested_element ( 'workshopeval_best_settings' , null , array ( 'comparison' ) ... | Returns the subplugin information to attach to workshop element |
27,020 | public function transform ( $ args , Mustache_LambdaHelper $ helper ) { list ( $ timestamp , $ format ) = explode ( ',' , $ args , 2 ) ; $ timestamp = trim ( $ timestamp ) ; $ format = trim ( $ format ) ; $ timestamp = $ helper -> render ( $ timestamp ) ; $ format = $ helper -> render ( $ format ) ; return userdate ( $... | Read a timestamp and format from the string . |
27,021 | public static function byId ( $ id , $ namespace ) { $ json = \ MongoDB \ BSON \ toJSON ( \ MongoDB \ BSON \ fromPHP ( [ '_id' => $ id ] ) ) ; return new static ( sprintf ( 'File "%s" not found in "%s"' , $ json , $ namespace ) ) ; } | Thrown when a file cannot be found by its ID . |
27,022 | public function col_manage ( \ tool_monitor \ rule $ rule ) { global $ OUTPUT , $ CFG ; $ manage = '' ; if ( $ this -> hassystemcap || ( $ rule -> courseid != 0 ) ) { $ editurl = new \ moodle_url ( $ CFG -> wwwroot . '/admin/tool/monitor/edit.php' , array ( 'ruleid' => $ rule -> id , 'courseid' => $ rule -> courseid , ... | Generate content for manage column . |
27,023 | function set_wwwroot ( $ wwwroot ) { global $ CFG , $ DB ; $ hostinfo = $ DB -> get_record ( 'mnet_host' , array ( 'wwwroot' => $ wwwroot ) ) ; if ( $ hostinfo != false ) { $ this -> populate ( $ hostinfo ) ; return true ; } return false ; } | Load information from db about an mnet peer into this object s properties |
27,024 | function populate ( $ hostinfo ) { global $ DB ; $ this -> id = $ hostinfo -> id ; $ this -> wwwroot = $ hostinfo -> wwwroot ; $ this -> ip_address = $ hostinfo -> ip_address ; $ this -> name = $ hostinfo -> name ; $ this -> deleted = $ hostinfo -> deleted ; $ this -> public_key = $ hostinfo -> public_key ; $ this -> p... | Several methods can be used to get an mnet_host record . They all then send it to this private method to populate this object s attributes . |
27,025 | static public function define_decode_rules ( ) { $ rules = array ( ) ; $ rules [ ] = new restore_decode_rule ( 'LESSONEDIT' , '/mod/lesson/edit.php?id=$1' , 'course_module' ) ; $ rules [ ] = new restore_decode_rule ( 'LESSONESAY' , '/mod/lesson/essay.php?id=$1' , 'course_module' ) ; $ rules [ ] = new restore_decode_rul... | Define the decoding rules for links belonging to the activity to be executed by the link decoder |
27,026 | public function get_all_samples ( \ core_analytics \ analysable $ course ) { $ enrolments = enrol_get_course_users ( $ course -> get_id ( ) ) ; $ studentids = $ course -> get_students ( ) ; $ samplesdata = array ( ) ; foreach ( $ enrolments as $ userenrolmentid => $ user ) { if ( empty ( $ studentids [ $ user -> id ] )... | All course student enrolments . |
27,027 | public function get_samples ( $ sampleids ) { global $ DB ; $ enrolments = enrol_get_course_users ( false , false , array ( ) , $ sampleids ) ; list ( $ enrolsql , $ params ) = $ DB -> get_in_or_equal ( $ sampleids , SQL_PARAMS_NAMED ) ; $ samplesdata = array ( ) ; foreach ( $ enrolments as $ userenrolmentid => $ user ... | Returns all samples from the samples ids . |
27,028 | protected function get_sample_courseid ( $ sampleid ) { global $ DB ; if ( empty ( $ this -> samplecourses [ $ sampleid ] ) ) { $ course = enrol_get_course_by_user_enrolment_id ( $ sampleid ) ; $ this -> samplecourses [ $ sampleid ] = $ course -> id ; } return $ this -> samplecourses [ $ sampleid ] ; } | Returns the student enrolment course id . |
27,029 | public function batchUpdate ( $ id , Google_Service_MapsEngine_PermissionsBatchUpdateRequest $ postBody , $ optParams = array ( ) ) { $ params = array ( 'id' => $ id , 'postBody' => $ postBody ) ; $ params = array_merge ( $ params , $ optParams ) ; return $ this -> call ( 'batchUpdate' , array ( $ params ) , "Google_Se... | Add or update permission entries to an already existing asset . |
27,030 | public function batchInsert ( $ id , Google_Service_MapsEngine_FeaturesBatchInsertRequest $ postBody , $ optParams = array ( ) ) { $ params = array ( 'id' => $ id , 'postBody' => $ postBody ) ; $ params = array_merge ( $ params , $ optParams ) ; return $ this -> call ( 'batchInsert' , array ( $ params ) ) ; } | Append features to an existing table . |
27,031 | public function batchPatch ( $ id , Google_Service_MapsEngine_FeaturesBatchPatchRequest $ postBody , $ optParams = array ( ) ) { $ params = array ( 'id' => $ id , 'postBody' => $ postBody ) ; $ params = array_merge ( $ params , $ optParams ) ; return $ this -> call ( 'batchPatch' , array ( $ params ) ) ; } | Update the supplied features . |
27,032 | public static function create_from_tag_instance ( $ taginstance , $ tagname , $ tagrawname , $ addsnapshot = false ) { $ event = self :: create ( array ( 'objectid' => $ taginstance -> id , 'contextid' => $ taginstance -> contextid , 'other' => array ( 'tagid' => $ taginstance -> tagid , 'tagname' => $ tagname , 'tagra... | Creates an event from taginstance object |
27,033 | protected final function action_menu ( $ elementname , $ exported , $ persistent ) { $ elementname = clean_param ( $ elementname , PARAM_ALPHA ) ; $ actionmenu = new \ action_menu ( ) ; $ actionmenu -> set_menu_trigger ( get_string ( 'actions' ) ) ; $ actionmenu -> set_owner_selector ( $ elementname . '-' . $ exported ... | Adds an action menu for the provided element |
27,034 | public static function get_messages ( $ userid , $ otheruserid , $ timedeleted = 0 , $ limitfrom = 0 , $ limitnum = 0 , $ sort = 'timecreated ASC' , $ timefrom = 0 , $ timeto = 0 ) { global $ DB ; $ hash = self :: get_conversation_hash ( [ $ userid , $ otheruserid ] ) ; $ sql = "SELECT m.id, m.useridfrom, m.subject, m.... | Helper function to retrieve the messages between two users |
27,035 | public static function get_conversation_messages ( int $ userid , int $ convid , int $ timedeleted = 0 , int $ limitfrom = 0 , int $ limitnum = 0 , string $ sort = 'timecreated ASC' , int $ timefrom = 0 , int $ timeto = 0 ) : array { global $ DB ; $ sql = "SELECT m.id, m.useridfrom, m.subject, m.fullmessage, m.fullmess... | Helper function to retrieve conversation messages . |
27,036 | public static function create_messages ( $ userid , $ messages ) { $ arrmessages = array ( ) ; $ lastmessage = end ( $ messages ) ; $ firstmessage = reset ( $ messages ) ; if ( $ lastmessage -> timecreated < $ firstmessage -> timecreated ) { $ messages = array_reverse ( $ messages ) ; } $ day = '' ; $ month = '' ; $ ye... | Helper function to return an array of messages . |
27,037 | public static function create_contact ( $ contact , $ prefix = '' ) { global $ PAGE ; $ userfields = \ user_picture :: unalias ( $ contact , array ( 'lastaccess' ) , $ prefix . 'id' , $ prefix ) ; $ data = new \ stdClass ( ) ; $ data -> userid = $ userfields -> id ; $ data -> useridfrom = null ; $ data -> fullname = fu... | Helper function for creating a contact object . |
27,038 | public static function show_online_status ( $ user ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/user/lib.php' ) ; if ( $ lastaccess = user_get_user_details ( $ user , null , array ( 'lastaccess' ) ) ) { if ( isset ( $ lastaccess [ 'lastaccess' ] ) ) { return true ; } } return false ; } | Helper function for checking if we should show the user s online status . |
27,039 | public static function is_online ( $ lastaccess ) { global $ CFG ; $ timetoshowusers = 300 ; if ( isset ( $ CFG -> block_online_users_timetosee ) ) { $ timetoshowusers = $ CFG -> block_online_users_timetosee * 60 ; } $ time = time ( ) - $ timetoshowusers ; return $ lastaccess >= $ time ; } | Helper function for checking the time meets the online condition . |
27,040 | public static function get_providers_preferences ( $ providers , $ userid ) { $ preferences = new \ stdClass ( ) ; foreach ( $ providers as $ provider ) { foreach ( array ( 'loggedin' , 'loggedoff' ) as $ state ) { $ linepref = get_user_preferences ( 'message_provider_' . $ provider -> component . '_' . $ provider -> n... | Get providers preferences . |
27,041 | public static function togglecontact_requirejs ( ) { global $ PAGE ; static $ done = false ; if ( $ done ) { return ; } $ PAGE -> requires -> js_call_amd ( 'core_message/toggle_contact_button' , 'enhance' , array ( '#toggle-contact-button' ) ) ; $ done = true ; } | Requires the JS libraries for the toggle contact button . |
27,042 | public static function messageuser_requirejs ( ) { global $ PAGE ; static $ done = false ; if ( $ done ) { return ; } $ PAGE -> requires -> js_call_amd ( 'core_message/message_user_button' , 'send' , array ( '#message-user-button' ) ) ; $ done = true ; } | Requires the JS libraries for the message user button . |
27,043 | public static function messageuser_link_params ( int $ useridto ) : array { global $ USER ; return [ 'id' => 'message-user-button' , 'role' => 'button' , 'data-conversationid' => api :: get_conversation_between_users ( [ $ USER -> id , $ useridto ] ) , 'data-userid' => $ useridto , ] ; } | Returns the attributes to place on the message user button . |
27,044 | public static function legacy_messages_exist ( $ userid ) { global $ DB ; $ sql = "SELECT id FROM {message} m WHERE useridfrom = ? OR useridto = ?" ; $ messageexists = $ DB -> record_exists_sql ( $ sql , [ $ userid , $ userid ] ) ; $ sql = "SELECT id ... | Checks if legacy messages exist for a given user . |
27,045 | public static function render_messaging_widget ( bool $ isdrawer , int $ sendtouser = null , int $ conversationid = null ) { global $ USER , $ CFG , $ PAGE ; if ( empty ( $ CFG -> messaging ) || ! isloggedin ( ) || isguestuser ( ) || user_not_fully_set_up ( $ USER ) || get_user_preferences ( 'auth_forcepasswordchange' ... | Renders the messaging widget . |
27,046 | public static function search_get_user_details ( \ stdClass $ user ) : array { global $ CFG , $ USER ; require_once ( $ CFG -> dirroot . '/user/lib.php' ) ; if ( $ CFG -> messagingallusers || $ user -> id == $ USER -> id ) { return \ user_get_user_details_courses ( $ user ) ?? [ ] ; } else { $ sharedcourses = enrol_get... | Returns user details for a user if they are visible to the current user in the message search . |
27,047 | public function set_attributes ( $ type , $ fields , $ reftable = null , $ reffields = null ) { $ this -> type = $ type ; $ this -> fields = $ fields ; $ this -> reftable = $ reftable ; $ this -> reffields = empty ( $ reffields ) ? array ( ) : $ reffields ; } | Set all the attributes of one xmldb_key |
27,048 | public function getXMLDBKeyType ( $ type ) { $ result = XMLDB_KEY_INCORRECT ; switch ( strtolower ( $ type ) ) { case 'primary' : $ result = XMLDB_KEY_PRIMARY ; break ; case 'unique' : $ result = XMLDB_KEY_UNIQUE ; break ; case 'foreign' : $ result = XMLDB_KEY_FOREIGN ; break ; case 'foreign-unique' : $ result = XMLDB_... | This function returns the correct XMLDB_KEY_XXX value for the string passed as argument |
27,049 | public function getXMLDBKeyName ( $ type ) { $ result = '' ; switch ( $ type ) { case XMLDB_KEY_PRIMARY : $ result = 'primary' ; break ; case XMLDB_KEY_UNIQUE : $ result = 'unique' ; break ; case XMLDB_KEY_FOREIGN : $ result = 'foreign' ; break ; case XMLDB_KEY_FOREIGN_UNIQUE : $ result = 'foreign-unique' ; break ; } r... | This function returns the correct name value for the XMLDB_KEY_XXX passed as argument |
27,050 | public function calculateHash ( $ recursive = false ) { if ( ! $ this -> loaded ) { $ this -> hash = null ; } else { $ key = $ this -> type . implode ( ', ' , $ this -> fields ) ; if ( $ this -> type == XMLDB_KEY_FOREIGN || $ this -> type == XMLDB_KEY_FOREIGN_UNIQUE ) { $ key .= $ this -> reftable . implode ( ', ' , $ ... | This function calculate and set the hash of one xmldb_key |
27,051 | public function xmlOutput ( ) { $ o = '' ; $ o .= ' <KEY NAME="' . $ this -> name . '"' ; $ o .= ' TYPE="' . $ this -> getXMLDBKeyName ( $ this -> type ) . '"' ; $ o .= ' FIELDS="' . implode ( ', ' , $ this -> fields ) . '"' ; if ( $ this -> type == XMLDB_KEY_FOREIGN || $ this -> type == XMLDB_KEY_FOREIGN_UNIQUE... | This function will output the XML text for one key |
27,052 | public function setFromADOKey ( $ adokey ) { switch ( strtolower ( $ adokey [ 'name' ] ) ) { case 'primary' : $ this -> type = XMLDB_KEY_PRIMARY ; break ; default : $ this -> type = XMLDB_KEY_UNIQUE ; } $ fields = array_flip ( array_change_key_case ( array_flip ( $ adokey [ 'columns' ] ) ) ) ; $ this -> fields = $ fiel... | This function will set all the attributes of the xmldb_key object based on information passed in one ADOkey |
27,053 | public function getPHP ( ) { $ result = '' ; switch ( $ this -> getType ( ) ) { case XMLDB_KEY_PRIMARY : $ result .= 'XMLDB_KEY_PRIMARY' . ', ' ; break ; case XMLDB_KEY_UNIQUE : $ result .= 'XMLDB_KEY_UNIQUE' . ', ' ; break ; case XMLDB_KEY_FOREIGN : $ result .= 'XMLDB_KEY_FOREIGN' . ', ' ; break ; case XMLDB_KEY_FOREI... | Returns the PHP code needed to define one xmldb_key |
27,054 | protected function _getRealOffset ( $ offset ) { if ( parent :: offsetExists ( $ offset ) ) { return $ offset ; } foreach ( array_keys ( $ this -> getArrayCopy ( ) ) as $ key ) { if ( strcasecmp ( $ key , $ offset ) === 0 ) { return $ key ; } } return null ; } | Determines the actual array offset given the input offset . |
27,055 | static public function encode_content_links ( $ content ) { global $ CFG ; $ base = preg_quote ( $ CFG -> wwwroot . '/mod/lesson' , '#' ) ; $ pattern = '#' . $ base . '/edit\.php\?id=([0-9]+)#' ; $ replacement = '$@LESSONEDIT*$1@$' ; $ content = preg_replace ( $ pattern , $ replacement , $ content ) ; $ pattern = '#' .... | Encodes URLs to various Lesson scripts |
27,056 | private function get_user ( ) { $ userid = $ this -> backuprec -> userid ; $ user = core_user :: get_user ( $ userid , '*' , MUST_EXIST ) ; return $ user ; } | Given a user id return a user object . |
27,057 | private function lookup_message_variables ( $ matches ) { $ options = array ( 'operation' => $ this -> type , 'backupid' => $ this -> backupid , 'user_username' => $ this -> user -> username , 'user_email' => $ this -> user -> email , 'user_firstname' => $ this -> user -> firstname , 'user_lastname' => $ this -> user -... | Callback for preg_replace_callback . Replaces message placeholders with real values . |
27,058 | private function get_resource_link ( ) { if ( $ this -> backuprec -> type == 'activity' && $ this -> type == 'backup' ) { $ context = context_module :: instance ( $ this -> backuprec -> itemid ) ; } else { $ context = context_course :: instance ( $ this -> backuprec -> itemid ) ; } if ( $ this -> type == 'backup' ) { $... | Get the link to the resource that is being backuped or restored . |
27,059 | public function send_message ( ) { global $ USER ; $ subjectraw = get_config ( 'backup' , 'backup_async_message_subject' ) ; $ subjecttext = preg_replace_callback ( '/\{([-_A-Za-z0-9]+)\}/u' , array ( 'async_helper' , 'lookup_message_variables' ) , $ subjectraw ) ; $ messageraw = get_config ( 'backup' , 'backup_async_m... | Sends a confirmation message for an aynchronous process . |
27,060 | static public function is_async_enabled ( ) { global $ CFG ; $ async = false ; if ( ! empty ( $ CFG -> enableasyncbackup ) ) { $ async = true ; } return $ async ; } | Check if asynchronous backup and restore mode is enabled at system level . |
27,061 | public static function is_async_pending ( $ id , $ type , $ operation ) { global $ DB , $ USER , $ CFG ; $ asyncpending = false ; require_once ( $ CFG -> dirroot . '/backup/util/interfaces/checksumable.class.php' ) ; require_once ( $ CFG -> dirroot . '/backup/backup.class.php' ) ; if ( self :: is_async_enabled ( ) ) { ... | Check if there is a pending async operation for given details . |
27,062 | public static function get_backup_file_info ( $ filename , $ filearea , $ contextid ) { $ fs = get_file_storage ( ) ; $ file = $ fs -> get_file ( $ contextid , 'backup' , $ filearea , 0 , '/' , $ filename ) ; $ filesize = display_size ( $ file -> get_filesize ( ) ) ; $ fileurl = moodle_url :: make_pluginfile_url ( $ fi... | Get the size url and restore url for a backup file . |
27,063 | public static function get_restore_url ( $ backupid ) { global $ DB ; $ backupitemid = $ DB -> get_field ( 'backup_controllers' , 'itemid' , array ( 'backupid' => $ backupid ) , MUST_EXIST ) ; $ newcontext = context_course :: instance ( $ backupitemid ) ; $ restoreurl = $ newcontext -> get_url ( ) -> out ( ) ; $ urlarr... | Get the url of a restored backup item based on the backup ID . |
27,064 | public static function get_async_backups ( $ renderer , $ instanceid ) { global $ DB ; $ tabledata = array ( ) ; $ select = 'itemid = ? AND execution = ? AND status < ? AND status > ?' ; $ params = array ( $ instanceid , backup :: EXECUTION_DELAYED , backup :: STATUS_FINISHED_ERR , backup :: STATUS_NEED_PRECHECK ) ; $ ... | Get markup for in progress async backups to use in backup table UI . |
27,065 | public static function get_restore_name ( \ context $ context ) { global $ DB ; $ instanceid = $ context -> instanceid ; if ( $ context -> contextlevel == CONTEXT_MODULE ) { $ cm = get_coursemodule_from_id ( '' , $ context -> instanceid , 0 , false , MUST_EXIST ) ; $ coursename = $ DB -> get_field ( 'course' , 'fullnam... | Get the course name of the resource being restored . |
27,066 | public static function get_async_restores ( $ userid ) { global $ DB ; $ select = 'userid = ? AND execution = ? AND status < ? AND status > ? AND operation = ?' ; $ params = array ( $ userid , backup :: EXECUTION_DELAYED , backup :: STATUS_FINISHED_ERR , backup :: STATUS_NEED_PRECHECK , 'restore' ) ; $ restores = $ DB ... | Get all the current in progress async restores for a user . |
27,067 | private function cdiv ( $ xr , $ xi , $ yr , $ yi ) { if ( abs ( $ yr ) > abs ( $ yi ) ) { $ r = $ yi / $ yr ; $ d = $ yr + $ r * $ yi ; $ this -> cdivr = ( $ xr + $ r * $ xi ) / $ d ; $ this -> cdivi = ( $ xi - $ r * $ xr ) / $ d ; } else { $ r = $ yr / $ yi ; $ d = $ yi + $ r * $ yr ; $ this -> cdivr = ( $ r * $ xr +... | Performs complex division . |
27,068 | public static function get_available_in_context ( $ contexts ) { $ params = self :: validate_parameters ( self :: get_available_in_context_parameters ( ) , array ( 'contexts' => $ contexts ) ) ; $ filters = $ warnings = array ( ) ; foreach ( $ params [ 'contexts' ] as $ contextinfo ) { try { $ context = self :: get_con... | Returns the filters available in the given contexts . |
27,069 | public function set_installer_instance ( tool_installaddon_installer $ installer ) { if ( is_null ( $ this -> installer ) ) { $ this -> installer = $ installer ; } else { throw new coding_exception ( 'Attempting to reset the installer instance.' ) ; } } | Sets the tool_installaddon_installer instance being used . |
27,070 | public function index_page ( ) { if ( is_null ( $ this -> installer ) ) { throw new coding_exception ( 'Installer instance has not been set.' ) ; } $ permcheckurl = new moodle_url ( '/admin/tool/installaddon/permcheck.php' ) ; $ this -> page -> requires -> yui_module ( 'moodle-tool_installaddon-permcheck' , 'M.tool_ins... | Defines the index page layout |
27,071 | public function remote_request_invalid_page ( moodle_url $ continueurl ) { $ out = $ this -> output -> header ( ) ; $ out .= $ this -> output -> heading ( get_string ( 'installfromrepo' , 'tool_installaddon' ) ) ; $ out .= $ this -> output -> box ( get_string ( 'remoterequestinvalid' , 'tool_installaddon' ) , 'generalb... | Inform the user about invalid remote installation request . |
27,072 | public function remote_request_alreadyinstalled_page ( stdClass $ data , moodle_url $ continueurl ) { $ out = $ this -> output -> header ( ) ; $ out .= $ this -> output -> heading ( get_string ( 'installfromrepo' , 'tool_installaddon' ) ) ; $ out .= $ this -> output -> box ( get_string ( 'remoterequestalreadyinstalled'... | Inform the user that such plugin is already installed |
27,073 | public function remote_request_confirm_page ( stdClass $ data , moodle_url $ continueurl , moodle_url $ cancelurl ) { $ out = $ this -> output -> header ( ) ; $ out .= $ this -> output -> heading ( get_string ( 'installfromrepo' , 'tool_installaddon' ) ) ; $ out .= $ this -> output -> confirm ( get_string ( 'remoterequ... | Let the user confirm the remote installation request . |
27,074 | public function remote_request_permcheck_page ( stdClass $ data , $ plugintypepath , moodle_url $ continueurl , moodle_url $ cancelurl ) { $ data -> typepath = $ plugintypepath ; $ out = $ this -> output -> header ( ) ; $ out .= $ this -> output -> heading ( get_string ( 'installfromrepo' , 'tool_installaddon' ) ) ; $ ... | Inform the user that the target plugin type location is not writable . |
27,075 | protected function index_page_repository ( ) { $ url = $ this -> installer -> get_addons_repository_url ( ) ; $ out = $ this -> box ( $ this -> output -> single_button ( $ url , get_string ( 'installfromrepo' , 'tool_installaddon' ) , 'get' ) . $ this -> output -> help_icon ( 'installfromrepo' , 'tool_installaddon' ) ,... | Renders the widget for browsing the add - on repository |
27,076 | protected function index_page_upload ( ) { $ form = $ this -> installer -> get_installfromzip_form ( ) ; ob_start ( ) ; $ form -> display ( ) ; $ out = ob_get_clean ( ) ; $ out = $ this -> box ( $ out , 'generalbox' , 'installfromzipbox' ) ; return $ out ; } | Renders the widget for uploading the add - on ZIP package |
27,077 | public static function get_course_completion_join_sql ( int $ userid , string $ prefix , string $ joinfield ) : array { $ cccalias = "{$prefix}_ccc" ; $ cmcalias = "{$prefix}_cmc" ; $ ccccalias = "{$prefix}_cccc" ; $ join = "JOIN {course_completion_criteria} {$cccalias} ON {$joinfield} = {$cccalias}.course ... | Get join sql to retrieve courses the user is in . |
27,078 | public static function get_activity_completion_info ( \ stdClass $ user , \ stdClass $ course , $ cm ) : \ stdClass { $ completioninfo = new \ completion_info ( $ course ) ; $ completion = $ completioninfo -> is_enabled ( $ cm ) ; return ( $ completion != COMPLETION_TRACKING_NONE ) ? $ completioninfo -> get_data ( $ cm... | Returns activity completion information about a user . |
27,079 | public static function get_course_completion_info ( \ stdClass $ user , \ stdClass $ course ) : array { $ completioninfo = new \ completion_info ( $ course ) ; $ completion = $ completioninfo -> is_enabled ( ) ; if ( $ completion != COMPLETION_ENABLED ) { return [ ] ; } $ coursecomplete = $ completioninfo -> is_course_... | Returns course completion information for a user . |
27,080 | public static function delete_completion ( \ stdClass $ user = null , int $ courseid = null , int $ cmid = null ) { global $ DB ; if ( isset ( $ cmid ) ) { $ params = ( isset ( $ user ) ) ? [ 'userid' => $ user -> id , 'coursemoduleid' => $ cmid ] : [ 'coursemoduleid' => $ cmid ] ; $ DB -> delete_records ( 'course_modu... | Delete completion information for users . |
27,081 | public static function delete_completion_by_approved_userlist ( approved_userlist $ userlist , int $ courseid = null , int $ cmid = null ) { global $ DB ; $ userids = $ userlist -> get_userids ( ) ; if ( empty ( $ userids ) ) { return ; } list ( $ useridsql , $ params ) = $ DB -> get_in_or_equal ( $ userids , SQL_PARAM... | Delete completion information for users within an approved userlist . |
27,082 | protected function is_linear_whitespace ( ) { return ( bool ) ( $ this -> data [ $ this -> position ] === "\x09" || $ this -> data [ $ this -> position ] === "\x20" || ( $ this -> data [ $ this -> position ] === "\x0A" && isset ( $ this -> data [ $ this -> position + 1 ] ) && ( $ this -> data [ $ this -> position + 1 ]... | See if the next character is LWS |
27,083 | protected function http_version ( ) { if ( strpos ( $ this -> data , "\x0A" ) !== false && strtoupper ( substr ( $ this -> data , 0 , 5 ) ) === 'HTTP/' ) { $ len = strspn ( $ this -> data , '0123456789.' , 5 ) ; $ this -> http_version = substr ( $ this -> data , 5 , $ len ) ; $ this -> position += 5 + $ len ; if ( subs... | Parse the HTTP version |
27,084 | protected function status ( ) { if ( $ len = strspn ( $ this -> data , '0123456789' , $ this -> position ) ) { $ this -> status_code = ( int ) substr ( $ this -> data , $ this -> position , $ len ) ; $ this -> position += $ len ; $ this -> state = 'reason' ; } else { $ this -> state = false ; } } | Parse the status code |
27,085 | protected function reason ( ) { $ len = strcspn ( $ this -> data , "\x0A" , $ this -> position ) ; $ this -> reason = trim ( substr ( $ this -> data , $ this -> position , $ len ) , "\x09\x0D\x20" ) ; $ this -> position += $ len + 1 ; $ this -> state = 'new_line' ; } | Parse the reason phrase |
27,086 | protected function new_line ( ) { $ this -> value = trim ( $ this -> value , "\x0D\x20" ) ; if ( $ this -> name !== '' && $ this -> value !== '' ) { $ this -> name = strtolower ( $ this -> name ) ; if ( isset ( $ this -> headers [ $ this -> name ] ) && $ this -> name !== 'content-type' ) { $ this -> headers [ $ this ->... | Deal with a new line shifting data around as needed |
27,087 | protected function name ( ) { $ len = strcspn ( $ this -> data , "\x0A:" , $ this -> position ) ; if ( isset ( $ this -> data [ $ this -> position + $ len ] ) ) { if ( $ this -> data [ $ this -> position + $ len ] === "\x0A" ) { $ this -> position += $ len ; $ this -> state = 'new_line' ; } else { $ this -> name = subs... | Parse a header name |
27,088 | protected function linear_whitespace ( ) { do { if ( substr ( $ this -> data , $ this -> position , 2 ) === "\x0D\x0A" ) { $ this -> position += 2 ; } elseif ( $ this -> data [ $ this -> position ] === "\x0A" ) { $ this -> position ++ ; } $ this -> position += strspn ( $ this -> data , "\x09\x20" , $ this -> position )... | Parse LWS replacing consecutive LWS characters with a single space |
27,089 | protected function value ( ) { if ( $ this -> is_linear_whitespace ( ) ) { $ this -> linear_whitespace ( ) ; } else { switch ( $ this -> data [ $ this -> position ] ) { case '"' : if ( strtolower ( $ this -> name ) === 'etag' ) { $ this -> value .= '"' ; $ this -> position ++ ; $ this -> state = 'value_char' ; break ; ... | See what state to move to while within non - quoted header values |
27,090 | protected function value_char ( ) { $ len = strcspn ( $ this -> data , "\x09\x20\x0A\"" , $ this -> position ) ; $ this -> value .= substr ( $ this -> data , $ this -> position , $ len ) ; $ this -> position += $ len ; $ this -> state = 'value' ; } | Parse a header value while outside quotes |
27,091 | protected function quote ( ) { if ( $ this -> is_linear_whitespace ( ) ) { $ this -> linear_whitespace ( ) ; } else { switch ( $ this -> data [ $ this -> position ] ) { case '"' : $ this -> position ++ ; $ this -> state = 'value' ; break ; case "\x0A" : $ this -> position ++ ; $ this -> state = 'new_line' ; break ; cas... | See what state to move to while within quoted header values |
27,092 | protected function quote_escaped ( ) { $ this -> value .= $ this -> data [ $ this -> position ] ; $ this -> position ++ ; $ this -> state = 'quote' ; } | Parse an escaped character within quotes |
27,093 | protected function body ( ) { $ this -> body = substr ( $ this -> data , $ this -> position ) ; if ( ! empty ( $ this -> headers [ 'transfer-encoding' ] ) ) { unset ( $ this -> headers [ 'transfer-encoding' ] ) ; $ this -> state = 'chunked' ; } else { $ this -> state = 'emit' ; } } | Parse the body |
27,094 | public function getUpsertedId ( ) { if ( $ this -> isAcknowledged ) { foreach ( $ this -> writeResult -> getUpsertedIds ( ) as $ id ) { return $ id ; } return null ; } throw BadMethodCallException :: unacknowledgedWriteResultAccess ( __METHOD__ ) ; } | Return the ID of the document inserted by an upsert operation . |
27,095 | public static function is_minor ( $ age , $ country ) { global $ CFG ; $ ageconsentmap = $ CFG -> agedigitalconsentmap ; $ agedigitalconsentmap = self :: parse_age_digital_consent_map ( $ ageconsentmap ) ; return array_key_exists ( $ country , $ agedigitalconsentmap ) ? $ age < $ agedigitalconsentmap [ $ country ] : $ ... | Checks if a user is a digital minor . |
27,096 | public static function parse_age_digital_consent_map ( $ ageconsentmap ) { $ ageconsentmapparsed = array ( ) ; $ countries = get_string_manager ( ) -> get_list_of_countries ( true ) ; $ isdefaultvaluepresent = false ; $ lines = preg_split ( '/\r|\n/' , $ ageconsentmap , - 1 , PREG_SPLIT_NO_EMPTY ) ; foreach ( $ lines a... | Parse the agedigitalconsentmap setting into an array . |
27,097 | public function col_operation ( $ data ) { $ tokenpageurl = new \ moodle_url ( "/admin/webservice/tokens.php" , [ "sesskey" => sesskey ( ) , "action" => "delete" , "tokenid" => $ data -> id ] ) ; return \ html_writer :: link ( $ tokenpageurl , get_string ( "delete" ) ) ; } | Generate the operation column . |
27,098 | public function col_creatorlastname ( $ data ) { $ user = [ ] ; foreach ( $ data as $ key => $ value ) { if ( strpos ( $ key , 'creator' ) !== false ) { $ newkey = str_replace ( 'creator' , '' , $ key ) ; $ user [ $ newkey ] = $ value ; } } $ creatorprofileurl = new \ moodle_url ( '/user/profile.php' , [ 'id' => $ data... | Generate the creator column . |
27,099 | public function get_endpoint ( ) { $ this -> parse_template ( ) ; $ url = $ this -> get_service ( ) -> get_service_path ( ) . $ this -> get_template ( ) ; foreach ( $ this -> params as $ key => $ value ) { $ url = str_replace ( '{' . $ key . '}' , $ value , $ url ) ; } $ toolproxy = $ this -> get_service ( ) -> get_too... | Get the resource fully qualified endpoint . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.