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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
213,800 | moodle/moodle | lib/dml/oci_native_moodle_database.php | oci_native_moodle_database.get_limit_sql | private function get_limit_sql($sql, array $params = null, $limitfrom=0, $limitnum=0) {
list($limitfrom, $limitnum) = $this->normalise_limit_from_num($limitfrom, $limitnum);
// TODO: Add the /*+ FIRST_ROWS */ hint if there isn't another hint
if ($limitfrom and $limitnum) {
$sql = "... | php | private function get_limit_sql($sql, array $params = null, $limitfrom=0, $limitnum=0) {
list($limitfrom, $limitnum) = $this->normalise_limit_from_num($limitfrom, $limitnum);
// TODO: Add the /*+ FIRST_ROWS */ hint if there isn't another hint
if ($limitfrom and $limitnum) {
$sql = "... | [
"private",
"function",
"get_limit_sql",
"(",
"$",
"sql",
",",
"array",
"$",
"params",
"=",
"null",
",",
"$",
"limitfrom",
"=",
"0",
",",
"$",
"limitnum",
"=",
"0",
")",
"{",
"list",
"(",
"$",
"limitfrom",
",",
"$",
"limitnum",
")",
"=",
"$",
"this"... | Transforms the sql and params in order to emulate the LIMIT clause available in other DBs
@param string $sql the SQL select query to execute.
@param array $params array of sql parameters
@param int $limitfrom return a subset of records, starting at this point (optional, required if $limitnum is set).
@param int $limit... | [
"Transforms",
"the",
"sql",
"and",
"params",
"in",
"order",
"to",
"emulate",
"the",
"LIMIT",
"clause",
"available",
"in",
"other",
"DBs"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/oci_native_moodle_database.php#L727-L758 |
213,801 | moodle/moodle | lib/dml/oci_native_moodle_database.php | oci_native_moodle_database.insert_record | public function insert_record($table, $dataobject, $returnid=true, $bulk=false) {
$dataobject = (array)$dataobject;
$columns = $this->get_columns($table);
if (empty($columns)) {
throw new dml_exception('ddltablenotexist', $table);
}
$cleaned = array();
fore... | php | public function insert_record($table, $dataobject, $returnid=true, $bulk=false) {
$dataobject = (array)$dataobject;
$columns = $this->get_columns($table);
if (empty($columns)) {
throw new dml_exception('ddltablenotexist', $table);
}
$cleaned = array();
fore... | [
"public",
"function",
"insert_record",
"(",
"$",
"table",
",",
"$",
"dataobject",
",",
"$",
"returnid",
"=",
"true",
",",
"$",
"bulk",
"=",
"false",
")",
"{",
"$",
"dataobject",
"=",
"(",
"array",
")",
"$",
"dataobject",
";",
"$",
"columns",
"=",
"$"... | Insert a record into a table and return the "id" field if required.
Some conversions and safety checks are carried out. Lobs are supported.
If the return ID isn't required, then this just reports success as true/false.
$data is an object containing needed data
@param string $table The database table to be inserted int... | [
"Insert",
"a",
"record",
"into",
"a",
"table",
"and",
"return",
"the",
"id",
"field",
"if",
"required",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/oci_native_moodle_database.php#L1315-L1337 |
213,802 | moodle/moodle | lib/dml/oci_native_moodle_database.php | oci_native_moodle_database.recursive_concat | protected function recursive_concat(array $args) {
$count = count($args);
if ($count == 1) {
$arg = reset($args);
return $arg;
}
if ($count == 2) {
$args[] = "' '";
// No return here intentionally.
}
$first = array_shift($ar... | php | protected function recursive_concat(array $args) {
$count = count($args);
if ($count == 1) {
$arg = reset($args);
return $arg;
}
if ($count == 2) {
$args[] = "' '";
// No return here intentionally.
}
$first = array_shift($ar... | [
"protected",
"function",
"recursive_concat",
"(",
"array",
"$",
"args",
")",
"{",
"$",
"count",
"=",
"count",
"(",
"$",
"args",
")",
";",
"if",
"(",
"$",
"count",
"==",
"1",
")",
"{",
"$",
"arg",
"=",
"reset",
"(",
"$",
"args",
")",
";",
"return"... | Mega hacky magic to work around crazy Oracle NULL concats.
@param array $args
@return string | [
"Mega",
"hacky",
"magic",
"to",
"work",
"around",
"crazy",
"Oracle",
"NULL",
"concats",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/oci_native_moodle_database.php#L1712-L1726 |
213,803 | moodle/moodle | lib/dml/oci_native_moodle_database.php | oci_native_moodle_database.oci_package_installed | protected function oci_package_installed() {
$sql = "SELECT 1
FROM user_objects
WHERE object_type = 'PACKAGE BODY'
AND object_name = 'MOODLELIB'
AND status = 'VALID'";
$this->query_start($sql, null, SQL_QUERY_AUX);
$stmt = $this... | php | protected function oci_package_installed() {
$sql = "SELECT 1
FROM user_objects
WHERE object_type = 'PACKAGE BODY'
AND object_name = 'MOODLELIB'
AND status = 'VALID'";
$this->query_start($sql, null, SQL_QUERY_AUX);
$stmt = $this... | [
"protected",
"function",
"oci_package_installed",
"(",
")",
"{",
"$",
"sql",
"=",
"\"SELECT 1\n FROM user_objects\n WHERE object_type = 'PACKAGE BODY'\n AND object_name = 'MOODLELIB'\n AND status = 'VALID'\"",
";",
"$",
"this",
... | Is the required OCI server package installed?
@return bool | [
"Is",
"the",
"required",
"OCI",
"server",
"package",
"installed?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/oci_native_moodle_database.php#L1762-L1776 |
213,804 | moodle/moodle | lib/dml/oci_native_moodle_database.php | oci_native_moodle_database.attempt_oci_package_install | protected function attempt_oci_package_install() {
$sqls = file_get_contents(__DIR__.'/oci_native_moodle_package.sql');
$sqls = preg_split('/^\/$/sm', $sqls);
foreach ($sqls as $sql) {
$sql = trim($sql);
if ($sql === '' or $sql === 'SHOW ERRORS') {
continu... | php | protected function attempt_oci_package_install() {
$sqls = file_get_contents(__DIR__.'/oci_native_moodle_package.sql');
$sqls = preg_split('/^\/$/sm', $sqls);
foreach ($sqls as $sql) {
$sql = trim($sql);
if ($sql === '' or $sql === 'SHOW ERRORS') {
continu... | [
"protected",
"function",
"attempt_oci_package_install",
"(",
")",
"{",
"$",
"sqls",
"=",
"file_get_contents",
"(",
"__DIR__",
".",
"'/oci_native_moodle_package.sql'",
")",
";",
"$",
"sqls",
"=",
"preg_split",
"(",
"'/^\\/$/sm'",
",",
"$",
"sqls",
")",
";",
"fore... | Try to add required moodle package into oracle server. | [
"Try",
"to",
"add",
"required",
"moodle",
"package",
"into",
"oracle",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/oci_native_moodle_database.php#L1781-L1791 |
213,805 | moodle/moodle | mod/forum/classes/local/vaults/db_table_vault.php | db_table_vault.transform_db_records_to_entities | protected function transform_db_records_to_entities(array $records) {
$preprocessors = $this->get_preprocessors();
$result = array_map(function($record) {
return ['record' => $record];
}, $records);
$result = array_reduce(array_keys($preprocessors), function($carry, $preproc... | php | protected function transform_db_records_to_entities(array $records) {
$preprocessors = $this->get_preprocessors();
$result = array_map(function($record) {
return ['record' => $record];
}, $records);
$result = array_reduce(array_keys($preprocessors), function($carry, $preproc... | [
"protected",
"function",
"transform_db_records_to_entities",
"(",
"array",
"$",
"records",
")",
"{",
"$",
"preprocessors",
"=",
"$",
"this",
"->",
"get_preprocessors",
"(",
")",
";",
"$",
"result",
"=",
"array_map",
"(",
"function",
"(",
"$",
"record",
")",
... | Execute the defined preprocessors on the DB record results and then convert
them into entities.
@param stdClass[] $records List of DB results
@return array | [
"Execute",
"the",
"defined",
"preprocessors",
"on",
"the",
"DB",
"record",
"results",
"and",
"then",
"convert",
"them",
"into",
"entities",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/db_table_vault.php#L142-L161 |
213,806 | moodle/moodle | mod/forum/classes/local/vaults/db_table_vault.php | db_table_vault.get_from_id | public function get_from_id(int $id) {
$records = $this->get_from_ids([$id]);
return count($records) ? array_shift($records) : null;
} | php | public function get_from_id(int $id) {
$records = $this->get_from_ids([$id]);
return count($records) ? array_shift($records) : null;
} | [
"public",
"function",
"get_from_id",
"(",
"int",
"$",
"id",
")",
"{",
"$",
"records",
"=",
"$",
"this",
"->",
"get_from_ids",
"(",
"[",
"$",
"id",
"]",
")",
";",
"return",
"count",
"(",
"$",
"records",
")",
"?",
"array_shift",
"(",
"$",
"records",
... | Get the entity for the given id.
@param int $id Identifier for the entity
@return object|null | [
"Get",
"the",
"entity",
"for",
"the",
"given",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/db_table_vault.php#L169-L172 |
213,807 | moodle/moodle | mod/forum/classes/local/vaults/db_table_vault.php | db_table_vault.get_from_ids | public function get_from_ids(array $ids) {
$alias = $this->get_table_alias();
list($insql, $params) = $this->get_db()->get_in_or_equal($ids);
$wheresql = $alias . '.id ' . $insql;
$sql = $this->generate_get_records_sql($wheresql);
$records = $this->get_db()->get_records_sql($sql,... | php | public function get_from_ids(array $ids) {
$alias = $this->get_table_alias();
list($insql, $params) = $this->get_db()->get_in_or_equal($ids);
$wheresql = $alias . '.id ' . $insql;
$sql = $this->generate_get_records_sql($wheresql);
$records = $this->get_db()->get_records_sql($sql,... | [
"public",
"function",
"get_from_ids",
"(",
"array",
"$",
"ids",
")",
"{",
"$",
"alias",
"=",
"$",
"this",
"->",
"get_table_alias",
"(",
")",
";",
"list",
"(",
"$",
"insql",
",",
"$",
"params",
")",
"=",
"$",
"this",
"->",
"get_db",
"(",
")",
"->",
... | Get the list of entities for the given ids.
@param int[] $ids Identifiers
@return array | [
"Get",
"the",
"list",
"of",
"entities",
"for",
"the",
"given",
"ids",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/db_table_vault.php#L180-L188 |
213,808 | moodle/moodle | lib/classes/component.php | core_component.classloader | public static function classloader($classname) {
self::init();
if (isset(self::$classmap[$classname])) {
// Global $CFG is expected in included scripts.
global $CFG;
// Function include would be faster, but for BC it is better to include only once.
includ... | php | public static function classloader($classname) {
self::init();
if (isset(self::$classmap[$classname])) {
// Global $CFG is expected in included scripts.
global $CFG;
// Function include would be faster, but for BC it is better to include only once.
includ... | [
"public",
"static",
"function",
"classloader",
"(",
"$",
"classname",
")",
"{",
"self",
"::",
"init",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"classmap",
"[",
"$",
"classname",
"]",
")",
")",
"{",
"// Global $CFG is expected in included ... | Class loader for Frankenstyle named classes in standard locations.
Frankenstyle namespaces are supported.
The expected location for core classes is:
1/ core_xx_yy_zz ---> lib/classes/xx_yy_zz.php
2/ \core\xx_yy_zz ---> lib/classes/xx_yy_zz.php
3/ \core\xx\yy_zz ---> lib/classes/xx/yy_zz.php
The expected location for ... | [
"Class",
"loader",
"for",
"Frankenstyle",
"named",
"classes",
"in",
"standard",
"locations",
".",
"Frankenstyle",
"namespaces",
"are",
"supported",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L108-L135 |
213,809 | moodle/moodle | lib/classes/component.php | core_component.psr_classloader | protected static function psr_classloader($class) {
// Iterate through each PSR-4 namespace prefix.
foreach (self::$psr4namespaces as $prefix => $path) {
$file = self::get_class_file($class, $prefix, $path, array('\\'));
if (!empty($file) && file_exists($file)) {
... | php | protected static function psr_classloader($class) {
// Iterate through each PSR-4 namespace prefix.
foreach (self::$psr4namespaces as $prefix => $path) {
$file = self::get_class_file($class, $prefix, $path, array('\\'));
if (!empty($file) && file_exists($file)) {
... | [
"protected",
"static",
"function",
"psr_classloader",
"(",
"$",
"class",
")",
"{",
"// Iterate through each PSR-4 namespace prefix.",
"foreach",
"(",
"self",
"::",
"$",
"psr4namespaces",
"as",
"$",
"prefix",
"=>",
"$",
"path",
")",
"{",
"$",
"file",
"=",
"self",... | Return the path to a class from our defined PSR-0 or PSR-4 standard namespaces on
demand. Only returns paths to files that exist.
Adapated from http://www.php-fig.org/psr/psr-4/examples/ and made PSR-0
compatible.
@param string $class the name of the class.
@return string|bool The full path to the file defining the c... | [
"Return",
"the",
"path",
"to",
"a",
"class",
"from",
"our",
"defined",
"PSR",
"-",
"0",
"or",
"PSR",
"-",
"4",
"standard",
"namespaces",
"on",
"demand",
".",
"Only",
"returns",
"paths",
"to",
"files",
"that",
"exist",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L147-L165 |
213,810 | moodle/moodle | lib/classes/component.php | core_component.get_class_file | protected static function get_class_file($class, $prefix, $path, $separators) {
global $CFG;
// Does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
// No, move to the next prefix.
return false;
}
... | php | protected static function get_class_file($class, $prefix, $path, $separators) {
global $CFG;
// Does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
// No, move to the next prefix.
return false;
}
... | [
"protected",
"static",
"function",
"get_class_file",
"(",
"$",
"class",
",",
"$",
"prefix",
",",
"$",
"path",
",",
"$",
"separators",
")",
"{",
"global",
"$",
"CFG",
";",
"// Does the class use the namespace prefix?",
"$",
"len",
"=",
"strlen",
"(",
"$",
"pr... | Return the path to the class based on the given namespace prefix and path it corresponds to.
Will return the path even if the file does not exist. Check the file esists before requiring.
@param string $class the name of the class.
@param string $prefix The namespace prefix used to identify the base directory of the s... | [
"Return",
"the",
"path",
"to",
"the",
"class",
"based",
"on",
"the",
"given",
"namespace",
"prefix",
"and",
"path",
"it",
"corresponds",
"to",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L178-L198 |
213,811 | moodle/moodle | lib/classes/component.php | core_component.is_developer | protected static function is_developer() {
global $CFG;
// Note we can not rely on $CFG->debug here because DB is not initialised yet.
if (isset($CFG->config_php_settings['debug'])) {
$debug = (int)$CFG->config_php_settings['debug'];
} else {
return false;
... | php | protected static function is_developer() {
global $CFG;
// Note we can not rely on $CFG->debug here because DB is not initialised yet.
if (isset($CFG->config_php_settings['debug'])) {
$debug = (int)$CFG->config_php_settings['debug'];
} else {
return false;
... | [
"protected",
"static",
"function",
"is_developer",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// Note we can not rely on $CFG->debug here because DB is not initialised yet.",
"if",
"(",
"isset",
"(",
"$",
"CFG",
"->",
"config_php_settings",
"[",
"'debug'",
"]",
")",
"... | Are we in developer debug mode?
Note: You need to set "$CFG->debug = (E_ALL | E_STRICT);" in config.php,
the reason is we need to use this before we setup DB connection or caches for CFG.
@return bool | [
"Are",
"we",
"in",
"developer",
"debug",
"mode?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L328-L343 |
213,812 | moodle/moodle | lib/classes/component.php | core_component.get_cache_content | public static function get_cache_content() {
if (!isset(self::$plugintypes)) {
self::fill_all_caches();
}
$cache = array(
'subsystems' => self::$subsystems,
'plugintypes' => self::$plugintypes,
'plugins' => self::$plugins,
... | php | public static function get_cache_content() {
if (!isset(self::$plugintypes)) {
self::fill_all_caches();
}
$cache = array(
'subsystems' => self::$subsystems,
'plugintypes' => self::$plugintypes,
'plugins' => self::$plugins,
... | [
"public",
"static",
"function",
"get_cache_content",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"plugintypes",
")",
")",
"{",
"self",
"::",
"fill_all_caches",
"(",
")",
";",
"}",
"$",
"cache",
"=",
"array",
"(",
"'subsystems'",
"=>... | Create cache file content.
@private this is intended for $CFG->alternative_component_cache only.
@return string | [
"Create",
"cache",
"file",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L352-L372 |
213,813 | moodle/moodle | lib/classes/component.php | core_component.fill_all_caches | protected static function fill_all_caches() {
self::$subsystems = self::fetch_subsystems();
list(self::$plugintypes, self::$parents, self::$subplugins) = self::fetch_plugintypes();
self::$plugins = array();
foreach (self::$plugintypes as $type => $fulldir) {
self::$plugins[... | php | protected static function fill_all_caches() {
self::$subsystems = self::fetch_subsystems();
list(self::$plugintypes, self::$parents, self::$subplugins) = self::fetch_plugintypes();
self::$plugins = array();
foreach (self::$plugintypes as $type => $fulldir) {
self::$plugins[... | [
"protected",
"static",
"function",
"fill_all_caches",
"(",
")",
"{",
"self",
"::",
"$",
"subsystems",
"=",
"self",
"::",
"fetch_subsystems",
"(",
")",
";",
"list",
"(",
"self",
"::",
"$",
"plugintypes",
",",
"self",
"::",
"$",
"parents",
",",
"self",
"::... | Fill all caches. | [
"Fill",
"all",
"caches",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L377-L391 |
213,814 | moodle/moodle | lib/classes/component.php | core_component.fetch_core_version | protected static function fetch_core_version() {
global $CFG;
if (self::$version === null) {
$version = null; // Prevent IDE complaints.
require($CFG->dirroot . '/version.php');
self::$version = $version;
}
return self::$version;
} | php | protected static function fetch_core_version() {
global $CFG;
if (self::$version === null) {
$version = null; // Prevent IDE complaints.
require($CFG->dirroot . '/version.php');
self::$version = $version;
}
return self::$version;
} | [
"protected",
"static",
"function",
"fetch_core_version",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"self",
"::",
"$",
"version",
"===",
"null",
")",
"{",
"$",
"version",
"=",
"null",
";",
"// Prevent IDE complaints.",
"require",
"(",
"$",
"CFG",... | Get the core version.
In order for this to work properly, opcache should be reset beforehand.
@return float core version. | [
"Get",
"the",
"core",
"version",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L400-L408 |
213,815 | moodle/moodle | lib/classes/component.php | core_component.fetch_subtypes | protected static function fetch_subtypes($ownerdir) {
global $CFG;
$types = array();
if (file_exists("$ownerdir/db/subplugins.php")) {
$subplugins = array();
include("$ownerdir/db/subplugins.php");
foreach ($subplugins as $subtype => $dir) {
i... | php | protected static function fetch_subtypes($ownerdir) {
global $CFG;
$types = array();
if (file_exists("$ownerdir/db/subplugins.php")) {
$subplugins = array();
include("$ownerdir/db/subplugins.php");
foreach ($subplugins as $subtype => $dir) {
i... | [
"protected",
"static",
"function",
"fetch_subtypes",
"(",
"$",
"ownerdir",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"types",
"=",
"array",
"(",
")",
";",
"if",
"(",
"file_exists",
"(",
"\"$ownerdir/db/subplugins.php\"",
")",
")",
"{",
"$",
"subplugins",
"... | Returns list of subtypes.
@param string $ownerdir
@return array | [
"Returns",
"list",
"of",
"subtypes",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L603-L630 |
213,816 | moodle/moodle | lib/classes/component.php | core_component.fetch_plugins | protected static function fetch_plugins($plugintype, $fulldir) {
global $CFG;
$fulldirs = (array)$fulldir;
if ($plugintype === 'theme') {
if (realpath($fulldir) !== realpath($CFG->dirroot.'/theme')) {
// Include themes in standard location too.
array_... | php | protected static function fetch_plugins($plugintype, $fulldir) {
global $CFG;
$fulldirs = (array)$fulldir;
if ($plugintype === 'theme') {
if (realpath($fulldir) !== realpath($CFG->dirroot.'/theme')) {
// Include themes in standard location too.
array_... | [
"protected",
"static",
"function",
"fetch_plugins",
"(",
"$",
"plugintype",
",",
"$",
"fulldir",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"fulldirs",
"=",
"(",
"array",
")",
"$",
"fulldir",
";",
"if",
"(",
"$",
"plugintype",
"===",
"'theme'",
")",
"{"... | Returns list of plugins of given type in given directory.
@param string $plugintype
@param string $fulldir
@return array | [
"Returns",
"list",
"of",
"plugins",
"of",
"given",
"type",
"in",
"given",
"directory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L638-L678 |
213,817 | moodle/moodle | lib/classes/component.php | core_component.fill_classmap_cache | protected static function fill_classmap_cache() {
global $CFG;
self::$classmap = array();
self::load_classes('core', "$CFG->dirroot/lib/classes");
foreach (self::$subsystems as $subsystem => $fulldir) {
if (!$fulldir) {
continue;
}
s... | php | protected static function fill_classmap_cache() {
global $CFG;
self::$classmap = array();
self::load_classes('core', "$CFG->dirroot/lib/classes");
foreach (self::$subsystems as $subsystem => $fulldir) {
if (!$fulldir) {
continue;
}
s... | [
"protected",
"static",
"function",
"fill_classmap_cache",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"self",
"::",
"$",
"classmap",
"=",
"array",
"(",
")",
";",
"self",
"::",
"load_classes",
"(",
"'core'",
",",
"\"$CFG->dirroot/lib/classes\"",
")",
";",
"fore... | Find all classes that can be autoloaded including frankenstyle namespaces. | [
"Find",
"all",
"classes",
"that",
"can",
"be",
"autoloaded",
"including",
"frankenstyle",
"namespaces",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L683-L703 |
213,818 | moodle/moodle | lib/classes/component.php | core_component.fill_filemap_cache | protected static function fill_filemap_cache() {
global $CFG;
self::$filemap = array();
foreach (self::$filestomap as $file) {
if (!isset(self::$filemap[$file])) {
self::$filemap[$file] = array();
}
foreach (self::$plugins as $plugintype => $... | php | protected static function fill_filemap_cache() {
global $CFG;
self::$filemap = array();
foreach (self::$filestomap as $file) {
if (!isset(self::$filemap[$file])) {
self::$filemap[$file] = array();
}
foreach (self::$plugins as $plugintype => $... | [
"protected",
"static",
"function",
"fill_filemap_cache",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"self",
"::",
"$",
"filemap",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"filestomap",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"!"... | Fills up the cache defining what plugins have certain files.
@see self::get_plugin_list_with_file
@return void | [
"Fills",
"up",
"the",
"cache",
"defining",
"what",
"plugins",
"have",
"certain",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L711-L731 |
213,819 | moodle/moodle | lib/classes/component.php | core_component.load_classes | protected static function load_classes($component, $fulldir, $namespace = '') {
if (!is_dir($fulldir)) {
return;
}
if (!is_readable($fulldir)) {
// TODO: MDL-51711 We should generate some diagnostic debugging information in this case
// because its pretty lik... | php | protected static function load_classes($component, $fulldir, $namespace = '') {
if (!is_dir($fulldir)) {
return;
}
if (!is_readable($fulldir)) {
// TODO: MDL-51711 We should generate some diagnostic debugging information in this case
// because its pretty lik... | [
"protected",
"static",
"function",
"load_classes",
"(",
"$",
"component",
",",
"$",
"fulldir",
",",
"$",
"namespace",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"fulldir",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"is_readable"... | Find classes in directory and recurse to subdirs.
@param string $component
@param string $fulldir
@param string $namespace | [
"Find",
"classes",
"in",
"directory",
"and",
"recurse",
"to",
"subdirs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L739-L778 |
213,820 | moodle/moodle | lib/classes/component.php | core_component.get_plugin_list | public static function get_plugin_list($plugintype) {
self::init();
if (!isset(self::$plugins[$plugintype])) {
return array();
}
return self::$plugins[$plugintype];
} | php | public static function get_plugin_list($plugintype) {
self::init();
if (!isset(self::$plugins[$plugintype])) {
return array();
}
return self::$plugins[$plugintype];
} | [
"public",
"static",
"function",
"get_plugin_list",
"(",
"$",
"plugintype",
")",
"{",
"self",
"::",
"init",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"plugins",
"[",
"$",
"plugintype",
"]",
")",
")",
"{",
"return",
"array",
"(",
... | Get list of plugins of given type.
@param string $plugintype
@return array as (string)pluginname => (string)fulldir | [
"Get",
"list",
"of",
"plugins",
"of",
"given",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L816-L823 |
213,821 | moodle/moodle | lib/classes/component.php | core_component.get_plugin_list_with_class | public static function get_plugin_list_with_class($plugintype, $class, $file = null) {
global $CFG; // Necessary in case it is referenced by included PHP scripts.
if ($class) {
$suffix = '_' . $class;
} else {
$suffix = '';
}
$pluginclasses = array();
... | php | public static function get_plugin_list_with_class($plugintype, $class, $file = null) {
global $CFG; // Necessary in case it is referenced by included PHP scripts.
if ($class) {
$suffix = '_' . $class;
} else {
$suffix = '';
}
$pluginclasses = array();
... | [
"public",
"static",
"function",
"get_plugin_list_with_class",
"(",
"$",
"plugintype",
",",
"$",
"class",
",",
"$",
"file",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"// Necessary in case it is referenced by included PHP scripts.",
"if",
"(",
"$",
"class",
... | Get a list of all the plugins of a given type that define a certain class
in a certain file. The plugin component names and class names are returned.
@param string $plugintype the type of plugin, e.g. 'mod' or 'report'.
@param string $class the part of the name of the class after the
frankenstyle prefix. e.g 'thing' i... | [
"Get",
"a",
"list",
"of",
"all",
"the",
"plugins",
"of",
"a",
"given",
"type",
"that",
"define",
"a",
"certain",
"class",
"in",
"a",
"certain",
"file",
".",
"The",
"plugin",
"component",
"names",
"and",
"class",
"names",
"are",
"returned",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L839-L878 |
213,822 | moodle/moodle | lib/classes/component.php | core_component.get_plugin_list_with_file | public static function get_plugin_list_with_file($plugintype, $file, $include = false) {
global $CFG; // Necessary in case it is referenced by included PHP scripts.
$pluginfiles = array();
if (isset(self::$filemap[$file])) {
// If the file was supposed to be mapped, then it should h... | php | public static function get_plugin_list_with_file($plugintype, $file, $include = false) {
global $CFG; // Necessary in case it is referenced by included PHP scripts.
$pluginfiles = array();
if (isset(self::$filemap[$file])) {
// If the file was supposed to be mapped, then it should h... | [
"public",
"static",
"function",
"get_plugin_list_with_file",
"(",
"$",
"plugintype",
",",
"$",
"file",
",",
"$",
"include",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
";",
"// Necessary in case it is referenced by included PHP scripts.",
"$",
"pluginfiles",
"=",
... | Get a list of all the plugins of a given type that contain a particular file.
@param string $plugintype the type of plugin, e.g. 'mod' or 'report'.
@param string $file the name of file that must be present in the plugin.
(e.g. 'view.php', 'db/install.xml').
@param bool $include if true (default false), the file will b... | [
"Get",
"a",
"list",
"of",
"all",
"the",
"plugins",
"of",
"a",
"given",
"type",
"that",
"contain",
"a",
"particular",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L890-L917 |
213,823 | moodle/moodle | lib/classes/component.php | core_component.get_component_classes_in_namespace | public static function get_component_classes_in_namespace($component = null, $namespace = '') {
$classes = array();
// Only look for components if a component name is set or a namespace is set.
if (isset($component) || !empty($namespace)) {
// If a component parameter value is set... | php | public static function get_component_classes_in_namespace($component = null, $namespace = '') {
$classes = array();
// Only look for components if a component name is set or a namespace is set.
if (isset($component) || !empty($namespace)) {
// If a component parameter value is set... | [
"public",
"static",
"function",
"get_component_classes_in_namespace",
"(",
"$",
"component",
"=",
"null",
",",
"$",
"namespace",
"=",
"''",
")",
"{",
"$",
"classes",
"=",
"array",
"(",
")",
";",
"// Only look for components if a component name is set or a namespace is s... | Returns all classes in a component matching the provided namespace.
It checks that the class exists.
e.g. get_component_classes_in_namespace('mod_forum', 'event')
@param string|null $component A valid moodle component (frankenstyle) or null if searching all components
@param string $namespace Namespace from the comp... | [
"Returns",
"all",
"classes",
"in",
"a",
"component",
"matching",
"the",
"provided",
"namespace",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L931-L962 |
213,824 | moodle/moodle | lib/classes/component.php | core_component.is_valid_plugin_name | public static function is_valid_plugin_name($plugintype, $pluginname) {
if ($plugintype === 'mod') {
// Modules must not have the same name as core subsystems.
if (!isset(self::$subsystems)) {
// Watch out, this is called from init!
self::init();
... | php | public static function is_valid_plugin_name($plugintype, $pluginname) {
if ($plugintype === 'mod') {
// Modules must not have the same name as core subsystems.
if (!isset(self::$subsystems)) {
// Watch out, this is called from init!
self::init();
... | [
"public",
"static",
"function",
"is_valid_plugin_name",
"(",
"$",
"plugintype",
",",
"$",
"pluginname",
")",
"{",
"if",
"(",
"$",
"plugintype",
"===",
"'mod'",
")",
"{",
"// Modules must not have the same name as core subsystems.",
"if",
"(",
"!",
"isset",
"(",
"s... | This method validates a plug name. It is much faster than calling clean_param.
@param string $plugintype type of plugin
@param string $pluginname a string that might be a plugin name.
@return bool if this string is a valid plugin name. | [
"This",
"method",
"validates",
"a",
"plug",
"name",
".",
"It",
"is",
"much",
"faster",
"than",
"calling",
"clean_param",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L1007-L1024 |
213,825 | moodle/moodle | lib/classes/component.php | core_component.normalize_componentname | public static function normalize_componentname($componentname) {
list($plugintype, $pluginname) = self::normalize_component($componentname);
if ($plugintype === 'core' && is_null($pluginname)) {
return $plugintype;
}
return $plugintype . '_' . $pluginname;
} | php | public static function normalize_componentname($componentname) {
list($plugintype, $pluginname) = self::normalize_component($componentname);
if ($plugintype === 'core' && is_null($pluginname)) {
return $plugintype;
}
return $plugintype . '_' . $pluginname;
} | [
"public",
"static",
"function",
"normalize_componentname",
"(",
"$",
"componentname",
")",
"{",
"list",
"(",
"$",
"plugintype",
",",
"$",
"pluginname",
")",
"=",
"self",
"::",
"normalize_component",
"(",
"$",
"componentname",
")",
";",
"if",
"(",
"$",
"plugi... | Normalize the component name.
Note: this does not verify the validity of the plugin or component.
@param string $component
@return string | [
"Normalize",
"the",
"component",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L1034-L1040 |
213,826 | moodle/moodle | lib/classes/component.php | core_component.normalize_component | public static function normalize_component($component) {
if ($component === 'moodle' or $component === 'core' or $component === '') {
return array('core', null);
}
if (strpos($component, '_') === false) {
self::init();
if (array_key_exists($component, self::$... | php | public static function normalize_component($component) {
if ($component === 'moodle' or $component === 'core' or $component === '') {
return array('core', null);
}
if (strpos($component, '_') === false) {
self::init();
if (array_key_exists($component, self::$... | [
"public",
"static",
"function",
"normalize_component",
"(",
"$",
"component",
")",
"{",
"if",
"(",
"$",
"component",
"===",
"'moodle'",
"or",
"$",
"component",
"===",
"'core'",
"or",
"$",
"component",
"===",
"''",
")",
"{",
"return",
"array",
"(",
"'core'"... | Normalize the component name using the "frankenstyle" rules.
Note: this does not verify the validity of plugin or type names.
@param string $component
@return array two-items list of [(string)type, (string|null)name] | [
"Normalize",
"the",
"component",
"name",
"using",
"the",
"frankenstyle",
"rules",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L1050-L1075 |
213,827 | moodle/moodle | lib/classes/component.php | core_component.get_component_directory | public static function get_component_directory($component) {
global $CFG;
list($type, $plugin) = self::normalize_component($component);
if ($type === 'core') {
if ($plugin === null) {
return $path = $CFG->libdir;
}
return self::get_subsystem_... | php | public static function get_component_directory($component) {
global $CFG;
list($type, $plugin) = self::normalize_component($component);
if ($type === 'core') {
if ($plugin === null) {
return $path = $CFG->libdir;
}
return self::get_subsystem_... | [
"public",
"static",
"function",
"get_component_directory",
"(",
"$",
"component",
")",
"{",
"global",
"$",
"CFG",
";",
"list",
"(",
"$",
"type",
",",
"$",
"plugin",
")",
"=",
"self",
"::",
"normalize_component",
"(",
"$",
"component",
")",
";",
"if",
"("... | Return exact absolute path to a plugin directory.
@param string $component name such as 'moodle', 'mod_forum'
@return string full path to component directory; NULL if not found | [
"Return",
"exact",
"absolute",
"path",
"to",
"a",
"plugin",
"directory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L1083-L1096 |
213,828 | moodle/moodle | lib/classes/component.php | core_component.get_plugin_types_with_subplugins | public static function get_plugin_types_with_subplugins() {
self::init();
$return = array();
foreach (self::$supportsubplugins as $type) {
$return[$type] = self::$plugintypes[$type];
}
return $return;
} | php | public static function get_plugin_types_with_subplugins() {
self::init();
$return = array();
foreach (self::$supportsubplugins as $type) {
$return[$type] = self::$plugintypes[$type];
}
return $return;
} | [
"public",
"static",
"function",
"get_plugin_types_with_subplugins",
"(",
")",
"{",
"self",
"::",
"init",
"(",
")",
";",
"$",
"return",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"supportsubplugins",
"as",
"$",
"type",
")",
"{",
"$",
... | Returns list of plugin types that allow subplugins.
@return array as (string)plugintype => (string)fulldir | [
"Returns",
"list",
"of",
"plugin",
"types",
"that",
"allow",
"subplugins",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L1102-L1110 |
213,829 | moodle/moodle | lib/classes/component.php | core_component.get_subtype_parent | public static function get_subtype_parent($type) {
self::init();
if (isset(self::$parents[$type])) {
return self::$parents[$type];
}
return null;
} | php | public static function get_subtype_parent($type) {
self::init();
if (isset(self::$parents[$type])) {
return self::$parents[$type];
}
return null;
} | [
"public",
"static",
"function",
"get_subtype_parent",
"(",
"$",
"type",
")",
"{",
"self",
"::",
"init",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"parents",
"[",
"$",
"type",
"]",
")",
")",
"{",
"return",
"self",
"::",
"$",
"parent... | Returns parent of this subplugin type.
@param string $type
@return string parent component or null | [
"Returns",
"parent",
"of",
"this",
"subplugin",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L1118-L1126 |
213,830 | moodle/moodle | lib/classes/component.php | core_component.get_subplugins | public static function get_subplugins($component) {
self::init();
if (isset(self::$subplugins[$component])) {
return self::$subplugins[$component];
}
return null;
} | php | public static function get_subplugins($component) {
self::init();
if (isset(self::$subplugins[$component])) {
return self::$subplugins[$component];
}
return null;
} | [
"public",
"static",
"function",
"get_subplugins",
"(",
"$",
"component",
")",
"{",
"self",
"::",
"init",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"subplugins",
"[",
"$",
"component",
"]",
")",
")",
"{",
"return",
"self",
"::",
"$",
... | Return all subplugins of this component.
@param string $component.
@return array $subtype=>array($component, ..), null if no subtypes defined | [
"Return",
"all",
"subplugins",
"of",
"this",
"component",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L1133-L1141 |
213,831 | moodle/moodle | lib/classes/component.php | core_component.get_all_versions | public static function get_all_versions() : array {
global $CFG;
self::init();
$versions = array();
// Main version first.
$versions['core'] = self::fetch_core_version();
// The problem here is tha the component cache might be stable,
// we want this to work a... | php | public static function get_all_versions() : array {
global $CFG;
self::init();
$versions = array();
// Main version first.
$versions['core'] = self::fetch_core_version();
// The problem here is tha the component cache might be stable,
// we want this to work a... | [
"public",
"static",
"function",
"get_all_versions",
"(",
")",
":",
"array",
"{",
"global",
"$",
"CFG",
";",
"self",
"::",
"init",
"(",
")",
";",
"$",
"versions",
"=",
"array",
"(",
")",
";",
"// Main version first.",
"$",
"versions",
"[",
"'core'",
"]",
... | Returns hash of all versions including core and all plugins.
This is relatively slow and not fully cached, use with care!
@return array as (string)plugintype_pluginname => (int)version | [
"Returns",
"hash",
"of",
"all",
"versions",
"including",
"core",
"and",
"all",
"plugins",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L1161-L1196 |
213,832 | moodle/moodle | lib/classes/component.php | core_component.fill_classmap_renames_cache | protected static function fill_classmap_renames_cache() {
global $CFG;
self::$classmaprenames = array();
self::load_renamed_classes("$CFG->dirroot/lib/");
foreach (self::$subsystems as $subsystem => $fulldir) {
self::load_renamed_classes($fulldir);
}
forea... | php | protected static function fill_classmap_renames_cache() {
global $CFG;
self::$classmaprenames = array();
self::load_renamed_classes("$CFG->dirroot/lib/");
foreach (self::$subsystems as $subsystem => $fulldir) {
self::load_renamed_classes($fulldir);
}
forea... | [
"protected",
"static",
"function",
"fill_classmap_renames_cache",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"self",
"::",
"$",
"classmaprenames",
"=",
"array",
"(",
")",
";",
"self",
"::",
"load_renamed_classes",
"(",
"\"$CFG->dirroot/lib/\"",
")",
";",
"foreach... | Records all class renames that have been made to facilitate autoloading. | [
"Records",
"all",
"class",
"renames",
"that",
"have",
"been",
"made",
"to",
"facilitate",
"autoloading",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L1228-L1244 |
213,833 | moodle/moodle | lib/classes/component.php | core_component.get_component_names | public static function get_component_names() : array {
$componentnames = [];
// Get all plugins.
foreach (self::get_plugin_types() as $plugintype => $typedir) {
foreach (self::get_plugin_list($plugintype) as $pluginname => $plugindir) {
$componentnames[] = $plugintype... | php | public static function get_component_names() : array {
$componentnames = [];
// Get all plugins.
foreach (self::get_plugin_types() as $plugintype => $typedir) {
foreach (self::get_plugin_list($plugintype) as $pluginname => $plugindir) {
$componentnames[] = $plugintype... | [
"public",
"static",
"function",
"get_component_names",
"(",
")",
":",
"array",
"{",
"$",
"componentnames",
"=",
"[",
"]",
";",
"// Get all plugins.",
"foreach",
"(",
"self",
"::",
"get_plugin_types",
"(",
")",
"as",
"$",
"plugintype",
"=>",
"$",
"typedir",
"... | Returns a list of frankenstyle component names.
E.g.
[
'core_course',
'core_message',
'mod_assign',
...
]
@return array the list of frankenstyle component names. | [
"Returns",
"a",
"list",
"of",
"frankenstyle",
"component",
"names",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/component.php#L1314-L1327 |
213,834 | moodle/moodle | admin/webservice/lib.php | service_user_selector.get_options | protected function get_options() {
global $CFG;
$options = parent::get_options();
$options['file'] = $CFG->admin.'/webservice/lib.php'; //need to be set, otherwise
// the /user/selector/search.php
... | php | protected function get_options() {
global $CFG;
$options = parent::get_options();
$options['file'] = $CFG->admin.'/webservice/lib.php'; //need to be set, otherwise
// the /user/selector/search.php
... | [
"protected",
"function",
"get_options",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"options",
"=",
"parent",
"::",
"get_options",
"(",
")",
";",
"$",
"options",
"[",
"'file'",
"]",
"=",
"$",
"CFG",
"->",
"admin",
".",
"'/webservice/lib.php'",
";",
... | This options are automatically used by the AJAX search
@global object $CFG
@return object options pass to the constructor when AJAX search call a new selector | [
"This",
"options",
"are",
"automatically",
"used",
"by",
"the",
"AJAX",
"search"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/webservice/lib.php#L117-L126 |
213,835 | moodle/moodle | backup/util/plan/base_task.class.php | base_task.add_result | public function add_result($result) {
if (!is_null($this->plan)) {
$this->plan->add_result($result);
} else {
debugging('Attempting to add a result of a task not binded with a plan', DEBUG_DEVELOPER);
}
} | php | public function add_result($result) {
if (!is_null($this->plan)) {
$this->plan->add_result($result);
} else {
debugging('Attempting to add a result of a task not binded with a plan', DEBUG_DEVELOPER);
}
} | [
"public",
"function",
"add_result",
"(",
"$",
"result",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"plan",
")",
")",
"{",
"$",
"this",
"->",
"plan",
"->",
"add_result",
"(",
"$",
"result",
")",
";",
"}",
"else",
"{",
"debugging",
... | Add the given info to the current plan's results.
@see base_plan::add_result()
@param array $result associative array describing a result of a task/step | [
"Add",
"the",
"given",
"info",
"to",
"the",
"current",
"plan",
"s",
"results",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/plan/base_task.class.php#L233-L239 |
213,836 | moodle/moodle | backup/util/plan/base_task.class.php | base_task.get_results | public function get_results() {
if (!is_null($this->plan)) {
return $this->plan->get_results();
} else {
debugging('Attempting to get results of a task not binded with a plan', DEBUG_DEVELOPER);
return null;
}
} | php | public function get_results() {
if (!is_null($this->plan)) {
return $this->plan->get_results();
} else {
debugging('Attempting to get results of a task not binded with a plan', DEBUG_DEVELOPER);
return null;
}
} | [
"public",
"function",
"get_results",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"plan",
")",
")",
"{",
"return",
"$",
"this",
"->",
"plan",
"->",
"get_results",
"(",
")",
";",
"}",
"else",
"{",
"debugging",
"(",
"'Attempting to... | Return the current plan's results
@return array|null | [
"Return",
"the",
"current",
"plan",
"s",
"results"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/plan/base_task.class.php#L246-L253 |
213,837 | moodle/moodle | mod/assign/classes/event/course_module_instance_list_viewed.php | course_module_instance_list_viewed.create_from_course | public static function create_from_course(\stdClass $course) {
$params = array(
'context' => \context_course::instance($course->id)
);
$event = \mod_assign\event\course_module_instance_list_viewed::create($params);
$event->add_record_snapshot('course', $course);
retur... | php | public static function create_from_course(\stdClass $course) {
$params = array(
'context' => \context_course::instance($course->id)
);
$event = \mod_assign\event\course_module_instance_list_viewed::create($params);
$event->add_record_snapshot('course', $course);
retur... | [
"public",
"static",
"function",
"create_from_course",
"(",
"\\",
"stdClass",
"$",
"course",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'context'",
"=>",
"\\",
"context_course",
"::",
"instance",
"(",
"$",
"course",
"->",
"id",
")",
")",
";",
"$",
"even... | Create the event from course record.
@param \stdClass $course
@return course_module_instance_list_viewed | [
"Create",
"the",
"event",
"from",
"course",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/event/course_module_instance_list_viewed.php#L44-L51 |
213,838 | moodle/moodle | question/previewlib.php | question_preview_options.load_user_defaults | public function load_user_defaults() {
$defaults = get_config('question_preview');
foreach ($this->get_user_pref_fields() as $field) {
$this->$field = get_user_preferences(
self::OPTIONPREFIX . $field, $defaults->$field);
}
$this->numpartscorrect = $this->... | php | public function load_user_defaults() {
$defaults = get_config('question_preview');
foreach ($this->get_user_pref_fields() as $field) {
$this->$field = get_user_preferences(
self::OPTIONPREFIX . $field, $defaults->$field);
}
$this->numpartscorrect = $this->... | [
"public",
"function",
"load_user_defaults",
"(",
")",
"{",
"$",
"defaults",
"=",
"get_config",
"(",
"'question_preview'",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"get_user_pref_fields",
"(",
")",
"as",
"$",
"field",
")",
"{",
"$",
"this",
"->",
"$",
... | Load the value of the options from the user_preferences table. | [
"Load",
"the",
"value",
"of",
"the",
"options",
"from",
"the",
"user_preferences",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/previewlib.php#L169-L176 |
213,839 | moodle/moodle | question/previewlib.php | question_preview_options.save_user_preview_options | public function save_user_preview_options($newoptions) {
foreach ($this->get_user_pref_fields() as $field) {
if (isset($newoptions->$field)) {
set_user_preference(self::OPTIONPREFIX . $field, $newoptions->$field);
}
}
} | php | public function save_user_preview_options($newoptions) {
foreach ($this->get_user_pref_fields() as $field) {
if (isset($newoptions->$field)) {
set_user_preference(self::OPTIONPREFIX . $field, $newoptions->$field);
}
}
} | [
"public",
"function",
"save_user_preview_options",
"(",
"$",
"newoptions",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"get_user_pref_fields",
"(",
")",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"newoptions",
"->",
"$",
"field",
")",
"... | Save a change to the user's preview options to the database.
@param object $newoptions | [
"Save",
"a",
"change",
"to",
"the",
"user",
"s",
"preview",
"options",
"to",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/previewlib.php#L182-L188 |
213,840 | moodle/moodle | question/previewlib.php | question_preview_options.set_from_request | public function set_from_request() {
foreach ($this->get_field_types() as $field => $type) {
$this->$field = optional_param($field, $this->$field, $type);
}
$this->numpartscorrect = $this->feedback;
} | php | public function set_from_request() {
foreach ($this->get_field_types() as $field => $type) {
$this->$field = optional_param($field, $this->$field, $type);
}
$this->numpartscorrect = $this->feedback;
} | [
"public",
"function",
"set_from_request",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"get_field_types",
"(",
")",
"as",
"$",
"field",
"=>",
"$",
"type",
")",
"{",
"$",
"this",
"->",
"$",
"field",
"=",
"optional_param",
"(",
"$",
"field",
",",
... | Set the value of any fields included in the request. | [
"Set",
"the",
"value",
"of",
"any",
"fields",
"included",
"in",
"the",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/previewlib.php#L193-L198 |
213,841 | moodle/moodle | lib/horde/framework/Horde/Mime/Headers/ContentParam.php | Horde_Mime_Headers_ContentParam._escapeParams | protected function _escapeParams($params)
{
foreach ($params as $k => $v) {
foreach (str_split($v) as $c) {
if (!Horde_Mime_ContentParam_Decode::isAtextNonTspecial($c)) {
$params[$k] = '"' . addcslashes($v, '\\"') . '"';
break;
... | php | protected function _escapeParams($params)
{
foreach ($params as $k => $v) {
foreach (str_split($v) as $c) {
if (!Horde_Mime_ContentParam_Decode::isAtextNonTspecial($c)) {
$params[$k] = '"' . addcslashes($v, '\\"') . '"';
break;
... | [
"protected",
"function",
"_escapeParams",
"(",
"$",
"params",
")",
"{",
"foreach",
"(",
"$",
"params",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"foreach",
"(",
"str_split",
"(",
"$",
"v",
")",
"as",
"$",
"c",
")",
"{",
"if",
"(",
"!",
"Horde_Mim... | Escape the parameter array.
@param array $params Parameter array.
@return array Escaped parameter array. | [
"Escape",
"the",
"parameter",
"array",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Headers/ContentParam.php#L230-L242 |
213,842 | moodle/moodle | lib/horde/framework/Horde/Mime/Headers/ContentParam.php | Horde_Mime_Headers_ContentParam.setContentParamValue | public function setContentParamValue($data)
{
$data = $this->_sanityCheck(trim($data));
if (($pos = strpos($data, ';')) !== false) {
$data = substr($data, 0, $pos);
}
$this->_values = array($data);
} | php | public function setContentParamValue($data)
{
$data = $this->_sanityCheck(trim($data));
if (($pos = strpos($data, ';')) !== false) {
$data = substr($data, 0, $pos);
}
$this->_values = array($data);
} | [
"public",
"function",
"setContentParamValue",
"(",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"_sanityCheck",
"(",
"trim",
"(",
"$",
"data",
")",
")",
";",
"if",
"(",
"(",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"data",
",",
"';'",
... | Set the content-parameter base value.
@since 2.8.0
@param string $data Value. | [
"Set",
"the",
"content",
"-",
"parameter",
"base",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Headers/ContentParam.php#L251-L259 |
213,843 | moodle/moodle | mod/assign/gradeform.php | mod_assign_grade_form.definition | public function definition() {
$mform = $this->_form;
list($assignment, $data, $params) = $this->_customdata;
// Visible elements.
$this->assignment = $assignment;
$assignment->add_grade_form_elements($mform, $data, $params);
if ($data) {
$this->set_data($da... | php | public function definition() {
$mform = $this->_form;
list($assignment, $data, $params) = $this->_customdata;
// Visible elements.
$this->assignment = $assignment;
$assignment->add_grade_form_elements($mform, $data, $params);
if ($data) {
$this->set_data($da... | [
"public",
"function",
"definition",
"(",
")",
"{",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"list",
"(",
"$",
"assignment",
",",
"$",
"data",
",",
"$",
"params",
")",
"=",
"$",
"this",
"->",
"_customdata",
";",
"// Visible elements.",
"$",
... | Define the form - called by parent constructor. | [
"Define",
"the",
"form",
"-",
"called",
"by",
"parent",
"constructor",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/gradeform.php#L46-L57 |
213,844 | moodle/moodle | mod/assign/gradeform.php | mod_assign_grade_form.validation | public function validation($data, $files) {
global $DB;
$errors = parent::validation($data, $files);
$instance = $this->assignment->get_instance();
// Advanced grading.
if (!array_key_exists('grade', $data)) {
return $errors;
}
if ($instance->grade >... | php | public function validation($data, $files) {
global $DB;
$errors = parent::validation($data, $files);
$instance = $this->assignment->get_instance();
// Advanced grading.
if (!array_key_exists('grade', $data)) {
return $errors;
}
if ($instance->grade >... | [
"public",
"function",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"errors",
"=",
"parent",
"::",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
";",
"$",
"instance",
"=",
"$",
"this",
"->",
... | Perform minimal validation on the grade form
@param array $data
@param array $files | [
"Perform",
"minimal",
"validation",
"on",
"the",
"grade",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/gradeform.php#L76-L104 |
213,845 | moodle/moodle | lib/grade/grade_outcome.php | grade_outcome.delete | public function delete($source=null) {
global $DB;
if (!empty($this->courseid)) {
$DB->delete_records('grade_outcomes_courses', array('outcomeid' => $this->id, 'courseid' => $this->courseid));
}
if (parent::delete($source)) {
$context = context_system::instance();... | php | public function delete($source=null) {
global $DB;
if (!empty($this->courseid)) {
$DB->delete_records('grade_outcomes_courses', array('outcomeid' => $this->id, 'courseid' => $this->courseid));
}
if (parent::delete($source)) {
$context = context_system::instance();... | [
"public",
"function",
"delete",
"(",
"$",
"source",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"courseid",
")",
")",
"{",
"$",
"DB",
"->",
"delete_records",
"(",
"'grade_outcomes_courses'",
",",
... | Deletes this outcome from the database.
@param string $source from where was the object deleted (mod/forum, manual, etc.)
@return bool success | [
"Deletes",
"this",
"outcome",
"from",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_outcome.php#L103-L118 |
213,846 | moodle/moodle | lib/grade/grade_outcome.php | grade_outcome.use_in | public function use_in($courseid) {
global $DB;
if (!empty($this->courseid) and $courseid != $this->courseid) {
return false;
}
if (!$DB->record_exists('grade_outcomes_courses', array('courseid' => $courseid, 'outcomeid' => $this->id))) {
$goc = new stdClass();
... | php | public function use_in($courseid) {
global $DB;
if (!empty($this->courseid) and $courseid != $this->courseid) {
return false;
}
if (!$DB->record_exists('grade_outcomes_courses', array('courseid' => $courseid, 'outcomeid' => $this->id))) {
$goc = new stdClass();
... | [
"public",
"function",
"use_in",
"(",
"$",
"courseid",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"courseid",
")",
"and",
"$",
"courseid",
"!=",
"$",
"this",
"->",
"courseid",
")",
"{",
"return",
"false",
";... | Mark outcome as used in a course
@param int $courseid
@return False if invalid courseid requested | [
"Mark",
"outcome",
"as",
"used",
"in",
"a",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_outcome.php#L167-L180 |
213,847 | moodle/moodle | lib/grade/grade_outcome.php | grade_outcome.load_scale | public function load_scale() {
if (empty($this->scale->id) or $this->scale->id != $this->scaleid) {
$this->scale = grade_scale::fetch(array('id'=>$this->scaleid));
$this->scale->load_items();
}
return $this->scale;
} | php | public function load_scale() {
if (empty($this->scale->id) or $this->scale->id != $this->scaleid) {
$this->scale = grade_scale::fetch(array('id'=>$this->scaleid));
$this->scale->load_items();
}
return $this->scale;
} | [
"public",
"function",
"load_scale",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"scale",
"->",
"id",
")",
"or",
"$",
"this",
"->",
"scale",
"->",
"id",
"!=",
"$",
"this",
"->",
"scaleid",
")",
"{",
"$",
"this",
"->",
"scale",
"=",
... | Instantiates a grade_scale object whose data is retrieved from the database
@return grade_scale | [
"Instantiates",
"a",
"grade_scale",
"object",
"whose",
"data",
"is",
"retrieved",
"from",
"the",
"database"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_outcome.php#L209-L215 |
213,848 | moodle/moodle | lib/grade/grade_outcome.php | grade_outcome.fetch_all_available | public static function fetch_all_available($courseid) {
global $CFG, $DB;
$result = array();
$params = array($courseid);
$sql = "SELECT go.*
FROM {grade_outcomes} go, {grade_outcomes_courses} goc
WHERE go.id = goc.outcomeid AND goc.courseid = ?
... | php | public static function fetch_all_available($courseid) {
global $CFG, $DB;
$result = array();
$params = array($courseid);
$sql = "SELECT go.*
FROM {grade_outcomes} go, {grade_outcomes_courses} goc
WHERE go.id = goc.outcomeid AND goc.courseid = ?
... | [
"public",
"static",
"function",
"fetch_all_available",
"(",
"$",
"courseid",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"params",
"=",
"array",
"(",
"$",
"courseid",
")",
";",
"$",
"sql",
"... | Static method that returns all outcomes available in course
@static
@param int $courseid
@return array | [
"Static",
"method",
"that",
"returns",
"all",
"outcomes",
"available",
"in",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_outcome.php#L251-L269 |
213,849 | moodle/moodle | lib/grade/grade_outcome.php | grade_outcome.can_delete | public function can_delete() {
if ($this->get_item_uses_count()) {
return false;
}
if (empty($this->courseid)) {
if ($this->get_course_uses_count()) {
return false;
}
}
return true;
} | php | public function can_delete() {
if ($this->get_item_uses_count()) {
return false;
}
if (empty($this->courseid)) {
if ($this->get_course_uses_count()) {
return false;
}
}
return true;
} | [
"public",
"function",
"can_delete",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"get_item_uses_count",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"courseid",
")",
")",
"{",
"if",
"(",
"$",
"this",
... | Checks if outcome can be deleted.
@return bool | [
"Checks",
"if",
"outcome",
"can",
"be",
"deleted",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_outcome.php#L314-L324 |
213,850 | moodle/moodle | lib/horde/framework/Horde/Mime/ContentParam/Decode.php | Horde_Mime_ContentParam_Decode.decode | public function decode($data)
{
$out = array();
$this->_data = $data;
$this->_datalen = strlen($data);
$this->_ptr = 0;
while ($this->_curr() !== false) {
$this->_rfc822SkipLwsp();
$this->_rfc822ParseMimeToken($param);
if (is_null($para... | php | public function decode($data)
{
$out = array();
$this->_data = $data;
$this->_datalen = strlen($data);
$this->_ptr = 0;
while ($this->_curr() !== false) {
$this->_rfc822SkipLwsp();
$this->_rfc822ParseMimeToken($param);
if (is_null($para... | [
"public",
"function",
"decode",
"(",
"$",
"data",
")",
"{",
"$",
"out",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"_data",
"=",
"$",
"data",
";",
"$",
"this",
"->",
"_datalen",
"=",
"strlen",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",... | Decode content parameter data.
@param string $data Parameter data.
@return array List of parameter key/value combinations. | [
"Decode",
"content",
"parameter",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/ContentParam/Decode.php#L40-L86 |
213,851 | moodle/moodle | backup/util/settings/setting_dependency.class.php | setting_dependency.process_change | final public function process_change($changetype, $oldvalue) {
// Check the type of change requested.
switch ($changetype) {
// Process a status change.
case base_setting::CHANGED_STATUS:
return $this->process_status_change($oldvalue);
// Process a vis... | php | final public function process_change($changetype, $oldvalue) {
// Check the type of change requested.
switch ($changetype) {
// Process a status change.
case base_setting::CHANGED_STATUS:
return $this->process_status_change($oldvalue);
// Process a vis... | [
"final",
"public",
"function",
"process_change",
"(",
"$",
"changetype",
",",
"$",
"oldvalue",
")",
"{",
"// Check the type of change requested.",
"switch",
"(",
"$",
"changetype",
")",
"{",
"// Process a status change.",
"case",
"base_setting",
"::",
"CHANGED_STATUS",
... | Processes a change is setting called by the primary setting
@param int $changetype
@param mixed $oldvalue
@return bool | [
"Processes",
"a",
"change",
"is",
"setting",
"called",
"by",
"the",
"primary",
"setting"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/settings/setting_dependency.class.php#L95-L110 |
213,852 | moodle/moodle | backup/util/settings/setting_dependency.class.php | setting_dependency.process_visibility_change | protected function process_visibility_change($oldvisibility) {
// Store the current dependent settings visibility for comparison.
$prevalue = $this->dependentsetting->get_visibility();
// Set it regardless of whether we need to.
$this->dependentsetting->set_visibility($this->setting->get... | php | protected function process_visibility_change($oldvisibility) {
// Store the current dependent settings visibility for comparison.
$prevalue = $this->dependentsetting->get_visibility();
// Set it regardless of whether we need to.
$this->dependentsetting->set_visibility($this->setting->get... | [
"protected",
"function",
"process_visibility_change",
"(",
"$",
"oldvisibility",
")",
"{",
"// Store the current dependent settings visibility for comparison.",
"$",
"prevalue",
"=",
"$",
"this",
"->",
"dependentsetting",
"->",
"get_visibility",
"(",
")",
";",
"// Set it re... | Processes a visibility change
@param bool $oldvisibility
@return bool | [
"Processes",
"a",
"visibility",
"change"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/settings/setting_dependency.class.php#L116-L123 |
213,853 | moodle/moodle | backup/util/settings/setting_dependency.class.php | setting_dependency_disabledif_equals.is_locked | public function is_locked() {
// If the setting is locked or the dependent setting should be locked then return true.
if ($this->setting->get_status() !== base_setting::NOT_LOCKED ||
$this->evaluate_disabled_condition($this->setting->get_value())) {
return true;
}
... | php | public function is_locked() {
// If the setting is locked or the dependent setting should be locked then return true.
if ($this->setting->get_status() !== base_setting::NOT_LOCKED ||
$this->evaluate_disabled_condition($this->setting->get_value())) {
return true;
}
... | [
"public",
"function",
"is_locked",
"(",
")",
"{",
"// If the setting is locked or the dependent setting should be locked then return true.",
"if",
"(",
"$",
"this",
"->",
"setting",
"->",
"get_status",
"(",
")",
"!==",
"base_setting",
"::",
"NOT_LOCKED",
"||",
"$",
"thi... | Returns true if the dependent setting is locked by this setting_dependency.
@return bool | [
"Returns",
"true",
"if",
"the",
"dependent",
"setting",
"is",
"locked",
"by",
"this",
"setting_dependency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/settings/setting_dependency.class.php#L193-L201 |
213,854 | moodle/moodle | backup/util/settings/setting_dependency.class.php | setting_dependency_disabledif_equals.process_value_change | protected function process_value_change($oldvalue) {
if ($this->dependentsetting->get_status() == base_setting::LOCKED_BY_PERMISSION ||
$this->dependentsetting->get_status() == base_setting::LOCKED_BY_CONFIG) {
// When setting is locked by permission or config do not apply dependenci... | php | protected function process_value_change($oldvalue) {
if ($this->dependentsetting->get_status() == base_setting::LOCKED_BY_PERMISSION ||
$this->dependentsetting->get_status() == base_setting::LOCKED_BY_CONFIG) {
// When setting is locked by permission or config do not apply dependenci... | [
"protected",
"function",
"process_value_change",
"(",
"$",
"oldvalue",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dependentsetting",
"->",
"get_status",
"(",
")",
"==",
"base_setting",
"::",
"LOCKED_BY_PERMISSION",
"||",
"$",
"this",
"->",
"dependentsetting",
"->"... | Processes a value change in the primary setting
@param mixed $oldvalue
@return bool | [
"Processes",
"a",
"value",
"change",
"in",
"the",
"primary",
"setting"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/settings/setting_dependency.class.php#L207-L234 |
213,855 | moodle/moodle | backup/util/settings/setting_dependency.class.php | setting_dependency_disabledif_equals.process_status_change | protected function process_status_change($oldstatus) {
// Store the dependent status.
$prevalue = $this->dependentsetting->get_status();
// Store the current status.
$currentstatus = $this->setting->get_status();
if ($currentstatus == base_setting::NOT_LOCKED) {
if ($... | php | protected function process_status_change($oldstatus) {
// Store the dependent status.
$prevalue = $this->dependentsetting->get_status();
// Store the current status.
$currentstatus = $this->setting->get_status();
if ($currentstatus == base_setting::NOT_LOCKED) {
if ($... | [
"protected",
"function",
"process_status_change",
"(",
"$",
"oldstatus",
")",
"{",
"// Store the dependent status.",
"$",
"prevalue",
"=",
"$",
"this",
"->",
"dependentsetting",
"->",
"get_status",
"(",
")",
";",
"// Store the current status.",
"$",
"currentstatus",
"... | Processes a status change in the primary setting
@param mixed $oldstatus
@return bool | [
"Processes",
"a",
"status",
"change",
"in",
"the",
"primary",
"setting"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/settings/setting_dependency.class.php#L240-L257 |
213,856 | moodle/moodle | backup/util/settings/setting_dependency.class.php | setting_dependency_disabledif_equals.enforce | public function enforce() {
// This will be set to true if ANYTHING changes.
$changes = false;
// First process any value changes.
if ($this->process_value_change($this->setting->get_value())) {
$changes = true;
}
// Second process any status changes.
... | php | public function enforce() {
// This will be set to true if ANYTHING changes.
$changes = false;
// First process any value changes.
if ($this->process_value_change($this->setting->get_value())) {
$changes = true;
}
// Second process any status changes.
... | [
"public",
"function",
"enforce",
"(",
")",
"{",
"// This will be set to true if ANYTHING changes.",
"$",
"changes",
"=",
"false",
";",
"// First process any value changes.",
"if",
"(",
"$",
"this",
"->",
"process_value_change",
"(",
"$",
"this",
"->",
"setting",
"->",... | Enforces the dependency if required.
@return bool True if there were changes | [
"Enforces",
"the",
"dependency",
"if",
"required",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/settings/setting_dependency.class.php#L262-L278 |
213,857 | moodle/moodle | blocks/glossary_random/backup/moodle2/restore_glossary_random_block_task.class.php | restore_glossary_random_block_task.after_restore | public function after_restore() {
global $DB;
// Get the blockid
$blockid = $this->get_blockid();
// Extract block configdata and update it to point to the new glossary
if ($configdata = $DB->get_field('block_instances', 'configdata', array('id' => $blockid))) {
$co... | php | public function after_restore() {
global $DB;
// Get the blockid
$blockid = $this->get_blockid();
// Extract block configdata and update it to point to the new glossary
if ($configdata = $DB->get_field('block_instances', 'configdata', array('id' => $blockid))) {
$co... | [
"public",
"function",
"after_restore",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"// Get the blockid",
"$",
"blockid",
"=",
"$",
"this",
"->",
"get_blockid",
"(",
")",
";",
"// Extract block configdata and update it to point to the new glossary",
"if",
"(",
"$",
"con... | This function, executed after all the tasks in the plan
have been executed, will perform the recode of the
target glossary for the block. This must be done here
and not in normal execution steps because the glossary
may be restored after the block. | [
"This",
"function",
"executed",
"after",
"all",
"the",
"tasks",
"in",
"the",
"plan",
"have",
"been",
"executed",
"will",
"perform",
"the",
"recode",
"of",
"the",
"target",
"glossary",
"for",
"the",
"block",
".",
"This",
"must",
"be",
"done",
"here",
"and",... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/glossary_random/backup/moodle2/restore_glossary_random_block_task.class.php#L53-L86 |
213,858 | moodle/moodle | admin/tool/cohortroles/classes/api.php | api.create_cohort_role_assignment | public static function create_cohort_role_assignment(stdClass $record) {
$cohortroleassignment = new cohort_role_assignment(0, $record);
$context = context_system::instance();
// First we do a permissions check.
require_capability('moodle/role:manage', $context);
// Validate be... | php | public static function create_cohort_role_assignment(stdClass $record) {
$cohortroleassignment = new cohort_role_assignment(0, $record);
$context = context_system::instance();
// First we do a permissions check.
require_capability('moodle/role:manage', $context);
// Validate be... | [
"public",
"static",
"function",
"create_cohort_role_assignment",
"(",
"stdClass",
"$",
"record",
")",
"{",
"$",
"cohortroleassignment",
"=",
"new",
"cohort_role_assignment",
"(",
"0",
",",
"$",
"record",
")",
";",
"$",
"context",
"=",
"context_system",
"::",
"in... | Create a cohort role assignment from a record containing all the data for the class.
Requires moodle/role:manage capability at the system context.
@param stdClass $record Record containing all the data for an instance of the class.
@return competency | [
"Create",
"a",
"cohort",
"role",
"assignment",
"from",
"a",
"record",
"containing",
"all",
"the",
"data",
"for",
"the",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/cohortroles/classes/api.php#L46-L66 |
213,859 | moodle/moodle | admin/tool/cohortroles/classes/api.php | api.delete_cohort_role_assignment | public static function delete_cohort_role_assignment($id) {
$cohortroleassignment = new cohort_role_assignment($id);
$context = context_system::instance();
// First we do a permissions check.
require_capability('moodle/role:manage', $context);
// OK - all set.
return $c... | php | public static function delete_cohort_role_assignment($id) {
$cohortroleassignment = new cohort_role_assignment($id);
$context = context_system::instance();
// First we do a permissions check.
require_capability('moodle/role:manage', $context);
// OK - all set.
return $c... | [
"public",
"static",
"function",
"delete_cohort_role_assignment",
"(",
"$",
"id",
")",
"{",
"$",
"cohortroleassignment",
"=",
"new",
"cohort_role_assignment",
"(",
"$",
"id",
")",
";",
"$",
"context",
"=",
"context_system",
"::",
"instance",
"(",
")",
";",
"// ... | Delete a cohort role assignment by id.
Requires moodle/role:manage capability at the system context.
@param int $id The record to delete. This will also remove this role from the user for all users in the system.
@return boolean | [
"Delete",
"a",
"cohort",
"role",
"assignment",
"by",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/cohortroles/classes/api.php#L76-L85 |
213,860 | moodle/moodle | cache/stores/mongodb/MongoDB/Operation/CreateCollection.php | CreateCollection.createCommand | private function createCommand()
{
$cmd = ['create' => $this->collectionName];
foreach (['autoIndexId', 'capped', 'flags', 'max', 'maxTimeMS', 'size', 'validationAction', 'validationLevel'] as $option) {
if (isset($this->options[$option])) {
$cmd[$option] = $this->option... | php | private function createCommand()
{
$cmd = ['create' => $this->collectionName];
foreach (['autoIndexId', 'capped', 'flags', 'max', 'maxTimeMS', 'size', 'validationAction', 'validationLevel'] as $option) {
if (isset($this->options[$option])) {
$cmd[$option] = $this->option... | [
"private",
"function",
"createCommand",
"(",
")",
"{",
"$",
"cmd",
"=",
"[",
"'create'",
"=>",
"$",
"this",
"->",
"collectionName",
"]",
";",
"foreach",
"(",
"[",
"'autoIndexId'",
",",
"'capped'",
",",
"'flags'",
",",
"'max'",
",",
"'maxTimeMS'",
",",
"'... | Create the create command.
@return Command | [
"Create",
"the",
"create",
"command",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/Operation/CreateCollection.php#L219-L236 |
213,861 | moodle/moodle | mod/forum/classes/message/inbound/reply_handler.php | reply_handler.process_attachment | protected function process_attachment($acceptedtypes, \context_user $context, $itemid, \stdClass $attachment) {
global $USER, $CFG;
// Create the file record.
$record = new \stdClass();
$record->filearea = 'draft';
$record->component = 'user';
$record->itemid = $... | php | protected function process_attachment($acceptedtypes, \context_user $context, $itemid, \stdClass $attachment) {
global $USER, $CFG;
// Create the file record.
$record = new \stdClass();
$record->filearea = 'draft';
$record->component = 'user';
$record->itemid = $... | [
"protected",
"function",
"process_attachment",
"(",
"$",
"acceptedtypes",
",",
"\\",
"context_user",
"$",
"context",
",",
"$",
"itemid",
",",
"\\",
"stdClass",
"$",
"attachment",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"CFG",
";",
"// Create the file record... | Process attachments included in a message.
@param string[] $acceptedtypes String The mimetypes of the acceptable attachment types.
@param \context_user $context context_user The context of the user creating this attachment.
@param int $itemid int The itemid to store this attachment under.
@param \stdClass $attachment ... | [
"Process",
"attachments",
"included",
"in",
"a",
"message",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/message/inbound/reply_handler.php#L280-L305 |
213,862 | moodle/moodle | mod/forum/classes/message/inbound/reply_handler.php | reply_handler.get_success_message | public function get_success_message(\stdClass $messagedata, $handlerresult) {
$a = new \stdClass();
$a->subject = $handlerresult->subject;
$discussionurl = new \moodle_url('/mod/forum/discuss.php', array('d' => $handlerresult->discussion));
$discussionurl->set_anchor('p' . $handlerresult... | php | public function get_success_message(\stdClass $messagedata, $handlerresult) {
$a = new \stdClass();
$a->subject = $handlerresult->subject;
$discussionurl = new \moodle_url('/mod/forum/discuss.php', array('d' => $handlerresult->discussion));
$discussionurl->set_anchor('p' . $handlerresult... | [
"public",
"function",
"get_success_message",
"(",
"\\",
"stdClass",
"$",
"messagedata",
",",
"$",
"handlerresult",
")",
"{",
"$",
"a",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"a",
"->",
"subject",
"=",
"$",
"handlerresult",
"->",
"subject",
";"... | Return the content of any success notification to be sent.
Both an HTML and Plain Text variant must be provided.
@param \stdClass $messagedata The message data.
@param \stdClass $handlerresult The record for the newly created post.
@return \stdClass with keys `html` and `plain`. | [
"Return",
"the",
"content",
"of",
"any",
"success",
"notification",
"to",
"be",
"sent",
".",
"Both",
"an",
"HTML",
"and",
"Plain",
"Text",
"variant",
"must",
"be",
"provided",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/message/inbound/reply_handler.php#L315-L326 |
213,863 | moodle/moodle | enrol/lti/classes/tool_provider.php | tool_provider.onError | protected function onError() {
global $OUTPUT;
$message = $this->message;
if ($this->debugMode && !empty($this->reason)) {
$message = $this->reason;
}
// Display the error message from the provider's side if the consumer has not specified a URL to pass the error to.... | php | protected function onError() {
global $OUTPUT;
$message = $this->message;
if ($this->debugMode && !empty($this->reason)) {
$message = $this->reason;
}
// Display the error message from the provider's side if the consumer has not specified a URL to pass the error to.... | [
"protected",
"function",
"onError",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"message",
"=",
"$",
"this",
"->",
"message",
";",
"if",
"(",
"$",
"this",
"->",
"debugMode",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"reason",
")",
")",
"{",... | Override onError for custom error handling.
@return void | [
"Override",
"onError",
"for",
"custom",
"error",
"handling",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/tool_provider.php#L170-L182 |
213,864 | moodle/moodle | enrol/lti/classes/tool_provider.php | tool_provider.onRegister | protected function onRegister() {
global $PAGE;
if (empty($this->consumer)) {
$this->ok = false;
$this->message = get_string('invalidtoolconsumer', 'enrol_lti');
return;
}
if (empty($this->returnUrl)) {
$this->ok = false;
$thi... | php | protected function onRegister() {
global $PAGE;
if (empty($this->consumer)) {
$this->ok = false;
$this->message = get_string('invalidtoolconsumer', 'enrol_lti');
return;
}
if (empty($this->returnUrl)) {
$this->ok = false;
$thi... | [
"protected",
"function",
"onRegister",
"(",
")",
"{",
"global",
"$",
"PAGE",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"consumer",
")",
")",
"{",
"$",
"this",
"->",
"ok",
"=",
"false",
";",
"$",
"this",
"->",
"message",
"=",
"get_string",
"(... | Override onRegister with registration code. | [
"Override",
"onRegister",
"with",
"registration",
"code",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/tool_provider.php#L388-L428 |
213,865 | moodle/moodle | enrol/lti/classes/tool_provider.php | tool_provider.map_tool_to_consumer | public function map_tool_to_consumer() {
global $DB;
if (empty($this->consumer)) {
throw new moodle_exception('invalidtoolconsumer', 'enrol_lti');
}
// Map the consumer to the tool.
$mappingparams = [
'toolid' => $this->tool->id,
'consumerid'... | php | public function map_tool_to_consumer() {
global $DB;
if (empty($this->consumer)) {
throw new moodle_exception('invalidtoolconsumer', 'enrol_lti');
}
// Map the consumer to the tool.
$mappingparams = [
'toolid' => $this->tool->id,
'consumerid'... | [
"public",
"function",
"map_tool_to_consumer",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"consumer",
")",
")",
"{",
"throw",
"new",
"moodle_exception",
"(",
"'invalidtoolconsumer'",
",",
"'enrol_lti'",
")",
";",
"}... | Performs mapping of the tool consumer to a published tool.
@throws moodle_exception | [
"Performs",
"mapping",
"of",
"the",
"tool",
"consumer",
"to",
"a",
"published",
"tool",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/tool_provider.php#L435-L451 |
213,866 | moodle/moodle | comment/locallib.php | comment_manager.get_comments | function get_comments($page) {
global $DB;
if ($page == 0) {
$start = 0;
} else {
$start = $page * $this->perpage;
}
$comments = array();
$usernamefields = get_all_user_name_fields(true, 'u');
$sql = "SELECT c.id, c.contextid, c.itemid, c... | php | function get_comments($page) {
global $DB;
if ($page == 0) {
$start = 0;
} else {
$start = $page * $this->perpage;
}
$comments = array();
$usernamefields = get_all_user_name_fields(true, 'u');
$sql = "SELECT c.id, c.contextid, c.itemid, c... | [
"function",
"get_comments",
"(",
"$",
"page",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"page",
"==",
"0",
")",
"{",
"$",
"start",
"=",
"0",
";",
"}",
"else",
"{",
"$",
"start",
"=",
"$",
"page",
"*",
"$",
"this",
"->",
"perpage",
"... | Return comments by pages
@global moodle_database $DB
@param int $page
@return array An array of comments | [
"Return",
"comments",
"by",
"pages"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/locallib.php#L54-L88 |
213,867 | moodle/moodle | comment/locallib.php | comment_manager.setup_course | private function setup_course($courseid) {
global $PAGE, $DB;
if (!empty($this->course) && $this->course->id == $courseid) {
// already set, stop
return;
}
if ($courseid == $PAGE->course->id) {
$this->course = $PAGE->course;
} else if (!$this->... | php | private function setup_course($courseid) {
global $PAGE, $DB;
if (!empty($this->course) && $this->course->id == $courseid) {
// already set, stop
return;
}
if ($courseid == $PAGE->course->id) {
$this->course = $PAGE->course;
} else if (!$this->... | [
"private",
"function",
"setup_course",
"(",
"$",
"courseid",
")",
"{",
"global",
"$",
"PAGE",
",",
"$",
"DB",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"course",
")",
"&&",
"$",
"this",
"->",
"course",
"->",
"id",
"==",
"$",
"courseid",... | Records the course object
@global moodle_page $PAGE
@global moodle_database $DB
@param int $courseid | [
"Records",
"the",
"course",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/locallib.php#L97-L108 |
213,868 | moodle/moodle | comment/locallib.php | comment_manager.setup_plugin | private function setup_plugin($comment) {
global $DB;
$this->context = context::instance_by_id($comment->contextid, IGNORE_MISSING);
if (!$this->context) {
return false;
}
switch ($this->context->contextlevel) {
case CONTEXT_BLOCK:
if ($blo... | php | private function setup_plugin($comment) {
global $DB;
$this->context = context::instance_by_id($comment->contextid, IGNORE_MISSING);
if (!$this->context) {
return false;
}
switch ($this->context->contextlevel) {
case CONTEXT_BLOCK:
if ($blo... | [
"private",
"function",
"setup_plugin",
"(",
"$",
"comment",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"context",
"=",
"context",
"::",
"instance_by_id",
"(",
"$",
"comment",
"->",
"contextid",
",",
"IGNORE_MISSING",
")",
";",
"if",
"(",
"!",... | Sets up the module or block information for a comment
@global moodle_database $DB
@param stdClass $comment
@return bool | [
"Sets",
"up",
"the",
"module",
"or",
"block",
"information",
"for",
"a",
"comment"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/locallib.php#L117-L141 |
213,869 | moodle/moodle | comment/locallib.php | comment_manager.get_component_comments_since | public function get_component_comments_since($course, $context, $component, $since, $cm = null) {
global $DB;
$commentssince = array();
$where = 'contextid = ? AND component = ? AND timecreated > ?';
$comments = $DB->get_records_select('comments', $where, array($context->id, $component,... | php | public function get_component_comments_since($course, $context, $component, $since, $cm = null) {
global $DB;
$commentssince = array();
$where = 'contextid = ? AND component = ? AND timecreated > ?';
$comments = $DB->get_records_select('comments', $where, array($context->id, $component,... | [
"public",
"function",
"get_component_comments_since",
"(",
"$",
"course",
",",
"$",
"context",
",",
"$",
"component",
",",
"$",
"since",
",",
"$",
"cm",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"commentssince",
"=",
"array",
"(",
")",
";",... | Get comments created since a given time.
@param stdClass $course course object
@param stdClass $context context object
@param string $component component name
@param int $since the time to check
@param stdClass $cm course module object
@return array list of comments db records since the giv... | [
"Get",
"comments",
"created",
"since",
"a",
"given",
"time",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/locallib.php#L234-L267 |
213,870 | moodle/moodle | lib/google/curlio.php | moodle_google_curlio.do_request | private function do_request($curl, $request) {
$url = $request->getUrl();
$method = $request->getRequestMethod();
switch (strtoupper($method)) {
case 'POST':
$ret = $curl->post($url, $request->getPostBody());
break;
case 'GET':
... | php | private function do_request($curl, $request) {
$url = $request->getUrl();
$method = $request->getRequestMethod();
switch (strtoupper($method)) {
case 'POST':
$ret = $curl->post($url, $request->getPostBody());
break;
case 'GET':
... | [
"private",
"function",
"do_request",
"(",
"$",
"curl",
",",
"$",
"request",
")",
"{",
"$",
"url",
"=",
"$",
"request",
"->",
"getUrl",
"(",
")",
";",
"$",
"method",
"=",
"$",
"request",
"->",
"getRequestMethod",
"(",
")",
";",
"switch",
"(",
"strtoup... | Send the request via our curl object.
@param curl $curl prepared curl object.
@param Google_HttpRequest $request The request.
@return string result of the request. | [
"Send",
"the",
"request",
"via",
"our",
"curl",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/curlio.php#L54-L75 |
213,871 | moodle/moodle | lib/google/curlio.php | moodle_google_curlio.executeRequest | public function executeRequest(Google_Http_Request $request) {
$curl = new curl();
if ($request->getPostBody()) {
$curl->setopt(array('CURLOPT_POSTFIELDS' => $request->getPostBody()));
}
$requestHeaders = $request->getRequestHeaders();
if ($requestHeaders && is_arra... | php | public function executeRequest(Google_Http_Request $request) {
$curl = new curl();
if ($request->getPostBody()) {
$curl->setopt(array('CURLOPT_POSTFIELDS' => $request->getPostBody()));
}
$requestHeaders = $request->getRequestHeaders();
if ($requestHeaders && is_arra... | [
"public",
"function",
"executeRequest",
"(",
"Google_Http_Request",
"$",
"request",
")",
"{",
"$",
"curl",
"=",
"new",
"curl",
"(",
")",
";",
"if",
"(",
"$",
"request",
"->",
"getPostBody",
"(",
")",
")",
"{",
"$",
"curl",
"->",
"setopt",
"(",
"array",... | Execute an API request.
This is a copy/paste from the parent class that uses Moodle's implementation
of curl. Portions have been removed or altered.
@param Google_Http_Request $request the http request to be executed
@return Google_Http_Request http request with the response http code, response
headers and response b... | [
"Execute",
"an",
"API",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/curlio.php#L88-L133 |
213,872 | moodle/moodle | lib/google/curlio.php | moodle_google_curlio.get_option_name_from_constant | public function get_option_name_from_constant($constant) {
if (is_null(self::$constants)) {
$constants = get_defined_constants(true);
$constants = isset($constants['curl']) ? $constants['curl'] : array();
$constants = array_flip($constants);
self::$constants = $co... | php | public function get_option_name_from_constant($constant) {
if (is_null(self::$constants)) {
$constants = get_defined_constants(true);
$constants = isset($constants['curl']) ? $constants['curl'] : array();
$constants = array_flip($constants);
self::$constants = $co... | [
"public",
"function",
"get_option_name_from_constant",
"(",
"$",
"constant",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"constants",
")",
")",
"{",
"$",
"constants",
"=",
"get_defined_constants",
"(",
"true",
")",
";",
"$",
"constants",
"=",
"... | Return the name of an option based on the constant value.
@param int $constant value of a CURL constant.
@return string name of the constant if found, or throws exception.
@throws coding_exception when the constant is not found.
@since Moodle 2.5 | [
"Return",
"the",
"name",
"of",
"an",
"option",
"based",
"on",
"the",
"constant",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/curlio.php#L191-L202 |
213,873 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Data/Format/List.php | Horde_Imap_Client_Data_Format_List.add | public function add($data, $merge = false)
{
if (is_array($data) || ($merge && ($data instanceof Traversable))) {
foreach ($data as $val) {
$this->add($val);
}
} elseif (is_object($data)) {
$this->_data[] = $data;
} elseif (!is_null($data))... | php | public function add($data, $merge = false)
{
if (is_array($data) || ($merge && ($data instanceof Traversable))) {
foreach ($data as $val) {
$this->add($val);
}
} elseif (is_object($data)) {
$this->_data[] = $data;
} elseif (!is_null($data))... | [
"public",
"function",
"add",
"(",
"$",
"data",
",",
"$",
"merge",
"=",
"false",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
"||",
"(",
"$",
"merge",
"&&",
"(",
"$",
"data",
"instanceof",
"Traversable",
")",
")",
")",
"{",
"foreach",
"... | Add an element to the list.
@param mixed $data The data element(s) to add. Either a
Horde_Imap_Client_Data_Format object, a string
value that will be treated as an IMAP atom, or
an array (or iterable object) of objects to add.
@param boolean $merge Merge the contents of any container objects,
instead of adding th... | [
"Add",
"an",
"element",
"to",
"the",
"list",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Data/Format/List.php#L51-L64 |
213,874 | moodle/moodle | lib/simplepie/library/SimplePie/IRI.php | SimplePie_IRI.get_iauthority | protected function get_iauthority()
{
if ($this->iuserinfo !== null || $this->ihost !== null || $this->port !== null)
{
$iauthority = '';
if ($this->iuserinfo !== null)
{
$iauthority .= $this->iuserinfo . '@';
}
if ($this->ihost !== null)
{
$iauthority .= $this->ihost;
}
if ($this->... | php | protected function get_iauthority()
{
if ($this->iuserinfo !== null || $this->ihost !== null || $this->port !== null)
{
$iauthority = '';
if ($this->iuserinfo !== null)
{
$iauthority .= $this->iuserinfo . '@';
}
if ($this->ihost !== null)
{
$iauthority .= $this->ihost;
}
if ($this->... | [
"protected",
"function",
"get_iauthority",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"iuserinfo",
"!==",
"null",
"||",
"$",
"this",
"->",
"ihost",
"!==",
"null",
"||",
"$",
"this",
"->",
"port",
"!==",
"null",
")",
"{",
"$",
"iauthority",
"=",
"''... | Get the complete iauthority
@return string | [
"Get",
"the",
"complete",
"iauthority"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/IRI.php#L1219-L1242 |
213,875 | moodle/moodle | lib/classes/output/mustache_template_finder.php | mustache_template_finder.get_template_directories_for_component | public static function get_template_directories_for_component($component, $themename = '') {
global $CFG, $PAGE;
// Default the param.
if ($themename == '') {
$themename = $PAGE->theme->name;
}
// Clean params for safety.
$component = clean_param($component,... | php | public static function get_template_directories_for_component($component, $themename = '') {
global $CFG, $PAGE;
// Default the param.
if ($themename == '') {
$themename = $PAGE->theme->name;
}
// Clean params for safety.
$component = clean_param($component,... | [
"public",
"static",
"function",
"get_template_directories_for_component",
"(",
"$",
"component",
",",
"$",
"themename",
"=",
"''",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"// Default the param.",
"if",
"(",
"$",
"themename",
"==",
"''",
")",
"... | Helper function for getting a list of valid template directories for a specific component.
@param string $component The component to search
@param string $themename The current theme name
@return string[] List of valid directories for templates for this compoonent. Directories are not checked for existence. | [
"Helper",
"function",
"for",
"getting",
"a",
"list",
"of",
"valid",
"template",
"directories",
"for",
"a",
"specific",
"component",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/output/mustache_template_finder.php#L49-L94 |
213,876 | moodle/moodle | lib/classes/output/mustache_template_finder.php | mustache_template_finder.get_template_filepath | public static function get_template_filepath($name, $themename = '') {
global $CFG, $PAGE;
if (strpos($name, '/') === false) {
throw new coding_exception('Templates names must be specified as "componentname/templatename"' .
' (' . s($name) . ' requeste... | php | public static function get_template_filepath($name, $themename = '') {
global $CFG, $PAGE;
if (strpos($name, '/') === false) {
throw new coding_exception('Templates names must be specified as "componentname/templatename"' .
' (' . s($name) . ' requeste... | [
"public",
"static",
"function",
"get_template_filepath",
"(",
"$",
"name",
",",
"$",
"themename",
"=",
"''",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"if",
"(",
"strpos",
"(",
"$",
"name",
",",
"'/'",
")",
"===",
"false",
")",
"{",
"t... | Helper function for getting a filename for a template from the template name.
@param string $name - This is the componentname/templatename combined.
@param string $themename - This is the current theme name.
@return string | [
"Helper",
"function",
"for",
"getting",
"a",
"filename",
"for",
"a",
"template",
"from",
"the",
"template",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/output/mustache_template_finder.php#L103-L126 |
213,877 | moodle/moodle | admin/tool/policy/classes/output/renderer.php | renderer.render | public function render(renderable $widget) {
$namespacedclassname = get_class($widget);
$plainclassname = preg_replace('/^.*\\\/', '', $namespacedclassname);
$rendermethod = 'render_'.$plainclassname;
if (method_exists($this, $rendermethod)) {
// Explicit rendering method e... | php | public function render(renderable $widget) {
$namespacedclassname = get_class($widget);
$plainclassname = preg_replace('/^.*\\\/', '', $namespacedclassname);
$rendermethod = 'render_'.$plainclassname;
if (method_exists($this, $rendermethod)) {
// Explicit rendering method e... | [
"public",
"function",
"render",
"(",
"renderable",
"$",
"widget",
")",
"{",
"$",
"namespacedclassname",
"=",
"get_class",
"(",
"$",
"widget",
")",
";",
"$",
"plainclassname",
"=",
"preg_replace",
"(",
"'/^.*\\\\\\/'",
",",
"''",
",",
"$",
"namespacedclassname"... | Overrides the parent so that templatable widgets are handled even without their explicit render method.
@param renderable $widget
@return string | [
"Overrides",
"the",
"parent",
"so",
"that",
"templatable",
"widgets",
"are",
"handled",
"even",
"without",
"their",
"explicit",
"render",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/output/renderer.php#L49-L70 |
213,878 | moodle/moodle | lib/portfolio/formats.php | portfolio_format.make_tag | public static function make_tag($file, $path, $attributes) {
$srcattr = 'href';
$tag = 'a';
$content = $file->get_filename();
if (in_array($file->get_mimetype(), portfolio_format_image::mimetypes())) {
$srcattr = 'src';
$tag = 'img';
$content =... | php | public static function make_tag($file, $path, $attributes) {
$srcattr = 'href';
$tag = 'a';
$content = $file->get_filename();
if (in_array($file->get_mimetype(), portfolio_format_image::mimetypes())) {
$srcattr = 'src';
$tag = 'img';
$content =... | [
"public",
"static",
"function",
"make_tag",
"(",
"$",
"file",
",",
"$",
"path",
",",
"$",
"attributes",
")",
"{",
"$",
"srcattr",
"=",
"'href'",
";",
"$",
"tag",
"=",
"'a'",
";",
"$",
"content",
"=",
"$",
"file",
"->",
"get_filename",
"(",
")",
";"... | Create portfolio tag
@param stored_file $file file information object
@param string $path file path
@param array $attributes portfolio attributes
@return string | [
"Create",
"portfolio",
"tag"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/formats.php#L91-L115 |
213,879 | moodle/moodle | lib/portfolio/formats.php | portfolio_format_leap2a.file_output | public static function file_output($file, $options=null) {
$id = '';
if (!is_array($options)) {
$options = array();
}
if (!array_key_exists('entry', $options)) {
$options['entry'] = true;
}
if (!empty($options['entry'])) {
$path = 'port... | php | public static function file_output($file, $options=null) {
$id = '';
if (!is_array($options)) {
$options = array();
}
if (!array_key_exists('entry', $options)) {
$options['entry'] = true;
}
if (!empty($options['entry'])) {
$path = 'port... | [
"public",
"static",
"function",
"file_output",
"(",
"$",
"file",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"id",
"=",
"''",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
")",
"{",
"$",
"options",
"=",
"array",
"(",
")",
";",
... | Return the link to a file
@param stored_file $file information for existing file
@param array $options array of options to pass. can contain:
attributes => hash of existing html attributes (eg title, height, width, etc)
@return string | [
"Return",
"the",
"link",
"to",
"a",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/formats.php#L469-L488 |
213,880 | moodle/moodle | mod/wiki/classes/search/collaborative_page.php | collaborative_page.get_document_recordset | public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
global $DB;
list ($contextjoin, $contextparams) = $this->get_context_restriction_sql(
$context, 'wiki', 'w');
if ($contextjoin === null) {
return null;
}
$sql = "SE... | php | public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
global $DB;
list ($contextjoin, $contextparams) = $this->get_context_restriction_sql(
$context, 'wiki', 'w');
if ($contextjoin === null) {
return null;
}
$sql = "SE... | [
"public",
"function",
"get_document_recordset",
"(",
"$",
"modifiedfrom",
"=",
"0",
",",
"\\",
"context",
"$",
"context",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"contextjoin",
",",
"$",
"contextparams",
")",
"=",
"$",
"this",
... | Returns a recordset with all required page information.
@param int $modifiedfrom
@param \context|null $context Optional context to restrict scope of returned results
@return moodle_recordset|null Recordset (or null if no results) | [
"Returns",
"a",
"recordset",
"with",
"all",
"required",
"page",
"information",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/classes/search/collaborative_page.php#L51-L70 |
213,881 | moodle/moodle | mod/wiki/classes/search/collaborative_page.php | collaborative_page.get_document | public function get_document($record, $options = array()) {
try {
$cm = $this->get_cm('wiki', $record->wikiid, $record->courseid);
$context = \context_module::instance($cm->id);
} catch (\dml_missing_record_exception $ex) {
// Notify it as we run here as admin, we sho... | php | public function get_document($record, $options = array()) {
try {
$cm = $this->get_cm('wiki', $record->wikiid, $record->courseid);
$context = \context_module::instance($cm->id);
} catch (\dml_missing_record_exception $ex) {
// Notify it as we run here as admin, we sho... | [
"public",
"function",
"get_document",
"(",
"$",
"record",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"$",
"cm",
"=",
"$",
"this",
"->",
"get_cm",
"(",
"'wiki'",
",",
"$",
"record",
"->",
"wikiid",
",",
"$",
"record",
"->",
... | Returns the document for a particular page.
@param \stdClass $record A record containing, at least, the indexed document id and a modified timestamp
@param array $options Options for document creation
@return \core_search\document | [
"Returns",
"the",
"document",
"for",
"a",
"particular",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/classes/search/collaborative_page.php#L79-L127 |
213,882 | moodle/moodle | lib/tcpdf/tcpdf_barcodes_2d.php | TCPDF2DBarcode.getBarcodeSVG | public function getBarcodeSVG($w=3, $h=3, $color='black') {
// send headers
$code = $this->getBarcodeSVGcode($w, $h, $color);
header('Content-Type: application/svg+xml');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:0... | php | public function getBarcodeSVG($w=3, $h=3, $color='black') {
// send headers
$code = $this->getBarcodeSVGcode($w, $h, $color);
header('Content-Type: application/svg+xml');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:0... | [
"public",
"function",
"getBarcodeSVG",
"(",
"$",
"w",
"=",
"3",
",",
"$",
"h",
"=",
"3",
",",
"$",
"color",
"=",
"'black'",
")",
"{",
"// send headers",
"$",
"code",
"=",
"$",
"this",
"->",
"getBarcodeSVGcode",
"(",
"$",
"w",
",",
"$",
"h",
",",
... | Send barcode as SVG image object to the standard output.
@param $w (int) Width of a single rectangle element in user units.
@param $h (int) Height of a single rectangle element in user units.
@param $color (string) Foreground color (in SVG format) for bar elements (background is transparent).
@public | [
"Send",
"barcode",
"as",
"SVG",
"image",
"object",
"to",
"the",
"standard",
"output",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tcpdf/tcpdf_barcodes_2d.php#L87-L98 |
213,883 | moodle/moodle | lib/phpexcel/PHPExcel/Style/Alignment.php | PHPExcel_Style_Alignment.setReadorder | public function setReadorder($pValue = 0)
{
if ($pValue < 0 || $pValue > 2) {
$pValue = 0;
}
if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(array('readorder' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFr... | php | public function setReadorder($pValue = 0)
{
if ($pValue < 0 || $pValue > 2) {
$pValue = 0;
}
if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(array('readorder' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFr... | [
"public",
"function",
"setReadorder",
"(",
"$",
"pValue",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"pValue",
"<",
"0",
"||",
"$",
"pValue",
">",
"2",
")",
"{",
"$",
"pValue",
"=",
"0",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isSupervisor",
")",
"{"... | Set read order
@param int $pValue
@return PHPExcel_Style_Alignment | [
"Set",
"read",
"order"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Style/Alignment.php#L429-L441 |
213,884 | moodle/moodle | mod/quiz/classes/admin_review_setting.php | mod_quiz_admin_review_setting.times | protected static function times() {
return array(
self::DURING => get_string('reviewduring', 'quiz'),
self::IMMEDIATELY_AFTER => get_string('reviewimmediately', 'quiz'),
self::LATER_WHILE_OPEN => get_string('reviewopen', 'quiz'),
self::AFTER_CLOSE ... | php | protected static function times() {
return array(
self::DURING => get_string('reviewduring', 'quiz'),
self::IMMEDIATELY_AFTER => get_string('reviewimmediately', 'quiz'),
self::LATER_WHILE_OPEN => get_string('reviewopen', 'quiz'),
self::AFTER_CLOSE ... | [
"protected",
"static",
"function",
"times",
"(",
")",
"{",
"return",
"array",
"(",
"self",
"::",
"DURING",
"=>",
"get_string",
"(",
"'reviewduring'",
",",
"'quiz'",
")",
",",
"self",
"::",
"IMMEDIATELY_AFTER",
"=>",
"get_string",
"(",
"'reviewimmediately'",
",... | Get an array of the names of all the possible times.
@return array an array of time constant => lang string. | [
"Get",
"an",
"array",
"of",
"the",
"names",
"of",
"all",
"the",
"possible",
"times",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/admin_review_setting.php#L111-L118 |
213,885 | moodle/moodle | admin/tool/dataprivacy/classes/category.php | category.is_used | public function is_used() {
if (\tool_dataprivacy\contextlevel::is_category_used($this->get('id')) ||
\tool_dataprivacy\context_instance::is_category_used($this->get('id'))) {
return true;
}
$pluginconfig = get_config('tool_dataprivacy');
$levels = \context_... | php | public function is_used() {
if (\tool_dataprivacy\contextlevel::is_category_used($this->get('id')) ||
\tool_dataprivacy\context_instance::is_category_used($this->get('id'))) {
return true;
}
$pluginconfig = get_config('tool_dataprivacy');
$levels = \context_... | [
"public",
"function",
"is_used",
"(",
")",
"{",
"if",
"(",
"\\",
"tool_dataprivacy",
"\\",
"contextlevel",
"::",
"is_category_used",
"(",
"$",
"this",
"->",
"get",
"(",
"'id'",
")",
")",
"||",
"\\",
"tool_dataprivacy",
"\\",
"context_instance",
"::",
"is_cat... | Is this category used?.
@return null | [
"Is",
"this",
"category",
"used?",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/category.php#L72-L90 |
213,886 | moodle/moodle | cohort/upload_form.php | cohort_upload_form.definition_after_data | public function definition_after_data() {
$mform = $this->_form;
$cohortfile = $mform->getElementValue('cohortfile');
$allowsubmitform = false;
if ($cohortfile && ($file = $this->get_cohort_file($cohortfile))) {
// File was uploaded. Parse it.
$encoding = $mform->... | php | public function definition_after_data() {
$mform = $this->_form;
$cohortfile = $mform->getElementValue('cohortfile');
$allowsubmitform = false;
if ($cohortfile && ($file = $this->get_cohort_file($cohortfile))) {
// File was uploaded. Parse it.
$encoding = $mform->... | [
"public",
"function",
"definition_after_data",
"(",
")",
"{",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"$",
"cohortfile",
"=",
"$",
"mform",
"->",
"getElementValue",
"(",
"'cohortfile'",
")",
";",
"$",
"allowsubmitform",
"=",
"false",
";",
"if",... | Process the uploaded file and allow the submit button only if it doest not have errors. | [
"Process",
"the",
"uploaded",
"file",
"and",
"allow",
"the",
"submit",
"button",
"only",
"if",
"it",
"doest",
"not",
"have",
"errors",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cohort/upload_form.php#L108-L133 |
213,887 | moodle/moodle | cohort/upload_form.php | cohort_upload_form.get_context_options | protected function get_context_options() {
if ($this->contextoptions === null) {
$this->contextoptions = array();
$displaylist = core_course_category::make_categories_list('moodle/cohort:manage');
// We need to index the options array by context id instead of category id and ... | php | protected function get_context_options() {
if ($this->contextoptions === null) {
$this->contextoptions = array();
$displaylist = core_course_category::make_categories_list('moodle/cohort:manage');
// We need to index the options array by context id instead of category id and ... | [
"protected",
"function",
"get_context_options",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"contextoptions",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"contextoptions",
"=",
"array",
"(",
")",
";",
"$",
"displaylist",
"=",
"core_course_category",
"::",
... | Returns the list of contexts where current user can create cohorts.
@return array | [
"Returns",
"the",
"list",
"of",
"contexts",
"where",
"current",
"user",
"can",
"create",
"cohorts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cohort/upload_form.php#L140-L155 |
213,888 | moodle/moodle | cohort/upload_form.php | cohort_upload_form.get_cohort_file | protected function get_cohort_file($draftid) {
global $USER;
// We can not use moodleform::get_file_content() method because we need the content before the form is validated.
if (!$draftid) {
return null;
}
$fs = get_file_storage();
$context = context_user::in... | php | protected function get_cohort_file($draftid) {
global $USER;
// We can not use moodleform::get_file_content() method because we need the content before the form is validated.
if (!$draftid) {
return null;
}
$fs = get_file_storage();
$context = context_user::in... | [
"protected",
"function",
"get_cohort_file",
"(",
"$",
"draftid",
")",
"{",
"global",
"$",
"USER",
";",
"// We can not use moodleform::get_file_content() method because we need the content before the form is validated.",
"if",
"(",
"!",
"$",
"draftid",
")",
"{",
"return",
"n... | Returns the uploaded file if it is present.
@param int $draftid
@return stored_file|null | [
"Returns",
"the",
"uploaded",
"file",
"if",
"it",
"is",
"present",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cohort/upload_form.php#L178-L193 |
213,889 | moodle/moodle | cohort/upload_form.php | cohort_upload_form.get_cohorts_data | public function get_cohorts_data() {
$cohorts = array();
if ($this->processeddata) {
foreach ($this->processeddata as $idx => $line) {
if ($idx && !empty($line['data'])) {
$cohorts[] = (object)$line['data'];
}
}
}
... | php | public function get_cohorts_data() {
$cohorts = array();
if ($this->processeddata) {
foreach ($this->processeddata as $idx => $line) {
if ($idx && !empty($line['data'])) {
$cohorts[] = (object)$line['data'];
}
}
}
... | [
"public",
"function",
"get_cohorts_data",
"(",
")",
"{",
"$",
"cohorts",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"processeddata",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"processeddata",
"as",
"$",
"idx",
"=>",
"$",
"line",
")... | Returns the list of prepared objects to be added as cohorts
@return array of stdClass objects, each can be passed to {@link cohort_add_cohort()} | [
"Returns",
"the",
"list",
"of",
"prepared",
"objects",
"to",
"be",
"added",
"as",
"cohorts"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cohort/upload_form.php#L200-L210 |
213,890 | moodle/moodle | cohort/upload_form.php | cohort_upload_form.preview_uploaded_cohorts | protected function preview_uploaded_cohorts() {
global $OUTPUT;
if (empty($this->processeddata)) {
return;
}
foreach ($this->processeddata[0]['errors'] as $error) {
echo $OUTPUT->notification($error);
}
foreach ($this->processeddata[0]['warnings'] ... | php | protected function preview_uploaded_cohorts() {
global $OUTPUT;
if (empty($this->processeddata)) {
return;
}
foreach ($this->processeddata[0]['errors'] as $error) {
echo $OUTPUT->notification($error);
}
foreach ($this->processeddata[0]['warnings'] ... | [
"protected",
"function",
"preview_uploaded_cohorts",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"processeddata",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"processeddata",
"[",
"0"... | Displays the preview of the uploaded file | [
"Displays",
"the",
"preview",
"of",
"the",
"uploaded",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cohort/upload_form.php#L215-L270 |
213,891 | moodle/moodle | cohort/upload_form.php | cohort_upload_form.get_previewed_rows | protected function get_previewed_rows() {
$previewlimit = 10;
if (count($this->processeddata) <= 1) {
$rows = array();
} else if (count($this->processeddata) < $previewlimit + 1) {
// Return all rows.
$rows = range(1, count($this->processeddata) - 1);
... | php | protected function get_previewed_rows() {
$previewlimit = 10;
if (count($this->processeddata) <= 1) {
$rows = array();
} else if (count($this->processeddata) < $previewlimit + 1) {
// Return all rows.
$rows = range(1, count($this->processeddata) - 1);
... | [
"protected",
"function",
"get_previewed_rows",
"(",
")",
"{",
"$",
"previewlimit",
"=",
"10",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"processeddata",
")",
"<=",
"1",
")",
"{",
"$",
"rows",
"=",
"array",
"(",
")",
";",
"}",
"else",
"if",
"... | Find up rows to show in preview
Number of previewed rows is limited but rows with errors and warnings have priority.
@return array | [
"Find",
"up",
"rows",
"to",
"show",
"in",
"preview"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cohort/upload_form.php#L279-L312 |
213,892 | moodle/moodle | cohort/upload_form.php | cohort_upload_form.clean_cohort_data | protected function clean_cohort_data(&$hash) {
foreach ($hash as $key => $value) {
switch ($key) {
case 'contextid': $hash[$key] = clean_param($value, PARAM_INT); break;
case 'name': $hash[$key] = core_text::substr(clean_param($value, PARAM_TEXT), 0, 254); break;
... | php | protected function clean_cohort_data(&$hash) {
foreach ($hash as $key => $value) {
switch ($key) {
case 'contextid': $hash[$key] = clean_param($value, PARAM_INT); break;
case 'name': $hash[$key] = core_text::substr(clean_param($value, PARAM_TEXT), 0, 254); break;
... | [
"protected",
"function",
"clean_cohort_data",
"(",
"&",
"$",
"hash",
")",
"{",
"foreach",
"(",
"$",
"hash",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"key",
")",
"{",
"case",
"'contextid'",
":",
"$",
"hash",
"[",
"$",
"key... | Cleans input data about one cohort.
@param array $hash | [
"Cleans",
"input",
"data",
"about",
"one",
"cohort",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cohort/upload_form.php#L453-L479 |
213,893 | moodle/moodle | lib/jabber/XMPP/XMPP_Old.php | XMPPHP_XMPPOld.startXML | public function startXML($parser, $name, $attr) {
if($this->xml_depth == 0) {
$this->session_id = $attr['ID'];
$this->authenticate();
}
parent::startXML($parser, $name, $attr);
} | php | public function startXML($parser, $name, $attr) {
if($this->xml_depth == 0) {
$this->session_id = $attr['ID'];
$this->authenticate();
}
parent::startXML($parser, $name, $attr);
} | [
"public",
"function",
"startXML",
"(",
"$",
"parser",
",",
"$",
"name",
",",
"$",
"attr",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"xml_depth",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"session_id",
"=",
"$",
"attr",
"[",
"'ID'",
"]",
";",
"$",
"... | Override XMLStream's startXML
@param parser $parser
@param string $name
@param array $attr | [
"Override",
"XMLStream",
"s",
"startXML"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMPP_Old.php#L59-L65 |
213,894 | moodle/moodle | lib/jabber/XMPP/XMPP_Old.php | XMPPHP_XMPPOld.authFieldsHandler | public function authFieldsHandler($xml) {
$id = $this->getId();
$this->addidhandler($id, 'oldAuthResultHandler');
if($xml->sub('query')->hasSub('digest')) {
$hash = sha1($this->session_id . $this->password);
print "{$this->session_id} {$this->password}\n";
$out = "<iq type='set' id='$id'><query xml... | php | public function authFieldsHandler($xml) {
$id = $this->getId();
$this->addidhandler($id, 'oldAuthResultHandler');
if($xml->sub('query')->hasSub('digest')) {
$hash = sha1($this->session_id . $this->password);
print "{$this->session_id} {$this->password}\n";
$out = "<iq type='set' id='$id'><query xml... | [
"public",
"function",
"authFieldsHandler",
"(",
"$",
"xml",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"$",
"this",
"->",
"addidhandler",
"(",
"$",
"id",
",",
"'oldAuthResultHandler'",
")",
";",
"if",
"(",
"$",
"xml",
"->",
... | Retrieve auth fields and send auth attempt
@param XMLObj $xml | [
"Retrieve",
"auth",
"fields",
"and",
"send",
"auth",
"attempt"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMPP_Old.php#L82-L94 |
213,895 | moodle/moodle | lib/jabber/XMPP/XMPP_Old.php | XMPPHP_XMPPOld.oldAuthResultHandler | public function oldAuthResultHandler($xml) {
if($xml->attrs['type'] != 'result') {
$this->log->log("Auth failed!", XMPPHP_Log::LEVEL_ERROR);
$this->disconnect();
throw new XMPPHP_Exception('Auth failed!');
} else {
$this->log->log("Session started");
$this->event('session_start');
}
} | php | public function oldAuthResultHandler($xml) {
if($xml->attrs['type'] != 'result') {
$this->log->log("Auth failed!", XMPPHP_Log::LEVEL_ERROR);
$this->disconnect();
throw new XMPPHP_Exception('Auth failed!');
} else {
$this->log->log("Session started");
$this->event('session_start');
}
} | [
"public",
"function",
"oldAuthResultHandler",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"$",
"xml",
"->",
"attrs",
"[",
"'type'",
"]",
"!=",
"'result'",
")",
"{",
"$",
"this",
"->",
"log",
"->",
"log",
"(",
"\"Auth failed!\"",
",",
"XMPPHP_Log",
"::",
"LEV... | Determine authenticated or failure
@param XMLObj $xml | [
"Determine",
"authenticated",
"or",
"failure"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMPP_Old.php#L101-L110 |
213,896 | moodle/moodle | lib/pear/HTML/QuickForm/select.php | HTML_QuickForm_select.setSelected | function setSelected($values)
{
if (is_string($values) && $this->getMultiple()) {
$values = preg_split("/[ ]?,[ ]?/", $values);
}
if (is_array($values)) {
$this->_values = array_values($values);
} else {
$this->_values = array($values);
}
... | php | function setSelected($values)
{
if (is_string($values) && $this->getMultiple()) {
$values = preg_split("/[ ]?,[ ]?/", $values);
}
if (is_array($values)) {
$this->_values = array_values($values);
} else {
$this->_values = array($values);
}
... | [
"function",
"setSelected",
"(",
"$",
"values",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"values",
")",
"&&",
"$",
"this",
"->",
"getMultiple",
"(",
")",
")",
"{",
"$",
"values",
"=",
"preg_split",
"(",
"\"/[ ]?,[ ]?/\"",
",",
"$",
"values",
")",
"... | Sets the default values of the select box
@param mixed $values Array or comma delimited string of selected values
@since 1.0
@access public
@return void | [
"Sets",
"the",
"default",
"values",
"of",
"the",
"select",
"box"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/select.php#L114-L124 |
213,897 | moodle/moodle | lib/pear/HTML/QuickForm/select.php | HTML_QuickForm_select.loadDbResult | function loadDbResult(&$result, $textCol=null, $valueCol=null, $values=null)
{
if (!is_object($result) || !is_a($result, 'db_result')) {
return self::raiseError('Argument 1 of HTML_Select::loadDbResult is not a valid DB_result');
}
if (isset($values)) {
$this->setValu... | php | function loadDbResult(&$result, $textCol=null, $valueCol=null, $values=null)
{
if (!is_object($result) || !is_a($result, 'db_result')) {
return self::raiseError('Argument 1 of HTML_Select::loadDbResult is not a valid DB_result');
}
if (isset($values)) {
$this->setValu... | [
"function",
"loadDbResult",
"(",
"&",
"$",
"result",
",",
"$",
"textCol",
"=",
"null",
",",
"$",
"valueCol",
"=",
"null",
",",
"$",
"values",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"result",
")",
"||",
"!",
"is_a",
"(",
"$"... | Loads the options from DB_result object
If no column names are specified the first two columns of the result are
used as the text and value columns respectively
@param object $result DB_result object
@param string $textCol (optional) Name of column to display as the OPTION text
@param string ... | [
"Loads",
"the",
"options",
"from",
"DB_result",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/select.php#L367-L384 |
213,898 | moodle/moodle | lib/pear/HTML/QuickForm/select.php | HTML_QuickForm_select.loadQuery | function loadQuery(&$conn, $sql, $textCol=null, $valueCol=null, $values=null)
{
if (is_string($conn)) {
require_once('DB.php');
$dbConn = &DB::connect($conn, true);
if (DB::isError($dbConn)) {
return $dbConn;
}
} elseif (is_subclass_of(... | php | function loadQuery(&$conn, $sql, $textCol=null, $valueCol=null, $values=null)
{
if (is_string($conn)) {
require_once('DB.php');
$dbConn = &DB::connect($conn, true);
if (DB::isError($dbConn)) {
return $dbConn;
}
} elseif (is_subclass_of(... | [
"function",
"loadQuery",
"(",
"&",
"$",
"conn",
",",
"$",
"sql",
",",
"$",
"textCol",
"=",
"null",
",",
"$",
"valueCol",
"=",
"null",
",",
"$",
"values",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"conn",
")",
")",
"{",
"require_onc... | Queries a database and loads the options from the results
@param mixed $conn Either an existing DB connection or a valid dsn
@param string $sql SQL query string
@param string $textCol (optional) Name of column to display as the OPTION text
@param string $valueCol (optiona... | [
"Queries",
"a",
"database",
"and",
"loads",
"the",
"options",
"from",
"the",
"results"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/select.php#L402-L425 |
213,899 | moodle/moodle | lib/pear/HTML/QuickForm/select.php | HTML_QuickForm_select.load | function load(&$options, $param1=null, $param2=null, $param3=null, $param4=null)
{
switch (true) {
case is_array($options):
return $this->loadArray($options, $param1);
break;
case (is_a($options, 'db_result')):
return $this->loadDbResul... | php | function load(&$options, $param1=null, $param2=null, $param3=null, $param4=null)
{
switch (true) {
case is_array($options):
return $this->loadArray($options, $param1);
break;
case (is_a($options, 'db_result')):
return $this->loadDbResul... | [
"function",
"load",
"(",
"&",
"$",
"options",
",",
"$",
"param1",
"=",
"null",
",",
"$",
"param2",
"=",
"null",
",",
"$",
"param3",
"=",
"null",
",",
"$",
"param4",
"=",
"null",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"is_array",
"(",
... | Loads options from different types of data sources
This method is a simulated overloaded method. The arguments, other than the
first are optional and only mean something depending on the type of the first argument.
If the first argument is an array then all arguments are passed in order to loadArray.
If the first arg... | [
"Loads",
"options",
"from",
"different",
"types",
"of",
"data",
"sources"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/select.php#L449-L462 |
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.