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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
219,800 | moodle/moodle | lib/outputcomponents.php | html_writer.select_time | public static function select_time($type, $name, $currenttime = 0, $step = 5, array $attributes = null) {
global $OUTPUT;
if (!$currenttime) {
$currenttime = time();
}
$calendartype = \core_calendar\type_factory::get_calendar_instance();
$currentdate = $calendartype-... | php | public static function select_time($type, $name, $currenttime = 0, $step = 5, array $attributes = null) {
global $OUTPUT;
if (!$currenttime) {
$currenttime = time();
}
$calendartype = \core_calendar\type_factory::get_calendar_instance();
$currentdate = $calendartype-... | [
"public",
"static",
"function",
"select_time",
"(",
"$",
"type",
",",
"$",
"name",
",",
"$",
"currenttime",
"=",
"0",
",",
"$",
"step",
"=",
"5",
",",
"array",
"$",
"attributes",
"=",
"null",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"!",
... | This is a shortcut for making an hour selector menu.
@param string $type The type of selector (years, months, days, hours, minutes)
@param string $name fieldname
@param int $currenttime A default timestamp in GMT
@param int $step minute spacing
@param array $attributes - html select element attributes
@return HTML fra... | [
"This",
"is",
"a",
"shortcut",
"for",
"making",
"an",
"hour",
"selector",
"menu",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1946-L2013 |
219,801 | moodle/moodle | lib/outputcomponents.php | html_writer.alist | public static function alist(array $items, array $attributes = null, $tag = 'ul') {
$output = html_writer::start_tag($tag, $attributes)."\n";
foreach ($items as $item) {
$output .= html_writer::tag('li', $item)."\n";
}
$output .= html_writer::end_tag($tag);
return $ou... | php | public static function alist(array $items, array $attributes = null, $tag = 'ul') {
$output = html_writer::start_tag($tag, $attributes)."\n";
foreach ($items as $item) {
$output .= html_writer::tag('li', $item)."\n";
}
$output .= html_writer::end_tag($tag);
return $ou... | [
"public",
"static",
"function",
"alist",
"(",
"array",
"$",
"items",
",",
"array",
"$",
"attributes",
"=",
"null",
",",
"$",
"tag",
"=",
"'ul'",
")",
"{",
"$",
"output",
"=",
"html_writer",
"::",
"start_tag",
"(",
"$",
"tag",
",",
"$",
"attributes",
... | Shortcut for quick making of lists
Note: 'list' is a reserved keyword ;-)
@param array $items
@param array $attributes
@param string $tag ul or ol
@return string | [
"Shortcut",
"for",
"quick",
"making",
"of",
"lists"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L2025-L2032 |
219,802 | moodle/moodle | lib/outputcomponents.php | html_writer.input_hidden_params | public static function input_hidden_params(moodle_url $url, array $exclude = null) {
$exclude = (array)$exclude;
$params = $url->params();
foreach ($exclude as $key) {
unset($params[$key]);
}
$output = '';
foreach ($params as $key => $value) {
$at... | php | public static function input_hidden_params(moodle_url $url, array $exclude = null) {
$exclude = (array)$exclude;
$params = $url->params();
foreach ($exclude as $key) {
unset($params[$key]);
}
$output = '';
foreach ($params as $key => $value) {
$at... | [
"public",
"static",
"function",
"input_hidden_params",
"(",
"moodle_url",
"$",
"url",
",",
"array",
"$",
"exclude",
"=",
"null",
")",
"{",
"$",
"exclude",
"=",
"(",
"array",
")",
"$",
"exclude",
";",
"$",
"params",
"=",
"$",
"url",
"->",
"params",
"(",... | Returns hidden input fields created from url parameters.
@param moodle_url $url
@param array $exclude list of excluded parameters
@return string HTML fragment | [
"Returns",
"hidden",
"input",
"fields",
"created",
"from",
"url",
"parameters",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L2041-L2054 |
219,803 | moodle/moodle | lib/outputcomponents.php | html_writer.script | public static function script($jscode, $url=null) {
if ($jscode) {
$attributes = array('type'=>'text/javascript');
return self::tag('script', "\n//<![CDATA[\n$jscode\n//]]>\n", $attributes) . "\n";
} else if ($url) {
$attributes = array('type'=>'text/javascript', 'sr... | php | public static function script($jscode, $url=null) {
if ($jscode) {
$attributes = array('type'=>'text/javascript');
return self::tag('script', "\n//<![CDATA[\n$jscode\n//]]>\n", $attributes) . "\n";
} else if ($url) {
$attributes = array('type'=>'text/javascript', 'sr... | [
"public",
"static",
"function",
"script",
"(",
"$",
"jscode",
",",
"$",
"url",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"jscode",
")",
"{",
"$",
"attributes",
"=",
"array",
"(",
"'type'",
"=>",
"'text/javascript'",
")",
";",
"return",
"self",
"::",
"ta... | Generate a script tag containing the the specified code.
@param string $jscode the JavaScript code
@param moodle_url|string $url optional url of the external script, $code ignored if specified
@return string HTML, the code wrapped in <script> tags. | [
"Generate",
"a",
"script",
"tag",
"containing",
"the",
"the",
"specified",
"code",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L2063-L2075 |
219,804 | moodle/moodle | lib/outputcomponents.php | html_writer.label | public static function label($text, $for, $colonize = true, array $attributes=array()) {
if (!is_null($for)) {
$attributes = array_merge($attributes, array('for' => $for));
}
$text = trim($text);
$label = self::tag('label', $text, $attributes);
// TODO MDL-12192 $col... | php | public static function label($text, $for, $colonize = true, array $attributes=array()) {
if (!is_null($for)) {
$attributes = array_merge($attributes, array('for' => $for));
}
$text = trim($text);
$label = self::tag('label', $text, $attributes);
// TODO MDL-12192 $col... | [
"public",
"static",
"function",
"label",
"(",
"$",
"text",
",",
"$",
"for",
",",
"$",
"colonize",
"=",
"true",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"for",
")",
")",
"{",
"$",
"a... | Renders form element label
By default, the label is suffixed with a label separator defined in the
current language pack (colon by default in the English lang pack).
Adding the colon can be explicitly disabled if needed. Label separators
are put outside the label tag itself so they are not read by
screenreaders (acces... | [
"Renders",
"form",
"element",
"label"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L2342-L2365 |
219,805 | moodle/moodle | lib/outputcomponents.php | html_writer.add_class | private static function add_class($class = '', array $attributes = null) {
if ($class !== '') {
$classattribute = array('class' => $class);
if ($attributes) {
if (array_key_exists('class', $attributes)) {
$attributes['class'] = trim($attributes['class'... | php | private static function add_class($class = '', array $attributes = null) {
if ($class !== '') {
$classattribute = array('class' => $class);
if ($attributes) {
if (array_key_exists('class', $attributes)) {
$attributes['class'] = trim($attributes['class'... | [
"private",
"static",
"function",
"add_class",
"(",
"$",
"class",
"=",
"''",
",",
"array",
"$",
"attributes",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"class",
"!==",
"''",
")",
"{",
"$",
"classattribute",
"=",
"array",
"(",
"'class'",
"=>",
"$",
"class... | Combines a class parameter with other attributes. Aids in code reduction
because the class parameter is very frequently used.
If the class attribute is specified both in the attributes and in the
class parameter, the two values are combined with a space between.
@param string $class Optional CSS class (or classes as ... | [
"Combines",
"a",
"class",
"parameter",
"with",
"other",
"attributes",
".",
"Aids",
"in",
"code",
"reduction",
"because",
"the",
"class",
"parameter",
"is",
"very",
"frequently",
"used",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L2378-L2392 |
219,806 | moodle/moodle | lib/outputcomponents.php | js_writer.function_call | public static function function_call($function, array $arguments = null, $delay=0) {
if ($arguments) {
$arguments = array_map('json_encode', convert_to_array($arguments));
$arguments = implode(', ', $arguments);
} else {
$arguments = '';
}
$js = "$func... | php | public static function function_call($function, array $arguments = null, $delay=0) {
if ($arguments) {
$arguments = array_map('json_encode', convert_to_array($arguments));
$arguments = implode(', ', $arguments);
} else {
$arguments = '';
}
$js = "$func... | [
"public",
"static",
"function",
"function_call",
"(",
"$",
"function",
",",
"array",
"$",
"arguments",
"=",
"null",
",",
"$",
"delay",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"arguments",
")",
"{",
"$",
"arguments",
"=",
"array_map",
"(",
"'json_encode'",
... | Returns javascript code calling the function
@param string $function function name, can be complex like Y.Event.purgeElement
@param array $arguments parameters
@param int $delay execution delay in seconds
@return string JS code fragment | [
"Returns",
"javascript",
"code",
"calling",
"the",
"function"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L2478-L2492 |
219,807 | moodle/moodle | lib/outputcomponents.php | js_writer.function_call_with_Y | public static function function_call_with_Y($function, array $extraarguments = null) {
if ($extraarguments) {
$extraarguments = array_map('json_encode', convert_to_array($extraarguments));
$arguments = 'Y, ' . implode(', ', $extraarguments);
} else {
$arguments = 'Y';... | php | public static function function_call_with_Y($function, array $extraarguments = null) {
if ($extraarguments) {
$extraarguments = array_map('json_encode', convert_to_array($extraarguments));
$arguments = 'Y, ' . implode(', ', $extraarguments);
} else {
$arguments = 'Y';... | [
"public",
"static",
"function",
"function_call_with_Y",
"(",
"$",
"function",
",",
"array",
"$",
"extraarguments",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"extraarguments",
")",
"{",
"$",
"extraarguments",
"=",
"array_map",
"(",
"'json_encode'",
",",
"convert_t... | Special function which adds Y as first argument of function call.
@param string $function The function to call
@param array $extraarguments Any arguments to pass to it
@return string Some JS code | [
"Special",
"function",
"which",
"adds",
"Y",
"as",
"first",
"argument",
"of",
"function",
"call",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L2501-L2509 |
219,808 | moodle/moodle | lib/outputcomponents.php | js_writer.object_init | public static function object_init($var, $class, array $arguments = null, array $requirements = null, $delay=0) {
if (is_array($arguments)) {
$arguments = array_map('json_encode', convert_to_array($arguments));
$arguments = implode(', ', $arguments);
}
if ($var === null)... | php | public static function object_init($var, $class, array $arguments = null, array $requirements = null, $delay=0) {
if (is_array($arguments)) {
$arguments = array_map('json_encode', convert_to_array($arguments));
$arguments = implode(', ', $arguments);
}
if ($var === null)... | [
"public",
"static",
"function",
"object_init",
"(",
"$",
"var",
",",
"$",
"class",
",",
"array",
"$",
"arguments",
"=",
"null",
",",
"array",
"$",
"requirements",
"=",
"null",
",",
"$",
"delay",
"=",
"0",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
... | Returns JavaScript code to initialise a new object
@param string $var If it is null then no var is assigned the new object.
@param string $class The class to initialise an object for.
@param array $arguments An array of args to pass to the init method.
@param array $requirements Any modules required for this class.
@p... | [
"Returns",
"JavaScript",
"code",
"to",
"initialise",
"a",
"new",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L2521-L2545 |
219,809 | moodle/moodle | lib/outputcomponents.php | js_writer.set_variable | public static function set_variable($name, $value, $usevar = true) {
$output = '';
if ($usevar) {
if (strpos($name, '.')) {
$output .= '';
} else {
$output .= 'var ';
}
}
$output .= "$name = ".json_encode($value).";";
... | php | public static function set_variable($name, $value, $usevar = true) {
$output = '';
if ($usevar) {
if (strpos($name, '.')) {
$output .= '';
} else {
$output .= 'var ';
}
}
$output .= "$name = ".json_encode($value).";";
... | [
"public",
"static",
"function",
"set_variable",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"usevar",
"=",
"true",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"$",
"usevar",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"name",
",",
"'.'",
... | Returns code setting value to variable
@param string $name
@param mixed $value json serialised value
@param bool $usevar add var definition, ignored for nested properties
@return string JS code fragment | [
"Returns",
"code",
"setting",
"value",
"to",
"variable"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L2555-L2569 |
219,810 | moodle/moodle | lib/outputcomponents.php | js_writer.event_handler | public static function event_handler($selector, $event, $function, array $arguments = null) {
$selector = json_encode($selector);
$output = "Y.on('$event', $function, $selector, null";
if (!empty($arguments)) {
$output .= ', ' . json_encode($arguments);
}
return $outp... | php | public static function event_handler($selector, $event, $function, array $arguments = null) {
$selector = json_encode($selector);
$output = "Y.on('$event', $function, $selector, null";
if (!empty($arguments)) {
$output .= ', ' . json_encode($arguments);
}
return $outp... | [
"public",
"static",
"function",
"event_handler",
"(",
"$",
"selector",
",",
"$",
"event",
",",
"$",
"function",
",",
"array",
"$",
"arguments",
"=",
"null",
")",
"{",
"$",
"selector",
"=",
"json_encode",
"(",
"$",
"selector",
")",
";",
"$",
"output",
"... | Writes event handler attaching code
@param array|string $selector standard YUI selector for elements, may be
array or string, element id is in the form "#idvalue"
@param string $event A valid DOM event (click, mousedown, change etc.)
@param string $function The name of the function to call
@param array $arguments An o... | [
"Writes",
"event",
"handler",
"attaching",
"code"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L2581-L2588 |
219,811 | moodle/moodle | lib/outputcomponents.php | custom_menu_item.add | public function add($text, moodle_url $url = null, $title = null, $sort = null) {
$key = count($this->children);
if (empty($sort)) {
$sort = $this->lastsort + 1;
}
$this->children[$key] = new custom_menu_item($text, $url, $title, $sort, $this);
$this->lastsort = (int)... | php | public function add($text, moodle_url $url = null, $title = null, $sort = null) {
$key = count($this->children);
if (empty($sort)) {
$sort = $this->lastsort + 1;
}
$this->children[$key] = new custom_menu_item($text, $url, $title, $sort, $this);
$this->lastsort = (int)... | [
"public",
"function",
"add",
"(",
"$",
"text",
",",
"moodle_url",
"$",
"url",
"=",
"null",
",",
"$",
"title",
"=",
"null",
",",
"$",
"sort",
"=",
"null",
")",
"{",
"$",
"key",
"=",
"count",
"(",
"$",
"this",
"->",
"children",
")",
";",
"if",
"(... | Adds a custom menu item as a child of this node given its properties.
@param string $text
@param moodle_url $url
@param string $title
@param int $sort
@return custom_menu_item | [
"Adds",
"a",
"custom",
"menu",
"item",
"as",
"a",
"child",
"of",
"this",
"node",
"given",
"its",
"properties",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L3485-L3493 |
219,812 | moodle/moodle | lib/outputcomponents.php | custom_menu_item.remove_child | public function remove_child(custom_menu_item $menuitem) {
$removed = false;
if (($key = array_search($menuitem, $this->children)) !== false) {
unset($this->children[$key]);
$this->children = array_values($this->children);
$removed = true;
} else {
... | php | public function remove_child(custom_menu_item $menuitem) {
$removed = false;
if (($key = array_search($menuitem, $this->children)) !== false) {
unset($this->children[$key]);
$this->children = array_values($this->children);
$removed = true;
} else {
... | [
"public",
"function",
"remove_child",
"(",
"custom_menu_item",
"$",
"menuitem",
")",
"{",
"$",
"removed",
"=",
"false",
";",
"if",
"(",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"menuitem",
",",
"$",
"this",
"->",
"children",
")",
")",
"!==",
"fa... | Removes a custom menu item that is a child or descendant to the current menu.
Returns true if child was found and removed.
@param custom_menu_item $menuitem
@return bool | [
"Removes",
"a",
"custom",
"menu",
"item",
"that",
"is",
"a",
"child",
"or",
"descendant",
"to",
"the",
"current",
"menu",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L3503-L3517 |
219,813 | moodle/moodle | lib/outputcomponents.php | custom_menu.convert_text_to_menu_nodes | public static function convert_text_to_menu_nodes($text, $language = null) {
$root = new custom_menu();
$lastitem = $root;
$lastdepth = 0;
$hiddenitems = array();
$lines = explode("\n", $text);
foreach ($lines as $linenumber => $line) {
$line = trim($line);
... | php | public static function convert_text_to_menu_nodes($text, $language = null) {
$root = new custom_menu();
$lastitem = $root;
$lastdepth = 0;
$hiddenitems = array();
$lines = explode("\n", $text);
foreach ($lines as $linenumber => $line) {
$line = trim($line);
... | [
"public",
"static",
"function",
"convert_text_to_menu_nodes",
"(",
"$",
"text",
",",
"$",
"language",
"=",
"null",
")",
"{",
"$",
"root",
"=",
"new",
"custom_menu",
"(",
")",
";",
"$",
"lastitem",
"=",
"$",
"root",
";",
"$",
"lastdepth",
"=",
"0",
";",... | Converts a string into a structured array of custom_menu_items which can
then be added to a custom menu.
Structure:
text|url|title|langs
The number of hyphens at the start determines the depth of the item. The
languages are optional, comma separated list of languages the line is for.
Example structure:
First level fi... | [
"Converts",
"a",
"string",
"into",
"a",
"structured",
"array",
"of",
"custom_menu_items",
"which",
"can",
"then",
"be",
"added",
"to",
"a",
"custom",
"menu",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L3717-L3781 |
219,814 | moodle/moodle | lib/outputcomponents.php | custom_menu.sort_custom_menu_items | public static function sort_custom_menu_items(custom_menu_item $itema, custom_menu_item $itemb) {
$itema = $itema->get_sort_order();
$itemb = $itemb->get_sort_order();
if ($itema == $itemb) {
return 0;
}
return ($itema > $itemb) ? +1 : -1;
} | php | public static function sort_custom_menu_items(custom_menu_item $itema, custom_menu_item $itemb) {
$itema = $itema->get_sort_order();
$itemb = $itemb->get_sort_order();
if ($itema == $itemb) {
return 0;
}
return ($itema > $itemb) ? +1 : -1;
} | [
"public",
"static",
"function",
"sort_custom_menu_items",
"(",
"custom_menu_item",
"$",
"itema",
",",
"custom_menu_item",
"$",
"itemb",
")",
"{",
"$",
"itema",
"=",
"$",
"itema",
"->",
"get_sort_order",
"(",
")",
";",
"$",
"itemb",
"=",
"$",
"itemb",
"->",
... | Sorts two custom menu items
This function is designed to be used with the usort method
usort($this->children, array('custom_menu','sort_custom_menu_items'));
@static
@param custom_menu_item $itema
@param custom_menu_item $itemb
@return int | [
"Sorts",
"two",
"custom",
"menu",
"items"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L3794-L3801 |
219,815 | moodle/moodle | lib/outputcomponents.php | tabobject.set_selected | protected function set_selected($selected) {
if ((string)$selected === (string)$this->id) {
$this->selected = true;
// This tab is selected. No need to travel through subtree.
return true;
}
foreach ($this->subtree as $subitem) {
if ($subitem->set_... | php | protected function set_selected($selected) {
if ((string)$selected === (string)$this->id) {
$this->selected = true;
// This tab is selected. No need to travel through subtree.
return true;
}
foreach ($this->subtree as $subitem) {
if ($subitem->set_... | [
"protected",
"function",
"set_selected",
"(",
"$",
"selected",
")",
"{",
"if",
"(",
"(",
"string",
")",
"$",
"selected",
"===",
"(",
"string",
")",
"$",
"this",
"->",
"id",
")",
"{",
"$",
"this",
"->",
"selected",
"=",
"true",
";",
"// This tab is sele... | Travels through tree and finds the tab to mark as selected, all parents are automatically marked as activated
@param string $selected the id of the selected tab (whatever row it's on),
if null marks all tabs as unselected
@return bool whether this tab is selected or contains selected tab in its subtree | [
"Travels",
"through",
"tree",
"and",
"finds",
"the",
"tab",
"to",
"mark",
"as",
"selected",
"all",
"parents",
"are",
"automatically",
"marked",
"as",
"activated"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L3856-L3870 |
219,816 | moodle/moodle | lib/outputcomponents.php | tabobject.find | public function find($id) {
if ((string)$this->id === (string)$id) {
return $this;
}
foreach ($this->subtree as $tab) {
if ($obj = $tab->find($id)) {
return $obj;
}
}
return null;
} | php | public function find($id) {
if ((string)$this->id === (string)$id) {
return $this;
}
foreach ($this->subtree as $tab) {
if ($obj = $tab->find($id)) {
return $obj;
}
}
return null;
} | [
"public",
"function",
"find",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"(",
"string",
")",
"$",
"this",
"->",
"id",
"===",
"(",
"string",
")",
"$",
"id",
")",
"{",
"return",
"$",
"this",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"subtree",
"as",... | Travels through tree and finds a tab with specified id
@param string $id
@return tabtree|null | [
"Travels",
"through",
"tree",
"and",
"finds",
"a",
"tab",
"with",
"specified",
"id"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L3878-L3888 |
219,817 | moodle/moodle | lib/outputcomponents.php | tabobject.set_level | protected function set_level($level) {
$this->level = $level;
foreach ($this->subtree as $tab) {
$tab->set_level($level + 1);
}
} | php | protected function set_level($level) {
$this->level = $level;
foreach ($this->subtree as $tab) {
$tab->set_level($level + 1);
}
} | [
"protected",
"function",
"set_level",
"(",
"$",
"level",
")",
"{",
"$",
"this",
"->",
"level",
"=",
"$",
"level",
";",
"foreach",
"(",
"$",
"this",
"->",
"subtree",
"as",
"$",
"tab",
")",
"{",
"$",
"tab",
"->",
"set_level",
"(",
"$",
"level",
"+",
... | Allows to mark each tab's level in the tree before rendering.
@param int $level | [
"Allows",
"to",
"mark",
"each",
"tab",
"s",
"level",
"in",
"the",
"tree",
"before",
"rendering",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L3895-L3900 |
219,818 | moodle/moodle | lib/outputcomponents.php | context_header.format_button_images | protected function format_button_images() {
foreach ($this->additionalbuttons as $buttontype => $button) {
$page = $button['page'];
// If no image is provided then just use the title.
if (!isset($button['image'])) {
$this->additionalbuttons[$buttontype]['form... | php | protected function format_button_images() {
foreach ($this->additionalbuttons as $buttontype => $button) {
$page = $button['page'];
// If no image is provided then just use the title.
if (!isset($button['image'])) {
$this->additionalbuttons[$buttontype]['form... | [
"protected",
"function",
"format_button_images",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"additionalbuttons",
"as",
"$",
"buttontype",
"=>",
"$",
"button",
")",
"{",
"$",
"page",
"=",
"$",
"button",
"[",
"'page'",
"]",
";",
"// If no image is provi... | Adds an array element for a formatted image. | [
"Adds",
"an",
"array",
"element",
"for",
"a",
"formatted",
"image",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L3985-L4012 |
219,819 | moodle/moodle | lib/outputcomponents.php | action_menu.initialise_js | public function initialise_js(moodle_page $page) {
static $initialised = false;
if (!$initialised) {
$page->requires->yui_module('moodle-core-actionmenu', 'M.core.actionmenu.init');
$initialised = true;
}
} | php | public function initialise_js(moodle_page $page) {
static $initialised = false;
if (!$initialised) {
$page->requires->yui_module('moodle-core-actionmenu', 'M.core.actionmenu.init');
$initialised = true;
}
} | [
"public",
"function",
"initialise_js",
"(",
"moodle_page",
"$",
"page",
")",
"{",
"static",
"$",
"initialised",
"=",
"false",
";",
"if",
"(",
"!",
"$",
"initialised",
")",
"{",
"$",
"page",
"->",
"requires",
"->",
"yui_module",
"(",
"'moodle-core-actionmenu'... | Initialises JS required fore the action menu.
The JS is only required once as it manages all action menu's on the page.
@param moodle_page $page | [
"Initialises",
"JS",
"required",
"fore",
"the",
"action",
"menu",
".",
"The",
"JS",
"is",
"only",
"required",
"once",
"as",
"it",
"manages",
"all",
"action",
"menu",
"s",
"on",
"the",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4268-L4274 |
219,820 | moodle/moodle | lib/outputcomponents.php | action_menu.add | public function add($action) {
if ($action instanceof action_link) {
if ($action->primary) {
$this->add_primary_action($action);
} else {
$this->add_secondary_action($action);
}
} else if ($action instanceof pix_icon) {
$thi... | php | public function add($action) {
if ($action instanceof action_link) {
if ($action->primary) {
$this->add_primary_action($action);
} else {
$this->add_secondary_action($action);
}
} else if ($action instanceof pix_icon) {
$thi... | [
"public",
"function",
"add",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"$",
"action",
"instanceof",
"action_link",
")",
"{",
"if",
"(",
"$",
"action",
"->",
"primary",
")",
"{",
"$",
"this",
"->",
"add_primary_action",
"(",
"$",
"action",
")",
";",
"}... | Adds an action to this action menu.
@param action_menu_link|pix_icon|string $action | [
"Adds",
"an",
"action",
"to",
"this",
"action",
"menu",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4281-L4293 |
219,821 | moodle/moodle | lib/outputcomponents.php | action_menu.add_primary_action | public function add_primary_action($action) {
if ($action instanceof action_link || $action instanceof pix_icon) {
$action->attributes['role'] = 'menuitem';
if ($action instanceof action_menu_link) {
$action->actionmenu = $this;
}
}
$this->prim... | php | public function add_primary_action($action) {
if ($action instanceof action_link || $action instanceof pix_icon) {
$action->attributes['role'] = 'menuitem';
if ($action instanceof action_menu_link) {
$action->actionmenu = $this;
}
}
$this->prim... | [
"public",
"function",
"add_primary_action",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"$",
"action",
"instanceof",
"action_link",
"||",
"$",
"action",
"instanceof",
"pix_icon",
")",
"{",
"$",
"action",
"->",
"attributes",
"[",
"'role'",
"]",
"=",
"'menuitem'"... | Adds a primary action to the action menu.
@param action_menu_link|action_link|pix_icon|string $action | [
"Adds",
"a",
"primary",
"action",
"to",
"the",
"action",
"menu",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4300-L4308 |
219,822 | moodle/moodle | lib/outputcomponents.php | action_menu.add_secondary_action | public function add_secondary_action($action) {
if ($action instanceof action_link || $action instanceof pix_icon) {
$action->attributes['role'] = 'menuitem';
if ($action instanceof action_menu_link) {
$action->actionmenu = $this;
}
}
$this->se... | php | public function add_secondary_action($action) {
if ($action instanceof action_link || $action instanceof pix_icon) {
$action->attributes['role'] = 'menuitem';
if ($action instanceof action_menu_link) {
$action->actionmenu = $this;
}
}
$this->se... | [
"public",
"function",
"add_secondary_action",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"$",
"action",
"instanceof",
"action_link",
"||",
"$",
"action",
"instanceof",
"pix_icon",
")",
"{",
"$",
"action",
"->",
"attributes",
"[",
"'role'",
"]",
"=",
"'menuitem... | Adds a secondary action to the action menu.
@param action_link|pix_icon|string $action | [
"Adds",
"a",
"secondary",
"action",
"to",
"the",
"action",
"menu",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4315-L4323 |
219,823 | moodle/moodle | lib/outputcomponents.php | action_menu.get_primary_actions | public function get_primary_actions(core_renderer $output = null) {
global $OUTPUT;
if ($output === null) {
$output = $OUTPUT;
}
$pixicon = $this->actionicon;
$linkclasses = array('toggle-display');
$title = '';
if (!empty($this->menutrigger)) {
... | php | public function get_primary_actions(core_renderer $output = null) {
global $OUTPUT;
if ($output === null) {
$output = $OUTPUT;
}
$pixicon = $this->actionicon;
$linkclasses = array('toggle-display');
$title = '';
if (!empty($this->menutrigger)) {
... | [
"public",
"function",
"get_primary_actions",
"(",
"core_renderer",
"$",
"output",
"=",
"null",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"$",
"output",
"===",
"null",
")",
"{",
"$",
"output",
"=",
"$",
"OUTPUT",
";",
"}",
"$",
"pixicon",
"=",
... | Returns the primary actions ready to be rendered.
@param core_renderer $output The renderer to use for getting icons.
@return array | [
"Returns",
"the",
"primary",
"actions",
"ready",
"to",
"be",
"rendered",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4331-L4384 |
219,824 | moodle/moodle | lib/outputcomponents.php | action_menu.set_alignment | public function set_alignment($dialogue, $button) {
if (isset($this->attributessecondary['data-align'])) {
// We've already got one set, lets remove the old class so as to avoid troubles.
$class = $this->attributessecondary['class'];
$search = 'align-'.$this->attributessecond... | php | public function set_alignment($dialogue, $button) {
if (isset($this->attributessecondary['data-align'])) {
// We've already got one set, lets remove the old class so as to avoid troubles.
$class = $this->attributessecondary['class'];
$search = 'align-'.$this->attributessecond... | [
"public",
"function",
"set_alignment",
"(",
"$",
"dialogue",
",",
"$",
"button",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"attributessecondary",
"[",
"'data-align'",
"]",
")",
")",
"{",
"// We've already got one set, lets remove the old class so as to a... | Sets the alignment of the dialogue in relation to button used to toggle it.
@param int $dialogue One of action_menu::TL, action_menu::TR, action_menu::BL, action_menu::BR.
@param int $button One of action_menu::TL, action_menu::TR, action_menu::BL, action_menu::BR. | [
"Sets",
"the",
"alignment",
"of",
"the",
"dialogue",
"in",
"relation",
"to",
"button",
"used",
"to",
"toggle",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4408-L4418 |
219,825 | moodle/moodle | lib/outputcomponents.php | action_menu.get_align_string | protected function get_align_string($align) {
switch ($align) {
case self::TL :
return 'tl';
case self::TR :
return 'tr';
case self::BL :
return 'bl';
case self::BR :
return 'br';
default ... | php | protected function get_align_string($align) {
switch ($align) {
case self::TL :
return 'tl';
case self::TR :
return 'tr';
case self::BL :
return 'bl';
case self::BR :
return 'br';
default ... | [
"protected",
"function",
"get_align_string",
"(",
"$",
"align",
")",
"{",
"switch",
"(",
"$",
"align",
")",
"{",
"case",
"self",
"::",
"TL",
":",
"return",
"'tl'",
";",
"case",
"self",
"::",
"TR",
":",
"return",
"'tr'",
";",
"case",
"self",
"::",
"BL... | Returns a string to describe the alignment.
@param int $align One of action_menu::TL, action_menu::TR, action_menu::BL, action_menu::BR.
@return string | [
"Returns",
"a",
"string",
"to",
"describe",
"the",
"alignment",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4426-L4439 |
219,826 | moodle/moodle | lib/outputcomponents.php | action_menu.set_nowrap_on_items | public function set_nowrap_on_items($value = true) {
$class = 'nowrap-items';
if (!empty($this->attributes['class'])) {
$pos = strpos($this->attributes['class'], $class);
if ($value === true && $pos === false) {
// The value is true and the class has not been set ... | php | public function set_nowrap_on_items($value = true) {
$class = 'nowrap-items';
if (!empty($this->attributes['class'])) {
$pos = strpos($this->attributes['class'], $class);
if ($value === true && $pos === false) {
// The value is true and the class has not been set ... | [
"public",
"function",
"set_nowrap_on_items",
"(",
"$",
"value",
"=",
"true",
")",
"{",
"$",
"class",
"=",
"'nowrap-items'",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"attributes",
"[",
"'class'",
"]",
")",
")",
"{",
"$",
"pos",
"=",
"strp... | Sets nowrap on items. If true menu items should not wrap lines if they are longer than the available space.
This property can be useful when the action menu is displayed within a parent element that is either floated
or relatively positioned.
In that situation the width of the menu is determined by the width of the pa... | [
"Sets",
"nowrap",
"on",
"items",
".",
"If",
"true",
"menu",
"items",
"should",
"not",
"wrap",
"lines",
"if",
"they",
"are",
"longer",
"than",
"the",
"available",
"space",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4487-L4502 |
219,827 | moodle/moodle | lib/outputcomponents.php | progress_bar.create | public function create() {
global $OUTPUT;
$this->time_start = microtime(true);
if (CLI_SCRIPT) {
return; // Temporary solution for cli scripts.
}
flush();
echo $OUTPUT->render($this);
flush();
} | php | public function create() {
global $OUTPUT;
$this->time_start = microtime(true);
if (CLI_SCRIPT) {
return; // Temporary solution for cli scripts.
}
flush();
echo $OUTPUT->render($this);
flush();
} | [
"public",
"function",
"create",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"this",
"->",
"time_start",
"=",
"microtime",
"(",
"true",
")",
";",
"if",
"(",
"CLI_SCRIPT",
")",
"{",
"return",
";",
"// Temporary solution for cli scripts.",
"}",
"flush",
... | Create a new progress bar, this function will output html.
@return void Echo's output | [
"Create",
"a",
"new",
"progress",
"bar",
"this",
"function",
"will",
"output",
"html",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4879-L4890 |
219,828 | moodle/moodle | lib/outputcomponents.php | progress_bar._update | private function _update($percent, $msg) {
if (empty($this->time_start)) {
throw new coding_exception('You must call create() (or use the $autostart ' .
'argument to the constructor) before you try updating the progress bar.');
}
if (CLI_SCRIPT) {
ret... | php | private function _update($percent, $msg) {
if (empty($this->time_start)) {
throw new coding_exception('You must call create() (or use the $autostart ' .
'argument to the constructor) before you try updating the progress bar.');
}
if (CLI_SCRIPT) {
ret... | [
"private",
"function",
"_update",
"(",
"$",
"percent",
",",
"$",
"msg",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"time_start",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'You must call create() (or use the $autostart '",
".",
"'argum... | Update the progress bar.
@param int $percent From 1-100.
@param string $msg The message.
@return void Echo's output
@throws coding_exception | [
"Update",
"the",
"progress",
"bar",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4900-L4934 |
219,829 | moodle/moodle | lib/outputcomponents.php | progress_bar.estimate | private function estimate($pt) {
if ($this->lastupdate == 0) {
return null;
}
if ($pt < 0.00001) {
return null; // We do not know yet how long it will take.
}
if ($pt > 99.99999) {
return 0; // Nearly done, right?
}
$consumed = ... | php | private function estimate($pt) {
if ($this->lastupdate == 0) {
return null;
}
if ($pt < 0.00001) {
return null; // We do not know yet how long it will take.
}
if ($pt > 99.99999) {
return 0; // Nearly done, right?
}
$consumed = ... | [
"private",
"function",
"estimate",
"(",
"$",
"pt",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"lastupdate",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"pt",
"<",
"0.00001",
")",
"{",
"return",
"null",
";",
"// We do not know yet ho... | Estimate how much time it is going to take.
@param int $pt From 1-100.
@return mixed Null (unknown), or int. | [
"Estimate",
"how",
"much",
"time",
"it",
"is",
"going",
"to",
"take",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4942-L4958 |
219,830 | moodle/moodle | lib/outputcomponents.php | progress_bar.update_full | public function update_full($percent, $msg) {
$percent = max(min($percent, 100), 0);
$this->_update($percent, $msg);
} | php | public function update_full($percent, $msg) {
$percent = max(min($percent, 100), 0);
$this->_update($percent, $msg);
} | [
"public",
"function",
"update_full",
"(",
"$",
"percent",
",",
"$",
"msg",
")",
"{",
"$",
"percent",
"=",
"max",
"(",
"min",
"(",
"$",
"percent",
",",
"100",
")",
",",
"0",
")",
";",
"$",
"this",
"->",
"_update",
"(",
"$",
"percent",
",",
"$",
... | Update progress bar according percent.
@param int $percent From 1-100.
@param string $msg The message needed to be shown. | [
"Update",
"progress",
"bar",
"according",
"percent",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4966-L4969 |
219,831 | moodle/moodle | lib/outputcomponents.php | progress_bar.update | public function update($cur, $total, $msg) {
$percent = ($cur / $total) * 100;
$this->update_full($percent, $msg);
} | php | public function update($cur, $total, $msg) {
$percent = ($cur / $total) * 100;
$this->update_full($percent, $msg);
} | [
"public",
"function",
"update",
"(",
"$",
"cur",
",",
"$",
"total",
",",
"$",
"msg",
")",
"{",
"$",
"percent",
"=",
"(",
"$",
"cur",
"/",
"$",
"total",
")",
"*",
"100",
";",
"$",
"this",
"->",
"update_full",
"(",
"$",
"percent",
",",
"$",
"msg"... | Update progress bar according the number of tasks.
@param int $cur Current task number.
@param int $total Total task number.
@param string $msg The message needed to be shown. | [
"Update",
"progress",
"bar",
"according",
"the",
"number",
"of",
"tasks",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L4978-L4981 |
219,832 | moodle/moodle | mod/assign/feedback/editpdf/locallib.php | assign_feedback_editpdf.get_widget | public function get_widget($userid, $grade, $readonly) {
$attempt = -1;
if ($grade && isset($grade->attemptnumber)) {
$attempt = $grade->attemptnumber;
} else {
$grade = $this->assignment->get_user_grade($userid, true);
}
$feedbackfile = document_services... | php | public function get_widget($userid, $grade, $readonly) {
$attempt = -1;
if ($grade && isset($grade->attemptnumber)) {
$attempt = $grade->attemptnumber;
} else {
$grade = $this->assignment->get_user_grade($userid, true);
}
$feedbackfile = document_services... | [
"public",
"function",
"get_widget",
"(",
"$",
"userid",
",",
"$",
"grade",
",",
"$",
"readonly",
")",
"{",
"$",
"attempt",
"=",
"-",
"1",
";",
"if",
"(",
"$",
"grade",
"&&",
"isset",
"(",
"$",
"grade",
"->",
"attemptnumber",
")",
")",
"{",
"$",
"... | Create a widget for rendering the editor.
@param int $userid
@param stdClass $grade
@param bool $readonly
@return assignfeedback_editpdf_widget | [
"Create",
"a",
"widget",
"for",
"rendering",
"the",
"editor",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/locallib.php#L59-L146 |
219,833 | moodle/moodle | mod/assign/feedback/editpdf/locallib.php | assign_feedback_editpdf.get_form_elements_for_user | public function get_form_elements_for_user($grade, MoodleQuickForm $mform, stdClass $data, $userid) {
global $PAGE;
$attempt = -1;
if ($grade) {
$attempt = $grade->attemptnumber;
}
$renderer = $PAGE->get_renderer('assignfeedback_editpdf');
$widget = $this->... | php | public function get_form_elements_for_user($grade, MoodleQuickForm $mform, stdClass $data, $userid) {
global $PAGE;
$attempt = -1;
if ($grade) {
$attempt = $grade->attemptnumber;
}
$renderer = $PAGE->get_renderer('assignfeedback_editpdf');
$widget = $this->... | [
"public",
"function",
"get_form_elements_for_user",
"(",
"$",
"grade",
",",
"MoodleQuickForm",
"$",
"mform",
",",
"stdClass",
"$",
"data",
",",
"$",
"userid",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"attempt",
"=",
"-",
"1",
";",
"if",
"(",
"$",
"gr... | Get form elements for grading form
@param stdClass $grade
@param MoodleQuickForm $mform
@param stdClass $data
@param int $userid
@return bool true if elements were added to the form | [
"Get",
"form",
"elements",
"for",
"grading",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/locallib.php#L157-L175 |
219,834 | moodle/moodle | mod/assign/feedback/editpdf/locallib.php | assign_feedback_editpdf.is_feedback_modified | public function is_feedback_modified(stdClass $grade, stdClass $data) {
// We only need to know if the source user's PDF has changed. If so then all
// following users will have the same status. If it's only an individual annotation
// then only one user will come through this method.
//... | php | public function is_feedback_modified(stdClass $grade, stdClass $data) {
// We only need to know if the source user's PDF has changed. If so then all
// following users will have the same status. If it's only an individual annotation
// then only one user will come through this method.
//... | [
"public",
"function",
"is_feedback_modified",
"(",
"stdClass",
"$",
"grade",
",",
"stdClass",
"$",
"data",
")",
"{",
"// We only need to know if the source user's PDF has changed. If so then all",
"// following users will have the same status. If it's only an individual annotation",
"/... | Check to see if the grade feedback for the pdf has been modified.
@param stdClass $grade Grade object.
@param stdClass $data Data from the form submission (not used).
@return boolean True if the pdf has been modified, else false. | [
"Check",
"to",
"see",
"if",
"the",
"grade",
"feedback",
"for",
"the",
"pdf",
"has",
"been",
"modified",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/locallib.php#L184-L244 |
219,835 | moodle/moodle | mod/assign/feedback/editpdf/locallib.php | assign_feedback_editpdf.delete_instance | public function delete_instance() {
global $DB;
$grades = $DB->get_records('assign_grades', array('assignment'=>$this->assignment->get_instance()->id), '', 'id');
if ($grades) {
list($gradeids, $params) = $DB->get_in_or_equal(array_keys($grades), SQL_PARAMS_NAMED);
$DB->d... | php | public function delete_instance() {
global $DB;
$grades = $DB->get_records('assign_grades', array('assignment'=>$this->assignment->get_instance()->id), '', 'id');
if ($grades) {
list($gradeids, $params) = $DB->get_in_or_equal(array_keys($grades), SQL_PARAMS_NAMED);
$DB->d... | [
"public",
"function",
"delete_instance",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"grades",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"'assign_grades'",
",",
"array",
"(",
"'assignment'",
"=>",
"$",
"this",
"->",
"assignment",
"->",
"get_instance",
"(... | The assignment has been deleted - remove the plugin specific data
@return bool | [
"The",
"assignment",
"has",
"been",
"deleted",
"-",
"remove",
"the",
"plugin",
"specific",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/locallib.php#L323-L332 |
219,836 | moodle/moodle | mod/assign/feedback/editpdf/locallib.php | assign_feedback_editpdf.is_available | public function is_available() {
if ($this->enabledcache === null) {
$testpath = assignfeedback_editpdf\pdf::test_gs_path(false);
$this->enabledcache = ($testpath->status == assignfeedback_editpdf\pdf::GSPATH_OK);
}
return $this->enabledcache;
} | php | public function is_available() {
if ($this->enabledcache === null) {
$testpath = assignfeedback_editpdf\pdf::test_gs_path(false);
$this->enabledcache = ($testpath->status == assignfeedback_editpdf\pdf::GSPATH_OK);
}
return $this->enabledcache;
} | [
"public",
"function",
"is_available",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"enabledcache",
"===",
"null",
")",
"{",
"$",
"testpath",
"=",
"assignfeedback_editpdf",
"\\",
"pdf",
"::",
"test_gs_path",
"(",
"false",
")",
";",
"$",
"this",
"->",
"ena... | Determine if ghostscript is available and working.
@return bool | [
"Determine",
"if",
"ghostscript",
"is",
"available",
"and",
"working",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/locallib.php#L339-L345 |
219,837 | moodle/moodle | lib/simplepie/library/SimplePie/Registry.php | SimplePie_Registry.register | public function register($type, $class, $legacy = false)
{
if (!@is_subclass_of($class, $this->default[$type]))
{
return false;
}
$this->classes[$type] = $class;
if ($legacy)
{
$this->legacy[] = $class;
}
return true;
} | php | public function register($type, $class, $legacy = false)
{
if (!@is_subclass_of($class, $this->default[$type]))
{
return false;
}
$this->classes[$type] = $class;
if ($legacy)
{
$this->legacy[] = $class;
}
return true;
} | [
"public",
"function",
"register",
"(",
"$",
"type",
",",
"$",
"class",
",",
"$",
"legacy",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"@",
"is_subclass_of",
"(",
"$",
"class",
",",
"$",
"this",
"->",
"default",
"[",
"$",
"type",
"]",
")",
")",
"{",
... | Register a class
@param string $type See {@see $default} for names
@param string $class Class name, must subclass the corresponding default
@param bool $legacy Whether to enable legacy support for this class
@return bool Successfulness | [
"Register",
"a",
"class"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Registry.php#L113-L128 |
219,838 | moodle/moodle | lib/simplepie/library/SimplePie/Registry.php | SimplePie_Registry.get_class | public function get_class($type)
{
if (!empty($this->classes[$type]))
{
return $this->classes[$type];
}
if (!empty($this->default[$type]))
{
return $this->default[$type];
}
return null;
} | php | public function get_class($type)
{
if (!empty($this->classes[$type]))
{
return $this->classes[$type];
}
if (!empty($this->default[$type]))
{
return $this->default[$type];
}
return null;
} | [
"public",
"function",
"get_class",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"classes",
"[",
"$",
"type",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"classes",
"[",
"$",
"type",
"]",
";",
"}",
"if",
"(",... | Get the class registered for a type
Where possible, use {@see create()} or {@see call()} instead
@param string $type
@return string|null | [
"Get",
"the",
"class",
"registered",
"for",
"a",
"type"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Registry.php#L138-L150 |
219,839 | moodle/moodle | lib/simplepie/library/SimplePie/Registry.php | SimplePie_Registry.& | public function &create($type, $parameters = array())
{
$class = $this->get_class($type);
if (in_array($class, $this->legacy))
{
switch ($type)
{
case 'locator':
// Legacy: file, timeout, useragent, file_class, max_checked_feeds, content_type_sniffer_class
// Specified: file, timeout, userag... | php | public function &create($type, $parameters = array())
{
$class = $this->get_class($type);
if (in_array($class, $this->legacy))
{
switch ($type)
{
case 'locator':
// Legacy: file, timeout, useragent, file_class, max_checked_feeds, content_type_sniffer_class
// Specified: file, timeout, userag... | [
"public",
"function",
"&",
"create",
"(",
"$",
"type",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"get_class",
"(",
"$",
"type",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"class",
",",
"$",
... | Create a new instance of a given type
@param string $type
@param array $parameters Parameters to pass to the constructor
@return object Instance of class | [
"Create",
"a",
"new",
"instance",
"of",
"a",
"given",
"type"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Registry.php#L159-L191 |
219,840 | moodle/moodle | lib/simplepie/library/SimplePie/Registry.php | SimplePie_Registry.& | public function &call($type, $method, $parameters = array())
{
$class = $this->get_class($type);
if (in_array($class, $this->legacy))
{
switch ($type)
{
case 'Cache':
// For backwards compatibility with old non-static
// Cache::create() methods
if ($method === 'get_handler')
{
... | php | public function &call($type, $method, $parameters = array())
{
$class = $this->get_class($type);
if (in_array($class, $this->legacy))
{
switch ($type)
{
case 'Cache':
// For backwards compatibility with old non-static
// Cache::create() methods
if ($method === 'get_handler')
{
... | [
"public",
"function",
"&",
"call",
"(",
"$",
"type",
",",
"$",
"method",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"get_class",
"(",
"$",
"type",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"... | Call a static method for a type
@param string $type
@param string $method
@param array $parameters
@return mixed | [
"Call",
"a",
"static",
"method",
"for",
"a",
"type"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Registry.php#L201-L223 |
219,841 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.create_database | public function create_database($dbhost, $dbuser, $dbpass, $dbname, array $dboptions=null) {
$driverstatus = $this->driver_installed();
if ($driverstatus !== true) {
throw new dml_exception('dbdriverproblem', $driverstatus);
}
if (!empty($dboptions['dbsocket'])
... | php | public function create_database($dbhost, $dbuser, $dbpass, $dbname, array $dboptions=null) {
$driverstatus = $this->driver_installed();
if ($driverstatus !== true) {
throw new dml_exception('dbdriverproblem', $driverstatus);
}
if (!empty($dboptions['dbsocket'])
... | [
"public",
"function",
"create_database",
"(",
"$",
"dbhost",
",",
"$",
"dbuser",
",",
"$",
"dbpass",
",",
"$",
"dbname",
",",
"array",
"$",
"dboptions",
"=",
"null",
")",
"{",
"$",
"driverstatus",
"=",
"$",
"this",
"->",
"driver_installed",
"(",
")",
"... | Attempt to create the database
@param string $dbhost
@param string $dbuser
@param string $dbpass
@param string $dbname
@return bool success
@throws dml_exception A DML specific exception is thrown for any errors. | [
"Attempt",
"to",
"create",
"the",
"database"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L56-L109 |
219,842 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.get_dbengine | public function get_dbengine() {
if (isset($this->dboptions['dbengine'])) {
return $this->dboptions['dbengine'];
}
if ($this->external) {
return null;
}
$engine = null;
// Look for current engine of our config table (the first table that gets cr... | php | public function get_dbengine() {
if (isset($this->dboptions['dbengine'])) {
return $this->dboptions['dbengine'];
}
if ($this->external) {
return null;
}
$engine = null;
// Look for current engine of our config table (the first table that gets cr... | [
"public",
"function",
"get_dbengine",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"dboptions",
"[",
"'dbengine'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"dboptions",
"[",
"'dbengine'",
"]",
";",
"}",
"if",
"(",
"$",
"this",
... | Returns the current MySQL db engine.
This is an ugly workaround for MySQL default engine problems,
Moodle is designed to work best on ACID compliant databases
with full transaction support. Do not use MyISAM.
@return string or null MySQL engine name | [
"Returns",
"the",
"current",
"MySQL",
"db",
"engine",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L159-L225 |
219,843 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.get_dbcollation | public function get_dbcollation() {
if (isset($this->dboptions['dbcollation'])) {
return $this->dboptions['dbcollation'];
}
if ($this->external) {
return null;
}
$collation = null;
// Look for current collation of our config table (the first tabl... | php | public function get_dbcollation() {
if (isset($this->dboptions['dbcollation'])) {
return $this->dboptions['dbcollation'];
}
if ($this->external) {
return null;
}
$collation = null;
// Look for current collation of our config table (the first tabl... | [
"public",
"function",
"get_dbcollation",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"dboptions",
"[",
"'dbcollation'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"dboptions",
"[",
"'dbcollation'",
"]",
";",
"}",
"if",
"(",
"$",
... | Returns the current MySQL db collation.
This is an ugly workaround for MySQL default collation problems.
@return string or null MySQL collation name | [
"Returns",
"the",
"current",
"MySQL",
"db",
"collation",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L234-L294 |
219,844 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.get_row_format | public function get_row_format($table = null) {
$rowformat = null;
if (isset($table)) {
$table = $this->mysqli->real_escape_string($table);
$sql = "SELECT row_format
FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = DATABASE() AND tabl... | php | public function get_row_format($table = null) {
$rowformat = null;
if (isset($table)) {
$table = $this->mysqli->real_escape_string($table);
$sql = "SELECT row_format
FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = DATABASE() AND tabl... | [
"public",
"function",
"get_row_format",
"(",
"$",
"table",
"=",
"null",
")",
"{",
"$",
"rowformat",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"table",
")",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"mysqli",
"->",
"real_escape_string",
"(... | Get the row format from the database schema.
@param string $table
@return string row_format name or null if not known or table does not exist. | [
"Get",
"the",
"row",
"format",
"from",
"the",
"database",
"schema",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L325-L361 |
219,845 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.is_large_prefix_enabled | public function is_large_prefix_enabled() {
if ($this->is_antelope_file_format_no_more_supported()) {
// Breaking change: Antelope file format support has been removed, only Barracuda.
return true;
}
if ($largeprefix = $this->get_record_sql("SHOW VARIABLES LIKE 'innodb_l... | php | public function is_large_prefix_enabled() {
if ($this->is_antelope_file_format_no_more_supported()) {
// Breaking change: Antelope file format support has been removed, only Barracuda.
return true;
}
if ($largeprefix = $this->get_record_sql("SHOW VARIABLES LIKE 'innodb_l... | [
"public",
"function",
"is_large_prefix_enabled",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_antelope_file_format_no_more_supported",
"(",
")",
")",
"{",
"// Breaking change: Antelope file format support has been removed, only Barracuda.",
"return",
"true",
";",
"}",
"... | Check the database to see if innodb_large_prefix is on.
@return bool True if on otherwise false. | [
"Check",
"the",
"database",
"to",
"see",
"if",
"innodb_large_prefix",
"is",
"on",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L420-L432 |
219,846 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.get_row_format_sql | public function get_row_format_sql($engine = null, $collation = null) {
if (!isset($engine)) {
$engine = $this->get_dbengine();
}
$engine = strtolower($engine);
if (!isset($collation)) {
$collation = $this->get_dbcollation();
}
$rowformat = '';
... | php | public function get_row_format_sql($engine = null, $collation = null) {
if (!isset($engine)) {
$engine = $this->get_dbengine();
}
$engine = strtolower($engine);
if (!isset($collation)) {
$collation = $this->get_dbcollation();
}
$rowformat = '';
... | [
"public",
"function",
"get_row_format_sql",
"(",
"$",
"engine",
"=",
"null",
",",
"$",
"collation",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"engine",
")",
")",
"{",
"$",
"engine",
"=",
"$",
"this",
"->",
"get_dbengine",
"(",
")",
... | Determine if the row format should be set to compressed, dynamic, or default.
Terrible kludge. If we're using utf8mb4 AND we're using InnoDB, we need to specify row format to
be either dynamic or compressed (default is compact) in order to allow for bigger indexes (MySQL
errors #1709 and #1071).
@param string $engin... | [
"Determine",
"if",
"the",
"row",
"format",
"should",
"be",
"set",
"to",
"compressed",
"dynamic",
"or",
"default",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L445-L465 |
219,847 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.mysqltype2moodletype | private function mysqltype2moodletype($mysql_type) {
$type = null;
switch(strtoupper($mysql_type)) {
case 'BIT':
$type = 'L';
break;
case 'TINYINT':
case 'SMALLINT':
case 'MEDIUMINT':
case 'INT':
ca... | php | private function mysqltype2moodletype($mysql_type) {
$type = null;
switch(strtoupper($mysql_type)) {
case 'BIT':
$type = 'L';
break;
case 'TINYINT':
case 'SMALLINT':
case 'MEDIUMINT':
case 'INT':
ca... | [
"private",
"function",
"mysqltype2moodletype",
"(",
"$",
"mysql_type",
")",
"{",
"$",
"type",
"=",
"null",
";",
"switch",
"(",
"strtoupper",
"(",
"$",
"mysql_type",
")",
")",
"{",
"case",
"'BIT'",
":",
"$",
"type",
"=",
"'L'",
";",
"break",
";",
"case"... | Normalise column type.
@param string $mysql_type
@return string one character
@throws dml_exception | [
"Normalise",
"column",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L941-L1000 |
219,848 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.setup_is_unicodedb | public function setup_is_unicodedb() {
// All new tables are created with this collation, we just have to make sure it is utf8 compatible,
// if config table already exists it has this collation too.
$collation = $this->get_dbcollation();
$collationinfo = explode('_', $collation);
... | php | public function setup_is_unicodedb() {
// All new tables are created with this collation, we just have to make sure it is utf8 compatible,
// if config table already exists it has this collation too.
$collation = $this->get_dbcollation();
$collationinfo = explode('_', $collation);
... | [
"public",
"function",
"setup_is_unicodedb",
"(",
")",
"{",
"// All new tables are created with this collation, we just have to make sure it is utf8 compatible,",
"// if config table already exists it has this collation too.",
"$",
"collation",
"=",
"$",
"this",
"->",
"get_dbcollation",
... | Is this database compatible with utf8?
@return bool | [
"Is",
"this",
"database",
"compatible",
"with",
"utf8?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L1031-L1051 |
219,849 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.emulate_bound_params | protected function emulate_bound_params($sql, array $params=null) {
if (empty($params)) {
return $sql;
}
// ok, we have verified sql statement with ? and correct number of params
$parts = array_reverse(explode('?', $sql));
$return = array_pop($parts);
foreach ... | php | protected function emulate_bound_params($sql, array $params=null) {
if (empty($params)) {
return $sql;
}
// ok, we have verified sql statement with ? and correct number of params
$parts = array_reverse(explode('?', $sql));
$return = array_pop($parts);
foreach ... | [
"protected",
"function",
"emulate_bound_params",
"(",
"$",
"sql",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"params",
")",
")",
"{",
"return",
"$",
"sql",
";",
"}",
"// ok, we have verified sql statement with ? and corre... | Very ugly hack which emulates bound parameters in queries
because prepared statements do not use query cache. | [
"Very",
"ugly",
"hack",
"which",
"emulates",
"bound",
"parameters",
"in",
"queries",
"because",
"prepared",
"statements",
"do",
"not",
"use",
"query",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L1095-L1118 |
219,850 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.export_table_recordset | public function export_table_recordset($table) {
$sql = $this->fix_table_names("SELECT * FROM {{$table}}");
$this->query_start($sql, array(), SQL_QUERY_SELECT);
// MYSQLI_STORE_RESULT may eat all memory for large tables, unfortunately MYSQLI_USE_RESULT blocks other queries.
$result = $t... | php | public function export_table_recordset($table) {
$sql = $this->fix_table_names("SELECT * FROM {{$table}}");
$this->query_start($sql, array(), SQL_QUERY_SELECT);
// MYSQLI_STORE_RESULT may eat all memory for large tables, unfortunately MYSQLI_USE_RESULT blocks other queries.
$result = $t... | [
"public",
"function",
"export_table_recordset",
"(",
"$",
"table",
")",
"{",
"$",
"sql",
"=",
"$",
"this",
"->",
"fix_table_names",
"(",
"\"SELECT * FROM {{$table}}\"",
")",
";",
"$",
"this",
"->",
"query_start",
"(",
"$",
"sql",
",",
"array",
"(",
")",
",... | Get all records from a table.
This method works around potential memory problems and may improve performance,
this method may block access to table until the recordset is closed.
@param string $table Name of database table.
@return moodle_recordset A moodle_recordset instance {@link function get_recordset}.
@throws d... | [
"Get",
"all",
"records",
"from",
"a",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L1199-L1208 |
219,851 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.insert_chunk | protected function insert_chunk($table, array $chunk, array $columns) {
$fieldssql = '('.implode(',', array_keys($columns)).')';
$valuessql = '('.implode(',', array_fill(0, count($columns), '?')).')';
$valuessql = implode(',', array_fill(0, count($chunk), $valuessql));
$params = array(... | php | protected function insert_chunk($table, array $chunk, array $columns) {
$fieldssql = '('.implode(',', array_keys($columns)).')';
$valuessql = '('.implode(',', array_fill(0, count($columns), '?')).')';
$valuessql = implode(',', array_fill(0, count($chunk), $valuessql));
$params = array(... | [
"protected",
"function",
"insert_chunk",
"(",
"$",
"table",
",",
"array",
"$",
"chunk",
",",
"array",
"$",
"columns",
")",
"{",
"$",
"fieldssql",
"=",
"'('",
".",
"implode",
"(",
"','",
",",
"array_keys",
"(",
"$",
"columns",
")",
")",
".",
"')'",
";... | Insert records in chunks.
Note: can be used only from insert_records().
@param string $table
@param array $chunk
@param database_column_info[] $columns | [
"Insert",
"records",
"in",
"chunks",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L1473-L1494 |
219,852 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.sql_regex | public function sql_regex($positivematch = true, $casesensitive = false) {
$collation = '';
if ($casesensitive) {
if (substr($this->get_dbcollation(), -4) !== '_bin') {
$collationinfo = explode('_', $this->get_dbcollation());
$collation = 'COLLATE ' . $collati... | php | public function sql_regex($positivematch = true, $casesensitive = false) {
$collation = '';
if ($casesensitive) {
if (substr($this->get_dbcollation(), -4) !== '_bin') {
$collationinfo = explode('_', $this->get_dbcollation());
$collation = 'COLLATE ' . $collati... | [
"public",
"function",
"sql_regex",
"(",
"$",
"positivematch",
"=",
"true",
",",
"$",
"casesensitive",
"=",
"false",
")",
"{",
"$",
"collation",
"=",
"''",
";",
"if",
"(",
"$",
"casesensitive",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"this",
"->",
"g... | Return regex positive or negative match sql
@param bool $positivematch
@param bool $casesensitive
@return string or empty if not supported | [
"Return",
"regex",
"positive",
"or",
"negative",
"match",
"sql"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L1799-L1815 |
219,853 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.transactions_supported | protected function transactions_supported() {
if (!is_null($this->transactions_supported)) {
return $this->transactions_supported;
}
// this is all just guessing, might be better to just specify it in config.php
if (isset($this->dboptions['dbtransactions'])) {
$t... | php | protected function transactions_supported() {
if (!is_null($this->transactions_supported)) {
return $this->transactions_supported;
}
// this is all just guessing, might be better to just specify it in config.php
if (isset($this->dboptions['dbtransactions'])) {
$t... | [
"protected",
"function",
"transactions_supported",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"transactions_supported",
")",
")",
"{",
"return",
"$",
"this",
"->",
"transactions_supported",
";",
"}",
"// this is all just guessing, might be bet... | Are transactions supported?
It is not responsible to run productions servers
on databases without transaction support ;-)
MyISAM does not support support transactions.
You can override this via the dbtransactions option.
@return bool | [
"Are",
"transactions",
"supported?",
"It",
"is",
"not",
"responsible",
"to",
"run",
"productions",
"servers",
"on",
"databases",
"without",
"transaction",
"support",
";",
"-",
")"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L1930-L1951 |
219,854 | moodle/moodle | lib/dml/mysqli_native_moodle_database.php | mysqli_native_moodle_database.convert_table_row_format | public function convert_table_row_format($tablename) {
$currentrowformat = $this->get_row_format($tablename);
if ($currentrowformat == 'Compact' || $currentrowformat == 'Redundant') {
$rowformat = ($this->is_compressed_row_format_supported(false)) ? "ROW_FORMAT=Compressed" : "ROW_FORMAT=Dyna... | php | public function convert_table_row_format($tablename) {
$currentrowformat = $this->get_row_format($tablename);
if ($currentrowformat == 'Compact' || $currentrowformat == 'Redundant') {
$rowformat = ($this->is_compressed_row_format_supported(false)) ? "ROW_FORMAT=Compressed" : "ROW_FORMAT=Dyna... | [
"public",
"function",
"convert_table_row_format",
"(",
"$",
"tablename",
")",
"{",
"$",
"currentrowformat",
"=",
"$",
"this",
"->",
"get_row_format",
"(",
"$",
"tablename",
")",
";",
"if",
"(",
"$",
"currentrowformat",
"==",
"'Compact'",
"||",
"$",
"currentrow... | Converts a table to either 'Compressed' or 'Dynamic' row format.
@param string $tablename Name of the table to convert to the new row format. | [
"Converts",
"a",
"table",
"to",
"either",
"Compressed",
"or",
"Dynamic",
"row",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/mysqli_native_moodle_database.php#L2013-L2020 |
219,855 | moodle/moodle | grade/report/history/classes/output/renderer.php | renderer.render_user_button | protected function render_user_button(user_button $button) {
$data = $button->export_for_template($this);
return $this->render_from_template('gradereport_history/user_button', $data);
} | php | protected function render_user_button(user_button $button) {
$data = $button->export_for_template($this);
return $this->render_from_template('gradereport_history/user_button', $data);
} | [
"protected",
"function",
"render_user_button",
"(",
"user_button",
"$",
"button",
")",
"{",
"$",
"data",
"=",
"$",
"button",
"->",
"export_for_template",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
"render_from_template",
"(",
"'gradereport_history/... | Render for the select user button.
@param user_button $button instance of gradereport_history_user_button to render
@return string HTML to display | [
"Render",
"for",
"the",
"select",
"user",
"button",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/history/classes/output/renderer.php#L48-L51 |
219,856 | moodle/moodle | mod/quiz/report/responses/first_or_all_responses_table.php | quiz_first_or_all_responses_table.get_summary_after_try | public function get_summary_after_try($tablerow, $slot) {
$qa = $this->get_question_attempt($tablerow->usageid, $slot);
if (!($qa->get_question() instanceof question_manually_gradable)) {
// No responses, and we cannot call summarise_response below.
return null;
}
... | php | public function get_summary_after_try($tablerow, $slot) {
$qa = $this->get_question_attempt($tablerow->usageid, $slot);
if (!($qa->get_question() instanceof question_manually_gradable)) {
// No responses, and we cannot call summarise_response below.
return null;
}
... | [
"public",
"function",
"get_summary_after_try",
"(",
"$",
"tablerow",
",",
"$",
"slot",
")",
"{",
"$",
"qa",
"=",
"$",
"this",
"->",
"get_question_attempt",
"(",
"$",
"tablerow",
"->",
"usageid",
",",
"$",
"slot",
")",
";",
"if",
"(",
"!",
"(",
"$",
"... | Get the summary of the response after the try.
@param object $tablerow row data
@param int $slot Slot number.
@return string summary for the question after this try. | [
"Get",
"the",
"summary",
"of",
"the",
"response",
"after",
"the",
"try",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/responses/first_or_all_responses_table.php#L142-L155 |
219,857 | moodle/moodle | mod/quiz/report/responses/first_or_all_responses_table.php | quiz_first_or_all_responses_table.slot_fraction | protected function slot_fraction($tablerow, $slot) {
$qa = $this->get_question_attempt($tablerow->usageid, $slot);
$submissionsteps = $qa->get_steps_with_submitted_response_iterator();
$step = $submissionsteps[$tablerow->try];
if ($step === null) {
return null;
}
... | php | protected function slot_fraction($tablerow, $slot) {
$qa = $this->get_question_attempt($tablerow->usageid, $slot);
$submissionsteps = $qa->get_steps_with_submitted_response_iterator();
$step = $submissionsteps[$tablerow->try];
if ($step === null) {
return null;
}
... | [
"protected",
"function",
"slot_fraction",
"(",
"$",
"tablerow",
",",
"$",
"slot",
")",
"{",
"$",
"qa",
"=",
"$",
"this",
"->",
"get_question_attempt",
"(",
"$",
"tablerow",
"->",
"usageid",
",",
"$",
"slot",
")",
";",
"$",
"submissionsteps",
"=",
"$",
... | The grade for this slot after this try.
@param object $tablerow attempt data from db.
@param int $slot Slot number.
@return float The fraction. | [
"The",
"grade",
"for",
"this",
"slot",
"after",
"this",
"try",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/responses/first_or_all_responses_table.php#L175-L188 |
219,858 | moodle/moodle | mod/quiz/report/responses/first_or_all_responses_table.php | quiz_first_or_all_responses_table.get_no_of_tries | public function get_no_of_tries($tablerow, $slot) {
return count($this->get_question_attempt($tablerow->usageid, $slot)->get_steps_with_submitted_response_iterator());
} | php | public function get_no_of_tries($tablerow, $slot) {
return count($this->get_question_attempt($tablerow->usageid, $slot)->get_steps_with_submitted_response_iterator());
} | [
"public",
"function",
"get_no_of_tries",
"(",
"$",
"tablerow",
",",
"$",
"slot",
")",
"{",
"return",
"count",
"(",
"$",
"this",
"->",
"get_question_attempt",
"(",
"$",
"tablerow",
"->",
"usageid",
",",
"$",
"slot",
")",
"->",
"get_steps_with_submitted_response... | How many tries were attempted at this question in this slot, during this usage?
@param object $tablerow attempt data from db.
@param int $slot Slot number
@return int the number of tries in the question attempt for slot $slot. | [
"How",
"many",
"tries",
"were",
"attempted",
"at",
"this",
"question",
"in",
"this",
"slot",
"during",
"this",
"usage?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/responses/first_or_all_responses_table.php#L209-L211 |
219,859 | moodle/moodle | mod/quiz/report/responses/first_or_all_responses_table.php | quiz_first_or_all_responses_table.step_no_for_try | protected function step_no_for_try($questionusageid, $slot, $tryno) {
$qa = $this->get_question_attempt($questionusageid, $slot);
return $qa->get_steps_with_submitted_response_iterator()->step_no_for_try($tryno);
} | php | protected function step_no_for_try($questionusageid, $slot, $tryno) {
$qa = $this->get_question_attempt($questionusageid, $slot);
return $qa->get_steps_with_submitted_response_iterator()->step_no_for_try($tryno);
} | [
"protected",
"function",
"step_no_for_try",
"(",
"$",
"questionusageid",
",",
"$",
"slot",
",",
"$",
"tryno",
")",
"{",
"$",
"qa",
"=",
"$",
"this",
"->",
"get_question_attempt",
"(",
"$",
"questionusageid",
",",
"$",
"slot",
")",
";",
"return",
"$",
"qa... | What is the step no this try was seen in?
@param int $questionusageid The question usage id.
@param int $slot Slot number
@param int $tryno Try no
@return int the step no or zero if not found | [
"What",
"is",
"the",
"step",
"no",
"this",
"try",
"was",
"seen",
"in?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/responses/first_or_all_responses_table.php#L222-L225 |
219,860 | moodle/moodle | report/performance/locallib.php | report_performance.doc_link | public function doc_link($issue, $name) {
global $CFG, $OUTPUT;
if (empty($CFG->docroot)) {
return $name;
}
return $OUTPUT->doc_link('report/performance/'.$issue, $name);
} | php | public function doc_link($issue, $name) {
global $CFG, $OUTPUT;
if (empty($CFG->docroot)) {
return $name;
}
return $OUTPUT->doc_link('report/performance/'.$issue, $name);
} | [
"public",
"function",
"doc_link",
"(",
"$",
"issue",
",",
"$",
"name",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"OUTPUT",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"docroot",
")",
")",
"{",
"return",
"$",
"name",
";",
"}",
"return",
"$",
... | Returns document link for performance issue
@param string $issue string describing issue
@param string $name name of issue
@return string issue link pointing to docs page. | [
"Returns",
"document",
"link",
"for",
"performance",
"issue"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/performance/locallib.php#L101-L109 |
219,861 | moodle/moodle | report/performance/locallib.php | report_performance.add_issue_to_table | public function add_issue_to_table(&$table, $issueresult, $detailed = false) {
global $OUTPUT;
$statusarr = array(self::REPORT_PERFORMANCE_OK => 'statusok',
self::REPORT_PERFORMANCE_WARNING => 'statuswarning',
self::REPORT_PERFORMANCE_SERIOUS => 'statusser... | php | public function add_issue_to_table(&$table, $issueresult, $detailed = false) {
global $OUTPUT;
$statusarr = array(self::REPORT_PERFORMANCE_OK => 'statusok',
self::REPORT_PERFORMANCE_WARNING => 'statuswarning',
self::REPORT_PERFORMANCE_SERIOUS => 'statusser... | [
"public",
"function",
"add_issue_to_table",
"(",
"&",
"$",
"table",
",",
"$",
"issueresult",
",",
"$",
"detailed",
"=",
"false",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"statusarr",
"=",
"array",
"(",
"self",
"::",
"REPORT_PERFORMANCE_OK",
"=>",
"'sta... | Helper function to add issue details to table.
@param html_table $table table in which issue details should be added
@param report_performance_issues $issueresult issue result to be added
@param bool $detail true if issue if displayed in detail. | [
"Helper",
"function",
"to",
"add",
"issue",
"details",
"to",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/performance/locallib.php#L118-L142 |
219,862 | moodle/moodle | report/performance/locallib.php | report_performance.report_performance_check_themedesignermode | public static function report_performance_check_themedesignermode() {
global $CFG;
$issueresult = new report_performance_issue();
$issueresult->issue = 'report_performance_check_themedesignermode';
$issueresult->name = get_string('themedesignermode', 'admin');
if (empty($CFG->th... | php | public static function report_performance_check_themedesignermode() {
global $CFG;
$issueresult = new report_performance_issue();
$issueresult->issue = 'report_performance_check_themedesignermode';
$issueresult->name = get_string('themedesignermode', 'admin');
if (empty($CFG->th... | [
"public",
"static",
"function",
"report_performance_check_themedesignermode",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"issueresult",
"=",
"new",
"report_performance_issue",
"(",
")",
";",
"$",
"issueresult",
"->",
"issue",
"=",
"'report_performance_check_themed... | Verifies if theme designer mode is enabled.
@return report_performance_issue result of themedesigner issue. | [
"Verifies",
"if",
"theme",
"designer",
"mode",
"is",
"enabled",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/performance/locallib.php#L149-L168 |
219,863 | moodle/moodle | report/performance/locallib.php | report_performance.report_performance_check_debugmsg | public static function report_performance_check_debugmsg() {
global $CFG;
$issueresult = new report_performance_issue();
$issueresult->issue = 'report_performance_check_debugmsg';
$issueresult->name = get_string('debug', 'admin');
$debugchoices = array(DEBUG_NONE => 'debugnone',... | php | public static function report_performance_check_debugmsg() {
global $CFG;
$issueresult = new report_performance_issue();
$issueresult->issue = 'report_performance_check_debugmsg';
$issueresult->name = get_string('debug', 'admin');
$debugchoices = array(DEBUG_NONE => 'debugnone',... | [
"public",
"static",
"function",
"report_performance_check_debugmsg",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"issueresult",
"=",
"new",
"report_performance_issue",
"(",
")",
";",
"$",
"issueresult",
"->",
"issue",
"=",
"'report_performance_check_debugmsg'",
"... | Checks debug config.
@return report_performance_issue result of debugmsg issue. | [
"Checks",
"debug",
"config",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/performance/locallib.php#L201-L225 |
219,864 | moodle/moodle | report/performance/locallib.php | report_performance.report_performance_check_automatic_backup | public static function report_performance_check_automatic_backup() {
global $CFG;
require_once($CFG->dirroot . '/backup/util/helper/backup_cron_helper.class.php');
$issueresult = new report_performance_issue();
$issueresult->issue = 'report_performance_check_automatic_backup';
$... | php | public static function report_performance_check_automatic_backup() {
global $CFG;
require_once($CFG->dirroot . '/backup/util/helper/backup_cron_helper.class.php');
$issueresult = new report_performance_issue();
$issueresult->issue = 'report_performance_check_automatic_backup';
$... | [
"public",
"static",
"function",
"report_performance_check_automatic_backup",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/backup/util/helper/backup_cron_helper.class.php'",
")",
";",
"$",
"issueresult",
"=",
"new"... | Checks automatic backup config.
@return report_performance_issue result of automatic backup issue. | [
"Checks",
"automatic",
"backup",
"config",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/performance/locallib.php#L232-L258 |
219,865 | moodle/moodle | report/performance/locallib.php | report_performance.report_performance_check_enablestats | public static function report_performance_check_enablestats() {
global $CFG;
$issueresult = new report_performance_issue();
$issueresult->issue = 'report_performance_check_enablestats';
$issueresult->name = get_string('enablestats', 'admin');
if (!empty($CFG->enablestats)) {
... | php | public static function report_performance_check_enablestats() {
global $CFG;
$issueresult = new report_performance_issue();
$issueresult->issue = 'report_performance_check_enablestats';
$issueresult->name = get_string('enablestats', 'admin');
if (!empty($CFG->enablestats)) {
... | [
"public",
"static",
"function",
"report_performance_check_enablestats",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"issueresult",
"=",
"new",
"report_performance_issue",
"(",
")",
";",
"$",
"issueresult",
"->",
"issue",
"=",
"'report_performance_check_enablestats'... | Checks if stats are enabled. | [
"Checks",
"if",
"stats",
"are",
"enabled",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/performance/locallib.php#L263-L282 |
219,866 | moodle/moodle | lib/horde/framework/Horde/Mail/Rfc822/Identification.php | Horde_Mail_Rfc822_Identification.parse | public function parse($value)
{
if (!strlen($value)) {
return;
}
$this->_data = $value;
$this->_datalen = strlen($value);
$this->_params['validate'] = true;
$this->_ptr = 0;
$this->_rfc822SkipLwsp();
while ($this->_curr() !== false) {
... | php | public function parse($value)
{
if (!strlen($value)) {
return;
}
$this->_data = $value;
$this->_datalen = strlen($value);
$this->_params['validate'] = true;
$this->_ptr = 0;
$this->_rfc822SkipLwsp();
while ($this->_curr() !== false) {
... | [
"public",
"function",
"parse",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"strlen",
"(",
"$",
"value",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"_data",
"=",
"$",
"value",
";",
"$",
"this",
"->",
"_datalen",
"=",
"strlen",
"(",
"... | Parse an identification header.
@param string $value Identification field value to parse. | [
"Parse",
"an",
"identification",
"header",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mail/Rfc822/Identification.php#L49-L74 |
219,867 | moodle/moodle | mod/lti/classes/local/ltiservice/response.php | response.get_reason | public function get_reason() {
if (empty($this->reason)) {
$this->reason = $this->responsecodes[$this->code];
}
// Use generic reason for this category (based on first digit) if a specific reason is not defined.
if (empty($this->reason)) {
$this->reason = $this->r... | php | public function get_reason() {
if (empty($this->reason)) {
$this->reason = $this->responsecodes[$this->code];
}
// Use generic reason for this category (based on first digit) if a specific reason is not defined.
if (empty($this->reason)) {
$this->reason = $this->r... | [
"public",
"function",
"get_reason",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"reason",
")",
")",
"{",
"$",
"this",
"->",
"reason",
"=",
"$",
"this",
"->",
"responsecodes",
"[",
"$",
"this",
"->",
"code",
"]",
";",
"}",
"// Use gen... | Get the response reason.
@return string | [
"Get",
"the",
"response",
"reason",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/local/ltiservice/response.php#L116-L125 |
219,868 | moodle/moodle | mod/forum/classes/privacy/subcontext_info.php | subcontext_info.get_discussion_area | protected static function get_discussion_area(\stdClass $discussion) : Array {
$pathparts = [];
if (!empty($discussion->groupname)) {
$pathparts[] = get_string('groups');
$pathparts[] = $discussion->groupname;
}
$parts = [
$discussion->id,
... | php | protected static function get_discussion_area(\stdClass $discussion) : Array {
$pathparts = [];
if (!empty($discussion->groupname)) {
$pathparts[] = get_string('groups');
$pathparts[] = $discussion->groupname;
}
$parts = [
$discussion->id,
... | [
"protected",
"static",
"function",
"get_discussion_area",
"(",
"\\",
"stdClass",
"$",
"discussion",
")",
":",
"Array",
"{",
"$",
"pathparts",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"discussion",
"->",
"groupname",
")",
")",
"{",
"$",
"p... | Get the discussion part of the subcontext.
@param \stdClass $discussion The discussion
@return array | [
"Get",
"the",
"discussion",
"part",
"of",
"the",
"subcontext",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/privacy/subcontext_info.php#L46-L64 |
219,869 | moodle/moodle | mod/forum/classes/privacy/subcontext_info.php | subcontext_info.get_post_area | protected static function get_post_area(\stdClass $post) : Array {
$parts = [
$post->created,
$post->subject,
$post->id,
];
$area[] = implode('-', $parts);
return $area;
} | php | protected static function get_post_area(\stdClass $post) : Array {
$parts = [
$post->created,
$post->subject,
$post->id,
];
$area[] = implode('-', $parts);
return $area;
} | [
"protected",
"static",
"function",
"get_post_area",
"(",
"\\",
"stdClass",
"$",
"post",
")",
":",
"Array",
"{",
"$",
"parts",
"=",
"[",
"$",
"post",
"->",
"created",
",",
"$",
"post",
"->",
"subject",
",",
"$",
"post",
"->",
"id",
",",
"]",
";",
"$... | Get the post part of the subcontext.
@param \stdClass $post The post.
@return array | [
"Get",
"the",
"post",
"part",
"of",
"the",
"subcontext",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/privacy/subcontext_info.php#L72-L81 |
219,870 | moodle/moodle | mod/forum/classes/privacy/subcontext_info.php | subcontext_info.get_post_area_for_parent | protected static function get_post_area_for_parent(\stdClass $post) {
global $DB;
$subcontext = [];
if ($parent = $DB->get_record('forum_posts', ['id' => $post->parent], 'id, created, subject')) {
$subcontext = array_merge($subcontext, static::get_post_area($parent));
}
... | php | protected static function get_post_area_for_parent(\stdClass $post) {
global $DB;
$subcontext = [];
if ($parent = $DB->get_record('forum_posts', ['id' => $post->parent], 'id, created, subject')) {
$subcontext = array_merge($subcontext, static::get_post_area($parent));
}
... | [
"protected",
"static",
"function",
"get_post_area_for_parent",
"(",
"\\",
"stdClass",
"$",
"post",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"subcontext",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"parent",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'forum_posts... | Get the parent subcontext for the supplied forum, discussion, and post combination.
@param \stdClass $post The post.
@return array | [
"Get",
"the",
"parent",
"subcontext",
"for",
"the",
"supplied",
"forum",
"discussion",
"and",
"post",
"combination",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/privacy/subcontext_info.php#L89-L99 |
219,871 | moodle/moodle | mod/forum/classes/privacy/subcontext_info.php | subcontext_info.get_subcontext | protected static function get_subcontext($forum, $discussion = null, $post = null) {
$subcontext = [];
if (null !== $discussion) {
$subcontext += self::get_discussion_area($discussion);
if (null !== $post) {
$subcontext[] = get_string('posts', 'mod_forum');
... | php | protected static function get_subcontext($forum, $discussion = null, $post = null) {
$subcontext = [];
if (null !== $discussion) {
$subcontext += self::get_discussion_area($discussion);
if (null !== $post) {
$subcontext[] = get_string('posts', 'mod_forum');
... | [
"protected",
"static",
"function",
"get_subcontext",
"(",
"$",
"forum",
",",
"$",
"discussion",
"=",
"null",
",",
"$",
"post",
"=",
"null",
")",
"{",
"$",
"subcontext",
"=",
"[",
"]",
";",
"if",
"(",
"null",
"!==",
"$",
"discussion",
")",
"{",
"$",
... | Get the subcontext for the supplied forum, discussion, and post combination.
@param \stdClass $forum The forum.
@param \stdClass $discussion The discussion
@param \stdClass $post The post.
@return array | [
"Get",
"the",
"subcontext",
"for",
"the",
"supplied",
"forum",
"discussion",
"and",
"post",
"combination",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/privacy/subcontext_info.php#L109-L122 |
219,872 | moodle/moodle | lib/classes/hub/api.php | api.call | protected static function call($function, array $data = [], $allowpublic = false) {
$token = registration::get_token() ?: 'publichub';
if (!$allowpublic && $token === 'publichub') {
// This will throw an exception.
registration::require_registration();
}
return ... | php | protected static function call($function, array $data = [], $allowpublic = false) {
$token = registration::get_token() ?: 'publichub';
if (!$allowpublic && $token === 'publichub') {
// This will throw an exception.
registration::require_registration();
}
return ... | [
"protected",
"static",
"function",
"call",
"(",
"$",
"function",
",",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"allowpublic",
"=",
"false",
")",
"{",
"$",
"token",
"=",
"registration",
"::",
"get_token",
"(",
")",
"?",
":",
"'publichub'",
";",
... | Calls moodle.net WS
@param string $function name of WS function
@param array $data parameters of WS function
@param bool $allowpublic allow request without moodle.net registration
@return mixed depends on the function
@throws moodle_exception | [
"Calls",
"moodle",
".",
"net",
"WS"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/api.php#L62-L71 |
219,873 | moodle/moodle | lib/classes/hub/api.php | api.process_curl_exception | protected static function process_curl_exception($token, $curloutput) {
if (!isset($curloutput['exception'])) {
return;
}
if ($token === registration::get_token()) {
// Check if registration token was rejected or there are other problems with registration.
if ... | php | protected static function process_curl_exception($token, $curloutput) {
if (!isset($curloutput['exception'])) {
return;
}
if ($token === registration::get_token()) {
// Check if registration token was rejected or there are other problems with registration.
if ... | [
"protected",
"static",
"function",
"process_curl_exception",
"(",
"$",
"token",
",",
"$",
"curloutput",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"curloutput",
"[",
"'exception'",
"]",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"token",
"===... | Analyses exception received from moodle.net
@param string $token token used for CURL request
@param array $curloutput output from CURL request
@throws moodle_exception | [
"Analyses",
"exception",
"received",
"from",
"moodle",
".",
"net"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/api.php#L113-L127 |
219,874 | moodle/moodle | lib/classes/hub/api.php | api.get_hub_info | public static function get_hub_info() {
$info = self::call('hub_get_info', [], true);
$info['imgurl'] = new moodle_url(HUB_MOODLEORGHUBURL . '/local/hub/webservice/download.php',
['filetype' => self::HUB_HUBSCREENSHOT_FILE_TYPE]);
return $info;
} | php | public static function get_hub_info() {
$info = self::call('hub_get_info', [], true);
$info['imgurl'] = new moodle_url(HUB_MOODLEORGHUBURL . '/local/hub/webservice/download.php',
['filetype' => self::HUB_HUBSCREENSHOT_FILE_TYPE]);
return $info;
} | [
"public",
"static",
"function",
"get_hub_info",
"(",
")",
"{",
"$",
"info",
"=",
"self",
"::",
"call",
"(",
"'hub_get_info'",
",",
"[",
"]",
",",
"true",
")",
";",
"$",
"info",
"[",
"'imgurl'",
"]",
"=",
"new",
"moodle_url",
"(",
"HUB_MOODLEORGHUBURL",
... | Returns information about moodle.net
Example of the return array:
{
"courses": 384,
"description": "Moodle.net connects you with free content and courses shared by Moodle ...",
"downloadablecourses": 190,
"enrollablecourses": 194,
"hublogo": 1,
"language": "en",
"name": "Moodle.net",
"sites": 274175,
"url": "https://m... | [
"Returns",
"information",
"about",
"moodle",
".",
"net"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/api.php#L160-L165 |
219,875 | moodle/moodle | lib/classes/hub/api.php | api.get_courses | public static function get_courses($search, $downloadable, $enrollable, $options) {
static $availableoptions = ['ids', 'sitecourseids', 'coverage', 'licenceshortname', 'subject', 'audience',
'educationallevel', 'language', 'orderby', 'givememore', 'allsitecourses'];
if (empty($options)) {
... | php | public static function get_courses($search, $downloadable, $enrollable, $options) {
static $availableoptions = ['ids', 'sitecourseids', 'coverage', 'licenceshortname', 'subject', 'audience',
'educationallevel', 'language', 'orderby', 'givememore', 'allsitecourses'];
if (empty($options)) {
... | [
"public",
"static",
"function",
"get_courses",
"(",
"$",
"search",
",",
"$",
"downloadable",
",",
"$",
"enrollable",
",",
"$",
"options",
")",
"{",
"static",
"$",
"availableoptions",
"=",
"[",
"'ids'",
",",
"'sitecourseids'",
",",
"'coverage'",
",",
"'licenc... | Calls WS function hub_get_courses
Parameter $options may have any of these fields:
[
'ids' => new external_multiple_structure(new external_value(PARAM_INTEGER, 'id of a course in the hub course
directory'), 'ids of course', VALUE_OPTIONAL),
'sitecourseids' => new external_multiple_structure(new external_value(PARAM_IN... | [
"Calls",
"WS",
"function",
"hub_get_courses"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/api.php#L257-L295 |
219,876 | moodle/moodle | lib/classes/hub/api.php | api.register_course | public static function register_course($courseinfo) {
$params = array('courses' => array($courseinfo));
$hubcourseids = self::call('hub_register_courses', $params);
if (count($hubcourseids) != 1) {
throw new moodle_exception('errorcoursewronglypublished', 'hub');
}
re... | php | public static function register_course($courseinfo) {
$params = array('courses' => array($courseinfo));
$hubcourseids = self::call('hub_register_courses', $params);
if (count($hubcourseids) != 1) {
throw new moodle_exception('errorcoursewronglypublished', 'hub');
}
re... | [
"public",
"static",
"function",
"register_course",
"(",
"$",
"courseinfo",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'courses'",
"=>",
"array",
"(",
"$",
"courseinfo",
")",
")",
";",
"$",
"hubcourseids",
"=",
"self",
"::",
"call",
"(",
"'hub_register_co... | Publish one course
Expected contents of $courseinfo:
[
'sitecourseid' => new external_value(PARAM_INT, 'the id of the course on the publishing site'),
'fullname' => new external_value(PARAM_TEXT, 'course name'),
'shortname' => new external_value(PARAM_TEXT, 'course short name'),
'description' => new external_value(PAR... | [
"Publish",
"one",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/api.php#L362-L369 |
219,877 | moodle/moodle | lib/classes/hub/api.php | api.add_screenshot | public static function add_screenshot($hubcourseid, \stored_file $file, $screenshotnumber) {
$curl = new \curl();
$params = array();
$params['filetype'] = self::HUB_SCREENSHOT_FILE_TYPE;
$params['file'] = $file;
$params['courseid'] = $hubcourseid;
$params['filename'] = $f... | php | public static function add_screenshot($hubcourseid, \stored_file $file, $screenshotnumber) {
$curl = new \curl();
$params = array();
$params['filetype'] = self::HUB_SCREENSHOT_FILE_TYPE;
$params['file'] = $file;
$params['courseid'] = $hubcourseid;
$params['filename'] = $f... | [
"public",
"static",
"function",
"add_screenshot",
"(",
"$",
"hubcourseid",
",",
"\\",
"stored_file",
"$",
"file",
",",
"$",
"screenshotnumber",
")",
"{",
"$",
"curl",
"=",
"new",
"\\",
"curl",
"(",
")",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
... | Uploads a screenshot for the published course
@param int $hubcourseid id of the published course on moodle.net, it must be published from this site
@param \stored_file $file
@param int $screenshotnumber ordinal number of the screenshot | [
"Uploads",
"a",
"screenshot",
"for",
"the",
"published",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/api.php#L378-L388 |
219,878 | moodle/moodle | lib/classes/hub/api.php | api.download_course_backup | public static function download_course_backup($hubcourseid, $path) {
$fp = fopen($path, 'w');
$curlurl = new \moodle_url(HUB_MOODLEORGHUBURL . '/local/hub/webservice/download.php',
['filetype' => self::HUB_BACKUP_FILE_TYPE, 'courseid' => $hubcourseid]);
// Send an identification to... | php | public static function download_course_backup($hubcourseid, $path) {
$fp = fopen($path, 'w');
$curlurl = new \moodle_url(HUB_MOODLEORGHUBURL . '/local/hub/webservice/download.php',
['filetype' => self::HUB_BACKUP_FILE_TYPE, 'courseid' => $hubcourseid]);
// Send an identification to... | [
"public",
"static",
"function",
"download_course_backup",
"(",
"$",
"hubcourseid",
",",
"$",
"path",
")",
"{",
"$",
"fp",
"=",
"fopen",
"(",
"$",
"path",
",",
"'w'",
")",
";",
"$",
"curlurl",
"=",
"new",
"\\",
"moodle_url",
"(",
"HUB_MOODLEORGHUBURL",
".... | Downloads course backup
@param int $hubcourseid id of the course on moodle.net
@param string $path local path (in tempdir) to save the downloaded backup to. | [
"Downloads",
"course",
"backup"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/api.php#L396-L412 |
219,879 | moodle/moodle | lib/classes/hub/api.php | api.upload_course_backup | public static function upload_course_backup($hubcourseid, \stored_file $backupfile) {
$curl = new \curl();
$params = array();
$params['filetype'] = self::HUB_BACKUP_FILE_TYPE;
$params['courseid'] = $hubcourseid;
$params['file'] = $backupfile;
$params['token'] = registrati... | php | public static function upload_course_backup($hubcourseid, \stored_file $backupfile) {
$curl = new \curl();
$params = array();
$params['filetype'] = self::HUB_BACKUP_FILE_TYPE;
$params['courseid'] = $hubcourseid;
$params['file'] = $backupfile;
$params['token'] = registrati... | [
"public",
"static",
"function",
"upload_course_backup",
"(",
"$",
"hubcourseid",
",",
"\\",
"stored_file",
"$",
"backupfile",
")",
"{",
"$",
"curl",
"=",
"new",
"\\",
"curl",
"(",
")",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"params",
"["... | Uploads a course backup
@param int $hubcourseid id of the published course on moodle.net, it must be published from this site
@param \stored_file $backupfile | [
"Uploads",
"a",
"course",
"backup"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/hub/api.php#L420-L428 |
219,880 | moodle/moodle | mod/assign/feedback/editpdf/fpdi/filters/FilterLZW.php | FilterLZW.decode | public function decode($data)
{
if ($data[0] == 0x00 && $data[1] == 0x01) {
throw new Exception('LZW flavour not supported.');
}
$this->_initsTable();
$this->_data = $data;
$this->_dataLength = strlen($data);
// Initialize pointers
$this->_byteP... | php | public function decode($data)
{
if ($data[0] == 0x00 && $data[1] == 0x01) {
throw new Exception('LZW flavour not supported.');
}
$this->_initsTable();
$this->_data = $data;
$this->_dataLength = strlen($data);
// Initialize pointers
$this->_byteP... | [
"public",
"function",
"decode",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
"[",
"0",
"]",
"==",
"0x00",
"&&",
"$",
"data",
"[",
"1",
"]",
"==",
"0x01",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'LZW flavour not supported.'",
")",
";",
"... | Decodes LZW compressed data.
@param string $data The compressed data.
@throws Exception
@return string | [
"Decodes",
"LZW",
"compressed",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/fpdi/filters/FilterLZW.php#L34-L92 |
219,881 | moodle/moodle | mod/assign/feedback/editpdf/fpdi/filters/FilterLZW.php | FilterLZW._getNextCode | protected function _getNextCode()
{
if ($this->_bytePointer == $this->_dataLength) {
return 257;
}
$this->_nextData = ($this->_nextData << 8) | (ord($this->_data[$this->_bytePointer++]) & 0xff);
$this->_nextBits += 8;
if ($this->_nextBits < $this->_bitsToGet) {
... | php | protected function _getNextCode()
{
if ($this->_bytePointer == $this->_dataLength) {
return 257;
}
$this->_nextData = ($this->_nextData << 8) | (ord($this->_data[$this->_bytePointer++]) & 0xff);
$this->_nextBits += 8;
if ($this->_nextBits < $this->_bitsToGet) {
... | [
"protected",
"function",
"_getNextCode",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_bytePointer",
"==",
"$",
"this",
"->",
"_dataLength",
")",
"{",
"return",
"257",
";",
"}",
"$",
"this",
"->",
"_nextData",
"=",
"(",
"$",
"this",
"->",
"_nextData",... | Returns the next 9, 10, 11 or 12 bits
@return int | [
"Returns",
"the",
"next",
"9",
"10",
"11",
"or",
"12",
"bits"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/fpdi/filters/FilterLZW.php#L133-L151 |
219,882 | moodle/moodle | lib/phpunit/classes/coverage_info.php | phpunit_coverage_info.get_whitelists | final public function get_whitelists(string $plugindir) : array {
$filters = [];
if (!empty($plugindir)) {
$plugindir .= "/";
}
foreach ($this->whitelistfolders as $folder) {
$filters[] = html_writer::tag('directory', "{$plugindir}{$folder}", ['suffix' => '.php'... | php | final public function get_whitelists(string $plugindir) : array {
$filters = [];
if (!empty($plugindir)) {
$plugindir .= "/";
}
foreach ($this->whitelistfolders as $folder) {
$filters[] = html_writer::tag('directory', "{$plugindir}{$folder}", ['suffix' => '.php'... | [
"final",
"public",
"function",
"get_whitelists",
"(",
"string",
"$",
"plugindir",
")",
":",
"array",
"{",
"$",
"filters",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"plugindir",
")",
")",
"{",
"$",
"plugindir",
".=",
"\"/\"",
";",
"}",
... | Get the formatted XML list of files and folders to whitelist.
@param string $plugindir The root of the plugin, relative to the dataroot.
@return array | [
"Get",
"the",
"formatted",
"XML",
"list",
"of",
"files",
"and",
"folders",
"to",
"whitelist",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpunit/classes/coverage_info.php#L54-L70 |
219,883 | moodle/moodle | lib/phpunit/classes/coverage_info.php | phpunit_coverage_info.get_excludelists | final public function get_excludelists(string $plugindir) : array {
$filters = [];
if (!empty($plugindir)) {
$plugindir .= "/";
}
foreach ($this->excludelistfolders as $folder) {
$filters[] = html_writer::tag('directory', "{$plugindir}{$folder}", ['suffix' => '.... | php | final public function get_excludelists(string $plugindir) : array {
$filters = [];
if (!empty($plugindir)) {
$plugindir .= "/";
}
foreach ($this->excludelistfolders as $folder) {
$filters[] = html_writer::tag('directory', "{$plugindir}{$folder}", ['suffix' => '.... | [
"final",
"public",
"function",
"get_excludelists",
"(",
"string",
"$",
"plugindir",
")",
":",
"array",
"{",
"$",
"filters",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"plugindir",
")",
")",
"{",
"$",
"plugindir",
".=",
"\"/\"",
";",
"}",
... | Get the formatted XML list of files and folders to exclude.
@param string $plugindir The root of the plugin, relative to the dataroot.
@return array | [
"Get",
"the",
"formatted",
"XML",
"list",
"of",
"files",
"and",
"folders",
"to",
"exclude",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpunit/classes/coverage_info.php#L78-L94 |
219,884 | moodle/moodle | grade/import/direct/classes/import_form.php | gradeimport_direct_import_form.definition | public function definition() {
global $COURSE;
$mform = $this->_form;
if (isset($this->_customdata)) { // Hardcoding plugin names here is hacky.
$features = $this->_customdata;
} else {
$features = array();
}
// Course id needs to be passed for... | php | public function definition() {
global $COURSE;
$mform = $this->_form;
if (isset($this->_customdata)) { // Hardcoding plugin names here is hacky.
$features = $this->_customdata;
} else {
$features = array();
}
// Course id needs to be passed for... | [
"public",
"function",
"definition",
"(",
")",
"{",
"global",
"$",
"COURSE",
";",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_customdata",
")",
")",
"{",
"// Hardcoding plugin names here is hacky.",
"$",... | Definition method. | [
"Definition",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/direct/classes/import_form.php#L35-L76 |
219,885 | moodle/moodle | blocks/recentlyaccesseditems/classes/helper.php | helper.get_recent_items | public static function get_recent_items(int $limit = 0) {
global $USER, $DB;
$userid = $USER->id;
$courses = array();
$recentitems = array();
if (!isloggedin() or \core\session\manager::is_loggedinas() or isguestuser()) {
// No access tracking.
return $... | php | public static function get_recent_items(int $limit = 0) {
global $USER, $DB;
$userid = $USER->id;
$courses = array();
$recentitems = array();
if (!isloggedin() or \core\session\manager::is_loggedinas() or isguestuser()) {
// No access tracking.
return $... | [
"public",
"static",
"function",
"get_recent_items",
"(",
"int",
"$",
"limit",
"=",
"0",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"DB",
";",
"$",
"userid",
"=",
"$",
"USER",
"->",
"id",
";",
"$",
"courses",
"=",
"array",
"(",
")",
";",
"$",
"rec... | Returns a list of the most recently items accessed by the logged user
@param int $limit Restrict result set to this amount
@return array List of recent items accessed by userid | [
"Returns",
"a",
"list",
"of",
"the",
"most",
"recently",
"items",
"accessed",
"by",
"the",
"logged",
"user"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/recentlyaccesseditems/classes/helper.php#L43-L95 |
219,886 | moodle/moodle | repository/wikimedia/lib.php | repository_wikimedia.get_maxwidth | public function get_maxwidth() {
$param = optional_param('wikimedia_maxwidth', 0, PARAM_INT);
$pref = get_user_preferences('repository_wikimedia_maxwidth', WIKIMEDIA_IMAGE_SIDE_LENGTH);
if ($param > 0 && $param != $pref) {
$pref = $param;
set_user_preference('repository_w... | php | public function get_maxwidth() {
$param = optional_param('wikimedia_maxwidth', 0, PARAM_INT);
$pref = get_user_preferences('repository_wikimedia_maxwidth', WIKIMEDIA_IMAGE_SIDE_LENGTH);
if ($param > 0 && $param != $pref) {
$pref = $param;
set_user_preference('repository_w... | [
"public",
"function",
"get_maxwidth",
"(",
")",
"{",
"$",
"param",
"=",
"optional_param",
"(",
"'wikimedia_maxwidth'",
",",
"0",
",",
"PARAM_INT",
")",
";",
"$",
"pref",
"=",
"get_user_preferences",
"(",
"'repository_wikimedia_maxwidth'",
",",
"WIKIMEDIA_IMAGE_SIDE_... | Returns maximum width for images
Takes the maximum width for images eithre from search form or from
user preferences, updates user preferences if needed
@return int | [
"Returns",
"maximum",
"width",
"for",
"images"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/wikimedia/lib.php#L49-L57 |
219,887 | moodle/moodle | repository/wikimedia/lib.php | repository_wikimedia.get_maxheight | public function get_maxheight() {
$param = optional_param('wikimedia_maxheight', 0, PARAM_INT);
$pref = get_user_preferences('repository_wikimedia_maxheight', WIKIMEDIA_IMAGE_SIDE_LENGTH);
if ($param > 0 && $param != $pref) {
$pref = $param;
set_user_preference('repositor... | php | public function get_maxheight() {
$param = optional_param('wikimedia_maxheight', 0, PARAM_INT);
$pref = get_user_preferences('repository_wikimedia_maxheight', WIKIMEDIA_IMAGE_SIDE_LENGTH);
if ($param > 0 && $param != $pref) {
$pref = $param;
set_user_preference('repositor... | [
"public",
"function",
"get_maxheight",
"(",
")",
"{",
"$",
"param",
"=",
"optional_param",
"(",
"'wikimedia_maxheight'",
",",
"0",
",",
"PARAM_INT",
")",
";",
"$",
"pref",
"=",
"get_user_preferences",
"(",
"'repository_wikimedia_maxheight'",
",",
"WIKIMEDIA_IMAGE_SI... | Returns maximum height for images
Takes the maximum height for images eithre from search form or from
user preferences, updates user preferences if needed
@return int | [
"Returns",
"maximum",
"height",
"for",
"images"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/wikimedia/lib.php#L67-L75 |
219,888 | moodle/moodle | repository/wikimedia/lib.php | repository_wikimedia.print_login | public function print_login() {
$keyword = new stdClass();
$keyword->label = get_string('keyword', 'repository_wikimedia').': ';
$keyword->id = 'input_text_keyword';
$keyword->type = 'text';
$keyword->name = 'wikimedia_keyword';
$keyword->value = '';
$maxwidt... | php | public function print_login() {
$keyword = new stdClass();
$keyword->label = get_string('keyword', 'repository_wikimedia').': ';
$keyword->id = 'input_text_keyword';
$keyword->type = 'text';
$keyword->name = 'wikimedia_keyword';
$keyword->value = '';
$maxwidt... | [
"public",
"function",
"print_login",
"(",
")",
"{",
"$",
"keyword",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"keyword",
"->",
"label",
"=",
"get_string",
"(",
"'keyword'",
",",
"'repository_wikimedia'",
")",
".",
"': '",
";",
"$",
"keyword",
"->",
"id... | this function will be called to print a login form. | [
"this",
"function",
"will",
"be",
"called",
"to",
"print",
"a",
"login",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/wikimedia/lib.php#L120-L158 |
219,889 | moodle/moodle | tag/classes/manage_table.php | core_tag_manage_table.col_isstandard | public function col_isstandard($tag) {
global $OUTPUT;
$tagoutput = new core_tag\output\tagisstandard($tag);
return $tagoutput->render($OUTPUT);
} | php | public function col_isstandard($tag) {
global $OUTPUT;
$tagoutput = new core_tag\output\tagisstandard($tag);
return $tagoutput->render($OUTPUT);
} | [
"public",
"function",
"col_isstandard",
"(",
"$",
"tag",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"tagoutput",
"=",
"new",
"core_tag",
"\\",
"output",
"\\",
"tagisstandard",
"(",
"$",
"tag",
")",
";",
"return",
"$",
"tagoutput",
"->",
"render",
"(",
... | Column tag type
@param stdClass $tag
@return string | [
"Column",
"tag",
"type"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/manage_table.php#L241-L245 |
219,890 | moodle/moodle | question/engine/datalib.php | question_engine_data_mapper.load_questions_usages_question_state_summary | public function load_questions_usages_question_state_summary(
qubaid_condition $qubaids, $slots) {
list($slottest, $params) = $this->db->get_in_or_equal($slots, SQL_PARAMS_NAMED, 'slot');
$rs = $this->db->get_recordset_sql("
SELECT
qa.slot,
qa.questionid,
q.name,
CASE qas.st... | php | public function load_questions_usages_question_state_summary(
qubaid_condition $qubaids, $slots) {
list($slottest, $params) = $this->db->get_in_or_equal($slots, SQL_PARAMS_NAMED, 'slot');
$rs = $this->db->get_recordset_sql("
SELECT
qa.slot,
qa.questionid,
q.name,
CASE qas.st... | [
"public",
"function",
"load_questions_usages_question_state_summary",
"(",
"qubaid_condition",
"$",
"qubaids",
",",
"$",
"slots",
")",
"{",
"list",
"(",
"$",
"slottest",
",",
"$",
"params",
")",
"=",
"$",
"this",
"->",
"db",
"->",
"get_in_or_equal",
"(",
"$",
... | Load summary information about the state of each question in a group of
attempts. This is used, for example, by the quiz manual grading report,
to show how many attempts at each question need to be graded.
This method may be called publicly.
@param qubaid_condition $qubaids used to restrict which usages are included
... | [
"Load",
"summary",
"information",
"about",
"the",
"state",
"of",
"each",
"question",
"in",
"a",
"group",
"of",
"attempts",
".",
"This",
"is",
"used",
"for",
"example",
"by",
"the",
"quiz",
"manual",
"grading",
"report",
"to",
"show",
"how",
"many",
"attemp... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/datalib.php#L608-L670 |
219,891 | moodle/moodle | question/engine/datalib.php | question_engine_data_mapper.load_average_marks | public function load_average_marks(qubaid_condition $qubaids, $slots = null) {
if (!empty($slots)) {
list($slottest, $slotsparams) = $this->db->get_in_or_equal(
$slots, SQL_PARAMS_NAMED, 'slot');
$slotwhere = " AND qa.slot {$slottest}";
} else {
$s... | php | public function load_average_marks(qubaid_condition $qubaids, $slots = null) {
if (!empty($slots)) {
list($slottest, $slotsparams) = $this->db->get_in_or_equal(
$slots, SQL_PARAMS_NAMED, 'slot');
$slotwhere = " AND qa.slot {$slottest}";
} else {
$s... | [
"public",
"function",
"load_average_marks",
"(",
"qubaid_condition",
"$",
"qubaids",
",",
"$",
"slots",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"slots",
")",
")",
"{",
"list",
"(",
"$",
"slottest",
",",
"$",
"slotsparams",
")",
"=",
... | Load the average mark, and number of attempts, for each slot in a set of
question usages..
This method may be called publicly.
@param qubaid_condition $qubaids used to restrict which usages are included
in the query. See {@link qubaid_condition}.
@param array $slots if null, load info for all quesitions, otherwise on... | [
"Load",
"the",
"average",
"mark",
"and",
"number",
"of",
"attempts",
"for",
"each",
"slot",
"in",
"a",
"set",
"of",
"question",
"usages",
".."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/datalib.php#L773-L812 |
219,892 | moodle/moodle | question/engine/datalib.php | question_engine_data_mapper.load_attempts_at_question | public function load_attempts_at_question($questionid, qubaid_condition $qubaids) {
$sql = "
SELECT
quba.contextid,
quba.preferredbehaviour,
qa.id AS questionattemptid,
qa.questionusageid,
qa.slot,
qa.behaviour,
qa.questionid,
qa.variant,
qa.maxmark,
qa.minfraction,
q... | php | public function load_attempts_at_question($questionid, qubaid_condition $qubaids) {
$sql = "
SELECT
quba.contextid,
quba.preferredbehaviour,
qa.id AS questionattemptid,
qa.questionusageid,
qa.slot,
qa.behaviour,
qa.questionid,
qa.variant,
qa.maxmark,
qa.minfraction,
q... | [
"public",
"function",
"load_attempts_at_question",
"(",
"$",
"questionid",
",",
"qubaid_condition",
"$",
"qubaids",
")",
"{",
"$",
"sql",
"=",
"\"\nSELECT\n quba.contextid,\n quba.preferredbehaviour,\n qa.id AS questionattemptid,\n qa.questionusageid,\n qa.slot,\n qa.... | Load all the attempts at a given queston from a set of question_usages.
steps.
This method may be called publicly.
@param int $questionid the question to load all the attempts fors.
@param qubaid_condition $qubaids used to restrict which usages are included
in the query. See {@link qubaid_condition}.
@return question... | [
"Load",
"all",
"the",
"attempts",
"at",
"a",
"given",
"queston",
"from",
"a",
"set",
"of",
"question_usages",
".",
"steps",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/datalib.php#L825-L884 |
219,893 | moodle/moodle | question/engine/datalib.php | question_engine_data_mapper.update_questions_usage_by_activity | public function update_questions_usage_by_activity(question_usage_by_activity $quba) {
$record = new stdClass();
$record->id = $quba->get_id();
$record->contextid = $quba->get_owning_context()->id;
$record->component = $quba->get_owning_component();
$record->preferredbehaviour = ... | php | public function update_questions_usage_by_activity(question_usage_by_activity $quba) {
$record = new stdClass();
$record->id = $quba->get_id();
$record->contextid = $quba->get_owning_context()->id;
$record->component = $quba->get_owning_component();
$record->preferredbehaviour = ... | [
"public",
"function",
"update_questions_usage_by_activity",
"(",
"question_usage_by_activity",
"$",
"quba",
")",
"{",
"$",
"record",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"record",
"->",
"id",
"=",
"$",
"quba",
"->",
"get_id",
"(",
")",
";",
"$",
"re... | Update a question_usages row to refect any changes in a usage (but not
any of its question_attempts.
You should not call this method directly. You should use
@link question_engine::save_questions_usage_by_activity()}.
@param question_usage_by_activity $quba the usage that has changed. | [
"Update",
"a",
"question_usages",
"row",
"to",
"refect",
"any",
"changes",
"in",
"a",
"usage",
"(",
"but",
"not",
"any",
"of",
"its",
"question_attempts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/datalib.php#L895-L903 |
219,894 | moodle/moodle | question/engine/datalib.php | question_engine_data_mapper.delete_questions_usage_by_activities | public function delete_questions_usage_by_activities(qubaid_condition $qubaids) {
$where = "qa.questionusageid {$qubaids->usage_id_in()}";
$params = $qubaids->usage_id_in_params();
$contextids = $this->db->get_records_sql_menu("
SELECT DISTINCT contextid, 1
FROM ... | php | public function delete_questions_usage_by_activities(qubaid_condition $qubaids) {
$where = "qa.questionusageid {$qubaids->usage_id_in()}";
$params = $qubaids->usage_id_in_params();
$contextids = $this->db->get_records_sql_menu("
SELECT DISTINCT contextid, 1
FROM ... | [
"public",
"function",
"delete_questions_usage_by_activities",
"(",
"qubaid_condition",
"$",
"qubaids",
")",
"{",
"$",
"where",
"=",
"\"qa.questionusageid {$qubaids->usage_id_in()}\"",
";",
"$",
"params",
"=",
"$",
"qubaids",
"->",
"usage_id_in_params",
"(",
")",
";",
... | Delete a question_usage_by_activity and all its associated
You should not call this method directly. You should use
@link question_engine::delete_questions_usage_by_activities()}.
{@link question_attempts} and {@link question_attempt_steps} from the
database.
@param qubaid_condition $qubaids identifies which question... | [
"Delete",
"a",
"question_usage_by_activity",
"and",
"all",
"its",
"associated"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/datalib.php#L941-L979 |
219,895 | moodle/moodle | question/engine/datalib.php | question_engine_data_mapper.delete_steps | public function delete_steps($stepids, $context) {
if (empty($stepids)) {
return;
}
list($test, $params) = $this->db->get_in_or_equal($stepids, SQL_PARAMS_NAMED);
$this->delete_response_files($context->id, $test, $params);
$this->db->delete_records_select('question_... | php | public function delete_steps($stepids, $context) {
if (empty($stepids)) {
return;
}
list($test, $params) = $this->db->get_in_or_equal($stepids, SQL_PARAMS_NAMED);
$this->delete_response_files($context->id, $test, $params);
$this->db->delete_records_select('question_... | [
"public",
"function",
"delete_steps",
"(",
"$",
"stepids",
",",
"$",
"context",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"stepids",
")",
")",
"{",
"return",
";",
"}",
"list",
"(",
"$",
"test",
",",
"$",
"params",
")",
"=",
"$",
"this",
"->",
"db",... | Delete all the steps for a question attempt.
Private method, only for use by other parts of the question engine.
@param int $qaids question_attempt id.
@param context $context the context that the $quba belongs to. | [
"Delete",
"all",
"the",
"steps",
"for",
"a",
"question",
"attempt",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/datalib.php#L1016-L1028 |
219,896 | moodle/moodle | question/engine/datalib.php | question_engine_data_mapper.delete_response_files | protected function delete_response_files($contextid, $itemidstest, $params) {
$fs = get_file_storage();
foreach (question_engine::get_all_response_file_areas() as $filearea) {
$fs->delete_area_files_select($contextid, 'question', $filearea,
$itemidstest, $params);
... | php | protected function delete_response_files($contextid, $itemidstest, $params) {
$fs = get_file_storage();
foreach (question_engine::get_all_response_file_areas() as $filearea) {
$fs->delete_area_files_select($contextid, 'question', $filearea,
$itemidstest, $params);
... | [
"protected",
"function",
"delete_response_files",
"(",
"$",
"contextid",
",",
"$",
"itemidstest",
",",
"$",
"params",
")",
"{",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"foreach",
"(",
"question_engine",
"::",
"get_all_response_file_areas",
"(",
")",
... | Delete all the files belonging to the response variables in the gives
question attempt steps.
@param int $contextid the context these attempts belong to.
@param string $itemidstest a bit of SQL that can be used in a
WHERE itemid $itemidstest clause. Must use named params.
@param array $params any query parameters used ... | [
"Delete",
"all",
"the",
"files",
"belonging",
"to",
"the",
"response",
"variables",
"in",
"the",
"gives",
"question",
"attempt",
"steps",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/datalib.php#L1038-L1044 |
219,897 | moodle/moodle | question/engine/datalib.php | question_engine_data_mapper.delete_previews | public function delete_previews($questionid) {
$previews = $this->db->get_records_sql_menu("
SELECT DISTINCT quba.id, 1
FROM {question_usages} quba
JOIN {question_attempts} qa ON qa.questionusageid = quba.id
WHERE quba.component = 'core_question_pr... | php | public function delete_previews($questionid) {
$previews = $this->db->get_records_sql_menu("
SELECT DISTINCT quba.id, 1
FROM {question_usages} quba
JOIN {question_attempts} qa ON qa.questionusageid = quba.id
WHERE quba.component = 'core_question_pr... | [
"public",
"function",
"delete_previews",
"(",
"$",
"questionid",
")",
"{",
"$",
"previews",
"=",
"$",
"this",
"->",
"db",
"->",
"get_records_sql_menu",
"(",
"\"\n SELECT DISTINCT quba.id, 1\n FROM {question_usages} quba\n JOIN {questio... | Delete all the previews for a given question.
Private method, only for use by other parts of the question engine.
@param int $questionid question id. | [
"Delete",
"all",
"the",
"previews",
"for",
"a",
"given",
"question",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/datalib.php#L1053-L1064 |
219,898 | moodle/moodle | question/engine/datalib.php | question_engine_data_mapper.update_question_attempt_flag | public function update_question_attempt_flag($qubaid, $questionid, $qaid, $slot, $newstate) {
if (!$this->db->record_exists('question_attempts', array('id' => $qaid,
'questionusageid' => $qubaid, 'questionid' => $questionid, 'slot' => $slot))) {
throw new moodle_exception('errorsavin... | php | public function update_question_attempt_flag($qubaid, $questionid, $qaid, $slot, $newstate) {
if (!$this->db->record_exists('question_attempts', array('id' => $qaid,
'questionusageid' => $qubaid, 'questionid' => $questionid, 'slot' => $slot))) {
throw new moodle_exception('errorsavin... | [
"public",
"function",
"update_question_attempt_flag",
"(",
"$",
"qubaid",
",",
"$",
"questionid",
",",
"$",
"qaid",
",",
"$",
"slot",
",",
"$",
"newstate",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"db",
"->",
"record_exists",
"(",
"'question_attempts'"... | Update the flagged state of a question in the database.
You should call {@link question_engine::update_flag()()}
rather than calling this method directly.
@param int $qubaid the question usage id.
@param int $questionid the question id.
@param int $sessionid the question_attempt id.
@param bool $newstate the new stat... | [
"Update",
"the",
"flagged",
"state",
"of",
"a",
"question",
"in",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/datalib.php#L1077-L1084 |
219,899 | moodle/moodle | question/engine/datalib.php | question_engine_data_mapper.questions_in_use | public function questions_in_use(array $questionids, qubaid_condition $qubaids) {
list($test, $params) = $this->db->get_in_or_equal($questionids);
return $this->db->record_exists_select('question_attempts',
'questionid ' . $test . ' AND questionusageid ' .
$qubaids->usage... | php | public function questions_in_use(array $questionids, qubaid_condition $qubaids) {
list($test, $params) = $this->db->get_in_or_equal($questionids);
return $this->db->record_exists_select('question_attempts',
'questionid ' . $test . ' AND questionusageid ' .
$qubaids->usage... | [
"public",
"function",
"questions_in_use",
"(",
"array",
"$",
"questionids",
",",
"qubaid_condition",
"$",
"qubaids",
")",
"{",
"list",
"(",
"$",
"test",
",",
"$",
"params",
")",
"=",
"$",
"this",
"->",
"db",
"->",
"get_in_or_equal",
"(",
"$",
"questionids"... | Are any of these questions are currently in use?
You should call {@link question_engine::questions_in_use()}
rather than calling this method directly.
@param array $questionids of question ids.
@param qubaid_condition $qubaids ids of the usages to consider.
@return bool whether any of these questions are being used b... | [
"Are",
"any",
"of",
"these",
"questions",
"are",
"currently",
"in",
"use?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/datalib.php#L1244-L1249 |
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.