idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
29,500 | public static function get_activities_completion_status ( $ courseid , $ userid ) { global $ CFG , $ USER ; require_once ( $ CFG -> libdir . '/grouplib.php' ) ; $ warnings = array ( ) ; $ arrayparams = array ( 'courseid' => $ courseid , 'userid' => $ userid , ) ; $ params = self :: validate_parameters ( self :: get_act... | Get Activities completion status |
29,501 | public static function get_course_completion_status ( $ courseid , $ userid ) { global $ CFG , $ USER ; require_once ( $ CFG -> libdir . '/grouplib.php' ) ; $ warnings = array ( ) ; $ arrayparams = array ( 'courseid' => $ courseid , 'userid' => $ userid , ) ; $ params = self :: validate_parameters ( self :: get_course_... | Get Course completion status |
29,502 | public static function find_one_amd_module ( $ component , $ jsfilename , $ debug = false ) { $ jsfileroot = core_component :: get_component_directory ( $ component ) ; if ( ! $ jsfileroot ) { return array ( ) ; } $ module = str_replace ( '.js' , '' , $ jsfilename ) ; $ srcdir = $ jsfileroot . '/amd/build' ; $ minpart ... | Check a single module exists and return the full path to it . |
29,503 | public static function find_all_amd_modules ( $ debug = false ) { global $ CFG ; $ jsdirs = array ( ) ; $ jsfiles = array ( ) ; $ dir = $ CFG -> libdir . '/amd' ; if ( ! empty ( $ dir ) && is_dir ( $ dir ) ) { $ jsdirs [ 'core' ] = $ dir ; } $ subsystems = core_component :: get_core_subsystems ( ) ; foreach ( $ subsyst... | Scan the source for AMD modules and return them all . |
29,504 | public static function get_workshops_by_courses ( $ courseids = array ( ) ) { global $ PAGE ; $ warnings = array ( ) ; $ returnedworkshops = array ( ) ; $ params = array ( 'courseids' => $ courseids , ) ; $ params = self :: validate_parameters ( self :: get_workshops_by_courses_parameters ( ) , $ params ) ; $ mycourses... | Returns a list of workshops in a provided list of courses . If no list is provided all workshops that the user can view will be returned . |
29,505 | protected static function validate_workshop ( $ workshopid ) { global $ DB , $ USER ; $ workshop = $ DB -> get_record ( 'workshop' , array ( 'id' => $ workshopid ) , '*' , MUST_EXIST ) ; list ( $ course , $ cm ) = get_course_and_cm_from_instance ( $ workshop , 'workshop' ) ; $ context = context_module :: instance ( $ c... | Utility function for validating a workshop . |
29,506 | public static function get_workshop_access_information ( $ workshopid ) { global $ USER ; $ params = self :: validate_parameters ( self :: get_workshop_access_information_parameters ( ) , array ( 'workshopid' => $ workshopid ) ) ; list ( $ workshop , $ course , $ cm , $ context ) = self :: validate_workshop ( $ params ... | Return access information for a given workshop . |
29,507 | public static function get_workshop_access_information_returns ( ) { $ structure = array ( 'creatingsubmissionallowed' => new external_value ( PARAM_BOOL , 'Is the given user allowed to create their submission?' ) , 'modifyingsubmissionallowed' => new external_value ( PARAM_BOOL , 'Is the user allowed to modify his exi... | Describes the get_workshop_access_information return value . |
29,508 | public static function get_user_plan ( $ workshopid , $ userid = 0 ) { global $ USER ; $ params = array ( 'workshopid' => $ workshopid , 'userid' => $ userid , ) ; $ params = self :: validate_parameters ( self :: get_user_plan_parameters ( ) , $ params ) ; list ( $ workshop , $ course , $ cm , $ context ) = self :: val... | Return the planner information for the given user . |
29,509 | public static function get_user_plan_returns ( ) { return new external_single_structure ( array ( 'userplan' => new external_single_structure ( array ( 'phases' => new external_multiple_structure ( new external_single_structure ( array ( 'code' => new external_value ( PARAM_INT , 'Phase code.' ) , 'title' => new extern... | Describes the get_user_plan return value . |
29,510 | public static function add_submission ( $ workshopid , $ title , $ content = '' , $ contentformat = FORMAT_MOODLE , $ inlineattachmentsid = 0 , $ attachmentsid = 0 ) { global $ USER ; $ params = self :: validate_parameters ( self :: add_submission_parameters ( ) , array ( 'workshopid' => $ workshopid , 'title' => $ tit... | Add a new submission to a given workshop . |
29,511 | public static function update_submission ( $ submissionid , $ title , $ content = '' , $ contentformat = FORMAT_MOODLE , $ inlineattachmentsid = 0 , $ attachmentsid = 0 ) { global $ USER , $ DB ; $ params = self :: validate_parameters ( self :: update_submission_parameters ( ) , array ( 'submissionid' => $ submissionid... | Updates the given submission . |
29,512 | public static function delete_submission ( $ submissionid ) { global $ USER , $ DB ; $ params = self :: validate_parameters ( self :: delete_submission_parameters ( ) , array ( 'submissionid' => $ submissionid ) ) ; $ warnings = array ( ) ; $ submission = $ DB -> get_record ( 'workshop_submissions' , array ( 'id' => $ ... | Deletes the given submission . |
29,513 | protected static function prepare_submission_for_external ( $ submission , workshop $ workshop , $ canviewauthorpublished = null , $ canviewauthornames = null , $ canviewallsubmissions = null ) { global $ USER ; if ( is_null ( $ canviewauthorpublished ) ) { $ canviewauthorpublished = has_capability ( 'mod/workshop:view... | Helper method for returning the submission data according the current user capabilities and current phase . |
29,514 | protected static function validate_submission ( $ submission , workshop $ workshop ) { global $ USER ; $ workshopclosed = $ workshop -> phase == workshop :: PHASE_CLOSED ; $ canviewpublished = has_capability ( 'mod/workshop:viewpublishedsubmissions' , $ workshop -> context ) ; $ canview = $ submission -> authorid == $ ... | Helper method for validating a submission . |
29,515 | public static function get_submission ( $ submissionid ) { global $ USER , $ DB , $ PAGE ; $ params = self :: validate_parameters ( self :: get_submission_parameters ( ) , array ( 'submissionid' => $ submissionid ) ) ; $ warnings = array ( ) ; $ submission = $ DB -> get_record ( 'workshop_submissions' , array ( 'id' =>... | Retrieves the given submission . |
29,516 | protected static function check_view_submission_assessments ( $ submission , workshop $ workshop ) { global $ USER ; $ ownsubmission = $ submission -> authorid == $ USER -> id ; $ canview = has_capability ( 'mod/workshop:viewallassessments' , $ workshop -> context ) || ( $ ownsubmission && $ workshop -> assessments_ava... | Helper method for validating if the current user can view the submission assessments . |
29,517 | protected static function prepare_assessment_for_external ( $ assessment , workshop $ workshop ) { global $ USER ; static $ canviewallassessments = null ; static $ canviewreviewers = null ; static $ canoverridegrades = null ; $ properties = assessment_exporter :: properties_definition ( ) ; foreach ( $ assessment as $ ... | Helper method for returning the assessment data according the current user capabilities and current phase . |
29,518 | public static function get_submission_assessments ( $ submissionid ) { global $ USER , $ DB , $ PAGE ; $ params = self :: validate_parameters ( self :: get_submission_assessments_parameters ( ) , array ( 'submissionid' => $ submissionid ) ) ; $ warnings = $ assessments = array ( ) ; $ submission = $ DB -> get_record ( ... | Retrieves the given submission assessments . |
29,519 | public static function get_assessment ( $ assessmentid ) { global $ DB , $ PAGE ; $ params = self :: validate_parameters ( self :: get_assessment_parameters ( ) , array ( 'assessmentid' => $ assessmentid ) ) ; $ warnings = array ( ) ; $ assessment = $ DB -> get_record ( 'workshop_assessments' , array ( 'id' => $ params... | Retrieves the given assessment . |
29,520 | public static function get_reviewer_assessments ( $ workshopid , $ userid = 0 ) { global $ USER , $ DB , $ PAGE ; $ params = self :: validate_parameters ( self :: get_reviewer_assessments_parameters ( ) , array ( 'workshopid' => $ workshopid , 'userid' => $ userid ) ) ; $ warnings = $ assessments = array ( ) ; list ( $... | Retrieves all the assessments reviewed by the given user . |
29,521 | public static function update_assessment ( $ assessmentid , $ data ) { global $ DB , $ USER ; $ params = self :: validate_parameters ( self :: update_assessment_parameters ( ) , array ( 'assessmentid' => $ assessmentid , 'data' => $ data ) ) ; $ warnings = array ( ) ; $ assessment = $ DB -> get_record ( 'workshop_asses... | Updates an assessment . |
29,522 | public static function get_grades ( $ workshopid , $ userid = 0 ) { global $ USER ; $ params = array ( 'workshopid' => $ workshopid , 'userid' => $ userid , ) ; $ params = self :: validate_parameters ( self :: get_grades_parameters ( ) , $ params ) ; $ warnings = array ( ) ; list ( $ workshop , $ course , $ cm , $ cont... | Returns the grades information for the given workshop and user . |
29,523 | public static function view_submission ( $ submissionid ) { global $ DB ; $ params = self :: validate_parameters ( self :: view_submission_parameters ( ) , array ( 'submissionid' => $ submissionid ) ) ; $ warnings = array ( ) ; $ submission = $ DB -> get_record ( 'workshop_submissions' , array ( 'id' => $ params [ 'sub... | Trigger the submission viewed event . |
29,524 | public function store_plugin_summaries ( array $ plugins ) { $ table = new html_table ( ) ; $ table -> head = array ( get_string ( 'plugin' , 'cache' ) , get_string ( 'storeready' , 'cache' ) , get_string ( 'stores' , 'cache' ) , get_string ( 'modes' , 'cache' ) , get_string ( 'supports' , 'cache' ) , get_string ( 'act... | Displays plugin summaries |
29,525 | public function definition_summaries ( array $ definitions , context $ context ) { $ table = new html_table ( ) ; $ table -> head = array ( get_string ( 'definition' , 'cache' ) , get_string ( 'mode' , 'cache' ) , get_string ( 'component' , 'cache' ) , get_string ( 'area' , 'cache' ) , get_string ( 'mappings' , 'cache'... | Displays definition summaries |
29,526 | public function mode_mappings ( $ applicationstore , $ sessionstore , $ requeststore , moodle_url $ editurl ) { $ table = new html_table ( ) ; $ table -> colclasses = array ( 'mode' , 'mapping' , ) ; $ table -> rowclasses = array ( 'mode_application' , 'mode_session' , 'mode_request' ) ; $ table -> head = array ( get_s... | Displays mode mappings |
29,527 | public function lock_summaries ( array $ locks ) { $ table = new html_table ( ) ; $ table -> colclasses = array ( 'name' , 'type' , 'default' , 'uses' , 'actions' ) ; $ table -> rowclasses = array ( 'lock_name' , 'lock_type' , 'lock_default' , 'lock_uses' , 'lock_actions' , ) ; $ table -> head = array ( get_string ( 'l... | Display basic information about lock instances . |
29,528 | public function notifications ( array $ notifications = array ( ) ) { if ( count ( $ notifications ) === 0 ) { return '' ; } $ html = html_writer :: start_div ( 'notifications' ) ; foreach ( $ notifications as $ notification ) { list ( $ message , $ notifysuccess ) = $ notification ; $ html .= $ this -> notification ( ... | Renders an array of notifications for the cache configuration screen . |
29,529 | public function matches ( array $ list ) { $ list = array_values ( $ list ) ; if ( $ this -> isSizeValid ( $ list ) ) { $ mismatch = false ; foreach ( $ this -> chain as $ i => $ search ) { $ proxy_url = $ list [ $ i ] ; if ( preg_match ( '/^\/.*\/[ixASUXu]*$/s' , $ search ) ) { if ( preg_match ( $ search , $ proxy_url... | Match a list of proxies . |
29,530 | public static function get_contexts_for_userid ( int $ userid ) : contextlist { global $ DB ; $ contextlist = new contextlist ( ) ; $ contexts = [ CONTEXT_SYSTEM , CONTEXT_USER , CONTEXT_COURSECAT , CONTEXT_COURSE , CONTEXT_MODULE , CONTEXT_BLOCK ] ; list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ contexts ... | Return all contexts for this userid . |
29,531 | public static function export_user_role_to_cohort ( int $ userid ) { global $ DB ; $ rolesnames = self :: get_roles_name ( ) ; $ sql = "SELECT ra.id, ra.contextid, ra.roleid, ra.userid, ra.timemodified, ra.modifierid, r.id as roleid FROM {role_assignments} ra JOIN {context} ctx ... | Exports the data relating to tool_cohortroles component on role assignments by Assign user roles to cohort feature . |
29,532 | public static function delete_data_for_user ( approved_contextlist $ contextlist ) { global $ DB ; if ( empty ( $ contextlist -> count ( ) ) ) { return ; } $ userid = $ contextlist -> get_user ( ) -> id ; $ contextids = $ contextlist -> get_contextids ( ) ; list ( $ contextsql , $ contextparams ) = $ DB -> get_in_or_eq... | Delete all user data for this user only . |
29,533 | protected static function get_roles_name ( ) { $ roles = role_fix_names ( get_all_roles ( ) , \ context_system :: instance ( ) , ROLENAME_ORIGINAL ) ; $ rolesnames = array ( ) ; foreach ( $ roles as $ role ) { $ rolesnames [ $ role -> id ] = $ role -> localname ; } return $ rolesnames ; } | Get all the localised roles name in a simple array . |
29,534 | protected static function get_permissions_name ( ) { $ strpermissions = array ( CAP_INHERIT => get_string ( 'inherit' , 'role' ) , CAP_ALLOW => get_string ( 'allow' , 'role' ) , CAP_PREVENT => get_string ( 'prevent' , 'role' ) , CAP_PROHIBIT => get_string ( 'prohibit' , 'role' ) ) ; return $ strpermissions ; } | Get all the permissions name in a simple array . |
29,535 | protected function prepare_response ( ) { try { if ( ! empty ( $ this -> function -> returns_desc ) ) { $ validatedvalues = external_api :: clean_returnvalue ( $ this -> function -> returns_desc , $ this -> returns ) ; $ encodingoptions = array ( "encoding" => "UTF-8" , "verbosity" => "no_white_space" , "escaping" => [... | Prepares the response . |
29,536 | protected function send_error ( $ ex = null ) { $ this -> response = $ this -> generate_error ( $ ex ) ; $ this -> send_headers ( ) ; echo $ this -> response ; } | Send the error information to the WS client . |
29,537 | protected function generate_error ( $ ex , $ faultcode = 404 ) { $ error = $ ex -> getMessage ( ) ; if ( ! empty ( $ ex -> errorcode ) ) { $ faultcode = base_convert ( md5 ( $ ex -> errorcode ) , 16 , 10 ) ; $ faultcode = substr ( $ faultcode , 0 , 8 ) ; if ( debugging ( ) and isset ( $ ex -> debuginfo ) ) { $ error .=... | Generate the XML - RPC fault response . |
29,538 | public static function validate_fields ( $ field , $ value ) { switch ( $ field ) { case 'minute' : case 'hour' : $ regex = "/\A\*\z|\A[0-5]?[0-9]\z|\A\*\/[0-5]?[0-9]\z|\A[0-5]?[0-9](,[0-5]?[0-9])*\z|\A[0-5]?[0-9]-[0-5]?[0-9]\z/" ; break ; case 'day' : $ regex = "/\A\*\z|\A([1-2]?[0-9]|3[0-1])\z|\A\*\/([1-2]?[0-9]|3[0-... | Helper function that validates the submitted data . |
29,539 | public static function get_file_extension ( $ mimetype ) { $ types = self :: get_types ( ) ; foreach ( $ types as $ extension => $ info ) { if ( $ info [ 'type' ] == $ mimetype ) { return $ extension ; } } return false ; } | Given a mimetype - return a valid file extension for it . |
29,540 | public static function & get_types ( ) { if ( self :: $ cachedtypes ) { return self :: $ cachedtypes ; } $ mimetypes = self :: get_default_types ( ) ; $ custom = self :: get_custom_types ( ) ; if ( ! is_array ( $ custom ) ) { debugging ( 'Invalid $CFG->customfiletypes (not array)' , DEBUG_DEVELOPER ) ; $ custom = array... | Gets all the current types . |
29,541 | protected static function get_custom_types ( ) { global $ CFG ; if ( ! empty ( $ CFG -> customfiletypes ) ) { if ( is_array ( $ CFG -> customfiletypes ) ) { return $ CFG -> customfiletypes ; } else { return json_decode ( $ CFG -> customfiletypes ) ; } } else { return array ( ) ; } } | Gets custom types from config variable after decoding the JSON if required . |
29,542 | protected static function set_custom_types ( array $ types ) { global $ CFG ; if ( array_key_exists ( 'customfiletypes' , $ CFG -> config_php_settings ) ) { throw new coding_exception ( 'Cannot set custom filetypes because they ' . 'are defined in config.php' ) ; } if ( empty ( $ types ) ) { unset_config ( 'customfilet... | Sets the custom types into config variable encoding into JSON . |
29,543 | public static function get_deleted_types ( ) { $ defaults = self :: get_default_types ( ) ; $ deleted = array ( ) ; foreach ( self :: get_custom_types ( ) as $ customentry ) { if ( ! empty ( $ customentry -> deleted ) ) { $ deleted [ $ customentry -> extension ] = $ defaults [ $ customentry -> extension ] ; } } return ... | Gets the default types that have been deleted . Returns an array containing the defaults of all those types . |
29,544 | public static function add_type ( $ extension , $ mimetype , $ coreicon , array $ groups = array ( ) , $ corestring = '' , $ customdescription = '' , $ defaulticon = false ) { $ extension = ( string ) $ extension ; if ( $ extension === '' || $ extension [ 0 ] === '.' ) { throw new coding_exception ( 'Invalid extension ... | Adds a new entry to the list of custom filetypes . |
29,545 | public static function update_type ( $ extension , $ newextension , $ mimetype , $ coreicon , array $ groups = array ( ) , $ corestring = '' , $ customdescription = '' , $ defaulticon = false ) { $ extension = ( string ) $ extension ; $ mimetypes = get_mimetypes_array ( ) ; if ( ! array_key_exists ( $ extension , $ mim... | Updates an entry in the list of filetypes in config . |
29,546 | public static function revert_type_to_default ( $ extension ) { $ extension = ( string ) $ extension ; $ defaults = self :: get_default_types ( ) ; if ( ! array_key_exists ( $ extension , $ defaults ) ) { throw new coding_exception ( 'Extension ' . $ extension . ' is not a default type' ) ; } $ changed = false ; $ cust... | Reverts a file type to the default . May only be called on types that have default values . This will undelete the type if necessary or set its values . If the type is already at default values does nothing . |
29,547 | protected static function create_config_record ( $ extension , $ mimetype , $ coreicon , array $ groups , $ corestring , $ customdescription , $ defaulticon ) { $ newentry = ( object ) array ( 'extension' => ( string ) $ extension , 'type' => ( string ) $ mimetype , 'icon' => ( string ) $ coreicon ) ; if ( $ groups ) {... | Converts function parameters into a record for storing in the JSON value . |
29,548 | public function review_page ( quiz_attempt $ attemptobj , $ slots , $ page , $ showall , $ lastpage , mod_quiz_display_options $ displayoptions , $ summarydata ) { $ output = '' ; $ output .= $ this -> header ( ) ; $ output .= $ this -> review_summary_table ( $ summarydata , $ page ) ; $ output .= $ this -> review_form... | Builds the review page |
29,549 | protected function filter_review_summary_table ( $ summarydata , $ page ) { if ( $ page == 0 ) { return $ summarydata ; } foreach ( $ summarydata as $ key => $ rowdata ) { if ( ! in_array ( $ key , array ( 'user' , 'attemptlist' ) ) ) { unset ( $ summarydata [ $ key ] ) ; } } return $ summarydata ; } | Filters the summarydata array . |
29,550 | public function review_summary_table ( $ summarydata , $ page ) { $ summarydata = $ this -> filter_review_summary_table ( $ summarydata , $ page ) ; if ( empty ( $ summarydata ) ) { return '' ; } $ output = '' ; $ output .= html_writer :: start_tag ( 'table' , array ( 'class' => 'generaltable generalbox quizreviewsumma... | Outputs the table containing data from summary data array |
29,551 | public function questions ( quiz_attempt $ attemptobj , $ reviewing , $ slots , $ page , $ showall , mod_quiz_display_options $ displayoptions ) { $ output = '' ; foreach ( $ slots as $ slot ) { $ output .= $ attemptobj -> render_question ( $ slot , $ reviewing , $ this , $ attemptobj -> review_url ( $ slot , $ page , ... | Renders each question |
29,552 | public function review_form ( $ page , $ showall , $ displayoptions , $ content , $ attemptobj ) { if ( $ displayoptions -> flags != question_display_options :: EDITABLE ) { return $ content ; } $ this -> page -> requires -> js_init_call ( 'M.mod_quiz.init_review_form' , null , false , quiz_get_js_module ( ) ) ; $ outp... | Renders the main bit of the review page . |
29,553 | public function finish_review_link ( quiz_attempt $ attemptobj ) { $ url = $ attemptobj -> view_url ( ) ; if ( $ attemptobj -> get_access_manager ( time ( ) ) -> attempt_must_be_in_popup ( ) ) { $ this -> page -> requires -> js_init_call ( 'M.mod_quiz.secure_window.init_close_button' , array ( $ url ) , false , quiz_ge... | Returns either a liink or button |
29,554 | public function countdown_timer ( quiz_attempt $ attemptobj , $ timenow ) { $ timeleft = $ attemptobj -> get_time_left_display ( $ timenow ) ; if ( $ timeleft !== false ) { $ ispreview = $ attemptobj -> is_preview ( ) ; $ timerstartvalue = $ timeleft ; if ( ! $ ispreview ) { $ timerstartvalue = max ( $ timerstartvalue ... | Return the HTML of the quiz timer . |
29,555 | public function navigation_panel ( quiz_nav_panel_base $ panel ) { $ output = '' ; $ userpicture = $ panel -> user_picture ( ) ; if ( $ userpicture ) { $ fullname = fullname ( $ userpicture -> user ) ; if ( $ userpicture -> size === true ) { $ fullname = html_writer :: div ( $ fullname ) ; } $ output .= html_writer :: ... | Outputs the navigation block panel |
29,556 | protected function render_quiz_nav_question_button ( quiz_nav_question_button $ button ) { $ classes = array ( 'qnbutton' , $ button -> stateclass , $ button -> navmethod , 'btn' , 'btn-secondary' ) ; $ extrainfo = array ( ) ; if ( $ button -> currentpage ) { $ classes [ ] = 'thispage' ; $ extrainfo [ ] = get_string ( ... | Display a quiz navigation button . |
29,557 | protected function render_mod_quiz_links_to_other_attempts ( mod_quiz_links_to_other_attempts $ links ) { $ attemptlinks = array ( ) ; foreach ( $ links -> links as $ attempt => $ url ) { if ( ! $ url ) { $ attemptlinks [ ] = html_writer :: tag ( 'strong' , $ attempt ) ; } else if ( $ url instanceof renderable ) { $ at... | outputs the link the other attempts . |
29,558 | public function quiz_notices ( $ messages ) { if ( ! $ messages ) { return '' ; } return $ this -> box ( $ this -> heading ( get_string ( 'accessnoticesheader' , 'quiz' ) , 3 ) . $ this -> access_messages ( $ messages ) , 'quizaccessnotices' ) ; } | Returns any notices . |
29,559 | public function attempt_form ( $ attemptobj , $ page , $ slots , $ id , $ nextpage ) { $ output = '' ; $ output .= html_writer :: start_tag ( 'form' , array ( 'action' => new moodle_url ( $ attemptobj -> processattempt_url ( ) , array ( 'cmid' => $ attemptobj -> get_cmid ( ) ) ) , 'method' => 'post' , 'enctype' => 'mul... | Ouputs the form for making an attempt |
29,560 | public function redo_question_button ( $ slot , $ disabled ) { $ attributes = array ( 'type' => 'submit' , 'name' => 'redoslot' . $ slot , 'value' => get_string ( 'redoquestion' , 'quiz' ) , 'class' => 'mod_quiz-redo_question_button' ) ; if ( $ disabled ) { $ attributes [ 'disabled' ] = 'disabled' ; } return html_write... | Render a button which allows students to redo a question in the attempt . |
29,561 | public function initialise_timer ( $ timerstartvalue , $ ispreview ) { $ options = array ( $ timerstartvalue , ( bool ) $ ispreview ) ; $ this -> page -> requires -> js_init_call ( 'M.mod_quiz.timer.init' , $ options , false , quiz_get_js_module ( ) ) ; } | Output the JavaScript required to initialise the countdown timer . |
29,562 | public function close_attempt_popup ( $ url , $ message = '' ) { $ output = '' ; $ output .= $ this -> header ( ) ; $ output .= $ this -> box_start ( ) ; if ( $ message ) { $ output .= html_writer :: tag ( 'p' , $ message ) ; $ output .= html_writer :: tag ( 'p' , get_string ( 'windowclosing' , 'quiz' ) ) ; $ delay = 5... | Output a page with an optional message and JavaScript code to close the current window and redirect the parent window to a new URL . |
29,563 | public function summary_page ( $ attemptobj , $ displayoptions ) { $ output = '' ; $ output .= $ this -> header ( ) ; $ output .= $ this -> heading ( format_string ( $ attemptobj -> get_quiz_name ( ) ) ) ; $ output .= $ this -> heading ( get_string ( 'summaryofattempt' , 'quiz' ) , 3 ) ; $ output .= $ this -> summary_t... | Create the summary page |
29,564 | public function summary_table ( $ attemptobj , $ displayoptions ) { $ table = new html_table ( ) ; $ table -> attributes [ 'class' ] = 'generaltable quizsummaryofattempt boxaligncenter' ; $ table -> head = array ( get_string ( 'question' , 'quiz' ) , get_string ( 'status' , 'quiz' ) ) ; $ table -> align = array ( 'left... | Generates the table of summarydata |
29,565 | public function summary_page_controls ( $ attemptobj ) { $ output = '' ; if ( $ attemptobj -> get_state ( ) == quiz_attempt :: IN_PROGRESS ) { $ button = new single_button ( new moodle_url ( $ attemptobj -> attempt_url ( null , $ attemptobj -> get_currentpage ( ) ) ) , get_string ( 'returnattempt' , 'quiz' ) ) ; $ outp... | Creates any controls a the page should have . |
29,566 | public function view_page ( $ course , $ quiz , $ cm , $ context , $ viewobj ) { $ output = '' ; $ output .= $ this -> view_information ( $ quiz , $ cm , $ context , $ viewobj -> infomessages ) ; $ output .= $ this -> view_table ( $ quiz , $ context , $ viewobj ) ; $ output .= $ this -> view_result_info ( $ quiz , $ co... | Generates the view page |
29,567 | public function view_page_buttons ( mod_quiz_view_object $ viewobj ) { global $ CFG ; $ output = '' ; if ( ! $ viewobj -> quizhasquestions ) { $ output .= $ this -> no_questions_message ( $ viewobj -> canedit , $ viewobj -> editurl ) ; } $ output .= $ this -> access_messages ( $ viewobj -> preventmessages ) ; if ( $ vi... | Work out and render whatever buttons and surrounding info should appear at the end of the review page . |
29,568 | public function start_attempt_button ( $ buttontext , moodle_url $ url , mod_quiz_preflight_check_form $ preflightcheckform = null , $ popuprequired = false , $ popupoptions = null ) { if ( is_string ( $ preflightcheckform ) ) { debugging ( 'The third argument to start_attempt_button should now be the ' . 'mod_quiz_pre... | Generates the view attempt button |
29,569 | public function no_questions_message ( $ canedit , $ editurl ) { $ output = '' ; $ output .= $ this -> notification ( get_string ( 'noquestions' , 'quiz' ) ) ; if ( $ canedit ) { $ output .= $ this -> single_button ( $ editurl , get_string ( 'editquiz' , 'quiz' ) , 'get' ) ; } return $ output ; } | Generate a message saying that this quiz has no questions with a button to go to the edit page if the user has the right capability . |
29,570 | public function view_page_guest ( $ course , $ quiz , $ cm , $ context , $ messages ) { $ output = '' ; $ output .= $ this -> view_information ( $ quiz , $ cm , $ context , $ messages ) ; $ guestno = html_writer :: tag ( 'p' , get_string ( 'guestsno' , 'quiz' ) ) ; $ liketologin = html_writer :: tag ( 'p' , get_string ... | Outputs an error message for any guests accessing the quiz |
29,571 | public function view_page_notenrolled ( $ course , $ quiz , $ cm , $ context , $ messages ) { global $ CFG ; $ output = '' ; $ output .= $ this -> view_information ( $ quiz , $ cm , $ context , $ messages ) ; $ youneedtoenrol = html_writer :: tag ( 'p' , get_string ( 'youneedtoenrol' , 'quiz' ) ) ; $ button = html_writ... | Outputs and error message for anyone who is not enrolle don the course |
29,572 | public function view_information ( $ quiz , $ cm , $ context , $ messages ) { global $ CFG ; $ output = '' ; $ output .= $ this -> heading ( format_string ( $ quiz -> name ) ) ; $ output .= $ this -> quiz_intro ( $ quiz , $ cm ) ; if ( $ messages ) { $ output .= $ this -> box ( $ this -> access_messages ( $ messages ) ... | Output the page information |
29,573 | public function quiz_intro ( $ quiz , $ cm ) { if ( html_is_blank ( $ quiz -> intro ) ) { return '' ; } return $ this -> box ( format_module_intro ( 'quiz' , $ quiz , $ cm -> id ) , 'generalbox' , 'intro' ) ; } | Output the quiz intro . |
29,574 | public function attempt_state ( $ attemptobj ) { switch ( $ attemptobj -> get_state ( ) ) { case quiz_attempt :: IN_PROGRESS : return get_string ( 'stateinprogress' , 'quiz' ) ; case quiz_attempt :: OVERDUE : return get_string ( 'stateoverdue' , 'quiz' ) . html_writer :: tag ( 'span' , get_string ( 'stateoverduedetails... | Generate a brief textual desciption of the current state of an attempt . |
29,575 | public function view_result_info ( $ quiz , $ context , $ cm , $ viewobj ) { $ output = '' ; if ( ! $ viewobj -> numattempts && ! $ viewobj -> gradecolumn && is_null ( $ viewobj -> mygrade ) ) { return $ output ; } $ resultinfo = '' ; if ( $ viewobj -> overallstats ) { if ( $ viewobj -> moreattempts ) { $ a = new stdCl... | Generates data pertaining to quiz results |
29,576 | public function review_link ( $ url , $ reviewinpopup , $ popupoptions ) { if ( $ reviewinpopup ) { $ button = new single_button ( $ url , get_string ( 'review' , 'quiz' ) ) ; $ button -> add_action ( new popup_action ( 'click' , $ url , 'quizpopup' , $ popupoptions ) ) ; return $ this -> render ( $ button ) ; } else {... | Output either a link to the review page for an attempt or a button to open the review in a popup window . |
29,577 | public function chart ( \ core \ chart_base $ chart , $ title ) { return $ this -> heading ( $ title , 3 ) . html_writer :: tag ( 'div' , $ this -> render ( $ chart ) , array ( 'class' => 'graph' ) ) ; } | Outputs a chart . |
29,578 | public function graph ( moodle_url $ url , $ title ) { global $ CFG ; $ graph = html_writer :: empty_tag ( 'img' , array ( 'src' => $ url , 'alt' => $ title ) ) ; return $ this -> heading ( $ title , 3 ) . html_writer :: tag ( 'div' , $ graph , array ( 'class' => 'graph' ) ) ; } | Output a graph or a message saying that GD is required . |
29,579 | public function connection_warning ( ) { $ options = array ( 'filter' => false , 'newlines' => false ) ; $ warning = format_text ( get_string ( 'connectionerror' , 'quiz' ) , FORMAT_MARKDOWN , $ options ) ; $ ok = format_text ( get_string ( 'connectionok' , 'quiz' ) , FORMAT_MARKDOWN , $ options ) ; return html_writer ... | Output the connection warning messages which are initially hidden and only revealed by JavaScript if necessary . |
29,580 | public static function are_requirements_met ( ) { $ enabled = ini_get ( 'apc.enabled' ) && ( php_sapi_name ( ) != "cli" || ini_get ( 'apc.enable_cli' ) ) ; if ( ! extension_loaded ( 'apcu' ) || ! $ enabled ) { return false ; } $ version = phpversion ( 'apcu' ) ; return $ version && version_compare ( $ version , self ::... | Static method to check that the APCu stores requirements have been met . |
29,581 | public function initialise ( cache_definition $ definition ) { $ this -> definition = $ definition ; $ this -> cacheprefix = $ this -> storeprefix . $ definition -> generate_definition_hash ( ) . '__' ; return true ; } | Initialises a new instance of the cache store given the definition the instance is to be used for . |
29,582 | public static function get_surveys_by_courses_returns ( ) { return new external_single_structure ( array ( 'surveys' => new external_multiple_structure ( new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'Survey id' ) , 'coursemodule' => new external_value ( PARAM_INT , 'Course module id'... | Describes the get_surveys_by_courses return value . |
29,583 | public static function get_questions ( $ surveyid ) { global $ DB , $ USER ; $ params = self :: validate_parameters ( self :: get_questions_parameters ( ) , array ( 'surveyid' => $ surveyid ) ) ; $ warnings = array ( ) ; $ survey = $ DB -> get_record ( 'survey' , array ( 'id' => $ params [ 'surveyid' ] ) , '*' , MUST_E... | Get the complete list of questions for the survey including subquestions . |
29,584 | public static function submit_answers_parameters ( ) { return new external_function_parameters ( array ( 'surveyid' => new external_value ( PARAM_INT , 'Survey id' ) , 'answers' => new external_multiple_structure ( new external_single_structure ( array ( 'key' => new external_value ( PARAM_RAW , 'Answer key' ) , 'value... | Describes the parameters for submit_answers . |
29,585 | public static function submit_answers ( $ surveyid , $ answers ) { global $ DB , $ USER ; $ params = self :: validate_parameters ( self :: submit_answers_parameters ( ) , array ( 'surveyid' => $ surveyid , 'answers' => $ answers ) ) ; $ warnings = array ( ) ; $ survey = $ DB -> get_record ( 'survey' , array ( 'id' => $... | Submit the answers for a given survey . |
29,586 | public function generate ( $ samplecontexts , $ predictions ) { global $ OUTPUT ; $ analyserclass = $ this -> target -> get_analyser_class ( ) ; $ actuallanguage = current_language ( ) ; if ( $ analyserclass :: one_sample_per_analysable ( ) ) { foreach ( $ predictions as $ prediction ) { $ context = $ samplecontexts [ ... | Generates insight notifications . |
29,587 | private function notification ( \ context $ context , \ stdClass $ user , \ moodle_url $ insighturl , string $ fullmessage , string $ fullmessagehtml ) { $ message = new \ core \ message \ message ( ) ; $ message -> component = 'moodle' ; $ message -> name = 'insights' ; $ message -> userfrom = \ core_user :: get_norep... | Generates a insight notification for the user . |
29,588 | private function get_context_courseid ( \ context $ context ) { if ( empty ( $ this -> contextcourseids [ $ context -> id ] ) ) { $ coursecontext = $ context -> get_course_context ( false ) ; if ( ! $ coursecontext ) { $ coursecontext = \ context_course :: instance ( SITEID ) ; } $ this -> contextcourseids [ $ context ... | Returns the course context of the provided context reading an internal cache first . |
29,589 | private function prediction_info ( \ core_analytics \ prediction $ prediction ) { global $ OUTPUT ; $ predictionactions = $ this -> target -> prediction_actions ( $ prediction , true , true ) ; $ fullmessageplaintext = '' ; $ messageactions = [ ] ; $ insighturl = null ; foreach ( $ predictionactions as $ action ) { $ a... | Extracts info from the prediction for display purposes . |
29,590 | private function set_notification_language ( $ user ) { global $ CFG ; if ( ! empty ( $ user -> lang ) ) { $ lang = $ user -> lang ; } else if ( isset ( $ CFG -> lang ) ) { $ lang = $ CFG -> lang ; } else { $ lang = 'en' ; } force_current_language ( $ lang ) ; } | Sets the session language to the language used by the notification receiver . |
29,591 | public static function export_item_data ( \ context $ context , int $ itemid , array $ subcontext ) { global $ DB ; $ sql = "SELECT gi.id AS instanceid, gd.id AS definitionid, gd.method FROM {grading_areas} ga JOIN {grading_definitions} gd ON gd.areaid = ga.id JOIN {gr... | Export all user data related to a context and itemid . |
29,592 | public static function delete_instance_data ( \ context $ context , int $ itemid = null ) { if ( is_null ( $ itemid ) ) { self :: delete_data_for_instances ( $ context ) ; } else { self :: delete_data_for_instances ( $ context , [ $ itemid ] ) ; } } | Deletes all user data related to a context and possibly an itemid . |
29,593 | public static function delete_data_for_instances ( \ context $ context , array $ itemids = [ ] ) { global $ DB ; $ itemsql = '' ; $ params = [ 'contextid' => $ context -> id ] ; if ( ! empty ( $ itemids ) ) { list ( $ itemsql , $ itemparams ) = $ DB -> get_in_or_equal ( $ itemids , SQL_PARAMS_NAMED ) ; $ params = array... | Deletes all user data related to a context and possibly itemids . |
29,594 | protected static function export_grading_instances ( \ context $ context , array $ subcontext , int $ definitionid , int $ userid = 0 ) { global $ DB ; $ params = [ 'definitionid' => $ definitionid ] ; if ( ! empty ( $ userid ) ) { $ params [ 'raterid' ] = $ userid ; } $ instances = $ DB -> get_recordset ( 'grading_ins... | Exports the data related to grading instances within the specified definition . |
29,595 | public function delete_instance ( $ instance ) { global $ DB ; $ tool = $ DB -> get_record ( 'enrol_lti_tools' , array ( 'enrolid' => $ instance -> id ) , 'id' , MUST_EXIST ) ; $ DB -> delete_records ( 'enrol_lti_users' , array ( 'toolid' => $ tool -> id ) ) ; $ rsmapping = $ DB -> get_recordset ( 'enrol_lti_tool_consu... | Delete plugin specific information . |
29,596 | public function unenrol_user ( stdClass $ instance , $ userid ) { global $ DB ; if ( $ tool = $ DB -> get_record ( 'enrol_lti_tools' , array ( 'enrolid' => $ instance -> id ) , 'id' ) ) { $ DB -> delete_records ( 'enrol_lti_users' , array ( 'userid' => $ userid , 'toolid' => $ tool -> id ) ) ; } parent :: unenrol_user ... | Handles un - enrolling a user . |
29,597 | protected function recode_choice_order ( $ order ) { $ neworder = array ( ) ; foreach ( explode ( ',' , $ order ) as $ id ) { if ( $ newid = $ this -> get_mappingid ( 'question_answer' , $ id ) ) { $ neworder [ ] = $ newid ; } } return implode ( ',' , $ neworder ) ; } | Recode the choice order as stored in the response . |
29,598 | public function recode_legacy_state_answer ( $ state ) { $ answer = $ state -> answer ; $ orderarr = array ( ) ; $ responsesarr = array ( ) ; $ lists = explode ( ':' , $ answer ) ; if ( count ( $ lists ) == 1 ) { $ lists [ 1 ] = $ lists [ 0 ] ; $ lists [ 0 ] = '' ; } if ( ! empty ( $ lists [ 0 ] ) ) { foreach ( explode... | Given one question_states record return the answer recoded pointing to all the restored stuff for multichoice questions |
29,599 | public function setLogger ( $ logger = null ) { if ( $ logger !== null && ! ( $ logger instanceof Mustache_Logger || is_a ( $ logger , 'Psr\\Log\\LoggerInterface' ) ) ) { throw new Mustache_Exception_InvalidArgumentException ( 'Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.' ) ; } $ this -> logge... | Set a logger instance . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.