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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
217,200 | moodle/moodle | media/classes/manager.php | core_media_manager.get_players | private function get_players() {
// Save time by only building the list once.
if (!$this->players) {
$sortorder = \core\plugininfo\media::get_enabled_plugins();
$this->players = [];
foreach ($sortorder as $name) {
$classname = "media_" . $name . "_plu... | php | private function get_players() {
// Save time by only building the list once.
if (!$this->players) {
$sortorder = \core\plugininfo\media::get_enabled_plugins();
$this->players = [];
foreach ($sortorder as $name) {
$classname = "media_" . $name . "_plu... | [
"private",
"function",
"get_players",
"(",
")",
"{",
"// Save time by only building the list once.",
"if",
"(",
"!",
"$",
"this",
"->",
"players",
")",
"{",
"$",
"sortorder",
"=",
"\\",
"core",
"\\",
"plugininfo",
"\\",
"media",
"::",
"get_enabled_plugins",
"(",... | Obtains the list of core_media_player objects currently in use to render
items.
The list is in rank order (highest first) and does not include players
which are disabled.
@return core_media_player[] Array of core_media_player objects in rank order | [
"Obtains",
"the",
"list",
"of",
"core_media_player",
"objects",
"currently",
"in",
"use",
"to",
"render",
"items",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/media/classes/manager.php#L172-L186 |
217,201 | moodle/moodle | media/classes/manager.php | core_media_manager.fallback_to_link | private function fallback_to_link($urls, $name, $options) {
// If link is turned off, return empty.
if (!empty($options[self::OPTION_NO_LINK])) {
return '';
}
// Build up link content.
$output = '';
foreach ($urls as $url) {
if (strval($name) !== ... | php | private function fallback_to_link($urls, $name, $options) {
// If link is turned off, return empty.
if (!empty($options[self::OPTION_NO_LINK])) {
return '';
}
// Build up link content.
$output = '';
foreach ($urls as $url) {
if (strval($name) !== ... | [
"private",
"function",
"fallback_to_link",
"(",
"$",
"urls",
",",
"$",
"name",
",",
"$",
"options",
")",
"{",
"// If link is turned off, return empty.",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"self",
"::",
"OPTION_NO_LINK",
"]",
")",
")",
"{",
... | Returns links to the specified URLs unless OPTION_NO_LINK is passed.
@param array $urls URLs of media files
@param string $name Display name; '' to use default
@param array $options Options array
@return string HTML code for embed | [
"Returns",
"links",
"to",
"the",
"specified",
"URLs",
"unless",
"OPTION_NO_LINK",
"is",
"passed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/media/classes/manager.php#L301-L324 |
217,202 | moodle/moodle | media/classes/manager.php | core_media_manager.can_embed_urls | public function can_embed_urls(array $urls, $options = array()) {
// Check all players to see if any of them support it.
foreach ($this->get_players() as $player) {
// First player that supports it, return true.
if ($player->list_supported_urls($urls, $options)) {
... | php | public function can_embed_urls(array $urls, $options = array()) {
// Check all players to see if any of them support it.
foreach ($this->get_players() as $player) {
// First player that supports it, return true.
if ($player->list_supported_urls($urls, $options)) {
... | [
"public",
"function",
"can_embed_urls",
"(",
"array",
"$",
"urls",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"// Check all players to see if any of them support it.",
"foreach",
"(",
"$",
"this",
"->",
"get_players",
"(",
")",
"as",
"$",
"player",
... | Checks whether a file can be embedded. If this returns true you will get
an embedded player; if this returns false, you will just get a download
link.
@param array $urls URL of media file and any alternatives (moodle_url)
@param array $options Options (same as when embedding)
@return bool True if file can be embedded | [
"Checks",
"whether",
"a",
"file",
"can",
"be",
"embedded",
".",
"If",
"this",
"returns",
"true",
"you",
"will",
"get",
"an",
"embedded",
"player",
";",
"if",
"this",
"returns",
"false",
"you",
"will",
"just",
"get",
"a",
"download",
"link",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/media/classes/manager.php#L350-L359 |
217,203 | moodle/moodle | media/classes/manager.php | core_media_manager.get_embeddable_markers | public function get_embeddable_markers() {
if (empty($this->embeddablemarkers)) {
$markers = '';
foreach ($this->get_players() as $player) {
foreach ($player->get_embeddable_markers() as $marker) {
if ($markers !== '') {
$marker... | php | public function get_embeddable_markers() {
if (empty($this->embeddablemarkers)) {
$markers = '';
foreach ($this->get_players() as $player) {
foreach ($player->get_embeddable_markers() as $marker) {
if ($markers !== '') {
$marker... | [
"public",
"function",
"get_embeddable_markers",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"embeddablemarkers",
")",
")",
"{",
"$",
"markers",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"get_players",
"(",
")",
"as",
"$",
"playe... | Obtains a list of markers that can be used in a regular expression when
searching for URLs that can be embedded by any player type.
This string is used to improve peformance of regex matching by ensuring
that the (presumably C) regex code can do a quick keyword check on the
URL part of a link to see if it matches one ... | [
"Obtains",
"a",
"list",
"of",
"markers",
"that",
"can",
"be",
"used",
"in",
"a",
"regular",
"expression",
"when",
"searching",
"for",
"URLs",
"that",
"can",
"be",
"embedded",
"by",
"any",
"player",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/media/classes/manager.php#L372-L386 |
217,204 | moodle/moodle | media/classes/manager.php | core_media_manager.get_extension | public function get_extension(moodle_url $url) {
// Note: Does not use core_text (. is UTF8-safe).
$filename = self::get_filename($url);
$dot = strrpos($filename, '.');
if ($dot === false) {
return '';
} else {
return strtolower(substr($filename, $dot + 1)... | php | public function get_extension(moodle_url $url) {
// Note: Does not use core_text (. is UTF8-safe).
$filename = self::get_filename($url);
$dot = strrpos($filename, '.');
if ($dot === false) {
return '';
} else {
return strtolower(substr($filename, $dot + 1)... | [
"public",
"function",
"get_extension",
"(",
"moodle_url",
"$",
"url",
")",
"{",
"// Note: Does not use core_text (. is UTF8-safe).",
"$",
"filename",
"=",
"self",
"::",
"get_filename",
"(",
"$",
"url",
")",
";",
"$",
"dot",
"=",
"strrpos",
"(",
"$",
"filename",
... | Returns the file extension for a URL.
@param moodle_url $url URL | [
"Returns",
"the",
"file",
"extension",
"for",
"a",
"URL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/media/classes/manager.php#L447-L456 |
217,205 | moodle/moodle | media/classes/manager.php | core_media_manager.get_filename | public function get_filename(moodle_url $url) {
// Use the 'file' parameter if provided (for links created when
// slasharguments was off). If not present, just use URL path.
$path = $url->get_param('file');
if (!$path) {
$path = $url->get_path();
}
// Remove... | php | public function get_filename(moodle_url $url) {
// Use the 'file' parameter if provided (for links created when
// slasharguments was off). If not present, just use URL path.
$path = $url->get_param('file');
if (!$path) {
$path = $url->get_path();
}
// Remove... | [
"public",
"function",
"get_filename",
"(",
"moodle_url",
"$",
"url",
")",
"{",
"// Use the 'file' parameter if provided (for links created when",
"// slasharguments was off). If not present, just use URL path.",
"$",
"path",
"=",
"$",
"url",
"->",
"get_param",
"(",
"'file'",
... | Obtains the filename from the moodle_url.
@param moodle_url $url URL
@return string Filename only (not escaped) | [
"Obtains",
"the",
"filename",
"from",
"the",
"moodle_url",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/media/classes/manager.php#L463-L477 |
217,206 | moodle/moodle | competency/classes/api.php | api.is_scale_used_anywhere | public static function is_scale_used_anywhere($scaleid) {
global $DB;
$sql = "SELECT s.id
FROM {scale} s
LEFT JOIN {" . competency_framework::TABLE ."} f
ON f.scaleid = :scaleid1
LEFT JOIN {" . competency::TABLE ."} c
ON... | php | public static function is_scale_used_anywhere($scaleid) {
global $DB;
$sql = "SELECT s.id
FROM {scale} s
LEFT JOIN {" . competency_framework::TABLE ."} f
ON f.scaleid = :scaleid1
LEFT JOIN {" . competency::TABLE ."} c
ON... | [
"public",
"static",
"function",
"is_scale_used_anywhere",
"(",
"$",
"scaleid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT s.id\n FROM {scale} s\n LEFT JOIN {\"",
".",
"competency_framework",
"::",
"TABLE",
".",
"\"} f\n ... | Checks whether a scale is used anywhere in the plugin.
This public API has two exceptions:
- It MUST NOT perform any capability checks.
- It MUST ignore whether competencies are enabled or not ({@link self::is_enabled()}).
@param int $scaleid The scale ID.
@return bool | [
"Checks",
"whether",
"a",
"scale",
"is",
"used",
"anywhere",
"in",
"the",
"plugin",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L110-L121 |
217,207 | moodle/moodle | competency/classes/api.php | api.validate_course_module | protected static function validate_course_module($cmmixed, $throwexception = true) {
$cm = $cmmixed;
if (!is_object($cm)) {
$cmrecord = get_coursemodule_from_id(null, $cmmixed);
$modinfo = get_fast_modinfo($cmrecord->course);
$cm = $modinfo->get_cm($cmmixed);
... | php | protected static function validate_course_module($cmmixed, $throwexception = true) {
$cm = $cmmixed;
if (!is_object($cm)) {
$cmrecord = get_coursemodule_from_id(null, $cmmixed);
$modinfo = get_fast_modinfo($cmrecord->course);
$cm = $modinfo->get_cm($cmmixed);
... | [
"protected",
"static",
"function",
"validate_course_module",
"(",
"$",
"cmmixed",
",",
"$",
"throwexception",
"=",
"true",
")",
"{",
"$",
"cm",
"=",
"$",
"cmmixed",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"cm",
")",
")",
"{",
"$",
"cmrecord",
"=",
... | Validate if current user have acces to the course_module if hidden.
@param mixed $cmmixed The cm_info class, course module record or its ID.
@param bool $throwexception Throw an exception or not.
@return bool | [
"Validate",
"if",
"current",
"user",
"have",
"acces",
"to",
"the",
"course_module",
"if",
"hidden",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L130-L151 |
217,208 | moodle/moodle | competency/classes/api.php | api.validate_course | protected static function validate_course($courseorid, $throwexception = true) {
$course = $courseorid;
if (!is_object($course)) {
$course = get_course($course);
}
$coursecontext = context_course::instance($course->id);
if (!$course->visible and !has_capability('mood... | php | protected static function validate_course($courseorid, $throwexception = true) {
$course = $courseorid;
if (!is_object($course)) {
$course = get_course($course);
}
$coursecontext = context_course::instance($course->id);
if (!$course->visible and !has_capability('mood... | [
"protected",
"static",
"function",
"validate_course",
"(",
"$",
"courseorid",
",",
"$",
"throwexception",
"=",
"true",
")",
"{",
"$",
"course",
"=",
"$",
"courseorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"course",
")",
")",
"{",
"$",
"course",
... | Validate if current user have acces to the course if hidden.
@param mixed $courseorid The course or it ID.
@param bool $throwexception Throw an exception or not.
@return bool | [
"Validate",
"if",
"current",
"user",
"have",
"acces",
"to",
"the",
"course",
"if",
"hidden",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L160-L176 |
217,209 | moodle/moodle | competency/classes/api.php | api.create_competency | public static function create_competency(stdClass $record) {
static::require_enabled();
$competency = new competency(0, $record);
// First we do a permissions check.
require_capability('moodle/competency:competencymanage', $competency->get_context());
// Reset the sortorder, us... | php | public static function create_competency(stdClass $record) {
static::require_enabled();
$competency = new competency(0, $record);
// First we do a permissions check.
require_capability('moodle/competency:competencymanage', $competency->get_context());
// Reset the sortorder, us... | [
"public",
"static",
"function",
"create_competency",
"(",
"stdClass",
"$",
"record",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"competency",
"=",
"new",
"competency",
"(",
"0",
",",
"$",
"record",
")",
";",
"// First we do a permissions ... | Create a competency from a record containing all the data for the class.
Requires moodle/competency:competencymanage capability at the system context.
@param stdClass $record Record containing all the data for an instance of the class.
@return competency | [
"Create",
"a",
"competency",
"from",
"a",
"record",
"containing",
"all",
"the",
"data",
"for",
"the",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L186-L207 |
217,210 | moodle/moodle | competency/classes/api.php | api.delete_competency | public static function delete_competency($id) {
global $DB;
static::require_enabled();
$competency = new competency($id);
// First we do a permissions check.
require_capability('moodle/competency:competencymanage', $competency->get_context());
$events = array();
... | php | public static function delete_competency($id) {
global $DB;
static::require_enabled();
$competency = new competency($id);
// First we do a permissions check.
require_capability('moodle/competency:competencymanage', $competency->get_context());
$events = array();
... | [
"public",
"static",
"function",
"delete_competency",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"competency",
"=",
"new",
"competency",
"(",
"$",
"id",
")",
";",
"// First we do a permissions ch... | Delete a competency by id.
Requires moodle/competency:competencymanage capability at the system context.
@param int $id The record to delete. This will delete alot of related data - you better be sure.
@return boolean | [
"Delete",
"a",
"competency",
"by",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L217-L269 |
217,211 | moodle/moodle | competency/classes/api.php | api.move_up_competency | public static function move_up_competency($id) {
static::require_enabled();
$current = new competency($id);
// First we do a permissions check.
require_capability('moodle/competency:competencymanage', $current->get_context());
$sortorder = $current->get('sortorder');
if... | php | public static function move_up_competency($id) {
static::require_enabled();
$current = new competency($id);
// First we do a permissions check.
require_capability('moodle/competency:competencymanage', $current->get_context());
$sortorder = $current->get('sortorder');
if... | [
"public",
"static",
"function",
"move_up_competency",
"(",
"$",
"id",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"current",
"=",
"new",
"competency",
"(",
"$",
"id",
")",
";",
"// First we do a permissions check.",
"require_capability",
"("... | Reorder this competency.
Requires moodle/competency:competencymanage capability at the system context.
@param int $id The id of the competency to move.
@return boolean | [
"Reorder",
"this",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L322-L350 |
217,212 | moodle/moodle | competency/classes/api.php | api.set_parent_competency | public static function set_parent_competency($id, $newparentid) {
global $DB;
static::require_enabled();
$current = new competency($id);
// First we do a permissions check.
require_capability('moodle/competency:competencymanage', $current->get_context());
if ($id == $new... | php | public static function set_parent_competency($id, $newparentid) {
global $DB;
static::require_enabled();
$current = new competency($id);
// First we do a permissions check.
require_capability('moodle/competency:competencymanage', $current->get_context());
if ($id == $new... | [
"public",
"static",
"function",
"set_parent_competency",
"(",
"$",
"id",
",",
"$",
"newparentid",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"current",
"=",
"new",
"competency",
"(",
"$",
"id",
")",
";",
... | Move this competency so it sits in a new parent.
Requires moodle/competency:competencymanage capability at the system context.
@param int $id The id of the competency to move.
@param int $newparentid The new parent id for the competency.
@return boolean | [
"Move",
"this",
"competency",
"so",
"it",
"sits",
"in",
"a",
"new",
"parent",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L361-L419 |
217,213 | moodle/moodle | competency/classes/api.php | api.update_competency | public static function update_competency($record) {
static::require_enabled();
$competency = new competency($record->id);
// First we do a permissions check.
require_capability('moodle/competency:competencymanage', $competency->get_context());
// Some things should not be chang... | php | public static function update_competency($record) {
static::require_enabled();
$competency = new competency($record->id);
// First we do a permissions check.
require_capability('moodle/competency:competencymanage', $competency->get_context());
// Some things should not be chang... | [
"public",
"static",
"function",
"update_competency",
"(",
"$",
"record",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"competency",
"=",
"new",
"competency",
"(",
"$",
"record",
"->",
"id",
")",
";",
"// First we do a permissions check.",
"... | Update the details for a competency.
Requires moodle/competency:competencymanage capability at the system context.
@param stdClass $record The new details for the competency.
Note - must contain an id that points to the competency to update.
@return boolean | [
"Update",
"the",
"details",
"for",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L431-L453 |
217,214 | moodle/moodle | competency/classes/api.php | api.read_competency | public static function read_competency($id, $includerelated = false) {
static::require_enabled();
$competency = new competency($id);
// First we do a permissions check.
$context = $competency->get_context();
if (!has_any_capability(array('moodle/competency:competencyview', 'mood... | php | public static function read_competency($id, $includerelated = false) {
static::require_enabled();
$competency = new competency($id);
// First we do a permissions check.
$context = $competency->get_context();
if (!has_any_capability(array('moodle/competency:competencyview', 'mood... | [
"public",
"static",
"function",
"read_competency",
"(",
"$",
"id",
",",
"$",
"includerelated",
"=",
"false",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"competency",
"=",
"new",
"competency",
"(",
"$",
"id",
")",
";",
"// First we do ... | Read a the details for a single competency and return a record.
Requires moodle/competency:competencyview capability at the system context.
@param int $id The id of the competency to read.
@param bool $includerelated Include related tags or not.
@return stdClass | [
"Read",
"a",
"the",
"details",
"for",
"a",
"single",
"competency",
"and",
"return",
"a",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L464-L483 |
217,215 | moodle/moodle | competency/classes/api.php | api.search_competencies | public static function search_competencies($textsearch, $competencyframeworkid) {
static::require_enabled();
$framework = new competency_framework($competencyframeworkid);
// First we do a permissions check.
$context = $framework->get_context();
if (!has_any_capability(array('mo... | php | public static function search_competencies($textsearch, $competencyframeworkid) {
static::require_enabled();
$framework = new competency_framework($competencyframeworkid);
// First we do a permissions check.
$context = $framework->get_context();
if (!has_any_capability(array('mo... | [
"public",
"static",
"function",
"search_competencies",
"(",
"$",
"textsearch",
",",
"$",
"competencyframeworkid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"framework",
"=",
"new",
"competency_framework",
"(",
"$",
"competencyframeworkid",
"... | Perform a text search based and return all results and their parents.
Requires moodle/competency:competencyview capability at the framework context.
@param string $textsearch A string to search for.
@param int $competencyframeworkid The id of the framework to limit the search.
@return array of competencies | [
"Perform",
"a",
"text",
"search",
"based",
"and",
"return",
"all",
"results",
"and",
"their",
"parents",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L494-L507 |
217,216 | moodle/moodle | competency/classes/api.php | api.create_framework | public static function create_framework(stdClass $record) {
static::require_enabled();
$framework = new competency_framework(0, $record);
require_capability('moodle/competency:competencymanage', $framework->get_context());
// Account for different formats of taxonomies.
if (isse... | php | public static function create_framework(stdClass $record) {
static::require_enabled();
$framework = new competency_framework(0, $record);
require_capability('moodle/competency:competencymanage', $framework->get_context());
// Account for different formats of taxonomies.
if (isse... | [
"public",
"static",
"function",
"create_framework",
"(",
"stdClass",
"$",
"record",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"framework",
"=",
"new",
"competency_framework",
"(",
"0",
",",
"$",
"record",
")",
";",
"require_capability",
... | Create a competency framework from a record containing all the data for the class.
Requires moodle/competency:competencymanage capability at the system context.
@param stdClass $record Record containing all the data for an instance of the class.
@return competency_framework | [
"Create",
"a",
"competency",
"framework",
"from",
"a",
"record",
"containing",
"all",
"the",
"data",
"for",
"the",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L573-L589 |
217,217 | moodle/moodle | competency/classes/api.php | api.duplicate_framework | public static function duplicate_framework($id) {
global $DB;
static::require_enabled();
$framework = new competency_framework($id);
require_capability('moodle/competency:competencymanage', $framework->get_context());
// Starting transaction.
$transaction = $DB->start_de... | php | public static function duplicate_framework($id) {
global $DB;
static::require_enabled();
$framework = new competency_framework($id);
require_capability('moodle/competency:competencymanage', $framework->get_context());
// Starting transaction.
$transaction = $DB->start_de... | [
"public",
"static",
"function",
"duplicate_framework",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"framework",
"=",
"new",
"competency_framework",
"(",
"$",
"id",
")",
";",
"require_capability",... | Duplicate a competency framework by id.
Requires moodle/competency:competencymanage capability at the system context.
@param int $id The record to duplicate. All competencies associated and related will be duplicated.
@return competency_framework the framework duplicated | [
"Duplicate",
"a",
"competency",
"framework",
"by",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L599-L658 |
217,218 | moodle/moodle | competency/classes/api.php | api.delete_framework | public static function delete_framework($id) {
global $DB;
static::require_enabled();
$framework = new competency_framework($id);
require_capability('moodle/competency:competencymanage', $framework->get_context());
$events = array();
$competenciesid = competency::get_ids... | php | public static function delete_framework($id) {
global $DB;
static::require_enabled();
$framework = new competency_framework($id);
require_capability('moodle/competency:competencymanage', $framework->get_context());
$events = array();
$competenciesid = competency::get_ids... | [
"public",
"static",
"function",
"delete_framework",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"framework",
"=",
"new",
"competency_framework",
"(",
"$",
"id",
")",
";",
"require_capability",
... | Delete a competency framework by id.
Requires moodle/competency:competencymanage capability at the system context.
@param int $id The record to delete. This will delete alot of related data - you better be sure.
@return boolean | [
"Delete",
"a",
"competency",
"framework",
"by",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L668-L716 |
217,219 | moodle/moodle | competency/classes/api.php | api.update_framework | public static function update_framework($record) {
static::require_enabled();
$framework = new competency_framework($record->id);
// Check the permissions before update.
require_capability('moodle/competency:competencymanage', $framework->get_context());
// Account for differen... | php | public static function update_framework($record) {
static::require_enabled();
$framework = new competency_framework($record->id);
// Check the permissions before update.
require_capability('moodle/competency:competencymanage', $framework->get_context());
// Account for differen... | [
"public",
"static",
"function",
"update_framework",
"(",
"$",
"record",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"framework",
"=",
"new",
"competency_framework",
"(",
"$",
"record",
"->",
"id",
")",
";",
"// Check the permissions before u... | Update the details for a competency framework.
Requires moodle/competency:competencymanage capability at the system context.
@param stdClass $record The new details for the framework. Note - must contain an id that points to the framework to update.
@return boolean | [
"Update",
"the",
"details",
"for",
"a",
"competency",
"framework",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L726-L743 |
217,220 | moodle/moodle | competency/classes/api.php | api.read_framework | public static function read_framework($id) {
static::require_enabled();
$framework = new competency_framework($id);
if (!has_any_capability(array('moodle/competency:competencyview', 'moodle/competency:competencymanage'),
$framework->get_context())) {
throw new require... | php | public static function read_framework($id) {
static::require_enabled();
$framework = new competency_framework($id);
if (!has_any_capability(array('moodle/competency:competencyview', 'moodle/competency:competencymanage'),
$framework->get_context())) {
throw new require... | [
"public",
"static",
"function",
"read_framework",
"(",
"$",
"id",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"framework",
"=",
"new",
"competency_framework",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"has_any_capability",
"(",
"array"... | Read a the details for a single competency framework and return a record.
Requires moodle/competency:competencyview capability at the system context.
@param int $id The id of the framework to read.
@return competency_framework | [
"Read",
"a",
"the",
"details",
"for",
"a",
"single",
"competency",
"framework",
"and",
"return",
"a",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L753-L762 |
217,221 | moodle/moodle | competency/classes/api.php | api.competency_framework_viewed | public static function competency_framework_viewed($frameworkorid) {
static::require_enabled();
$framework = $frameworkorid;
if (!is_object($framework)) {
$framework = new competency_framework($framework);
}
if (!has_any_capability(array('moodle/competency:competencyv... | php | public static function competency_framework_viewed($frameworkorid) {
static::require_enabled();
$framework = $frameworkorid;
if (!is_object($framework)) {
$framework = new competency_framework($framework);
}
if (!has_any_capability(array('moodle/competency:competencyv... | [
"public",
"static",
"function",
"competency_framework_viewed",
"(",
"$",
"frameworkorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"framework",
"=",
"$",
"frameworkorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"framework",
")",
"... | Logg the competency framework viewed event.
@param competency_framework|int $frameworkorid The competency_framework object or competency framework id
@return bool | [
"Logg",
"the",
"competency",
"framework",
"viewed",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L770-L783 |
217,222 | moodle/moodle | competency/classes/api.php | api.competency_viewed | public static function competency_viewed($competencyorid) {
static::require_enabled();
$competency = $competencyorid;
if (!is_object($competency)) {
$competency = new competency($competency);
}
if (!has_any_capability(array('moodle/competency:competencyview', 'moodle... | php | public static function competency_viewed($competencyorid) {
static::require_enabled();
$competency = $competencyorid;
if (!is_object($competency)) {
$competency = new competency($competency);
}
if (!has_any_capability(array('moodle/competency:competencyview', 'moodle... | [
"public",
"static",
"function",
"competency_viewed",
"(",
"$",
"competencyorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"competency",
"=",
"$",
"competencyorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"competency",
")",
")",
... | Logg the competency viewed event.
@param competency|int $competencyorid The competency object or competency id
@return bool | [
"Logg",
"the",
"competency",
"viewed",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L791-L806 |
217,223 | moodle/moodle | competency/classes/api.php | api.get_related_contexts | public static function get_related_contexts($context, $includes, array $hasanycapability = null) {
global $DB;
static::require_enabled();
if (!in_array($includes, array('children', 'parents', 'self'))) {
throw new coding_exception('Invalid parameter value for \'includes\'.');
... | php | public static function get_related_contexts($context, $includes, array $hasanycapability = null) {
global $DB;
static::require_enabled();
if (!in_array($includes, array('children', 'parents', 'self'))) {
throw new coding_exception('Invalid parameter value for \'includes\'.');
... | [
"public",
"static",
"function",
"get_related_contexts",
"(",
"$",
"context",
",",
"$",
"includes",
",",
"array",
"$",
"hasanycapability",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"if",
"(",
"!",
"... | Fetches all the relevant contexts.
Note: This currently only supports system, category and user contexts. However user contexts
behave a bit differently and will fallback on the system context. This is what makes the most
sense because a user context does not have descendants, and only has system as a parent.
@param ... | [
"Fetches",
"all",
"the",
"relevant",
"contexts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L906-L950 |
217,224 | moodle/moodle | competency/classes/api.php | api.count_courses_using_competency | public static function count_courses_using_competency($competencyid) {
static::require_enabled();
// OK - all set.
$courses = course_competency::list_courses_min($competencyid);
$count = 0;
// Now check permissions on each course.
foreach ($courses as $course) {
... | php | public static function count_courses_using_competency($competencyid) {
static::require_enabled();
// OK - all set.
$courses = course_competency::list_courses_min($competencyid);
$count = 0;
// Now check permissions on each course.
foreach ($courses as $course) {
... | [
"public",
"static",
"function",
"count_courses_using_competency",
"(",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// OK - all set.",
"$",
"courses",
"=",
"course_competency",
"::",
"list_courses_min",
"(",
"$",
"competencyid",
... | Count all the courses using a competency.
@param int $competencyid The id of the competency to check.
@return int | [
"Count",
"all",
"the",
"courses",
"using",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L958-L981 |
217,225 | moodle/moodle | competency/classes/api.php | api.list_course_modules_using_competency | public static function list_course_modules_using_competency($competencyid, $courseid) {
static::require_enabled();
$result = array();
self::validate_course($courseid);
$coursecontext = context_course::instance($courseid);
// We will not check each module - course permissions s... | php | public static function list_course_modules_using_competency($competencyid, $courseid) {
static::require_enabled();
$result = array();
self::validate_course($courseid);
$coursecontext = context_course::instance($courseid);
// We will not check each module - course permissions s... | [
"public",
"static",
"function",
"list_course_modules_using_competency",
"(",
"$",
"competencyid",
",",
"$",
"courseid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"self",
"::",
"validate_course",
"("... | List all the courses modules using a competency in a course.
@param int $competencyid The id of the competency to check.
@param int $courseid The id of the course to check.
@return array[int] Array of course modules ids. | [
"List",
"all",
"the",
"courses",
"modules",
"using",
"a",
"competency",
"in",
"a",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L990-L1012 |
217,226 | moodle/moodle | competency/classes/api.php | api.list_course_module_competencies_in_course_module | public static function list_course_module_competencies_in_course_module($cmorid) {
static::require_enabled();
$cm = $cmorid;
if (!is_object($cmorid)) {
$cm = get_coursemodule_from_id('', $cmorid, 0, true, MUST_EXIST);
}
// Check the user have access to the course mod... | php | public static function list_course_module_competencies_in_course_module($cmorid) {
static::require_enabled();
$cm = $cmorid;
if (!is_object($cmorid)) {
$cm = get_coursemodule_from_id('', $cmorid, 0, true, MUST_EXIST);
}
// Check the user have access to the course mod... | [
"public",
"static",
"function",
"list_course_module_competencies_in_course_module",
"(",
"$",
"cmorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"cm",
"=",
"$",
"cmorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"cmorid",
")",
")",... | List all the competencies linked to a course module.
@param mixed $cmorid The course module, or its ID.
@return array[competency] Array of competency records. | [
"List",
"all",
"the",
"competencies",
"linked",
"to",
"a",
"course",
"module",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1020-L1044 |
217,227 | moodle/moodle | competency/classes/api.php | api.list_courses_using_competency | public static function list_courses_using_competency($competencyid) {
static::require_enabled();
// OK - all set.
$courses = course_competency::list_courses($competencyid);
$result = array();
// Now check permissions on each course.
foreach ($courses as $id => $course) ... | php | public static function list_courses_using_competency($competencyid) {
static::require_enabled();
// OK - all set.
$courses = course_competency::list_courses($competencyid);
$result = array();
// Now check permissions on each course.
foreach ($courses as $id => $course) ... | [
"public",
"static",
"function",
"list_courses_using_competency",
"(",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// OK - all set.",
"$",
"courses",
"=",
"course_competency",
"::",
"list_courses",
"(",
"$",
"competencyid",
")",
... | List all the courses using a competency.
@param int $competencyid The id of the competency to check.
@return array[stdClass] Array of stdClass containing id and shortname. | [
"List",
"all",
"the",
"courses",
"using",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1052-L1075 |
217,228 | moodle/moodle | competency/classes/api.php | api.count_proficient_competencies_in_course_for_user | public static function count_proficient_competencies_in_course_for_user($courseid, $userid) {
static::require_enabled();
// Check the user have access to the course.
self::validate_course($courseid);
// First we do a permissions check.
$context = context_course::instance($course... | php | public static function count_proficient_competencies_in_course_for_user($courseid, $userid) {
static::require_enabled();
// Check the user have access to the course.
self::validate_course($courseid);
// First we do a permissions check.
$context = context_course::instance($course... | [
"public",
"static",
"function",
"count_proficient_competencies_in_course_for_user",
"(",
"$",
"courseid",
",",
"$",
"userid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// Check the user have access to the course.",
"self",
"::",
"validate_course",
"(",
... | Count the proficient competencies in a course for one user.
@param int $courseid The id of the course to check.
@param int $userid The id of the user to check.
@return int | [
"Count",
"the",
"proficient",
"competencies",
"in",
"a",
"course",
"for",
"one",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1084-L1099 |
217,229 | moodle/moodle | competency/classes/api.php | api.count_competencies_in_course | public static function count_competencies_in_course($courseid) {
static::require_enabled();
// Check the user have access to the course.
self::validate_course($courseid);
// First we do a permissions check.
$context = context_course::instance($courseid);
$capabilities =... | php | public static function count_competencies_in_course($courseid) {
static::require_enabled();
// Check the user have access to the course.
self::validate_course($courseid);
// First we do a permissions check.
$context = context_course::instance($courseid);
$capabilities =... | [
"public",
"static",
"function",
"count_competencies_in_course",
"(",
"$",
"courseid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// Check the user have access to the course.",
"self",
"::",
"validate_course",
"(",
"$",
"courseid",
")",
";",
"// First... | Count all the competencies in a course.
@param int $courseid The id of the course to check.
@return int | [
"Count",
"all",
"the",
"competencies",
"in",
"a",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1107-L1122 |
217,230 | moodle/moodle | competency/classes/api.php | api.list_course_competencies | public static function list_course_competencies($courseorid) {
static::require_enabled();
$course = $courseorid;
if (!is_object($courseorid)) {
$course = get_course($courseorid);
}
// Check the user have access to the course.
self::validate_course($course);
... | php | public static function list_course_competencies($courseorid) {
static::require_enabled();
$course = $courseorid;
if (!is_object($courseorid)) {
$course = get_course($courseorid);
}
// Check the user have access to the course.
self::validate_course($course);
... | [
"public",
"static",
"function",
"list_course_competencies",
"(",
"$",
"courseorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"course",
"=",
"$",
"courseorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"courseorid",
")",
")",
"{",
... | List the competencies associated to a course.
@param mixed $courseorid The course, or its ID.
@return array( array(
'competency' => \core_competency\competency,
'coursecompetency' => \core_competency\course_competency
)) | [
"List",
"the",
"competencies",
"associated",
"to",
"a",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1133-L1164 |
217,231 | moodle/moodle | competency/classes/api.php | api.get_user_competency | public static function get_user_competency($userid, $competencyid) {
static::require_enabled();
$existing = user_competency::get_multiple($userid, array($competencyid));
$uc = array_pop($existing);
if (!$uc) {
$uc = user_competency::create_relation($userid, $competencyid);
... | php | public static function get_user_competency($userid, $competencyid) {
static::require_enabled();
$existing = user_competency::get_multiple($userid, array($competencyid));
$uc = array_pop($existing);
if (!$uc) {
$uc = user_competency::create_relation($userid, $competencyid);
... | [
"public",
"static",
"function",
"get_user_competency",
"(",
"$",
"userid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"existing",
"=",
"user_competency",
"::",
"get_multiple",
"(",
"$",
"userid",
",",
"array",
... | Get a user competency.
@param int $userid The user ID.
@param int $competencyid The competency ID.
@return user_competency | [
"Get",
"a",
"user",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1173-L1188 |
217,232 | moodle/moodle | competency/classes/api.php | api.get_user_competency_by_id | public static function get_user_competency_by_id($usercompetencyid) {
static::require_enabled();
$uc = new user_competency($usercompetencyid);
if (!$uc->can_read()) {
throw new required_capability_exception($uc->get_context(), 'moodle/competency:usercompetencyview',
'... | php | public static function get_user_competency_by_id($usercompetencyid) {
static::require_enabled();
$uc = new user_competency($usercompetencyid);
if (!$uc->can_read()) {
throw new required_capability_exception($uc->get_context(), 'moodle/competency:usercompetencyview',
'... | [
"public",
"static",
"function",
"get_user_competency_by_id",
"(",
"$",
"usercompetencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"uc",
"=",
"new",
"user_competency",
"(",
"$",
"usercompetencyid",
")",
";",
"if",
"(",
"!",
"$",
"uc"... | Get a user competency by ID.
@param int $usercompetencyid The user competency ID.
@return user_competency | [
"Get",
"a",
"user",
"competency",
"by",
"ID",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1196-L1204 |
217,233 | moodle/moodle | competency/classes/api.php | api.list_course_module_competencies | public static function list_course_module_competencies($cmorid) {
static::require_enabled();
$cm = $cmorid;
if (!is_object($cmorid)) {
$cm = get_coursemodule_from_id('', $cmorid, 0, true, MUST_EXIST);
}
// Check the user have access to the course module.
self... | php | public static function list_course_module_competencies($cmorid) {
static::require_enabled();
$cm = $cmorid;
if (!is_object($cmorid)) {
$cm = get_coursemodule_from_id('', $cmorid, 0, true, MUST_EXIST);
}
// Check the user have access to the course module.
self... | [
"public",
"static",
"function",
"list_course_module_competencies",
"(",
"$",
"cmorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"cm",
"=",
"$",
"cmorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"cmorid",
")",
")",
"{",
"$",
... | List the competencies associated to a course module.
@param mixed $cmorid The course module, or its ID.
@return array( array(
'competency' => \core_competency\competency,
'coursemodulecompetency' => \core_competency\course_module_competency
)) | [
"List",
"the",
"competencies",
"associated",
"to",
"a",
"course",
"module",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1215-L1246 |
217,234 | moodle/moodle | competency/classes/api.php | api.get_user_competency_in_course | public static function get_user_competency_in_course($courseid, $userid, $competencyid) {
static::require_enabled();
// First we do a permissions check.
$context = context_course::instance($courseid);
$capabilities = array('moodle/competency:coursecompetencyview', 'moodle/competency:cou... | php | public static function get_user_competency_in_course($courseid, $userid, $competencyid) {
static::require_enabled();
// First we do a permissions check.
$context = context_course::instance($courseid);
$capabilities = array('moodle/competency:coursecompetencyview', 'moodle/competency:cou... | [
"public",
"static",
"function",
"get_user_competency_in_course",
"(",
"$",
"courseid",
",",
"$",
"userid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// First we do a permissions check.",
"$",
"context",
"=",
"context_cour... | Get a user competency in a course.
@param int $courseid The id of the course to check.
@param int $userid The id of the course to check.
@param int $competencyid The id of the competency.
@return user_competency_course | [
"Get",
"a",
"user",
"competency",
"in",
"a",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1256-L1282 |
217,235 | moodle/moodle | competency/classes/api.php | api.list_user_competencies_in_course | public static function list_user_competencies_in_course($courseid, $userid) {
static::require_enabled();
// First we do a permissions check.
$context = context_course::instance($courseid);
$onlyvisible = 1;
$capabilities = array('moodle/competency:coursecompetencyview', 'moodle/... | php | public static function list_user_competencies_in_course($courseid, $userid) {
static::require_enabled();
// First we do a permissions check.
$context = context_course::instance($courseid);
$onlyvisible = 1;
$capabilities = array('moodle/competency:coursecompetencyview', 'moodle/... | [
"public",
"static",
"function",
"list_user_competencies_in_course",
"(",
"$",
"courseid",
",",
"$",
"userid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// First we do a permissions check.",
"$",
"context",
"=",
"context_course",
"::",
"instance",
... | List all the user competencies in a course.
@param int $courseid The id of the course to check.
@param int $userid The id of the course to check.
@return array of user_competency_course objects | [
"List",
"all",
"the",
"user",
"competencies",
"in",
"a",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1291-L1329 |
217,236 | moodle/moodle | competency/classes/api.php | api.list_user_competencies_to_review | public static function list_user_competencies_to_review($skip = 0, $limit = 50, $userid = null) {
global $DB, $USER;
static::require_enabled();
if ($userid === null) {
$userid = $USER->id;
}
$capability = 'moodle/competency:usercompetencyreview';
$ucfields = ... | php | public static function list_user_competencies_to_review($skip = 0, $limit = 50, $userid = null) {
global $DB, $USER;
static::require_enabled();
if ($userid === null) {
$userid = $USER->id;
}
$capability = 'moodle/competency:usercompetencyreview';
$ucfields = ... | [
"public",
"static",
"function",
"list_user_competencies_to_review",
"(",
"$",
"skip",
"=",
"0",
",",
"$",
"limit",
"=",
"50",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"static",
"::",
"require_enabled",
"(",
... | List the user competencies to review.
The method returns values in this format:
array(
'competencies' => array(
(stdClass)(
'usercompetency' => (user_competency),
'competency' => (competency),
'user' => (user)
)
),
'count' => (int)
)
@param int $skip The number of records to skip.
@param int $limit The number of res... | [
"List",
"the",
"user",
"competencies",
"to",
"review",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1353-L1418 |
217,237 | moodle/moodle | competency/classes/api.php | api.add_competency_to_course_module | public static function add_competency_to_course_module($cmorid, $competencyid) {
static::require_enabled();
$cm = $cmorid;
if (!is_object($cmorid)) {
$cm = get_coursemodule_from_id('', $cmorid, 0, true, MUST_EXIST);
}
// Check the user have access to the course modul... | php | public static function add_competency_to_course_module($cmorid, $competencyid) {
static::require_enabled();
$cm = $cmorid;
if (!is_object($cmorid)) {
$cm = get_coursemodule_from_id('', $cmorid, 0, true, MUST_EXIST);
}
// Check the user have access to the course modul... | [
"public",
"static",
"function",
"add_competency_to_course_module",
"(",
"$",
"cmorid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"cm",
"=",
"$",
"cmorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"cmorid"... | Add a competency to this course module.
@param mixed $cmorid The course module, or id of the course module
@param int $competencyid The id of the competency
@return bool | [
"Add",
"a",
"competency",
"to",
"this",
"course",
"module",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1427-L1461 |
217,238 | moodle/moodle | competency/classes/api.php | api.remove_competency_from_course_module | public static function remove_competency_from_course_module($cmorid, $competencyid) {
static::require_enabled();
$cm = $cmorid;
if (!is_object($cmorid)) {
$cm = get_coursemodule_from_id('', $cmorid, 0, true, MUST_EXIST);
}
// Check the user have access to the course m... | php | public static function remove_competency_from_course_module($cmorid, $competencyid) {
static::require_enabled();
$cm = $cmorid;
if (!is_object($cmorid)) {
$cm = get_coursemodule_from_id('', $cmorid, 0, true, MUST_EXIST);
}
// Check the user have access to the course m... | [
"public",
"static",
"function",
"remove_competency_from_course_module",
"(",
"$",
"cmorid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"cm",
"=",
"$",
"cmorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"cm... | Remove a competency from this course module.
@param mixed $cmorid The course module, or id of the course module
@param int $competencyid The id of the competency
@return bool | [
"Remove",
"a",
"competency",
"from",
"this",
"course",
"module",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1470-L1494 |
217,239 | moodle/moodle | competency/classes/api.php | api.reorder_course_module_competency | public static function reorder_course_module_competency($cmorid, $competencyidfrom, $competencyidto) {
static::require_enabled();
$cm = $cmorid;
if (!is_object($cmorid)) {
$cm = get_coursemodule_from_id('', $cmorid, 0, true, MUST_EXIST);
}
// Check the user have acces... | php | public static function reorder_course_module_competency($cmorid, $competencyidfrom, $competencyidto) {
static::require_enabled();
$cm = $cmorid;
if (!is_object($cmorid)) {
$cm = get_coursemodule_from_id('', $cmorid, 0, true, MUST_EXIST);
}
// Check the user have acces... | [
"public",
"static",
"function",
"reorder_course_module_competency",
"(",
"$",
"cmorid",
",",
"$",
"competencyidfrom",
",",
"$",
"competencyidto",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"cm",
"=",
"$",
"cmorid",
";",
"if",
"(",
"!",
... | Move the course module competency up or down in the display list.
Requires moodle/competency:coursecompetencymanage capability at the course module context.
@param mixed $cmorid The course module, or id of the course module
@param int $competencyidfrom The id of the competency we are moving.
@param int $competencyidt... | [
"Move",
"the",
"course",
"module",
"competency",
"up",
"or",
"down",
"in",
"the",
"display",
"list",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1506-L1553 |
217,240 | moodle/moodle | competency/classes/api.php | api.set_course_module_competency_ruleoutcome | public static function set_course_module_competency_ruleoutcome($coursemodulecompetencyorid, $ruleoutcome) {
static::require_enabled();
$coursemodulecompetency = $coursemodulecompetencyorid;
if (!is_object($coursemodulecompetency)) {
$coursemodulecompetency = new course_module_compet... | php | public static function set_course_module_competency_ruleoutcome($coursemodulecompetencyorid, $ruleoutcome) {
static::require_enabled();
$coursemodulecompetency = $coursemodulecompetencyorid;
if (!is_object($coursemodulecompetency)) {
$coursemodulecompetency = new course_module_compet... | [
"public",
"static",
"function",
"set_course_module_competency_ruleoutcome",
"(",
"$",
"coursemodulecompetencyorid",
",",
"$",
"ruleoutcome",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"coursemodulecompetency",
"=",
"$",
"coursemodulecompetencyorid",
... | Update ruleoutcome value for a course module competency.
@param int|course_module_competency $coursemodulecompetencyorid The course_module_competency, or its ID.
@param int $ruleoutcome The value of ruleoutcome.
@return bool True on success. | [
"Update",
"ruleoutcome",
"value",
"for",
"a",
"course",
"module",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1562-L1578 |
217,241 | moodle/moodle | competency/classes/api.php | api.add_competency_to_course | public static function add_competency_to_course($courseid, $competencyid) {
static::require_enabled();
// Check the user have access to the course.
self::validate_course($courseid);
// First we do a permissions check.
$context = context_course::instance($courseid);
requ... | php | public static function add_competency_to_course($courseid, $competencyid) {
static::require_enabled();
// Check the user have access to the course.
self::validate_course($courseid);
// First we do a permissions check.
$context = context_course::instance($courseid);
requ... | [
"public",
"static",
"function",
"add_competency_to_course",
"(",
"$",
"courseid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// Check the user have access to the course.",
"self",
"::",
"validate_course",
"(",
"$",
"courseid... | Add a competency to this course.
@param int $courseid The id of the course
@param int $competencyid The id of the competency
@return bool | [
"Add",
"a",
"competency",
"to",
"this",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1587-L1617 |
217,242 | moodle/moodle | competency/classes/api.php | api.remove_competency_from_course | public static function remove_competency_from_course($courseid, $competencyid) {
static::require_enabled();
// Check the user have access to the course.
self::validate_course($courseid);
// First we do a permissions check.
$context = context_course::instance($courseid);
... | php | public static function remove_competency_from_course($courseid, $competencyid) {
static::require_enabled();
// Check the user have access to the course.
self::validate_course($courseid);
// First we do a permissions check.
$context = context_course::instance($courseid);
... | [
"public",
"static",
"function",
"remove_competency_from_course",
"(",
"$",
"courseid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// Check the user have access to the course.",
"self",
"::",
"validate_course",
"(",
"$",
"cou... | Remove a competency from this course.
@param int $courseid The id of the course
@param int $competencyid The id of the competency
@return bool | [
"Remove",
"a",
"competency",
"from",
"this",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1626-L1651 |
217,243 | moodle/moodle | competency/classes/api.php | api.reorder_course_competency | public static function reorder_course_competency($courseid, $competencyidfrom, $competencyidto) {
static::require_enabled();
// Check the user have access to the course.
self::validate_course($courseid);
// First we do a permissions check.
$context = context_course::instance($co... | php | public static function reorder_course_competency($courseid, $competencyidfrom, $competencyidto) {
static::require_enabled();
// Check the user have access to the course.
self::validate_course($courseid);
// First we do a permissions check.
$context = context_course::instance($co... | [
"public",
"static",
"function",
"reorder_course_competency",
"(",
"$",
"courseid",
",",
"$",
"competencyidfrom",
",",
"$",
"competencyidto",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// Check the user have access to the course.",
"self",
"::",
"vali... | Move the course competency up or down in the display list.
Requires moodle/competency:coursecompetencymanage capability at the course context.
@param int $courseid The course
@param int $competencyidfrom The id of the competency we are moving.
@param int $competencyidto The id of the competency we are moving to.
@ret... | [
"Move",
"the",
"course",
"competency",
"up",
"or",
"down",
"in",
"the",
"display",
"list",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1663-L1707 |
217,244 | moodle/moodle | competency/classes/api.php | api.set_course_competency_ruleoutcome | public static function set_course_competency_ruleoutcome($coursecompetencyorid, $ruleoutcome) {
static::require_enabled();
$coursecompetency = $coursecompetencyorid;
if (!is_object($coursecompetency)) {
$coursecompetency = new course_competency($coursecompetencyorid);
}
... | php | public static function set_course_competency_ruleoutcome($coursecompetencyorid, $ruleoutcome) {
static::require_enabled();
$coursecompetency = $coursecompetencyorid;
if (!is_object($coursecompetency)) {
$coursecompetency = new course_competency($coursecompetencyorid);
}
... | [
"public",
"static",
"function",
"set_course_competency_ruleoutcome",
"(",
"$",
"coursecompetencyorid",
",",
"$",
"ruleoutcome",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"coursecompetency",
"=",
"$",
"coursecompetencyorid",
";",
"if",
"(",
"... | Update ruleoutcome value for a course competency.
@param int|course_competency $coursecompetencyorid The course_competency, or its ID.
@param int $ruleoutcome The value of ruleoutcome.
@return bool True on success. | [
"Update",
"ruleoutcome",
"value",
"for",
"a",
"course",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1716-L1731 |
217,245 | moodle/moodle | competency/classes/api.php | api.create_template | public static function create_template(stdClass $record) {
static::require_enabled();
$template = new template(0, $record);
// First we do a permissions check.
if (!$template->can_manage()) {
throw new required_capability_exception($template->get_context(), 'moodle/competenc... | php | public static function create_template(stdClass $record) {
static::require_enabled();
$template = new template(0, $record);
// First we do a permissions check.
if (!$template->can_manage()) {
throw new required_capability_exception($template->get_context(), 'moodle/competenc... | [
"public",
"static",
"function",
"create_template",
"(",
"stdClass",
"$",
"record",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"template",
"=",
"new",
"template",
"(",
"0",
",",
"$",
"record",
")",
";",
"// First we do a permissions check.... | Create a learning plan template from a record containing all the data for the class.
Requires moodle/competency:templatemanage capability.
@param stdClass $record Record containing all the data for an instance of the class.
@return template | [
"Create",
"a",
"learning",
"plan",
"template",
"from",
"a",
"record",
"containing",
"all",
"the",
"data",
"for",
"the",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1741-L1758 |
217,246 | moodle/moodle | competency/classes/api.php | api.delete_template | public static function delete_template($id, $deleteplans = true) {
global $DB;
static::require_enabled();
$template = new template($id);
// First we do a permissions check.
if (!$template->can_manage()) {
throw new required_capability_exception($template->get_context... | php | public static function delete_template($id, $deleteplans = true) {
global $DB;
static::require_enabled();
$template = new template($id);
// First we do a permissions check.
if (!$template->can_manage()) {
throw new required_capability_exception($template->get_context... | [
"public",
"static",
"function",
"delete_template",
"(",
"$",
"id",
",",
"$",
"deleteplans",
"=",
"true",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"template",
"=",
"new",
"template",
"(",
"$",
"id",
")",... | Delete a learning plan template by id.
If the learning plan template has associated cohorts they will be deleted.
Requires moodle/competency:templatemanage capability.
@param int $id The record to delete.
@param boolean $deleteplans True to delete plans associaated to template, false to unlink them.
@return boolean | [
"Delete",
"a",
"learning",
"plan",
"template",
"by",
"id",
".",
"If",
"the",
"learning",
"plan",
"template",
"has",
"associated",
"cohorts",
"they",
"will",
"be",
"deleted",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1808-L1866 |
217,247 | moodle/moodle | competency/classes/api.php | api.update_template | public static function update_template($record) {
global $DB;
static::require_enabled();
$template = new template($record->id);
// First we do a permissions check.
if (!$template->can_manage()) {
throw new required_capability_exception($template->get_context(), 'mood... | php | public static function update_template($record) {
global $DB;
static::require_enabled();
$template = new template($record->id);
// First we do a permissions check.
if (!$template->can_manage()) {
throw new required_capability_exception($template->get_context(), 'mood... | [
"public",
"static",
"function",
"update_template",
"(",
"$",
"record",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"template",
"=",
"new",
"template",
"(",
"$",
"record",
"->",
"id",
")",
";",
"// First we d... | Update the details for a learning plan template.
Requires moodle/competency:templatemanage capability.
@param stdClass $record The new details for the template. Note - must contain an id that points to the template to update.
@return boolean | [
"Update",
"the",
"details",
"for",
"a",
"learning",
"plan",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1876-L1924 |
217,248 | moodle/moodle | competency/classes/api.php | api.read_template | public static function read_template($id) {
static::require_enabled();
$template = new template($id);
$context = $template->get_context();
// First we do a permissions check.
if (!$template->can_read()) {
throw new required_capability_exception($template->get_contex... | php | public static function read_template($id) {
static::require_enabled();
$template = new template($id);
$context = $template->get_context();
// First we do a permissions check.
if (!$template->can_read()) {
throw new required_capability_exception($template->get_contex... | [
"public",
"static",
"function",
"read_template",
"(",
"$",
"id",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"template",
"=",
"new",
"template",
"(",
"$",
"id",
")",
";",
"$",
"context",
"=",
"$",
"template",
"->",
"get_context",
"... | Read a the details for a single learning plan template and return a record.
Requires moodle/competency:templateview capability at the system context.
@param int $id The id of the template to read.
@return template | [
"Read",
"a",
"the",
"details",
"for",
"a",
"single",
"learning",
"plan",
"template",
"and",
"return",
"a",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L1934-L1947 |
217,249 | moodle/moodle | competency/classes/api.php | api.count_templates | public static function count_templates($context, $includes) {
global $DB;
static::require_enabled();
// First we do a permissions check.
$contexts = self::get_related_contexts($context, $includes,
array('moodle/competency:templateview', 'moodle/competency:templatemanage'));
... | php | public static function count_templates($context, $includes) {
global $DB;
static::require_enabled();
// First we do a permissions check.
$contexts = self::get_related_contexts($context, $includes,
array('moodle/competency:templateview', 'moodle/competency:templatemanage'));
... | [
"public",
"static",
"function",
"count_templates",
"(",
"$",
"context",
",",
"$",
"includes",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// First we do a permissions check.",
"$",
"contexts",
"=",
"self",
"::",
"get_... | Perform a search based on the provided filters and return how many results there are.
Requires moodle/competency:templateview capability at the system context.
@param context $context The parent context of the frameworks.
@param string $includes Defines what other contexts to fetch frameworks from.
Accepted values ar... | [
"Perform",
"a",
"search",
"based",
"on",
"the",
"provided",
"filters",
"and",
"return",
"how",
"many",
"results",
"there",
"are",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2011-L2027 |
217,250 | moodle/moodle | competency/classes/api.php | api.count_templates_using_competency | public static function count_templates_using_competency($competencyid) {
static::require_enabled();
// First we do a permissions check.
$context = context_system::instance();
$onlyvisible = 1;
$capabilities = array('moodle/competency:templateview', 'moodle/competency:templateman... | php | public static function count_templates_using_competency($competencyid) {
static::require_enabled();
// First we do a permissions check.
$context = context_system::instance();
$onlyvisible = 1;
$capabilities = array('moodle/competency:templateview', 'moodle/competency:templateman... | [
"public",
"static",
"function",
"count_templates_using_competency",
"(",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// First we do a permissions check.",
"$",
"context",
"=",
"context_system",
"::",
"instance",
"(",
")",
";",
"... | Count all the templates using a competency.
@param int $competencyid The id of the competency to check.
@return int | [
"Count",
"all",
"the",
"templates",
"using",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2035-L2052 |
217,251 | moodle/moodle | competency/classes/api.php | api.list_templates_using_competency | public static function list_templates_using_competency($competencyid) {
static::require_enabled();
// First we do a permissions check.
$context = context_system::instance();
$onlyvisible = 1;
$capabilities = array('moodle/competency:templateview', 'moodle/competency:templatemana... | php | public static function list_templates_using_competency($competencyid) {
static::require_enabled();
// First we do a permissions check.
$context = context_system::instance();
$onlyvisible = 1;
$capabilities = array('moodle/competency:templateview', 'moodle/competency:templatemana... | [
"public",
"static",
"function",
"list_templates_using_competency",
"(",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// First we do a permissions check.",
"$",
"context",
"=",
"context_system",
"::",
"instance",
"(",
")",
";",
"$... | List all the learning plan templatesd using a competency.
@param int $competencyid The id of the competency to check.
@return array[stdClass] Array of stdClass containing id and shortname. | [
"List",
"all",
"the",
"learning",
"plan",
"templatesd",
"using",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2060-L2078 |
217,252 | moodle/moodle | competency/classes/api.php | api.count_competencies_in_template | public static function count_competencies_in_template($templateorid) {
static::require_enabled();
// First we do a permissions check.
$template = $templateorid;
if (!is_object($template)) {
$template = new template($template);
}
if (!$template->can_read()) {
... | php | public static function count_competencies_in_template($templateorid) {
static::require_enabled();
// First we do a permissions check.
$template = $templateorid;
if (!is_object($template)) {
$template = new template($template);
}
if (!$template->can_read()) {
... | [
"public",
"static",
"function",
"count_competencies_in_template",
"(",
"$",
"templateorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// First we do a permissions check.",
"$",
"template",
"=",
"$",
"templateorid",
";",
"if",
"(",
"!",
"is_object"... | Count all the competencies in a learning plan template.
@param template|int $templateorid The template or its ID.
@return int | [
"Count",
"all",
"the",
"competencies",
"in",
"a",
"learning",
"plan",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2086-L2101 |
217,253 | moodle/moodle | competency/classes/api.php | api.count_competencies_in_template_with_no_courses | public static function count_competencies_in_template_with_no_courses($templateorid) {
// First we do a permissions check.
$template = $templateorid;
if (!is_object($template)) {
$template = new template($template);
}
if (!$template->can_read()) {
throw n... | php | public static function count_competencies_in_template_with_no_courses($templateorid) {
// First we do a permissions check.
$template = $templateorid;
if (!is_object($template)) {
$template = new template($template);
}
if (!$template->can_read()) {
throw n... | [
"public",
"static",
"function",
"count_competencies_in_template_with_no_courses",
"(",
"$",
"templateorid",
")",
"{",
"// First we do a permissions check.",
"$",
"template",
"=",
"$",
"templateorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"template",
")",
")",
... | Count all the competencies in a learning plan template with no linked courses.
@param template|int $templateorid The template or its ID.
@return int | [
"Count",
"all",
"the",
"competencies",
"in",
"a",
"learning",
"plan",
"template",
"with",
"no",
"linked",
"courses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2109-L2123 |
217,254 | moodle/moodle | competency/classes/api.php | api.list_competencies_in_template | public static function list_competencies_in_template($templateorid) {
static::require_enabled();
// First we do a permissions check.
$template = $templateorid;
if (!is_object($template)) {
$template = new template($template);
}
if (!$template->can_read()) {
... | php | public static function list_competencies_in_template($templateorid) {
static::require_enabled();
// First we do a permissions check.
$template = $templateorid;
if (!is_object($template)) {
$template = new template($template);
}
if (!$template->can_read()) {
... | [
"public",
"static",
"function",
"list_competencies_in_template",
"(",
"$",
"templateorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// First we do a permissions check.",
"$",
"template",
"=",
"$",
"templateorid",
";",
"if",
"(",
"!",
"is_object",... | List all the competencies in a template.
@param template|int $templateorid The template or its ID.
@return array of competencies | [
"List",
"all",
"the",
"competencies",
"in",
"a",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2131-L2146 |
217,255 | moodle/moodle | competency/classes/api.php | api.add_competency_to_template | public static function add_competency_to_template($templateid, $competencyid) {
static::require_enabled();
// First we do a permissions check.
$template = new template($templateid);
if (!$template->can_manage()) {
throw new required_capability_exception($template->get_context... | php | public static function add_competency_to_template($templateid, $competencyid) {
static::require_enabled();
// First we do a permissions check.
$template = new template($templateid);
if (!$template->can_manage()) {
throw new required_capability_exception($template->get_context... | [
"public",
"static",
"function",
"add_competency_to_template",
"(",
"$",
"templateid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// First we do a permissions check.",
"$",
"template",
"=",
"new",
"template",
"(",
"$",
"t... | Add a competency to this template.
@param int $templateid The id of the template
@param int $competencyid The id of the competency
@return bool | [
"Add",
"a",
"competency",
"to",
"this",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2155-L2182 |
217,256 | moodle/moodle | competency/classes/api.php | api.remove_competency_from_template | public static function remove_competency_from_template($templateid, $competencyid) {
static::require_enabled();
// First we do a permissions check.
$template = new template($templateid);
if (!$template->can_manage()) {
throw new required_capability_exception($template->get_co... | php | public static function remove_competency_from_template($templateid, $competencyid) {
static::require_enabled();
// First we do a permissions check.
$template = new template($templateid);
if (!$template->can_manage()) {
throw new required_capability_exception($template->get_co... | [
"public",
"static",
"function",
"remove_competency_from_template",
"(",
"$",
"templateid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"// First we do a permissions check.",
"$",
"template",
"=",
"new",
"template",
"(",
"$",... | Remove a competency from this template.
@param int $templateid The id of the template
@param int $competencyid The id of the competency
@return bool | [
"Remove",
"a",
"competency",
"from",
"this",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2191-L2212 |
217,257 | moodle/moodle | competency/classes/api.php | api.reorder_template_competency | public static function reorder_template_competency($templateid, $competencyidfrom, $competencyidto) {
static::require_enabled();
$template = new template($templateid);
// First we do a permissions check.
if (!$template->can_manage()) {
throw new required_capability_exception... | php | public static function reorder_template_competency($templateid, $competencyidfrom, $competencyidto) {
static::require_enabled();
$template = new template($templateid);
// First we do a permissions check.
if (!$template->can_manage()) {
throw new required_capability_exception... | [
"public",
"static",
"function",
"reorder_template_competency",
"(",
"$",
"templateid",
",",
"$",
"competencyidfrom",
",",
"$",
"competencyidto",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"template",
"=",
"new",
"template",
"(",
"$",
"tem... | Move the template competency up or down in the display list.
Requires moodle/competency:templatemanage capability at the system context.
@param int $templateid The template id
@param int $competencyidfrom The id of the competency we are moving.
@param int $competencyidto The id of the competency we are moving to.
@re... | [
"Move",
"the",
"template",
"competency",
"up",
"or",
"down",
"in",
"the",
"display",
"list",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2224-L2267 |
217,258 | moodle/moodle | competency/classes/api.php | api.create_template_cohort | public static function create_template_cohort($templateorid, $cohortorid) {
global $DB;
static::require_enabled();
$template = $templateorid;
if (!is_object($template)) {
$template = new template($template);
}
require_capability('moodle/competency:templateman... | php | public static function create_template_cohort($templateorid, $cohortorid) {
global $DB;
static::require_enabled();
$template = $templateorid;
if (!is_object($template)) {
$template = new template($template);
}
require_capability('moodle/competency:templateman... | [
"public",
"static",
"function",
"create_template_cohort",
"(",
"$",
"templateorid",
",",
"$",
"cohortorid",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"template",
"=",
"$",
"templateorid",
";",
"if",
"(",
"!"... | Create a relation between a template and a cohort.
This silently ignores when the relation already existed.
@param template|int $templateorid The template or its ID.
@param stdClass|int $cohortorid The cohort ot its ID.
@return template_cohort | [
"Create",
"a",
"relation",
"between",
"a",
"template",
"and",
"a",
"cohort",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2278-L2305 |
217,259 | moodle/moodle | competency/classes/api.php | api.delete_template_cohort | public static function delete_template_cohort($templateorid, $cohortorid) {
global $DB;
static::require_enabled();
$template = $templateorid;
if (!is_object($template)) {
$template = new template($template);
}
require_capability('moodle/competency:templateman... | php | public static function delete_template_cohort($templateorid, $cohortorid) {
global $DB;
static::require_enabled();
$template = $templateorid;
if (!is_object($template)) {
$template = new template($template);
}
require_capability('moodle/competency:templateman... | [
"public",
"static",
"function",
"delete_template_cohort",
"(",
"$",
"templateorid",
",",
"$",
"cohortorid",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"template",
"=",
"$",
"templateorid",
";",
"if",
"(",
"!"... | Remove a relation between a template and a cohort.
@param template|int $templateorid The template or its ID.
@param stdClass|int $cohortorid The cohort ot its ID.
@return boolean True on success or when the relation did not exist. | [
"Remove",
"a",
"relation",
"between",
"a",
"template",
"and",
"a",
"cohort",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2314-L2335 |
217,260 | moodle/moodle | competency/classes/api.php | api.list_user_plans | public static function list_user_plans($userid) {
global $DB, $USER;
static::require_enabled();
$select = 'userid = :userid';
$params = array('userid' => $userid);
$context = context_user::instance($userid);
// Check that we can read something here.
if (!plan::ca... | php | public static function list_user_plans($userid) {
global $DB, $USER;
static::require_enabled();
$select = 'userid = :userid';
$params = array('userid' => $userid);
$context = context_user::instance($userid);
// Check that we can read something here.
if (!plan::ca... | [
"public",
"static",
"function",
"list_user_plans",
"(",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"select",
"=",
"'userid = :userid'",
";",
"$",
"params",
"=",
"array",
"("... | Lists user plans.
@param int $userid
@return \core_competency\plan[] | [
"Lists",
"user",
"plans",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2343-L2370 |
217,261 | moodle/moodle | competency/classes/api.php | api.list_plans_to_review | public static function list_plans_to_review($skip = 0, $limit = 100, $userid = null) {
global $DB, $USER;
static::require_enabled();
if ($userid === null) {
$userid = $USER->id;
}
$planfields = plan::get_sql_fields('p', 'plan_');
$tplfields = template::get_s... | php | public static function list_plans_to_review($skip = 0, $limit = 100, $userid = null) {
global $DB, $USER;
static::require_enabled();
if ($userid === null) {
$userid = $USER->id;
}
$planfields = plan::get_sql_fields('p', 'plan_');
$tplfields = template::get_s... | [
"public",
"static",
"function",
"list_plans_to_review",
"(",
"$",
"skip",
"=",
"0",
",",
"$",
"limit",
"=",
"100",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"static",
"::",
"require_enabled",
"(",
")",
";"... | List the plans to review.
The method returns values in this format:
array(
'plans' => array(
(stdClass)(
'plan' => (plan),
'template' => (template),
'owner' => (stdClass)
)
),
'count' => (int)
)
@param int $skip The number of records to skip.
@param int $limit The number of results to return.
@param int $userid The ... | [
"List",
"the",
"plans",
"to",
"review",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2394-L2467 |
217,262 | moodle/moodle | competency/classes/api.php | api.create_plan | public static function create_plan(stdClass $record) {
global $USER;
static::require_enabled();
$plan = new plan(0, $record);
if ($plan->is_based_on_template()) {
throw new coding_exception('To create a plan from a template use api::create_plan_from_template().');
} ... | php | public static function create_plan(stdClass $record) {
global $USER;
static::require_enabled();
$plan = new plan(0, $record);
if ($plan->is_based_on_template()) {
throw new coding_exception('To create a plan from a template use api::create_plan_from_template().');
} ... | [
"public",
"static",
"function",
"create_plan",
"(",
"stdClass",
"$",
"record",
")",
"{",
"global",
"$",
"USER",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"new",
"plan",
"(",
"0",
",",
"$",
"record",
")",
";",
"if",
"(",... | Creates a learning plan based on the provided data.
@param stdClass $record
@return \core_competency\plan | [
"Creates",
"a",
"learning",
"plan",
"based",
"on",
"the",
"provided",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2475-L2496 |
217,263 | moodle/moodle | competency/classes/api.php | api.create_plan_from_template | public static function create_plan_from_template($templateorid, $userid) {
static::require_enabled();
$template = $templateorid;
if (!is_object($template)) {
$template = new template($template);
}
// The user must be able to view the template to use it as a base for ... | php | public static function create_plan_from_template($templateorid, $userid) {
static::require_enabled();
$template = $templateorid;
if (!is_object($template)) {
$template = new template($template);
}
// The user must be able to view the template to use it as a base for ... | [
"public",
"static",
"function",
"create_plan_from_template",
"(",
"$",
"templateorid",
",",
"$",
"userid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"template",
"=",
"$",
"templateorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"t... | Create a learning plan from a template.
@param mixed $templateorid The template object or ID.
@param int $userid
@return false|\core_competency\plan Returns false when the plan already exists. | [
"Create",
"a",
"learning",
"plan",
"from",
"a",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2505-L2560 |
217,264 | moodle/moodle | competency/classes/api.php | api.create_plans_from_template_cohort | public static function create_plans_from_template_cohort($templateorid, $cohortid, $recreateunlinked = false) {
global $DB, $CFG;
static::require_enabled();
require_once($CFG->dirroot . '/cohort/lib.php');
$template = $templateorid;
if (!is_object($template)) {
$temp... | php | public static function create_plans_from_template_cohort($templateorid, $cohortid, $recreateunlinked = false) {
global $DB, $CFG;
static::require_enabled();
require_once($CFG->dirroot . '/cohort/lib.php');
$template = $templateorid;
if (!is_object($template)) {
$temp... | [
"public",
"static",
"function",
"create_plans_from_template_cohort",
"(",
"$",
"templateorid",
",",
"$",
"cohortid",
",",
"$",
"recreateunlinked",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"static",
"::",
"require_enabled",
"(",
")",
... | Create learning plans from a template and cohort.
@param mixed $templateorid The template object or ID.
@param int $cohortid The cohort ID.
@param bool $recreateunlinked When true the plans that were unlinked from this template will be re-created.
@return int The number of plans created. | [
"Create",
"learning",
"plans",
"from",
"a",
"template",
"and",
"cohort",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2570-L2637 |
217,265 | moodle/moodle | competency/classes/api.php | api.unlink_plan_from_template | public static function unlink_plan_from_template($planorid) {
global $DB;
static::require_enabled();
$plan = $planorid;
if (!is_object($planorid)) {
$plan = new plan($planorid);
}
// The user must be allowed to manage the plans of the user, nothing about the... | php | public static function unlink_plan_from_template($planorid) {
global $DB;
static::require_enabled();
$plan = $planorid;
if (!is_object($planorid)) {
$plan = new plan($planorid);
}
// The user must be allowed to manage the plans of the user, nothing about the... | [
"public",
"static",
"function",
"unlink_plan_from_template",
"(",
"$",
"planorid",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"$",
"planorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"plano... | Unlink a plan from its template.
@param \core_competency\plan|int $planorid The plan or its ID.
@return bool | [
"Unlink",
"a",
"plan",
"from",
"its",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2645-L2694 |
217,266 | moodle/moodle | competency/classes/api.php | api.update_plan | public static function update_plan(stdClass $record) {
static::require_enabled();
$plan = new plan($record->id);
// Validate that the plan as it is can be managed.
if (!$plan->can_manage()) {
throw new required_capability_exception($plan->get_context(), 'moodle/competency:p... | php | public static function update_plan(stdClass $record) {
static::require_enabled();
$plan = new plan($record->id);
// Validate that the plan as it is can be managed.
if (!$plan->can_manage()) {
throw new required_capability_exception($plan->get_context(), 'moodle/competency:p... | [
"public",
"static",
"function",
"update_plan",
"(",
"stdClass",
"$",
"record",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"new",
"plan",
"(",
"$",
"record",
"->",
"id",
")",
";",
"// Validate that the plan as it is can be man... | Updates a plan.
@param stdClass $record
@return \core_competency\plan | [
"Updates",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2702-L2740 |
217,267 | moodle/moodle | competency/classes/api.php | api.read_plan | public static function read_plan($id) {
static::require_enabled();
$plan = new plan($id);
if (!$plan->can_read()) {
$context = context_user::instance($plan->get('userid'));
throw new required_capability_exception($context, 'moodle/competency:planview', 'nopermissions', '... | php | public static function read_plan($id) {
static::require_enabled();
$plan = new plan($id);
if (!$plan->can_read()) {
$context = context_user::instance($plan->get('userid'));
throw new required_capability_exception($context, 'moodle/competency:planview', 'nopermissions', '... | [
"public",
"static",
"function",
"read_plan",
"(",
"$",
"id",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"new",
"plan",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"plan",
"->",
"can_read",
"(",
")",
")",
"{",... | Returns a plan data.
@param int $id
@return \core_competency\plan | [
"Returns",
"a",
"plan",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2748-L2758 |
217,268 | moodle/moodle | competency/classes/api.php | api.plan_viewed | public static function plan_viewed($planorid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($plan)) {
$plan = new plan($plan);
}
// First we do a permissions check.
if (!$plan->can_read()) {
$context = context_user::instance($plan... | php | public static function plan_viewed($planorid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($plan)) {
$plan = new plan($plan);
}
// First we do a permissions check.
if (!$plan->can_read()) {
$context = context_user::instance($plan... | [
"public",
"static",
"function",
"plan_viewed",
"(",
"$",
"planorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"$",
"planorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"plan",
")",
")",
"{",
"$",
"plan",
"=",
... | Plan event viewed.
@param mixed $planorid The id or the plan.
@return boolean | [
"Plan",
"event",
"viewed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2766-L2783 |
217,269 | moodle/moodle | competency/classes/api.php | api.delete_plan | public static function delete_plan($id) {
global $DB;
static::require_enabled();
$plan = new plan($id);
if (!$plan->can_manage()) {
$context = context_user::instance($plan->get('userid'));
throw new required_capability_exception($context, 'moodle/competency:plan... | php | public static function delete_plan($id) {
global $DB;
static::require_enabled();
$plan = new plan($id);
if (!$plan->can_manage()) {
$context = context_user::instance($plan->get('userid'));
throw new required_capability_exception($context, 'moodle/competency:plan... | [
"public",
"static",
"function",
"delete_plan",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"new",
"plan",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"plan",
"->",
"ca... | Deletes a plan.
Plans based on a template can be removed just like any other one.
@param int $id
@return bool Success? | [
"Deletes",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2793-L2826 |
217,270 | moodle/moodle | competency/classes/api.php | api.plan_cancel_review_request | public static function plan_cancel_review_request($planorid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($plan)) {
$plan = new plan($plan);
}
// We need to be able to view the plan at least.
if (!$plan->can_read()) {
throw new r... | php | public static function plan_cancel_review_request($planorid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($plan)) {
$plan = new plan($plan);
}
// We need to be able to view the plan at least.
if (!$plan->can_read()) {
throw new r... | [
"public",
"static",
"function",
"plan_cancel_review_request",
"(",
"$",
"planorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"$",
"planorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"plan",
")",
")",
"{",
"$",
"... | Cancel the review of a plan.
@param int|plan $planorid The plan, or its ID.
@return bool | [
"Cancel",
"the",
"review",
"of",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2834-L2861 |
217,271 | moodle/moodle | competency/classes/api.php | api.plan_start_review | public static function plan_start_review($planorid) {
global $USER;
static::require_enabled();
$plan = $planorid;
if (!is_object($plan)) {
$plan = new plan($plan);
}
// We need to be able to view the plan at least.
if (!$plan->can_read()) {
... | php | public static function plan_start_review($planorid) {
global $USER;
static::require_enabled();
$plan = $planorid;
if (!is_object($plan)) {
$plan = new plan($plan);
}
// We need to be able to view the plan at least.
if (!$plan->can_read()) {
... | [
"public",
"static",
"function",
"plan_start_review",
"(",
"$",
"planorid",
")",
"{",
"global",
"$",
"USER",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"$",
"planorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"plan",
")... | Start the review of a plan.
@param int|plan $planorid The plan, or its ID.
@return bool | [
"Start",
"the",
"review",
"of",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2904-L2933 |
217,272 | moodle/moodle | competency/classes/api.php | api.plan_stop_review | public static function plan_stop_review($planorid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($plan)) {
$plan = new plan($plan);
}
// We need to be able to view the plan at least.
if (!$plan->can_read()) {
throw new required_ca... | php | public static function plan_stop_review($planorid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($plan)) {
$plan = new plan($plan);
}
// We need to be able to view the plan at least.
if (!$plan->can_read()) {
throw new required_ca... | [
"public",
"static",
"function",
"plan_stop_review",
"(",
"$",
"planorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"$",
"planorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"plan",
")",
")",
"{",
"$",
"plan",
"... | Stop reviewing a plan.
@param int|plan $planorid The plan, or its ID.
@return bool | [
"Stop",
"reviewing",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2941-L2969 |
217,273 | moodle/moodle | competency/classes/api.php | api.approve_plan | public static function approve_plan($planorid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($plan)) {
$plan = new plan($plan);
}
// We need to be able to view the plan at least.
if (!$plan->can_read()) {
throw new required_capabi... | php | public static function approve_plan($planorid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($plan)) {
$plan = new plan($plan);
}
// We need to be able to view the plan at least.
if (!$plan->can_read()) {
throw new required_capabi... | [
"public",
"static",
"function",
"approve_plan",
"(",
"$",
"planorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"$",
"planorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"plan",
")",
")",
"{",
"$",
"plan",
"=",
... | Approve a plan.
This means making the plan active.
@param int|plan $planorid The plan, or its ID.
@return bool | [
"Approve",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L2979-L3008 |
217,274 | moodle/moodle | competency/classes/api.php | api.unapprove_plan | public static function unapprove_plan($planorid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($plan)) {
$plan = new plan($plan);
}
// We need to be able to view the plan at least.
if (!$plan->can_read()) {
throw new required_capa... | php | public static function unapprove_plan($planorid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($plan)) {
$plan = new plan($plan);
}
// We need to be able to view the plan at least.
if (!$plan->can_read()) {
throw new required_capa... | [
"public",
"static",
"function",
"unapprove_plan",
"(",
"$",
"planorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"$",
"planorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"plan",
")",
")",
"{",
"$",
"plan",
"="... | Unapprove a plan.
This means making the plan draft.
@param int|plan $planorid The plan, or its ID.
@return bool | [
"Unapprove",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3018-L3045 |
217,275 | moodle/moodle | competency/classes/api.php | api.complete_plan | public static function complete_plan($planorid) {
global $DB;
static::require_enabled();
$plan = $planorid;
if (!is_object($planorid)) {
$plan = new plan($planorid);
}
// Validate that the plan can be managed.
if (!$plan->can_manage()) {
... | php | public static function complete_plan($planorid) {
global $DB;
static::require_enabled();
$plan = $planorid;
if (!is_object($planorid)) {
$plan = new plan($planorid);
}
// Validate that the plan can be managed.
if (!$plan->can_manage()) {
... | [
"public",
"static",
"function",
"complete_plan",
"(",
"$",
"planorid",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"$",
"planorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"planorid",
")",... | Complete a plan.
@param int|plan $planorid The plan, or its ID.
@return bool | [
"Complete",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3053-L3100 |
217,276 | moodle/moodle | competency/classes/api.php | api.reopen_plan | public static function reopen_plan($planorid) {
global $DB;
static::require_enabled();
$plan = $planorid;
if (!is_object($planorid)) {
$plan = new plan($planorid);
}
// Validate that the plan as it is can be managed.
if (!$plan->can_manage()) {
... | php | public static function reopen_plan($planorid) {
global $DB;
static::require_enabled();
$plan = $planorid;
if (!is_object($planorid)) {
$plan = new plan($planorid);
}
// Validate that the plan as it is can be managed.
if (!$plan->can_manage()) {
... | [
"public",
"static",
"function",
"reopen_plan",
"(",
"$",
"planorid",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"$",
"planorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"planorid",
")",
... | Reopen a plan.
@param int|plan $planorid The plan, or its ID.
@return bool | [
"Reopen",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3108-L3159 |
217,277 | moodle/moodle | competency/classes/api.php | api.get_plan_competency | public static function get_plan_competency($planorid, $competencyid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($planorid)) {
$plan = new plan($planorid);
}
if (!user_competency::can_read_user($plan->get('userid'))) {
throw new require... | php | public static function get_plan_competency($planorid, $competencyid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($planorid)) {
$plan = new plan($planorid);
}
if (!user_competency::can_read_user($plan->get('userid'))) {
throw new require... | [
"public",
"static",
"function",
"get_plan_competency",
"(",
"$",
"planorid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"$",
"planorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"planorid",
... | Get a single competency from the user plan.
@param int $planorid The plan, or its ID.
@param int $competencyid The competency id.
@return (object) array(
'competency' => \core_competency\competency,
'usercompetency' => \core_competency\user_competency
'usercompetencyplan' => \core_competency\user_competency_plan
)
T... | [
"Get",
"a",
"single",
"competency",
"from",
"the",
"user",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3173-L3218 |
217,278 | moodle/moodle | competency/classes/api.php | api.list_plans_with_competency | public static function list_plans_with_competency($userid, $competencyorid) {
global $USER;
static::require_enabled();
$competencyid = $competencyorid;
$competency = null;
if (is_object($competencyid)) {
$competency = $competencyid;
$competencyid = $compe... | php | public static function list_plans_with_competency($userid, $competencyorid) {
global $USER;
static::require_enabled();
$competencyid = $competencyorid;
$competency = null;
if (is_object($competencyid)) {
$competency = $competencyid;
$competencyid = $compe... | [
"public",
"static",
"function",
"list_plans_with_competency",
"(",
"$",
"userid",
",",
"$",
"competencyorid",
")",
"{",
"global",
"$",
"USER",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"competencyid",
"=",
"$",
"competencyorid",
";",
"$",
"... | List the plans with a competency.
@param int $userid The user id we want the plans for.
@param int $competencyorid The competency, or its ID.
@return array[plan] Array of learning plans. | [
"List",
"the",
"plans",
"with",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3227-L3246 |
217,279 | moodle/moodle | competency/classes/api.php | api.list_plan_competencies | public static function list_plan_competencies($planorid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($planorid)) {
$plan = new plan($planorid);
}
if (!$plan->can_read()) {
$context = context_user::instance($plan->get('userid'));
... | php | public static function list_plan_competencies($planorid) {
static::require_enabled();
$plan = $planorid;
if (!is_object($planorid)) {
$plan = new plan($planorid);
}
if (!$plan->can_read()) {
$context = context_user::instance($plan->get('userid'));
... | [
"public",
"static",
"function",
"list_plan_competencies",
"(",
"$",
"planorid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"$",
"planorid",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"planorid",
")",
")",
"{",
"$",
"... | List the competencies in a user plan.
@param int $planorid The plan, or its ID.
@return array((object) array(
'competency' => \core_competency\competency,
'usercompetency' => \core_competency\user_competency
'usercompetencyplan' => \core_competency\user_competency_plan
))
The values of of keys usercompetency and user... | [
"List",
"the",
"competencies",
"in",
"a",
"user",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3259-L3314 |
217,280 | moodle/moodle | competency/classes/api.php | api.add_competency_to_plan | public static function add_competency_to_plan($planid, $competencyid) {
static::require_enabled();
$plan = new plan($planid);
// First we do a permissions check.
if (!$plan->can_manage()) {
throw new required_capability_exception($plan->get_context(), 'moodle/competency:plan... | php | public static function add_competency_to_plan($planid, $competencyid) {
static::require_enabled();
$plan = new plan($planid);
// First we do a permissions check.
if (!$plan->can_manage()) {
throw new required_capability_exception($plan->get_context(), 'moodle/competency:plan... | [
"public",
"static",
"function",
"add_competency_to_plan",
"(",
"$",
"planid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"new",
"plan",
"(",
"$",
"planid",
")",
";",
"// First we do a permissions che... | Add a competency to a plan.
@param int $planid The id of the plan
@param int $competencyid The id of the competency
@return bool | [
"Add",
"a",
"competency",
"to",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3323-L3356 |
217,281 | moodle/moodle | competency/classes/api.php | api.remove_competency_from_plan | public static function remove_competency_from_plan($planid, $competencyid) {
static::require_enabled();
$plan = new plan($planid);
// First we do a permissions check.
if (!$plan->can_manage()) {
$context = context_user::instance($plan->get('userid'));
throw new r... | php | public static function remove_competency_from_plan($planid, $competencyid) {
static::require_enabled();
$plan = new plan($planid);
// First we do a permissions check.
if (!$plan->can_manage()) {
$context = context_user::instance($plan->get('userid'));
throw new r... | [
"public",
"static",
"function",
"remove_competency_from_plan",
"(",
"$",
"planid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"new",
"plan",
"(",
"$",
"planid",
")",
";",
"// First we do a permission... | Remove a competency from a plan.
@param int $planid The plan id
@param int $competencyid The id of the competency
@return bool | [
"Remove",
"a",
"competency",
"from",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3365-L3387 |
217,282 | moodle/moodle | competency/classes/api.php | api.reorder_plan_competency | public static function reorder_plan_competency($planid, $competencyidfrom, $competencyidto) {
static::require_enabled();
$plan = new plan($planid);
// First we do a permissions check.
if (!$plan->can_manage()) {
$context = context_user::instance($plan->get('userid'));
... | php | public static function reorder_plan_competency($planid, $competencyidfrom, $competencyidto) {
static::require_enabled();
$plan = new plan($planid);
// First we do a permissions check.
if (!$plan->can_manage()) {
$context = context_user::instance($plan->get('userid'));
... | [
"public",
"static",
"function",
"reorder_plan_competency",
"(",
"$",
"planid",
",",
"$",
"competencyidfrom",
",",
"$",
"competencyidto",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"plan",
"=",
"new",
"plan",
"(",
"$",
"planid",
")",
"... | Move the plan competency up or down in the display list.
Requires moodle/competency:planmanage capability at the system context.
@param int $planid The plan id
@param int $competencyidfrom The id of the competency we are moving.
@param int $competencyidto The id of the competency we are moving to.
@return boolean | [
"Move",
"the",
"plan",
"competency",
"up",
"or",
"down",
"in",
"the",
"display",
"list",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3399-L3449 |
217,283 | moodle/moodle | competency/classes/api.php | api.user_competency_cancel_review_request | public static function user_competency_cancel_review_request($userid, $competencyid) {
static::require_enabled();
$context = context_user::instance($userid);
$uc = user_competency::get_record(array('userid' => $userid, 'competencyid' => $competencyid));
if (!$uc || !$uc->can_read()) {
... | php | public static function user_competency_cancel_review_request($userid, $competencyid) {
static::require_enabled();
$context = context_user::instance($userid);
$uc = user_competency::get_record(array('userid' => $userid, 'competencyid' => $competencyid));
if (!$uc || !$uc->can_read()) {
... | [
"public",
"static",
"function",
"user_competency_cancel_review_request",
"(",
"$",
"userid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"context",
"=",
"context_user",
"::",
"instance",
"(",
"$",
"userid",
")",
"... | Cancel a user competency review request.
@param int $userid The user ID.
@param int $competencyid The competency ID.
@return bool | [
"Cancel",
"a",
"user",
"competency",
"review",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3458-L3476 |
217,284 | moodle/moodle | competency/classes/api.php | api.user_competency_request_review | public static function user_competency_request_review($userid, $competencyid) {
static::require_enabled();
$uc = user_competency::get_record(array('userid' => $userid, 'competencyid' => $competencyid));
if (!$uc) {
$uc = user_competency::create_relation($userid, $competencyid);
... | php | public static function user_competency_request_review($userid, $competencyid) {
static::require_enabled();
$uc = user_competency::get_record(array('userid' => $userid, 'competencyid' => $competencyid));
if (!$uc) {
$uc = user_competency::create_relation($userid, $competencyid);
... | [
"public",
"static",
"function",
"user_competency_request_review",
"(",
"$",
"userid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"uc",
"=",
"user_competency",
"::",
"get_record",
"(",
"array",
"(",
"'userid'",
"=... | Request a user competency review.
@param int $userid The user ID.
@param int $competencyid The competency ID.
@return bool | [
"Request",
"a",
"user",
"competency",
"review",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3485-L3509 |
217,285 | moodle/moodle | competency/classes/api.php | api.user_competency_start_review | public static function user_competency_start_review($userid, $competencyid) {
global $USER;
static::require_enabled();
$context = context_user::instance($userid);
$uc = user_competency::get_record(array('userid' => $userid, 'competencyid' => $competencyid));
if (!$uc || !$uc->ca... | php | public static function user_competency_start_review($userid, $competencyid) {
global $USER;
static::require_enabled();
$context = context_user::instance($userid);
$uc = user_competency::get_record(array('userid' => $userid, 'competencyid' => $competencyid));
if (!$uc || !$uc->ca... | [
"public",
"static",
"function",
"user_competency_start_review",
"(",
"$",
"userid",
",",
"$",
"competencyid",
")",
"{",
"global",
"$",
"USER",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"context",
"=",
"context_user",
"::",
"instance",
"(",
... | Start a user competency review.
@param int $userid The user ID.
@param int $competencyid The competency ID.
@return bool | [
"Start",
"a",
"user",
"competency",
"review",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3518-L3539 |
217,286 | moodle/moodle | competency/classes/api.php | api.user_competency_stop_review | public static function user_competency_stop_review($userid, $competencyid) {
static::require_enabled();
$context = context_user::instance($userid);
$uc = user_competency::get_record(array('userid' => $userid, 'competencyid' => $competencyid));
if (!$uc || !$uc->can_read()) {
... | php | public static function user_competency_stop_review($userid, $competencyid) {
static::require_enabled();
$context = context_user::instance($userid);
$uc = user_competency::get_record(array('userid' => $userid, 'competencyid' => $competencyid));
if (!$uc || !$uc->can_read()) {
... | [
"public",
"static",
"function",
"user_competency_stop_review",
"(",
"$",
"userid",
",",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"context",
"=",
"context_user",
"::",
"instance",
"(",
"$",
"userid",
")",
";",
"$",... | Stop a user competency review.
@param int $userid The user ID.
@param int $competencyid The competency ID.
@return bool | [
"Stop",
"a",
"user",
"competency",
"review",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3548-L3566 |
217,287 | moodle/moodle | competency/classes/api.php | api.list_related_competencies | public static function list_related_competencies($competencyid) {
static::require_enabled();
$competency = new competency($competencyid);
if (!has_any_capability(array('moodle/competency:competencyview', 'moodle/competency:competencymanage'),
$competency->get_context())) {
... | php | public static function list_related_competencies($competencyid) {
static::require_enabled();
$competency = new competency($competencyid);
if (!has_any_capability(array('moodle/competency:competencyview', 'moodle/competency:competencymanage'),
$competency->get_context())) {
... | [
"public",
"static",
"function",
"list_related_competencies",
"(",
"$",
"competencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"competency",
"=",
"new",
"competency",
"(",
"$",
"competencyid",
")",
";",
"if",
"(",
"!",
"has_any_capabil... | List all the related competencies.
@param int $competencyid The id of the competency to check.
@return competency[] | [
"List",
"all",
"the",
"related",
"competencies",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3696-L3707 |
217,288 | moodle/moodle | competency/classes/api.php | api.add_related_competency | public static function add_related_competency($competencyid, $relatedcompetencyid) {
static::require_enabled();
$competency1 = new competency($competencyid);
$competency2 = new competency($relatedcompetencyid);
require_capability('moodle/competency:competencymanage', $competency1->get_c... | php | public static function add_related_competency($competencyid, $relatedcompetencyid) {
static::require_enabled();
$competency1 = new competency($competencyid);
$competency2 = new competency($relatedcompetencyid);
require_capability('moodle/competency:competencymanage', $competency1->get_c... | [
"public",
"static",
"function",
"add_related_competency",
"(",
"$",
"competencyid",
",",
"$",
"relatedcompetencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"competency1",
"=",
"new",
"competency",
"(",
"$",
"competencyid",
")",
";",
"... | Add a related competency.
@param int $competencyid The id of the competency
@param int $relatedcompetencyid The id of the related competency.
@return bool False when create failed, true on success, or if the relation already existed. | [
"Add",
"a",
"related",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3716-L3730 |
217,289 | moodle/moodle | competency/classes/api.php | api.remove_related_competency | public static function remove_related_competency($competencyid, $relatedcompetencyid) {
static::require_enabled();
$competency = new competency($competencyid);
// This only check if we have the permission in either competency because both competencies
// should belong to the same framew... | php | public static function remove_related_competency($competencyid, $relatedcompetencyid) {
static::require_enabled();
$competency = new competency($competencyid);
// This only check if we have the permission in either competency because both competencies
// should belong to the same framew... | [
"public",
"static",
"function",
"remove_related_competency",
"(",
"$",
"competencyid",
",",
"$",
"relatedcompetencyid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"competency",
"=",
"new",
"competency",
"(",
"$",
"competencyid",
")",
";",
... | Remove a related competency.
@param int $competencyid The id of the competency.
@param int $relatedcompetencyid The id of the related competency.
@return bool True when it was deleted, false when it wasn't or the relation doesn't exist. | [
"Remove",
"a",
"related",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3739-L3753 |
217,290 | moodle/moodle | competency/classes/api.php | api.read_user_evidence | public static function read_user_evidence($id) {
static::require_enabled();
$userevidence = new user_evidence($id);
if (!$userevidence->can_read()) {
$context = $userevidence->get_context();
throw new required_capability_exception($context, 'moodle/competency:userevidenc... | php | public static function read_user_evidence($id) {
static::require_enabled();
$userevidence = new user_evidence($id);
if (!$userevidence->can_read()) {
$context = $userevidence->get_context();
throw new required_capability_exception($context, 'moodle/competency:userevidenc... | [
"public",
"static",
"function",
"read_user_evidence",
"(",
"$",
"id",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"userevidence",
"=",
"new",
"user_evidence",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"userevidence",
"->",
"can_... | Read a user evidence.
@param int $id
@return user_evidence | [
"Read",
"a",
"user",
"evidence",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3761-L3771 |
217,291 | moodle/moodle | competency/classes/api.php | api.list_user_evidence | public static function list_user_evidence($userid) {
static::require_enabled();
if (!user_evidence::can_read_user($userid)) {
$context = context_user::instance($userid);
throw new required_capability_exception($context, 'moodle/competency:userevidenceview', 'nopermissions', '');
... | php | public static function list_user_evidence($userid) {
static::require_enabled();
if (!user_evidence::can_read_user($userid)) {
$context = context_user::instance($userid);
throw new required_capability_exception($context, 'moodle/competency:userevidenceview', 'nopermissions', '');
... | [
"public",
"static",
"function",
"list_user_evidence",
"(",
"$",
"userid",
")",
"{",
"static",
"::",
"require_enabled",
"(",
")",
";",
"if",
"(",
"!",
"user_evidence",
"::",
"can_read_user",
"(",
"$",
"userid",
")",
")",
"{",
"$",
"context",
"=",
"context_u... | List the user evidence of a user.
@param int $userid The user ID.
@return user_evidence[] | [
"List",
"the",
"user",
"evidence",
"of",
"a",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3879-L3888 |
217,292 | moodle/moodle | competency/classes/api.php | api.create_user_evidence_competency | public static function create_user_evidence_competency($userevidenceorid, $competencyid) {
global $USER;
static::require_enabled();
$userevidence = $userevidenceorid;
if (!is_object($userevidence)) {
$userevidence = self::read_user_evidence($userevidence);
}
... | php | public static function create_user_evidence_competency($userevidenceorid, $competencyid) {
global $USER;
static::require_enabled();
$userevidence = $userevidenceorid;
if (!is_object($userevidence)) {
$userevidence = self::read_user_evidence($userevidence);
}
... | [
"public",
"static",
"function",
"create_user_evidence_competency",
"(",
"$",
"userevidenceorid",
",",
"$",
"competencyid",
")",
"{",
"global",
"$",
"USER",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"userevidence",
"=",
"$",
"userevidenceorid",
... | Link a user evidence with a competency.
@param user_evidence|int $userevidenceorid User evidence or its ID.
@param int $competencyid Competency ID.
@return user_evidence_competency | [
"Link",
"a",
"user",
"evidence",
"with",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3897-L3937 |
217,293 | moodle/moodle | competency/classes/api.php | api.delete_user_evidence_competency | public static function delete_user_evidence_competency($userevidenceorid, $competencyid) {
global $USER;
static::require_enabled();
$userevidence = $userevidenceorid;
if (!is_object($userevidence)) {
$userevidence = self::read_user_evidence($userevidence);
}
... | php | public static function delete_user_evidence_competency($userevidenceorid, $competencyid) {
global $USER;
static::require_enabled();
$userevidence = $userevidenceorid;
if (!is_object($userevidence)) {
$userevidence = self::read_user_evidence($userevidence);
}
... | [
"public",
"static",
"function",
"delete_user_evidence_competency",
"(",
"$",
"userevidenceorid",
",",
"$",
"competencyid",
")",
"{",
"global",
"$",
"USER",
";",
"static",
"::",
"require_enabled",
"(",
")",
";",
"$",
"userevidence",
"=",
"$",
"userevidenceorid",
... | Delete a relationship between a user evidence and a competency.
@param user_evidence|int $userevidenceorid User evidence or its ID.
@param int $competencyid Competency ID.
@return bool | [
"Delete",
"a",
"relationship",
"between",
"a",
"user",
"evidence",
"and",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3946-L3985 |
217,294 | moodle/moodle | competency/classes/api.php | api.request_review_of_user_evidence_linked_competencies | public static function request_review_of_user_evidence_linked_competencies($id) {
$userevidence = new user_evidence($id);
$context = $userevidence->get_context();
$userid = $userevidence->get('userid');
if (!$userevidence->can_manage()) {
throw new required_capability_except... | php | public static function request_review_of_user_evidence_linked_competencies($id) {
$userevidence = new user_evidence($id);
$context = $userevidence->get_context();
$userid = $userevidence->get('userid');
if (!$userevidence->can_manage()) {
throw new required_capability_except... | [
"public",
"static",
"function",
"request_review_of_user_evidence_linked_competencies",
"(",
"$",
"id",
")",
"{",
"$",
"userevidence",
"=",
"new",
"user_evidence",
"(",
"$",
"id",
")",
";",
"$",
"context",
"=",
"$",
"userevidence",
"->",
"get_context",
"(",
")",
... | Send request review for user evidence competencies.
@param int $id The user evidence ID.
@return bool | [
"Send",
"request",
"review",
"for",
"user",
"evidence",
"competencies",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L3993-L4010 |
217,295 | moodle/moodle | competency/classes/api.php | api.duplicate_competency_tree | protected static function duplicate_competency_tree($frameworkid, $tree, $oldparent = 0, $newparent = 0) {
$matchids = array();
foreach ($tree as $node) {
if ($node->competency->get('parentid') == $oldparent) {
$parentid = $node->competency->get('id');
// Cre... | php | protected static function duplicate_competency_tree($frameworkid, $tree, $oldparent = 0, $newparent = 0) {
$matchids = array();
foreach ($tree as $node) {
if ($node->competency->get('parentid') == $oldparent) {
$parentid = $node->competency->get('id');
// Cre... | [
"protected",
"static",
"function",
"duplicate_competency_tree",
"(",
"$",
"frameworkid",
",",
"$",
"tree",
",",
"$",
"oldparent",
"=",
"0",
",",
"$",
"newparent",
"=",
"0",
")",
"{",
"$",
"matchids",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"t... | Recursively duplicate competencies from a tree, we start duplicating from parents to children to have a correct path.
This method does not copy the related competencies.
@param int $frameworkid - framework id
@param competency[] $tree - array of competencies object
@param int $oldparent - old parent id
@param int $new... | [
"Recursively",
"duplicate",
"competencies",
"from",
"a",
"tree",
"we",
"start",
"duplicating",
"from",
"parents",
"to",
"children",
"to",
"have",
"a",
"correct",
"path",
".",
"This",
"method",
"does",
"not",
"copy",
"the",
"related",
"competencies",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L4022-L4052 |
217,296 | moodle/moodle | competency/classes/api.php | api.migrate_competency_tree_rules | protected static function migrate_competency_tree_rules($tree, $matchids) {
foreach ($tree as $node) {
$oldcompid = $node->competency->get('id');
if ($node->competency->get('ruletype') && array_key_exists($oldcompid, $matchids)) {
try {
// Get the new... | php | protected static function migrate_competency_tree_rules($tree, $matchids) {
foreach ($tree as $node) {
$oldcompid = $node->competency->get('id');
if ($node->competency->get('ruletype') && array_key_exists($oldcompid, $matchids)) {
try {
// Get the new... | [
"protected",
"static",
"function",
"migrate_competency_tree_rules",
"(",
"$",
"tree",
",",
"$",
"matchids",
")",
"{",
"foreach",
"(",
"$",
"tree",
"as",
"$",
"node",
")",
"{",
"$",
"oldcompid",
"=",
"$",
"node",
"->",
"competency",
"->",
"get",
"(",
"'id... | Recursively migrate competency rules.
@param competency[] $tree - array of competencies object
@param competency[] $matchids - List of old competencies ids matched with new competencies object | [
"Recursively",
"migrate",
"competency",
"rules",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L4060-L4085 |
217,297 | moodle/moodle | competency/classes/api.php | api.archive_user_competencies_in_plan | protected static function archive_user_competencies_in_plan($plan) {
// Check if the plan was already completed.
if ($plan->get('status') == plan::STATUS_COMPLETE) {
throw new coding_exception('The plan is already completed.');
}
$competencies = $plan->get_competencies();
... | php | protected static function archive_user_competencies_in_plan($plan) {
// Check if the plan was already completed.
if ($plan->get('status') == plan::STATUS_COMPLETE) {
throw new coding_exception('The plan is already completed.');
}
$competencies = $plan->get_competencies();
... | [
"protected",
"static",
"function",
"archive_user_competencies_in_plan",
"(",
"$",
"plan",
")",
"{",
"// Check if the plan was already completed.",
"if",
"(",
"$",
"plan",
"->",
"get",
"(",
"'status'",
")",
"==",
"plan",
"::",
"STATUS_COMPLETE",
")",
"{",
"throw",
... | Archive user competencies in a plan.
@param int $plan The plan object.
@return void | [
"Archive",
"user",
"competencies",
"in",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L4093-L4135 |
217,298 | moodle/moodle | competency/classes/api.php | api.remove_archived_user_competencies_in_plan | protected static function remove_archived_user_competencies_in_plan($plan) {
$competencies = $plan->get_competencies();
$usercompetenciesplan = user_competency_plan::get_multiple($plan->get('userid'), $plan->get('id'), $competencies);
foreach ($usercompetenciesplan as $ucpkey => $ucp) {
... | php | protected static function remove_archived_user_competencies_in_plan($plan) {
$competencies = $plan->get_competencies();
$usercompetenciesplan = user_competency_plan::get_multiple($plan->get('userid'), $plan->get('id'), $competencies);
foreach ($usercompetenciesplan as $ucpkey => $ucp) {
... | [
"protected",
"static",
"function",
"remove_archived_user_competencies_in_plan",
"(",
"$",
"plan",
")",
"{",
"$",
"competencies",
"=",
"$",
"plan",
"->",
"get_competencies",
"(",
")",
";",
"$",
"usercompetenciesplan",
"=",
"user_competency_plan",
"::",
"get_multiple",
... | Delete archived user competencies in a plan.
@param int $plan The plan object.
@return void | [
"Delete",
"archived",
"user",
"competencies",
"in",
"a",
"plan",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L4143-L4150 |
217,299 | moodle/moodle | competency/classes/api.php | api.list_evidence | public static function list_evidence($userid = 0, $competencyid = 0, $planid = 0, $sort = 'timecreated',
$order = 'DESC', $skip = 0, $limit = 0) {
static::require_enabled();
if (!user_competency::can_read_user($userid)) {
$context = context_user::ins... | php | public static function list_evidence($userid = 0, $competencyid = 0, $planid = 0, $sort = 'timecreated',
$order = 'DESC', $skip = 0, $limit = 0) {
static::require_enabled();
if (!user_competency::can_read_user($userid)) {
$context = context_user::ins... | [
"public",
"static",
"function",
"list_evidence",
"(",
"$",
"userid",
"=",
"0",
",",
"$",
"competencyid",
"=",
"0",
",",
"$",
"planid",
"=",
"0",
",",
"$",
"sort",
"=",
"'timecreated'",
",",
"$",
"order",
"=",
"'DESC'",
",",
"$",
"skip",
"=",
"0",
"... | List all the evidence for a user competency.
@param int $userid The user id - only used if usercompetencyid is 0.
@param int $competencyid The competency id - only used it usercompetencyid is 0.
@param int $planid The plan id - not used yet - but can be used to only list archived evidence if a plan is completed.
@para... | [
"List",
"all",
"the",
"evidence",
"for",
"a",
"user",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/api.php#L4165-L4199 |
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.