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,700 | moodle/moodle | mod/quiz/renderer.php | mod_quiz_renderer.attempt_state | public function attempt_state($attemptobj) {
switch ($attemptobj->get_state()) {
case quiz_attempt::IN_PROGRESS:
return get_string('stateinprogress', 'quiz');
case quiz_attempt::OVERDUE:
return get_string('stateoverdue', 'quiz') . html_writer::tag('span',... | php | public function attempt_state($attemptobj) {
switch ($attemptobj->get_state()) {
case quiz_attempt::IN_PROGRESS:
return get_string('stateinprogress', 'quiz');
case quiz_attempt::OVERDUE:
return get_string('stateoverdue', 'quiz') . html_writer::tag('span',... | [
"public",
"function",
"attempt_state",
"(",
"$",
"attemptobj",
")",
"{",
"switch",
"(",
"$",
"attemptobj",
"->",
"get_state",
"(",
")",
")",
"{",
"case",
"quiz_attempt",
"::",
"IN_PROGRESS",
":",
"return",
"get_string",
"(",
"'stateinprogress'",
",",
"'quiz'",... | Generate a brief textual desciption of the current state of an attempt.
@param quiz_attempt $attemptobj the attempt
@param int $timenow the time to use as 'now'.
@return string the appropriate lang string to describe the state. | [
"Generate",
"a",
"brief",
"textual",
"desciption",
"of",
"the",
"current",
"state",
"of",
"an",
"attempt",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/renderer.php#L1108-L1128 |
214,701 | moodle/moodle | mod/quiz/renderer.php | mod_quiz_renderer.view_result_info | public function view_result_info($quiz, $context, $cm, $viewobj) {
$output = '';
if (!$viewobj->numattempts && !$viewobj->gradecolumn && is_null($viewobj->mygrade)) {
return $output;
}
$resultinfo = '';
if ($viewobj->overallstats) {
if ($viewobj->moreatte... | php | public function view_result_info($quiz, $context, $cm, $viewobj) {
$output = '';
if (!$viewobj->numattempts && !$viewobj->gradecolumn && is_null($viewobj->mygrade)) {
return $output;
}
$resultinfo = '';
if ($viewobj->overallstats) {
if ($viewobj->moreatte... | [
"public",
"function",
"view_result_info",
"(",
"$",
"quiz",
",",
"$",
"context",
",",
"$",
"cm",
",",
"$",
"viewobj",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"!",
"$",
"viewobj",
"->",
"numattempts",
"&&",
"!",
"$",
"viewobj",
"->",
"gr... | Generates data pertaining to quiz results
@param array $quiz Array containing quiz data
@param int $context The page context ID
@param int $cm The Course Module Id
@param mod_quiz_view_object $viewobj | [
"Generates",
"data",
"pertaining",
"to",
"quiz",
"results"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/renderer.php#L1138-L1181 |
214,702 | moodle/moodle | mod/quiz/renderer.php | mod_quiz_renderer.review_link | public function review_link($url, $reviewinpopup, $popupoptions) {
if ($reviewinpopup) {
$button = new single_button($url, get_string('review', 'quiz'));
$button->add_action(new popup_action('click', $url, 'quizpopup', $popupoptions));
return $this->render($button);
... | php | public function review_link($url, $reviewinpopup, $popupoptions) {
if ($reviewinpopup) {
$button = new single_button($url, get_string('review', 'quiz'));
$button->add_action(new popup_action('click', $url, 'quizpopup', $popupoptions));
return $this->render($button);
... | [
"public",
"function",
"review_link",
"(",
"$",
"url",
",",
"$",
"reviewinpopup",
",",
"$",
"popupoptions",
")",
"{",
"if",
"(",
"$",
"reviewinpopup",
")",
"{",
"$",
"button",
"=",
"new",
"single_button",
"(",
"$",
"url",
",",
"get_string",
"(",
"'review'... | Output either a link to the review page for an attempt, or a button to
open the review in a popup window.
@param moodle_url $url of the target page.
@param bool $reviewinpopup whether a pop-up is required.
@param array $popupoptions options to pass to the popup_action constructor.
@return string HTML to output. | [
"Output",
"either",
"a",
"link",
"to",
"the",
"review",
"page",
"for",
"an",
"attempt",
"or",
"a",
"button",
"to",
"open",
"the",
"review",
"in",
"a",
"popup",
"window",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/renderer.php#L1192-L1202 |
214,703 | moodle/moodle | mod/quiz/renderer.php | mod_quiz_renderer.chart | public function chart(\core\chart_base $chart, $title) {
return $this->heading($title, 3) . html_writer::tag('div', $this->render($chart), array('class' => 'graph'));
} | php | public function chart(\core\chart_base $chart, $title) {
return $this->heading($title, 3) . html_writer::tag('div', $this->render($chart), array('class' => 'graph'));
} | [
"public",
"function",
"chart",
"(",
"\\",
"core",
"\\",
"chart_base",
"$",
"chart",
",",
"$",
"title",
")",
"{",
"return",
"$",
"this",
"->",
"heading",
"(",
"$",
"title",
",",
"3",
")",
".",
"html_writer",
"::",
"tag",
"(",
"'div'",
",",
"$",
"thi... | Outputs a chart.
@param \core\chart_base $chart The chart.
@param string $title The title to display above the graph.
@return string HTML fragment for the graph. | [
"Outputs",
"a",
"chart",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/renderer.php#L1251-L1253 |
214,704 | moodle/moodle | mod/quiz/renderer.php | mod_quiz_renderer.graph | public function graph(moodle_url $url, $title) {
global $CFG;
$graph = html_writer::empty_tag('img', array('src' => $url, 'alt' => $title));
return $this->heading($title, 3) . html_writer::tag('div', $graph, array('class' => 'graph'));
} | php | public function graph(moodle_url $url, $title) {
global $CFG;
$graph = html_writer::empty_tag('img', array('src' => $url, 'alt' => $title));
return $this->heading($title, 3) . html_writer::tag('div', $graph, array('class' => 'graph'));
} | [
"public",
"function",
"graph",
"(",
"moodle_url",
"$",
"url",
",",
"$",
"title",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"graph",
"=",
"html_writer",
"::",
"empty_tag",
"(",
"'img'",
",",
"array",
"(",
"'src'",
"=>",
"$",
"url",
",",
"'alt'",
"=>",... | Output a graph, or a message saying that GD is required.
@param moodle_url $url the URL of the graph.
@param string $title the title to display above the graph.
@return string HTML fragment for the graph. | [
"Output",
"a",
"graph",
"or",
"a",
"message",
"saying",
"that",
"GD",
"is",
"required",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/renderer.php#L1261-L1267 |
214,705 | moodle/moodle | mod/quiz/renderer.php | mod_quiz_renderer.connection_warning | public function connection_warning() {
$options = array('filter' => false, 'newlines' => false);
$warning = format_text(get_string('connectionerror', 'quiz'), FORMAT_MARKDOWN, $options);
$ok = format_text(get_string('connectionok', 'quiz'), FORMAT_MARKDOWN, $options);
return html_writer:... | php | public function connection_warning() {
$options = array('filter' => false, 'newlines' => false);
$warning = format_text(get_string('connectionerror', 'quiz'), FORMAT_MARKDOWN, $options);
$ok = format_text(get_string('connectionok', 'quiz'), FORMAT_MARKDOWN, $options);
return html_writer:... | [
"public",
"function",
"connection_warning",
"(",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"'filter'",
"=>",
"false",
",",
"'newlines'",
"=>",
"false",
")",
";",
"$",
"warning",
"=",
"format_text",
"(",
"get_string",
"(",
"'connectionerror'",
",",
"'quiz'... | Output the connection warning messages, which are initially hidden, and
only revealed by JavaScript if necessary. | [
"Output",
"the",
"connection",
"warning",
"messages",
"which",
"are",
"initially",
"hidden",
"and",
"only",
"revealed",
"by",
"JavaScript",
"if",
"necessary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/renderer.php#L1273-L1280 |
214,706 | moodle/moodle | cache/stores/apcu/lib.php | cachestore_apcu.are_requirements_met | public static function are_requirements_met() {
$enabled = ini_get('apc.enabled') && (php_sapi_name() != "cli" || ini_get('apc.enable_cli'));
if (!extension_loaded('apcu') || !$enabled) {
return false;
}
$version = phpversion('apcu');
return $version && version_compa... | php | public static function are_requirements_met() {
$enabled = ini_get('apc.enabled') && (php_sapi_name() != "cli" || ini_get('apc.enable_cli'));
if (!extension_loaded('apcu') || !$enabled) {
return false;
}
$version = phpversion('apcu');
return $version && version_compa... | [
"public",
"static",
"function",
"are_requirements_met",
"(",
")",
"{",
"$",
"enabled",
"=",
"ini_get",
"(",
"'apc.enabled'",
")",
"&&",
"(",
"php_sapi_name",
"(",
")",
"!=",
"\"cli\"",
"||",
"ini_get",
"(",
"'apc.enable_cli'",
")",
")",
";",
"if",
"(",
"!"... | Static method to check that the APCu stores requirements have been met.
It checks that the APCu extension has been loaded and that it has been enabled.
@return bool True if the stores software/hardware requirements have been met and it can be used. False otherwise. | [
"Static",
"method",
"to",
"check",
"that",
"the",
"APCu",
"stores",
"requirements",
"have",
"been",
"met",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/apcu/lib.php#L71-L79 |
214,707 | moodle/moodle | cache/stores/apcu/lib.php | cachestore_apcu.initialise | public function initialise(cache_definition $definition) {
$this->definition = $definition;
$this->cacheprefix = $this->storeprefix.$definition->generate_definition_hash().'__';
return true;
} | php | public function initialise(cache_definition $definition) {
$this->definition = $definition;
$this->cacheprefix = $this->storeprefix.$definition->generate_definition_hash().'__';
return true;
} | [
"public",
"function",
"initialise",
"(",
"cache_definition",
"$",
"definition",
")",
"{",
"$",
"this",
"->",
"definition",
"=",
"$",
"definition",
";",
"$",
"this",
"->",
"cacheprefix",
"=",
"$",
"this",
"->",
"storeprefix",
".",
"$",
"definition",
"->",
"... | Initialises a new instance of the cache store given the definition the instance is to be used for.
This function should prepare any given connections etc.
@param cache_definition $definition
@return bool | [
"Initialises",
"a",
"new",
"instance",
"of",
"the",
"cache",
"store",
"given",
"the",
"definition",
"the",
"instance",
"is",
"to",
"be",
"used",
"for",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/apcu/lib.php#L144-L148 |
214,708 | moodle/moodle | mod/survey/classes/external.php | mod_survey_external.get_surveys_by_courses_returns | public static function get_surveys_by_courses_returns() {
return new external_single_structure(
array(
'surveys' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_valu... | php | public static function get_surveys_by_courses_returns() {
return new external_single_structure(
array(
'surveys' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_valu... | [
"public",
"static",
"function",
"get_surveys_by_courses_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'surveys'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'id'",... | Describes the get_surveys_by_courses return value.
@return external_single_structure
@since Moodle 3.0 | [
"Describes",
"the",
"get_surveys_by_courses",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/survey/classes/external.php#L142-L171 |
214,709 | moodle/moodle | mod/survey/classes/external.php | mod_survey_external.get_questions | public static function get_questions($surveyid) {
global $DB, $USER;
$params = self::validate_parameters(self::get_questions_parameters(),
array(
'surveyid' => $surveyid
... | php | public static function get_questions($surveyid) {
global $DB, $USER;
$params = self::validate_parameters(self::get_questions_parameters(),
array(
'surveyid' => $surveyid
... | [
"public",
"static",
"function",
"get_questions",
"(",
"$",
"surveyid",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_questions_parameters",
"(",
")",
",",
"array",
"("... | Get the complete list of questions for the survey, including subquestions.
@param int $surveyid the survey instance id
@return array of warnings and the question list
@since Moodle 3.0
@throws moodle_exception | [
"Get",
"the",
"complete",
"list",
"of",
"questions",
"for",
"the",
"survey",
"including",
"subquestions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/survey/classes/external.php#L260-L300 |
214,710 | moodle/moodle | mod/survey/classes/external.php | mod_survey_external.submit_answers_parameters | public static function submit_answers_parameters() {
return new external_function_parameters(
array(
'surveyid' => new external_value(PARAM_INT, 'Survey id'),
'answers' => new external_multiple_structure(
new external_single_structure(
... | php | public static function submit_answers_parameters() {
return new external_function_parameters(
array(
'surveyid' => new external_value(PARAM_INT, 'Survey id'),
'answers' => new external_multiple_structure(
new external_single_structure(
... | [
"public",
"static",
"function",
"submit_answers_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'surveyid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'Survey id'",
")",
",",
"'answers'",
"=>",
"new",
"... | Describes the parameters for submit_answers.
@return external_function_parameters
@since Moodle 3.0 | [
"Describes",
"the",
"parameters",
"for",
"submit_answers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/survey/classes/external.php#L336-L350 |
214,711 | moodle/moodle | mod/survey/classes/external.php | mod_survey_external.submit_answers | public static function submit_answers($surveyid, $answers) {
global $DB, $USER;
$params = self::validate_parameters(self::submit_answers_parameters(),
array(
'surveyid' => $surveyid,
... | php | public static function submit_answers($surveyid, $answers) {
global $DB, $USER;
$params = self::validate_parameters(self::submit_answers_parameters(),
array(
'surveyid' => $surveyid,
... | [
"public",
"static",
"function",
"submit_answers",
"(",
"$",
"surveyid",
",",
"$",
"answers",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"submit_answers_parameters",
"(",
... | Submit the answers for a given survey.
@param int $surveyid the survey instance id
@param array $answers the survey answers
@return array of warnings and status result
@since Moodle 3.0
@throws moodle_exception | [
"Submit",
"the",
"answers",
"for",
"a",
"given",
"survey",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/survey/classes/external.php#L361-L396 |
214,712 | moodle/moodle | analytics/classes/insights_generator.php | insights_generator.generate | public function generate($samplecontexts, $predictions) {
global $OUTPUT;
$analyserclass = $this->target->get_analyser_class();
// We will need to restore it later.
$actuallanguage = current_language();
if ($analyserclass::one_sample_per_analysable()) {
// Iterate... | php | public function generate($samplecontexts, $predictions) {
global $OUTPUT;
$analyserclass = $this->target->get_analyser_class();
// We will need to restore it later.
$actuallanguage = current_language();
if ($analyserclass::one_sample_per_analysable()) {
// Iterate... | [
"public",
"function",
"generate",
"(",
"$",
"samplecontexts",
",",
"$",
"predictions",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"analyserclass",
"=",
"$",
"this",
"->",
"target",
"->",
"get_analyser_class",
"(",
")",
";",
"// We will need to restore it later... | Generates insight notifications.
@param array $samplecontexts The contexts these predictions belong to
@param \core_analytics\prediction[] $predictions The prediction records
@return null | [
"Generates",
"insight",
"notifications",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/insights_generator.php#L73-L120 |
214,713 | moodle/moodle | analytics/classes/insights_generator.php | insights_generator.notification | private function notification(\context $context, \stdClass $user, \moodle_url $insighturl, string $fullmessage, string $fullmessagehtml) {
$message = new \core\message\message();
$message->component = 'moodle';
$message->name = 'insights';
$message->userfrom = \core_user::get_noreply_u... | php | private function notification(\context $context, \stdClass $user, \moodle_url $insighturl, string $fullmessage, string $fullmessagehtml) {
$message = new \core\message\message();
$message->component = 'moodle';
$message->name = 'insights';
$message->userfrom = \core_user::get_noreply_u... | [
"private",
"function",
"notification",
"(",
"\\",
"context",
"$",
"context",
",",
"\\",
"stdClass",
"$",
"user",
",",
"\\",
"moodle_url",
"$",
"insighturl",
",",
"string",
"$",
"fullmessage",
",",
"string",
"$",
"fullmessagehtml",
")",
"{",
"$",
"message",
... | Generates a insight notification for the user.
@param \context $context
@param \stdClass $user
@param \moodle_url $insighturl The insight URL
@param string $fullmessage
@param string $fullmessagehtml
@return null | [
"Generates",
"a",
"insight",
"notification",
"for",
"the",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/insights_generator.php#L132-L154 |
214,714 | moodle/moodle | analytics/classes/insights_generator.php | insights_generator.get_context_courseid | private function get_context_courseid(\context $context) {
if (empty($this->contextcourseids[$context->id])) {
$coursecontext = $context->get_course_context(false);
if (!$coursecontext) {
// Default to the frontpage course context.
$coursecontext = \cont... | php | private function get_context_courseid(\context $context) {
if (empty($this->contextcourseids[$context->id])) {
$coursecontext = $context->get_course_context(false);
if (!$coursecontext) {
// Default to the frontpage course context.
$coursecontext = \cont... | [
"private",
"function",
"get_context_courseid",
"(",
"\\",
"context",
"$",
"context",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"contextcourseids",
"[",
"$",
"context",
"->",
"id",
"]",
")",
")",
"{",
"$",
"coursecontext",
"=",
"$",
"context",... | Returns the course context of the provided context reading an internal cache first.
@param \context $context
@return int | [
"Returns",
"the",
"course",
"context",
"of",
"the",
"provided",
"context",
"reading",
"an",
"internal",
"cache",
"first",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/insights_generator.php#L162-L175 |
214,715 | moodle/moodle | analytics/classes/insights_generator.php | insights_generator.prediction_info | private function prediction_info(\core_analytics\prediction $prediction) {
global $OUTPUT;
$predictionactions = $this->target->prediction_actions($prediction, true, true);
// For FORMAT_PLAIN.
$fullmessageplaintext = '';
// For FORMAT_HTML.
$messageactions = [];
... | php | private function prediction_info(\core_analytics\prediction $prediction) {
global $OUTPUT;
$predictionactions = $this->target->prediction_actions($prediction, true, true);
// For FORMAT_PLAIN.
$fullmessageplaintext = '';
// For FORMAT_HTML.
$messageactions = [];
... | [
"private",
"function",
"prediction_info",
"(",
"\\",
"core_analytics",
"\\",
"prediction",
"$",
"prediction",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"predictionactions",
"=",
"$",
"this",
"->",
"target",
"->",
"prediction_actions",
"(",
"$",
"prediction",
... | Extracts info from the prediction for display purposes.
@param \core_analytics\prediction $prediction
@return array Three items array with formats [\moodle_url, string, string] | [
"Extracts",
"info",
"from",
"the",
"prediction",
"for",
"display",
"purposes",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/insights_generator.php#L183-L215 |
214,716 | moodle/moodle | analytics/classes/insights_generator.php | insights_generator.set_notification_language | private function set_notification_language($user) {
global $CFG;
// Copied from current_language().
if (!empty($user->lang)) {
$lang = $user->lang;
} else if (isset($CFG->lang)) {
$lang = $CFG->lang;
} else {
$lang = 'en';
}
fo... | php | private function set_notification_language($user) {
global $CFG;
// Copied from current_language().
if (!empty($user->lang)) {
$lang = $user->lang;
} else if (isset($CFG->lang)) {
$lang = $CFG->lang;
} else {
$lang = 'en';
}
fo... | [
"private",
"function",
"set_notification_language",
"(",
"$",
"user",
")",
"{",
"global",
"$",
"CFG",
";",
"// Copied from current_language().",
"if",
"(",
"!",
"empty",
"(",
"$",
"user",
"->",
"lang",
")",
")",
"{",
"$",
"lang",
"=",
"$",
"user",
"->",
... | Sets the session language to the language used by the notification receiver.
@param \stdClass $user The user who will receive the message
@return null | [
"Sets",
"the",
"session",
"language",
"to",
"the",
"language",
"used",
"by",
"the",
"notification",
"receiver",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/insights_generator.php#L223-L235 |
214,717 | moodle/moodle | grade/grading/classes/privacy/provider.php | provider.export_item_data | public static function export_item_data(\context $context, int $itemid, array $subcontext) {
global $DB;
$sql = "SELECT gi.id AS instanceid, gd.id AS definitionid, gd.method
FROM {grading_areas} ga
JOIN {grading_definitions} gd ON gd.areaid = ga.id
... | php | public static function export_item_data(\context $context, int $itemid, array $subcontext) {
global $DB;
$sql = "SELECT gi.id AS instanceid, gd.id AS definitionid, gd.method
FROM {grading_areas} ga
JOIN {grading_definitions} gd ON gd.areaid = ga.id
... | [
"public",
"static",
"function",
"export_item_data",
"(",
"\\",
"context",
"$",
"context",
",",
"int",
"$",
"itemid",
",",
"array",
"$",
"subcontext",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT gi.id AS instanceid, gd.id AS definitionid, gd.meth... | Export all user data related to a context and itemid.
@param \context $context Context to export on.
@param int $itemid Item ID to export on.
@param array $subcontext Directory location to export to. | [
"Export",
"all",
"user",
"data",
"related",
"to",
"a",
"context",
"and",
"itemid",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/classes/privacy/provider.php#L173-L195 |
214,718 | moodle/moodle | grade/grading/classes/privacy/provider.php | provider.delete_instance_data | public static function delete_instance_data(\context $context, int $itemid = null) {
if (is_null($itemid)) {
self::delete_data_for_instances($context);
} else {
self::delete_data_for_instances($context, [$itemid]);
}
} | php | public static function delete_instance_data(\context $context, int $itemid = null) {
if (is_null($itemid)) {
self::delete_data_for_instances($context);
} else {
self::delete_data_for_instances($context, [$itemid]);
}
} | [
"public",
"static",
"function",
"delete_instance_data",
"(",
"\\",
"context",
"$",
"context",
",",
"int",
"$",
"itemid",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"itemid",
")",
")",
"{",
"self",
"::",
"delete_data_for_instances",
"(",
"$",
... | Deletes all user data related to a context and possibly an itemid.
@param \context $context The context to delete on.
@param int|null $itemid An optional item ID to refine the deletion. | [
"Deletes",
"all",
"user",
"data",
"related",
"to",
"a",
"context",
"and",
"possibly",
"an",
"itemid",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/classes/privacy/provider.php#L203-L209 |
214,719 | moodle/moodle | grade/grading/classes/privacy/provider.php | provider.delete_data_for_instances | public static function delete_data_for_instances(\context $context, array $itemids = []) {
global $DB;
$itemsql = '';
$params = ['contextid' => $context->id];
if (!empty($itemids)) {
list($itemsql, $itemparams) = $DB->get_in_or_equal($itemids, SQL_PARAMS_NAMED);
$... | php | public static function delete_data_for_instances(\context $context, array $itemids = []) {
global $DB;
$itemsql = '';
$params = ['contextid' => $context->id];
if (!empty($itemids)) {
list($itemsql, $itemparams) = $DB->get_in_or_equal($itemids, SQL_PARAMS_NAMED);
$... | [
"public",
"static",
"function",
"delete_data_for_instances",
"(",
"\\",
"context",
"$",
"context",
",",
"array",
"$",
"itemids",
"=",
"[",
"]",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"itemsql",
"=",
"''",
";",
"$",
"params",
"=",
"[",
"'contextid'",
... | Deletes all user data related to a context and possibly itemids.
@param \context $context The context to delete on.
@param array $itemids An optional list of item IDs to refine the deletion. | [
"Deletes",
"all",
"user",
"data",
"related",
"to",
"a",
"context",
"and",
"possibly",
"itemids",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/classes/privacy/provider.php#L217-L246 |
214,720 | moodle/moodle | grade/grading/classes/privacy/provider.php | provider.export_grading_instances | protected static function export_grading_instances(\context $context, array $subcontext, int $definitionid, int $userid = 0) {
global $DB;
$params = ['definitionid' => $definitionid];
if (!empty($userid)) {
$params['raterid'] = $userid;
}
$instances = $DB->get_record... | php | protected static function export_grading_instances(\context $context, array $subcontext, int $definitionid, int $userid = 0) {
global $DB;
$params = ['definitionid' => $definitionid];
if (!empty($userid)) {
$params['raterid'] = $userid;
}
$instances = $DB->get_record... | [
"protected",
"static",
"function",
"export_grading_instances",
"(",
"\\",
"context",
"$",
"context",
",",
"array",
"$",
"subcontext",
",",
"int",
"$",
"definitionid",
",",
"int",
"$",
"userid",
"=",
"0",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
... | Exports the data related to grading instances within the specified definition.
@param \context $context Context owner of the data.
@param array $subcontext Subcontext owner of the data.
@param int $definitionid The definition ID whose grading instance information is to be exported.
@... | [
"Exports",
"the",
"data",
"related",
"to",
"grading",
"instances",
"within",
"the",
"specified",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/classes/privacy/provider.php#L344-L373 |
214,721 | moodle/moodle | enrol/lti/lib.php | enrol_lti_plugin.delete_instance | public function delete_instance($instance) {
global $DB;
// Get the tool associated with this instance.
$tool = $DB->get_record('enrol_lti_tools', array('enrolid' => $instance->id), 'id', MUST_EXIST);
// Delete any users associated with this tool.
$DB->delete_records('enrol_lti... | php | public function delete_instance($instance) {
global $DB;
// Get the tool associated with this instance.
$tool = $DB->get_record('enrol_lti_tools', array('enrolid' => $instance->id), 'id', MUST_EXIST);
// Delete any users associated with this tool.
$DB->delete_records('enrol_lti... | [
"public",
"function",
"delete_instance",
"(",
"$",
"instance",
")",
"{",
"global",
"$",
"DB",
";",
"// Get the tool associated with this instance.",
"$",
"tool",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'enrol_lti_tools'",
",",
"array",
"(",
"'enrolid'",
"=>",
... | Delete plugin specific information.
@param stdClass $instance
@return void | [
"Delete",
"plugin",
"specific",
"information",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/lib.php#L154-L183 |
214,722 | moodle/moodle | enrol/lti/lib.php | enrol_lti_plugin.unenrol_user | public function unenrol_user(stdClass $instance, $userid) {
global $DB;
// Get the tool associated with this instance. Note - it may not exist if we have deleted
// the tool. This is fine because we have already cleaned the 'enrol_lti_users' table.
if ($tool = $DB->get_record('enrol_lti... | php | public function unenrol_user(stdClass $instance, $userid) {
global $DB;
// Get the tool associated with this instance. Note - it may not exist if we have deleted
// the tool. This is fine because we have already cleaned the 'enrol_lti_users' table.
if ($tool = $DB->get_record('enrol_lti... | [
"public",
"function",
"unenrol_user",
"(",
"stdClass",
"$",
"instance",
",",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"// Get the tool associated with this instance. Note - it may not exist if we have deleted",
"// the tool. This is fine because we have already cleaned th... | Handles un-enrolling a user.
@param stdClass $instance
@param int $userid
@return void | [
"Handles",
"un",
"-",
"enrolling",
"a",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/lib.php#L192-L203 |
214,723 | moodle/moodle | question/type/multichoice/backup/moodle2/restore_qtype_multichoice_plugin.class.php | restore_qtype_multichoice_plugin.recode_choice_order | protected function recode_choice_order($order) {
$neworder = array();
foreach (explode(',', $order) as $id) {
if ($newid = $this->get_mappingid('question_answer', $id)) {
$neworder[] = $newid;
}
}
return implode(',', $neworder);
} | php | protected function recode_choice_order($order) {
$neworder = array();
foreach (explode(',', $order) as $id) {
if ($newid = $this->get_mappingid('question_answer', $id)) {
$neworder[] = $newid;
}
}
return implode(',', $neworder);
} | [
"protected",
"function",
"recode_choice_order",
"(",
"$",
"order",
")",
"{",
"$",
"neworder",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"explode",
"(",
"','",
",",
"$",
"order",
")",
"as",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"newid",
"=",
"$",
... | Recode the choice order as stored in the response.
@param string $order the original order.
@return string the recoded order. | [
"Recode",
"the",
"choice",
"order",
"as",
"stored",
"in",
"the",
"response",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/multichoice/backup/moodle2/restore_qtype_multichoice_plugin.class.php#L96-L104 |
214,724 | moodle/moodle | question/type/multichoice/backup/moodle2/restore_qtype_multichoice_plugin.class.php | restore_qtype_multichoice_plugin.recode_legacy_state_answer | public function recode_legacy_state_answer($state) {
$answer = $state->answer;
$orderarr = array();
$responsesarr = array();
$lists = explode(':', $answer);
// If only 1 list, answer is missing the order list, adjust.
if (count($lists) == 1) {
$lists[1] = $lis... | php | public function recode_legacy_state_answer($state) {
$answer = $state->answer;
$orderarr = array();
$responsesarr = array();
$lists = explode(':', $answer);
// If only 1 list, answer is missing the order list, adjust.
if (count($lists) == 1) {
$lists[1] = $lis... | [
"public",
"function",
"recode_legacy_state_answer",
"(",
"$",
"state",
")",
"{",
"$",
"answer",
"=",
"$",
"state",
"->",
"answer",
";",
"$",
"orderarr",
"=",
"array",
"(",
")",
";",
"$",
"responsesarr",
"=",
"array",
"(",
")",
";",
"$",
"lists",
"=",
... | Given one question_states record, return the answer
recoded pointing to all the restored stuff for multichoice questions
answer are two (hypen speparated) lists of comma separated question_answers
the first to specify the order of the answers and the second to specify the
responses. Note the order list (the first one)... | [
"Given",
"one",
"question_states",
"record",
"return",
"the",
"answer",
"recoded",
"pointing",
"to",
"all",
"the",
"restored",
"stuff",
"for",
"multichoice",
"questions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/multichoice/backup/moodle2/restore_qtype_multichoice_plugin.class.php#L114-L148 |
214,725 | moodle/moodle | lib/mustache/src/Mustache/Cache/AbstractCache.php | Mustache_Cache_AbstractCache.setLogger | public function setLogger($logger = null)
{
if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) {
throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.');
}
... | php | public function setLogger($logger = null)
{
if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) {
throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.');
}
... | [
"public",
"function",
"setLogger",
"(",
"$",
"logger",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"logger",
"!==",
"null",
"&&",
"!",
"(",
"$",
"logger",
"instanceof",
"Mustache_Logger",
"||",
"is_a",
"(",
"$",
"logger",
",",
"'Psr\\\\Log\\\\LoggerInterface'",
... | Set a logger instance.
@param Mustache_Logger|Psr\Log\LoggerInterface $logger | [
"Set",
"a",
"logger",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Cache/AbstractCache.php#L38-L45 |
214,726 | moodle/moodle | badges/criteria/award_criteria.php | award_criteria.build | public static function build($params) {
global $CFG;
require_once($CFG->libdir . '/badgeslib.php');
$types = badges_list_criteria(false);
if (!isset($params['criteriatype']) || !isset($types[$params['criteriatype']])) {
print_error('error:invalidcriteriatype', 'badges');
... | php | public static function build($params) {
global $CFG;
require_once($CFG->libdir . '/badgeslib.php');
$types = badges_list_criteria(false);
if (!isset($params['criteriatype']) || !isset($types[$params['criteriatype']])) {
print_error('error:invalidcriteriatype', 'badges');
... | [
"public",
"static",
"function",
"build",
"(",
"$",
"params",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/badgeslib.php'",
")",
";",
"$",
"types",
"=",
"badges_list_criteria",
"(",
"false",
")",
";",
"if",... | Factory method for creating criteria class object
@param array $params associative arrays varname => value
@return award_criteria | [
"Factory",
"method",
"for",
"creating",
"criteria",
"class",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/criteria/award_criteria.php#L153-L168 |
214,727 | moodle/moodle | badges/criteria/award_criteria.php | award_criteria.config_form_criteria | public function config_form_criteria($data) {
global $OUTPUT;
$agg = $data->get_aggregation_methods();
$editurl = new moodle_url('/badges/criteria_settings.php',
array('badgeid' => $this->badgeid, 'edit' => true, 'type' => $this->criteriatype, 'crit' => $this->id));
$del... | php | public function config_form_criteria($data) {
global $OUTPUT;
$agg = $data->get_aggregation_methods();
$editurl = new moodle_url('/badges/criteria_settings.php',
array('badgeid' => $this->badgeid, 'edit' => true, 'type' => $this->criteriatype, 'crit' => $this->id));
$del... | [
"public",
"function",
"config_form_criteria",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"agg",
"=",
"$",
"data",
"->",
"get_aggregation_methods",
"(",
")",
";",
"$",
"editurl",
"=",
"new",
"moodle_url",
"(",
"'/badges/criteria_settings.php... | Add appropriate criteria elements
@param stdClass $data details of various criteria | [
"Add",
"appropriate",
"criteria",
"elements"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/criteria/award_criteria.php#L248-L283 |
214,728 | moodle/moodle | badges/criteria/award_criteria.php | award_criteria.mark_complete | public function mark_complete($userid) {
global $DB;
$obj = array();
$obj['critid'] = $this->id;
$obj['userid'] = $userid;
$obj['datemet'] = time();
if (!$DB->record_exists('badge_criteria_met', array('critid' => $this->id, 'userid' => $userid))) {
$DB->insert... | php | public function mark_complete($userid) {
global $DB;
$obj = array();
$obj['critid'] = $this->id;
$obj['userid'] = $userid;
$obj['datemet'] = time();
if (!$DB->record_exists('badge_criteria_met', array('critid' => $this->id, 'userid' => $userid))) {
$DB->insert... | [
"public",
"function",
"mark_complete",
"(",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"obj",
"=",
"array",
"(",
")",
";",
"$",
"obj",
"[",
"'critid'",
"]",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"obj",
"[",
"'userid'",
"]",
"=",
... | Mark this criteria as complete for a user
@param int $userid User whose criteria is completed. | [
"Mark",
"this",
"criteria",
"as",
"complete",
"for",
"a",
"user"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/criteria/award_criteria.php#L309-L318 |
214,729 | moodle/moodle | badges/criteria/award_criteria.php | award_criteria.get_params | public function get_params($cid) {
global $DB;
$params = array();
$records = $DB->get_records('badge_criteria_param', array('critid' => $cid));
foreach ($records as $rec) {
$arr = explode('_', $rec->name);
$params[$arr[1]][$arr[0]] = $rec->value;
}
... | php | public function get_params($cid) {
global $DB;
$params = array();
$records = $DB->get_records('badge_criteria_param', array('critid' => $cid));
foreach ($records as $rec) {
$arr = explode('_', $rec->name);
$params[$arr[1]][$arr[0]] = $rec->value;
}
... | [
"public",
"function",
"get_params",
"(",
"$",
"cid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"records",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"'badge_criteria_param'",
",",
"array",
"(",
"'critid'",
"=>"... | Return criteria parameters
@param int $critid Criterion ID
@return array | [
"Return",
"criteria",
"parameters"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/criteria/award_criteria.php#L326-L337 |
214,730 | moodle/moodle | badges/criteria/award_criteria.php | award_criteria.delete | public function delete() {
global $DB, $PAGE;
// Remove any records if it has already been met.
$DB->delete_records('badge_criteria_met', array('critid' => $this->id));
// Remove all parameters records.
$DB->delete_records('badge_criteria_param', array('critid' => $this->id));
... | php | public function delete() {
global $DB, $PAGE;
// Remove any records if it has already been met.
$DB->delete_records('badge_criteria_met', array('critid' => $this->id));
// Remove all parameters records.
$DB->delete_records('badge_criteria_param', array('critid' => $this->id));
... | [
"public",
"function",
"delete",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"PAGE",
";",
"// Remove any records if it has already been met.",
"$",
"DB",
"->",
"delete_records",
"(",
"'badge_criteria_met'",
",",
"array",
"(",
"'critid'",
"=>",
"$",
"this",
"->"... | Delete this criterion | [
"Delete",
"this",
"criterion"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/criteria/award_criteria.php#L343-L361 |
214,731 | moodle/moodle | mod/quiz/attemptlib.php | quiz.create | public static function create($quizid, $userid = null) {
global $DB;
$quiz = quiz_access_manager::load_quiz_and_settings($quizid);
$course = $DB->get_record('course', array('id' => $quiz->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('quiz', $quiz->id, $course->id, fal... | php | public static function create($quizid, $userid = null) {
global $DB;
$quiz = quiz_access_manager::load_quiz_and_settings($quizid);
$course = $DB->get_record('course', array('id' => $quiz->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('quiz', $quiz->id, $course->id, fal... | [
"public",
"static",
"function",
"create",
"(",
"$",
"quizid",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"quiz",
"=",
"quiz_access_manager",
"::",
"load_quiz_and_settings",
"(",
"$",
"quizid",
")",
";",
"$",
"course",
"=",
... | Static function to create a new quiz object for a specific user.
@param int $quizid the the quiz id.
@param int $userid the the userid.
@return quiz the new quiz object | [
"Static",
"function",
"to",
"create",
"a",
"new",
"quiz",
"object",
"for",
"a",
"specific",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L107-L120 |
214,732 | moodle/moodle | mod/quiz/attemptlib.php | quiz.get_sections | public function get_sections() {
global $DB;
if ($this->sections === null) {
$this->sections = array_values($DB->get_records('quiz_sections',
array('quizid' => $this->get_quizid()), 'firstslot'));
}
return $this->sections;
} | php | public function get_sections() {
global $DB;
if ($this->sections === null) {
$this->sections = array_values($DB->get_records('quiz_sections',
array('quizid' => $this->get_quizid()), 'firstslot'));
}
return $this->sections;
} | [
"public",
"function",
"get_sections",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"sections",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"sections",
"=",
"array_values",
"(",
"$",
"DB",
"->",
"get_records",
"(",
"'quiz_secti... | Get all the sections in this quiz.
@return array 0, 1, 2, ... => quiz_sections row from the database. | [
"Get",
"all",
"the",
"sections",
"in",
"this",
"quiz",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L296-L303 |
214,733 | moodle/moodle | mod/quiz/attemptlib.php | quiz.get_access_manager | public function get_access_manager($timenow) {
if (is_null($this->accessmanager)) {
$this->accessmanager = new quiz_access_manager($this, $timenow,
has_capability('mod/quiz:ignoretimelimits', $this->context, null, false));
}
return $this->accessmanager;
} | php | public function get_access_manager($timenow) {
if (is_null($this->accessmanager)) {
$this->accessmanager = new quiz_access_manager($this, $timenow,
has_capability('mod/quiz:ignoretimelimits', $this->context, null, false));
}
return $this->accessmanager;
} | [
"public",
"function",
"get_access_manager",
"(",
"$",
"timenow",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"accessmanager",
")",
")",
"{",
"$",
"this",
"->",
"accessmanager",
"=",
"new",
"quiz_access_manager",
"(",
"$",
"this",
",",
"$",
"t... | Return quiz_access_manager and instance of the quiz_access_manager class
for this quiz at this time.
@param int $timenow the current time as a unix timestamp.
@return quiz_access_manager and instance of the quiz_access_manager class
for this quiz at this time. | [
"Return",
"quiz_access_manager",
"and",
"instance",
"of",
"the",
"quiz_access_manager",
"class",
"for",
"this",
"quiz",
"at",
"this",
"time",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L312-L318 |
214,734 | moodle/moodle | mod/quiz/attemptlib.php | quiz.ensure_question_loaded | protected function ensure_question_loaded($id) {
if (isset($this->questions[$id]->_partiallyloaded)) {
throw new moodle_quiz_exception($this, 'questionnotloaded', $id);
}
} | php | protected function ensure_question_loaded($id) {
if (isset($this->questions[$id]->_partiallyloaded)) {
throw new moodle_quiz_exception($this, 'questionnotloaded', $id);
}
} | [
"protected",
"function",
"ensure_question_loaded",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"questions",
"[",
"$",
"id",
"]",
"->",
"_partiallyloaded",
")",
")",
"{",
"throw",
"new",
"moodle_quiz_exception",
"(",
"$",
"this",
... | Check that the definition of a particular question is loaded, and if not throw an exception.
@param $id a questionid. | [
"Check",
"that",
"the",
"definition",
"of",
"a",
"particular",
"question",
"is",
"loaded",
"and",
"if",
"not",
"throw",
"an",
"exception",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L453-L457 |
214,735 | moodle/moodle | mod/quiz/attemptlib.php | quiz.get_all_question_types_used | public function get_all_question_types_used($includepotential = false) {
$questiontypes = array();
// To control if we need to look in categories for questions.
$qcategories = array();
// We must be careful with random questions, if we find a random question we must assume that the qui... | php | public function get_all_question_types_used($includepotential = false) {
$questiontypes = array();
// To control if we need to look in categories for questions.
$qcategories = array();
// We must be careful with random questions, if we find a random question we must assume that the qui... | [
"public",
"function",
"get_all_question_types_used",
"(",
"$",
"includepotential",
"=",
"false",
")",
"{",
"$",
"questiontypes",
"=",
"array",
"(",
")",
";",
"// To control if we need to look in categories for questions.",
"$",
"qcategories",
"=",
"array",
"(",
")",
"... | Return all the question types used in this quiz.
@param boolean $includepotential if the quiz include random questions, setting this flag to true will make the function to
return all the possible question types in the random questions category
@return array a sorted array including the different question types
@since... | [
"Return",
"all",
"the",
"question",
"types",
"used",
"in",
"this",
"quiz",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L467-L508 |
214,736 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.link_sections_and_slots | protected function link_sections_and_slots() {
foreach ($this->sections as $i => $section) {
if (isset($this->sections[$i + 1])) {
$section->lastslot = $this->sections[$i + 1]->firstslot - 1;
} else {
$section->lastslot = count($this->slots);
}... | php | protected function link_sections_and_slots() {
foreach ($this->sections as $i => $section) {
if (isset($this->sections[$i + 1])) {
$section->lastslot = $this->sections[$i + 1]->firstslot - 1;
} else {
$section->lastslot = count($this->slots);
}... | [
"protected",
"function",
"link_sections_and_slots",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"sections",
"as",
"$",
"i",
"=>",
"$",
"section",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"sections",
"[",
"$",
"i",
"+",
"1",
"]",
... | Let each slot know which section it is part of. | [
"Let",
"each",
"slot",
"know",
"which",
"section",
"it",
"is",
"part",
"of",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L649-L660 |
214,737 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.determine_layout | protected function determine_layout() {
$this->pagelayout = array();
// Break up the layout string into pages.
$pagelayouts = explode(',0', $this->attempt->layout);
// Strip off any empty last page (normally there is one).
if (end($pagelayouts) == '') {
array_pop($p... | php | protected function determine_layout() {
$this->pagelayout = array();
// Break up the layout string into pages.
$pagelayouts = explode(',0', $this->attempt->layout);
// Strip off any empty last page (normally there is one).
if (end($pagelayouts) == '') {
array_pop($p... | [
"protected",
"function",
"determine_layout",
"(",
")",
"{",
"$",
"this",
"->",
"pagelayout",
"=",
"array",
"(",
")",
";",
"// Break up the layout string into pages.",
"$",
"pagelayouts",
"=",
"explode",
"(",
"',0'",
",",
"$",
"this",
"->",
"attempt",
"->",
"la... | Parse attempt->layout to populate the other arrays the represent the layout. | [
"Parse",
"attempt",
"-",
">",
"layout",
"to",
"populate",
"the",
"other",
"arrays",
"the",
"represent",
"the",
"layout",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L665-L699 |
214,738 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.has_response_to_at_least_one_graded_question | public function has_response_to_at_least_one_graded_question() {
foreach ($this->quba->get_attempt_iterator() as $qa) {
if ($qa->get_max_mark() == 0) {
continue;
}
if ($qa->get_num_steps() > 1) {
return true;
}
}
ret... | php | public function has_response_to_at_least_one_graded_question() {
foreach ($this->quba->get_attempt_iterator() as $qa) {
if ($qa->get_max_mark() == 0) {
continue;
}
if ($qa->get_num_steps() > 1) {
return true;
}
}
ret... | [
"public",
"function",
"has_response_to_at_least_one_graded_question",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"quba",
"->",
"get_attempt_iterator",
"(",
")",
"as",
"$",
"qa",
")",
"{",
"if",
"(",
"$",
"qa",
"->",
"get_max_mark",
"(",
")",
"==",
"... | Has the student, in this attempt, engaged with the quiz in a non-trivial way?
That is, is there any question worth a non-zero number of marks, where
the student has made some response that we have saved?
@return bool true if we have saved a response for at least one graded question. | [
"Has",
"the",
"student",
"in",
"this",
"attempt",
"engaged",
"with",
"the",
"quiz",
"in",
"a",
"non",
"-",
"trivial",
"way?",
"That",
"is",
"is",
"there",
"any",
"question",
"worth",
"a",
"non",
"-",
"zero",
"number",
"of",
"marks",
"where",
"the",
"st... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L902-L912 |
214,739 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.check_review_capability | public function check_review_capability() {
if ($this->get_attempt_state() == mod_quiz_display_options::IMMEDIATELY_AFTER) {
$capability = 'mod/quiz:attempt';
} else {
$capability = 'mod/quiz:reviewmyattempts';
}
// These next tests are in a slighly funny order. ... | php | public function check_review_capability() {
if ($this->get_attempt_state() == mod_quiz_display_options::IMMEDIATELY_AFTER) {
$capability = 'mod/quiz:attempt';
} else {
$capability = 'mod/quiz:reviewmyattempts';
}
// These next tests are in a slighly funny order. ... | [
"public",
"function",
"check_review_capability",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"get_attempt_state",
"(",
")",
"==",
"mod_quiz_display_options",
"::",
"IMMEDIATELY_AFTER",
")",
"{",
"$",
"capability",
"=",
"'mod/quiz:attempt'",
";",
"}",
"else",
"{... | Check the appropriate capability to see whether this user may review their own attempt.
If not, prints an error. | [
"Check",
"the",
"appropriate",
"capability",
"to",
"see",
"whether",
"this",
"user",
"may",
"review",
"their",
"own",
"attempt",
".",
"If",
"not",
"prints",
"an",
"error",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L962-L988 |
214,740 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.all_question_attempts_originally_in_slot | public function all_question_attempts_originally_in_slot($slot) {
$qas = array();
foreach ($this->quba->get_attempt_iterator() as $qa) {
if ($qa->get_metadata('originalslot') == $slot) {
$qas[] = $qa;
}
}
$qas[] = $this->quba->get_question_attempt(... | php | public function all_question_attempts_originally_in_slot($slot) {
$qas = array();
foreach ($this->quba->get_attempt_iterator() as $qa) {
if ($qa->get_metadata('originalslot') == $slot) {
$qas[] = $qa;
}
}
$qas[] = $this->quba->get_question_attempt(... | [
"public",
"function",
"all_question_attempts_originally_in_slot",
"(",
"$",
"slot",
")",
"{",
"$",
"qas",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"quba",
"->",
"get_attempt_iterator",
"(",
")",
"as",
"$",
"qa",
")",
"{",
"if",
"("... | Get the question_attempt object for a particular question in this attempt.
@param int $slot the number used to identify this question within this attempt.
@return question_attempt | [
"Get",
"the",
"question_attempt",
"object",
"for",
"a",
"particular",
"question",
"in",
"this",
"attempt",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1144-L1153 |
214,741 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.is_blocked_by_previous_question | public function is_blocked_by_previous_question($slot) {
return $slot > 1 && isset($this->slots[$slot]) && $this->slots[$slot]->requireprevious &&
!$this->slots[$slot]->section->shufflequestions &&
!$this->slots[$slot - 1]->section->shufflequestions &&
$this->get_... | php | public function is_blocked_by_previous_question($slot) {
return $slot > 1 && isset($this->slots[$slot]) && $this->slots[$slot]->requireprevious &&
!$this->slots[$slot]->section->shufflequestions &&
!$this->slots[$slot - 1]->section->shufflequestions &&
$this->get_... | [
"public",
"function",
"is_blocked_by_previous_question",
"(",
"$",
"slot",
")",
"{",
"return",
"$",
"slot",
">",
"1",
"&&",
"isset",
"(",
"$",
"this",
"->",
"slots",
"[",
"$",
"slot",
"]",
")",
"&&",
"$",
"this",
"->",
"slots",
"[",
"$",
"slot",
"]",... | Checks whether the question in this slot requires the previous question to have been completed.
@param int $slot the number used to identify this question within this attempt.
@return bool whether the previous question must have been completed before this one can be seen. | [
"Checks",
"whether",
"the",
"question",
"in",
"this",
"slot",
"requires",
"the",
"previous",
"question",
"to",
"have",
"been",
"completed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1180-L1187 |
214,742 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.can_question_be_redone_now | public function can_question_be_redone_now($slot) {
return $this->get_quiz()->canredoquestions && !$this->is_finished() &&
$this->get_question_state($slot)->is_finished();
} | php | public function can_question_be_redone_now($slot) {
return $this->get_quiz()->canredoquestions && !$this->is_finished() &&
$this->get_question_state($slot)->is_finished();
} | [
"public",
"function",
"can_question_be_redone_now",
"(",
"$",
"slot",
")",
"{",
"return",
"$",
"this",
"->",
"get_quiz",
"(",
")",
"->",
"canredoquestions",
"&&",
"!",
"$",
"this",
"->",
"is_finished",
"(",
")",
"&&",
"$",
"this",
"->",
"get_question_state",... | Is it possible for this question to be re-started within this attempt?
@param int $slot the number used to identify this question within this attempt.
@return whether the student should be given the option to restart this question now. | [
"Is",
"it",
"possible",
"for",
"this",
"question",
"to",
"be",
"re",
"-",
"started",
"within",
"this",
"attempt?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1195-L1198 |
214,743 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.get_original_slot | public function get_original_slot($slot) {
$originalslot = $this->quba->get_question_attempt_metadata($slot, 'originalslot');
if ($originalslot) {
return $originalslot;
} else {
return $slot;
}
} | php | public function get_original_slot($slot) {
$originalslot = $this->quba->get_question_attempt_metadata($slot, 'originalslot');
if ($originalslot) {
return $originalslot;
} else {
return $slot;
}
} | [
"public",
"function",
"get_original_slot",
"(",
"$",
"slot",
")",
"{",
"$",
"originalslot",
"=",
"$",
"this",
"->",
"quba",
"->",
"get_question_attempt_metadata",
"(",
"$",
"slot",
",",
"'originalslot'",
")",
";",
"if",
"(",
"$",
"originalslot",
")",
"{",
... | Given a slot in this attempt, which may or not be a redone question, return the original slot.
@param int $slot identifies a particular question in this attempt.
@return int the slot where this question was originally. | [
"Given",
"a",
"slot",
"in",
"this",
"attempt",
"which",
"may",
"or",
"not",
"be",
"a",
"redone",
"question",
"return",
"the",
"original",
"slot",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1206-L1213 |
214,744 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.get_heading_before_slot | public function get_heading_before_slot($slot) {
if ($this->slots[$slot]->firstinsection) {
return $this->slots[$slot]->section->heading;
} else {
return null;
}
} | php | public function get_heading_before_slot($slot) {
if ($this->slots[$slot]->firstinsection) {
return $this->slots[$slot]->section->heading;
} else {
return null;
}
} | [
"public",
"function",
"get_heading_before_slot",
"(",
"$",
"slot",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"slots",
"[",
"$",
"slot",
"]",
"->",
"firstinsection",
")",
"{",
"return",
"$",
"this",
"->",
"slots",
"[",
"$",
"slot",
"]",
"->",
"section",
... | If the section heading, if any, that should come just before this slot.
@param int $slot identifies a particular question in this attempt.
@return string the required heading, or null if there is not one here. | [
"If",
"the",
"section",
"heading",
"if",
"any",
"that",
"should",
"come",
"just",
"before",
"this",
"slot",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1230-L1236 |
214,745 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.get_time_left_display | public function get_time_left_display($timenow) {
if ($this->attempt->state != self::IN_PROGRESS) {
return false;
}
return $this->get_access_manager($timenow)->get_time_left_display($this->attempt, $timenow);
} | php | public function get_time_left_display($timenow) {
if ($this->attempt->state != self::IN_PROGRESS) {
return false;
}
return $this->get_access_manager($timenow)->get_time_left_display($this->attempt, $timenow);
} | [
"public",
"function",
"get_time_left_display",
"(",
"$",
"timenow",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"attempt",
"->",
"state",
"!=",
"self",
"::",
"IN_PROGRESS",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"get_access_manager... | Get the time remaining for an in-progress attempt, if the time is short
enought that it would be worth showing a timer.
@param int $timenow the time to consider as 'now'.
@return int|false the number of seconds remaining for this attempt.
False if there is no limit. | [
"Get",
"the",
"time",
"remaining",
"for",
"an",
"in",
"-",
"progress",
"attempt",
"if",
"the",
"time",
"is",
"short",
"enought",
"that",
"it",
"would",
"be",
"worth",
"showing",
"a",
"timer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1338-L1343 |
214,746 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.get_due_date | public function get_due_date() {
$deadlines = array();
if ($this->quizobj->get_quiz()->timelimit) {
$deadlines[] = $this->attempt->timestart + $this->quizobj->get_quiz()->timelimit;
}
if ($this->quizobj->get_quiz()->timeclose) {
$deadlines[] = $this->quizobj->get_... | php | public function get_due_date() {
$deadlines = array();
if ($this->quizobj->get_quiz()->timelimit) {
$deadlines[] = $this->attempt->timestart + $this->quizobj->get_quiz()->timelimit;
}
if ($this->quizobj->get_quiz()->timeclose) {
$deadlines[] = $this->quizobj->get_... | [
"public",
"function",
"get_due_date",
"(",
")",
"{",
"$",
"deadlines",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"quizobj",
"->",
"get_quiz",
"(",
")",
"->",
"timelimit",
")",
"{",
"$",
"deadlines",
"[",
"]",
"=",
"$",
"this",
"->"... | If the attempt is in an applicable state, work out the time by which the
student should next do something.
@return int timestamp by which the student needs to do something. | [
"If",
"the",
"attempt",
"is",
"in",
"an",
"applicable",
"state",
"work",
"out",
"the",
"time",
"by",
"which",
"the",
"student",
"should",
"next",
"do",
"something",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1359-L1383 |
214,747 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.get_html_head_contributions | public function get_html_head_contributions($page = 'all', $showall = false) {
if ($showall) {
$page = 'all';
}
$result = '';
foreach ($this->get_slots($page) as $slot) {
$result .= $this->quba->render_question_head_html($slot);
}
$result .= questi... | php | public function get_html_head_contributions($page = 'all', $showall = false) {
if ($showall) {
$page = 'all';
}
$result = '';
foreach ($this->get_slots($page) as $slot) {
$result .= $this->quba->render_question_head_html($slot);
}
$result .= questi... | [
"public",
"function",
"get_html_head_contributions",
"(",
"$",
"page",
"=",
"'all'",
",",
"$",
"showall",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"showall",
")",
"{",
"$",
"page",
"=",
"'all'",
";",
"}",
"$",
"result",
"=",
"''",
";",
"foreach",
"(",... | Initialise the JS etc. required all the questions on a page.
@param mixed $page a page number, or 'all'. | [
"Initialise",
"the",
"JS",
"etc",
".",
"required",
"all",
"the",
"questions",
"on",
"a",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1474-L1484 |
214,748 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.restart_preview_button | public function restart_preview_button() {
global $OUTPUT;
if ($this->is_preview() && $this->is_preview_user()) {
return $OUTPUT->single_button(new moodle_url(
$this->start_attempt_url(), array('forcenew' => true)),
get_string('startnewpreview', 'quiz'... | php | public function restart_preview_button() {
global $OUTPUT;
if ($this->is_preview() && $this->is_preview_user()) {
return $OUTPUT->single_button(new moodle_url(
$this->start_attempt_url(), array('forcenew' => true)),
get_string('startnewpreview', 'quiz'... | [
"public",
"function",
"restart_preview_button",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"$",
"this",
"->",
"is_preview",
"(",
")",
"&&",
"$",
"this",
"->",
"is_preview_user",
"(",
")",
")",
"{",
"return",
"$",
"OUTPUT",
"->",
"single_butt... | Print the HTML for the start new preview button, if the current user
is allowed to see one. | [
"Print",
"the",
"HTML",
"for",
"the",
"start",
"new",
"preview",
"button",
"if",
"the",
"current",
"user",
"is",
"allowed",
"to",
"see",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1499-L1508 |
214,749 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.render_question | public function render_question($slot, $reviewing, mod_quiz_renderer $renderer, $thispageurl = null) {
if ($this->is_blocked_by_previous_question($slot)) {
$placeholderqa = $this->make_blocked_question_placeholder($slot);
$displayoptions = $this->get_display_options($reviewing);
... | php | public function render_question($slot, $reviewing, mod_quiz_renderer $renderer, $thispageurl = null) {
if ($this->is_blocked_by_previous_question($slot)) {
$placeholderqa = $this->make_blocked_question_placeholder($slot);
$displayoptions = $this->get_display_options($reviewing);
... | [
"public",
"function",
"render_question",
"(",
"$",
"slot",
",",
"$",
"reviewing",
",",
"mod_quiz_renderer",
"$",
"renderer",
",",
"$",
"thispageurl",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_blocked_by_previous_question",
"(",
"$",
"slot",
")... | Generate the HTML that displayes the question in its current state, with
the appropriate display options.
@param int $slot identifies the question in the attempt.
@param bool $reviewing is the being printed on an attempt or a review page.
@param mod_quiz_renderer $renderer the quiz renderer.
@param moodle_url $thispag... | [
"Generate",
"the",
"HTML",
"that",
"displayes",
"the",
"question",
"in",
"its",
"current",
"state",
"with",
"the",
"appropriate",
"display",
"options",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1520-L1535 |
214,750 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.make_blocked_question_placeholder | protected function make_blocked_question_placeholder($slot) {
$replacedquestion = $this->get_question_attempt($slot)->get_question();
question_bank::load_question_definition_classes('description');
$question = new qtype_description_question();
$question->id = $replacedquestion->id;
... | php | protected function make_blocked_question_placeholder($slot) {
$replacedquestion = $this->get_question_attempt($slot)->get_question();
question_bank::load_question_definition_classes('description');
$question = new qtype_description_question();
$question->id = $replacedquestion->id;
... | [
"protected",
"function",
"make_blocked_question_placeholder",
"(",
"$",
"slot",
")",
"{",
"$",
"replacedquestion",
"=",
"$",
"this",
"->",
"get_question_attempt",
"(",
"$",
"slot",
")",
"->",
"get_question",
"(",
")",
";",
"question_bank",
"::",
"load_question_def... | Create a fake question to be displayed in place of a question that is blocked
until the previous question has been answered.
@param int $slot int slot number of the question to replace.
@return question_definition the placeholde question. | [
"Create",
"a",
"fake",
"question",
"to",
"be",
"displayed",
"in",
"place",
"of",
"a",
"question",
"that",
"is",
"blocked",
"until",
"the",
"previous",
"question",
"has",
"been",
"answered",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1590-L1620 |
214,751 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.check_file_access | public function check_file_access($slot, $reviewing, $contextid, $component,
$filearea, $args, $forcedownload) {
$options = $this->get_display_options($reviewing);
// Check permissions - warning there is similar code in review.php and
// reviewquestion.php. If you change on, change ... | php | public function check_file_access($slot, $reviewing, $contextid, $component,
$filearea, $args, $forcedownload) {
$options = $this->get_display_options($reviewing);
// Check permissions - warning there is similar code in review.php and
// reviewquestion.php. If you change on, change ... | [
"public",
"function",
"check_file_access",
"(",
"$",
"slot",
",",
"$",
"reviewing",
",",
"$",
"contextid",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"args",
",",
"$",
"forcedownload",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"get_... | Check wheter access should be allowed to a particular file.
@param int $id the id of a question in this quiz attempt.
@param bool $reviewing is the being printed on an attempt or a review page.
@param string $thispageurl the URL of the page this question is being printed on.
@return string HTML for the question in its... | [
"Check",
"wheter",
"access",
"should",
"be",
"allowed",
"to",
"a",
"particular",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1658-L1674 |
214,752 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.get_navigation_panel | public function get_navigation_panel(mod_quiz_renderer $output,
$panelclass, $page, $showall = false) {
$panel = new $panelclass($this, $this->get_display_options(true), $page, $showall);
$bc = new block_contents();
$bc->attributes['id'] = 'mod_quiz_navblock';
$bc->attribut... | php | public function get_navigation_panel(mod_quiz_renderer $output,
$panelclass, $page, $showall = false) {
$panel = new $panelclass($this, $this->get_display_options(true), $page, $showall);
$bc = new block_contents();
$bc->attributes['id'] = 'mod_quiz_navblock';
$bc->attribut... | [
"public",
"function",
"get_navigation_panel",
"(",
"mod_quiz_renderer",
"$",
"output",
",",
"$",
"panelclass",
",",
"$",
"page",
",",
"$",
"showall",
"=",
"false",
")",
"{",
"$",
"panel",
"=",
"new",
"$",
"panelclass",
"(",
"$",
"this",
",",
"$",
"this",... | Get the navigation panel object for this attempt.
@param $panelclass The type of panel, quiz_attempt_nav_panel or quiz_review_nav_panel
@param $page the current page number.
@param $showall whether we are showing the whole quiz on one page. (Used by review.php)
@return quiz_nav_panel_base the requested object. | [
"Get",
"the",
"navigation",
"panel",
"object",
"for",
"this",
"attempt",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1684-L1695 |
214,753 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.links_to_other_attempts | public function links_to_other_attempts(moodle_url $url) {
$attempts = quiz_get_user_attempts($this->get_quiz()->id, $this->attempt->userid, 'all');
if (count($attempts) <= 1) {
return false;
}
$links = new mod_quiz_links_to_other_attempts();
foreach ($attempts as $a... | php | public function links_to_other_attempts(moodle_url $url) {
$attempts = quiz_get_user_attempts($this->get_quiz()->id, $this->attempt->userid, 'all');
if (count($attempts) <= 1) {
return false;
}
$links = new mod_quiz_links_to_other_attempts();
foreach ($attempts as $a... | [
"public",
"function",
"links_to_other_attempts",
"(",
"moodle_url",
"$",
"url",
")",
"{",
"$",
"attempts",
"=",
"quiz_get_user_attempts",
"(",
"$",
"this",
"->",
"get_quiz",
"(",
")",
"->",
"id",
",",
"$",
"this",
"->",
"attempt",
"->",
"userid",
",",
"'al... | Return an array of variant URLs to other attempts at this quiz.
The $url passed in must contain an attempt parameter.
The {@link mod_quiz_links_to_other_attempts} object returned contains an
array with keys that are the attempt number, 1, 2, 3.
The array values are either a {@link moodle_url} with the attmept paramet... | [
"Return",
"an",
"array",
"of",
"variant",
"URLs",
"to",
"other",
"attempts",
"at",
"this",
"quiz",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1711-L1726 |
214,754 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.links_to_other_redos | public function links_to_other_redos($slot, moodle_url $baseurl) {
$originalslot = $this->get_original_slot($slot);
$qas = $this->all_question_attempts_originally_in_slot($originalslot);
if (count($qas) <= 1) {
return null;
}
$links = new mod_quiz_links_to_other_att... | php | public function links_to_other_redos($slot, moodle_url $baseurl) {
$originalslot = $this->get_original_slot($slot);
$qas = $this->all_question_attempts_originally_in_slot($originalslot);
if (count($qas) <= 1) {
return null;
}
$links = new mod_quiz_links_to_other_att... | [
"public",
"function",
"links_to_other_redos",
"(",
"$",
"slot",
",",
"moodle_url",
"$",
"baseurl",
")",
"{",
"$",
"originalslot",
"=",
"$",
"this",
"->",
"get_original_slot",
"(",
"$",
"slot",
")",
";",
"$",
"qas",
"=",
"$",
"this",
"->",
"all_question_att... | Return an array of variant URLs to other redos of the question in a particular slot.
The $url passed in must contain a slot parameter.
The {@link mod_quiz_links_to_other_attempts} object returned contains an
array with keys that are the redo number, 1, 2, 3.
The array values are either a {@link moodle_url} with the s... | [
"Return",
"an",
"array",
"of",
"variant",
"URLs",
"to",
"other",
"redos",
"of",
"the",
"question",
"in",
"a",
"particular",
"slot",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1744-L1767 |
214,755 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.handle_if_time_expired | public function handle_if_time_expired($timestamp, $studentisonline) {
global $DB;
$timeclose = $this->get_access_manager($timestamp)->get_end_time($this->attempt);
if ($timeclose === false || $this->is_preview()) {
$this->update_timecheckstate(null);
return; // No time... | php | public function handle_if_time_expired($timestamp, $studentisonline) {
global $DB;
$timeclose = $this->get_access_manager($timestamp)->get_end_time($this->attempt);
if ($timeclose === false || $this->is_preview()) {
$this->update_timecheckstate(null);
return; // No time... | [
"public",
"function",
"handle_if_time_expired",
"(",
"$",
"timestamp",
",",
"$",
"studentisonline",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"timeclose",
"=",
"$",
"this",
"->",
"get_access_manager",
"(",
"$",
"timestamp",
")",
"->",
"get_end_time",
"(",
"$"... | Check this attempt, to see if there are any state transitions that should
happen automatically. This function will update the attempt checkstatetime.
@param int $timestamp the timestamp that should be stored as the modifed
@param bool $studentisonline is the student currently interacting with Moodle? | [
"Check",
"this",
"attempt",
"to",
"see",
"if",
"there",
"are",
"any",
"state",
"transitions",
"that",
"should",
"happen",
"automatically",
".",
"This",
"function",
"will",
"update",
"the",
"attempt",
"checkstatetime",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1777-L1828 |
214,756 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.process_submitted_actions | public function process_submitted_actions($timestamp, $becomingoverdue = false, $simulatedresponses = null) {
global $DB;
$transaction = $DB->start_delegated_transaction();
if ($simulatedresponses !== null) {
if (is_int(key($simulatedresponses))) {
// Legacy approac... | php | public function process_submitted_actions($timestamp, $becomingoverdue = false, $simulatedresponses = null) {
global $DB;
$transaction = $DB->start_delegated_transaction();
if ($simulatedresponses !== null) {
if (is_int(key($simulatedresponses))) {
// Legacy approac... | [
"public",
"function",
"process_submitted_actions",
"(",
"$",
"timestamp",
",",
"$",
"becomingoverdue",
"=",
"false",
",",
"$",
"simulatedresponses",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"transaction",
"=",
"$",
"DB",
"->",
"start_delegated_tra... | Process all the actions that were submitted as part of the current request.
@param int $timestamp the timestamp that should be stored as the modifed
time in the database for these actions. If null, will use the current time.
@param bool $becomingoverdue
@param array|null $simulatedresponses If not null, then we are ... | [
"Process",
"all",
"the",
"actions",
"that",
"were",
"submitted",
"as",
"part",
"of",
"the",
"current",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1843-L1877 |
214,757 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.process_redo_question | public function process_redo_question($slot, $timestamp) {
global $DB;
if (!$this->can_question_be_redone_now($slot)) {
throw new coding_exception('Attempt to restart the question in slot ' . $slot .
' when it is not in a state to be restarted.');
}
$qub... | php | public function process_redo_question($slot, $timestamp) {
global $DB;
if (!$this->can_question_be_redone_now($slot)) {
throw new coding_exception('Attempt to restart the question in slot ' . $slot .
' when it is not in a state to be restarted.');
}
$qub... | [
"public",
"function",
"process_redo_question",
"(",
"$",
"slot",
",",
"$",
"timestamp",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"can_question_be_redone_now",
"(",
"$",
"slot",
")",
")",
"{",
"throw",
"new",
"coding_exception"... | Replace a question in an attempt with a new attempt at the same qestion.
@param int $slot the questoin to restart.
@param int $timestamp the timestamp to record for this action. | [
"Replace",
"a",
"question",
"in",
"an",
"attempt",
"with",
"a",
"new",
"attempt",
"at",
"the",
"same",
"qestion",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1884-L1935 |
214,758 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.process_auto_save | public function process_auto_save($timestamp) {
global $DB;
$transaction = $DB->start_delegated_transaction();
$this->quba->process_all_autosaves($timestamp);
question_engine::save_questions_usage_by_activity($this->quba);
$transaction->allow_commit();
} | php | public function process_auto_save($timestamp) {
global $DB;
$transaction = $DB->start_delegated_transaction();
$this->quba->process_all_autosaves($timestamp);
question_engine::save_questions_usage_by_activity($this->quba);
$transaction->allow_commit();
} | [
"public",
"function",
"process_auto_save",
"(",
"$",
"timestamp",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"transaction",
"=",
"$",
"DB",
"->",
"start_delegated_transaction",
"(",
")",
";",
"$",
"this",
"->",
"quba",
"->",
"process_all_autosaves",
"(",
"$",
... | Process all the autosaved data that was part of the current request.
@param int $timestamp the timestamp that should be stored as the modifed
time in the database for these actions. If null, will use the current time. | [
"Process",
"all",
"the",
"autosaved",
"data",
"that",
"was",
"part",
"of",
"the",
"current",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L1943-L1952 |
214,759 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.update_timecheckstate | public function update_timecheckstate($time) {
global $DB;
if ($this->attempt->timecheckstate !== $time) {
$this->attempt->timecheckstate = $time;
$DB->set_field('quiz_attempts', 'timecheckstate', $time, array('id' => $this->attempt->id));
}
} | php | public function update_timecheckstate($time) {
global $DB;
if ($this->attempt->timecheckstate !== $time) {
$this->attempt->timecheckstate = $time;
$DB->set_field('quiz_attempts', 'timecheckstate', $time, array('id' => $this->attempt->id));
}
} | [
"public",
"function",
"update_timecheckstate",
"(",
"$",
"time",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"attempt",
"->",
"timecheckstate",
"!==",
"$",
"time",
")",
"{",
"$",
"this",
"->",
"attempt",
"->",
"timecheckstate",
"=",... | Update this attempt timecheckstate if necessary.
@param int|null the timecheckstate | [
"Update",
"this",
"attempt",
"timecheckstate",
"if",
"necessary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L2003-L2009 |
214,760 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.process_going_overdue | public function process_going_overdue($timestamp, $studentisonline) {
global $DB;
$transaction = $DB->start_delegated_transaction();
$this->attempt->timemodified = $timestamp;
$this->attempt->state = self::OVERDUE;
// If we knew the attempt close time, we could compute when the ... | php | public function process_going_overdue($timestamp, $studentisonline) {
global $DB;
$transaction = $DB->start_delegated_transaction();
$this->attempt->timemodified = $timestamp;
$this->attempt->state = self::OVERDUE;
// If we knew the attempt close time, we could compute when the ... | [
"public",
"function",
"process_going_overdue",
"(",
"$",
"timestamp",
",",
"$",
"studentisonline",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"transaction",
"=",
"$",
"DB",
"->",
"start_delegated_transaction",
"(",
")",
";",
"$",
"this",
"->",
"attempt",
"->",... | Mark this attempt as now overdue.
@param int $timestamp the time to deem as now.
@param bool $studentisonline is the student currently interacting with Moodle? | [
"Mark",
"this",
"attempt",
"as",
"now",
"overdue",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L2016-L2032 |
214,761 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.process_abandon | public function process_abandon($timestamp, $studentisonline) {
global $DB;
$transaction = $DB->start_delegated_transaction();
$this->attempt->timemodified = $timestamp;
$this->attempt->state = self::ABANDONED;
$this->attempt->timecheckstate = null;
$DB->update_record('q... | php | public function process_abandon($timestamp, $studentisonline) {
global $DB;
$transaction = $DB->start_delegated_transaction();
$this->attempt->timemodified = $timestamp;
$this->attempt->state = self::ABANDONED;
$this->attempt->timecheckstate = null;
$DB->update_record('q... | [
"public",
"function",
"process_abandon",
"(",
"$",
"timestamp",
",",
"$",
"studentisonline",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"transaction",
"=",
"$",
"DB",
"->",
"start_delegated_transaction",
"(",
")",
";",
"$",
"this",
"->",
"attempt",
"->",
"ti... | Mark this attempt as abandoned.
@param int $timestamp the time to deem as now.
@param bool $studentisonline is the student currently interacting with Moodle? | [
"Mark",
"this",
"attempt",
"as",
"abandoned",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L2039-L2051 |
214,762 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.fire_state_transition_event | protected function fire_state_transition_event($eventclass, $timestamp) {
global $USER;
$quizrecord = $this->get_quiz();
$params = array(
'context' => $this->get_quizobj()->get_context(),
'courseid' => $this->get_courseid(),
'objectid' => $this->attempt->id,
... | php | protected function fire_state_transition_event($eventclass, $timestamp) {
global $USER;
$quizrecord = $this->get_quiz();
$params = array(
'context' => $this->get_quizobj()->get_context(),
'courseid' => $this->get_courseid(),
'objectid' => $this->attempt->id,
... | [
"protected",
"function",
"fire_state_transition_event",
"(",
"$",
"eventclass",
",",
"$",
"timestamp",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"quizrecord",
"=",
"$",
"this",
"->",
"get_quiz",
"(",
")",
";",
"$",
"params",
"=",
"array",
"(",
"'context'"... | Fire a state transition event.
the same event information.
@param string $eventclass the event class name.
@param int $timestamp the timestamp to include in the event.
@return void | [
"Fire",
"a",
"state",
"transition",
"event",
".",
"the",
"same",
"event",
"information",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L2060-L2078 |
214,763 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.check_page_access | public function check_page_access($page) {
global $DB;
if ($this->get_currentpage() != $page) {
if ($this->get_navigation_method() == QUIZ_NAVMETHOD_SEQ && $this->get_currentpage() > $page) {
return false;
}
}
return true;
} | php | public function check_page_access($page) {
global $DB;
if ($this->get_currentpage() != $page) {
if ($this->get_navigation_method() == QUIZ_NAVMETHOD_SEQ && $this->get_currentpage() > $page) {
return false;
}
}
return true;
} | [
"public",
"function",
"check_page_access",
"(",
"$",
"page",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"get_currentpage",
"(",
")",
"!=",
"$",
"page",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"get_navigation_method",
"(",
")",
... | Check a page access to see if is an out of sequence access.
@param int $page page number
@return boolean false is is an out of sequence access, true otherwise.
@since Moodle 3.1 | [
"Check",
"a",
"page",
"access",
"to",
"see",
"if",
"is",
"an",
"out",
"of",
"sequence",
"access",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L2276-L2285 |
214,764 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.set_currentpage | public function set_currentpage($page) {
global $DB;
if ($this->check_page_access($page)) {
$DB->set_field('quiz_attempts', 'currentpage', $page, array('id' => $this->get_attemptid()));
return true;
}
return false;
} | php | public function set_currentpage($page) {
global $DB;
if ($this->check_page_access($page)) {
$DB->set_field('quiz_attempts', 'currentpage', $page, array('id' => $this->get_attemptid()));
return true;
}
return false;
} | [
"public",
"function",
"set_currentpage",
"(",
"$",
"page",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"check_page_access",
"(",
"$",
"page",
")",
")",
"{",
"$",
"DB",
"->",
"set_field",
"(",
"'quiz_attempts'",
",",
"'currentpage'",... | Update attempt page.
@param int $page page number
@return boolean true if everything was ok, false otherwise (out of sequence access).
@since Moodle 3.1 | [
"Update",
"attempt",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L2294-L2302 |
214,765 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.fire_attempt_viewed_event | public function fire_attempt_viewed_event() {
$params = array(
'objectid' => $this->get_attemptid(),
'relateduserid' => $this->get_userid(),
'courseid' => $this->get_courseid(),
'context' => context_module::instance($this->get_cmid()),
'other' => array... | php | public function fire_attempt_viewed_event() {
$params = array(
'objectid' => $this->get_attemptid(),
'relateduserid' => $this->get_userid(),
'courseid' => $this->get_courseid(),
'context' => context_module::instance($this->get_cmid()),
'other' => array... | [
"public",
"function",
"fire_attempt_viewed_event",
"(",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'objectid'",
"=>",
"$",
"this",
"->",
"get_attemptid",
"(",
")",
",",
"'relateduserid'",
"=>",
"$",
"this",
"->",
"get_userid",
"(",
")",
",",
"'courseid'",
... | Trigger the attempt_viewed event.
@since Moodle 3.1 | [
"Trigger",
"the",
"attempt_viewed",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L2309-L2322 |
214,766 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.fire_attempt_summary_viewed_event | public function fire_attempt_summary_viewed_event() {
$params = array(
'objectid' => $this->get_attemptid(),
'relateduserid' => $this->get_userid(),
'courseid' => $this->get_courseid(),
'context' => context_module::instance($this->get_cmid()),
'other'... | php | public function fire_attempt_summary_viewed_event() {
$params = array(
'objectid' => $this->get_attemptid(),
'relateduserid' => $this->get_userid(),
'courseid' => $this->get_courseid(),
'context' => context_module::instance($this->get_cmid()),
'other'... | [
"public",
"function",
"fire_attempt_summary_viewed_event",
"(",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'objectid'",
"=>",
"$",
"this",
"->",
"get_attemptid",
"(",
")",
",",
"'relateduserid'",
"=>",
"$",
"this",
"->",
"get_userid",
"(",
")",
",",
"'cour... | Trigger the attempt_summary_viewed event.
@since Moodle 3.1 | [
"Trigger",
"the",
"attempt_summary_viewed",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L2329-L2343 |
214,767 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.fire_attempt_reviewed_event | public function fire_attempt_reviewed_event() {
$params = array(
'objectid' => $this->get_attemptid(),
'relateduserid' => $this->get_userid(),
'courseid' => $this->get_courseid(),
'context' => context_module::instance($this->get_cmid()),
'other' => ar... | php | public function fire_attempt_reviewed_event() {
$params = array(
'objectid' => $this->get_attemptid(),
'relateduserid' => $this->get_userid(),
'courseid' => $this->get_courseid(),
'context' => context_module::instance($this->get_cmid()),
'other' => ar... | [
"public",
"function",
"fire_attempt_reviewed_event",
"(",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'objectid'",
"=>",
"$",
"this",
"->",
"get_attemptid",
"(",
")",
",",
"'relateduserid'",
"=>",
"$",
"this",
"->",
"get_userid",
"(",
")",
",",
"'courseid'"... | Trigger the attempt_reviewed event.
@since Moodle 3.1 | [
"Trigger",
"the",
"attempt_reviewed",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L2350-L2364 |
214,768 | moodle/moodle | mod/quiz/attemptlib.php | quiz_attempt.set_offline_modified_time | public function set_offline_modified_time($time) {
global $DB;
// Update the timemodifiedoffline field only if web services are being used.
if (WS_SERVER) {
$this->attempt->timemodifiedoffline = $time;
return true;
}
return false;
} | php | public function set_offline_modified_time($time) {
global $DB;
// Update the timemodifiedoffline field only if web services are being used.
if (WS_SERVER) {
$this->attempt->timemodifiedoffline = $time;
return true;
}
return false;
} | [
"public",
"function",
"set_offline_modified_time",
"(",
"$",
"time",
")",
"{",
"global",
"$",
"DB",
";",
"// Update the timemodifiedoffline field only if web services are being used.",
"if",
"(",
"WS_SERVER",
")",
"{",
"$",
"this",
"->",
"attempt",
"->",
"timemodifiedof... | Update the timemodifiedoffline attempt field.
This function should be used only when web services are being used.
@param int $time time stamp
@return boolean false if the field is not updated because web services aren't being used.
@since Moodle 3.2 | [
"Update",
"the",
"timemodifiedoffline",
"attempt",
"field",
".",
"This",
"function",
"should",
"be",
"used",
"only",
"when",
"web",
"services",
"are",
"being",
"used",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L2374-L2383 |
214,769 | moodle/moodle | mod/quiz/attemptlib.php | quiz_nav_panel_base.get_question_buttons | public function get_question_buttons() {
$buttons = array();
foreach ($this->attemptobj->get_slots() as $slot) {
if ($heading = $this->attemptobj->get_heading_before_slot($slot)) {
$buttons[] = new quiz_nav_section_heading(format_string($heading));
}
... | php | public function get_question_buttons() {
$buttons = array();
foreach ($this->attemptobj->get_slots() as $slot) {
if ($heading = $this->attemptobj->get_heading_before_slot($slot)) {
$buttons[] = new quiz_nav_section_heading(format_string($heading));
}
... | [
"public",
"function",
"get_question_buttons",
"(",
")",
"{",
"$",
"buttons",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"attemptobj",
"->",
"get_slots",
"(",
")",
"as",
"$",
"slot",
")",
"{",
"if",
"(",
"$",
"heading",
"=",
"$",
... | Get the buttons and section headings to go in the quiz navigation block.
@return renderable[] the buttons, possibly interleaved with section headings. | [
"Get",
"the",
"buttons",
"and",
"section",
"headings",
"to",
"go",
"in",
"the",
"quiz",
"navigation",
"block",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/attemptlib.php#L2466-L2498 |
214,770 | moodle/moodle | admin/tool/analytics/classes/output/model_logs.php | model_logs.col_indicators | public function col_indicators($log) {
$indicatorclasses = json_decode($log->indicators);
$indicators = array();
foreach ($indicatorclasses as $indicatorclass) {
$indicator = \core_analytics\manager::get_indicator($indicatorclass);
if ($indicator) {
$indic... | php | public function col_indicators($log) {
$indicatorclasses = json_decode($log->indicators);
$indicators = array();
foreach ($indicatorclasses as $indicatorclass) {
$indicator = \core_analytics\manager::get_indicator($indicatorclass);
if ($indicator) {
$indic... | [
"public",
"function",
"col_indicators",
"(",
"$",
"log",
")",
"{",
"$",
"indicatorclasses",
"=",
"json_decode",
"(",
"$",
"log",
"->",
"indicators",
")",
";",
"$",
"indicators",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"indicatorclasses",
"as",
... | Generate the indicators column.
@param \stdClass $log log data.
@return string HTML for the indicators column | [
"Generate",
"the",
"indicators",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/analytics/classes/output/model_logs.php#L131-L143 |
214,771 | moodle/moodle | admin/tool/analytics/classes/output/model_logs.php | model_logs.col_info | public function col_info($log) {
global $PAGE;
if (empty($log->info) && empty($log->dir)) {
return '';
}
$info = array();
if (!empty($log->info)) {
$info = json_decode($log->info);
}
if (!empty($log->dir)) {
$info[] = get_stri... | php | public function col_info($log) {
global $PAGE;
if (empty($log->info) && empty($log->dir)) {
return '';
}
$info = array();
if (!empty($log->info)) {
$info = json_decode($log->info);
}
if (!empty($log->dir)) {
$info[] = get_stri... | [
"public",
"function",
"col_info",
"(",
"$",
"log",
")",
"{",
"global",
"$",
"PAGE",
";",
"if",
"(",
"empty",
"(",
"$",
"log",
"->",
"info",
")",
"&&",
"empty",
"(",
"$",
"log",
"->",
"dir",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"info",
... | Generate the info column.
@param \stdClass $log log data.
@return string HTML for the score column | [
"Generate",
"the",
"info",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/analytics/classes/output/model_logs.php#L172-L188 |
214,772 | moodle/moodle | admin/tool/analytics/classes/output/model_logs.php | model_logs.query_db | public function query_db($pagesize, $useinitialsbar = true) {
$total = count($this->model->get_logs());
$this->pagesize($pagesize, $total);
$this->rawdata = $this->model->get_logs($this->get_page_start(), $this->get_page_size());
// Set initial bars.
if ($useinitialsbar) {
... | php | public function query_db($pagesize, $useinitialsbar = true) {
$total = count($this->model->get_logs());
$this->pagesize($pagesize, $total);
$this->rawdata = $this->model->get_logs($this->get_page_start(), $this->get_page_size());
// Set initial bars.
if ($useinitialsbar) {
... | [
"public",
"function",
"query_db",
"(",
"$",
"pagesize",
",",
"$",
"useinitialsbar",
"=",
"true",
")",
"{",
"$",
"total",
"=",
"count",
"(",
"$",
"this",
"->",
"model",
"->",
"get_logs",
"(",
")",
")",
";",
"$",
"this",
"->",
"pagesize",
"(",
"$",
"... | Query the logs table. Store results in the object for use by build_table.
@param int $pagesize size of page for paginated displayed table.
@param bool $useinitialsbar do you want to use the initials bar. | [
"Query",
"the",
"logs",
"table",
".",
"Store",
"results",
"in",
"the",
"object",
"for",
"use",
"by",
"build_table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/analytics/classes/output/model_logs.php#L207-L216 |
214,773 | moodle/moodle | lib/horde/framework/Horde/Mime/QuotedPrintable.php | Horde_Mime_QuotedPrintable.encode | public static function encode($text, $eol = "\n", $wrap = 76)
{
$fp = fopen('php://temp', 'r+');
stream_filter_append(
$fp,
'convert.quoted-printable-encode',
STREAM_FILTER_WRITE,
array(
'line-break-chars' => $eol,
'line... | php | public static function encode($text, $eol = "\n", $wrap = 76)
{
$fp = fopen('php://temp', 'r+');
stream_filter_append(
$fp,
'convert.quoted-printable-encode',
STREAM_FILTER_WRITE,
array(
'line-break-chars' => $eol,
'line... | [
"public",
"static",
"function",
"encode",
"(",
"$",
"text",
",",
"$",
"eol",
"=",
"\"\\n\"",
",",
"$",
"wrap",
"=",
"76",
")",
"{",
"$",
"fp",
"=",
"fopen",
"(",
"'php://temp'",
",",
"'r+'",
")",
";",
"stream_filter_append",
"(",
"$",
"fp",
",",
"'... | Encodes text via quoted-printable encoding.
@param string $text The text to encode (UTF-8).
@param string $eol The EOL sequence to use.
@param integer $wrap Wrap a line at this many characters.
@return string The quoted-printable encoded string. | [
"Encodes",
"text",
"via",
"quoted",
"-",
"printable",
"encoding",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/QuotedPrintable.php#L47-L65 |
214,774 | moodle/moodle | competency/classes/url.php | url.get | protected static function get($resource, $args) {
global $CFG;
if (!isset(static::$resolver)) {
$klass = !empty($CFG->core_competency_url_resolver) ? $CFG->core_competency_url_resolver : 'tool_lp\\url_resolver';
static::$resolver = new $klass();
}
if (!method_exis... | php | protected static function get($resource, $args) {
global $CFG;
if (!isset(static::$resolver)) {
$klass = !empty($CFG->core_competency_url_resolver) ? $CFG->core_competency_url_resolver : 'tool_lp\\url_resolver';
static::$resolver = new $klass();
}
if (!method_exis... | [
"protected",
"static",
"function",
"get",
"(",
"$",
"resource",
",",
"$",
"args",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"resolver",
")",
")",
"{",
"$",
"klass",
"=",
"!",
"empty",
"(",
"$",
"CFG",... | Defer to the resolver.
@param string $resource The resource type.
@param array $args The arguments.
@return mixed | [
"Defer",
"to",
"the",
"resolver",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/url.php#L62-L73 |
214,775 | moodle/moodle | lib/classes/access/get_user_capability_course_helper.php | get_user_capability_course_helper.calculate_permission_tree | protected static function calculate_permission_tree(array $pathroleperms) {
// Considering each discovered context path as an inflection point, evaluate the user's
// permission (based on all roles) at each point.
$pathallows = [];
$mindepth = 1000;
$maxdepth = 0;
foreach... | php | protected static function calculate_permission_tree(array $pathroleperms) {
// Considering each discovered context path as an inflection point, evaluate the user's
// permission (based on all roles) at each point.
$pathallows = [];
$mindepth = 1000;
$maxdepth = 0;
foreach... | [
"protected",
"static",
"function",
"calculate_permission_tree",
"(",
"array",
"$",
"pathroleperms",
")",
"{",
"// Considering each discovered context path as an inflection point, evaluate the user's",
"// permission (based on all roles) at each point.",
"$",
"pathallows",
"=",
"[",
"... | Calculates a permission tree based on an array of information about role permissions.
The input parameter must be in the format returned by get_capability_info_at_each_context.
The output is the root of a tree of stdClass objects with the fields 'path' (a context path),
'allow' (true or false), and 'children' (an arr... | [
"Calculates",
"a",
"permission",
"tree",
"based",
"on",
"an",
"array",
"of",
"information",
"about",
"role",
"permissions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/access/get_user_capability_course_helper.php#L170-L261 |
214,776 | moodle/moodle | lib/classes/access/get_user_capability_course_helper.php | get_user_capability_course_helper.remove_duplicate_nodes | protected static function remove_duplicate_nodes($parent) {
$length = count($parent->children);
$index = 0;
while ($index < $length) {
$child = $parent->children[$index];
if ($child->allow === $parent->allow) {
// Remove child node, but add its children to... | php | protected static function remove_duplicate_nodes($parent) {
$length = count($parent->children);
$index = 0;
while ($index < $length) {
$child = $parent->children[$index];
if ($child->allow === $parent->allow) {
// Remove child node, but add its children to... | [
"protected",
"static",
"function",
"remove_duplicate_nodes",
"(",
"$",
"parent",
")",
"{",
"$",
"length",
"=",
"count",
"(",
"$",
"parent",
"->",
"children",
")",
";",
"$",
"index",
"=",
"0",
";",
"while",
"(",
"$",
"index",
"<",
"$",
"length",
")",
... | Removes duplicate nodes of a tree - where a child node has the same permission as its
parent.
@param \stdClass $parent Tree root node | [
"Removes",
"duplicate",
"nodes",
"of",
"a",
"tree",
"-",
"where",
"a",
"child",
"node",
"has",
"the",
"same",
"permission",
"as",
"its",
"parent",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/access/get_user_capability_course_helper.php#L299-L319 |
214,777 | moodle/moodle | lib/classes/access/get_user_capability_course_helper.php | get_user_capability_course_helper.get_tree | protected static function get_tree($userid, $capability) {
// Extract raw capability data for this user and capability.
$pathroleperms = self::get_capability_info_at_each_context($userid, $capability);
// Convert the raw data into a permission tree based on context.
$root = self::calcul... | php | protected static function get_tree($userid, $capability) {
// Extract raw capability data for this user and capability.
$pathroleperms = self::get_capability_info_at_each_context($userid, $capability);
// Convert the raw data into a permission tree based on context.
$root = self::calcul... | [
"protected",
"static",
"function",
"get_tree",
"(",
"$",
"userid",
",",
"$",
"capability",
")",
"{",
"// Extract raw capability data for this user and capability.",
"$",
"pathroleperms",
"=",
"self",
"::",
"get_capability_info_at_each_context",
"(",
"$",
"userid",
",",
... | Gets a permission tree for the given user and capability, representing the value of that
capability at different contexts across the system. The tree will be simplified as far as
possible.
The output is the root of a tree of stdClass objects with the fields 'path' (a context path),
'allow' (true or false), and 'childr... | [
"Gets",
"a",
"permission",
"tree",
"for",
"the",
"given",
"user",
"and",
"capability",
"representing",
"the",
"value",
"of",
"that",
"capability",
"at",
"different",
"contexts",
"across",
"the",
"system",
".",
"The",
"tree",
"will",
"be",
"simplified",
"as",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/access/get_user_capability_course_helper.php#L333-L347 |
214,778 | moodle/moodle | lib/classes/access/get_user_capability_course_helper.php | get_user_capability_course_helper.create_sql | protected static function create_sql($parent) {
global $DB;
$sql = '';
$params = [];
if ($parent->path !== null) {
// Except for the root element, create the condition that it applies to the context of
// this element (or anything within it).
$sql = '... | php | protected static function create_sql($parent) {
global $DB;
$sql = '';
$params = [];
if ($parent->path !== null) {
// Except for the root element, create the condition that it applies to the context of
// this element (or anything within it).
$sql = '... | [
"protected",
"static",
"function",
"create_sql",
"(",
"$",
"parent",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"''",
";",
"$",
"params",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"parent",
"->",
"path",
"!==",
"null",
")",
"{",
"// Except for ... | Creates SQL suitable for restricting by contexts listed in the given permission tree.
This function relies on the permission tree being in the format created by get_tree.
Specifically, all the children of the root element must be set to 'allow' permission,
children of those children must be 'not allow', children of th... | [
"Creates",
"SQL",
"suitable",
"for",
"restricting",
"by",
"contexts",
"listed",
"in",
"the",
"given",
"permission",
"tree",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/access/get_user_capability_course_helper.php#L359-L402 |
214,779 | moodle/moodle | lib/classes/access/get_user_capability_course_helper.php | get_user_capability_course_helper.get_sql | public static function get_sql($userid, $capability) {
// Get a tree of capability permission at various contexts for current user.
$root = self::get_tree($userid, $capability);
// The root node always has permission false. If there are no child nodes then the user
// cannot access anyt... | php | public static function get_sql($userid, $capability) {
// Get a tree of capability permission at various contexts for current user.
$root = self::get_tree($userid, $capability);
// The root node always has permission false. If there are no child nodes then the user
// cannot access anyt... | [
"public",
"static",
"function",
"get_sql",
"(",
"$",
"userid",
",",
"$",
"capability",
")",
"{",
"// Get a tree of capability permission at various contexts for current user.",
"$",
"root",
"=",
"self",
"::",
"get_tree",
"(",
"$",
"userid",
",",
"$",
"capability",
"... | Gets SQL to restrict a query to contexts in which the user has a capability.
This returns an array with two elements (SQL containing ? placeholders, and a params array).
The SQL is intended to be used as part of a WHERE clause. It relies on the prefix 'x' being
used for the Moodle context table.
If the user does not ... | [
"Gets",
"SQL",
"to",
"restrict",
"a",
"query",
"to",
"contexts",
"in",
"which",
"the",
"user",
"has",
"a",
"capability",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/access/get_user_capability_course_helper.php#L418-L431 |
214,780 | moodle/moodle | question/format/blackboard_six/formatpool.php | qformat_blackboard_six_pool.readquestions | protected function readquestions($text) {
// This converts xml to big nasty data structure,
// the 0 means keep white space as it is.
try {
$xml = xmlize($text, 0, 'UTF-8', true);
} catch (xml_format_exception $e) {
$this->error($e->getMessage(), '');
... | php | protected function readquestions($text) {
// This converts xml to big nasty data structure,
// the 0 means keep white space as it is.
try {
$xml = xmlize($text, 0, 'UTF-8', true);
} catch (xml_format_exception $e) {
$this->error($e->getMessage(), '');
... | [
"protected",
"function",
"readquestions",
"(",
"$",
"text",
")",
"{",
"// This converts xml to big nasty data structure,",
"// the 0 means keep white space as it is.",
"try",
"{",
"$",
"xml",
"=",
"xmlize",
"(",
"$",
"text",
",",
"0",
",",
"'UTF-8'",
",",
"true",
")... | Parse the xml document into an array of questions
This *could* burn memory - but it won't happen that much
so fingers crossed!
@param array $text array of lines from the input file.
@return array (of objects) questions objects. | [
"Parse",
"the",
"xml",
"document",
"into",
"an",
"array",
"of",
"questions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/blackboard_six/formatpool.php#L52-L75 |
214,781 | moodle/moodle | question/format/blackboard_six/formatpool.php | qformat_blackboard_six_pool.process_common | public function process_common($questiondata) {
// This routine initialises the question object.
$question = $this->defaultquestion();
// Determine if the question is already escaped html.
$this->ishtml = $this->getpath($questiondata,
array('#', 'BODY', 0, '#', 'FLAGS',... | php | public function process_common($questiondata) {
// This routine initialises the question object.
$question = $this->defaultquestion();
// Determine if the question is already escaped html.
$this->ishtml = $this->getpath($questiondata,
array('#', 'BODY', 0, '#', 'FLAGS',... | [
"public",
"function",
"process_common",
"(",
"$",
"questiondata",
")",
"{",
"// This routine initialises the question object.",
"$",
"question",
"=",
"$",
"this",
"->",
"defaultquestion",
"(",
")",
";",
"// Determine if the question is already escaped html.",
"$",
"this",
... | Do question import processing common to every qtype.
@param array $questiondata the xml tree related to the current question
@return object initialized question object. | [
"Do",
"question",
"import",
"processing",
"common",
"to",
"every",
"qtype",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/blackboard_six/formatpool.php#L83-L117 |
214,782 | moodle/moodle | question/format/blackboard_six/formatpool.php | qformat_blackboard_six_pool.process_essay | public function process_essay($xml, &$questions) {
if ($this->getpath($xml, array('POOL', '#', 'QUESTION_ESSAY'), false, false)) {
$essayquestions = $this->getpath($xml,
array('POOL', '#', 'QUESTION_ESSAY'), false, false);
} else {
return;
}
... | php | public function process_essay($xml, &$questions) {
if ($this->getpath($xml, array('POOL', '#', 'QUESTION_ESSAY'), false, false)) {
$essayquestions = $this->getpath($xml,
array('POOL', '#', 'QUESTION_ESSAY'), false, false);
} else {
return;
}
... | [
"public",
"function",
"process_essay",
"(",
"$",
"xml",
",",
"&",
"$",
"questions",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getpath",
"(",
"$",
"xml",
",",
"array",
"(",
"'POOL'",
",",
"'#'",
",",
"'QUESTION_ESSAY'",
")",
",",
"false",
",",
"false",... | Process Essay Questions
@param array $xml the xml tree
@param array $questions the questions already parsed | [
"Process",
"Essay",
"Questions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/blackboard_six/formatpool.php#L139-L169 |
214,783 | moodle/moodle | question/format/blackboard_six/formatpool.php | qformat_blackboard_six_pool.process_mc | public function process_mc($xml, &$questions) {
if ($this->getpath($xml, array('POOL', '#', 'QUESTION_MULTIPLECHOICE'), false, false)) {
$mcquestions = $this->getpath($xml,
array('POOL', '#', 'QUESTION_MULTIPLECHOICE'), false, false);
} else {
return;
... | php | public function process_mc($xml, &$questions) {
if ($this->getpath($xml, array('POOL', '#', 'QUESTION_MULTIPLECHOICE'), false, false)) {
$mcquestions = $this->getpath($xml,
array('POOL', '#', 'QUESTION_MULTIPLECHOICE'), false, false);
} else {
return;
... | [
"public",
"function",
"process_mc",
"(",
"$",
"xml",
",",
"&",
"$",
"questions",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getpath",
"(",
"$",
"xml",
",",
"array",
"(",
"'POOL'",
",",
"'#'",
",",
"'QUESTION_MULTIPLECHOICE'",
")",
",",
"false",
",",
"f... | Process Multiple Choice Questions with single answer
@param array $xml the xml tree
@param array $questions the questions already parsed | [
"Process",
"Multiple",
"Choice",
"Questions",
"with",
"single",
"answer"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/blackboard_six/formatpool.php#L225-L272 |
214,784 | moodle/moodle | question/format/blackboard_six/formatpool.php | qformat_blackboard_six_pool.process_ma | public function process_ma($xml, &$questions) {
if ($this->getpath($xml, array('POOL', '#', 'QUESTION_MULTIPLEANSWER'), false, false)) {
$maquestions = $this->getpath($xml,
array('POOL', '#', 'QUESTION_MULTIPLEANSWER'), false, false);
} else {
return;
... | php | public function process_ma($xml, &$questions) {
if ($this->getpath($xml, array('POOL', '#', 'QUESTION_MULTIPLEANSWER'), false, false)) {
$maquestions = $this->getpath($xml,
array('POOL', '#', 'QUESTION_MULTIPLEANSWER'), false, false);
} else {
return;
... | [
"public",
"function",
"process_ma",
"(",
"$",
"xml",
",",
"&",
"$",
"questions",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getpath",
"(",
"$",
"xml",
",",
"array",
"(",
"'POOL'",
",",
"'#'",
",",
"'QUESTION_MULTIPLEANSWER'",
")",
",",
"false",
",",
"f... | Process Multiple Choice Questions With Multiple Answers
@param array $xml the xml tree
@param array $questions the questions already parsed | [
"Process",
"Multiple",
"Choice",
"Questions",
"With",
"Multiple",
"Answers"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/blackboard_six/formatpool.php#L279-L336 |
214,785 | moodle/moodle | question/format/blackboard_six/formatpool.php | qformat_blackboard_six_pool.process_fib | public function process_fib($xml, &$questions) {
if ($this->getpath($xml, array('POOL', '#', 'QUESTION_FILLINBLANK'), false, false)) {
$fibquestions = $this->getpath($xml,
array('POOL', '#', 'QUESTION_FILLINBLANK'), false, false);
} else {
return;
}
... | php | public function process_fib($xml, &$questions) {
if ($this->getpath($xml, array('POOL', '#', 'QUESTION_FILLINBLANK'), false, false)) {
$fibquestions = $this->getpath($xml,
array('POOL', '#', 'QUESTION_FILLINBLANK'), false, false);
} else {
return;
}
... | [
"public",
"function",
"process_fib",
"(",
"$",
"xml",
",",
"&",
"$",
"questions",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getpath",
"(",
"$",
"xml",
",",
"array",
"(",
"'POOL'",
",",
"'#'",
",",
"'QUESTION_FILLINBLANK'",
")",
",",
"false",
",",
"fal... | Process Fill in the Blank Questions
@param array $xml the xml tree
@param array $questions the questions already parsed | [
"Process",
"Fill",
"in",
"the",
"Blank",
"Questions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/blackboard_six/formatpool.php#L343-L377 |
214,786 | moodle/moodle | lib/lessphp/SourceMap/Generator.php | Less_SourceMap_Generator.generateCSS | public function generateCSS(){
$output = new Less_Output_Mapped($this->contentsMap, $this);
// catch the output
$this->root->genCSS($output);
$sourceMapUrl = $this->getOption('sourceMapURL');
$sourceMapFilename = $this->getOption('sourceMapFilename');
$sourceMapContent = $this->generateJs... | php | public function generateCSS(){
$output = new Less_Output_Mapped($this->contentsMap, $this);
// catch the output
$this->root->genCSS($output);
$sourceMapUrl = $this->getOption('sourceMapURL');
$sourceMapFilename = $this->getOption('sourceMapFilename');
$sourceMapContent = $this->generateJs... | [
"public",
"function",
"generateCSS",
"(",
")",
"{",
"$",
"output",
"=",
"new",
"Less_Output_Mapped",
"(",
"$",
"this",
"->",
"contentsMap",
",",
"$",
"this",
")",
";",
"// catch the output\r",
"$",
"this",
"->",
"root",
"->",
"genCSS",
"(",
"$",
"output",
... | Generates the CSS
@return string | [
"Generates",
"the",
"CSS"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/SourceMap/Generator.php#L104-L135 |
214,787 | moodle/moodle | lib/lessphp/SourceMap/Generator.php | Less_SourceMap_Generator.fixWindowsPath | public function fixWindowsPath($path, $addEndSlash = false){
$slash = ($addEndSlash) ? '/' : '';
if( !empty($path) ){
$path = str_replace('\\', '/', $path);
$path = rtrim($path,'/') . $slash;
}
return $path;
} | php | public function fixWindowsPath($path, $addEndSlash = false){
$slash = ($addEndSlash) ? '/' : '';
if( !empty($path) ){
$path = str_replace('\\', '/', $path);
$path = rtrim($path,'/') . $slash;
}
return $path;
} | [
"public",
"function",
"fixWindowsPath",
"(",
"$",
"path",
",",
"$",
"addEndSlash",
"=",
"false",
")",
"{",
"$",
"slash",
"=",
"(",
"$",
"addEndSlash",
")",
"?",
"'/'",
":",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"$",... | fix windows paths
@param string $path
@return string | [
"fix",
"windows",
"paths"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/SourceMap/Generator.php#L355-L363 |
214,788 | moodle/moodle | lib/classes/lock/lock.php | lock.extend | public function extend($maxlifetime = 86400) {
if ($this->factory) {
return $this->factory->extend_lock($this, $maxlifetime);
}
return false;
} | php | public function extend($maxlifetime = 86400) {
if ($this->factory) {
return $this->factory->extend_lock($this, $maxlifetime);
}
return false;
} | [
"public",
"function",
"extend",
"(",
"$",
"maxlifetime",
"=",
"86400",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"factory",
")",
"{",
"return",
"$",
"this",
"->",
"factory",
"->",
"extend_lock",
"(",
"$",
"this",
",",
"$",
"maxlifetime",
")",
";",
"}",... | Extend the lifetime of this lock. Not supported by all factories.
@param int $maxlifetime - the new lifetime for the lock (in seconds).
@return bool | [
"Extend",
"the",
"lifetime",
"of",
"this",
"lock",
".",
"Not",
"supported",
"by",
"all",
"factories",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/lock/lock.php#L86-L91 |
214,789 | moodle/moodle | lib/classes/lock/lock.php | lock.release | public function release() {
$this->released = true;
if (empty($this->factory)) {
return false;
}
$result = $this->factory->release_lock($this);
// Release any held references to the factory.
unset($this->factory);
$this->factory = null;
$this->... | php | public function release() {
$this->released = true;
if (empty($this->factory)) {
return false;
}
$result = $this->factory->release_lock($this);
// Release any held references to the factory.
unset($this->factory);
$this->factory = null;
$this->... | [
"public",
"function",
"release",
"(",
")",
"{",
"$",
"this",
"->",
"released",
"=",
"true",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"factory",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"result",
"=",
"$",
"this",
"->",
"factory",
... | Release this lock
@return bool | [
"Release",
"this",
"lock"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/lock/lock.php#L97-L108 |
214,790 | moodle/moodle | lib/google/src/Google/Task/Runner.php | Google_Task_Runner.backOff | private function backOff()
{
$delay = $this->getDelay();
$this->client->getLogger()->debug(
'Retrying task with backoff',
array(
'request' => $this->name,
'retry' => $this->attempts,
'backoff_seconds' => $delay
)
);
usleep($delay * 1000000)... | php | private function backOff()
{
$delay = $this->getDelay();
$this->client->getLogger()->debug(
'Retrying task with backoff',
array(
'request' => $this->name,
'retry' => $this->attempts,
'backoff_seconds' => $delay
)
);
usleep($delay * 1000000)... | [
"private",
"function",
"backOff",
"(",
")",
"{",
"$",
"delay",
"=",
"$",
"this",
"->",
"getDelay",
"(",
")",
";",
"$",
"this",
"->",
"client",
"->",
"getLogger",
"(",
")",
"->",
"debug",
"(",
"'Retrying task with backoff'",
",",
"array",
"(",
"'request'"... | Sleeps in accordance to the backoff configurations. | [
"Sleeps",
"in",
"accordance",
"to",
"the",
"backoff",
"configurations",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Task/Runner.php#L218-L232 |
214,791 | moodle/moodle | auth/classes/external.php | core_auth_external.confirm_user | public static function confirm_user($username, $secret) {
global $PAGE;
$warnings = array();
$params = self::validate_parameters(
self::confirm_user_parameters(),
array(
'username' => $username,
'secret' => $secret,
)
)... | php | public static function confirm_user($username, $secret) {
global $PAGE;
$warnings = array();
$params = self::validate_parameters(
self::confirm_user_parameters(),
array(
'username' => $username,
'secret' => $secret,
)
)... | [
"public",
"static",
"function",
"confirm_user",
"(",
"$",
"username",
",",
"$",
"secret",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"warnings",
"=",
"array",
"(",
")",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"c... | Confirm a user account.
@param string $username user name
@param string $secret confirmation secret (random string) used for validating the confirm request
@return array warnings and success status (true if the user was confirmed, false if he was already confirmed)
@since Moodle 3.2
@throws moodle_exception | [
"Confirm",
"a",
"user",
"account",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/classes/external.php#L67-L107 |
214,792 | moodle/moodle | auth/classes/external.php | core_auth_external.request_password_reset_parameters | public static function request_password_reset_parameters() {
return new external_function_parameters(
array(
'username' => new external_value(core_user::get_property_type('username'), 'User name', VALUE_DEFAULT, ''),
'email' => new external_value(core_user::get_proper... | php | public static function request_password_reset_parameters() {
return new external_function_parameters(
array(
'username' => new external_value(core_user::get_property_type('username'), 'User name', VALUE_DEFAULT, ''),
'email' => new external_value(core_user::get_proper... | [
"public",
"static",
"function",
"request_password_reset_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'username'",
"=>",
"new",
"external_value",
"(",
"core_user",
"::",
"get_property_type",
"(",
"'username'",
")",
",... | Describes the parameters for request_password_reset.
@return external_function_parameters
@since Moodle 3.4 | [
"Describes",
"the",
"parameters",
"for",
"request_password_reset",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/classes/external.php#L131-L138 |
214,793 | moodle/moodle | auth/classes/external.php | core_auth_external.request_password_reset | public static function request_password_reset($username = '', $email = '') {
global $CFG, $PAGE;
require_once($CFG->dirroot . '/login/lib.php');
$warnings = array();
$params = self::validate_parameters(
self::request_password_reset_parameters(),
array(
... | php | public static function request_password_reset($username = '', $email = '') {
global $CFG, $PAGE;
require_once($CFG->dirroot . '/login/lib.php');
$warnings = array();
$params = self::validate_parameters(
self::request_password_reset_parameters(),
array(
... | [
"public",
"static",
"function",
"request_password_reset",
"(",
"$",
"username",
"=",
"''",
",",
"$",
"email",
"=",
"''",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/login/lib.php'",
")"... | Requests a password reset.
@param string $username user name
@param string $email user email
@return array warnings and success status (including notices and errors while processing)
@since Moodle 3.4
@throws moodle_exception | [
"Requests",
"a",
"password",
"reset",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/classes/external.php#L149-L192 |
214,794 | moodle/moodle | auth/classes/external.php | core_auth_external.is_minor | public static function is_minor($age, $country) {
global $CFG, $PAGE;
require_once($CFG->dirroot . '/login/lib.php');
$params = self::validate_parameters(
self::is_minor_parameters(),
array(
'age' => $age,
'country' => $country,
... | php | public static function is_minor($age, $country) {
global $CFG, $PAGE;
require_once($CFG->dirroot . '/login/lib.php');
$params = self::validate_parameters(
self::is_minor_parameters(),
array(
'age' => $age,
'country' => $country,
... | [
"public",
"static",
"function",
"is_minor",
"(",
"$",
"age",
",",
"$",
"country",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/login/lib.php'",
")",
";",
"$",
"params",
"=",
"self",
... | Requests a check if a user is digital minor.
@param int $age User age
@param string $country Country of residence
@return array status (true if the user is a minor, false otherwise)
@since Moodle 3.4
@throws moodle_exception | [
"Requests",
"a",
"check",
"if",
"a",
"user",
"is",
"digital",
"minor",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/classes/external.php#L243-L274 |
214,795 | moodle/moodle | auth/classes/external.php | core_auth_external.is_age_digital_consent_verification_enabled | public static function is_age_digital_consent_verification_enabled() {
global $PAGE;
$context = context_system::instance();
$PAGE->set_context($context);
$status = false;
// Check if verification is enabled.
if (\core_auth\digital_consent::is_age_digital_consent_verific... | php | public static function is_age_digital_consent_verification_enabled() {
global $PAGE;
$context = context_system::instance();
$PAGE->set_context($context);
$status = false;
// Check if verification is enabled.
if (\core_auth\digital_consent::is_age_digital_consent_verific... | [
"public",
"static",
"function",
"is_age_digital_consent_verification_enabled",
"(",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"context",
"=",
"context_system",
"::",
"instance",
"(",
")",
";",
"$",
"PAGE",
"->",
"set_context",
"(",
"$",
"context",
")",
";",
... | Checks if age digital consent verification is enabled.
@return array status (true if digital consent verification is enabled, false otherwise.)
@since Moodle 3.3
@throws moodle_exception | [
"Checks",
"if",
"age",
"digital",
"consent",
"verification",
"is",
"enabled",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/classes/external.php#L308-L323 |
214,796 | moodle/moodle | auth/classes/external.php | core_auth_external.resend_confirmation_email_parameters | public static function resend_confirmation_email_parameters() {
return new external_function_parameters(
array(
'username' => new external_value(core_user::get_property_type('username'), 'Username.'),
'password' => new external_value(core_user::get_property_type('pass... | php | public static function resend_confirmation_email_parameters() {
return new external_function_parameters(
array(
'username' => new external_value(core_user::get_property_type('username'), 'Username.'),
'password' => new external_value(core_user::get_property_type('pass... | [
"public",
"static",
"function",
"resend_confirmation_email_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'username'",
"=>",
"new",
"external_value",
"(",
"core_user",
"::",
"get_property_type",
"(",
"'username'",
")",
... | Describes the parameters for resend_confirmation_email.
@return external_function_parameters
@since Moodle 3.6 | [
"Describes",
"the",
"parameters",
"for",
"resend_confirmation_email",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/classes/external.php#L346-L355 |
214,797 | moodle/moodle | auth/classes/external.php | core_auth_external.resend_confirmation_email | public static function resend_confirmation_email($username, $password, $redirect = '') {
global $PAGE;
$warnings = array();
$params = self::validate_parameters(
self::resend_confirmation_email_parameters(),
array(
'username' => $username,
... | php | public static function resend_confirmation_email($username, $password, $redirect = '') {
global $PAGE;
$warnings = array();
$params = self::validate_parameters(
self::resend_confirmation_email_parameters(),
array(
'username' => $username,
... | [
"public",
"static",
"function",
"resend_confirmation_email",
"(",
"$",
"username",
",",
"$",
"password",
",",
"$",
"redirect",
"=",
"''",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"warnings",
"=",
"array",
"(",
")",
";",
"$",
"params",
"=",
"self",
":... | Requests resend the confirmation email.
@param string $username user name
@param string $password plain text password
@param string $redirect redirect the user to this site url after confirmation
@return array warnings and success status
@since Moodle 3.6
@throws moodle_exception | [
"Requests",
"resend",
"the",
"confirmation",
"email",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/classes/external.php#L367-L413 |
214,798 | moodle/moodle | admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php | cohort_role_assignments_table.col_cohortname | protected function col_cohortname($data) {
global $OUTPUT;
$record = (object) array(
'id' => $data->cohortid,
'idnumber' => $data->cohortidnumber,
'description' => $data->cohortdescription,
'visible' => $data->cohortvisible,
'name' => $data->c... | php | protected function col_cohortname($data) {
global $OUTPUT;
$record = (object) array(
'id' => $data->cohortid,
'idnumber' => $data->cohortidnumber,
'description' => $data->cohortdescription,
'visible' => $data->cohortvisible,
'name' => $data->c... | [
"protected",
"function",
"col_cohortname",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"record",
"=",
"(",
"object",
")",
"array",
"(",
"'id'",
"=>",
"$",
"data",
"->",
"cohortid",
",",
"'idnumber'",
"=>",
"$",
"data",
"->",
"cohorti... | Cohort name column.
@param array $data Row data.
@return string | [
"Cohort",
"name",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php#L89-L107 |
214,799 | moodle/moodle | admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php | cohort_role_assignments_table.col_actions | protected function col_actions($data) {
global $OUTPUT;
$action = new \confirm_action(get_string('removecohortroleassignmentconfirm', 'tool_cohortroles'));
$url = new moodle_url($this->baseurl);
$url->params(array('removecohortroleassignment' => $data->id, 'sesskey' => sesskey()));
... | php | protected function col_actions($data) {
global $OUTPUT;
$action = new \confirm_action(get_string('removecohortroleassignmentconfirm', 'tool_cohortroles'));
$url = new moodle_url($this->baseurl);
$url->params(array('removecohortroleassignment' => $data->id, 'sesskey' => sesskey()));
... | [
"protected",
"function",
"col_actions",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"action",
"=",
"new",
"\\",
"confirm_action",
"(",
"get_string",
"(",
"'removecohortroleassignmentconfirm'",
",",
"'tool_cohortroles'",
")",
")",
";",
"$",
"... | Actions column.
@param array $data Row data.
@return string | [
"Actions",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php#L115-L123 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.