idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
30,500 | public static function get_lesson_access_information ( $ lessonid ) { global $ DB , $ USER ; $ warnings = array ( ) ; $ params = array ( 'lessonid' => $ lessonid ) ; $ params = self :: validate_parameters ( self :: get_lesson_access_information_parameters ( ) , $ params ) ; list ( $ lesson , $ course , $ cm , $ context... | Return access information for a given lesson . |
30,501 | public static function get_lesson_access_information_returns ( ) { return new external_single_structure ( array ( 'canmanage' => new external_value ( PARAM_BOOL , 'Whether the user can manage the lesson or not.' ) , 'cangrade' => new external_value ( PARAM_BOOL , 'Whether the user can grade the lesson or not.' ) , 'can... | Describes the get_lesson_access_information return value . |
30,502 | public static function get_questions_attempts_parameters ( ) { return new external_function_parameters ( array ( 'lessonid' => new external_value ( PARAM_INT , 'lesson instance id' ) , 'attempt' => new external_value ( PARAM_INT , 'lesson attempt number' ) , 'correct' => new external_value ( PARAM_BOOL , 'only fetch co... | Describes the parameters for get_questions_attempts . |
30,503 | public static function get_questions_attempts ( $ lessonid , $ attempt , $ correct = false , $ pageid = null , $ userid = null ) { global $ DB , $ USER ; $ params = array ( 'lessonid' => $ lessonid , 'attempt' => $ attempt , 'correct' => $ correct , 'pageid' => $ pageid , 'userid' => $ userid , ) ; $ params = self :: v... | Return the list of page question attempts in a given lesson . |
30,504 | public static function get_questions_attempts_returns ( ) { return new external_single_structure ( array ( 'attempts' => new external_multiple_structure ( new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'The attempt id' ) , 'lessonid' => new external_value ( PARAM_INT , 'The attempt les... | Describes the get_questions_attempts return value . |
30,505 | public static function get_user_grade ( $ lessonid , $ userid = null ) { global $ CFG , $ USER ; require_once ( $ CFG -> libdir . '/gradelib.php' ) ; $ params = array ( 'lessonid' => $ lessonid , 'userid' => $ userid , ) ; $ params = self :: validate_parameters ( self :: get_user_grade_parameters ( ) , $ params ) ; $ w... | Return the final grade in the lesson for the given user . |
30,506 | protected static function get_user_attempt_grade_structure ( $ required = VALUE_REQUIRED ) { $ data = array ( 'nquestions' => new external_value ( PARAM_INT , 'Number of questions answered' ) , 'attempts' => new external_value ( PARAM_INT , 'Number of question attempts' ) , 'total' => new external_value ( PARAM_FLOAT ,... | Describes an attempt grade structure . |
30,507 | public static function get_user_attempt_grade_parameters ( ) { return new external_function_parameters ( array ( 'lessonid' => new external_value ( PARAM_INT , 'lesson instance id' ) , 'lessonattempt' => new external_value ( PARAM_INT , 'lesson attempt number' ) , 'userid' => new external_value ( PARAM_INT , 'the user ... | Describes the parameters for get_user_attempt_grade . |
30,508 | public static function get_user_attempt_grade ( $ lessonid , $ lessonattempt , $ userid = null ) { global $ CFG , $ USER ; require_once ( $ CFG -> libdir . '/gradelib.php' ) ; $ params = array ( 'lessonid' => $ lessonid , 'lessonattempt' => $ lessonattempt , 'userid' => $ userid , ) ; $ params = self :: validate_parame... | Return grade information in the attempt for a given user . |
30,509 | public static function get_content_pages_viewed_parameters ( ) { return new external_function_parameters ( array ( 'lessonid' => new external_value ( PARAM_INT , 'lesson instance id' ) , 'lessonattempt' => new external_value ( PARAM_INT , 'lesson attempt number' ) , 'userid' => new external_value ( PARAM_INT , 'the use... | Describes the parameters for get_content_pages_viewed . |
30,510 | public static function get_content_pages_viewed ( $ lessonid , $ lessonattempt , $ userid = null ) { global $ USER ; $ params = array ( 'lessonid' => $ lessonid , 'lessonattempt' => $ lessonattempt , 'userid' => $ userid , ) ; $ params = self :: validate_parameters ( self :: get_content_pages_viewed_parameters ( ) , $ ... | Return the list of content pages viewed by a user during a lesson attempt . |
30,511 | public static function get_content_pages_viewed_returns ( ) { return new external_single_structure ( array ( 'pages' => new external_multiple_structure ( new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'The attempt id.' ) , 'lessonid' => new external_value ( PARAM_INT , 'The lesson id.'... | Describes the get_content_pages_viewed return value . |
30,512 | public static function get_user_timers_returns ( ) { return new external_single_structure ( array ( 'timers' => new external_multiple_structure ( new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'The attempt id' ) , 'lessonid' => new external_value ( PARAM_INT , 'The lesson id' ) , 'user... | Describes the get_user_timers return value . |
30,513 | protected static function get_page_structure ( $ required = VALUE_REQUIRED ) { return new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'The id of this lesson page' ) , 'lessonid' => new external_value ( PARAM_INT , 'The id of the lesson this page belongs to' ) , 'prevpageid' => new exter... | Describes the external structure for a lesson page . |
30,514 | protected static function get_page_fields ( lesson_page $ page , $ returncontents = false ) { $ lesson = $ page -> lesson ; $ context = $ lesson -> context ; $ pagedata = new stdClass ; $ visibleproperties = array ( 'id' , 'lessonid' , 'prevpageid' , 'nextpageid' , 'qtype' , 'qoption' , 'layout' , 'display' , 'displayi... | Returns the fields of a page object |
30,515 | public static function get_pages_returns ( ) { return new external_single_structure ( array ( 'pages' => new external_multiple_structure ( new external_single_structure ( array ( 'page' => self :: get_page_structure ( ) , 'answerids' => new external_multiple_structure ( new external_value ( PARAM_INT , 'Answer id' ) , ... | Describes the get_pages return value . |
30,516 | public static function launch_attempt_parameters ( ) { return new external_function_parameters ( array ( 'lessonid' => new external_value ( PARAM_INT , 'lesson instance id' ) , 'password' => new external_value ( PARAM_RAW , 'optional password (the lesson may be protected)' , VALUE_DEFAULT , '' ) , 'pageid' => new exter... | Describes the parameters for launch_attempt . |
30,517 | protected static function format_lesson_messages ( $ lesson ) { $ messages = array ( ) ; foreach ( $ lesson -> messages as $ message ) { $ messages [ ] = array ( 'message' => $ message [ 0 ] , 'type' => $ message [ 1 ] , ) ; } return $ messages ; } | Return lesson messages formatted according the external_messages structure |
30,518 | public static function launch_attempt ( $ lessonid , $ password = '' , $ pageid = 0 , $ review = false ) { global $ CFG , $ USER ; $ params = array ( 'lessonid' => $ lessonid , 'password' => $ password , 'pageid' => $ pageid , 'review' => $ review ) ; $ params = self :: validate_parameters ( self :: launch_attempt_para... | Starts a new attempt or continues an existing one . |
30,519 | public static function get_page_data_parameters ( ) { return new external_function_parameters ( array ( 'lessonid' => new external_value ( PARAM_INT , 'lesson instance id' ) , 'pageid' => new external_value ( PARAM_INT , 'the page id' ) , 'password' => new external_value ( PARAM_RAW , 'optional password (the lesson may... | Describes the parameters for get_page_data . |
30,520 | public static function get_page_data_returns ( ) { return new external_single_structure ( array ( 'page' => self :: get_page_structure ( VALUE_OPTIONAL ) , 'newpageid' => new external_value ( PARAM_INT , 'New page id (if a jump was made)' ) , 'pagecontent' => new external_value ( PARAM_RAW , 'Page html content' , VALUE... | Describes the get_page_data return value . |
30,521 | public static function process_page_parameters ( ) { return new external_function_parameters ( array ( 'lessonid' => new external_value ( PARAM_INT , 'lesson instance id' ) , 'pageid' => new external_value ( PARAM_INT , 'the page id' ) , 'data' => new external_multiple_structure ( new external_single_structure ( array ... | Describes the parameters for process_page . |
30,522 | public static function finish_attempt_parameters ( ) { return new external_function_parameters ( array ( 'lessonid' => new external_value ( PARAM_INT , 'Lesson instance id.' ) , 'password' => new external_value ( PARAM_RAW , 'Optional password (the lesson may be protected).' , VALUE_DEFAULT , '' ) , 'outoftime' => new ... | Describes the parameters for finish_attempt . |
30,523 | public static function finish_attempt ( $ lessonid , $ password = '' , $ outoftime = false , $ review = false ) { $ params = array ( 'lessonid' => $ lessonid , 'password' => $ password , 'outoftime' => $ outoftime , 'review' => $ review ) ; $ params = self :: validate_parameters ( self :: finish_attempt_parameters ( ) ... | Finishes the current attempt . |
30,524 | public static function finish_attempt_returns ( ) { return new external_single_structure ( array ( 'data' => new external_multiple_structure ( new external_single_structure ( array ( 'name' => new external_value ( PARAM_ALPHANUMEXT , 'Data name.' ) , 'value' => new external_value ( PARAM_RAW , 'Data value.' ) , 'messag... | Describes the finish_attempt return value . |
30,525 | public static function get_attempts_overview ( $ lessonid , $ groupid = 0 ) { $ params = array ( 'lessonid' => $ lessonid , 'groupid' => $ groupid ) ; $ params = self :: validate_parameters ( self :: get_attempts_overview_parameters ( ) , $ params ) ; $ warnings = array ( ) ; list ( $ lesson , $ course , $ cm , $ conte... | Get a list of all the attempts made by users in a lesson . |
30,526 | public static function get_attempts_overview_returns ( ) { return new external_single_structure ( array ( 'data' => new external_single_structure ( array ( 'lessonscored' => new external_value ( PARAM_BOOL , 'True if the lesson was scored.' ) , 'numofattempts' => new external_value ( PARAM_INT , 'Number of attempts.' )... | Describes the get_attempts_overview return value . |
30,527 | public static function get_user_attempt_returns ( ) { return new external_single_structure ( array ( 'answerpages' => new external_multiple_structure ( new external_single_structure ( array ( 'page' => self :: get_page_structure ( VALUE_OPTIONAL ) , 'title' => new external_value ( PARAM_RAW , 'Page title.' ) , 'content... | Describes the get_user_attempt return value . |
30,528 | public static function get_pages_possible_jumps ( $ lessonid ) { global $ USER ; $ params = array ( 'lessonid' => $ lessonid ) ; $ params = self :: validate_parameters ( self :: get_pages_possible_jumps_parameters ( ) , $ params ) ; $ warnings = $ jumps = array ( ) ; list ( $ lesson , $ course , $ cm , $ context ) = se... | Return all the possible jumps for the pages in a given lesson . |
30,529 | public static function get_pages_possible_jumps_returns ( ) { return new external_single_structure ( array ( 'jumps' => new external_multiple_structure ( new external_single_structure ( array ( 'pageid' => new external_value ( PARAM_INT , 'The page id' ) , 'answerid' => new external_value ( PARAM_INT , 'The answer id' ... | Describes the get_pages_possible_jumps return value . |
30,530 | public static function get_lesson ( $ lessonid , $ password = '' ) { global $ PAGE ; $ params = array ( 'lessonid' => $ lessonid , 'password' => $ password ) ; $ params = self :: validate_parameters ( self :: get_lesson_parameters ( ) , $ params ) ; $ warnings = array ( ) ; list ( $ lesson , $ course , $ cm , $ context... | Return information of a given lesson . |
30,531 | public function recode_legacy_state_answer ( $ state ) { $ answer = $ state -> answer ; $ resultarr = array ( ) ; foreach ( explode ( ',' , $ answer ) as $ pair ) { $ pairarr = explode ( '-' , $ pair ) ; $ questionid = $ pairarr [ 0 ] ; $ answerid = $ pairarr [ 1 ] ; $ newquestionid = $ questionid ? $ this -> get_mappi... | Given one question_states record return the answer recoded pointing to all the restored stuff for randomsamatch questions |
30,532 | public function load_data ( ) { global $ DB , $ USER ; require_login ( $ this -> get ( 'course' ) , false , $ this -> cm , false , true ) ; if ( isguestuser ( ) ) { throw new portfolio_caller_exception ( 'guestsarenotallowed' , 'core_error' ) ; } $ workshoprecord = $ DB -> get_record ( 'workshop' , [ 'id' => $ this -> ... | Load data required for the export . |
30,533 | public function prepare_package ( ) { $ canviewauthornames = has_capability ( 'mod/workshop:viewauthornames' , $ this -> workshop -> context , $ this -> get ( 'user' ) ) ; $ workshopsubmission = $ this -> workshop -> prepare_submission ( $ this -> submission , $ canviewauthornames ) ; $ writingleap = false ; if ( $ thi... | Prepare the package ready to be passed off to the portfolio plugin . |
30,534 | protected function export_header ( workshop_submission $ workshopsubmission ) { $ output = '' ; $ output .= html_writer :: tag ( 'h2' , get_string ( 'pluginname' , 'mod_workshop' ) . ': ' . s ( $ this -> workshop -> name ) ) ; $ output .= html_writer :: tag ( 'h3' , s ( $ workshopsubmission -> title ) ) ; $ created = g... | Render the header of the exported content . |
30,535 | protected function export_content ( workshop_submission $ workshopsubmission ) { $ output = '' ; if ( ! $ workshopsubmission -> is_anonymous ( ) ) { $ author = username_load_fields_from_object ( ( object ) [ ] , $ workshopsubmission , 'author' ) ; $ output .= html_writer :: div ( get_string ( 'byfullnamewithoutlink' , ... | Render the content of the submission . |
30,536 | protected function export_assessment ( workshop_assessment $ assessment ) { $ output = '' ; if ( empty ( $ assessment -> title ) ) { $ title = get_string ( 'assessment' , 'workshop' ) ; } else { $ title = s ( $ assessment -> title ) ; } $ output .= html_writer :: tag ( 'h3' , $ title ) ; if ( $ assessment -> reviewer )... | Render the content of an assessment . |
30,537 | protected function export_files_list ( $ filearea ) { $ output = '' ; $ files = [ ] ; foreach ( $ this -> multifiles as $ file ) { if ( $ file -> is_directory ( ) ) { continue ; } if ( $ file -> get_filearea ( ) !== $ filearea ) { continue ; } if ( $ file -> is_valid_image ( ) ) { $ files [ ] = html_writer :: tag ( 'li... | Export the files in the given file area in a list . |
30,538 | protected function export_content_leap2a ( portfolio_format_leap2a_writer $ leapwriter , workshop_submission $ workshopsubmission , $ html ) { $ entry = new portfolio_format_leap2a_entry ( 'workshopsubmission' . $ workshopsubmission -> id , s ( $ workshopsubmission -> title ) , 'resource' , $ html ) ; $ entry -> publis... | Add a LEAP2A entry element that corresponds to a submission including attachments . |
30,539 | public function get_return_url ( ) { $ returnurl = new moodle_url ( '/mod/workshop/submission.php' , [ 'cmid' => $ this -> cm -> id , 'id' => $ this -> submissionid ] ) ; return $ returnurl -> out ( ) ; } | Return URL for redirecting the user back to where the export started . |
30,540 | public function get_sha1 ( ) { $ identifier = 'submission:' . $ this -> submission -> id . '@' . $ this -> submission -> timemodified ; if ( $ this -> assessments ) { $ ids = array_keys ( $ this -> assessments ) ; sort ( $ ids ) ; $ identifier .= '/assessments:' . implode ( ',' , $ ids ) ; } if ( $ this -> multifiles )... | Return the SHA1 hash of the exported content . |
30,541 | public function call ( $ functionname , $ functionargs , $ rawpost = false , $ contenttype = false ) { $ functions = $ this -> get_api_functions ( ) ; $ supportedmethods = [ 'get' , 'put' , 'post' , 'patch' , 'head' , 'delete' ] ; if ( empty ( $ functions [ $ functionname ] ) ) { throw new coding_exception ( 'unsupport... | Call a function from the Api with a set of arguments and optional data . |
30,542 | protected function port_is_blocked ( $ port ) { $ portnum = intval ( $ port ) ; if ( empty ( $ port ) || ( string ) $ portnum !== ( string ) $ port || $ port < 0 ) { return true ; } $ allowedports = $ this -> get_whitelisted_ports ( ) ; return ! empty ( $ allowedports ) && ! in_array ( $ portnum , $ allowedports ) ; } | Checks whether the given port is blocked as determined by its absence on the ports whitelist . Ports are assumed to be blocked unless found in the whitelist . |
30,543 | protected function address_explicitly_blocked ( $ addr ) { $ blockedhosts = $ this -> get_blacklisted_hosts_by_category ( ) ; $ iphostsblocked = array_merge ( $ blockedhosts [ 'ipv4' ] , $ blockedhosts [ 'ipv6' ] ) ; return address_in_subnet ( $ addr , implode ( ',' , $ iphostsblocked ) ) ; } | Checks whether the input address is blocked by at any of the IPv4 or IPv6 address rules . |
30,544 | protected function get_blacklisted_hosts_by_category ( ) { $ config = [ 'ipv6' => [ ] , 'ipv4' => [ ] , 'domain' => [ ] , 'domainwildcard' => [ ] ] ; $ entries = $ this -> get_blacklisted_hosts ( ) ; foreach ( $ entries as $ entry ) { if ( ip_utils :: is_ipv6_address ( $ entry ) || ip_utils :: is_ipv6_range ( $ entry )... | Helper to get all entries from the admin setting as an array sorted by classification . Classifications include ipv4 ipv6 domain domainwildcard . |
30,545 | protected function get_whitelisted_ports ( ) { global $ CFG ; if ( ! isset ( $ CFG -> curlsecurityallowedport ) ) { return [ ] ; } return array_filter ( array_map ( 'trim' , explode ( "\n" , $ CFG -> curlsecurityallowedport ) ) , function ( $ entry ) { return ! empty ( $ entry ) ; } ) ; } | Helper that returns the whitelisted ports as defined in the curlsecurityallowedport setting . |
30,546 | protected function get_blacklisted_hosts ( ) { global $ CFG ; if ( ! isset ( $ CFG -> curlsecurityblockedhosts ) ) { return [ ] ; } return array_filter ( array_map ( 'trim' , explode ( "\n" , $ CFG -> curlsecurityblockedhosts ) ) , function ( $ entry ) { return ! empty ( $ entry ) ; } ) ; } | Helper that returns the blacklisted hosts as defined in the curlsecurityblockedhosts setting . |
30,547 | protected function locate_path ( $ path ) { $ starturl = rtrim ( $ this -> getMinkParameter ( 'base_url' ) , '/' ) . '/' ; return 0 !== strpos ( $ path , 'http' ) ? $ starturl . ltrim ( $ path , '/' ) : $ path ; } | Locates url based on provided path . Override to provide custom routing mechanism . |
30,548 | protected function find ( $ selector , $ locator , $ exception = false , $ node = false , $ timeout = false ) { if ( $ selector === 'named' ) { $ exception = 'Using the "named" selector is deprecated as of 3.1. ' . ' Use the "named_partial" or use the "named_exact" selector instead.' ; throw new ExpectationException ( ... | Returns the first matching element . |
30,549 | protected function find_all ( $ selector , $ locator , $ exception = false , $ node = false , $ timeout = false ) { if ( $ selector === 'named' ) { $ exception = 'Using the "named" selector is deprecated as of 3.1. ' . ' Use the "named_partial" or use the "named_exact" selector instead.' ; throw new ExpectationExceptio... | Returns all matching elements . |
30,550 | protected function spin ( $ lambda , $ args = false , $ timeout = false , $ exception = false , $ microsleep = false ) { if ( ! $ timeout ) { $ timeout = self :: get_timeout ( ) ; } if ( $ microsleep ) { $ loops = $ timeout * 10 ; } else { $ loops = $ timeout ; } if ( ! $ this -> running_javascript ( ) ) { $ loops = 1 ... | Executes the passed closure until returns true or time outs . |
30,551 | protected function get_node_in_container ( $ selectortype , $ element , $ containerselectortype , $ containerelement ) { $ containernode = $ this -> get_text_selector_node ( $ containerselectortype , $ containerelement ) ; list ( $ selector , $ locator ) = $ this -> transform_selector ( $ selectortype , $ element ) ; $... | Gets the requested element inside the specified container . |
30,552 | protected function ensure_element_exists ( $ element , $ selectortype ) { list ( $ selector , $ locator ) = $ this -> transform_selector ( $ selectortype , $ element ) ; $ msg = 'The "' . $ element . '" element does not exist and should exist' ; $ exception = new ExpectationException ( $ msg , $ this -> getSession ( ) ... | Spins around an element until it exists |
30,553 | protected function ensure_node_is_visible ( $ node ) { if ( ! $ this -> running_javascript ( ) ) { return ; } $ msg = 'The "' . $ node -> getXPath ( ) . '" xpath node is not visible and it should be visible' ; $ exception = new ExpectationException ( $ msg , $ this -> getSession ( ) ) ; $ this -> spin ( function ( $ co... | Ensures that the provided node is visible and we can interact with it . |
30,554 | protected function ensure_node_attribute_is_set ( $ node , $ attribute , $ attributevalue ) { if ( ! $ this -> running_javascript ( ) ) { return ; } $ msg = 'The "' . $ node -> getXPath ( ) . '" xpath node is not visible and it should be visible' ; $ exception = new ExpectationException ( $ msg , $ this -> getSession (... | Ensures that the provided node has a attribute value set . This step can be used to check if specific JS has finished modifying the node . |
30,555 | protected function ensure_element_is_visible ( $ element , $ selectortype ) { if ( ! $ this -> running_javascript ( ) ) { return ; } $ node = $ this -> get_selected_node ( $ selectortype , $ element ) ; $ this -> ensure_node_is_visible ( $ node ) ; return $ node ; } | Ensures that the provided element is visible and we can interact with it . |
30,556 | public static function wait_for_pending_js_in_session ( Session $ session ) { for ( $ i = 0 ; $ i < self :: get_extended_timeout ( ) * 10 ; $ i ++ ) { $ pending = '' ; try { $ jscode = trim ( preg_replace ( '/\s+/' , ' ' , ' return (function() { if (typeof M === "undefined") { ... | Waits for all the JS to be loaded . |
30,557 | protected function execute ( $ contextapi , $ params = array ( ) ) { if ( ! is_array ( $ params ) ) { $ params = array ( $ params ) ; } $ contextapi = explode ( "::" , $ contextapi ) ; $ context = behat_context_helper :: get ( $ contextapi [ 0 ] ) ; call_user_func_array ( array ( $ context , $ contextapi [ 1 ] ) , $ pa... | Helper function to execute api in a given context . |
30,558 | protected function js_trigger_click ( $ node ) { if ( ! $ this -> running_javascript ( ) ) { $ node -> click ( ) ; } $ this -> ensure_node_is_visible ( $ node ) ; $ xpath = $ node -> getXpath ( ) ; $ driver = $ this -> getSession ( ) -> getDriver ( ) ; if ( $ driver instanceof \ Moodle \ BehatExtension \ Driver \ Moodl... | Trigger click on node via javascript instead of actually clicking on it via pointer . |
30,559 | protected static function get_real_timeout ( int $ timeout ) : int { global $ CFG ; if ( ! empty ( $ CFG -> behat_increasetimeout ) ) { return $ timeout * $ CFG -> behat_increasetimeout ; } else { return $ timeout ; } } | Gets the required timeout in seconds . |
30,560 | public static function get_customfields_data_contexts ( string $ component , string $ area , string $ itemidstest = 'IS NOT NULL' , string $ instanceidstest = 'IS NOT NULL' , array $ params = [ ] ) : contextlist { $ sql = "SELECT d.contextid FROM {customfield_category} c JOIN {customfield_field} f ON f.categ... | Returns contexts that have customfields data |
30,561 | public static function export_customfields_data ( approved_contextlist $ contextlist , string $ component , string $ area , string $ itemidstest = 'IS NOT NULL' , string $ instanceidstest = 'IS NOT NULL' , array $ params = [ ] , array $ subcontext = null ) { global $ DB ; list ( $ contextidstest , $ contextparams ) = $... | Exports customfields data |
30,562 | public static function delete_customfields_data ( approved_contextlist $ contextlist , string $ component , string $ area , string $ itemidstest = 'IS NOT NULL' , string $ instanceidstest = 'IS NOT NULL' , array $ params = [ ] ) { global $ DB ; list ( $ contextidstest , $ contextparams ) = $ DB -> get_in_or_equal ( $ c... | Deletes customfields data |
30,563 | public static function delete_customfields_data_for_context ( string $ component , string $ area , \ context $ context ) { global $ DB ; $ sql = "SELECT d.id FROM {customfield_category} c JOIN {customfield_field} f ON f.categoryid = c.id JOIN {customfield_data} d ON d.fieldid = f.id ... | Deletes all customfields data for the given context |
30,564 | protected static function delete_categories ( array $ contextids , array $ categoriesids ) { global $ DB ; if ( ! $ categoriesids ) { return ; } list ( $ categoryidstest , $ catparams ) = $ DB -> get_in_or_equal ( $ categoriesids , SQL_PARAMS_NAMED , 'cfcat' ) ; $ datasql = "SELECT d.id FROM {customfield_data} d JOIN {... | Delete custom fields categories configurations all their fields and data |
30,565 | public static function export_customfield_data ( data_controller $ data , array $ subcontext ) { $ context = $ data -> get_context ( ) ; $ exportdata = $ data -> to_record ( ) ; $ exportdata -> fieldtype = $ data -> get_field ( ) -> get ( 'type' ) ; $ exportdata -> fieldshortname = $ data -> get_field ( ) -> get ( 'sho... | Exports one instance of custom field data |
30,566 | protected static function export_customfield_data_unknown ( \ stdClass $ record , \ stdClass $ field , array $ subcontext ) { $ context = \ context :: instance_by_id ( $ record -> contextid ) ; $ record -> fieldtype = $ field -> type ; $ record -> fieldshortname = $ field -> shortname ; $ record -> fieldname = format_s... | Export data record of unknown type when we were not able to create instance of data_controller |
30,567 | public static function is_expired ( data_request $ request ) { $ result = false ; if ( $ request -> get ( 'type' ) == api :: DATAREQUEST_TYPE_EXPORT ) { switch ( $ request -> get ( 'status' ) ) { case api :: DATAREQUEST_STATUS_EXPIRED : $ result = true ; break ; case api :: DATAREQUEST_STATUS_DOWNLOAD_READY : $ expirys... | Determines whether a completed data export request has expired . The response will be valid regardless of the expiry scheduled task having run . |
30,568 | public static function get_expired_requests ( $ userid = 0 ) { global $ DB ; $ expiryseconds = get_config ( 'tool_dataprivacy' , 'privacyrequestexpiry' ) ; $ expirytime = strtotime ( "-{$expiryseconds} second" ) ; $ table = self :: TABLE ; $ sqlwhere = 'type = :export_type AND status = :completestatus AND timemodified ... | Fetch completed data requests which are due to expire . |
30,569 | public static function expire ( $ expiredrequests ) { global $ DB ; $ ids = array_keys ( $ expiredrequests ) ; if ( count ( $ ids ) > 0 ) { list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ ids ) ; $ initialparams = array ( api :: DATAREQUEST_STATUS_EXPIRED , time ( ) ) ; $ params = array_merge ( $ initialpar... | Expire a given set of data requests . Update request status and delete the files . |
30,570 | public function is_active ( ) : bool { $ active = [ api :: DATAREQUEST_STATUS_APPROVED => true , ] ; return isset ( $ active [ $ this -> get ( 'status' ) ] ) ; } | Whether this request is active . |
30,571 | public function resubmit_request ( ) : data_request { if ( $ this -> is_active ( ) ) { $ this -> set ( 'status' , api :: DATAREQUEST_STATUS_REJECTED ) -> save ( ) ; } if ( ! $ this -> is_resettable ( ) ) { throw new \ moodle_exception ( 'cannotreset' , 'tool_dataprivacy' ) ; } $ currentdata = $ this -> to_record ( ) ; ... | Reject this request and resubmit it as a fresh request . |
30,572 | protected function _continuationCheck ( $ list ) { foreach ( $ list as $ val ) { if ( ( $ val instanceof Horde_Imap_Client_Interaction_Command_Continuation ) || ( ( $ val instanceof Horde_Imap_Client_Data_Format_String ) && $ val -> literal ( ) ) ) { return true ; } if ( ( $ val instanceof Horde_Imap_Client_Data_Format... | Recursive check for continuation functions . |
30,573 | public function process_question ( array $ data , array $ raw ) { if ( isset ( $ data [ 'answers' ] ) ) { $ this -> write_answers ( $ data [ 'answers' ] , $ this -> pluginname ) ; } if ( ! isset ( $ data [ 'multichoice' ] ) ) { $ data [ 'multichoice' ] = array ( array ( 'single' => 1 , 'shuffleanswers' => 1 , 'correctf... | Appends the multichoice specific information to the question |
30,574 | protected function write_multichoice ( array $ multichoices , $ oldquestiontextformat , $ questionid ) { global $ CFG ; foreach ( $ multichoices as $ multichoice ) { $ multichoice [ 'id' ] = $ this -> converter -> get_nextid ( ) ; $ multichoice [ 'correctfeedbackformat' ] = 0 ; $ multichoice [ 'partiallycorrectfeedback... | Converts the multichoice info and writes it into the question . xml |
30,575 | protected function prepare_activity_structure ( $ activitystructure ) { $ activity = new backup_nested_element ( 'activity' , array ( 'id' , 'moduleid' , 'modulename' , 'contextid' ) , null ) ; $ activity -> add_child ( $ activitystructure ) ; $ activityarr = array ( ( object ) array ( 'id' => $ this -> task -> get_act... | Wraps any activity backup structure within the common activity element that will include common to all activities information like id context ... |
30,576 | protected function execute_condition ( ) { $ courseid = $ this -> get_courseid ( ) ; if ( $ courseid == SITEID ) { return false ; } return backup_plan_dbops :: require_gradebook_backup ( $ courseid , $ this -> get_backupid ( ) ) ; } | We need to decide conditionally based on dynamic information about the execution of this step . Only will be executed if all the module gradeitems have been already included in backup |
30,577 | protected function define_execution ( ) { global $ DB ; $ plugins = enrol_get_plugins ( true ) ; $ enrols = $ DB -> get_records ( 'enrol' , array ( 'courseid' => $ this -> task -> get_courseid ( ) ) ) ; foreach ( $ enrols as $ enrol ) { if ( isset ( $ plugins [ $ enrol -> enrol ] ) ) { $ plugins [ $ enrol -> enrol ] ->... | Function that will contain all the code to be executed . |
30,578 | protected function execute_condition ( ) { if ( $ this -> get_courseid ( ) == SITEID ) { return false ; } return plugin_supports ( 'mod' , $ this -> get_task ( ) -> get_modulename ( ) , FEATURE_ADVANCED_GRADING , false ) ; } | Include the grading . xml only if the module supports advanced grading |
30,579 | protected function define_structure ( ) { $ userinfo = $ this -> get_setting_value ( 'userinfo' ) ; $ areas = new backup_nested_element ( 'areas' ) ; $ area = new backup_nested_element ( 'area' , array ( 'id' ) , array ( 'areaname' , 'activemethod' ) ) ; $ definitions = new backup_nested_element ( 'definitions' ) ; $ d... | Declares the gradable areas structures and data sources |
30,580 | public function set_value ( $ value ) { if ( ! empty ( $ value ) && ! $ this -> field -> isChecked ( ) ) { if ( ! $ this -> running_javascript ( ) ) { $ this -> field -> check ( ) ; return ; } $ this -> field -> click ( ) ; $ this -> trigger_on_change ( ) ; } else if ( empty ( $ value ) && $ this -> field -> isChecked ... | Sets the value of a checkbox . |
30,581 | public function matches ( $ expectedvalue = false ) { $ ischecked = $ this -> field -> isChecked ( ) ; if ( ! empty ( $ expectedvalue ) && $ ischecked ) { return true ; } else if ( empty ( $ expectedvalue ) && ! $ ischecked ) { return true ; } return false ; } | Is it enabled? |
30,582 | protected function trigger_on_change ( ) { $ driver = $ this -> session -> getDriver ( ) ; if ( $ driver instanceof \ Moodle \ BehatExtension \ Driver \ MoodleSelenium2Driver ) { $ driver -> triggerSynScript ( $ this -> field -> getXPath ( ) , "Syn.trigger('change', {}, {{ELEMENT}})" ) ; } } | Trigger on change event . |
30,583 | public function start_html ( ) { if ( $ this -> bar ) { throw new \ coding_exception ( 'Already started' ) ; } $ this -> bar = new \ progress_bar ( ) ; $ this -> bar -> create ( ) ; echo \ html_writer :: start_div ( 'wibbler' ) ; } | Starts to output progress . |
30,584 | public function update_progress ( ) { if ( ! $ this -> is_in_progress_section ( ) ) { if ( $ this -> bar ) { $ this -> end_html ( ) ; } } else { if ( ! $ this -> bar ) { $ this -> start_html ( ) ; } if ( time ( ) != $ this -> lastwibble ) { $ this -> lastwibble = time ( ) ; echo \ html_writer :: div ( '' , 'wibble stat... | When progress is updated updates the bar . |
30,585 | private function duplicate_course_module ( stdClass $ cm , $ moduleid , $ newinstanceid ) { global $ DB , $ CFG ; $ newcm = new stdClass ( ) ; $ newcm -> course = $ cm -> course ; $ newcm -> module = $ moduleid ; $ newcm -> instance = $ newinstanceid ; $ newcm -> visible = $ cm -> visible ; $ newcm -> section = $ cm ->... | Create a duplicate course module record so we can create the upgraded assign module alongside the old assignment module . |
30,586 | public function listImages ( $ project , $ optParams = array ( ) ) { $ params = array ( 'project' => $ project ) ; $ params = array_merge ( $ params , $ optParams ) ; return $ this -> call ( 'list' , array ( $ params ) , "Google_Service_Compute_ImageList" ) ; } | Retrieves the list of private images available to the specified project . Private images are images you create that belong to your project . This method does not get any images that belong to other projects including publicly - available images like Debian 7 . If you want to get a list of publicly - available images us... |
30,587 | protected function explode_answer ( $ answer ) { if ( ! $ answer ) { return array ( ) ; } $ bits = explode ( ',' , $ answer ) ; $ selections = array ( ) ; foreach ( $ bits as $ bit ) { list ( $ stem , $ choice ) = explode ( '-' , $ bit ) ; $ selections [ $ stem ] = $ choice ; } return $ selections ; } | Explode the answer saved as a string in state |
30,588 | protected function lookup_choice ( $ choice ) { if ( array_key_exists ( $ choice , $ this -> choices ) ) { return $ choice ; } else { $ questionid = array_search ( $ choice , $ this -> rightanswerid ) ; if ( $ questionid ) { return $ this -> right [ $ questionid ] ; } } return null ; } | Find the index corresponding to a choice |
30,589 | public function validate ( $ data ) { if ( get_config ( 'auth_ldap' , 'ntlmsso_type' ) === 'ntlm' ) { $ format = trim ( $ data ) ; if ( ! empty ( $ format ) && ! preg_match ( '/%username%/i' , $ format ) ) { return get_string ( 'auth_ntlmsso_missing_username' , 'auth_ldap' ) ; } } return parent :: validate ( $ data ) ;... | We need to validate the username format when using NTLM . |
30,590 | public function find_plugin ( $ component , $ reqversion = ANY_VERSION , $ branch = null ) { global $ CFG ; $ params = array ( 'plugin' => $ component , 'format' => 'json' , ) ; if ( $ reqversion === ANY_VERSION ) { $ params [ 'minversion' ] = 0 ; } else { $ params [ 'minversion' ] = $ reqversion ; } if ( $ branch === ... | Locate the given plugin in the plugin directory . |
30,591 | public function validate_pluginfo_format ( $ data ) { if ( empty ( $ data ) or ! is_object ( $ data ) ) { return false ; } $ output = new remote_info ( ) ; $ rootproperties = array ( 'id' => 1 , 'name' => 1 , 'component' => 1 , 'source' => 0 , 'doc' => 0 , 'bugs' => 0 , 'discussion' => 0 , 'version' => 0 ) ; foreach ( ... | Makes sure the given data format match the expected output of the pluginfo service . |
30,592 | protected function call_pluginfo_service ( array $ params ) { $ serviceurl = $ this -> get_serviceurl_pluginfo ( ) ; $ response = $ this -> call_service ( $ serviceurl , $ params ) ; if ( $ response ) { if ( $ response -> info [ 'http_code' ] == 404 ) { return false ; } else if ( $ response -> info [ 'http_code' ] == 2... | Calls the pluginfo . php end - point with given parameters . |
30,593 | protected function call_service ( $ serviceurl , array $ params = array ( ) ) { $ response = ( object ) array ( 'data' => null , 'info' => null , 'status' => null , ) ; $ curl = new curl ( ) ; $ response -> data = json_decode ( $ curl -> get ( $ serviceurl , $ params , array ( 'CURLOPT_SSL_VERIFYHOST' => 2 , 'CURLOPT_S... | Calls the given end - point service with the given parameters . |
30,594 | protected function convert_branch_numbering_format ( $ branch ) { $ branch = ( string ) $ branch ; if ( strpos ( $ branch , '.' ) === false ) { $ branch = substr ( $ branch , 0 , - 1 ) . '.' . substr ( $ branch , - 1 ) ; } return $ branch ; } | Converts the given branch from XY format to the X . Y format |
30,595 | protected function get_serviceurl_pluginfo ( ) { global $ CFG ; if ( ! empty ( $ CFG -> config_php_settings [ 'alternativepluginfoserviceurl' ] ) ) { return $ CFG -> config_php_settings [ 'alternativepluginfoserviceurl' ] ; } else { return self :: APIROOT . '/' . self :: APIVER . '/pluginfo.php' ; } } | Returns URL of the pluginfo . php API end - point . |
30,596 | public function render_print_book_page ( print_book_page $ page ) { $ data = $ page -> export_for_template ( $ this ) ; return parent :: render_from_template ( 'booktool_print/print_book' , $ data ) ; } | Render the print book page . |
30,597 | public function render_print_book_chapter_page ( print_book_chapter_page $ page ) { $ data = $ page -> export_for_template ( $ this ) ; return parent :: render_from_template ( 'booktool_print/print_book_chapter' , $ data ) ; } | Render the print book chapter page . |
30,598 | public function render_print_book_chapter_dialog_link ( ) { $ printtext = get_string ( 'printchapter' , 'booktool_print' ) ; $ printicon = $ this -> output -> pix_icon ( 'chapter' , $ printtext , 'booktool_print' , array ( 'class' => 'icon' ) ) ; $ printlinkatt = array ( 'onclick' => 'window.print();return false;' , 'c... | Render the print book chapter link . |
30,599 | public function render_print_book_toc ( $ chapters , $ book , $ cm ) { $ first = true ; $ context = context_module :: instance ( $ cm -> id ) ; $ toc = '' ; switch ( $ book -> numbering ) { case BOOK_NUM_NONE : $ toc .= html_writer :: start_tag ( 'div' , array ( 'class' => 'book_toc_none' ) ) ; break ; case BOOK_NUM_NU... | Render the print book table of contents . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.