idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
29,000 | protected static function transform_user_evidence ( $ userid , user_evidence $ ue ) { $ options = [ 'context' => $ ue -> get_context ( ) ] ; return [ 'name' => format_string ( $ ue -> get ( 'name' ) , true , $ options ) , 'description' => format_text ( $ ue -> get ( 'description' ) , $ ue -> get ( 'descriptionformat' )... | Transform a user evidence . |
29,001 | protected static function recordset_loop_and_export ( moodle_recordset $ recordset , $ splitkey , $ initial , callable $ reducer , callable $ export ) { $ data = $ initial ; $ lastid = null ; foreach ( $ recordset as $ record ) { if ( $ lastid && $ record -> { $ splitkey } != $ lastid ) { $ export ( $ lastid , $ data )... | Loop and export from a recordset . |
29,002 | function exportValue ( & $ submitValues , $ assoc = false ) { global $ USER ; $ draftitemid = $ this -> _findValue ( $ submitValues ) ; if ( null === $ draftitemid ) { $ draftitemid = $ this -> getValue ( ) ; } if ( ! is_null ( $ draftitemid ) ) { $ fs = get_file_storage ( ) ; $ usercontext = context_user :: instance (... | export uploaded file |
29,003 | function inquotedstring ( $ content ) { if ( strlen ( $ content ) < 2 ) { return true ; } $ this -> tokens [ ] = new search_token ( TOKEN_STRING , substr ( $ content , 1 ) ) ; return true ; } | State entered when we ve seen a quoted string . Potentially emits a token . |
29,004 | protected function init ( ) { if ( isset ( $ this -> extdb ) ) { return ! empty ( $ this -> extdb ) ; } $ dbdriver = $ this -> get_config ( 'dbdriver' ) ; if ( empty ( $ dbdriver ) ) { $ this -> extdb = false ; return false ; } list ( $ dblibrary , $ dbtype ) = explode ( '/' , $ dbdriver ) ; if ( ! $ db = \ moodle_data... | Setup the Database . |
29,005 | protected function insert_event_entries ( $ evententries ) { if ( ! $ this -> init ( ) ) { return ; } if ( ! $ dbtable = $ this -> get_config ( 'dbtable' ) ) { return ; } try { $ this -> extdb -> insert_records ( $ dbtable , $ evententries ) ; } catch ( \ moodle_exception $ e ) { debugging ( 'Cannot write to external d... | Insert events in bulk to the database . |
29,006 | public function get_events_select ( $ selectwhere , array $ params , $ sort , $ limitfrom , $ limitnum ) { if ( ! $ this -> init ( ) ) { return array ( ) ; } if ( ! $ dbtable = $ this -> get_config ( 'dbtable' ) ) { return array ( ) ; } $ sort = self :: tweak_sort_by_id ( $ sort ) ; $ events = array ( ) ; $ records = $... | Get an array of events based on the passed on params . |
29,007 | public function get_events_select_count ( $ selectwhere , array $ params ) { if ( ! $ this -> init ( ) ) { return 0 ; } if ( ! $ dbtable = $ this -> get_config ( 'dbtable' ) ) { return 0 ; } return $ this -> extdb -> count_records_select ( $ dbtable , $ selectwhere , $ params ) ; } | Get number of events present for the given select clause . |
29,008 | public function dispose ( ) { $ this -> helper_dispose ( ) ; if ( $ this -> extdb ) { $ this -> extdb -> dispose ( ) ; } $ this -> extdb = null ; } | Dispose off database connection after pushing any buffered events to the database . |
29,009 | public function process_stage ( $ stage , $ alreadystolen = false ) { $ this -> set ( 'stage' , $ stage ) ; if ( $ alreadystolen ) { $ this -> alreadystolen [ $ stage ] = true ; } else { if ( ! array_key_exists ( $ stage , $ this -> alreadystolen ) ) { $ this -> alreadystolen [ $ stage ] = false ; } } if ( ! $ this -> ... | Process the given stage calling whatever functions are necessary |
29,010 | public function process_stage_queueorwait ( ) { global $ DB ; $ wait = $ this -> instance -> get_export_config ( 'wait' ) ; if ( empty ( $ wait ) ) { $ DB -> set_field ( 'portfolio_tempdata' , 'queued' , 1 , array ( 'id' => $ this -> id ) ) ; $ this -> queued = true ; return $ this -> process_stage_finished ( true ) ; ... | Processes the queueornext stage of the export |
29,011 | public function process_stage_package ( ) { try { $ this -> caller -> prepare_package ( ) ; } catch ( portfolio_exception $ e ) { throw new portfolio_export_exception ( $ this , 'callercouldnotpackage' , 'portfolio' , null , $ e -> getMessage ( ) ) ; } catch ( file_exception $ e ) { throw new portfolio_export_exception... | Processes the package stage of the export |
29,012 | public function process_stage_cleanup ( $ pullok = false ) { global $ CFG , $ DB ; if ( ! $ pullok && $ this -> get ( 'instance' ) && ! $ this -> get ( 'instance' ) -> is_push ( ) ) { return true ; } if ( $ this -> get ( 'instance' ) ) { $ this -> get ( 'instance' ) -> cleanup ( ) ; } $ DB -> delete_records ( 'portfoli... | Processes the cleanup stage of the export |
29,013 | public function process_stage_send ( ) { try { $ this -> instance -> send_package ( ) ; } catch ( portfolio_plugin_exception $ e ) { throw new portfolio_export_exception ( $ this , 'failedtosendpackage' , 'portfolio' , null , $ e -> getMessage ( ) ) ; } if ( $ this -> get ( 'instance' ) -> is_push ( ) ) { $ this -> log... | Processes the send stage of the export |
29,014 | public function log_transfer ( ) { global $ DB ; $ l = array ( 'userid' => $ this -> user -> id , 'portfolio' => $ this -> instance -> get ( 'id' ) , 'caller_file' => '' , 'caller_component' => $ this -> callercomponent , 'caller_sha1' => $ this -> caller -> get_sha1 ( ) , 'caller_class' => get_class ( $ this -> caller... | Log the transfer |
29,015 | public function process_stage_finished ( $ queued = false ) { global $ OUTPUT ; $ returnurl = $ this -> caller -> get_return_url ( ) ; $ continueurl = $ this -> instance -> get_interactive_continue_url ( ) ; $ extras = $ this -> instance -> get_extra_finish_options ( ) ; $ key = 'exportcomplete' ; if ( $ queued || $ th... | Processes the finish stage of the export |
29,016 | public function print_header ( $ headingstr , $ summary = true ) { global $ OUTPUT , $ PAGE ; $ titlestr = get_string ( 'exporting' , 'portfolio' ) ; $ headerstr = get_string ( 'exporting' , 'portfolio' ) ; $ PAGE -> set_title ( $ titlestr ) ; $ PAGE -> set_heading ( $ headerstr ) ; echo $ OUTPUT -> header ( ) ; echo $... | Local print header function to be reused across the export |
29,017 | public function cancel_request ( $ logreturn = false ) { global $ CFG ; if ( ! isset ( $ this ) ) { return ; } $ this -> process_stage_cleanup ( true ) ; if ( $ logreturn ) { redirect ( $ CFG -> wwwroot . '/user/portfoliologs.php' ) ; } redirect ( $ this -> caller -> get_return_url ( ) ) ; exit ; } | Cancels a potfolio request and cleans up the tempdata and redirects the user back to where they started |
29,018 | public function save ( ) { global $ DB ; if ( empty ( $ this -> id ) ) { $ r = ( object ) array ( 'data' => base64_encode ( serialize ( $ this ) ) , 'expirytime' => time ( ) + ( 60 * 60 * 24 ) , 'userid' => $ this -> user -> id , 'instance' => ( empty ( $ this -> instance ) ) ? null : $ this -> instance -> get ( 'id' )... | Writes out the contents of this object and all its data to the portfolio_tempdata table and sets the id field . |
29,019 | public static function rewaken_object ( $ id ) { global $ DB , $ CFG ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; require_once ( $ CFG -> libdir . '/portfolio/exporter.php' ) ; require_once ( $ CFG -> libdir . '/portfolio/caller.php' ) ; require_once ( $ CFG -> libdir . '/portfolio/plugin.php' ) ; if ( ! $ dat... | Rewakens the data from the database given the id . Makes sure to load the required files with the class definitions |
29,020 | public function verify_rewaken ( $ readonly = false ) { global $ USER , $ CFG ; if ( $ this -> get ( 'user' ) -> id != $ USER -> id ) { throw new portfolio_exception ( 'notyours' , 'portfolio' ) ; } if ( ! $ readonly && $ this -> get ( 'instance' ) && ! $ this -> get ( 'instance' ) -> allows_multiple_exports ( ) ) { $ ... | Verifies a rewoken object . Checks to make sure it belongs to the same user and session as is currently in use . |
29,021 | public function copy_existing_file ( $ oldfile ) { if ( array_key_exists ( $ oldfile -> get_contenthash ( ) , $ this -> newfilehashes ) ) { return $ this -> newfilehashes [ $ oldfile -> get_contenthash ( ) ] ; } $ fs = get_file_storage ( ) ; $ file_record = $ this -> new_file_record_base ( $ oldfile -> get_filename ( )... | Copies a file from somewhere else in moodle to the portfolio temporary working directory associated with this export |
29,022 | public function write_new_file ( $ content , $ name , $ manifest = true ) { $ fs = get_file_storage ( ) ; $ file_record = $ this -> new_file_record_base ( $ name ) ; if ( empty ( $ manifest ) && ( $ dir = $ this -> get ( 'format' ) -> get_file_directory ( ) ) ) { $ file_record -> filepath = '/' . $ dir . '/' ; } return... | Writes out some content to a file in the portfolio temporary working directory associated with this export . |
29,023 | public function zip_tempfiles ( $ filename = 'portfolio-export.zip' , $ filepath = '/final/' ) { $ zipper = new zip_packer ( ) ; list ( $ contextid , $ component , $ filearea , $ itemid ) = array_values ( $ this -> get_base_filearea ( ) ) ; if ( $ newfile = $ zipper -> archive_to_storage ( $ this -> get_tempfiles ( ) ,... | Zips all files in the temporary directory |
29,024 | public function get_tempfiles ( $ skipfile = 'portfolio-export.zip' ) { $ fs = get_file_storage ( ) ; $ files = $ fs -> get_area_files ( SYSCONTEXTID , 'portfolio' , 'exporter' , $ this -> id , 'sortorder, itemid, filepath, filename' , false ) ; if ( empty ( $ files ) ) { return array ( ) ; } $ returnfiles = array ( ) ... | Returns an arary of files in the temporary working directory for this export . Always use this instead of the files api directly |
29,025 | public static function print_expired_export ( ) { global $ CFG , $ OUTPUT , $ PAGE ; $ title = get_string ( 'exportexpired' , 'portfolio' ) ; $ PAGE -> navbar -> add ( get_string ( 'exportexpired' , 'portfolio' ) ) ; $ PAGE -> set_title ( $ title ) ; $ PAGE -> set_heading ( $ title ) ; echo $ OUTPUT -> header ( ) ; ech... | Wrapper function to print a friendly error to users This is generally caused by them hitting an expired transfer through the usage of the backbutton |
29,026 | public static function print_cleaned_export ( $ log , $ instance = null ) { global $ CFG , $ OUTPUT , $ PAGE ; if ( empty ( $ instance ) || ! $ instance instanceof portfolio_plugin_base ) { $ instance = portfolio_instance ( $ log -> portfolio ) ; } $ title = get_string ( 'exportalreadyfinished' , 'portfolio' ) ; $ PAGE... | Wrapper function to print a friendly error to users |
29,027 | public static function get_course_grades ( $ userid = 0 ) { global $ USER ; $ warnings = array ( ) ; $ params = self :: validate_parameters ( self :: get_course_grades_parameters ( ) , array ( 'userid' => $ userid ) ) ; $ userid = $ params [ 'userid' ] ; if ( empty ( $ userid ) ) { $ userid = $ USER -> id ; } $ systemc... | Get the given user courses final grades |
29,028 | public static function get_course_grades_returns ( ) { return new external_single_structure ( array ( 'grades' => new external_multiple_structure ( new external_single_structure ( array ( 'courseid' => new external_value ( PARAM_INT , 'Course id' ) , 'grade' => new external_value ( PARAM_RAW , 'Grade formatted' ) , 'ra... | Describes the get_course_grades return value . |
29,029 | public function matches ( $ expectedvalue ) { $ multiple = $ this -> field -> hasAttribute ( 'multiple' ) ; if ( ! $ multiple ) { $ cleanexpectedvalue = trim ( $ expectedvalue ) ; $ selectedtext = trim ( $ this -> get_selected_options ( ) ) ; $ selectedvalue = trim ( $ this -> get_selected_options ( false ) ) ; if ( $ ... | Returns whether the provided argument matches the current value . |
29,030 | protected function get_unescaped_options ( $ value ) { $ optionsarray = array_map ( 'trim' , preg_replace ( '/\\\,/' , ',' , preg_split ( '/(?<!\\\),/' , $ value ) ) ) ; core_collator :: asort ( $ optionsarray , SORT_STRING ) ; return implode ( '|||' , $ optionsarray ) ; } | Cleans the list of options and returns it as a string separating options with ||| . |
29,031 | protected function get_selected_options ( $ returntexts = true ) { $ method = 'getHtml' ; if ( $ returntexts === false ) { $ method = 'getValue' ; } $ multiple = $ this -> field -> hasAttribute ( 'multiple' ) ; $ selectedoptions = array ( ) ; $ values = $ this -> field -> getValue ( ) ; if ( ! is_array ( $ values ) ) {... | Returns the field selected values . |
29,032 | protected function initial_steps_walker ( $ step , $ stats , $ summarks , $ positionstat = true , $ dovariantalso = true ) { $ stats -> s ++ ; $ stats -> totalmarks += $ step -> mark ; $ stats -> markarray [ ] = $ step -> mark ; if ( $ positionstat ) { $ stats -> totalothermarks += $ summarks [ $ step -> questionusagei... | Calculating the stats is a four step process . |
29,033 | protected function initial_question_walker ( $ stats ) { $ stats -> markaverage = $ stats -> totalmarks / $ stats -> s ; if ( $ stats -> maxmark != 0 ) { $ stats -> facility = $ stats -> markaverage / $ stats -> maxmark ; } else { $ stats -> facility = null ; } $ stats -> othermarkaverage = $ stats -> totalothermarks /... | Then loop through all questions for the first time . |
29,034 | protected function secondary_steps_walker ( $ step , $ stats , $ summarks ) { $ markdifference = $ step -> mark - $ stats -> markaverage ; if ( $ stats -> subquestion ) { $ othermarkdifference = $ summarks [ $ step -> questionusageid ] - $ stats -> othermarkaverage ; } else { $ othermarkdifference = $ summarks [ $ step... | Loop through all last step data again . |
29,035 | protected function secondary_question_walker ( $ stats ) { if ( $ stats -> s > 1 ) { $ stats -> markvariance = $ stats -> markvariancesum / ( $ stats -> s - 1 ) ; $ stats -> othermarkvariance = $ stats -> othermarkvariancesum / ( $ stats -> s - 1 ) ; $ stats -> covariance = $ stats -> covariancesum / ( $ stats -> s - 1... | And finally loop through all the questions again . |
29,036 | public function handler_close ( ) { if ( $ this -> recordid ) { try { $ this -> database -> release_session_lock ( $ this -> recordid ) ; } catch ( \ Exception $ ex ) { } } $ this -> recordid = null ; $ this -> lasthash = null ; return true ; } | Close session handler . |
29,037 | public function handler_read ( $ sid ) { try { if ( ! $ record = $ this -> database -> get_record ( 'sessions' , array ( 'sid' => $ sid ) , 'id' ) ) { $ this -> failed = false ; $ this -> recordid = null ; $ this -> lasthash = sha1 ( '' ) ; return '' ; } if ( $ this -> recordid and $ this -> recordid != $ record -> id ... | Read session handler . |
29,038 | public function handler_write ( $ sid , $ session_data ) { if ( $ this -> failed ) { return false ; } $ sessdata = base64_encode ( $ session_data ) ; $ hash = sha1 ( $ sessdata ) ; if ( $ hash === $ this -> lasthash ) { return true ; } try { if ( $ this -> recordid ) { $ this -> database -> set_field ( 'sessions' , 'se... | Write session handler . |
29,039 | public function handler_destroy ( $ sid ) { if ( ! $ session = $ this -> database -> get_record ( 'sessions' , array ( 'sid' => $ sid ) , 'id, sid' ) ) { if ( $ sid == session_id ( ) ) { $ this -> recordid = null ; $ this -> lasthash = null ; } return true ; } if ( $ this -> recordid and $ session -> id == $ this -> re... | Destroy session handler . |
29,040 | public function handler_gc ( $ ignored_maxlifetime ) { if ( ! $ stalelifetime = ini_get ( 'session.gc_maxlifetime' ) ) { return true ; } $ params = array ( 'purgebefore' => ( time ( ) - $ stalelifetime ) ) ; $ this -> database -> delete_records_select ( 'sessions' , 'userid = 0 AND timemodified < :purgebefore' , $ para... | GC session handler . |
29,041 | function notemptyfield ( $ value , $ name ) { $ found = false ; foreach ( $ value as $ checkboxitem ) { if ( strval ( $ checkboxitem ) !== '' ) { $ found = true ; break ; } } return $ found ; } | Check whether any boxes in the checkbox where checked . |
29,042 | public static function get_content_value ( $ content ) { $ arr = explode ( '##' , $ content -> content ) ; $ strvalue = '' ; foreach ( $ arr as $ a ) { $ strvalue .= $ a . ' ' ; } return trim ( $ strvalue , "\r\n " ) ; } | Returns the presentable string value for a field content . |
29,043 | function lookup_consumer ( $ consumerKey ) { return new OAuth \ OAuthConsumer ( $ this -> toolProvider -> consumer -> getKey ( ) , $ this -> toolProvider -> consumer -> secret ) ; } | Create an OAuthConsumer object for the tool consumer . |
29,044 | protected function initialise_stats_for_variant ( $ variantno ) { $ this -> subparts [ $ variantno ] = array ( ) ; foreach ( $ this -> possibleresponses as $ subpartid => $ classes ) { $ this -> subparts [ $ variantno ] [ $ subpartid ] = new analysis_for_subpart ( $ classes ) ; } } | Initialise data structure for response analysis of one variant . |
29,045 | protected function blockLines ( OutputBlock $ block ) { $ inner = $ this -> indentStr ( ) ; $ glue = $ this -> break . $ inner ; $ this -> write ( $ inner . implode ( $ glue , $ block -> lines ) ) ; if ( ! empty ( $ block -> children ) ) { $ this -> write ( $ this -> break ) ; } } | Output lines inside a block |
29,046 | protected function blockSelectors ( OutputBlock $ block ) { $ inner = $ this -> indentStr ( ) ; $ this -> write ( $ inner . implode ( $ this -> tagSeparator , $ block -> selectors ) . $ this -> open . $ this -> break ) ; } | Output block selectors |
29,047 | protected function blockChildren ( OutputBlock $ block ) { foreach ( $ block -> children as $ child ) { $ this -> block ( $ child ) ; } } | Output block children |
29,048 | protected function block ( OutputBlock $ block ) { if ( empty ( $ block -> lines ) && empty ( $ block -> children ) ) { return ; } $ this -> currentBlock = $ block ; $ pre = $ this -> indentStr ( ) ; if ( ! empty ( $ block -> selectors ) ) { $ this -> blockSelectors ( $ block ) ; $ this -> indentLevel ++ ; } if ( ! emp... | Output non - empty block |
29,049 | public function format ( OutputBlock $ block , SourceMapGenerator $ sourceMapGenerator = null ) { $ this -> sourceMapGenerator = null ; if ( $ sourceMapGenerator ) { $ this -> currentLine = 1 ; $ this -> currentColumn = 0 ; $ this -> sourceMapGenerator = $ sourceMapGenerator ; } ob_start ( ) ; $ this -> block ( $ block... | Entry point to formatting a block |
29,050 | public function toggle_locked_state ( int $ timestamp ) { $ this -> timelocked = ( $ this -> timelocked && $ timestamp ? $ this -> timelocked : $ timestamp ) ; } | Set the locked timestamp |
29,051 | public function set_pinned ( int $ targetstate ) : void { if ( $ targetstate != $ this -> pinned ) { $ this -> pinned = $ targetstate ; } } | Set the pinned value for this entity |
29,052 | public function is_timed_discussion ( ) : bool { global $ CFG ; return ! empty ( $ CFG -> forum_enabletimedposts ) && ( $ this -> get_time_start ( ) || $ this -> get_time_end ( ) ) ; } | Check if the discussion is timed . |
29,053 | public static function get_renderer_factory ( ) : renderer_factory { global $ PAGE ; return new renderer_factory ( self :: get_legacy_data_mapper_factory ( ) , self :: get_exporter_factory ( ) , self :: get_vault_factory ( ) , self :: get_manager_factory ( ) , self :: get_entity_factory ( ) , self :: get_builder_factor... | Create the renderer factory . |
29,054 | public static function get_exporter_factory ( ) : exporter_factory { return new exporter_factory ( self :: get_legacy_data_mapper_factory ( ) , self :: get_manager_factory ( ) , self :: get_url_factory ( ) , self :: get_vault_factory ( ) ) ; } | Create the exporter factory . |
29,055 | public static function get_vault_factory ( ) : vault_factory { global $ DB ; return new vault_factory ( $ DB , self :: get_entity_factory ( ) , get_file_storage ( ) , self :: get_legacy_data_mapper_factory ( ) ) ; } | Create the vault factory . |
29,056 | public static function get_builder_factory ( ) : builder_factory { global $ PAGE ; return new builder_factory ( self :: get_legacy_data_mapper_factory ( ) , self :: get_exporter_factory ( ) , self :: get_vault_factory ( ) , self :: get_manager_factory ( ) , $ PAGE -> get_renderer ( 'mod_forum' ) ) ; } | Create the builder factory . |
29,057 | public static function columnSort ( $ a , $ b ) { return strcasecmp ( strlen ( $ a ) . $ a , strlen ( $ b ) . $ b ) ; } | Compare two column addresses Intended for use as a Callback function for sorting column addresses by column |
29,058 | public static function columnReverseSort ( $ a , $ b ) { return 1 - strcasecmp ( strlen ( $ a ) . $ a , strlen ( $ b ) . $ b ) ; } | Compare two column addresses Intended for use as a Callback function for reverse sorting column addresses by column |
29,059 | public static function cellSort ( $ a , $ b ) { sscanf ( $ a , '%[A-Z]%d' , $ ac , $ ar ) ; sscanf ( $ b , '%[A-Z]%d' , $ bc , $ br ) ; if ( $ ar == $ br ) { return strcasecmp ( strlen ( $ ac ) . $ ac , strlen ( $ bc ) . $ bc ) ; } return ( $ ar < $ br ) ? - 1 : 1 ; } | Compare two cell addresses Intended for use as a Callback function for sorting cell addresses by column and row |
29,060 | private function updateSingleCellReference ( $ pCellReference = 'A1' , $ pBefore = 'A1' , $ pNumCols = 0 , $ pNumRows = 0 ) { if ( strpos ( $ pCellReference , ':' ) === false && strpos ( $ pCellReference , ',' ) === false ) { list ( $ beforeColumn , $ beforeRow ) = PHPExcel_Cell :: coordinateFromString ( $ pBefore ) ; ... | Update single cell reference |
29,061 | private static function create_endpoints_for_google ( $ issuer ) { $ record = ( object ) [ 'issuerid' => $ issuer -> get ( 'id' ) , 'name' => 'discovery_endpoint' , 'url' => 'https://accounts.google.com/.well-known/openid-configuration' ] ; $ endpoint = new endpoint ( 0 , $ record ) ; $ endpoint -> create ( ) ; return ... | Create endpoints for google issuers . |
29,062 | private static function create_endpoints_for_facebook ( $ issuer ) { $ apiversion = '2.12' ; $ graphurl = 'https://graph.facebook.com/v' . $ apiversion ; $ infofields = [ 'id' , 'first_name' , 'last_name' , 'link' , 'picture.type(large)' , 'name' , 'email' , ] ; $ endpoints = [ 'authorization_endpoint' => sprintf ( 'ht... | Create endpoints for facebook issuers . |
29,063 | private static function create_endpoints_for_microsoft ( $ issuer ) { $ endpoints = [ 'authorization_endpoint' => 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize' , 'token_endpoint' => 'https://login.microsoftonline.com/common/oauth2/v2.0/token' , 'userinfo_endpoint' => 'https://graph.microsoft.com/v1.0... | Create endpoints for microsoft issuers . |
29,064 | private static function create_endpoints_for_nextcloud ( $ issuer ) { $ baseurl = $ issuer -> get ( 'baseurl' ) ; if ( substr ( $ baseurl , - 1 ) !== '/' ) { $ baseurl .= '/' ; } $ endpoints = [ 'authorization_endpoint' => 'index.php/apps/oauth2/authorize' , 'token_endpoint' => 'index.php/apps/oauth2/api/v1/token' , 'u... | Create endpoints for nextcloud issuers . |
29,065 | public static function init_standard_issuer ( $ type ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; if ( $ type == 'google' ) { return self :: init_google ( ) ; } else if ( $ type == 'microsoft' ) { return self :: init_microsoft ( ) ; } else if ( $ type == 'facebook' ) { return self ... | Initializes a record for one of the standard issuers to be displayed in the settings . The issuer is not yet created in the database . |
29,066 | public static function create_endpoints_for_standard_issuer ( $ type , $ issuer ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; if ( $ type == 'google' ) { $ issuer = self :: create_endpoints_for_google ( $ issuer ) ; self :: discover_endpoints ( $ issuer ) ; return $ issuer ; } else ... | Create endpoints for standard issuers based on the issuer created from submitted data . |
29,067 | public static function create_standard_issuer ( $ type , $ baseurl = false ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; if ( $ type == 'google' ) { $ issuer = self :: init_google ( ) ; $ issuer -> create ( ) ; return self :: create_endpoints_for_google ( $ issuer ) ; } else if ( $ ... | Create one of the standard issuers . |
29,068 | public static function get_system_scopes_for_issuer ( $ issuer ) { $ scopes = $ issuer -> get ( 'loginscopesoffline' ) ; $ pluginsfunction = get_plugins_with_function ( 'oauth2_system_scopes' , 'lib.php' ) ; foreach ( $ pluginsfunction as $ plugintype => $ plugins ) { foreach ( $ plugins as $ pluginfunction ) { $ plugi... | Get the full list of system scopes required by an oauth issuer . This includes the list required for login as well as any scopes injected by the oauth2_system_scopes callback in plugins . |
29,069 | public static function get_system_oauth_client ( issuer $ issuer ) { $ systemaccount = self :: get_system_account ( $ issuer ) ; if ( empty ( $ systemaccount ) ) { return false ; } $ scopes = self :: get_system_scopes_for_issuer ( $ issuer ) ; $ client = new \ core \ oauth2 \ client ( $ issuer , null , $ scopes , true ... | Get an authenticated oauth2 client using the system account . This call uses the refresh token to get an access token . |
29,070 | public static function get_user_oauth_client ( issuer $ issuer , moodle_url $ currenturl , $ additionalscopes = '' ) { $ client = new \ core \ oauth2 \ client ( $ issuer , $ currenturl , $ additionalscopes ) ; return $ client ; } | Get an authenticated oauth2 client using the current user account . This call does the redirect dance back to the current page after authentication . |
29,071 | protected static function guess_image ( $ issuer ) { if ( empty ( $ issuer -> get ( 'image' ) ) && ! empty ( $ issuer -> get ( 'baseurl' ) ) ) { $ baseurl = parse_url ( $ issuer -> get ( 'baseurl' ) ) ; $ imageurl = $ baseurl [ 'scheme' ] . '://' . $ baseurl [ 'host' ] . '/favicon.ico' ; $ issuer -> set ( 'image' , $ i... | Guess an image from the discovery URL . |
29,072 | protected static function discover_endpoints ( $ issuer ) { $ curl = new curl ( ) ; if ( empty ( $ issuer -> get ( 'baseurl' ) ) ) { return 0 ; } $ url = $ issuer -> get_endpoint_url ( 'discovery' ) ; if ( ! $ url ) { $ url = $ issuer -> get ( 'baseurl' ) . '/.well-known/openid-configuration' ; } if ( ! $ json = $ curl... | If the discovery endpoint exists for this issuer try and determine the list of valid endpoints . |
29,073 | public static function update_issuer ( $ data ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ issuer = new issuer ( 0 , $ data ) ; $ issuer -> update ( ) ; self :: discover_endpoints ( $ issuer ) ; self :: guess_image ( $ issuer ) ; return $ issuer ; } | Take the data from the mform and update the issuer . |
29,074 | public static function create_issuer ( $ data ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ issuer = new issuer ( 0 , $ data ) ; $ issuer -> create ( ) ; self :: discover_endpoints ( $ issuer ) ; self :: guess_image ( $ issuer ) ; return $ issuer ; } | Take the data from the mform and create the issuer . |
29,075 | public static function update_endpoint ( $ data ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ endpoint = new endpoint ( 0 , $ data ) ; $ endpoint -> update ( ) ; return $ endpoint ; } | Take the data from the mform and update the endpoint . |
29,076 | public static function create_endpoint ( $ data ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ endpoint = new endpoint ( 0 , $ data ) ; $ endpoint -> create ( ) ; return $ endpoint ; } | Take the data from the mform and create the endpoint . |
29,077 | public static function update_user_field_mapping ( $ data ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ userfieldmapping = new user_field_mapping ( 0 , $ data ) ; $ userfieldmapping -> update ( ) ; return $ userfieldmapping ; } | Take the data from the mform and update the user field mapping . |
29,078 | public static function create_user_field_mapping ( $ data ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ userfieldmapping = new user_field_mapping ( 0 , $ data ) ; $ userfieldmapping -> create ( ) ; return $ userfieldmapping ; } | Take the data from the mform and create the user field mapping . |
29,079 | public static function move_up_issuer ( $ id ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ current = new issuer ( $ id ) ; $ sortorder = $ current -> get ( 'sortorder' ) ; if ( $ sortorder == 0 ) { return false ; } $ sortorder = $ sortorder - 1 ; $ current -> set ( 'sortorder' , $... | Reorder this identity issuer . |
29,080 | public static function disable_issuer ( $ id ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ issuer = new issuer ( $ id ) ; $ issuer -> set ( 'enabled' , 0 ) ; return $ issuer -> update ( ) ; } | Disable an identity issuer . |
29,081 | public static function enable_issuer ( $ id ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ issuer = new issuer ( $ id ) ; $ issuer -> set ( 'enabled' , 1 ) ; return $ issuer -> update ( ) ; } | Enable an identity issuer . |
29,082 | public static function delete_issuer ( $ id ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ issuer = new issuer ( $ id ) ; $ systemaccount = self :: get_system_account ( $ issuer ) ; if ( $ systemaccount ) { $ systemaccount -> delete ( ) ; } $ endpoints = self :: get_endpoints ( $ i... | Delete an identity issuer . |
29,083 | public static function delete_endpoint ( $ id ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ endpoint = new endpoint ( $ id ) ; return $ endpoint -> delete ( ) ; } | Delete an endpoint . |
29,084 | public static function delete_user_field_mapping ( $ id ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ userfieldmapping = new user_field_mapping ( $ id ) ; return $ userfieldmapping -> delete ( ) ; } | Delete a user_field_mapping . |
29,085 | public static function connect_system_account ( $ issuer , $ returnurl ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ scopes = self :: get_system_scopes_for_issuer ( $ issuer ) ; $ client = new client ( $ issuer , $ returnurl , $ scopes , true ) ; if ( ! optional_param ( 'response'... | Perform the OAuth dance and get a refresh token . |
29,086 | public function get_permalink ( ) { $ link = $ this -> _get_discussionlink ( ) ; $ link -> set_anchor ( $ this -> get_postanchor ( ) ) ; return $ link -> out ( false ) ; } | Get the link to the current post including post anchor . |
29,087 | public function get_parentpostlink ( ) { $ link = $ this -> _get_discussionlink ( ) ; $ link -> param ( 'parent' , $ this -> post -> parent ) ; return $ link -> out ( false ) ; } | Get the link to the parent post . |
29,088 | public function get_authorlink ( ) { $ link = new \ moodle_url ( '/user/view.php' , array ( 'id' => $ this -> post -> userid , 'course' => $ this -> course -> id , ) ) ; return $ link -> out ( false ) ; } | Get the link to the author s profile page . |
29,089 | public function get_unsubscribeforumlink ( ) { if ( ! \ mod_forum \ subscriptions :: is_subscribable ( $ this -> forum ) ) { return null ; } $ link = new \ moodle_url ( '/mod/forum/subscribe.php' , array ( 'id' => $ this -> forum -> id , ) ) ; return $ link -> out ( false ) ; } | Get the link to unsubscribe from the forum . |
29,090 | public function get_unsubscribediscussionlink ( ) { if ( ! \ mod_forum \ subscriptions :: is_subscribable ( $ this -> forum ) ) { return null ; } $ link = new \ moodle_url ( '/mod/forum/subscribe.php' , array ( 'id' => $ this -> forum -> id , 'd' => $ this -> discussion -> id , ) ) ; return $ link -> out ( false ) ; } | Get the link to unsubscribe from the discussion . |
29,091 | public function get_coursefullname ( ) { return format_string ( $ this -> course -> fullname , true , array ( 'context' => \ context_course :: instance ( $ this -> course -> id ) , ) ) ; } | The full name of the course that the forum is in . |
29,092 | public function get_coursename ( ) { return format_string ( $ this -> course -> shortname , true , array ( 'context' => \ context_course :: instance ( $ this -> course -> id ) , ) ) ; } | The name of the course that the forum is in . |
29,093 | public function get_postdate ( ) { global $ CFG ; $ postmodified = $ this -> post -> modified ; if ( ! empty ( $ CFG -> forum_enabletimedposts ) && ( $ this -> discussion -> timestart > $ postmodified ) ) { $ postmodified = $ this -> discussion -> timestart ; } return userdate ( $ postmodified , "" , \ core_date :: get... | The date of the post formatted according to the postto user s preferences . |
29,094 | public function get_author_picture ( \ renderer_base $ renderer ) { return $ renderer -> user_picture ( $ this -> author , array ( 'courseid' => $ this -> course -> id ) ) ; } | The HTML for the author s user picture . |
29,095 | public function get_group_picture ( \ renderer_base $ renderer ) { if ( isset ( $ this -> userfrom -> groups ) ) { $ groups = $ this -> userfrom -> groups [ $ this -> forum -> id ] ; } else { $ groups = groups_get_all_groups ( $ this -> course -> id , $ this -> author -> id , $ this -> cm -> groupingid ) ; } if ( $ thi... | The HTML for a group picture . |
29,096 | public function flush ( ) { if ( $ this -> count == 0 ) { return ; } $ events = $ this -> buffer ; $ this -> count = 0 ; $ this -> buffer = array ( ) ; $ this -> insert_event_entries ( $ events ) ; } | Flush event buffer . |
29,097 | protected static function validate_quiz ( $ quizid ) { global $ DB ; $ quiz = $ DB -> get_record ( 'quiz' , array ( 'id' => $ quizid ) , '*' , MUST_EXIST ) ; list ( $ course , $ cm ) = get_course_and_cm_from_instance ( $ quiz , 'quiz' ) ; $ context = context_module :: instance ( $ cm -> id ) ; self :: validate_context ... | Utility function for validating a quiz . |
29,098 | public static function get_user_attempts_parameters ( ) { return new external_function_parameters ( array ( 'quizid' => new external_value ( PARAM_INT , 'quiz instance id' ) , 'userid' => new external_value ( PARAM_INT , 'user id, empty for current user' , VALUE_DEFAULT , 0 ) , 'status' => new external_value ( PARAM_AL... | Describes the parameters for get_user_attempts . |
29,099 | public static function get_user_attempts ( $ quizid , $ userid = 0 , $ status = 'finished' , $ includepreviews = false ) { global $ DB , $ USER ; $ warnings = array ( ) ; $ params = array ( 'quizid' => $ quizid , 'userid' => $ userid , 'status' => $ status , 'includepreviews' => $ includepreviews , ) ; $ params = self ... | Return a list of attempts for the given quiz and user . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.