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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
220,000 | moodle/moodle | lib/classes/hub/publication.php | publication.unpublish | public static function unpublish($publication) {
global $DB;
// Unpublish the publication by web service.
api::unregister_courses($publication->hubcourseid);
// Delete the publication from the database.
$DB->delete_records('course_published', array('id' => $publication->id));
... | php | public static function unpublish($publication) {
global $DB;
// Unpublish the publication by web service.
api::unregister_courses($publication->hubcourseid);
// Delete the publication from the database.
$DB->delete_records('course_published', array('id' => $publication->id));
... | [
"public",
"static",
"function",
"unpublish",
"(",
"$",
"publication",
")",
"{",
"global",
"$",
"DB",
";",
"// Unpublish the publication by web service.",
"api",
"::",
"unregister_courses",
"(",
"$",
"publication",
"->",
"hubcourseid",
")",
";",
"// Delete the publicat... | Unpublish a course
@param stdClass $publication | [
"Unpublish",
"a",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/publication.php#L179-L193 |
220,001 | moodle/moodle | lib/classes/hub/publication.php | publication.publish_course | public static function publish_course($courseinfo, $files) {
global $DB;
// Register course and get id of the course on moodle.net ($hubcourseid).
$courseid = $courseinfo->sitecourseid;
try {
$hubcourseid = api::register_course($courseinfo);
} catch (Exception $e) {
... | php | public static function publish_course($courseinfo, $files) {
global $DB;
// Register course and get id of the course on moodle.net ($hubcourseid).
$courseid = $courseinfo->sitecourseid;
try {
$hubcourseid = api::register_course($courseinfo);
} catch (Exception $e) {
... | [
"public",
"static",
"function",
"publish_course",
"(",
"$",
"courseinfo",
",",
"$",
"files",
")",
"{",
"global",
"$",
"DB",
";",
"// Register course and get id of the course on moodle.net ($hubcourseid).",
"$",
"courseid",
"=",
"$",
"courseinfo",
"->",
"sitecourseid",
... | Publish a course
@param \stdClass $courseinfo
@param \stored_file[] $files | [
"Publish",
"a",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/publication.php#L201-L238 |
220,002 | moodle/moodle | lib/classes/hub/publication.php | publication.delete_all_publications | public static function delete_all_publications($advertised = true, $shared = true) {
global $DB;
if (!$advertised && !$shared) {
// Nothing to do.
return true;
}
$params = ['huburl' => HUB_MOODLEORGHUBURL];
if (!$advertised || !$shared) {
// ... | php | public static function delete_all_publications($advertised = true, $shared = true) {
global $DB;
if (!$advertised && !$shared) {
// Nothing to do.
return true;
}
$params = ['huburl' => HUB_MOODLEORGHUBURL];
if (!$advertised || !$shared) {
// ... | [
"public",
"static",
"function",
"delete_all_publications",
"(",
"$",
"advertised",
"=",
"true",
",",
"$",
"shared",
"=",
"true",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"$",
"advertised",
"&&",
"!",
"$",
"shared",
")",
"{",
"// Nothing to do.... | Delete all publications
@param int $advertised search for advertised courses
@param int $shared search for shared courses
@throws moodle_exception | [
"Delete",
"all",
"publications"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/publication.php#L247-L275 |
220,003 | moodle/moodle | lib/classes/hub/publication.php | publication.educational_level_options | public static function educational_level_options($any = false) {
$options = array();
if ($any) {
$options['all'] = get_string('any');
}
$options[self::HUB_EDULEVEL_PRIMARY] = get_string('edulevelprimary', 'hub');
$options[self::HUB_EDULEVEL_SECONDARY] = get_string('ed... | php | public static function educational_level_options($any = false) {
$options = array();
if ($any) {
$options['all'] = get_string('any');
}
$options[self::HUB_EDULEVEL_PRIMARY] = get_string('edulevelprimary', 'hub');
$options[self::HUB_EDULEVEL_SECONDARY] = get_string('ed... | [
"public",
"static",
"function",
"educational_level_options",
"(",
"$",
"any",
"=",
"false",
")",
"{",
"$",
"options",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"any",
")",
"{",
"$",
"options",
"[",
"'all'",
"]",
"=",
"get_string",
"(",
"'any'",
")... | List of available educational levels
@param bool $any add option for "Any" (for search forms)
@return array | [
"List",
"of",
"available",
"educational",
"levels"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/publication.php#L293-L306 |
220,004 | moodle/moodle | lib/classes/hub/publication.php | publication.audience_options | public static function audience_options($any = false) {
$options = array();
if ($any) {
$options['all'] = get_string('any');
}
$options[self::HUB_AUDIENCE_EDUCATORS] = get_string('audienceeducators', 'hub');
$options[self::HUB_AUDIENCE_STUDENTS] = get_string('audience... | php | public static function audience_options($any = false) {
$options = array();
if ($any) {
$options['all'] = get_string('any');
}
$options[self::HUB_AUDIENCE_EDUCATORS] = get_string('audienceeducators', 'hub');
$options[self::HUB_AUDIENCE_STUDENTS] = get_string('audience... | [
"public",
"static",
"function",
"audience_options",
"(",
"$",
"any",
"=",
"false",
")",
"{",
"$",
"options",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"any",
")",
"{",
"$",
"options",
"[",
"'all'",
"]",
"=",
"get_string",
"(",
"'any'",
")",
";",... | List of available audience options
@param bool $any add option for "Any" (for search forms)
@return array | [
"List",
"of",
"available",
"audience",
"options"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/publication.php#L314-L323 |
220,005 | moodle/moodle | lib/classes/hub/publication.php | publication.search | public static function search($search, $downloadable, $options) {
try {
return api::get_courses($search, $downloadable, !$downloadable, $options);
} catch (moodle_exception $e) {
\core\notification::add(get_string('errorcourselisting', 'block_community', $e->getMessage()),
... | php | public static function search($search, $downloadable, $options) {
try {
return api::get_courses($search, $downloadable, !$downloadable, $options);
} catch (moodle_exception $e) {
\core\notification::add(get_string('errorcourselisting', 'block_community', $e->getMessage()),
... | [
"public",
"static",
"function",
"search",
"(",
"$",
"search",
",",
"$",
"downloadable",
",",
"$",
"options",
")",
"{",
"try",
"{",
"return",
"api",
"::",
"get_courses",
"(",
"$",
"search",
",",
"$",
"downloadable",
",",
"!",
"$",
"downloadable",
",",
"... | Search for courses
For the list of fields returned for each course see {@link communication::get_courses}
@param string $search search string
@param bool $downloadable true - return downloadable courses, false - return enrollable courses
@param array|\stdClass $options other options from the list of allowed options:
... | [
"Search",
"for",
"courses"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/publication.php#L337-L345 |
220,006 | moodle/moodle | lib/classes/hub/publication.php | publication.get_published_course | public static function get_published_course($publication) {
try {
list($courses, $unused) = api::get_courses('', !$publication->enrollable,
$publication->enrollable, ['ids' => [$publication->hubcourseid], 'allsitecourses' => 1]);
return reset($courses);
} catch (\... | php | public static function get_published_course($publication) {
try {
list($courses, $unused) = api::get_courses('', !$publication->enrollable,
$publication->enrollable, ['ids' => [$publication->hubcourseid], 'allsitecourses' => 1]);
return reset($courses);
} catch (\... | [
"public",
"static",
"function",
"get_published_course",
"(",
"$",
"publication",
")",
"{",
"try",
"{",
"list",
"(",
"$",
"courses",
",",
"$",
"unused",
")",
"=",
"api",
"::",
"get_courses",
"(",
"''",
",",
"!",
"$",
"publication",
"->",
"enrollable",
","... | Retrieves information about published course
For the list of fields returned for the course see {@link communication::get_courses}
@param stdClass $publication
@return array|null | [
"Retrieves",
"information",
"about",
"published",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/publication.php#L355-L365 |
220,007 | moodle/moodle | lib/classes/hub/publication.php | publication.download_course_backup | public static function download_course_backup($hubcourseid, $coursename) {
global $CFG, $USER;
require_once($CFG->libdir . "/filelib.php");
$backuptempdir = make_backup_temp_directory('');
$filename = md5(time() . '-' . $hubcourseid . '-'. $USER->id . '-'. random_string(20));
$p... | php | public static function download_course_backup($hubcourseid, $coursename) {
global $CFG, $USER;
require_once($CFG->libdir . "/filelib.php");
$backuptempdir = make_backup_temp_directory('');
$filename = md5(time() . '-' . $hubcourseid . '-'. $USER->id . '-'. random_string(20));
$p... | [
"public",
"static",
"function",
"download_course_backup",
"(",
"$",
"hubcourseid",
",",
"$",
"coursename",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"USER",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"\"/filelib.php\"",
")",
";",
"$",
"back... | Downloads course backup and stores it in the user private files
@param int $hubcourseid
@param string $coursename
@return array | [
"Downloads",
"course",
"backup",
"and",
"stores",
"it",
"in",
"the",
"user",
"private",
"files"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/publication.php#L374-L398 |
220,008 | moodle/moodle | mod/forum/classes/local/builders/exported_posts.php | exported_posts.build | public function build(
stdClass $user,
array $forums,
array $discussions,
array $posts
) : array {
// Format the forums and discussion to make them more easily accessed later.
$forums = array_reduce($forums, function($carry, $forum) {
$carry[$forum->get_id... | php | public function build(
stdClass $user,
array $forums,
array $discussions,
array $posts
) : array {
// Format the forums and discussion to make them more easily accessed later.
$forums = array_reduce($forums, function($carry, $forum) {
$carry[$forum->get_id... | [
"public",
"function",
"build",
"(",
"stdClass",
"$",
"user",
",",
"array",
"$",
"forums",
",",
"array",
"$",
"discussions",
",",
"array",
"$",
"posts",
")",
":",
"array",
"{",
"// Format the forums and discussion to make them more easily accessed later.",
"$",
"foru... | Build the exported posts for a given set of forums, discussions, and posts.
This will typically be used for a list of posts in the same discussion/forum however
it does support exporting any arbitrary list of posts as long as the caller also provides
a unique list of all discussions for the list of posts and all forum... | [
"Build",
"the",
"exported",
"posts",
"for",
"a",
"given",
"set",
"of",
"forums",
"discussions",
"and",
"posts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/builders/exported_posts.php#L119-L187 |
220,009 | moodle/moodle | mod/forum/classes/local/builders/exported_posts.php | exported_posts.group_posts_by_discussion | private function group_posts_by_discussion(array $forums, array $discussions, array $posts) : array {
return array_reduce($posts, function($carry, $post) use ($forums, $discussions) {
$discussionid = $post->get_discussion_id();
if (!isset($discussions[$discussionid])) {
t... | php | private function group_posts_by_discussion(array $forums, array $discussions, array $posts) : array {
return array_reduce($posts, function($carry, $post) use ($forums, $discussions) {
$discussionid = $post->get_discussion_id();
if (!isset($discussions[$discussionid])) {
t... | [
"private",
"function",
"group_posts_by_discussion",
"(",
"array",
"$",
"forums",
",",
"array",
"$",
"discussions",
",",
"array",
"$",
"posts",
")",
":",
"array",
"{",
"return",
"array_reduce",
"(",
"$",
"posts",
",",
"function",
"(",
"$",
"carry",
",",
"$"... | Group the posts by which discussion they belong to in order for them to be processed
in chunks by the exporting.
Returns a list of groups where each group has a forum, discussion, and list of posts.
E.g.
[
[
'forum' => <forum_entity>,
'discussion' => <discussion_entity>,
'posts' => [
<post_entity in discussion>,
<post... | [
"Group",
"the",
"posts",
"by",
"which",
"discussion",
"they",
"belong",
"to",
"in",
"order",
"for",
"them",
"to",
"be",
"processed",
"in",
"chunks",
"by",
"the",
"exporting",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/builders/exported_posts.php#L212-L238 |
220,010 | moodle/moodle | mod/forum/classes/local/builders/exported_posts.php | exported_posts.get_attachments_for_posts | private function get_attachments_for_posts(array $groupedposts) : array {
$attachmentsbypostid = [];
$postattachmentvault = $this->vaultfactory->get_post_attachment_vault();
$postsbyforum = array_reduce($groupedposts, function($carry, $grouping) {
['forum' => $forum, 'posts' => $post... | php | private function get_attachments_for_posts(array $groupedposts) : array {
$attachmentsbypostid = [];
$postattachmentvault = $this->vaultfactory->get_post_attachment_vault();
$postsbyforum = array_reduce($groupedposts, function($carry, $grouping) {
['forum' => $forum, 'posts' => $post... | [
"private",
"function",
"get_attachments_for_posts",
"(",
"array",
"$",
"groupedposts",
")",
":",
"array",
"{",
"$",
"attachmentsbypostid",
"=",
"[",
"]",
";",
"$",
"postattachmentvault",
"=",
"$",
"this",
"->",
"vaultfactory",
"->",
"get_post_attachment_vault",
"(... | Load the list of all attachments for the posts. The list of attachments will be
indexed by the post id.
@param array $groupedposts List of posts grouped by discussions.
@return stored_file[] | [
"Load",
"the",
"list",
"of",
"all",
"attachments",
"for",
"the",
"posts",
".",
"The",
"list",
"of",
"attachments",
"will",
"be",
"indexed",
"by",
"the",
"post",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/builders/exported_posts.php#L271-L300 |
220,011 | moodle/moodle | mod/forum/classes/local/builders/exported_posts.php | exported_posts.get_author_groups_from_posts | private function get_author_groups_from_posts(array $groupedposts) : array {
$groupsbyauthorid = [];
$authoridsbycourseid = [];
// Get the unique list of author ids for each course in the grouped
// posts. Grouping by course is the largest grouping we can achieve.
foreach ($grou... | php | private function get_author_groups_from_posts(array $groupedposts) : array {
$groupsbyauthorid = [];
$authoridsbycourseid = [];
// Get the unique list of author ids for each course in the grouped
// posts. Grouping by course is the largest grouping we can achieve.
foreach ($grou... | [
"private",
"function",
"get_author_groups_from_posts",
"(",
"array",
"$",
"groupedposts",
")",
":",
"array",
"{",
"$",
"groupsbyauthorid",
"=",
"[",
"]",
";",
"$",
"authoridsbycourseid",
"=",
"[",
"]",
";",
"// Get the unique list of author ids for each course in the gr... | Get the groups for each author of the given posts.
The results are grouped by course and then author id because the groups are
contextually related to the course, e.g. a single author can be part of two different
sets of groups in two different courses.
@param array $groupedposts List of posts grouped by discussions.... | [
"Get",
"the",
"groups",
"for",
"each",
"author",
"of",
"the",
"given",
"posts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/builders/exported_posts.php#L312-L372 |
220,012 | moodle/moodle | mod/forum/classes/local/builders/exported_posts.php | exported_posts.get_tags_from_posts | private function get_tags_from_posts(array $posts) : array {
$postids = array_map(function($post) {
return $post->get_id();
}, $posts);
return core_tag_tag::get_items_tags('mod_forum', 'forum_posts', $postids);
} | php | private function get_tags_from_posts(array $posts) : array {
$postids = array_map(function($post) {
return $post->get_id();
}, $posts);
return core_tag_tag::get_items_tags('mod_forum', 'forum_posts', $postids);
} | [
"private",
"function",
"get_tags_from_posts",
"(",
"array",
"$",
"posts",
")",
":",
"array",
"{",
"$",
"postids",
"=",
"array_map",
"(",
"function",
"(",
"$",
"post",
")",
"{",
"return",
"$",
"post",
"->",
"get_id",
"(",
")",
";",
"}",
",",
"$",
"pos... | Get the list of tags for each of the posts. The tags will be returned in an
array indexed by the post id.
@param post_entity[] $posts The list of posts to load tags for.
@return array Sets of tags indexed by post id. | [
"Get",
"the",
"list",
"of",
"tags",
"for",
"each",
"of",
"the",
"posts",
".",
"The",
"tags",
"will",
"be",
"returned",
"in",
"an",
"array",
"indexed",
"by",
"the",
"post",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/builders/exported_posts.php#L381-L386 |
220,013 | moodle/moodle | mod/forum/classes/local/builders/exported_posts.php | exported_posts.get_ratings_from_posts | private function get_ratings_from_posts(stdClass $user, array $groupedposts) {
$ratingsbypostid = [];
$postsdatamapper = $this->legacydatamapperfactory->get_post_data_mapper();
$postsbyforum = array_reduce($groupedposts, function($carry, $grouping) {
['forum' => $forum, 'posts' => $p... | php | private function get_ratings_from_posts(stdClass $user, array $groupedposts) {
$ratingsbypostid = [];
$postsdatamapper = $this->legacydatamapperfactory->get_post_data_mapper();
$postsbyforum = array_reduce($groupedposts, function($carry, $grouping) {
['forum' => $forum, 'posts' => $p... | [
"private",
"function",
"get_ratings_from_posts",
"(",
"stdClass",
"$",
"user",
",",
"array",
"$",
"groupedposts",
")",
"{",
"$",
"ratingsbypostid",
"=",
"[",
"]",
";",
"$",
"postsdatamapper",
"=",
"$",
"this",
"->",
"legacydatamapperfactory",
"->",
"get_post_dat... | Get the list of ratings for each post. The ratings are returned in an array
indexed by the post id.
@param stdClass $user The user viewing the ratings.
@param array $groupedposts List of posts grouped by discussions.
@return array Sets of ratings indexed by post id. | [
"Get",
"the",
"list",
"of",
"ratings",
"for",
"each",
"post",
".",
"The",
"ratings",
"are",
"returned",
"in",
"an",
"array",
"indexed",
"by",
"the",
"post",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/builders/exported_posts.php#L396-L443 |
220,014 | moodle/moodle | mod/forum/classes/local/builders/exported_posts.php | exported_posts.get_read_receipts_from_posts | private function get_read_receipts_from_posts(stdClass $user, array $groupedposts) {
$forumdatamapper = $this->legacydatamapperfactory->get_forum_data_mapper();
$trackedforums = [];
$trackedpostids = [];
foreach ($groupedposts as $group) {
['forum' => $forum, 'posts' => $pos... | php | private function get_read_receipts_from_posts(stdClass $user, array $groupedposts) {
$forumdatamapper = $this->legacydatamapperfactory->get_forum_data_mapper();
$trackedforums = [];
$trackedpostids = [];
foreach ($groupedposts as $group) {
['forum' => $forum, 'posts' => $pos... | [
"private",
"function",
"get_read_receipts_from_posts",
"(",
"stdClass",
"$",
"user",
",",
"array",
"$",
"groupedposts",
")",
"{",
"$",
"forumdatamapper",
"=",
"$",
"this",
"->",
"legacydatamapperfactory",
"->",
"get_forum_data_mapper",
"(",
")",
";",
"$",
"tracked... | Get the read receipt collections for the given viewing user and each forum. The
receipt collections will only be loaded for posts in forums that the user is tracking.
The receipt collections are returned in an array indexed by the forum ids.
@param stdClass $user The user viewing the posts.
@param array $groupedposts... | [
"Get",
"the",
"read",
"receipt",
"collections",
"for",
"the",
"given",
"viewing",
"user",
"and",
"each",
"forum",
".",
"The",
"receipt",
"collections",
"will",
"only",
"be",
"loaded",
"for",
"posts",
"in",
"forums",
"that",
"the",
"user",
"is",
"tracking",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/builders/exported_posts.php#L454-L492 |
220,015 | moodle/moodle | mod/forum/classes/local/builders/exported_posts.php | exported_posts.sort_exported_posts | private function sort_exported_posts(array $posts, array $exportedposts) {
$postindexes = [];
foreach (array_values($posts) as $index => $post) {
$postindexes[$post->get_id()] = $index;
}
$sortedexportedposts = [];
foreach ($exportedposts as $exportedpost) {
... | php | private function sort_exported_posts(array $posts, array $exportedposts) {
$postindexes = [];
foreach (array_values($posts) as $index => $post) {
$postindexes[$post->get_id()] = $index;
}
$sortedexportedposts = [];
foreach ($exportedposts as $exportedpost) {
... | [
"private",
"function",
"sort_exported_posts",
"(",
"array",
"$",
"posts",
",",
"array",
"$",
"exportedposts",
")",
"{",
"$",
"postindexes",
"=",
"[",
"]",
";",
"foreach",
"(",
"array_values",
"(",
"$",
"posts",
")",
"as",
"$",
"index",
"=>",
"$",
"post",... | Sort the list of exported posts back into the same order as the given posts.
The ordering of the exported posts can often deviate from the given posts due
to the process of exporting them so we need to sort them back into the order
that the calling code expected.
@param post_entity[] $posts The posts in the expected o... | [
"Sort",
"the",
"list",
"of",
"exported",
"posts",
"back",
"into",
"the",
"same",
"order",
"as",
"the",
"given",
"posts",
".",
"The",
"ordering",
"of",
"the",
"exported",
"posts",
"can",
"often",
"deviate",
"from",
"the",
"given",
"posts",
"due",
"to",
"t... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/builders/exported_posts.php#L504-L518 |
220,016 | moodle/moodle | lib/phpexcel/PHPExcel/Reader/Excel5/Escher.php | PHPExcel_Reader_Excel5_Escher.readSplitMenuColors | private function readSplitMenuColors()
{
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record
$this->pos += 8 + $length;
} | php | private function readSplitMenuColors()
{
$length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record
$this->pos += 8 + $length;
} | [
"private",
"function",
"readSplitMenuColors",
"(",
")",
"{",
"$",
"length",
"=",
"PHPExcel_Reader_Excel5",
"::",
"getInt4d",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"this",
"->",
"pos",
"+",
"4",
")",
";",
"$",
"recordData",
"=",
"substr",
"(",
"$",
... | Read SplitMenuColors record | [
"Read",
"SplitMenuColors",
"record"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Reader/Excel5/Escher.php#L426-L433 |
220,017 | moodle/moodle | mod/workshop/form/accumulative/backup/moodle1/lib.php | moodle1_workshopform_accumulative_handler.get_new_scale_definition | private function get_new_scale_definition($oldscaleid) {
$data = array(
'userid' => 0, // restore will remap to the current user
'courseid' => 0, // global scale
'description' => '',
'descriptionformat' => FORMAT_HTML,
);
... | php | private function get_new_scale_definition($oldscaleid) {
$data = array(
'userid' => 0, // restore will remap to the current user
'courseid' => 0, // global scale
'description' => '',
'descriptionformat' => FORMAT_HTML,
);
... | [
"private",
"function",
"get_new_scale_definition",
"(",
"$",
"oldscaleid",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'userid'",
"=>",
"0",
",",
"// restore will remap to the current user",
"'courseid'",
"=>",
"0",
",",
"// global scale",
"'description'",
"=>",
"''"... | Returns a definition of a legacy workshop scale
@see workshopform_accumulative_upgrade_scales
@param object $oldscaleid
@return array | [
"Returns",
"a",
"definition",
"of",
"a",
"legacy",
"workshop",
"scale"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/form/accumulative/backup/moodle1/lib.php#L111-L169 |
220,018 | moodle/moodle | customfield/externallib.php | core_customfield_external.delete_field | public static function delete_field($id) {
$params = self::validate_parameters(self::delete_field_parameters(), ['id' => $id]);
$record = \core_customfield\field_controller::create($params['id']);
$handler = $record->get_handler();
if (!$handler->can_configure()) {
throw new... | php | public static function delete_field($id) {
$params = self::validate_parameters(self::delete_field_parameters(), ['id' => $id]);
$record = \core_customfield\field_controller::create($params['id']);
$handler = $record->get_handler();
if (!$handler->can_configure()) {
throw new... | [
"public",
"static",
"function",
"delete_field",
"(",
"$",
"id",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"delete_field_parameters",
"(",
")",
",",
"[",
"'id'",
"=>",
"$",
"id",
"]",
")",
";",
"$",
"record",
... | Delete custom field function
@param int $id | [
"Delete",
"custom",
"field",
"function"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/externallib.php#L53-L62 |
220,019 | moodle/moodle | customfield/externallib.php | core_customfield_external.reload_template_parameters | public static function reload_template_parameters() {
return new external_function_parameters(
array(
'component' => new external_value(PARAM_COMPONENT, 'component', VALUE_REQUIRED),
'area' => new external_value(PARAM_ALPHANUMEXT, 'area', VALUE_REQUIRED),
... | php | public static function reload_template_parameters() {
return new external_function_parameters(
array(
'component' => new external_value(PARAM_COMPONENT, 'component', VALUE_REQUIRED),
'area' => new external_value(PARAM_ALPHANUMEXT, 'area', VALUE_REQUIRED),
... | [
"public",
"static",
"function",
"reload_template_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'component'",
"=>",
"new",
"external_value",
"(",
"PARAM_COMPONENT",
",",
"'component'",
",",
"VALUE_REQUIRED",
")",
",",
... | Parameters for reload template function
@return external_function_parameters | [
"Parameters",
"for",
"reload",
"template",
"function"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/externallib.php#L75-L83 |
220,020 | moodle/moodle | customfield/externallib.php | core_customfield_external.reload_template | public static function reload_template($component, $area, $itemid) {
global $PAGE;
$params = self::validate_parameters(self::reload_template_parameters(),
['component' => $component, 'area' => $area, 'itemid' => $itemid]);
$PAGE->set_context(context_system::instance());
... | php | public static function reload_template($component, $area, $itemid) {
global $PAGE;
$params = self::validate_parameters(self::reload_template_parameters(),
['component' => $component, 'area' => $area, 'itemid' => $itemid]);
$PAGE->set_context(context_system::instance());
... | [
"public",
"static",
"function",
"reload_template",
"(",
"$",
"component",
",",
"$",
"area",
",",
"$",
"itemid",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"reload_template_parameters",
"(... | Reload template function
@param string $component
@param string $area
@param int $itemid
@return array|object|stdClass | [
"Reload",
"template",
"function"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/externallib.php#L93-L108 |
220,021 | moodle/moodle | customfield/externallib.php | core_customfield_external.reload_template_returns | public static function reload_template_returns() {
return new external_single_structure(
array(
'component' => new external_value(PARAM_COMPONENT, 'component'),
'area' => new external_value(PARAM_ALPHANUMEXT, 'area'),
'itemid' => new external_value(PAR... | php | public static function reload_template_returns() {
return new external_single_structure(
array(
'component' => new external_value(PARAM_COMPONENT, 'component'),
'area' => new external_value(PARAM_ALPHANUMEXT, 'area'),
'itemid' => new external_value(PAR... | [
"public",
"static",
"function",
"reload_template_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'component'",
"=>",
"new",
"external_value",
"(",
"PARAM_COMPONENT",
",",
"'component'",
")",
",",
"'area'",
"=>",
"new",
"e... | Ajax returns on reload template.
@return external_single_structure | [
"Ajax",
"returns",
"on",
"reload",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/externallib.php#L115-L144 |
220,022 | moodle/moodle | customfield/externallib.php | core_customfield_external.delete_category | public static function delete_category($id) {
$category = core_customfield\category_controller::create($id);
$handler = $category->get_handler();
self::validate_context($handler->get_configuration_context());
if (!$handler->can_configure()) {
throw new moodle_exception('noper... | php | public static function delete_category($id) {
$category = core_customfield\category_controller::create($id);
$handler = $category->get_handler();
self::validate_context($handler->get_configuration_context());
if (!$handler->can_configure()) {
throw new moodle_exception('noper... | [
"public",
"static",
"function",
"delete_category",
"(",
"$",
"id",
")",
"{",
"$",
"category",
"=",
"core_customfield",
"\\",
"category_controller",
"::",
"create",
"(",
"$",
"id",
")",
";",
"$",
"handler",
"=",
"$",
"category",
"->",
"get_handler",
"(",
")... | Delete category function
@param int $id | [
"Delete",
"category",
"function"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/externallib.php#L162-L170 |
220,023 | moodle/moodle | customfield/externallib.php | core_customfield_external.create_category_parameters | public static function create_category_parameters() {
return new external_function_parameters(
array(
'component' => new external_value(PARAM_COMPONENT, 'component', VALUE_REQUIRED),
'area' => new external_value(PARAM_ALPHANUMEXT, 'area', VALUE_REQUIRED),
... | php | public static function create_category_parameters() {
return new external_function_parameters(
array(
'component' => new external_value(PARAM_COMPONENT, 'component', VALUE_REQUIRED),
'area' => new external_value(PARAM_ALPHANUMEXT, 'area', VALUE_REQUIRED),
... | [
"public",
"static",
"function",
"create_category_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'component'",
"=>",
"new",
"external_value",
"(",
"PARAM_COMPONENT",
",",
"'component'",
",",
"VALUE_REQUIRED",
")",
",",
... | Parameters for create category
@return external_function_parameters | [
"Parameters",
"for",
"create",
"category"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/externallib.php#L184-L192 |
220,024 | moodle/moodle | customfield/externallib.php | core_customfield_external.create_category | public static function create_category($component, $area, $itemid) {
$params = self::validate_parameters(self::create_category_parameters(),
['component' => $component, 'area' => $area, 'itemid' => $itemid]);
$handler = \core_customfield\handler::get_handler($params['component'], $params['a... | php | public static function create_category($component, $area, $itemid) {
$params = self::validate_parameters(self::create_category_parameters(),
['component' => $component, 'area' => $area, 'itemid' => $itemid]);
$handler = \core_customfield\handler::get_handler($params['component'], $params['a... | [
"public",
"static",
"function",
"create_category",
"(",
"$",
"component",
",",
"$",
"area",
",",
"$",
"itemid",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"create_category_parameters",
"(",
")",
",",
"[",
"'componen... | Create category function
@param string $component
@param string $area
@param int $itemid
@return mixed | [
"Create",
"category",
"function"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/externallib.php#L202-L212 |
220,025 | moodle/moodle | customfield/externallib.php | core_customfield_external.move_field_parameters | public static function move_field_parameters() {
return new external_function_parameters(
['id' => new external_value(PARAM_INT, 'Id of the field to move', VALUE_REQUIRED),
'categoryid' => new external_value(PARAM_INT, 'New parent category id', VALUE_REQUIRED),
... | php | public static function move_field_parameters() {
return new external_function_parameters(
['id' => new external_value(PARAM_INT, 'Id of the field to move', VALUE_REQUIRED),
'categoryid' => new external_value(PARAM_INT, 'New parent category id', VALUE_REQUIRED),
... | [
"public",
"static",
"function",
"move_field_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"[",
"'id'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'Id of the field to move'",
",",
"VALUE_REQUIRED",
")",
",",
"'categoryid'... | Parameters for move field.
@return external_function_parameters | [
"Parameters",
"for",
"move",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/externallib.php#L226-L233 |
220,026 | moodle/moodle | customfield/externallib.php | core_customfield_external.move_category | public static function move_category(int $id, int $beforeid) {
$params = self::validate_parameters(self::move_category_parameters(),
['id' => $id, 'beforeid' => $beforeid]);
$category = core_customfield\category_controller::create($id);
$handler = $category->get_handler();
se... | php | public static function move_category(int $id, int $beforeid) {
$params = self::validate_parameters(self::move_category_parameters(),
['id' => $id, 'beforeid' => $beforeid]);
$category = core_customfield\category_controller::create($id);
$handler = $category->get_handler();
se... | [
"public",
"static",
"function",
"move_category",
"(",
"int",
"$",
"id",
",",
"int",
"$",
"beforeid",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"move_category_parameters",
"(",
")",
",",
"[",
"'id'",
"=>",
"$",
... | Reorder categories. Move category to the new position
@param int $id category id
@param int $beforeid | [
"Reorder",
"categories",
".",
"Move",
"category",
"to",
"the",
"new",
"position"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/externallib.php#L279-L289 |
220,027 | moodle/moodle | grade/grading/form/rubric/lib.php | gradingform_rubric_controller.update_definition | public function update_definition(stdClass $newdefinition, $usermodified = null) {
$this->update_or_check_rubric($newdefinition, $usermodified, true);
if (isset($newdefinition->rubric['regrade']) && $newdefinition->rubric['regrade']) {
$this->mark_for_regrade();
}
} | php | public function update_definition(stdClass $newdefinition, $usermodified = null) {
$this->update_or_check_rubric($newdefinition, $usermodified, true);
if (isset($newdefinition->rubric['regrade']) && $newdefinition->rubric['regrade']) {
$this->mark_for_regrade();
}
} | [
"public",
"function",
"update_definition",
"(",
"stdClass",
"$",
"newdefinition",
",",
"$",
"usermodified",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"update_or_check_rubric",
"(",
"$",
"newdefinition",
",",
"$",
"usermodified",
",",
"true",
")",
";",
"if",
... | Saves the rubric definition into the database
@see parent::update_definition()
@param stdClass $newdefinition rubric definition data as coming from gradingform_rubric_editrubric::get_data()
@param int|null $usermodified optional userid of the author of the definition, defaults to the current user | [
"Saves",
"the",
"rubric",
"definition",
"into",
"the",
"database"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/rubric/lib.php#L99-L104 |
220,028 | moodle/moodle | grade/grading/form/rubric/lib.php | gradingform_rubric_controller.load_definition | protected function load_definition() {
global $DB;
$sql = "SELECT gd.*,
rc.id AS rcid, rc.sortorder AS rcsortorder, rc.description AS rcdescription, rc.descriptionformat AS rcdescriptionformat,
rl.id AS rlid, rl.score AS rlscore, rl.definition AS rldefinitio... | php | protected function load_definition() {
global $DB;
$sql = "SELECT gd.*,
rc.id AS rcid, rc.sortorder AS rcsortorder, rc.description AS rcdescription, rc.descriptionformat AS rcdescriptionformat,
rl.id AS rlid, rl.score AS rlscore, rl.definition AS rldefinitio... | [
"protected",
"function",
"load_definition",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT gd.*,\n rc.id AS rcid, rc.sortorder AS rcsortorder, rc.description AS rcdescription, rc.descriptionformat AS rcdescriptionformat,\n rl... | Loads the rubric form definition if it exists
There is a new array called 'rubric_criteria' appended to the list of parent's definition properties. | [
"Loads",
"the",
"rubric",
"form",
"definition",
"if",
"it",
"exists"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/rubric/lib.php#L303-L352 |
220,029 | moodle/moodle | grade/grading/form/rubric/lib.php | gradingform_rubric_controller.get_options | public function get_options() {
$options = self::get_default_options();
if (!empty($this->definition->options)) {
$thisoptions = json_decode($this->definition->options);
foreach ($thisoptions as $option => $value) {
$options[$option] = $value;
}
... | php | public function get_options() {
$options = self::get_default_options();
if (!empty($this->definition->options)) {
$thisoptions = json_decode($this->definition->options);
foreach ($thisoptions as $option => $value) {
$options[$option] = $value;
}
... | [
"public",
"function",
"get_options",
"(",
")",
"{",
"$",
"options",
"=",
"self",
"::",
"get_default_options",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"definition",
"->",
"options",
")",
")",
"{",
"$",
"thisoptions",
"=",
"json_d... | Gets the options of this rubric definition, fills the missing options with default values
The only exception is 'lockzeropoints' - if other options are present in the json string but this
one is absent, this means that the rubric was created before Moodle 3.2 and the 0 value should be used.
@return array | [
"Gets",
"the",
"options",
"of",
"this",
"rubric",
"definition",
"fills",
"the",
"missing",
"options",
"with",
"default",
"values"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/rubric/lib.php#L382-L396 |
220,030 | moodle/moodle | grade/grading/form/rubric/lib.php | gradingform_rubric_instance.clear_attempt | public function clear_attempt($data) {
global $DB;
foreach ($data['criteria'] as $criterionid => $record) {
$DB->delete_records('gradingform_rubric_fillings',
array('criterionid' => $criterionid, 'instanceid' => $this->get_id()));
}
} | php | public function clear_attempt($data) {
global $DB;
foreach ($data['criteria'] as $criterionid => $record) {
$DB->delete_records('gradingform_rubric_fillings',
array('criterionid' => $criterionid, 'instanceid' => $this->get_id()));
}
} | [
"public",
"function",
"clear_attempt",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"foreach",
"(",
"$",
"data",
"[",
"'criteria'",
"]",
"as",
"$",
"criterionid",
"=>",
"$",
"record",
")",
"{",
"$",
"DB",
"->",
"delete_records",
"(",
"'grading... | Removes the attempt from the gradingform_guide_fillings table
@param array $data the attempt data | [
"Removes",
"the",
"attempt",
"from",
"the",
"gradingform_guide_fillings",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/rubric/lib.php#L798-L805 |
220,031 | moodle/moodle | grade/grading/form/rubric/lib.php | gradingform_rubric_instance.validate_grading_element | public function validate_grading_element($elementvalue) {
$criteria = $this->get_controller()->get_definition()->rubric_criteria;
if (!isset($elementvalue['criteria']) || !is_array($elementvalue['criteria']) || sizeof($elementvalue['criteria']) < sizeof($criteria)) {
return false;
}
... | php | public function validate_grading_element($elementvalue) {
$criteria = $this->get_controller()->get_definition()->rubric_criteria;
if (!isset($elementvalue['criteria']) || !is_array($elementvalue['criteria']) || sizeof($elementvalue['criteria']) < sizeof($criteria)) {
return false;
}
... | [
"public",
"function",
"validate_grading_element",
"(",
"$",
"elementvalue",
")",
"{",
"$",
"criteria",
"=",
"$",
"this",
"->",
"get_controller",
"(",
")",
"->",
"get_definition",
"(",
")",
"->",
"rubric_criteria",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"e... | Validates that rubric is fully completed and contains valid grade on each criterion
@param array $elementvalue value of element as came in form submit
@return boolean true if the form data is validated and contains no errors | [
"Validates",
"that",
"rubric",
"is",
"fully",
"completed",
"and",
"contains",
"valid",
"grade",
"on",
"each",
"criterion"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/rubric/lib.php#L813-L825 |
220,032 | moodle/moodle | grade/grading/form/rubric/lib.php | gradingform_rubric_instance.get_rubric_filling | public function get_rubric_filling($force = false) {
global $DB;
if ($this->rubric === null || $force) {
$records = $DB->get_records('gradingform_rubric_fillings', array('instanceid' => $this->get_id()));
$this->rubric = array('criteria' => array());
foreach ($records... | php | public function get_rubric_filling($force = false) {
global $DB;
if ($this->rubric === null || $force) {
$records = $DB->get_records('gradingform_rubric_fillings', array('instanceid' => $this->get_id()));
$this->rubric = array('criteria' => array());
foreach ($records... | [
"public",
"function",
"get_rubric_filling",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"rubric",
"===",
"null",
"||",
"$",
"force",
")",
"{",
"$",
"records",
"=",
"$",
"DB",
"->",
"get_records",... | Retrieves from DB and returns the data how this rubric was filled
@param boolean $force whether to force DB query even if the data is cached
@return array | [
"Retrieves",
"from",
"DB",
"and",
"returns",
"the",
"data",
"how",
"this",
"rubric",
"was",
"filled"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/rubric/lib.php#L833-L843 |
220,033 | moodle/moodle | completion/classes/manager.php | manager.get_completion_detail | private function get_completion_detail($mod) {
global $OUTPUT;
$strings = [];
switch ($mod->completion) {
case COMPLETION_TRACKING_NONE:
$strings['string'] = get_string('none');
break;
case COMPLETION_TRACKING_MANUAL:
$stri... | php | private function get_completion_detail($mod) {
global $OUTPUT;
$strings = [];
switch ($mod->completion) {
case COMPLETION_TRACKING_NONE:
$strings['string'] = get_string('none');
break;
case COMPLETION_TRACKING_MANUAL:
$stri... | [
"private",
"function",
"get_completion_detail",
"(",
"$",
"mod",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"strings",
"=",
"[",
"]",
";",
"switch",
"(",
"$",
"mod",
"->",
"completion",
")",
"{",
"case",
"COMPLETION_TRACKING_NONE",
":",
"$",
"strings",
... | Get completion information on the selected module or module type
@param cm_info|stdClass $mod either instance of cm_info (with 'customcompletionrules' in customdata) or
object with fields ->completion, ->completionview, ->completionexpected, ->completionusegrade
and ->customdata['customcompletionrules']
@return array | [
"Get",
"completion",
"information",
"on",
"the",
"selected",
"module",
"or",
"module",
"type"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/classes/manager.php#L129-L159 |
220,034 | moodle/moodle | completion/classes/manager.php | manager.get_completion_active_rule_descriptions | protected function get_completion_active_rule_descriptions($moduledata) {
$activeruledescriptions = [];
if ($moduledata->completion == COMPLETION_TRACKING_AUTOMATIC) {
// Generate the description strings for the core conditional completion rules (if set).
if (!empty($moduledata-... | php | protected function get_completion_active_rule_descriptions($moduledata) {
$activeruledescriptions = [];
if ($moduledata->completion == COMPLETION_TRACKING_AUTOMATIC) {
// Generate the description strings for the core conditional completion rules (if set).
if (!empty($moduledata-... | [
"protected",
"function",
"get_completion_active_rule_descriptions",
"(",
"$",
"moduledata",
")",
"{",
"$",
"activeruledescriptions",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"moduledata",
"->",
"completion",
"==",
"COMPLETION_TRACKING_AUTOMATIC",
")",
"{",
"// Generate the... | Get the descriptions for all active conditional completion rules for the current module.
@param cm_info|stdClass $moduledata either instance of cm_info (with 'customcompletionrules' in customdata) or
object with fields ->completion, ->completionview, ->completionexpected, ->completionusegrade
and ->customdata['customc... | [
"Get",
"the",
"descriptions",
"for",
"all",
"active",
"conditional",
"completion",
"rules",
"for",
"the",
"current",
"module",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/classes/manager.php#L169-L197 |
220,035 | moodle/moodle | completion/classes/manager.php | manager.get_activities_and_resources | public function get_activities_and_resources() {
global $DB, $OUTPUT, $CFG;
require_once($CFG->dirroot.'/course/lib.php');
// Get enabled activities and resources.
$modules = $DB->get_records('modules', ['visible' => 1], 'name ASC');
$data = new stdClass();
$data->course... | php | public function get_activities_and_resources() {
global $DB, $OUTPUT, $CFG;
require_once($CFG->dirroot.'/course/lib.php');
// Get enabled activities and resources.
$modules = $DB->get_records('modules', ['visible' => 1], 'name ASC');
$data = new stdClass();
$data->course... | [
"public",
"function",
"get_activities_and_resources",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"OUTPUT",
",",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/course/lib.php'",
")",
";",
"// Get enabled activities and resources.",
... | Gets the course modules for the current course.
@return stdClass $data containing the modules | [
"Gets",
"the",
"course",
"modules",
"for",
"the",
"current",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/classes/manager.php#L204-L230 |
220,036 | moodle/moodle | completion/classes/manager.php | manager.can_edit_bulk_completion | public static function can_edit_bulk_completion($courseorid, $cm = null) {
if ($cm) {
return $cm->uservisible && has_capability('moodle/course:manageactivities', $cm->context);
}
$coursecontext = context_course::instance(is_object($courseorid) ? $courseorid->id : $courseorid);
... | php | public static function can_edit_bulk_completion($courseorid, $cm = null) {
if ($cm) {
return $cm->uservisible && has_capability('moodle/course:manageactivities', $cm->context);
}
$coursecontext = context_course::instance(is_object($courseorid) ? $courseorid->id : $courseorid);
... | [
"public",
"static",
"function",
"can_edit_bulk_completion",
"(",
"$",
"courseorid",
",",
"$",
"cm",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"cm",
")",
"{",
"return",
"$",
"cm",
"->",
"uservisible",
"&&",
"has_capability",
"(",
"'moodle/course:manageactivities'"... | Checks if current user can edit activity completion
@param int|stdClass $courseorid
@param \cm_info|null $cm if specified capability for a given coursemodule will be check,
if not specified capability to edit at least one activity is checked. | [
"Checks",
"if",
"current",
"user",
"can",
"edit",
"activity",
"completion"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/classes/manager.php#L239-L254 |
220,037 | moodle/moodle | completion/classes/manager.php | manager.get_available_completion_tabs | public static function get_available_completion_tabs($courseorid) {
$tabs = [];
$courseid = is_object($courseorid) ? $courseorid->id : $courseorid;
$coursecontext = context_course::instance($courseid);
if (has_capability('moodle/course:update', $coursecontext)) {
$tabs[] = ... | php | public static function get_available_completion_tabs($courseorid) {
$tabs = [];
$courseid = is_object($courseorid) ? $courseorid->id : $courseorid;
$coursecontext = context_course::instance($courseid);
if (has_capability('moodle/course:update', $coursecontext)) {
$tabs[] = ... | [
"public",
"static",
"function",
"get_available_completion_tabs",
"(",
"$",
"courseorid",
")",
"{",
"$",
"tabs",
"=",
"[",
"]",
";",
"$",
"courseid",
"=",
"is_object",
"(",
"$",
"courseorid",
")",
"?",
"$",
"courseorid",
"->",
"id",
":",
"$",
"courseorid",
... | Gets the available completion tabs for the current course and user.
@param stdClass|int $courseorid the course object or id.
@return tabobject[] | [
"Gets",
"the",
"available",
"completion",
"tabs",
"for",
"the",
"current",
"course",
"and",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/classes/manager.php#L262-L293 |
220,038 | moodle/moodle | completion/classes/manager.php | manager.apply_completion | public function apply_completion($data, $updateinstances) {
$updated = false;
$needreset = [];
$modinfo = get_fast_modinfo($this->courseid);
$cmids = $data->cmid;
$data = (array)$data;
unset($data['id']); // This is a course id, we don't want to confuse it with cmid or ... | php | public function apply_completion($data, $updateinstances) {
$updated = false;
$needreset = [];
$modinfo = get_fast_modinfo($this->courseid);
$cmids = $data->cmid;
$data = (array)$data;
unset($data['id']); // This is a course id, we don't want to confuse it with cmid or ... | [
"public",
"function",
"apply_completion",
"(",
"$",
"data",
",",
"$",
"updateinstances",
")",
"{",
"$",
"updated",
"=",
"false",
";",
"$",
"needreset",
"=",
"[",
"]",
";",
"$",
"modinfo",
"=",
"get_fast_modinfo",
"(",
"$",
"this",
"->",
"courseid",
")",
... | Applies completion from the bulk edit form to all selected modules
@param stdClass $data data received from the core_completion_bulkedit_form
@param bool $updateinstances if we need to update the instance tables of the module (i.e. 'assign', 'forum', etc.) -
if no module-specific completion rules were added to the for... | [
"Applies",
"completion",
"from",
"the",
"bulk",
"edit",
"form",
"to",
"all",
"selected",
"modules"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/classes/manager.php#L302-L340 |
220,039 | moodle/moodle | completion/classes/manager.php | manager.apply_completion_cm | protected function apply_completion_cm(\cm_info $cm, $data, $updateinstance) {
global $DB;
$defaults = ['completion' => COMPLETION_DISABLED, 'completionview' => COMPLETION_VIEW_NOT_REQUIRED,
'completionexpected' => 0, 'completiongradeitemnumber' => null];
$data += ['completion' => ... | php | protected function apply_completion_cm(\cm_info $cm, $data, $updateinstance) {
global $DB;
$defaults = ['completion' => COMPLETION_DISABLED, 'completionview' => COMPLETION_VIEW_NOT_REQUIRED,
'completionexpected' => 0, 'completiongradeitemnumber' => null];
$data += ['completion' => ... | [
"protected",
"function",
"apply_completion_cm",
"(",
"\\",
"cm_info",
"$",
"cm",
",",
"$",
"data",
",",
"$",
"updateinstance",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"defaults",
"=",
"[",
"'completion'",
"=>",
"COMPLETION_DISABLED",
",",
"'completionview'",
... | Applies new completion rules to one course module
@param \cm_info $cm
@param array $data
@param bool $updateinstance if we need to update the instance table of the module (i.e. 'assign', 'forum', etc.) -
if no module-specific completion rules were added to the form, update of the module table is not needed.
@return bo... | [
"Applies",
"new",
"completion",
"rules",
"to",
"one",
"course",
"module"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/classes/manager.php#L351-L394 |
220,040 | moodle/moodle | completion/classes/manager.php | manager.apply_default_completion | public function apply_default_completion($data, $updatecustomrules) {
global $DB;
$courseid = $data->id;
$coursecontext = context_course::instance($courseid);
if (!$modids = $data->modids) {
return;
}
$defaults = [
'completion' => COMPLETION_DISAB... | php | public function apply_default_completion($data, $updatecustomrules) {
global $DB;
$courseid = $data->id;
$coursecontext = context_course::instance($courseid);
if (!$modids = $data->modids) {
return;
}
$defaults = [
'completion' => COMPLETION_DISAB... | [
"public",
"function",
"apply_default_completion",
"(",
"$",
"data",
",",
"$",
"updatecustomrules",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"courseid",
"=",
"$",
"data",
"->",
"id",
";",
"$",
"coursecontext",
"=",
"context_course",
"::",
"instance",
"(",
"... | Saves default completion from edit form to all selected module types
@param stdClass $data data received from the core_completion_bulkedit_form
@param bool $updatecustomrules if we need to update the custom rules of the module -
if no module-specific completion rules were added to the form, update of the module table ... | [
"Saves",
"default",
"completion",
"from",
"edit",
"form",
"to",
"all",
"selected",
"module",
"types"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/classes/manager.php#L404-L459 |
220,041 | moodle/moodle | completion/classes/manager.php | manager.get_default_completion | public static function get_default_completion($course, $module, $flatten = true) {
global $DB, $CFG;
if ($data = $DB->get_record('course_completion_defaults', ['course' => $course->id, 'module' => $module->id],
'completion, completionview, completionexpected, completionusegrade, customrules'... | php | public static function get_default_completion($course, $module, $flatten = true) {
global $DB, $CFG;
if ($data = $DB->get_record('course_completion_defaults', ['course' => $course->id, 'module' => $module->id],
'completion, completionview, completionexpected, completionusegrade, customrules'... | [
"public",
"static",
"function",
"get_default_completion",
"(",
"$",
"course",
",",
"$",
"module",
",",
"$",
"flatten",
"=",
"true",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"if",
"(",
"$",
"data",
"=",
"$",
"DB",
"->",
"get_record",
"(",
... | Returns default completion rules for given module type in the given course
@param stdClass $course
@param stdClass $module
@param bool $flatten if true all module custom completion rules become properties of the same object,
otherwise they can be found as array in ->customdata['customcompletionrules']
@return stdClass | [
"Returns",
"default",
"completion",
"rules",
"for",
"given",
"module",
"type",
"in",
"the",
"given",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/classes/manager.php#L470-L496 |
220,042 | moodle/moodle | mod/assign/feedback/comments/backup/moodle2/restore_assignfeedback_comments_subplugin.class.php | restore_assignfeedback_comments_subplugin.process_assignfeedback_comments_grade | public function process_assignfeedback_comments_grade($data) {
global $DB;
$data = (object)$data;
$data->assignment = $this->get_new_parentid('assign');
$oldgradeid = $data->grade;
// The mapping is set in the restore for the core assign activity
// when a grade node is ... | php | public function process_assignfeedback_comments_grade($data) {
global $DB;
$data = (object)$data;
$data->assignment = $this->get_new_parentid('assign');
$oldgradeid = $data->grade;
// The mapping is set in the restore for the core assign activity
// when a grade node is ... | [
"public",
"function",
"process_assignfeedback_comments_grade",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"(",
"object",
")",
"$",
"data",
";",
"$",
"data",
"->",
"assignment",
"=",
"$",
"this",
"->",
"get_new_parentid",
"(",
... | Processes one feedback_comments element.
@param mixed $data | [
"Processes",
"one",
"feedback_comments",
"element",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/comments/backup/moodle2/restore_assignfeedback_comments_subplugin.class.php#L63-L82 |
220,043 | moodle/moodle | auth/cas/CAS/CAS/ProxiedService/Http/Abstract.php | CAS_ProxiedService_Http_Abstract.setUrl | public function setUrl($url)
{
if ($this->hasBeenSent()) {
throw new CAS_OutOfSequenceException(
'Cannot set the URL, request already sent.'
);
}
if (!is_string($url)) {
throw new CAS_InvalidArgumentException('$url must be a string.');
... | php | public function setUrl($url)
{
if ($this->hasBeenSent()) {
throw new CAS_OutOfSequenceException(
'Cannot set the URL, request already sent.'
);
}
if (!is_string($url)) {
throw new CAS_InvalidArgumentException('$url must be a string.');
... | [
"public",
"function",
"setUrl",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasBeenSent",
"(",
")",
")",
"{",
"throw",
"new",
"CAS_OutOfSequenceException",
"(",
"'Cannot set the URL, request already sent.'",
")",
";",
"}",
"if",
"(",
"!",
"is_s... | Set the URL of the Request
@param string $url url to set
@return void
@throws CAS_OutOfSequenceException If called after the Request has been sent. | [
"Set",
"the",
"URL",
"of",
"the",
"Request"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/ProxiedService/Http/Abstract.php#L108-L120 |
220,044 | moodle/moodle | auth/cas/CAS/CAS/ProxiedService/Http/Abstract.php | CAS_ProxiedService_Http_Abstract.makeRequest | protected function makeRequest($url)
{
// Verify that we are not in a redirect loop
$this->_numRequests++;
if ($this->_numRequests > 4) {
$message = 'Exceeded the maximum number of redirects (3) in proxied service request.';
phpCAS::trace($message);
throw ... | php | protected function makeRequest($url)
{
// Verify that we are not in a redirect loop
$this->_numRequests++;
if ($this->_numRequests > 4) {
$message = 'Exceeded the maximum number of redirects (3) in proxied service request.';
phpCAS::trace($message);
throw ... | [
"protected",
"function",
"makeRequest",
"(",
"$",
"url",
")",
"{",
"// Verify that we are not in a redirect loop",
"$",
"this",
"->",
"_numRequests",
"++",
";",
"if",
"(",
"$",
"this",
"->",
"_numRequests",
">",
"4",
")",
"{",
"$",
"message",
"=",
"'Exceeded t... | Build and perform a request, following redirects
@param string $url url for the request
@return void
@throws CAS_ProxyTicketException If there is a proxy-ticket failure.
The code of the Exception will be one of:
PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE
PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE
PHPCAS_SERVICE_PT_FAILURE
@thro... | [
"Build",
"and",
"perform",
"a",
"request",
"following",
"redirects"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/ProxiedService/Http/Abstract.php#L208-L251 |
220,045 | moodle/moodle | auth/cas/CAS/CAS/ProxiedService/Http/Abstract.php | CAS_ProxiedService_Http_Abstract.getRedirectUrl | protected function getRedirectUrl(array $responseHeaders)
{
// Check for the redirect after authentication
foreach ($responseHeaders as $header) {
if ( preg_match('/^(Location:|URI:)\s*([^\s]+.*)$/', $header, $matches)
) {
return trim(array_pop($matches));
... | php | protected function getRedirectUrl(array $responseHeaders)
{
// Check for the redirect after authentication
foreach ($responseHeaders as $header) {
if ( preg_match('/^(Location:|URI:)\s*([^\s]+.*)$/', $header, $matches)
) {
return trim(array_pop($matches));
... | [
"protected",
"function",
"getRedirectUrl",
"(",
"array",
"$",
"responseHeaders",
")",
"{",
"// Check for the redirect after authentication",
"foreach",
"(",
"$",
"responseHeaders",
"as",
"$",
"header",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^(Location:|URI:)\\s*([^\... | Answer a redirect URL if a redirect header is found, otherwise null.
@param array $responseHeaders response header to extract a redirect from
@return string or null | [
"Answer",
"a",
"redirect",
"URL",
"if",
"a",
"redirect",
"header",
"is",
"found",
"otherwise",
"null",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/ProxiedService/Http/Abstract.php#L271-L281 |
220,046 | moodle/moodle | lib/pagelib.php | moodle_page.magic_get_blockmanipulations | protected function magic_get_blockmanipulations() {
if (!right_to_left()) {
return false;
}
if (is_null($this->_theme)) {
$this->initialise_theme_and_output();
}
return $this->_theme->blockrtlmanipulations;
} | php | protected function magic_get_blockmanipulations() {
if (!right_to_left()) {
return false;
}
if (is_null($this->_theme)) {
$this->initialise_theme_and_output();
}
return $this->_theme->blockrtlmanipulations;
} | [
"protected",
"function",
"magic_get_blockmanipulations",
"(",
")",
"{",
"if",
"(",
"!",
"right_to_left",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_theme",
")",
")",
"{",
"$",
"this",
"->",
"initial... | Returns an array of minipulations or false if there are none to make.
@since Moodle 2.5.1 2.6
@return bool|array | [
"Returns",
"an",
"array",
"of",
"minipulations",
"or",
"false",
"if",
"there",
"are",
"none",
"to",
"make",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L688-L696 |
220,047 | moodle/moodle | lib/pagelib.php | moodle_page.magic_get_navigation | protected function magic_get_navigation() {
if ($this->_navigation === null) {
$this->_navigation = new global_navigation($this);
}
return $this->_navigation;
} | php | protected function magic_get_navigation() {
if ($this->_navigation === null) {
$this->_navigation = new global_navigation($this);
}
return $this->_navigation;
} | [
"protected",
"function",
"magic_get_navigation",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_navigation",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_navigation",
"=",
"new",
"global_navigation",
"(",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this... | Return the navigation object
@return global_navigation | [
"Return",
"the",
"navigation",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L734-L739 |
220,048 | moodle/moodle | lib/pagelib.php | moodle_page.magic_get_navbar | protected function magic_get_navbar() {
if ($this->_navbar === null) {
$this->_navbar = new navbar($this);
}
return $this->_navbar;
} | php | protected function magic_get_navbar() {
if ($this->_navbar === null) {
$this->_navbar = new navbar($this);
}
return $this->_navbar;
} | [
"protected",
"function",
"magic_get_navbar",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_navbar",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_navbar",
"=",
"new",
"navbar",
"(",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this",
"->",
"_navbar",... | Return a navbar object
@return navbar | [
"Return",
"a",
"navbar",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L745-L750 |
220,049 | moodle/moodle | lib/pagelib.php | moodle_page.magic_get_settingsnav | protected function magic_get_settingsnav() {
if ($this->_settingsnav === null) {
$this->_settingsnav = new settings_navigation($this);
$this->_settingsnav->initialise();
}
return $this->_settingsnav;
} | php | protected function magic_get_settingsnav() {
if ($this->_settingsnav === null) {
$this->_settingsnav = new settings_navigation($this);
$this->_settingsnav->initialise();
}
return $this->_settingsnav;
} | [
"protected",
"function",
"magic_get_settingsnav",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_settingsnav",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_settingsnav",
"=",
"new",
"settings_navigation",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"... | Returns the settings navigation object
@return settings_navigation | [
"Returns",
"the",
"settings",
"navigation",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L756-L762 |
220,050 | moodle/moodle | lib/pagelib.php | moodle_page.magic_get_flatnav | protected function magic_get_flatnav() {
if ($this->_flatnav === null) {
$this->_flatnav = new flat_navigation($this);
$this->_flatnav->initialise();
}
return $this->_flatnav;
} | php | protected function magic_get_flatnav() {
if ($this->_flatnav === null) {
$this->_flatnav = new flat_navigation($this);
$this->_flatnav->initialise();
}
return $this->_flatnav;
} | [
"protected",
"function",
"magic_get_flatnav",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_flatnav",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_flatnav",
"=",
"new",
"flat_navigation",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"_flatnav",
"->... | Returns the flat navigation object
@return flat_navigation | [
"Returns",
"the",
"flat",
"navigation",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L768-L774 |
220,051 | moodle/moodle | lib/pagelib.php | moodle_page.get_renderer | public function get_renderer($component, $subtype = null, $target = null) {
if ($this->pagelayout === 'maintenance') {
// If the page is using the maintenance layout then we're going to force target to maintenance.
// This leads to a special core renderer that is designed to block access... | php | public function get_renderer($component, $subtype = null, $target = null) {
if ($this->pagelayout === 'maintenance') {
// If the page is using the maintenance layout then we're going to force target to maintenance.
// This leads to a special core renderer that is designed to block access... | [
"public",
"function",
"get_renderer",
"(",
"$",
"component",
",",
"$",
"subtype",
"=",
"null",
",",
"$",
"target",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"pagelayout",
"===",
"'maintenance'",
")",
"{",
"// If the page is using the maintenance lay... | Returns instance of page renderer
@param string $component name such as 'core', 'mod_forum' or 'qtype_multichoice'.
@param string $subtype optional subtype such as 'news' resulting to 'mod_forum_news'
@param string $target one of rendering target constants
@return renderer_base | [
"Returns",
"instance",
"of",
"page",
"renderer"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L857-L865 |
220,052 | moodle/moodle | lib/pagelib.php | moodle_page.has_navbar | public function has_navbar() {
if ($this->_navbar === null) {
$this->_navbar = new navbar($this);
}
return $this->_navbar->has_items();
} | php | public function has_navbar() {
if ($this->_navbar === null) {
$this->_navbar = new navbar($this);
}
return $this->_navbar->has_items();
} | [
"public",
"function",
"has_navbar",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_navbar",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_navbar",
"=",
"new",
"navbar",
"(",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this",
"->",
"_navbar",
"->",
... | Checks to see if there are any items on the navbar object
@return bool true if there are, false if not | [
"Checks",
"to",
"see",
"if",
"there",
"are",
"any",
"items",
"on",
"the",
"navbar",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L872-L877 |
220,053 | moodle/moodle | lib/pagelib.php | moodle_page.end_collecting_javascript_requirements | public function end_collecting_javascript_requirements() {
if ($this->savedrequires === null) {
throw new coding_exception('JavaScript collection has not been started.');
}
$this->_requires = $this->savedrequires;
$this->savedrequires = null;
} | php | public function end_collecting_javascript_requirements() {
if ($this->savedrequires === null) {
throw new coding_exception('JavaScript collection has not been started.');
}
$this->_requires = $this->savedrequires;
$this->savedrequires = null;
} | [
"public",
"function",
"end_collecting_javascript_requirements",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"savedrequires",
"===",
"null",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'JavaScript collection has not been started.'",
")",
";",
"}",
"$",
"this... | Switches back from collecting fragment JS requirement to the original requirement manager | [
"Switches",
"back",
"from",
"collecting",
"fragment",
"JS",
"requirement",
"to",
"the",
"original",
"requirement",
"manager"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L906-L912 |
220,054 | moodle/moodle | lib/pagelib.php | moodle_page.debug_summary | public function debug_summary() {
$summary = '';
$summary .= 'General type: ' . $this->pagelayout . '. ';
if (!during_initial_install()) {
$summary .= 'Context ' . $this->context->get_context_name() . ' (context id ' . $this->_context->id . '). ';
}
$summary .= 'Page ... | php | public function debug_summary() {
$summary = '';
$summary .= 'General type: ' . $this->pagelayout . '. ';
if (!during_initial_install()) {
$summary .= 'Context ' . $this->context->get_context_name() . ' (context id ' . $this->_context->id . '). ';
}
$summary .= 'Page ... | [
"public",
"function",
"debug_summary",
"(",
")",
"{",
"$",
"summary",
"=",
"''",
";",
"$",
"summary",
".=",
"'General type: '",
".",
"$",
"this",
"->",
"pagelayout",
".",
"'. '",
";",
"if",
"(",
"!",
"during_initial_install",
"(",
")",
")",
"{",
"$",
"... | Get a description of this page. Normally displayed in the footer in developer debug mode.
@return string | [
"Get",
"a",
"description",
"of",
"this",
"page",
".",
"Normally",
"displayed",
"in",
"the",
"footer",
"in",
"developer",
"debug",
"mode",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L945-L956 |
220,055 | moodle/moodle | lib/pagelib.php | moodle_page.set_state | public function set_state($state) {
if ($state != $this->_state + 1 || $state > self::STATE_DONE) {
throw new coding_exception('Invalid state passed to moodle_page::set_state. We are in state ' .
$this->_state . ' and state ' . $state . ' was requested.');
}
if (... | php | public function set_state($state) {
if ($state != $this->_state + 1 || $state > self::STATE_DONE) {
throw new coding_exception('Invalid state passed to moodle_page::set_state. We are in state ' .
$this->_state . ' and state ' . $state . ' was requested.');
}
if (... | [
"public",
"function",
"set_state",
"(",
"$",
"state",
")",
"{",
"if",
"(",
"$",
"state",
"!=",
"$",
"this",
"->",
"_state",
"+",
"1",
"||",
"$",
"state",
">",
"self",
"::",
"STATE_DONE",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Invalid stat... | Set the state.
The state must be one of that STATE_... constants, and the state is only allowed to advance one step at a time.
@param int $state The new state.
@throws coding_exception | [
"Set",
"the",
"state",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L968-L979 |
220,056 | moodle/moodle | lib/pagelib.php | moodle_page.set_context | public function set_context($context) {
if ($context === null) {
// Extremely ugly hack which sets context to some value in order to prevent warnings,
// use only for core error handling!!!!
if (!$this->_context) {
$this->_context = context_system::instance();... | php | public function set_context($context) {
if ($context === null) {
// Extremely ugly hack which sets context to some value in order to prevent warnings,
// use only for core error handling!!!!
if (!$this->_context) {
$this->_context = context_system::instance();... | [
"public",
"function",
"set_context",
"(",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"context",
"===",
"null",
")",
"{",
"// Extremely ugly hack which sets context to some value in order to prevent warnings,",
"// use only for core error handling!!!!",
"if",
"(",
"!",
"$",
... | Set the main context to which this page belongs.
@param context $context a context object. You normally get this with context_xxxx::instance(). | [
"Set",
"the",
"main",
"context",
"to",
"which",
"this",
"page",
"belongs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1034-L1059 |
220,057 | moodle/moodle | lib/pagelib.php | moodle_page.set_pagelayout | public function set_pagelayout($pagelayout) {
global $SESSION;
if (!empty($SESSION->forcepagelayout)) {
$this->_pagelayout = $SESSION->forcepagelayout;
} else {
// Uncomment this to debug theme pagelayout issues like missing blocks.
// if (!empty($this->_wher... | php | public function set_pagelayout($pagelayout) {
global $SESSION;
if (!empty($SESSION->forcepagelayout)) {
$this->_pagelayout = $SESSION->forcepagelayout;
} else {
// Uncomment this to debug theme pagelayout issues like missing blocks.
// if (!empty($this->_wher... | [
"public",
"function",
"set_pagelayout",
"(",
"$",
"pagelayout",
")",
"{",
"global",
"$",
"SESSION",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"SESSION",
"->",
"forcepagelayout",
")",
")",
"{",
"$",
"this",
"->",
"_pagelayout",
"=",
"$",
"SESSION",
"->",
... | Sets the layout to use for this page.
The page layout determines how the page will be displayed, things such as
block regions, content areas, etc are controlled by the layout.
The theme in use for the page will determine that the layout contains.
This properly defaults to 'base', so you only need to call this functio... | [
"Sets",
"the",
"layout",
"to",
"use",
"for",
"this",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1164-L1175 |
220,058 | moodle/moodle | lib/pagelib.php | moodle_page.set_title | public function set_title($title) {
$title = format_string($title);
$title = strip_tags($title);
$title = str_replace('"', '"', $title);
$this->_title = $title;
} | php | public function set_title($title) {
$title = format_string($title);
$title = strip_tags($title);
$title = str_replace('"', '"', $title);
$this->_title = $title;
} | [
"public",
"function",
"set_title",
"(",
"$",
"title",
")",
"{",
"$",
"title",
"=",
"format_string",
"(",
"$",
"title",
")",
";",
"$",
"title",
"=",
"strip_tags",
"(",
"$",
"title",
")",
";",
"$",
"title",
"=",
"str_replace",
"(",
"'\"'",
",",
"'"... | Sets the title for the page.
This is normally used within the title tag in the head of the page.
@param string $title the title that should go in the <head> section of the HTML of this page. | [
"Sets",
"the",
"title",
"for",
"the",
"page",
".",
"This",
"is",
"normally",
"used",
"within",
"the",
"title",
"tag",
"in",
"the",
"head",
"of",
"the",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1222-L1227 |
220,059 | moodle/moodle | lib/pagelib.php | moodle_page.set_category_by_id | public function set_category_by_id($categoryid) {
global $SITE;
if (!is_null($this->_course)) {
throw new coding_exception('Course has already been set. You cannot change the category now.');
}
if (is_array($this->_categories)) {
throw new coding_exception('Course... | php | public function set_category_by_id($categoryid) {
global $SITE;
if (!is_null($this->_course)) {
throw new coding_exception('Course has already been set. You cannot change the category now.');
}
if (is_array($this->_categories)) {
throw new coding_exception('Course... | [
"public",
"function",
"set_category_by_id",
"(",
"$",
"categoryid",
")",
"{",
"global",
"$",
"SITE",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_course",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Course has already been set. You c... | Set the course category this page belongs to manually.
This automatically sets $PAGE->course to be the site course. You cannot
use this method if you have already set $PAGE->course - in that case,
the category must be the one that the course belongs to. This also
automatically sets the page context to the category con... | [
"Set",
"the",
"course",
"category",
"this",
"page",
"belongs",
"to",
"manually",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1259-L1271 |
220,060 | moodle/moodle | lib/pagelib.php | moodle_page.set_url | public function set_url($url, array $params = null) {
global $CFG;
if (is_string($url) && strpos($url, 'http') !== 0) {
if (strpos($url, '/') === 0) {
// Add the wwwroot to the relative url.
$url = $CFG->wwwroot . $url;
} else {
th... | php | public function set_url($url, array $params = null) {
global $CFG;
if (is_string($url) && strpos($url, 'http') !== 0) {
if (strpos($url, '/') === 0) {
// Add the wwwroot to the relative url.
$url = $CFG->wwwroot . $url;
} else {
th... | [
"public",
"function",
"set_url",
"(",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"is_string",
"(",
"$",
"url",
")",
"&&",
"strpos",
"(",
"$",
"url",
",",
"'http'",
")",
"!==",
"0",
")",
... | You should call this method from every page to set the URL that should be used to return to this page.
Used, for example, by the blocks editing UI to know where to return the
user after an action.
For example, course/view.php does:
$id = optional_param('id', 0, PARAM_INT);
$PAGE->set_url('/course/view.php', array('id'... | [
"You",
"should",
"call",
"this",
"method",
"from",
"every",
"page",
"to",
"set",
"the",
"URL",
"that",
"should",
"be",
"used",
"to",
"return",
"to",
"this",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1299-L1322 |
220,061 | moodle/moodle | lib/pagelib.php | moodle_page.add_alternate_version | public function add_alternate_version($title, $url, $mimetype) {
if ($this->_state > self::STATE_BEFORE_HEADER) {
throw new coding_exception('Cannot call moodle_page::add_alternate_version after output has been started.');
}
$alt = new stdClass;
$alt->title = $title;
... | php | public function add_alternate_version($title, $url, $mimetype) {
if ($this->_state > self::STATE_BEFORE_HEADER) {
throw new coding_exception('Cannot call moodle_page::add_alternate_version after output has been started.');
}
$alt = new stdClass;
$alt->title = $title;
... | [
"public",
"function",
"add_alternate_version",
"(",
"$",
"title",
",",
"$",
"url",
",",
"$",
"mimetype",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_state",
">",
"self",
"::",
"STATE_BEFORE_HEADER",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Cannot... | Sets an alternative version of this page.
There can be alternate versions of some pages (for example an RSS feed version).
Call this method for each alternative version available.
For each alternative version a link will be included in the <head> tag.
@param string $title The title to give the alternate version.
@par... | [
"Sets",
"an",
"alternative",
"version",
"of",
"this",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1352-L1360 |
220,062 | moodle/moodle | lib/pagelib.php | moodle_page.set_other_editing_capability | public function set_other_editing_capability($capability) {
if (is_array($capability)) {
$this->_othereditingcaps = array_unique($this->_othereditingcaps + $capability);
} else {
$this->_othereditingcaps[] = $capability;
}
} | php | public function set_other_editing_capability($capability) {
if (is_array($capability)) {
$this->_othereditingcaps = array_unique($this->_othereditingcaps + $capability);
} else {
$this->_othereditingcaps[] = $capability;
}
} | [
"public",
"function",
"set_other_editing_capability",
"(",
"$",
"capability",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"capability",
")",
")",
"{",
"$",
"this",
"->",
"_othereditingcaps",
"=",
"array_unique",
"(",
"$",
"this",
"->",
"_othereditingcaps",
"+",... | Some pages let you turn editing on for reasons other than editing blocks.
If that is the case, you can pass other capabilities that let the user
edit this page here.
@param string|array $capability either a capability, or an array of capabilities. | [
"Some",
"pages",
"let",
"you",
"turn",
"editing",
"on",
"for",
"reasons",
"other",
"than",
"editing",
"blocks",
".",
"If",
"that",
"is",
"the",
"case",
"you",
"can",
"pass",
"other",
"capabilities",
"that",
"let",
"the",
"user",
"edit",
"this",
"page",
"... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1400-L1406 |
220,063 | moodle/moodle | lib/pagelib.php | moodle_page.set_periodic_refresh_delay | public function set_periodic_refresh_delay($delay = null) {
if ($this->_state > self::STATE_BEFORE_HEADER) {
throw new coding_exception('You cannot set a periodic refresh delay after the header has been printed');
}
if ($delay === null) {
$this->_periodicrefreshdelay = nu... | php | public function set_periodic_refresh_delay($delay = null) {
if ($this->_state > self::STATE_BEFORE_HEADER) {
throw new coding_exception('You cannot set a periodic refresh delay after the header has been printed');
}
if ($delay === null) {
$this->_periodicrefreshdelay = nu... | [
"public",
"function",
"set_periodic_refresh_delay",
"(",
"$",
"delay",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_state",
">",
"self",
"::",
"STATE_BEFORE_HEADER",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'You cannot set a periodic refresh d... | Sets the page to periodically refresh
This function must be called before $OUTPUT->header has been called or
a coding exception will be thrown.
@param int $delay Sets the delay before refreshing the page, if set to null refresh is cancelled.
@throws coding_exception | [
"Sets",
"the",
"page",
"to",
"periodically",
"refresh"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1426-L1435 |
220,064 | moodle/moodle | lib/pagelib.php | moodle_page.reload_theme | public function reload_theme() {
if (!is_null($this->_theme)) {
$this->_theme = theme_config::load($this->_theme->name);
}
} | php | public function reload_theme() {
if (!is_null($this->_theme)) {
$this->_theme = theme_config::load($this->_theme->name);
}
} | [
"public",
"function",
"reload_theme",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_theme",
")",
")",
"{",
"$",
"this",
"->",
"_theme",
"=",
"theme_config",
"::",
"load",
"(",
"$",
"this",
"->",
"_theme",
"->",
"name",
")",
";... | Reload theme settings.
This is used when we need to reset settings
because they are now double cached in theme. | [
"Reload",
"theme",
"settings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1456-L1460 |
220,065 | moodle/moodle | lib/pagelib.php | moodle_page.starting_output | protected function starting_output() {
global $CFG;
if (!during_initial_install()) {
$this->blocks->load_blocks();
if (empty($this->_block_actions_done)) {
$this->_block_actions_done = true;
if ($this->blocks->process_url_actions($this)) {
... | php | protected function starting_output() {
global $CFG;
if (!during_initial_install()) {
$this->blocks->load_blocks();
if (empty($this->_block_actions_done)) {
$this->_block_actions_done = true;
if ($this->blocks->process_url_actions($this)) {
... | [
"protected",
"function",
"starting_output",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"during_initial_install",
"(",
")",
")",
"{",
"$",
"this",
"->",
"blocks",
"->",
"load_blocks",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
... | This method is called when the page first moves out of the STATE_BEFORE_HEADER
state. This is our last change to initialise things. | [
"This",
"method",
"is",
"called",
"when",
"the",
"page",
"first",
"moves",
"out",
"of",
"the",
"STATE_BEFORE_HEADER",
"state",
".",
"This",
"is",
"our",
"last",
"change",
"to",
"initialise",
"things",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1495-L1523 |
220,066 | moodle/moodle | lib/pagelib.php | moodle_page.initialise_theme_and_output | public function initialise_theme_and_output() {
global $OUTPUT, $PAGE, $SITE, $CFG;
if (!empty($this->_wherethemewasinitialised)) {
return;
}
if (!during_initial_install()) {
// Detect PAGE->context mess.
$this->magic_get_context();
}
... | php | public function initialise_theme_and_output() {
global $OUTPUT, $PAGE, $SITE, $CFG;
if (!empty($this->_wherethemewasinitialised)) {
return;
}
if (!during_initial_install()) {
// Detect PAGE->context mess.
$this->magic_get_context();
}
... | [
"public",
"function",
"initialise_theme_and_output",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
",",
"$",
"PAGE",
",",
"$",
"SITE",
",",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_wherethemewasinitialised",
")",
")",
"{",
"return",
... | Method for use by Moodle core to set up the theme. Do not
use this in your own code.
Make sure the right theme for this page is loaded. Tell our
blocks_manager about the theme block regions, and then, if
we are $PAGE, set up the global $OUTPUT.
@return void | [
"Method",
"for",
"use",
"by",
"Moodle",
"core",
"to",
"set",
"up",
"the",
"theme",
".",
"Do",
"not",
"use",
"this",
"in",
"your",
"own",
"code",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1535-L1575 |
220,067 | moodle/moodle | lib/pagelib.php | moodle_page.resolve_theme | protected function resolve_theme() {
global $CFG, $USER, $SESSION;
if (empty($CFG->themeorder)) {
$themeorder = array('course', 'category', 'session', 'user', 'cohort', 'site');
} else {
$themeorder = $CFG->themeorder;
// Just in case, make sure we always use... | php | protected function resolve_theme() {
global $CFG, $USER, $SESSION;
if (empty($CFG->themeorder)) {
$themeorder = array('course', 'category', 'session', 'user', 'cohort', 'site');
} else {
$themeorder = $CFG->themeorder;
// Just in case, make sure we always use... | [
"protected",
"function",
"resolve_theme",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"USER",
",",
"$",
"SESSION",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"themeorder",
")",
")",
"{",
"$",
"themeorder",
"=",
"array",
"(",
"'course'",
",",
... | Work out the theme this page should use.
This depends on numerous $CFG settings, and the properties of this page.
@return string the name of the theme that should be used on this page. | [
"Work",
"out",
"the",
"theme",
"this",
"page",
"should",
"use",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1602-L1691 |
220,068 | moodle/moodle | lib/pagelib.php | moodle_page.load_activity_record | protected function load_activity_record() {
global $DB;
if (is_null($this->_cm)) {
return;
}
$this->_module = $DB->get_record($this->_cm->modname, array('id' => $this->_cm->instance));
} | php | protected function load_activity_record() {
global $DB;
if (is_null($this->_cm)) {
return;
}
$this->_module = $DB->get_record($this->_cm->modname, array('id' => $this->_cm->instance));
} | [
"protected",
"function",
"load_activity_record",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_cm",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"_module",
"=",
"$",
"DB",
"->",
"get_record",
"(",
... | Loads the activity record for the current CM object associated with this
page.
This will load {@link moodle_page::$_module} with a row from the related
module table in the database.
For instance if {@link moodle_page::$_cm} is a forum then a row from the
forum table will be loaded. | [
"Loads",
"the",
"activity",
"record",
"for",
"the",
"current",
"CM",
"object",
"associated",
"with",
"this",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1832-L1838 |
220,069 | moodle/moodle | lib/pagelib.php | moodle_page.ensure_category_loaded | protected function ensure_category_loaded() {
if (is_array($this->_categories)) {
return; // Already done.
}
if (is_null($this->_course)) {
throw new coding_exception('Attempt to get the course category for this page before the course was set.');
}
if ($th... | php | protected function ensure_category_loaded() {
if (is_array($this->_categories)) {
return; // Already done.
}
if (is_null($this->_course)) {
throw new coding_exception('Attempt to get the course category for this page before the course was set.');
}
if ($th... | [
"protected",
"function",
"ensure_category_loaded",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"_categories",
")",
")",
"{",
"return",
";",
"// Already done.",
"}",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_course",
")",
")",
"{",... | This function ensures that the category of the current course has been
loaded, and if not, the function loads it now.
@return void
@throws coding_exception | [
"This",
"function",
"ensures",
"that",
"the",
"category",
"of",
"the",
"current",
"course",
"has",
"been",
"loaded",
"and",
"if",
"not",
"the",
"function",
"loads",
"it",
"now",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1847-L1859 |
220,070 | moodle/moodle | lib/pagelib.php | moodle_page.load_category | protected function load_category($categoryid) {
global $DB;
$category = $DB->get_record('course_categories', array('id' => $categoryid));
if (!$category) {
throw new moodle_exception('unknowncategory');
}
$this->_categories[$category->id] = $category;
$parentc... | php | protected function load_category($categoryid) {
global $DB;
$category = $DB->get_record('course_categories', array('id' => $categoryid));
if (!$category) {
throw new moodle_exception('unknowncategory');
}
$this->_categories[$category->id] = $category;
$parentc... | [
"protected",
"function",
"load_category",
"(",
"$",
"categoryid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"category",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'course_categories'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"categoryid",
")",
")",
";",
"if"... | Loads the requested category into the pages categories array.
@param int $categoryid
@throws moodle_exception | [
"Loads",
"the",
"requested",
"category",
"into",
"the",
"pages",
"categories",
"array",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1867-L1879 |
220,071 | moodle/moodle | lib/pagelib.php | moodle_page.ensure_categories_loaded | protected function ensure_categories_loaded() {
global $DB;
$this->ensure_category_loaded();
if (!is_null(end($this->_categories))) {
return; // Already done.
}
$idstoload = array_keys($this->_categories);
array_shift($idstoload);
$categories = $DB->ge... | php | protected function ensure_categories_loaded() {
global $DB;
$this->ensure_category_loaded();
if (!is_null(end($this->_categories))) {
return; // Already done.
}
$idstoload = array_keys($this->_categories);
array_shift($idstoload);
$categories = $DB->ge... | [
"protected",
"function",
"ensure_categories_loaded",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"ensure_category_loaded",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"end",
"(",
"$",
"this",
"->",
"_categories",
")",
")",
")",
"{",
... | Ensures that the category the current course is within, as well as all of
its parent categories, have been loaded.
@return void | [
"Ensures",
"that",
"the",
"category",
"the",
"current",
"course",
"is",
"within",
"as",
"well",
"as",
"all",
"of",
"its",
"parent",
"categories",
"have",
"been",
"loaded",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1887-L1899 |
220,072 | moodle/moodle | lib/pagelib.php | moodle_page.url_to_class_name | protected function url_to_class_name($url) {
$bits = parse_url($url);
$class = str_replace('.', '-', $bits['host']);
if (!empty($bits['port'])) {
$class .= '--' . $bits['port'];
}
if (!empty($bits['path'])) {
$path = trim($bits['path'], '/');
i... | php | protected function url_to_class_name($url) {
$bits = parse_url($url);
$class = str_replace('.', '-', $bits['host']);
if (!empty($bits['port'])) {
$class .= '--' . $bits['port'];
}
if (!empty($bits['path'])) {
$path = trim($bits['path'], '/');
i... | [
"protected",
"function",
"url_to_class_name",
"(",
"$",
"url",
")",
"{",
"$",
"bits",
"=",
"parse_url",
"(",
"$",
"url",
")",
";",
"$",
"class",
"=",
"str_replace",
"(",
"'.'",
",",
"'-'",
",",
"$",
"bits",
"[",
"'host'",
"]",
")",
";",
"if",
"(",
... | Converts the provided URL into a CSS class that be used within the page.
This is primarily used to add the wwwroot to the body tag as a CSS class.
@param string $url
@return string | [
"Converts",
"the",
"provided",
"URL",
"into",
"a",
"CSS",
"class",
"that",
"be",
"used",
"within",
"the",
"page",
".",
"This",
"is",
"primarily",
"used",
"to",
"add",
"the",
"wwwroot",
"to",
"the",
"body",
"tag",
"as",
"a",
"CSS",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1927-L1940 |
220,073 | moodle/moodle | lib/pagelib.php | moodle_page.apply_theme_region_manipulations | public function apply_theme_region_manipulations($region) {
if ($this->blockmanipulations && isset($this->blockmanipulations[$region])) {
$regionwas = $region;
$regionnow = $this->blockmanipulations[$region];
if ($this->blocks->is_known_region($regionwas) && $this->blocks->is... | php | public function apply_theme_region_manipulations($region) {
if ($this->blockmanipulations && isset($this->blockmanipulations[$region])) {
$regionwas = $region;
$regionnow = $this->blockmanipulations[$region];
if ($this->blocks->is_known_region($regionwas) && $this->blocks->is... | [
"public",
"function",
"apply_theme_region_manipulations",
"(",
"$",
"region",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"blockmanipulations",
"&&",
"isset",
"(",
"$",
"this",
"->",
"blockmanipulations",
"[",
"$",
"region",
"]",
")",
")",
"{",
"$",
"regionwas",... | Returns the block region having made any required theme manipulations.
@since Moodle 2.5.1 2.6
@param string $region
@return string | [
"Returns",
"the",
"block",
"region",
"having",
"made",
"any",
"required",
"theme",
"manipulations",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L1998-L2010 |
220,074 | moodle/moodle | lib/pagelib.php | moodle_page.add_report_nodes | public function add_report_nodes($userid, $nodeinfo) {
global $USER;
// Try to find the specific user node.
$newusernode = $this->navigation->find('user' . $userid, null);
$reportnode = null;
$navigationnodeerror =
'Could not find the navigation node requested. Pl... | php | public function add_report_nodes($userid, $nodeinfo) {
global $USER;
// Try to find the specific user node.
$newusernode = $this->navigation->find('user' . $userid, null);
$reportnode = null;
$navigationnodeerror =
'Could not find the navigation node requested. Pl... | [
"public",
"function",
"add_report_nodes",
"(",
"$",
"userid",
",",
"$",
"nodeinfo",
")",
"{",
"global",
"$",
"USER",
";",
"// Try to find the specific user node.",
"$",
"newusernode",
"=",
"$",
"this",
"->",
"navigation",
"->",
"find",
"(",
"'user'",
".",
"$",... | Add a report node and a specific report to the navigation.
@param int $userid The user ID that we are looking to add this report node to.
@param array $nodeinfo Name and url of the final node that we are creating. | [
"Add",
"a",
"report",
"node",
"and",
"a",
"specific",
"report",
"to",
"the",
"navigation",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pagelib.php#L2018-L2046 |
220,075 | moodle/moodle | lib/mustache/src/Mustache/Engine.php | Mustache_Engine.setPartials | public function setPartials(array $partials = array())
{
if (!isset($this->partialsLoader)) {
$this->partialsLoader = new Mustache_Loader_ArrayLoader();
}
if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) {
throw new Mustache_Exception_RuntimeExcep... | php | public function setPartials(array $partials = array())
{
if (!isset($this->partialsLoader)) {
$this->partialsLoader = new Mustache_Loader_ArrayLoader();
}
if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) {
throw new Mustache_Exception_RuntimeExcep... | [
"public",
"function",
"setPartials",
"(",
"array",
"$",
"partials",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"partialsLoader",
")",
")",
"{",
"$",
"this",
"->",
"partialsLoader",
"=",
"new",
"Mustache_Loader_Arra... | Set partials for the current partials Loader instance.
@throws Mustache_Exception_RuntimeException If the current Loader instance is immutable
@param array $partials (default: array()) | [
"Set",
"partials",
"for",
"the",
"current",
"partials",
"Loader",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Engine.php#L340-L351 |
220,076 | moodle/moodle | lib/mustache/src/Mustache/Engine.php | Mustache_Engine.setHelpers | public function setHelpers($helpers)
{
if (!is_array($helpers) && !$helpers instanceof Traversable) {
throw new Mustache_Exception_InvalidArgumentException('setHelpers expects an array of helpers');
}
$this->getHelpers()->clear();
foreach ($helpers as $name => $helper) ... | php | public function setHelpers($helpers)
{
if (!is_array($helpers) && !$helpers instanceof Traversable) {
throw new Mustache_Exception_InvalidArgumentException('setHelpers expects an array of helpers');
}
$this->getHelpers()->clear();
foreach ($helpers as $name => $helper) ... | [
"public",
"function",
"setHelpers",
"(",
"$",
"helpers",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"helpers",
")",
"&&",
"!",
"$",
"helpers",
"instanceof",
"Traversable",
")",
"{",
"throw",
"new",
"Mustache_Exception_InvalidArgumentException",
"(",
"'set... | Set an array of Mustache helpers.
An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order sections), or
any other valid Mustache context value. They will be prepended to the context stack, so they will be available in
any template loaded by this Mustache instance.
@throws Mu... | [
"Set",
"an",
"array",
"of",
"Mustache",
"helpers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Engine.php#L364-L375 |
220,077 | moodle/moodle | lib/mustache/src/Mustache/Engine.php | Mustache_Engine.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 the Mustache Logger instance.
@throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface
@param Mustache_Logger|Psr\Log\LoggerInterface $logger | [
"Set",
"the",
"Mustache",
"Logger",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Engine.php#L453-L464 |
220,078 | moodle/moodle | lib/mustache/src/Mustache/Engine.php | Mustache_Engine.setCache | public function setCache(Mustache_Cache $cache)
{
if (isset($this->logger) && $cache->getLogger() === null) {
$cache->setLogger($this->getLogger());
}
$this->cache = $cache;
} | php | public function setCache(Mustache_Cache $cache)
{
if (isset($this->logger) && $cache->getLogger() === null) {
$cache->setLogger($this->getLogger());
}
$this->cache = $cache;
} | [
"public",
"function",
"setCache",
"(",
"Mustache_Cache",
"$",
"cache",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"logger",
")",
"&&",
"$",
"cache",
"->",
"getLogger",
"(",
")",
"===",
"null",
")",
"{",
"$",
"cache",
"->",
"setLogger",
"("... | Set the Mustache Cache instance.
@param Mustache_Cache $cache | [
"Set",
"the",
"Mustache",
"Cache",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Engine.php#L559-L566 |
220,079 | moodle/moodle | lib/mustache/src/Mustache/Engine.php | Mustache_Engine.getLambdaCache | protected function getLambdaCache()
{
if ($this->cacheLambdaTemplates) {
return $this->getCache();
}
if (!isset($this->lambdaCache)) {
$this->lambdaCache = new Mustache_Cache_NoopCache();
}
return $this->lambdaCache;
} | php | protected function getLambdaCache()
{
if ($this->cacheLambdaTemplates) {
return $this->getCache();
}
if (!isset($this->lambdaCache)) {
$this->lambdaCache = new Mustache_Cache_NoopCache();
}
return $this->lambdaCache;
} | [
"protected",
"function",
"getLambdaCache",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cacheLambdaTemplates",
")",
"{",
"return",
"$",
"this",
"->",
"getCache",
"(",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"lambdaCache",
")",
... | Get the current Lambda Cache instance.
If 'cache_lambda_templates' is enabled, this is the default cache instance. Otherwise, it is a NoopCache.
@see Mustache_Engine::getCache
@return Mustache_Cache | [
"Get",
"the",
"current",
"Lambda",
"Cache",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Engine.php#L593-L604 |
220,080 | moodle/moodle | lib/mustache/src/Mustache/Engine.php | Mustache_Engine.getTemplateClassName | public function getTemplateClassName($source)
{
// For the most part, adding a new option here should do the trick.
//
// Pick a value here which is unique for each possible way the template
// could be compiled... but not necessarily unique per option value. See
// escape be... | php | public function getTemplateClassName($source)
{
// For the most part, adding a new option here should do the trick.
//
// Pick a value here which is unique for each possible way the template
// could be compiled... but not necessarily unique per option value. See
// escape be... | [
"public",
"function",
"getTemplateClassName",
"(",
"$",
"source",
")",
"{",
"// For the most part, adding a new option here should do the trick.",
"//",
"// Pick a value here which is unique for each possible way the template",
"// could be compiled... but not necessarily unique per option val... | Helper method to generate a Mustache template class.
This method must be updated any time options are added which make it so
the same template could be parsed and compiled multiple different ways.
@param string|Mustache_Source $source
@return string Mustache Template class name | [
"Helper",
"method",
"to",
"generate",
"a",
"Mustache",
"template",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Engine.php#L616-L646 |
220,081 | moodle/moodle | lib/mustache/src/Mustache/Engine.php | Mustache_Engine.loadPartial | public function loadPartial($name)
{
try {
if (isset($this->partialsLoader)) {
$loader = $this->partialsLoader;
} elseif (isset($this->loader) && !$this->loader instanceof Mustache_Loader_StringLoader) {
$loader = $this->loader;
} else {
... | php | public function loadPartial($name)
{
try {
if (isset($this->partialsLoader)) {
$loader = $this->partialsLoader;
} elseif (isset($this->loader) && !$this->loader instanceof Mustache_Loader_StringLoader) {
$loader = $this->loader;
} else {
... | [
"public",
"function",
"loadPartial",
"(",
"$",
"name",
")",
"{",
"try",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"partialsLoader",
")",
")",
"{",
"$",
"loader",
"=",
"$",
"this",
"->",
"partialsLoader",
";",
"}",
"elseif",
"(",
"isset",
"(",
... | Load a Mustache partial Template by name.
This is a helper method used internally by Template instances for loading partial templates. You can most likely
ignore it completely.
@param string $name
@return Mustache_Template | [
"Load",
"a",
"Mustache",
"partial",
"Template",
"by",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Engine.php#L670-L690 |
220,082 | moodle/moodle | lib/mustache/src/Mustache/Engine.php | Mustache_Engine.loadLambda | public function loadLambda($source, $delims = null)
{
if ($delims !== null) {
$source = $delims . "\n" . $source;
}
return $this->loadSource($source, $this->getLambdaCache());
} | php | public function loadLambda($source, $delims = null)
{
if ($delims !== null) {
$source = $delims . "\n" . $source;
}
return $this->loadSource($source, $this->getLambdaCache());
} | [
"public",
"function",
"loadLambda",
"(",
"$",
"source",
",",
"$",
"delims",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"delims",
"!==",
"null",
")",
"{",
"$",
"source",
"=",
"$",
"delims",
".",
"\"\\n\"",
".",
"$",
"source",
";",
"}",
"return",
"$",
... | Load a Mustache lambda Template by source.
This is a helper method used by Template instances to generate subtemplates for Lambda sections. You can most
likely ignore it completely.
@param string $source
@param string $delims (default: null)
@return Mustache_Template | [
"Load",
"a",
"Mustache",
"lambda",
"Template",
"by",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Engine.php#L703-L710 |
220,083 | moodle/moodle | lib/mustache/src/Mustache/Engine.php | Mustache_Engine.loadSource | private function loadSource($source, Mustache_Cache $cache = null)
{
$className = $this->getTemplateClassName($source);
if (!isset($this->templates[$className])) {
if ($cache === null) {
$cache = $this->getCache();
}
if (!class_exists($className,... | php | private function loadSource($source, Mustache_Cache $cache = null)
{
$className = $this->getTemplateClassName($source);
if (!isset($this->templates[$className])) {
if ($cache === null) {
$cache = $this->getCache();
}
if (!class_exists($className,... | [
"private",
"function",
"loadSource",
"(",
"$",
"source",
",",
"Mustache_Cache",
"$",
"cache",
"=",
"null",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"getTemplateClassName",
"(",
"$",
"source",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"thi... | Instantiate and return a Mustache Template instance by source.
Optionally provide a Mustache_Cache instance. This is used internally by Mustache_Engine::loadLambda to respect
the 'cache_lambda_templates' configuration option.
@see Mustache_Engine::loadTemplate
@see Mustache_Engine::loadPartial
@see Mustache_Engine::l... | [
"Instantiate",
"and",
"return",
"a",
"Mustache",
"Template",
"instance",
"by",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Engine.php#L727-L753 |
220,084 | moodle/moodle | lib/mustache/src/Mustache/Engine.php | Mustache_Engine.parse | private function parse($source)
{
$parser = $this->getParser();
$parser->setPragmas($this->getPragmas());
return $parser->parse($this->tokenize($source));
} | php | private function parse($source)
{
$parser = $this->getParser();
$parser->setPragmas($this->getPragmas());
return $parser->parse($this->tokenize($source));
} | [
"private",
"function",
"parse",
"(",
"$",
"source",
")",
"{",
"$",
"parser",
"=",
"$",
"this",
"->",
"getParser",
"(",
")",
";",
"$",
"parser",
"->",
"setPragmas",
"(",
"$",
"this",
"->",
"getPragmas",
"(",
")",
")",
";",
"return",
"$",
"parser",
"... | Helper method to parse a Mustache template.
@see Mustache_Parser::parse
@param string $source
@return array Token tree | [
"Helper",
"method",
"to",
"parse",
"a",
"Mustache",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Engine.php#L778-L784 |
220,085 | moodle/moodle | lib/mustache/src/Mustache/Engine.php | Mustache_Engine.compile | private function compile($source)
{
$name = $this->getTemplateClassName($source);
$this->log(
Mustache_Logger::INFO,
'Compiling template to "{className}" class',
array('className' => $name)
);
if ($source instanceof Mustache_Source) {
... | php | private function compile($source)
{
$name = $this->getTemplateClassName($source);
$this->log(
Mustache_Logger::INFO,
'Compiling template to "{className}" class',
array('className' => $name)
);
if ($source instanceof Mustache_Source) {
... | [
"private",
"function",
"compile",
"(",
"$",
"source",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getTemplateClassName",
"(",
"$",
"source",
")",
";",
"$",
"this",
"->",
"log",
"(",
"Mustache_Logger",
"::",
"INFO",
",",
"'Compiling template to \"{classNa... | Helper method to compile a Mustache template.
@see Mustache_Compiler::compile
@param string|Mustache_Source $source
@return string generated Mustache template class code | [
"Helper",
"method",
"to",
"compile",
"a",
"Mustache",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Engine.php#L795-L814 |
220,086 | moodle/moodle | lib/mustache/src/Mustache/Engine.php | Mustache_Engine.log | private function log($level, $message, array $context = array())
{
if (isset($this->logger)) {
$this->logger->log($level, $message, $context);
}
} | php | private function log($level, $message, array $context = array())
{
if (isset($this->logger)) {
$this->logger->log($level, $message, $context);
}
} | [
"private",
"function",
"log",
"(",
"$",
"level",
",",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"logger",
")",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"log",
... | Add a log record if logging is enabled.
@param int $level The logging level
@param string $message The log message
@param array $context The log context | [
"Add",
"a",
"log",
"record",
"if",
"logging",
"is",
"enabled",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Engine.php#L823-L828 |
220,087 | moodle/moodle | admin/tool/uploadcourse/classes/processor.php | tool_uploadcourse_processor.get_course | protected function get_course($data) {
$importoptions = array(
'candelete' => $this->allowdeletes,
'canrename' => $this->allowrenames,
'canreset' => $this->allowresets,
'reset' => $this->reset,
'restoredir' => $this->get_restore_content_dir(),
... | php | protected function get_course($data) {
$importoptions = array(
'candelete' => $this->allowdeletes,
'canrename' => $this->allowrenames,
'canreset' => $this->allowresets,
'reset' => $this->reset,
'restoredir' => $this->get_restore_content_dir(),
... | [
"protected",
"function",
"get_course",
"(",
"$",
"data",
")",
"{",
"$",
"importoptions",
"=",
"array",
"(",
"'candelete'",
"=>",
"$",
"this",
"->",
"allowdeletes",
",",
"'canrename'",
"=>",
"$",
"this",
"->",
"allowrenames",
",",
"'canreset'",
"=>",
"$",
"... | Return a course import object.
@param array $data data to import the course with.
@return tool_uploadcourse_course | [
"Return",
"a",
"course",
"import",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/uploadcourse/classes/processor.php#L238-L248 |
220,088 | moodle/moodle | admin/tool/uploadcourse/classes/processor.php | tool_uploadcourse_processor.log_error | protected function log_error($errors) {
if (empty($errors)) {
return;
}
foreach ($errors as $code => $langstring) {
if (!isset($this->errors[$this->linenb])) {
$this->errors[$this->linenb] = array();
}
$this->errors[$this->linenb][... | php | protected function log_error($errors) {
if (empty($errors)) {
return;
}
foreach ($errors as $code => $langstring) {
if (!isset($this->errors[$this->linenb])) {
$this->errors[$this->linenb] = array();
}
$this->errors[$this->linenb][... | [
"protected",
"function",
"log_error",
"(",
"$",
"errors",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"errors",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"errors",
"as",
"$",
"code",
"=>",
"$",
"langstring",
")",
"{",
"if",
"(",
"!",
"i... | Log errors on the current line.
@param array $errors array of errors
@return void | [
"Log",
"errors",
"on",
"the",
"current",
"line",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/uploadcourse/classes/processor.php#L284-L295 |
220,089 | moodle/moodle | admin/tool/uploadcourse/classes/processor.php | tool_uploadcourse_processor.preview | public function preview($rows = 10, $tracker = null) {
if ($this->processstarted) {
throw new coding_exception('Process has already been started');
}
$this->processstarted = true;
if (empty($tracker)) {
$tracker = new tool_uploadcourse_tracker(tool_uploadcourse_t... | php | public function preview($rows = 10, $tracker = null) {
if ($this->processstarted) {
throw new coding_exception('Process has already been started');
}
$this->processstarted = true;
if (empty($tracker)) {
$tracker = new tool_uploadcourse_tracker(tool_uploadcourse_t... | [
"public",
"function",
"preview",
"(",
"$",
"rows",
"=",
"10",
",",
"$",
"tracker",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"processstarted",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Process has already been started'",
")",
";",
"}"... | Return a preview of the import.
This only returns passed data, along with the errors.
@param integer $rows number of rows to preview.
@param object $tracker the output tracker to use.
@return array of preview data. | [
"Return",
"a",
"preview",
"of",
"the",
"import",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/uploadcourse/classes/processor.php#L326-L360 |
220,090 | moodle/moodle | admin/tool/uploadcourse/classes/processor.php | tool_uploadcourse_processor.reset | public function reset() {
$this->processstarted = false;
$this->linenb = 0;
$this->cir->init();
$this->errors = array();
} | php | public function reset() {
$this->processstarted = false;
$this->linenb = 0;
$this->cir->init();
$this->errors = array();
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"processstarted",
"=",
"false",
";",
"$",
"this",
"->",
"linenb",
"=",
"0",
";",
"$",
"this",
"->",
"cir",
"->",
"init",
"(",
")",
";",
"$",
"this",
"->",
"errors",
"=",
"array",
"(... | Reset the current process.
@return void. | [
"Reset",
"the",
"current",
"process",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/uploadcourse/classes/processor.php#L367-L372 |
220,091 | moodle/moodle | tag/classes/area.php | core_tag_area.get_areas | public static function get_areas($tagcollid = null, $enabledonly = false) {
global $DB;
$cache = cache::make('core', 'tags');
if (($itemtypes = $cache->get('tag_area')) === false) {
$colls = core_tag_collection::get_collections();
$defaultcoll = reset($colls);
... | php | public static function get_areas($tagcollid = null, $enabledonly = false) {
global $DB;
$cache = cache::make('core', 'tags');
if (($itemtypes = $cache->get('tag_area')) === false) {
$colls = core_tag_collection::get_collections();
$defaultcoll = reset($colls);
... | [
"public",
"static",
"function",
"get_areas",
"(",
"$",
"tagcollid",
"=",
"null",
",",
"$",
"enabledonly",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"cache",
"=",
"cache",
"::",
"make",
"(",
"'core'",
",",
"'tags'",
")",
";",
"if",
"(",
... | Returns the list of areas indexed by itemtype and component
@param int $tagcollid return only areas in this tag collection
@param bool $enabledonly return only enabled tag areas
@return array itemtype=>component=>tagarea object | [
"Returns",
"the",
"list",
"of",
"areas",
"indexed",
"by",
"itemtype",
"and",
"component"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/area.php#L43-L71 |
220,092 | moodle/moodle | tag/classes/area.php | core_tag_area.get_by_id | public static function get_by_id($tagareaid) {
$tagareas = self::get_areas();
foreach ($tagareas as $itemtype => $it) {
foreach ($it as $component => $v) {
if ($v->id == $tagareaid) {
return $v;
}
}
}
return null... | php | public static function get_by_id($tagareaid) {
$tagareas = self::get_areas();
foreach ($tagareas as $itemtype => $it) {
foreach ($it as $component => $v) {
if ($v->id == $tagareaid) {
return $v;
}
}
}
return null... | [
"public",
"static",
"function",
"get_by_id",
"(",
"$",
"tagareaid",
")",
"{",
"$",
"tagareas",
"=",
"self",
"::",
"get_areas",
"(",
")",
";",
"foreach",
"(",
"$",
"tagareas",
"as",
"$",
"itemtype",
"=>",
"$",
"it",
")",
"{",
"foreach",
"(",
"$",
"it"... | Retrieves info about one tag area
@param int $tagareaid
@return stdClass | [
"Retrieves",
"info",
"about",
"one",
"tag",
"area"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/area.php#L79-L89 |
220,093 | moodle/moodle | tag/classes/area.php | core_tag_area.display_name | public static function display_name($component, $itemtype) {
$identifier = 'tagarea_' . clean_param($itemtype, PARAM_STRINGID);
if ($component === 'core') {
$component = 'tag';
}
return new lang_string($identifier, $component);
} | php | public static function display_name($component, $itemtype) {
$identifier = 'tagarea_' . clean_param($itemtype, PARAM_STRINGID);
if ($component === 'core') {
$component = 'tag';
}
return new lang_string($identifier, $component);
} | [
"public",
"static",
"function",
"display_name",
"(",
"$",
"component",
",",
"$",
"itemtype",
")",
"{",
"$",
"identifier",
"=",
"'tagarea_'",
".",
"clean_param",
"(",
"$",
"itemtype",
",",
"PARAM_STRINGID",
")",
";",
"if",
"(",
"$",
"component",
"===",
"'co... | Returns the display name for this area
@param string $component
@param string $itemtype
@return lang_string | [
"Returns",
"the",
"display",
"name",
"for",
"this",
"area"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/area.php#L98-L104 |
220,094 | moodle/moodle | tag/classes/area.php | core_tag_area.is_enabled | public static function is_enabled($component, $itemtype) {
global $CFG;
if (empty($CFG->usetags)) {
return false;
}
$itemtypes = self::get_areas();
if (isset($itemtypes[$itemtype][$component])) {
return $itemtypes[$itemtype][$component]->enabled ? true : f... | php | public static function is_enabled($component, $itemtype) {
global $CFG;
if (empty($CFG->usetags)) {
return false;
}
$itemtypes = self::get_areas();
if (isset($itemtypes[$itemtype][$component])) {
return $itemtypes[$itemtype][$component]->enabled ? true : f... | [
"public",
"static",
"function",
"is_enabled",
"(",
"$",
"component",
",",
"$",
"itemtype",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"usetags",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"itemtypes",
"=",
... | Returns whether the tag area is enabled
@param string $component component responsible for tagging
@param string $itemtype what is being tagged, for example, 'post', 'course', 'user', etc.
@return bool|null | [
"Returns",
"whether",
"the",
"tag",
"area",
"is",
"enabled"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/area.php#L113-L123 |
220,095 | moodle/moodle | tag/classes/area.php | core_tag_area.allows_tagging_in_multiple_contexts | public static function allows_tagging_in_multiple_contexts($component, $itemtype) {
$itemtypes = self::get_areas();
if (isset($itemtypes[$itemtype][$component])) {
$config = $itemtypes[$itemtype][$component];
return isset($config->multiplecontexts) ? $config->multiplecontexts : f... | php | public static function allows_tagging_in_multiple_contexts($component, $itemtype) {
$itemtypes = self::get_areas();
if (isset($itemtypes[$itemtype][$component])) {
$config = $itemtypes[$itemtype][$component];
return isset($config->multiplecontexts) ? $config->multiplecontexts : f... | [
"public",
"static",
"function",
"allows_tagging_in_multiple_contexts",
"(",
"$",
"component",
",",
"$",
"itemtype",
")",
"{",
"$",
"itemtypes",
"=",
"self",
"::",
"get_areas",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"itemtypes",
"[",
"$",
"itemtype",
... | Checks if the tag area allows items to be tagged in multiple different contexts.
If true then it indicates that not all tag instance contexts must match the
context of the item they are tagging. If false then all tag instance should
match the context of the item they are tagging.
Example use case for multi-context ta... | [
"Checks",
"if",
"the",
"tag",
"area",
"allows",
"items",
"to",
"be",
"tagged",
"in",
"multiple",
"different",
"contexts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/area.php#L142-L149 |
220,096 | moodle/moodle | tag/classes/area.php | core_tag_area.get_collection | public static function get_collection($component, $itemtype) {
$itemtypes = self::get_areas();
if (array_key_exists($itemtype, $itemtypes)) {
if (!array_key_exists($component, $itemtypes[$itemtype])) {
$component = key($itemtypes[$itemtype]);
}
return ... | php | public static function get_collection($component, $itemtype) {
$itemtypes = self::get_areas();
if (array_key_exists($itemtype, $itemtypes)) {
if (!array_key_exists($component, $itemtypes[$itemtype])) {
$component = key($itemtypes[$itemtype]);
}
return ... | [
"public",
"static",
"function",
"get_collection",
"(",
"$",
"component",
",",
"$",
"itemtype",
")",
"{",
"$",
"itemtypes",
"=",
"self",
"::",
"get_areas",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"itemtype",
",",
"$",
"itemtypes",
")",
")"... | Returns the id of the tag collection that should be used for storing tags of this itemtype
@param string $component component responsible for tagging
@param string $itemtype what is being tagged, for example, 'post', 'course', 'user', etc.
@return int | [
"Returns",
"the",
"id",
"of",
"the",
"tag",
"collection",
"that",
"should",
"be",
"used",
"for",
"storing",
"tags",
"of",
"this",
"itemtype"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/area.php#L158-L167 |
220,097 | moodle/moodle | tag/classes/area.php | core_tag_area.get_showstandard | public static function get_showstandard($component, $itemtype) {
$itemtypes = self::get_areas();
if (array_key_exists($itemtype, $itemtypes)) {
if (!array_key_exists($component, $itemtypes[$itemtype])) {
$component = key($itemtypes[$itemtype]);
}
retur... | php | public static function get_showstandard($component, $itemtype) {
$itemtypes = self::get_areas();
if (array_key_exists($itemtype, $itemtypes)) {
if (!array_key_exists($component, $itemtypes[$itemtype])) {
$component = key($itemtypes[$itemtype]);
}
retur... | [
"public",
"static",
"function",
"get_showstandard",
"(",
"$",
"component",
",",
"$",
"itemtype",
")",
"{",
"$",
"itemtypes",
"=",
"self",
"::",
"get_areas",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"itemtype",
",",
"$",
"itemtypes",
")",
"... | Returns wether this tag area should display or not standard tags when user edits it.
@param string $component component responsible for tagging
@param string $itemtype what is being tagged, for example, 'post', 'course', 'user', etc.
@return int | [
"Returns",
"wether",
"this",
"tag",
"area",
"should",
"display",
"or",
"not",
"standard",
"tags",
"when",
"user",
"edits",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/area.php#L176-L185 |
220,098 | moodle/moodle | tag/classes/area.php | core_tag_area.get_definitions_for_component | protected static function get_definitions_for_component($componentname) {
global $DB;
list($a, $b) = core_component::normalize_component($componentname);
$component = $b ? ($a . '_' . $b) : $a;
$sql = 'component = :component';
$params = array('component' => $component);
i... | php | protected static function get_definitions_for_component($componentname) {
global $DB;
list($a, $b) = core_component::normalize_component($componentname);
$component = $b ? ($a . '_' . $b) : $a;
$sql = 'component = :component';
$params = array('component' => $component);
i... | [
"protected",
"static",
"function",
"get_definitions_for_component",
"(",
"$",
"componentname",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"core_component",
"::",
"normalize_component",
"(",
"$",
"componentname",
")",
... | Returns all tag areas and collections that are currently cached in DB for this component
@param string $componentname
@return array first element is the list of areas and the second list of collections | [
"Returns",
"all",
"tag",
"areas",
"and",
"collections",
"that",
"are",
"currently",
"cached",
"in",
"DB",
"for",
"this",
"component"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/area.php#L193-L211 |
220,099 | moodle/moodle | tag/classes/area.php | core_tag_area.delete | protected static function delete($record) {
global $DB;
core_tag_tag::delete_instances($record->component, $record->itemtype);
$DB->delete_records('tag_area',
array('itemtype' => $record->itemtype,
'component' => $record->component));
// Reset cache... | php | protected static function delete($record) {
global $DB;
core_tag_tag::delete_instances($record->component, $record->itemtype);
$DB->delete_records('tag_area',
array('itemtype' => $record->itemtype,
'component' => $record->component));
// Reset cache... | [
"protected",
"static",
"function",
"delete",
"(",
"$",
"record",
")",
"{",
"global",
"$",
"DB",
";",
"core_tag_tag",
"::",
"delete_instances",
"(",
"$",
"record",
"->",
"component",
",",
"$",
"record",
"->",
"itemtype",
")",
";",
"$",
"DB",
"->",
"delete... | Completely delete a tag area and all instances inside it
@param stdClass $record | [
"Completely",
"delete",
"a",
"tag",
"area",
"and",
"all",
"instances",
"inside",
"it"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/area.php#L218-L229 |
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.