idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
30,400 | public function calculate ( $ sampleids , \ core_analytics \ analysable $ analysable , $ starttime = false , $ endtime = false ) { if ( ! PHPUNIT_TEST && CLI_SCRIPT ) { echo '.' ; } $ calculations = [ ] ; foreach ( $ sampleids as $ sampleid => $ unusedsampleid ) { $ calculatedvalue = $ this -> calculate_sample ( $ samp... | Calculates the target . |
30,401 | public function filter_out_invalid_samples ( & $ sampleids , \ core_analytics \ analysable $ analysable , $ fortraining = true ) { foreach ( $ sampleids as $ sampleid => $ unusedsampleid ) { if ( ! $ this -> is_valid_sample ( $ sampleid , $ analysable , $ fortraining ) ) { unset ( $ sampleids [ $ sampleid ] ) ; } } } | Filters out invalid samples for training . |
30,402 | public static function get_current_versions_ids ( $ audience = null ) { global $ DB ; $ sql = "SELECT v.policyid, v.id FROM {tool_policy} d LEFT JOIN {tool_policy_versions} v ON v.policyid = d.id WHERE d.currentversionid = v.id" ; $ params = [ ] ; if ( $ audience ) { $ sql .= " AND v... | Checks if there are any current policies defined and returns their ids only |
30,403 | public static function count_total_users ( ) { global $ DB , $ CFG ; static $ cached = null ; if ( $ cached === null ) { $ cached = $ DB -> count_records_select ( 'user' , 'deleted = 0 AND id <> ?' , [ $ CFG -> siteguest ] ) ; } return $ cached ; } | Returns total number of users who are expected to accept site policy |
30,404 | public static function get_policy_version ( $ versionid , $ policies = null ) { if ( $ policies === null ) { $ policies = self :: list_policies ( ) ; } foreach ( $ policies as $ policy ) { if ( $ policy -> currentversionid == $ versionid ) { return $ policy -> currentversion ; } else { foreach ( $ policy -> draftversio... | Load a particular policy document version . |
30,405 | public static function fix_revision_values ( array $ versions ) { $ byrev = [ ] ; foreach ( $ versions as $ version ) { if ( $ version -> revision === '' ) { $ version -> revision = userdate ( $ version -> timecreated , get_string ( 'strftimedate' , 'core_langconfig' ) ) ; } $ byrev [ $ version -> revision ] [ $ versio... | Make sure that each version has a unique revision value . |
30,406 | public static function can_user_view_policy_version ( $ policy , $ behalfid = null , $ userid = null ) { global $ USER ; if ( $ policy -> status == policy_version :: STATUS_ACTIVE ) { return true ; } if ( empty ( $ userid ) ) { $ userid = $ USER -> id ; } if ( $ behalfid > 0 ) { $ behalfcontext = context_user :: instan... | Can the user view the given policy version document? |
30,407 | public static function get_user_minors ( $ userid , array $ extrafields = null ) { global $ DB ; $ ctxfields = context_helper :: get_preload_record_columns_sql ( 'c' ) ; $ namefields = get_all_user_name_fields ( true , 'u' ) ; $ pixfields = user_picture :: fields ( 'u' , $ extrafields ) ; $ sql = "SELECT $ctxfields, $n... | Return the user s minors - other users on which behalf we can accept policies . |
30,408 | public static function form_policydoc_add ( stdClass $ form ) { global $ DB ; $ form = clone ( $ form ) ; $ form -> policyid = $ DB -> insert_record ( 'tool_policy' , ( object ) [ 'sortorder' => 999 , ] ) ; static :: distribute_policy_document_sortorder ( ) ; return static :: form_policydoc_update_new ( $ form ) ; } | Save the data from the policydoc form as a new policy document . |
30,409 | public static function form_policydoc_update_new ( stdClass $ form ) { global $ DB ; if ( empty ( $ form -> policyid ) ) { throw new coding_exception ( 'Invalid policy document ID' ) ; } $ form = clone ( $ form ) ; $ form -> id = $ DB -> insert_record ( 'tool_policy_versions' , ( new policy_version ( 0 , ( object ) [ '... | Save the data from the policydoc form as a new policy document version . |
30,410 | public static function form_policydoc_update_overwrite ( stdClass $ form ) { $ form = clone ( $ form ) ; unset ( $ form -> timecreated ) ; $ summaryfieldoptions = static :: policy_summary_field_options ( ) ; $ form = file_postupdate_standard_editor ( $ form , 'summary' , $ summaryfieldoptions , $ summaryfieldoptions [ ... | Save the data from the policydoc form overwriting the existing policy document version . |
30,411 | public static function make_current ( $ versionid ) { global $ DB , $ USER ; $ policyversion = new policy_version ( $ versionid ) ; if ( ! $ policyversion -> get ( 'id' ) || $ policyversion -> get ( 'archived' ) ) { throw new coding_exception ( 'Version not found or is archived' ) ; } if ( $ currentversionid = $ DB -> ... | Make the given version the current active one . |
30,412 | public static function inactivate ( $ policyid ) { global $ DB ; if ( $ currentversionid = $ DB -> get_field ( 'tool_policy' , 'currentversionid' , [ 'id' => $ policyid ] ) ) { $ DB -> set_field ( 'tool_policy_versions' , 'archived' , 1 , [ 'id' => $ currentversionid ] ) ; $ DB -> set_field ( 'tool_policy' , 'currentve... | Inactivate the policy document - no version marked as current and the document does not apply . |
30,413 | public static function revert_to_draft ( $ versionid ) { $ policyversion = new policy_version ( $ versionid ) ; if ( ! $ policyversion -> get ( 'id' ) || ! $ policyversion -> get ( 'archived' ) ) { throw new coding_exception ( 'Version not found or is not archived' ) ; } $ formdata = static :: form_policydoc_data ( $ p... | Create a new draft policy document from an archived version . |
30,414 | protected static function distribute_policy_document_sortorder ( ) { global $ DB ; $ sql = "SELECT p.id, p.sortorder, MAX(v.timecreated) AS timerecentcreated FROM {tool_policy} p LEFT JOIN {tool_policy_versions} v ON v.policyid = p.id GROUP BY p.id, p.sortorder ORD... | Re - sets the sortorder field of the policy documents to even values . |
30,415 | protected static function move_policy_document ( $ policyid , $ step ) { global $ DB ; $ sortorder = $ DB -> get_field ( 'tool_policy' , 'sortorder' , [ 'id' => $ policyid ] , MUST_EXIST ) ; $ DB -> set_field ( 'tool_policy' , 'sortorder' , $ sortorder + $ step , [ 'id' => $ policyid ] ) ; static :: distribute_policy_d... | Change the policy document s sortorder . |
30,416 | public static function get_user_acceptances ( $ userid , $ versions = null ) { global $ DB ; list ( $ vsql , $ vparams ) = [ '' , [ ] ] ; if ( ! empty ( $ versions ) ) { list ( $ vsql , $ vparams ) = $ DB -> get_in_or_equal ( $ versions , SQL_PARAMS_NAMED , 'ver' ) ; $ vsql = ' AND a.policyversionid ' . $ vsql ; } $ us... | Returns list of acceptances for this user . |
30,417 | public static function get_user_version_acceptance ( $ userid , $ versionid , $ acceptances = null ) { if ( empty ( $ acceptances ) ) { $ acceptances = static :: get_user_acceptances ( $ userid , $ versionid ) ; } if ( array_key_exists ( $ versionid , $ acceptances ) ) { return $ acceptances [ $ versionid ] ; } return ... | Returns version acceptance for this user . |
30,418 | public static function is_user_version_accepted ( $ userid , $ versionid , $ acceptances = null ) { $ acceptance = static :: get_user_version_acceptance ( $ userid , $ versionid , $ acceptances ) ; if ( ! empty ( $ acceptance ) ) { return ( bool ) $ acceptance -> status ; } return null ; } | Did the user accept the given policy version? |
30,419 | public static function get_policies_with_acceptances ( $ userid ) { $ policies = static :: list_policies ( ) ; $ acceptances = static :: get_user_acceptances ( $ userid ) ; $ ret = [ ] ; foreach ( $ policies as $ policy ) { $ versions = [ ] ; if ( $ policy -> currentversion && $ policy -> currentversion -> audience != ... | Get the list of policies and versions that current user is able to see and the respective acceptance records for the selected user . |
30,420 | public static function accept_policies ( $ policyversionid , $ userid = null , $ note = null , $ lang = null ) { static :: set_acceptances_status ( $ policyversionid , $ userid , $ note , $ lang , 1 ) ; } | Mark the given policy versions as accepted by the user . |
30,421 | public static function decline_policies ( $ policyversionid , $ userid = null , $ note = null , $ lang = null ) { static :: set_acceptances_status ( $ policyversionid , $ userid , $ note , $ lang , 0 ) ; } | Mark the given policy versions as declined by the user . |
30,422 | protected static function set_acceptances_status ( $ policyversionid , $ userid = null , $ note = null , $ lang = null , $ status = 1 ) { global $ DB , $ USER ; if ( empty ( $ policyversionid ) ) { return ; } else if ( ! is_array ( $ policyversionid ) ) { $ policyversionid = [ $ policyversionid ] ; } if ( ! $ userid ) ... | Mark the given policy versions as accepted or declined by the user . |
30,423 | public static function revoke_acceptance ( $ policyversionid , $ userid , $ note = null ) { global $ DB , $ USER ; if ( ! $ userid ) { $ userid = $ USER -> id ; } self :: can_accept_policies ( [ $ policyversionid ] , $ userid , true ) ; if ( $ currentacceptance = $ DB -> get_record ( 'tool_policy_acceptances' , [ 'poli... | May be used to revert accidentally granted acceptance for another user |
30,424 | public static function create_acceptances_user_created ( \ core \ event \ user_created $ event ) { global $ USER , $ CFG , $ DB ; if ( empty ( $ CFG -> sitepolicyhandler ) || $ CFG -> sitepolicyhandler !== 'tool_policy' ) { return ; } $ userid = $ event -> objectid ; $ lang = current_language ( ) ; $ user = $ event -> ... | Create user policy acceptances when the user is created . |
30,425 | public static function get_agreement_optional ( $ versionid ) { global $ DB ; $ optcache = \ cache :: make ( 'tool_policy' , 'policy_optional' ) ; $ hit = $ optcache -> get ( $ versionid ) ; if ( $ hit === false ) { $ flags = $ DB -> get_records_menu ( 'tool_policy_versions' , null , '' , 'id, optional' ) ; $ optcache ... | Returns the value of the optional flag for the given policy version . |
30,426 | public static function store ( \ core \ event \ base $ event ) { global $ DB ; if ( ! isloggedin ( ) or \ core \ session \ manager :: is_loggedinas ( ) or isguestuser ( ) ) { return ; } $ conditions = [ 'userid' => $ event -> userid ] ; $ records = $ DB -> get_records ( self :: $ table , $ conditions , "timeaccess DESC... | Register items views in block_recentlyaccesseditems table . |
30,427 | public static function remove ( \ core \ event \ base $ event ) { global $ DB ; $ DB -> delete_records ( self :: $ table , array ( 'cmid' => $ event -> contextinstanceid ) ) ; } | Remove record when course module is deleted . |
30,428 | public function export_for_download ( ) { if ( count ( $ this -> versions ) == 1 ) { if ( $ this -> accepted ) { if ( $ this -> onbehalf ) { return get_string ( 'acceptancestatusacceptedbehalf' , 'tool_policy' ) ; } else { return get_string ( 'acceptancestatusaccepted' , 'tool_policy' ) ; } } else if ( $ this -> declin... | Describe the status with a plain text for downloading purposes . |
30,429 | public function get_pathnamehash ( ) { return sha1 ( '/' . $ this -> get_contextid ( ) . '/' . $ this -> get_component ( ) . '/' . $ this -> get_filearea ( ) . '/' . $ this -> get_itemid ( ) . $ this -> get_filepath ( ) . $ this -> get_filename ( ) ) ; } | Returns path name hash |
30,430 | public function definition ( ) { $ mform = $ this -> _form ; $ workshop = $ this -> _customdata [ 'workshop' ] ; $ mform -> addElement ( 'header' , 'general' , get_string ( 'evaluationsettings' , 'mod_workshop' ) ) ; $ this -> definition_sub ( ) ; $ mform -> addElement ( 'submit' , 'submit' , get_string ( 'aggregategra... | Defines the common form fields . |
30,431 | public function open ( $ filePath ) { if ( $ this -> isStreamWrapper ( $ filePath ) && ( ! $ this -> doesSupportStreamWrapper ( ) || ! $ this -> isSupportedStreamWrapper ( $ filePath ) ) ) { throw new IOException ( "Could not open $filePath for reading! Stream wrapper used is not supported for this type of file." ) ; }... | Prepares the reader to read the given file . It also makes sure that the file exists and is readable . |
30,432 | public function close ( ) { if ( $ this -> isStreamOpened ) { $ this -> closeReader ( ) ; $ sheetIterator = $ this -> getConcreteSheetIterator ( ) ; if ( $ sheetIterator ) { $ sheetIterator -> end ( ) ; } $ this -> isStreamOpened = false ; } } | Closes the reader preventing any additional reading |
30,433 | public function field_validation ( $ values ) { $ valuecount = 0 ; foreach ( $ values as $ value ) { if ( isset ( $ value -> value ) && ! ( $ value -> value == '' ) ) { $ valuecount ++ ; } } if ( $ valuecount == 0 || $ valuecount == 2 ) { return false ; } return get_string ( 'latlongboth' , 'data' ) ; } | Validate values for this field . Both the Latitude and the Longitude fields need to be filled in . |
30,434 | protected function validate_duedate ( $ value ) { if ( $ this -> get ( 'id' ) ) { $ before = $ this -> beforeupdate -> get ( 'duedate' ) ; if ( $ before == $ value ) { return true ; } } if ( ! empty ( $ value ) && $ value <= time ( ) - 600 ) { return new lang_string ( 'errorcannotsetduedateinthepast' , 'core_competency... | Validate the due date . |
30,435 | public static function get_strings_parameters ( ) { return new external_function_parameters ( array ( 'strings' => new external_multiple_structure ( new external_single_structure ( array ( 'stringid' => new external_value ( PARAM_STRINGID , 'string identifier' ) , 'component' => new external_value ( PARAM_COMPONENT , '... | Returns description of get_string parameters |
30,436 | public static function get_user_dates_parameters ( ) { return new external_function_parameters ( [ 'contextid' => new external_value ( PARAM_INT , 'Context ID. Either use this value, or level and instanceid.' , VALUE_DEFAULT , 0 ) , 'contextlevel' => new external_value ( PARAM_ALPHA , 'Context level. To be used with in... | Returns description of get_user_dates parameters |
30,437 | public static function get_user_dates ( $ contextid , $ contextlevel , $ instanceid , $ timestamps ) { $ params = self :: validate_parameters ( self :: get_user_dates_parameters ( ) , [ 'contextid' => $ contextid , 'contextlevel' => $ contextlevel , 'instanceid' => $ instanceid , 'timestamps' => $ timestamps , ] ) ; $ ... | Format an array of timestamps . |
30,438 | public static function get_fragment_parameters ( ) { return new external_function_parameters ( array ( 'component' => new external_value ( PARAM_COMPONENT , 'Component for the callback e.g. mod_assign' ) , 'callback' => new external_value ( PARAM_ALPHANUMEXT , 'Name of the callback to execute' ) , 'contextid' => new ex... | Returns description of get_fragment parameters |
30,439 | public static function get_fragment ( $ component , $ callback , $ contextid , $ args = null ) { global $ OUTPUT , $ PAGE ; $ params = self :: validate_parameters ( self :: get_fragment_parameters ( ) , array ( 'component' => $ component , 'callback' => $ callback , 'contextid' => $ contextid , 'args' => $ args ) ) ; $... | Get a HTML fragment for inserting into something . Initial use is for inserting mforms into a page using AJAX . This web service is designed to be called only via AJAX and not directly . Callbacks that are called by this web service are responsible for doing the appropriate security checks to access the information ret... |
30,440 | public static function update_inplace_editable ( $ component , $ itemtype , $ itemid , $ value ) { global $ PAGE ; $ params = self :: validate_parameters ( self :: update_inplace_editable_parameters ( ) , array ( 'component' => $ component , 'itemtype' => $ itemtype , 'itemid' => $ itemid , 'value' => $ value ) ) ; if ... | Update any component s editable value assuming that component implements necessary callback |
30,441 | public static function fetch_notifications ( $ contextid ) { global $ PAGE ; self :: validate_parameters ( self :: fetch_notifications_parameters ( ) , [ 'contextid' => $ contextid , ] ) ; $ context = \ context :: instance_by_id ( $ contextid ) ; self :: validate_context ( $ context ) ; return \ core \ notification :: ... | Returns the list of notifications against the current session . |
30,442 | private function dimension_grades_structure ( $ elementname ) { $ subplugin = $ this -> get_subplugin_element ( ) ; $ subpluginwrapper = new backup_nested_element ( $ this -> get_recommended_name ( ) ) ; $ subplugingrade = new backup_nested_element ( $ elementname , array ( 'id' ) , array ( 'dimensionid' , 'grade' , 'p... | Returns the structure of dimension grades |
30,443 | public static function update_config_file ( $ component = '' , $ testsrunner = true , $ tags = '' , $ themesuitewithallfeatures = false , $ parallelruns = 0 , $ run = 0 ) { global $ CFG ; if ( $ testsrunner === true ) { $ configfilepath = behat_command :: get_behat_dir ( $ run ) . '/behat.yml' ; } else { $ configfilepa... | Updates a config file |
30,444 | public static function get_steps_list_config_filepath ( ) { global $ USER ; $ userdir = behat_command :: get_behat_dir ( ) . '/users/' . $ USER -> id ; make_writable_directory ( $ userdir ) ; return $ userdir . '/behat.yml' ; } | Returns the behat config file path used by the steps definition list |
30,445 | public static function get_behat_cli_config_filepath ( $ runprocess = 0 ) { global $ CFG ; if ( $ runprocess ) { if ( isset ( $ CFG -> behat_parallel_run [ $ runprocess - 1 ] [ 'behat_dataroot' ] ) ) { $ command = $ CFG -> behat_parallel_run [ $ runprocess - 1 ] [ 'behat_dataroot' ] ; } else { $ command = $ CFG -> beha... | Returns the behat config file path used by the behat cli command . |
30,446 | public final static function get_behat_run_config_value ( $ key ) { $ parallelrunconfigfile = self :: get_behat_run_config_file_path ( ) ; if ( file_exists ( $ parallelrunconfigfile ) ) { if ( $ parallelrunconfigs = @ json_decode ( file_get_contents ( $ parallelrunconfigfile ) , true ) ) { if ( isset ( $ parallelruncon... | Get config for parallel run . |
30,447 | public final static function drop_parallel_site_links ( ) { global $ CFG ; $ parallelrun = self :: get_behat_run_config_value ( 'parallel' ) ; if ( empty ( $ parallelrun ) ) { return false ; } clearstatcache ( ) ; for ( $ i = 1 ; $ i <= $ parallelrun ; $ i ++ ) { if ( ! empty ( $ CFG -> behat_parallel_run [ 'behat_wwwr... | Drops parallel site links . |
30,448 | public final static function create_parallel_site_links ( $ fromrun , $ torun ) { global $ CFG ; clearstatcache ( ) ; for ( $ i = $ fromrun ; $ i <= $ torun ; $ i ++ ) { if ( ! empty ( $ CFG -> behat_parallel_run [ 'behat_wwwroot' ] [ $ i - 1 ] [ 'behat_wwwroot' ] ) ) { continue ; } $ link = $ CFG -> dirroot . '/' . BE... | Create parallel site links . |
30,449 | public function get ( $ mailbox , array $ uids = array ( ) , $ fields = array ( ) , $ uidvalid = null ) { $ mailbox = strval ( $ mailbox ) ; if ( empty ( $ uids ) ) { $ ret = $ this -> _backend -> getCachedUids ( $ mailbox , $ uidvalid ) ; } else { $ ret = $ this -> _backend -> get ( $ mailbox , $ uids , $ fields , $ u... | Get information from the cache . |
30,450 | public function set ( $ mailbox , $ data , $ uidvalid ) { $ mailbox = strval ( $ mailbox ) ; if ( empty ( $ data ) ) { $ this -> _backend -> getMetaData ( $ mailbox , $ uidvalid , array ( 'uidvalid' ) ) ; } else { $ this -> _backend -> set ( $ mailbox , $ data , $ uidvalid ) ; if ( $ this -> _debug ) { $ this -> _debug... | Store information in cache . |
30,451 | public function getMetaData ( $ mailbox , $ uidvalid = null , array $ entries = array ( ) ) { return $ this -> _backend -> getMetaData ( strval ( $ mailbox ) , $ uidvalid , $ entries ) ; } | Get metadata information for a mailbox . |
30,452 | public function setMetaData ( $ mailbox , $ uidvalid , array $ data = array ( ) ) { unset ( $ data [ 'uidvalid' ] ) ; if ( ! empty ( $ data ) ) { if ( ! empty ( $ uidvalid ) ) { $ data [ 'uidvalid' ] = $ uidvalid ; } $ mailbox = strval ( $ mailbox ) ; $ this -> _backend -> setMetaData ( $ mailbox , $ data ) ; if ( $ th... | Set metadata information for a mailbox . |
30,453 | public function is_valid_sample ( $ sampleid , \ core_analytics \ analysable $ course , $ fortraining = true ) { $ userenrol = $ this -> retrieve ( 'user_enrolments' , $ sampleid ) ; if ( $ userenrol -> timeend && $ course -> get_start ( ) > $ userenrol -> timeend ) { return false ; } $ limit = $ course -> get_start ( ... | Discard student enrolments that are invalid . |
30,454 | public function definition ( ) { $ mform = $ this -> _form ; $ mform -> disable_form_change_checker ( ) ; $ componentarray = $ this -> _customdata [ 'components' ] ; $ edulevelarray = $ this -> _customdata [ 'edulevel' ] ; $ crudarray = $ this -> _customdata [ 'crud' ] ; $ mform -> addElement ( 'header' , 'displayinfo'... | Form definition method . |
30,455 | protected function openWriter ( ) { if ( $ this -> shouldAddBOM ) { $ this -> globalFunctionsHelper -> fputs ( $ this -> filePointer , EncodingHelper :: BOM_UTF8 ) ; } } | Opens the CSV streamer and makes it ready to accept data . |
30,456 | protected function addRowToWriter ( array $ dataRow , $ style ) { $ wasWriteSuccessful = $ this -> globalFunctionsHelper -> fputcsv ( $ this -> filePointer , $ dataRow , $ this -> fieldDelimiter , $ this -> fieldEnclosure ) ; if ( $ wasWriteSuccessful === false ) { throw new IOException ( 'Unable to write data' ) ; } $... | Adds data to the currently opened writer . |
30,457 | public function begin_table_import ( $ tablename , $ schemaHash ) { if ( $ this -> transactionmode == 'pertable' ) { $ this -> transaction = $ this -> mdb -> start_delegated_transaction ( ) ; } if ( ! $ table = $ this -> schema -> getTable ( $ tablename ) ) { throw new dbtransfer_exception ( 'unknowntableexception' , $... | Callback function . Should be called only once per table import operation before any table changes are made . It will delete all table data . |
30,458 | public function finish_table_import ( $ tablename ) { $ table = $ this -> schema -> getTable ( $ tablename ) ; $ fields = $ table -> getFields ( ) ; foreach ( $ fields as $ field ) { if ( $ field -> getSequence ( ) ) { $ this -> manager -> reset_sequence ( $ tablename ) ; return ; } } if ( $ this -> transactionmode == ... | Callback function . Should be called only once per table import operation after all table changes are made . It will reset table sequences if any . |
30,459 | public function extra_horizontal_navigation ( ) { if ( $ questionnode = $ this -> page -> settingsnav -> find ( "questionbank" , \ navigation_node :: TYPE_CONTAINER ) ) { if ( $ children = $ questionnode -> children ) { $ tabs = [ ] ; foreach ( $ children as $ key => $ node ) { $ tabs [ ] = new \ tabobject ( $ node -> ... | Display additional navigation if needed . |
30,460 | public function qtype_icon ( $ qtype ) { $ qtype = question_bank :: get_qtype ( $ qtype , false ) ; $ namestr = $ qtype -> local_name ( ) ; return $ this -> image_icon ( 'icon' , $ namestr , $ qtype -> plugin_name ( ) , array ( 'title' => $ namestr ) ) ; } | Output the icon for a question type . |
30,461 | public function execute ( ) { if ( ! is_enabled_auth ( 'lti' ) ) { mtrace ( 'Skipping task - ' . get_string ( 'pluginnotenabled' , 'auth' , get_string ( 'pluginname' , 'auth_lti' ) ) ) ; return ; } if ( ! enrol_is_enabled ( 'lti' ) ) { mtrace ( 'Skipping task - ' . get_string ( 'enrolisdisabled' , 'enrol_lti' ) ) ; ret... | Performs the synchronisation of members . |
30,462 | protected function fetch_members_from_consumer ( ToolConsumer $ consumer ) { $ dataconnector = $ this -> dataconnector ; $ defaultmembershipsurl = null ; if ( isset ( $ consumer -> profile -> service_offered ) ) { $ servicesoffered = $ consumer -> profile -> service_offered ; foreach ( $ servicesoffered as $ service ) ... | Fetches the members that belong to a ToolConsumer . |
30,463 | protected function sync_member_information ( stdClass $ tool , ToolConsumer $ consumer , $ members ) { global $ DB ; $ usercount = 0 ; $ enrolcount = 0 ; foreach ( $ members as $ member ) { $ usercount ++ ; $ user = new stdClass ( ) ; $ user -> username = helper :: create_username ( $ consumer -> getKey ( ) , $ member ... | Performs synchronisation of member information and enrolments . |
30,464 | protected function sync_unenrol ( stdClass $ tool ) { global $ DB ; $ ltiplugin = enrol_get_plugin ( 'lti' ) ; if ( ! $ this -> should_sync_unenrol ( $ tool -> membersyncmode ) ) { return 0 ; } if ( empty ( $ this -> currentusers ) ) { return 0 ; } $ unenrolcount = 0 ; $ ltiusersrs = $ DB -> get_recordset ( 'enrol_lti_... | Performs unenrolment of users that are no longer enrolled in the consumer side . |
30,465 | protected function sync_profile_images ( ) { $ counter = 0 ; foreach ( $ this -> userphotos as $ userid => $ url ) { if ( $ url ) { $ result = helper :: update_user_profile_image ( $ userid , $ url ) ; if ( $ result === helper :: PROFILE_IMAGE_UPDATE_SUCCESSFUL ) { $ counter ++ ; mtrace ( "Profile image succesfully dow... | Performs synchronisation of user profile images . |
30,466 | protected function do_context_membership_request ( Context $ context , ResourceLink $ resourcelink = null , $ membershipsurltemplate = '' ) { $ dataconnector = $ this -> dataconnector ; $ contextupdated = false ; if ( ! $ context -> hasMembershipService ( ) ) { if ( empty ( $ membershipsurltemplate ) ) { mtrace ( "Skip... | Performs membership service request using an LTI Context object . |
30,467 | public function setup ( $ page , $ context ) { static $ jsinitialised = false ; if ( $ jsinitialised ) { return ; } $ jsinitialised = true ; $ mediamanager = core_media_manager :: instance ( $ page ) ; } | Setup page with filter requirements and other prepare stuff . |
30,468 | private function callback ( array $ matches ) { $ mediamanager = core_media_manager :: instance ( ) ; global $ CFG , $ PAGE ; if ( preg_match ( '/class="[^"]*nomediaplugin/i' , $ matches [ 0 ] ) ) { return $ matches [ 0 ] ; } $ name = trim ( $ matches [ 2 ] ) ; if ( empty ( $ name ) or strpos ( $ name , 'http' ) === 0 ... | Replace link with embedded content if supported . |
30,469 | public function get_font_families ( ) { $ families = array ( ) ; foreach ( $ this -> fontlist as $ font ) { if ( strpos ( $ font , 'uni2cid' ) === 0 ) { continue ; } if ( strpos ( $ font , 'cid0' ) === 0 ) { continue ; } if ( substr ( $ font , - 2 ) === 'bi' ) { $ family = substr ( $ font , 0 , - 2 ) ; if ( in_array ( ... | Returns list of font families and types of fonts . |
30,470 | public function lock ( $ key , $ ownerid , $ block = false ) { $ lockfile = $ this -> get_lock_file ( $ key ) ; $ result = @ fopen ( $ lockfile , 'xb' ) ; if ( $ result === false ) { if ( $ this -> maxlife !== null && ! array_key_exists ( $ key , $ this -> locks ) ) { $ mtime = filemtime ( $ lockfile ) ; if ( $ mtime <... | Acquire a lock . |
30,471 | public function unlock ( $ key , $ ownerid , $ forceunlock = false ) { if ( array_key_exists ( $ key , $ this -> locks ) ) { @ unlink ( $ this -> locks [ $ key ] ) ; unset ( $ this -> locks [ $ key ] ) ; return true ; } else if ( $ forceunlock ) { $ lockfile = $ this -> get_lock_file ( $ key ) ; if ( file_exists ( $ lo... | Releases an acquired lock . |
30,472 | public function check_state ( $ key , $ ownerid ) { if ( array_key_exists ( $ key , $ this -> locks ) ) { return true ; } $ lockfile = $ this -> get_lock_file ( $ key ) ; if ( file_exists ( $ lockfile ) ) { return false ; } return null ; } | Checks if the given key is locked . |
30,473 | public static function fromXYArrays ( array $ x , array $ y , $ sample = true , float $ meanX = null , float $ meanY = null ) { if ( empty ( $ x ) || empty ( $ y ) ) { throw InvalidArgumentException :: arrayCantBeEmpty ( ) ; } $ n = count ( $ x ) ; if ( $ sample && $ n === 1 ) { throw InvalidArgumentException :: arrayS... | Calculates covariance from two given arrays x and y respectively |
30,474 | public static function fromDataset ( array $ data , int $ i , int $ k , bool $ sample = true , float $ meanX = null , float $ meanY = null ) { if ( empty ( $ data ) ) { throw InvalidArgumentException :: arrayCantBeEmpty ( ) ; } $ n = count ( $ data ) ; if ( $ sample && $ n === 1 ) { throw InvalidArgumentException :: ar... | Calculates covariance of two dimensions i and k in the given data . |
30,475 | public function pluralize ( $ word ) { if ( $ plural = $ this -> getCache ( $ word , 'pluralize' ) ) { return $ plural ; } if ( isset ( $ this -> _uncountables_keys [ $ word ] ) ) { return $ word ; } foreach ( $ this -> _pluralizationRules as $ regexp => $ replacement ) { $ plural = preg_replace ( $ regexp , $ replacem... | Singular English word to pluralize . |
30,476 | public function singularize ( $ word ) { if ( $ singular = $ this -> getCache ( $ word , 'singularize' ) ) { return $ singular ; } if ( isset ( $ this -> _uncountables_keys [ $ word ] ) ) { return $ word ; } foreach ( $ this -> _singularizationRules as $ regexp => $ replacement ) { $ singular = preg_replace ( $ regexp ... | Plural English word to singularize . |
30,477 | public function camelize ( $ word , $ firstLetter = 'upper' ) { if ( $ camelized = $ this -> getCache ( $ word , 'camelize' . $ firstLetter ) ) { return $ camelized ; } $ camelized = $ word ; if ( Horde_String :: lower ( $ camelized ) != $ camelized && strpos ( $ camelized , '_' ) !== false ) { $ camelized = str_replac... | Camel - cases a word . |
30,478 | public function dasherize ( $ underscoredWord ) { if ( $ result = $ this -> getCache ( $ underscoredWord , 'dasherize' ) ) { return $ result ; } $ result = str_replace ( '_' , '-' , $ this -> underscore ( $ underscoredWord ) ) ; return $ this -> setCache ( $ underscoredWord , 'dasherize' , $ result ) ; } | Replaces underscores with dashes in the string . |
30,479 | public function humanize ( $ lowerCaseAndUnderscoredWord ) { $ word = $ lowerCaseAndUnderscoredWord ; if ( $ result = $ this -> getCache ( $ word , 'humanize' ) ) { return $ result ; } $ result = ucfirst ( str_replace ( '_' , ' ' , $ this -> underscore ( $ word ) ) ) ; if ( substr ( $ result , - 3 , 3 ) == ' id' ) { $ ... | Capitalizes the first word and turns underscores into spaces and strips _id . |
30,480 | public function tableize ( $ className ) { if ( $ result = $ this -> getCache ( $ className , 'tableize' ) ) { return $ result ; } $ result = $ this -> pluralize ( $ this -> underscore ( $ className ) ) ; $ result = str_replace ( '/' , '_' , $ result ) ; return $ this -> setCache ( $ className , 'tableize' , $ result )... | Creates the name of a table like Rails does for models to table names . |
30,481 | public function classify ( $ tableName ) { if ( $ result = $ this -> getCache ( $ tableName , 'classify' ) ) { return $ result ; } $ result = $ this -> camelize ( $ this -> singularize ( $ tableName ) ) ; $ result = str_replace ( '/' , '_' , $ result ) ; return $ this -> setCache ( $ tableName , 'classify' , $ result )... | Creates a class name from a table name like Rails does for table names to models . |
30,482 | public function getCache ( $ word , $ rule ) { return isset ( $ this -> _cache [ $ word . '|' . $ rule ] ) ? $ this -> _cache [ $ word . '|' . $ rule ] : false ; } | Retuns a cached inflection . |
30,483 | public function setCache ( $ word , $ rule , $ value ) { $ this -> _cache [ $ word . '|' . $ rule ] = $ value ; return $ value ; } | Caches an inflection . |
30,484 | public function execute ( array $ records ) : array { $ idalias = $ this -> idalias ; $ alias = $ this -> alias ; return array_map ( function ( $ record ) use ( $ idalias , $ alias ) { return user_picture :: unalias ( $ record , null , $ idalias , $ alias ) ; } , $ records ) ; } | Extract the user records from a list of DB records . |
30,485 | protected function get_course ( $ courseid ) { if ( ! empty ( $ this -> cachedcourses [ $ courseid ] ) ) { return $ this -> cachedcourses [ $ courseid ] ; } $ this -> cachedcourses [ $ courseid ] = get_course ( $ courseid , false ) ; return $ this -> cachedcourses [ $ courseid ] ; } | Returns a course instance checking internal caching . |
30,486 | public function get_user ( $ userid ) { global $ DB ; if ( empty ( self :: $ cachedusers [ $ userid ] ) ) { $ fields = get_all_user_name_fields ( true ) ; self :: $ cachedusers [ $ userid ] = $ DB -> get_record ( 'user' , array ( 'id' => $ userid ) , 'id, ' . $ fields ) ; } return self :: $ cachedusers [ $ userid ] ; } | Returns user data checking the internal static cache . |
30,487 | protected function get_search_area ( $ areaid ) { if ( isset ( $ this -> cachedareas [ $ areaid ] ) && $ this -> cachedareas [ $ areaid ] === false ) { return false ; } if ( ! isset ( $ this -> cachedareas [ $ areaid ] ) ) { $ this -> cachedareas [ $ areaid ] = \ core_search \ manager :: get_search_area ( $ areaid ) ; ... | Returns a search instance of the specified area checking internal caching . |
30,488 | protected function to_document ( \ core_search \ base $ searcharea , $ docdata ) { list ( $ componentname , $ areaname ) = \ core_search \ manager :: extract_areaid_parts ( $ docdata [ 'areaid' ] ) ; $ doc = \ core_search \ document_factory :: instance ( $ docdata [ 'itemid' ] , $ componentname , $ areaname , $ this ) ... | Returns a document instance prepared to be rendered . |
30,489 | public function add_documents ( $ iterator , $ searcharea , $ options ) { $ numrecords = 0 ; $ numdocs = 0 ; $ numdocsignored = 0 ; $ lastindexeddoc = 0 ; $ firstindexeddoc = 0 ; $ partial = false ; $ lastprogress = manager :: get_current_time ( ) ; foreach ( $ iterator as $ document ) { if ( $ lastindexeddoc !== $ fir... | Loop through given iterator of search documents and and have the search engine back end add them to the index . |
30,490 | public function get_data ( ) { if ( $ data = parent :: get_data ( ) ) { if ( empty ( $ data -> emailalert ) || empty ( $ data -> emailalertnewemail ) ) { $ data -> emailalertemail = null ; } unset ( $ data -> emailalertnewemail ) ; if ( empty ( $ data -> commnews ) || empty ( $ data -> commnewsnewemail ) ) { $ data -> ... | Returns the form data |
30,491 | public static function is_anonymous_user ( $ user ) { if ( preg_match ( '/^anon\d*$/' , $ user -> username ) ) { $ match = preg_match ( '/^anonfirstname\d*$/' , $ user -> firstname ) ; $ match = $ match && preg_match ( '/^anonlastname\d*$/' , $ user -> lastname ) ; $ emailmatch = preg_match ( '/^anon\d*@doesntexist\.co... | Determine if the given user is an anonymous user based on their username firstname lastname and email address . |
30,492 | public function run ( ) { raise_memory_limit ( MEMORY_EXTRA ) ; external_api :: set_timeout ( ) ; set_exception_handler ( array ( $ this , 'exception_handler' ) ) ; $ this -> parse_request ( ) ; $ this -> authenticate_user ( ) ; $ this -> init_service_class ( ) ; if ( $ this -> wsdlmode ) { $ this -> generate_wsdl ( ) ... | Runs the SOAP web service . |
30,493 | protected function generate_wsdl ( ) { $ this -> wsdl = new wsdl ( $ this -> serviceclass , $ this -> serverurl ) ; foreach ( $ this -> servicestructs as $ structinfo ) { $ this -> wsdl -> add_complex_type ( $ structinfo -> classname , $ structinfo -> properties ) ; } foreach ( $ this -> servicemethods as $ methodinfo ... | Generates the WSDL . |
30,494 | protected function handle ( ) { if ( $ this -> wsdlmode ) { $ this -> response = $ this -> wsdl -> to_xml ( ) ; $ this -> send_response ( ) ; } else { $ wsdlurl = clone ( $ this -> serverurl ) ; $ wsdlurl -> param ( 'wsdl' , 1 ) ; $ options = array ( 'uri' => $ this -> serverurl -> out ( false ) ) ; $ this -> soapserve... | Handles the web service function call . |
30,495 | protected function send_error ( $ ex = null ) { if ( $ ex ) { $ info = $ ex -> getMessage ( ) ; if ( debugging ( ) and isset ( $ ex -> debuginfo ) ) { $ info .= ' - ' . $ ex -> debuginfo ; } } else { $ info = 'Unknown error' ; } $ dom = new DOMDocument ( '1.0' , 'UTF-8' ) ; $ fault = $ dom -> createElement ( 'SOAP-ENV:... | Send the error information to the WS client formatted as an XML document . |
30,496 | public function fault ( $ fault = null , $ code = 'Receiver' ) { $ allowedfaultmodes = array ( 'VersionMismatch' , 'MustUnderstand' , 'DataEncodingUnknown' , 'Sender' , 'Receiver' , 'Server' ) ; if ( ! in_array ( $ code , $ allowedfaultmodes ) ) { $ code = 'Receiver' ; } $ actor = null ; $ details = null ; $ errorcode ... | Generate a server fault . |
30,497 | protected static function get_lesson_summary_for_exporter ( $ lessonrecord , $ password = '' ) { global $ USER ; $ lesson = new lesson ( $ lessonrecord ) ; $ lesson -> update_effective_access ( $ USER -> id ) ; $ lessonavailable = $ lesson -> get_time_restriction_status ( ) === false ; $ lessonavailable = $ lessonavail... | Return a lesson record ready for being exported . |
30,498 | public static function get_lessons_by_courses ( $ courseids = array ( ) ) { global $ PAGE ; $ warnings = array ( ) ; $ returnedlessons = array ( ) ; $ params = array ( 'courseids' => $ courseids , ) ; $ params = self :: validate_parameters ( self :: get_lessons_by_courses_parameters ( ) , $ params ) ; $ mycourses = arr... | Returns a list of lessons in a provided list of courses if no list is provided all lessons that the user can view will be returned . |
30,499 | protected static function validate_lesson ( $ lessonid ) { global $ DB , $ USER ; $ lessonrecord = $ DB -> get_record ( 'lesson' , array ( 'id' => $ lessonid ) , '*' , MUST_EXIST ) ; list ( $ course , $ cm ) = get_course_and_cm_from_instance ( $ lessonrecord , 'lesson' ) ; $ lesson = new lesson ( $ lessonrecord , $ cm ... | Utility function for validating a lesson . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.