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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
215,600 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/Math/Statistic/Covariance.php | Covariance.fromDataset | public static function fromDataset(array $data, int $i, int $k, bool $sample = true, float $meanX = null, float $meanY = null)
{
if (empty($data)) {
throw InvalidArgumentException::arrayCantBeEmpty();
}
$n = count($data);
if ($sample && $n === 1) {
throw Inva... | php | public static function fromDataset(array $data, int $i, int $k, bool $sample = true, float $meanX = null, float $meanY = null)
{
if (empty($data)) {
throw InvalidArgumentException::arrayCantBeEmpty();
}
$n = count($data);
if ($sample && $n === 1) {
throw Inva... | [
"public",
"static",
"function",
"fromDataset",
"(",
"array",
"$",
"data",
",",
"int",
"$",
"i",
",",
"int",
"$",
"k",
",",
"bool",
"$",
"sample",
"=",
"true",
",",
"float",
"$",
"meanX",
"=",
"null",
",",
"float",
"$",
"meanY",
"=",
"null",
")",
... | Calculates covariance of two dimensions, i and k in the given data.
@param array $data
@param int $i
@param int $k
@param bool $sample
@param float $meanX
@param float $meanY
@return float
@throws InvalidArgumentException
@throws \Exception | [
"Calculates",
"covariance",
"of",
"two",
"dimensions",
"i",
"and",
"k",
"in",
"the",
"given",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Math/Statistic/Covariance.php#L71-L125 |
215,601 | moodle/moodle | lib/horde/framework/Horde/Support/Inflector.php | Horde_Support_Inflector.pluralize | public function pluralize($word)
{
if ($plural = $this->getCache($word, 'pluralize')) {
return $plural;
}
if (isset($this->_uncountables_keys[$word])) {
return $word;
}
foreach ($this->_pluralizationRules as $regexp => $replacement) {
$pl... | php | public function pluralize($word)
{
if ($plural = $this->getCache($word, 'pluralize')) {
return $plural;
}
if (isset($this->_uncountables_keys[$word])) {
return $word;
}
foreach ($this->_pluralizationRules as $regexp => $replacement) {
$pl... | [
"public",
"function",
"pluralize",
"(",
"$",
"word",
")",
"{",
"if",
"(",
"$",
"plural",
"=",
"$",
"this",
"->",
"getCache",
"(",
"$",
"word",
",",
"'pluralize'",
")",
")",
"{",
"return",
"$",
"plural",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"th... | Singular English word to pluralize.
@param string $word Word to pluralize.
@return string Plural form of $word. | [
"Singular",
"English",
"word",
"to",
"pluralize",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/Inflector.php#L149-L167 |
215,602 | moodle/moodle | lib/horde/framework/Horde/Support/Inflector.php | Horde_Support_Inflector.singularize | public function singularize($word)
{
if ($singular = $this->getCache($word, 'singularize')) {
return $singular;
}
if (isset($this->_uncountables_keys[$word])) {
return $word;
}
foreach ($this->_singularizationRules as $regexp => $replacement) {
... | php | public function singularize($word)
{
if ($singular = $this->getCache($word, 'singularize')) {
return $singular;
}
if (isset($this->_uncountables_keys[$word])) {
return $word;
}
foreach ($this->_singularizationRules as $regexp => $replacement) {
... | [
"public",
"function",
"singularize",
"(",
"$",
"word",
")",
"{",
"if",
"(",
"$",
"singular",
"=",
"$",
"this",
"->",
"getCache",
"(",
"$",
"word",
",",
"'singularize'",
")",
")",
"{",
"return",
"$",
"singular",
";",
"}",
"if",
"(",
"isset",
"(",
"$... | Plural English word to singularize.
@param string $word Word to singularize.
@return string Singular form of $word. | [
"Plural",
"English",
"word",
"to",
"singularize",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/Inflector.php#L176-L194 |
215,603 | moodle/moodle | lib/horde/framework/Horde/Support/Inflector.php | Horde_Support_Inflector.camelize | public function camelize($word, $firstLetter = 'upper')
{
if ($camelized = $this->getCache($word, 'camelize' . $firstLetter)) {
return $camelized;
}
$camelized = $word;
if (Horde_String::lower($camelized) != $camelized &&
strpos($camelized, '_') !== false) {
... | php | public function camelize($word, $firstLetter = 'upper')
{
if ($camelized = $this->getCache($word, 'camelize' . $firstLetter)) {
return $camelized;
}
$camelized = $word;
if (Horde_String::lower($camelized) != $camelized &&
strpos($camelized, '_') !== false) {
... | [
"public",
"function",
"camelize",
"(",
"$",
"word",
",",
"$",
"firstLetter",
"=",
"'upper'",
")",
"{",
"if",
"(",
"$",
"camelized",
"=",
"$",
"this",
"->",
"getCache",
"(",
"$",
"word",
",",
"'camelize'",
".",
"$",
"firstLetter",
")",
")",
"{",
"retu... | Camel-cases a word.
@todo Do we want locale-specific or locale-independent camel casing?
@param string $word The word to camel-case.
@param string $firstLetter Whether to upper or lower case the first.
letter of each slash-separated section.
@return string Camelized $word | [
"Camel",
"-",
"cases",
"a",
"word",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/Inflector.php#L207-L237 |
215,604 | moodle/moodle | lib/horde/framework/Horde/Support/Inflector.php | Horde_Support_Inflector.dasherize | public function dasherize($underscoredWord)
{
if ($result = $this->getCache($underscoredWord, 'dasherize')) {
return $result;
}
$result = str_replace('_', '-', $this->underscore($underscoredWord));
return $this->setCache($underscoredWord, 'dasherize', $result);
} | php | public function dasherize($underscoredWord)
{
if ($result = $this->getCache($underscoredWord, 'dasherize')) {
return $result;
}
$result = str_replace('_', '-', $this->underscore($underscoredWord));
return $this->setCache($underscoredWord, 'dasherize', $result);
} | [
"public",
"function",
"dasherize",
"(",
"$",
"underscoredWord",
")",
"{",
"if",
"(",
"$",
"result",
"=",
"$",
"this",
"->",
"getCache",
"(",
"$",
"underscoredWord",
",",
"'dasherize'",
")",
")",
"{",
"return",
"$",
"result",
";",
"}",
"$",
"result",
"=... | Replaces underscores with dashes in the string.
Example:
1. dasherize("puni_puni") => "puni-puni" | [
"Replaces",
"underscores",
"with",
"dashes",
"in",
"the",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/Inflector.php#L285-L293 |
215,605 | moodle/moodle | lib/horde/framework/Horde/Support/Inflector.php | Horde_Support_Inflector.humanize | public function humanize($lowerCaseAndUnderscoredWord)
{
$word = $lowerCaseAndUnderscoredWord;
if ($result = $this->getCache($word, 'humanize')) {
return $result;
}
$result = ucfirst(str_replace('_', ' ', $this->underscore($word)));
if (substr($result, -3, 3) == ... | php | public function humanize($lowerCaseAndUnderscoredWord)
{
$word = $lowerCaseAndUnderscoredWord;
if ($result = $this->getCache($word, 'humanize')) {
return $result;
}
$result = ucfirst(str_replace('_', ' ', $this->underscore($word)));
if (substr($result, -3, 3) == ... | [
"public",
"function",
"humanize",
"(",
"$",
"lowerCaseAndUnderscoredWord",
")",
"{",
"$",
"word",
"=",
"$",
"lowerCaseAndUnderscoredWord",
";",
"if",
"(",
"$",
"result",
"=",
"$",
"this",
"->",
"getCache",
"(",
"$",
"word",
",",
"'humanize'",
")",
")",
"{"... | Capitalizes the first word and turns underscores into spaces and strips
_id.
Like titleize(), this is meant for creating pretty output.
Examples:
1. humanize("employee_salary") => "Employee salary"
2. humanize("author_id") => "Author" | [
"Capitalizes",
"the",
"first",
"word",
"and",
"turns",
"underscores",
"into",
"spaces",
"and",
"strips",
"_id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/Inflector.php#L305-L317 |
215,606 | moodle/moodle | lib/horde/framework/Horde/Support/Inflector.php | Horde_Support_Inflector.tableize | public function tableize($className)
{
if ($result = $this->getCache($className, 'tableize')) {
return $result;
}
$result = $this->pluralize($this->underscore($className));
$result = str_replace('/', '_', $result);
return $this->setCache($className, 'tableize', $... | php | public function tableize($className)
{
if ($result = $this->getCache($className, 'tableize')) {
return $result;
}
$result = $this->pluralize($this->underscore($className));
$result = str_replace('/', '_', $result);
return $this->setCache($className, 'tableize', $... | [
"public",
"function",
"tableize",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"$",
"result",
"=",
"$",
"this",
"->",
"getCache",
"(",
"$",
"className",
",",
"'tableize'",
")",
")",
"{",
"return",
"$",
"result",
";",
"}",
"$",
"result",
"=",
"$",
"t... | Creates the name of a table like Rails does for models to table names.
This method uses the pluralize() method on the last word in the string.
Examples:
1. tableize("RawScaledScorer") => "raw_scaled_scorers"
2. tableize("egg_and_ham") => "egg_and_hams"
3. tableize("fancyCategory") => "fancy_categories" | [
"Creates",
"the",
"name",
"of",
"a",
"table",
"like",
"Rails",
"does",
"for",
"models",
"to",
"table",
"names",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/Inflector.php#L342-L351 |
215,607 | moodle/moodle | lib/horde/framework/Horde/Support/Inflector.php | Horde_Support_Inflector.classify | public function classify($tableName)
{
if ($result = $this->getCache($tableName, 'classify')) {
return $result;
}
$result = $this->camelize($this->singularize($tableName));
// classes use underscores instead of slashes for namespaces
$result = str_replace('/', '_... | php | public function classify($tableName)
{
if ($result = $this->getCache($tableName, 'classify')) {
return $result;
}
$result = $this->camelize($this->singularize($tableName));
// classes use underscores instead of slashes for namespaces
$result = str_replace('/', '_... | [
"public",
"function",
"classify",
"(",
"$",
"tableName",
")",
"{",
"if",
"(",
"$",
"result",
"=",
"$",
"this",
"->",
"getCache",
"(",
"$",
"tableName",
",",
"'classify'",
")",
")",
"{",
"return",
"$",
"result",
";",
"}",
"$",
"result",
"=",
"$",
"t... | Creates a class name from a table name like Rails does for table names
to models.
Examples:
1. classify("egg_and_hams") => "EggAndHam"
2. classify("post") => "Post" | [
"Creates",
"a",
"class",
"name",
"from",
"a",
"table",
"name",
"like",
"Rails",
"does",
"for",
"table",
"names",
"to",
"models",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/Inflector.php#L361-L371 |
215,608 | moodle/moodle | lib/horde/framework/Horde/Support/Inflector.php | Horde_Support_Inflector.getCache | public function getCache($word, $rule)
{
return isset($this->_cache[$word . '|' . $rule]) ?
$this->_cache[$word . '|' . $rule] : false;
} | php | public function getCache($word, $rule)
{
return isset($this->_cache[$word . '|' . $rule]) ?
$this->_cache[$word . '|' . $rule] : false;
} | [
"public",
"function",
"getCache",
"(",
"$",
"word",
",",
"$",
"rule",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_cache",
"[",
"$",
"word",
".",
"'|'",
".",
"$",
"rule",
"]",
")",
"?",
"$",
"this",
"->",
"_cache",
"[",
"$",
"word",
"... | Retuns a cached inflection.
@return string | false | [
"Retuns",
"a",
"cached",
"inflection",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/Inflector.php#L417-L421 |
215,609 | moodle/moodle | lib/horde/framework/Horde/Support/Inflector.php | Horde_Support_Inflector.setCache | public function setCache($word, $rule, $value)
{
$this->_cache[$word . '|' . $rule] = $value;
return $value;
} | php | public function setCache($word, $rule, $value)
{
$this->_cache[$word . '|' . $rule] = $value;
return $value;
} | [
"public",
"function",
"setCache",
"(",
"$",
"word",
",",
"$",
"rule",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"_cache",
"[",
"$",
"word",
".",
"'|'",
".",
"$",
"rule",
"]",
"=",
"$",
"value",
";",
"return",
"$",
"value",
";",
"}"
] | Caches an inflection.
@param string $word The word being inflected.
@param string $rule The inflection rule.
@param string $value The inflected value of $word.
@return string The inflected value | [
"Caches",
"an",
"inflection",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/Inflector.php#L432-L436 |
215,610 | moodle/moodle | mod/forum/classes/local/vaults/preprocessors/extract_user.php | extract_user.execute | public function execute(array $records) : array {
$idalias = $this->idalias;
$alias = $this->alias;
return array_map(function($record) use ($idalias, $alias) {
return user_picture::unalias($record, null, $idalias, $alias);
}, $records);
} | php | public function execute(array $records) : array {
$idalias = $this->idalias;
$alias = $this->alias;
return array_map(function($record) use ($idalias, $alias) {
return user_picture::unalias($record, null, $idalias, $alias);
}, $records);
} | [
"public",
"function",
"execute",
"(",
"array",
"$",
"records",
")",
":",
"array",
"{",
"$",
"idalias",
"=",
"$",
"this",
"->",
"idalias",
";",
"$",
"alias",
"=",
"$",
"this",
"->",
"alias",
";",
"return",
"array_map",
"(",
"function",
"(",
"$",
"reco... | Extract the user records from a list of DB records.
@param stdClass[] $records The DB records
@return stdClass[] The list of extracted users | [
"Extract",
"the",
"user",
"records",
"from",
"a",
"list",
"of",
"DB",
"records",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/preprocessors/extract_user.php#L63-L70 |
215,611 | moodle/moodle | search/classes/engine.php | engine.get_course | protected function get_course($courseid) {
if (!empty($this->cachedcourses[$courseid])) {
return $this->cachedcourses[$courseid];
}
// No need to clone, only read.
$this->cachedcourses[$courseid] = get_course($courseid, false);
return $this->cachedcourses[$courseid]... | php | protected function get_course($courseid) {
if (!empty($this->cachedcourses[$courseid])) {
return $this->cachedcourses[$courseid];
}
// No need to clone, only read.
$this->cachedcourses[$courseid] = get_course($courseid, false);
return $this->cachedcourses[$courseid]... | [
"protected",
"function",
"get_course",
"(",
"$",
"courseid",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"cachedcourses",
"[",
"$",
"courseid",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"cachedcourses",
"[",
"$",
"courseid",
"]",
... | Returns a course instance checking internal caching.
@param int $courseid
@return stdClass | [
"Returns",
"a",
"course",
"instance",
"checking",
"internal",
"caching",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/engine.php#L113-L122 |
215,612 | moodle/moodle | search/classes/engine.php | engine.get_user | public function get_user($userid) {
global $DB;
if (empty(self::$cachedusers[$userid])) {
$fields = get_all_user_name_fields(true);
self::$cachedusers[$userid] = $DB->get_record('user', array('id' => $userid), 'id, ' . $fields);
}
return self::$cachedusers[$useri... | php | public function get_user($userid) {
global $DB;
if (empty(self::$cachedusers[$userid])) {
$fields = get_all_user_name_fields(true);
self::$cachedusers[$userid] = $DB->get_record('user', array('id' => $userid), 'id, ' . $fields);
}
return self::$cachedusers[$useri... | [
"public",
"function",
"get_user",
"(",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"cachedusers",
"[",
"$",
"userid",
"]",
")",
")",
"{",
"$",
"fields",
"=",
"get_all_user_name_fields",
"(",
"true",
... | Returns user data checking the internal static cache.
Including here the minimum required user information as this may grow big.
@param int $userid
@return stdClass | [
"Returns",
"user",
"data",
"checking",
"the",
"internal",
"static",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/engine.php#L132-L140 |
215,613 | moodle/moodle | search/classes/engine.php | engine.get_search_area | protected function get_search_area($areaid) {
if (isset($this->cachedareas[$areaid]) && $this->cachedareas[$areaid] === false) {
// We already checked that area and it is not available.
return false;
}
if (!isset($this->cachedareas[$areaid])) {
// First resu... | php | protected function get_search_area($areaid) {
if (isset($this->cachedareas[$areaid]) && $this->cachedareas[$areaid] === false) {
// We already checked that area and it is not available.
return false;
}
if (!isset($this->cachedareas[$areaid])) {
// First resu... | [
"protected",
"function",
"get_search_area",
"(",
"$",
"areaid",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cachedareas",
"[",
"$",
"areaid",
"]",
")",
"&&",
"$",
"this",
"->",
"cachedareas",
"[",
"$",
"areaid",
"]",
"===",
"false",
")",
"... | Returns a search instance of the specified area checking internal caching.
@param string $areaid Area id
@return \core_search\base | [
"Returns",
"a",
"search",
"instance",
"of",
"the",
"specified",
"area",
"checking",
"internal",
"caching",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/engine.php#L157-L186 |
215,614 | moodle/moodle | search/classes/engine.php | engine.to_document | protected function to_document(\core_search\base $searcharea, $docdata) {
list($componentname, $areaname) = \core_search\manager::extract_areaid_parts($docdata['areaid']);
$doc = \core_search\document_factory::instance($docdata['itemid'], $componentname, $areaname, $this);
$doc->set_data_from_e... | php | protected function to_document(\core_search\base $searcharea, $docdata) {
list($componentname, $areaname) = \core_search\manager::extract_areaid_parts($docdata['areaid']);
$doc = \core_search\document_factory::instance($docdata['itemid'], $componentname, $areaname, $this);
$doc->set_data_from_e... | [
"protected",
"function",
"to_document",
"(",
"\\",
"core_search",
"\\",
"base",
"$",
"searcharea",
",",
"$",
"docdata",
")",
"{",
"list",
"(",
"$",
"componentname",
",",
"$",
"areaname",
")",
"=",
"\\",
"core_search",
"\\",
"manager",
"::",
"extract_areaid_p... | Returns a document instance prepared to be rendered.
@param \core_search\base $searcharea
@param array $docdata
@return \core_search\document | [
"Returns",
"a",
"document",
"instance",
"prepared",
"to",
"be",
"rendered",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/engine.php#L195-L214 |
215,615 | moodle/moodle | search/classes/engine.php | engine.add_documents | public function add_documents($iterator, $searcharea, $options) {
$numrecords = 0;
$numdocs = 0;
$numdocsignored = 0;
$lastindexeddoc = 0;
$firstindexeddoc = 0;
$partial = false;
$lastprogress = manager::get_current_time();
foreach ($iterator as $document... | php | public function add_documents($iterator, $searcharea, $options) {
$numrecords = 0;
$numdocs = 0;
$numdocsignored = 0;
$lastindexeddoc = 0;
$firstindexeddoc = 0;
$partial = false;
$lastprogress = manager::get_current_time();
foreach ($iterator as $document... | [
"public",
"function",
"add_documents",
"(",
"$",
"iterator",
",",
"$",
"searcharea",
",",
"$",
"options",
")",
"{",
"$",
"numrecords",
"=",
"0",
";",
"$",
"numdocs",
"=",
"0",
";",
"$",
"numdocsignored",
"=",
"0",
";",
"$",
"lastindexeddoc",
"=",
"0",
... | Loop through given iterator of search documents
and and have the search engine back end add them
to the index.
@param iterator $iterator the iterator of documents to index
@param searcharea $searcharea the area for the documents to index
@param array $options document indexing options
@return array Processed document ... | [
"Loop",
"through",
"given",
"iterator",
"of",
"search",
"documents",
"and",
"and",
"have",
"the",
"search",
"engine",
"back",
"end",
"add",
"them",
"to",
"the",
"index",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/engine.php#L226-L283 |
215,616 | moodle/moodle | lib/classes/hub/site_registration_form.php | site_registration_form.get_data | public function get_data() {
if ($data = parent::get_data()) {
// Never return '*newemail' checkboxes, always return 'emailalertemail' and 'commnewsemail' even if not applicable.
if (empty($data->emailalert) || empty($data->emailalertnewemail)) {
$data->emailalertemail = ... | php | public function get_data() {
if ($data = parent::get_data()) {
// Never return '*newemail' checkboxes, always return 'emailalertemail' and 'commnewsemail' even if not applicable.
if (empty($data->emailalert) || empty($data->emailalertnewemail)) {
$data->emailalertemail = ... | [
"public",
"function",
"get_data",
"(",
")",
"{",
"if",
"(",
"$",
"data",
"=",
"parent",
"::",
"get_data",
"(",
")",
")",
"{",
"// Never return '*newemail' checkboxes, always return 'emailalertemail' and 'commnewsemail' even if not applicable.",
"if",
"(",
"empty",
"(",
... | Returns the form data
@return stdClass | [
"Returns",
"the",
"form",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/site_registration_form.php#L256-L283 |
215,617 | moodle/moodle | backup/util/helper/backup_anonymizer_helper.class.php | backup_anonymizer_helper.is_anonymous_user | public static function is_anonymous_user($user) {
if (preg_match('/^anon\d*$/', $user->username)) {
$match = preg_match('/^anonfirstname\d*$/', $user->firstname);
$match = $match && preg_match('/^anonlastname\d*$/', $user->lastname);
// Check .com for backwards compatibility.... | php | public static function is_anonymous_user($user) {
if (preg_match('/^anon\d*$/', $user->username)) {
$match = preg_match('/^anonfirstname\d*$/', $user->firstname);
$match = $match && preg_match('/^anonlastname\d*$/', $user->lastname);
// Check .com for backwards compatibility.... | [
"public",
"static",
"function",
"is_anonymous_user",
"(",
"$",
"user",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^anon\\d*$/'",
",",
"$",
"user",
"->",
"username",
")",
")",
"{",
"$",
"match",
"=",
"preg_match",
"(",
"'/^anonfirstname\\d*$/'",
",",
"$",
"... | Determine if the given user is an 'anonymous' user, based on their username, firstname, lastname
and email address.
@param stdClass $user the user record to test
@return bool true if this is an 'anonymous' user | [
"Determine",
"if",
"the",
"given",
"user",
"is",
"an",
"anonymous",
"user",
"based",
"on",
"their",
"username",
"firstname",
"lastname",
"and",
"email",
"address",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/backup_anonymizer_helper.class.php#L55-L67 |
215,618 | moodle/moodle | webservice/soap/locallib.php | webservice_soap_server.run | public function run() {
// We will probably need a lot of memory in some functions.
raise_memory_limit(MEMORY_EXTRA);
// Set some longer timeout since operations may need longer time to finish.
external_api::set_timeout();
// Set up exception handler.
set_exception_hand... | php | public function run() {
// We will probably need a lot of memory in some functions.
raise_memory_limit(MEMORY_EXTRA);
// Set some longer timeout since operations may need longer time to finish.
external_api::set_timeout();
// Set up exception handler.
set_exception_hand... | [
"public",
"function",
"run",
"(",
")",
"{",
"// We will probably need a lot of memory in some functions.",
"raise_memory_limit",
"(",
"MEMORY_EXTRA",
")",
";",
"// Set some longer timeout since operations may need longer time to finish.",
"external_api",
"::",
"set_timeout",
"(",
"... | Runs the SOAP web service.
@throws coding_exception
@throws moodle_exception
@throws webservice_access_exception | [
"Runs",
"the",
"SOAP",
"web",
"service",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/webservice/soap/locallib.php#L112-L153 |
215,619 | moodle/moodle | webservice/soap/locallib.php | webservice_soap_server.generate_wsdl | protected function generate_wsdl() {
// Initialise WSDL.
$this->wsdl = new wsdl($this->serviceclass, $this->serverurl);
// Register service struct classes as complex types.
foreach ($this->servicestructs as $structinfo) {
$this->wsdl->add_complex_type($structinfo->classname, ... | php | protected function generate_wsdl() {
// Initialise WSDL.
$this->wsdl = new wsdl($this->serviceclass, $this->serverurl);
// Register service struct classes as complex types.
foreach ($this->servicestructs as $structinfo) {
$this->wsdl->add_complex_type($structinfo->classname, ... | [
"protected",
"function",
"generate_wsdl",
"(",
")",
"{",
"// Initialise WSDL.",
"$",
"this",
"->",
"wsdl",
"=",
"new",
"wsdl",
"(",
"$",
"this",
"->",
"serviceclass",
",",
"$",
"this",
"->",
"serverurl",
")",
";",
"// Register service struct classes as complex typ... | Generates the WSDL. | [
"Generates",
"the",
"WSDL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/webservice/soap/locallib.php#L158-L169 |
215,620 | moodle/moodle | webservice/soap/locallib.php | webservice_soap_server.handle | protected function handle() {
if ($this->wsdlmode) {
// Prepare the response.
$this->response = $this->wsdl->to_xml();
// Send the results back in correct format.
$this->send_response();
} else {
$wsdlurl = clone($this->serverurl);
... | php | protected function handle() {
if ($this->wsdlmode) {
// Prepare the response.
$this->response = $this->wsdl->to_xml();
// Send the results back in correct format.
$this->send_response();
} else {
$wsdlurl = clone($this->serverurl);
... | [
"protected",
"function",
"handle",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"wsdlmode",
")",
"{",
"// Prepare the response.",
"$",
"this",
"->",
"response",
"=",
"$",
"this",
"->",
"wsdl",
"->",
"to_xml",
"(",
")",
";",
"// Send the results back in corre... | Handles the web service function call. | [
"Handles",
"the",
"web",
"service",
"function",
"call",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/webservice/soap/locallib.php#L174-L206 |
215,621 | moodle/moodle | webservice/soap/locallib.php | webservice_soap_server.send_error | protected function send_error($ex = null) {
if ($ex) {
$info = $ex->getMessage();
if (debugging() and isset($ex->debuginfo)) {
$info .= ' - '.$ex->debuginfo;
}
} else {
$info = 'Unknown error';
}
// Initialise new DOM docum... | php | protected function send_error($ex = null) {
if ($ex) {
$info = $ex->getMessage();
if (debugging() and isset($ex->debuginfo)) {
$info .= ' - '.$ex->debuginfo;
}
} else {
$info = 'Unknown error';
}
// Initialise new DOM docum... | [
"protected",
"function",
"send_error",
"(",
"$",
"ex",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"ex",
")",
"{",
"$",
"info",
"=",
"$",
"ex",
"->",
"getMessage",
"(",
")",
";",
"if",
"(",
"debugging",
"(",
")",
"and",
"isset",
"(",
"$",
"ex",
"->"... | Send the error information to the WS client formatted as an XML document.
@param Exception $ex the exception to send back | [
"Send",
"the",
"error",
"information",
"to",
"the",
"WS",
"client",
"formatted",
"as",
"an",
"XML",
"document",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/webservice/soap/locallib.php#L213-L245 |
215,622 | moodle/moodle | webservice/soap/locallib.php | webservice_soap_server.fault | public function fault($fault = null, $code = 'Receiver') {
$allowedfaultmodes = array(
'VersionMismatch', 'MustUnderstand', 'DataEncodingUnknown',
'Sender', 'Receiver', 'Server'
);
if (!in_array($code, $allowedfaultmodes)) {
$code = 'Receiver';
}
... | php | public function fault($fault = null, $code = 'Receiver') {
$allowedfaultmodes = array(
'VersionMismatch', 'MustUnderstand', 'DataEncodingUnknown',
'Sender', 'Receiver', 'Server'
);
if (!in_array($code, $allowedfaultmodes)) {
$code = 'Receiver';
}
... | [
"public",
"function",
"fault",
"(",
"$",
"fault",
"=",
"null",
",",
"$",
"code",
"=",
"'Receiver'",
")",
"{",
"$",
"allowedfaultmodes",
"=",
"array",
"(",
"'VersionMismatch'",
",",
"'MustUnderstand'",
",",
"'DataEncodingUnknown'",
",",
"'Sender'",
",",
"'Recei... | Generate a server fault.
Note that the parameter order is the reverse of SoapFault's constructor parameters.
Moodle note: basically we return the faultactor (errorcode) and faultdetails (debuginfo).
If an exception is passed as the first argument, its message and code
will be used to create the fault object.
@link ... | [
"Generate",
"a",
"server",
"fault",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/webservice/soap/locallib.php#L282-L309 |
215,623 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_lesson_summary_for_exporter | protected static function get_lesson_summary_for_exporter($lessonrecord, $password = '') {
global $USER;
$lesson = new lesson($lessonrecord);
$lesson->update_effective_access($USER->id);
$lessonavailable = $lesson->get_time_restriction_status() === false;
$lessonavailable = $les... | php | protected static function get_lesson_summary_for_exporter($lessonrecord, $password = '') {
global $USER;
$lesson = new lesson($lessonrecord);
$lesson->update_effective_access($USER->id);
$lessonavailable = $lesson->get_time_restriction_status() === false;
$lessonavailable = $les... | [
"protected",
"static",
"function",
"get_lesson_summary_for_exporter",
"(",
"$",
"lessonrecord",
",",
"$",
"password",
"=",
"''",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"lesson",
"=",
"new",
"lesson",
"(",
"$",
"lessonrecord",
")",
";",
"$",
"lesson",
"... | Return a lesson record ready for being exported.
@param stdClass $lessonrecord lesson record
@param string $password lesson password
@return stdClass the lesson record ready for exporting. | [
"Return",
"a",
"lesson",
"record",
"ready",
"for",
"being",
"exported",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L52-L85 |
215,624 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_lessons_by_courses | public static function get_lessons_by_courses($courseids = array()) {
global $PAGE;
$warnings = array();
$returnedlessons = array();
$params = array(
'courseids' => $courseids,
);
$params = self::validate_parameters(self::get_lessons_by_courses_parameters(),... | php | public static function get_lessons_by_courses($courseids = array()) {
global $PAGE;
$warnings = array();
$returnedlessons = array();
$params = array(
'courseids' => $courseids,
);
$params = self::validate_parameters(self::get_lessons_by_courses_parameters(),... | [
"public",
"static",
"function",
"get_lessons_by_courses",
"(",
"$",
"courseids",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"warnings",
"=",
"array",
"(",
")",
";",
"$",
"returnedlessons",
"=",
"array",
"(",
")",
";",
"$",
"para... | Returns a list of lessons in a provided list of courses,
if no list is provided all lessons that the user can view will be returned.
@param array $courseids Array of course ids
@return array of lessons details
@since Moodle 3.3 | [
"Returns",
"a",
"list",
"of",
"lessons",
"in",
"a",
"provided",
"list",
"of",
"courses",
"if",
"no",
"list",
"is",
"provided",
"all",
"lessons",
"that",
"the",
"user",
"can",
"view",
"will",
"be",
"returned",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L111-L153 |
215,625 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.validate_lesson | protected static function validate_lesson($lessonid) {
global $DB, $USER;
// Request and permission validation.
$lessonrecord = $DB->get_record('lesson', array('id' => $lessonid), '*', MUST_EXIST);
list($course, $cm) = get_course_and_cm_from_instance($lessonrecord, 'lesson');
$... | php | protected static function validate_lesson($lessonid) {
global $DB, $USER;
// Request and permission validation.
$lessonrecord = $DB->get_record('lesson', array('id' => $lessonid), '*', MUST_EXIST);
list($course, $cm) = get_course_and_cm_from_instance($lessonrecord, 'lesson');
$... | [
"protected",
"static",
"function",
"validate_lesson",
"(",
"$",
"lessonid",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"// Request and permission validation.",
"$",
"lessonrecord",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'lesson'",
",",
"array",
"... | Utility function for validating a lesson.
@param int $lessonid lesson instance id
@return array array containing the lesson, course, context and course module objects
@since Moodle 3.3 | [
"Utility",
"function",
"for",
"validating",
"a",
"lesson",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L179-L193 |
215,626 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_lesson_access_information | public static function get_lesson_access_information($lessonid) {
global $DB, $USER;
$warnings = array();
$params = array(
'lessonid' => $lessonid
);
$params = self::validate_parameters(self::get_lesson_access_information_parameters(), $params);
list($lesso... | php | public static function get_lesson_access_information($lessonid) {
global $DB, $USER;
$warnings = array();
$params = array(
'lessonid' => $lessonid
);
$params = self::validate_parameters(self::get_lesson_access_information_parameters(), $params);
list($lesso... | [
"public",
"static",
"function",
"get_lesson_access_information",
"(",
"$",
"lessonid",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"warnings",
"=",
"array",
"(",
")",
";",
"$",
"params",
"=",
"array",
"(",
"'lessonid'",
"=>",
"$",
"lessoni... | Return access information for a given lesson.
@param int $lessonid lesson instance id
@return array of warnings and the access information
@since Moodle 3.3
@throws moodle_exception | [
"Return",
"access",
"information",
"for",
"a",
"given",
"lesson",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L350-L390 |
215,627 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_lesson_access_information_returns | public static function get_lesson_access_information_returns() {
return new external_single_structure(
array(
'canmanage' => new external_value(PARAM_BOOL, 'Whether the user can manage the lesson or not.'),
'cangrade' => new external_value(PARAM_BOOL, 'Whether the use... | php | public static function get_lesson_access_information_returns() {
return new external_single_structure(
array(
'canmanage' => new external_value(PARAM_BOOL, 'Whether the user can manage the lesson or not.'),
'cangrade' => new external_value(PARAM_BOOL, 'Whether the use... | [
"public",
"static",
"function",
"get_lesson_access_information_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'canmanage'",
"=>",
"new",
"external_value",
"(",
"PARAM_BOOL",
",",
"'Whether the user can manage the lesson or not.'",
... | Describes the get_lesson_access_information return value.
@return external_single_structure
@since Moodle 3.3 | [
"Describes",
"the",
"get_lesson_access_information",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L398-L422 |
215,628 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_questions_attempts_parameters | public static function get_questions_attempts_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'lesson instance id'),
'attempt' => new external_value(PARAM_INT, 'lesson attempt number'),
'corre... | php | public static function get_questions_attempts_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'lesson instance id'),
'attempt' => new external_value(PARAM_INT, 'lesson attempt number'),
'corre... | [
"public",
"static",
"function",
"get_questions_attempts_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'lessonid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'lesson instance id'",
")",
",",
"'attempt'",
"... | Describes the parameters for get_questions_attempts.
@return external_function_parameters
@since Moodle 3.3 | [
"Describes",
"the",
"parameters",
"for",
"get_questions_attempts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L507-L517 |
215,629 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_questions_attempts | public static function get_questions_attempts($lessonid, $attempt, $correct = false, $pageid = null, $userid = null) {
global $DB, $USER;
$params = array(
'lessonid' => $lessonid,
'attempt' => $attempt,
'correct' => $correct,
'pageid' => $pageid,
... | php | public static function get_questions_attempts($lessonid, $attempt, $correct = false, $pageid = null, $userid = null) {
global $DB, $USER;
$params = array(
'lessonid' => $lessonid,
'attempt' => $attempt,
'correct' => $correct,
'pageid' => $pageid,
... | [
"public",
"static",
"function",
"get_questions_attempts",
"(",
"$",
"lessonid",
",",
"$",
"attempt",
",",
"$",
"correct",
"=",
"false",
",",
"$",
"pageid",
"=",
"null",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
... | Return the list of page question attempts in a given lesson.
@param int $lessonid lesson instance id
@param int $attempt the lesson attempt number
@param bool $correct only fetch correct attempts
@param int $pageid only fetch attempts at the given page
@param int $userid only fetch attempts of the given user
@return a... | [
"Return",
"the",
"list",
"of",
"page",
"question",
"attempts",
"in",
"a",
"given",
"lesson",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L531-L560 |
215,630 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_questions_attempts_returns | public static function get_questions_attempts_returns() {
return new external_single_structure(
array(
'attempts' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_val... | php | public static function get_questions_attempts_returns() {
return new external_single_structure(
array(
'attempts' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_val... | [
"public",
"static",
"function",
"get_questions_attempts_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'attempts'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'id'"... | Describes the get_questions_attempts return value.
@return external_single_structure
@since Moodle 3.3 | [
"Describes",
"the",
"get_questions_attempts",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L568-L590 |
215,631 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_user_grade | public static function get_user_grade($lessonid, $userid = null) {
global $CFG, $USER;
require_once($CFG->libdir . '/gradelib.php');
$params = array(
'lessonid' => $lessonid,
'userid' => $userid,
);
$params = self::validate_parameters(self::get_user_grade... | php | public static function get_user_grade($lessonid, $userid = null) {
global $CFG, $USER;
require_once($CFG->libdir . '/gradelib.php');
$params = array(
'lessonid' => $lessonid,
'userid' => $userid,
);
$params = self::validate_parameters(self::get_user_grade... | [
"public",
"static",
"function",
"get_user_grade",
"(",
"$",
"lessonid",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"USER",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/gradelib.php'",
")",
";",
"$",
"par... | Return the final grade in the lesson for the given user.
@param int $lessonid lesson instance id
@param int $userid only fetch grades of this user
@return array of warnings and page attempts
@since Moodle 3.3
@throws moodle_exception | [
"Return",
"the",
"final",
"grade",
"in",
"the",
"lesson",
"for",
"the",
"given",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L616-L660 |
215,632 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_user_attempt_grade_structure | protected static function get_user_attempt_grade_structure($required = VALUE_REQUIRED) {
$data = array(
'nquestions' => new external_value(PARAM_INT, 'Number of questions answered'),
'attempts' => new external_value(PARAM_INT, 'Number of question attempts'),
'total' => new ex... | php | protected static function get_user_attempt_grade_structure($required = VALUE_REQUIRED) {
$data = array(
'nquestions' => new external_value(PARAM_INT, 'Number of questions answered'),
'attempts' => new external_value(PARAM_INT, 'Number of question attempts'),
'total' => new ex... | [
"protected",
"static",
"function",
"get_user_attempt_grade_structure",
"(",
"$",
"required",
"=",
"VALUE_REQUIRED",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'nquestions'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'Number of questions answered'",
")",
... | Describes an attempt grade structure.
@param int $required if the structure is required or optional
@return external_single_structure the structure
@since Moodle 3.3 | [
"Describes",
"an",
"attempt",
"grade",
"structure",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L685-L698 |
215,633 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_user_attempt_grade_parameters | public static function get_user_attempt_grade_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'lesson instance id'),
'lessonattempt' => new external_value(PARAM_INT, 'lesson attempt number'),
... | php | public static function get_user_attempt_grade_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'lesson instance id'),
'lessonattempt' => new external_value(PARAM_INT, 'lesson attempt number'),
... | [
"public",
"static",
"function",
"get_user_attempt_grade_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'lessonid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'lesson instance id'",
")",
",",
"'lessonattempt'... | Describes the parameters for get_user_attempt_grade.
@return external_function_parameters
@since Moodle 3.3 | [
"Describes",
"the",
"parameters",
"for",
"get_user_attempt_grade",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L706-L714 |
215,634 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_user_attempt_grade | public static function get_user_attempt_grade($lessonid, $lessonattempt, $userid = null) {
global $CFG, $USER;
require_once($CFG->libdir . '/gradelib.php');
$params = array(
'lessonid' => $lessonid,
'lessonattempt' => $lessonattempt,
'userid' => $userid,
... | php | public static function get_user_attempt_grade($lessonid, $lessonattempt, $userid = null) {
global $CFG, $USER;
require_once($CFG->libdir . '/gradelib.php');
$params = array(
'lessonid' => $lessonid,
'lessonattempt' => $lessonattempt,
'userid' => $userid,
... | [
"public",
"static",
"function",
"get_user_attempt_grade",
"(",
"$",
"lessonid",
",",
"$",
"lessonattempt",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"USER",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/gr... | Return grade information in the attempt for a given user.
@param int $lessonid lesson instance id
@param int $lessonattempt lesson attempt number
@param int $userid only fetch attempts of the given user
@return array of warnings and page attempts
@since Moodle 3.3
@throws moodle_exception | [
"Return",
"grade",
"information",
"in",
"the",
"attempt",
"for",
"a",
"given",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L726-L754 |
215,635 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_content_pages_viewed_parameters | public static function get_content_pages_viewed_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'lesson instance id'),
'lessonattempt' => new external_value(PARAM_INT, 'lesson attempt number'),
... | php | public static function get_content_pages_viewed_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'lesson instance id'),
'lessonattempt' => new external_value(PARAM_INT, 'lesson attempt number'),
... | [
"public",
"static",
"function",
"get_content_pages_viewed_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'lessonid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'lesson instance id'",
")",
",",
"'lessonattemp... | Describes the parameters for get_content_pages_viewed.
@return external_function_parameters
@since Moodle 3.3 | [
"Describes",
"the",
"parameters",
"for",
"get_content_pages_viewed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L777-L785 |
215,636 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_content_pages_viewed | public static function get_content_pages_viewed($lessonid, $lessonattempt, $userid = null) {
global $USER;
$params = array(
'lessonid' => $lessonid,
'lessonattempt' => $lessonattempt,
'userid' => $userid,
);
$params = self::validate_parameters(self::g... | php | public static function get_content_pages_viewed($lessonid, $lessonattempt, $userid = null) {
global $USER;
$params = array(
'lessonid' => $lessonid,
'lessonattempt' => $lessonattempt,
'userid' => $userid,
);
$params = self::validate_parameters(self::g... | [
"public",
"static",
"function",
"get_content_pages_viewed",
"(",
"$",
"lessonid",
",",
"$",
"lessonattempt",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"params",
"=",
"array",
"(",
"'lessonid'",
"=>",
"$",
"lessonid",
",",
... | Return the list of content pages viewed by a user during a lesson attempt.
@param int $lessonid lesson instance id
@param int $lessonattempt lesson attempt number
@param int $userid only fetch attempts of the given user
@return array of warnings and page attempts
@since Moodle 3.3
@throws moodle_exception | [
"Return",
"the",
"list",
"of",
"content",
"pages",
"viewed",
"by",
"a",
"user",
"during",
"a",
"lesson",
"attempt",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L797-L826 |
215,637 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_content_pages_viewed_returns | public static function get_content_pages_viewed_returns() {
return new external_single_structure(
array(
'pages' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_valu... | php | public static function get_content_pages_viewed_returns() {
return new external_single_structure(
array(
'pages' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_valu... | [
"public",
"static",
"function",
"get_content_pages_viewed_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'pages'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'id'",... | Describes the get_content_pages_viewed return value.
@return external_single_structure
@since Moodle 3.3 | [
"Describes",
"the",
"get_content_pages_viewed",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L834-L855 |
215,638 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_user_timers_returns | public static function get_user_timers_returns() {
return new external_single_structure(
array(
'timers' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_value(PARAM_... | php | public static function get_user_timers_returns() {
return new external_single_structure(
array(
'timers' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_value(PARAM_... | [
"public",
"static",
"function",
"get_user_timers_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'timers'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'id'",
"=>",... | Describes the get_user_timers return value.
@return external_single_structure
@since Moodle 3.3 | [
"Describes",
"the",
"get_user_timers",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L917-L937 |
215,639 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_page_structure | protected static function get_page_structure($required = VALUE_REQUIRED) {
return new external_single_structure(
array(
'id' => new external_value(PARAM_INT, 'The id of this lesson page'),
'lessonid' => new external_value(PARAM_INT, 'The id of the lesson this page bel... | php | protected static function get_page_structure($required = VALUE_REQUIRED) {
return new external_single_structure(
array(
'id' => new external_value(PARAM_INT, 'The id of this lesson page'),
'lessonid' => new external_value(PARAM_INT, 'The id of the lesson this page bel... | [
"protected",
"static",
"function",
"get_page_structure",
"(",
"$",
"required",
"=",
"VALUE_REQUIRED",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'id'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'The id of this lesson page'... | Describes the external structure for a lesson page.
@return external_single_structure
@since Moodle 3.3 | [
"Describes",
"the",
"external",
"structure",
"for",
"a",
"lesson",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L945-L968 |
215,640 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_page_fields | protected static function get_page_fields(lesson_page $page, $returncontents = false) {
$lesson = $page->lesson;
$context = $lesson->context;
$pagedata = new stdClass; // Contains the data that will be returned by the WS.
// Return the visible data.
$visibleproperties = array('... | php | protected static function get_page_fields(lesson_page $page, $returncontents = false) {
$lesson = $page->lesson;
$context = $lesson->context;
$pagedata = new stdClass; // Contains the data that will be returned by the WS.
// Return the visible data.
$visibleproperties = array('... | [
"protected",
"static",
"function",
"get_page_fields",
"(",
"lesson_page",
"$",
"page",
",",
"$",
"returncontents",
"=",
"false",
")",
"{",
"$",
"lesson",
"=",
"$",
"page",
"->",
"lesson",
";",
"$",
"context",
"=",
"$",
"lesson",
"->",
"context",
";",
"$"... | Returns the fields of a page object
@param lesson_page $page the lesson page
@param bool $returncontents whether to return the page title and contents
@return stdClass the fields matching the external page structure
@since Moodle 3.3 | [
"Returns",
"the",
"fields",
"of",
"a",
"page",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L977-L1003 |
215,641 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_pages_returns | public static function get_pages_returns() {
return new external_single_structure(
array(
'pages' => new external_multiple_structure(
new external_single_structure(
array(
'page' => self::get_page_structure(),
... | php | public static function get_pages_returns() {
return new external_single_structure(
array(
'pages' => new external_multiple_structure(
new external_single_structure(
array(
'page' => self::get_page_structure(),
... | [
"public",
"static",
"function",
"get_pages_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'pages'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'page'",
"=>",
"s... | Describes the get_pages return value.
@return external_single_structure
@since Moodle 3.3 | [
"Describes",
"the",
"get_pages",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1084-L1106 |
215,642 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.launch_attempt_parameters | public static function launch_attempt_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'lesson instance id'),
'password' => new external_value(PARAM_RAW, 'optional password (the lesson may be protected)', VALU... | php | public static function launch_attempt_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'lesson instance id'),
'password' => new external_value(PARAM_RAW, 'optional password (the lesson may be protected)', VALU... | [
"public",
"static",
"function",
"launch_attempt_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'lessonid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'lesson instance id'",
")",
",",
"'password'",
"=>",
... | Describes the parameters for launch_attempt.
@return external_function_parameters
@since Moodle 3.3 | [
"Describes",
"the",
"parameters",
"for",
"launch_attempt",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1114-L1123 |
215,643 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.format_lesson_messages | protected static function format_lesson_messages($lesson) {
$messages = array();
foreach ($lesson->messages as $message) {
$messages[] = array(
'message' => $message[0],
'type' => $message[1],
);
}
return $messages;
} | php | protected static function format_lesson_messages($lesson) {
$messages = array();
foreach ($lesson->messages as $message) {
$messages[] = array(
'message' => $message[0],
'type' => $message[1],
);
}
return $messages;
} | [
"protected",
"static",
"function",
"format_lesson_messages",
"(",
"$",
"lesson",
")",
"{",
"$",
"messages",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"lesson",
"->",
"messages",
"as",
"$",
"message",
")",
"{",
"$",
"messages",
"[",
"]",
"=",
"a... | Return lesson messages formatted according the external_messages structure
@param lesson $lesson lesson instance
@return array messages formatted
@since Moodle 3.3 | [
"Return",
"lesson",
"messages",
"formatted",
"according",
"the",
"external_messages",
"structure"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1132-L1141 |
215,644 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.launch_attempt | public static function launch_attempt($lessonid, $password = '', $pageid = 0, $review = false) {
global $CFG, $USER;
$params = array('lessonid' => $lessonid, 'password' => $password, 'pageid' => $pageid, 'review' => $review);
$params = self::validate_parameters(self::launch_attempt_parameters()... | php | public static function launch_attempt($lessonid, $password = '', $pageid = 0, $review = false) {
global $CFG, $USER;
$params = array('lessonid' => $lessonid, 'password' => $password, 'pageid' => $pageid, 'review' => $review);
$params = self::validate_parameters(self::launch_attempt_parameters()... | [
"public",
"static",
"function",
"launch_attempt",
"(",
"$",
"lessonid",
",",
"$",
"password",
"=",
"''",
",",
"$",
"pageid",
"=",
"0",
",",
"$",
"review",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"USER",
";",
"$",
"params",
"=",
"arr... | Starts a new attempt or continues an existing one.
@param int $lessonid lesson instance id
@param string $password optional password (the lesson may be protected)
@param int $pageid page id to continue from (only when continuing an attempt)
@param bool $review if we want to review just after finishing
@return array of... | [
"Starts",
"a",
"new",
"attempt",
"or",
"continues",
"an",
"existing",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1172-L1214 |
215,645 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_page_data_parameters | public static function get_page_data_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'lesson instance id'),
'pageid' => new external_value(PARAM_INT, 'the page id'),
'password' => new external... | php | public static function get_page_data_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'lesson instance id'),
'pageid' => new external_value(PARAM_INT, 'the page id'),
'password' => new external... | [
"public",
"static",
"function",
"get_page_data_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'lessonid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'lesson instance id'",
")",
",",
"'pageid'",
"=>",
"ne... | Describes the parameters for get_page_data.
@return external_function_parameters
@since Moodle 3.3 | [
"Describes",
"the",
"parameters",
"for",
"get_page_data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1237-L1249 |
215,646 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_page_data_returns | public static function get_page_data_returns() {
return new external_single_structure(
array(
'page' => self::get_page_structure(VALUE_OPTIONAL),
'newpageid' => new external_value(PARAM_INT, 'New page id (if a jump was made)'),
'pagecontent' => new ext... | php | public static function get_page_data_returns() {
return new external_single_structure(
array(
'page' => self::get_page_structure(VALUE_OPTIONAL),
'newpageid' => new external_value(PARAM_INT, 'New page id (if a jump was made)'),
'pagecontent' => new ext... | [
"public",
"static",
"function",
"get_page_data_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'page'",
"=>",
"self",
"::",
"get_page_structure",
"(",
"VALUE_OPTIONAL",
")",
",",
"'newpageid'",
"=>",
"new",
"external_value"... | Describes the get_page_data return value.
@return external_single_structure
@since Moodle 3.3 | [
"Describes",
"the",
"get_page_data",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1366-L1401 |
215,647 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.process_page_parameters | public static function process_page_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'lesson instance id'),
'pageid' => new external_value(PARAM_INT, 'the page id'),
'data' => new external_mult... | php | public static function process_page_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'lesson instance id'),
'pageid' => new external_value(PARAM_INT, 'the page id'),
'data' => new external_mult... | [
"public",
"static",
"function",
"process_page_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'lessonid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'lesson instance id'",
")",
",",
"'pageid'",
"=>",
"new... | Describes the parameters for process_page.
@return external_function_parameters
@since Moodle 3.3 | [
"Describes",
"the",
"parameters",
"for",
"process_page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1409-L1427 |
215,648 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.finish_attempt_parameters | public static function finish_attempt_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'Lesson instance id.'),
'password' => new external_value(PARAM_RAW, 'Optional password (the lesson may be protected).', VA... | php | public static function finish_attempt_parameters() {
return new external_function_parameters (
array(
'lessonid' => new external_value(PARAM_INT, 'Lesson instance id.'),
'password' => new external_value(PARAM_RAW, 'Optional password (the lesson may be protected).', VA... | [
"public",
"static",
"function",
"finish_attempt_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'lessonid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'Lesson instance id.'",
")",
",",
"'password'",
"=>",
... | Describes the parameters for finish_attempt.
@return external_function_parameters
@since Moodle 3.3 | [
"Describes",
"the",
"parameters",
"for",
"finish_attempt",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1551-L1561 |
215,649 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.finish_attempt | public static function finish_attempt($lessonid, $password = '', $outoftime = false, $review = false) {
$params = array('lessonid' => $lessonid, 'password' => $password, 'outoftime' => $outoftime, 'review' => $review);
$params = self::validate_parameters(self::finish_attempt_parameters(), $params);
... | php | public static function finish_attempt($lessonid, $password = '', $outoftime = false, $review = false) {
$params = array('lessonid' => $lessonid, 'password' => $password, 'outoftime' => $outoftime, 'review' => $review);
$params = self::validate_parameters(self::finish_attempt_parameters(), $params);
... | [
"public",
"static",
"function",
"finish_attempt",
"(",
"$",
"lessonid",
",",
"$",
"password",
"=",
"''",
",",
"$",
"outoftime",
"=",
"false",
",",
"$",
"review",
"=",
"false",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'lessonid'",
"=>",
"$",
"lesson... | Finishes the current attempt.
@param int $lessonid lesson instance id
@param string $password optional password (the lesson may be protected)
@param bool $outoftime optional if the user run out of time
@param bool $review if we want to review just after finishing (1 hour margin)
@return array of warnings and informati... | [
"Finishes",
"the",
"current",
"attempt",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1574-L1634 |
215,650 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.finish_attempt_returns | public static function finish_attempt_returns() {
return new external_single_structure(
array(
'data' => new external_multiple_structure(
new external_single_structure(
array(
'name' => new external_value(PARAM_A... | php | public static function finish_attempt_returns() {
return new external_single_structure(
array(
'data' => new external_multiple_structure(
new external_single_structure(
array(
'name' => new external_value(PARAM_A... | [
"public",
"static",
"function",
"finish_attempt_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'data'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'name'",
"=>",
... | Describes the finish_attempt return value.
@return external_single_structure
@since Moodle 3.3 | [
"Describes",
"the",
"finish_attempt",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1642-L1658 |
215,651 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_attempts_overview | public static function get_attempts_overview($lessonid, $groupid = 0) {
$params = array('lessonid' => $lessonid, 'groupid' => $groupid);
$params = self::validate_parameters(self::get_attempts_overview_parameters(), $params);
$warnings = array();
list($lesson, $course, $cm, $context, $l... | php | public static function get_attempts_overview($lessonid, $groupid = 0) {
$params = array('lessonid' => $lessonid, 'groupid' => $groupid);
$params = self::validate_parameters(self::get_attempts_overview_parameters(), $params);
$warnings = array();
list($lesson, $course, $cm, $context, $l... | [
"public",
"static",
"function",
"get_attempts_overview",
"(",
"$",
"lessonid",
",",
"$",
"groupid",
"=",
"0",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'lessonid'",
"=>",
"$",
"lessonid",
",",
"'groupid'",
"=>",
"$",
"groupid",
")",
";",
"$",
"params"... | Get a list of all the attempts made by users in a lesson.
@param int $lessonid lesson instance id
@param int $groupid group id, 0 means that the function will determine the user group
@return array of warnings and status result
@since Moodle 3.3
@throws moodle_exception | [
"Get",
"a",
"list",
"of",
"all",
"the",
"attempts",
"made",
"by",
"users",
"in",
"a",
"lesson",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1685-L1723 |
215,652 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_attempts_overview_returns | public static function get_attempts_overview_returns() {
return new external_single_structure(
array(
'data' => new external_single_structure(
array(
'lessonscored' => new external_value(PARAM_BOOL, 'True if the lesson was scored.'),
... | php | public static function get_attempts_overview_returns() {
return new external_single_structure(
array(
'data' => new external_single_structure(
array(
'lessonscored' => new external_value(PARAM_BOOL, 'True if the lesson was scored.'),
... | [
"public",
"static",
"function",
"get_attempts_overview_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'data'",
"=>",
"new",
"external_single_structure",
"(",
"array",
"(",
"'lessonscored'",
"=>",
"new",
"external_value",
"("... | Describes the get_attempts_overview return value.
@return external_single_structure
@since Moodle 3.3 | [
"Describes",
"the",
"get_attempts_overview",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1731-L1770 |
215,653 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_user_attempt_returns | public static function get_user_attempt_returns() {
return new external_single_structure(
array(
'answerpages' => new external_multiple_structure(
new external_single_structure(
array(
'page' => self::get_page_st... | php | public static function get_user_attempt_returns() {
return new external_single_structure(
array(
'answerpages' => new external_multiple_structure(
new external_single_structure(
array(
'page' => self::get_page_st... | [
"public",
"static",
"function",
"get_user_attempt_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'answerpages'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'page'",... | Describes the get_user_attempt return value.
@return external_single_structure
@since Moodle 3.3 | [
"Describes",
"the",
"get_user_attempt",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1841-L1878 |
215,654 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_pages_possible_jumps | public static function get_pages_possible_jumps($lessonid) {
global $USER;
$params = array('lessonid' => $lessonid);
$params = self::validate_parameters(self::get_pages_possible_jumps_parameters(), $params);
$warnings = $jumps = array();
list($lesson, $course, $cm, $context) =... | php | public static function get_pages_possible_jumps($lessonid) {
global $USER;
$params = array('lessonid' => $lessonid);
$params = self::validate_parameters(self::get_pages_possible_jumps_parameters(), $params);
$warnings = $jumps = array();
list($lesson, $course, $cm, $context) =... | [
"public",
"static",
"function",
"get_pages_possible_jumps",
"(",
"$",
"lessonid",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"params",
"=",
"array",
"(",
"'lessonid'",
"=>",
"$",
"lessonid",
")",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
... | Return all the possible jumps for the pages in a given lesson.
You may expect different results on consecutive executions due to the random nature of the lesson module.
@param int $lessonid lesson instance id
@return array of warnings and possible jumps
@since Moodle 3.3
@throws moodle_exception | [
"Return",
"all",
"the",
"possible",
"jumps",
"for",
"the",
"pages",
"in",
"a",
"given",
"lesson",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1904-L1949 |
215,655 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_pages_possible_jumps_returns | public static function get_pages_possible_jumps_returns() {
return new external_single_structure(
array(
'jumps' => new external_multiple_structure(
new external_single_structure(
array(
'pageid' => new external_... | php | public static function get_pages_possible_jumps_returns() {
return new external_single_structure(
array(
'jumps' => new external_multiple_structure(
new external_single_structure(
array(
'pageid' => new external_... | [
"public",
"static",
"function",
"get_pages_possible_jumps_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'jumps'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'pagei... | Describes the get_pages_possible_jumps return value.
@return external_single_structure
@since Moodle 3.3 | [
"Describes",
"the",
"get_pages_possible_jumps",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1957-L1973 |
215,656 | moodle/moodle | mod/lesson/classes/external.php | mod_lesson_external.get_lesson | public static function get_lesson($lessonid, $password = '') {
global $PAGE;
$params = array('lessonid' => $lessonid, 'password' => $password);
$params = self::validate_parameters(self::get_lesson_parameters(), $params);
$warnings = array();
list($lesson, $course, $cm, $context... | php | public static function get_lesson($lessonid, $password = '') {
global $PAGE;
$params = array('lessonid' => $lessonid, 'password' => $password);
$params = self::validate_parameters(self::get_lesson_parameters(), $params);
$warnings = array();
list($lesson, $course, $cm, $context... | [
"public",
"static",
"function",
"get_lesson",
"(",
"$",
"lessonid",
",",
"$",
"password",
"=",
"''",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
"array",
"(",
"'lessonid'",
"=>",
"$",
"lessonid",
",",
"'password'",
"=>",
"$",
"password",
... | Return information of a given lesson.
@param int $lessonid lesson instance id
@param string $password optional password (the lesson may be protected)
@return array of warnings and status result
@since Moodle 3.3
@throws moodle_exception | [
"Return",
"information",
"of",
"a",
"given",
"lesson",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/classes/external.php#L1999-L2015 |
215,657 | moodle/moodle | question/type/randomsamatch/backup/moodle2/restore_qtype_randomsamatch_plugin.class.php | restore_qtype_randomsamatch_plugin.recode_legacy_state_answer | public function recode_legacy_state_answer($state) {
$answer = $state->answer;
$resultarr = array();
foreach (explode(',', $answer) as $pair) {
$pairarr = explode('-', $pair);
$questionid = $pairarr[0];
$answerid = $pairarr[1];
$newquestionid = $qu... | php | public function recode_legacy_state_answer($state) {
$answer = $state->answer;
$resultarr = array();
foreach (explode(',', $answer) as $pair) {
$pairarr = explode('-', $pair);
$questionid = $pairarr[0];
$answerid = $pairarr[1];
$newquestionid = $qu... | [
"public",
"function",
"recode_legacy_state_answer",
"(",
"$",
"state",
")",
"{",
"$",
"answer",
"=",
"$",
"state",
"->",
"answer",
";",
"$",
"resultarr",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"explode",
"(",
"','",
",",
"$",
"answer",
")",
"as",... | Given one question_states record, return the answer
recoded pointing to all the restored stuff for randomsamatch questions
answer is one comma separated list of hypen separated pairs
containing question->id and question_answers->id | [
"Given",
"one",
"question_states",
"record",
"return",
"the",
"answer",
"recoded",
"pointing",
"to",
"all",
"the",
"restored",
"stuff",
"for",
"randomsamatch",
"questions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/randomsamatch/backup/moodle2/restore_qtype_randomsamatch_plugin.class.php#L107-L119 |
215,658 | moodle/moodle | mod/workshop/classes/portfolio_caller.php | mod_workshop_portfolio_caller.load_data | public function load_data() {
global $DB, $USER;
// Note that require_login() is normally called later as a part of
// portfolio_export_pagesetup() in the portfolio/add.php file. But we
// load various data depending of capabilities so it makes sense to
// call it explicitly her... | php | public function load_data() {
global $DB, $USER;
// Note that require_login() is normally called later as a part of
// portfolio_export_pagesetup() in the portfolio/add.php file. But we
// load various data depending of capabilities so it makes sense to
// call it explicitly her... | [
"public",
"function",
"load_data",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"// Note that require_login() is normally called later as a part of",
"// portfolio_export_pagesetup() in the portfolio/add.php file. But we",
"// load various data depending of capabilities s... | Load data required for the export. | [
"Load",
"data",
"required",
"for",
"the",
"export",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/classes/portfolio_caller.php#L85-L156 |
215,659 | moodle/moodle | mod/workshop/classes/portfolio_caller.php | mod_workshop_portfolio_caller.prepare_package | public function prepare_package() {
$canviewauthornames = has_capability('mod/workshop:viewauthornames', $this->workshop->context, $this->get('user'));
// Prepare the submission record for rendering.
$workshopsubmission = $this->workshop->prepare_submission($this->submission, $canviewauthornam... | php | public function prepare_package() {
$canviewauthornames = has_capability('mod/workshop:viewauthornames', $this->workshop->context, $this->get('user'));
// Prepare the submission record for rendering.
$workshopsubmission = $this->workshop->prepare_submission($this->submission, $canviewauthornam... | [
"public",
"function",
"prepare_package",
"(",
")",
"{",
"$",
"canviewauthornames",
"=",
"has_capability",
"(",
"'mod/workshop:viewauthornames'",
",",
"$",
"this",
"->",
"workshop",
"->",
"context",
",",
"$",
"this",
"->",
"get",
"(",
"'user'",
")",
")",
";",
... | Prepare the package ready to be passed off to the portfolio plugin. | [
"Prepare",
"the",
"package",
"ready",
"to",
"be",
"passed",
"off",
"to",
"the",
"portfolio",
"plugin",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/classes/portfolio_caller.php#L161-L210 |
215,660 | moodle/moodle | mod/workshop/classes/portfolio_caller.php | mod_workshop_portfolio_caller.export_header | protected function export_header(workshop_submission $workshopsubmission) {
$output = '';
$output .= html_writer::tag('h2', get_string('pluginname', 'mod_workshop').': '.s($this->workshop->name));
$output .= html_writer::tag('h3', s($workshopsubmission->title));
$created = get_string('... | php | protected function export_header(workshop_submission $workshopsubmission) {
$output = '';
$output .= html_writer::tag('h2', get_string('pluginname', 'mod_workshop').': '.s($this->workshop->name));
$output .= html_writer::tag('h3', s($workshopsubmission->title));
$created = get_string('... | [
"protected",
"function",
"export_header",
"(",
"workshop_submission",
"$",
"workshopsubmission",
")",
"{",
"$",
"output",
"=",
"''",
";",
"$",
"output",
".=",
"html_writer",
"::",
"tag",
"(",
"'h2'",
",",
"get_string",
"(",
"'pluginname'",
",",
"'mod_workshop'",... | Render the header of the exported content.
This is mainly used for the HTML output format. In case of LEAP2A
export, this is not used as the information is stored in metadata and
displayed as a part of the journal and entry title in Mahara.
@param workshop_submission $workshopsubmission
@return string HTML | [
"Render",
"the",
"header",
"of",
"the",
"exported",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/classes/portfolio_caller.php#L237-L257 |
215,661 | moodle/moodle | mod/workshop/classes/portfolio_caller.php | mod_workshop_portfolio_caller.export_content | protected function export_content(workshop_submission $workshopsubmission) {
$output = '';
if (!$workshopsubmission->is_anonymous()) {
$author = username_load_fields_from_object((object)[], $workshopsubmission, 'author');
$output .= html_writer::div(get_string('byfullnamewithou... | php | protected function export_content(workshop_submission $workshopsubmission) {
$output = '';
if (!$workshopsubmission->is_anonymous()) {
$author = username_load_fields_from_object((object)[], $workshopsubmission, 'author');
$output .= html_writer::div(get_string('byfullnamewithou... | [
"protected",
"function",
"export_content",
"(",
"workshop_submission",
"$",
"workshopsubmission",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"!",
"$",
"workshopsubmission",
"->",
"is_anonymous",
"(",
")",
")",
"{",
"$",
"author",
"=",
"username_load_f... | Render the content of the submission.
@param workshop_submission $workshopsubmission
@return string | [
"Render",
"the",
"content",
"of",
"the",
"submission",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/classes/portfolio_caller.php#L265-L319 |
215,662 | moodle/moodle | mod/workshop/classes/portfolio_caller.php | mod_workshop_portfolio_caller.export_assessment | protected function export_assessment(workshop_assessment $assessment) {
$output = '';
if (empty($assessment->title)) {
$title = get_string('assessment', 'workshop');
} else {
$title = s($assessment->title);
}
$output .= html_writer::tag('h3', $title);
... | php | protected function export_assessment(workshop_assessment $assessment) {
$output = '';
if (empty($assessment->title)) {
$title = get_string('assessment', 'workshop');
} else {
$title = s($assessment->title);
}
$output .= html_writer::tag('h3', $title);
... | [
"protected",
"function",
"export_assessment",
"(",
"workshop_assessment",
"$",
"assessment",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"empty",
"(",
"$",
"assessment",
"->",
"title",
")",
")",
"{",
"$",
"title",
"=",
"get_string",
"(",
"'assessme... | Render the content of an assessment.
@param workshop_assessment $assessment
@return string HTML | [
"Render",
"the",
"content",
"of",
"an",
"assessment",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/classes/portfolio_caller.php#L327-L361 |
215,663 | moodle/moodle | mod/workshop/classes/portfolio_caller.php | mod_workshop_portfolio_caller.export_files_list | protected function export_files_list($filearea) {
$output = '';
$files = [];
foreach ($this->multifiles as $file) {
if ($file->is_directory()) {
continue;
}
if ($file->get_filearea() !== $filearea) {
continue;
}
... | php | protected function export_files_list($filearea) {
$output = '';
$files = [];
foreach ($this->multifiles as $file) {
if ($file->is_directory()) {
continue;
}
if ($file->get_filearea() !== $filearea) {
continue;
}
... | [
"protected",
"function",
"export_files_list",
"(",
"$",
"filearea",
")",
"{",
"$",
"output",
"=",
"''",
";",
"$",
"files",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"multifiles",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"file",
"->... | Export the files in the given file area in a list.
@param string $filearea
@return string HTML | [
"Export",
"the",
"files",
"in",
"the",
"given",
"file",
"area",
"in",
"a",
"list",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/classes/portfolio_caller.php#L369-L395 |
215,664 | moodle/moodle | mod/workshop/classes/portfolio_caller.php | mod_workshop_portfolio_caller.export_content_leap2a | protected function export_content_leap2a(portfolio_format_leap2a_writer $leapwriter,
workshop_submission $workshopsubmission, $html) {
$entry = new portfolio_format_leap2a_entry('workshopsubmission'.$workshopsubmission->id, s($workshopsubmission->title),
'resource', $html);
$en... | php | protected function export_content_leap2a(portfolio_format_leap2a_writer $leapwriter,
workshop_submission $workshopsubmission, $html) {
$entry = new portfolio_format_leap2a_entry('workshopsubmission'.$workshopsubmission->id, s($workshopsubmission->title),
'resource', $html);
$en... | [
"protected",
"function",
"export_content_leap2a",
"(",
"portfolio_format_leap2a_writer",
"$",
"leapwriter",
",",
"workshop_submission",
"$",
"workshopsubmission",
",",
"$",
"html",
")",
"{",
"$",
"entry",
"=",
"new",
"portfolio_format_leap2a_entry",
"(",
"'workshopsubmiss... | Add a LEAP2A entry element that corresponds to a submission including attachments.
@param portfolio_format_leap2a_writer $leapwriter Writer object to add entries to.
@param workshop_submission $workshopsubmission
@param string $html The exported HTML content of the submission
@return int id of new entry | [
"Add",
"a",
"LEAP2A",
"entry",
"element",
"that",
"corresponds",
"to",
"a",
"submission",
"including",
"attachments",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/classes/portfolio_caller.php#L425-L443 |
215,665 | moodle/moodle | mod/workshop/classes/portfolio_caller.php | mod_workshop_portfolio_caller.get_return_url | public function get_return_url() {
$returnurl = new moodle_url('/mod/workshop/submission.php', ['cmid' => $this->cm->id, 'id' => $this->submissionid]);
return $returnurl->out();
} | php | public function get_return_url() {
$returnurl = new moodle_url('/mod/workshop/submission.php', ['cmid' => $this->cm->id, 'id' => $this->submissionid]);
return $returnurl->out();
} | [
"public",
"function",
"get_return_url",
"(",
")",
"{",
"$",
"returnurl",
"=",
"new",
"moodle_url",
"(",
"'/mod/workshop/submission.php'",
",",
"[",
"'cmid'",
"=>",
"$",
"this",
"->",
"cm",
"->",
"id",
",",
"'id'",
"=>",
"$",
"this",
"->",
"submissionid",
"... | Return URL for redirecting the user back to where the export started.
@return string | [
"Return",
"URL",
"for",
"redirecting",
"the",
"user",
"back",
"to",
"where",
"the",
"export",
"started",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/classes/portfolio_caller.php#L450-L454 |
215,666 | moodle/moodle | mod/workshop/classes/portfolio_caller.php | mod_workshop_portfolio_caller.get_sha1 | public function get_sha1() {
$identifier = 'submission:'.$this->submission->id.'@'.$this->submission->timemodified;
if ($this->assessments) {
$ids = array_keys($this->assessments);
sort($ids);
$identifier .= '/assessments:'.implode(',', $ids);
}
if ... | php | public function get_sha1() {
$identifier = 'submission:'.$this->submission->id.'@'.$this->submission->timemodified;
if ($this->assessments) {
$ids = array_keys($this->assessments);
sort($ids);
$identifier .= '/assessments:'.implode(',', $ids);
}
if ... | [
"public",
"function",
"get_sha1",
"(",
")",
"{",
"$",
"identifier",
"=",
"'submission:'",
".",
"$",
"this",
"->",
"submission",
"->",
"id",
".",
"'@'",
".",
"$",
"this",
"->",
"submission",
"->",
"timemodified",
";",
"if",
"(",
"$",
"this",
"->",
"asse... | Return the SHA1 hash of the exported content.
@return string | [
"Return",
"the",
"SHA1",
"hash",
"of",
"the",
"exported",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/classes/portfolio_caller.php#L493-L508 |
215,667 | moodle/moodle | lib/classes/oauth2/rest.php | rest.call | public function call($functionname, $functionargs, $rawpost = false, $contenttype = false) {
$functions = $this->get_api_functions();
$supportedmethods = [ 'get', 'put', 'post', 'patch', 'head', 'delete' ];
if (empty($functions[$functionname])) {
throw new coding_exception('unsupport... | php | public function call($functionname, $functionargs, $rawpost = false, $contenttype = false) {
$functions = $this->get_api_functions();
$supportedmethods = [ 'get', 'put', 'post', 'patch', 'head', 'delete' ];
if (empty($functions[$functionname])) {
throw new coding_exception('unsupport... | [
"public",
"function",
"call",
"(",
"$",
"functionname",
",",
"$",
"functionargs",
",",
"$",
"rawpost",
"=",
"false",
",",
"$",
"contenttype",
"=",
"false",
")",
"{",
"$",
"functions",
"=",
"$",
"this",
"->",
"get_api_functions",
"(",
")",
";",
"$",
"su... | Call a function from the Api with a set of arguments and optional data.
@param string $functionname
@param array $functionargs
@param string $rawpost Optional param to include in the body of a post.
@param string $contenttype The MIME type for the request's Content-Type header.
@return string|stdClass | [
"Call",
"a",
"function",
"from",
"the",
"Api",
"with",
"a",
"set",
"of",
"arguments",
"and",
"optional",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/rest.php#L71-L133 |
215,668 | moodle/moodle | lib/classes/files/curl_security_helper.php | curl_security_helper.port_is_blocked | protected function port_is_blocked($port) {
$portnum = intval($port);
// Intentionally block port 0 and below and check the int cast was valid.
if (empty($port) || (string)$portnum !== (string)$port || $port < 0) {
return true;
}
$allowedports = $this->get_whitelisted... | php | protected function port_is_blocked($port) {
$portnum = intval($port);
// Intentionally block port 0 and below and check the int cast was valid.
if (empty($port) || (string)$portnum !== (string)$port || $port < 0) {
return true;
}
$allowedports = $this->get_whitelisted... | [
"protected",
"function",
"port_is_blocked",
"(",
"$",
"port",
")",
"{",
"$",
"portnum",
"=",
"intval",
"(",
"$",
"port",
")",
";",
"// Intentionally block port 0 and below and check the int cast was valid.",
"if",
"(",
"empty",
"(",
"$",
"port",
")",
"||",
"(",
... | Checks whether the given port is blocked, as determined by its absence on the ports whitelist.
Ports are assumed to be blocked unless found in the whitelist.
@param integer|string $port the port to check against the ports whitelist.
@return bool true if the port is blocked, false otherwise. | [
"Checks",
"whether",
"the",
"given",
"port",
"is",
"blocked",
"as",
"determined",
"by",
"its",
"absence",
"on",
"the",
"ports",
"whitelist",
".",
"Ports",
"are",
"assumed",
"to",
"be",
"blocked",
"unless",
"found",
"in",
"the",
"whitelist",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/files/curl_security_helper.php#L191-L199 |
215,669 | moodle/moodle | lib/classes/files/curl_security_helper.php | curl_security_helper.address_explicitly_blocked | protected function address_explicitly_blocked($addr) {
$blockedhosts = $this->get_blacklisted_hosts_by_category();
$iphostsblocked = array_merge($blockedhosts['ipv4'], $blockedhosts['ipv6']);
return address_in_subnet($addr, implode(',', $iphostsblocked));
} | php | protected function address_explicitly_blocked($addr) {
$blockedhosts = $this->get_blacklisted_hosts_by_category();
$iphostsblocked = array_merge($blockedhosts['ipv4'], $blockedhosts['ipv6']);
return address_in_subnet($addr, implode(',', $iphostsblocked));
} | [
"protected",
"function",
"address_explicitly_blocked",
"(",
"$",
"addr",
")",
"{",
"$",
"blockedhosts",
"=",
"$",
"this",
"->",
"get_blacklisted_hosts_by_category",
"(",
")",
";",
"$",
"iphostsblocked",
"=",
"array_merge",
"(",
"$",
"blockedhosts",
"[",
"'ipv4'",
... | Checks whether the input address is blocked by at any of the IPv4 or IPv6 address rules.
@param string $addr the ip address to check.
@return bool true if the address is covered by an entry in the blacklist, false otherwise. | [
"Checks",
"whether",
"the",
"input",
"address",
"is",
"blocked",
"by",
"at",
"any",
"of",
"the",
"IPv4",
"or",
"IPv6",
"address",
"rules",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/files/curl_security_helper.php#L217-L221 |
215,670 | moodle/moodle | lib/classes/files/curl_security_helper.php | curl_security_helper.get_blacklisted_hosts_by_category | protected function get_blacklisted_hosts_by_category() {
// For each of the admin setting entries, check and place in the correct section of the config array.
$config = ['ipv6' => [], 'ipv4' => [], 'domain' => [], 'domainwildcard' => []];
$entries = $this->get_blacklisted_hosts();
foreac... | php | protected function get_blacklisted_hosts_by_category() {
// For each of the admin setting entries, check and place in the correct section of the config array.
$config = ['ipv6' => [], 'ipv4' => [], 'domain' => [], 'domainwildcard' => []];
$entries = $this->get_blacklisted_hosts();
foreac... | [
"protected",
"function",
"get_blacklisted_hosts_by_category",
"(",
")",
"{",
"// For each of the admin setting entries, check and place in the correct section of the config array.",
"$",
"config",
"=",
"[",
"'ipv6'",
"=>",
"[",
"]",
",",
"'ipv4'",
"=>",
"[",
"]",
",",
"'dom... | Helper to get all entries from the admin setting, as an array, sorted by classification.
Classifications include 'ipv4', 'ipv6', 'domain', 'domainwildcard'.
@return array of host/domain/ip entries from the 'curlsecurityblockedhosts' config. | [
"Helper",
"to",
"get",
"all",
"entries",
"from",
"the",
"admin",
"setting",
"as",
"an",
"array",
"sorted",
"by",
"classification",
".",
"Classifications",
"include",
"ipv4",
"ipv6",
"domain",
"domainwildcard",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/files/curl_security_helper.php#L241-L257 |
215,671 | moodle/moodle | lib/classes/files/curl_security_helper.php | curl_security_helper.get_whitelisted_ports | protected function get_whitelisted_ports() {
global $CFG;
if (!isset($CFG->curlsecurityallowedport)) {
return [];
}
return array_filter(array_map('trim', explode("\n", $CFG->curlsecurityallowedport)), function($entry) {
return !empty($entry);
});
} | php | protected function get_whitelisted_ports() {
global $CFG;
if (!isset($CFG->curlsecurityallowedport)) {
return [];
}
return array_filter(array_map('trim', explode("\n", $CFG->curlsecurityallowedport)), function($entry) {
return !empty($entry);
});
} | [
"protected",
"function",
"get_whitelisted_ports",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"CFG",
"->",
"curlsecurityallowedport",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"return",
"array_filter",
"(",
"array_map",
... | Helper that returns the whitelisted ports, as defined in the 'curlsecurityallowedport' setting.
@return array the array of whitelisted ports. | [
"Helper",
"that",
"returns",
"the",
"whitelisted",
"ports",
"as",
"defined",
"in",
"the",
"curlsecurityallowedport",
"setting",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/files/curl_security_helper.php#L264-L272 |
215,672 | moodle/moodle | lib/classes/files/curl_security_helper.php | curl_security_helper.get_blacklisted_hosts | protected function get_blacklisted_hosts() {
global $CFG;
if (!isset($CFG->curlsecurityblockedhosts)) {
return [];
}
return array_filter(array_map('trim', explode("\n", $CFG->curlsecurityblockedhosts)), function($entry) {
return !empty($entry);
});
} | php | protected function get_blacklisted_hosts() {
global $CFG;
if (!isset($CFG->curlsecurityblockedhosts)) {
return [];
}
return array_filter(array_map('trim', explode("\n", $CFG->curlsecurityblockedhosts)), function($entry) {
return !empty($entry);
});
} | [
"protected",
"function",
"get_blacklisted_hosts",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"CFG",
"->",
"curlsecurityblockedhosts",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"return",
"array_filter",
"(",
"array_map",... | Helper that returns the blacklisted hosts, as defined in the 'curlsecurityblockedhosts' setting.
@return array the array of blacklisted host entries. | [
"Helper",
"that",
"returns",
"the",
"blacklisted",
"hosts",
"as",
"defined",
"in",
"the",
"curlsecurityblockedhosts",
"setting",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/files/curl_security_helper.php#L279-L287 |
215,673 | moodle/moodle | lib/behat/behat_base.php | behat_base.locate_path | protected function locate_path($path) {
$starturl = rtrim($this->getMinkParameter('base_url'), '/') . '/';
return 0 !== strpos($path, 'http') ? $starturl . ltrim($path, '/') : $path;
} | php | protected function locate_path($path) {
$starturl = rtrim($this->getMinkParameter('base_url'), '/') . '/';
return 0 !== strpos($path, 'http') ? $starturl . ltrim($path, '/') : $path;
} | [
"protected",
"function",
"locate_path",
"(",
"$",
"path",
")",
"{",
"$",
"starturl",
"=",
"rtrim",
"(",
"$",
"this",
"->",
"getMinkParameter",
"(",
"'base_url'",
")",
",",
"'/'",
")",
".",
"'/'",
";",
"return",
"0",
"!==",
"strpos",
"(",
"$",
"path",
... | Locates url, based on provided path.
Override to provide custom routing mechanism.
@see Behat\MinkExtension\Context\MinkContext
@param string $path
@return string | [
"Locates",
"url",
"based",
"on",
"provided",
"path",
".",
"Override",
"to",
"provide",
"custom",
"routing",
"mechanism",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L101-L104 |
215,674 | moodle/moodle | lib/behat/behat_base.php | behat_base.find | protected function find($selector, $locator, $exception = false, $node = false, $timeout = false) {
// Throw exception, so dev knows it is not supported.
if ($selector === 'named') {
$exception = 'Using the "named" selector is deprecated as of 3.1. '
.' Use the "named_partia... | php | protected function find($selector, $locator, $exception = false, $node = false, $timeout = false) {
// Throw exception, so dev knows it is not supported.
if ($selector === 'named') {
$exception = 'Using the "named" selector is deprecated as of 3.1. '
.' Use the "named_partia... | [
"protected",
"function",
"find",
"(",
"$",
"selector",
",",
"$",
"locator",
",",
"$",
"exception",
"=",
"false",
",",
"$",
"node",
"=",
"false",
",",
"$",
"timeout",
"=",
"false",
")",
"{",
"// Throw exception, so dev knows it is not supported.",
"if",
"(",
... | Returns the first matching element.
@link http://mink.behat.org/#traverse-the-page-selectors
@param string $selector The selector type (css, xpath, named...)
@param mixed $locator It depends on the $selector, can be the xpath, a name, a css locator...
@param Exception $exception Otherwise we throw exception with gener... | [
"Returns",
"the",
"first",
"matching",
"element",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L117-L129 |
215,675 | moodle/moodle | lib/behat/behat_base.php | behat_base.find_all | protected function find_all($selector, $locator, $exception = false, $node = false, $timeout = false) {
// Throw exception, so dev knows it is not supported.
if ($selector === 'named') {
$exception = 'Using the "named" selector is deprecated as of 3.1. '
.' Use the "named_pa... | php | protected function find_all($selector, $locator, $exception = false, $node = false, $timeout = false) {
// Throw exception, so dev knows it is not supported.
if ($selector === 'named') {
$exception = 'Using the "named" selector is deprecated as of 3.1. '
.' Use the "named_pa... | [
"protected",
"function",
"find_all",
"(",
"$",
"selector",
",",
"$",
"locator",
",",
"$",
"exception",
"=",
"false",
",",
"$",
"node",
"=",
"false",
",",
"$",
"timeout",
"=",
"false",
")",
"{",
"// Throw exception, so dev knows it is not supported.",
"if",
"("... | Returns all matching elements.
Adapter to Behat\Mink\Element\Element::findAll() using the spin() method.
@link http://mink.behat.org/#traverse-the-page-selectors
@param string $selector The selector type (css, xpath, named...)
@param mixed $locator It depends on the $selector, can be the xpath, a name, a css locator.... | [
"Returns",
"all",
"matching",
"elements",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L144-L227 |
215,676 | moodle/moodle | lib/behat/behat_base.php | behat_base.spin | protected function spin($lambda, $args = false, $timeout = false, $exception = false, $microsleep = false) {
// Using default timeout which is pretty high.
if (!$timeout) {
$timeout = self::get_timeout();
}
if ($microsleep) {
// Will sleep 1/10th of a second by d... | php | protected function spin($lambda, $args = false, $timeout = false, $exception = false, $microsleep = false) {
// Using default timeout which is pretty high.
if (!$timeout) {
$timeout = self::get_timeout();
}
if ($microsleep) {
// Will sleep 1/10th of a second by d... | [
"protected",
"function",
"spin",
"(",
"$",
"lambda",
",",
"$",
"args",
"=",
"false",
",",
"$",
"timeout",
"=",
"false",
",",
"$",
"exception",
"=",
"false",
",",
"$",
"microsleep",
"=",
"false",
")",
"{",
"// Using default timeout which is pretty high.",
"if... | Executes the passed closure until returns true or time outs.
In most cases the document.readyState === 'complete' will be enough, but sometimes JS
requires more time to be completely loaded or an element to be visible or whatever is required to
perform some action on an element; this method receives a closure which sh... | [
"Executes",
"the",
"passed",
"closure",
"until",
"returns",
"true",
"or",
"time",
"outs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L319-L370 |
215,677 | moodle/moodle | lib/behat/behat_base.php | behat_base.get_node_in_container | protected function get_node_in_container($selectortype, $element, $containerselectortype, $containerelement) {
// Gets the container, it will always be text based.
$containernode = $this->get_text_selector_node($containerselectortype, $containerelement);
list($selector, $locator) = $this->tran... | php | protected function get_node_in_container($selectortype, $element, $containerselectortype, $containerelement) {
// Gets the container, it will always be text based.
$containernode = $this->get_text_selector_node($containerselectortype, $containerelement);
list($selector, $locator) = $this->tran... | [
"protected",
"function",
"get_node_in_container",
"(",
"$",
"selectortype",
",",
"$",
"element",
",",
"$",
"containerselectortype",
",",
"$",
"containerelement",
")",
"{",
"// Gets the container, it will always be text based.",
"$",
"containernode",
"=",
"$",
"this",
"-... | Gets the requested element inside the specified container.
@throws ElementNotFoundException Thrown by behat_base::find
@param mixed $selectortype The element selector type.
@param mixed $element The element locator.
@param mixed $containerselectortype The container selector type.
@param mixed $containerelement The con... | [
"Gets",
"the",
"requested",
"element",
"inside",
"the",
"specified",
"container",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L418-L431 |
215,678 | moodle/moodle | lib/behat/behat_base.php | behat_base.ensure_element_exists | protected function ensure_element_exists($element, $selectortype) {
// Getting the behat selector & locator.
list($selector, $locator) = $this->transform_selector($selectortype, $element);
// Exception if it timesout and the element is still there.
$msg = 'The "' . $element . '" elemen... | php | protected function ensure_element_exists($element, $selectortype) {
// Getting the behat selector & locator.
list($selector, $locator) = $this->transform_selector($selectortype, $element);
// Exception if it timesout and the element is still there.
$msg = 'The "' . $element . '" elemen... | [
"protected",
"function",
"ensure_element_exists",
"(",
"$",
"element",
",",
"$",
"selectortype",
")",
"{",
"// Getting the behat selector & locator.",
"list",
"(",
"$",
"selector",
",",
"$",
"locator",
")",
"=",
"$",
"this",
"->",
"transform_selector",
"(",
"$",
... | Spins around an element until it exists
@throws ExpectationException
@param string $element
@param string $selectortype
@return void | [
"Spins",
"around",
"an",
"element",
"until",
"it",
"exists"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L512-L536 |
215,679 | moodle/moodle | lib/behat/behat_base.php | behat_base.ensure_node_is_visible | protected function ensure_node_is_visible($node) {
if (!$this->running_javascript()) {
return;
}
// Exception if it timesout and the element is still there.
$msg = 'The "' . $node->getXPath() . '" xpath node is not visible and it should be visible';
$exception = new... | php | protected function ensure_node_is_visible($node) {
if (!$this->running_javascript()) {
return;
}
// Exception if it timesout and the element is still there.
$msg = 'The "' . $node->getXPath() . '" xpath node is not visible and it should be visible';
$exception = new... | [
"protected",
"function",
"ensure_node_is_visible",
"(",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"running_javascript",
"(",
")",
")",
"{",
"return",
";",
"}",
"// Exception if it timesout and the element is still there.",
"$",
"msg",
"=",
"'The \"... | Ensures that the provided node is visible and we can interact with it.
@throws ExpectationException
@param NodeElement $node
@return void Throws an exception if it times out without the element being visible | [
"Ensures",
"that",
"the",
"provided",
"node",
"is",
"visible",
"and",
"we",
"can",
"interact",
"with",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L578-L601 |
215,680 | moodle/moodle | lib/behat/behat_base.php | behat_base.ensure_node_attribute_is_set | protected function ensure_node_attribute_is_set($node, $attribute, $attributevalue) {
if (!$this->running_javascript()) {
return;
}
// Exception if it timesout and the element is still there.
$msg = 'The "' . $node->getXPath() . '" xpath node is not visible and it should be... | php | protected function ensure_node_attribute_is_set($node, $attribute, $attributevalue) {
if (!$this->running_javascript()) {
return;
}
// Exception if it timesout and the element is still there.
$msg = 'The "' . $node->getXPath() . '" xpath node is not visible and it should be... | [
"protected",
"function",
"ensure_node_attribute_is_set",
"(",
"$",
"node",
",",
"$",
"attribute",
",",
"$",
"attributevalue",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"running_javascript",
"(",
")",
")",
"{",
"return",
";",
"}",
"// Exception if it timesou... | Ensures that the provided node has a attribute value set. This step can be used to check if specific
JS has finished modifying the node.
@throws ExpectationException
@param NodeElement $node
@param string $attribute attribute name
@param string $attributevalue attribute value to check.
@return void Throws an exception... | [
"Ensures",
"that",
"the",
"provided",
"node",
"has",
"a",
"attribute",
"value",
"set",
".",
"This",
"step",
"can",
"be",
"used",
"to",
"check",
"if",
"specific",
"JS",
"has",
"finished",
"modifying",
"the",
"node",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L613-L636 |
215,681 | moodle/moodle | lib/behat/behat_base.php | behat_base.ensure_element_is_visible | protected function ensure_element_is_visible($element, $selectortype) {
if (!$this->running_javascript()) {
return;
}
$node = $this->get_selected_node($selectortype, $element);
$this->ensure_node_is_visible($node);
return $node;
} | php | protected function ensure_element_is_visible($element, $selectortype) {
if (!$this->running_javascript()) {
return;
}
$node = $this->get_selected_node($selectortype, $element);
$this->ensure_node_is_visible($node);
return $node;
} | [
"protected",
"function",
"ensure_element_is_visible",
"(",
"$",
"element",
",",
"$",
"selectortype",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"running_javascript",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"node",
"=",
"$",
"this",
"->",
"get_sele... | Ensures that the provided element is visible and we can interact with it.
Returns the node in case other actions are interested in using it.
@throws ExpectationException
@param string $element
@param string $selectortype
@return NodeElement Throws an exception if it times out without being visible | [
"Ensures",
"that",
"the",
"provided",
"element",
"is",
"visible",
"and",
"we",
"can",
"interact",
"with",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L648-L658 |
215,682 | moodle/moodle | lib/behat/behat_base.php | behat_base.wait_for_pending_js_in_session | public static function wait_for_pending_js_in_session(Session $session) {
// We don't use behat_base::spin() here as we don't want to end up with an exception
// if the page & JSs don't finish loading properly.
for ($i = 0; $i < self::get_extended_timeout() * 10; $i++) {
$pending = '... | php | public static function wait_for_pending_js_in_session(Session $session) {
// We don't use behat_base::spin() here as we don't want to end up with an exception
// if the page & JSs don't finish loading properly.
for ($i = 0; $i < self::get_extended_timeout() * 10; $i++) {
$pending = '... | [
"public",
"static",
"function",
"wait_for_pending_js_in_session",
"(",
"Session",
"$",
"session",
")",
"{",
"// We don't use behat_base::spin() here as we don't want to end up with an exception",
"// if the page & JSs don't finish loading properly.",
"for",
"(",
"$",
"i",
"=",
"0",... | Waits for all the JS to be loaded.
@param Session $session The Mink Session where JS can be run
@return bool Whether any JS is still pending completion. | [
"Waits",
"for",
"all",
"the",
"JS",
"to",
"be",
"loaded",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L767-L818 |
215,683 | moodle/moodle | lib/behat/behat_base.php | behat_base.execute | protected function execute($contextapi, $params = array()) {
if (!is_array($params)) {
$params = array($params);
}
// Get required context and execute the api.
$contextapi = explode("::", $contextapi);
$context = behat_context_helper::get($contextapi[0]);
cal... | php | protected function execute($contextapi, $params = array()) {
if (!is_array($params)) {
$params = array($params);
}
// Get required context and execute the api.
$contextapi = explode("::", $contextapi);
$context = behat_context_helper::get($contextapi[0]);
cal... | [
"protected",
"function",
"execute",
"(",
"$",
"contextapi",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"$",
"params",
")",
";",
"}",
"// G... | Helper function to execute api in a given context.
@param string $contextapi context in which api is defined.
@param array $params list of params to pass.
@throws Exception | [
"Helper",
"function",
"to",
"execute",
"api",
"in",
"a",
"given",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L957-L975 |
215,684 | moodle/moodle | lib/behat/behat_base.php | behat_base.js_trigger_click | protected function js_trigger_click($node) {
if (!$this->running_javascript()) {
$node->click();
}
$this->ensure_node_is_visible($node); // Ensures hidden elements can't be clicked.
$xpath = $node->getXpath();
$driver = $this->getSession()->getDriver();
if ($d... | php | protected function js_trigger_click($node) {
if (!$this->running_javascript()) {
$node->click();
}
$this->ensure_node_is_visible($node); // Ensures hidden elements can't be clicked.
$xpath = $node->getXpath();
$driver = $this->getSession()->getDriver();
if ($d... | [
"protected",
"function",
"js_trigger_click",
"(",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"running_javascript",
"(",
")",
")",
"{",
"$",
"node",
"->",
"click",
"(",
")",
";",
"}",
"$",
"this",
"->",
"ensure_node_is_visible",
"(",
"$",... | Trigger click on node via javascript instead of actually clicking on it via pointer.
This function resolves the issue of nested elements with click listeners or links - in these cases clicking via
the pointer may accidentally cause a click on the wrong element.
Example of issue: clicking to expand navigation nodes whe... | [
"Trigger",
"click",
"on",
"node",
"via",
"javascript",
"instead",
"of",
"actually",
"clicking",
"on",
"it",
"via",
"pointer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L1032-L1045 |
215,685 | moodle/moodle | lib/behat/behat_base.php | behat_base.get_real_timeout | protected static function get_real_timeout(int $timeout) : int {
global $CFG;
if (!empty($CFG->behat_increasetimeout)) {
return $timeout * $CFG->behat_increasetimeout;
} else {
return $timeout;
}
} | php | protected static function get_real_timeout(int $timeout) : int {
global $CFG;
if (!empty($CFG->behat_increasetimeout)) {
return $timeout * $CFG->behat_increasetimeout;
} else {
return $timeout;
}
} | [
"protected",
"static",
"function",
"get_real_timeout",
"(",
"int",
"$",
"timeout",
")",
":",
"int",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"behat_increasetimeout",
")",
")",
"{",
"return",
"$",
"timeout",
"*",
"... | Gets the required timeout in seconds.
@param int $timeout One of the TIMEOUT constants
@return int Actual timeout (in seconds) | [
"Gets",
"the",
"required",
"timeout",
"in",
"seconds",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_base.php#L1053-L1060 |
215,686 | moodle/moodle | customfield/classes/privacy/provider.php | provider.get_customfields_data_contexts | public static function get_customfields_data_contexts(string $component, string $area,
string $itemidstest = 'IS NOT NULL', string $instanceidstest = 'IS NOT NULL', array $params = []) : contextlist {
$sql = "SELECT d.contextid FROM {customfield_category} c
JOIN {customfield_field} f ON... | php | public static function get_customfields_data_contexts(string $component, string $area,
string $itemidstest = 'IS NOT NULL', string $instanceidstest = 'IS NOT NULL', array $params = []) : contextlist {
$sql = "SELECT d.contextid FROM {customfield_category} c
JOIN {customfield_field} f ON... | [
"public",
"static",
"function",
"get_customfields_data_contexts",
"(",
"string",
"$",
"component",
",",
"string",
"$",
"area",
",",
"string",
"$",
"itemidstest",
"=",
"'IS NOT NULL'",
",",
"string",
"$",
"instanceidstest",
"=",
"'IS NOT NULL'",
",",
"array",
"$",
... | Returns contexts that have customfields data
To be used in implementations of core_user_data_provider::get_contexts_for_userid
Caller needs to transfer the $userid to the select subqueries for
customfield_category->itemid and/or customfield_data->instanceid
@param string $component
@param string $area
@param string $... | [
"Returns",
"contexts",
"that",
"have",
"customfields",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/privacy/provider.php#L105-L117 |
215,687 | moodle/moodle | customfield/classes/privacy/provider.php | provider.export_customfields_data | public static function export_customfields_data(approved_contextlist $contextlist, string $component, string $area,
string $itemidstest = 'IS NOT NULL', string $instanceidstest = 'IS NOT NULL', array $params = [],
array $subcontext = null) {
global $DB;
// This query is ... | php | public static function export_customfields_data(approved_contextlist $contextlist, string $component, string $area,
string $itemidstest = 'IS NOT NULL', string $instanceidstest = 'IS NOT NULL', array $params = [],
array $subcontext = null) {
global $DB;
// This query is ... | [
"public",
"static",
"function",
"export_customfields_data",
"(",
"approved_contextlist",
"$",
"contextlist",
",",
"string",
"$",
"component",
",",
"string",
"$",
"area",
",",
"string",
"$",
"itemidstest",
"=",
"'IS NOT NULL'",
",",
"string",
"$",
"instanceidstest",
... | Exports customfields data
To be used in implementations of core_user_data_provider::export_user_data
Caller needs to transfer the $userid to the select subqueries for
customfield_category->itemid and/or customfield_data->instanceid
@param approved_contextlist $contextlist
@param string $component
@param string $area
... | [
"Exports",
"customfields",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/privacy/provider.php#L164-L205 |
215,688 | moodle/moodle | customfield/classes/privacy/provider.php | provider.delete_customfields_data | public static function delete_customfields_data(approved_contextlist $contextlist, string $component, string $area,
string $itemidstest = 'IS NOT NULL', string $instanceidstest = 'IS NOT NULL', array $params = []) {
global $DB;
list($contextidstest, $contextparams) = $DB->get_in_or_equal($c... | php | public static function delete_customfields_data(approved_contextlist $contextlist, string $component, string $area,
string $itemidstest = 'IS NOT NULL', string $instanceidstest = 'IS NOT NULL', array $params = []) {
global $DB;
list($contextidstest, $contextparams) = $DB->get_in_or_equal($c... | [
"public",
"static",
"function",
"delete_customfields_data",
"(",
"approved_contextlist",
"$",
"contextlist",
",",
"string",
"$",
"component",
",",
"string",
"$",
"area",
",",
"string",
"$",
"itemidstest",
"=",
"'IS NOT NULL'",
",",
"string",
"$",
"instanceidstest",
... | Deletes customfields data
To be used in implementations of core_user_data_provider::delete_data_for_user
Caller needs to transfer the $userid to the select subqueries for
customfield_category->itemid and/or customfield_data->instanceid
@param approved_contextlist $contextlist
@param string $component
@param string $a... | [
"Deletes",
"customfields",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/privacy/provider.php#L221-L242 |
215,689 | moodle/moodle | customfield/classes/privacy/provider.php | provider.delete_customfields_data_for_context | public static function delete_customfields_data_for_context(string $component, string $area, \context $context) {
global $DB;
$sql = "SELECT d.id
FROM {customfield_category} c
JOIN {customfield_field} f ON f.categoryid = c.id
JOIN {customfield_data} d ON d.fieldid = ... | php | public static function delete_customfields_data_for_context(string $component, string $area, \context $context) {
global $DB;
$sql = "SELECT d.id
FROM {customfield_category} c
JOIN {customfield_field} f ON f.categoryid = c.id
JOIN {customfield_data} d ON d.fieldid = ... | [
"public",
"static",
"function",
"delete_customfields_data_for_context",
"(",
"string",
"$",
"component",
",",
"string",
"$",
"area",
",",
"\\",
"context",
"$",
"context",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT d.id\n FROM {custom... | Deletes all customfields data for the given context
To be used in implementations of core_user_data_provider::delete_data_for_all_users_in_context
@param string $component
@param string $area
@param \context $context | [
"Deletes",
"all",
"customfields",
"data",
"for",
"the",
"given",
"context"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/privacy/provider.php#L303-L323 |
215,690 | moodle/moodle | customfield/classes/privacy/provider.php | provider.delete_categories | protected static function delete_categories(array $contextids, array $categoriesids) {
global $DB;
if (!$categoriesids) {
return;
}
list($categoryidstest, $catparams) = $DB->get_in_or_equal($categoriesids, SQL_PARAMS_NAMED, 'cfcat');
$datasql = "SELECT d.id FROM {cu... | php | protected static function delete_categories(array $contextids, array $categoriesids) {
global $DB;
if (!$categoriesids) {
return;
}
list($categoryidstest, $catparams) = $DB->get_in_or_equal($categoriesids, SQL_PARAMS_NAMED, 'cfcat');
$datasql = "SELECT d.id FROM {cu... | [
"protected",
"static",
"function",
"delete_categories",
"(",
"array",
"$",
"contextids",
",",
"array",
"$",
"categoriesids",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"$",
"categoriesids",
")",
"{",
"return",
";",
"}",
"list",
"(",
"$",
"catego... | Delete custom fields categories configurations, all their fields and data
@param array $contextids
@param array $categoriesids | [
"Delete",
"custom",
"fields",
"categories",
"configurations",
"all",
"their",
"fields",
"and",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/privacy/provider.php#L348-L367 |
215,691 | moodle/moodle | customfield/classes/privacy/provider.php | provider.export_customfield_data | public static function export_customfield_data(data_controller $data, array $subcontext) {
$context = $data->get_context();
$exportdata = $data->to_record();
$exportdata->fieldtype = $data->get_field()->get('type');
$exportdata->fieldshortname = $data->get_field()->get('shortname');
... | php | public static function export_customfield_data(data_controller $data, array $subcontext) {
$context = $data->get_context();
$exportdata = $data->to_record();
$exportdata->fieldtype = $data->get_field()->get('type');
$exportdata->fieldshortname = $data->get_field()->get('shortname');
... | [
"public",
"static",
"function",
"export_customfield_data",
"(",
"data_controller",
"$",
"data",
",",
"array",
"$",
"subcontext",
")",
"{",
"$",
"context",
"=",
"$",
"data",
"->",
"get_context",
"(",
")",
";",
"$",
"exportdata",
"=",
"$",
"data",
"->",
"to_... | Exports one instance of custom field data
@param data_controller $data
@param array $subcontext subcontext to pass to content_writer::export_data | [
"Exports",
"one",
"instance",
"of",
"custom",
"field",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/privacy/provider.php#L451-L471 |
215,692 | moodle/moodle | customfield/classes/privacy/provider.php | provider.export_customfield_data_unknown | protected static function export_customfield_data_unknown(\stdClass $record, \stdClass $field, array $subcontext) {
$context = \context::instance_by_id($record->contextid);
$record->fieldtype = $field->type;
$record->fieldshortname = $field->shortname;
$record->fieldname = format_string... | php | protected static function export_customfield_data_unknown(\stdClass $record, \stdClass $field, array $subcontext) {
$context = \context::instance_by_id($record->contextid);
$record->fieldtype = $field->type;
$record->fieldshortname = $field->shortname;
$record->fieldname = format_string... | [
"protected",
"static",
"function",
"export_customfield_data_unknown",
"(",
"\\",
"stdClass",
"$",
"record",
",",
"\\",
"stdClass",
"$",
"field",
",",
"array",
"$",
"subcontext",
")",
"{",
"$",
"context",
"=",
"\\",
"context",
"::",
"instance_by_id",
"(",
"$",
... | Export data record of unknown type when we were not able to create instance of data_controller
@param \stdClass $record record from db table {customfield_data}
@param \stdClass $field field record with at least fields type, shortname, name
@param array $subcontext | [
"Export",
"data",
"record",
"of",
"unknown",
"type",
"when",
"we",
"were",
"not",
"able",
"to",
"create",
"instance",
"of",
"data_controller"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/privacy/provider.php#L480-L491 |
215,693 | moodle/moodle | admin/tool/dataprivacy/classes/data_request.php | data_request.is_expired | public static function is_expired(data_request $request) {
$result = false;
// Only export requests expire.
if ($request->get('type') == api::DATAREQUEST_TYPE_EXPORT) {
switch ($request->get('status')) {
// Expired requests are obviously expired.
case... | php | public static function is_expired(data_request $request) {
$result = false;
// Only export requests expire.
if ($request->get('type') == api::DATAREQUEST_TYPE_EXPORT) {
switch ($request->get('status')) {
// Expired requests are obviously expired.
case... | [
"public",
"static",
"function",
"is_expired",
"(",
"data_request",
"$",
"request",
")",
"{",
"$",
"result",
"=",
"false",
";",
"// Only export requests expire.",
"if",
"(",
"$",
"request",
"->",
"get",
"(",
"'type'",
")",
"==",
"api",
"::",
"DATAREQUEST_TYPE_E... | Determines whether a completed data export request has expired.
The response will be valid regardless of the expiry scheduled task having run.
@param data_request $request the data request object whose expiry will be checked.
@return bool true if the request has expired. | [
"Determines",
"whether",
"a",
"completed",
"data",
"export",
"request",
"has",
"expired",
".",
"The",
"response",
"will",
"be",
"valid",
"regardless",
"of",
"the",
"expiry",
"scheduled",
"task",
"having",
"run",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_request.php#L139-L160 |
215,694 | moodle/moodle | admin/tool/dataprivacy/classes/data_request.php | data_request.get_expired_requests | public static function get_expired_requests($userid = 0) {
global $DB;
$expiryseconds = get_config('tool_dataprivacy', 'privacyrequestexpiry');
$expirytime = strtotime("-{$expiryseconds} second");
$table = self::TABLE;
$sqlwhere = 'type = :export_type AND status = :completestatu... | php | public static function get_expired_requests($userid = 0) {
global $DB;
$expiryseconds = get_config('tool_dataprivacy', 'privacyrequestexpiry');
$expirytime = strtotime("-{$expiryseconds} second");
$table = self::TABLE;
$sqlwhere = 'type = :export_type AND status = :completestatu... | [
"public",
"static",
"function",
"get_expired_requests",
"(",
"$",
"userid",
"=",
"0",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"expiryseconds",
"=",
"get_config",
"(",
"'tool_dataprivacy'",
",",
"'privacyrequestexpiry'",
")",
";",
"$",
"expirytime",
"=",
"strt... | Fetch completed data requests which are due to expire.
@param int $userid Optional user ID to filter by.
@return array Details of completed requests which are due to expire. | [
"Fetch",
"completed",
"data",
"requests",
"which",
"are",
"due",
"to",
"expire",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_request.php#L169-L192 |
215,695 | moodle/moodle | admin/tool/dataprivacy/classes/data_request.php | data_request.expire | public static function expire($expiredrequests) {
global $DB;
$ids = array_keys($expiredrequests);
if (count($ids) > 0) {
list($insql, $inparams) = $DB->get_in_or_equal($ids);
$initialparams = array(api::DATAREQUEST_STATUS_EXPIRED, time());
$params = array_m... | php | public static function expire($expiredrequests) {
global $DB;
$ids = array_keys($expiredrequests);
if (count($ids) > 0) {
list($insql, $inparams) = $DB->get_in_or_equal($ids);
$initialparams = array(api::DATAREQUEST_STATUS_EXPIRED, time());
$params = array_m... | [
"public",
"static",
"function",
"expire",
"(",
"$",
"expiredrequests",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"ids",
"=",
"array_keys",
"(",
"$",
"expiredrequests",
")",
";",
"if",
"(",
"count",
"(",
"$",
"ids",
")",
">",
"0",
")",
"{",
"list",
"... | Expire a given set of data requests.
Update request status and delete the files.
@param array $expiredrequests [requestid => userid]
@return void | [
"Expire",
"a",
"given",
"set",
"of",
"data",
"requests",
".",
"Update",
"request",
"status",
"and",
"delete",
"the",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_request.php#L202-L225 |
215,696 | moodle/moodle | admin/tool/dataprivacy/classes/data_request.php | data_request.is_active | public function is_active() : bool {
$active = [
api::DATAREQUEST_STATUS_APPROVED => true,
];
return isset($active[$this->get('status')]);
} | php | public function is_active() : bool {
$active = [
api::DATAREQUEST_STATUS_APPROVED => true,
];
return isset($active[$this->get('status')]);
} | [
"public",
"function",
"is_active",
"(",
")",
":",
"bool",
"{",
"$",
"active",
"=",
"[",
"api",
"::",
"DATAREQUEST_STATUS_APPROVED",
"=>",
"true",
",",
"]",
";",
"return",
"isset",
"(",
"$",
"active",
"[",
"$",
"this",
"->",
"get",
"(",
"'status'",
")",... | Whether this request is 'active'.
@return bool | [
"Whether",
"this",
"request",
"is",
"active",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_request.php#L253-L259 |
215,697 | moodle/moodle | admin/tool/dataprivacy/classes/data_request.php | data_request.resubmit_request | public function resubmit_request() : data_request {
if ($this->is_active()) {
$this->set('status', api::DATAREQUEST_STATUS_REJECTED)->save();
}
if (!$this->is_resettable()) {
throw new \moodle_exception('cannotreset', 'tool_dataprivacy');
}
$currentdata ... | php | public function resubmit_request() : data_request {
if ($this->is_active()) {
$this->set('status', api::DATAREQUEST_STATUS_REJECTED)->save();
}
if (!$this->is_resettable()) {
throw new \moodle_exception('cannotreset', 'tool_dataprivacy');
}
$currentdata ... | [
"public",
"function",
"resubmit_request",
"(",
")",
":",
"data_request",
"{",
"if",
"(",
"$",
"this",
"->",
"is_active",
"(",
")",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"'status'",
",",
"api",
"::",
"DATAREQUEST_STATUS_REJECTED",
")",
"->",
"save",
"(... | Reject this request and resubmit it as a fresh request.
Note: This does not check whether any other completed requests exist for this user.
@return self | [
"Reject",
"this",
"request",
"and",
"resubmit",
"it",
"as",
"a",
"fresh",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_request.php#L268-L294 |
215,698 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Interaction/Command.php | Horde_Imap_Client_Interaction_Command._continuationCheck | protected function _continuationCheck($list)
{
foreach ($list as $val) {
if (($val instanceof Horde_Imap_Client_Interaction_Command_Continuation) ||
(($val instanceof Horde_Imap_Client_Data_Format_String) &&
$val->literal())) {
return true;
... | php | protected function _continuationCheck($list)
{
foreach ($list as $val) {
if (($val instanceof Horde_Imap_Client_Interaction_Command_Continuation) ||
(($val instanceof Horde_Imap_Client_Data_Format_String) &&
$val->literal())) {
return true;
... | [
"protected",
"function",
"_continuationCheck",
"(",
"$",
"list",
")",
"{",
"foreach",
"(",
"$",
"list",
"as",
"$",
"val",
")",
"{",
"if",
"(",
"(",
"$",
"val",
"instanceof",
"Horde_Imap_Client_Interaction_Command_Continuation",
")",
"||",
"(",
"(",
"$",
"val... | Recursive check for continuation functions. | [
"Recursive",
"check",
"for",
"continuation",
"functions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Interaction/Command.php#L166-L182 |
215,699 | moodle/moodle | question/type/multichoice/backup/moodle1/lib.php | moodle1_qtype_multichoice_handler.process_question | public function process_question(array $data, array $raw) {
// Convert and write the answers first.
if (isset($data['answers'])) {
$this->write_answers($data['answers'], $this->pluginname);
}
// Convert and write the multichoice.
if (!isset($data['multichoice'])) {
... | php | public function process_question(array $data, array $raw) {
// Convert and write the answers first.
if (isset($data['answers'])) {
$this->write_answers($data['answers'], $this->pluginname);
}
// Convert and write the multichoice.
if (!isset($data['multichoice'])) {
... | [
"public",
"function",
"process_question",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"raw",
")",
"{",
"// Convert and write the answers first.",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'answers'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"write_answers"... | Appends the multichoice specific information to the question | [
"Appends",
"the",
"multichoice",
"specific",
"information",
"to",
"the",
"question"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/multichoice/backup/moodle1/lib.php#L44-L68 |
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.