id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
217,100 | moodle/moodle | lib/outputlib.php | theme_config.get_css_cache_key | public function get_css_cache_key() {
$nosvg = (!$this->use_svg_icons()) ? 'nosvg_' : '';
$rtlmode = ($this->rtlmode == true) ? 'rtl' : 'ltr';
return $nosvg . $this->name . '_' . $rtlmode;
} | php | public function get_css_cache_key() {
$nosvg = (!$this->use_svg_icons()) ? 'nosvg_' : '';
$rtlmode = ($this->rtlmode == true) ? 'rtl' : 'ltr';
return $nosvg . $this->name . '_' . $rtlmode;
} | [
"public",
"function",
"get_css_cache_key",
"(",
")",
"{",
"$",
"nosvg",
"=",
"(",
"!",
"$",
"this",
"->",
"use_svg_icons",
"(",
")",
")",
"?",
"'nosvg_'",
":",
"''",
";",
"$",
"rtlmode",
"=",
"(",
"$",
"this",
"->",
"rtlmode",
"==",
"true",
")",
"?... | Generate the css content cache key.
@return string The post processed css cache key. | [
"Generate",
"the",
"css",
"content",
"cache",
"key",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1194-L1199 |
217,101 | moodle/moodle | lib/outputlib.php | theme_config.get_css_content_editor | public function get_css_content_editor() {
$css = '';
$cssfiles = $this->editor_css_files();
// If editor has static CSS, include it.
foreach ($cssfiles as $file) {
$css .= file_get_contents($file)."\n";
}
// If editor has SCSS, compile and include it.
... | php | public function get_css_content_editor() {
$css = '';
$cssfiles = $this->editor_css_files();
// If editor has static CSS, include it.
foreach ($cssfiles as $file) {
$css .= file_get_contents($file)."\n";
}
// If editor has SCSS, compile and include it.
... | [
"public",
"function",
"get_css_content_editor",
"(",
")",
"{",
"$",
"css",
"=",
"''",
";",
"$",
"cssfiles",
"=",
"$",
"this",
"->",
"editor_css_files",
"(",
")",
";",
"// If editor has static CSS, include it.",
"foreach",
"(",
"$",
"cssfiles",
"as",
"$",
"file... | Get the whole css stylesheet for editor iframe.
NOTE: this method is not expected to be used from any addons.
@return string CSS markup | [
"Get",
"the",
"whole",
"css",
"stylesheet",
"for",
"editor",
"iframe",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1293-L1310 |
217,102 | moodle/moodle | lib/outputlib.php | theme_config.get_css_content_from_less | protected function get_css_content_from_less($themedesigner) {
global $CFG;
$lessfile = $this->lessfile;
if (!$lessfile || !is_readable($this->dir . '/less/' . $lessfile . '.less')) {
throw new coding_exception('The theme did not define a LESS file, or it is not readable.');
... | php | protected function get_css_content_from_less($themedesigner) {
global $CFG;
$lessfile = $this->lessfile;
if (!$lessfile || !is_readable($this->dir . '/less/' . $lessfile . '.less')) {
throw new coding_exception('The theme did not define a LESS file, or it is not readable.');
... | [
"protected",
"function",
"get_css_content_from_less",
"(",
"$",
"themedesigner",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"lessfile",
"=",
"$",
"this",
"->",
"lessfile",
";",
"if",
"(",
"!",
"$",
"lessfile",
"||",
"!",
"is_readable",
"(",
"$",
"this",
"... | Return the CSS content generated from LESS the file.
@param bool $themedesigner True if theme designer is enabled.
@return bool|string Return false when the compilation failed. Else the compiled string. | [
"Return",
"the",
"CSS",
"content",
"generated",
"from",
"LESS",
"the",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1435-L1493 |
217,103 | moodle/moodle | lib/outputlib.php | theme_config.get_css_content_from_scss | protected function get_css_content_from_scss($themedesigner) {
global $CFG;
list($paths, $scss) = $this->get_scss_property();
if (!$scss) {
throw new coding_exception('The theme did not define a SCSS file, or it is not readable.');
}
// We might need more memory/tim... | php | protected function get_css_content_from_scss($themedesigner) {
global $CFG;
list($paths, $scss) = $this->get_scss_property();
if (!$scss) {
throw new coding_exception('The theme did not define a SCSS file, or it is not readable.');
}
// We might need more memory/tim... | [
"protected",
"function",
"get_css_content_from_scss",
"(",
"$",
"themedesigner",
")",
"{",
"global",
"$",
"CFG",
";",
"list",
"(",
"$",
"paths",
",",
"$",
"scss",
")",
"=",
"$",
"this",
"->",
"get_scss_property",
"(",
")",
";",
"if",
"(",
"!",
"$",
"sc... | Return the CSS content generated from the SCSS file.
@param bool $themedesigner True if theme designer is enabled.
@return bool|string Return false when the compilation failed. Else the compiled string. | [
"Return",
"the",
"CSS",
"content",
"generated",
"from",
"the",
"SCSS",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1501-L1538 |
217,104 | moodle/moodle | lib/outputlib.php | theme_config.get_precompiled_css_content | public function get_precompiled_css_content() {
$configs = [$this] + $this->parent_configs;
$css = '';
foreach ($configs as $config) {
if (isset($config->precompiledcsscallback)) {
$function = $config->precompiledcsscallback;
if (function_exists($func... | php | public function get_precompiled_css_content() {
$configs = [$this] + $this->parent_configs;
$css = '';
foreach ($configs as $config) {
if (isset($config->precompiledcsscallback)) {
$function = $config->precompiledcsscallback;
if (function_exists($func... | [
"public",
"function",
"get_precompiled_css_content",
"(",
")",
"{",
"$",
"configs",
"=",
"[",
"$",
"this",
"]",
"+",
"$",
"this",
"->",
"parent_configs",
";",
"$",
"css",
"=",
"''",
";",
"foreach",
"(",
"$",
"configs",
"as",
"$",
"config",
")",
"{",
... | Return the precompiled CSS if the precompiledcsscallback exists.
@return string Return compiled css. | [
"Return",
"the",
"precompiled",
"CSS",
"if",
"the",
"precompiledcsscallback",
"exists",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1545-L1558 |
217,105 | moodle/moodle | lib/outputlib.php | theme_config.get_icon_system | public function get_icon_system() {
// Getting all the candidate functions.
$system = false;
if (isset($this->iconsystem) && \core\output\icon_system::is_valid_system($this->iconsystem)) {
return $this->iconsystem;
}
foreach ($this->parent_configs as $parent_config) ... | php | public function get_icon_system() {
// Getting all the candidate functions.
$system = false;
if (isset($this->iconsystem) && \core\output\icon_system::is_valid_system($this->iconsystem)) {
return $this->iconsystem;
}
foreach ($this->parent_configs as $parent_config) ... | [
"public",
"function",
"get_icon_system",
"(",
")",
"{",
"// Getting all the candidate functions.",
"$",
"system",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"iconsystem",
")",
"&&",
"\\",
"core",
"\\",
"output",
"\\",
"icon_system",
"::",
... | Get the icon system to use.
@return string | [
"Get",
"the",
"icon",
"system",
"to",
"use",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1565-L1578 |
217,106 | moodle/moodle | lib/outputlib.php | theme_config.get_less_variables | protected function get_less_variables() {
$variables = array();
// Getting all the candidate functions.
$candidates = array();
foreach ($this->parent_configs as $parent_config) {
if (!isset($parent_config->lessvariablescallback)) {
continue;
}
... | php | protected function get_less_variables() {
$variables = array();
// Getting all the candidate functions.
$candidates = array();
foreach ($this->parent_configs as $parent_config) {
if (!isset($parent_config->lessvariablescallback)) {
continue;
}
... | [
"protected",
"function",
"get_less_variables",
"(",
")",
"{",
"$",
"variables",
"=",
"array",
"(",
")",
";",
"// Getting all the candidate functions.",
"$",
"candidates",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"parent_configs",
"as",
"... | Return extra LESS variables to use when compiling.
@return array Where keys are the variable names (omitting the @), and the values are the value. | [
"Return",
"extra",
"LESS",
"variables",
"to",
"use",
"when",
"compiling",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1585-L1611 |
217,107 | moodle/moodle | lib/outputlib.php | theme_config.get_extra_less_code | protected function get_extra_less_code() {
$content = '';
// Getting all the candidate functions.
$candidates = array();
foreach ($this->parent_configs as $parent_config) {
if (!isset($parent_config->extralesscallback)) {
continue;
}
$... | php | protected function get_extra_less_code() {
$content = '';
// Getting all the candidate functions.
$candidates = array();
foreach ($this->parent_configs as $parent_config) {
if (!isset($parent_config->extralesscallback)) {
continue;
}
$... | [
"protected",
"function",
"get_extra_less_code",
"(",
")",
"{",
"$",
"content",
"=",
"''",
";",
"// Getting all the candidate functions.",
"$",
"candidates",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"parent_configs",
"as",
"$",
"parent_conf... | Return extra LESS code to add when compiling.
This is intended to be used by themes to inject some LESS code
before it gets compiled. If you want to inject variables you
should use {@link self::get_less_variables()}.
@return string The LESS code to inject. | [
"Return",
"extra",
"LESS",
"code",
"to",
"add",
"when",
"compiling",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1622-L1643 |
217,108 | moodle/moodle | lib/outputlib.php | theme_config.get_extra_scss_code | protected function get_extra_scss_code() {
$content = '';
// Getting all the candidate functions.
$candidates = array();
foreach ($this->parent_configs as $parent_config) {
if (!isset($parent_config->extrascsscallback)) {
continue;
}
$... | php | protected function get_extra_scss_code() {
$content = '';
// Getting all the candidate functions.
$candidates = array();
foreach ($this->parent_configs as $parent_config) {
if (!isset($parent_config->extrascsscallback)) {
continue;
}
$... | [
"protected",
"function",
"get_extra_scss_code",
"(",
")",
"{",
"$",
"content",
"=",
"''",
";",
"// Getting all the candidate functions.",
"$",
"candidates",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"parent_configs",
"as",
"$",
"parent_conf... | Return extra SCSS code to add when compiling.
This is intended to be used by themes to inject some SCSS code
before it gets compiled. If you want to inject variables you
should use {@link self::get_scss_variables()}.
@return string The SCSS code to inject. | [
"Return",
"extra",
"SCSS",
"code",
"to",
"add",
"when",
"compiling",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1654-L1675 |
217,109 | moodle/moodle | lib/outputlib.php | theme_config.get_pre_scss_code | protected function get_pre_scss_code() {
$content = '';
// Getting all the candidate functions.
$candidates = array();
foreach ($this->parent_configs as $parent_config) {
if (!isset($parent_config->prescsscallback)) {
continue;
}
$cand... | php | protected function get_pre_scss_code() {
$content = '';
// Getting all the candidate functions.
$candidates = array();
foreach ($this->parent_configs as $parent_config) {
if (!isset($parent_config->prescsscallback)) {
continue;
}
$cand... | [
"protected",
"function",
"get_pre_scss_code",
"(",
")",
"{",
"$",
"content",
"=",
"''",
";",
"// Getting all the candidate functions.",
"$",
"candidates",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"parent_configs",
"as",
"$",
"parent_config... | SCSS code to prepend when compiling.
This is intended to be used by themes to inject SCSS code before it gets compiled.
@return string The SCSS code to inject. | [
"SCSS",
"code",
"to",
"prepend",
"when",
"compiling",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1684-L1705 |
217,110 | moodle/moodle | lib/outputlib.php | theme_config.get_scss_property | public function get_scss_property() {
if ($this->scsscache === null) {
$configs = [$this] + $this->parent_configs;
$scss = null;
foreach ($configs as $config) {
$path = "{$config->dir}/scss";
// We collect the SCSS property until we've found ... | php | public function get_scss_property() {
if ($this->scsscache === null) {
$configs = [$this] + $this->parent_configs;
$scss = null;
foreach ($configs as $config) {
$path = "{$config->dir}/scss";
// We collect the SCSS property until we've found ... | [
"public",
"function",
"get_scss_property",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"scsscache",
"===",
"null",
")",
"{",
"$",
"configs",
"=",
"[",
"$",
"this",
"]",
"+",
"$",
"this",
"->",
"parent_configs",
";",
"$",
"scss",
"=",
"null",
";",
... | Get the SCSS property.
This resolves whether a SCSS file (or content) has to be used when generating
the stylesheet for the theme. It will look at parents themes and check the
SCSS properties there.
@return False when SCSS is not used.
An array with the import paths, and the path to the SCSS file or Closure as second... | [
"Get",
"the",
"SCSS",
"property",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1717-L1746 |
217,111 | moodle/moodle | lib/outputlib.php | theme_config.javascript_url | public function javascript_url($inhead) {
global $CFG;
$rev = theme_get_revision();
$params = array('theme'=>$this->name,'rev'=>$rev);
$params['type'] = $inhead ? 'head' : 'footer';
// Return early if there are no files to serve
if (count($this->javascript_files($params... | php | public function javascript_url($inhead) {
global $CFG;
$rev = theme_get_revision();
$params = array('theme'=>$this->name,'rev'=>$rev);
$params['type'] = $inhead ? 'head' : 'footer';
// Return early if there are no files to serve
if (count($this->javascript_files($params... | [
"public",
"function",
"javascript_url",
"(",
"$",
"inhead",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"rev",
"=",
"theme_get_revision",
"(",
")",
";",
"$",
"params",
"=",
"array",
"(",
"'theme'",
"=>",
"$",
"this",
"->",
"name",
",",
"'rev'",
"=>",
"... | Generate a URL to the file that serves theme JavaScript files.
If we determine that the theme has no relevant files, then we return
early with a null value.
@param bool $inhead true means head url, false means footer
@return moodle_url|null | [
"Generate",
"a",
"URL",
"to",
"the",
"file",
"that",
"serves",
"theme",
"JavaScript",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1757-L1776 |
217,112 | moodle/moodle | lib/outputlib.php | theme_config.resolve_excludes | protected function resolve_excludes($variable, $default = null) {
$setting = $default;
if (is_array($this->{$variable}) or $this->{$variable} === true) {
$setting = $this->{$variable};
} else {
foreach ($this->parent_configs as $parent_config) { // the immediate parent fi... | php | protected function resolve_excludes($variable, $default = null) {
$setting = $default;
if (is_array($this->{$variable}) or $this->{$variable} === true) {
$setting = $this->{$variable};
} else {
foreach ($this->parent_configs as $parent_config) { // the immediate parent fi... | [
"protected",
"function",
"resolve_excludes",
"(",
"$",
"variable",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"setting",
"=",
"$",
"default",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"{",
"$",
"variable",
"}",
")",
"or",
"$",
"this",... | Resolves an exclude setting to the themes setting is applicable or the
setting of its closest parent.
@param string $variable The name of the setting the exclude setting to resolve
@param string $default
@return mixed | [
"Resolves",
"an",
"exclude",
"setting",
"to",
"the",
"themes",
"setting",
"is",
"applicable",
"or",
"the",
"setting",
"of",
"its",
"closest",
"parent",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1838-L1854 |
217,113 | moodle/moodle | lib/outputlib.php | theme_config.javascript_content | public function javascript_content($type) {
$jsfiles = $this->javascript_files($type);
$js = '';
foreach ($jsfiles as $jsfile) {
$js .= file_get_contents($jsfile)."\n";
}
return $js;
} | php | public function javascript_content($type) {
$jsfiles = $this->javascript_files($type);
$js = '';
foreach ($jsfiles as $jsfile) {
$js .= file_get_contents($jsfile)."\n";
}
return $js;
} | [
"public",
"function",
"javascript_content",
"(",
"$",
"type",
")",
"{",
"$",
"jsfiles",
"=",
"$",
"this",
"->",
"javascript_files",
"(",
"$",
"type",
")",
";",
"$",
"js",
"=",
"''",
";",
"foreach",
"(",
"$",
"jsfiles",
"as",
"$",
"jsfile",
")",
"{",
... | Returns the content of the one huge javascript file merged from all theme javascript files.
@param bool $type
@return string | [
"Returns",
"the",
"content",
"of",
"the",
"one",
"huge",
"javascript",
"file",
"merged",
"from",
"all",
"theme",
"javascript",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1862-L1869 |
217,114 | moodle/moodle | lib/outputlib.php | theme_config.post_process | public function post_process($css) {
// now resolve all image locations
if (preg_match_all('/\[\[pix:([a-z0-9_]+\|)?([^\]]+)\]\]/', $css, $matches, PREG_SET_ORDER)) {
$replaced = array();
foreach ($matches as $match) {
if (isset($replaced[$match[0]])) {
... | php | public function post_process($css) {
// now resolve all image locations
if (preg_match_all('/\[\[pix:([a-z0-9_]+\|)?([^\]]+)\]\]/', $css, $matches, PREG_SET_ORDER)) {
$replaced = array();
foreach ($matches as $match) {
if (isset($replaced[$match[0]])) {
... | [
"public",
"function",
"post_process",
"(",
"$",
"css",
")",
"{",
"// now resolve all image locations",
"if",
"(",
"preg_match_all",
"(",
"'/\\[\\[pix:([a-z0-9_]+\\|)?([^\\]]+)\\]\\]/'",
",",
"$",
"css",
",",
"$",
"matches",
",",
"PREG_SET_ORDER",
")",
")",
"{",
"$",... | Post processes CSS.
This method post processes all of the CSS before it is served for this theme.
This is done so that things such as image URL's can be swapped in and to
run any specific CSS post process method the theme has requested.
This allows themes to use CSS settings.
@param string $css The CSS to process.
@r... | [
"Post",
"processes",
"CSS",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1882-L1950 |
217,115 | moodle/moodle | lib/outputlib.php | theme_config.font_url | public function font_url($font, $component) {
global $CFG;
$params = array('theme'=>$this->name);
if (empty($component) or $component === 'moodle' or $component === 'core') {
$params['component'] = 'core';
} else {
$params['component'] = $component;
}
... | php | public function font_url($font, $component) {
global $CFG;
$params = array('theme'=>$this->name);
if (empty($component) or $component === 'moodle' or $component === 'core') {
$params['component'] = 'core';
} else {
$params['component'] = $component;
}
... | [
"public",
"function",
"font_url",
"(",
"$",
"font",
",",
"$",
"component",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"params",
"=",
"array",
"(",
"'theme'",
"=>",
"$",
"this",
"->",
"name",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"component",
")",
... | Return the URL for a font
@param string $font the name of the font (including extension).
@param string $component specification of one plugin like in get_string()
@return moodle_url | [
"Return",
"the",
"URL",
"for",
"a",
"font"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2034-L2061 |
217,116 | moodle/moodle | lib/outputlib.php | theme_config.setting_file_url | public function setting_file_url($setting, $filearea) {
global $CFG;
if (empty($this->settings->$setting)) {
return null;
}
$component = 'theme_'.$this->name;
$itemid = theme_get_revision();
$filepath = $this->settings->$setting;
$syscontext = contex... | php | public function setting_file_url($setting, $filearea) {
global $CFG;
if (empty($this->settings->$setting)) {
return null;
}
$component = 'theme_'.$this->name;
$itemid = theme_get_revision();
$filepath = $this->settings->$setting;
$syscontext = contex... | [
"public",
"function",
"setting_file_url",
"(",
"$",
"setting",
",",
"$",
"filearea",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"settings",
"->",
"$",
"setting",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
... | Returns URL to the stored file via pluginfile.php.
Note the theme must also implement pluginfile.php handler,
theme revision is used instead of the itemid.
@param string $setting
@param string $filearea
@return string protocol relative URL or null if not present | [
"Returns",
"URL",
"to",
"the",
"stored",
"file",
"via",
"pluginfile",
".",
"php",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2073-L2093 |
217,117 | moodle/moodle | lib/outputlib.php | theme_config.setting_file_serve | public function setting_file_serve($filearea, $args, $forcedownload, $options) {
global $CFG;
require_once("$CFG->libdir/filelib.php");
$syscontext = context_system::instance();
$component = 'theme_'.$this->name;
$revision = array_shift($args);
if ($revision < 0) {
... | php | public function setting_file_serve($filearea, $args, $forcedownload, $options) {
global $CFG;
require_once("$CFG->libdir/filelib.php");
$syscontext = context_system::instance();
$component = 'theme_'.$this->name;
$revision = array_shift($args);
if ($revision < 0) {
... | [
"public",
"function",
"setting_file_serve",
"(",
"$",
"filearea",
",",
"$",
"args",
",",
"$",
"forcedownload",
",",
"$",
"options",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"\"$CFG->libdir/filelib.php\"",
")",
";",
"$",
"syscontext",
"=",
"c... | Serve the theme setting file.
@param string $filearea
@param array $args
@param bool $forcedownload
@param array $options
@return bool may terminate if file not found or donotdie not specified | [
"Serve",
"the",
"theme",
"setting",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2104-L2133 |
217,118 | moodle/moodle | lib/outputlib.php | theme_config.resolve_image_location | public function resolve_image_location($image, $component, $svg = false) {
global $CFG;
if (!is_bool($svg)) {
// If $svg isn't a bool then we need to decide for ourselves.
$svg = $this->use_svg_icons();
}
if ($component === 'moodle' or $component === 'core' or e... | php | public function resolve_image_location($image, $component, $svg = false) {
global $CFG;
if (!is_bool($svg)) {
// If $svg isn't a bool then we need to decide for ourselves.
$svg = $this->use_svg_icons();
}
if ($component === 'moodle' or $component === 'core' or e... | [
"public",
"function",
"resolve_image_location",
"(",
"$",
"image",
",",
"$",
"component",
",",
"$",
"svg",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"svg",
")",
")",
"{",
"// If $svg isn't a bool then we need t... | Resolves the real image location.
$svg was introduced as an arg in 2.4. It is important because not all supported browsers support the use of SVG
and we need a way in which to turn it off.
By default SVG won't be used unless asked for. This is done for two reasons:
1. It ensures that we don't serve svg images unless w... | [
"Resolves",
"the",
"real",
"image",
"location",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2152-L2214 |
217,119 | moodle/moodle | lib/outputlib.php | theme_config.resolve_font_location | public function resolve_font_location($font, $component) {
global $CFG;
if ($component === 'moodle' or $component === 'core' or empty($component)) {
if (file_exists("$this->dir/fonts_core/$font")) {
return "$this->dir/fonts_core/$font";
}
foreach (arr... | php | public function resolve_font_location($font, $component) {
global $CFG;
if ($component === 'moodle' or $component === 'core' or empty($component)) {
if (file_exists("$this->dir/fonts_core/$font")) {
return "$this->dir/fonts_core/$font";
}
foreach (arr... | [
"public",
"function",
"resolve_font_location",
"(",
"$",
"font",
",",
"$",
"component",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"$",
"component",
"===",
"'moodle'",
"or",
"$",
"component",
"===",
"'core'",
"or",
"empty",
"(",
"$",
"component",
")... | Resolves the real font location.
@param string $font name of font file
@param string $component
@return string full file path | [
"Resolves",
"the",
"real",
"font",
"location",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2223-L2277 |
217,120 | moodle/moodle | lib/outputlib.php | theme_config.use_svg_icons | public function use_svg_icons() {
global $CFG;
if ($this->usesvg === null) {
if (!isset($CFG->svgicons)) {
$this->usesvg = core_useragent::supports_svg();
} else {
// Force them on/off depending upon the setting.
$this->usesvg = (b... | php | public function use_svg_icons() {
global $CFG;
if ($this->usesvg === null) {
if (!isset($CFG->svgicons)) {
$this->usesvg = core_useragent::supports_svg();
} else {
// Force them on/off depending upon the setting.
$this->usesvg = (b... | [
"public",
"function",
"use_svg_icons",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"$",
"this",
"->",
"usesvg",
"===",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"CFG",
"->",
"svgicons",
")",
")",
"{",
"$",
"this",
"->",
"usesv... | Return true if we should look for SVG images as well.
@return bool | [
"Return",
"true",
"if",
"we",
"should",
"look",
"for",
"SVG",
"images",
"as",
"well",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2284-L2296 |
217,121 | moodle/moodle | lib/outputlib.php | theme_config.image_exists | private static function image_exists($filepath, $svg = false) {
if ($svg && file_exists("$filepath.svg")) {
return "$filepath.svg";
} else if (file_exists("$filepath.png")) {
return "$filepath.png";
} else if (file_exists("$filepath.gif")) {
return "$filepath... | php | private static function image_exists($filepath, $svg = false) {
if ($svg && file_exists("$filepath.svg")) {
return "$filepath.svg";
} else if (file_exists("$filepath.png")) {
return "$filepath.png";
} else if (file_exists("$filepath.gif")) {
return "$filepath... | [
"private",
"static",
"function",
"image_exists",
"(",
"$",
"filepath",
",",
"$",
"svg",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"svg",
"&&",
"file_exists",
"(",
"\"$filepath.svg\"",
")",
")",
"{",
"return",
"\"$filepath.svg\"",
";",
"}",
"else",
"if",
"(... | Checks if file with any image extension exists.
The order to these images was adjusted prior to the release of 2.4
At that point the were the following image counts in Moodle core:
- png = 667 in pix dirs (1499 total)
- gif = 385 in pix dirs (606 total)
- jpg = 62 in pix dirs (74 total)
- jpeg = 0 in pix dirs (1 to... | [
"Checks",
"if",
"file",
"with",
"any",
"image",
"extension",
"exists",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2347-L2361 |
217,122 | moodle/moodle | lib/outputlib.php | theme_config.find_theme_config | private static function find_theme_config($themename, $settings, $parentscheck = true) {
// We have to use the variable name $THEME (upper case) because that
// is what is used in theme config.php files.
if (!$dir = theme_config::find_theme_location($themename)) {
return null;
... | php | private static function find_theme_config($themename, $settings, $parentscheck = true) {
// We have to use the variable name $THEME (upper case) because that
// is what is used in theme config.php files.
if (!$dir = theme_config::find_theme_location($themename)) {
return null;
... | [
"private",
"static",
"function",
"find_theme_config",
"(",
"$",
"themename",
",",
"$",
"settings",
",",
"$",
"parentscheck",
"=",
"true",
")",
"{",
"// We have to use the variable name $THEME (upper case) because that",
"// is what is used in theme config.php files.",
"if",
"... | Loads the theme config from config.php file.
@param string $themename
@param stdClass $settings from config_plugins table
@param boolean $parentscheck true to also check the parents. .
@return stdClass The theme configuration | [
"Loads",
"the",
"theme",
"config",
"from",
"config",
".",
"php",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2371-L2405 |
217,123 | moodle/moodle | lib/outputlib.php | theme_config.find_theme_location | private static function find_theme_location($themename) {
global $CFG;
if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
$dir = "$CFG->dirroot/theme/$themename";
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
$... | php | private static function find_theme_location($themename) {
global $CFG;
if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
$dir = "$CFG->dirroot/theme/$themename";
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
$... | [
"private",
"static",
"function",
"find_theme_location",
"(",
"$",
"themename",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"file_exists",
"(",
"\"$CFG->dirroot/theme/$themename/config.php\"",
")",
")",
"{",
"$",
"dir",
"=",
"\"$CFG->dirroot/theme/$themename\"",
... | Finds the theme location and verifies the theme has all needed files
and is not obsoleted.
@param string $themename
@return string full dir path or null if not found | [
"Finds",
"the",
"theme",
"location",
"and",
"verifies",
"the",
"theme",
"has",
"all",
"needed",
"files",
"and",
"is",
"not",
"obsoleted",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2414-L2433 |
217,124 | moodle/moodle | lib/outputlib.php | theme_config.get_renderer | public function get_renderer(moodle_page $page, $component, $subtype = null, $target = null) {
if (is_null($this->rf)) {
$classname = $this->rendererfactory;
$this->rf = new $classname($this);
}
return $this->rf->get_renderer($page, $component, $subtype, $target);
} | php | public function get_renderer(moodle_page $page, $component, $subtype = null, $target = null) {
if (is_null($this->rf)) {
$classname = $this->rendererfactory;
$this->rf = new $classname($this);
}
return $this->rf->get_renderer($page, $component, $subtype, $target);
} | [
"public",
"function",
"get_renderer",
"(",
"moodle_page",
"$",
"page",
",",
"$",
"component",
",",
"$",
"subtype",
"=",
"null",
",",
"$",
"target",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"rf",
")",
")",
"{",
"$",
"clas... | Get the renderer for a part of Moodle for this theme.
@param moodle_page $page the page we are rendering
@param string $component the name of part of moodle. E.g. 'core', 'quiz', 'qtype_multichoice'.
@param string $subtype optional subtype such as 'news' resulting to 'mod_forum_news'
@param string $target one of rende... | [
"Get",
"the",
"renderer",
"for",
"a",
"part",
"of",
"Moodle",
"for",
"this",
"theme",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2444-L2451 |
217,125 | moodle/moodle | lib/outputlib.php | theme_config.layout_file | public function layout_file($pagelayout) {
global $CFG;
$layoutinfo = $this->layout_info_for_page($pagelayout);
$layoutfile = $layoutinfo['file'];
if (array_key_exists('theme', $layoutinfo)) {
$themes = array($layoutinfo['theme']);
} else {
$themes = arr... | php | public function layout_file($pagelayout) {
global $CFG;
$layoutinfo = $this->layout_info_for_page($pagelayout);
$layoutfile = $layoutinfo['file'];
if (array_key_exists('theme', $layoutinfo)) {
$themes = array($layoutinfo['theme']);
} else {
$themes = arr... | [
"public",
"function",
"layout_file",
"(",
"$",
"pagelayout",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"layoutinfo",
"=",
"$",
"this",
"->",
"layout_info_for_page",
"(",
"$",
"pagelayout",
")",
";",
"$",
"layoutfile",
"=",
"$",
"layoutinfo",
"[",
"'file'",... | Given the settings of this theme, and the page pagelayout, return the
full path of the page layout file to use.
Used by {@link core_renderer::header()}.
@param string $pagelayout the the page layout name.
@return string Full path to the lyout file to use | [
"Given",
"the",
"settings",
"of",
"this",
"theme",
"and",
"the",
"page",
"pagelayout",
"return",
"the",
"full",
"path",
"of",
"the",
"page",
"layout",
"file",
"to",
"use",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2477-L2503 |
217,126 | moodle/moodle | lib/outputlib.php | theme_config.setup_blocks | public function setup_blocks($pagelayout, $blockmanager) {
$layoutinfo = $this->layout_info_for_page($pagelayout);
if (!empty($layoutinfo['regions'])) {
$blockmanager->add_regions($layoutinfo['regions'], false);
$blockmanager->set_default_region($layoutinfo['defaultregion']);
... | php | public function setup_blocks($pagelayout, $blockmanager) {
$layoutinfo = $this->layout_info_for_page($pagelayout);
if (!empty($layoutinfo['regions'])) {
$blockmanager->add_regions($layoutinfo['regions'], false);
$blockmanager->set_default_region($layoutinfo['defaultregion']);
... | [
"public",
"function",
"setup_blocks",
"(",
"$",
"pagelayout",
",",
"$",
"blockmanager",
")",
"{",
"$",
"layoutinfo",
"=",
"$",
"this",
"->",
"layout_info_for_page",
"(",
"$",
"pagelayout",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"layoutinfo",
"[",
"... | Inform a block_manager about the block regions this theme wants on this
page layout.
@param string $pagelayout the general type of the page.
@param block_manager $blockmanager the block_manger to set up. | [
"Inform",
"a",
"block_manager",
"about",
"the",
"block",
"regions",
"this",
"theme",
"wants",
"on",
"this",
"page",
"layout",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2526-L2532 |
217,127 | moodle/moodle | lib/outputlib.php | theme_config.get_region_name | protected function get_region_name($region, $theme) {
$regionstring = get_string('region-' . $region, 'theme_' . $theme);
// A name exists in this theme, so use it
if (substr($regionstring, 0, 1) != '[') {
return $regionstring;
}
// Otherwise, try to find one elsewhe... | php | protected function get_region_name($region, $theme) {
$regionstring = get_string('region-' . $region, 'theme_' . $theme);
// A name exists in this theme, so use it
if (substr($regionstring, 0, 1) != '[') {
return $regionstring;
}
// Otherwise, try to find one elsewhe... | [
"protected",
"function",
"get_region_name",
"(",
"$",
"region",
",",
"$",
"theme",
")",
"{",
"$",
"regionstring",
"=",
"get_string",
"(",
"'region-'",
".",
"$",
"region",
",",
"'theme_'",
".",
"$",
"theme",
")",
";",
"// A name exists in this theme, so use it",
... | Gets the visible name for the requested block region.
@param string $region The region name to get
@param string $theme The theme the region belongs to (may come from the parent theme)
@return string | [
"Gets",
"the",
"visible",
"name",
"for",
"the",
"requested",
"block",
"region",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2541-L2559 |
217,128 | moodle/moodle | lib/outputlib.php | theme_config.get_all_block_regions | public function get_all_block_regions() {
$regions = array();
foreach ($this->layouts as $layoutinfo) {
foreach ($layoutinfo['regions'] as $region) {
$regions[$region] = $this->get_region_name($region, $this->name);
}
}
return $regions;
} | php | public function get_all_block_regions() {
$regions = array();
foreach ($this->layouts as $layoutinfo) {
foreach ($layoutinfo['regions'] as $region) {
$regions[$region] = $this->get_region_name($region, $this->name);
}
}
return $regions;
} | [
"public",
"function",
"get_all_block_regions",
"(",
")",
"{",
"$",
"regions",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"layouts",
"as",
"$",
"layoutinfo",
")",
"{",
"foreach",
"(",
"$",
"layoutinfo",
"[",
"'regions'",
"]",
"as",
... | Get the list of all block regions known to this theme in all templates.
@return array internal region name => human readable name. | [
"Get",
"the",
"list",
"of",
"all",
"block",
"regions",
"known",
"to",
"this",
"theme",
"in",
"all",
"templates",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2566-L2574 |
217,129 | moodle/moodle | lib/outputlib.php | theme_config.get_block_render_method | public function get_block_render_method() {
if ($this->blockrendermethod) {
// Return the specified block render method.
return $this->blockrendermethod;
}
// Its not explicitly set, check the parent theme configs.
foreach ($this->parent_configs as $config) {
... | php | public function get_block_render_method() {
if ($this->blockrendermethod) {
// Return the specified block render method.
return $this->blockrendermethod;
}
// Its not explicitly set, check the parent theme configs.
foreach ($this->parent_configs as $config) {
... | [
"public",
"function",
"get_block_render_method",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"blockrendermethod",
")",
"{",
"// Return the specified block render method.",
"return",
"$",
"this",
"->",
"blockrendermethod",
";",
"}",
"// Its not explicitly set, check the p... | Returns the block render method.
It is set by the theme via:
$THEME->blockrendermethod = '...';
It can be one of two values, blocks or blocks_for_region.
It should be set to the method being used by the theme layouts.
@return string | [
"Returns",
"the",
"block",
"render",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2596-L2609 |
217,130 | moodle/moodle | lib/outputlib.php | theme_config.get_css_tree_post_processor | public function get_css_tree_post_processor() {
$configs = [$this] + $this->parent_configs;
foreach ($configs as $config) {
if (!empty($config->csstreepostprocessor) && is_callable($config->csstreepostprocessor)) {
return $config->csstreepostprocessor;
}
}... | php | public function get_css_tree_post_processor() {
$configs = [$this] + $this->parent_configs;
foreach ($configs as $config) {
if (!empty($config->csstreepostprocessor) && is_callable($config->csstreepostprocessor)) {
return $config->csstreepostprocessor;
}
}... | [
"public",
"function",
"get_css_tree_post_processor",
"(",
")",
"{",
"$",
"configs",
"=",
"[",
"$",
"this",
"]",
"+",
"$",
"this",
"->",
"parent_configs",
";",
"foreach",
"(",
"$",
"configs",
"as",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
... | Get the callable for CSS tree post processing.
@return string|null | [
"Get",
"the",
"callable",
"for",
"CSS",
"tree",
"post",
"processing",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2616-L2624 |
217,131 | moodle/moodle | lib/outputlib.php | xhtml_container_stack.push | public function push($type, $closehtml) {
$container = new stdClass;
$container->type = $type;
$container->closehtml = $closehtml;
if ($this->isdebugging) {
$this->log('Open', $type);
}
array_push($this->opencontainers, $container);
} | php | public function push($type, $closehtml) {
$container = new stdClass;
$container->type = $type;
$container->closehtml = $closehtml;
if ($this->isdebugging) {
$this->log('Open', $type);
}
array_push($this->opencontainers, $container);
} | [
"public",
"function",
"push",
"(",
"$",
"type",
",",
"$",
"closehtml",
")",
"{",
"$",
"container",
"=",
"new",
"stdClass",
";",
"$",
"container",
"->",
"type",
"=",
"$",
"type",
";",
"$",
"container",
"->",
"closehtml",
"=",
"$",
"closehtml",
";",
"i... | Push the close HTML for a recently opened container onto the stack.
@param string $type The type of container. This is checked when {@link pop()}
is called and must match, otherwise a developer debug warning is output.
@param string $closehtml The HTML required to close the container. | [
"Push",
"the",
"close",
"HTML",
"for",
"a",
"recently",
"opened",
"container",
"onto",
"the",
"stack",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L2676-L2684 |
217,132 | moodle/moodle | backup/util/helper/convert_helper.class.php | convert_helper.available_converters | public static function available_converters($restore=true) {
global $CFG;
$converters = array();
$plugins = get_list_of_plugins('backup/converter');
foreach ($plugins as $name) {
$filename = $restore ? 'lib.php' : 'backuplib.php';
$classuf = $restore ? '_con... | php | public static function available_converters($restore=true) {
global $CFG;
$converters = array();
$plugins = get_list_of_plugins('backup/converter');
foreach ($plugins as $name) {
$filename = $restore ? 'lib.php' : 'backuplib.php';
$classuf = $restore ? '_con... | [
"public",
"static",
"function",
"available_converters",
"(",
"$",
"restore",
"=",
"true",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"converters",
"=",
"array",
"(",
")",
";",
"$",
"plugins",
"=",
"get_list_of_plugins",
"(",
"'backup/converter'",
")",
";",
... | Returns the list of all available converters and loads their classes
Converter must be installed as a directory in backup/converter/ and its
method is_available() must return true to get to the list.
@see base_converter::is_available()
@return array of strings | [
"Returns",
"the",
"list",
"of",
"all",
"available",
"converters",
"and",
"loads",
"their",
"classes"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/convert_helper.class.php#L53-L97 |
217,133 | moodle/moodle | backup/util/helper/convert_helper.class.php | convert_helper.detect_moodle2_format | public static function detect_moodle2_format($tempdir) {
$dirpath = make_backup_temp_directory($tempdir, false);
if (!is_dir($dirpath)) {
throw new convert_helper_exception('tmp_backup_directory_not_found', $dirpath);
}
$filepath = $dirpath . '/moodle_backup.xml';
if... | php | public static function detect_moodle2_format($tempdir) {
$dirpath = make_backup_temp_directory($tempdir, false);
if (!is_dir($dirpath)) {
throw new convert_helper_exception('tmp_backup_directory_not_found', $dirpath);
}
$filepath = $dirpath . '/moodle_backup.xml';
if... | [
"public",
"static",
"function",
"detect_moodle2_format",
"(",
"$",
"tempdir",
")",
"{",
"$",
"dirpath",
"=",
"make_backup_temp_directory",
"(",
"$",
"tempdir",
",",
"false",
")",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"dirpath",
")",
")",
"{",
"throw",
... | Detects if the given folder contains an unpacked moodle2 backup
@param string $tempdir the name of the backup directory
@return boolean true if moodle2 format detected, false otherwise | [
"Detects",
"if",
"the",
"given",
"folder",
"contains",
"an",
"unpacked",
"moodle2",
"backup"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/convert_helper.class.php#L133-L155 |
217,134 | moodle/moodle | backup/util/helper/convert_helper.class.php | convert_helper.to_moodle2_format | public static function to_moodle2_format($tempdir, $format = null, $logger = null) {
if (is_null($format)) {
$format = backup_general_helper::detect_backup_format($tempdir);
}
// get the supported conversion paths from all available converters
$converters = self::availabl... | php | public static function to_moodle2_format($tempdir, $format = null, $logger = null) {
if (is_null($format)) {
$format = backup_general_helper::detect_backup_format($tempdir);
}
// get the supported conversion paths from all available converters
$converters = self::availabl... | [
"public",
"static",
"function",
"to_moodle2_format",
"(",
"$",
"tempdir",
",",
"$",
"format",
"=",
"null",
",",
"$",
"logger",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"format",
")",
")",
"{",
"$",
"format",
"=",
"backup_general_helper",
... | Converts the given directory with the backup into moodle2 format
@param string $tempdir The directory to convert
@param string $format The current format, if already detected
@param base_logger|null if the conversion should be logged, use this logger
@throws convert_helper_exception
@return bool false if unable to fin... | [
"Converts",
"the",
"given",
"directory",
"with",
"the",
"backup",
"into",
"moodle2",
"format"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/convert_helper.class.php#L166-L215 |
217,135 | moodle/moodle | question/format/gift/format.php | qformat_gift.write_general_feedback | public function write_general_feedback($question, $indent = "\t") {
$generalfeedback = $this->write_questiontext($question->generalfeedback,
$question->generalfeedbackformat, $question->questiontextformat);
if ($generalfeedback) {
$generalfeedback = '####' . $generalfeedback... | php | public function write_general_feedback($question, $indent = "\t") {
$generalfeedback = $this->write_questiontext($question->generalfeedback,
$question->generalfeedbackformat, $question->questiontextformat);
if ($generalfeedback) {
$generalfeedback = '####' . $generalfeedback... | [
"public",
"function",
"write_general_feedback",
"(",
"$",
"question",
",",
"$",
"indent",
"=",
"\"\\t\"",
")",
"{",
"$",
"generalfeedback",
"=",
"$",
"this",
"->",
"write_questiontext",
"(",
"$",
"question",
"->",
"generalfeedback",
",",
"$",
"question",
"->",... | Outputs the general feedback for the question, if any. This needs to be the
last thing before the }.
@param object $question the question data.
@param string $indent to put before the general feedback. Defaults to a tab.
If this is not blank, a newline is added after the line. | [
"Outputs",
"the",
"general",
"feedback",
"for",
"the",
"question",
"if",
"any",
".",
"This",
"needs",
"to",
"be",
"the",
"last",
"thing",
"before",
"the",
"}",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/gift/format.php#L623-L635 |
217,136 | moodle/moodle | comment/classes/external.php | core_comment_external.get_comments | public static function get_comments($contextlevel, $instanceid, $component, $itemid, $area = '', $page = 0) {
$warnings = array();
$arrayparams = array(
'contextlevel' => $contextlevel,
'instanceid' => $instanceid,
'component' => $component,
'itemid'... | php | public static function get_comments($contextlevel, $instanceid, $component, $itemid, $area = '', $page = 0) {
$warnings = array();
$arrayparams = array(
'contextlevel' => $contextlevel,
'instanceid' => $instanceid,
'component' => $component,
'itemid'... | [
"public",
"static",
"function",
"get_comments",
"(",
"$",
"contextlevel",
",",
"$",
"instanceid",
",",
"$",
"component",
",",
"$",
"itemid",
",",
"$",
"area",
"=",
"''",
",",
"$",
"page",
"=",
"0",
")",
"{",
"$",
"warnings",
"=",
"array",
"(",
")",
... | Return a list of comments
@param string $contextlevel ('system, course, user', etc..)
@param int $instanceid
@param string $component the name of the component
@param int $itemid the item id
@param string $area comment area
@param int $page page number
@return array of comments and warnings
@since Moodle 2.9 | [
"Return",
"a",
"list",
"of",
"comments"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/classes/external.php#L74-L123 |
217,137 | moodle/moodle | mod/assign/submission/comments/locallib.php | assign_submission_comments.view_summary | public function view_summary(stdClass $submission, & $showviewlink) {
// Never show a link to view full submission.
$showviewlink = false;
// Need to used this init() otherwise it does not have the javascript includes.
comment::init();
$options = new stdClass();
$option... | php | public function view_summary(stdClass $submission, & $showviewlink) {
// Never show a link to view full submission.
$showviewlink = false;
// Need to used this init() otherwise it does not have the javascript includes.
comment::init();
$options = new stdClass();
$option... | [
"public",
"function",
"view_summary",
"(",
"stdClass",
"$",
"submission",
",",
"&",
"$",
"showviewlink",
")",
"{",
"// Never show a link to view full submission.",
"$",
"showviewlink",
"=",
"false",
";",
"// Need to used this init() otherwise it does not have the javascript inc... | Display AJAX based comment in the submission status table
@param stdClass $submission
@param bool $showviewlink - If the comments are long this is
set to true so they can be shown in a separate page
@return string | [
"Display",
"AJAX",
"based",
"comment",
"in",
"the",
"submission",
"status",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/comments/locallib.php#L55-L75 |
217,138 | moodle/moodle | question/behaviour/behaviourbase.php | question_behaviour.adjust_display_options | public function adjust_display_options(question_display_options $options) {
if (!$this->qa->has_marks()) {
$options->correctness = false;
$options->numpartscorrect = false;
}
if ($this->qa->get_state()->is_finished()) {
$options->readonly = true;
$... | php | public function adjust_display_options(question_display_options $options) {
if (!$this->qa->has_marks()) {
$options->correctness = false;
$options->numpartscorrect = false;
}
if ($this->qa->get_state()->is_finished()) {
$options->readonly = true;
$... | [
"public",
"function",
"adjust_display_options",
"(",
"question_display_options",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"qa",
"->",
"has_marks",
"(",
")",
")",
"{",
"$",
"options",
"->",
"correctness",
"=",
"false",
";",
"$",
"options... | Make any changes to the display options before a question is rendered, so
that it can be displayed in a way that is appropriate for the statue it is
currently in. For example, by default, if the question is finished, we
ensure that it is only ever displayed read-only.
@param question_display_options $options the option... | [
"Make",
"any",
"changes",
"to",
"the",
"display",
"options",
"before",
"a",
"question",
"is",
"rendered",
"so",
"that",
"it",
"can",
"be",
"displayed",
"in",
"a",
"way",
"that",
"is",
"appropriate",
"for",
"the",
"statue",
"it",
"is",
"currently",
"in",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/behaviour/behaviourbase.php#L158-L171 |
217,139 | moodle/moodle | question/behaviour/behaviourbase.php | question_behaviour.get_expected_data | public function get_expected_data() {
if (!$this->qa->get_state()->is_finished()) {
return array();
}
$vars = array('comment' => question_attempt::PARAM_RAW_FILES, 'commentformat' => PARAM_INT);
if ($this->qa->get_max_mark()) {
$vars['mark'] = PARAM_RAW_TRIMMED;
... | php | public function get_expected_data() {
if (!$this->qa->get_state()->is_finished()) {
return array();
}
$vars = array('comment' => question_attempt::PARAM_RAW_FILES, 'commentformat' => PARAM_INT);
if ($this->qa->get_max_mark()) {
$vars['mark'] = PARAM_RAW_TRIMMED;
... | [
"public",
"function",
"get_expected_data",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"qa",
"->",
"get_state",
"(",
")",
"->",
"is_finished",
"(",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"vars",
"=",
"array",
"(",
"'commen... | Return an array of the behaviour variables that could be submitted
as part of a question of this type, with their types, so they can be
properly cleaned.
@return array variable name => PARAM_... constant. | [
"Return",
"an",
"array",
"of",
"the",
"behaviour",
"variables",
"that",
"could",
"be",
"submitted",
"as",
"part",
"of",
"a",
"question",
"of",
"this",
"type",
"with",
"their",
"types",
"so",
"they",
"can",
"be",
"properly",
"cleaned",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/behaviour/behaviourbase.php#L211-L222 |
217,140 | moodle/moodle | question/behaviour/behaviourbase.php | question_behaviour_with_save.process_save | public function process_save(question_attempt_pending_step $pendingstep) {
if ($this->qa->get_state()->is_finished()) {
return question_attempt::DISCARD;
} else if (!$this->qa->get_state()->is_active()) {
throw new coding_exception('Question is not active, cannot process_actions.... | php | public function process_save(question_attempt_pending_step $pendingstep) {
if ($this->qa->get_state()->is_finished()) {
return question_attempt::DISCARD;
} else if (!$this->qa->get_state()->is_active()) {
throw new coding_exception('Question is not active, cannot process_actions.... | [
"public",
"function",
"process_save",
"(",
"question_attempt_pending_step",
"$",
"pendingstep",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"qa",
"->",
"get_state",
"(",
")",
"->",
"is_finished",
"(",
")",
")",
"{",
"return",
"question_attempt",
"::",
"DISCARD",
... | Implementation of processing a save action that should be suitable for
most subclasses.
@param question_attempt_pending_step $pendingstep a partially initialised step
containing all the information about the action that is being peformed.
@return bool either {@link question_attempt::KEEP} or {@link question_attempt::DI... | [
"Implementation",
"of",
"processing",
"a",
"save",
"action",
"that",
"should",
"be",
"suitable",
"for",
"most",
"subclasses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/behaviour/behaviourbase.php#L672-L689 |
217,141 | moodle/moodle | question/behaviour/behaviourbase.php | question_cbm.adjust_fraction | public static function adjust_fraction($fraction, $certainty) {
if ($certainty == -1) {
// Certainty -1 has never been used in standard Moodle, but is
// used in Tony-Gardiner Medwin's patches to mean 'No idea' which
// we intend to implement: MDL-42077. In the mean time, avo... | php | public static function adjust_fraction($fraction, $certainty) {
if ($certainty == -1) {
// Certainty -1 has never been used in standard Moodle, but is
// used in Tony-Gardiner Medwin's patches to mean 'No idea' which
// we intend to implement: MDL-42077. In the mean time, avo... | [
"public",
"static",
"function",
"adjust_fraction",
"(",
"$",
"fraction",
",",
"$",
"certainty",
")",
"{",
"if",
"(",
"$",
"certainty",
"==",
"-",
"1",
")",
"{",
"// Certainty -1 has never been used in standard Moodle, but is",
"// used in Tony-Gardiner Medwin's patches to... | Given a fraction, and a certainty, compute the adjusted fraction.
@param number $fraction the raw fraction for this question.
@param int $certainty one of the certainty level constants.
@return number the adjusted fraction taking the certainty into account. | [
"Given",
"a",
"fraction",
"and",
"a",
"certainty",
"compute",
"the",
"adjusted",
"fraction",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/behaviour/behaviourbase.php#L779-L792 |
217,142 | moodle/moodle | question/behaviour/behaviourbase.php | question_cbm.summary_with_certainty | public static function summary_with_certainty($summary, $certainty) {
if (is_null($certainty)) {
return $summary;
}
return $summary . ' [' . self::get_short_string($certainty) . ']';
} | php | public static function summary_with_certainty($summary, $certainty) {
if (is_null($certainty)) {
return $summary;
}
return $summary . ' [' . self::get_short_string($certainty) . ']';
} | [
"public",
"static",
"function",
"summary_with_certainty",
"(",
"$",
"summary",
",",
"$",
"certainty",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"certainty",
")",
")",
"{",
"return",
"$",
"summary",
";",
"}",
"return",
"$",
"summary",
".",
"' ['",
".",
... | Add information about certainty to a response summary.
@param string $summary the response summary.
@param int $certainty the level of certainty to add.
@return string the summary with information about the certainty added. | [
"Add",
"information",
"about",
"certainty",
"to",
"a",
"response",
"summary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/behaviour/behaviourbase.php#L816-L821 |
217,143 | moodle/moodle | lib/filebrowser/file_info_context_system.php | file_info_context_system.get_file_info | public function get_file_info($component, $filearea, $itemid, $filepath, $filename) {
if (empty($component)) {
return $this;
}
$methodname = "get_area_{$component}_{$filearea}";
if (method_exists($this, $methodname)) {
return $this->$methodname($itemid, $filepat... | php | public function get_file_info($component, $filearea, $itemid, $filepath, $filename) {
if (empty($component)) {
return $this;
}
$methodname = "get_area_{$component}_{$filearea}";
if (method_exists($this, $methodname)) {
return $this->$methodname($itemid, $filepat... | [
"public",
"function",
"get_file_info",
"(",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"component",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
... | Return information about this specific part of context level
@param string $component component
@param string $filearea file area
@param int $itemid item ID
@param string $filepath file path
@param string $filename file name
@return file_info|null file_info instance or null if not found or access not allowed | [
"Return",
"information",
"about",
"this",
"specific",
"part",
"of",
"context",
"level"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info_context_system.php#L59-L71 |
217,144 | moodle/moodle | completion/completion_completion.php | completion_completion.fetch | public static function fetch($params) {
$cache = cache::make('core', 'coursecompletion');
$key = $params['userid'] . '_' . $params['course'];
if ($hit = $cache->get($key)) {
return $hit['value'];
}
$tocache = self::fetch_helper('course_completions', __CLASS__, $para... | php | public static function fetch($params) {
$cache = cache::make('core', 'coursecompletion');
$key = $params['userid'] . '_' . $params['course'];
if ($hit = $cache->get($key)) {
return $hit['value'];
}
$tocache = self::fetch_helper('course_completions', __CLASS__, $para... | [
"public",
"static",
"function",
"fetch",
"(",
"$",
"params",
")",
"{",
"$",
"cache",
"=",
"cache",
"::",
"make",
"(",
"'core'",
",",
"'coursecompletion'",
")",
";",
"$",
"key",
"=",
"$",
"params",
"[",
"'userid'",
"]",
".",
"'_'",
".",
"$",
"params",... | Finds and returns a data_object instance based on params.
@param array $params associative arrays varname = >value
@return data_object instance of data_object or false if none found. | [
"Finds",
"and",
"returns",
"a",
"data_object",
"instance",
"based",
"on",
"params",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/completion_completion.php#L76-L87 |
217,145 | moodle/moodle | completion/completion_completion.php | completion_completion.mark_inprogress | public function mark_inprogress($timestarted = null) {
$timenow = time();
// Set reaggregate flag
$this->reaggregate = $timenow;
if (!$this->timestarted) {
if (!$timestarted) {
$timestarted = $timenow;
}
$this->timestarted = $times... | php | public function mark_inprogress($timestarted = null) {
$timenow = time();
// Set reaggregate flag
$this->reaggregate = $timenow;
if (!$this->timestarted) {
if (!$timestarted) {
$timestarted = $timenow;
}
$this->timestarted = $times... | [
"public",
"function",
"mark_inprogress",
"(",
"$",
"timestarted",
"=",
"null",
")",
"{",
"$",
"timenow",
"=",
"time",
"(",
")",
";",
"// Set reaggregate flag",
"$",
"this",
"->",
"reaggregate",
"=",
"$",
"timenow",
";",
"if",
"(",
"!",
"$",
"this",
"->",... | Mark this user as inprogress in this course
If the user is already marked as inprogress, the time will not be changed
@param integer $timestarted Time started (optional) | [
"Mark",
"this",
"user",
"as",
"inprogress",
"in",
"this",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/completion_completion.php#L126-L143 |
217,146 | moodle/moodle | completion/completion_completion.php | completion_completion.mark_complete | public function mark_complete($timecomplete = null) {
global $USER;
// Never change a completion time.
if ($this->timecompleted) {
return;
}
// Use current time if nothing supplied.
if (!$timecomplete) {
$timecomplete = time();
}
... | php | public function mark_complete($timecomplete = null) {
global $USER;
// Never change a completion time.
if ($this->timecompleted) {
return;
}
// Use current time if nothing supplied.
if (!$timecomplete) {
$timecomplete = time();
}
... | [
"public",
"function",
"mark_complete",
"(",
"$",
"timecomplete",
"=",
"null",
")",
"{",
"global",
"$",
"USER",
";",
"// Never change a completion time.",
"if",
"(",
"$",
"this",
"->",
"timecompleted",
")",
"{",
"return",
";",
"}",
"// Use current time if nothing s... | Mark this user complete in this course
This generally happens when the required completion criteria
in the course are complete.
@param integer $timecomplete Time completed (optional)
@return void | [
"Mark",
"this",
"user",
"complete",
"in",
"this",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/completion_completion.php#L154-L177 |
217,147 | moodle/moodle | completion/completion_completion.php | completion_completion._save | private function _save() {
if ($this->timeenrolled === null) {
$this->timeenrolled = 0;
}
$result = false;
// Save record
if ($this->id) {
$result = $this->update();
} else {
// Make sure reaggregate field is not null
if (!... | php | private function _save() {
if ($this->timeenrolled === null) {
$this->timeenrolled = 0;
}
$result = false;
// Save record
if ($this->id) {
$result = $this->update();
} else {
// Make sure reaggregate field is not null
if (!... | [
"private",
"function",
"_save",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"timeenrolled",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"timeenrolled",
"=",
"0",
";",
"}",
"$",
"result",
"=",
"false",
";",
"// Save record",
"if",
"(",
"$",
"this",
... | Save course completion status
This method creates a course_completions record if none exists
@access private
@return bool | [
"Save",
"course",
"completion",
"status"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/completion_completion.php#L186-L218 |
217,148 | moodle/moodle | blocks/community/renderer.php | block_community_renderer.remove_success | public function remove_success(moodle_url $url) {
$html = $this->output->notification(get_string('communityremoved', 'hub'),
'notifysuccess');
$continuebutton = new single_button($url,
get_string('continue', 'block_community'));
$html .= html_writer::t... | php | public function remove_success(moodle_url $url) {
$html = $this->output->notification(get_string('communityremoved', 'hub'),
'notifysuccess');
$continuebutton = new single_button($url,
get_string('continue', 'block_community'));
$html .= html_writer::t... | [
"public",
"function",
"remove_success",
"(",
"moodle_url",
"$",
"url",
")",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"output",
"->",
"notification",
"(",
"get_string",
"(",
"'communityremoved'",
",",
"'hub'",
")",
",",
"'notifysuccess'",
")",
";",
"$",
"c... | Display remove community success message and a button to be redirected to te referer page
@param moodle_url $url the page to be redirected to
@return string html | [
"Display",
"remove",
"community",
"success",
"message",
"and",
"a",
"button",
"to",
"be",
"redirected",
"to",
"te",
"referer",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/community/renderer.php#L52-L60 |
217,149 | moodle/moodle | blocks/community/renderer.php | block_community_renderer.moodlenet_info | public function moodlenet_info() {
if (!$info = \core\hub\registration::get_moodlenet_info()) {
return '';
}
$image = html_writer::div(html_writer::img($info['imgurl'], $info['name']), 'hubimage');
$namelink = html_writer::link($info['url'], html_writer::tag('h2', $info['na... | php | public function moodlenet_info() {
if (!$info = \core\hub\registration::get_moodlenet_info()) {
return '';
}
$image = html_writer::div(html_writer::img($info['imgurl'], $info['name']), 'hubimage');
$namelink = html_writer::link($info['url'], html_writer::tag('h2', $info['na... | [
"public",
"function",
"moodlenet_info",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"info",
"=",
"\\",
"core",
"\\",
"hub",
"\\",
"registration",
"::",
"get_moodlenet_info",
"(",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"image",
"=",
"html_writer",
"::",
... | Displays information about moodle.net above course search form
@return string | [
"Displays",
"information",
"about",
"moodle",
".",
"net",
"above",
"course",
"search",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/community/renderer.php#L93-L115 |
217,150 | moodle/moodle | repository/coursefiles/lib.php | repository_coursefiles.get_name | public function get_name() {
$context = $this->context->get_course_context(false);
if ($context) {
return get_string('courselegacyfilesofcourse', 'moodle', $context->get_context_name(false, true));
} else {
return get_string('courselegacyfiles');
}
} | php | public function get_name() {
$context = $this->context->get_course_context(false);
if ($context) {
return get_string('courselegacyfilesofcourse', 'moodle', $context->get_context_name(false, true));
} else {
return get_string('courselegacyfiles');
}
} | [
"public",
"function",
"get_name",
"(",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"context",
"->",
"get_course_context",
"(",
"false",
")",
";",
"if",
"(",
"$",
"context",
")",
"{",
"return",
"get_string",
"(",
"'courselegacyfilesofcourse'",
",",
"'... | Return the repository name.
@return string | [
"Return",
"the",
"repository",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/coursefiles/lib.php#L188-L195 |
217,151 | moodle/moodle | media/player/videojs/classes/plugin.php | media_videojs_plugin.find_language | protected function find_language() {
global $CFG;
$this->language = current_language();
$basedir = $CFG->dirroot . '/media/player/videojs/videojs/lang/';
$langfiles = get_directory_list($basedir);
$candidates = [];
foreach ($langfiles as $langfile) {
if (strto... | php | protected function find_language() {
global $CFG;
$this->language = current_language();
$basedir = $CFG->dirroot . '/media/player/videojs/videojs/lang/';
$langfiles = get_directory_list($basedir);
$candidates = [];
foreach ($langfiles as $langfile) {
if (strto... | [
"protected",
"function",
"find_language",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"this",
"->",
"language",
"=",
"current_language",
"(",
")",
";",
"$",
"basedir",
"=",
"$",
"CFG",
"->",
"dirroot",
".",
"'/media/player/videojs/videojs/lang/'",
";",
"$... | Tries to match the current language to existing language files
Matched language is stored in $this->language
@return string JS code with a setting | [
"Tries",
"to",
"match",
"the",
"current",
"language",
"to",
"existing",
"language",
"files"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/media/player/videojs/classes/plugin.php#L295-L329 |
217,152 | moodle/moodle | media/player/videojs/classes/plugin.php | media_videojs_plugin.setup | public function setup($page) {
// Load dynamic loader. It will scan page for videojs media and load necessary modules.
// Loader will be loaded on absolutely every page, however the videojs will only be loaded
// when video is present on the page or added later to it in AJAX.
$path = ne... | php | public function setup($page) {
// Load dynamic loader. It will scan page for videojs media and load necessary modules.
// Loader will be loaded on absolutely every page, however the videojs will only be loaded
// when video is present on the page or added later to it in AJAX.
$path = ne... | [
"public",
"function",
"setup",
"(",
"$",
"page",
")",
"{",
"// Load dynamic loader. It will scan page for videojs media and load necessary modules.",
"// Loader will be loaded on absolutely every page, however the videojs will only be loaded",
"// when video is present on the page or added later... | Setup page requirements.
@param moodle_page $page The page we are going to add requirements to. | [
"Setup",
"page",
"requirements",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/media/player/videojs/classes/plugin.php#L378-L394 |
217,153 | moodle/moodle | course/classes/analytics/indicator/potential_social_breadth.php | potential_social_breadth.get_social_indicator | protected function get_social_indicator($modname) {
$indicators = \core_analytics\manager::get_all_indicators();
foreach ($indicators as $indicator) {
if ($indicator instanceof community_of_inquiry_activity &&
$indicator->get_indicator_type() === community_of_inquiry_acti... | php | protected function get_social_indicator($modname) {
$indicators = \core_analytics\manager::get_all_indicators();
foreach ($indicators as $indicator) {
if ($indicator instanceof community_of_inquiry_activity &&
$indicator->get_indicator_type() === community_of_inquiry_acti... | [
"protected",
"function",
"get_social_indicator",
"(",
"$",
"modname",
")",
"{",
"$",
"indicators",
"=",
"\\",
"core_analytics",
"\\",
"manager",
"::",
"get_all_indicators",
"(",
")",
";",
"foreach",
"(",
"$",
"indicators",
"as",
"$",
"indicator",
")",
"{",
"... | Returns the social breadth class of this indicator.
@param string $modname
@return \core_analytics\local\indicator\base|false | [
"Returns",
"the",
"social",
"breadth",
"class",
"of",
"this",
"indicator",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/analytics/indicator/potential_social_breadth.php#L127-L137 |
217,154 | moodle/moodle | mod/forum/classes/local/vaults/post.php | post.from_db_records | protected function from_db_records(array $results) {
$entityfactory = $this->get_entity_factory();
return array_map(function(array $result) use ($entityfactory) {
['record' => $record] = $result;
return $entityfactory->get_post_from_stdclass($record);
}, $results);
} | php | protected function from_db_records(array $results) {
$entityfactory = $this->get_entity_factory();
return array_map(function(array $result) use ($entityfactory) {
['record' => $record] = $result;
return $entityfactory->get_post_from_stdclass($record);
}, $results);
} | [
"protected",
"function",
"from_db_records",
"(",
"array",
"$",
"results",
")",
"{",
"$",
"entityfactory",
"=",
"$",
"this",
"->",
"get_entity_factory",
"(",
")",
";",
"return",
"array_map",
"(",
"function",
"(",
"array",
"$",
"result",
")",
"use",
"(",
"$"... | Convert the DB records into post entities.
@param array $results The DB records
@return post_entity[] | [
"Convert",
"the",
"DB",
"records",
"into",
"post",
"entities",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/post.php#L88-L95 |
217,155 | moodle/moodle | mod/forum/classes/local/vaults/post.php | post.get_from_discussion_id | public function get_from_discussion_id(
stdClass $user,
int $discussionid,
bool $canseeprivatereplies,
string $orderby = 'created ASC'
) : array {
$alias = $this->get_table_alias();
[
'where' => $privatewhere,
'params' => $privateparams,
... | php | public function get_from_discussion_id(
stdClass $user,
int $discussionid,
bool $canseeprivatereplies,
string $orderby = 'created ASC'
) : array {
$alias = $this->get_table_alias();
[
'where' => $privatewhere,
'params' => $privateparams,
... | [
"public",
"function",
"get_from_discussion_id",
"(",
"stdClass",
"$",
"user",
",",
"int",
"$",
"discussionid",
",",
"bool",
"$",
"canseeprivatereplies",
",",
"string",
"$",
"orderby",
"=",
"'created ASC'",
")",
":",
"array",
"{",
"$",
"alias",
"=",
"$",
"thi... | Get the post ids for the given discussion.
@param stdClass $user The user to check the unread count for
@param int $discussionid The discussion to load posts for
@param bool $canseeprivatereplies Whether this user can see all private replies or not
@param string $orderby Order the results
@return post_entity[] | [
"Get",
"the",
"post",
"ids",
"for",
"the",
"given",
"discussion",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/post.php#L106-L128 |
217,156 | moodle/moodle | mod/forum/classes/local/vaults/post.php | post.get_from_discussion_ids | public function get_from_discussion_ids(stdClass $user, array $discussionids, bool $canseeprivatereplies) : array {
if (empty($discussionids)) {
return [];
}
$alias = $this->get_table_alias();
list($insql, $params) = $this->get_db()->get_in_or_equal($discussionids, SQL_PARA... | php | public function get_from_discussion_ids(stdClass $user, array $discussionids, bool $canseeprivatereplies) : array {
if (empty($discussionids)) {
return [];
}
$alias = $this->get_table_alias();
list($insql, $params) = $this->get_db()->get_in_or_equal($discussionids, SQL_PARA... | [
"public",
"function",
"get_from_discussion_ids",
"(",
"stdClass",
"$",
"user",
",",
"array",
"$",
"discussionids",
",",
"bool",
"$",
"canseeprivatereplies",
")",
":",
"array",
"{",
"if",
"(",
"empty",
"(",
"$",
"discussionids",
")",
")",
"{",
"return",
"[",
... | Get the list of posts for the given discussions.
@param stdClass $user The user to check the unread count for
@param int[] $discussionids The list of discussion ids to load posts for
@param bool $canseeprivatereplies Whether this user can see all private replies or not
@return post_entity[] | [
"Get",
"the",
"list",
"of",
"posts",
"for",
"the",
"given",
"discussions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/post.php#L138-L157 |
217,157 | moodle/moodle | mod/forum/classes/local/vaults/post.php | post.get_replies_to_post | public function get_replies_to_post(
stdClass $user,
post_entity $post,
bool $canseeprivatereplies,
string $orderby = 'created ASC'
) : array {
$alias = $this->get_table_alias();
[
'where' => $privatewhere,
'params' => $privateparams,
... | php | public function get_replies_to_post(
stdClass $user,
post_entity $post,
bool $canseeprivatereplies,
string $orderby = 'created ASC'
) : array {
$alias = $this->get_table_alias();
[
'where' => $privatewhere,
'params' => $privateparams,
... | [
"public",
"function",
"get_replies_to_post",
"(",
"stdClass",
"$",
"user",
",",
"post_entity",
"$",
"post",
",",
"bool",
"$",
"canseeprivatereplies",
",",
"string",
"$",
"orderby",
"=",
"'created ASC'",
")",
":",
"array",
"{",
"$",
"alias",
"=",
"$",
"this",... | Load a list of replies to the given post. This will load all descendants of the post.
That is, all direct replies and replies to those replies etc.
The return value will be a flat array of posts in the requested order.
@param stdClass $user The user to check the unread count for
@param post_entity $post The post t... | [
"Load",
"a",
"list",
"of",
"replies",
"to",
"the",
"given",
"post",
".",
"This",
"will",
"load",
"all",
"descendants",
"of",
"the",
"post",
".",
"That",
"is",
"all",
"direct",
"replies",
"and",
"replies",
"to",
"those",
"replies",
"etc",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/post.php#L171-L239 |
217,158 | moodle/moodle | mod/forum/classes/local/vaults/post.php | post.get_reply_count_for_post_id_in_discussion_id | public function get_reply_count_for_post_id_in_discussion_id(
stdClass $user, int $postid, int $discussionid, bool $canseeprivatereplies) : int {
[
'where' => $privatewhere,
'params' => $privateparams,
] = $this->get_private_reply_sql($user, $canseeprivatereplies);
... | php | public function get_reply_count_for_post_id_in_discussion_id(
stdClass $user, int $postid, int $discussionid, bool $canseeprivatereplies) : int {
[
'where' => $privatewhere,
'params' => $privateparams,
] = $this->get_private_reply_sql($user, $canseeprivatereplies);
... | [
"public",
"function",
"get_reply_count_for_post_id_in_discussion_id",
"(",
"stdClass",
"$",
"user",
",",
"int",
"$",
"postid",
",",
"int",
"$",
"discussionid",
",",
"bool",
"$",
"canseeprivatereplies",
")",
":",
"int",
"{",
"[",
"'where'",
"=>",
"$",
"privatewhe... | Get a mapping of replies to the specified discussions.
@param stdClass $user The user to check the unread count for
@param int $postid The post to collect replies to
@param int $discussionid The list of discussions to fetch counts for
@param bool $canseeprivatereplies Whether this use... | [
"Get",
"a",
"mapping",
"of",
"replies",
"to",
"the",
"specified",
"discussions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/post.php#L278-L297 |
217,159 | moodle/moodle | mod/forum/classes/local/vaults/post.php | post.count_children_from_parent_recursively | private function count_children_from_parent_recursively(array $postparents, int $postid) : int {
if (!isset($postparents[$postid])) {
// Post not found at all.
return 0;
}
$count = 0;
foreach ($postparents as $pid => $parentid) {
if ($postid == $paren... | php | private function count_children_from_parent_recursively(array $postparents, int $postid) : int {
if (!isset($postparents[$postid])) {
// Post not found at all.
return 0;
}
$count = 0;
foreach ($postparents as $pid => $parentid) {
if ($postid == $paren... | [
"private",
"function",
"count_children_from_parent_recursively",
"(",
"array",
"$",
"postparents",
",",
"int",
"$",
"postid",
")",
":",
"int",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"postparents",
"[",
"$",
"postid",
"]",
")",
")",
"{",
"// Post not found a... | Count the children whose parent matches the current record recursively.
@param array $postparents The full mapping of posts.
@param int $postid The ID to check for
@return int $count | [
"Count",
"the",
"children",
"whose",
"parent",
"matches",
"the",
"current",
"record",
"recursively",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/post.php#L306-L320 |
217,160 | moodle/moodle | mod/forum/classes/local/vaults/post.php | post.get_unread_count_for_discussion_ids | public function get_unread_count_for_discussion_ids(stdClass $user, array $discussionids, bool $canseeprivatereplies) : array {
global $CFG;
if (empty($discussionids)) {
return [];
}
[
'where' => $privatewhere,
'params' => $privateparams,
] =... | php | public function get_unread_count_for_discussion_ids(stdClass $user, array $discussionids, bool $canseeprivatereplies) : array {
global $CFG;
if (empty($discussionids)) {
return [];
}
[
'where' => $privatewhere,
'params' => $privateparams,
] =... | [
"public",
"function",
"get_unread_count_for_discussion_ids",
"(",
"stdClass",
"$",
"user",
",",
"array",
"$",
"discussionids",
",",
"bool",
"$",
"canseeprivatereplies",
")",
":",
"array",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"discussio... | Get a mapping of unread post counts for the specified discussions.
@param stdClass $user The user to fetch counts for
@param int[] $discussionids The list of discussions to fetch counts for
@param bool $canseeprivatereplies Whether this user can see all private replies or not
@return int[] ... | [
"Get",
"a",
"mapping",
"of",
"unread",
"post",
"counts",
"for",
"the",
"specified",
"discussions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/post.php#L330-L355 |
217,161 | moodle/moodle | mod/forum/classes/local/vaults/post.php | post.get_private_reply_sql | private function get_private_reply_sql(stdClass $user, bool $canseeprivatereplies) {
$params = [];
$privatewhere = '';
if (!$canseeprivatereplies) {
$privatewhere = ' AND (p.privatereplyto = :privatereplyto OR p.userid = :privatereplyfrom OR p.privatereplyto = 0)';
$param... | php | private function get_private_reply_sql(stdClass $user, bool $canseeprivatereplies) {
$params = [];
$privatewhere = '';
if (!$canseeprivatereplies) {
$privatewhere = ' AND (p.privatereplyto = :privatereplyto OR p.userid = :privatereplyfrom OR p.privatereplyto = 0)';
$param... | [
"private",
"function",
"get_private_reply_sql",
"(",
"stdClass",
"$",
"user",
",",
"bool",
"$",
"canseeprivatereplies",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"$",
"privatewhere",
"=",
"''",
";",
"if",
"(",
"!",
"$",
"canseeprivatereplies",
")",
"{",... | Get the SQL where and additional parameters to use to restrict posts to private reply posts.
@param stdClass $user The user to fetch counts for
@param bool $canseeprivatereplies Whether this user can see all private replies or not
@return array The SQL WHERE clause, and parameters to use in the SQ... | [
"Get",
"the",
"SQL",
"where",
"and",
"additional",
"parameters",
"to",
"use",
"to",
"restrict",
"posts",
"to",
"private",
"reply",
"posts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/post.php#L403-L416 |
217,162 | moodle/moodle | mod/forum/classes/local/vaults/post.php | post.get_first_post_for_discussion_ids | public function get_first_post_for_discussion_ids(array $discussionids) : array {
if (empty($discussionids)) {
return [];
}
list($insql, $params) = $this->get_db()->get_in_or_equal($discussionids, SQL_PARAMS_NAMED);
$sql = "
SELECT p.*
FROM {" . s... | php | public function get_first_post_for_discussion_ids(array $discussionids) : array {
if (empty($discussionids)) {
return [];
}
list($insql, $params) = $this->get_db()->get_in_or_equal($discussionids, SQL_PARAMS_NAMED);
$sql = "
SELECT p.*
FROM {" . s... | [
"public",
"function",
"get_first_post_for_discussion_ids",
"(",
"array",
"$",
"discussionids",
")",
":",
"array",
"{",
"if",
"(",
"empty",
"(",
"$",
"discussionids",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"list",
"(",
"$",
"insql",
",",
"$",
"param... | Get a mapping of the first post in each discussion based on post creation time.
@param int[] $discussionids The list of discussions to fetch counts for
@return stdClass[] The post object of the first post for each discussions returned in an associative array | [
"Get",
"a",
"mapping",
"of",
"the",
"first",
"post",
"in",
"each",
"discussion",
"based",
"on",
"post",
"creation",
"time",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/post.php#L424-L443 |
217,163 | moodle/moodle | lib/php-css-parser/CSSList/Document.php | Document.getAllValues | public function getAllValues($mElement = null, $bSearchInFunctionArguments = false) {
$sSearchString = null;
if ($mElement === null) {
$mElement = $this;
} else if (is_string($mElement)) {
$sSearchString = $mElement;
$mElement = $this;
}
$aResult = array();
$this->allValues($mElement, $aResult, $sS... | php | public function getAllValues($mElement = null, $bSearchInFunctionArguments = false) {
$sSearchString = null;
if ($mElement === null) {
$mElement = $this;
} else if (is_string($mElement)) {
$sSearchString = $mElement;
$mElement = $this;
}
$aResult = array();
$this->allValues($mElement, $aResult, $sS... | [
"public",
"function",
"getAllValues",
"(",
"$",
"mElement",
"=",
"null",
",",
"$",
"bSearchInFunctionArguments",
"=",
"false",
")",
"{",
"$",
"sSearchString",
"=",
"null",
";",
"if",
"(",
"$",
"mElement",
"===",
"null",
")",
"{",
"$",
"mElement",
"=",
"$... | Returns all Value objects found recursively in the tree.
@param (object|string) $mElement the CSSList or RuleSet to start the search from (defaults to the whole document). If a string is given, it is used as rule name filter (@see{RuleSet->getRules()}).
@param (bool) $bSearchInFunctionArguments whether to also return V... | [
"Returns",
"all",
"Value",
"objects",
"found",
"recursively",
"in",
"the",
"tree",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/php-css-parser/CSSList/Document.php#L47-L58 |
217,164 | moodle/moodle | lib/behat/form_field/behat_form_editor.php | behat_form_editor.select_text | public function select_text() {
// NodeElement.keyPress simply doesn't work.
if (!$this->running_javascript()) {
throw new coding_exception('Selecting text requires javascript.');
}
$editorid = $this->field->getAttribute('id');
$js = ' (function() {
var e = docum... | php | public function select_text() {
// NodeElement.keyPress simply doesn't work.
if (!$this->running_javascript()) {
throw new coding_exception('Selecting text requires javascript.');
}
$editorid = $this->field->getAttribute('id');
$js = ' (function() {
var e = docum... | [
"public",
"function",
"select_text",
"(",
")",
"{",
"// NodeElement.keyPress simply doesn't work.",
"if",
"(",
"!",
"$",
"this",
"->",
"running_javascript",
"(",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Selecting text requires javascript.'",
")",
";",... | Select all the text in the form field. | [
"Select",
"all",
"the",
"text",
"in",
"the",
"form",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_editor.php#L72-L92 |
217,165 | moodle/moodle | mod/forum/classes/local/entities/post_read_receipt_collection.php | post_read_receipt_collection.has_user_read_post | public function has_user_read_post(stdClass $user, post_entity $post) : bool {
global $CFG;
$isoldpost = ($post->get_time_modified() < (time() - ($CFG->forum_oldpostdays * 24 * 3600)));
if ($isoldpost) {
return true;
}
$receipts = isset($this->receiptsbypostid[$post... | php | public function has_user_read_post(stdClass $user, post_entity $post) : bool {
global $CFG;
$isoldpost = ($post->get_time_modified() < (time() - ($CFG->forum_oldpostdays * 24 * 3600)));
if ($isoldpost) {
return true;
}
$receipts = isset($this->receiptsbypostid[$post... | [
"public",
"function",
"has_user_read_post",
"(",
"stdClass",
"$",
"user",
",",
"post_entity",
"$",
"post",
")",
":",
"bool",
"{",
"global",
"$",
"CFG",
";",
"$",
"isoldpost",
"=",
"(",
"$",
"post",
"->",
"get_time_modified",
"(",
")",
"<",
"(",
"time",
... | Check whether a user has read a post.
@param stdClass $user The user to check
@param post_entity $post The post to check
@return bool | [
"Check",
"whether",
"a",
"user",
"has",
"read",
"a",
"post",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/entities/post_read_receipt_collection.php#L68-L85 |
217,166 | moodle/moodle | calendar/classes/external/calendar_event_exporter.php | calendar_event_exporter.define_related | protected static function define_related() {
$related = parent::define_related();
$related['daylink'] = \moodle_url::class;
$related['type'] = '\core_calendar\type_base';
$related['today'] = 'int';
$related['moduleinstance'] = 'stdClass?';
return $related;
} | php | protected static function define_related() {
$related = parent::define_related();
$related['daylink'] = \moodle_url::class;
$related['type'] = '\core_calendar\type_base';
$related['today'] = 'int';
$related['moduleinstance'] = 'stdClass?';
return $related;
} | [
"protected",
"static",
"function",
"define_related",
"(",
")",
"{",
"$",
"related",
"=",
"parent",
"::",
"define_related",
"(",
")",
";",
"$",
"related",
"[",
"'daylink'",
"]",
"=",
"\\",
"moodle_url",
"::",
"class",
";",
"$",
"related",
"[",
"'type'",
"... | Returns a list of objects that are related.
@return array | [
"Returns",
"a",
"list",
"of",
"objects",
"that",
"are",
"related",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/calendar_event_exporter.php#L187-L195 |
217,167 | moodle/moodle | calendar/classes/external/calendar_event_exporter.php | calendar_event_exporter.get_timestamp_min_limit | protected function get_timestamp_min_limit(\DateTimeInterface $starttime, $min) {
// We need to check that the minimum valid time is earlier in the
// day than the current event time so that if the user drags and drops
// the event to this day (which changes the date but not the time) it
... | php | protected function get_timestamp_min_limit(\DateTimeInterface $starttime, $min) {
// We need to check that the minimum valid time is earlier in the
// day than the current event time so that if the user drags and drops
// the event to this day (which changes the date but not the time) it
... | [
"protected",
"function",
"get_timestamp_min_limit",
"(",
"\\",
"DateTimeInterface",
"$",
"starttime",
",",
"$",
"min",
")",
"{",
"// We need to check that the minimum valid time is earlier in the",
"// day than the current event time so that if the user drags and drops",
"// the event ... | Get the correct minimum midnight day limit based on the event start time
and the minimum timestamp limit of what the event belongs to.
@param DateTimeInterface $starttime The event start time
@param array $min The module's minimum limit for the event
@return array Returns an array with mindaytimestamp and mindayerror ... | [
"Get",
"the",
"correct",
"minimum",
"midnight",
"day",
"limit",
"based",
"on",
"the",
"event",
"start",
"time",
"and",
"the",
"minimum",
"timestamp",
"limit",
"of",
"what",
"the",
"event",
"belongs",
"to",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/calendar_event_exporter.php#L297-L331 |
217,168 | moodle/moodle | calendar/classes/external/calendar_event_exporter.php | calendar_event_exporter.get_timestamp_max_limit | protected function get_timestamp_max_limit(\DateTimeInterface $starttime, $max) {
// We're doing a similar calculation here as we are for the minimum
// day timestamp. See the explanation above.
$values = [];
$timestamp = $max[0];
$errorstring = $max[1];
$maxdate = (new \... | php | protected function get_timestamp_max_limit(\DateTimeInterface $starttime, $max) {
// We're doing a similar calculation here as we are for the minimum
// day timestamp. See the explanation above.
$values = [];
$timestamp = $max[0];
$errorstring = $max[1];
$maxdate = (new \... | [
"protected",
"function",
"get_timestamp_max_limit",
"(",
"\\",
"DateTimeInterface",
"$",
"starttime",
",",
"$",
"max",
")",
"{",
"// We're doing a similar calculation here as we are for the minimum",
"// day timestamp. See the explanation above.",
"$",
"values",
"=",
"[",
"]",
... | Get the correct maximum midnight day limit based on the event start time
and the maximum timestamp limit of what the event belongs to.
@param DateTimeInterface $starttime The event start time
@param array $max The module's maximum limit for the event
@return array Returns an array with maxdaytimestamp and maxdayerror ... | [
"Get",
"the",
"correct",
"maximum",
"midnight",
"day",
"limit",
"based",
"on",
"the",
"event",
"start",
"time",
"and",
"the",
"maximum",
"timestamp",
"limit",
"of",
"what",
"the",
"event",
"belongs",
"to",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/calendar_event_exporter.php#L341-L366 |
217,169 | moodle/moodle | calendar/classes/external/calendar_event_exporter.php | calendar_event_exporter.get_module_timestamp_min_limit | protected function get_module_timestamp_min_limit(\DateTimeInterface $starttime, $min) {
debugging('get_module_timestamp_min_limit() has been deprecated. Please call get_timestamp_min_limit() instead.',
DEBUG_DEVELOPER);
return $this->get_timestamp_min_limit($starttime, $min);
} | php | protected function get_module_timestamp_min_limit(\DateTimeInterface $starttime, $min) {
debugging('get_module_timestamp_min_limit() has been deprecated. Please call get_timestamp_min_limit() instead.',
DEBUG_DEVELOPER);
return $this->get_timestamp_min_limit($starttime, $min);
} | [
"protected",
"function",
"get_module_timestamp_min_limit",
"(",
"\\",
"DateTimeInterface",
"$",
"starttime",
",",
"$",
"min",
")",
"{",
"debugging",
"(",
"'get_module_timestamp_min_limit() has been deprecated. Please call get_timestamp_min_limit() instead.'",
",",
"DEBUG_DEVELOPER"... | Get the correct minimum midnight day limit based on the event start time
and the module's minimum timestamp limit.
@deprecated since Moodle 3.6. Please use get_timestamp_min_limit().
@todo final deprecation. To be removed in Moodle 4.0
@param DateTimeInterface $starttime The event start time
@param array $min The modu... | [
"Get",
"the",
"correct",
"minimum",
"midnight",
"day",
"limit",
"based",
"on",
"the",
"event",
"start",
"time",
"and",
"the",
"module",
"s",
"minimum",
"timestamp",
"limit",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/calendar_event_exporter.php#L378-L382 |
217,170 | moodle/moodle | calendar/classes/external/calendar_event_exporter.php | calendar_event_exporter.get_module_timestamp_max_limit | protected function get_module_timestamp_max_limit(\DateTimeInterface $starttime, $max) {
debugging('get_module_timestamp_max_limit() has been deprecated. Please call get_timestamp_max_limit() instead.',
DEBUG_DEVELOPER);
return $this->get_timestamp_max_limit($starttime, $max);
} | php | protected function get_module_timestamp_max_limit(\DateTimeInterface $starttime, $max) {
debugging('get_module_timestamp_max_limit() has been deprecated. Please call get_timestamp_max_limit() instead.',
DEBUG_DEVELOPER);
return $this->get_timestamp_max_limit($starttime, $max);
} | [
"protected",
"function",
"get_module_timestamp_max_limit",
"(",
"\\",
"DateTimeInterface",
"$",
"starttime",
",",
"$",
"max",
")",
"{",
"debugging",
"(",
"'get_module_timestamp_max_limit() has been deprecated. Please call get_timestamp_max_limit() instead.'",
",",
"DEBUG_DEVELOPER"... | Get the correct maximum midnight day limit based on the event start time
and the module's maximum timestamp limit.
@deprecated since Moodle 3.6. Please use get_timestamp_max_limit().
@todo final deprecation. To be removed in Moodle 4.0
@param DateTimeInterface $starttime The event start time
@param array $max The modu... | [
"Get",
"the",
"correct",
"maximum",
"midnight",
"day",
"limit",
"based",
"on",
"the",
"event",
"start",
"time",
"and",
"the",
"module",
"s",
"maximum",
"timestamp",
"limit",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/calendar_event_exporter.php#L394-L398 |
217,171 | moodle/moodle | backup/converter/convertlib.php | base_converter.convert | public function convert() {
try {
$this->log('creating the target directory', backup::LOG_DEBUG);
$this->create_workdir();
$this->log('executing the conversion', backup::LOG_DEBUG);
$this->execute();
$this->log('replacing the source directory with t... | php | public function convert() {
try {
$this->log('creating the target directory', backup::LOG_DEBUG);
$this->create_workdir();
$this->log('executing the conversion', backup::LOG_DEBUG);
$this->execute();
$this->log('replacing the source directory with t... | [
"public",
"function",
"convert",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"log",
"(",
"'creating the target directory'",
",",
"backup",
"::",
"LOG_DEBUG",
")",
";",
"$",
"this",
"->",
"create_workdir",
"(",
")",
";",
"$",
"this",
"->",
"log",
"(",
... | Converts the backup directory | [
"Converts",
"the",
"backup",
"directory"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/convertlib.php#L122-L143 |
217,172 | moodle/moodle | backup/converter/convertlib.php | base_converter.replace_tempdir | protected function replace_tempdir() {
global $CFG;
$tempdir = $this->get_tempdir_path();
if (empty($CFG->keeptempdirectoriesonbackup)) {
fulldelete($tempdir);
} else {
if (!rename($tempdir, $tempdir . '_' . $this->get_name() . '_' . $this->id . '_source')) {
... | php | protected function replace_tempdir() {
global $CFG;
$tempdir = $this->get_tempdir_path();
if (empty($CFG->keeptempdirectoriesonbackup)) {
fulldelete($tempdir);
} else {
if (!rename($tempdir, $tempdir . '_' . $this->get_name() . '_' . $this->id . '_source')) {
... | [
"protected",
"function",
"replace_tempdir",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"tempdir",
"=",
"$",
"this",
"->",
"get_tempdir_path",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"keeptempdirectoriesonbackup",
")",
")",
"{",
"ful... | Replaces the source backup directory with the converted version
If $CFG->keeptempdirectoriesonbackup is defined, the original source
source backup directory is kept for debugging purposes. | [
"Replaces",
"the",
"source",
"backup",
"directory",
"with",
"the",
"converted",
"version"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/convertlib.php#L239-L255 |
217,173 | moodle/moodle | mod/quiz/classes/structure.php | structure.create_for_quiz | public static function create_for_quiz($quizobj) {
$structure = self::create();
$structure->quizobj = $quizobj;
$structure->populate_structure($quizobj->get_quiz());
return $structure;
} | php | public static function create_for_quiz($quizobj) {
$structure = self::create();
$structure->quizobj = $quizobj;
$structure->populate_structure($quizobj->get_quiz());
return $structure;
} | [
"public",
"static",
"function",
"create_for_quiz",
"(",
"$",
"quizobj",
")",
"{",
"$",
"structure",
"=",
"self",
"::",
"create",
"(",
")",
";",
"$",
"structure",
"->",
"quizobj",
"=",
"$",
"quizobj",
";",
"$",
"structure",
"->",
"populate_structure",
"(",
... | Create an instance of this class representing the structure of a given quiz.
@param \quiz $quizobj the quiz.
@return structure | [
"Create",
"an",
"instance",
"of",
"this",
"class",
"representing",
"the",
"structure",
"of",
"a",
"given",
"quiz",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L86-L91 |
217,174 | moodle/moodle | mod/quiz/classes/structure.php | structure.can_finish_during_the_attempt | public function can_finish_during_the_attempt($slotnumber) {
if ($this->quizobj->get_navigation_method() == QUIZ_NAVMETHOD_SEQ) {
return false;
}
if ($this->slotsinorder[$slotnumber]->section->shufflequestions) {
return false;
}
if (in_array($this->get_q... | php | public function can_finish_during_the_attempt($slotnumber) {
if ($this->quizobj->get_navigation_method() == QUIZ_NAVMETHOD_SEQ) {
return false;
}
if ($this->slotsinorder[$slotnumber]->section->shufflequestions) {
return false;
}
if (in_array($this->get_q... | [
"public",
"function",
"can_finish_during_the_attempt",
"(",
"$",
"slotnumber",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"quizobj",
"->",
"get_navigation_method",
"(",
")",
"==",
"QUIZ_NAVMETHOD_SEQ",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"thi... | Whether it is possible for another question to depend on this one finishing.
Note that the answer is not exact, because of random questions, and sometimes
questions cannot be depended upon because of quiz options.
@param int $slotnumber the index of the slot in question.
@return bool can this question finish naturally ... | [
"Whether",
"it",
"is",
"possible",
"for",
"another",
"question",
"to",
"depend",
"on",
"this",
"one",
"finishing",
".",
"Note",
"that",
"the",
"answer",
"is",
"not",
"exact",
"because",
"of",
"random",
"questions",
"and",
"sometimes",
"questions",
"cannot",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L183-L214 |
217,175 | moodle/moodle | mod/quiz/classes/structure.php | structure.can_be_edited | public function can_be_edited() {
if ($this->canbeedited === null) {
$this->canbeedited = !quiz_has_attempts($this->quizobj->get_quizid());
}
return $this->canbeedited;
} | php | public function can_be_edited() {
if ($this->canbeedited === null) {
$this->canbeedited = !quiz_has_attempts($this->quizobj->get_quizid());
}
return $this->canbeedited;
} | [
"public",
"function",
"can_be_edited",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"canbeedited",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"canbeedited",
"=",
"!",
"quiz_has_attempts",
"(",
"$",
"this",
"->",
"quizobj",
"->",
"get_quizid",
"(",
")",
... | Quizzes can only be edited if they have not been attempted.
@return bool whether the quiz can be edited. | [
"Quizzes",
"can",
"only",
"be",
"edited",
"if",
"they",
"have",
"not",
"been",
"attempted",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L281-L286 |
217,176 | moodle/moodle | mod/quiz/classes/structure.php | structure.check_can_be_edited | public function check_can_be_edited() {
if (!$this->can_be_edited()) {
$reportlink = quiz_attempt_summary_link_to_reports($this->get_quiz(),
$this->quizobj->get_cm(), $this->quizobj->get_context());
throw new \moodle_exception('cannoteditafterattempts', 'quiz',
... | php | public function check_can_be_edited() {
if (!$this->can_be_edited()) {
$reportlink = quiz_attempt_summary_link_to_reports($this->get_quiz(),
$this->quizobj->get_cm(), $this->quizobj->get_context());
throw new \moodle_exception('cannoteditafterattempts', 'quiz',
... | [
"public",
"function",
"check_can_be_edited",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"can_be_edited",
"(",
")",
")",
"{",
"$",
"reportlink",
"=",
"quiz_attempt_summary_link_to_reports",
"(",
"$",
"this",
"->",
"get_quiz",
"(",
")",
",",
"$",
"thi... | This quiz can only be edited if they have not been attempted.
Throw an exception if this is not the case. | [
"This",
"quiz",
"can",
"only",
"be",
"edited",
"if",
"they",
"have",
"not",
"been",
"attempted",
".",
"Throw",
"an",
"exception",
"if",
"this",
"is",
"not",
"the",
"case",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L292-L299 |
217,177 | moodle/moodle | mod/quiz/classes/structure.php | structure.is_first_slot_on_page | public function is_first_slot_on_page($slotnumber) {
if ($slotnumber == 1) {
return true;
}
return $this->slotsinorder[$slotnumber]->page != $this->slotsinorder[$slotnumber - 1]->page;
} | php | public function is_first_slot_on_page($slotnumber) {
if ($slotnumber == 1) {
return true;
}
return $this->slotsinorder[$slotnumber]->page != $this->slotsinorder[$slotnumber - 1]->page;
} | [
"public",
"function",
"is_first_slot_on_page",
"(",
"$",
"slotnumber",
")",
"{",
"if",
"(",
"$",
"slotnumber",
"==",
"1",
")",
"{",
"return",
"true",
";",
"}",
"return",
"$",
"this",
"->",
"slotsinorder",
"[",
"$",
"slotnumber",
"]",
"->",
"page",
"!=",
... | Is this slot the first one on its page?
@param int $slotnumber the index of the slot in question.
@return bool whether this slot the first one on its page. | [
"Is",
"this",
"slot",
"the",
"first",
"one",
"on",
"its",
"page?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L325-L330 |
217,178 | moodle/moodle | mod/quiz/classes/structure.php | structure.is_last_slot_on_page | public function is_last_slot_on_page($slotnumber) {
if (!isset($this->slotsinorder[$slotnumber + 1])) {
return true;
}
return $this->slotsinorder[$slotnumber]->page != $this->slotsinorder[$slotnumber + 1]->page;
} | php | public function is_last_slot_on_page($slotnumber) {
if (!isset($this->slotsinorder[$slotnumber + 1])) {
return true;
}
return $this->slotsinorder[$slotnumber]->page != $this->slotsinorder[$slotnumber + 1]->page;
} | [
"public",
"function",
"is_last_slot_on_page",
"(",
"$",
"slotnumber",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"slotsinorder",
"[",
"$",
"slotnumber",
"+",
"1",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"$",
"this",
... | Is this slot the last one on its page?
@param int $slotnumber the index of the slot in question.
@return bool whether this slot the last one on its page. | [
"Is",
"this",
"slot",
"the",
"last",
"one",
"on",
"its",
"page?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L337-L342 |
217,179 | moodle/moodle | mod/quiz/classes/structure.php | structure.is_only_slot_in_section | public function is_only_slot_in_section($slotnumber) {
return $this->slotsinorder[$slotnumber]->section->firstslot ==
$this->slotsinorder[$slotnumber]->section->lastslot;
} | php | public function is_only_slot_in_section($slotnumber) {
return $this->slotsinorder[$slotnumber]->section->firstslot ==
$this->slotsinorder[$slotnumber]->section->lastslot;
} | [
"public",
"function",
"is_only_slot_in_section",
"(",
"$",
"slotnumber",
")",
"{",
"return",
"$",
"this",
"->",
"slotsinorder",
"[",
"$",
"slotnumber",
"]",
"->",
"section",
"->",
"firstslot",
"==",
"$",
"this",
"->",
"slotsinorder",
"[",
"$",
"slotnumber",
... | Is this slot the only one in its section?
@param int $slotnumber the index of the slot in question.
@return bool whether this slot the only one on its section. | [
"Is",
"this",
"slot",
"the",
"only",
"one",
"in",
"its",
"section?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L358-L361 |
217,180 | moodle/moodle | mod/quiz/classes/structure.php | structure.get_slot_by_id | public function get_slot_by_id($slotid) {
if (!array_key_exists($slotid, $this->slots)) {
throw new \coding_exception('The \'slotid\' could not be found.');
}
return $this->slots[$slotid];
} | php | public function get_slot_by_id($slotid) {
if (!array_key_exists($slotid, $this->slots)) {
throw new \coding_exception('The \'slotid\' could not be found.');
}
return $this->slots[$slotid];
} | [
"public",
"function",
"get_slot_by_id",
"(",
"$",
"slotid",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"slotid",
",",
"$",
"this",
"->",
"slots",
")",
")",
"{",
"throw",
"new",
"\\",
"coding_exception",
"(",
"'The \\'slotid\\' could not be found.'... | Get a slot by it's id. Throws an exception if it is missing.
@param int $slotid the slot id.
@return \stdClass the requested quiz_slots row. | [
"Get",
"a",
"slot",
"by",
"it",
"s",
"id",
".",
"Throws",
"an",
"exception",
"if",
"it",
"is",
"missing",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L413-L418 |
217,181 | moodle/moodle | mod/quiz/classes/structure.php | structure.get_slot_by_number | public function get_slot_by_number($slotnumber) {
foreach ($this->slots as $slot) {
if ($slot->slot == $slotnumber) {
return $slot;
}
}
throw new \coding_exception('The \'slotnumber\' could not be found.');
} | php | public function get_slot_by_number($slotnumber) {
foreach ($this->slots as $slot) {
if ($slot->slot == $slotnumber) {
return $slot;
}
}
throw new \coding_exception('The \'slotnumber\' could not be found.');
} | [
"public",
"function",
"get_slot_by_number",
"(",
"$",
"slotnumber",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"slots",
"as",
"$",
"slot",
")",
"{",
"if",
"(",
"$",
"slot",
"->",
"slot",
"==",
"$",
"slotnumber",
")",
"{",
"return",
"$",
"slot",
";"... | Get a slot by it's slot number. Throws an exception if it is missing.
@param int $slotnumber The slot number
@return \stdClass
@throws \coding_exception | [
"Get",
"a",
"slot",
"by",
"it",
"s",
"slot",
"number",
".",
"Throws",
"an",
"exception",
"if",
"it",
"is",
"missing",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L427-L435 |
217,182 | moodle/moodle | mod/quiz/classes/structure.php | structure.can_add_section_heading | public function can_add_section_heading($pagenumber) {
// There is a default section heading on this page,
// do not show adding new section heading in the Add menu.
if ($pagenumber == 1) {
return false;
}
// Get an array of firstslots.
$firstslots = array();
... | php | public function can_add_section_heading($pagenumber) {
// There is a default section heading on this page,
// do not show adding new section heading in the Add menu.
if ($pagenumber == 1) {
return false;
}
// Get an array of firstslots.
$firstslots = array();
... | [
"public",
"function",
"can_add_section_heading",
"(",
"$",
"pagenumber",
")",
"{",
"// There is a default section heading on this page,",
"// do not show adding new section heading in the Add menu.",
"if",
"(",
"$",
"pagenumber",
"==",
"1",
")",
"{",
"return",
"false",
";",
... | Check whether adding a section heading is possible
@param int $pagenumber the number of the page.
@return boolean | [
"Check",
"whether",
"adding",
"a",
"section",
"heading",
"is",
"possible"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L442-L465 |
217,183 | moodle/moodle | mod/quiz/classes/structure.php | structure.get_slots_in_section | public function get_slots_in_section($sectionid) {
$slots = array();
foreach ($this->slotsinorder as $slot) {
if ($slot->section->id == $sectionid) {
$slots[] = $slot->slot;
}
}
return $slots;
} | php | public function get_slots_in_section($sectionid) {
$slots = array();
foreach ($this->slotsinorder as $slot) {
if ($slot->section->id == $sectionid) {
$slots[] = $slot->slot;
}
}
return $slots;
} | [
"public",
"function",
"get_slots_in_section",
"(",
"$",
"sectionid",
")",
"{",
"$",
"slots",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"slotsinorder",
"as",
"$",
"slot",
")",
"{",
"if",
"(",
"$",
"slot",
"->",
"section",
"->",
"... | Get all the slots in a section of the quiz.
@param int $sectionid the section id.
@return int[] slot numbers. | [
"Get",
"all",
"the",
"slots",
"in",
"a",
"section",
"of",
"the",
"quiz",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L472-L480 |
217,184 | moodle/moodle | mod/quiz/classes/structure.php | structure.get_edit_page_warnings | public function get_edit_page_warnings() {
$warnings = array();
if (quiz_has_attempts($this->quizobj->get_quizid())) {
$reviewlink = quiz_attempt_summary_link_to_reports($this->quizobj->get_quiz(),
$this->quizobj->get_cm(), $this->quizobj->get_context());
$wa... | php | public function get_edit_page_warnings() {
$warnings = array();
if (quiz_has_attempts($this->quizobj->get_quizid())) {
$reviewlink = quiz_attempt_summary_link_to_reports($this->quizobj->get_quiz(),
$this->quizobj->get_cm(), $this->quizobj->get_context());
$wa... | [
"public",
"function",
"get_edit_page_warnings",
"(",
")",
"{",
"$",
"warnings",
"=",
"array",
"(",
")",
";",
"if",
"(",
"quiz_has_attempts",
"(",
"$",
"this",
"->",
"quizobj",
"->",
"get_quizid",
"(",
")",
")",
")",
"{",
"$",
"reviewlink",
"=",
"quiz_att... | Get any warnings to show at the top of the edit page.
@return string[] array of strings. | [
"Get",
"any",
"warnings",
"to",
"show",
"at",
"the",
"top",
"of",
"the",
"edit",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L543-L553 |
217,185 | moodle/moodle | mod/quiz/classes/structure.php | structure.get_dates_summary | public function get_dates_summary() {
$timenow = time();
$quiz = $this->quizobj->get_quiz();
// Exact open and close dates for the tool-tip.
$dates = array();
if ($quiz->timeopen > 0) {
if ($timenow > $quiz->timeopen) {
$dates[] = get_string('quizopen... | php | public function get_dates_summary() {
$timenow = time();
$quiz = $this->quizobj->get_quiz();
// Exact open and close dates for the tool-tip.
$dates = array();
if ($quiz->timeopen > 0) {
if ($timenow > $quiz->timeopen) {
$dates[] = get_string('quizopen... | [
"public",
"function",
"get_dates_summary",
"(",
")",
"{",
"$",
"timenow",
"=",
"time",
"(",
")",
";",
"$",
"quiz",
"=",
"$",
"this",
"->",
"quizobj",
"->",
"get_quiz",
"(",
")",
";",
"// Exact open and close dates for the tool-tip.",
"$",
"dates",
"=",
"arra... | Get the date information about the current state of the quiz.
@return string[] array of two strings. First a short summary, then a longer
explanation of the current state, e.g. for a tool-tip. | [
"Get",
"the",
"date",
"information",
"about",
"the",
"current",
"state",
"of",
"the",
"quiz",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L560-L599 |
217,186 | moodle/moodle | mod/quiz/classes/structure.php | structure.populate_structure | public function populate_structure($quiz) {
global $DB;
$slots = $DB->get_records_sql("
SELECT slot.id AS slotid, slot.slot, slot.questionid, slot.page, slot.maxmark,
slot.requireprevious, q.*, qc.contextid
FROM {quiz_slots} slot
... | php | public function populate_structure($quiz) {
global $DB;
$slots = $DB->get_records_sql("
SELECT slot.id AS slotid, slot.slot, slot.questionid, slot.page, slot.maxmark,
slot.requireprevious, q.*, qc.contextid
FROM {quiz_slots} slot
... | [
"public",
"function",
"populate_structure",
"(",
"$",
"quiz",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"slots",
"=",
"$",
"DB",
"->",
"get_records_sql",
"(",
"\"\n SELECT slot.id AS slotid, slot.slot, slot.questionid, slot.page, slot.maxmark,\n ... | Set up this class with the structure for a given quiz.
@param \stdClass $quiz the quiz settings. | [
"Set",
"up",
"this",
"class",
"with",
"the",
"structure",
"for",
"a",
"given",
"quiz",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L605-L642 |
217,187 | moodle/moodle | mod/quiz/classes/structure.php | structure.populate_missing_questions | protected function populate_missing_questions($slots) {
// Address missing question types.
foreach ($slots as $slot) {
if ($slot->qtype === null) {
// If the questiontype is missing change the question type.
$slot->id = $slot->questionid;
$slot... | php | protected function populate_missing_questions($slots) {
// Address missing question types.
foreach ($slots as $slot) {
if ($slot->qtype === null) {
// If the questiontype is missing change the question type.
$slot->id = $slot->questionid;
$slot... | [
"protected",
"function",
"populate_missing_questions",
"(",
"$",
"slots",
")",
"{",
"// Address missing question types.",
"foreach",
"(",
"$",
"slots",
"as",
"$",
"slot",
")",
"{",
"if",
"(",
"$",
"slot",
"->",
"qtype",
"===",
"null",
")",
"{",
"// If the ques... | Used by populate. Make up fake data for any missing questions.
@param \stdClass[] $slots the data about the slots and questions in the quiz.
@return \stdClass[] updated $slots array. | [
"Used",
"by",
"populate",
".",
"Make",
"up",
"fake",
"data",
"for",
"any",
"missing",
"questions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L649-L671 |
217,188 | moodle/moodle | mod/quiz/classes/structure.php | structure.populate_slots_with_sections | public function populate_slots_with_sections() {
$sections = array_values($this->sections);
foreach ($sections as $i => $section) {
if (isset($sections[$i + 1])) {
$section->lastslot = $sections[$i + 1]->firstslot - 1;
} else {
$section->lastslot =... | php | public function populate_slots_with_sections() {
$sections = array_values($this->sections);
foreach ($sections as $i => $section) {
if (isset($sections[$i + 1])) {
$section->lastslot = $sections[$i + 1]->firstslot - 1;
} else {
$section->lastslot =... | [
"public",
"function",
"populate_slots_with_sections",
"(",
")",
"{",
"$",
"sections",
"=",
"array_values",
"(",
"$",
"this",
"->",
"sections",
")",
";",
"foreach",
"(",
"$",
"sections",
"as",
"$",
"i",
"=>",
"$",
"section",
")",
"{",
"if",
"(",
"isset",
... | Fill in the section ids for each slot. | [
"Fill",
"in",
"the",
"section",
"ids",
"for",
"each",
"slot",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L676-L688 |
217,189 | moodle/moodle | mod/quiz/classes/structure.php | structure.populate_question_numbers | protected function populate_question_numbers() {
$number = 1;
foreach ($this->slots as $slot) {
if ($this->questions[$slot->questionid]->length == 0) {
$slot->displayednumber = get_string('infoshort', 'quiz');
} else {
$slot->displayednumber = $num... | php | protected function populate_question_numbers() {
$number = 1;
foreach ($this->slots as $slot) {
if ($this->questions[$slot->questionid]->length == 0) {
$slot->displayednumber = get_string('infoshort', 'quiz');
} else {
$slot->displayednumber = $num... | [
"protected",
"function",
"populate_question_numbers",
"(",
")",
"{",
"$",
"number",
"=",
"1",
";",
"foreach",
"(",
"$",
"this",
"->",
"slots",
"as",
"$",
"slot",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"questions",
"[",
"$",
"slot",
"->",
"questionid",... | Number the questions. | [
"Number",
"the",
"questions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L693-L703 |
217,190 | moodle/moodle | mod/quiz/classes/structure.php | structure.refresh_page_numbers | public function refresh_page_numbers($slots = array()) {
global $DB;
// Get slots ordered by page then slot.
if (!count($slots)) {
$slots = $DB->get_records('quiz_slots', array('quizid' => $this->get_quizid()), 'slot, page');
}
// Loop slots. Start Page number at 1 a... | php | public function refresh_page_numbers($slots = array()) {
global $DB;
// Get slots ordered by page then slot.
if (!count($slots)) {
$slots = $DB->get_records('quiz_slots', array('quizid' => $this->get_quizid()), 'slot, page');
}
// Loop slots. Start Page number at 1 a... | [
"public",
"function",
"refresh_page_numbers",
"(",
"$",
"slots",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"DB",
";",
"// Get slots ordered by page then slot.",
"if",
"(",
"!",
"count",
"(",
"$",
"slots",
")",
")",
"{",
"$",
"slots",
"=",
"$",
"DB... | Refresh page numbering of quiz slots.
@param \stdClass[] $slots (optional) array of slot objects.
@return \stdClass[] array of slot objects. | [
"Refresh",
"page",
"numbering",
"of",
"quiz",
"slots",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L860-L883 |
217,191 | moodle/moodle | mod/quiz/classes/structure.php | structure.refresh_page_numbers_and_update_db | public function refresh_page_numbers_and_update_db() {
global $DB;
$this->check_can_be_edited();
$slots = $this->refresh_page_numbers();
// Record new page order.
foreach ($slots as $slot) {
$DB->set_field('quiz_slots', 'page', $slot->page,
array... | php | public function refresh_page_numbers_and_update_db() {
global $DB;
$this->check_can_be_edited();
$slots = $this->refresh_page_numbers();
// Record new page order.
foreach ($slots as $slot) {
$DB->set_field('quiz_slots', 'page', $slot->page,
array... | [
"public",
"function",
"refresh_page_numbers_and_update_db",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"check_can_be_edited",
"(",
")",
";",
"$",
"slots",
"=",
"$",
"this",
"->",
"refresh_page_numbers",
"(",
")",
";",
"// Record new page order."... | Refresh page numbering of quiz slots and save to the database.
@param \stdClass $quiz the quiz object.
@return \stdClass[] array of slot objects. | [
"Refresh",
"page",
"numbering",
"of",
"quiz",
"slots",
"and",
"save",
"to",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L890-L903 |
217,192 | moodle/moodle | mod/quiz/classes/structure.php | structure.remove_slot | public function remove_slot($slotnumber) {
global $DB;
$this->check_can_be_edited();
if ($this->is_only_slot_in_section($slotnumber) && $this->get_section_count() > 1) {
throw new \coding_exception('You cannot remove the last slot in a section.');
}
$slot = $DB->ge... | php | public function remove_slot($slotnumber) {
global $DB;
$this->check_can_be_edited();
if ($this->is_only_slot_in_section($slotnumber) && $this->get_section_count() > 1) {
throw new \coding_exception('You cannot remove the last slot in a section.');
}
$slot = $DB->ge... | [
"public",
"function",
"remove_slot",
"(",
"$",
"slotnumber",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"check_can_be_edited",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"is_only_slot_in_section",
"(",
"$",
"slotnumber",
")",
"&&",
"$",
"th... | Remove a slot from a quiz
@param int $slotnumber The number of the slot to be deleted. | [
"Remove",
"a",
"slot",
"from",
"a",
"quiz"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L909-L944 |
217,193 | moodle/moodle | mod/quiz/classes/structure.php | structure.update_slot_maxmark | public function update_slot_maxmark($slot, $maxmark) {
global $DB;
if (abs($maxmark - $slot->maxmark) < 1e-7) {
// Grade has not changed. Nothing to do.
return false;
}
$trans = $DB->start_delegated_transaction();
$slot->maxmark = $maxmark;
$DB->... | php | public function update_slot_maxmark($slot, $maxmark) {
global $DB;
if (abs($maxmark - $slot->maxmark) < 1e-7) {
// Grade has not changed. Nothing to do.
return false;
}
$trans = $DB->start_delegated_transaction();
$slot->maxmark = $maxmark;
$DB->... | [
"public",
"function",
"update_slot_maxmark",
"(",
"$",
"slot",
",",
"$",
"maxmark",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"abs",
"(",
"$",
"maxmark",
"-",
"$",
"slot",
"->",
"maxmark",
")",
"<",
"1e-7",
")",
"{",
"// Grade has not changed. Nothi... | Change the max mark for a slot.
Saves changes to the question grades in the quiz_slots table and any
corresponding question_attempts.
It does not update 'sumgrades' in the quiz table.
@param \stdClass $slot row from the quiz_slots table.
@param float $maxmark the new maxmark.
@return bool true if the new grade is dif... | [
"Change",
"the",
"max",
"mark",
"for",
"a",
"slot",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L957-L973 |
217,194 | moodle/moodle | mod/quiz/classes/structure.php | structure.add_section_heading | public function add_section_heading($pagenumber, $heading = null) {
global $DB;
$section = new \stdClass();
if ($heading !== null) {
$section->heading = $heading;
} else {
$section->heading = get_string('newsectionheading', 'quiz');
}
$section->qui... | php | public function add_section_heading($pagenumber, $heading = null) {
global $DB;
$section = new \stdClass();
if ($heading !== null) {
$section->heading = $heading;
} else {
$section->heading = get_string('newsectionheading', 'quiz');
}
$section->qui... | [
"public",
"function",
"add_section_heading",
"(",
"$",
"pagenumber",
",",
"$",
"heading",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"section",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"if",
"(",
"$",
"heading",
"!==",
"null",
")",
"{"... | Add a section heading on a given page and return the sectionid
@param int $pagenumber the number of the page where the section heading begins.
@param string|null $heading the heading to add. If not given, a default is used. | [
"Add",
"a",
"section",
"heading",
"on",
"a",
"given",
"page",
"and",
"return",
"the",
"sectionid"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L1013-L1026 |
217,195 | moodle/moodle | mod/quiz/classes/structure.php | structure.set_section_heading | public function set_section_heading($id, $newheading) {
global $DB;
$section = $DB->get_record('quiz_sections', array('id' => $id), '*', MUST_EXIST);
$section->heading = $newheading;
$DB->update_record('quiz_sections', $section);
} | php | public function set_section_heading($id, $newheading) {
global $DB;
$section = $DB->get_record('quiz_sections', array('id' => $id), '*', MUST_EXIST);
$section->heading = $newheading;
$DB->update_record('quiz_sections', $section);
} | [
"public",
"function",
"set_section_heading",
"(",
"$",
"id",
",",
"$",
"newheading",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"section",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'quiz_sections'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"id",
")",
",",
... | Change the heading for a section.
@param int $id the id of the section to change.
@param string $newheading the new heading for this section. | [
"Change",
"the",
"heading",
"for",
"a",
"section",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L1033-L1038 |
217,196 | moodle/moodle | mod/quiz/classes/structure.php | structure.set_section_shuffle | public function set_section_shuffle($id, $shuffle) {
global $DB;
$section = $DB->get_record('quiz_sections', array('id' => $id), '*', MUST_EXIST);
$section->shufflequestions = $shuffle;
$DB->update_record('quiz_sections', $section);
} | php | public function set_section_shuffle($id, $shuffle) {
global $DB;
$section = $DB->get_record('quiz_sections', array('id' => $id), '*', MUST_EXIST);
$section->shufflequestions = $shuffle;
$DB->update_record('quiz_sections', $section);
} | [
"public",
"function",
"set_section_shuffle",
"(",
"$",
"id",
",",
"$",
"shuffle",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"section",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'quiz_sections'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"id",
")",
",",
"'... | Change the shuffle setting for a section.
@param int $id the id of the section to change.
@param bool $shuffle whether this section should be shuffled. | [
"Change",
"the",
"shuffle",
"setting",
"for",
"a",
"section",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L1045-L1050 |
217,197 | moodle/moodle | mod/quiz/classes/structure.php | structure.remove_section_heading | public function remove_section_heading($sectionid) {
global $DB;
$section = $DB->get_record('quiz_sections', array('id' => $sectionid), '*', MUST_EXIST);
if ($section->firstslot == 1) {
throw new \coding_exception('Cannot remove the first section in a quiz.');
}
$DB->... | php | public function remove_section_heading($sectionid) {
global $DB;
$section = $DB->get_record('quiz_sections', array('id' => $sectionid), '*', MUST_EXIST);
if ($section->firstslot == 1) {
throw new \coding_exception('Cannot remove the first section in a quiz.');
}
$DB->... | [
"public",
"function",
"remove_section_heading",
"(",
"$",
"sectionid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"section",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'quiz_sections'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"sectionid",
")",
",",
"'*'",
","... | Remove the section heading with the given id
@param int $sectionid the section to remove. | [
"Remove",
"the",
"section",
"heading",
"with",
"the",
"given",
"id"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L1056-L1063 |
217,198 | moodle/moodle | mod/quiz/classes/structure.php | structure.get_slot_tags_for_slot_id | public function get_slot_tags_for_slot_id($slotid) {
if (!$this->hasloadedtags) {
// Lazy load the tags just in case they are never required.
$this->populate_slot_tags();
$this->hasloadedtags = true;
}
return isset($this->slottags[$slotid]) ? $this->slottags[... | php | public function get_slot_tags_for_slot_id($slotid) {
if (!$this->hasloadedtags) {
// Lazy load the tags just in case they are never required.
$this->populate_slot_tags();
$this->hasloadedtags = true;
}
return isset($this->slottags[$slotid]) ? $this->slottags[... | [
"public",
"function",
"get_slot_tags_for_slot_id",
"(",
"$",
"slotid",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasloadedtags",
")",
"{",
"// Lazy load the tags just in case they are never required.",
"$",
"this",
"->",
"populate_slot_tags",
"(",
")",
";",
"$",... | Retrieve the list of slot tags for the given slot id.
@param int $slotid The id for the slot
@return \stdClass[] The list of slot tag records | [
"Retrieve",
"the",
"list",
"of",
"slot",
"tags",
"for",
"the",
"given",
"slot",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/structure.php#L1079-L1087 |
217,199 | moodle/moodle | media/classes/manager.php | core_media_manager.instance | public static function instance($page = null) {
// Use the passed $page if given, otherwise the $PAGE global.
if (!$page) {
global $PAGE;
$page = $PAGE;
}
if (self::$instance === null || ($page && self::$instance->page !== $page)) {
self::$instance = n... | php | public static function instance($page = null) {
// Use the passed $page if given, otherwise the $PAGE global.
if (!$page) {
global $PAGE;
$page = $PAGE;
}
if (self::$instance === null || ($page && self::$instance->page !== $page)) {
self::$instance = n... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"page",
"=",
"null",
")",
"{",
"// Use the passed $page if given, otherwise the $PAGE global.",
"if",
"(",
"!",
"$",
"page",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"page",
"=",
"$",
"PAGE",
";",
"}",
... | Returns a singleton instance of a manager
Note as of Moodle 3.3, this will call setup for you.
@return core_media_manager | [
"Returns",
"a",
"singleton",
"instance",
"of",
"a",
"manager"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/media/classes/manager.php#L110-L120 |
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.