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
214,500
moodle/moodle
mod/lesson/locallib.php
lesson.get_courserecord
public function get_courserecord() { global $DB; if ($this->courserecord == null) { $this->courserecord = $DB->get_record('course', array('id' => $this->properties->course)); } return $this->courserecord; }
php
public function get_courserecord() { global $DB; if ($this->courserecord == null) { $this->courserecord = $DB->get_record('course', array('id' => $this->properties->course)); } return $this->courserecord; }
[ "public", "function", "get_courserecord", "(", ")", "{", "global", "$", "DB", ";", "if", "(", "$", "this", "->", "courserecord", "==", "null", ")", "{", "$", "this", "->", "courserecord", "=", "$", "DB", "->", "get_record", "(", "'course'", ",", "array...
Return the lesson course object. @return stdClass course @since Moodle 3.3
[ "Return", "the", "lesson", "course", "object", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2775-L2782
214,501
moodle/moodle
mod/lesson/locallib.php
lesson.get_time_restriction_status
public function get_time_restriction_status() { if ($this->can_manage()) { return false; } if (!$this->is_accessible()) { if ($this->properties->deadline != 0 && time() > $this->properties->deadline) { $status = ['reason' => 'lessonclosed', 'time' => $thi...
php
public function get_time_restriction_status() { if ($this->can_manage()) { return false; } if (!$this->is_accessible()) { if ($this->properties->deadline != 0 && time() > $this->properties->deadline) { $status = ['reason' => 'lessonclosed', 'time' => $thi...
[ "public", "function", "get_time_restriction_status", "(", ")", "{", "if", "(", "$", "this", "->", "can_manage", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "$", "this", "->", "is_accessible", "(", ")", ")", "{", "if", "(", "$", ...
Check if time restriction is applied. @return mixed false if there aren't restrictions or an object with the restriction information @since Moodle 3.3
[ "Check", "if", "time", "restriction", "is", "applied", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2800-L2814
214,502
moodle/moodle
mod/lesson/locallib.php
lesson.get_password_restriction_status
public function get_password_restriction_status($userpassword) { global $USER; if ($this->can_manage()) { return false; } if ($this->properties->usepassword && empty($USER->lessonloggedin[$this->id])) { $correctpass = false; if (!empty($userpassword) ...
php
public function get_password_restriction_status($userpassword) { global $USER; if ($this->can_manage()) { return false; } if ($this->properties->usepassword && empty($USER->lessonloggedin[$this->id])) { $correctpass = false; if (!empty($userpassword) ...
[ "public", "function", "get_password_restriction_status", "(", "$", "userpassword", ")", "{", "global", "$", "USER", ";", "if", "(", "$", "this", "->", "can_manage", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "propertie...
Check if password restriction is applied. @param string $userpassword the user password to check (if the restriction is set) @return mixed false if there aren't restrictions or an object with the restriction information @since Moodle 3.3
[ "Check", "if", "password", "restriction", "is", "applied", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2823-L2848
214,503
moodle/moodle
mod/lesson/locallib.php
lesson.get_dependencies_restriction_status
public function get_dependencies_restriction_status() { global $DB, $USER; if ($this->can_manage()) { return false; } if ($dependentlesson = $DB->get_record('lesson', array('id' => $this->properties->dependency))) { // Lesson exists, so we can proceed. ...
php
public function get_dependencies_restriction_status() { global $DB, $USER; if ($this->can_manage()) { return false; } if ($dependentlesson = $DB->get_record('lesson', array('id' => $this->properties->dependency))) { // Lesson exists, so we can proceed. ...
[ "public", "function", "get_dependencies_restriction_status", "(", ")", "{", "global", "$", "DB", ",", "$", "USER", ";", "if", "(", "$", "this", "->", "can_manage", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "$", "dependentlesson", "=", ...
Check if dependencies restrictions are applied. @return mixed false if there aren't restrictions or an object with the restriction information @since Moodle 3.3
[ "Check", "if", "dependencies", "restrictions", "are", "applied", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2856-L2909
214,504
moodle/moodle
mod/lesson/locallib.php
lesson.get_last_page_seen
public function get_last_page_seen($retriescount) { global $DB, $USER; $lastpageseen = false; $allattempts = $this->get_attempts($retriescount); if (!empty($allattempts)) { $attempt = end($allattempts); $attemptpage = $this->load_page($attempt->pageid); ...
php
public function get_last_page_seen($retriescount) { global $DB, $USER; $lastpageseen = false; $allattempts = $this->get_attempts($retriescount); if (!empty($allattempts)) { $attempt = end($allattempts); $attemptpage = $this->load_page($attempt->pageid); ...
[ "public", "function", "get_last_page_seen", "(", "$", "retriescount", ")", "{", "global", "$", "DB", ",", "$", "USER", ";", "$", "lastpageseen", "=", "false", ";", "$", "allattempts", "=", "$", "this", "->", "get_attempts", "(", "$", "retriescount", ")", ...
Return the last page the current user saw. @param int $retriescount the number of retries for the lesson (the last retry number). @return mixed false if the user didn't see the lesson or the last page id
[ "Return", "the", "last", "page", "the", "current", "user", "saw", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2933-L2984
214,505
moodle/moodle
mod/lesson/locallib.php
lesson.left_during_timed_session
public function left_during_timed_session($retriescount) { global $DB, $USER; $conditions = array('lessonid' => $this->properties->id, 'userid' => $USER->id, 'retry' => $retriescount); return $DB->count_records('lesson_attempts', $conditions) > 0 || $DB->count_records('lesson_branch', $conditio...
php
public function left_during_timed_session($retriescount) { global $DB, $USER; $conditions = array('lessonid' => $this->properties->id, 'userid' => $USER->id, 'retry' => $retriescount); return $DB->count_records('lesson_attempts', $conditions) > 0 || $DB->count_records('lesson_branch', $conditio...
[ "public", "function", "left_during_timed_session", "(", "$", "retriescount", ")", "{", "global", "$", "DB", ",", "$", "USER", ";", "$", "conditions", "=", "array", "(", "'lessonid'", "=>", "$", "this", "->", "properties", "->", "id", ",", "'userid'", "=>",...
Check if a user left a timed session. @param int $retriescount the number of retries for the lesson (the last retry number). @return true if the user left the timed session @since Moodle 3.3
[ "Check", "if", "a", "user", "left", "a", "timed", "session", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L3006-L3011
214,506
moodle/moodle
mod/lesson/locallib.php
lesson.check_time
public function check_time($timer) { if ($this->properties->timelimit) { $timeleft = $timer->starttime + $this->properties->timelimit - time(); if ($timeleft <= 0) { // Out of time. $this->add_message(get_string('eolstudentoutoftime', 'lesson')); ...
php
public function check_time($timer) { if ($this->properties->timelimit) { $timeleft = $timer->starttime + $this->properties->timelimit - time(); if ($timeleft <= 0) { // Out of time. $this->add_message(get_string('eolstudentoutoftime', 'lesson')); ...
[ "public", "function", "check_time", "(", "$", "timer", ")", "{", "if", "(", "$", "this", "->", "properties", "->", "timelimit", ")", "{", "$", "timeleft", "=", "$", "timer", "->", "starttime", "+", "$", "this", "->", "properties", "->", "timelimit", "-...
Check if the user is out of time in a timed lesson. @param stdClass $timer timer object @return bool True if the user is on time, false is the user ran out of time @since Moodle 3.3
[ "Check", "if", "the", "user", "is", "out", "of", "time", "in", "a", "timed", "lesson", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L3065-L3078
214,507
moodle/moodle
mod/lesson/locallib.php
lesson.calculate_progress
public function calculate_progress() { global $USER, $DB; // Check if the user is reviewing the attempt. if (isset($USER->modattempts[$this->properties->id])) { return 100; } // All of the lesson pages. $pages = $this->load_all_pages(); foreach ($pag...
php
public function calculate_progress() { global $USER, $DB; // Check if the user is reviewing the attempt. if (isset($USER->modattempts[$this->properties->id])) { return 100; } // All of the lesson pages. $pages = $this->load_all_pages(); foreach ($pag...
[ "public", "function", "calculate_progress", "(", ")", "{", "global", "$", "USER", ",", "$", "DB", ";", "// Check if the user is reviewing the attempt.", "if", "(", "isset", "(", "$", "USER", "->", "modattempts", "[", "$", "this", "->", "properties", "->", "id"...
Calculate the progress of the current user in the lesson. @return int the progress (scale 0-100) @since Moodle 3.3
[ "Calculate", "the", "progress", "of", "the", "current", "user", "in", "the", "lesson", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L3167-L3219
214,508
moodle/moodle
mod/lesson/locallib.php
lesson.process_page_responses
public function process_page_responses(lesson_page $page) { $context = $this->get_context(); // Check the page has answers [MDL-25632]. if (count($page->answers) > 0) { $result = $page->record_attempt($context); } else { // The page has no answers so we will just...
php
public function process_page_responses(lesson_page $page) { $context = $this->get_context(); // Check the page has answers [MDL-25632]. if (count($page->answers) > 0) { $result = $page->record_attempt($context); } else { // The page has no answers so we will just...
[ "public", "function", "process_page_responses", "(", "lesson_page", "$", "page", ")", "{", "$", "context", "=", "$", "this", "->", "get_context", "(", ")", ";", "// Check the page has answers [MDL-25632].", "if", "(", "count", "(", "$", "page", "->", "answers", ...
Process page responses. @param lesson_page $page page object @since Moodle 3.3
[ "Process", "page", "responses", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L3372-L3394
214,509
moodle/moodle
mod/lesson/locallib.php
lesson_page.load
final public static function load($id, lesson $lesson) { global $DB; if (is_object($id) && !empty($id->qtype)) { $page = $id; } else { $page = $DB->get_record("lesson_pages", array("id" => $id)); if (!$page) { print_error('cannotfindpages', 'l...
php
final public static function load($id, lesson $lesson) { global $DB; if (is_object($id) && !empty($id->qtype)) { $page = $id; } else { $page = $DB->get_record("lesson_pages", array("id" => $id)); if (!$page) { print_error('cannotfindpages', 'l...
[ "final", "public", "static", "function", "load", "(", "$", "id", ",", "lesson", "$", "lesson", ")", "{", "global", "$", "DB", ";", "if", "(", "is_object", "(", "$", "id", ")", "&&", "!", "empty", "(", "$", "id", "->", "qtype", ")", ")", "{", "$...
This method loads a page object from the database and returns it as a specialised object that extends lesson_page @final @static @param int $id @param lesson $lesson @return lesson_page Specialised lesson_page object
[ "This", "method", "loads", "a", "page", "object", "from", "the", "database", "and", "returns", "it", "as", "a", "specialised", "object", "that", "extends", "lesson_page" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L3892-L3911
214,510
moodle/moodle
mod/lesson/locallib.php
lesson_page.move
final public function move($nextpageid=null, $prevpageid=null) { global $DB; if ($nextpageid === null) { $nextpageid = $this->properties->nextpageid; } if ($prevpageid === null) { $prevpageid = $this->properties->prevpageid; } $obj = new stdClass; ...
php
final public function move($nextpageid=null, $prevpageid=null) { global $DB; if ($nextpageid === null) { $nextpageid = $this->properties->nextpageid; } if ($prevpageid === null) { $prevpageid = $this->properties->prevpageid; } $obj = new stdClass; ...
[ "final", "public", "function", "move", "(", "$", "nextpageid", "=", "null", ",", "$", "prevpageid", "=", "null", ")", "{", "global", "$", "DB", ";", "if", "(", "$", "nextpageid", "===", "null", ")", "{", "$", "nextpageid", "=", "$", "this", "->", "...
Moves a page by updating its nextpageid and prevpageid values within the database @final @param int $nextpageid @param int $prevpageid
[ "Moves", "a", "page", "by", "updating", "its", "nextpageid", "and", "prevpageid", "values", "within", "the", "database" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L3996-L4009
214,511
moodle/moodle
mod/lesson/locallib.php
lesson_page.get_answers
final public function get_answers() { global $DB; if ($this->answers === null) { $this->answers = array(); $answers = $DB->get_records('lesson_answers', array('pageid'=>$this->properties->id, 'lessonid'=>$this->lesson->id), 'id'); if (!$answers) { // I...
php
final public function get_answers() { global $DB; if ($this->answers === null) { $this->answers = array(); $answers = $DB->get_records('lesson_answers', array('pageid'=>$this->properties->id, 'lessonid'=>$this->lesson->id), 'id'); if (!$answers) { // I...
[ "final", "public", "function", "get_answers", "(", ")", "{", "global", "$", "DB", ";", "if", "(", "$", "this", "->", "answers", "===", "null", ")", "{", "$", "this", "->", "answers", "=", "array", "(", ")", ";", "$", "answers", "=", "$", "DB", "-...
Returns the answers that are associated with this page in the database @final @return array
[ "Returns", "the", "answers", "that", "are", "associated", "with", "this", "page", "in", "the", "database" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4017-L4033
214,512
moodle/moodle
mod/lesson/locallib.php
lesson_page.format_answer
public function format_answer($answer, $context, $answerformat, $options = []) { if (is_object($options)) { $options = (array) $options; } if (empty($options['context'])) { $options['context'] = $context; } if (empty($options['para'])) { $op...
php
public function format_answer($answer, $context, $answerformat, $options = []) { if (is_object($options)) { $options = (array) $options; } if (empty($options['context'])) { $options['context'] = $context; } if (empty($options['para'])) { $op...
[ "public", "function", "format_answer", "(", "$", "answer", ",", "$", "context", ",", "$", "answerformat", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "is_object", "(", "$", "options", ")", ")", "{", "$", "options", "=", "(", "array", "...
Formats the answer. Override for custom formatting. @param string $answer @param context $context @param int $answerformat @return string Returns formatted string
[ "Formats", "the", "answer", ".", "Override", "for", "custom", "formatting", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4277-L4292
214,513
moodle/moodle
mod/lesson/locallib.php
lesson_page.format_response
private function format_response($response, $context, $responseformat, $answerid, $options) { $convertstudentresponse = file_rewrite_pluginfile_urls($response, 'pluginfile.php', $context->id, 'mod_lesson', 'page_responses', $answerid); return format_text($convertstudentresponse, $responsef...
php
private function format_response($response, $context, $responseformat, $answerid, $options) { $convertstudentresponse = file_rewrite_pluginfile_urls($response, 'pluginfile.php', $context->id, 'mod_lesson', 'page_responses', $answerid); return format_text($convertstudentresponse, $responsef...
[ "private", "function", "format_response", "(", "$", "response", ",", "$", "context", ",", "$", "responseformat", ",", "$", "answerid", ",", "$", "options", ")", "{", "$", "convertstudentresponse", "=", "file_rewrite_pluginfile_urls", "(", "$", "response", ",", ...
Formats the response @param string $response @param context $context @param int $responseformat @param int $answerid @param stdClass $options @return string Returns formatted string
[ "Formats", "the", "response" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4304-L4310
214,514
moodle/moodle
mod/lesson/locallib.php
lesson_page.get_jump_name
final protected function get_jump_name($jumpto) { global $DB; static $jumpnames = array(); if (!array_key_exists($jumpto, $jumpnames)) { if ($jumpto == LESSON_THISPAGE) { $jumptitle = get_string('thispage', 'lesson'); } elseif ($jumpto == LESSON_NEXTPAGE)...
php
final protected function get_jump_name($jumpto) { global $DB; static $jumpnames = array(); if (!array_key_exists($jumpto, $jumpnames)) { if ($jumpto == LESSON_THISPAGE) { $jumptitle = get_string('thispage', 'lesson'); } elseif ($jumpto == LESSON_NEXTPAGE)...
[ "final", "protected", "function", "get_jump_name", "(", "$", "jumpto", ")", "{", "global", "$", "DB", ";", "static", "$", "jumpnames", "=", "array", "(", ")", ";", "if", "(", "!", "array_key_exists", "(", "$", "jumpto", ",", "$", "jumpnames", ")", ")",...
Returns the string for a jump name @final @param int $jumpto Jump code or page ID @return string
[ "Returns", "the", "string", "for", "a", "jump", "name" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4319-L4349
214,515
moodle/moodle
mod/lesson/locallib.php
lesson_page.save_answers_files
public function save_answers_files($context, $maxbytes, &$answer, $answereditor = '', $responseeditor = '') { global $DB; if (isset($answereditor['itemid'])) { $answer->answer = file_save_draft_area_files($answereditor['itemid'], $context->id, 'mod_lesson', 'page_answers'...
php
public function save_answers_files($context, $maxbytes, &$answer, $answereditor = '', $responseeditor = '') { global $DB; if (isset($answereditor['itemid'])) { $answer->answer = file_save_draft_area_files($answereditor['itemid'], $context->id, 'mod_lesson', 'page_answers'...
[ "public", "function", "save_answers_files", "(", "$", "context", ",", "$", "maxbytes", ",", "&", "$", "answer", ",", "$", "answereditor", "=", "''", ",", "$", "responseeditor", "=", "''", ")", "{", "global", "$", "DB", ";", "if", "(", "isset", "(", "...
save editor answers files and update answer record @param object $context @param int $maxbytes @param object $answer @param object $answereditor @param object $responseeditor
[ "save", "editor", "answers", "files", "and", "update", "answer", "record" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4393-L4409
214,516
moodle/moodle
mod/lesson/locallib.php
lesson_page.rewrite_answers_urls
public static function rewrite_answers_urls($answer, $rewriteanswer = true) { global $PAGE; $context = context_module::instance($PAGE->cm->id); if ($rewriteanswer) { $answer->answer = file_rewrite_pluginfile_urls($answer->answer, 'pluginfile.php', $context->id, '...
php
public static function rewrite_answers_urls($answer, $rewriteanswer = true) { global $PAGE; $context = context_module::instance($PAGE->cm->id); if ($rewriteanswer) { $answer->answer = file_rewrite_pluginfile_urls($answer->answer, 'pluginfile.php', $context->id, '...
[ "public", "static", "function", "rewrite_answers_urls", "(", "$", "answer", ",", "$", "rewriteanswer", "=", "true", ")", "{", "global", "$", "PAGE", ";", "$", "context", "=", "context_module", "::", "instance", "(", "$", "PAGE", "->", "cm", "->", "id", "...
Rewrite urls in response and optionality answer of a question answer @param object $answer @param bool $rewriteanswer must rewrite answer @return object answer with rewritten urls
[ "Rewrite", "urls", "in", "response", "and", "optionality", "answer", "of", "a", "question", "answer" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4418-L4430
214,517
moodle/moodle
mod/lesson/locallib.php
lesson_page.is_unseen
public function is_unseen($param) { global $USER, $DB; if (is_array($param)) { $seenpages = $param; return (!array_key_exists($this->properties->id, $seenpages)); } else { $nretakes = $param; if (!$DB->count_records("lesson_attempts", array("pageid...
php
public function is_unseen($param) { global $USER, $DB; if (is_array($param)) { $seenpages = $param; return (!array_key_exists($this->properties->id, $seenpages)); } else { $nretakes = $param; if (!$DB->count_records("lesson_attempts", array("pageid...
[ "public", "function", "is_unseen", "(", "$", "param", ")", "{", "global", "$", "USER", ",", "$", "DB", ";", "if", "(", "is_array", "(", "$", "param", ")", ")", "{", "$", "seenpages", "=", "$", "param", ";", "return", "(", "!", "array_key_exists", "...
Returns true if a page has been viewed before @param array|int $param Either an array of pages that have been seen or the number of retakes a user has had @return bool
[ "Returns", "true", "if", "a", "page", "has", "been", "viewed", "before" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4561-L4573
214,518
moodle/moodle
mod/lesson/locallib.php
lesson_page.is_unanswered
public function is_unanswered($nretakes) { global $DB, $USER; if (!$DB->count_records("lesson_attempts", array('pageid'=>$this->properties->id, 'userid'=>$USER->id, 'correct'=>1, 'retry'=>$nretakes))) { return true; } return false; }
php
public function is_unanswered($nretakes) { global $DB, $USER; if (!$DB->count_records("lesson_attempts", array('pageid'=>$this->properties->id, 'userid'=>$USER->id, 'correct'=>1, 'retry'=>$nretakes))) { return true; } return false; }
[ "public", "function", "is_unanswered", "(", "$", "nretakes", ")", "{", "global", "$", "DB", ",", "$", "USER", ";", "if", "(", "!", "$", "DB", "->", "count_records", "(", "\"lesson_attempts\"", ",", "array", "(", "'pageid'", "=>", "$", "this", "->", "pr...
Checks to see if a page has been answered previously @param int $nretakes @return bool
[ "Checks", "to", "see", "if", "a", "page", "has", "been", "answered", "previously" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4580-L4586
214,519
moodle/moodle
mod/lesson/locallib.php
lesson_page.check_answer
public function check_answer() { $result = new stdClass; $result->answerid = 0; $result->noanswer = false; $result->correctanswer = false; $result->isessayquestion = false; // use this to turn off review button on essay questions $result->response ...
php
public function check_answer() { $result = new stdClass; $result->answerid = 0; $result->noanswer = false; $result->correctanswer = false; $result->isessayquestion = false; // use this to turn off review button on essay questions $result->response ...
[ "public", "function", "check_answer", "(", ")", "{", "$", "result", "=", "new", "stdClass", ";", "$", "result", "->", "answerid", "=", "0", ";", "$", "result", "->", "noanswer", "=", "false", ";", "$", "result", "->", "correctanswer", "=", "false", ";"...
This method MUST be overridden by all question page types, or page types that wish to score a page. The structure of result should always be the same so it is a good idea when overriding this method on a page type to call <code> $result = parent::check_answer(); </code> before modifying it as required. @return stdCla...
[ "This", "method", "MUST", "be", "overridden", "by", "all", "question", "page", "types", "or", "page", "types", "that", "wish", "to", "score", "a", "page", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4662-L4680
214,520
moodle/moodle
mod/lesson/locallib.php
lesson_page.properties
public function properties() { $properties = clone($this->properties); if ($this->answers === null) { $this->get_answers(); } if (count($this->answers)>0) { $count = 0; $qtype = $properties->qtype; foreach ($this->answers as $answer) { ...
php
public function properties() { $properties = clone($this->properties); if ($this->answers === null) { $this->get_answers(); } if (count($this->answers)>0) { $count = 0; $qtype = $properties->qtype; foreach ($this->answers as $answer) { ...
[ "public", "function", "properties", "(", ")", "{", "$", "properties", "=", "clone", "(", "$", "this", "->", "properties", ")", ";", "if", "(", "$", "this", "->", "answers", "===", "null", ")", "{", "$", "this", "->", "get_answers", "(", ")", ";", "...
Returns the properties of this lesson page as an object @return stdClass;
[ "Returns", "the", "properties", "of", "this", "lesson", "page", "as", "an", "object" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4721-L4742
214,521
moodle/moodle
mod/lesson/locallib.php
lesson_page.get_contents
public function get_contents() { global $PAGE; if (!empty($this->properties->contents)) { if (!isset($this->properties->contentsformat)) { $this->properties->contentsformat = FORMAT_HTML; } $context = context_module::instance($PAGE->cm->id); ...
php
public function get_contents() { global $PAGE; if (!empty($this->properties->contents)) { if (!isset($this->properties->contentsformat)) { $this->properties->contentsformat = FORMAT_HTML; } $context = context_module::instance($PAGE->cm->id); ...
[ "public", "function", "get_contents", "(", ")", "{", "global", "$", "PAGE", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "properties", "->", "contents", ")", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "properties", "->", "c...
Returns the contents field for the page properly formatted and with plugin file url's converted @return string
[ "Returns", "the", "contents", "field", "for", "the", "page", "properly", "formatted", "and", "with", "plugin", "file", "url", "s", "converted" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4791-L4806
214,522
moodle/moodle
mod/lesson/locallib.php
lesson_page.display_answers
public function display_answers(html_table $table) { $answers = $this->get_answers(); $i = 1; foreach ($answers as $answer) { $cells = array(); $cells[] = '<label>' . get_string('jump', 'lesson') . ' ' . $i . '</label>:'; $cells[] = $this->get_jump_name($answe...
php
public function display_answers(html_table $table) { $answers = $this->get_answers(); $i = 1; foreach ($answers as $answer) { $cells = array(); $cells[] = '<label>' . get_string('jump', 'lesson') . ' ' . $i . '</label>:'; $cells[] = $this->get_jump_name($answe...
[ "public", "function", "display_answers", "(", "html_table", "$", "table", ")", "{", "$", "answers", "=", "$", "this", "->", "get_answers", "(", ")", ";", "$", "i", "=", "1", ";", "foreach", "(", "$", "answers", "as", "$", "answer", ")", "{", "$", "...
Updates a table with the answers for this page @param html_table $table @return html_table
[ "Updates", "a", "table", "with", "the", "answers", "for", "this", "page" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4829-L4843
214,523
moodle/moodle
mod/lesson/locallib.php
lesson_page.report_answers
public function report_answers($answerpage, $answerdata, $useranswer, $pagestats, &$i, &$n) { $answers = $this->get_answers(); $formattextdefoptions = new stdClass; $formattextdefoptions->para = false; //I'll use it widely in this page foreach ($answers as $answer) { $data =...
php
public function report_answers($answerpage, $answerdata, $useranswer, $pagestats, &$i, &$n) { $answers = $this->get_answers(); $formattextdefoptions = new stdClass; $formattextdefoptions->para = false; //I'll use it widely in this page foreach ($answers as $answer) { $data =...
[ "public", "function", "report_answers", "(", "$", "answerpage", ",", "$", "answerdata", ",", "$", "useranswer", ",", "$", "pagestats", ",", "&", "$", "i", ",", "&", "$", "n", ")", "{", "$", "answers", "=", "$", "this", "->", "get_answers", "(", ")", ...
Formats the answers of this page for a report @param object $answerpage @param object $answerdata @param object $useranswer @param array $pagestats @param int $i Count of first level answers @param int $n Count of second level answers @return object The answer page for this
[ "Formats", "the", "answers", "of", "this", "page", "for", "a", "report" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4875-L4885
214,524
moodle/moodle
mod/lesson/locallib.php
lesson_page.valid_page_and_view
public function valid_page_and_view(&$validpages, &$pageviews) { $validpages[$this->properties->id] = 1; return $this->properties->nextpageid; }
php
public function valid_page_and_view(&$validpages, &$pageviews) { $validpages[$this->properties->id] = 1; return $this->properties->nextpageid; }
[ "public", "function", "valid_page_and_view", "(", "&", "$", "validpages", ",", "&", "$", "pageviews", ")", "{", "$", "validpages", "[", "$", "this", "->", "properties", "->", "id", "]", "=", "1", ";", "return", "$", "this", "->", "properties", "->", "n...
This method is used to determine if this page is a valid page @param array $validpages @param array $pageviews @return int The next page id to check
[ "This", "method", "is", "used", "to", "determine", "if", "this", "page", "is", "a", "valid", "page" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4929-L4932
214,525
moodle/moodle
mod/lesson/locallib.php
lesson_page.get_files
public function get_files($includedirs = true, $updatedsince = 0) { $fs = get_file_storage(); return $fs->get_area_files($this->lesson->context->id, 'mod_lesson', 'page_contents', $this->properties->id, 'itemid, filepath, filename', $includedirs, $updatedsince); }
php
public function get_files($includedirs = true, $updatedsince = 0) { $fs = get_file_storage(); return $fs->get_area_files($this->lesson->context->id, 'mod_lesson', 'page_contents', $this->properties->id, 'itemid, filepath, filename', $includedirs, $updatedsince); }
[ "public", "function", "get_files", "(", "$", "includedirs", "=", "true", ",", "$", "updatedsince", "=", "0", ")", "{", "$", "fs", "=", "get_file_storage", "(", ")", ";", "return", "$", "fs", "->", "get_area_files", "(", "$", "this", "->", "lesson", "->...
Get files from the page area file. @param bool $includedirs whether or not include directories @param int $updatedsince return files updated since this time @return array list of stored_file objects @since Moodle 3.2
[ "Get", "files", "from", "the", "page", "area", "file", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L4942-L4946
214,526
moodle/moodle
mod/lesson/locallib.php
lesson_page_answer.get_files
public function get_files($includedirs = true, $updatedsince = 0) { $lesson = lesson::load($this->properties->lessonid); $fs = get_file_storage(); $answerfiles = $fs->get_area_files($lesson->context->id, 'mod_lesson', 'page_answers', $this->properties->id, ...
php
public function get_files($includedirs = true, $updatedsince = 0) { $lesson = lesson::load($this->properties->lessonid); $fs = get_file_storage(); $answerfiles = $fs->get_area_files($lesson->context->id, 'mod_lesson', 'page_answers', $this->properties->id, ...
[ "public", "function", "get_files", "(", "$", "includedirs", "=", "true", ",", "$", "updatedsince", "=", "0", ")", "{", "$", "lesson", "=", "lesson", "::", "load", "(", "$", "this", "->", "properties", "->", "lessonid", ")", ";", "$", "fs", "=", "get_...
Get files from the answer area file. @param bool $includedirs whether or not include directories @param int $updatedsince return files updated since this time @return array list of stored_file objects @since Moodle 3.2
[ "Get", "files", "from", "the", "answer", "area", "file", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L5014-L5023
214,527
moodle/moodle
mod/lesson/locallib.php
lesson_page_type_manager.get
public static function get(lesson $lesson) { static $pagetypemanager; if (!($pagetypemanager instanceof lesson_page_type_manager)) { $pagetypemanager = new lesson_page_type_manager(); $pagetypemanager->load_lesson_types($lesson); } return $pagetypemanager; }
php
public static function get(lesson $lesson) { static $pagetypemanager; if (!($pagetypemanager instanceof lesson_page_type_manager)) { $pagetypemanager = new lesson_page_type_manager(); $pagetypemanager->load_lesson_types($lesson); } return $pagetypemanager; }
[ "public", "static", "function", "get", "(", "lesson", "$", "lesson", ")", "{", "static", "$", "pagetypemanager", ";", "if", "(", "!", "(", "$", "pagetypemanager", "instanceof", "lesson_page_type_manager", ")", ")", "{", "$", "pagetypemanager", "=", "new", "l...
Retrieves the lesson page type manager object If the object hasn't yet been created it is created here. @staticvar lesson_page_type_manager $pagetypemanager @param lesson $lesson @return lesson_page_type_manager
[ "Retrieves", "the", "lesson", "page", "type", "manager", "object" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L5058-L5065
214,528
moodle/moodle
mod/lesson/locallib.php
lesson_page_type_manager.get_page_type_strings
public function get_page_type_strings($type=null, $special=true) { $types = array(); foreach ($this->types as $pagetype) { if (($type===null || $pagetype->type===$type) && ($special===true || $pagetype->is_standard())) { $types[$pagetype->typeid] = $pagetype->typestring; ...
php
public function get_page_type_strings($type=null, $special=true) { $types = array(); foreach ($this->types as $pagetype) { if (($type===null || $pagetype->type===$type) && ($special===true || $pagetype->is_standard())) { $types[$pagetype->typeid] = $pagetype->typestring; ...
[ "public", "function", "get_page_type_strings", "(", "$", "type", "=", "null", ",", "$", "special", "=", "true", ")", "{", "$", "types", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "types", "as", "$", "pagetype", ")", "{", "if", ...
Returns an array of strings to describe the loaded page types @param int $type Can be used to return JUST the string for the requested type @return array
[ "Returns", "an", "array", "of", "strings", "to", "describe", "the", "loaded", "page", "types" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L5096-L5104
214,529
moodle/moodle
mod/lesson/locallib.php
lesson_page_type_manager.get_page_type_idstring
public function get_page_type_idstring($id) { foreach ($this->types as $pagetype) { if ((int)$pagetype->typeid === (int)$id) { return $pagetype->idstring; } } return 'unknown'; }
php
public function get_page_type_idstring($id) { foreach ($this->types as $pagetype) { if ((int)$pagetype->typeid === (int)$id) { return $pagetype->idstring; } } return 'unknown'; }
[ "public", "function", "get_page_type_idstring", "(", "$", "id", ")", "{", "foreach", "(", "$", "this", "->", "types", "as", "$", "pagetype", ")", "{", "if", "(", "(", "int", ")", "$", "pagetype", "->", "typeid", "===", "(", "int", ")", "$", "id", "...
Returns the basic string used to identify a page type provided with an id This string can be used to instantiate or identify the page type class. If the page type id is unknown then 'unknown' is returned @param int $id @return string
[ "Returns", "the", "basic", "string", "used", "to", "identify", "a", "page", "type", "provided", "with", "an", "id" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L5115-L5122
214,530
moodle/moodle
mod/lesson/locallib.php
lesson_page_type_manager.load_page
public function load_page($pageid, lesson $lesson) { global $DB; if (!($page =$DB->get_record('lesson_pages', array('id'=>$pageid, 'lessonid'=>$lesson->id)))) { print_error('cannotfindpages', 'lesson'); } $pagetype = get_class($this->types[$page->qtype]); $page = new ...
php
public function load_page($pageid, lesson $lesson) { global $DB; if (!($page =$DB->get_record('lesson_pages', array('id'=>$pageid, 'lessonid'=>$lesson->id)))) { print_error('cannotfindpages', 'lesson'); } $pagetype = get_class($this->types[$page->qtype]); $page = new ...
[ "public", "function", "load_page", "(", "$", "pageid", ",", "lesson", "$", "lesson", ")", "{", "global", "$", "DB", ";", "if", "(", "!", "(", "$", "page", "=", "$", "DB", "->", "get_record", "(", "'lesson_pages'", ",", "array", "(", "'id'", "=>", "...
Loads a page for the provided lesson given it's id This function loads a page from the lesson when given both the lesson it belongs to as well as the page's id. If the page doesn't exist an error is thrown @param int $pageid The id of the page to load @param lesson $lesson The lesson the page belongs to @return lesso...
[ "Loads", "a", "page", "for", "the", "provided", "lesson", "given", "it", "s", "id" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L5135-L5143
214,531
moodle/moodle
mod/lesson/locallib.php
lesson_page_type_manager.check_page_order
protected function check_page_order($page1, $page2) { global $DB; if (empty($page1)) { if ($page2->prevpageid != 0) { debugging("***prevpageid of page " . $page2->id . " set to 0***"); $page2->prevpageid = 0; $DB->set_field("lesson_pages", "pre...
php
protected function check_page_order($page1, $page2) { global $DB; if (empty($page1)) { if ($page2->prevpageid != 0) { debugging("***prevpageid of page " . $page2->id . " set to 0***"); $page2->prevpageid = 0; $DB->set_field("lesson_pages", "pre...
[ "protected", "function", "check_page_order", "(", "$", "page1", ",", "$", "page2", ")", "{", "global", "$", "DB", ";", "if", "(", "empty", "(", "$", "page1", ")", ")", "{", "if", "(", "$", "page2", "->", "prevpageid", "!=", "0", ")", "{", "debuggin...
This function detects errors in the ordering between 2 pages and updates the page records. @param stdClass $page1 Either the first of 2 pages or null if the $page2 param is the first in the list. @param stdClass $page1 Either the second of 2 pages or null if the $page1 param is the last in the list.
[ "This", "function", "detects", "errors", "in", "the", "ordering", "between", "2", "pages", "and", "updates", "the", "page", "records", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L5151-L5177
214,532
moodle/moodle
mod/lesson/locallib.php
lesson_page_type_manager.load_all_pages
public function load_all_pages(lesson $lesson) { global $DB; if (!($pages =$DB->get_records('lesson_pages', array('lessonid'=>$lesson->id)))) { return array(); // Records returned empty. } foreach ($pages as $key=>$page) { $pagetype = get_class($this->types[$page-...
php
public function load_all_pages(lesson $lesson) { global $DB; if (!($pages =$DB->get_records('lesson_pages', array('lessonid'=>$lesson->id)))) { return array(); // Records returned empty. } foreach ($pages as $key=>$page) { $pagetype = get_class($this->types[$page-...
[ "public", "function", "load_all_pages", "(", "lesson", "$", "lesson", ")", "{", "global", "$", "DB", ";", "if", "(", "!", "(", "$", "pages", "=", "$", "DB", "->", "get_records", "(", "'lesson_pages'", ",", "array", "(", "'lessonid'", "=>", "$", "lesson...
This function loads ALL pages that belong to the lesson. @param lesson $lesson @return array An array of lesson_page_type_*
[ "This", "function", "loads", "ALL", "pages", "that", "belong", "to", "the", "lesson", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L5185-L5239
214,533
moodle/moodle
mod/lesson/locallib.php
lesson_page_type_manager.get_add_page_type_links
public function get_add_page_type_links($previd) { global $OUTPUT; $links = array(); foreach ($this->types as $key=>$type) { if ($link = $type->add_page_link($previd)) { $links[$key] = $link; } } return $links; }
php
public function get_add_page_type_links($previd) { global $OUTPUT; $links = array(); foreach ($this->types as $key=>$type) { if ($link = $type->add_page_link($previd)) { $links[$key] = $link; } } return $links; }
[ "public", "function", "get_add_page_type_links", "(", "$", "previd", ")", "{", "global", "$", "OUTPUT", ";", "$", "links", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "types", "as", "$", "key", "=>", "$", "type", ")", "{", "if", ...
Returns an array of links to use as add page links @param int $previd The id of the previous page @return array
[ "Returns", "an", "array", "of", "links", "to", "use", "as", "add", "page", "links" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L5264-L5276
214,534
moodle/moodle
lib/google/src/Google/Utils.php
Google_Utils.normalize
public static function normalize($arr) { if (!is_array($arr)) { return array(); } $normalized = array(); foreach ($arr as $key => $val) { $normalized[strtolower($key)] = $val; } return $normalized; }
php
public static function normalize($arr) { if (!is_array($arr)) { return array(); } $normalized = array(); foreach ($arr as $key => $val) { $normalized[strtolower($key)] = $val; } return $normalized; }
[ "public", "static", "function", "normalize", "(", "$", "arr", ")", "{", "if", "(", "!", "is_array", "(", "$", "arr", ")", ")", "{", "return", "array", "(", ")", ";", "}", "$", "normalized", "=", "array", "(", ")", ";", "foreach", "(", "$", "arr",...
Normalize all keys in an array to lower-case. @param array $arr @return array Normalized array.
[ "Normalize", "all", "keys", "in", "an", "array", "to", "lower", "-", "case", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Utils.php#L108-L119
214,535
moodle/moodle
customfield/classes/field_controller.php
field_controller.create
public static function create(int $id, \stdClass $record = null, category_controller $category = null) : field_controller { global $DB; if ($id && $record) { // This warning really should be in persistent as well. debugging('Too many parameters, either id need to be specified or ...
php
public static function create(int $id, \stdClass $record = null, category_controller $category = null) : field_controller { global $DB; if ($id && $record) { // This warning really should be in persistent as well. debugging('Too many parameters, either id need to be specified or ...
[ "public", "static", "function", "create", "(", "int", "$", "id", ",", "\\", "stdClass", "$", "record", "=", "null", ",", "category_controller", "$", "category", "=", "null", ")", ":", "field_controller", "{", "global", "$", "DB", ";", "if", "(", "$", "...
Creates an instance of field_controller Parameters $id, $record and $category can complement each other but not conflict. If $id is not specified, categoryid must be present either in $record or in $category. If $id is not specified, type must be present in $record No DB queries are performed if both $record and $cat...
[ "Creates", "an", "instance", "of", "field_controller" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/field_controller.php#L84-L124
214,536
moodle/moodle
customfield/classes/field_controller.php
field_controller.delete
public function delete() : bool { global $DB; $DB->delete_records('customfield_data', ['fieldid' => $this->get('id')]); return $this->field->delete(); }
php
public function delete() : bool { global $DB; $DB->delete_records('customfield_data', ['fieldid' => $this->get('id')]); return $this->field->delete(); }
[ "public", "function", "delete", "(", ")", ":", "bool", "{", "global", "$", "DB", ";", "$", "DB", "->", "delete_records", "(", "'customfield_data'", ",", "[", "'fieldid'", "=>", "$", "this", "->", "get", "(", "'id'", ")", "]", ")", ";", "return", "$",...
Delete a field and all associated data Plugins may override it if it is necessary to delete related data (such as files) Not that the delete() method from data_controller is not called here. @return bool
[ "Delete", "a", "field", "and", "all", "associated", "data" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/field_controller.php#L170-L174
214,537
moodle/moodle
customfield/classes/field_controller.php
field_controller.get_configdata_property
public function get_configdata_property(string $property) { $configdata = $this->field->get('configdata'); if (!isset($configdata[$property])) { return null; } return $configdata[$property]; }
php
public function get_configdata_property(string $property) { $configdata = $this->field->get('configdata'); if (!isset($configdata[$property])) { return null; } return $configdata[$property]; }
[ "public", "function", "get_configdata_property", "(", "string", "$", "property", ")", "{", "$", "configdata", "=", "$", "this", "->", "field", "->", "get", "(", "'configdata'", ")", ";", "if", "(", "!", "isset", "(", "$", "configdata", "[", "$", "propert...
Get configdata property. @param string $property name of the property @return mixed
[ "Get", "configdata", "property", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/field_controller.php#L209-L215
214,538
moodle/moodle
customfield/classes/field_controller.php
field_controller.get_formatted_name
public function get_formatted_name() : string { $context = $this->get_handler()->get_configuration_context(); return format_string($this->get('name'), true, ['context' => $context]); }
php
public function get_formatted_name() : string { $context = $this->get_handler()->get_configuration_context(); return format_string($this->get('name'), true, ['context' => $context]); }
[ "public", "function", "get_formatted_name", "(", ")", ":", "string", "{", "$", "context", "=", "$", "this", "->", "get_handler", "(", ")", "->", "get_configuration_context", "(", ")", ";", "return", "format_string", "(", "$", "this", "->", "get", "(", "'na...
Returns the field name formatted according to configuration context. @return string
[ "Returns", "the", "field", "name", "formatted", "according", "to", "configuration", "context", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/field_controller.php#L248-L251
214,539
moodle/moodle
tag/classes/privacy/provider.php
provider.export_item_tags
public static function export_item_tags( int $userid, \context $context, array $subcontext, string $component, string $itemtype, int $itemid, bool $onlyuser = false ) { global $DB; // Ignore mdl_tag.userid here because it only reflects the use...
php
public static function export_item_tags( int $userid, \context $context, array $subcontext, string $component, string $itemtype, int $itemid, bool $onlyuser = false ) { global $DB; // Ignore mdl_tag.userid here because it only reflects the use...
[ "public", "static", "function", "export_item_tags", "(", "int", "$", "userid", ",", "\\", "context", "$", "context", ",", "array", "$", "subcontext", ",", "string", "$", "component", ",", "string", "$", "itemtype", ",", "int", "$", "itemid", ",", "bool", ...
Store all tags which match the specified component, itemtype, and itemid. In most situations you will want to specify $onlyuser as false. This will fetch only tags where the user themselves set the tag, or where tags are a shared resource. If you specify $onlyuser as true, only the tags created by that user will be i...
[ "Store", "all", "tags", "which", "match", "the", "specified", "component", "itemtype", "and", "itemid", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/privacy/provider.php#L117-L155
214,540
moodle/moodle
tag/classes/privacy/provider.php
provider.delete_item_tags
public static function delete_item_tags(\context $context, $component, $itemtype, $itemid = null, $userid = null) { global $DB; $params = ['contextid' => $context->id, 'component' => $component, 'itemtype' => $itemtype]; if ($itemid) { $params['itemid'] = $itemid; ...
php
public static function delete_item_tags(\context $context, $component, $itemtype, $itemid = null, $userid = null) { global $DB; $params = ['contextid' => $context->id, 'component' => $component, 'itemtype' => $itemtype]; if ($itemid) { $params['itemid'] = $itemid; ...
[ "public", "static", "function", "delete_item_tags", "(", "\\", "context", "$", "context", ",", "$", "component", ",", "$", "itemtype", ",", "$", "itemid", "=", "null", ",", "$", "userid", "=", "null", ")", "{", "global", "$", "DB", ";", "$", "params", ...
Deletes all tag instances for given context, component, itemtype, itemid In most situations you will want to specify $userid as null. Per-user tag instances are possible in Tags API, however there are no components or standard plugins that actually use them. @param \context $context The context to export for @pa...
[ "Deletes", "all", "tag", "instances", "for", "given", "context", "component", "itemtype", "itemid" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/privacy/provider.php#L169-L180
214,541
moodle/moodle
question/type/gapselect/rendererbase.php
qtype_elements_embedded_in_question_text_renderer.get_fragments_glue_placeholders
protected function get_fragments_glue_placeholders($fragments) { $fragmentscount = count($fragments); if ($fragmentscount <= 1) { return []; } $prefix = '[[$'; $postfix = ']]'; $text = join('', $fragments); while (preg_match('/' . preg_quote($prefix, '...
php
protected function get_fragments_glue_placeholders($fragments) { $fragmentscount = count($fragments); if ($fragmentscount <= 1) { return []; } $prefix = '[[$'; $postfix = ']]'; $text = join('', $fragments); while (preg_match('/' . preg_quote($prefix, '...
[ "protected", "function", "get_fragments_glue_placeholders", "(", "$", "fragments", ")", "{", "$", "fragmentscount", "=", "count", "(", "$", "fragments", ")", ";", "if", "(", "$", "fragmentscount", "<=", "1", ")", "{", "return", "[", "]", ";", "}", "$", "...
Find strings that we can use to glue the fragments with These strings have to be all different and neither of them can be present in the text @param array $fragments @return array array with indexes from 1 to count($fragments)-1
[ "Find", "strings", "that", "we", "can", "use", "to", "glue", "the", "fragments", "with" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/gapselect/rendererbase.php#L87-L103
214,542
moodle/moodle
mod/choice/classes/event/answer_created.php
answer_created.create_from_object
public static function create_from_object($choiceanswer, $choice, $cm, $course) { global $USER; $eventdata = array(); $eventdata['objectid'] = $choiceanswer->id; $eventdata['context'] = \context_module::instance($cm->id); $eventdata['userid'] = $USER->id; $eventdata['cour...
php
public static function create_from_object($choiceanswer, $choice, $cm, $course) { global $USER; $eventdata = array(); $eventdata['objectid'] = $choiceanswer->id; $eventdata['context'] = \context_module::instance($cm->id); $eventdata['userid'] = $USER->id; $eventdata['cour...
[ "public", "static", "function", "create_from_object", "(", "$", "choiceanswer", ",", "$", "choice", ",", "$", "cm", ",", "$", "course", ")", "{", "global", "$", "USER", ";", "$", "eventdata", "=", "array", "(", ")", ";", "$", "eventdata", "[", "'object...
Creates an instance of the event from the records @param stdClass $choiceanswer record from 'choice_answers' table @param stdClass $choice record from 'choice' table @param stdClass $cm record from 'course_modules' table @param stdClass $course @return self
[ "Creates", "an", "instance", "of", "the", "event", "from", "the", "records" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/choice/classes/event/answer_created.php#L55-L72
214,543
moodle/moodle
grade/grading/form/guide/backup/moodle2/restore_gradingform_guide_plugin.class.php
restore_gradingform_guide_plugin.define_definition_plugin_structure
protected function define_definition_plugin_structure() { $paths = array(); $paths[] = new restore_path_element('gradingform_guide_criterion', $this->get_pathfor('/guidecriteria/guidecriterion')); $paths[] = new restore_path_element('gradingform_guide_comment', $this->...
php
protected function define_definition_plugin_structure() { $paths = array(); $paths[] = new restore_path_element('gradingform_guide_criterion', $this->get_pathfor('/guidecriteria/guidecriterion')); $paths[] = new restore_path_element('gradingform_guide_comment', $this->...
[ "protected", "function", "define_definition_plugin_structure", "(", ")", "{", "$", "paths", "=", "array", "(", ")", ";", "$", "paths", "[", "]", "=", "new", "restore_path_element", "(", "'gradingform_guide_criterion'", ",", "$", "this", "->", "get_pathfor", "(",...
Declares the marking guide XML paths attached to the form definition element @return array of {@link restore_path_element}
[ "Declares", "the", "marking", "guide", "XML", "paths", "attached", "to", "the", "form", "definition", "element" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/guide/backup/moodle2/restore_gradingform_guide_plugin.class.php#L41-L57
214,544
moodle/moodle
grade/grading/form/guide/backup/moodle2/restore_gradingform_guide_plugin.class.php
restore_gradingform_guide_plugin.process_gradingform_guide_criterion
public function process_gradingform_guide_criterion($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->definitionid = $this->get_new_parentid('grading_definition'); $newid = $DB->insert_record('gradingform_guide_criteria', $data); $this->set_mapping(...
php
public function process_gradingform_guide_criterion($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->definitionid = $this->get_new_parentid('grading_definition'); $newid = $DB->insert_record('gradingform_guide_criteria', $data); $this->set_mapping(...
[ "public", "function", "process_gradingform_guide_criterion", "(", "$", "data", ")", "{", "global", "$", "DB", ";", "$", "data", "=", "(", "object", ")", "$", "data", ";", "$", "oldid", "=", "$", "data", "->", "id", ";", "$", "data", "->", "definitionid...
Processes criterion element data Sets the mapping 'gradingform_guide_criterion' to be used later by {@link self::process_gradinform_guide_filling()} @param array|stdClass $data
[ "Processes", "criterion", "element", "data" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/guide/backup/moodle2/restore_gradingform_guide_plugin.class.php#L82-L91
214,545
moodle/moodle
question/engine/lib.php
question_engine.is_manual_grade_in_range
public static function is_manual_grade_in_range($qubaid, $slot) { $prefix = 'q' . $qubaid . ':' . $slot . '_'; $mark = question_utils::optional_param_mark($prefix . '-mark'); $maxmark = optional_param($prefix . '-maxmark', null, PARAM_FLOAT); $minfraction = optional_param($prefix . ':min...
php
public static function is_manual_grade_in_range($qubaid, $slot) { $prefix = 'q' . $qubaid . ':' . $slot . '_'; $mark = question_utils::optional_param_mark($prefix . '-mark'); $maxmark = optional_param($prefix . '-maxmark', null, PARAM_FLOAT); $minfraction = optional_param($prefix . ':min...
[ "public", "static", "function", "is_manual_grade_in_range", "(", "$", "qubaid", ",", "$", "slot", ")", "{", "$", "prefix", "=", "'q'", ".", "$", "qubaid", ".", "':'", ".", "$", "slot", ".", "'_'", ";", "$", "mark", "=", "question_utils", "::", "optiona...
Validate that the manual grade submitted for a particular question is in range. @param int $qubaid the question_usage id. @param int $slot the slot number within the usage. @return bool whether the submitted data is in range.
[ "Validate", "that", "the", "manual", "grade", "submitted", "for", "a", "particular", "question", "is", "in", "range", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/lib.php#L140-L149
214,546
moodle/moodle
question/engine/lib.php
question_display_options.get_dp_options
public static function get_dp_options() { $options = array(); for ($i = 0; $i <= self::MAX_DP; $i += 1) { $options[$i] = $i; } return $options; }
php
public static function get_dp_options() { $options = array(); for ($i = 0; $i <= self::MAX_DP; $i += 1) { $options[$i] = $i; } return $options; }
[ "public", "static", "function", "get_dp_options", "(", ")", "{", "$", "options", "=", "array", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<=", "self", "::", "MAX_DP", ";", "$", "i", "+=", "1", ")", "{", "$", "options", "[", ...
Returns the valid choices for the number of decimal places for showing question marks. For use in the user interface. Calling code should probably use {@link question_engine::get_dp_options()} rather than calling this method directly. @return array suitable for passing to {@link html_writer::select()} or similar.
[ "Returns", "the", "valid", "choices", "for", "the", "number", "of", "decimal", "places", "for", "showing", "question", "marks", ".", "For", "use", "in", "the", "user", "interface", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/lib.php#L655-L661
214,547
moodle/moodle
question/engine/lib.php
question_flags.get_toggle_checksum
protected static function get_toggle_checksum($qubaid, $questionid, $qaid, $slot, $user = null) { if (is_null($user)) { global $USER; $user = $USER; } return md5($qubaid . "_" . $user->secret . "_" . $questionid . "_" . $qaid . "_" . $slot); }
php
protected static function get_toggle_checksum($qubaid, $questionid, $qaid, $slot, $user = null) { if (is_null($user)) { global $USER; $user = $USER; } return md5($qubaid . "_" . $user->secret . "_" . $questionid . "_" . $qaid . "_" . $slot); }
[ "protected", "static", "function", "get_toggle_checksum", "(", "$", "qubaid", ",", "$", "questionid", ",", "$", "qaid", ",", "$", "slot", ",", "$", "user", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "user", ")", ")", "{", "global", "$", ...
Get the checksum that validates that a toggle request is valid. @param int $qubaid the question usage id. @param int $questionid the question id. @param int $sessionid the question_attempt id. @param object $user the user. If null, defaults to $USER. @return string that needs to be sent to question/toggleflag.php for i...
[ "Get", "the", "checksum", "that", "validates", "that", "a", "toggle", "request", "is", "valid", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/lib.php#L680-L687
214,548
moodle/moodle
question/engine/lib.php
question_flags.update_flag
public static function update_flag($qubaid, $questionid, $qaid, $slot, $checksum, $newstate) { // Check the checksum - it is very hard to know who a question session belongs // to, so we require that checksum parameter is matches an md5 hash of the // three ids and the users username. Since we a...
php
public static function update_flag($qubaid, $questionid, $qaid, $slot, $checksum, $newstate) { // Check the checksum - it is very hard to know who a question session belongs // to, so we require that checksum parameter is matches an md5 hash of the // three ids and the users username. Since we a...
[ "public", "static", "function", "update_flag", "(", "$", "qubaid", ",", "$", "questionid", ",", "$", "qaid", ",", "$", "slot", ",", "$", "checksum", ",", "$", "newstate", ")", "{", "// Check the checksum - it is very hard to know who a question session belongs", "//...
If the request seems valid, update the flag state of a question attempt. Throws exceptions if this is not a valid update request. @param int $qubaid the question usage id. @param int $questionid the question id. @param int $sessionid the question_attempt id. @param string $checksum checksum, as computed by {@link get_t...
[ "If", "the", "request", "seems", "valid", "update", "the", "flag", "state", "of", "a", "question", "attempt", ".", "Throws", "exceptions", "if", "this", "is", "not", "a", "valid", "update", "request", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/lib.php#L714-L726
214,549
moodle/moodle
question/engine/lib.php
question_utils.int_to_roman
public static function int_to_roman($number) { if (!is_integer($number) || $number < 1 || $number > 3999) { throw new coding_exception('Only integers between 0 and 3999 can be ' . 'converted to roman numerals.', $number); } return self::$thousands[$number / 1000 ...
php
public static function int_to_roman($number) { if (!is_integer($number) || $number < 1 || $number > 3999) { throw new coding_exception('Only integers between 0 and 3999 can be ' . 'converted to roman numerals.', $number); } return self::$thousands[$number / 1000 ...
[ "public", "static", "function", "int_to_roman", "(", "$", "number", ")", "{", "if", "(", "!", "is_integer", "(", "$", "number", ")", "||", "$", "number", "<", "1", "||", "$", "number", ">", "3999", ")", "{", "throw", "new", "coding_exception", "(", "...
Convert an integer to roman numerals. @param int $number an integer between 1 and 3999 inclusive. Anything else will throw an exception. @return string the number converted to lower case roman numerals.
[ "Convert", "an", "integer", "to", "roman", "numerals", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/lib.php#L898-L906
214,550
moodle/moodle
question/engine/lib.php
question_utils.int_to_letter
public static function int_to_letter($number) { $alphabet = [ '1' => 'A', '2' => 'B', '3' => 'C', '4' => 'D', '5' => 'E', '6' => 'F', '7' => 'G', '8' => 'H', '9' => 'I'...
php
public static function int_to_letter($number) { $alphabet = [ '1' => 'A', '2' => 'B', '3' => 'C', '4' => 'D', '5' => 'E', '6' => 'F', '7' => 'G', '8' => 'H', '9' => 'I'...
[ "public", "static", "function", "int_to_letter", "(", "$", "number", ")", "{", "$", "alphabet", "=", "[", "'1'", "=>", "'A'", ",", "'2'", "=>", "'B'", ",", "'3'", "=>", "'C'", ",", "'4'", "=>", "'D'", ",", "'5'", "=>", "'E'", ",", "'6'", "=>", "'...
Convert an integer to a letter of alphabet. @param int $number an integer between 1 and 26 inclusive. Anything else will throw an exception. @return string the number converted to upper case letter of alphabet.
[ "Convert", "an", "integer", "to", "a", "letter", "of", "alphabet", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/lib.php#L914-L947
214,551
moodle/moodle
question/engine/lib.php
question_utils.to_plain_text
public static function to_plain_text($text, $format, $options = array('noclean' => 'true')) { // The following call to html_to_text uses the option that strips out // all URLs, but format_text complains if it finds @@PLUGINFILE@@ tokens. // So, we need to replace @@PLUGINFILE@@ with a real URL, ...
php
public static function to_plain_text($text, $format, $options = array('noclean' => 'true')) { // The following call to html_to_text uses the option that strips out // all URLs, but format_text complains if it finds @@PLUGINFILE@@ tokens. // So, we need to replace @@PLUGINFILE@@ with a real URL, ...
[ "public", "static", "function", "to_plain_text", "(", "$", "text", ",", "$", "format", ",", "$", "options", "=", "array", "(", "'noclean'", "=>", "'true'", ")", ")", "{", "// The following call to html_to_text uses the option that strips out", "// all URLs, but format_t...
Convert part of some question content to plain text. @param string $text the text. @param int $format the text format. @param array $options formatting options. Passed to {@link format_text}. @return float|string|null cleaned mark as a float if possible. Otherwise '' or null.
[ "Convert", "part", "of", "some", "question", "content", "to", "plain", "text", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/lib.php#L990-L997
214,552
moodle/moodle
question/engine/lib.php
question_utils.get_filepicker_options
public static function get_filepicker_options($context, $draftitemid) { return [ 'image' => self::specific_filepicker_options(['image'], $draftitemid, $context), 'media' => self::specific_filepicker_options(['video', 'audio'], $draftitemid, $context), 'link' => s...
php
public static function get_filepicker_options($context, $draftitemid) { return [ 'image' => self::specific_filepicker_options(['image'], $draftitemid, $context), 'media' => self::specific_filepicker_options(['video', 'audio'], $draftitemid, $context), 'link' => s...
[ "public", "static", "function", "get_filepicker_options", "(", "$", "context", ",", "$", "draftitemid", ")", "{", "return", "[", "'image'", "=>", "self", "::", "specific_filepicker_options", "(", "[", "'image'", "]", ",", "$", "draftitemid", ",", "$", "context...
Get filepicker options for question related text areas. @param object $context the context. @param int $draftitemid the draft area item id. @return array An array of options
[ "Get", "filepicker", "options", "for", "question", "related", "text", "areas", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/lib.php#L1029-L1035
214,553
moodle/moodle
question/engine/lib.php
question_utils.get_editor_options
public static function get_editor_options($context) { global $CFG; $editoroptions = [ 'subdirs' => 0, 'context' => $context, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'noclean' => 0, ...
php
public static function get_editor_options($context) { global $CFG; $editoroptions = [ 'subdirs' => 0, 'context' => $context, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'noclean' => 0, ...
[ "public", "static", "function", "get_editor_options", "(", "$", "context", ")", "{", "global", "$", "CFG", ";", "$", "editoroptions", "=", "[", "'subdirs'", "=>", "0", ",", "'context'", "=>", "$", "context", ",", "'maxfiles'", "=>", "EDITOR_UNLIMITED_FILES", ...
Get editor options for question related text areas. @param object $context the context. @return array An array of options
[ "Get", "editor", "options", "for", "question", "related", "text", "areas", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/lib.php#L1042-L1056
214,554
moodle/moodle
mod/scorm/datamodels/scormlib.php
xml2Array.parse
public function parse($strinputxml) { $this->resparser = xml_parser_create ('UTF-8'); xml_set_object($this->resparser, $this); xml_set_element_handler($this->resparser, "tagopen", "tagclosed"); xml_set_character_data_handler($this->resparser, "tagdata"); $this->strxmldata = xml...
php
public function parse($strinputxml) { $this->resparser = xml_parser_create ('UTF-8'); xml_set_object($this->resparser, $this); xml_set_element_handler($this->resparser, "tagopen", "tagclosed"); xml_set_character_data_handler($this->resparser, "tagdata"); $this->strxmldata = xml...
[ "public", "function", "parse", "(", "$", "strinputxml", ")", "{", "$", "this", "->", "resparser", "=", "xml_parser_create", "(", "'UTF-8'", ")", ";", "xml_set_object", "(", "$", "this", "->", "resparser", ",", "$", "this", ")", ";", "xml_set_element_handler"...
Parse an XML text string and create an array tree that rapresent the XML structure @param string $strinputxml The XML string @return array
[ "Parse", "an", "XML", "text", "string", "and", "create", "an", "array", "tree", "that", "rapresent", "the", "XML", "structure" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/scorm/datamodels/scormlib.php#L917-L934
214,555
moodle/moodle
lib/filebrowser/file_info_context_user.php
file_info_context_user.get_area_user_private
protected function get_area_user_private($itemid, $filepath, $filename) { global $USER, $CFG; // access control: only my files, nobody else if ($this->user->id != $USER->id) { return null; } if (is_null($itemid)) { // go to parent, we do not use itemids ...
php
protected function get_area_user_private($itemid, $filepath, $filename) { global $USER, $CFG; // access control: only my files, nobody else if ($this->user->id != $USER->id) { return null; } if (is_null($itemid)) { // go to parent, we do not use itemids ...
[ "protected", "function", "get_area_user_private", "(", "$", "itemid", ",", "$", "filepath", ",", "$", "filename", ")", "{", "global", "$", "USER", ",", "$", "CFG", ";", "// access control: only my files, nobody else", "if", "(", "$", "this", "->", "user", "->"...
Get a file from user private area @todo MDL-31070 this method should respect $CFG->userquota @param int $itemid item ID @param string $filepath file path @param string $filename file name @return file_info|null
[ "Get", "a", "file", "from", "user", "private", "area" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info_context_user.php#L94-L126
214,556
moodle/moodle
backup/moodle2/restore_plan_builder.class.php
restore_plan_builder.build_activity_plan
static protected function build_activity_plan($controller, $activityid) { $plan = $controller->get_plan(); $info = $controller->get_info(); $infoactivity = $info->activities[$activityid]; // Add the activity task, responsible for restoring // all the module related information....
php
static protected function build_activity_plan($controller, $activityid) { $plan = $controller->get_plan(); $info = $controller->get_info(); $infoactivity = $info->activities[$activityid]; // Add the activity task, responsible for restoring // all the module related information....
[ "static", "protected", "function", "build_activity_plan", "(", "$", "controller", ",", "$", "activityid", ")", "{", "$", "plan", "=", "$", "controller", "->", "get_plan", "(", ")", ";", "$", "info", "=", "$", "controller", "->", "get_info", "(", ")", ";"...
Restore one 1-activity backup
[ "Restore", "one", "1", "-", "activity", "backup" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/restore_plan_builder.class.php#L132-L160
214,557
moodle/moodle
backup/moodle2/restore_plan_builder.class.php
restore_plan_builder.build_section_plan
static protected function build_section_plan($controller, $sectionid) { $plan = $controller->get_plan(); $info = $controller->get_info(); $infosection = $info->sections[$sectionid]; // Add the section task, responsible for restoring // all the section related information ...
php
static protected function build_section_plan($controller, $sectionid) { $plan = $controller->get_plan(); $info = $controller->get_info(); $infosection = $info->sections[$sectionid]; // Add the section task, responsible for restoring // all the section related information ...
[ "static", "protected", "function", "build_section_plan", "(", "$", "controller", ",", "$", "sectionid", ")", "{", "$", "plan", "=", "$", "controller", "->", "get_plan", "(", ")", ";", "$", "info", "=", "$", "controller", "->", "get_info", "(", ")", ";", ...
Restore one 1-section backup
[ "Restore", "one", "1", "-", "section", "backup" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/restore_plan_builder.class.php#L165-L186
214,558
moodle/moodle
backup/moodle2/restore_plan_builder.class.php
restore_plan_builder.build_course_plan
static protected function build_course_plan($controller, $courseid) { $plan = $controller->get_plan(); $info = $controller->get_info(); // Add the course task, responsible for restoring // all the course related information $task = restore_factory::get_restore_course_task($info...
php
static protected function build_course_plan($controller, $courseid) { $plan = $controller->get_plan(); $info = $controller->get_info(); // Add the course task, responsible for restoring // all the course related information $task = restore_factory::get_restore_course_task($info...
[ "static", "protected", "function", "build_course_plan", "(", "$", "controller", ",", "$", "courseid", ")", "{", "$", "plan", "=", "$", "controller", "->", "get_plan", "(", ")", ";", "$", "info", "=", "$", "controller", "->", "get_info", "(", ")", ";", ...
Restore one 1-course backup
[ "Restore", "one", "1", "-", "course", "backup" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/restore_plan_builder.class.php#L191-L218
214,559
moodle/moodle
analytics/classes/dataset_manager.php
dataset_manager.store
public function store($data) { // Delete previous file if it exists. $fs = get_file_storage(); $filerecord = [ 'component' => 'analytics', 'filearea' => $this->filearea, 'itemid' => $this->modelid, 'contextid' => \context_system::instance()->id, ...
php
public function store($data) { // Delete previous file if it exists. $fs = get_file_storage(); $filerecord = [ 'component' => 'analytics', 'filearea' => $this->filearea, 'itemid' => $this->modelid, 'contextid' => \context_system::instance()->id, ...
[ "public", "function", "store", "(", "$", "data", ")", "{", "// Delete previous file if it exists.", "$", "fs", "=", "get_file_storage", "(", ")", ";", "$", "filerecord", "=", "[", "'component'", "=>", "'analytics'", ",", "'filearea'", "=>", "$", "this", "->", ...
Store the dataset in the internal file system. @param array $data @return \stored_file
[ "Store", "the", "dataset", "in", "the", "internal", "file", "system", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/dataset_manager.php#L122-L156
214,560
moodle/moodle
analytics/classes/dataset_manager.php
dataset_manager.get_previous_evaluation_file
public static function get_previous_evaluation_file($modelid, $timesplittingid) { $fs = get_file_storage(); // Evaluation data is always labelled. $filepath = '/timesplitting/' . \core_analytics\analysis::clean_time_splitting_id($timesplittingid) . '/'; return $fs->get_file(\context_syst...
php
public static function get_previous_evaluation_file($modelid, $timesplittingid) { $fs = get_file_storage(); // Evaluation data is always labelled. $filepath = '/timesplitting/' . \core_analytics\analysis::clean_time_splitting_id($timesplittingid) . '/'; return $fs->get_file(\context_syst...
[ "public", "static", "function", "get_previous_evaluation_file", "(", "$", "modelid", ",", "$", "timesplittingid", ")", "{", "$", "fs", "=", "get_file_storage", "(", ")", ";", "// Evaluation data is always labelled.", "$", "filepath", "=", "'/timesplitting/'", ".", "...
Returns the previous evaluation file. Important to note that this is per modelid + timesplittingid, when dealing with multiple analysables this is the merged file. Do not confuse with self::get_evaluation_analysable_file @param int $modelid @param string $timesplittingid @return \stored_file
[ "Returns", "the", "previous", "evaluation", "file", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/dataset_manager.php#L168-L174
214,561
moodle/moodle
analytics/classes/dataset_manager.php
dataset_manager.get_pending_files
public static function get_pending_files($modelid, $includetarget, $timesplittingids) { global $DB; $fs = get_file_storage(); if ($includetarget) { $filearea = self::LABELLED_FILEAREA; $usedfileaction = 'trained'; } else { $filearea = self::UNLABELLE...
php
public static function get_pending_files($modelid, $includetarget, $timesplittingids) { global $DB; $fs = get_file_storage(); if ($includetarget) { $filearea = self::LABELLED_FILEAREA; $usedfileaction = 'trained'; } else { $filearea = self::UNLABELLE...
[ "public", "static", "function", "get_pending_files", "(", "$", "modelid", ",", "$", "includetarget", ",", "$", "timesplittingids", ")", "{", "global", "$", "DB", ";", "$", "fs", "=", "get_file_storage", "(", ")", ";", "if", "(", "$", "includetarget", ")", ...
Gets the list of files that couldn't be previously used for training and prediction. @param int $modelid @param bool $includetarget @param string[] $timesplittingids @return null
[ "Gets", "the", "list", "of", "files", "that", "couldn", "t", "be", "previously", "used", "for", "training", "and", "prediction", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/dataset_manager.php#L184-L229
214,562
moodle/moodle
analytics/classes/dataset_manager.php
dataset_manager.delete_previous_evaluation_file
public static function delete_previous_evaluation_file($modelid, $timesplittingid) { if ($file = self::get_previous_evaluation_file($modelid, $timesplittingid)) { $file->delete(); return true; } return false; }
php
public static function delete_previous_evaluation_file($modelid, $timesplittingid) { if ($file = self::get_previous_evaluation_file($modelid, $timesplittingid)) { $file->delete(); return true; } return false; }
[ "public", "static", "function", "delete_previous_evaluation_file", "(", "$", "modelid", ",", "$", "timesplittingid", ")", "{", "if", "(", "$", "file", "=", "self", "::", "get_previous_evaluation_file", "(", "$", "modelid", ",", "$", "timesplittingid", ")", ")", ...
Deletes previous evaluation files of this model. @param int $modelid @param string $timesplittingid @return bool
[ "Deletes", "previous", "evaluation", "files", "of", "this", "model", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/dataset_manager.php#L238-L245
214,563
moodle/moodle
analytics/classes/dataset_manager.php
dataset_manager.merge_datasets
public static function merge_datasets(array $files, $modelid, $timesplittingid, $filearea, $evaluation = false) { $tmpfilepath = make_request_directory() . DIRECTORY_SEPARATOR . 'tmpfile.csv'; // Add headers. // We could also do this with a single iteration gathering all files headers and appe...
php
public static function merge_datasets(array $files, $modelid, $timesplittingid, $filearea, $evaluation = false) { $tmpfilepath = make_request_directory() . DIRECTORY_SEPARATOR . 'tmpfile.csv'; // Add headers. // We could also do this with a single iteration gathering all files headers and appe...
[ "public", "static", "function", "merge_datasets", "(", "array", "$", "files", ",", "$", "modelid", ",", "$", "timesplittingid", ",", "$", "filearea", ",", "$", "evaluation", "=", "false", ")", "{", "$", "tmpfilepath", "=", "make_request_directory", "(", ")",...
Merge multiple files into one. Important! It is the caller responsability to ensure that the datasets are compatible. @param array $files @param int $modelid @param string $timesplittingid @param string $filearea @param bool $evaluation @return \stored_file
[ "Merge", "multiple", "files", "into", "one", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/dataset_manager.php#L280-L352
214,564
moodle/moodle
analytics/classes/dataset_manager.php
dataset_manager.export_training_data
public static function export_training_data($modelid, $timesplittingid) { $fs = get_file_storage(); $contextid = \context_system::instance()->id; $filepath = '/timesplitting/' . \core_analytics\analysis::clean_time_splitting_id($timesplittingid) . '/'; $files = $fs->get_directory_file...
php
public static function export_training_data($modelid, $timesplittingid) { $fs = get_file_storage(); $contextid = \context_system::instance()->id; $filepath = '/timesplitting/' . \core_analytics\analysis::clean_time_splitting_id($timesplittingid) . '/'; $files = $fs->get_directory_file...
[ "public", "static", "function", "export_training_data", "(", "$", "modelid", ",", "$", "timesplittingid", ")", "{", "$", "fs", "=", "get_file_storage", "(", ")", ";", "$", "contextid", "=", "\\", "context_system", "::", "instance", "(", ")", "->", "id", ";...
Exports the model training data. @param int $modelid @param string $timesplittingid @return \stored_file|false
[ "Exports", "the", "model", "training", "data", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/dataset_manager.php#L361-L383
214,565
moodle/moodle
analytics/classes/dataset_manager.php
dataset_manager.get_structured_data
public static function get_structured_data(\stored_file $dataset) { if ($dataset->get_filearea() !== 'unlabelled') { throw new \coding_exception('Sorry, only support for unlabelled data'); } $rh = $dataset->get_content_file_handle(); // Skip dataset info. fgets($rh...
php
public static function get_structured_data(\stored_file $dataset) { if ($dataset->get_filearea() !== 'unlabelled') { throw new \coding_exception('Sorry, only support for unlabelled data'); } $rh = $dataset->get_content_file_handle(); // Skip dataset info. fgets($rh...
[ "public", "static", "function", "get_structured_data", "(", "\\", "stored_file", "$", "dataset", ")", "{", "if", "(", "$", "dataset", "->", "get_filearea", "(", ")", "!==", "'unlabelled'", ")", "{", "throw", "new", "\\", "coding_exception", "(", "'Sorry, only ...
Returns the dataset file data structured by sampleids using the indicators and target column names. @param \stored_file $dataset @return array
[ "Returns", "the", "dataset", "file", "data", "structured", "by", "sampleids", "using", "the", "indicators", "and", "target", "column", "names", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/dataset_manager.php#L391-L427
214,566
moodle/moodle
analytics/classes/dataset_manager.php
dataset_manager.clear_model_files
public static function clear_model_files($modelid) { $fs = get_file_storage(); return $fs->delete_area_files(\context_system::instance()->id, 'analytics', false, $modelid); }
php
public static function clear_model_files($modelid) { $fs = get_file_storage(); return $fs->delete_area_files(\context_system::instance()->id, 'analytics', false, $modelid); }
[ "public", "static", "function", "clear_model_files", "(", "$", "modelid", ")", "{", "$", "fs", "=", "get_file_storage", "(", ")", ";", "return", "$", "fs", "->", "delete_area_files", "(", "\\", "context_system", "::", "instance", "(", ")", "->", "id", ",",...
Delete all files of a model. @param int $modelid @return bool
[ "Delete", "all", "files", "of", "a", "model", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/dataset_manager.php#L435-L438
214,567
moodle/moodle
analytics/classes/dataset_manager.php
dataset_manager.get_filename
protected static function get_filename($evaluation) { if ($evaluation === true) { $filename = self::EVALUATION_FILENAME; } else { // Incremental time, the lock will make sure we don't have concurrency problems. $filename = microtime(true) . '.csv'; } ...
php
protected static function get_filename($evaluation) { if ($evaluation === true) { $filename = self::EVALUATION_FILENAME; } else { // Incremental time, the lock will make sure we don't have concurrency problems. $filename = microtime(true) . '.csv'; } ...
[ "protected", "static", "function", "get_filename", "(", "$", "evaluation", ")", "{", "if", "(", "$", "evaluation", "===", "true", ")", "{", "$", "filename", "=", "self", "::", "EVALUATION_FILENAME", ";", "}", "else", "{", "// Incremental time, the lock will make...
Returns the file name to be used. @param strinbool $evaluation @return string
[ "Returns", "the", "file", "name", "to", "be", "used", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/dataset_manager.php#L446-L456
214,568
moodle/moodle
blocks/myoverview/classes/output/main.php
main.get_preferences_as_booleans
public function get_preferences_as_booleans() { $preferences = []; $preferences[$this->view] = true; $preferences[$this->sort] = true; $preferences[$this->grouping] = true; return $preferences; }
php
public function get_preferences_as_booleans() { $preferences = []; $preferences[$this->view] = true; $preferences[$this->sort] = true; $preferences[$this->grouping] = true; return $preferences; }
[ "public", "function", "get_preferences_as_booleans", "(", ")", "{", "$", "preferences", "=", "[", "]", ";", "$", "preferences", "[", "$", "this", "->", "view", "]", "=", "true", ";", "$", "preferences", "[", "$", "this", "->", "sort", "]", "=", "true",...
Get the user preferences as an array to figure out what has been selected @return array $preferences Array with the pref as key and value set to true
[ "Get", "the", "user", "preferences", "as", "an", "array", "to", "figure", "out", "what", "has", "been", "selected" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/myoverview/classes/output/main.php#L102-L109
214,569
moodle/moodle
question/type/numerical/question.php
qtype_numerical_question.get_matching_answer
public function get_matching_answer($value, $multiplier) { if (is_null($value) || $value === '') { return null; } if (!is_null($multiplier)) { $scaledvalue = $value * $multiplier; } else { $scaledvalue = $value; } foreach ($this->answe...
php
public function get_matching_answer($value, $multiplier) { if (is_null($value) || $value === '') { return null; } if (!is_null($multiplier)) { $scaledvalue = $value * $multiplier; } else { $scaledvalue = $value; } foreach ($this->answe...
[ "public", "function", "get_matching_answer", "(", "$", "value", ",", "$", "multiplier", ")", "{", "if", "(", "is_null", "(", "$", "value", ")", "||", "$", "value", "===", "''", ")", "{", "return", "null", ";", "}", "if", "(", "!", "is_null", "(", "...
Get an answer that contains the feedback and fraction that should be awarded for this response. @param number $value the numerical value of a response. @param number $multiplier for the unit the student gave, if any. When no unit was given, or an unrecognised unit was given, $multiplier will be null. @return question_a...
[ "Get", "an", "answer", "that", "contains", "the", "feedback", "and", "fraction", "that", "should", "be", "awarded", "for", "this", "response", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/numerical/question.php#L197-L218
214,570
moodle/moodle
question/type/numerical/question.php
qtype_numerical_question.apply_unit_penalty
public function apply_unit_penalty($fraction, $unitisright) { if ($unitisright) { return $fraction; } if ($this->unitgradingtype == qtype_numerical::UNITGRADEDOUTOFMARK) { $fraction -= $this->unitpenalty * $fraction; } else if ($this->unitgradingtype == qtype_num...
php
public function apply_unit_penalty($fraction, $unitisright) { if ($unitisright) { return $fraction; } if ($this->unitgradingtype == qtype_numerical::UNITGRADEDOUTOFMARK) { $fraction -= $this->unitpenalty * $fraction; } else if ($this->unitgradingtype == qtype_num...
[ "public", "function", "apply_unit_penalty", "(", "$", "fraction", ",", "$", "unitisright", ")", "{", "if", "(", "$", "unitisright", ")", "{", "return", "$", "fraction", ";", "}", "if", "(", "$", "this", "->", "unitgradingtype", "==", "qtype_numerical", "::...
Adjust the fraction based on whether the unit was correct. @param number $fraction @param bool $unitisright @return number
[ "Adjust", "the", "fraction", "based", "on", "whether", "the", "unit", "was", "correct", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/numerical/question.php#L236-L247
214,571
moodle/moodle
lib/htmlpurifier/HTMLPurifier/Length.php
HTMLPurifier_Length.validate
protected function validate() { // Special case: if ($this->n === '+0' || $this->n === '-0') { $this->n = '0'; } if ($this->n === '0' && $this->unit === false) { return true; } if (!ctype_lower($this->unit)) { $this->unit = strtolow...
php
protected function validate() { // Special case: if ($this->n === '+0' || $this->n === '-0') { $this->n = '0'; } if ($this->n === '0' && $this->unit === false) { return true; } if (!ctype_lower($this->unit)) { $this->unit = strtolow...
[ "protected", "function", "validate", "(", ")", "{", "// Special case:", "if", "(", "$", "this", "->", "n", "===", "'+0'", "||", "$", "this", "->", "n", "===", "'-0'", ")", "{", "$", "this", "->", "n", "=", "'0'", ";", "}", "if", "(", "$", "this",...
Validates the number and unit. @return bool
[ "Validates", "the", "number", "and", "unit", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Length.php#L70-L93
214,572
moodle/moodle
lib/simplepie/library/SimplePie/Net/IPv6.php
SimplePie_Net_IPv6.uncompress
public static function uncompress($ip) { $c1 = -1; $c2 = -1; if (substr_count($ip, '::') === 1) { list($ip1, $ip2) = explode('::', $ip); if ($ip1 === '') { $c1 = -1; } else { $c1 = substr_count($ip1, ':'); } if ($ip2 === '') { $c2 = -1; } else { $c2 = substr_...
php
public static function uncompress($ip) { $c1 = -1; $c2 = -1; if (substr_count($ip, '::') === 1) { list($ip1, $ip2) = explode('::', $ip); if ($ip1 === '') { $c1 = -1; } else { $c1 = substr_count($ip1, ':'); } if ($ip2 === '') { $c2 = -1; } else { $c2 = substr_...
[ "public", "static", "function", "uncompress", "(", "$", "ip", ")", "{", "$", "c1", "=", "-", "1", ";", "$", "c2", "=", "-", "1", ";", "if", "(", "substr_count", "(", "$", "ip", ",", "'::'", ")", "===", "1", ")", "{", "list", "(", "$", "ip1", ...
Uncompresses an IPv6 address RFC 4291 allows you to compress concecutive zero pieces in an address to '::'. This method expects a valid IPv6 address and expands the '::' to the required number of zero pieces. Example: FF01::101 -> FF01:0:0:0:0:0:0:101 ::1 -> 0:0:0:0:0:0:0:1 @author Alexander Merz <alexa...
[ "Uncompresses", "an", "IPv6", "address" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Net/IPv6.php#L78-L130
214,573
moodle/moodle
lib/simplepie/library/SimplePie/Net/IPv6.php
SimplePie_Net_IPv6.split_v6_v4
private static function split_v6_v4($ip) { if (strpos($ip, '.') !== false) { $pos = strrpos($ip, ':'); $ipv6_part = substr($ip, 0, $pos); $ipv4_part = substr($ip, $pos + 1); return array($ipv6_part, $ipv4_part); } else { return array($ip, ''); } }
php
private static function split_v6_v4($ip) { if (strpos($ip, '.') !== false) { $pos = strrpos($ip, ':'); $ipv6_part = substr($ip, 0, $pos); $ipv4_part = substr($ip, $pos + 1); return array($ipv6_part, $ipv4_part); } else { return array($ip, ''); } }
[ "private", "static", "function", "split_v6_v4", "(", "$", "ip", ")", "{", "if", "(", "strpos", "(", "$", "ip", ",", "'.'", ")", "!==", "false", ")", "{", "$", "pos", "=", "strrpos", "(", "$", "ip", ",", "':'", ")", ";", "$", "ipv6_part", "=", "...
Splits an IPv6 address into the IPv6 and IPv4 representation parts RFC 4291 allows you to represent the last two parts of an IPv6 address using the standard IPv4 representation Example: 0:0:0:0:0:0:13.1.68.3 0:0:0:0:0:FFFF:129.144.52.38 @param string $ip An IPv6 address @return array [0] contains the IPv6 represent...
[ "Splits", "an", "IPv6", "address", "into", "the", "IPv6", "and", "IPv4", "representation", "parts" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Net/IPv6.php#L194-L207
214,574
moodle/moodle
lib/simplepie/library/SimplePie/Net/IPv6.php
SimplePie_Net_IPv6.check_ipv6
public static function check_ipv6($ip) { $ip = self::uncompress($ip); list($ipv6, $ipv4) = self::split_v6_v4($ip); $ipv6 = explode(':', $ipv6); $ipv4 = explode('.', $ipv4); if (count($ipv6) === 8 && count($ipv4) === 1 || count($ipv6) === 6 && count($ipv4) === 4) { foreach ($ipv6 as $ipv6_part) { ...
php
public static function check_ipv6($ip) { $ip = self::uncompress($ip); list($ipv6, $ipv4) = self::split_v6_v4($ip); $ipv6 = explode(':', $ipv6); $ipv4 = explode('.', $ipv4); if (count($ipv6) === 8 && count($ipv4) === 1 || count($ipv6) === 6 && count($ipv4) === 4) { foreach ($ipv6 as $ipv6_part) { ...
[ "public", "static", "function", "check_ipv6", "(", "$", "ip", ")", "{", "$", "ip", "=", "self", "::", "uncompress", "(", "$", "ip", ")", ";", "list", "(", "$", "ipv6", ",", "$", "ipv4", ")", "=", "self", "::", "split_v6_v4", "(", "$", "ip", ")", ...
Checks an IPv6 address Checks if the given IP is a valid IPv6 address @param string $ip An IPv6 address @return bool true if $ip is a valid IPv6 address
[ "Checks", "an", "IPv6", "address" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Net/IPv6.php#L217-L260
214,575
moodle/moodle
enrol/lti/backup/moodle2/restore_enrol_lti_plugin.class.php
restore_enrol_lti_plugin.define_enrol_plugin_structure
protected function define_enrol_plugin_structure() { $paths = array(); $paths[] = new restore_path_element('enrol_lti_tool', $this->connectionpoint->get_path() . '/tool'); $paths[] = new restore_path_element('enrol_lti_users', $this->connectionpoint->get_path() . '/tool/users/user'); r...
php
protected function define_enrol_plugin_structure() { $paths = array(); $paths[] = new restore_path_element('enrol_lti_tool', $this->connectionpoint->get_path() . '/tool'); $paths[] = new restore_path_element('enrol_lti_users', $this->connectionpoint->get_path() . '/tool/users/user'); r...
[ "protected", "function", "define_enrol_plugin_structure", "(", ")", "{", "$", "paths", "=", "array", "(", ")", ";", "$", "paths", "[", "]", "=", "new", "restore_path_element", "(", "'enrol_lti_tool'", ",", "$", "this", "->", "connectionpoint", "->", "get_path"...
Declares the enrol LTI XML paths attached to the enrol element @return array of {@link restore_path_element}
[ "Declares", "the", "enrol", "LTI", "XML", "paths", "attached", "to", "the", "enrol", "element" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/backup/moodle2/restore_enrol_lti_plugin.class.php#L46-L53
214,576
moodle/moodle
enrol/lti/backup/moodle2/restore_enrol_lti_plugin.class.php
restore_enrol_lti_plugin.process_enrol_lti_tool
public function process_enrol_lti_tool($data) { global $DB; $data = (object) $data; // Store the old id. $oldid = $data->id; // Change the values before we insert it. $data->timecreated = time(); $data->timemodified = $data->timecreated; // Now we can ...
php
public function process_enrol_lti_tool($data) { global $DB; $data = (object) $data; // Store the old id. $oldid = $data->id; // Change the values before we insert it. $data->timecreated = time(); $data->timemodified = $data->timecreated; // Now we can ...
[ "public", "function", "process_enrol_lti_tool", "(", "$", "data", ")", "{", "global", "$", "DB", ";", "$", "data", "=", "(", "object", ")", "$", "data", ";", "// Store the old id.", "$", "oldid", "=", "$", "data", "->", "id", ";", "// Change the values bef...
Processes LTI tools element data @param array|stdClass $data
[ "Processes", "LTI", "tools", "element", "data" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/backup/moodle2/restore_enrol_lti_plugin.class.php#L60-L80
214,577
moodle/moodle
enrol/lti/backup/moodle2/restore_enrol_lti_plugin.class.php
restore_enrol_lti_plugin.process_enrol_lti_users
public function process_enrol_lti_users($data) { global $DB; $data = (object) $data; $data->userid = $this->get_mappingid('user', $data->userid); $data->toolid = $this->get_mappingid('enrol_lti_tool', $data->toolid); $data->timecreated = time(); $DB->insert_record('enr...
php
public function process_enrol_lti_users($data) { global $DB; $data = (object) $data; $data->userid = $this->get_mappingid('user', $data->userid); $data->toolid = $this->get_mappingid('enrol_lti_tool', $data->toolid); $data->timecreated = time(); $DB->insert_record('enr...
[ "public", "function", "process_enrol_lti_users", "(", "$", "data", ")", "{", "global", "$", "DB", ";", "$", "data", "=", "(", "object", ")", "$", "data", ";", "$", "data", "->", "userid", "=", "$", "this", "->", "get_mappingid", "(", "'user'", ",", "...
Processes LTI users element data @param array|stdClass $data The data to insert as a comment
[ "Processes", "LTI", "users", "element", "data" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/backup/moodle2/restore_enrol_lti_plugin.class.php#L87-L97
214,578
moodle/moodle
enrol/lti/backup/moodle2/restore_enrol_lti_plugin.class.php
restore_enrol_lti_plugin.after_restore_enrol
public function after_restore_enrol() { global $DB; // Need to go through and change the values. foreach ($this->tools as $tool) { $updatetool = new stdClass(); $updatetool->id = $tool->id; $updatetool->enrolid = $this->get_mappingid('enrol', $tool->enrolid);...
php
public function after_restore_enrol() { global $DB; // Need to go through and change the values. foreach ($this->tools as $tool) { $updatetool = new stdClass(); $updatetool->id = $tool->id; $updatetool->enrolid = $this->get_mappingid('enrol', $tool->enrolid);...
[ "public", "function", "after_restore_enrol", "(", ")", "{", "global", "$", "DB", ";", "// Need to go through and change the values.", "foreach", "(", "$", "this", "->", "tools", "as", "$", "tool", ")", "{", "$", "updatetool", "=", "new", "stdClass", "(", ")", ...
This function is executed after all the tasks in the plan have been finished. This must be done here because the activities have not been restored yet.
[ "This", "function", "is", "executed", "after", "all", "the", "tasks", "in", "the", "plan", "have", "been", "finished", ".", "This", "must", "be", "done", "here", "because", "the", "activities", "have", "not", "been", "restored", "yet", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/backup/moodle2/restore_enrol_lti_plugin.class.php#L103-L114
214,579
moodle/moodle
lib/phpexcel/PHPExcel/Writer/HTML.php
PHPExcel_Writer_HTML.mapBorderStyle
private function mapBorderStyle($borderStyle) { switch ($borderStyle) { case PHPExcel_Style_Border::BORDER_NONE: return 'none'; case PHPExcel_Style_Border::BORDER_DASHDOT: return '1px dashed'; case PHPExcel_Style_Border::BORDER_DASHDOTDOT: ...
php
private function mapBorderStyle($borderStyle) { switch ($borderStyle) { case PHPExcel_Style_Border::BORDER_NONE: return 'none'; case PHPExcel_Style_Border::BORDER_DASHDOT: return '1px dashed'; case PHPExcel_Style_Border::BORDER_DASHDOTDOT: ...
[ "private", "function", "mapBorderStyle", "(", "$", "borderStyle", ")", "{", "switch", "(", "$", "borderStyle", ")", "{", "case", "PHPExcel_Style_Border", "::", "BORDER_NONE", ":", "return", "'none'", ";", "case", "PHPExcel_Style_Border", "::", "BORDER_DASHDOT", ":...
Map border style @param int $borderStyle Sheet index @return string
[ "Map", "border", "style" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Writer/HTML.php#L237-L272
214,580
moodle/moodle
lib/phpexcel/PHPExcel/Writer/HTML.php
PHPExcel_Writer_HTML.generateHTMLHeader
public function generateHTMLHeader($pIncludeStyles = false) { // PHPExcel object known? if (is_null($this->phpExcel)) { throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Construct HTML $properties = $this->...
php
public function generateHTMLHeader($pIncludeStyles = false) { // PHPExcel object known? if (is_null($this->phpExcel)) { throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Construct HTML $properties = $this->...
[ "public", "function", "generateHTMLHeader", "(", "$", "pIncludeStyles", "=", "false", ")", "{", "// PHPExcel object known?", "if", "(", "is_null", "(", "$", "this", "->", "phpExcel", ")", ")", "{", "throw", "new", "PHPExcel_Writer_Exception", "(", "'Internal PHPEx...
Generate HTML header @param boolean $pIncludeStyles Include styles? @return string @throws PHPExcel_Writer_Exception
[ "Generate", "HTML", "header" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Writer/HTML.php#L334-L385
214,581
moodle/moodle
lib/phpexcel/PHPExcel/Writer/HTML.php
PHPExcel_Writer_HTML.writeChartInCell
private function writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates) { // Construct HTML $html = ''; // Write charts foreach ($pSheet->getChartCollection() as $chart) { if ($chart instanceof PHPExcel_Chart) { $chartCoordinates = $chart->getTopLeftP...
php
private function writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates) { // Construct HTML $html = ''; // Write charts foreach ($pSheet->getChartCollection() as $chart) { if ($chart instanceof PHPExcel_Chart) { $chartCoordinates = $chart->getTopLeftP...
[ "private", "function", "writeChartInCell", "(", "PHPExcel_Worksheet", "$", "pSheet", ",", "$", "coordinates", ")", "{", "// Construct HTML", "$", "html", "=", "''", ";", "// Write charts", "foreach", "(", "$", "pSheet", "->", "getChartCollection", "(", ")", "as"...
Generate chart tag in cell @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet @param string $coordinates Cell coordinates @return string @throws PHPExcel_Writer_Exception
[ "Generate", "chart", "tag", "in", "cell" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Writer/HTML.php#L673-L710
214,582
moodle/moodle
calendar/classes/type_factory.php
type_factory.get_list_of_calendar_types
public static function get_list_of_calendar_types() { $calendars = array(); $calendardirs = \core_component::get_plugin_list('calendartype'); foreach ($calendardirs as $name => $location) { $calendars[$name] = get_string('name', "calendartype_{$name}"); } return $ca...
php
public static function get_list_of_calendar_types() { $calendars = array(); $calendardirs = \core_component::get_plugin_list('calendartype'); foreach ($calendardirs as $name => $location) { $calendars[$name] = get_string('name', "calendartype_{$name}"); } return $ca...
[ "public", "static", "function", "get_list_of_calendar_types", "(", ")", "{", "$", "calendars", "=", "array", "(", ")", ";", "$", "calendardirs", "=", "\\", "core_component", "::", "get_plugin_list", "(", "'calendartype'", ")", ";", "foreach", "(", "$", "calend...
Returns a list of calendar typess available for use. @return array the list of calendar types
[ "Returns", "a", "list", "of", "calendar", "typess", "available", "for", "use", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/type_factory.php#L58-L67
214,583
moodle/moodle
calendar/classes/type_factory.php
type_factory.get_calendar_type
public static function get_calendar_type() { global $CFG, $USER, $SESSION, $COURSE; // Course calendartype can override all other settings for this page. if (!empty($COURSE->id) and $COURSE->id != SITEID and !empty($COURSE->calendartype)) { $return = $COURSE->calendartype; }...
php
public static function get_calendar_type() { global $CFG, $USER, $SESSION, $COURSE; // Course calendartype can override all other settings for this page. if (!empty($COURSE->id) and $COURSE->id != SITEID and !empty($COURSE->calendartype)) { $return = $COURSE->calendartype; }...
[ "public", "static", "function", "get_calendar_type", "(", ")", "{", "global", "$", "CFG", ",", "$", "USER", ",", "$", "SESSION", ",", "$", "COURSE", ";", "// Course calendartype can override all other settings for this page.", "if", "(", "!", "empty", "(", "$", ...
Returns the current calendar type in use. @return string the current calendar type being used
[ "Returns", "the", "current", "calendar", "type", "in", "use", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/type_factory.php#L74-L91
214,584
moodle/moodle
grade/grading/form/rubric/rubriceditor.php
MoodleQuickForm_rubriceditor.toHtml
public function toHtml() { global $PAGE; $html = $this->_getTabs(); $renderer = $PAGE->get_renderer('gradingform_rubric'); $data = $this->prepare_data(null, $this->wasvalidated); if (!$this->_flagFrozen) { $mode = gradingform_rubric_controller::DISPLAY_EDIT_FULL; ...
php
public function toHtml() { global $PAGE; $html = $this->_getTabs(); $renderer = $PAGE->get_renderer('gradingform_rubric'); $data = $this->prepare_data(null, $this->wasvalidated); if (!$this->_flagFrozen) { $mode = gradingform_rubric_controller::DISPLAY_EDIT_FULL; ...
[ "public", "function", "toHtml", "(", ")", "{", "global", "$", "PAGE", ";", "$", "html", "=", "$", "this", "->", "_getTabs", "(", ")", ";", "$", "renderer", "=", "$", "PAGE", "->", "get_renderer", "(", "'gradingform_rubric'", ")", ";", "$", "data", "=...
Returns html string to display this element @return string
[ "Returns", "html", "string", "to", "display", "this", "element" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/rubric/rubriceditor.php#L111-L148
214,585
moodle/moodle
grade/grading/form/rubric/rubriceditor.php
MoodleQuickForm_rubriceditor.validate
public function validate($value) { if (!$this->wasvalidated) { $this->prepare_data($value, true); } return $this->validationerrors; }
php
public function validate($value) { if (!$this->wasvalidated) { $this->prepare_data($value, true); } return $this->validationerrors; }
[ "public", "function", "validate", "(", "$", "value", ")", "{", "if", "(", "!", "$", "this", "->", "wasvalidated", ")", "{", "$", "this", "->", "prepare_data", "(", "$", "value", ",", "true", ")", ";", "}", "return", "$", "this", "->", "validationerro...
Validates that rubric has at least one criterion, at least two levels within one criterion, each level has a valid score, all levels have filled definitions and all criteria have filled descriptions @param array $value @return string|false error text or false if no errors found
[ "Validates", "that", "rubric", "has", "at", "least", "one", "criterion", "at", "least", "two", "levels", "within", "one", "criterion", "each", "level", "has", "a", "valid", "score", "all", "levels", "have", "filled", "definitions", "and", "all", "criteria", ...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/rubric/rubriceditor.php#L376-L381
214,586
moodle/moodle
lib/badgeslib.php
badge.get_context
public function get_context() { if ($this->type == BADGE_TYPE_SITE) { return context_system::instance(); } else if ($this->type == BADGE_TYPE_COURSE) { return context_course::instance($this->courseid); } else { debugging('Something is wrong...'); } ...
php
public function get_context() { if ($this->type == BADGE_TYPE_SITE) { return context_system::instance(); } else if ($this->type == BADGE_TYPE_COURSE) { return context_course::instance($this->courseid); } else { debugging('Something is wrong...'); } ...
[ "public", "function", "get_context", "(", ")", "{", "if", "(", "$", "this", "->", "type", "==", "BADGE_TYPE_SITE", ")", "{", "return", "context_system", "::", "instance", "(", ")", ";", "}", "else", "if", "(", "$", "this", "->", "type", "==", "BADGE_TY...
Use to get context instance of a badge. @return context instance.
[ "Use", "to", "get", "context", "instance", "of", "a", "badge", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L195-L203
214,587
moodle/moodle
lib/badgeslib.php
badge.get_accepted_criteria
public function get_accepted_criteria() { global $CFG; $criteriatypes = array(); if ($this->type == BADGE_TYPE_COURSE) { $criteriatypes = array( BADGE_CRITERIA_TYPE_OVERALL, BADGE_CRITERIA_TYPE_MANUAL, BADGE_CRITERIA_TYPE_C...
php
public function get_accepted_criteria() { global $CFG; $criteriatypes = array(); if ($this->type == BADGE_TYPE_COURSE) { $criteriatypes = array( BADGE_CRITERIA_TYPE_OVERALL, BADGE_CRITERIA_TYPE_MANUAL, BADGE_CRITERIA_TYPE_C...
[ "public", "function", "get_accepted_criteria", "(", ")", "{", "global", "$", "CFG", ";", "$", "criteriatypes", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "type", "==", "BADGE_TYPE_COURSE", ")", "{", "$", "criteriatypes", "=", "array", "("...
Return array of accepted criteria types for this badge @return array
[ "Return", "array", "of", "accepted", "criteria", "types", "for", "this", "badge" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L220-L252
214,588
moodle/moodle
lib/badgeslib.php
badge.make_clone
public function make_clone() { global $DB, $USER, $PAGE; $fordb = new stdClass(); foreach (get_object_vars($this) as $k => $v) { $fordb->{$k} = $v; } $fordb->name = get_string('copyof', 'badges', $this->name); $fordb->status = BADGE_STATUS_INACTIVE; ...
php
public function make_clone() { global $DB, $USER, $PAGE; $fordb = new stdClass(); foreach (get_object_vars($this) as $k => $v) { $fordb->{$k} = $v; } $fordb->name = get_string('copyof', 'badges', $this->name); $fordb->status = BADGE_STATUS_INACTIVE; ...
[ "public", "function", "make_clone", "(", ")", "{", "global", "$", "DB", ",", "$", "USER", ",", "$", "PAGE", ";", "$", "fordb", "=", "new", "stdClass", "(", ")", ";", "foreach", "(", "get_object_vars", "(", "$", "this", ")", "as", "$", "k", "=>", ...
Creates and saves a clone of badge with all its properties. Clone is not active by default and has 'Copy of' attached to its name. @return int ID of new badge.
[ "Creates", "and", "saves", "a", "clone", "of", "badge", "with", "all", "its", "properties", ".", "Clone", "is", "not", "active", "by", "default", "and", "has", "Copy", "of", "attached", "to", "its", "name", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L288-L359
214,589
moodle/moodle
lib/badgeslib.php
badge.issue
public function issue($userid, $nobake = false) { global $DB, $CFG; $now = time(); $issued = new stdClass(); $issued->badgeid = $this->id; $issued->userid = $userid; $issued->uniquehash = sha1(rand() . $userid . $this->id . $now); $issued->dateissued = $now; ...
php
public function issue($userid, $nobake = false) { global $DB, $CFG; $now = time(); $issued = new stdClass(); $issued->badgeid = $this->id; $issued->userid = $userid; $issued->uniquehash = sha1(rand() . $userid . $this->id . $now); $issued->dateissued = $now; ...
[ "public", "function", "issue", "(", "$", "userid", ",", "$", "nobake", "=", "false", ")", "{", "global", "$", "DB", ",", "$", "CFG", ";", "$", "now", "=", "time", "(", ")", ";", "$", "issued", "=", "new", "stdClass", "(", ")", ";", "$", "issued...
Issue a badge to user. @param int $userid User who earned the badge @param bool $nobake Not baking actual badges (for testing purposes)
[ "Issue", "a", "badge", "to", "user", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L466-L520
214,590
moodle/moodle
lib/badgeslib.php
badge.review_all_criteria
public function review_all_criteria() { global $DB, $CFG; $awards = 0; // Raise timelimit as this could take a while for big web sites. core_php_time_limit::raise(); raise_memory_limit(MEMORY_HUGE); foreach ($this->criteria as $crit) { // Overall criterion i...
php
public function review_all_criteria() { global $DB, $CFG; $awards = 0; // Raise timelimit as this could take a while for big web sites. core_php_time_limit::raise(); raise_memory_limit(MEMORY_HUGE); foreach ($this->criteria as $crit) { // Overall criterion i...
[ "public", "function", "review_all_criteria", "(", ")", "{", "global", "$", "DB", ",", "$", "CFG", ";", "$", "awards", "=", "0", ";", "// Raise timelimit as this could take a while for big web sites.", "core_php_time_limit", "::", "raise", "(", ")", ";", "raise_memor...
Reviews all badge criteria and checks if badge can be instantly awarded. @return int Number of awards
[ "Reviews", "all", "badge", "criteria", "and", "checks", "if", "badge", "can", "be", "instantly", "awarded", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L527-L597
214,591
moodle/moodle
lib/badgeslib.php
badge.get_criteria_completions
public function get_criteria_completions($userid) { global $DB; $completions = array(); $sql = "SELECT bcm.id, bcm.critid FROM {badge_criteria_met} bcm INNER JOIN {badge_criteria} bc ON bcm.critid = bc.id WHERE bc.badgeid = :badgeid AND bcm.use...
php
public function get_criteria_completions($userid) { global $DB; $completions = array(); $sql = "SELECT bcm.id, bcm.critid FROM {badge_criteria_met} bcm INNER JOIN {badge_criteria} bc ON bcm.critid = bc.id WHERE bc.badgeid = :badgeid AND bcm.use...
[ "public", "function", "get_criteria_completions", "(", "$", "userid", ")", "{", "global", "$", "DB", ";", "$", "completions", "=", "array", "(", ")", ";", "$", "sql", "=", "\"SELECT bcm.id, bcm.critid\n FROM {badge_criteria_met} bcm\n INN...
Gets an array of completed criteria from 'badge_criteria_met' table. @param int $userid Completions for a user @return array Records of criteria completions
[ "Gets", "an", "array", "of", "completed", "criteria", "from", "badge_criteria_met", "table", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L605-L615
214,592
moodle/moodle
lib/badgeslib.php
badge.get_criteria
public function get_criteria() { global $DB; $criteria = array(); if ($records = (array)$DB->get_records('badge_criteria', array('badgeid' => $this->id))) { foreach ($records as $record) { $criteria[$record->criteriatype] = award_criteria::build((array)$record); ...
php
public function get_criteria() { global $DB; $criteria = array(); if ($records = (array)$DB->get_records('badge_criteria', array('badgeid' => $this->id))) { foreach ($records as $record) { $criteria[$record->criteriatype] = award_criteria::build((array)$record); ...
[ "public", "function", "get_criteria", "(", ")", "{", "global", "$", "DB", ";", "$", "criteria", "=", "array", "(", ")", ";", "if", "(", "$", "records", "=", "(", "array", ")", "$", "DB", "->", "get_records", "(", "'badge_criteria'", ",", "array", "("...
Returns badge award criteria @return array An array of badge criteria
[ "Returns", "badge", "award", "criteria" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L634-L645
214,593
moodle/moodle
lib/badgeslib.php
badge.get_aggregation_method
public function get_aggregation_method($criteriatype = 0) { global $DB; $params = array('badgeid' => $this->id, 'criteriatype' => $criteriatype); $aggregation = $DB->get_field('badge_criteria', 'method', $params, IGNORE_MULTIPLE); if (!$aggregation) { return BADGE_CRITERIA_A...
php
public function get_aggregation_method($criteriatype = 0) { global $DB; $params = array('badgeid' => $this->id, 'criteriatype' => $criteriatype); $aggregation = $DB->get_field('badge_criteria', 'method', $params, IGNORE_MULTIPLE); if (!$aggregation) { return BADGE_CRITERIA_A...
[ "public", "function", "get_aggregation_method", "(", "$", "criteriatype", "=", "0", ")", "{", "global", "$", "DB", ";", "$", "params", "=", "array", "(", "'badgeid'", "=>", "$", "this", "->", "id", ",", "'criteriatype'", "=>", "$", "criteriatype", ")", "...
Get aggregation method for badge criteria @param int $criteriatype If none supplied, get overall aggregation method (optional) @return int One of BADGE_CRITERIA_AGGREGATION_ALL or BADGE_CRITERIA_AGGREGATION_ANY
[ "Get", "aggregation", "method", "for", "badge", "criteria" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L653-L663
214,594
moodle/moodle
lib/badgeslib.php
badge.calculate_expiry
public function calculate_expiry($timestamp) { $expiry = null; if (isset($this->expiredate)) { $expiry = $this->expiredate; } else if (isset($this->expireperiod)) { $expiry = $timestamp + $this->expireperiod; } return $expiry; }
php
public function calculate_expiry($timestamp) { $expiry = null; if (isset($this->expiredate)) { $expiry = $this->expiredate; } else if (isset($this->expireperiod)) { $expiry = $timestamp + $this->expireperiod; } return $expiry; }
[ "public", "function", "calculate_expiry", "(", "$", "timestamp", ")", "{", "$", "expiry", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "expiredate", ")", ")", "{", "$", "expiry", "=", "$", "this", "->", "expiredate", ";", "}", "else"...
Calculates badge expiry date based on either expirydate or expiryperiod. @param int $timestamp Time of badge issue @return int A timestamp
[ "Calculates", "badge", "expiry", "date", "based", "on", "either", "expirydate", "or", "expiryperiod", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L683-L693
214,595
moodle/moodle
lib/badgeslib.php
badge.has_manual_award_criteria
public function has_manual_award_criteria() { foreach ($this->criteria as $criterion) { if ($criterion->criteriatype == BADGE_CRITERIA_TYPE_MANUAL) { return true; } } return false; }
php
public function has_manual_award_criteria() { foreach ($this->criteria as $criterion) { if ($criterion->criteriatype == BADGE_CRITERIA_TYPE_MANUAL) { return true; } } return false; }
[ "public", "function", "has_manual_award_criteria", "(", ")", "{", "foreach", "(", "$", "this", "->", "criteria", "as", "$", "criterion", ")", "{", "if", "(", "$", "criterion", "->", "criteriatype", "==", "BADGE_CRITERIA_TYPE_MANUAL", ")", "{", "return", "true"...
Checks if badge has manual award criteria set. @return bool A status indicating badge can be awarded manually
[ "Checks", "if", "badge", "has", "manual", "award", "criteria", "set", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L700-L707
214,596
moodle/moodle
lib/badgeslib.php
badge.delete
public function delete($archive = true) { global $DB; if ($archive) { $this->status = BADGE_STATUS_ARCHIVED; $this->save(); // Trigger event, badge archived. $eventparams = array('objectid' => $this->id, 'context' => $this->get_context()); $e...
php
public function delete($archive = true) { global $DB; if ($archive) { $this->status = BADGE_STATUS_ARCHIVED; $this->save(); // Trigger event, badge archived. $eventparams = array('objectid' => $this->id, 'context' => $this->get_context()); $e...
[ "public", "function", "delete", "(", "$", "archive", "=", "true", ")", "{", "global", "$", "DB", ";", "if", "(", "$", "archive", ")", "{", "$", "this", "->", "status", "=", "BADGE_STATUS_ARCHIVED", ";", "$", "this", "->", "save", "(", ")", ";", "//...
Fully deletes the badge or marks it as archived. @param $archive bool Achive a badge without actual deleting of any data.
[ "Fully", "deletes", "the", "badge", "or", "marks", "it", "as", "archived", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L714-L769
214,597
moodle/moodle
lib/badgeslib.php
badge.add_related_badges
public function add_related_badges($relatedids) { global $DB; $relatedbadges = array(); foreach ($relatedids as $relatedid) { $relatedbadge = new stdClass(); $relatedbadge->badgeid = $this->id; $relatedbadge->relatedbadgeid = $relatedid; $relatedba...
php
public function add_related_badges($relatedids) { global $DB; $relatedbadges = array(); foreach ($relatedids as $relatedid) { $relatedbadge = new stdClass(); $relatedbadge->badgeid = $this->id; $relatedbadge->relatedbadgeid = $relatedid; $relatedba...
[ "public", "function", "add_related_badges", "(", "$", "relatedids", ")", "{", "global", "$", "DB", ";", "$", "relatedbadges", "=", "array", "(", ")", ";", "foreach", "(", "$", "relatedids", "as", "$", "relatedid", ")", "{", "$", "relatedbadge", "=", "new...
Add multiple related badges. @param array $relatedids Id of badges.
[ "Add", "multiple", "related", "badges", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L776-L786
214,598
moodle/moodle
lib/badgeslib.php
badge.delete_related_badge
public function delete_related_badge($relatedid) { global $DB; $sql = "(badgeid = :badgeid AND relatedbadgeid = :relatedid) OR " . "(badgeid = :relatedid2 AND relatedbadgeid = :badgeid2)"; $params = ['badgeid' => $this->id, 'badgeid2' => $this->id, 'relatedid' => $relatedid, 'rela...
php
public function delete_related_badge($relatedid) { global $DB; $sql = "(badgeid = :badgeid AND relatedbadgeid = :relatedid) OR " . "(badgeid = :relatedid2 AND relatedbadgeid = :badgeid2)"; $params = ['badgeid' => $this->id, 'badgeid2' => $this->id, 'relatedid' => $relatedid, 'rela...
[ "public", "function", "delete_related_badge", "(", "$", "relatedid", ")", "{", "global", "$", "DB", ";", "$", "sql", "=", "\"(badgeid = :badgeid AND relatedbadgeid = :relatedid) OR \"", ".", "\"(badgeid = :relatedid2 AND relatedbadgeid = :badgeid2)\"", ";", "$", "params", "...
Delete an related badge. @param int $relatedid Id related badge. @return bool A status for delete an related badge.
[ "Delete", "an", "related", "badge", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L794-L800
214,599
moodle/moodle
lib/badgeslib.php
badge.has_related
public function has_related() { global $DB; $sql = "SELECT DISTINCT b.id FROM {badge_related} br JOIN {badge} b ON (br.relatedbadgeid = b.id OR br.badgeid = b.id) WHERE (br.badgeid = :badgeid OR br.relatedbadgeid = :badgeid2) AND b.id != :badgei...
php
public function has_related() { global $DB; $sql = "SELECT DISTINCT b.id FROM {badge_related} br JOIN {badge} b ON (br.relatedbadgeid = b.id OR br.badgeid = b.id) WHERE (br.badgeid = :badgeid OR br.relatedbadgeid = :badgeid2) AND b.id != :badgei...
[ "public", "function", "has_related", "(", ")", "{", "global", "$", "DB", ";", "$", "sql", "=", "\"SELECT DISTINCT b.id\n FROM {badge_related} br\n JOIN {badge} b ON (br.relatedbadgeid = b.id OR br.badgeid = b.id)\n WHERE (br.badgeid =...
Checks if badge has related badges. @return bool A status related badge.
[ "Checks", "if", "badge", "has", "related", "badges", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/badgeslib.php#L807-L814