id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
218,500
moodle/moodle
question/type/random/backup/moodle2/restore_qtype_random_plugin.class.php
restore_qtype_random_plugin.recode_legacy_state_answer
public function recode_legacy_state_answer($state) { global $DB; $answer = $state->answer; $result = ''; // Randomxx-yy answer format. if (preg_match('~^random([0-9]+)-(.*)$~', $answer, $matches)) { $questionid = $matches[1]; $subanswer = $matches[2]; ...
php
public function recode_legacy_state_answer($state) { global $DB; $answer = $state->answer; $result = ''; // Randomxx-yy answer format. if (preg_match('~^random([0-9]+)-(.*)$~', $answer, $matches)) { $questionid = $matches[1]; $subanswer = $matches[2]; ...
[ "public", "function", "recode_legacy_state_answer", "(", "$", "state", ")", "{", "global", "$", "DB", ";", "$", "answer", "=", "$", "state", "->", "answer", ";", "$", "result", "=", "''", ";", "// Randomxx-yy answer format.", "if", "(", "preg_match", "(", ...
Given one question_states record, return the answer recoded pointing to all the restored stuff for random questions answer format is randomxx-yy, with xx being question->id and yy the actual response to the question. We'll delegate the recode to the corresponding qtype also, some old states can contain, simply, one q...
[ "Given", "one", "question_states", "record", "return", "the", "answer", "recoded", "pointing", "to", "all", "the", "restored", "stuff", "for", "random", "questions" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/random/backup/moodle2/restore_qtype_random_plugin.class.php#L74-L98
218,501
moodle/moodle
question/type/random/backup/moodle2/restore_qtype_random_plugin.class.php
restore_qtype_random_plugin.after_execute_question
public function after_execute_question() { global $DB; // For random questions, questiontext should only ever be '0' or '1'. // In the past there were sometimes junk values like ''. If there // were any in the restore, fix them up. // // Note, we cannot just do this in o...
php
public function after_execute_question() { global $DB; // For random questions, questiontext should only ever be '0' or '1'. // In the past there were sometimes junk values like ''. If there // were any in the restore, fix them up. // // Note, we cannot just do this in o...
[ "public", "function", "after_execute_question", "(", ")", "{", "global", "$", "DB", ";", "// For random questions, questiontext should only ever be '0' or '1'.", "// In the past there were sometimes junk values like ''. If there", "// were any in the restore, fix them up.", "//", "// Not...
After restoring, make sure questiontext is set properly.
[ "After", "restoring", "make", "sure", "questiontext", "is", "set", "properly", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/random/backup/moodle2/restore_qtype_random_plugin.class.php#L103-L129
218,502
moodle/moodle
mod/quiz/classes/question/bank/custom_view.php
custom_view.set_quiz_has_attempts
public function set_quiz_has_attempts($quizhasattempts) { $this->quizhasattempts = $quizhasattempts; if ($quizhasattempts && isset($this->visiblecolumns['addtoquizaction'])) { unset($this->visiblecolumns['addtoquizaction']); } }
php
public function set_quiz_has_attempts($quizhasattempts) { $this->quizhasattempts = $quizhasattempts; if ($quizhasattempts && isset($this->visiblecolumns['addtoquizaction'])) { unset($this->visiblecolumns['addtoquizaction']); } }
[ "public", "function", "set_quiz_has_attempts", "(", "$", "quizhasattempts", ")", "{", "$", "this", "->", "quizhasattempts", "=", "$", "quizhasattempts", ";", "if", "(", "$", "quizhasattempts", "&&", "isset", "(", "$", "this", "->", "visiblecolumns", "[", "'add...
Let the question bank display know whether the quiz has been attempted, hence whether some bits of UI, like the add this question to the quiz icon, should be displayed. @param bool $quizhasattempts whether the quiz has attempts.
[ "Let", "the", "question", "bank", "display", "know", "whether", "the", "quiz", "has", "been", "attempted", "hence", "whether", "some", "bits", "of", "UI", "like", "the", "add", "this", "question", "to", "the", "quiz", "icon", "should", "be", "displayed", "...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/question/bank/custom_view.php#L114-L119
218,503
moodle/moodle
mod/quiz/classes/question/bank/custom_view.php
custom_view.print_choose_category_message
protected function print_choose_category_message($categoryandcontext) { global $OUTPUT; debugging('print_choose_category_message() is deprecated, ' . 'please use \core_question\bank\search\category_condition instead.', DEBUG_DEVELOPER); echo $OUTPUT->box_start('generalbox questio...
php
protected function print_choose_category_message($categoryandcontext) { global $OUTPUT; debugging('print_choose_category_message() is deprecated, ' . 'please use \core_question\bank\search\category_condition instead.', DEBUG_DEVELOPER); echo $OUTPUT->box_start('generalbox questio...
[ "protected", "function", "print_choose_category_message", "(", "$", "categoryandcontext", ")", "{", "global", "$", "OUTPUT", ";", "debugging", "(", "'print_choose_category_message() is deprecated, '", ".", "'please use \\core_question\\bank\\search\\category_condition instead.'", "...
Prints a form to choose categories. @param string $categoryandcontext 'categoryID,contextID'. @deprecated since Moodle 2.6 MDL-40313. @see \core_question\bank\search\category_condition @todo MDL-41978 This will be deleted in Moodle 2.8
[ "Prints", "a", "form", "to", "choose", "categories", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/question/bank/custom_view.php#L189-L200
218,504
moodle/moodle
calendar/classes/privacy/provider.php
provider.get_metadata
public static function get_metadata(collection $collection) : collection { // The calendar 'event' table contains user data. $collection->add_database_table( 'event', [ 'name' => 'privacy:metadata:calendar:event:name', 'description' => 'privacy:met...
php
public static function get_metadata(collection $collection) : collection { // The calendar 'event' table contains user data. $collection->add_database_table( 'event', [ 'name' => 'privacy:metadata:calendar:event:name', 'description' => 'privacy:met...
[ "public", "static", "function", "get_metadata", "(", "collection", "$", "collection", ")", ":", "collection", "{", "// The calendar 'event' table contains user data.", "$", "collection", "->", "add_database_table", "(", "'event'", ",", "[", "'name'", "=>", "'privacy:met...
Provides meta data that is stored about a user with core_calendar. @param collection $collection A collection of meta data items to be added to. @return collection Returns the collection of metadata.
[ "Provides", "meta", "data", "that", "is", "stored", "about", "a", "user", "with", "core_calendar", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/privacy/provider.php#L57-L89
218,505
moodle/moodle
calendar/classes/privacy/provider.php
provider.get_contexts_for_userid
public static function get_contexts_for_userid(int $userid) : contextlist { $contextlist = new contextlist(); // Calendar Events can exist at Site, Course Category, Course, Course Group, User, or Course Modules contexts. $params = [ 'sitecontext' => CONTEXT_SYSTEM, ...
php
public static function get_contexts_for_userid(int $userid) : contextlist { $contextlist = new contextlist(); // Calendar Events can exist at Site, Course Category, Course, Course Group, User, or Course Modules contexts. $params = [ 'sitecontext' => CONTEXT_SYSTEM, ...
[ "public", "static", "function", "get_contexts_for_userid", "(", "int", "$", "userid", ")", ":", "contextlist", "{", "$", "contextlist", "=", "new", "contextlist", "(", ")", ";", "// Calendar Events can exist at Site, Course Category, Course, Course Group, User, or Course Modu...
Get the list of contexts that contain calendar user information for the specified user. @param int $userid The user to search. @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
[ "Get", "the", "list", "of", "contexts", "that", "contain", "calendar", "user", "information", "for", "the", "specified", "user", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/privacy/provider.php#L97-L155
218,506
moodle/moodle
calendar/classes/privacy/provider.php
provider.delete_data_for_all_users_in_context
public static function delete_data_for_all_users_in_context(\context $context) { // Delete all Calendar Events in the specified context in batches. if ($eventids = array_keys(self::get_calendar_event_ids_by_context($context))) { self::delete_batch_records('event', 'id', $eventids); }...
php
public static function delete_data_for_all_users_in_context(\context $context) { // Delete all Calendar Events in the specified context in batches. if ($eventids = array_keys(self::get_calendar_event_ids_by_context($context))) { self::delete_batch_records('event', 'id', $eventids); }...
[ "public", "static", "function", "delete_data_for_all_users_in_context", "(", "\\", "context", "$", "context", ")", "{", "// Delete all Calendar Events in the specified context in batches.", "if", "(", "$", "eventids", "=", "array_keys", "(", "self", "::", "get_calendar_even...
Delete all Calendar Event and Calendar Subscription data for all users in the specified context. @param context $context Transform the specific context to delete data for.
[ "Delete", "all", "Calendar", "Event", "and", "Calendar", "Subscription", "data", "for", "all", "users", "in", "the", "specified", "context", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/privacy/provider.php#L257-L267
218,507
moodle/moodle
calendar/classes/privacy/provider.php
provider.export_user_calendar_event_data
protected static function export_user_calendar_event_data(approved_contextlist $contextlist) { // Calendar Events can exist at Site, Course Category, Course, Course Group, User, or Course Modules contexts. $eventdetails = self::get_calendar_event_details_by_contextlist($contextlist); // Multipl...
php
protected static function export_user_calendar_event_data(approved_contextlist $contextlist) { // Calendar Events can exist at Site, Course Category, Course, Course Group, User, or Course Modules contexts. $eventdetails = self::get_calendar_event_details_by_contextlist($contextlist); // Multipl...
[ "protected", "static", "function", "export_user_calendar_event_data", "(", "approved_contextlist", "$", "contextlist", ")", "{", "// Calendar Events can exist at Site, Course Category, Course, Course Group, User, or Course Modules contexts.", "$", "eventdetails", "=", "self", "::", "...
Helper function to export Calendar Events data by a User's contextlist. @param approved_contextlist $contextlist @throws \coding_exception
[ "Helper", "function", "to", "export", "Calendar", "Events", "data", "by", "a", "User", "s", "contextlist", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/privacy/provider.php#L340-L390
218,508
moodle/moodle
calendar/classes/privacy/provider.php
provider.export_user_calendar_subscription_data
protected static function export_user_calendar_subscription_data(approved_contextlist $contextlist) { // Calendar Subscriptions can exist at Site, Course Category, Course, Course Group, or User contexts. $subscriptiondetails = self::get_calendar_subscription_details_by_contextlist($contextlist); ...
php
protected static function export_user_calendar_subscription_data(approved_contextlist $contextlist) { // Calendar Subscriptions can exist at Site, Course Category, Course, Course Group, or User contexts. $subscriptiondetails = self::get_calendar_subscription_details_by_contextlist($contextlist); ...
[ "protected", "static", "function", "export_user_calendar_subscription_data", "(", "approved_contextlist", "$", "contextlist", ")", "{", "// Calendar Subscriptions can exist at Site, Course Category, Course, Course Group, or User contexts.", "$", "subscriptiondetails", "=", "self", "::"...
Helper function to export Calendar Subscriptions data by a User's contextlist. @param approved_contextlist $contextlist @throws \coding_exception
[ "Helper", "function", "to", "export", "Calendar", "Subscriptions", "data", "by", "a", "User", "s", "contextlist", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/privacy/provider.php#L398-L438
218,509
moodle/moodle
calendar/classes/privacy/provider.php
provider.get_calendar_event_ids_by_context
protected static function get_calendar_event_ids_by_context(\context $context, $userids = array()) { global $DB; // Calendar Events can exist at Site (CONTEXT_SYSTEM), Course Category (CONTEXT_COURSECAT), // Course and Course Group (CONTEXT_COURSE), User (CONTEXT_USER), or Course Modules (CONTE...
php
protected static function get_calendar_event_ids_by_context(\context $context, $userids = array()) { global $DB; // Calendar Events can exist at Site (CONTEXT_SYSTEM), Course Category (CONTEXT_COURSECAT), // Course and Course Group (CONTEXT_COURSE), User (CONTEXT_USER), or Course Modules (CONTE...
[ "protected", "static", "function", "get_calendar_event_ids_by_context", "(", "\\", "context", "$", "context", ",", "$", "userids", "=", "array", "(", ")", ")", "{", "global", "$", "DB", ";", "// Calendar Events can exist at Site (CONTEXT_SYSTEM), Course Category (CONTEXT_...
Helper function to return all Calendar Event id results for a specified context and optionally included user list. @param \context $context @param array $userids @return array|null @throws \dml_exception
[ "Helper", "function", "to", "return", "all", "Calendar", "Event", "id", "results", "for", "a", "specified", "context", "and", "optionally", "included", "user", "list", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/privacy/provider.php#L449-L509
218,510
moodle/moodle
calendar/classes/privacy/provider.php
provider.get_calendar_event_details_by_contextlist
protected static function get_calendar_event_details_by_contextlist(approved_contextlist $contextlist) { global $DB; $userid = $contextlist->get_user()->id; list($contextsql1, $contextparams1) = $DB->get_in_or_equal($contextlist->get_contextids(), SQL_PARAMS_NAMED); list($contextsql2, ...
php
protected static function get_calendar_event_details_by_contextlist(approved_contextlist $contextlist) { global $DB; $userid = $contextlist->get_user()->id; list($contextsql1, $contextparams1) = $DB->get_in_or_equal($contextlist->get_contextids(), SQL_PARAMS_NAMED); list($contextsql2, ...
[ "protected", "static", "function", "get_calendar_event_details_by_contextlist", "(", "approved_contextlist", "$", "contextlist", ")", "{", "global", "$", "DB", ";", "$", "userid", "=", "$", "contextlist", "->", "get_user", "(", ")", "->", "id", ";", "list", "(",...
Helper function to return the Calendar Events for a given user and context list. @param approved_contextlist $contextlist @return array @throws \coding_exception @throws \dml_exception
[ "Helper", "function", "to", "return", "the", "Calendar", "Events", "for", "a", "given", "user", "and", "context", "list", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/privacy/provider.php#L582-L639
218,511
moodle/moodle
calendar/classes/privacy/provider.php
provider.get_calendar_subscription_details_by_contextlist
protected static function get_calendar_subscription_details_by_contextlist(approved_contextlist $contextlist) { global $DB; $user = $contextlist->get_user(); list($contextsql, $contextparams) = $DB->get_in_or_equal($contextlist->get_contextids(), SQL_PARAMS_NAMED); $params = [ ...
php
protected static function get_calendar_subscription_details_by_contextlist(approved_contextlist $contextlist) { global $DB; $user = $contextlist->get_user(); list($contextsql, $contextparams) = $DB->get_in_or_equal($contextlist->get_contextids(), SQL_PARAMS_NAMED); $params = [ ...
[ "protected", "static", "function", "get_calendar_subscription_details_by_contextlist", "(", "approved_contextlist", "$", "contextlist", ")", "{", "global", "$", "DB", ";", "$", "user", "=", "$", "contextlist", "->", "get_user", "(", ")", ";", "list", "(", "$", "...
Helper function to return the Calendar Subscriptions for a given user and context list. @param approved_contextlist $contextlist @return array @throws \coding_exception @throws \dml_exception
[ "Helper", "function", "to", "return", "the", "Calendar", "Subscriptions", "for", "a", "given", "user", "and", "context", "list", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/privacy/provider.php#L649-L684
218,512
moodle/moodle
calendar/classes/privacy/provider.php
provider.delete_batch_records
protected static function delete_batch_records($tablename, $field, $values) { global $DB; // Batch deletion with an upper limit of 2000 records to minimise the number of deletion queries. $batchrecords = array_chunk($values, 2000); foreach ($batchrecords as $batchrecord) { ...
php
protected static function delete_batch_records($tablename, $field, $values) { global $DB; // Batch deletion with an upper limit of 2000 records to minimise the number of deletion queries. $batchrecords = array_chunk($values, 2000); foreach ($batchrecords as $batchrecord) { ...
[ "protected", "static", "function", "delete_batch_records", "(", "$", "tablename", ",", "$", "field", ",", "$", "values", ")", "{", "global", "$", "DB", ";", "// Batch deletion with an upper limit of 2000 records to minimise the number of deletion queries.", "$", "batchrecor...
Helper function to delete records in batches in order to minimise amount of deletion queries. @param string $tablename The table name to delete from. @param string $field The table column field name to delete records by. @param array $values The table column field values to delete records by. @thro...
[ "Helper", "function", "to", "delete", "records", "in", "batches", "in", "order", "to", "minimise", "amount", "of", "deletion", "queries", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/privacy/provider.php#L694-L703
218,513
moodle/moodle
lib/classes/progress/base.php
base.start_progress
public function start_progress($description, $max = self::INDETERMINATE, $parentcount = 1) { if ($max != self::INDETERMINATE && $max < 0) { throw new \coding_exception( 'start_progress() max value cannot be negative'); } if ($parentcount < 1) { ...
php
public function start_progress($description, $max = self::INDETERMINATE, $parentcount = 1) { if ($max != self::INDETERMINATE && $max < 0) { throw new \coding_exception( 'start_progress() max value cannot be negative'); } if ($parentcount < 1) { ...
[ "public", "function", "start_progress", "(", "$", "description", ",", "$", "max", "=", "self", "::", "INDETERMINATE", ",", "$", "parentcount", "=", "1", ")", "{", "if", "(", "$", "max", "!=", "self", "::", "INDETERMINATE", "&&", "$", "max", "<", "0", ...
Marks the start of an operation that will display progress. This can be called multiple times for nested progress sections. It must be paired with calls to end_progress. The progress maximum may be {@link self::INDETERMINATE} if the current operation has an unknown number of steps. (This is default.) Calling this fu...
[ "Marks", "the", "start", "of", "an", "operation", "that", "will", "display", "progress", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/progress/base.php#L97-L127
218,514
moodle/moodle
lib/classes/progress/base.php
base.end_progress
public function end_progress() { if (!count($this->descriptions)) { throw new \coding_exception('end_progress() without start_progress()'); } array_pop($this->descriptions); array_pop($this->maxes); array_pop($this->currents); $parentcount = array_pop($this->p...
php
public function end_progress() { if (!count($this->descriptions)) { throw new \coding_exception('end_progress() without start_progress()'); } array_pop($this->descriptions); array_pop($this->maxes); array_pop($this->currents); $parentcount = array_pop($this->p...
[ "public", "function", "end_progress", "(", ")", "{", "if", "(", "!", "count", "(", "$", "this", "->", "descriptions", ")", ")", "{", "throw", "new", "\\", "coding_exception", "(", "'end_progress() without start_progress()'", ")", ";", "}", "array_pop", "(", ...
Marks the end of an operation that will display progress. This must be paired with each {@link start_progress} call. If there is a parent progress section, its progress will be increased automatically to reflect the end of the child section. @throws \coding_exception If progress hasn't been started
[ "Marks", "the", "end", "of", "an", "operation", "that", "will", "display", "progress", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/progress/base.php#L139-L155
218,515
moodle/moodle
lib/classes/progress/base.php
base.progress
public function progress($progress = self::INDETERMINATE) { // Check we are inside a progress section. $max = end($this->maxes); if ($max === false) { throw new \coding_exception( 'progress() without start_progress'); } // Check and apply new prog...
php
public function progress($progress = self::INDETERMINATE) { // Check we are inside a progress section. $max = end($this->maxes); if ($max === false) { throw new \coding_exception( 'progress() without start_progress'); } // Check and apply new prog...
[ "public", "function", "progress", "(", "$", "progress", "=", "self", "::", "INDETERMINATE", ")", "{", "// Check we are inside a progress section.", "$", "max", "=", "end", "(", "$", "this", "->", "maxes", ")", ";", "if", "(", "$", "max", "===", "false", ")...
Indicates that progress has occurred. The progress value should indicate the total progress so far, from 0 to the value supplied for $max (inclusive) in {@link start_progress}. You do not need to call this function for every value. It is OK to skip values. It is also OK to call this function as often as desired; it d...
[ "Indicates", "that", "progress", "has", "occurred", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/progress/base.php#L173-L217
218,516
moodle/moodle
lib/classes/progress/base.php
base.get_progress_proportion_range
public function get_progress_proportion_range() { // If there is no progress underway, we must have finished. if (empty($this->currents)) { return array(1.0, 1.0); } $count = count($this->currents); $min = 0.0; $max = 1.0; for ($i = 0; $i < $count; $i+...
php
public function get_progress_proportion_range() { // If there is no progress underway, we must have finished. if (empty($this->currents)) { return array(1.0, 1.0); } $count = count($this->currents); $min = 0.0; $max = 1.0; for ($i = 0; $i < $count; $i+...
[ "public", "function", "get_progress_proportion_range", "(", ")", "{", "// If there is no progress underway, we must have finished.", "if", "(", "empty", "(", "$", "this", "->", "currents", ")", ")", "{", "return", "array", "(", "1.0", ",", "1.0", ")", ";", "}", ...
Obtains current progress in a way suitable for drawing a progress bar. Progress is returned as a minimum and maximum value. If there is no indeterminate progress, these values will be identical. If there is intermediate progress, these values can be different. (For example, if the top level progress sections is indete...
[ "Obtains", "current", "progress", "in", "a", "way", "suitable", "for", "drawing", "a", "progress", "bar", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/progress/base.php#L292-L331
218,517
moodle/moodle
grade/report/history/classes/filter_form.php
filter_form.definition
public function definition() { $mform = $this->_form; $course = $this->_customdata['course']; $itemids = $this->_customdata['itemids']; $graders = $this->_customdata['graders']; $userbutton = $this->_customdata['userbutton']; $names = \html_writer::span('', 'selec...
php
public function definition() { $mform = $this->_form; $course = $this->_customdata['course']; $itemids = $this->_customdata['itemids']; $graders = $this->_customdata['graders']; $userbutton = $this->_customdata['userbutton']; $names = \html_writer::span('', 'selec...
[ "public", "function", "definition", "(", ")", "{", "$", "mform", "=", "$", "this", "->", "_form", ";", "$", "course", "=", "$", "this", "->", "_customdata", "[", "'course'", "]", ";", "$", "itemids", "=", "$", "this", "->", "_customdata", "[", "'item...
Definition of the Mform for filters displayed in the report.
[ "Definition", "of", "the", "Mform", "for", "filters", "displayed", "in", "the", "report", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/history/classes/filter_form.php#L46-L81
218,518
moodle/moodle
grade/report/history/classes/filter_form.php
filter_form.definition_after_data
public function definition_after_data() { $mform = $this->_form; if ($userfullnames = $mform->getElementValue('userfullnames')) { $mform->getElement('selectednames')->setValue(\html_writer::span($userfullnames, 'selectednames')); } }
php
public function definition_after_data() { $mform = $this->_form; if ($userfullnames = $mform->getElementValue('userfullnames')) { $mform->getElement('selectednames')->setValue(\html_writer::span($userfullnames, 'selectednames')); } }
[ "public", "function", "definition_after_data", "(", ")", "{", "$", "mform", "=", "$", "this", "->", "_form", ";", "if", "(", "$", "userfullnames", "=", "$", "mform", "->", "getElementValue", "(", "'userfullnames'", ")", ")", "{", "$", "mform", "->", "get...
This method implements changes to the form that need to be made once the form data is set.
[ "This", "method", "implements", "changes", "to", "the", "form", "that", "need", "to", "be", "made", "once", "the", "form", "data", "is", "set", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/history/classes/filter_form.php#L86-L92
218,519
moodle/moodle
lib/ddl/sqlite_sql_generator.php
sqlite_sql_generator.getRenameIndexSQL
function getRenameIndexSQL($xmldb_table, $xmldb_index, $newname) { /// Get the real index name $dbindexname = $this->mdb->get_manager()->find_index_name($xmldb_table, $xmldb_index); $xmldb_index->setName($newname); $results = array('DROP INDEX ' . $dbindexname); $results = array_merg...
php
function getRenameIndexSQL($xmldb_table, $xmldb_index, $newname) { /// Get the real index name $dbindexname = $this->mdb->get_manager()->find_index_name($xmldb_table, $xmldb_index); $xmldb_index->setName($newname); $results = array('DROP INDEX ' . $dbindexname); $results = array_merg...
[ "function", "getRenameIndexSQL", "(", "$", "xmldb_table", ",", "$", "xmldb_index", ",", "$", "newname", ")", "{", "/// Get the real index name", "$", "dbindexname", "=", "$", "this", "->", "mdb", "->", "get_manager", "(", ")", "->", "find_index_name", "(", "$"...
Given one xmldb_table and one xmldb_index, return the SQL statements needed to rename the index in the table
[ "Given", "one", "xmldb_table", "and", "one", "xmldb_index", "return", "the", "SQL", "statements", "needed", "to", "rename", "the", "index", "in", "the", "table" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/sqlite_sql_generator.php#L331-L338
218,520
moodle/moodle
grade/report/user/externallib.php
gradereport_user_external.check_report_access
protected static function check_report_access($courseid, $userid, $groupid = 0) { global $USER; // Validate the parameter. $params = self::validate_parameters(self::get_grades_table_parameters(), array( 'courseid' => $courseid, 'userid' => $userid, ...
php
protected static function check_report_access($courseid, $userid, $groupid = 0) { global $USER; // Validate the parameter. $params = self::validate_parameters(self::get_grades_table_parameters(), array( 'courseid' => $courseid, 'userid' => $userid, ...
[ "protected", "static", "function", "check_report_access", "(", "$", "courseid", ",", "$", "userid", ",", "$", "groupid", "=", "0", ")", "{", "global", "$", "USER", ";", "// Validate the parameter.", "$", "params", "=", "self", "::", "validate_parameters", "(",...
Validate access permissions to the report @param int $courseid the courseid @param int $userid the user id to retrieve data from @param int $groupid the group id @return array with the parameters cleaned and other required information @since Moodle 3.2
[ "Validate", "access", "permissions", "to", "the", "report" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/user/externallib.php#L50-L123
218,521
moodle/moodle
grade/report/user/externallib.php
gradereport_user_external.get_report_data
protected static function get_report_data($course, $context, $user, $userid, $groupid, $tabledata = true) { global $CFG; $warnings = array(); // Require files here to save some memory in case validation fails. require_once($CFG->dirroot . '/group/lib.php'); require_once($CFG->li...
php
protected static function get_report_data($course, $context, $user, $userid, $groupid, $tabledata = true) { global $CFG; $warnings = array(); // Require files here to save some memory in case validation fails. require_once($CFG->dirroot . '/group/lib.php'); require_once($CFG->li...
[ "protected", "static", "function", "get_report_data", "(", "$", "course", ",", "$", "context", ",", "$", "user", ",", "$", "userid", ",", "$", "groupid", ",", "$", "tabledata", "=", "true", ")", "{", "global", "$", "CFG", ";", "$", "warnings", "=", "...
Get the report data @param stdClass $course course object @param stdClass $context context object @param stdClass $user user object (it can be null for all the users) @param int $userid the user to retrieve data from, 0 for all @param int $groupid the group id to filter @param bool $tabledata whe...
[ "Get", "the", "report", "data" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/user/externallib.php#L136-L206
218,522
moodle/moodle
grade/report/user/externallib.php
gradereport_user_external.get_grades_table_parameters
public static function get_grades_table_parameters() { return new external_function_parameters ( array( 'courseid' => new external_value(PARAM_INT, 'Course Id', VALUE_REQUIRED), 'userid' => new external_value(PARAM_INT, 'Return grades only for this user (optional)',...
php
public static function get_grades_table_parameters() { return new external_function_parameters ( array( 'courseid' => new external_value(PARAM_INT, 'Course Id', VALUE_REQUIRED), 'userid' => new external_value(PARAM_INT, 'Return grades only for this user (optional)',...
[ "public", "static", "function", "get_grades_table_parameters", "(", ")", "{", "return", "new", "external_function_parameters", "(", "array", "(", "'courseid'", "=>", "new", "external_value", "(", "PARAM_INT", ",", "'Course Id'", ",", "VALUE_REQUIRED", ")", ",", "'us...
Describes the parameters for get_grades_table. @return external_function_parameters @since Moodle 2.9
[ "Describes", "the", "parameters", "for", "get_grades_table", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/user/externallib.php#L214-L222
218,523
moodle/moodle
grade/report/user/externallib.php
gradereport_user_external.get_grades_table
public static function get_grades_table($courseid, $userid = 0, $groupid = 0) { global $CFG, $USER; list($params, $course, $context, $user, $groupid) = self::check_report_access($courseid, $userid, $groupid); $userid = $params['userid']; // We pass userid because it can be still 0. ...
php
public static function get_grades_table($courseid, $userid = 0, $groupid = 0) { global $CFG, $USER; list($params, $course, $context, $user, $groupid) = self::check_report_access($courseid, $userid, $groupid); $userid = $params['userid']; // We pass userid because it can be still 0. ...
[ "public", "static", "function", "get_grades_table", "(", "$", "courseid", ",", "$", "userid", "=", "0", ",", "$", "groupid", "=", "0", ")", "{", "global", "$", "CFG", ",", "$", "USER", ";", "list", "(", "$", "params", ",", "$", "course", ",", "$", ...
Returns a list of grades tables for users in a course. @param int $courseid Course Id @param int $userid Only this user (optional) @param int $groupid Get users from this group only @return array the grades tables @since Moodle 2.9
[ "Returns", "a", "list", "of", "grades", "tables", "for", "users", "in", "a", "course", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/user/externallib.php#L234-L247
218,524
moodle/moodle
grade/report/user/externallib.php
gradereport_user_external.get_grades_table_returns
public static function get_grades_table_returns() { return new external_single_structure( array( 'tables' => new external_multiple_structure( new external_single_structure( array( 'courseid' => new external_value...
php
public static function get_grades_table_returns() { return new external_single_structure( array( 'tables' => new external_multiple_structure( new external_single_structure( array( 'courseid' => new external_value...
[ "public", "static", "function", "get_grades_table_returns", "(", ")", "{", "return", "new", "external_single_structure", "(", "array", "(", "'tables'", "=>", "new", "external_multiple_structure", "(", "new", "external_single_structure", "(", "array", "(", "'courseid'", ...
Describes tget_grades_table return value. @return external_single_structure @since Moodle 2.9
[ "Describes", "tget_grades_table", "return", "value", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/user/externallib.php#L269-L333
218,525
moodle/moodle
grade/report/user/externallib.php
gradereport_user_external.get_grade_items
public static function get_grade_items($courseid, $userid = 0, $groupid = 0) { global $CFG, $USER; list($params, $course, $context, $user, $groupid) = self::check_report_access($courseid, $userid, $groupid); $userid = $params['userid']; // We pass userid because it can be still 0. ...
php
public static function get_grade_items($courseid, $userid = 0, $groupid = 0) { global $CFG, $USER; list($params, $course, $context, $user, $groupid) = self::check_report_access($courseid, $userid, $groupid); $userid = $params['userid']; // We pass userid because it can be still 0. ...
[ "public", "static", "function", "get_grade_items", "(", "$", "courseid", ",", "$", "userid", "=", "0", ",", "$", "groupid", "=", "0", ")", "{", "global", "$", "CFG", ",", "$", "USER", ";", "list", "(", "$", "params", ",", "$", "course", ",", "$", ...
Returns the complete list of grade items for users in a course. @param int $courseid Course Id @param int $userid Only this user (optional) @param int $groupid Get users from this group only @return array the grades tables @since Moodle 3.2
[ "Returns", "the", "complete", "list", "of", "grade", "items", "for", "users", "in", "a", "course", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/user/externallib.php#L444-L464
218,526
moodle/moodle
lib/adodb/adodb-perf.inc.php
adodb_perf.table
static function table($newtable = false) { static $_table; if (!empty($newtable)) $_table = $newtable; if (empty($_table)) $_table = 'adodb_logsql'; return $_table; }
php
static function table($newtable = false) { static $_table; if (!empty($newtable)) $_table = $newtable; if (empty($_table)) $_table = 'adodb_logsql'; return $_table; }
[ "static", "function", "table", "(", "$", "newtable", "=", "false", ")", "{", "static", "$", "_table", ";", "if", "(", "!", "empty", "(", "$", "newtable", ")", ")", "$", "_table", "=", "$", "newtable", ";", "if", "(", "empty", "(", "$", "_table", ...
Sets the tablename to be used
[ "Sets", "the", "tablename", "to", "be", "used" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-perf.inc.php#L234-L241
218,527
moodle/moodle
lib/adodb/adodb-perf.inc.php
adodb_perf._CPULoad
function _CPULoad() { /* cpu 524152 2662 2515228 336057010 cpu0 264339 1408 1257951 168025827 cpu1 259813 1254 1257277 168031181 page 622307 25475680 swap 24 1891 intr 890153570 868093576 6 0 4 4 0 6 1 2 0 0 0 124 0 8098760 2 13961053 0 0 0 0 0 0 0 0 0 0 0 0 0 16 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
php
function _CPULoad() { /* cpu 524152 2662 2515228 336057010 cpu0 264339 1408 1257951 168025827 cpu1 259813 1254 1257277 168031181 page 622307 25475680 swap 24 1891 intr 890153570 868093576 6 0 4 4 0 6 1 2 0 0 0 124 0 8098760 2 13961053 0 0 0 0 0 0 0 0 0 0 0 0 0 16 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
[ "function", "_CPULoad", "(", ")", "{", "/*\n\ncpu 524152 2662 2515228 336057010\ncpu0 264339 1408 1257951 168025827\ncpu1 259813 1254 1257277 168031181\npage 622307 25475680\nswap 24 1891\nintr 890153570 868093576 6 0 4 4 0 6 1 2 0 0 0 124 0 8098760 2 13961053 0 0 0 0 0 0 0 0 0 0 0 0 0 16 16 0 0 0 0 0 0 ...
returns array with info to calculate CPU Load
[ "returns", "array", "with", "info", "to", "calculate", "CPU", "Load" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-perf.inc.php#L244-L319
218,528
moodle/moodle
blog/classes/privacy/provider.php
provider.delete_all_user_data
protected static function delete_all_user_data(context_user $usercontext) { global $DB; $userid = $usercontext->instanceid; // Delete all blog posts. $recordset = $DB->get_recordset_select('post', 'userid = :userid AND module IN (:blog, :blogext)', [ 'userid' => $userid, 'bl...
php
protected static function delete_all_user_data(context_user $usercontext) { global $DB; $userid = $usercontext->instanceid; // Delete all blog posts. $recordset = $DB->get_recordset_select('post', 'userid = :userid AND module IN (:blog, :blogext)', [ 'userid' => $userid, 'bl...
[ "protected", "static", "function", "delete_all_user_data", "(", "context_user", "$", "usercontext", ")", "{", "global", "$", "DB", ";", "$", "userid", "=", "$", "usercontext", "->", "instanceid", ";", "// Delete all blog posts.", "$", "recordset", "=", "$", "DB"...
Helper method to delete all user data. @param context_user $usercontext The user context. @return void
[ "Helper", "method", "to", "delete", "all", "user", "data", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/classes/privacy/provider.php#L510-L526
218,529
moodle/moodle
enrol/guest/classes/external.php
enrol_guest_external.get_instance_info
public static function get_instance_info($instanceid) { global $DB; $params = self::validate_parameters(self::get_instance_info_parameters(), array('instanceid' => $instanceid)); $warnings = array(); // Retrieve guest enrolment plugin. $enrolplugin = enrol_get_plugin('guest'); ...
php
public static function get_instance_info($instanceid) { global $DB; $params = self::validate_parameters(self::get_instance_info_parameters(), array('instanceid' => $instanceid)); $warnings = array(); // Retrieve guest enrolment plugin. $enrolplugin = enrol_get_plugin('guest'); ...
[ "public", "static", "function", "get_instance_info", "(", "$", "instanceid", ")", "{", "global", "$", "DB", ";", "$", "params", "=", "self", "::", "validate_parameters", "(", "self", "::", "get_instance_info_parameters", "(", ")", ",", "array", "(", "'instance...
Return guest enrolment instance information. @param int $instanceid instance id of guest enrolment plugin. @return array warnings and instance information. @since Moodle 3.1
[ "Return", "guest", "enrolment", "instance", "information", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/guest/classes/external.php#L62-L92
218,530
moodle/moodle
cache/stores/memcached/lib.php
cachestore_memcached.is_connection_ready
public function is_connection_ready() { if (!@$this->connection->set("ping", 'ping', 1)) { // Test the connection to the server. return false; } if ($this->isshared) { // There is a bug in libmemcached which means that it is not possible to purge the cache in...
php
public function is_connection_ready() { if (!@$this->connection->set("ping", 'ping', 1)) { // Test the connection to the server. return false; } if ($this->isshared) { // There is a bug in libmemcached which means that it is not possible to purge the cache in...
[ "public", "function", "is_connection_ready", "(", ")", "{", "if", "(", "!", "@", "$", "this", "->", "connection", "->", "set", "(", "\"ping\"", ",", "'ping'", ",", "1", ")", ")", "{", "// Test the connection to the server.", "return", "false", ";", "}", "i...
Confirm whether the connection is ready and usable. @return boolean
[ "Confirm", "whether", "the", "connection", "is", "ready", "and", "usable", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/memcached/lib.php#L240-L286
218,531
moodle/moodle
cache/stores/memcached/lib.php
cachestore_memcached.delete_many_connection
protected function delete_many_connection(Memcached $connection, array $keys) { $count = 0; if ($this->candeletemulti) { // We can use deleteMulti, this is a bit faster yay! $result = $connection->deleteMulti($keys); foreach ($result as $key => $outcome) { ...
php
protected function delete_many_connection(Memcached $connection, array $keys) { $count = 0; if ($this->candeletemulti) { // We can use deleteMulti, this is a bit faster yay! $result = $connection->deleteMulti($keys); foreach ($result as $key => $outcome) { ...
[ "protected", "function", "delete_many_connection", "(", "Memcached", "$", "connection", ",", "array", "$", "keys", ")", "{", "$", "count", "=", "0", ";", "if", "(", "$", "this", "->", "candeletemulti", ")", "{", "// We can use deleteMulti, this is a bit faster yay...
Deletes several keys from the cache in a single action for a specific connection. @param Memcached $connection The connection to work on. @param array $keys The keys to delete @return int The number of items successfully deleted.
[ "Deletes", "several", "keys", "from", "the", "cache", "in", "a", "single", "action", "for", "a", "specific", "connection", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/memcached/lib.php#L498-L518
218,532
moodle/moodle
cache/stores/memcached/lib.php
cachestore_memcached.get_prefixed_keys
protected static function get_prefixed_keys(Memcached $connection, $prefix) { $connkeys = $connection->getAllKeys(); if (empty($connkeys)) { return array(); } $keys = array(); $start = strlen($prefix); foreach ($connkeys as $key) { if (strpos($key...
php
protected static function get_prefixed_keys(Memcached $connection, $prefix) { $connkeys = $connection->getAllKeys(); if (empty($connkeys)) { return array(); } $keys = array(); $start = strlen($prefix); foreach ($connkeys as $key) { if (strpos($key...
[ "protected", "static", "function", "get_prefixed_keys", "(", "Memcached", "$", "connection", ",", "$", "prefix", ")", "{", "$", "connkeys", "=", "$", "connection", "->", "getAllKeys", "(", ")", ";", "if", "(", "empty", "(", "$", "connkeys", ")", ")", "{"...
Returns all of the keys in the given connection that belong to this cache store instance. Requires php memcached extension version 2.0.0 or greater. @param Memcached $connection @param string $prefix @return array
[ "Returns", "all", "of", "the", "keys", "in", "the", "given", "connection", "that", "belong", "to", "this", "cache", "store", "instance", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/memcached/lib.php#L562-L576
218,533
moodle/moodle
cache/stores/memcached/lib.php
cachestore_memcached.config_get_hash_options
public static function config_get_hash_options() { $options = array( Memcached::HASH_DEFAULT => get_string('hash_default', 'cachestore_memcached'), Memcached::HASH_MD5 => get_string('hash_md5', 'cachestore_memcached'), Memcached::HASH_CRC => get_string('hash_crc', 'cachestore...
php
public static function config_get_hash_options() { $options = array( Memcached::HASH_DEFAULT => get_string('hash_default', 'cachestore_memcached'), Memcached::HASH_MD5 => get_string('hash_md5', 'cachestore_memcached'), Memcached::HASH_CRC => get_string('hash_crc', 'cachestore...
[ "public", "static", "function", "config_get_hash_options", "(", ")", "{", "$", "options", "=", "array", "(", "Memcached", "::", "HASH_DEFAULT", "=>", "get_string", "(", "'hash_default'", ",", "'cachestore_memcached'", ")", ",", "Memcached", "::", "HASH_MD5", "=>",...
Gets an array of hash options available during configuration. @return array
[ "Gets", "an", "array", "of", "hash", "options", "available", "during", "configuration", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/memcached/lib.php#L599-L612
218,534
moodle/moodle
cache/stores/memcached/lib.php
cachestore_memcached.get_warnings
public function get_warnings() { global $CFG; $warnings = array(); if (isset($CFG->session_memcached_save_path) && count($this->servers)) { $bits = explode(':', $CFG->session_memcached_save_path, 3); $host = array_shift($bits); $port = (count($bits)) ? array_s...
php
public function get_warnings() { global $CFG; $warnings = array(); if (isset($CFG->session_memcached_save_path) && count($this->servers)) { $bits = explode(':', $CFG->session_memcached_save_path, 3); $host = array_shift($bits); $port = (count($bits)) ? array_s...
[ "public", "function", "get_warnings", "(", ")", "{", "global", "$", "CFG", ";", "$", "warnings", "=", "array", "(", ")", ";", "if", "(", "isset", "(", "$", "CFG", "->", "session_memcached_save_path", ")", "&&", "count", "(", "$", "this", "->", "servers...
Used to notify of configuration conflicts. The warnings returned here will be displayed on the cache configuration screen. @return string[] Returns an array of warnings (strings)
[ "Used", "to", "notify", "of", "configuration", "conflicts", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/memcached/lib.php#L824-L840
218,535
moodle/moodle
lib/filelib.php
curl.resetopt
public function resetopt() { $this->options = array(); $this->options['CURLOPT_USERAGENT'] = 'MoodleBot/1.0'; // True to include the header in the output $this->options['CURLOPT_HEADER'] = 0; // True to Exclude the body from the output $this->options['C...
php
public function resetopt() { $this->options = array(); $this->options['CURLOPT_USERAGENT'] = 'MoodleBot/1.0'; // True to include the header in the output $this->options['CURLOPT_HEADER'] = 0; // True to Exclude the body from the output $this->options['C...
[ "public", "function", "resetopt", "(", ")", "{", "$", "this", "->", "options", "=", "array", "(", ")", ";", "$", "this", "->", "options", "[", "'CURLOPT_USERAGENT'", "]", "=", "'MoodleBot/1.0'", ";", "// True to include the header in the output", "$", "this", ...
Resets the CURL options that have already been set
[ "Resets", "the", "CURL", "options", "that", "have", "already", "been", "set" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filelib.php#L3103-L3124
218,536
moodle/moodle
lib/filelib.php
curl.get_cacert
public static function get_cacert() { global $CFG; // Bundle in dataroot always wins. if (is_readable("$CFG->dataroot/moodleorgca.crt")) { return realpath("$CFG->dataroot/moodleorgca.crt"); } // Next comes the default from php.ini $cacert = ini_get('curl.cai...
php
public static function get_cacert() { global $CFG; // Bundle in dataroot always wins. if (is_readable("$CFG->dataroot/moodleorgca.crt")) { return realpath("$CFG->dataroot/moodleorgca.crt"); } // Next comes the default from php.ini $cacert = ini_get('curl.cai...
[ "public", "static", "function", "get_cacert", "(", ")", "{", "global", "$", "CFG", ";", "// Bundle in dataroot always wins.", "if", "(", "is_readable", "(", "\"$CFG->dataroot/moodleorgca.crt\"", ")", ")", "{", "return", "realpath", "(", "\"$CFG->dataroot/moodleorgca.crt...
Get the location of ca certificates. @return string absolute file path or empty if default used
[ "Get", "the", "location", "of", "ca", "certificates", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filelib.php#L3130-L3153
218,537
moodle/moodle
lib/filelib.php
curl.setHeader
public function setHeader($header) { if (is_array($header)) { foreach ($header as $v) { $this->setHeader($v); } } else { // Remove newlines, they are not allowed in headers. $newvalue = preg_replace('/[\r\n]/', '', $header); if ...
php
public function setHeader($header) { if (is_array($header)) { foreach ($header as $v) { $this->setHeader($v); } } else { // Remove newlines, they are not allowed in headers. $newvalue = preg_replace('/[\r\n]/', '', $header); if ...
[ "public", "function", "setHeader", "(", "$", "header", ")", "{", "if", "(", "is_array", "(", "$", "header", ")", ")", "{", "foreach", "(", "$", "header", "as", "$", "v", ")", "{", "$", "this", "->", "setHeader", "(", "$", "v", ")", ";", "}", "}...
Set HTTP Request Header @param array $header
[ "Set", "HTTP", "Request", "Header" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filelib.php#L3223-L3235
218,538
moodle/moodle
lib/filelib.php
curl.set_security
public function set_security($securityobject) { if ($securityobject instanceof \core\files\curl_security_helper) { $this->securityhelper = $securityobject; return true; } return false; }
php
public function set_security($securityobject) { if ($securityobject instanceof \core\files\curl_security_helper) { $this->securityhelper = $securityobject; return true; } return false; }
[ "public", "function", "set_security", "(", "$", "securityobject", ")", "{", "if", "(", "$", "securityobject", "instanceof", "\\", "core", "\\", "files", "\\", "curl_security_helper", ")", "{", "$", "this", "->", "securityhelper", "=", "$", "securityobject", ";...
Sets the curl security helper. @param \core\files\curl_security_helper $securityobject instance/subclass of the base curl_security_helper class. @return bool true if the security helper could be set, false otherwise.
[ "Sets", "the", "curl", "security", "helper", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filelib.php#L3469-L3475
218,539
moodle/moodle
lib/filelib.php
curl.multi
protected function multi($requests, $options = array()) { $count = count($requests); $handles = array(); $results = array(); $main = curl_multi_init(); for ($i = 0; $i < $count; $i++) { if (!empty($requests[$i]['filepath']) and empty($requests[$i]['file'])) { ...
php
protected function multi($requests, $options = array()) { $count = count($requests); $handles = array(); $results = array(); $main = curl_multi_init(); for ($i = 0; $i < $count; $i++) { if (!empty($requests[$i]['filepath']) and empty($requests[$i]['file'])) { ...
[ "protected", "function", "multi", "(", "$", "requests", ",", "$", "options", "=", "array", "(", ")", ")", "{", "$", "count", "=", "count", "(", "$", "requests", ")", ";", "$", "handles", "=", "array", "(", ")", ";", "$", "results", "=", "array", ...
Multi HTTP Requests This function could run multi-requests in parallel. @param array $requests An array of files to request @param array $options An array of options to set @return array An array of results
[ "Multi", "HTTP", "Requests", "This", "function", "could", "run", "multi", "-", "requests", "in", "parallel", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filelib.php#L3485-L3524
218,540
moodle/moodle
lib/filelib.php
curl.reset_request_state_vars
protected function reset_request_state_vars() { $this->info = array(); $this->error = ''; $this->errno = 0; $this->response = array(); $this->rawresponse = array(); $this->responsefinished = false; }
php
protected function reset_request_state_vars() { $this->info = array(); $this->error = ''; $this->errno = 0; $this->response = array(); $this->rawresponse = array(); $this->responsefinished = false; }
[ "protected", "function", "reset_request_state_vars", "(", ")", "{", "$", "this", "->", "info", "=", "array", "(", ")", ";", "$", "this", "->", "error", "=", "''", ";", "$", "this", "->", "errno", "=", "0", ";", "$", "this", "->", "response", "=", "...
Helper function to reset the request state vars. @return void.
[ "Helper", "function", "to", "reset", "the", "request", "state", "vars", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filelib.php#L3531-L3538
218,541
moodle/moodle
lib/filelib.php
curl.download_one
public function download_one($url, $params, $options = array()) { $options['CURLOPT_HTTPGET'] = 1; if (!empty($params)) { $url .= (stripos($url, '?') !== false) ? '&' : '?'; $url .= http_build_query($params, '', '&'); } if (!empty($options['filepath']) && empty($o...
php
public function download_one($url, $params, $options = array()) { $options['CURLOPT_HTTPGET'] = 1; if (!empty($params)) { $url .= (stripos($url, '?') !== false) ? '&' : '?'; $url .= http_build_query($params, '', '&'); } if (!empty($options['filepath']) && empty($o...
[ "public", "function", "download_one", "(", "$", "url", ",", "$", "params", ",", "$", "options", "=", "array", "(", ")", ")", "{", "$", "options", "[", "'CURLOPT_HTTPGET'", "]", "=", "1", ";", "if", "(", "!", "empty", "(", "$", "params", ")", ")", ...
Downloads one file and writes it to the specified file handler <code> $c = new curl(); $file = fopen('savepath', 'w'); $result = $c->download_one('http://localhost/', null, array('file' => $file, 'timeout' => 5, 'followlocation' => true, 'maxredirs' => 3)); fclose($file); $download_info = $c->get_info(); if ($result =...
[ "Downloads", "one", "file", "and", "writes", "it", "to", "the", "specified", "file", "handler" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filelib.php#L3835-L3858
218,542
moodle/moodle
lib/filelib.php
curl_cache.cleanup
public function cleanup($expire) { if ($dir = opendir($this->dir)) { while (false !== ($file = readdir($dir))) { if(!is_dir($file) && $file != '.' && $file != '..') { $lasttime = @filemtime($this->dir.$file); if (time() - $lasttime > $expire) {...
php
public function cleanup($expire) { if ($dir = opendir($this->dir)) { while (false !== ($file = readdir($dir))) { if(!is_dir($file) && $file != '.' && $file != '..') { $lasttime = @filemtime($this->dir.$file); if (time() - $lasttime > $expire) {...
[ "public", "function", "cleanup", "(", "$", "expire", ")", "{", "if", "(", "$", "dir", "=", "opendir", "(", "$", "this", "->", "dir", ")", ")", "{", "while", "(", "false", "!==", "(", "$", "file", "=", "readdir", "(", "$", "dir", ")", ")", ")", ...
Remove cache files @param int $expire The number of seconds before expiry
[ "Remove", "cache", "files" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filelib.php#L4094-L4106
218,543
moodle/moodle
lib/spout/src/Spout/Reader/XLSX/Helper/StyleHelper.php
StyleHelper.shouldFormatNumericValueAsDate
public function shouldFormatNumericValueAsDate($styleId) { $stylesAttributes = $this->getStylesAttributes(); // Default style (0) does not format numeric values as timestamps. Only custom styles do. // Also if the style ID does not exist in the styles.xml file, format as numeric value. ...
php
public function shouldFormatNumericValueAsDate($styleId) { $stylesAttributes = $this->getStylesAttributes(); // Default style (0) does not format numeric values as timestamps. Only custom styles do. // Also if the style ID does not exist in the styles.xml file, format as numeric value. ...
[ "public", "function", "shouldFormatNumericValueAsDate", "(", "$", "styleId", ")", "{", "$", "stylesAttributes", "=", "$", "this", "->", "getStylesAttributes", "(", ")", ";", "// Default style (0) does not format numeric values as timestamps. Only custom styles do.", "// Also if...
Returns whether the style with the given ID should consider numeric values as timestamps and format the cell as a date. @param int $styleId Zero-based style ID @return bool Whether the cell with the given cell should display a date instead of a numeric value
[ "Returns", "whether", "the", "style", "with", "the", "given", "ID", "should", "consider", "numeric", "values", "as", "timestamps", "and", "format", "the", "cell", "as", "a", "date", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/XLSX/Helper/StyleHelper.php#L84-L98
218,544
moodle/moodle
lib/spout/src/Spout/Reader/XLSX/Helper/StyleHelper.php
StyleHelper.extractRelevantInfo
protected function extractRelevantInfo() { $this->customNumberFormats = []; $this->stylesAttributes = []; $xmlReader = new XMLReader(); if ($xmlReader->openFileInZip($this->filePath, self::STYLES_XML_FILE_PATH)) { while ($xmlReader->read()) { if ($xmlRea...
php
protected function extractRelevantInfo() { $this->customNumberFormats = []; $this->stylesAttributes = []; $xmlReader = new XMLReader(); if ($xmlReader->openFileInZip($this->filePath, self::STYLES_XML_FILE_PATH)) { while ($xmlReader->read()) { if ($xmlRea...
[ "protected", "function", "extractRelevantInfo", "(", ")", "{", "$", "this", "->", "customNumberFormats", "=", "[", "]", ";", "$", "this", "->", "stylesAttributes", "=", "[", "]", ";", "$", "xmlReader", "=", "new", "XMLReader", "(", ")", ";", "if", "(", ...
Reads the styles.xml file and extract the relevant information from the file. @return void
[ "Reads", "the", "styles", ".", "xml", "file", "and", "extract", "the", "relevant", "information", "from", "the", "file", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/XLSX/Helper/StyleHelper.php#L105-L124
218,545
moodle/moodle
lib/spout/src/Spout/Reader/XLSX/Helper/StyleHelper.php
StyleHelper.extractNumberFormats
protected function extractNumberFormats($xmlReader) { while ($xmlReader->read()) { if ($xmlReader->isPositionedOnStartingNode(self::XML_NODE_NUM_FMT)) { $numFmtId = intval($xmlReader->getAttribute(self::XML_ATTRIBUTE_NUM_FMT_ID)); $formatCode = $xmlReader->getAttr...
php
protected function extractNumberFormats($xmlReader) { while ($xmlReader->read()) { if ($xmlReader->isPositionedOnStartingNode(self::XML_NODE_NUM_FMT)) { $numFmtId = intval($xmlReader->getAttribute(self::XML_ATTRIBUTE_NUM_FMT_ID)); $formatCode = $xmlReader->getAttr...
[ "protected", "function", "extractNumberFormats", "(", "$", "xmlReader", ")", "{", "while", "(", "$", "xmlReader", "->", "read", "(", ")", ")", "{", "if", "(", "$", "xmlReader", "->", "isPositionedOnStartingNode", "(", "self", "::", "XML_NODE_NUM_FMT", ")", "...
Extracts number formats from the "numFmt" nodes. For simplicity, the styles attributes are kept in memory. This is possible thanks to the reuse of formats. So 1 million cells should not use 1 million formats. @param \Box\Spout\Reader\Wrapper\XMLReader $xmlReader XML Reader positioned on the "numFmts" node @return void
[ "Extracts", "number", "formats", "from", "the", "numFmt", "nodes", ".", "For", "simplicity", "the", "styles", "attributes", "are", "kept", "in", "memory", ".", "This", "is", "possible", "thanks", "to", "the", "reuse", "of", "formats", ".", "So", "1", "mill...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/XLSX/Helper/StyleHelper.php#L134-L146
218,546
moodle/moodle
lib/spout/src/Spout/Reader/XLSX/Helper/StyleHelper.php
StyleHelper.extractStyleAttributes
protected function extractStyleAttributes($xmlReader) { while ($xmlReader->read()) { if ($xmlReader->isPositionedOnStartingNode(self::XML_NODE_XF)) { $numFmtId = $xmlReader->getAttribute(self::XML_ATTRIBUTE_NUM_FMT_ID); $normalizedNumFmtId = ($numFmtId !== null) ?...
php
protected function extractStyleAttributes($xmlReader) { while ($xmlReader->read()) { if ($xmlReader->isPositionedOnStartingNode(self::XML_NODE_XF)) { $numFmtId = $xmlReader->getAttribute(self::XML_ATTRIBUTE_NUM_FMT_ID); $normalizedNumFmtId = ($numFmtId !== null) ?...
[ "protected", "function", "extractStyleAttributes", "(", "$", "xmlReader", ")", "{", "while", "(", "$", "xmlReader", "->", "read", "(", ")", ")", "{", "if", "(", "$", "xmlReader", "->", "isPositionedOnStartingNode", "(", "self", "::", "XML_NODE_XF", ")", ")",...
Extracts style attributes from the "xf" nodes, inside the "cellXfs" section. For simplicity, the styles attributes are kept in memory. This is possible thanks to the reuse of styles. So 1 million cells should not use 1 million styles. @param \Box\Spout\Reader\Wrapper\XMLReader $xmlReader XML Reader positioned on the "...
[ "Extracts", "style", "attributes", "from", "the", "xf", "nodes", "inside", "the", "cellXfs", "section", ".", "For", "simplicity", "the", "styles", "attributes", "are", "kept", "in", "memory", ".", "This", "is", "possible", "thanks", "to", "the", "reuse", "of...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/XLSX/Helper/StyleHelper.php#L156-L175
218,547
moodle/moodle
lib/spout/src/Spout/Reader/XLSX/Helper/StyleHelper.php
StyleHelper.doesNumFmtIdIndicateDate
protected function doesNumFmtIdIndicateDate($numFmtId) { if (!isset($this->numFmtIdToIsDateFormatCache[$numFmtId])) { $formatCode = $this->getFormatCodeForNumFmtId($numFmtId); $this->numFmtIdToIsDateFormatCache[$numFmtId] = ( $this->isNumFmtIdBuiltInDateFormat($numFm...
php
protected function doesNumFmtIdIndicateDate($numFmtId) { if (!isset($this->numFmtIdToIsDateFormatCache[$numFmtId])) { $formatCode = $this->getFormatCodeForNumFmtId($numFmtId); $this->numFmtIdToIsDateFormatCache[$numFmtId] = ( $this->isNumFmtIdBuiltInDateFormat($numFm...
[ "protected", "function", "doesNumFmtIdIndicateDate", "(", "$", "numFmtId", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "numFmtIdToIsDateFormatCache", "[", "$", "numFmtId", "]", ")", ")", "{", "$", "formatCode", "=", "$", "this", "->", "getFo...
Returns whether the number format ID indicates that the number is a date. The result is cached to avoid recomputing the same thing over and over, as "numFmtId" attributes can be shared between multiple styles. @param int $numFmtId @return bool Whether the number format ID indicates that the number is a date
[ "Returns", "whether", "the", "number", "format", "ID", "indicates", "that", "the", "number", "is", "a", "date", ".", "The", "result", "is", "cached", "to", "avoid", "recomputing", "the", "same", "thing", "over", "and", "over", "as", "numFmtId", "attributes",...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/XLSX/Helper/StyleHelper.php#L230-L242
218,548
moodle/moodle
mod/feedback/classes/responses_anon_table.php
mod_feedback_responses_anon_table.col_random_response
public function col_random_response($row) { if ($this->is_downloading()) { return $row->random_response; } else { return html_writer::link($this->get_link_single_entry($row), get_string('response_nr', 'feedback').': '. $row->random_response); } }
php
public function col_random_response($row) { if ($this->is_downloading()) { return $row->random_response; } else { return html_writer::link($this->get_link_single_entry($row), get_string('response_nr', 'feedback').': '. $row->random_response); } }
[ "public", "function", "col_random_response", "(", "$", "row", ")", "{", "if", "(", "$", "this", "->", "is_downloading", "(", ")", ")", "{", "return", "$", "row", "->", "random_response", ";", "}", "else", "{", "return", "html_writer", "::", "link", "(", ...
Prepares column reponse for display @param stdClass $row @return string
[ "Prepares", "column", "reponse", "for", "display" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_anon_table.php#L106-L113
218,549
moodle/moodle
admin/tool/log/store/database/backup/moodle2/restore_logstore_database_subplugin.class.php
restore_logstore_database_subplugin.process_logstore_database_log
public function process_logstore_database_log($data) { // Do not bother processing if we can not add it to a database. if (!self::$extdb || !self::$extdbtablename) { return; } $data = $this->process_log($data, get_config('logstore_database', 'jsonformat')); if ($dat...
php
public function process_logstore_database_log($data) { // Do not bother processing if we can not add it to a database. if (!self::$extdb || !self::$extdbtablename) { return; } $data = $this->process_log($data, get_config('logstore_database', 'jsonformat')); if ($dat...
[ "public", "function", "process_logstore_database_log", "(", "$", "data", ")", "{", "// Do not bother processing if we can not add it to a database.", "if", "(", "!", "self", "::", "$", "extdb", "||", "!", "self", "::", "$", "extdbtablename", ")", "{", "return", ";",...
Process logstore_database_log entries. This method proceeds to read, complete, remap and, finally, discard or save every log entry. @param array() $data log entry. @return null if we are not restoring the log.
[ "Process", "logstore_database_log", "entries", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/store/database/backup/moodle2/restore_logstore_database_subplugin.class.php#L90-L101
218,550
moodle/moodle
mod/lti/classes/local/ltiservice/service_base.php
service_base.is_used_in_context
public function is_used_in_context($typeid, $courseid) { global $DB; $ok = $DB->record_exists('lti', array('course' => $courseid, 'typeid' => $typeid)); return $ok || $DB->record_exists('lti_types', array('course' => $courseid, 'id' => $typeid)); }
php
public function is_used_in_context($typeid, $courseid) { global $DB; $ok = $DB->record_exists('lti', array('course' => $courseid, 'typeid' => $typeid)); return $ok || $DB->record_exists('lti_types', array('course' => $courseid, 'id' => $typeid)); }
[ "public", "function", "is_used_in_context", "(", "$", "typeid", ",", "$", "courseid", ")", "{", "global", "$", "DB", ";", "$", "ok", "=", "$", "DB", "->", "record_exists", "(", "'lti'", ",", "array", "(", "'course'", "=>", "$", "courseid", ",", "'typei...
Default implementation will check for the existence of at least one mod_lti entry for that tool and context. It may be overridden if other inferences can be done. Ideally a Site Tool should be explicitly engaged with a course, the check on the presence of a link is a proxy to infer a Site Tool engagement until an exp...
[ "Default", "implementation", "will", "check", "for", "the", "existence", "of", "at", "least", "one", "mod_lti", "entry", "for", "that", "tool", "and", "context", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/local/ltiservice/service_base.php#L172-L177
218,551
moodle/moodle
mod/lti/classes/local/ltiservice/service_base.php
service_base.is_allowed_in_context
public function is_allowed_in_context($typeid, $courseid) { global $DB; // Check if it is a Course tool for this course or a Site tool. $type = $DB->get_record('lti_types', array('id' => $typeid)); return $type && ($type->course == $courseid || $type->course == SITEID); }
php
public function is_allowed_in_context($typeid, $courseid) { global $DB; // Check if it is a Course tool for this course or a Site tool. $type = $DB->get_record('lti_types', array('id' => $typeid)); return $type && ($type->course == $courseid || $type->course == SITEID); }
[ "public", "function", "is_allowed_in_context", "(", "$", "typeid", ",", "$", "courseid", ")", "{", "global", "$", "DB", ";", "// Check if it is a Course tool for this course or a Site tool.", "$", "type", "=", "$", "DB", "->", "get_record", "(", "'lti_types'", ",", ...
Checks if there is a site tool or a course tool for this site. @param int $typeid The tool lti type id. @param int $courseid The course id. @return bool returns True if tool is allowed in context, false otherwise.
[ "Checks", "if", "there", "is", "a", "site", "tool", "or", "a", "course", "tool", "for", "this", "site", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/local/ltiservice/service_base.php#L186-L193
218,552
moodle/moodle
mod/lti/classes/local/ltiservice/service_base.php
service_base.parse_value
public function parse_value($value) { if (empty($this->resources)) { $this->resources = $this->get_resources(); } if (!empty($this->resources)) { foreach ($this->resources as $resource) { $value = $resource->parse_value($value); } } ...
php
public function parse_value($value) { if (empty($this->resources)) { $this->resources = $this->get_resources(); } if (!empty($this->resources)) { foreach ($this->resources as $resource) { $value = $resource->parse_value($value); } } ...
[ "public", "function", "parse_value", "(", "$", "value", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "resources", ")", ")", "{", "$", "this", "->", "resources", "=", "$", "this", "->", "get_resources", "(", ")", ";", "}", "if", "(", "!", ...
Parse a string for custom substitution parameter variables supported by this service's resources. @param string $value Value to be parsed @return string
[ "Parse", "a", "string", "for", "custom", "substitution", "parameter", "variables", "supported", "by", "this", "service", "s", "resources", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/local/ltiservice/service_base.php#L232-L245
218,553
moodle/moodle
mod/lti/classes/local/ltiservice/service_base.php
service_base.check_signature
private function check_signature($consumerkey, $secret, $body) { $ok = true; try { // TODO: Switch to core oauthlib once implemented - MDL-30149. lti\handle_oauth_body_post($consumerkey, $secret, $body); } catch (\Exception $e) { debugging($e->getMessage() . ...
php
private function check_signature($consumerkey, $secret, $body) { $ok = true; try { // TODO: Switch to core oauthlib once implemented - MDL-30149. lti\handle_oauth_body_post($consumerkey, $secret, $body); } catch (\Exception $e) { debugging($e->getMessage() . ...
[ "private", "function", "check_signature", "(", "$", "consumerkey", ",", "$", "secret", ",", "$", "body", ")", "{", "$", "ok", "=", "true", ";", "try", "{", "// TODO: Switch to core oauthlib once implemented - MDL-30149.", "lti", "\\", "handle_oauth_body_post", "(", ...
Check the request signature. @param string $consumerkey Consumer key @param string $secret Shared secret @param string $body Request body @return boolean
[ "Check", "the", "request", "signature", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/local/ltiservice/service_base.php#L317-L330
218,554
moodle/moodle
lib/horde/framework/Horde/Mail/Rfc822.php
Horde_Mail_Rfc822.parseAddressList
public function parseAddressList($address, array $params = array()) { if ($address instanceof Horde_Mail_Rfc822_List) { return $address; } if (empty($params['limit'])) { $params['limit'] = -1; } $this->_params = array_merge(array( 'defaul...
php
public function parseAddressList($address, array $params = array()) { if ($address instanceof Horde_Mail_Rfc822_List) { return $address; } if (empty($params['limit'])) { $params['limit'] = -1; } $this->_params = array_merge(array( 'defaul...
[ "public", "function", "parseAddressList", "(", "$", "address", ",", "array", "$", "params", "=", "array", "(", ")", ")", "{", "if", "(", "$", "address", "instanceof", "Horde_Mail_Rfc822_List", ")", "{", "return", "$", "address", ";", "}", "if", "(", "emp...
Starts the whole process. @param mixed $address The address(es) to validate. Either a string, a Horde_Mail_Rfc822_Object, or an array of strings and/or Horde_Mail_Rfc822_Objects. @param array $params Optional parameters: - default_domain: (string) Default domain/host. DEFAULT: None - group: (boolean) Return a Gro...
[ "Starts", "the", "whole", "process", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mail/Rfc822.php#L145-L189
218,555
moodle/moodle
lib/horde/framework/Horde/Mail/Rfc822.php
Horde_Mail_Rfc822._rfc822IsAtext
protected function _rfc822IsAtext($chr, $validate = null) { if (!$this->_params['validate'] && !is_null($validate)) { return strcspn($chr, $validate); } $ord = ord($chr); /* UTF-8 characters check. */ if ($ord > 127) { return ($this->_params['validat...
php
protected function _rfc822IsAtext($chr, $validate = null) { if (!$this->_params['validate'] && !is_null($validate)) { return strcspn($chr, $validate); } $ord = ord($chr); /* UTF-8 characters check. */ if ($ord > 127) { return ($this->_params['validat...
[ "protected", "function", "_rfc822IsAtext", "(", "$", "chr", ",", "$", "validate", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "_params", "[", "'validate'", "]", "&&", "!", "is_null", "(", "$", "validate", ")", ")", "{", "return", "strcs...
Check if data is an atom. @param string $chr The character to check. @param string $validate If in non-validate mode, use these characters as the non-atom delimiters. @return boolean True if a valid atom.
[ "Check", "if", "data", "is", "an", "atom", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mail/Rfc822.php#L799-L838
218,556
moodle/moodle
lib/horde/framework/Horde/Mail/Rfc822.php
Horde_Mail_Rfc822._curr
protected function _curr($advance = false) { return ($this->_ptr >= $this->_datalen) ? false : $this->_data[$advance ? $this->_ptr++ : $this->_ptr]; }
php
protected function _curr($advance = false) { return ($this->_ptr >= $this->_datalen) ? false : $this->_data[$advance ? $this->_ptr++ : $this->_ptr]; }
[ "protected", "function", "_curr", "(", "$", "advance", "=", "false", ")", "{", "return", "(", "$", "this", "->", "_ptr", ">=", "$", "this", "->", "_datalen", ")", "?", "false", ":", "$", "this", "->", "_data", "[", "$", "advance", "?", "$", "this",...
Return current character. @param boolean $advance If true, advance the cursor. @return string The current character (false if EOF reached).
[ "Return", "current", "character", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mail/Rfc822.php#L849-L854
218,557
moodle/moodle
admin/tool/lp/classes/site_competencies_form_element.php
tool_lp_site_competencies_form_element.toHtml
public function toHtml() { global $PAGE; $html = parent::toHTML(); if (!$this->isFrozen()) { $context = context_system::instance(); $params = [$context->id]; // Require some JS to select the competencies. $PAGE->requires->js_call_amd('tool_lp/for...
php
public function toHtml() { global $PAGE; $html = parent::toHTML(); if (!$this->isFrozen()) { $context = context_system::instance(); $params = [$context->id]; // Require some JS to select the competencies. $PAGE->requires->js_call_amd('tool_lp/for...
[ "public", "function", "toHtml", "(", ")", "{", "global", "$", "PAGE", ";", "$", "html", "=", "parent", "::", "toHTML", "(", ")", ";", "if", "(", "!", "$", "this", "->", "isFrozen", "(", ")", ")", "{", "$", "context", "=", "context_system", "::", ...
Generate the hidden field and the controls to show and pick the competencies.
[ "Generate", "the", "hidden", "field", "and", "the", "controls", "to", "show", "and", "pick", "the", "competencies", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/lp/classes/site_competencies_form_element.php#L62-L85
218,558
moodle/moodle
mod/quiz/classes/local/structure/slot_random.php
slot_random.get_quiz
public function get_quiz() { global $DB; if (empty($this->quiz)) { if (empty($this->record->quizid)) { throw new \coding_exception('quizid is not set.'); } $this->quiz = $DB->get_record('quiz', array('id' => $this->record->quizid)); } ...
php
public function get_quiz() { global $DB; if (empty($this->quiz)) { if (empty($this->record->quizid)) { throw new \coding_exception('quizid is not set.'); } $this->quiz = $DB->get_record('quiz', array('id' => $this->record->quizid)); } ...
[ "public", "function", "get_quiz", "(", ")", "{", "global", "$", "DB", ";", "if", "(", "empty", "(", "$", "this", "->", "quiz", ")", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "record", "->", "quizid", ")", ")", "{", "throw", "new", "...
Returns the quiz for this question slot. The quiz is fetched the first time it is requested and then stored in a member variable to be returned each subsequent time. @return mixed @throws \coding_exception
[ "Returns", "the", "quiz", "for", "this", "question", "slot", ".", "The", "quiz", "is", "fetched", "the", "first", "time", "it", "is", "requested", "and", "then", "stored", "in", "a", "member", "variable", "to", "be", "returned", "each", "subsequent", "time...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/local/structure/slot_random.php#L77-L88
218,559
moodle/moodle
mod/quiz/classes/local/structure/slot_random.php
slot_random.set_quiz
public function set_quiz($quiz) { $this->quiz = $quiz; $this->record->quizid = $quiz->id; }
php
public function set_quiz($quiz) { $this->quiz = $quiz; $this->record->quizid = $quiz->id; }
[ "public", "function", "set_quiz", "(", "$", "quiz", ")", "{", "$", "this", "->", "quiz", "=", "$", "quiz", ";", "$", "this", "->", "record", "->", "quizid", "=", "$", "quiz", "->", "id", ";", "}" ]
Sets the quiz object for the quiz slot. It is not mandatory to set the quiz as the quiz slot can fetch it the first time it is accessed, however it helps with the performance to set the quiz if you already have it. @param \stdClass $quiz The qui object.
[ "Sets", "the", "quiz", "object", "for", "the", "quiz", "slot", ".", "It", "is", "not", "mandatory", "to", "set", "the", "quiz", "as", "the", "quiz", "slot", "can", "fetch", "it", "the", "first", "time", "it", "is", "accessed", "however", "it", "helps",...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/local/structure/slot_random.php#L97-L100
218,560
moodle/moodle
mod/quiz/classes/local/structure/slot_random.php
slot_random.set_tags
public function set_tags($tags) { $this->tags = []; foreach ($tags as $tag) { // We use $tag->id as the key for the array so not only it handles duplicates of the same tag being given, // but also it is consistent with the behaviour of set_tags_by_id() below. $this->t...
php
public function set_tags($tags) { $this->tags = []; foreach ($tags as $tag) { // We use $tag->id as the key for the array so not only it handles duplicates of the same tag being given, // but also it is consistent with the behaviour of set_tags_by_id() below. $this->t...
[ "public", "function", "set_tags", "(", "$", "tags", ")", "{", "$", "this", "->", "tags", "=", "[", "]", ";", "foreach", "(", "$", "tags", "as", "$", "tag", ")", "{", "// We use $tag->id as the key for the array so not only it handles duplicates of the same tag being...
Set some tags for this quiz slot. @param \core_tag_tag[] $tags
[ "Set", "some", "tags", "for", "this", "quiz", "slot", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/local/structure/slot_random.php#L107-L114
218,561
moodle/moodle
lib/classes/task/refresh_mod_calendar_events_task.php
refresh_mod_calendar_events_task.execute
public function execute() { global $CFG; require_once($CFG->dirroot . '/course/lib.php'); // Specific list of plugins that need to be refreshed. If not set, then all mod plugins will be refreshed. $pluginstorefresh = null; if (isset($this->get_custom_data()->plugins)) { ...
php
public function execute() { global $CFG; require_once($CFG->dirroot . '/course/lib.php'); // Specific list of plugins that need to be refreshed. If not set, then all mod plugins will be refreshed. $pluginstorefresh = null; if (isset($this->get_custom_data()->plugins)) { ...
[ "public", "function", "execute", "(", ")", "{", "global", "$", "CFG", ";", "require_once", "(", "$", "CFG", "->", "dirroot", ".", "'/course/lib.php'", ")", ";", "// Specific list of plugins that need to be refreshed. If not set, then all mod plugins will be refreshed.", "$"...
Run the task to refresh calendar events.
[ "Run", "the", "task", "to", "refresh", "calendar", "events", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/refresh_mod_calendar_events_task.php#L46-L76
218,562
moodle/moodle
repository/nextcloud/classes/access_controlled_link_manager.php
access_controlled_link_manager.delete_share_dataowner_sysaccount
public function delete_share_dataowner_sysaccount($shareid) { $shareid = (int) $shareid; $deleteshareparams = [ 'share_id' => $shareid ]; $deleteshareresponse = $this->ocsclient->call('delete_share', $deleteshareparams); $xml = simplexml_load_string($deletesharerespon...
php
public function delete_share_dataowner_sysaccount($shareid) { $shareid = (int) $shareid; $deleteshareparams = [ 'share_id' => $shareid ]; $deleteshareresponse = $this->ocsclient->call('delete_share', $deleteshareparams); $xml = simplexml_load_string($deletesharerespon...
[ "public", "function", "delete_share_dataowner_sysaccount", "(", "$", "shareid", ")", "{", "$", "shareid", "=", "(", "int", ")", "$", "shareid", ";", "$", "deleteshareparams", "=", "[", "'share_id'", "=>", "$", "shareid", "]", ";", "$", "deleteshareresponse", ...
Deletes the share of the systemaccount and a user. In case the share could not be deleted a notification is displayed. @param int $shareid Remote ID of the share to be deleted.
[ "Deletes", "the", "share", "of", "the", "systemaccount", "and", "a", "user", ".", "In", "case", "the", "share", "could", "not", "be", "deleted", "a", "notification", "is", "displayed", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/classes/access_controlled_link_manager.php#L97-L109
218,563
moodle/moodle
repository/nextcloud/classes/access_controlled_link_manager.php
access_controlled_link_manager.transfer_file_to_path
public function transfer_file_to_path($srcpath, $dstpath, $operation, $webdavclient = null) { $this->systemwebdavclient->open(); $webdavendpoint = issuer_management::parse_endpoint_url('webdav', $this->issuer); $srcpath = ltrim($srcpath, '/'); $sourcepath = $webdavendpoint['path'] . $sr...
php
public function transfer_file_to_path($srcpath, $dstpath, $operation, $webdavclient = null) { $this->systemwebdavclient->open(); $webdavendpoint = issuer_management::parse_endpoint_url('webdav', $this->issuer); $srcpath = ltrim($srcpath, '/'); $sourcepath = $webdavendpoint['path'] . $sr...
[ "public", "function", "transfer_file_to_path", "(", "$", "srcpath", ",", "$", "dstpath", ",", "$", "operation", ",", "$", "webdavclient", "=", "null", ")", "{", "$", "this", "->", "systemwebdavclient", "->", "open", "(", ")", ";", "$", "webdavendpoint", "=...
Copy or moves a file to a new path. @param string $srcpath source path @param string $dstpath @param string $operation move or copy @param \webdav_client $webdavclient needed when moving files. @return String Http-status of the request @throws configuration_exception @throws \coding_exception @throws \moodle_exception...
[ "Copy", "or", "moves", "a", "file", "to", "a", "new", "path", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/classes/access_controlled_link_manager.php#L175-L216
218,564
moodle/moodle
repository/nextcloud/classes/access_controlled_link_manager.php
access_controlled_link_manager.create_folder_path_access_controlled_links
public function create_folder_path_access_controlled_links($context, $component, $filearea, $itemid) { global $CFG, $SITE; // The fullpath to store the file is generated from the context. $contextlist = array_reverse($context->get_parent_contexts(true)); $fullpath = ''; $allfolde...
php
public function create_folder_path_access_controlled_links($context, $component, $filearea, $itemid) { global $CFG, $SITE; // The fullpath to store the file is generated from the context. $contextlist = array_reverse($context->get_parent_contexts(true)); $fullpath = ''; $allfolde...
[ "public", "function", "create_folder_path_access_controlled_links", "(", "$", "context", ",", "$", "component", ",", "$", "filearea", ",", "$", "itemid", ")", "{", "global", "$", "CFG", ",", "$", "SITE", ";", "// The fullpath to store the file is generated from the co...
Creates a unique folder path for the access controlled link. @param context $context @param string $component @param string $filearea @param string $itemid @return string $result full generated path. @throws request_exception If the folder path cannot be created.
[ "Creates", "a", "unique", "folder", "path", "for", "the", "access", "controlled", "link", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/classes/access_controlled_link_manager.php#L227-L282
218,565
moodle/moodle
repository/nextcloud/classes/access_controlled_link_manager.php
access_controlled_link_manager.create_system_dav
public function create_system_dav() { $webdavendpoint = issuer_management::parse_endpoint_url('webdav', $this->issuer); // Selects the necessary information (port, type, server) from the path to build the webdavclient. $server = $webdavendpoint['host']; if ($webdavendpoint['scheme'] ===...
php
public function create_system_dav() { $webdavendpoint = issuer_management::parse_endpoint_url('webdav', $this->issuer); // Selects the necessary information (port, type, server) from the path to build the webdavclient. $server = $webdavendpoint['host']; if ($webdavendpoint['scheme'] ===...
[ "public", "function", "create_system_dav", "(", ")", "{", "$", "webdavendpoint", "=", "issuer_management", "::", "parse_endpoint_url", "(", "'webdav'", ",", "$", "this", "->", "issuer", ")", ";", "// Selects the necessary information (port, type, server) from the path to bu...
Creates a new webdav_client for the system account. @return \webdav_client @throws configuration_exception
[ "Creates", "a", "new", "webdav_client", "for", "the", "system", "account", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/classes/access_controlled_link_manager.php#L288-L313
218,566
moodle/moodle
repository/nextcloud/classes/access_controlled_link_manager.php
access_controlled_link_manager.create_storage_folder
public function create_storage_folder($controlledlinkfoldername, $webdavclient) { $parsedwebdavurl = issuer_management::parse_endpoint_url('webdav', $this->issuer); $webdavprefix = $parsedwebdavurl['path']; // Checks whether folder exist and creates non-existent folders. $webdavclient->o...
php
public function create_storage_folder($controlledlinkfoldername, $webdavclient) { $parsedwebdavurl = issuer_management::parse_endpoint_url('webdav', $this->issuer); $webdavprefix = $parsedwebdavurl['path']; // Checks whether folder exist and creates non-existent folders. $webdavclient->o...
[ "public", "function", "create_storage_folder", "(", "$", "controlledlinkfoldername", ",", "$", "webdavclient", ")", "{", "$", "parsedwebdavurl", "=", "issuer_management", "::", "parse_endpoint_url", "(", "'webdav'", ",", "$", "this", "->", "issuer", ")", ";", "$",...
Creates a folder to store access controlled links. @param string $controlledlinkfoldername @param \webdav_client $webdavclient @throws \coding_exception @throws configuration_exception @throws request_exception
[ "Creates", "a", "folder", "to", "store", "access", "controlled", "links", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/classes/access_controlled_link_manager.php#L322-L340
218,567
moodle/moodle
repository/nextcloud/classes/access_controlled_link_manager.php
access_controlled_link_manager.find_share_in_sysaccount
public function find_share_in_sysaccount($path) { $systemaccount = \core\oauth2\api::get_system_account($this->issuer); $systemaccountuser = $systemaccount->get('username'); // Find out share ID from user files. $ocsparams = [ 'path' => $path, 'reshares' => true ...
php
public function find_share_in_sysaccount($path) { $systemaccount = \core\oauth2\api::get_system_account($this->issuer); $systemaccountuser = $systemaccount->get('username'); // Find out share ID from user files. $ocsparams = [ 'path' => $path, 'reshares' => true ...
[ "public", "function", "find_share_in_sysaccount", "(", "$", "path", ")", "{", "$", "systemaccount", "=", "\\", "core", "\\", "oauth2", "\\", "api", "::", "get_system_account", "(", "$", "this", "->", "issuer", ")", ";", "$", "systemaccountuser", "=", "$", ...
Find a file that has previously been shared with the system account. @param string $path Path to file in user context. @return array shareid: ID of share, filetarget: path to file in sys account. @throws request_exception If the share cannot be resolved.
[ "Find", "a", "file", "that", "has", "previously", "been", "shared", "with", "the", "system", "account", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/classes/access_controlled_link_manager.php#L409-L456
218,568
moodle/moodle
repository/nextcloud/classes/access_controlled_link_manager.php
access_controlled_link_manager.download_for_offline_usage
public function download_for_offline_usage(string $srcpath, string $targetpath): void { $this->systemwebdavclient->open(); $webdavendpoint = issuer_management::parse_endpoint_url('webdav', $this->issuer); $srcpath = ltrim($srcpath, '/'); $sourcepath = $webdavendpoint['path'] . $srcpath; ...
php
public function download_for_offline_usage(string $srcpath, string $targetpath): void { $this->systemwebdavclient->open(); $webdavendpoint = issuer_management::parse_endpoint_url('webdav', $this->issuer); $srcpath = ltrim($srcpath, '/'); $sourcepath = $webdavendpoint['path'] . $srcpath; ...
[ "public", "function", "download_for_offline_usage", "(", "string", "$", "srcpath", ",", "string", "$", "targetpath", ")", ":", "void", "{", "$", "this", "->", "systemwebdavclient", "->", "open", "(", ")", ";", "$", "webdavendpoint", "=", "issuer_management", "...
Download a file from the system account for the purpose of offline usage. @param string $srcpath Name of a file owned by the system account @param string $targetpath Temporary filename in Moodle @throws repository_exception The download was unsuccessful, maybe the file does not exist.
[ "Download", "a", "file", "from", "the", "system", "account", "for", "the", "purpose", "of", "offline", "usage", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/classes/access_controlled_link_manager.php#L464-L476
218,569
moodle/moodle
analytics/classes/manager.php
manager.check_can_list_insights
public static function check_can_list_insights(\context $context, bool $return = false) { global $USER; if ($context->contextlevel === CONTEXT_USER && $context->instanceid == $USER->id) { $capability = 'moodle/analytics:listowninsights'; } else { $capability = 'moodle/an...
php
public static function check_can_list_insights(\context $context, bool $return = false) { global $USER; if ($context->contextlevel === CONTEXT_USER && $context->instanceid == $USER->id) { $capability = 'moodle/analytics:listowninsights'; } else { $capability = 'moodle/an...
[ "public", "static", "function", "check_can_list_insights", "(", "\\", "context", "$", "context", ",", "bool", "$", "return", "=", "false", ")", "{", "global", "$", "USER", ";", "if", "(", "$", "context", "->", "contextlevel", "===", "CONTEXT_USER", "&&", "...
Checks that the user can list that context insights @throws \required_capability_exception @param \context $context @param bool $return The method returns a bool if true. @return void
[ "Checks", "that", "the", "user", "can", "list", "that", "context", "insights" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L86-L100
218,570
moodle/moodle
analytics/classes/manager.php
manager.get_all_models
public static function get_all_models($enabled = false, $trained = false, $predictioncontext = false) { global $DB; $params = array(); $sql = "SELECT am.* FROM {analytics_models} am"; if ($enabled || $trained || $predictioncontext) { $conditions = []; if ($enab...
php
public static function get_all_models($enabled = false, $trained = false, $predictioncontext = false) { global $DB; $params = array(); $sql = "SELECT am.* FROM {analytics_models} am"; if ($enabled || $trained || $predictioncontext) { $conditions = []; if ($enab...
[ "public", "static", "function", "get_all_models", "(", "$", "enabled", "=", "false", ",", "$", "trained", "=", "false", ",", "$", "predictioncontext", "=", "false", ")", "{", "global", "$", "DB", ";", "$", "params", "=", "array", "(", ")", ";", "$", ...
Returns all system models that match the provided filters. @param bool $enabled @param bool $trained @param \context|false $predictioncontext @return \core_analytics\model[]
[ "Returns", "all", "system", "models", "that", "match", "the", "provided", "filters", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L110-L147
218,571
moodle/moodle
analytics/classes/manager.php
manager.get_predictions_processor
public static function get_predictions_processor($predictionclass = false, $checkisready = true) { // We want 0 or 1 so we can use it as an array key for caching. $checkisready = intval($checkisready); if (!$predictionclass) { $predictionclass = get_config('analytics', 'predictions...
php
public static function get_predictions_processor($predictionclass = false, $checkisready = true) { // We want 0 or 1 so we can use it as an array key for caching. $checkisready = intval($checkisready); if (!$predictionclass) { $predictionclass = get_config('analytics', 'predictions...
[ "public", "static", "function", "get_predictions_processor", "(", "$", "predictionclass", "=", "false", ",", "$", "checkisready", "=", "true", ")", "{", "// We want 0 or 1 so we can use it as an array key for caching.", "$", "checkisready", "=", "intval", "(", "$", "che...
Returns the provided predictions processor class. @param false|string $predictionclass Returns the system default processor if false @param bool $checkisready @return \core_analytics\predictor
[ "Returns", "the", "provided", "predictions", "processor", "class", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L156-L193
218,572
moodle/moodle
analytics/classes/manager.php
manager.get_all_prediction_processors
public static function get_all_prediction_processors() { $mlbackends = \core_component::get_plugin_list('mlbackend'); $predictionprocessors = array(); foreach ($mlbackends as $mlbackend => $unused) { $classfullpath = '\mlbackend_' . $mlbackend . '\processor'; $predictio...
php
public static function get_all_prediction_processors() { $mlbackends = \core_component::get_plugin_list('mlbackend'); $predictionprocessors = array(); foreach ($mlbackends as $mlbackend => $unused) { $classfullpath = '\mlbackend_' . $mlbackend . '\processor'; $predictio...
[ "public", "static", "function", "get_all_prediction_processors", "(", ")", "{", "$", "mlbackends", "=", "\\", "core_component", "::", "get_plugin_list", "(", "'mlbackend'", ")", ";", "$", "predictionprocessors", "=", "array", "(", ")", ";", "foreach", "(", "$", ...
Return all system predictions processors. @return \core_analytics\predictor[]
[ "Return", "all", "system", "predictions", "processors", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L200-L210
218,573
moodle/moodle
analytics/classes/manager.php
manager.get_predictions_processor_name
public static function get_predictions_processor_name(\core_analytics\predictor $predictionsprocessor) { $component = substr(get_class($predictionsprocessor), 0, strpos(get_class($predictionsprocessor), '\\', 1)); return get_string('pluginname', $component); }
php
public static function get_predictions_processor_name(\core_analytics\predictor $predictionsprocessor) { $component = substr(get_class($predictionsprocessor), 0, strpos(get_class($predictionsprocessor), '\\', 1)); return get_string('pluginname', $component); }
[ "public", "static", "function", "get_predictions_processor_name", "(", "\\", "core_analytics", "\\", "predictor", "$", "predictionsprocessor", ")", "{", "$", "component", "=", "substr", "(", "get_class", "(", "$", "predictionsprocessor", ")", ",", "0", ",", "strpo...
Returns the name of the provided predictions processor. @param \core_analytics\predictor $predictionsprocessor @return string
[ "Returns", "the", "name", "of", "the", "provided", "predictions", "processor", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L218-L221
218,574
moodle/moodle
analytics/classes/manager.php
manager.is_mlbackend_used
public static function is_mlbackend_used($plugin) { $models = self::get_all_models(); foreach ($models as $model) { $processor = $model->get_predictions_processor(); $noprefixnamespace = ltrim(get_class($processor), '\\'); $processorplugin = substr($noprefixnamespace,...
php
public static function is_mlbackend_used($plugin) { $models = self::get_all_models(); foreach ($models as $model) { $processor = $model->get_predictions_processor(); $noprefixnamespace = ltrim(get_class($processor), '\\'); $processorplugin = substr($noprefixnamespace,...
[ "public", "static", "function", "is_mlbackend_used", "(", "$", "plugin", ")", "{", "$", "models", "=", "self", "::", "get_all_models", "(", ")", ";", "foreach", "(", "$", "models", "as", "$", "model", ")", "{", "$", "processor", "=", "$", "model", "->"...
Whether the provided plugin is used by any model. @param string $plugin @return bool
[ "Whether", "the", "provided", "plugin", "is", "used", "by", "any", "model", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L229-L248
218,575
moodle/moodle
analytics/classes/manager.php
manager.get_all_time_splittings
public static function get_all_time_splittings() { if (self::$alltimesplittings !== null) { return self::$alltimesplittings; } $classes = self::get_analytics_classes('time_splitting'); self::$alltimesplittings = []; foreach ($classes as $fullclassname => $classpath)...
php
public static function get_all_time_splittings() { if (self::$alltimesplittings !== null) { return self::$alltimesplittings; } $classes = self::get_analytics_classes('time_splitting'); self::$alltimesplittings = []; foreach ($classes as $fullclassname => $classpath)...
[ "public", "static", "function", "get_all_time_splittings", "(", ")", "{", "if", "(", "self", "::", "$", "alltimesplittings", "!==", "null", ")", "{", "return", "self", "::", "$", "alltimesplittings", ";", "}", "$", "classes", "=", "self", "::", "get_analytic...
Get all available time splitting methods. @return \core_analytics\local\time_splitting\base[]
[ "Get", "all", "available", "time", "splitting", "methods", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L255-L272
218,576
moodle/moodle
analytics/classes/manager.php
manager.get_time_splitting_methods_for_evaluation
public static function get_time_splitting_methods_for_evaluation(bool $all = false) { if ($all === false) { if ($enabledtimesplittings = get_config('analytics', 'defaulttimesplittingsevaluation')) { $enabledtimesplittings = array_flip(explode(',', $enabledtimesplittings)); ...
php
public static function get_time_splitting_methods_for_evaluation(bool $all = false) { if ($all === false) { if ($enabledtimesplittings = get_config('analytics', 'defaulttimesplittingsevaluation')) { $enabledtimesplittings = array_flip(explode(',', $enabledtimesplittings)); ...
[ "public", "static", "function", "get_time_splitting_methods_for_evaluation", "(", "bool", "$", "all", "=", "false", ")", "{", "if", "(", "$", "all", "===", "false", ")", "{", "if", "(", "$", "enabledtimesplittings", "=", "get_config", "(", "'analytics'", ",", ...
Returns the time-splitting methods for model evaluation. @param bool $all Return all the time-splitting methods that can potentially be used for evaluation or the default ones. @return \core_analytics\local\time_splitting\base[]
[ "Returns", "the", "time", "-", "splitting", "methods", "for", "model", "evaluation", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L295-L318
218,577
moodle/moodle
analytics/classes/manager.php
manager.get_all_targets
public static function get_all_targets() : array { if (self::$alltargets !== null) { return self::$alltargets; } $classes = self::get_analytics_classes('target'); self::$alltargets = []; foreach ($classes as $fullclassname => $classpath) { $instance = se...
php
public static function get_all_targets() : array { if (self::$alltargets !== null) { return self::$alltargets; } $classes = self::get_analytics_classes('target'); self::$alltargets = []; foreach ($classes as $fullclassname => $classpath) { $instance = se...
[ "public", "static", "function", "get_all_targets", "(", ")", ":", "array", "{", "if", "(", "self", "::", "$", "alltargets", "!==", "null", ")", "{", "return", "self", "::", "$", "alltargets", ";", "}", "$", "classes", "=", "self", "::", "get_analytics_cl...
Return all targets in the system. @return \core_analytics\local\target\base[]
[ "Return", "all", "targets", "in", "the", "system", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L338-L354
218,578
moodle/moodle
analytics/classes/manager.php
manager.get_all_indicators
public static function get_all_indicators() { if (self::$allindicators !== null) { return self::$allindicators; } $classes = self::get_analytics_classes('indicator'); self::$allindicators = []; foreach ($classes as $fullclassname => $classpath) { $instan...
php
public static function get_all_indicators() { if (self::$allindicators !== null) { return self::$allindicators; } $classes = self::get_analytics_classes('indicator'); self::$allindicators = []; foreach ($classes as $fullclassname => $classpath) { $instan...
[ "public", "static", "function", "get_all_indicators", "(", ")", "{", "if", "(", "self", "::", "$", "allindicators", "!==", "null", ")", "{", "return", "self", "::", "$", "allindicators", ";", "}", "$", "classes", "=", "self", "::", "get_analytics_classes", ...
Return all system indicators. @return \core_analytics\local\indicator\base[]
[ "Return", "all", "system", "indicators", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L360-L376
218,579
moodle/moodle
analytics/classes/manager.php
manager.is_valid
public static function is_valid($fullclassname, $baseclass) { if (is_subclass_of($fullclassname, $baseclass)) { if ((new \ReflectionClass($fullclassname))->isInstantiable()) { return true; } } return false; }
php
public static function is_valid($fullclassname, $baseclass) { if (is_subclass_of($fullclassname, $baseclass)) { if ((new \ReflectionClass($fullclassname))->isInstantiable()) { return true; } } return false; }
[ "public", "static", "function", "is_valid", "(", "$", "fullclassname", ",", "$", "baseclass", ")", "{", "if", "(", "is_subclass_of", "(", "$", "fullclassname", ",", "$", "baseclass", ")", ")", "{", "if", "(", "(", "new", "\\", "ReflectionClass", "(", "$"...
Returns whether a time splitting method is valid or not. @param string $fullclassname @param string $baseclass @return bool
[ "Returns", "whether", "a", "time", "splitting", "method", "is", "valid", "or", "not", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L411-L418
218,580
moodle/moodle
analytics/classes/manager.php
manager.get_analytics_logstore
public static function get_analytics_logstore() { $readers = get_log_manager()->get_readers('core\log\sql_reader'); $analyticsstore = get_config('analytics', 'logstore'); if (!empty($analyticsstore) && !empty($readers[$analyticsstore])) { $logstore = $readers[$analyticsstore]; ...
php
public static function get_analytics_logstore() { $readers = get_log_manager()->get_readers('core\log\sql_reader'); $analyticsstore = get_config('analytics', 'logstore'); if (!empty($analyticsstore) && !empty($readers[$analyticsstore])) { $logstore = $readers[$analyticsstore]; ...
[ "public", "static", "function", "get_analytics_logstore", "(", ")", "{", "$", "readers", "=", "get_log_manager", "(", ")", "->", "get_readers", "(", "'core\\log\\sql_reader'", ")", ";", "$", "analyticsstore", "=", "get_config", "(", "'analytics'", ",", "'logstore'...
Returns the logstore used for analytics. @return \core\log\sql_reader|false False if no log stores are enabled.
[ "Returns", "the", "logstore", "used", "for", "analytics", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L425-L451
218,581
moodle/moodle
analytics/classes/manager.php
manager.get_indicator_calculations
public static function get_indicator_calculations($analysable, $starttime, $endtime, $samplesorigin) { global $DB; $params = array('starttime' => $starttime, 'endtime' => $endtime, 'contextid' => $analysable->get_context()->id, 'sampleorigin' => $samplesorigin); $calculations = $DB-...
php
public static function get_indicator_calculations($analysable, $starttime, $endtime, $samplesorigin) { global $DB; $params = array('starttime' => $starttime, 'endtime' => $endtime, 'contextid' => $analysable->get_context()->id, 'sampleorigin' => $samplesorigin); $calculations = $DB-...
[ "public", "static", "function", "get_indicator_calculations", "(", "$", "analysable", ",", "$", "starttime", ",", "$", "endtime", ",", "$", "samplesorigin", ")", "{", "global", "$", "DB", ";", "$", "params", "=", "array", "(", "'starttime'", "=>", "$", "st...
Returns this analysable calculations during the provided period. @param \core_analytics\analysable $analysable @param int $starttime @param int $endtime @param string $samplesorigin The samples origin as sampleid is not unique across models. @return array
[ "Returns", "this", "analysable", "calculations", "during", "the", "provided", "period", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L462-L478
218,582
moodle/moodle
analytics/classes/manager.php
manager.get_models_with_insights
public static function get_models_with_insights(\context $context) { self::check_can_list_insights($context); $models = self::get_all_models(true, true, $context); foreach ($models as $key => $model) { // Check that it not only have predictions but also generates insights from them...
php
public static function get_models_with_insights(\context $context) { self::check_can_list_insights($context); $models = self::get_all_models(true, true, $context); foreach ($models as $key => $model) { // Check that it not only have predictions but also generates insights from them...
[ "public", "static", "function", "get_models_with_insights", "(", "\\", "context", "$", "context", ")", "{", "self", "::", "check_can_list_insights", "(", "$", "context", ")", ";", "$", "models", "=", "self", "::", "get_all_models", "(", "true", ",", "true", ...
Returns the models with insights at the provided context. @param \context $context @return \core_analytics\model[]
[ "Returns", "the", "models", "with", "insights", "at", "the", "provided", "context", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L486-L498
218,583
moodle/moodle
analytics/classes/manager.php
manager.get_prediction
public static function get_prediction($predictionid, $requirelogin = false) { global $DB; if (!$predictionobj = $DB->get_record('analytics_predictions', array('id' => $predictionid))) { throw new \moodle_exception('errorpredictionnotfound', 'analytics'); } $context = \conte...
php
public static function get_prediction($predictionid, $requirelogin = false) { global $DB; if (!$predictionobj = $DB->get_record('analytics_predictions', array('id' => $predictionid))) { throw new \moodle_exception('errorpredictionnotfound', 'analytics'); } $context = \conte...
[ "public", "static", "function", "get_prediction", "(", "$", "predictionid", ",", "$", "requirelogin", "=", "false", ")", "{", "global", "$", "DB", ";", "if", "(", "!", "$", "predictionobj", "=", "$", "DB", "->", "get_record", "(", "'analytics_predictions'", ...
Returns a prediction @param int $predictionid @param bool $requirelogin @return array array($model, $prediction, $context)
[ "Returns", "a", "prediction" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L507-L531
218,584
moodle/moodle
analytics/classes/manager.php
manager.cleanup
public static function cleanup() { global $DB; // Clean up stuff that depends on contexts that do not exist anymore. $sql = "SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap LEFT JOIN {context} ctx ON ap.contextid = ctx.id WHERE ctx.id IS NULL"; ...
php
public static function cleanup() { global $DB; // Clean up stuff that depends on contexts that do not exist anymore. $sql = "SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap LEFT JOIN {context} ctx ON ap.contextid = ctx.id WHERE ctx.id IS NULL"; ...
[ "public", "static", "function", "cleanup", "(", ")", "{", "global", "$", "DB", ";", "// Clean up stuff that depends on contexts that do not exist anymore.", "$", "sql", "=", "\"SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap\n LEFT JOIN {context} ctx ON ap...
Cleans up analytics db tables that do not directly depend on analysables that may have been deleted.
[ "Cleans", "up", "analytics", "db", "tables", "that", "do", "not", "directly", "depend", "on", "analysables", "that", "may", "have", "been", "deleted", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L549-L596
218,585
moodle/moodle
analytics/classes/manager.php
manager.get_analytics_classes
private static function get_analytics_classes($element) { // Just in case... $element = clean_param($element, PARAM_ALPHANUMEXT); $classes = \core_component::get_component_classes_in_namespace(null, 'analytics\\' . $element); return $classes; }
php
private static function get_analytics_classes($element) { // Just in case... $element = clean_param($element, PARAM_ALPHANUMEXT); $classes = \core_component::get_component_classes_in_namespace(null, 'analytics\\' . $element); return $classes; }
[ "private", "static", "function", "get_analytics_classes", "(", "$", "element", ")", "{", "// Just in case...", "$", "element", "=", "clean_param", "(", "$", "element", ",", "PARAM_ALPHANUMEXT", ")", ";", "$", "classes", "=", "\\", "core_component", "::", "get_co...
Returns the provided element classes in the site. @param string $element @return string[] Array keys are the FQCN and the values the class path.
[ "Returns", "the", "provided", "element", "classes", "in", "the", "site", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L613-L621
218,586
moodle/moodle
analytics/classes/manager.php
manager.update_default_models_for_component
public static function update_default_models_for_component(string $componentname): array { $result = []; foreach (static::load_default_models_for_component($componentname) as $definition) { if (!\core_analytics\model::exists(static::get_target($definition['target']))) { $re...
php
public static function update_default_models_for_component(string $componentname): array { $result = []; foreach (static::load_default_models_for_component($componentname) as $definition) { if (!\core_analytics\model::exists(static::get_target($definition['target']))) { $re...
[ "public", "static", "function", "update_default_models_for_component", "(", "string", "$", "componentname", ")", ":", "array", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "static", "::", "load_default_models_for_component", "(", "$", "componentname", "...
Check that all the models declared by the component are up to date. This is intended to be called during the installation / upgrade to automatically create missing models. @param string $componentname The name of the component to load models for. @return array \core_analytics\model[] List of actually created models.
[ "Check", "that", "all", "the", "models", "declared", "by", "the", "component", "are", "up", "to", "date", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L631-L642
218,587
moodle/moodle
analytics/classes/manager.php
manager.load_default_models_for_component
public static function load_default_models_for_component(string $componentname): array { $dir = \core_component::get_component_directory($componentname); if (!$dir) { // This is either an invalid component, or a core subsystem without its own root directory. return []; ...
php
public static function load_default_models_for_component(string $componentname): array { $dir = \core_component::get_component_directory($componentname); if (!$dir) { // This is either an invalid component, or a core subsystem without its own root directory. return []; ...
[ "public", "static", "function", "load_default_models_for_component", "(", "string", "$", "componentname", ")", ":", "array", "{", "$", "dir", "=", "\\", "core_component", "::", "get_component_directory", "(", "$", "componentname", ")", ";", "if", "(", "!", "$", ...
Return the list of models declared by the given component. @param string $componentname The name of the component to load models for. @throws \coding_exception Exception thrown in case of invalid syntax. @return array The $models description array.
[ "Return", "the", "list", "of", "models", "declared", "by", "the", "given", "component", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L651-L684
218,588
moodle/moodle
analytics/classes/manager.php
manager.load_default_models_for_all_components
public static function load_default_models_for_all_components(): array { $tmp = []; foreach (\core_component::get_component_list() as $type => $components) { foreach (array_keys($components) as $component) { if ($loaded = static::load_default_models_for_component($component...
php
public static function load_default_models_for_all_components(): array { $tmp = []; foreach (\core_component::get_component_list() as $type => $components) { foreach (array_keys($components) as $component) { if ($loaded = static::load_default_models_for_component($component...
[ "public", "static", "function", "load_default_models_for_all_components", "(", ")", ":", "array", "{", "$", "tmp", "=", "[", "]", ";", "foreach", "(", "\\", "core_component", "::", "get_component_list", "(", ")", "as", "$", "type", "=>", "$", "components", "...
Return the list of all the models declared anywhere in this Moodle installation. Models defined by the core and core subsystems come first, followed by those provided by plugins. @return array indexed by the frankenstyle component
[ "Return", "the", "list", "of", "all", "the", "models", "declared", "anywhere", "in", "this", "Moodle", "installation", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L693-L721
218,589
moodle/moodle
analytics/classes/manager.php
manager.validate_models_declaration
public static function validate_models_declaration(array $models) { foreach ($models as $model) { if (!isset($model['target'])) { throw new \coding_exception('Missing target declaration'); } if (!static::is_valid($model['target'], '\core_analytics\local\targ...
php
public static function validate_models_declaration(array $models) { foreach ($models as $model) { if (!isset($model['target'])) { throw new \coding_exception('Missing target declaration'); } if (!static::is_valid($model['target'], '\core_analytics\local\targ...
[ "public", "static", "function", "validate_models_declaration", "(", "array", "$", "models", ")", "{", "foreach", "(", "$", "models", "as", "$", "model", ")", "{", "if", "(", "!", "isset", "(", "$", "model", "[", "'target'", "]", ")", ")", "{", "throw",...
Validate the declaration of prediction models according the syntax expected in the component's db folder. The expected structure looks like this: [ [ 'target' => '\fully\qualified\name\of\the\target\class', 'indicators' => [ '\fully\qualified\name\of\the\first\indicator', '\fully\qualified\name\of\the\second\indicato...
[ "Validate", "the", "declaration", "of", "prediction", "models", "according", "the", "syntax", "expected", "in", "the", "component", "s", "db", "folder", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L743-L777
218,590
moodle/moodle
analytics/classes/manager.php
manager.create_declared_model
public static function create_declared_model(array $definition): \core_analytics\model { list($target, $indicators) = static::get_declared_target_and_indicators_instances($definition); if (isset($definition['timesplitting'])) { $timesplitting = $definition['timesplitting']; } else ...
php
public static function create_declared_model(array $definition): \core_analytics\model { list($target, $indicators) = static::get_declared_target_and_indicators_instances($definition); if (isset($definition['timesplitting'])) { $timesplitting = $definition['timesplitting']; } else ...
[ "public", "static", "function", "create_declared_model", "(", "array", "$", "definition", ")", ":", "\\", "core_analytics", "\\", "model", "{", "list", "(", "$", "target", ",", "$", "indicators", ")", "=", "static", "::", "get_declared_target_and_indicators_instan...
Create the defined model. @param array $definition See {@link self::validate_models_declaration()} for the syntax. @return \core_analytics\model
[ "Create", "the", "defined", "model", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L785-L802
218,591
moodle/moodle
analytics/classes/manager.php
manager.get_declared_target_and_indicators_instances
public static function get_declared_target_and_indicators_instances(array $definition): array { $target = static::get_target($definition['target']); $indicators = []; foreach ($definition['indicators'] as $indicatorname) { $indicator = static::get_indicator($indicatorname); ...
php
public static function get_declared_target_and_indicators_instances(array $definition): array { $target = static::get_target($definition['target']); $indicators = []; foreach ($definition['indicators'] as $indicatorname) { $indicator = static::get_indicator($indicatorname); ...
[ "public", "static", "function", "get_declared_target_and_indicators_instances", "(", "array", "$", "definition", ")", ":", "array", "{", "$", "target", "=", "static", "::", "get_target", "(", "$", "definition", "[", "'target'", "]", ")", ";", "$", "indicators", ...
Given a model definition, return actual target and indicators instances. @param array $definition See {@link self::validate_models_declaration()} for the syntax. @return array [0] => target instance, [1] => array of indicators instances
[ "Given", "a", "model", "definition", "return", "actual", "target", "and", "indicators", "instances", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/manager.php#L820-L832
218,592
moodle/moodle
lib/classes/lock/file_lock_factory.php
file_lock_factory.is_available
public function is_available() { global $CFG; $preventfilelocking = !empty($CFG->preventfilelocking); $lockdirisdataroot = true; if (!empty($CFG->file_lock_root) && strpos($CFG->file_lock_root, $CFG->dataroot) !== 0) { $lockdirisdataroot = false; } return !$pr...
php
public function is_available() { global $CFG; $preventfilelocking = !empty($CFG->preventfilelocking); $lockdirisdataroot = true; if (!empty($CFG->file_lock_root) && strpos($CFG->file_lock_root, $CFG->dataroot) !== 0) { $lockdirisdataroot = false; } return !$pr...
[ "public", "function", "is_available", "(", ")", "{", "global", "$", "CFG", ";", "$", "preventfilelocking", "=", "!", "empty", "(", "$", "CFG", "->", "preventfilelocking", ")", ";", "$", "lockdirisdataroot", "=", "true", ";", "if", "(", "!", "empty", "(",...
Is available. @return boolean - True if preventfilelocking is not set - or the file_lock_root is not in dataroot.
[ "Is", "available", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/lock/file_lock_factory.php#L99-L107
218,593
moodle/moodle
lib/classes/lock/file_lock_factory.php
file_lock_factory.get_lock
public function get_lock($resource, $timeout, $maxlifetime = 86400) { $giveuptime = time() + $timeout; $hash = md5($this->type . '_' . $resource); $lockdir = $this->lockdirectory . '/' . substr($hash, 0, 2); if (!check_dir_exists($lockdir, true, true)) { return false; ...
php
public function get_lock($resource, $timeout, $maxlifetime = 86400) { $giveuptime = time() + $timeout; $hash = md5($this->type . '_' . $resource); $lockdir = $this->lockdirectory . '/' . substr($hash, 0, 2); if (!check_dir_exists($lockdir, true, true)) { return false; ...
[ "public", "function", "get_lock", "(", "$", "resource", ",", "$", "timeout", ",", "$", "maxlifetime", "=", "86400", ")", "{", "$", "giveuptime", "=", "time", "(", ")", "+", "$", "timeout", ";", "$", "hash", "=", "md5", "(", "$", "this", "->", "type...
Get a lock within the specified timeout or return false. @param string $resource - The identifier for the lock. Should use frankenstyle prefix. @param int $timeout - The number of seconds to wait for a lock before giving up. @param int $maxlifetime - Unused by this lock type. @return boolean - true if a lock was obtain...
[ "Get", "a", "lock", "within", "the", "specified", "timeout", "or", "return", "false", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/lock/file_lock_factory.php#L132-L169
218,594
moodle/moodle
backup/util/settings/backup_setting.class.php
backup_setting.make_ui
public function make_ui($type, $label, array $attributes = null, array $options = null) { $this->uisetting = backup_setting_ui::make($this, $type, $label, $attributes, $options); if (is_array($options) || is_object($options)) { $options = (array)$options; switch (get_class($this-...
php
public function make_ui($type, $label, array $attributes = null, array $options = null) { $this->uisetting = backup_setting_ui::make($this, $type, $label, $attributes, $options); if (is_array($options) || is_object($options)) { $options = (array)$options; switch (get_class($this-...
[ "public", "function", "make_ui", "(", "$", "type", ",", "$", "label", ",", "array", "$", "attributes", "=", "null", ",", "array", "$", "options", "=", "null", ")", "{", "$", "this", "->", "uisetting", "=", "backup_setting_ui", "::", "make", "(", "$", ...
Creates and sets a user interface for this setting given appropriate arguments @param int $type @param string $label @param array $attributes @param array $options
[ "Creates", "and", "sets", "a", "user", "interface", "for", "this", "setting", "given", "appropriate", "arguments" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/settings/backup_setting.class.php#L67-L91
218,595
moodle/moodle
backup/util/ui/import_extensions.php
import_ui_stage_confirmation.display
public function display(core_backup_renderer $renderer) { $form = $this->initialise_stage_form(); $form->require_definition_after_data(); if ($e = $form->get_element('submitbutton')) { $e->setLabel(get_string('import'.$this->get_ui()->get_name().'stage'.$this->get_stage().'action', '...
php
public function display(core_backup_renderer $renderer) { $form = $this->initialise_stage_form(); $form->require_definition_after_data(); if ($e = $form->get_element('submitbutton')) { $e->setLabel(get_string('import'.$this->get_ui()->get_name().'stage'.$this->get_stage().'action', '...
[ "public", "function", "display", "(", "core_backup_renderer", "$", "renderer", ")", "{", "$", "form", "=", "$", "this", "->", "initialise_stage_form", "(", ")", ";", "$", "form", "->", "require_definition_after_data", "(", ")", ";", "if", "(", "$", "e", "=...
Displays the stage This function is overriden so that we can manipulate the strings on the buttons. @param core_backup_renderer $renderer @return string HTML code to echo
[ "Displays", "the", "stage" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/import_extensions.php#L163-L188
218,596
moodle/moodle
question/type/numerical/questiontype.php
qtype_numerical.is_valid_number
public static function is_valid_number(string $x) : bool { $ap = new qtype_numerical_answer_processor(array()); list($value, $unit) = $ap->apply_units($x); return !is_null($value) && !$unit; }
php
public static function is_valid_number(string $x) : bool { $ap = new qtype_numerical_answer_processor(array()); list($value, $unit) = $ap->apply_units($x); return !is_null($value) && !$unit; }
[ "public", "static", "function", "is_valid_number", "(", "string", "$", "x", ")", ":", "bool", "{", "$", "ap", "=", "new", "qtype_numerical_answer_processor", "(", "array", "(", ")", ")", ";", "list", "(", "$", "value", ",", "$", "unit", ")", "=", "$", ...
Validate that a string is a number formatted correctly for the current locale. @param string $x a string @return bool whether $x is a number that the numerical question type can interpret.
[ "Validate", "that", "a", "string", "is", "a", "number", "formatted", "correctly", "for", "the", "current", "locale", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/numerical/questiontype.php#L60-L64
218,597
moodle/moodle
question/type/numerical/questiontype.php
qtype_numerical.add_unit
public function add_unit($questiondata, $answer, $unit = null) { if (is_null($unit)) { $unit = $this->get_default_numerical_unit($questiondata); } if (!$unit) { return $answer; } if (!empty($questiondata->options->unitsleft)) { return $unit->...
php
public function add_unit($questiondata, $answer, $unit = null) { if (is_null($unit)) { $unit = $this->get_default_numerical_unit($questiondata); } if (!$unit) { return $answer; } if (!empty($questiondata->options->unitsleft)) { return $unit->...
[ "public", "function", "add_unit", "(", "$", "questiondata", ",", "$", "answer", ",", "$", "unit", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "unit", ")", ")", "{", "$", "unit", "=", "$", "this", "->", "get_default_numerical_unit", "(", "$...
Add a unit to a response for display. @param object $questiondata the data defining the quetsion. @param string $answer a response. @param object $unit a unit. If null, {@link get_default_numerical_unit()} is used.
[ "Add", "a", "unit", "to", "a", "response", "for", "display", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/numerical/questiontype.php#L414-L428
218,598
moodle/moodle
question/type/numerical/questiontype.php
qtype_numerical_answer_processor.set_characters
public function set_characters($decsep, $thousandssep) { $this->decsep = $decsep; $this->thousandssep = $thousandssep; $this->regex = null; }
php
public function set_characters($decsep, $thousandssep) { $this->decsep = $decsep; $this->thousandssep = $thousandssep; $this->regex = null; }
[ "public", "function", "set_characters", "(", "$", "decsep", ",", "$", "thousandssep", ")", "{", "$", "this", "->", "decsep", "=", "$", "decsep", ";", "$", "this", "->", "thousandssep", "=", "$", "thousandssep", ";", "$", "this", "->", "regex", "=", "nu...
Set the decimal point and thousands separator character that should be used. @param string $decsep @param string $thousandssep
[ "Set", "the", "decimal", "point", "and", "thousands", "separator", "character", "that", "should", "be", "used", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/numerical/questiontype.php#L539-L543
218,599
moodle/moodle
question/type/numerical/questiontype.php
qtype_numerical_answer_processor.parse_response
protected function parse_response($response) { if (!preg_match($this->build_regex(), $response, $matches)) { return array(null, null, null, null); } $matches += array('', '', '', ''); // Fill in any missing matches. list($matchedpart, $beforepoint, $decimals, $exponent) = $m...
php
protected function parse_response($response) { if (!preg_match($this->build_regex(), $response, $matches)) { return array(null, null, null, null); } $matches += array('', '', '', ''); // Fill in any missing matches. list($matchedpart, $beforepoint, $decimals, $exponent) = $m...
[ "protected", "function", "parse_response", "(", "$", "response", ")", "{", "if", "(", "!", "preg_match", "(", "$", "this", "->", "build_regex", "(", ")", ",", "$", "response", ",", "$", "matches", ")", ")", "{", "return", "array", "(", "null", ",", "...
This method can be used for more locale-strict parsing of repsonses. At the moment we don't use it, and instead use the more lax parsing in apply_units. This is just a note that this funciton was used in the past, so if you are intersted, look through version control history. Take a string which is a number with or wi...
[ "This", "method", "can", "be", "used", "for", "more", "locale", "-", "strict", "parsing", "of", "repsonses", ".", "At", "the", "moment", "we", "don", "t", "use", "it", "and", "instead", "use", "the", "more", "lax", "parsing", "in", "apply_units", ".", ...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/numerical/questiontype.php#L606-L631