idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
29,100 | private static function attempt_structure ( ) { return new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'Attempt id.' , VALUE_OPTIONAL ) , 'quiz' => new external_value ( PARAM_INT , 'Foreign key reference to the quiz that was attempted.' , VALUE_OPTIONAL ) , 'userid' => new external_valu... | Describes a single attempt structure . |
29,101 | public static function get_user_best_grade ( $ quizid , $ userid = 0 ) { global $ DB , $ USER ; $ warnings = array ( ) ; $ params = array ( 'quizid' => $ quizid , 'userid' => $ userid , ) ; $ params = self :: validate_parameters ( self :: get_user_best_grade_parameters ( ) , $ params ) ; list ( $ quiz , $ course , $ cm... | Get the best current grade for the given user on a quiz . |
29,102 | public static function get_combined_review_options ( $ quizid , $ userid = 0 ) { global $ DB , $ USER ; $ warnings = array ( ) ; $ params = array ( 'quizid' => $ quizid , 'userid' => $ userid , ) ; $ params = self :: validate_parameters ( self :: get_combined_review_options_parameters ( ) , $ params ) ; list ( $ quiz ,... | Combines the review options from a number of different quiz attempts . |
29,103 | public static function get_combined_review_options_returns ( ) { return new external_single_structure ( array ( 'someoptions' => new external_multiple_structure ( new external_single_structure ( array ( 'name' => new external_value ( PARAM_ALPHANUMEXT , 'option name' ) , 'value' => new external_value ( PARAM_INT , 'opt... | Describes the get_combined_review_options return value . |
29,104 | public static function start_attempt_parameters ( ) { return new external_function_parameters ( array ( 'quizid' => new external_value ( PARAM_INT , 'quiz instance id' ) , 'preflightdata' => new external_multiple_structure ( new external_single_structure ( array ( 'name' => new external_value ( PARAM_ALPHANUMEXT , 'dat... | Describes the parameters for start_attempt . |
29,105 | public static function start_attempt ( $ quizid , $ preflightdata = array ( ) , $ forcenew = false ) { global $ DB , $ USER ; $ warnings = array ( ) ; $ attempt = array ( ) ; $ params = array ( 'quizid' => $ quizid , 'preflightdata' => $ preflightdata , 'forcenew' => $ forcenew , ) ; $ params = self :: validate_paramet... | Starts a new attempt at a quiz . |
29,106 | protected static function validate_attempt ( $ params , $ checkaccessrules = true , $ failifoverdue = true ) { global $ USER ; $ attemptobj = quiz_attempt :: create ( $ params [ 'attemptid' ] ) ; $ context = context_module :: instance ( $ attemptobj -> get_cm ( ) -> id ) ; self :: validate_context ( $ context ) ; if ( ... | Utility function for validating a given attempt |
29,107 | private static function question_structure ( ) { return new external_single_structure ( array ( 'slot' => new external_value ( PARAM_INT , 'slot number' ) , 'type' => new external_value ( PARAM_ALPHANUMEXT , 'question type, i.e: multichoice' ) , 'page' => new external_value ( PARAM_INT , 'page of the quiz this question... | Describes a single question structure . |
29,108 | private static function get_attempt_questions_data ( quiz_attempt $ attemptobj , $ review , $ page = 'all' ) { global $ PAGE ; $ questions = array ( ) ; $ contextid = $ attemptobj -> get_quizobj ( ) -> get_context ( ) -> id ; $ displayoptions = $ attemptobj -> get_display_options ( $ review ) ; $ renderer = $ PAGE -> g... | Return questions information for a given attempt . |
29,109 | public static function get_attempt_data_parameters ( ) { return new external_function_parameters ( array ( 'attemptid' => new external_value ( PARAM_INT , 'attempt id' ) , 'page' => new external_value ( PARAM_INT , 'page number' ) , 'preflightdata' => new external_multiple_structure ( new external_single_structure ( ar... | Describes the parameters for get_attempt_data . |
29,110 | public static function get_attempt_data ( $ attemptid , $ page , $ preflightdata = array ( ) ) { $ warnings = array ( ) ; $ params = array ( 'attemptid' => $ attemptid , 'page' => $ page , 'preflightdata' => $ preflightdata , ) ; $ params = self :: validate_parameters ( self :: get_attempt_data_parameters ( ) , $ param... | Returns information for the given attempt page for a quiz attempt in progress . |
29,111 | public static function get_attempt_data_returns ( ) { return new external_single_structure ( array ( 'attempt' => self :: attempt_structure ( ) , 'messages' => new external_multiple_structure ( new external_value ( PARAM_TEXT , 'access message' ) , 'access messages, will only be returned for users with mod/quiz:preview... | Describes the get_attempt_data return value . |
29,112 | public static function get_attempt_summary ( $ attemptid , $ preflightdata = array ( ) ) { $ warnings = array ( ) ; $ params = array ( 'attemptid' => $ attemptid , 'preflightdata' => $ preflightdata , ) ; $ params = self :: validate_parameters ( self :: get_attempt_summary_parameters ( ) , $ params ) ; list ( $ attempt... | Returns a summary of a quiz attempt before it is submitted . |
29,113 | public static function save_attempt_parameters ( ) { return new external_function_parameters ( array ( 'attemptid' => new external_value ( PARAM_INT , 'attempt id' ) , 'data' => new external_multiple_structure ( new external_single_structure ( array ( 'name' => new external_value ( PARAM_RAW , 'data name' ) , 'value' =... | Describes the parameters for save_attempt . |
29,114 | public static function save_attempt ( $ attemptid , $ data , $ preflightdata = array ( ) ) { global $ DB ; $ warnings = array ( ) ; $ params = array ( 'attemptid' => $ attemptid , 'data' => $ data , 'preflightdata' => $ preflightdata , ) ; $ params = self :: validate_parameters ( self :: save_attempt_parameters ( ) , $... | Processes save requests during the quiz . This function is intended for the quiz auto - save feature . |
29,115 | public static function process_attempt_parameters ( ) { return new external_function_parameters ( array ( 'attemptid' => new external_value ( PARAM_INT , 'attempt id' ) , 'data' => new external_multiple_structure ( new external_single_structure ( array ( 'name' => new external_value ( PARAM_RAW , 'data name' ) , 'value... | Describes the parameters for process_attempt . |
29,116 | public static function process_attempt ( $ attemptid , $ data , $ finishattempt = false , $ timeup = false , $ preflightdata = array ( ) ) { $ warnings = array ( ) ; $ params = array ( 'attemptid' => $ attemptid , 'data' => $ data , 'finishattempt' => $ finishattempt , 'timeup' => $ timeup , 'preflightdata' => $ prefli... | Process responses during an attempt at a quiz and also deals with attempts finishing . |
29,117 | protected static function validate_attempt_review ( $ params ) { $ attemptobj = quiz_attempt :: create ( $ params [ 'attemptid' ] ) ; $ attemptobj -> check_review_capability ( ) ; $ displayoptions = $ attemptobj -> get_display_options ( true ) ; if ( $ attemptobj -> is_own_attempt ( ) ) { if ( ! $ attemptobj -> is_fini... | Validate an attempt finished for review . The attempt would be reviewed by a user or a teacher . |
29,118 | public static function get_attempt_review ( $ attemptid , $ page = - 1 ) { global $ PAGE ; $ warnings = array ( ) ; $ params = array ( 'attemptid' => $ attemptid , 'page' => $ page , ) ; $ params = self :: validate_parameters ( self :: get_attempt_review_parameters ( ) , $ params ) ; list ( $ attemptobj , $ displayopti... | Returns review information for the given finished attempt can be used by users or teachers . |
29,119 | public static function get_attempt_review_returns ( ) { return new external_single_structure ( array ( 'grade' => new external_value ( PARAM_RAW , 'grade for the quiz (or empty or "notyetgraded")' ) , 'attempt' => self :: attempt_structure ( ) , 'additionaldata' => new external_multiple_structure ( new external_single_... | Describes the get_attempt_review return value . |
29,120 | public static function view_attempt ( $ attemptid , $ page , $ preflightdata = array ( ) ) { $ warnings = array ( ) ; $ params = array ( 'attemptid' => $ attemptid , 'page' => $ page , 'preflightdata' => $ preflightdata , ) ; $ params = self :: validate_parameters ( self :: view_attempt_parameters ( ) , $ params ) ; li... | Trigger the attempt viewed event . |
29,121 | public static function view_attempt_summary ( $ attemptid , $ preflightdata = array ( ) ) { $ warnings = array ( ) ; $ params = array ( 'attemptid' => $ attemptid , 'preflightdata' => $ preflightdata , ) ; $ params = self :: validate_parameters ( self :: view_attempt_summary_parameters ( ) , $ params ) ; list ( $ attem... | Trigger the attempt summary viewed event . |
29,122 | public static function view_attempt_review ( $ attemptid ) { $ warnings = array ( ) ; $ params = array ( 'attemptid' => $ attemptid , ) ; $ params = self :: validate_parameters ( self :: view_attempt_review_parameters ( ) , $ params ) ; list ( $ attemptobj , $ displayoptions ) = self :: validate_attempt_review ( $ para... | Trigger the attempt reviewed event . |
29,123 | public static function get_quiz_feedback_for_grade ( $ quizid , $ grade ) { global $ DB ; $ params = array ( 'quizid' => $ quizid , 'grade' => $ grade , ) ; $ params = self :: validate_parameters ( self :: get_quiz_feedback_for_grade_parameters ( ) , $ params ) ; $ warnings = array ( ) ; list ( $ quiz , $ course , $ cm... | Get the feedback text that should be show to a student who got the given grade in the given quiz . |
29,124 | public static function get_quiz_access_information ( $ quizid ) { global $ DB , $ USER ; $ warnings = array ( ) ; $ params = array ( 'quizid' => $ quizid ) ; $ params = self :: validate_parameters ( self :: get_quiz_access_information_parameters ( ) , $ params ) ; list ( $ quiz , $ course , $ cm , $ context ) = self ::... | Return access information for a given quiz . |
29,125 | public static function get_quiz_access_information_returns ( ) { return new external_single_structure ( array ( 'canattempt' => new external_value ( PARAM_BOOL , 'Whether the user can do the quiz or not.' ) , 'canmanage' => new external_value ( PARAM_BOOL , 'Whether the user can edit the quiz settings or not.' ) , 'can... | Describes the get_quiz_access_information return value . |
29,126 | public static function get_attempt_access_information ( $ quizid , $ attemptid = 0 ) { global $ DB , $ USER ; $ warnings = array ( ) ; $ params = array ( 'quizid' => $ quizid , 'attemptid' => $ attemptid , ) ; $ params = self :: validate_parameters ( self :: get_attempt_access_information_parameters ( ) , $ params ) ; ... | Return access information for a given attempt in a quiz . |
29,127 | public static function get_attempt_access_information_returns ( ) { return new external_single_structure ( array ( 'endtime' => new external_value ( PARAM_INT , 'When the attempt must be submitted (determined by rules).' , VALUE_OPTIONAL ) , 'isfinished' => new external_value ( PARAM_BOOL , 'Whether there is no way the... | Describes the get_attempt_access_information return value . |
29,128 | public static function get_quiz_required_qtypes ( $ quizid ) { global $ DB , $ USER ; $ warnings = array ( ) ; $ params = array ( 'quizid' => $ quizid ) ; $ params = self :: validate_parameters ( self :: get_quiz_required_qtypes_parameters ( ) , $ params ) ; list ( $ quiz , $ course , $ cm , $ context ) = self :: valid... | Return the potential question types that would be required for a given quiz . Please note that for random question types we return the potential question types in the category choosen . |
29,129 | public function col_name ( $ tool ) { $ name = helper :: get_name ( $ tool ) ; return $ this -> get_display_text ( $ tool , $ name ) ; } | Generate the name column . |
29,130 | public function col_launch ( $ tool ) { global $ OUTPUT ; $ url = helper :: get_cartridge_url ( $ tool ) ; $ cartridgeurllabel = get_string ( 'cartridgeurl' , 'enrol_lti' ) ; $ cartridgeurl = $ url ; $ secretlabel = get_string ( 'secret' , 'enrol_lti' ) ; $ secret = $ tool -> secret ; $ launchurl = helper :: get_launch... | Generate the launch column . |
29,131 | public function col_registration ( $ tool ) { global $ OUTPUT ; $ url = helper :: get_proxy_url ( $ tool ) ; $ toolurllabel = get_string ( "registrationurl" , "enrol_lti" ) ; $ toolurl = $ url ; $ data = [ "rows" => [ [ "label" => $ toolurllabel , "text" => $ toolurl , "id" => "toolurl" , "hidelabel" => true ] , ] ] ; ... | Generate the Registration column . |
29,132 | public function col_edit ( $ tool ) { global $ OUTPUT ; $ buttons = array ( ) ; $ instance = new \ stdClass ( ) ; $ instance -> id = $ tool -> enrolid ; $ instance -> courseid = $ tool -> courseid ; $ instance -> enrol = 'lti' ; $ instance -> status = $ tool -> status ; $ strdelete = get_string ( 'delete' ) ; $ strenab... | Generate the edit column . |
29,133 | protected function get_display_text ( $ tool , $ text ) { if ( $ tool -> status != ENROL_INSTANCE_ENABLED ) { return \ html_writer :: tag ( 'span' , $ text , array ( 'class' => 'dimmed_text' ) ) ; } return $ text ; } | Returns text to display in the columns . |
29,134 | protected static function transform_token ( $ record ) { $ notexportedstr = get_string ( 'privacy:request:notexportedsecurity' , 'core_webservice' ) ; return [ 'external_service' => $ record -> externalservicename , 'token' => $ notexportedstr , 'private_token' => $ record -> privatetoken ? $ notexportedstr : null , 'i... | Transform a token entry . |
29,135 | public static function get_courseid_from_type_id ( $ type , $ id ) { global $ DB ; if ( $ type == backup :: TYPE_1COURSE ) { return $ id ; } else if ( $ type == backup :: TYPE_1SECTION ) { if ( ! $ courseid = $ DB -> get_field ( 'course_sections' , 'course' , array ( 'id' => $ id ) ) ) { throw new backup_dbops_exceptio... | Given one type and id from controller return the corresponding courseid |
29,136 | public static function apply_version_and_release ( ) { global $ CFG ; if ( $ CFG -> backup_version < backup :: VERSION ) { set_config ( 'backup_version' , backup :: VERSION ) ; set_config ( 'backup_release' , backup :: RELEASE ) ; } } | Update CFG - > backup_version and CFG - > backup_release if change in version is detected . |
29,137 | public static function backup_includes_mnet_remote_users ( $ backupid ) { global $ CFG , $ DB ; $ sql = "SELECT COUNT(*) FROM {backup_ids_temp} b JOIN {user} u ON u.id = b.itemid WHERE b.backupid = ? AND b.itemname = 'userfinal' AND u... | Given the backupid detect if the backup includes mnet remote users or no |
29,138 | public static function backup_includes_files ( $ backupid ) { if ( self :: $ includesfilescachebackupid === $ backupid ) { return self :: $ includesfilescache ; } self :: $ includesfilescachebackupid = $ backupid ; $ bc = self :: load_controller ( $ backupid ) ; self :: $ includesfilescache = $ bc -> get_include_files ... | Given the backupid determine whether this backup should include files from the moodle file storage system . |
29,139 | public static function backup_includes_file_references ( $ backupid ) { global $ CFG , $ DB ; $ sql = "SELECT count(r.repositoryid) FROM {files} f LEFT JOIN {files_reference} r ON r.id = f.referencefileid JOIN {backup_ids_temp} bi ... | Given the backupid detect if the backup contains references to external contents |
29,140 | public static function apply_config_defaults ( backup_controller $ controller ) { $ mode = $ controller -> get_mode ( ) ; switch ( $ mode ) { case backup :: MODE_GENERAL : $ settings = array ( 'backup_general_users' => 'users' , 'backup_general_anonymize' => 'anonymize' , 'backup_general_role_assignments' => 'role_assi... | Sets the default values for the settings in a backup operation |
29,141 | public static function get_progress ( $ backupid ) { global $ DB ; $ progress = array ( ) ; $ backuprecord = $ DB -> get_record ( 'backup_controllers' , array ( 'backupid' => $ backupid ) , 'status, progress, operation' , MUST_EXIST ) ; $ status = $ backuprecord -> status ; $ progress = $ backuprecord -> progress ; $ o... | Get the progress details of a backup operation . Get backup records directly from database if the backup has successfully completed there will be no controller object to load . |
29,142 | public function process_logstore_standard_log ( $ data ) { global $ DB ; $ data = $ this -> process_log ( $ data , get_config ( 'logstore_standard' , 'jsonformat' ) ) ; if ( $ data ) { $ DB -> insert_record ( 'logstore_standard_log' , $ data ) ; } } | Process logstore_standard_log entries . |
29,143 | public function set_data ( $ datavalue , $ datakey = null ) { $ this -> datavalue = $ datavalue ; $ this -> set_data_key ( $ datakey ) ; } | Specify an integer data item value for this record . |
29,144 | public function fetch_data_key ( ) { global $ CFG , $ DB ; if ( ! isset ( $ CFG -> messageinbound_enabled ) || ! $ this -> handler || ! $ this -> handler -> enabled ) { return null ; } if ( ! isset ( $ this -> datakey ) ) { $ datakey = $ DB -> get_field ( 'messageinbound_datakeys' , 'datakey' , array ( 'handler' => $ t... | Return the data key for the data item . |
29,145 | protected function generate_data_key ( ) { global $ DB ; $ key = new \ stdClass ( ) ; $ key -> handler = $ this -> handler -> id ; $ key -> datavalue = $ this -> datavalue ; $ key -> datakey = md5 ( $ this -> datavalue . '_' . time ( ) . random_string ( 40 ) ) ; $ key -> timecreated = time ( ) ; if ( $ this -> handler ... | Generate a new secret key for the current data item and handler combination . |
29,146 | public function generate ( $ userid , $ userkey = null ) { global $ CFG ; if ( ! manager :: is_enabled ( ) ) { return null ; } if ( $ userkey == null ) { $ userkey = get_user_key ( 'messageinbound_handler' , $ userid ) ; } if ( ! isset ( $ this -> handler ) || ! $ this -> handler ) { throw new \ coding_exception ( 'Inb... | Generate an e - mail address for the Inbound Message handler storing a private key for the data object if one was not specified . |
29,147 | protected function process ( $ address ) { global $ DB ; if ( ! self :: is_correct_format ( $ address ) ) { return ; } $ this -> record = null ; $ record = new \ stdClass ( ) ; $ record -> address = $ address ; list ( $ localpart ) = explode ( '@' , $ address , 2 ) ; list ( $ record -> mailbox , $ encodeddata ) = explo... | Process an inbound address to obtain the data stored within it . |
29,148 | protected function validate ( $ address ) { if ( ! $ this -> record ) { return self :: VALIDATION_INVALID_ADDRESS_FORMAT ; } $ returnvalue = 0 ; if ( ! $ this -> handler ) { $ returnvalue += self :: VALIDATION_UNKNOWN_HANDLER ; } else if ( ! $ this -> handler -> enabled ) { $ returnvalue += self :: VALIDATION_DISABLED_... | Ensure that the parsed data is valid and if the handler requires address validation validate the sender against the user record of identified user record . |
29,149 | public function process_envelope ( $ recipient , $ sender ) { $ this -> process ( $ recipient ) ; $ this -> status = $ this -> validate ( $ sender ) ; return $ this -> status ; } | Process the message recipient load the handler and then validate the sender with the associated data record . |
29,150 | public function handle_message ( \ stdClass $ messagedata ) { $ this -> record = $ this -> get_data ( ) ; return $ this -> handler -> process_message ( $ this -> record , $ messagedata ) ; } | Process the message against the relevant handler . |
29,151 | protected function pack_int ( $ int ) { if ( PHP_INT_SIZE === 8 ) { $ left = 0xffffffff00000000 ; $ right = 0x00000000ffffffff ; $ l = ( $ int & $ left ) >> 32 ; $ r = $ int & $ right ; return pack ( 'NN' , $ l , $ r ) ; } else { return pack ( 'NN' , 0 , $ int ) ; } } | Pack an integer into a pair of 32 - bit numbers . |
29,152 | public function position ( $ l = null , $ c = null ) { $ this -> line = $ l ; $ this -> col = $ c ; } | Sets the position of the token in the source document . |
29,153 | public static function toAscii ( $ str ) { $ methods = array ( '_intlToAscii' , '_iconvToAscii' , '_fallbackToAscii' ) ; foreach ( $ methods as $ val ) { if ( ( $ out = call_user_func ( array ( __CLASS__ , $ val ) , $ str ) ) !== false ) { return $ out ; } } return $ str ; } | Transliterates an UTF - 8 string to ASCII replacing non - English characters to their English equivalents . |
29,154 | protected static function _intlToAscii ( $ str ) { if ( class_exists ( 'Transliterator' ) ) { if ( ! isset ( self :: $ _transliterator ) ) { self :: $ _transliterator = Transliterator :: create ( 'Any-Latin; Latin-ASCII' ) ; } if ( ! is_null ( self :: $ _transliterator ) ) { return self :: $ _transliterator -> translit... | Transliterate using the Transliterator package . |
29,155 | protected function get_footer ( $ feedrecords ) { global $ PAGE ; $ footer = null ; if ( $ this -> config -> block_rss_client_show_channel_link ) { global $ CFG ; require_once ( $ CFG -> libdir . '/simplepie/moodle_simplepie.php' ) ; $ feedrecord = array_pop ( $ feedrecords ) ; $ feed = new moodle_simplepie ( $ feedrec... | Gets the footer which is the channel link of the last feed in our list of feeds |
29,156 | public function get_feed ( $ feedrecord , $ maxentries , $ showtitle ) { global $ CFG ; require_once ( $ CFG -> libdir . '/simplepie/moodle_simplepie.php' ) ; if ( $ feedrecord -> skipuntil ) { $ this -> hasfailedfeeds = true ; return null ; } $ simplepiefeed = new moodle_simplepie ( $ feedrecord -> url ) ; if ( isset ... | Returns the html of a feed to be displaed in the block |
29,157 | function format_title ( $ title , $ max = 64 ) { if ( core_text :: strlen ( $ title ) <= $ max ) { return $ title ; } else { return core_text :: substr ( $ title , 0 , $ max - 3 ) . '...' ; } } | Strips a large title to size and adds ... if title too long This function does not escape HTML entities so they have to be escaped before being passed here . |
29,158 | public function setup_table ( ) { if ( $ this -> showrank [ 'any' ] ) { $ tablecolumns = array ( 'coursename' , 'grade' , 'rank' ) ; $ tableheaders = array ( $ this -> get_lang_string ( 'coursename' , 'grades' ) , $ this -> get_lang_string ( 'grade' ) , $ this -> get_lang_string ( 'rank' , 'grades' ) ) ; } else { $ tab... | Prepares the headers and attributes of the flexitable . |
29,159 | public function fill_table ( $ activitylink = false , $ studentcoursesonly = false ) { global $ CFG , $ DB , $ OUTPUT , $ USER ; if ( $ studentcoursesonly && count ( $ this -> studentcourseids ) == 0 ) { return false ; } if ( $ this -> courses ) { $ coursesdata = $ this -> setup_courses_data ( $ studentcoursesonly ) ; ... | Fill the table for displaying . |
29,160 | public function print_table ( $ return = false ) { ob_start ( ) ; $ this -> table -> print_html ( ) ; $ html = ob_get_clean ( ) ; if ( $ return ) { return $ html ; } else { echo $ html ; } } | Prints or returns the HTML from the flexitable . |
29,161 | public function print_teacher_table ( ) { $ table = new html_table ( ) ; $ table -> head = array ( get_string ( 'coursename' , 'grades' ) ) ; $ table -> data = null ; foreach ( $ this -> teachercourses as $ courseid => $ course ) { $ url = new moodle_url ( '/grade/report/index.php' , array ( 'id' => $ courseid ) ) ; $ ... | Print a table to show courses that the user is able to grade . |
29,162 | public static function check_access ( $ systemcontext , $ context , $ personalcontext , $ course , $ userid ) { global $ USER ; $ access = false ; if ( has_capability ( 'moodle/grade:viewall' , $ systemcontext ) ) { $ access = true ; } else if ( has_capability ( 'moodle/grade:viewall' , $ context ) ) { $ access = true ... | Check if the user can access the report . |
29,163 | public static function viewed ( $ context , $ courseid , $ userid ) { $ event = \ gradereport_overview \ event \ grade_report_viewed :: create ( array ( 'context' => $ context , 'courseid' => $ courseid , 'relateduserid' => $ userid , ) ) ; $ event -> trigger ( ) ; } | Trigger the grade_report_viewed event |
29,164 | function is_valid_value ( $ value ) { if ( is_array ( $ value ) ) { if ( ! $ this -> val_multi ) { return false ; } else { foreach ( $ value as $ oneval ) { if ( ! rfc2445_is_valid_value ( $ oneval , $ this -> val_type ) ) { return false ; } } } return true ; } return rfc2445_is_valid_value ( $ value , $ this -> val_ty... | Only data type validation is done here |
29,165 | public function on_elements_end ( ) { $ numofrubrics = 0 ; foreach ( $ this -> rubrics as $ itemid => $ levels ) { $ numofrubrics += count ( $ levels ) ; } if ( $ numofrubrics == 0 ) { $ this -> convert_legacy_criterion_elements ( ) ; } else { $ this -> convert_legacy_rubric_elements ( ) ; } } | Processes gathered elements and rubrics |
29,166 | protected function convert_legacy_criterion_elements ( ) { $ this -> write_xml ( 'workshopform_rubric_config' , array ( 'layout' => 'list' ) ) ; $ firstelement = reset ( $ this -> elements ) ; if ( $ firstelement === false ) { return ; } $ this -> xmlwriter -> begin_tag ( 'workshopform_rubric_dimension' , array ( 'id' ... | Processes gathered elements coming from the legacy criterion strategy |
29,167 | protected function convert_legacy_rubric_elements ( ) { $ this -> write_xml ( 'workshopform_rubric_config' , array ( 'layout' => 'grid' ) ) ; foreach ( $ this -> elements as $ element ) { $ this -> xmlwriter -> begin_tag ( 'workshopform_rubric_dimension' , array ( 'id' => $ element [ 'id' ] ) ) ; $ this -> xmlwriter ->... | Processes gathered elements coming from the legacy rubric strategy |
29,168 | public function import_resource ( DOMElement & $ node , cc_i_manifest & $ doc ) { $ searchstr = "//imscc:manifest[@identifier='" . $ doc -> manifestID ( ) . "']/imscc:resources/imscc:resource" ; $ this -> identifier = $ this -> get_attr_value ( $ node , "identifier" ) ; $ this -> type = $ this -> get_attr_value ( $ nod... | Import a resource |
29,169 | public function process_resource ( $ manifestroot , & $ fname , $ folder ) { $ file = empty ( $ folder ) ? $ manifestroot . '/' . $ fname : $ manifestroot . '/' . $ folder . '/' . $ fname ; if ( ! file_exists ( $ file ) && $ this -> throwonerror ) { throw new Exception ( 'The file doesnt exist!' ) ; } GetDepFiles ( $ m... | Process a resource |
29,170 | public static function get_course_progress_percentage ( $ course , $ userid = 0 ) { global $ USER ; if ( empty ( $ userid ) ) { $ userid = $ USER -> id ; } $ completion = new \ completion_info ( $ course ) ; if ( ! $ completion -> is_enabled ( ) ) { return null ; } if ( ! $ completion -> is_tracked_user ( $ userid ) ) ... | Returns the course percentage completed by a certain user returns null if no completion data is available . |
29,171 | public static function changeBrightness ( $ hex , $ adjustPercentage ) { $ rgba = ( strlen ( $ hex ) == 8 ) ; $ red = self :: getRed ( $ hex , false ) ; $ green = self :: getGreen ( $ hex , false ) ; $ blue = self :: getBlue ( $ hex , false ) ; if ( $ adjustPercentage > 0 ) { $ red += ( 255 - $ red ) * $ adjustPercenta... | Adjust the brightness of a color |
29,172 | public function is_disabled ( ) { $ locked = 0 ; $ gradeitemlocked = 0 ; $ overridden = 0 ; if ( ! empty ( $ this -> grade -> locked ) ) { $ locked = 1 ; } if ( ! empty ( $ this -> grade -> grade_item -> locked ) ) { $ gradeitemlocked = 1 ; } if ( $ this -> grade -> grade_item -> is_overridable_item ( ) and ! $ this ->... | Determine if this input should be disabled based on the other settings . |
29,173 | public function determine_format ( ) { return new text_attribute ( $ this -> get_name ( ) , $ this -> get_value ( ) , $ this -> get_label ( ) , $ this -> is_disabled ( ) ) ; } | Create a text_attribute for this ui element . |
29,174 | public function set ( $ value ) { $ finalgrade = false ; $ trimmed = trim ( $ value ) ; if ( empty ( $ trimmed ) ) { $ feedback = null ; } else { $ feedback = $ value ; } $ this -> grade -> grade_item -> update_final_grade ( $ this -> grade -> userid , $ finalgrade , 'singleview' , $ feedback , FORMAT_MOODLE ) ; } | Update the value for this input . |
29,175 | public function get_items ( $ hasvalueonly = false ) { global $ DB ; if ( $ this -> allitems === null ) { if ( $ this -> templateid ) { $ this -> allitems = $ DB -> get_records ( 'feedback_item' , [ 'template' => $ this -> templateid ] , 'position' ) ; } else { $ this -> allitems = $ DB -> get_records ( 'feedback_item'... | Get all items in this feedback or this template |
29,176 | public function is_empty ( ) { $ items = $ this -> get_items ( ) ; $ displayeditems = array_filter ( $ items , function ( $ item ) { return $ item -> typ !== 'pagebreak' ; } ) ; return ! $ displayeditems ; } | Is the items list empty? |
29,177 | public function page_after_submit ( ) { global $ CFG ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; $ pageaftersubmit = $ this -> get_feedback ( ) -> page_after_submit ; if ( empty ( $ pageaftersubmit ) ) { return null ; } $ pageaftersubmitformat = $ this -> get_feedback ( ) -> page_after_submitformat ; $ contex... | Returns the formatted text of the page after submit or null if it is not set |
29,178 | public function can_view_analysis ( ) { global $ USER ; $ context = context_module :: instance ( $ this -> cm -> id ) ; if ( has_capability ( 'mod/feedback:viewreports' , $ context , $ this -> userid ) ) { return true ; } if ( intval ( $ this -> get_feedback ( ) -> publish_stats ) != 1 || ! has_capability ( 'mod/feedba... | Checks if current user is able to view feedback on this course . |
29,179 | public function is_already_submitted ( $ anycourseid = false ) { global $ DB , $ USER ; if ( ( ! isloggedin ( ) && $ USER -> id == $ this -> userid ) || isguestuser ( $ this -> userid ) ) { return false ; } $ params = array ( 'userid' => $ this -> userid , 'feedback' => $ this -> feedback -> id ) ; if ( ! $ anycourseid... | check for multiple_submit = false . if the feedback is global so the courseid must be given |
29,180 | public function check_course_is_mapped ( ) { global $ DB ; if ( $ this -> feedback -> course != SITEID ) { return true ; } if ( $ DB -> get_records ( 'feedback_sitecourse_map' , array ( 'feedbackid' => $ this -> feedback -> id ) ) ) { $ params = array ( 'feedbackid' => $ this -> feedback -> id , 'courseid' => $ this ->... | Check whether the feedback is mapped to the given courseid . |
29,181 | public function shuffle_anonym_responses ( ) { global $ DB ; $ params = array ( 'feedback' => $ this -> feedback -> id , 'random_response' => 0 , 'anonymous_response' => FEEDBACK_ANONYMOUS_YES ) ; if ( $ DB -> count_records ( 'feedback_completed' , $ params , 'random_response' ) ) { unset ( $ params [ 'random_response'... | If there are any new responses to the anonymous feedback re - shuffle all responses and assign response number to each of them . |
29,182 | public function get_completed_courses ( ) { global $ DB ; if ( $ this -> get_feedback ( ) -> course != SITEID ) { return [ ] ; } if ( $ this -> allcourses !== null ) { return $ this -> allcourses ; } $ courseselect = "SELECT fbc.courseid FROM {feedback_completed} fbc WHERE fbc.feedback = :feedback... | For the frontpage feedback returns the list of courses with at least one completed feedback |
29,183 | function _Execute ( $ sql , $ inputarr = false ) { global $ ADODB_COUNTRECS ; if ( $ this -> _logsql ) { $ savecrecs = $ ADODB_COUNTRECS ; $ ADODB_COUNTRECS = true ; $ ret = ADOConnection :: _Execute ( $ sql , $ inputarr ) ; $ ADODB_COUNTRECS = $ savecrecs ; } else { $ ret = ADOConnection :: _Execute ( $ sql , $ inputa... | it appears that ibase extension cannot support multiple concurrent queryid s |
29,184 | function _ConvertFieldType ( & $ fld , $ ftype , $ flen , $ fscale , $ fsubtype , $ fprecision , $ dialect3 ) { $ fscale = abs ( $ fscale ) ; $ fld -> max_length = $ flen ; $ fld -> scale = null ; switch ( $ ftype ) { case 7 : case 8 : if ( $ dialect3 ) { switch ( $ fsubtype ) { case 0 : $ fld -> type = ( $ ftype == 7 ... | OPN STUFF start |
29,185 | function MetaColumns ( $ table , $ normalize = true ) { global $ ADODB_FETCH_MODE ; $ save = $ ADODB_FETCH_MODE ; $ ADODB_FETCH_MODE = ADODB_FETCH_NUM ; $ rs = $ this -> Execute ( sprintf ( $ this -> metaColumnsSQL , strtoupper ( $ table ) ) ) ; $ ADODB_FETCH_MODE = $ save ; $ false = false ; if ( $ rs === false ) { re... | returns array of ADOFieldObjects for current table |
29,186 | function _BlobDecode_old ( $ blob ) { $ blobid = ibase_blob_open ( $ this -> _connectionID , $ blob ) ; $ realblob = ibase_blob_get ( $ blobid , $ this -> maxblobsize ) ; while ( $ string = ibase_blob_get ( $ blobid , 8192 ) ) { $ realblob .= $ string ; } ibase_blob_close ( $ blobid ) ; return ( $ realblob ) ; } | still used to auto - decode all blob s |
29,187 | function SQLDate ( $ fmt , $ col = false ) { if ( ! $ col ) $ col = $ this -> sysDate ; $ s = '' ; $ len = strlen ( $ fmt ) ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { if ( $ s ) $ s .= '||' ; $ ch = $ fmt [ $ i ] ; switch ( $ ch ) { case 'Y' : case 'y' : $ s .= "extract(year from $col)" ; break ; case 'M' : case 'm' : ... | problem - does not zero - fill the day and month yet |
29,188 | public function define_form_specific ( $ form ) { $ calendartype = \ core_calendar \ type_factory :: get_calendar_instance ( ) ; list ( $ year , $ month , $ day ) = explode ( '_' , date ( 'Y_m_d' ) ) ; $ currentdate = $ calendartype -> convert_from_gregorian ( $ year , $ month , $ day ) ; $ currentyear = $ currentdate ... | Define the setting for a datetime custom field . |
29,189 | public function define_validate_specific ( $ data , $ files ) { $ errors = array ( ) ; if ( $ data -> param1 > $ data -> param2 ) { $ errors [ 'param1' ] = get_string ( 'startyearafterend' , 'profilefield_datetime' ) ; } return $ errors ; } | Validate the data from the profile field form . |
29,190 | public function define_after_data ( & $ mform ) { global $ DB ; $ id = required_param ( 'id' , PARAM_INT ) ; if ( $ id === 0 ) { return ; } $ field = $ DB -> get_record ( 'user_info_field' , array ( 'id' => $ id ) , 'param1, param2' , MUST_EXIST ) ; $ calendartype = \ core_calendar \ type_factory :: get_calendar_instan... | Alter form based on submitted or existing data . |
29,191 | public function define_save_preprocess ( $ data ) { $ calendartype = \ core_calendar \ type_factory :: get_calendar_instance ( ) ; if ( $ data -> param1 != $ data -> startyear ) { $ startdate = $ calendartype -> convert_to_gregorian ( $ data -> param1 , 1 , 1 ) ; } else { $ startdate = $ calendartype -> convert_to_greg... | Preprocess data from the profile field form before it is saved . |
29,192 | public function next ( $ t ) { if ( $ t !== NULL ) array_push ( $ this -> front , $ t ) ; return empty ( $ this -> back ) ? NULL : array_pop ( $ this -> back ) ; } | Move hole to the next element . |
29,193 | public function advance ( $ t , $ n ) { for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { $ t = $ this -> next ( $ t ) ; } return $ t ; } | Iterated hole advancement . |
29,194 | public static function message_viewed ( \ core \ event \ message_viewed $ event ) { global $ DB ; $ userid = $ event -> userid ; $ messageid = $ event -> other [ 'messageid' ] ; $ DB -> delete_records ( 'message_email_messages' , [ 'useridto' => $ userid , 'messageid' => $ messageid ] ) ; } | Message viewed event handler . |
29,195 | protected function update_automatic_end_date ( $ enddate ) { global $ DB ; $ params = array ( 'courseid' => $ this -> step -> get_task ( ) -> get_courseid ( ) , 'format' => 'weeks' , 'sectionid' => 0 , 'name' => 'automaticenddate' ) ; $ cfoid = $ DB -> get_field ( 'course_format_options' , 'id' , $ params ) ; $ update ... | Handles setting the automatic end date for a restored course . |
29,196 | protected function update_course_sections_visibility ( $ numsections ) { global $ DB ; $ backupinfo = $ this -> step -> get_task ( ) -> get_info ( ) ; foreach ( $ backupinfo -> sections as $ key => $ section ) { if ( $ this -> step -> get_task ( ) -> get_setting_value ( $ key . '_included' ) ) { $ sectionnum = ( int ) ... | Handles updating the visibility of sections in the restored course . |
29,197 | public function define_course_plugin_structure ( ) { global $ DB ; $ target = $ this -> step -> get_task ( ) -> get_target ( ) ; if ( ( $ target == backup :: TARGET_CURRENT_ADDING || $ target == backup :: TARGET_EXISTING_ADDING ) && $ this -> is_pre_33_backup ( ) ) { $ maxsection = $ DB -> get_field_sql ( 'SELECT max(s... | Creates a dummy path element in order to be able to execute code after restore |
29,198 | protected function init ( ) { if ( ! file_exists ( dirname ( $ this -> fullpath ) ) ) { throw new xml_output_exception ( 'directory_not_exists' , dirname ( $ this -> fullpath ) ) ; } if ( file_exists ( $ this -> fullpath ) ) { throw new xml_output_exception ( 'file_already_exists' , $ this -> fullpath ) ; } if ( ! is_w... | Private API starts here |
29,199 | public function get_progress_reporter ( ) { if ( ! $ this -> progressreporter ) { $ this -> progressreporter = new \ core \ progress \ none ( ) ; } return $ this -> progressreporter ; } | Gets the progress reporter object in use for this restore UI stage . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.