id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
218,600 | moodle/moodle | message/classes/time_last_message_between_users.php | time_last_message_between_users.get_instance_for_cache | public static function get_instance_for_cache(\cache_definition $definition) {
if (is_null(self::$instance)) {
self::$instance = new time_last_message_between_users();
}
return self::$instance;
} | php | public static function get_instance_for_cache(\cache_definition $definition) {
if (is_null(self::$instance)) {
self::$instance = new time_last_message_between_users();
}
return self::$instance;
} | [
"public",
"static",
"function",
"get_instance_for_cache",
"(",
"\\",
"cache_definition",
"$",
"definition",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"instance",
")",
")",
"{",
"self",
"::",
"$",
"instance",
"=",
"new",
"time_last_message_between... | Returns an instance of the data source class that the cache can use for loading data using the other methods
specified by the cache_data_source interface.
@param \cache_definition $definition
@return object | [
"Returns",
"an",
"instance",
"of",
"the",
"data",
"source",
"class",
"that",
"the",
"cache",
"can",
"use",
"for",
"loading",
"data",
"using",
"the",
"other",
"methods",
"specified",
"by",
"the",
"cache_data_source",
"interface",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/time_last_message_between_users.php#L50-L55 |
218,601 | moodle/moodle | message/classes/time_last_message_between_users.php | time_last_message_between_users.load_for_cache | public function load_for_cache($key) {
$message = api::get_most_recent_conversation_message($key);
if ($message) {
return $message->timecreated;
} else {
return null;
}
} | php | public function load_for_cache($key) {
$message = api::get_most_recent_conversation_message($key);
if ($message) {
return $message->timecreated;
} else {
return null;
}
} | [
"public",
"function",
"load_for_cache",
"(",
"$",
"key",
")",
"{",
"$",
"message",
"=",
"api",
"::",
"get_most_recent_conversation_message",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"message",
")",
"{",
"return",
"$",
"message",
"->",
"timecreated",
";",... | Loads the data for the key provided ready formatted for caching.
@param string|int $key The key to load.
@return mixed What ever data should be returned, or false if it can't be loaded. | [
"Loads",
"the",
"data",
"for",
"the",
"key",
"provided",
"ready",
"formatted",
"for",
"caching",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/time_last_message_between_users.php#L63-L71 |
218,602 | moodle/moodle | message/classes/time_last_message_between_users.php | time_last_message_between_users.load_many_for_cache | public function load_many_for_cache(array $keys) {
$results = [];
foreach ($keys as $key) {
$results[] = $this->load_for_cache($key);
}
return $results;
} | php | public function load_many_for_cache(array $keys) {
$results = [];
foreach ($keys as $key) {
$results[] = $this->load_for_cache($key);
}
return $results;
} | [
"public",
"function",
"load_many_for_cache",
"(",
"array",
"$",
"keys",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"$",
"results",
"[",
"]",
"=",
"$",
"this",
"->",
"load_for_cache",
"(",
... | Loads several keys for the cache.
@param array $keys An array of keys each of which will be string|int.
@return array An array of matching data items. | [
"Loads",
"several",
"keys",
"for",
"the",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/time_last_message_between_users.php#L79-L87 |
218,603 | moodle/moodle | lib/accesslib.php | context.reset_caches | protected static function reset_caches() {
self::$cache_contextsbyid = array();
self::$cache_contexts = array();
self::$cache_count = 0;
self::$cache_preloaded = array();
self::$systemcontext = null;
} | php | protected static function reset_caches() {
self::$cache_contextsbyid = array();
self::$cache_contexts = array();
self::$cache_count = 0;
self::$cache_preloaded = array();
self::$systemcontext = null;
} | [
"protected",
"static",
"function",
"reset_caches",
"(",
")",
"{",
"self",
"::",
"$",
"cache_contextsbyid",
"=",
"array",
"(",
")",
";",
"self",
"::",
"$",
"cache_contexts",
"=",
"array",
"(",
")",
";",
"self",
"::",
"$",
"cache_count",
"=",
"0",
";",
"... | Resets the cache to remove all data.
@static | [
"Resets",
"the",
"cache",
"to",
"remove",
"all",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L4839-L4846 |
218,604 | moodle/moodle | lib/accesslib.php | context.cache_add | protected static function cache_add(context $context) {
if (isset(self::$cache_contextsbyid[$context->id])) {
// already cached, no need to do anything - this is relatively cheap, we do all this because count() is slow
return;
}
if (self::$cache_count >= CONTEXT_CACHE_MA... | php | protected static function cache_add(context $context) {
if (isset(self::$cache_contextsbyid[$context->id])) {
// already cached, no need to do anything - this is relatively cheap, we do all this because count() is slow
return;
}
if (self::$cache_count >= CONTEXT_CACHE_MA... | [
"protected",
"static",
"function",
"cache_add",
"(",
"context",
"$",
"context",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"cache_contextsbyid",
"[",
"$",
"context",
"->",
"id",
"]",
")",
")",
"{",
"// already cached, no need to do anything - this is ... | Adds a context to the cache. If the cache is full, discards a batch of
older entries.
@static
@param context $context New context to add
@return void | [
"Adds",
"a",
"context",
"to",
"the",
"cache",
".",
"If",
"the",
"cache",
"is",
"full",
"discards",
"a",
"batch",
"of",
"older",
"entries",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L4856-L4883 |
218,605 | moodle/moodle | lib/accesslib.php | context.cache_remove | protected static function cache_remove(context $context) {
if (!isset(self::$cache_contextsbyid[$context->id])) {
// not cached, no need to do anything - this is relatively cheap, we do all this because count() is slow
return;
}
unset(self::$cache_contexts[$context->conte... | php | protected static function cache_remove(context $context) {
if (!isset(self::$cache_contextsbyid[$context->id])) {
// not cached, no need to do anything - this is relatively cheap, we do all this because count() is slow
return;
}
unset(self::$cache_contexts[$context->conte... | [
"protected",
"static",
"function",
"cache_remove",
"(",
"context",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"cache_contextsbyid",
"[",
"$",
"context",
"->",
"id",
"]",
")",
")",
"{",
"// not cached, no need to do anything - th... | Removes a context from the cache.
@static
@param context $context Context object to remove
@return void | [
"Removes",
"a",
"context",
"from",
"the",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L4892-L4905 |
218,606 | moodle/moodle | lib/accesslib.php | context.cache_get | protected static function cache_get($contextlevel, $instance) {
if (isset(self::$cache_contexts[$contextlevel][$instance])) {
return self::$cache_contexts[$contextlevel][$instance];
}
return false;
} | php | protected static function cache_get($contextlevel, $instance) {
if (isset(self::$cache_contexts[$contextlevel][$instance])) {
return self::$cache_contexts[$contextlevel][$instance];
}
return false;
} | [
"protected",
"static",
"function",
"cache_get",
"(",
"$",
"contextlevel",
",",
"$",
"instance",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"cache_contexts",
"[",
"$",
"contextlevel",
"]",
"[",
"$",
"instance",
"]",
")",
")",
"{",
"return",
"... | Gets a context from the cache.
@static
@param int $contextlevel Context level
@param int $instance Instance ID
@return context|bool Context or false if not in cache | [
"Gets",
"a",
"context",
"from",
"the",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L4915-L4920 |
218,607 | moodle/moodle | lib/accesslib.php | context.cache_get_by_id | protected static function cache_get_by_id($id) {
if (isset(self::$cache_contextsbyid[$id])) {
return self::$cache_contextsbyid[$id];
}
return false;
} | php | protected static function cache_get_by_id($id) {
if (isset(self::$cache_contextsbyid[$id])) {
return self::$cache_contextsbyid[$id];
}
return false;
} | [
"protected",
"static",
"function",
"cache_get_by_id",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"cache_contextsbyid",
"[",
"$",
"id",
"]",
")",
")",
"{",
"return",
"self",
"::",
"$",
"cache_contextsbyid",
"[",
"$",
"id",
"]"... | Gets a context from the cache based on its id.
@static
@param int $id Context ID
@return context|bool Context or false if not in cache | [
"Gets",
"a",
"context",
"from",
"the",
"cache",
"based",
"on",
"its",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L4929-L4934 |
218,608 | moodle/moodle | lib/accesslib.php | context.preload_from_record | protected static function preload_from_record(stdClass $rec) {
$notenoughdata = false;
$notenoughdata = $notenoughdata || empty($rec->ctxid);
$notenoughdata = $notenoughdata || empty($rec->ctxlevel);
$notenoughdata = $notenoughdata || !isset($rec->ctxinstance);
$notenoughdata = $... | php | protected static function preload_from_record(stdClass $rec) {
$notenoughdata = false;
$notenoughdata = $notenoughdata || empty($rec->ctxid);
$notenoughdata = $notenoughdata || empty($rec->ctxlevel);
$notenoughdata = $notenoughdata || !isset($rec->ctxinstance);
$notenoughdata = $... | [
"protected",
"static",
"function",
"preload_from_record",
"(",
"stdClass",
"$",
"rec",
")",
"{",
"$",
"notenoughdata",
"=",
"false",
";",
"$",
"notenoughdata",
"=",
"$",
"notenoughdata",
"||",
"empty",
"(",
"$",
"rec",
"->",
"ctxid",
")",
";",
"$",
"noteno... | Preloads context information from db record and strips the cached info.
@static
@param stdClass $rec
@return void (modifies $rec) | [
"Preloads",
"context",
"information",
"from",
"db",
"record",
"and",
"strips",
"the",
"cached",
"info",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L4943-L4976 |
218,609 | moodle/moodle | lib/accesslib.php | context.create_instance_from_record | protected static function create_instance_from_record(stdClass $record) {
$classname = context_helper::get_class_for_level($record->contextlevel);
if ($context = context::cache_get_by_id($record->id)) {
return $context;
}
$context = new $classname($record);
context:... | php | protected static function create_instance_from_record(stdClass $record) {
$classname = context_helper::get_class_for_level($record->contextlevel);
if ($context = context::cache_get_by_id($record->id)) {
return $context;
}
$context = new $classname($record);
context:... | [
"protected",
"static",
"function",
"create_instance_from_record",
"(",
"stdClass",
"$",
"record",
")",
"{",
"$",
"classname",
"=",
"context_helper",
"::",
"get_class_for_level",
"(",
"$",
"record",
"->",
"contextlevel",
")",
";",
"if",
"(",
"$",
"context",
"=",
... | This function is also used to work around 'protected' keyword problems in context_helper.
@static
@param stdClass $record
@return context instance | [
"This",
"function",
"is",
"also",
"used",
"to",
"work",
"around",
"protected",
"keyword",
"problems",
"in",
"context_helper",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5097-L5108 |
218,610 | moodle/moodle | lib/accesslib.php | context.merge_context_temp_table | protected static function merge_context_temp_table() {
global $DB;
/* MDL-11347:
* - mysql does not allow to use FROM in UPDATE statements
* - using two tables after UPDATE works in mysql, but might give unexpected
* results in pg 8 (depends on configuration)
* ... | php | protected static function merge_context_temp_table() {
global $DB;
/* MDL-11347:
* - mysql does not allow to use FROM in UPDATE statements
* - using two tables after UPDATE works in mysql, but might give unexpected
* results in pg 8 (depends on configuration)
* ... | [
"protected",
"static",
"function",
"merge_context_temp_table",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"/* MDL-11347:\n * - mysql does not allow to use FROM in UPDATE statements\n * - using two tables after UPDATE works in mysql, but might give unexpected\n * resu... | Copy prepared new contexts from temp table to context table,
we do this in db specific way for perf reasons only.
@static | [
"Copy",
"prepared",
"new",
"contexts",
"from",
"temp",
"table",
"to",
"context",
"table",
"we",
"do",
"this",
"in",
"db",
"specific",
"way",
"for",
"perf",
"reasons",
"only",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5115-L5160 |
218,611 | moodle/moodle | lib/accesslib.php | context.instance_by_id | public static function instance_by_id($id, $strictness = MUST_EXIST) {
global $DB;
if (get_called_class() !== 'context' and get_called_class() !== 'context_helper') {
// some devs might confuse context->id and instanceid, better prevent these mistakes completely
throw new coding... | php | public static function instance_by_id($id, $strictness = MUST_EXIST) {
global $DB;
if (get_called_class() !== 'context' and get_called_class() !== 'context_helper') {
// some devs might confuse context->id and instanceid, better prevent these mistakes completely
throw new coding... | [
"public",
"static",
"function",
"instance_by_id",
"(",
"$",
"id",
",",
"$",
"strictness",
"=",
"MUST_EXIST",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"get_called_class",
"(",
")",
"!==",
"'context'",
"and",
"get_called_class",
"(",
")",
"!==",
"'cont... | Get a context instance as an object, from a given context id.
@static
@param int $id context id
@param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found;
MUST_EXIST means throw exception if no record found
@return context|bool the context object or fa... | [
"Get",
"a",
"context",
"instance",
"as",
"an",
"object",
"from",
"a",
"given",
"context",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5171-L5196 |
218,612 | moodle/moodle | lib/accesslib.php | context.update_moved | public function update_moved(context $newparent) {
global $DB;
$frompath = $this->_path;
$newpath = $newparent->path . '/' . $this->_id;
$trans = $DB->start_delegated_transaction();
$setdepth = '';
if (($newparent->depth +1) != $this->_depth) {
$diff = $ne... | php | public function update_moved(context $newparent) {
global $DB;
$frompath = $this->_path;
$newpath = $newparent->path . '/' . $this->_id;
$trans = $DB->start_delegated_transaction();
$setdepth = '';
if (($newparent->depth +1) != $this->_depth) {
$diff = $ne... | [
"public",
"function",
"update_moved",
"(",
"context",
"$",
"newparent",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"frompath",
"=",
"$",
"this",
"->",
"_path",
";",
"$",
"newpath",
"=",
"$",
"newparent",
"->",
"path",
".",
"'/'",
".",
"$",
"this",
"->"... | Update context info after moving context in the tree structure.
@param context $newparent
@return void | [
"Update",
"context",
"info",
"after",
"moving",
"context",
"in",
"the",
"tree",
"structure",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5204-L5239 |
218,613 | moodle/moodle | lib/accesslib.php | context.set_locked | public function set_locked(bool $locked) {
global $DB;
if ($this->_locked == $locked) {
return $this;
}
$this->_locked = $locked;
$DB->set_field('context', 'locked', (int) $locked, ['id' => $this->id]);
$this->mark_dirty();
self::reset_caches();
... | php | public function set_locked(bool $locked) {
global $DB;
if ($this->_locked == $locked) {
return $this;
}
$this->_locked = $locked;
$DB->set_field('context', 'locked', (int) $locked, ['id' => $this->id]);
$this->mark_dirty();
self::reset_caches();
... | [
"public",
"function",
"set_locked",
"(",
"bool",
"$",
"locked",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"_locked",
"==",
"$",
"locked",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"this",
"->",
"_locked",
"=",
"$",
"... | Set whether this context has been locked or not.
@param bool $locked
@return $this | [
"Set",
"whether",
"this",
"context",
"has",
"been",
"locked",
"or",
"not",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5247-L5260 |
218,614 | moodle/moodle | lib/accesslib.php | context.reset_paths | public function reset_paths($rebuild = true) {
global $DB;
if ($this->_path) {
$this->mark_dirty();
}
$DB->set_field_select('context', 'depth', 0, "path LIKE '%/$this->_id/%'");
$DB->set_field_select('context', 'path', NULL, "path LIKE '%/$this->_id/%'");
if ... | php | public function reset_paths($rebuild = true) {
global $DB;
if ($this->_path) {
$this->mark_dirty();
}
$DB->set_field_select('context', 'depth', 0, "path LIKE '%/$this->_id/%'");
$DB->set_field_select('context', 'path', NULL, "path LIKE '%/$this->_id/%'");
if ... | [
"public",
"function",
"reset_paths",
"(",
"$",
"rebuild",
"=",
"true",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"_path",
")",
"{",
"$",
"this",
"->",
"mark_dirty",
"(",
")",
";",
"}",
"$",
"DB",
"->",
"set_field_select",
"(... | Remove all context path info and optionally rebuild it.
@param bool $rebuild
@return void | [
"Remove",
"all",
"context",
"path",
"info",
"and",
"optionally",
"rebuild",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5268-L5288 |
218,615 | moodle/moodle | lib/accesslib.php | context.delete_content | public function delete_content() {
global $CFG, $DB;
blocks_delete_all_for_context($this->_id);
filter_delete_all_for_context($this->_id);
require_once($CFG->dirroot . '/comment/lib.php');
comment::delete_comments(array('contextid'=>$this->_id));
require_once($CFG->dir... | php | public function delete_content() {
global $CFG, $DB;
blocks_delete_all_for_context($this->_id);
filter_delete_all_for_context($this->_id);
require_once($CFG->dirroot . '/comment/lib.php');
comment::delete_comments(array('contextid'=>$this->_id));
require_once($CFG->dir... | [
"public",
"function",
"delete_content",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"blocks_delete_all_for_context",
"(",
"$",
"this",
"->",
"_id",
")",
";",
"filter_delete_all_for_context",
"(",
"$",
"this",
"->",
"_id",
")",
";",
"require_onc... | Delete all data linked to content, do not delete the context record itself | [
"Delete",
"all",
"data",
"linked",
"to",
"content",
"do",
"not",
"delete",
"the",
"context",
"record",
"itself"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5293-L5325 |
218,616 | moodle/moodle | lib/accesslib.php | context.delete_capabilities | public function delete_capabilities() {
global $DB;
$ids = $DB->get_fieldset_select('role_capabilities', 'DISTINCT roleid', 'contextid = ?', array($this->_id));
if ($ids) {
$DB->delete_records('role_capabilities', array('contextid' => $this->_id));
// Reset any cache of... | php | public function delete_capabilities() {
global $DB;
$ids = $DB->get_fieldset_select('role_capabilities', 'DISTINCT roleid', 'contextid = ?', array($this->_id));
if ($ids) {
$DB->delete_records('role_capabilities', array('contextid' => $this->_id));
// Reset any cache of... | [
"public",
"function",
"delete_capabilities",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"ids",
"=",
"$",
"DB",
"->",
"get_fieldset_select",
"(",
"'role_capabilities'",
",",
"'DISTINCT roleid'",
",",
"'contextid = ?'",
",",
"array",
"(",
"$",
"this",
"->",
... | Unassign all capabilities from a context. | [
"Unassign",
"all",
"capabilities",
"from",
"a",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5330-L5340 |
218,617 | moodle/moodle | lib/accesslib.php | context.delete | public function delete() {
global $DB;
if ($this->_contextlevel <= CONTEXT_SYSTEM) {
throw new coding_exception('Cannot delete system context');
}
// double check the context still exists
if (!$DB->record_exists('context', array('id'=>$this->_id))) {
con... | php | public function delete() {
global $DB;
if ($this->_contextlevel <= CONTEXT_SYSTEM) {
throw new coding_exception('Cannot delete system context');
}
// double check the context still exists
if (!$DB->record_exists('context', array('id'=>$this->_id))) {
con... | [
"public",
"function",
"delete",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"_contextlevel",
"<=",
"CONTEXT_SYSTEM",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Cannot delete system context'",
")",
";",
"}",
"// double check... | Delete the context content and the context record itself | [
"Delete",
"the",
"context",
"content",
"and",
"the",
"context",
"record",
"itself"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5345-L5362 |
218,618 | moodle/moodle | lib/accesslib.php | context.insert_context_record | protected static function insert_context_record($contextlevel, $instanceid, $parentpath) {
global $DB;
$record = new stdClass();
$record->contextlevel = $contextlevel;
$record->instanceid = $instanceid;
$record->depth = 0;
$record->path = null; //not kno... | php | protected static function insert_context_record($contextlevel, $instanceid, $parentpath) {
global $DB;
$record = new stdClass();
$record->contextlevel = $contextlevel;
$record->instanceid = $instanceid;
$record->depth = 0;
$record->path = null; //not kno... | [
"protected",
"static",
"function",
"insert_context_record",
"(",
"$",
"contextlevel",
",",
"$",
"instanceid",
",",
"$",
"parentpath",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"record",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"record",
"->",
"contextlev... | Utility method for context creation
@static
@param int $contextlevel
@param int $instanceid
@param string $parentpath
@return stdClass context record | [
"Utility",
"method",
"for",
"context",
"creation"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5375-L5395 |
218,619 | moodle/moodle | lib/accesslib.php | context.is_locked | public function is_locked() {
if ($this->_locked) {
return true;
}
if ($parent = $this->get_parent_context()) {
return $parent->is_locked();
}
return false;
} | php | public function is_locked() {
if ($this->_locked) {
return true;
}
if ($parent = $this->get_parent_context()) {
return $parent->is_locked();
}
return false;
} | [
"public",
"function",
"is_locked",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_locked",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"parent",
"=",
"$",
"this",
"->",
"get_parent_context",
"(",
")",
")",
"{",
"return",
"$",
"parent",
"-... | Whether the current context is locked.
@return bool | [
"Whether",
"the",
"current",
"context",
"is",
"locked",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5416-L5426 |
218,620 | moodle/moodle | lib/accesslib.php | context.get_parent_contexts | public function get_parent_contexts($includeself = false) {
if (!$contextids = $this->get_parent_context_ids($includeself)) {
return array();
}
// Preload the contexts to reduce DB calls.
context_helper::preload_contexts_by_id($contextids);
$result = array();
... | php | public function get_parent_contexts($includeself = false) {
if (!$contextids = $this->get_parent_context_ids($includeself)) {
return array();
}
// Preload the contexts to reduce DB calls.
context_helper::preload_contexts_by_id($contextids);
$result = array();
... | [
"public",
"function",
"get_parent_contexts",
"(",
"$",
"includeself",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"contextids",
"=",
"$",
"this",
"->",
"get_parent_context_ids",
"(",
"$",
"includeself",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"... | Returns parent contexts of this context in reversed order, i.e. parent first,
then grand parent, etc.
@param bool $includeself true means include self too
@return array of context instances | [
"Returns",
"parent",
"contexts",
"of",
"this",
"context",
"in",
"reversed",
"order",
"i",
".",
"e",
".",
"parent",
"first",
"then",
"grand",
"parent",
"etc",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5486-L5501 |
218,621 | moodle/moodle | lib/accesslib.php | context.get_parent_context_ids | public function get_parent_context_ids($includeself = false) {
if (empty($this->_path)) {
return array();
}
$parentcontexts = trim($this->_path, '/'); // kill leading slash
$parentcontexts = explode('/', $parentcontexts);
if (!$includeself) {
array_pop($p... | php | public function get_parent_context_ids($includeself = false) {
if (empty($this->_path)) {
return array();
}
$parentcontexts = trim($this->_path, '/'); // kill leading slash
$parentcontexts = explode('/', $parentcontexts);
if (!$includeself) {
array_pop($p... | [
"public",
"function",
"get_parent_context_ids",
"(",
"$",
"includeself",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_path",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"parentcontexts",
"=",
"trim",
"(",
"$",
... | Returns parent context ids of this context in reversed order, i.e. parent first,
then grand parent, etc.
@param bool $includeself true means include self too
@return array of context ids | [
"Returns",
"parent",
"context",
"ids",
"of",
"this",
"context",
"in",
"reversed",
"order",
"i",
".",
"e",
".",
"parent",
"first",
"then",
"grand",
"parent",
"etc",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5510-L5522 |
218,622 | moodle/moodle | lib/accesslib.php | context.get_parent_context_paths | public function get_parent_context_paths($includeself = false) {
if (empty($this->_path)) {
return array();
}
$contextids = explode('/', $this->_path);
$path = '';
$paths = array();
foreach ($contextids as $contextid) {
if ($contextid) {
... | php | public function get_parent_context_paths($includeself = false) {
if (empty($this->_path)) {
return array();
}
$contextids = explode('/', $this->_path);
$path = '';
$paths = array();
foreach ($contextids as $contextid) {
if ($contextid) {
... | [
"public",
"function",
"get_parent_context_paths",
"(",
"$",
"includeself",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_path",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"contextids",
"=",
"explode",
"(",
"'/'",... | Returns parent context paths of this context.
@param bool $includeself true means include self too
@return array of context paths | [
"Returns",
"parent",
"context",
"paths",
"of",
"this",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5530-L5551 |
218,623 | moodle/moodle | lib/accesslib.php | context.get_parent_context | public function get_parent_context() {
if (empty($this->_path) or $this->_id == SYSCONTEXTID) {
return false;
}
$parentcontexts = trim($this->_path, '/'); // kill leading slash
$parentcontexts = explode('/', $parentcontexts);
array_pop($parentcontexts); // self
... | php | public function get_parent_context() {
if (empty($this->_path) or $this->_id == SYSCONTEXTID) {
return false;
}
$parentcontexts = trim($this->_path, '/'); // kill leading slash
$parentcontexts = explode('/', $parentcontexts);
array_pop($parentcontexts); // self
... | [
"public",
"function",
"get_parent_context",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_path",
")",
"or",
"$",
"this",
"->",
"_id",
"==",
"SYSCONTEXTID",
")",
"{",
"return",
"false",
";",
"}",
"$",
"parentcontexts",
"=",
"trim",
"(",
... | Returns parent context
@return context | [
"Returns",
"parent",
"context"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5558-L5569 |
218,624 | moodle/moodle | lib/accesslib.php | context.reload_if_dirty | public function reload_if_dirty() {
global $ACCESSLIB_PRIVATE, $USER;
// Load dirty contexts list if needed
if (CLI_SCRIPT) {
if (!isset($ACCESSLIB_PRIVATE->dirtycontexts)) {
// we do not load dirty flags in CLI and cron
$ACCESSLIB_PRIVATE->dirtyconte... | php | public function reload_if_dirty() {
global $ACCESSLIB_PRIVATE, $USER;
// Load dirty contexts list if needed
if (CLI_SCRIPT) {
if (!isset($ACCESSLIB_PRIVATE->dirtycontexts)) {
// we do not load dirty flags in CLI and cron
$ACCESSLIB_PRIVATE->dirtyconte... | [
"public",
"function",
"reload_if_dirty",
"(",
")",
"{",
"global",
"$",
"ACCESSLIB_PRIVATE",
",",
"$",
"USER",
";",
"// Load dirty contexts list if needed",
"if",
"(",
"CLI_SCRIPT",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"ACCESSLIB_PRIVATE",
"->",
"dirtycon... | Reset all cached permissions and definitions if the necessary.
@return void | [
"Reset",
"all",
"cached",
"permissions",
"and",
"definitions",
"if",
"the",
"necessary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5620-L5667 |
218,625 | moodle/moodle | lib/accesslib.php | context_helper.get_class_for_level | public static function get_class_for_level($contextlevel) {
self::init_levels();
if (isset(self::$alllevels[$contextlevel])) {
return self::$alllevels[$contextlevel];
} else {
throw new coding_exception('Invalid context level specified');
}
} | php | public static function get_class_for_level($contextlevel) {
self::init_levels();
if (isset(self::$alllevels[$contextlevel])) {
return self::$alllevels[$contextlevel];
} else {
throw new coding_exception('Invalid context level specified');
}
} | [
"public",
"static",
"function",
"get_class_for_level",
"(",
"$",
"contextlevel",
")",
"{",
"self",
"::",
"init_levels",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"alllevels",
"[",
"$",
"contextlevel",
"]",
")",
")",
"{",
"return",
"self"... | Returns a class name of the context level class
@static
@param int $contextlevel (CONTEXT_SYSTEM, etc.)
@return string class name of the context class | [
"Returns",
"a",
"class",
"name",
"of",
"the",
"context",
"level",
"class"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5781-L5788 |
218,626 | moodle/moodle | lib/accesslib.php | context_helper.cleanup_instances | public static function cleanup_instances() {
global $DB;
self::init_levels();
$sqls = array();
foreach (self::$alllevels as $level=>$classname) {
$sqls[] = $classname::get_cleanup_sql();
}
$sql = implode(" UNION ", $sqls);
// it is probably better t... | php | public static function cleanup_instances() {
global $DB;
self::init_levels();
$sqls = array();
foreach (self::$alllevels as $level=>$classname) {
$sqls[] = $classname::get_cleanup_sql();
}
$sql = implode(" UNION ", $sqls);
// it is probably better t... | [
"public",
"static",
"function",
"cleanup_instances",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"self",
"::",
"init_levels",
"(",
")",
";",
"$",
"sqls",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"alllevels",
"as",
"$",
"level",
"=... | Remove stale contexts that belonged to deleted instances.
Ideally all code should cleanup contexts properly, unfortunately accidents happen...
@static
@return void | [
"Remove",
"stale",
"contexts",
"that",
"belonged",
"to",
"deleted",
"instances",
".",
"Ideally",
"all",
"code",
"should",
"cleanup",
"contexts",
"properly",
"unfortunately",
"accidents",
"happen",
"..."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5808-L5830 |
218,627 | moodle/moodle | lib/accesslib.php | context_helper.create_instances | public static function create_instances($contextlevel = null, $buildpaths = true) {
self::init_levels();
foreach (self::$alllevels as $level=>$classname) {
if ($contextlevel and $level > $contextlevel) {
// skip potential sub-contexts
continue;
}
... | php | public static function create_instances($contextlevel = null, $buildpaths = true) {
self::init_levels();
foreach (self::$alllevels as $level=>$classname) {
if ($contextlevel and $level > $contextlevel) {
// skip potential sub-contexts
continue;
}
... | [
"public",
"static",
"function",
"create_instances",
"(",
"$",
"contextlevel",
"=",
"null",
",",
"$",
"buildpaths",
"=",
"true",
")",
"{",
"self",
"::",
"init_levels",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"alllevels",
"as",
"$",
"level",
"=>"... | Create all context instances at the given level and above.
@static
@param int $contextlevel null means all levels
@param bool $buildpaths
@return void | [
"Create",
"all",
"context",
"instances",
"at",
"the",
"given",
"level",
"and",
"above",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5840-L5852 |
218,628 | moodle/moodle | lib/accesslib.php | context_helper.build_all_paths | public static function build_all_paths($force = false) {
self::init_levels();
foreach (self::$alllevels as $classname) {
$classname::build_paths($force);
}
// reset static course cache - it might have incorrect cached data
accesslib_clear_all_caches(true);
} | php | public static function build_all_paths($force = false) {
self::init_levels();
foreach (self::$alllevels as $classname) {
$classname::build_paths($force);
}
// reset static course cache - it might have incorrect cached data
accesslib_clear_all_caches(true);
} | [
"public",
"static",
"function",
"build_all_paths",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"self",
"::",
"init_levels",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"alllevels",
"as",
"$",
"classname",
")",
"{",
"$",
"classname",
"::",
"build_pat... | Rebuild paths and depths in all context levels.
@static
@param bool $force false means add missing only
@return void | [
"Rebuild",
"paths",
"and",
"depths",
"in",
"all",
"context",
"levels",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5861-L5869 |
218,629 | moodle/moodle | lib/accesslib.php | context_helper.preload_contexts_by_id | public static function preload_contexts_by_id(array $contextids) {
global $DB;
// Determine which contexts are not already cached.
$tofetch = [];
foreach ($contextids as $contextid) {
if (!self::cache_get_by_id($contextid)) {
$tofetch[] = $contextid;
... | php | public static function preload_contexts_by_id(array $contextids) {
global $DB;
// Determine which contexts are not already cached.
$tofetch = [];
foreach ($contextids as $contextid) {
if (!self::cache_get_by_id($contextid)) {
$tofetch[] = $contextid;
... | [
"public",
"static",
"function",
"preload_contexts_by_id",
"(",
"array",
"$",
"contextids",
")",
"{",
"global",
"$",
"DB",
";",
"// Determine which contexts are not already cached.",
"$",
"tofetch",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"contextids",
"as",
"$",
... | Preload a set of contexts using their contextid.
@param array $contextids | [
"Preload",
"a",
"set",
"of",
"contexts",
"using",
"their",
"contextid",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5935-L5956 |
218,630 | moodle/moodle | lib/accesslib.php | context_helper.preload_course | public static function preload_course($courseid) {
// Users can call this multiple times without doing any harm
if (isset(context::$cache_preloaded[$courseid])) {
return;
}
$coursecontext = context_course::instance($courseid);
$coursecontext->get_child_contexts();
... | php | public static function preload_course($courseid) {
// Users can call this multiple times without doing any harm
if (isset(context::$cache_preloaded[$courseid])) {
return;
}
$coursecontext = context_course::instance($courseid);
$coursecontext->get_child_contexts();
... | [
"public",
"static",
"function",
"preload_course",
"(",
"$",
"courseid",
")",
"{",
"// Users can call this multiple times without doing any harm",
"if",
"(",
"isset",
"(",
"context",
"::",
"$",
"cache_preloaded",
"[",
"$",
"courseid",
"]",
")",
")",
"{",
"return",
... | Preload all contexts instances from course.
To be used if you expect multiple queries for course activities...
@static
@param int $courseid | [
"Preload",
"all",
"contexts",
"instances",
"from",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5966-L5975 |
218,631 | moodle/moodle | lib/accesslib.php | context_helper.delete_instance | public static function delete_instance($contextlevel, $instanceid) {
global $DB;
// double check the context still exists
if ($record = $DB->get_record('context', array('contextlevel'=>$contextlevel, 'instanceid'=>$instanceid))) {
$context = context::create_instance_from_record($rec... | php | public static function delete_instance($contextlevel, $instanceid) {
global $DB;
// double check the context still exists
if ($record = $DB->get_record('context', array('contextlevel'=>$contextlevel, 'instanceid'=>$instanceid))) {
$context = context::create_instance_from_record($rec... | [
"public",
"static",
"function",
"delete_instance",
"(",
"$",
"contextlevel",
",",
"$",
"instanceid",
")",
"{",
"global",
"$",
"DB",
";",
"// double check the context still exists",
"if",
"(",
"$",
"record",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'context'",
... | Delete context instance
@static
@param int $contextlevel
@param int $instanceid
@return void | [
"Delete",
"context",
"instance"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L5985-L5995 |
218,632 | moodle/moodle | lib/accesslib.php | context_system.instance | public static function instance($instanceid = 0, $strictness = MUST_EXIST, $cache = true) {
global $DB;
if ($instanceid != 0) {
debugging('context_system::instance(): invalid $id parameter detected, should be 0');
}
if (defined('SYSCONTEXTID') and $cache) { // dangerous: de... | php | public static function instance($instanceid = 0, $strictness = MUST_EXIST, $cache = true) {
global $DB;
if ($instanceid != 0) {
debugging('context_system::instance(): invalid $id parameter detected, should be 0');
}
if (defined('SYSCONTEXTID') and $cache) { // dangerous: de... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"instanceid",
"=",
"0",
",",
"$",
"strictness",
"=",
"MUST_EXIST",
",",
"$",
"cache",
"=",
"true",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"instanceid",
"!=",
"0",
")",
"{",
"debugging... | Returns system context instance.
@static
@param int $instanceid should be 0
@param int $strictness
@param bool $cache
@return context_system context instance | [
"Returns",
"system",
"context",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L6110-L6192 |
218,633 | moodle/moodle | lib/accesslib.php | context_system.get_child_contexts | public function get_child_contexts() {
global $DB;
debugging('Fetching of system context child courses is strongly discouraged on production servers (it may eat all available memory)!');
// Just get all the contexts except for CONTEXT_SYSTEM level
// and hope we don't OOM in the proces... | php | public function get_child_contexts() {
global $DB;
debugging('Fetching of system context child courses is strongly discouraged on production servers (it may eat all available memory)!');
// Just get all the contexts except for CONTEXT_SYSTEM level
// and hope we don't OOM in the proces... | [
"public",
"function",
"get_child_contexts",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"debugging",
"(",
"'Fetching of system context child courses is strongly discouraged on production servers (it may eat all available memory)!'",
")",
";",
"// Just get all the contexts except for CONTE... | Returns all site contexts except the system context, DO NOT call on production servers!!
Contexts are not cached.
@return array | [
"Returns",
"all",
"site",
"contexts",
"except",
"the",
"system",
"context",
"DO",
"NOT",
"call",
"on",
"production",
"servers!!"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L6201-L6219 |
218,634 | moodle/moodle | lib/accesslib.php | context_system.build_paths | protected static function build_paths($force) {
global $DB;
/* note: ignore $force here, we always do full test of system context */
// exactly one record must exist
$record = $DB->get_record('context', array('contextlevel'=>CONTEXT_SYSTEM), '*', MUST_EXIST);
if ($record->inst... | php | protected static function build_paths($force) {
global $DB;
/* note: ignore $force here, we always do full test of system context */
// exactly one record must exist
$record = $DB->get_record('context', array('contextlevel'=>CONTEXT_SYSTEM), '*', MUST_EXIST);
if ($record->inst... | [
"protected",
"static",
"function",
"build_paths",
"(",
"$",
"force",
")",
"{",
"global",
"$",
"DB",
";",
"/* note: ignore $force here, we always do full test of system context */",
"// exactly one record must exist",
"$",
"record",
"=",
"$",
"DB",
"->",
"get_record",
"(",... | Rebuild context paths and depths at system context level.
@static
@param bool $force | [
"Rebuild",
"context",
"paths",
"and",
"depths",
"at",
"system",
"context",
"level",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L6243-L6265 |
218,635 | moodle/moodle | lib/accesslib.php | context_user.instance | public static function instance($userid, $strictness = MUST_EXIST) {
global $DB;
if ($context = context::cache_get(CONTEXT_USER, $userid)) {
return $context;
}
if (!$record = $DB->get_record('context', array('contextlevel' => CONTEXT_USER, 'instanceid' => $userid))) {
... | php | public static function instance($userid, $strictness = MUST_EXIST) {
global $DB;
if ($context = context::cache_get(CONTEXT_USER, $userid)) {
return $context;
}
if (!$record = $DB->get_record('context', array('contextlevel' => CONTEXT_USER, 'instanceid' => $userid))) {
... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"userid",
",",
"$",
"strictness",
"=",
"MUST_EXIST",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"context",
"=",
"context",
"::",
"cache_get",
"(",
"CONTEXT_USER",
",",
"$",
"userid",
")",
"... | Returns user context instance.
@static
@param int $userid id from {user} table
@param int $strictness
@return context_user context instance | [
"Returns",
"user",
"context",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L6378-L6398 |
218,636 | moodle/moodle | lib/accesslib.php | context_user.build_paths | protected static function build_paths($force) {
global $DB;
// First update normal users.
$path = $DB->sql_concat('?', 'id');
$pathstart = '/' . SYSCONTEXTID . '/';
$params = array($pathstart);
if ($force) {
$where = "depth <> 2 OR path IS NULL OR path <> ({... | php | protected static function build_paths($force) {
global $DB;
// First update normal users.
$path = $DB->sql_concat('?', 'id');
$pathstart = '/' . SYSCONTEXTID . '/';
$params = array($pathstart);
if ($force) {
$where = "depth <> 2 OR path IS NULL OR path <> ({... | [
"protected",
"static",
"function",
"build_paths",
"(",
"$",
"force",
")",
"{",
"global",
"$",
"DB",
";",
"// First update normal users.",
"$",
"path",
"=",
"$",
"DB",
"->",
"sql_concat",
"(",
"'?'",
",",
"'id'",
")",
";",
"$",
"pathstart",
"=",
"'/'",
".... | Rebuild context paths and depths at user context level.
@static
@param bool $force | [
"Rebuild",
"context",
"paths",
"and",
"depths",
"at",
"user",
"context",
"level",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L6443-L6464 |
218,637 | moodle/moodle | lib/accesslib.php | context_coursecat.instance | public static function instance($categoryid, $strictness = MUST_EXIST) {
global $DB;
if ($context = context::cache_get(CONTEXT_COURSECAT, $categoryid)) {
return $context;
}
if (!$record = $DB->get_record('context', array('contextlevel' => CONTEXT_COURSECAT, 'instanceid' => ... | php | public static function instance($categoryid, $strictness = MUST_EXIST) {
global $DB;
if ($context = context::cache_get(CONTEXT_COURSECAT, $categoryid)) {
return $context;
}
if (!$record = $DB->get_record('context', array('contextlevel' => CONTEXT_COURSECAT, 'instanceid' => ... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"categoryid",
",",
"$",
"strictness",
"=",
"MUST_EXIST",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"context",
"=",
"context",
"::",
"cache_get",
"(",
"CONTEXT_COURSECAT",
",",
"$",
"categoryid... | Returns course category context instance.
@static
@param int $categoryid id from {course_categories} table
@param int $strictness
@return context_coursecat context instance | [
"Returns",
"course",
"category",
"context",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L6556-L6581 |
218,638 | moodle/moodle | lib/accesslib.php | context_coursecat.get_child_contexts | public function get_child_contexts() {
global $DB;
if (empty($this->_path) or empty($this->_depth)) {
debugging('Can not find child contexts of context '.$this->_id.' try rebuilding of context paths');
return array();
}
$sql = "SELECT ctx.*
FRO... | php | public function get_child_contexts() {
global $DB;
if (empty($this->_path) or empty($this->_depth)) {
debugging('Can not find child contexts of context '.$this->_id.' try rebuilding of context paths');
return array();
}
$sql = "SELECT ctx.*
FRO... | [
"public",
"function",
"get_child_contexts",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_path",
")",
"or",
"empty",
"(",
"$",
"this",
"->",
"_depth",
")",
")",
"{",
"debugging",
"(",
"'Can not find child contexts... | Returns immediate child contexts of category and all subcategories,
children of subcategories and courses are not returned.
@return array | [
"Returns",
"immediate",
"child",
"contexts",
"of",
"category",
"and",
"all",
"subcategories",
"children",
"of",
"subcategories",
"and",
"courses",
"are",
"not",
"returned",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L6589-L6609 |
218,639 | moodle/moodle | lib/accesslib.php | context_coursecat.create_level_instances | protected static function create_level_instances() {
global $DB;
$sql = "SELECT ".CONTEXT_COURSECAT.", cc.id
FROM {course_categories} cc
WHERE NOT EXISTS (SELECT 'x'
FROM {context} cx
WHERE cc.id... | php | protected static function create_level_instances() {
global $DB;
$sql = "SELECT ".CONTEXT_COURSECAT.", cc.id
FROM {course_categories} cc
WHERE NOT EXISTS (SELECT 'x'
FROM {context} cx
WHERE cc.id... | [
"protected",
"static",
"function",
"create_level_instances",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT \"",
".",
"CONTEXT_COURSECAT",
".",
"\", cc.id\n FROM {course_categories} cc\n WHERE NOT EXISTS (SELECT 'x'\n ... | Create missing context instances at course category context level
@static | [
"Create",
"missing",
"context",
"instances",
"at",
"course",
"category",
"context",
"level"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L6615-L6628 |
218,640 | moodle/moodle | lib/accesslib.php | context_coursecat.build_paths | protected static function build_paths($force) {
global $DB;
if ($force or $DB->record_exists_select('context', "contextlevel = ".CONTEXT_COURSECAT." AND (depth = 0 OR path IS NULL)")) {
if ($force) {
$ctxemptyclause = $emptyclause = '';
} else {
$... | php | protected static function build_paths($force) {
global $DB;
if ($force or $DB->record_exists_select('context', "contextlevel = ".CONTEXT_COURSECAT." AND (depth = 0 OR path IS NULL)")) {
if ($force) {
$ctxemptyclause = $emptyclause = '';
} else {
$... | [
"protected",
"static",
"function",
"build_paths",
"(",
"$",
"force",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"force",
"or",
"$",
"DB",
"->",
"record_exists_select",
"(",
"'context'",
",",
"\"contextlevel = \"",
".",
"CONTEXT_COURSECAT",
".",
"\" ... | Rebuild context paths and depths at course category context level.
@static
@param bool $force | [
"Rebuild",
"context",
"paths",
"and",
"depths",
"at",
"course",
"category",
"context",
"level",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L6653-L6696 |
218,641 | moodle/moodle | lib/accesslib.php | context_course.instance | public static function instance($courseid, $strictness = MUST_EXIST) {
global $DB;
if ($context = context::cache_get(CONTEXT_COURSE, $courseid)) {
return $context;
}
if (!$record = $DB->get_record('context', array('contextlevel' => CONTEXT_COURSE, 'instanceid' => $courseid)... | php | public static function instance($courseid, $strictness = MUST_EXIST) {
global $DB;
if ($context = context::cache_get(CONTEXT_COURSE, $courseid)) {
return $context;
}
if (!$record = $DB->get_record('context', array('contextlevel' => CONTEXT_COURSE, 'instanceid' => $courseid)... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"courseid",
",",
"$",
"strictness",
"=",
"MUST_EXIST",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"context",
"=",
"context",
"::",
"cache_get",
"(",
"CONTEXT_COURSE",
",",
"$",
"courseid",
")... | Returns course context instance.
@static
@param int $courseid id from {course} table
@param int $strictness
@return context_course context instance | [
"Returns",
"course",
"context",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L6810-L6835 |
218,642 | moodle/moodle | lib/accesslib.php | context_module.instance | public static function instance($cmid, $strictness = MUST_EXIST) {
global $DB;
if ($context = context::cache_get(CONTEXT_MODULE, $cmid)) {
return $context;
}
if (!$record = $DB->get_record('context', array('contextlevel' => CONTEXT_MODULE, 'instanceid' => $cmid))) {
... | php | public static function instance($cmid, $strictness = MUST_EXIST) {
global $DB;
if ($context = context::cache_get(CONTEXT_MODULE, $cmid)) {
return $context;
}
if (!$record = $DB->get_record('context', array('contextlevel' => CONTEXT_MODULE, 'instanceid' => $cmid))) {
... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"cmid",
",",
"$",
"strictness",
"=",
"MUST_EXIST",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"context",
"=",
"context",
"::",
"cache_get",
"(",
"CONTEXT_MODULE",
",",
"$",
"cmid",
")",
")"... | Returns module context instance.
@static
@param int $cmid id of the record from {course_modules} table; pass cmid there, NOT id in the instance column
@param int $strictness
@return context_module context instance | [
"Returns",
"module",
"context",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L7098-L7119 |
218,643 | moodle/moodle | lib/accesslib.php | context_block.instance | public static function instance($blockinstanceid, $strictness = MUST_EXIST) {
global $DB;
if ($context = context::cache_get(CONTEXT_BLOCK, $blockinstanceid)) {
return $context;
}
if (!$record = $DB->get_record('context', array('contextlevel' => CONTEXT_BLOCK, 'instanceid' =... | php | public static function instance($blockinstanceid, $strictness = MUST_EXIST) {
global $DB;
if ($context = context::cache_get(CONTEXT_BLOCK, $blockinstanceid)) {
return $context;
}
if (!$record = $DB->get_record('context', array('contextlevel' => CONTEXT_BLOCK, 'instanceid' =... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"blockinstanceid",
",",
"$",
"strictness",
"=",
"MUST_EXIST",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"context",
"=",
"context",
"::",
"cache_get",
"(",
"CONTEXT_BLOCK",
",",
"$",
"blockinst... | Returns block context instance.
@static
@param int $blockinstanceid id from {block_instances} table.
@param int $strictness
@return context_block context instance | [
"Returns",
"block",
"context",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L7310-L7331 |
218,644 | moodle/moodle | lib/accesslib.php | context_block.build_paths | protected static function build_paths($force) {
global $DB;
if ($force or $DB->record_exists_select('context', "contextlevel = ".CONTEXT_BLOCK." AND (depth = 0 OR path IS NULL)")) {
if ($force) {
$ctxemptyclause = '';
} else {
$ctxemptyclause = "A... | php | protected static function build_paths($force) {
global $DB;
if ($force or $DB->record_exists_select('context', "contextlevel = ".CONTEXT_BLOCK." AND (depth = 0 OR path IS NULL)")) {
if ($force) {
$ctxemptyclause = '';
} else {
$ctxemptyclause = "A... | [
"protected",
"static",
"function",
"build_paths",
"(",
"$",
"force",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"force",
"or",
"$",
"DB",
"->",
"record_exists_select",
"(",
"'context'",
",",
"\"contextlevel = \"",
".",
"CONTEXT_BLOCK",
".",
"\" AND ... | Rebuild context paths and depths at block context level.
@static
@param bool $force | [
"Rebuild",
"context",
"paths",
"and",
"depths",
"at",
"block",
"context",
"level",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/accesslib.php#L7383-L7408 |
218,645 | moodle/moodle | lib/spout/src/Spout/Reader/XLSX/Reader.php | Reader.openReader | protected function openReader($filePath)
{
$this->zip = new \ZipArchive();
if ($this->zip->open($filePath) === true) {
$this->sharedStringsHelper = new SharedStringsHelper($filePath, $this->getOptions()->getTempFolder());
if ($this->sharedStringsHelper->hasSharedStrings()) ... | php | protected function openReader($filePath)
{
$this->zip = new \ZipArchive();
if ($this->zip->open($filePath) === true) {
$this->sharedStringsHelper = new SharedStringsHelper($filePath, $this->getOptions()->getTempFolder());
if ($this->sharedStringsHelper->hasSharedStrings()) ... | [
"protected",
"function",
"openReader",
"(",
"$",
"filePath",
")",
"{",
"$",
"this",
"->",
"zip",
"=",
"new",
"\\",
"ZipArchive",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"zip",
"->",
"open",
"(",
"$",
"filePath",
")",
"===",
"true",
")",
"{",
... | Opens the file at the given file path to make it ready to be read.
It also parses the sharedStrings.xml file to get all the shared strings available in memory
and fetches all the available sheets.
@param string $filePath Path of the file to be read
@return void
@throws \Box\Spout\Common\Exception\IOException If the f... | [
"Opens",
"the",
"file",
"at",
"the",
"given",
"file",
"path",
"to",
"make",
"it",
"ready",
"to",
"be",
"read",
".",
"It",
"also",
"parses",
"the",
"sharedStrings",
".",
"xml",
"file",
"to",
"get",
"all",
"the",
"shared",
"strings",
"available",
"in",
"... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/XLSX/Reader.php#L70-L86 |
218,646 | moodle/moodle | lib/dml/sqlite3_pdo_moodle_database.php | sqlite3_pdo_moodle_database.get_indexes | public function get_indexes($table) {
$indexes = array();
$sql = 'PRAGMA index_list('.$this->prefix.$table.')';
if ($this->debug) {
$this->debug_query($sql);
}
$rsindexes = $this->pdb->query($sql);
foreach($rsindexes as $index) {
$unique = (boolean... | php | public function get_indexes($table) {
$indexes = array();
$sql = 'PRAGMA index_list('.$this->prefix.$table.')';
if ($this->debug) {
$this->debug_query($sql);
}
$rsindexes = $this->pdb->query($sql);
foreach($rsindexes as $index) {
$unique = (boolean... | [
"public",
"function",
"get_indexes",
"(",
"$",
"table",
")",
"{",
"$",
"indexes",
"=",
"array",
"(",
")",
";",
"$",
"sql",
"=",
"'PRAGMA index_list('",
".",
"$",
"this",
"->",
"prefix",
".",
"$",
"table",
".",
"')'",
";",
"if",
"(",
"$",
"this",
"-... | Return table indexes - everything lowercased
@param string $table The table we want to get indexes from.
@return array of arrays | [
"Return",
"table",
"indexes",
"-",
"everything",
"lowercased"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/sqlite3_pdo_moodle_database.php#L169-L193 |
218,647 | moodle/moodle | lib/dml/sqlite3_pdo_moodle_database.php | sqlite3_pdo_moodle_database.get_limit_clauses | protected function get_limit_clauses($sql, $limitfrom=0, $limitnum=0) {
if ($limitnum) {
$sql .= ' LIMIT '.$limitnum;
if ($limitfrom) {
$sql .= ' OFFSET '.$limitfrom;
}
}
return $sql;
} | php | protected function get_limit_clauses($sql, $limitfrom=0, $limitnum=0) {
if ($limitnum) {
$sql .= ' LIMIT '.$limitnum;
if ($limitfrom) {
$sql .= ' OFFSET '.$limitfrom;
}
}
return $sql;
} | [
"protected",
"function",
"get_limit_clauses",
"(",
"$",
"sql",
",",
"$",
"limitfrom",
"=",
"0",
",",
"$",
"limitnum",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"limitnum",
")",
"{",
"$",
"sql",
".=",
"' LIMIT '",
".",
"$",
"limitnum",
";",
"if",
"(",
"$"... | Returns the sql statement with clauses to append used to limit a recordset range.
@param string $sql the SQL statement to limit.
@param int $limitfrom return a subset of records, starting at this point (optional, required if $limitnum is set).
@param int $limitnum return a subset comprising this many records (optional,... | [
"Returns",
"the",
"sql",
"statement",
"with",
"clauses",
"to",
"append",
"used",
"to",
"limit",
"a",
"recordset",
"range",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/sqlite3_pdo_moodle_database.php#L335-L343 |
218,648 | moodle/moodle | lib/dml/sqlite3_pdo_moodle_database.php | sqlite3_pdo_moodle_database.sql_bitxor | public function sql_bitxor($int1, $int2) {
return '( ~' . $this->sql_bitand($int1, $int2) . ' & ' . $this->sql_bitor($int1, $int2) . ')';
} | php | public function sql_bitxor($int1, $int2) {
return '( ~' . $this->sql_bitand($int1, $int2) . ' & ' . $this->sql_bitor($int1, $int2) . ')';
} | [
"public",
"function",
"sql_bitxor",
"(",
"$",
"int1",
",",
"$",
"int2",
")",
"{",
"return",
"'( ~'",
".",
"$",
"this",
"->",
"sql_bitand",
"(",
"$",
"int1",
",",
"$",
"int2",
")",
".",
"' & '",
".",
"$",
"this",
"->",
"sql_bitor",
"(",
"$",
"int1",... | Returns the SQL text to be used in order to perform one bitwise XOR operation
between 2 integers.
@param integer int1 first integer in the operation
@param integer int2 second integer in the operation
@return string the piece of SQL code to be used in your statement. | [
"Returns",
"the",
"SQL",
"text",
"to",
"be",
"used",
"in",
"order",
"to",
"perform",
"one",
"bitwise",
"XOR",
"operation",
"between",
"2",
"integers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/sqlite3_pdo_moodle_database.php#L400-L402 |
218,649 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/AttrDef/HTML/Nmtokens.php | HTMLPurifier_AttrDef_HTML_Nmtokens.split | protected function split($string, $config, $context)
{
// OPTIMIZABLE!
// do the preg_match, capture all subpatterns for reformulation
// we don't support U+00A1 and up codepoints or
// escaping because I don't know how to do that with regexps
// and plus it would complicate... | php | protected function split($string, $config, $context)
{
// OPTIMIZABLE!
// do the preg_match, capture all subpatterns for reformulation
// we don't support U+00A1 and up codepoints or
// escaping because I don't know how to do that with regexps
// and plus it would complicate... | [
"protected",
"function",
"split",
"(",
"$",
"string",
",",
"$",
"config",
",",
"$",
"context",
")",
"{",
"// OPTIMIZABLE!",
"// do the preg_match, capture all subpatterns for reformulation",
"// we don't support U+00A1 and up codepoints or",
"// escaping because I don't know how to... | Splits a space separated list of tokens into its constituent parts.
@param string $string
@param HTMLPurifier_Config $config
@param HTMLPurifier_Context $context
@return array | [
"Splits",
"a",
"space",
"separated",
"list",
"of",
"tokens",
"into",
"its",
"constituent",
"parts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/AttrDef/HTML/Nmtokens.php#L39-L53 |
218,650 | moodle/moodle | question/classes/bank/view.php | view.get_column_type | protected function get_column_type($columnname) {
if (! class_exists($columnname)) {
if (class_exists('core_question\\bank\\' . $columnname)) {
$columnname = 'core_question\\bank\\' . $columnname;
} else {
throw new \coding_exception("No such class exists:... | php | protected function get_column_type($columnname) {
if (! class_exists($columnname)) {
if (class_exists('core_question\\bank\\' . $columnname)) {
$columnname = 'core_question\\bank\\' . $columnname;
} else {
throw new \coding_exception("No such class exists:... | [
"protected",
"function",
"get_column_type",
"(",
"$",
"columnname",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"columnname",
")",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'core_question\\\\bank\\\\'",
".",
"$",
"columnname",
")",
")",
"{",
"$",
... | Get a column object from its name.
@param string $columnname.
@return \core_question\bank\column_base. | [
"Get",
"a",
"column",
"object",
"from",
"its",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/view.php#L157-L169 |
218,651 | moodle/moodle | question/classes/bank/view.php | view.init_columns | protected function init_columns($wanted, $heading = '') {
$this->visiblecolumns = array();
$this->extrarows = array();
foreach ($wanted as $column) {
if ($column->is_extra_row()) {
$this->extrarows[get_class($column)] = $column;
} else {
$t... | php | protected function init_columns($wanted, $heading = '') {
$this->visiblecolumns = array();
$this->extrarows = array();
foreach ($wanted as $column) {
if ($column->is_extra_row()) {
$this->extrarows[get_class($column)] = $column;
} else {
$t... | [
"protected",
"function",
"init_columns",
"(",
"$",
"wanted",
",",
"$",
"heading",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"visiblecolumns",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"extrarows",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",... | Initializing table columns
@param array $wanted Collection of column names
@param string $heading The name of column that is set as heading | [
"Initializing",
"table",
"columns"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/view.php#L186-L199 |
218,652 | moodle/moodle | question/classes/bank/view.php | view.new_sort_url | public function new_sort_url($sort, $newsortreverse) {
if ($newsortreverse) {
$order = -1;
} else {
$order = 1;
}
// Tricky code to add the new sort at the start, removing it from where it was before, if it was present.
$newsort = array_reverse($this->sort... | php | public function new_sort_url($sort, $newsortreverse) {
if ($newsortreverse) {
$order = -1;
} else {
$order = 1;
}
// Tricky code to add the new sort at the start, removing it from where it was before, if it was present.
$newsort = array_reverse($this->sort... | [
"public",
"function",
"new_sort_url",
"(",
"$",
"sort",
",",
"$",
"newsortreverse",
")",
"{",
"if",
"(",
"$",
"newsortreverse",
")",
"{",
"$",
"order",
"=",
"-",
"1",
";",
"}",
"else",
"{",
"$",
"order",
"=",
"1",
";",
"}",
"// Tricky code to add the n... | Get a URL to redisplay the page with a new sort for the question bank.
@param string $sort the column, or column_subsort to sort on.
@param bool $newsortreverse whether to sort in reverse order.
@return string The new URL. | [
"Get",
"a",
"URL",
"to",
"redisplay",
"the",
"page",
"with",
"a",
"new",
"sort",
"for",
"the",
"question",
"bank",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/view.php#L318-L335 |
218,653 | moodle/moodle | question/classes/bank/view.php | view.build_query | protected function build_query() {
global $DB;
// Get the required tables and fields.
$joins = array();
$fields = array('q.hidden', 'q.category');
foreach ($this->requiredcolumns as $column) {
$extrajoins = $column->get_extra_joins();
foreach ($extrajoins... | php | protected function build_query() {
global $DB;
// Get the required tables and fields.
$joins = array();
$fields = array('q.hidden', 'q.category');
foreach ($this->requiredcolumns as $column) {
$extrajoins = $column->get_extra_joins();
foreach ($extrajoins... | [
"protected",
"function",
"build_query",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"// Get the required tables and fields.",
"$",
"joins",
"=",
"array",
"(",
")",
";",
"$",
"fields",
"=",
"array",
"(",
"'q.hidden'",
",",
"'q.category'",
")",
";",
"foreach",
"(... | Create the SQL query to retrieve the indicated questions, based on
\core_question\bank\search\condition filters. | [
"Create",
"the",
"SQL",
"query",
"to",
"retrieve",
"the",
"indicated",
"questions",
"based",
"on",
"\\",
"core_question",
"\\",
"bank",
"\\",
"search",
"\\",
"condition",
"filters",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/view.php#L357-L398 |
218,654 | moodle/moodle | question/classes/bank/view.php | view.preview_question_url | public function preview_question_url($questiondata) {
return question_preview_url($questiondata->id, null, null, null, null,
$this->get_most_specific_context());
} | php | public function preview_question_url($questiondata) {
return question_preview_url($questiondata->id, null, null, null, null,
$this->get_most_specific_context());
} | [
"public",
"function",
"preview_question_url",
"(",
"$",
"questiondata",
")",
"{",
"return",
"question_preview_url",
"(",
"$",
"questiondata",
"->",
"id",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"$",
"this",
"->",
"get_most_specific_context",
"... | Get the URL to preview a question.
@param stdClass $questiondata the data defining the question.
@return moodle_url the URL. | [
"Get",
"the",
"URL",
"to",
"preview",
"a",
"question",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/view.php#L446-L449 |
218,655 | moodle/moodle | question/classes/bank/view.php | view.display | public function display($tabname, $page, $perpage, $cat,
$recurse, $showhidden, $showquestiontext, $tagids = []) {
global $PAGE, $CFG;
if ($this->process_actions_needing_ui()) {
return;
}
$editcontexts = $this->contexts->having_one_edit_tab_cap($tabname);
... | php | public function display($tabname, $page, $perpage, $cat,
$recurse, $showhidden, $showquestiontext, $tagids = []) {
global $PAGE, $CFG;
if ($this->process_actions_needing_ui()) {
return;
}
$editcontexts = $this->contexts->having_one_edit_tab_cap($tabname);
... | [
"public",
"function",
"display",
"(",
"$",
"tabname",
",",
"$",
"page",
",",
"$",
"perpage",
",",
"$",
"cat",
",",
"$",
"recurse",
",",
"$",
"showhidden",
",",
"$",
"showquestiontext",
",",
"$",
"tagids",
"=",
"[",
"]",
")",
"{",
"global",
"$",
"PA... | Shows the question bank editing interface.
The function also processes a number of actions:
Actions affecting the question pool:
move Moves a question to a different category
deleteselected Deletes the selected questions from the category
Other actions:
category Chooses the category
displayoptions Sets... | [
"Shows",
"the",
"question",
"bank",
"editing",
"interface",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/view.php#L463-L495 |
218,656 | moodle/moodle | question/classes/bank/view.php | view.print_category_info | protected function print_category_info($category) {
$formatoptions = new \stdClass();
$formatoptions->noclean = true;
$formatoptions->overflowdiv = true;
echo '<div class="boxaligncenter">';
echo format_text($category->info, $category->infoformat, $formatoptions, $this->course->i... | php | protected function print_category_info($category) {
$formatoptions = new \stdClass();
$formatoptions->noclean = true;
$formatoptions->overflowdiv = true;
echo '<div class="boxaligncenter">';
echo format_text($category->info, $category->infoformat, $formatoptions, $this->course->i... | [
"protected",
"function",
"print_category_info",
"(",
"$",
"category",
")",
"{",
"$",
"formatoptions",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"formatoptions",
"->",
"noclean",
"=",
"true",
";",
"$",
"formatoptions",
"->",
"overflowdiv",
"=",
"true"... | prints category information
@param stdClass $category the category row from the database.
@deprecated since Moodle 2.7 MDL-40313.
@see \core_question\bank\search\condition
@todo MDL-41978 This will be deleted in Moodle 2.8 | [
"prints",
"category",
"information"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/view.php#L529-L536 |
218,657 | moodle/moodle | question/classes/bank/view.php | view.display_category_form | protected function display_category_form($contexts, $pageurl, $current) {
global $OUTPUT;
debugging('display_category_form() is deprecated, please use ' .
'\core_question\bank\search\condition instead.', DEBUG_DEVELOPER);
// Get all the existing categories now.
echo '<di... | php | protected function display_category_form($contexts, $pageurl, $current) {
global $OUTPUT;
debugging('display_category_form() is deprecated, please use ' .
'\core_question\bank\search\condition instead.', DEBUG_DEVELOPER);
// Get all the existing categories now.
echo '<di... | [
"protected",
"function",
"display_category_form",
"(",
"$",
"contexts",
",",
"$",
"pageurl",
",",
"$",
"current",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"debugging",
"(",
"'display_category_form() is deprecated, please use '",
".",
"'\\core_question\\bank\\search\\condit... | Prints a form to choose categories
@deprecated since Moodle 2.7 MDL-40313.
@see \core_question\bank\search\condition
@todo MDL-41978 This will be deleted in Moodle 2.8 | [
"Prints",
"a",
"form",
"to",
"choose",
"categories"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/view.php#L544-L557 |
218,658 | moodle/moodle | question/classes/bank/view.php | view.display_category_form_checkbox | protected function display_category_form_checkbox($name, $value, $label) {
debugging('display_category_form_checkbox() is deprecated, ' .
'please use \core_question\bank\search\condition instead.', DEBUG_DEVELOPER);
echo '<div><input type="hidden" id="' . $name . '_off" name="' . $name .... | php | protected function display_category_form_checkbox($name, $value, $label) {
debugging('display_category_form_checkbox() is deprecated, ' .
'please use \core_question\bank\search\condition instead.', DEBUG_DEVELOPER);
echo '<div><input type="hidden" id="' . $name . '_off" name="' . $name .... | [
"protected",
"function",
"display_category_form_checkbox",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"label",
")",
"{",
"debugging",
"(",
"'display_category_form_checkbox() is deprecated, '",
".",
"'please use \\core_question\\bank\\search\\condition instead.'",
",",
"DE... | Print a single option checkbox.
@deprecated since Moodle 2.7 MDL-40313.
@see \core_question\bank\search\condition
@see html_writer::checkbox
@todo MDL-41978 This will be deleted in Moodle 2.8 | [
"Print",
"a",
"single",
"option",
"checkbox",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/view.php#L581-L592 |
218,659 | moodle/moodle | question/classes/bank/view.php | view.display_options_form | protected function display_options_form($showquestiontext, $scriptpath = '/question/edit.php',
$showtextoption = true) {
global $PAGE;
echo \html_writer::start_tag('form', array('method' => 'get',
'action' => new \moodle_url($scriptpath), 'id' => 'displayoptions'));
... | php | protected function display_options_form($showquestiontext, $scriptpath = '/question/edit.php',
$showtextoption = true) {
global $PAGE;
echo \html_writer::start_tag('form', array('method' => 'get',
'action' => new \moodle_url($scriptpath), 'id' => 'displayoptions'));
... | [
"protected",
"function",
"display_options_form",
"(",
"$",
"showquestiontext",
",",
"$",
"scriptpath",
"=",
"'/question/edit.php'",
",",
"$",
"showtextoption",
"=",
"true",
")",
"{",
"global",
"$",
"PAGE",
";",
"echo",
"\\",
"html_writer",
"::",
"start_tag",
"("... | Display the form with options for which questions are displayed and how they are displayed.
@param bool $showquestiontext Display the text of the question within the list.
@param string $path path to the script displaying this page.
@param bool $showtextoption whether to include the 'Show question text' checkbox. | [
"Display",
"the",
"form",
"with",
"options",
"for",
"which",
"questions",
"are",
"displayed",
"and",
"how",
"they",
"are",
"displayed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/view.php#L600-L633 |
218,660 | moodle/moodle | question/classes/bank/view.php | view.display_advanced_search_form | protected function display_advanced_search_form() {
print_collapsible_region_start('', 'advancedsearch', get_string('advancedsearchoptions', 'question'),
'question_bank_advanced_search');
foreach ($this->searchconditions as $searchcondition) {
e... | php | protected function display_advanced_search_form() {
print_collapsible_region_start('', 'advancedsearch', get_string('advancedsearchoptions', 'question'),
'question_bank_advanced_search');
foreach ($this->searchconditions as $searchcondition) {
e... | [
"protected",
"function",
"display_advanced_search_form",
"(",
")",
"{",
"print_collapsible_region_start",
"(",
"''",
",",
"'advancedsearch'",
",",
"get_string",
"(",
"'advancedsearchoptions'",
",",
"'question'",
")",
",",
"'question_bank_advanced_search'",
")",
";",
"fore... | Print the "advanced" UI elements for the form to select which questions. Hidden by default. | [
"Print",
"the",
"advanced",
"UI",
"elements",
"for",
"the",
"form",
"to",
"select",
"which",
"questions",
".",
"Hidden",
"by",
"default",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/view.php#L638-L645 |
218,661 | moodle/moodle | mod/wiki/classes/privacy/provider.php | provider.export_subwiki | protected static function export_subwiki($user, context $context, $subwiki, $wikimode) {
if (empty($subwiki)) {
return;
}
$subwikiid = key($subwiki);
$pages = $subwiki[$subwikiid]['pages'];
unset($subwiki[$subwikiid]['pages']);
writer::with_context($context)->... | php | protected static function export_subwiki($user, context $context, $subwiki, $wikimode) {
if (empty($subwiki)) {
return;
}
$subwikiid = key($subwiki);
$pages = $subwiki[$subwikiid]['pages'];
unset($subwiki[$subwikiid]['pages']);
writer::with_context($context)->... | [
"protected",
"static",
"function",
"export_subwiki",
"(",
"$",
"user",
",",
"context",
"$",
"context",
",",
"$",
"subwiki",
",",
"$",
"wikimode",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"subwiki",
")",
")",
"{",
"return",
";",
"}",
"$",
"subwikiid",
... | Add one subwiki to the export
Each page is added as related data because all pages in one subwiki share the same filearea
@param stdClass $user
@param context $context
@param array $subwiki
@param string $wikimode | [
"Add",
"one",
"subwiki",
"to",
"the",
"export"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/classes/privacy/provider.php#L200-L250 |
218,662 | moodle/moodle | mod/wiki/classes/privacy/provider.php | provider.get_page_comments | protected static function get_page_comments($user, \context $context, $pageid, $onlyforthisuser = true) {
global $USER, $DB;
$params = [
'contextid' => $context->id,
'commentarea' => 'wiki_page',
'itemid' => $pageid
];
$sql = "SELECT c.id, c.content, c... | php | protected static function get_page_comments($user, \context $context, $pageid, $onlyforthisuser = true) {
global $USER, $DB;
$params = [
'contextid' => $context->id,
'commentarea' => 'wiki_page',
'itemid' => $pageid
];
$sql = "SELECT c.id, c.content, c... | [
"protected",
"static",
"function",
"get_page_comments",
"(",
"$",
"user",
",",
"\\",
"context",
"$",
"context",
",",
"$",
"pageid",
",",
"$",
"onlyforthisuser",
"=",
"true",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"DB",
";",
"$",
"params",
"=",
"[",... | Retrieves page comments
We can not use \core_comment\privacy\provider::export_comments() because it expects each item to have a separate
subcontext and we store wiki pages as related data to subwiki because the files are shared between pages.
@param stdClass $user
@param \context $context
@param int $pageid
@param bo... | [
"Retrieves",
"page",
"comments"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/classes/privacy/provider.php#L264-L300 |
218,663 | moodle/moodle | mod/wiki/classes/privacy/provider.php | provider.export_used_files | protected static function export_used_files($context, $subwikiid, $alltexts) {
if (!self::text_has_files($alltexts)) {
return;
}
$fs = get_file_storage();
$files = $fs->get_area_files($context->id, 'mod_wiki', 'attachments', $subwikiid,
'filepath, filename', false... | php | protected static function export_used_files($context, $subwikiid, $alltexts) {
if (!self::text_has_files($alltexts)) {
return;
}
$fs = get_file_storage();
$files = $fs->get_area_files($context->id, 'mod_wiki', 'attachments', $subwikiid,
'filepath, filename', false... | [
"protected",
"static",
"function",
"export_used_files",
"(",
"$",
"context",
",",
"$",
"subwikiid",
",",
"$",
"alltexts",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"text_has_files",
"(",
"$",
"alltexts",
")",
")",
"{",
"return",
";",
"}",
"$",
"fs",
"=",... | Analyze which files are used in the texts and export
@param context $context
@param int $subwikiid
@param string $alltexts
@return int|void | [
"Analyze",
"which",
"files",
"are",
"used",
"in",
"the",
"texts",
"and",
"export"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/classes/privacy/provider.php#L319-L350 |
218,664 | moodle/moodle | admin/tool/capability/renderer.php | tool_capability_renderer.get_permission_strings | protected function get_permission_strings() {
static $strpermissions;
if (!$strpermissions) {
$strpermissions = array(
CAP_INHERIT => new lang_string('inherit', 'role'),
CAP_ALLOW => new lang_string('allow', 'role'),
CAP_PREVENT => new lang_str... | php | protected function get_permission_strings() {
static $strpermissions;
if (!$strpermissions) {
$strpermissions = array(
CAP_INHERIT => new lang_string('inherit', 'role'),
CAP_ALLOW => new lang_string('allow', 'role'),
CAP_PREVENT => new lang_str... | [
"protected",
"function",
"get_permission_strings",
"(",
")",
"{",
"static",
"$",
"strpermissions",
";",
"if",
"(",
"!",
"$",
"strpermissions",
")",
"{",
"$",
"strpermissions",
"=",
"array",
"(",
"CAP_INHERIT",
"=>",
"new",
"lang_string",
"(",
"'inherit'",
",",... | Returns an array of permission strings.
@return lang_string[] | [
"Returns",
"an",
"array",
"of",
"permission",
"strings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/capability/renderer.php#L38-L49 |
218,665 | moodle/moodle | admin/tool/capability/renderer.php | tool_capability_renderer.capability_comparison_table | public function capability_comparison_table(array $capabilities, $contextid, array $roles) {
$strpermissions = $this->get_permission_strings();
$permissionclasses = $this->get_permission_classes();
if ($contextid === context_system::instance()->id) {
$strpermissions[CAP_INHERIT] = ... | php | public function capability_comparison_table(array $capabilities, $contextid, array $roles) {
$strpermissions = $this->get_permission_strings();
$permissionclasses = $this->get_permission_classes();
if ($contextid === context_system::instance()->id) {
$strpermissions[CAP_INHERIT] = ... | [
"public",
"function",
"capability_comparison_table",
"(",
"array",
"$",
"capabilities",
",",
"$",
"contextid",
",",
"array",
"$",
"roles",
")",
"{",
"$",
"strpermissions",
"=",
"$",
"this",
"->",
"get_permission_strings",
"(",
")",
";",
"$",
"permissionclasses",... | Produces a table to visually compare roles and capabilities.
@param array $capabilities An array of capabilities to show comparison for.
@param int $contextid The context we are displaying for.
@param array $roles An array of roles to show comparison for.
@return string | [
"Produces",
"a",
"table",
"to",
"visually",
"compare",
"roles",
"and",
"capabilities",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/capability/renderer.php#L77-L134 |
218,666 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Namespace/List.php | Horde_Imap_Client_Namespace_List.getNamespace | public function getNamespace($mbox, $personal = false)
{
$mbox = strval($mbox);
if ($ns = $this[$mbox]) {
return $ns;
}
foreach ($this->_ns as $val) {
$mbox = $mbox . $val->delimiter;
if (strlen($val->name) && (strpos($mbox, $val->name) === 0)) {... | php | public function getNamespace($mbox, $personal = false)
{
$mbox = strval($mbox);
if ($ns = $this[$mbox]) {
return $ns;
}
foreach ($this->_ns as $val) {
$mbox = $mbox . $val->delimiter;
if (strlen($val->name) && (strpos($mbox, $val->name) === 0)) {... | [
"public",
"function",
"getNamespace",
"(",
"$",
"mbox",
",",
"$",
"personal",
"=",
"false",
")",
"{",
"$",
"mbox",
"=",
"strval",
"(",
"$",
"mbox",
")",
";",
"if",
"(",
"$",
"ns",
"=",
"$",
"this",
"[",
"$",
"mbox",
"]",
")",
"{",
"return",
"$"... | Get namespace info for a full mailbox path.
@param string $mbox The mailbox path.
@param boolean $personal If true, will return the empty namespace only
if it is a personal namespace.
@return mixed The Horde_Imap_Client_Data_Namespace object for the
mailbox path, or null if the path doesn't exist. | [
"Get",
"namespace",
"info",
"for",
"a",
"full",
"mailbox",
"path",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Namespace/List.php#L56-L74 |
218,667 | moodle/moodle | backup/util/helper/backup_general_helper.class.php | backup_general_helper.get_blocks_from_path | public static function get_blocks_from_path($path) {
global $DB;
$blocks = array(); // To return results
static $availableblocks = array(); // Get and cache available blocks
if (empty($availableblocks)) {
$availableblocks = array_keys(core_component::get_plugin_list('block'... | php | public static function get_blocks_from_path($path) {
global $DB;
$blocks = array(); // To return results
static $availableblocks = array(); // Get and cache available blocks
if (empty($availableblocks)) {
$availableblocks = array_keys(core_component::get_plugin_list('block'... | [
"public",
"static",
"function",
"get_blocks_from_path",
"(",
"$",
"path",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"blocks",
"=",
"array",
"(",
")",
";",
"// To return results",
"static",
"$",
"availableblocks",
"=",
"array",
"(",
")",
";",
"// Get and cache... | Load all the blocks information needed for a given path within moodle2 backup
This function, given one full path (course, activities/xxxx) will look for all the
blocks existing in the backup file, returning one array used to build the
proper restore plan by the @restore_plan_builder | [
"Load",
"all",
"the",
"blocks",
"information",
"needed",
"for",
"a",
"given",
"path",
"within",
"moodle2",
"backup"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/backup_general_helper.class.php#L68-L106 |
218,668 | moodle/moodle | backup/util/helper/backup_general_helper.class.php | backup_general_helper.get_backup_information_from_mbz | public static function get_backup_information_from_mbz($filepath, file_progress $progress = null) {
global $CFG;
if (!is_readable($filepath)) {
throw new backup_helper_exception('missing_moodle_backup_file', $filepath);
}
// Extract moodle_backup.xml.
$tmpname = 'inf... | php | public static function get_backup_information_from_mbz($filepath, file_progress $progress = null) {
global $CFG;
if (!is_readable($filepath)) {
throw new backup_helper_exception('missing_moodle_backup_file', $filepath);
}
// Extract moodle_backup.xml.
$tmpname = 'inf... | [
"public",
"static",
"function",
"get_backup_information_from_mbz",
"(",
"$",
"filepath",
",",
"file_progress",
"$",
"progress",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"is_readable",
"(",
"$",
"filepath",
")",
")",
"{",
"throw",
"... | Load and format all the needed information from a backup file.
This will only extract the moodle_backup.xml file from an MBZ
file and then call {@link self::get_backup_information()}.
This can be a long-running (multi-minute) operation for large backups.
Pass a $progress value to receive progress updates.
@param str... | [
"Load",
"and",
"format",
"all",
"the",
"needed",
"information",
"from",
"a",
"backup",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/backup_general_helper.class.php#L263-L284 |
218,669 | moodle/moodle | backup/util/helper/backup_general_helper.class.php | backup_general_helper.backup_is_samesite | public static function backup_is_samesite($info) {
global $CFG;
$hashedsiteid = md5(get_site_identifier());
if (isset($info->original_site_identifier_hash) && !empty($info->original_site_identifier_hash)) {
return $info->original_site_identifier_hash == $hashedsiteid;
} else ... | php | public static function backup_is_samesite($info) {
global $CFG;
$hashedsiteid = md5(get_site_identifier());
if (isset($info->original_site_identifier_hash) && !empty($info->original_site_identifier_hash)) {
return $info->original_site_identifier_hash == $hashedsiteid;
} else ... | [
"public",
"static",
"function",
"backup_is_samesite",
"(",
"$",
"info",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"hashedsiteid",
"=",
"md5",
"(",
"get_site_identifier",
"(",
")",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"info",
"->",
"original_site_identif... | Given the information fetched from moodle_backup.xml file
decide if we are restoring in the same site the backup was
generated or no. Behavior of various parts of restore are
dependent of this.
Backups created natively in 2.0 and later declare the hashed
site identifier. Backups created by conversion from a 1.9
backup... | [
"Given",
"the",
"information",
"fetched",
"from",
"moodle_backup",
".",
"xml",
"file",
"decide",
"if",
"we",
"are",
"restoring",
"in",
"the",
"same",
"site",
"the",
"backup",
"was",
"generated",
"or",
"no",
".",
"Behavior",
"of",
"various",
"parts",
"of",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/backup_general_helper.class.php#L297-L305 |
218,670 | moodle/moodle | backup/util/helper/backup_general_helper.class.php | backup_general_helper.detect_backup_format | public static function detect_backup_format($tempdir) {
global $CFG;
require_once($CFG->dirroot . '/backup/util/helper/convert_helper.class.php');
if (convert_helper::detect_moodle2_format($tempdir)) {
return backup::FORMAT_MOODLE;
}
// see if a converter can identi... | php | public static function detect_backup_format($tempdir) {
global $CFG;
require_once($CFG->dirroot . '/backup/util/helper/convert_helper.class.php');
if (convert_helper::detect_moodle2_format($tempdir)) {
return backup::FORMAT_MOODLE;
}
// see if a converter can identi... | [
"public",
"static",
"function",
"detect_backup_format",
"(",
"$",
"tempdir",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/backup/util/helper/convert_helper.class.php'",
")",
";",
"if",
"(",
"convert_helper",
"::",
... | Detects the format of the given unpacked backup directory
@param string $tempdir the name of the backup directory
@return string one of backup::FORMAT_xxx constants | [
"Detects",
"the",
"format",
"of",
"the",
"given",
"unpacked",
"backup",
"directory"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/backup_general_helper.class.php#L313-L337 |
218,671 | moodle/moodle | mod/assign/gradingbatchoperationsform.php | mod_assign_grading_batch_operations_form.definition | public function definition() {
$mform = $this->_form;
$instance = $this->_customdata;
// Visible elements.
$options = array();
$options['lock'] = get_string('locksubmissions', 'assign');
$options['unlock'] = get_string('unlocksubmissions', 'assign');
$options['do... | php | public function definition() {
$mform = $this->_form;
$instance = $this->_customdata;
// Visible elements.
$options = array();
$options['lock'] = get_string('locksubmissions', 'assign');
$options['unlock'] = get_string('unlocksubmissions', 'assign');
$options['do... | [
"public",
"function",
"definition",
"(",
")",
"{",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"$",
"instance",
"=",
"$",
"this",
"->",
"_customdata",
";",
"// Visible elements.",
"$",
"options",
"=",
"array",
"(",
")",
";",
"$",
"options",
"["... | Define this form - called by the parent constructor. | [
"Define",
"this",
"form",
"-",
"called",
"by",
"the",
"parent",
"constructor",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/gradingbatchoperationsform.php#L41-L92 |
218,672 | moodle/moodle | customfield/classes/category_controller.php | category_controller.create | public static function create(int $id, \stdClass $record = null, handler $handler = null) : category_controller {
global $DB;
if ($id && $record) {
// This warning really should be in persistent as well.
debugging('Too many parameters, either id need to be specified or a record, ... | php | public static function create(int $id, \stdClass $record = null, handler $handler = null) : category_controller {
global $DB;
if ($id && $record) {
// This warning really should be in persistent as well.
debugging('Too many parameters, either id need to be specified or a record, ... | [
"public",
"static",
"function",
"create",
"(",
"int",
"$",
"id",
",",
"\\",
"stdClass",
"$",
"record",
"=",
"null",
",",
"handler",
"$",
"handler",
"=",
"null",
")",
":",
"category_controller",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"id",
"&&... | Creates an instance of category_controller
Either $id or $record or $handler need to be specified
If handler is known pass it to constructor to avoid retrieving it later
Component, area and itemid must not conflict with the ones in handler
@param int $id
@param \stdClass|null $record
@param handler|null $handler
@ret... | [
"Creates",
"an",
"instance",
"of",
"category_controller"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/category_controller.php#L80-L120 |
218,673 | moodle/moodle | customfield/classes/category_controller.php | category_controller.get_handler | public function get_handler() : handler {
if ($this->handler === null) {
$this->handler = handler::get_handler($this->get('component'), $this->get('area'), $this->get('itemid'));
}
return $this->handler;
} | php | public function get_handler() : handler {
if ($this->handler === null) {
$this->handler = handler::get_handler($this->get('component'), $this->get('area'), $this->get('itemid'));
}
return $this->handler;
} | [
"public",
"function",
"get_handler",
"(",
")",
":",
"handler",
"{",
"if",
"(",
"$",
"this",
"->",
"handler",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"handler",
"=",
"handler",
"::",
"get_handler",
"(",
"$",
"this",
"->",
"get",
"(",
"'component'",
... | Gets a handler, if not known retrieve it
@return handler | [
"Gets",
"a",
"handler",
"if",
"not",
"known",
"retrieve",
"it"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/category_controller.php#L183-L188 |
218,674 | moodle/moodle | customfield/classes/category_controller.php | category_controller.set_handler | public function set_handler(handler $handler) {
// Make sure there are no conflicts.
if ($this->get('component') !== $handler->get_component()) {
throw new \coding_exception('Component of the handler does not match the one from the record');
}
if ($this->get('area') !== $hand... | php | public function set_handler(handler $handler) {
// Make sure there are no conflicts.
if ($this->get('component') !== $handler->get_component()) {
throw new \coding_exception('Component of the handler does not match the one from the record');
}
if ($this->get('area') !== $hand... | [
"public",
"function",
"set_handler",
"(",
"handler",
"$",
"handler",
")",
"{",
"// Make sure there are no conflicts.",
"if",
"(",
"$",
"this",
"->",
"get",
"(",
"'component'",
")",
"!==",
"$",
"handler",
"->",
"get_component",
"(",
")",
")",
"{",
"throw",
"n... | Allows to set handler so we don't need to retrieve it later
@param handler $handler
@throws \coding_exception | [
"Allows",
"to",
"set",
"handler",
"so",
"we",
"don",
"t",
"need",
"to",
"retrieve",
"it",
"later"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/category_controller.php#L196-L211 |
218,675 | moodle/moodle | mod/resource/classes/external.php | mod_resource_external.get_resources_by_courses | public static function get_resources_by_courses($courseids = array()) {
$warnings = array();
$returnedresources = array();
$params = array(
'courseids' => $courseids,
);
$params = self::validate_parameters(self::get_resources_by_courses_parameters(), $params);
... | php | public static function get_resources_by_courses($courseids = array()) {
$warnings = array();
$returnedresources = array();
$params = array(
'courseids' => $courseids,
);
$params = self::validate_parameters(self::get_resources_by_courses_parameters(), $params);
... | [
"public",
"static",
"function",
"get_resources_by_courses",
"(",
"$",
"courseids",
"=",
"array",
"(",
")",
")",
"{",
"$",
"warnings",
"=",
"array",
"(",
")",
";",
"$",
"returnedresources",
"=",
"array",
"(",
")",
";",
"$",
"params",
"=",
"array",
"(",
... | Returns a list of files in a provided list of courses.
If no list is provided all files that the user can view will be returned.
@param array $courseids course ids
@return array of warnings and files
@since Moodle 3.3 | [
"Returns",
"a",
"list",
"of",
"files",
"in",
"a",
"provided",
"list",
"of",
"courses",
".",
"If",
"no",
"list",
"is",
"provided",
"all",
"files",
"that",
"the",
"user",
"can",
"view",
"will",
"be",
"returned",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/resource/classes/external.php#L131-L174 |
218,676 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/Lexer.php | HTMLPurifier_Lexer.create | public static function create($config)
{
if (!($config instanceof HTMLPurifier_Config)) {
$lexer = $config;
trigger_error(
"Passing a prototype to
HTMLPurifier_Lexer::create() is deprecated, please instead
use %Core.LexerImpl",
... | php | public static function create($config)
{
if (!($config instanceof HTMLPurifier_Config)) {
$lexer = $config;
trigger_error(
"Passing a prototype to
HTMLPurifier_Lexer::create() is deprecated, please instead
use %Core.LexerImpl",
... | [
"public",
"static",
"function",
"create",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"config",
"instanceof",
"HTMLPurifier_Config",
")",
")",
"{",
"$",
"lexer",
"=",
"$",
"config",
";",
"trigger_error",
"(",
"\"Passing a prototype to\n ... | Retrieves or sets the default Lexer as a Prototype Factory.
By default HTMLPurifier_Lexer_DOMLex will be returned. There are
a few exceptions involving special features that only DirectLex
implements.
@note The behavior of this class has changed, rather than accepting
a prototype object, it now accepts a configuratio... | [
"Retrieves",
"or",
"sets",
"the",
"default",
"Lexer",
"as",
"a",
"Prototype",
"Factory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Lexer.php#L69-L148 |
218,677 | moodle/moodle | lib/spout/src/Spout/Writer/WriterFactory.php | WriterFactory.create | public static function create($writerType)
{
$writer = null;
switch ($writerType) {
case Type::CSV:
$writer = new CSV\Writer();
break;
case Type::XLSX:
$writer = new XLSX\Writer();
break;
case Type::... | php | public static function create($writerType)
{
$writer = null;
switch ($writerType) {
case Type::CSV:
$writer = new CSV\Writer();
break;
case Type::XLSX:
$writer = new XLSX\Writer();
break;
case Type::... | [
"public",
"static",
"function",
"create",
"(",
"$",
"writerType",
")",
"{",
"$",
"writer",
"=",
"null",
";",
"switch",
"(",
"$",
"writerType",
")",
"{",
"case",
"Type",
"::",
"CSV",
":",
"$",
"writer",
"=",
"new",
"CSV",
"\\",
"Writer",
"(",
")",
"... | This creates an instance of the appropriate writer, given the type of the file to be read
@api
@param string $writerType Type of the writer to instantiate
@return WriterInterface
@throws \Box\Spout\Common\Exception\UnsupportedTypeException | [
"This",
"creates",
"an",
"instance",
"of",
"the",
"appropriate",
"writer",
"given",
"the",
"type",
"of",
"the",
"file",
"to",
"be",
"read"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/WriterFactory.php#L26-L47 |
218,678 | moodle/moodle | competency/classes/external.php | external.create_competency_framework | public static function create_competency_framework($competencyframework) {
global $PAGE;
$params = self::validate_parameters(self::create_competency_framework_parameters(), array(
'competencyframework' => $competencyframework
));
$params = $params['competencyframework'];
... | php | public static function create_competency_framework($competencyframework) {
global $PAGE;
$params = self::validate_parameters(self::create_competency_framework_parameters(), array(
'competencyframework' => $competencyframework
));
$params = $params['competencyframework'];
... | [
"public",
"static",
"function",
"create_competency_framework",
"(",
"$",
"competencyframework",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"create_competency_framework_parameters",
"(",
")",
",",... | Create a new competency framework
@param array $competencyframework A single param with all the fields for a competency framework.
@return \stdClass The new record | [
"Create",
"a",
"new",
"competency",
"framework"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L116-L137 |
218,679 | moodle/moodle | competency/classes/external.php | external.read_competency_framework | public static function read_competency_framework($id) {
global $PAGE;
$params = self::validate_parameters(self::read_competency_framework_parameters(), array(
'id' => $id,
));
$framework = api::read_framework($params['id']);
self::validate_context($framework->get_co... | php | public static function read_competency_framework($id) {
global $PAGE;
$params = self::validate_parameters(self::read_competency_framework_parameters(), array(
'id' => $id,
));
$framework = api::read_framework($params['id']);
self::validate_context($framework->get_co... | [
"public",
"static",
"function",
"read_competency_framework",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"read_competency_framework_parameters",
"(",
")",
",",
"array",
"(",
... | Read a competency framework by id.
@param int $id The id of the framework.
@return \stdClass | [
"Read",
"a",
"competency",
"framework",
"by",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L172-L185 |
218,680 | moodle/moodle | competency/classes/external.php | external.competency_viewed | public static function competency_viewed($id) {
$params = self::validate_parameters(self::competency_viewed_parameters(), array(
'id' => $id
));
return api::competency_viewed($params['id']);
} | php | public static function competency_viewed($id) {
$params = self::validate_parameters(self::competency_viewed_parameters(), array(
'id' => $id
));
return api::competency_viewed($params['id']);
} | [
"public",
"static",
"function",
"competency_viewed",
"(",
"$",
"id",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"competency_viewed_parameters",
"(",
")",
",",
"array",
"(",
"'id'",
"=>",
"$",
"id",
")",
")",
";",
... | Log event competency viewed.
@param int $id The competency ID.
@return boolean | [
"Log",
"event",
"competency",
"viewed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L219-L224 |
218,681 | moodle/moodle | competency/classes/external.php | external.duplicate_competency_framework | public static function duplicate_competency_framework($id) {
global $PAGE;
$params = self::validate_parameters(self::duplicate_competency_framework_parameters(), array(
'id' => $id,
));
$framework = api::read_framework($params['id']);
self::validate_context($framewor... | php | public static function duplicate_competency_framework($id) {
global $PAGE;
$params = self::validate_parameters(self::duplicate_competency_framework_parameters(), array(
'id' => $id,
));
$framework = api::read_framework($params['id']);
self::validate_context($framewor... | [
"public",
"static",
"function",
"duplicate_competency_framework",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"duplicate_competency_framework_parameters",
"(",
")",
",",
"array",... | Duplicate a competency framework
@param int $id The competency framework id
@return boolean | [
"Duplicate",
"a",
"competency",
"framework"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L259-L273 |
218,682 | moodle/moodle | competency/classes/external.php | external.delete_competency_framework | public static function delete_competency_framework($id) {
$params = self::validate_parameters(self::delete_competency_framework_parameters(), array(
'id' => $id,
));
$framework = api::read_framework($params['id']);
self::validate_context($framework->get_context());
... | php | public static function delete_competency_framework($id) {
$params = self::validate_parameters(self::delete_competency_framework_parameters(), array(
'id' => $id,
));
$framework = api::read_framework($params['id']);
self::validate_context($framework->get_context());
... | [
"public",
"static",
"function",
"delete_competency_framework",
"(",
"$",
"id",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"delete_competency_framework_parameters",
"(",
")",
",",
"array",
"(",
"'id'",
"=>",
"$",
"id",
... | Delete a competency framework
@param int $id The competency framework id
@return boolean | [
"Delete",
"a",
"competency",
"framework"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L308-L317 |
218,683 | moodle/moodle | competency/classes/external.php | external.update_competency_framework | public static function update_competency_framework($competencyframework) {
$params = self::validate_parameters(self::update_competency_framework_parameters(), array(
'competencyframework' => $competencyframework
));
$params = $params['competencyframework'];
$framework = api... | php | public static function update_competency_framework($competencyframework) {
$params = self::validate_parameters(self::update_competency_framework_parameters(), array(
'competencyframework' => $competencyframework
));
$params = $params['competencyframework'];
$framework = api... | [
"public",
"static",
"function",
"update_competency_framework",
"(",
"$",
"competencyframework",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"update_competency_framework_parameters",
"(",
")",
",",
"array",
"(",
"'competencyfra... | Update an existing competency framework
@param array $competencyframework An array with all the fields for a competency framework.
@return boolean | [
"Update",
"an",
"existing",
"competency",
"framework"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L345-L358 |
218,684 | moodle/moodle | competency/classes/external.php | external.count_competency_frameworks | public static function count_competency_frameworks($context, $includes) {
$params = self::validate_parameters(self::count_competency_frameworks_parameters(), array(
'context' => $context,
'includes' => $includes
));
$context = self::get_context_from_params($params['conte... | php | public static function count_competency_frameworks($context, $includes) {
$params = self::validate_parameters(self::count_competency_frameworks_parameters(), array(
'context' => $context,
'includes' => $includes
));
$context = self::get_context_from_params($params['conte... | [
"public",
"static",
"function",
"count_competency_frameworks",
"(",
"$",
"context",
",",
"$",
"includes",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"count_competency_frameworks_parameters",
"(",
")",
",",
"array",
"(",
... | Count the existing competency frameworks
@param array $context
@param string $includes
@return int | [
"Count",
"the",
"existing",
"competency",
"frameworks"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L523-L533 |
218,685 | moodle/moodle | competency/classes/external.php | external.competency_framework_viewed | public static function competency_framework_viewed($id) {
$params = self::validate_parameters(self::competency_framework_viewed_parameters(), array(
'id' => $id
));
return api::competency_framework_viewed($params['id']);
} | php | public static function competency_framework_viewed($id) {
$params = self::validate_parameters(self::competency_framework_viewed_parameters(), array(
'id' => $id
));
return api::competency_framework_viewed($params['id']);
} | [
"public",
"static",
"function",
"competency_framework_viewed",
"(",
"$",
"id",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"competency_framework_viewed_parameters",
"(",
")",
",",
"array",
"(",
"'id'",
"=>",
"$",
"id",
... | Log event competency framework viewed.
@param int $id The competency framework ID.
@return boolean | [
"Log",
"event",
"competency",
"framework",
"viewed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L568-L574 |
218,686 | moodle/moodle | competency/classes/external.php | external.create_competency | public static function create_competency($competency) {
global $PAGE;
$params = self::validate_parameters(self::create_competency_parameters(), array(
'competency' => $competency
));
$params = $params['competency'];
$framework = api::read_framework($params['competen... | php | public static function create_competency($competency) {
global $PAGE;
$params = self::validate_parameters(self::create_competency_parameters(), array(
'competency' => $competency
));
$params = $params['competency'];
$framework = api::read_framework($params['competen... | [
"public",
"static",
"function",
"create_competency",
"(",
"$",
"competency",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"create_competency_parameters",
"(",
")",
",",
"array",
"(",
"'compet... | Create a new competency
@param array $competency All the fields for a competency record (including id)
@return array the competency | [
"Create",
"a",
"new",
"competency"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L602-L620 |
218,687 | moodle/moodle | competency/classes/external.php | external.read_competency | public static function read_competency($id) {
global $PAGE;
$params = self::validate_parameters(self::read_competency_parameters(), array(
'id' => $id,
));
$competency = api::read_competency($params['id']);
$context = $competency->get_context();
self::valida... | php | public static function read_competency($id) {
global $PAGE;
$params = self::validate_parameters(self::read_competency_parameters(), array(
'id' => $id,
));
$competency = api::read_competency($params['id']);
$context = $competency->get_context();
self::valida... | [
"public",
"static",
"function",
"read_competency",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"read_competency_parameters",
"(",
")",
",",
"array",
"(",
"'id'",
"=>",
"$... | Read a competency by id.
@param int $id The id of the competency
@return \stdClass | [
"Read",
"a",
"competency",
"by",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L655-L669 |
218,688 | moodle/moodle | competency/classes/external.php | external.delete_competency | public static function delete_competency($id) {
$params = self::validate_parameters(self::delete_competency_parameters(), array(
'id' => $id,
));
$competency = api::read_competency($params['id']);
$context = $competency->get_context();
self::validate_context($context... | php | public static function delete_competency($id) {
$params = self::validate_parameters(self::delete_competency_parameters(), array(
'id' => $id,
));
$competency = api::read_competency($params['id']);
$context = $competency->get_context();
self::validate_context($context... | [
"public",
"static",
"function",
"delete_competency",
"(",
"$",
"id",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"delete_competency_parameters",
"(",
")",
",",
"array",
"(",
"'id'",
"=>",
"$",
"id",
",",
")",
")",
... | Delete a competency
@param int $id The competency id
@return boolean | [
"Delete",
"a",
"competency"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L704-L714 |
218,689 | moodle/moodle | competency/classes/external.php | external.update_competency | public static function update_competency($competency) {
$params = self::validate_parameters(self::update_competency_parameters(), array(
'competency' => $competency
));
$params = $params['competency'];
$competency = api::read_competency($params['id']);
self::validate... | php | public static function update_competency($competency) {
$params = self::validate_parameters(self::update_competency_parameters(), array(
'competency' => $competency
));
$params = $params['competency'];
$competency = api::read_competency($params['id']);
self::validate... | [
"public",
"static",
"function",
"update_competency",
"(",
"$",
"competency",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"update_competency_parameters",
"(",
")",
",",
"array",
"(",
"'competency'",
"=>",
"$",
"competency... | Update an existing competency
@param array $competency The array of competency fields (id is required).
@return boolean | [
"Update",
"an",
"existing",
"competency"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L742-L754 |
218,690 | moodle/moodle | competency/classes/external.php | external.list_competencies | public static function list_competencies($filters, $sort, $order, $skip, $limit) {
global $PAGE;
$params = self::validate_parameters(self::list_competencies_parameters(), array(
'filters' => $filters,
'sort' => $sort,
'order' => $order,
'skip' => $skip,
... | php | public static function list_competencies($filters, $sort, $order, $skip, $limit) {
global $PAGE;
$params = self::validate_parameters(self::list_competencies_parameters(), array(
'filters' => $filters,
'sort' => $sort,
'order' => $order,
'skip' => $skip,
... | [
"public",
"static",
"function",
"list_competencies",
"(",
"$",
"filters",
",",
"$",
"sort",
",",
"$",
"order",
",",
"$",
"skip",
",",
"$",
"limit",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"sel... | List the existing competency.
@param string $filters
@param int $sort
@param string $order
@param string $skip
@param int $limit
@return array
@throws \required_capability_exception
@throws invalid_parameter_exception | [
"List",
"the",
"existing",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L825-L876 |
218,691 | moodle/moodle | competency/classes/external.php | external.count_competencies | public static function count_competencies($filters) {
$params = self::validate_parameters(self::count_competencies_parameters(), array(
'filters' => $filters
));
$safefilters = array();
$validcolumns = array('id', 'shortname', 'description', 'sortorder', 'idnumber', 'parenti... | php | public static function count_competencies($filters) {
$params = self::validate_parameters(self::count_competencies_parameters(), array(
'filters' => $filters
));
$safefilters = array();
$validcolumns = array('id', 'shortname', 'description', 'sortorder', 'idnumber', 'parenti... | [
"public",
"static",
"function",
"count_competencies",
"(",
"$",
"filters",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"count_competencies_parameters",
"(",
")",
",",
"array",
"(",
"'filters'",
"=>",
"$",
"filters",
")... | Count the existing competency frameworks.
@param string $filters Filters to use.
@return boolean | [
"Count",
"the",
"existing",
"competency",
"frameworks",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L978-L1003 |
218,692 | moodle/moodle | competency/classes/external.php | external.set_parent_competency | public static function set_parent_competency($competencyid, $parentid) {
$params = self::validate_parameters(self::set_parent_competency_parameters(), array(
'competencyid' => $competencyid,
'parentid' => $parentid
));
$competency = api::read_competency($params['competen... | php | public static function set_parent_competency($competencyid, $parentid) {
$params = self::validate_parameters(self::set_parent_competency_parameters(), array(
'competencyid' => $competencyid,
'parentid' => $parentid
));
$competency = api::read_competency($params['competen... | [
"public",
"static",
"function",
"set_parent_competency",
"(",
"$",
"competencyid",
",",
"$",
"parentid",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"set_parent_competency_parameters",
"(",
")",
",",
"array",
"(",
"'comp... | Move the competency to a new parent.
@param int $competencyid Competency id.
@param int $parentid Parent id.
@return bool | [
"Move",
"the",
"competency",
"to",
"a",
"new",
"parent",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L1045-L1055 |
218,693 | moodle/moodle | competency/classes/external.php | external.reorder_course_competency | public static function reorder_course_competency($courseid, $competencyidfrom, $competencyidto) {
$params = self::validate_parameters(self::reorder_course_competency_parameters(), array(
'courseid' => $courseid,
'competencyidfrom' => $competencyidfrom,
'competencyidto' => $co... | php | public static function reorder_course_competency($courseid, $competencyidfrom, $competencyidto) {
$params = self::validate_parameters(self::reorder_course_competency_parameters(), array(
'courseid' => $courseid,
'competencyidfrom' => $competencyidfrom,
'competencyidto' => $co... | [
"public",
"static",
"function",
"reorder_course_competency",
"(",
"$",
"courseid",
",",
"$",
"competencyidfrom",
",",
"$",
"competencyidto",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"reorder_course_competency_parameters",
... | Change the order of course competencies.
@param int $courseid The course id
@param int $competencyidfrom The competency to move.
@param int $competencyidto The competency to move to.
@return bool | [
"Change",
"the",
"order",
"of",
"course",
"competencies",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L1505-L1513 |
218,694 | moodle/moodle | competency/classes/external.php | external.reorder_template_competency | public static function reorder_template_competency($templateid, $competencyidfrom, $competencyidto) {
$params = self::validate_parameters(self::reorder_template_competency_parameters(), array(
'templateid' => $templateid,
'competencyidfrom' => $competencyidfrom,
'competencyid... | php | public static function reorder_template_competency($templateid, $competencyidfrom, $competencyidto) {
$params = self::validate_parameters(self::reorder_template_competency_parameters(), array(
'templateid' => $templateid,
'competencyidfrom' => $competencyidfrom,
'competencyid... | [
"public",
"static",
"function",
"reorder_template_competency",
"(",
"$",
"templateid",
",",
"$",
"competencyidfrom",
",",
"$",
"competencyidto",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"reorder_template_competency_paramete... | Change the order of template competencies.
@param int $templateid The template id
@param int $competencyidfrom The competency to move.
@param int $competencyidto The competency to move to.
@return bool | [
"Change",
"the",
"order",
"of",
"template",
"competencies",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L1561-L1572 |
218,695 | moodle/moodle | competency/classes/external.php | external.create_template | public static function create_template($template) {
global $PAGE;
$params = self::validate_parameters(self::create_template_parameters(), array('template' => $template));
$params = $params['template'];
$context = self::get_context_from_params($params);
self::validate_context($co... | php | public static function create_template($template) {
global $PAGE;
$params = self::validate_parameters(self::create_template_parameters(), array('template' => $template));
$params = $params['template'];
$context = self::get_context_from_params($params);
self::validate_context($co... | [
"public",
"static",
"function",
"create_template",
"(",
"$",
"template",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"create_template_parameters",
"(",
")",
",",
"array",
"(",
"'template'",
... | Create a new learning plan template
@param array $template The list of fields for the template.
@return \stdClass Record of new template. | [
"Create",
"a",
"new",
"learning",
"plan",
"template"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L1600-L1618 |
218,696 | moodle/moodle | competency/classes/external.php | external.read_template | public static function read_template($id) {
global $PAGE;
$params = self::validate_parameters(self::read_template_parameters(), array('id' => $id));
$template = api::read_template($params['id']);
self::validate_context($template->get_context());
$output = $PAGE->get_renderer('co... | php | public static function read_template($id) {
global $PAGE;
$params = self::validate_parameters(self::read_template_parameters(), array('id' => $id));
$template = api::read_template($params['id']);
self::validate_context($template->get_context());
$output = $PAGE->get_renderer('co... | [
"public",
"static",
"function",
"read_template",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"read_template_parameters",
"(",
")",
",",
"array",
"(",
"'id'",
"=>",
"$",
... | Read a learning plan template by id.
@param int $id The id of the template.
@return \stdClass | [
"Read",
"a",
"learning",
"plan",
"template",
"by",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L1653-L1664 |
218,697 | moodle/moodle | competency/classes/external.php | external.delete_template | public static function delete_template($id, $deleteplans = true) {
$params = self::validate_parameters(self::delete_template_parameters(), array(
'id' => $id,
'deleteplans' => $deleteplans,
));
$template = api::read_template($params['id']);
self::validate_context... | php | public static function delete_template($id, $deleteplans = true) {
$params = self::validate_parameters(self::delete_template_parameters(), array(
'id' => $id,
'deleteplans' => $deleteplans,
));
$template = api::read_template($params['id']);
self::validate_context... | [
"public",
"static",
"function",
"delete_template",
"(",
"$",
"id",
",",
"$",
"deleteplans",
"=",
"true",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"delete_template_parameters",
"(",
")",
",",
"array",
"(",
"'id'",
... | Delete a learning plan template
@param int $id The learning plan template id
@param boolean $deleteplans True to delete the plans associated to template or false to unlink them
@return boolean | [
"Delete",
"a",
"learning",
"plan",
"template"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L1707-L1717 |
218,698 | moodle/moodle | competency/classes/external.php | external.update_template | public static function update_template($template) {
$params = self::validate_parameters(self::update_template_parameters(), array('template' => $template));
$params = $params['template'];
$template = api::read_template($params['id']);
self::validate_context($template->get_context());
... | php | public static function update_template($template) {
$params = self::validate_parameters(self::update_template_parameters(), array('template' => $template));
$params = $params['template'];
$template = api::read_template($params['id']);
self::validate_context($template->get_context());
... | [
"public",
"static",
"function",
"update_template",
"(",
"$",
"template",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"update_template_parameters",
"(",
")",
",",
"array",
"(",
"'template'",
"=>",
"$",
"template",
")",
... | Update an existing learning plan template
@param array $template The list of fields for the template.
@return boolean | [
"Update",
"an",
"existing",
"learning",
"plan",
"template"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L1745-L1755 |
218,699 | moodle/moodle | competency/classes/external.php | external.list_templates | public static function list_templates($sort, $order, $skip, $limit, $context, $includes, $onlyvisible) {
global $PAGE;
$params = self::validate_parameters(self::list_templates_parameters(), array(
'sort' => $sort,
'order' => $order,
'skip' => $skip,
'limi... | php | public static function list_templates($sort, $order, $skip, $limit, $context, $includes, $onlyvisible) {
global $PAGE;
$params = self::validate_parameters(self::list_templates_parameters(), array(
'sort' => $sort,
'order' => $order,
'skip' => $skip,
'limi... | [
"public",
"static",
"function",
"list_templates",
"(",
"$",
"sort",
",",
"$",
"order",
",",
"$",
"skip",
",",
"$",
"limit",
",",
"$",
"context",
",",
"$",
"includes",
",",
"$",
"onlyvisible",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
... | List the existing learning plan templates
@param string $sort Field to sort by.
@param string $order Sort order.
@param int $skip Limitstart.
@param int $limit Number of rows to return.
@param array $context
@param bool $includes
@param bool $onlyvisible
@return array | [
"List",
"the",
"existing",
"learning",
"plan",
"templates"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external.php#L1881-L1916 |
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.