id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
218,000 | moodle/moodle | lib/classes/user.php | core_user.get_property_choices | public static function get_property_choices($property) {
self::fill_properties_cache();
if (!array_key_exists($property, self::$propertiescache) && !array_key_exists('choices',
self::$propertiescache[$property])) {
throw new coding_exception('Invalid property requested, or... | php | public static function get_property_choices($property) {
self::fill_properties_cache();
if (!array_key_exists($property, self::$propertiescache) && !array_key_exists('choices',
self::$propertiescache[$property])) {
throw new coding_exception('Invalid property requested, or... | [
"public",
"static",
"function",
"get_property_choices",
"(",
"$",
"property",
")",
"{",
"self",
"::",
"fill_properties_cache",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"property",
",",
"self",
"::",
"$",
"propertiescache",
")",
"&&",
"!",... | Get the choices of the property.
This is a helper method to validate a value against a list of acceptable choices.
For instance: country, language, themes and etc.
@param string $property property name to be retrieved.
@throws coding_exception if the requested property name is invalid or if it does not has a list of ... | [
"Get",
"the",
"choices",
"of",
"the",
"property",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L900-L911 |
218,001 | moodle/moodle | lib/classes/user.php | core_user.get_property_default | public static function get_property_default($property) {
self::fill_properties_cache();
if (!array_key_exists($property, self::$propertiescache) || !isset(self::$propertiescache[$property]['default'])) {
throw new coding_exception('Invalid property requested, or the property does not has a... | php | public static function get_property_default($property) {
self::fill_properties_cache();
if (!array_key_exists($property, self::$propertiescache) || !isset(self::$propertiescache[$property]['default'])) {
throw new coding_exception('Invalid property requested, or the property does not has a... | [
"public",
"static",
"function",
"get_property_default",
"(",
"$",
"property",
")",
"{",
"self",
"::",
"fill_properties_cache",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"property",
",",
"self",
"::",
"$",
"propertiescache",
")",
"||",
"!",... | Get the property default.
This method gets the default value of a field (if exists).
@param string $property property name to be retrieved.
@throws coding_exception if the requested property name is invalid or if it does not has a default value.
@return string the property default value. | [
"Get",
"the",
"property",
"default",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L922-L931 |
218,002 | moodle/moodle | lib/classes/user.php | core_user.fill_preferences_cache | protected static function fill_preferences_cache() {
if (self::$preferencescache !== null) {
return;
}
// Array of user preferences and expected types/values.
// Every preference that can be updated directly by user should be added here.
$preferences = array();
... | php | protected static function fill_preferences_cache() {
if (self::$preferencescache !== null) {
return;
}
// Array of user preferences and expected types/values.
// Every preference that can be updated directly by user should be added here.
$preferences = array();
... | [
"protected",
"static",
"function",
"fill_preferences_cache",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"preferencescache",
"!==",
"null",
")",
"{",
"return",
";",
"}",
"// Array of user preferences and expected types/values.",
"// Every preference that can be updated dir... | Definition of updateable user preferences and rules for data and access validation.
array(
'preferencename' => array( // Either exact preference name or a regular expression.
'null' => NULL_ALLOWED, // Defaults to NULL_NOT_ALLOWED. Takes NULL_NOT_ALLOWED or NULL_ALLOWED.
'type' => PARAM_TYPE, // Expected ... | [
"Definition",
"of",
"updateable",
"user",
"preferences",
"and",
"rules",
"for",
"data",
"and",
"access",
"validation",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L953-L1012 |
218,003 | moodle/moodle | lib/classes/user.php | core_user.get_preference_definition | protected static function get_preference_definition($preferencename) {
self::fill_preferences_cache();
foreach (self::$preferencescache as $key => $preference) {
if (empty($preference['isregex'])) {
if ($key === $preferencename) {
return $preference;
... | php | protected static function get_preference_definition($preferencename) {
self::fill_preferences_cache();
foreach (self::$preferencescache as $key => $preference) {
if (empty($preference['isregex'])) {
if ($key === $preferencename) {
return $preference;
... | [
"protected",
"static",
"function",
"get_preference_definition",
"(",
"$",
"preferencename",
")",
"{",
"self",
"::",
"fill_preferences_cache",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"preferencescache",
"as",
"$",
"key",
"=>",
"$",
"preference",
")",
... | Retrieves the preference definition
@param string $preferencename
@return array | [
"Retrieves",
"the",
"preference",
"definition"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L1020-L1036 |
218,004 | moodle/moodle | lib/classes/user.php | core_user.clean_preference | public static function clean_preference($value, $preferencename) {
$definition = self::get_preference_definition($preferencename);
if (isset($definition['type']) && $value !== null) {
$value = clean_param($value, $definition['type']);
}
if (isset($definition['cleancallback... | php | public static function clean_preference($value, $preferencename) {
$definition = self::get_preference_definition($preferencename);
if (isset($definition['type']) && $value !== null) {
$value = clean_param($value, $definition['type']);
}
if (isset($definition['cleancallback... | [
"public",
"static",
"function",
"clean_preference",
"(",
"$",
"value",
",",
"$",
"preferencename",
")",
"{",
"$",
"definition",
"=",
"self",
"::",
"get_preference_definition",
"(",
"$",
"preferencename",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"definition",
... | Clean value of a user preference
@param string $value the user preference value to be cleaned.
@param string $preferencename the user preference name
@return string the cleaned preference value | [
"Clean",
"value",
"of",
"a",
"user",
"preference"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L1114-L1148 |
218,005 | moodle/moodle | analytics/classes/local/indicator/discrete.php | discrete.to_features | protected function to_features($calculatedvalues) {
$classes = static::get_classes();
foreach ($calculatedvalues as $sampleid => $calculatedvalue) {
// Using intval as it may come as a float from the db.
$classindex = array_search(intval($calculatedvalue), $classes, true);
... | php | protected function to_features($calculatedvalues) {
$classes = static::get_classes();
foreach ($calculatedvalues as $sampleid => $calculatedvalue) {
// Using intval as it may come as a float from the db.
$classindex = array_search(intval($calculatedvalue), $classes, true);
... | [
"protected",
"function",
"to_features",
"(",
"$",
"calculatedvalues",
")",
"{",
"$",
"classes",
"=",
"static",
"::",
"get_classes",
"(",
")",
";",
"foreach",
"(",
"$",
"calculatedvalues",
"as",
"$",
"sampleid",
"=>",
"$",
"calculatedvalue",
")",
"{",
"// Usi... | From calculated values to dataset features.
One column for each class.
@param float[] $calculatedvalues
@return float[] | [
"From",
"calculated",
"values",
"to",
"dataset",
"features",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/discrete.php#L116-L142 |
218,006 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/Injector/AutoParagraph.php | HTMLPurifier_Injector_AutoParagraph._checkNeedsP | private function _checkNeedsP($current)
{
if ($current instanceof HTMLPurifier_Token_Start) {
if (!$this->_isInline($current)) {
// <div>PAR1<div>
// ----
// Terminate early, since we hit a block element
return false;
... | php | private function _checkNeedsP($current)
{
if ($current instanceof HTMLPurifier_Token_Start) {
if (!$this->_isInline($current)) {
// <div>PAR1<div>
// ----
// Terminate early, since we hit a block element
return false;
... | [
"private",
"function",
"_checkNeedsP",
"(",
"$",
"current",
")",
"{",
"if",
"(",
"$",
"current",
"instanceof",
"HTMLPurifier_Token_Start",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_isInline",
"(",
"$",
"current",
")",
")",
"{",
"// <div>PAR1<div>",
"/... | Determines if a particular token requires an earlier inline token
to get a paragraph. This should be used with _forwardUntilEndToken
@param HTMLPurifier_Token $current
@return bool | [
"Determines",
"if",
"a",
"particular",
"token",
"requires",
"an",
"earlier",
"inline",
"token",
"to",
"get",
"a",
"paragraph",
".",
"This",
"should",
"be",
"used",
"with",
"_forwardUntilEndToken"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Injector/AutoParagraph.php#L333-L353 |
218,007 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree/DecisionTreeLeaf.php | DecisionTreeLeaf.getHTML | public function getHTML($columnNames = null)
{
if ($this->isTerminal) {
$value = "<b>$this->classValue</b>";
} else {
$value = $this->value;
if ($columnNames !== null) {
$col = $columnNames[$this->columnIndex];
} else {
... | php | public function getHTML($columnNames = null)
{
if ($this->isTerminal) {
$value = "<b>$this->classValue</b>";
} else {
$value = $this->value;
if ($columnNames !== null) {
$col = $columnNames[$this->columnIndex];
} else {
... | [
"public",
"function",
"getHTML",
"(",
"$",
"columnNames",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isTerminal",
")",
"{",
"$",
"value",
"=",
"\"<b>$this->classValue</b>\"",
";",
"}",
"else",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"valu... | Returns HTML representation of the node including children nodes
@param $columnNames
@return string | [
"Returns",
"HTML",
"representation",
"of",
"the",
"node",
"including",
"children",
"nodes"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree/DecisionTreeLeaf.php#L127-L162 |
218,008 | moodle/moodle | customfield/classes/field_config_form.php | field_config_form.validation | public function validation($data, $files = array()) {
global $DB;
$errors = array();
/** @var field_controller $field */
$field = $this->_customdata['field'];
$handler = $field->get_handler();
// Check the shortname is specified and is unique for this component-area-ite... | php | public function validation($data, $files = array()) {
global $DB;
$errors = array();
/** @var field_controller $field */
$field = $this->_customdata['field'];
$handler = $field->get_handler();
// Check the shortname is specified and is unique for this component-area-ite... | [
"public",
"function",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"/** @var field_controller $field */",
"$",
"field",
"=",
"$",
"this",
"->"... | Field data validation
@param array $data
@param array $files
@return array | [
"Field",
"data",
"validation"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/field_config_form.php#L110-L133 |
218,009 | moodle/moodle | lib/filebrowser/file_info_context_module.php | file_info_context_module.is_empty_area | public function is_empty_area() {
if ($child = $this->get_area_backup(0, '/', '.')) {
if (!$child->is_empty_area()) {
return false;
}
}
if ($child = $this->get_area_intro(0, '/', '.')) {
if (!$child->is_empty_area()) {
return fa... | php | public function is_empty_area() {
if ($child = $this->get_area_backup(0, '/', '.')) {
if (!$child->is_empty_area()) {
return false;
}
}
if ($child = $this->get_area_intro(0, '/', '.')) {
if (!$child->is_empty_area()) {
return fa... | [
"public",
"function",
"is_empty_area",
"(",
")",
"{",
"if",
"(",
"$",
"child",
"=",
"$",
"this",
"->",
"get_area_backup",
"(",
"0",
",",
"'/'",
",",
"'.'",
")",
")",
"{",
"if",
"(",
"!",
"$",
"child",
"->",
"is_empty_area",
"(",
")",
")",
"{",
"r... | Whether or not this is an emtpy area
@return bool | [
"Whether",
"or",
"not",
"this",
"is",
"an",
"emtpy",
"area"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info_context_module.php#L215-L236 |
218,010 | moodle/moodle | admin/tool/dataprivacy/classes/manager_observer.php | manager_observer.handle_component_failure | public function handle_component_failure($e, $component, $interface, $methodname, array $params) {
// Get the list of the site Data Protection Officers.
$dpos = api::get_site_dpos();
$messagesubject = get_string('exceptionnotificationsubject', 'tool_dataprivacy');
$a = (object)[
... | php | public function handle_component_failure($e, $component, $interface, $methodname, array $params) {
// Get the list of the site Data Protection Officers.
$dpos = api::get_site_dpos();
$messagesubject = get_string('exceptionnotificationsubject', 'tool_dataprivacy');
$a = (object)[
... | [
"public",
"function",
"handle_component_failure",
"(",
"$",
"e",
",",
"$",
"component",
",",
"$",
"interface",
",",
"$",
"methodname",
",",
"array",
"$",
"params",
")",
"{",
"// Get the list of the site Data Protection Officers.",
"$",
"dpos",
"=",
"api",
"::",
... | Notifies all DPOs that an exception occurred.
@param \Throwable $e
@param string $component
@param string $interface
@param string $methodname
@param array $params | [
"Notifies",
"all",
"DPOs",
"that",
"an",
"exception",
"occurred",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/manager_observer.php#L45-L75 |
218,011 | moodle/moodle | lib/adodb/drivers/adodb-ado.inc.php | ADORecordSet_ado._seek | function _seek($row)
{
$rs = $this->_queryID;
// absoluteposition doesn't work -- my maths is wrong ?
// $rs->AbsolutePosition->$row-2;
// return true;
if ($this->_currentRow > $row) return false;
@$rs->Move((integer)$row - $this->_currentRow-1); //adBookmarkFirst
return true;
} | php | function _seek($row)
{
$rs = $this->_queryID;
// absoluteposition doesn't work -- my maths is wrong ?
// $rs->AbsolutePosition->$row-2;
// return true;
if ($this->_currentRow > $row) return false;
@$rs->Move((integer)$row - $this->_currentRow-1); //adBookmarkFirst
return true;
} | [
"function",
"_seek",
"(",
"$",
"row",
")",
"{",
"$",
"rs",
"=",
"$",
"this",
"->",
"_queryID",
";",
"// absoluteposition doesn't work -- my maths is wrong ?",
"//\t$rs->AbsolutePosition->$row-2;",
"//\treturn true;",
"if",
"(",
"$",
"this",
"->",
"_currentRow",
">",
... | should only be used to move forward as we normally use forward-only cursors | [
"should",
"only",
"be",
"used",
"to",
"move",
"forward",
"as",
"we",
"normally",
"use",
"forward",
"-",
"only",
"cursors"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-ado.inc.php#L401-L410 |
218,012 | moodle/moodle | enrol/category/classes/observer.php | enrol_category_observer.role_assigned | public static function role_assigned(\core\event\role_assigned $event) {
global $DB;
if (!enrol_is_enabled('category')) {
return;
}
$ra = new stdClass();
$ra->roleid = $event->objectid;
$ra->userid = $event->relateduserid;
$ra->contextid = $event->co... | php | public static function role_assigned(\core\event\role_assigned $event) {
global $DB;
if (!enrol_is_enabled('category')) {
return;
}
$ra = new stdClass();
$ra->roleid = $event->objectid;
$ra->userid = $event->relateduserid;
$ra->contextid = $event->co... | [
"public",
"static",
"function",
"role_assigned",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"role_assigned",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"enrol_is_enabled",
"(",
"'category'",
")",
")",
"{",
"return",
";",
"}",
"$",
"... | Triggered when user is assigned a new role.
@param \core\event\role_assigned $event | [
"Triggered",
"when",
"user",
"is",
"assigned",
"a",
"new",
"role",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/category/classes/observer.php#L40-L92 |
218,013 | moodle/moodle | enrol/category/classes/observer.php | enrol_category_observer.role_unassigned | public static function role_unassigned(\core\event\role_unassigned $event) {
global $DB;
if (!enrol_is_enabled('category')) {
return;
}
$ra = new stdClass();
$ra->userid = $event->relateduserid;
$ra->contextid = $event->contextid;
// only category l... | php | public static function role_unassigned(\core\event\role_unassigned $event) {
global $DB;
if (!enrol_is_enabled('category')) {
return;
}
$ra = new stdClass();
$ra->userid = $event->relateduserid;
$ra->contextid = $event->contextid;
// only category l... | [
"public",
"static",
"function",
"role_unassigned",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"role_unassigned",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"enrol_is_enabled",
"(",
"'category'",
")",
")",
"{",
"return",
";",
"}",
"$",... | Triggered when user role is unassigned.
@param \core\event\role_unassigned $event | [
"Triggered",
"when",
"user",
"role",
"is",
"unassigned",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/category/classes/observer.php#L99-L152 |
218,014 | moodle/moodle | admin/roles/classes/override_permissions_table_advanced.php | core_role_override_permissions_table_advanced.get_row_attributes | protected function get_row_attributes($capability) {
$rowattributes = parent::get_row_attributes($capability);
if ($this->permissions[$capability->name] !== 0) {
if (empty($rowattributes['class'])) {
$rowattributes['class'] = "overriddenpermission";
} else {
... | php | protected function get_row_attributes($capability) {
$rowattributes = parent::get_row_attributes($capability);
if ($this->permissions[$capability->name] !== 0) {
if (empty($rowattributes['class'])) {
$rowattributes['class'] = "overriddenpermission";
} else {
... | [
"protected",
"function",
"get_row_attributes",
"(",
"$",
"capability",
")",
"{",
"$",
"rowattributes",
"=",
"parent",
"::",
"get_row_attributes",
"(",
"$",
"capability",
")",
";",
"if",
"(",
"$",
"this",
"->",
"permissions",
"[",
"$",
"capability",
"->",
"na... | This method adds an additional class to a row if capability is other than inherited.
@param stdClass $capability
@return array | [
"This",
"method",
"adds",
"an",
"additional",
"class",
"to",
"a",
"row",
"if",
"capability",
"is",
"other",
"than",
"inherited",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/roles/classes/override_permissions_table_advanced.php#L65-L75 |
218,015 | moodle/moodle | lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php | CellValueFormatter.formatStringCellValue | protected function formatStringCellValue($node)
{
$pNodeValues = [];
$pNodes = $node->getElementsByTagName(self::XML_NODE_P);
foreach ($pNodes as $pNode) {
$currentPValue = '';
foreach ($pNode->childNodes as $childNode) {
if ($childNode instanceof \D... | php | protected function formatStringCellValue($node)
{
$pNodeValues = [];
$pNodes = $node->getElementsByTagName(self::XML_NODE_P);
foreach ($pNodes as $pNode) {
$currentPValue = '';
foreach ($pNode->childNodes as $childNode) {
if ($childNode instanceof \D... | [
"protected",
"function",
"formatStringCellValue",
"(",
"$",
"node",
")",
"{",
"$",
"pNodeValues",
"=",
"[",
"]",
";",
"$",
"pNodes",
"=",
"$",
"node",
"->",
"getElementsByTagName",
"(",
"self",
"::",
"XML_NODE_P",
")",
";",
"foreach",
"(",
"$",
"pNodes",
... | Returns the cell String value.
@param \DOMNode $node
@return string The value associated with the cell | [
"Returns",
"the",
"cell",
"String",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php#L93-L119 |
218,016 | moodle/moodle | lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php | CellValueFormatter.formatFloatCellValue | protected function formatFloatCellValue($node)
{
$nodeValue = $node->getAttribute(self::XML_ATTRIBUTE_VALUE);
$nodeIntValue = intval($nodeValue);
// The "==" is intentionally not a "===" because only the value matters, not the type
$cellValue = ($nodeIntValue == $nodeValue) ? $nodeIn... | php | protected function formatFloatCellValue($node)
{
$nodeValue = $node->getAttribute(self::XML_ATTRIBUTE_VALUE);
$nodeIntValue = intval($nodeValue);
// The "==" is intentionally not a "===" because only the value matters, not the type
$cellValue = ($nodeIntValue == $nodeValue) ? $nodeIn... | [
"protected",
"function",
"formatFloatCellValue",
"(",
"$",
"node",
")",
"{",
"$",
"nodeValue",
"=",
"$",
"node",
"->",
"getAttribute",
"(",
"self",
"::",
"XML_ATTRIBUTE_VALUE",
")",
";",
"$",
"nodeIntValue",
"=",
"intval",
"(",
"$",
"nodeValue",
")",
";",
... | Returns the cell Numeric value from the given node.
@param \DOMNode $node
@return int|float The value associated with the cell | [
"Returns",
"the",
"cell",
"Numeric",
"value",
"from",
"the",
"given",
"node",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php#L127-L134 |
218,017 | moodle/moodle | lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php | CellValueFormatter.formatBooleanCellValue | protected function formatBooleanCellValue($node)
{
$nodeValue = $node->getAttribute(self::XML_ATTRIBUTE_BOOLEAN_VALUE);
// !! is similar to boolval()
$cellValue = !!$nodeValue;
return $cellValue;
} | php | protected function formatBooleanCellValue($node)
{
$nodeValue = $node->getAttribute(self::XML_ATTRIBUTE_BOOLEAN_VALUE);
// !! is similar to boolval()
$cellValue = !!$nodeValue;
return $cellValue;
} | [
"protected",
"function",
"formatBooleanCellValue",
"(",
"$",
"node",
")",
"{",
"$",
"nodeValue",
"=",
"$",
"node",
"->",
"getAttribute",
"(",
"self",
"::",
"XML_ATTRIBUTE_BOOLEAN_VALUE",
")",
";",
"// !! is similar to boolval()",
"$",
"cellValue",
"=",
"!",
"!",
... | Returns the cell Boolean value from the given node.
@param \DOMNode $node
@return bool The value associated with the cell | [
"Returns",
"the",
"cell",
"Boolean",
"value",
"from",
"the",
"given",
"node",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php#L142-L148 |
218,018 | moodle/moodle | lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php | CellValueFormatter.formatDateCellValue | protected function formatDateCellValue($node)
{
// The XML node looks like this:
// <table:table-cell calcext:value-type="date" office:date-value="2016-05-19T16:39:00" office:value-type="date">
// <text:p>05/19/16 04:39 PM</text:p>
// </table:table-cell>
if ($this->shouldF... | php | protected function formatDateCellValue($node)
{
// The XML node looks like this:
// <table:table-cell calcext:value-type="date" office:date-value="2016-05-19T16:39:00" office:value-type="date">
// <text:p>05/19/16 04:39 PM</text:p>
// </table:table-cell>
if ($this->shouldF... | [
"protected",
"function",
"formatDateCellValue",
"(",
"$",
"node",
")",
"{",
"// The XML node looks like this:",
"// <table:table-cell calcext:value-type=\"date\" office:date-value=\"2016-05-19T16:39:00\" office:value-type=\"date\">",
"// <text:p>05/19/16 04:39 PM</text:p>",
"// </table:table... | Returns the cell Date value from the given node.
@param \DOMNode $node
@return \DateTime|string|null The value associated with the cell or NULL if invalid date value | [
"Returns",
"the",
"cell",
"Date",
"value",
"from",
"the",
"given",
"node",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php#L156-L176 |
218,019 | moodle/moodle | lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php | CellValueFormatter.formatTimeCellValue | protected function formatTimeCellValue($node)
{
// The XML node looks like this:
// <table:table-cell calcext:value-type="time" office:time-value="PT13H24M00S" office:value-type="time">
// <text:p>01:24:00 PM</text:p>
// </table:table-cell>
if ($this->shouldFormatDates) {
... | php | protected function formatTimeCellValue($node)
{
// The XML node looks like this:
// <table:table-cell calcext:value-type="time" office:time-value="PT13H24M00S" office:value-type="time">
// <text:p>01:24:00 PM</text:p>
// </table:table-cell>
if ($this->shouldFormatDates) {
... | [
"protected",
"function",
"formatTimeCellValue",
"(",
"$",
"node",
")",
"{",
"// The XML node looks like this:",
"// <table:table-cell calcext:value-type=\"time\" office:time-value=\"PT13H24M00S\" office:value-type=\"time\">",
"// <text:p>01:24:00 PM</text:p>",
"// </table:table-cell>",
"if... | Returns the cell Time value from the given node.
@param \DOMNode $node
@return \DateInterval|string|null The value associated with the cell or NULL if invalid time value | [
"Returns",
"the",
"cell",
"Time",
"value",
"from",
"the",
"given",
"node",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php#L184-L204 |
218,020 | moodle/moodle | lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php | CellValueFormatter.formatCurrencyCellValue | protected function formatCurrencyCellValue($node)
{
$value = $node->getAttribute(self::XML_ATTRIBUTE_VALUE);
$currency = $node->getAttribute(self::XML_ATTRIBUTE_CURRENCY);
return "$value $currency";
} | php | protected function formatCurrencyCellValue($node)
{
$value = $node->getAttribute(self::XML_ATTRIBUTE_VALUE);
$currency = $node->getAttribute(self::XML_ATTRIBUTE_CURRENCY);
return "$value $currency";
} | [
"protected",
"function",
"formatCurrencyCellValue",
"(",
"$",
"node",
")",
"{",
"$",
"value",
"=",
"$",
"node",
"->",
"getAttribute",
"(",
"self",
"::",
"XML_ATTRIBUTE_VALUE",
")",
";",
"$",
"currency",
"=",
"$",
"node",
"->",
"getAttribute",
"(",
"self",
... | Returns the cell Currency value from the given node.
@param \DOMNode $node
@return string The value associated with the cell (e.g. "100 USD" or "9.99 EUR") | [
"Returns",
"the",
"cell",
"Currency",
"value",
"from",
"the",
"given",
"node",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php#L212-L218 |
218,021 | moodle/moodle | lib/spout/src/Spout/Reader/CSV/RowIterator.php | RowIterator.rewindAndSkipBom | protected function rewindAndSkipBom()
{
$byteOffsetToSkipBom = $this->encodingHelper->getBytesOffsetToSkipBOM($this->filePointer, $this->encoding);
// sets the cursor after the BOM (0 means no BOM, so rewind it)
$this->globalFunctionsHelper->fseek($this->filePointer, $byteOffsetToSkipBom);
... | php | protected function rewindAndSkipBom()
{
$byteOffsetToSkipBom = $this->encodingHelper->getBytesOffsetToSkipBOM($this->filePointer, $this->encoding);
// sets the cursor after the BOM (0 means no BOM, so rewind it)
$this->globalFunctionsHelper->fseek($this->filePointer, $byteOffsetToSkipBom);
... | [
"protected",
"function",
"rewindAndSkipBom",
"(",
")",
"{",
"$",
"byteOffsetToSkipBom",
"=",
"$",
"this",
"->",
"encodingHelper",
"->",
"getBytesOffsetToSkipBOM",
"(",
"$",
"this",
"->",
"filePointer",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"// sets the c... | This rewinds and skips the BOM if inserted at the beginning of the file
by moving the file pointer after it, so that it is not read.
@return void | [
"This",
"rewinds",
"and",
"skips",
"the",
"BOM",
"if",
"inserted",
"at",
"the",
"beginning",
"of",
"the",
"file",
"by",
"moving",
"the",
"file",
"pointer",
"after",
"it",
"so",
"that",
"it",
"is",
"not",
"read",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/CSV/RowIterator.php#L97-L103 |
218,022 | moodle/moodle | lib/spout/src/Spout/Reader/CSV/RowIterator.php | RowIterator.getEncodedEOLDelimiter | protected function getEncodedEOLDelimiter()
{
if (!isset($this->encodedEOLDelimiter)) {
$this->encodedEOLDelimiter = $this->encodingHelper->attemptConversionFromUTF8($this->inputEOLDelimiter, $this->encoding);
}
return $this->encodedEOLDelimiter;
} | php | protected function getEncodedEOLDelimiter()
{
if (!isset($this->encodedEOLDelimiter)) {
$this->encodedEOLDelimiter = $this->encodingHelper->attemptConversionFromUTF8($this->inputEOLDelimiter, $this->encoding);
}
return $this->encodedEOLDelimiter;
} | [
"protected",
"function",
"getEncodedEOLDelimiter",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"encodedEOLDelimiter",
")",
")",
"{",
"$",
"this",
"->",
"encodedEOLDelimiter",
"=",
"$",
"this",
"->",
"encodingHelper",
"->",
"attemptConversio... | Returns the end of line delimiter, encoded using the same encoding as the CSV.
The return value is cached.
@return string | [
"Returns",
"the",
"end",
"of",
"line",
"delimiter",
"encoded",
"using",
"the",
"same",
"encoding",
"as",
"the",
"CSV",
".",
"The",
"return",
"value",
"is",
"cached",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/CSV/RowIterator.php#L211-L218 |
218,023 | moodle/moodle | admin/tool/policy/classes/output/acceptances_filter.php | acceptances_filter.add_filter | protected function add_filter($key, $value, $allowmultiple = false) {
if ($allowmultiple || empty($this->get_filter_values($key))) {
$this->filtersapplied[] = [$key, $value];
}
} | php | protected function add_filter($key, $value, $allowmultiple = false) {
if ($allowmultiple || empty($this->get_filter_values($key))) {
$this->filtersapplied[] = [$key, $value];
}
} | [
"protected",
"function",
"add_filter",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"allowmultiple",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"allowmultiple",
"||",
"empty",
"(",
"$",
"this",
"->",
"get_filter_values",
"(",
"$",
"key",
")",
")",
")",
... | Adds an applied filter
@param mixed $key
@param mixed $value
@param bool $allowmultiple | [
"Adds",
"an",
"applied",
"filter"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/output/acceptances_filter.php#L128-L132 |
218,024 | moodle/moodle | admin/tool/policy/classes/output/acceptances_filter.php | acceptances_filter.get_filter_values | protected function get_filter_values($filtername) {
$values = [];
foreach ($this->filtersapplied as $filter) {
if ($filter[0] == $filtername) {
$values[] = $filter[1];
}
}
return $values;
} | php | protected function get_filter_values($filtername) {
$values = [];
foreach ($this->filtersapplied as $filter) {
if ($filter[0] == $filtername) {
$values[] = $filter[1];
}
}
return $values;
} | [
"protected",
"function",
"get_filter_values",
"(",
"$",
"filtername",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"filtersapplied",
"as",
"$",
"filter",
")",
"{",
"if",
"(",
"$",
"filter",
"[",
"0",
"]",
"==",
"$",... | Get all values of the applied filter
@param string $filtername
@return array | [
"Get",
"all",
"values",
"of",
"the",
"applied",
"filter"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/output/acceptances_filter.php#L194-L202 |
218,025 | moodle/moodle | admin/tool/policy/classes/output/acceptances_filter.php | acceptances_filter.get_filter_value | protected function get_filter_value($filtername, $default = null) {
if ($values = $this->get_filter_values($filtername)) {
$value = reset($values);
return $value;
}
return $default;
} | php | protected function get_filter_value($filtername, $default = null) {
if ($values = $this->get_filter_values($filtername)) {
$value = reset($values);
return $value;
}
return $default;
} | [
"protected",
"function",
"get_filter_value",
"(",
"$",
"filtername",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"values",
"=",
"$",
"this",
"->",
"get_filter_values",
"(",
"$",
"filtername",
")",
")",
"{",
"$",
"value",
"=",
"reset",
"... | Get one value of the applied filter
@param string $filtername
@param string $default
@return mixed | [
"Get",
"one",
"value",
"of",
"the",
"applied",
"filter"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/output/acceptances_filter.php#L211-L217 |
218,026 | moodle/moodle | admin/tool/policy/classes/output/acceptances_filter.php | acceptances_filter.get_versions | public function get_versions() {
if ($this->versions === null) {
$policyid = $this->get_policy_id_filter();
$versionid = $this->get_version_id_filter();
$this->versions = [];
foreach ($this->get_avaliable_policies() as $policy) {
if ($policyid && $... | php | public function get_versions() {
if ($this->versions === null) {
$policyid = $this->get_policy_id_filter();
$versionid = $this->get_version_id_filter();
$this->versions = [];
foreach ($this->get_avaliable_policies() as $policy) {
if ($policyid && $... | [
"public",
"function",
"get_versions",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"versions",
"===",
"null",
")",
"{",
"$",
"policyid",
"=",
"$",
"this",
"->",
"get_policy_id_filter",
"(",
")",
";",
"$",
"versionid",
"=",
"$",
"this",
"->",
"get_versi... | List of policies that match current filters
@return array of versions to display indexed by versionid | [
"List",
"of",
"policies",
"that",
"match",
"current",
"filters"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/output/acceptances_filter.php#L253-L273 |
218,027 | moodle/moodle | admin/tool/policy/classes/output/acceptances_filter.php | acceptances_filter.get_single_version | public function get_single_version() {
if ($this->get_version_id_filter() || $this->get_policy_id_filter()) {
$versions = $this->get_versions();
return reset($versions);
}
return null;
} | php | public function get_single_version() {
if ($this->get_version_id_filter() || $this->get_policy_id_filter()) {
$versions = $this->get_versions();
return reset($versions);
}
return null;
} | [
"public",
"function",
"get_single_version",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"get_version_id_filter",
"(",
")",
"||",
"$",
"this",
"->",
"get_policy_id_filter",
"(",
")",
")",
"{",
"$",
"versions",
"=",
"$",
"this",
"->",
"get_versions",
"(",
... | If policyid or versionid is specified return one single policy that needs to be shown
If neither policyid nor versionid is specified this method returns null.
When versionid is specified this method will always return an object (this is validated in {@link self::validate_ids()}
When only policyid is specified this me... | [
"If",
"policyid",
"or",
"versionid",
"is",
"specified",
"return",
"one",
"single",
"policy",
"that",
"needs",
"to",
"be",
"shown"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/output/acceptances_filter.php#L304-L310 |
218,028 | moodle/moodle | admin/tool/policy/classes/output/acceptances_filter.php | acceptances_filter.get_url | public function get_url() {
$urlparams = [];
if ($policyid = $this->get_policy_id_filter()) {
$urlparams['policyid'] = $policyid;
}
if ($versionid = $this->get_version_id_filter()) {
$urlparams['versionid'] = $versionid;
}
$i = 0;
foreach (... | php | public function get_url() {
$urlparams = [];
if ($policyid = $this->get_policy_id_filter()) {
$urlparams['policyid'] = $policyid;
}
if ($versionid = $this->get_version_id_filter()) {
$urlparams['versionid'] = $versionid;
}
$i = 0;
foreach (... | [
"public",
"function",
"get_url",
"(",
")",
"{",
"$",
"urlparams",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"policyid",
"=",
"$",
"this",
"->",
"get_policy_id_filter",
"(",
")",
")",
"{",
"$",
"urlparams",
"[",
"'policyid'",
"]",
"=",
"$",
"policyid",
";",... | Returns URL of the acceptances page with all current filters applied
@return \moodle_url | [
"Returns",
"URL",
"of",
"the",
"acceptances",
"page",
"with",
"all",
"current",
"filters",
"applied"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/output/acceptances_filter.php#L317-L336 |
218,029 | moodle/moodle | admin/tool/policy/classes/output/acceptances_filter.php | acceptances_filter.get_version_option_for_filter | protected function get_version_option_for_filter($version) {
if ($version->status == policy_version::STATUS_ACTIVE) {
$a = (object)[
'name' => format_string($version->revision),
'status' => get_string('status'.policy_version::STATUS_ACTIVE, 'tool_policy'),
... | php | protected function get_version_option_for_filter($version) {
if ($version->status == policy_version::STATUS_ACTIVE) {
$a = (object)[
'name' => format_string($version->revision),
'status' => get_string('status'.policy_version::STATUS_ACTIVE, 'tool_policy'),
... | [
"protected",
"function",
"get_version_option_for_filter",
"(",
"$",
"version",
")",
"{",
"if",
"(",
"$",
"version",
"->",
"status",
"==",
"policy_version",
"::",
"STATUS_ACTIVE",
")",
"{",
"$",
"a",
"=",
"(",
"object",
")",
"[",
"'name'",
"=>",
"format_strin... | Creates an option name for the smart select for the version
@param \stdClass $version
@return string | [
"Creates",
"an",
"option",
"name",
"for",
"the",
"smart",
"select",
"for",
"the",
"version"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/output/acceptances_filter.php#L344-L354 |
218,030 | moodle/moodle | customfield/classes/output/renderer.php | renderer.render_management | protected function render_management(\core_customfield\output\management $list) {
$context = $list->export_for_template($this);
return $this->render_from_template('core_customfield/list', $context);
} | php | protected function render_management(\core_customfield\output\management $list) {
$context = $list->export_for_template($this);
return $this->render_from_template('core_customfield/list', $context);
} | [
"protected",
"function",
"render_management",
"(",
"\\",
"core_customfield",
"\\",
"output",
"\\",
"management",
"$",
"list",
")",
"{",
"$",
"context",
"=",
"$",
"list",
"->",
"export_for_template",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
... | Render custom field management interface.
@param \core_customfield\output\management $list
@return string HTML | [
"Render",
"custom",
"field",
"management",
"interface",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/output/renderer.php#L46-L50 |
218,031 | moodle/moodle | customfield/classes/output/renderer.php | renderer.render_field_data | protected function render_field_data(\core_customfield\output\field_data $field) {
$context = $field->export_for_template($this);
return $this->render_from_template('core_customfield/field_data', $context);
} | php | protected function render_field_data(\core_customfield\output\field_data $field) {
$context = $field->export_for_template($this);
return $this->render_from_template('core_customfield/field_data', $context);
} | [
"protected",
"function",
"render_field_data",
"(",
"\\",
"core_customfield",
"\\",
"output",
"\\",
"field_data",
"$",
"field",
")",
"{",
"$",
"context",
"=",
"$",
"field",
"->",
"export_for_template",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
... | Render single custom field value
@param \core_customfield\output\field_data $field
@return string HTML | [
"Render",
"single",
"custom",
"field",
"value"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/output/renderer.php#L58-L61 |
218,032 | moodle/moodle | search/classes/document_factory.php | document_factory.instance | public static function instance($itemid, $componentname, $areaname, $engine = false) {
if ($engine === false) {
$search = \core_search\manager::instance();
$engine = $search->get_engine();
}
$pluginname = $engine->get_plugin_name();
if (!empty(self::$docclassna... | php | public static function instance($itemid, $componentname, $areaname, $engine = false) {
if ($engine === false) {
$search = \core_search\manager::instance();
$engine = $search->get_engine();
}
$pluginname = $engine->get_plugin_name();
if (!empty(self::$docclassna... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"itemid",
",",
"$",
"componentname",
",",
"$",
"areaname",
",",
"$",
"engine",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"engine",
"===",
"false",
")",
"{",
"$",
"search",
"=",
"\\",
"core_search",
... | Returns the appropiate document object as it depends on the engine.
@param int $itemid Document itemid
@param string $componentname Document component name
@param string $areaname Document area name
@param \core_search\engine $engine Falls back to the search engine in use.
@return \core_search\document Base document o... | [
"Returns",
"the",
"appropiate",
"document",
"object",
"as",
"it",
"depends",
"on",
"the",
"engine",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/document_factory.php#L58-L74 |
218,033 | moodle/moodle | mod/book/classes/search/chapter.php | chapter.get_document | public function get_document($record, $options = array()) {
try {
$cm = $this->get_cm('book', $record->bookid, $record->courseid);
$context = \context_module::instance($cm->id);
} catch (\dml_missing_record_exception $ex) {
// Notify it as we run here as admin, we sho... | php | public function get_document($record, $options = array()) {
try {
$cm = $this->get_cm('book', $record->bookid, $record->courseid);
$context = \context_module::instance($cm->id);
} catch (\dml_missing_record_exception $ex) {
// Notify it as we run here as admin, we sho... | [
"public",
"function",
"get_document",
"(",
"$",
"record",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"$",
"cm",
"=",
"$",
"this",
"->",
"get_cm",
"(",
"'book'",
",",
"$",
"record",
"->",
"bookid",
",",
"$",
"record",
"->",
... | Returns the document for a particular chapter.
@param \stdClass $record A record containing, at least, the indexed document id and a modified timestamp
@param array $options Options for document creation
@return \core_search\document | [
"Returns",
"the",
"document",
"for",
"a",
"particular",
"chapter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/book/classes/search/chapter.php#L73-L104 |
218,034 | moodle/moodle | mod/book/classes/search/chapter.php | chapter.get_doc_url | public function get_doc_url(\core_search\document $doc) {
$contextmodule = \context::instance_by_id($doc->get('contextid'));
$params = array('id' => $contextmodule->instanceid, 'chapterid' => $doc->get('itemid'));
return new \moodle_url('/mod/book/view.php', $params);
} | php | public function get_doc_url(\core_search\document $doc) {
$contextmodule = \context::instance_by_id($doc->get('contextid'));
$params = array('id' => $contextmodule->instanceid, 'chapterid' => $doc->get('itemid'));
return new \moodle_url('/mod/book/view.php', $params);
} | [
"public",
"function",
"get_doc_url",
"(",
"\\",
"core_search",
"\\",
"document",
"$",
"doc",
")",
"{",
"$",
"contextmodule",
"=",
"\\",
"context",
"::",
"instance_by_id",
"(",
"$",
"doc",
"->",
"get",
"(",
"'contextid'",
")",
")",
";",
"$",
"params",
"="... | Returns a url to the chapter.
@param \core_search\document $doc
@return \moodle_url | [
"Returns",
"a",
"url",
"to",
"the",
"chapter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/book/classes/search/chapter.php#L153-L157 |
218,035 | moodle/moodle | admin/tool/usertours/classes/event/tour_ended.php | tour_ended.get_other_mapping | public static function get_other_mapping() {
return [
'stepindex' => \core\event\base::NOT_MAPPED,
'stepid' => [
'db' => 'tool_usertours_steps',
'restore' => \core\event\base::NOT_MAPPED,
],
'pageurl' => \core\event\ba... | php | public static function get_other_mapping() {
return [
'stepindex' => \core\event\base::NOT_MAPPED,
'stepid' => [
'db' => 'tool_usertours_steps',
'restore' => \core\event\base::NOT_MAPPED,
],
'pageurl' => \core\event\ba... | [
"public",
"static",
"function",
"get_other_mapping",
"(",
")",
"{",
"return",
"[",
"'stepindex'",
"=>",
"\\",
"core",
"\\",
"event",
"\\",
"base",
"::",
"NOT_MAPPED",
",",
"'stepid'",
"=>",
"[",
"'db'",
"=>",
"'tool_usertours_steps'",
",",
"'restore'",
"=>",
... | This is used when restoring course logs where it is required that we
map the information in 'other' to it's new value in the new course.
Does nothing in the base class except display a debugging message warning
the user that the event does not contain the required functionality to
map this information. For events that... | [
"This",
"is",
"used",
"when",
"restoring",
"course",
"logs",
"where",
"it",
"is",
"required",
"that",
"we",
"map",
"the",
"information",
"in",
"other",
"to",
"it",
"s",
"new",
"value",
"in",
"the",
"new",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/event/tour_ended.php#L96-L105 |
218,036 | moodle/moodle | admin/tool/dataprivacy/classes/output/expired_contexts_table.php | expired_contexts_table.col_name | public function col_name($expiredctx) {
global $OUTPUT;
$context = context_helper::instance_by_id($expiredctx->get('contextid'));
$parent = $context->get_parent_context();
$contextdata = (object)[
'name' => $context->get_context_name(false, true),
'parent' => $par... | php | public function col_name($expiredctx) {
global $OUTPUT;
$context = context_helper::instance_by_id($expiredctx->get('contextid'));
$parent = $context->get_parent_context();
$contextdata = (object)[
'name' => $context->get_context_name(false, true),
'parent' => $par... | [
"public",
"function",
"col_name",
"(",
"$",
"expiredctx",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"context",
"=",
"context_helper",
"::",
"instance_by_id",
"(",
"$",
"expiredctx",
"->",
"get",
"(",
"'contextid'",
")",
")",
";",
"$",
"parent",
"=",
"... | The context name column.
@param stdClass $expiredctx The row data.
@return string
@throws coding_exception | [
"The",
"context",
"name",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/output/expired_contexts_table.php#L119-L137 |
218,037 | moodle/moodle | admin/tool/dataprivacy/classes/output/expired_contexts_table.php | expired_contexts_table.col_info | public function col_info($expiredctx) {
global $OUTPUT;
$context = context_helper::instance_by_id($expiredctx->get('contextid'));
$children = $context->get_child_contexts();
if (empty($children)) {
return get_string('none');
} else {
$childnames = [];
... | php | public function col_info($expiredctx) {
global $OUTPUT;
$context = context_helper::instance_by_id($expiredctx->get('contextid'));
$children = $context->get_child_contexts();
if (empty($children)) {
return get_string('none');
} else {
$childnames = [];
... | [
"public",
"function",
"col_info",
"(",
"$",
"expiredctx",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"context",
"=",
"context_helper",
"::",
"instance_by_id",
"(",
"$",
"expiredctx",
"->",
"get",
"(",
"'contextid'",
")",
")",
";",
"$",
"children",
"=",
... | The context information column.
@param stdClass $expiredctx The row data.
@return string
@throws coding_exception | [
"The",
"context",
"information",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/output/expired_contexts_table.php#L146-L165 |
218,038 | moodle/moodle | admin/tool/dataprivacy/classes/output/expired_contexts_table.php | expired_contexts_table.col_category | public function col_category($expiredctx) {
$context = context_helper::instance_by_id($expiredctx->get('contextid'));
$category = api::get_effective_context_category($context);
return s($category->get('name'));
} | php | public function col_category($expiredctx) {
$context = context_helper::instance_by_id($expiredctx->get('contextid'));
$category = api::get_effective_context_category($context);
return s($category->get('name'));
} | [
"public",
"function",
"col_category",
"(",
"$",
"expiredctx",
")",
"{",
"$",
"context",
"=",
"context_helper",
"::",
"instance_by_id",
"(",
"$",
"expiredctx",
"->",
"get",
"(",
"'contextid'",
")",
")",
";",
"$",
"category",
"=",
"api",
"::",
"get_effective_c... | The category name column.
@param stdClass $expiredctx The row data.
@return mixed
@throws coding_exception
@throws dml_exception | [
"The",
"category",
"name",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/output/expired_contexts_table.php#L175-L180 |
218,039 | moodle/moodle | admin/tool/dataprivacy/classes/output/expired_contexts_table.php | expired_contexts_table.col_retentionperiod | public function col_retentionperiod($expiredctx) {
$purpose = $this->get_purpose_for_expiry($expiredctx);
$expiries = [];
$expiry = html_writer::tag('dt', get_string('default'), ['class' => 'col-sm-3']);
if ($expiredctx->get('defaultexpired')) {
$expiries[get_string('defaul... | php | public function col_retentionperiod($expiredctx) {
$purpose = $this->get_purpose_for_expiry($expiredctx);
$expiries = [];
$expiry = html_writer::tag('dt', get_string('default'), ['class' => 'col-sm-3']);
if ($expiredctx->get('defaultexpired')) {
$expiries[get_string('defaul... | [
"public",
"function",
"col_retentionperiod",
"(",
"$",
"expiredctx",
")",
"{",
"$",
"purpose",
"=",
"$",
"this",
"->",
"get_purpose_for_expiry",
"(",
"$",
"expiredctx",
")",
";",
"$",
"expiries",
"=",
"[",
"]",
";",
"$",
"expiry",
"=",
"html_writer",
"::",... | The retention period column.
@param stdClass $expiredctx The row data.
@return string | [
"The",
"retention",
"period",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/output/expired_contexts_table.php#L201-L247 |
218,040 | moodle/moodle | admin/tool/dataprivacy/classes/output/expired_contexts_table.php | expired_contexts_table.col_select | public function col_select($expiredctx) {
$id = $expiredctx->get('id');
return html_writer::checkbox('expiredcontext_' . $id, $id, $this->selectall, '', ['class' => 'selectcontext']);
} | php | public function col_select($expiredctx) {
$id = $expiredctx->get('id');
return html_writer::checkbox('expiredcontext_' . $id, $id, $this->selectall, '', ['class' => 'selectcontext']);
} | [
"public",
"function",
"col_select",
"(",
"$",
"expiredctx",
")",
"{",
"$",
"id",
"=",
"$",
"expiredctx",
"->",
"get",
"(",
"'id'",
")",
";",
"return",
"html_writer",
"::",
"checkbox",
"(",
"'expiredcontext_'",
".",
"$",
"id",
",",
"$",
"id",
",",
"$",
... | Generate the select column.
@param stdClass $expiredctx The row data.
@return string | [
"Generate",
"the",
"select",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/output/expired_contexts_table.php#L265-L268 |
218,041 | moodle/moodle | admin/tool/dataprivacy/classes/output/expired_contexts_table.php | expired_contexts_table.col_tobedeleted | public function col_tobedeleted($expiredctx) {
if ($expiredctx->is_fully_expired()) {
return get_string('defaultexpired', 'tool_dataprivacy');
}
$purpose = $this->get_purpose_for_expiry($expiredctx);
$a = (object) [];
$expiredroles = [];
foreach ($expiredct... | php | public function col_tobedeleted($expiredctx) {
if ($expiredctx->is_fully_expired()) {
return get_string('defaultexpired', 'tool_dataprivacy');
}
$purpose = $this->get_purpose_for_expiry($expiredctx);
$a = (object) [];
$expiredroles = [];
foreach ($expiredct... | [
"public",
"function",
"col_tobedeleted",
"(",
"$",
"expiredctx",
")",
"{",
"if",
"(",
"$",
"expiredctx",
"->",
"is_fully_expired",
"(",
")",
")",
"{",
"return",
"get_string",
"(",
"'defaultexpired'",
",",
"'tool_dataprivacy'",
")",
";",
"}",
"$",
"purpose",
... | Formatting for the 'tobedeleted' column which indicates in a friendlier fashion whose data will be removed.
@param stdClass $expiredctx The row data.
@return string | [
"Formatting",
"for",
"the",
"tobedeleted",
"column",
"which",
"indicates",
"in",
"a",
"friendlier",
"fashion",
"whose",
"data",
"will",
"be",
"removed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/output/expired_contexts_table.php#L276-L304 |
218,042 | moodle/moodle | admin/tool/dataprivacy/classes/output/expired_contexts_table.php | expired_contexts_table.get_purpose_for_expiry | protected function get_purpose_for_expiry(expired_context $expiredcontext) : purpose {
$context = context_helper::instance_by_id($expiredcontext->get('contextid'));
if (empty($this->purposemap[$context->id])) {
$purpose = api::get_effective_context_purpose($context);
$this->purp... | php | protected function get_purpose_for_expiry(expired_context $expiredcontext) : purpose {
$context = context_helper::instance_by_id($expiredcontext->get('contextid'));
if (empty($this->purposemap[$context->id])) {
$purpose = api::get_effective_context_purpose($context);
$this->purp... | [
"protected",
"function",
"get_purpose_for_expiry",
"(",
"expired_context",
"$",
"expiredcontext",
")",
":",
"purpose",
"{",
"$",
"context",
"=",
"context_helper",
"::",
"instance_by_id",
"(",
"$",
"expiredcontext",
"->",
"get",
"(",
"'contextid'",
")",
")",
";",
... | Get the purpose for the specified expired context.
@param expired_context $expiredcontext
@return purpose | [
"Get",
"the",
"purpose",
"for",
"the",
"specified",
"expired",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/output/expired_contexts_table.php#L373-L386 |
218,043 | moodle/moodle | admin/tool/dataprivacy/classes/output/expired_contexts_table.php | expired_contexts_table.preload_contexts | protected function preload_contexts(array $contextids) {
global $DB;
if (empty($contextids)) {
return;
}
$ctxfields = \context_helper::get_preload_record_columns_sql('ctx');
list($insql, $inparams) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED);
$sql ... | php | protected function preload_contexts(array $contextids) {
global $DB;
if (empty($contextids)) {
return;
}
$ctxfields = \context_helper::get_preload_record_columns_sql('ctx');
list($insql, $inparams) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED);
$sql ... | [
"protected",
"function",
"preload_contexts",
"(",
"array",
"$",
"contextids",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"contextids",
")",
")",
"{",
"return",
";",
"}",
"$",
"ctxfields",
"=",
"\\",
"context_helper",
"::",
"get_pre... | Preload context records given a set of contextids.
@param array $contextids | [
"Preload",
"context",
"records",
"given",
"a",
"set",
"of",
"contextids",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/output/expired_contexts_table.php#L393-L409 |
218,044 | moodle/moodle | analytics/classes/local/target/binary.php | binary.get_calculation_outcome | public function get_calculation_outcome($value, $ignoredsubtype = false) {
if (!self::is_a_class($value)) {
throw new \moodle_exception('errorpredictionformat', 'analytics');
}
if (in_array($value, $this->ignored_predicted_classes(), false)) {
// Just in case, if it is ... | php | public function get_calculation_outcome($value, $ignoredsubtype = false) {
if (!self::is_a_class($value)) {
throw new \moodle_exception('errorpredictionformat', 'analytics');
}
if (in_array($value, $this->ignored_predicted_classes(), false)) {
// Just in case, if it is ... | [
"public",
"function",
"get_calculation_outcome",
"(",
"$",
"value",
",",
"$",
"ignoredsubtype",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"is_a_class",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"\\",
"moodle_exception",
"(",
"'errorpred... | Is the calculated value a positive outcome of this target?
@param string $value
@param string $ignoredsubtype
@return int | [
"Is",
"the",
"calculated",
"value",
"a",
"positive",
"outcome",
"of",
"this",
"target?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/target/binary.php#L75-L92 |
218,045 | moodle/moodle | lib/horde/framework/Horde/Support/StringStream.php | Horde_Support_StringStream.fopen | public function fopen()
{
return fopen(
self::WNAME . '://' . spl_object_hash($this),
'rb',
false,
stream_context_create(array(
self::WNAME => array(
'string' => $this
)
))
);
} | php | public function fopen()
{
return fopen(
self::WNAME . '://' . spl_object_hash($this),
'rb',
false,
stream_context_create(array(
self::WNAME => array(
'string' => $this
)
))
);
} | [
"public",
"function",
"fopen",
"(",
")",
"{",
"return",
"fopen",
"(",
"self",
"::",
"WNAME",
".",
"'://'",
".",
"spl_object_hash",
"(",
"$",
"this",
")",
",",
"'rb'",
",",
"false",
",",
"stream_context_create",
"(",
"array",
"(",
"self",
"::",
"WNAME",
... | Return a stream handle to this string stream.
@return resource | [
"Return",
"a",
"stream",
"handle",
"to",
"this",
"string",
"stream",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/StringStream.php#L46-L58 |
218,046 | moodle/moodle | lib/horde/framework/Horde/Support/StringStream.php | Horde_Support_StringStream.getFileObject | public function getFileObject()
{
return new SplFileObject(
self::WNAME . '://' . spl_object_hash($this),
'rb',
false,
stream_context_create(array(
self::WNAME => array(
'string' => $this
)
))
... | php | public function getFileObject()
{
return new SplFileObject(
self::WNAME . '://' . spl_object_hash($this),
'rb',
false,
stream_context_create(array(
self::WNAME => array(
'string' => $this
)
))
... | [
"public",
"function",
"getFileObject",
"(",
")",
"{",
"return",
"new",
"SplFileObject",
"(",
"self",
"::",
"WNAME",
".",
"'://'",
".",
"spl_object_hash",
"(",
"$",
"this",
")",
",",
"'rb'",
",",
"false",
",",
"stream_context_create",
"(",
"array",
"(",
"se... | Return an SplFileObject representing this string stream
@return SplFileObject | [
"Return",
"an",
"SplFileObject",
"representing",
"this",
"string",
"stream"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/StringStream.php#L65-L77 |
218,047 | moodle/moodle | theme/boost/classes/admin_settingspage_tabs.php | theme_boost_admin_settingspage_tabs.add_tab | public function add_tab(admin_settingpage $tab) {
foreach ($tab->settings as $setting) {
$this->settings->{$setting->name} = $setting;
}
$this->tabs[] = $tab;
return true;
} | php | public function add_tab(admin_settingpage $tab) {
foreach ($tab->settings as $setting) {
$this->settings->{$setting->name} = $setting;
}
$this->tabs[] = $tab;
return true;
} | [
"public",
"function",
"add_tab",
"(",
"admin_settingpage",
"$",
"tab",
")",
"{",
"foreach",
"(",
"$",
"tab",
"->",
"settings",
"as",
"$",
"setting",
")",
"{",
"$",
"this",
"->",
"settings",
"->",
"{",
"$",
"setting",
"->",
"name",
"}",
"=",
"$",
"set... | Add a tab.
@param admin_settingpage $tab A tab. | [
"Add",
"a",
"tab",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/theme/boost/classes/admin_settingspage_tabs.php#L40-L46 |
218,048 | moodle/moodle | theme/boost/classes/admin_settingspage_tabs.php | theme_boost_admin_settingspage_tabs.output_html | public function output_html() {
global $OUTPUT;
$activetab = optional_param('activetab', '', PARAM_TEXT);
$context = array('tabs' => array());
$havesetactive = false;
foreach ($this->get_tabs() as $tab) {
$active = false;
// Default to first tab it not ... | php | public function output_html() {
global $OUTPUT;
$activetab = optional_param('activetab', '', PARAM_TEXT);
$context = array('tabs' => array());
$havesetactive = false;
foreach ($this->get_tabs() as $tab) {
$active = false;
// Default to first tab it not ... | [
"public",
"function",
"output_html",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"activetab",
"=",
"optional_param",
"(",
"'activetab'",
",",
"''",
",",
"PARAM_TEXT",
")",
";",
"$",
"context",
"=",
"array",
"(",
"'tabs'",
"=>",
"array",
"(",
")",
... | Generate the HTML output.
@return string | [
"Generate",
"the",
"HTML",
"output",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/theme/boost/classes/admin_settingspage_tabs.php#L66-L97 |
218,049 | moodle/moodle | admin/tool/dataprivacy/classes/filtered_userlist.php | filtered_userlist.apply_expired_context_filters | public function apply_expired_context_filters(array $expireduserids, array $unexpireduserids) : filtered_userlist {
// The current userlist content.
$userids = $this->get_userids();
if (!empty($expireduserids)) {
// Now remove any not on the list of expired users.
$useri... | php | public function apply_expired_context_filters(array $expireduserids, array $unexpireduserids) : filtered_userlist {
// The current userlist content.
$userids = $this->get_userids();
if (!empty($expireduserids)) {
// Now remove any not on the list of expired users.
$useri... | [
"public",
"function",
"apply_expired_context_filters",
"(",
"array",
"$",
"expireduserids",
",",
"array",
"$",
"unexpireduserids",
")",
":",
"filtered_userlist",
"{",
"// The current userlist content.",
"$",
"userids",
"=",
"$",
"this",
"->",
"get_userids",
"(",
")",
... | Apply filters to only remove users in the expireduserids list, and to remove any who are in the unexpired list.
The unexpired list wins where a user is in both lists.
@param int[] $expireduserids The list of userids for users who should be expired.
@param int[] $unexpireduserids The list of userids for those u... | [
"Apply",
"filters",
"to",
"only",
"remove",
"users",
"in",
"the",
"expireduserids",
"list",
"and",
"to",
"remove",
"any",
"who",
"are",
"in",
"the",
"unexpired",
"list",
".",
"The",
"unexpired",
"list",
"wins",
"where",
"a",
"user",
"is",
"in",
"both",
"... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/filtered_userlist.php#L45-L62 |
218,050 | moodle/moodle | mod/lti/service/toolsettings/classes/local/service/toolsettings.php | toolsettings.distinct_settings | public static function distinct_settings(&$systemsettings, &$contextsettings, $linksettings) {
if (!empty($systemsettings)) {
foreach ($systemsettings as $key => $value) {
if ((!empty($contextsettings) && array_key_exists($key, $contextsettings)) ||
(!empty($link... | php | public static function distinct_settings(&$systemsettings, &$contextsettings, $linksettings) {
if (!empty($systemsettings)) {
foreach ($systemsettings as $key => $value) {
if ((!empty($contextsettings) && array_key_exists($key, $contextsettings)) ||
(!empty($link... | [
"public",
"static",
"function",
"distinct_settings",
"(",
"&",
"$",
"systemsettings",
",",
"&",
"$",
"contextsettings",
",",
"$",
"linksettings",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"systemsettings",
")",
")",
"{",
"foreach",
"(",
"$",
"systemsett... | Get the distinct settings from each level by removing any duplicates from higher levels.
@param array $systemsettings System level settings
@param array $contextsettings Context level settings
@param array $linksettings Link level settings | [
"Get",
"the",
"distinct",
"settings",
"from",
"each",
"level",
"by",
"removing",
"any",
"duplicates",
"from",
"higher",
"levels",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/service/toolsettings/classes/local/service/toolsettings.php#L77-L94 |
218,051 | moodle/moodle | mod/lti/service/toolsettings/classes/local/service/toolsettings.php | toolsettings.settings_to_json | public static function settings_to_json($settings, $simpleformat, $type, $resource) {
$json = '';
if (!empty($resource)) {
$indent = '';
if (!$simpleformat) {
$json .= " {\n \"@type\":\"{$type}\",\n";
$json .= " \"@id\":\"{$resource->... | php | public static function settings_to_json($settings, $simpleformat, $type, $resource) {
$json = '';
if (!empty($resource)) {
$indent = '';
if (!$simpleformat) {
$json .= " {\n \"@type\":\"{$type}\",\n";
$json .= " \"@id\":\"{$resource->... | [
"public",
"static",
"function",
"settings_to_json",
"(",
"$",
"settings",
",",
"$",
"simpleformat",
",",
"$",
"type",
",",
"$",
"resource",
")",
"{",
"$",
"json",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"resource",
")",
")",
"{",
"$",
"i... | Get the JSON representation of the settings.
@param array $settings Settings
@param boolean $simpleformat <code>true</code> if simple JSON is to be returned
@param string $type JSON-LD type
@param \mod_lti\local\ltiservice\resource_base $resource Resource handling the request
@return string | [
"Get",
"the",
"JSON",
"representation",
"of",
"the",
"settings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/service/toolsettings/classes/local/service/toolsettings.php#L106-L136 |
218,052 | moodle/moodle | auth/webservice/auth.php | auth_plugin_webservice.user_login_webservice | function user_login_webservice($username, $password) {
global $CFG, $DB;
// special web service login
if ($user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
return validate_internal_user_password($user, $password);
}
... | php | function user_login_webservice($username, $password) {
global $CFG, $DB;
// special web service login
if ($user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
return validate_internal_user_password($user, $password);
}
... | [
"function",
"user_login_webservice",
"(",
"$",
"username",
",",
"$",
"password",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"// special web service login",
"if",
"(",
"$",
"user",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'user'",
",",
"array",
... | Custom auth hook for web services.
@param string $username
@param string $password
@return bool success | [
"Custom",
"auth",
"hook",
"for",
"web",
"services",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/webservice/auth.php#L73-L80 |
218,053 | moodle/moodle | rating/classes/external/util.php | util.external_ratings_structure | public static function external_ratings_structure() {
return new external_single_structure (
[
'contextid' => new external_value(PARAM_INT, 'Context id.'),
'component' => new external_value(PARAM_COMPONENT, 'Context name.'),
'ratingarea' => new extern... | php | public static function external_ratings_structure() {
return new external_single_structure (
[
'contextid' => new external_value(PARAM_INT, 'Context id.'),
'component' => new external_value(PARAM_COMPONENT, 'Context name.'),
'ratingarea' => new extern... | [
"public",
"static",
"function",
"external_ratings_structure",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"[",
"'contextid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'Context id.'",
")",
",",
"'component'",
"=>",
"new",
"external... | Returns the ratings definition for external functions. | [
"Returns",
"the",
"ratings",
"definition",
"for",
"external",
"functions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/classes/external/util.php#L51-L100 |
218,054 | moodle/moodle | mod/wiki/parser/markups/wikimarkup.php | wiki_markup_parser.before_parsing | protected function before_parsing() {
$this->toc = array();
$this->string = preg_replace('/\r\n/', "\n", $this->string);
$this->string = preg_replace('/\r/', "\n", $this->string);
$this->string .= "\n\n";
if (!$this->printable && $this->section_editing) {
$this->re... | php | protected function before_parsing() {
$this->toc = array();
$this->string = preg_replace('/\r\n/', "\n", $this->string);
$this->string = preg_replace('/\r/', "\n", $this->string);
$this->string .= "\n\n";
if (!$this->printable && $this->section_editing) {
$this->re... | [
"protected",
"function",
"before_parsing",
"(",
")",
"{",
"$",
"this",
"->",
"toc",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"string",
"=",
"preg_replace",
"(",
"'/\\r\\n/'",
",",
"\"\\n\"",
",",
"$",
"this",
"->",
"string",
")",
";",
"$",
"th... | Before and after parsing... | [
"Before",
"and",
"after",
"parsing",
"..."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/parser/markups/wikimarkup.php#L53-L65 |
218,055 | moodle/moodle | mod/wiki/parser/markups/wikimarkup.php | wiki_markup_parser.process_toc | protected function process_toc() {
if (empty($this->toc)) {
return;
}
$toc = "";
$currentsection = array(0, 0, 0);
$i = 1;
foreach ($this->toc as & $header) {
switch ($header[0]) {
case 1:
$currentsection = array($curre... | php | protected function process_toc() {
if (empty($this->toc)) {
return;
}
$toc = "";
$currentsection = array(0, 0, 0);
$i = 1;
foreach ($this->toc as & $header) {
switch ($header[0]) {
case 1:
$currentsection = array($curre... | [
"protected",
"function",
"process_toc",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"toc",
")",
")",
"{",
"return",
";",
"}",
"$",
"toc",
"=",
"\"\"",
";",
"$",
"currentsection",
"=",
"array",
"(",
"0",
",",
"0",
",",
"0",
")",
"... | Table of contents processing after parsing | [
"Table",
"of",
"contents",
"processing",
"after",
"parsing"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/parser/markups/wikimarkup.php#L204-L250 |
218,056 | moodle/moodle | mod/wiki/parser/markups/wikimarkup.php | wiki_markup_parser.link | protected function link($link, $anchor = "") {
$link = trim($link);
if (preg_match("/^(https?|s?ftp):\/\/.+$/i", $link)) {
$link = trim($link, ",.?!");
return array('content' => $link, 'url' => $link);
} else {
$callbackargs = $this->linkgeneratorcallbackargs;... | php | protected function link($link, $anchor = "") {
$link = trim($link);
if (preg_match("/^(https?|s?ftp):\/\/.+$/i", $link)) {
$link = trim($link, ",.?!");
return array('content' => $link, 'url' => $link);
} else {
$callbackargs = $this->linkgeneratorcallbackargs;... | [
"protected",
"function",
"link",
"(",
"$",
"link",
",",
"$",
"anchor",
"=",
"\"\"",
")",
"{",
"$",
"link",
"=",
"trim",
"(",
"$",
"link",
")",
";",
"if",
"(",
"preg_match",
"(",
"\"/^(https?|s?ftp):\\/\\/.+$/i\"",
",",
"$",
"link",
")",
")",
"{",
"$"... | Link internal callback | [
"Link",
"internal",
"callback"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/parser/markups/wikimarkup.php#L342-L359 |
218,057 | moodle/moodle | mod/imscp/classes/external.php | mod_imscp_external.get_imscps_by_courses | public static function get_imscps_by_courses($courseids = array()) {
global $CFG;
$returnedimscps = array();
$warnings = array();
$params = self::validate_parameters(self::get_imscps_by_courses_parameters(), array('courseids' => $courseids));
$courses = array();
if (em... | php | public static function get_imscps_by_courses($courseids = array()) {
global $CFG;
$returnedimscps = array();
$warnings = array();
$params = self::validate_parameters(self::get_imscps_by_courses_parameters(), array('courseids' => $courseids));
$courses = array();
if (em... | [
"public",
"static",
"function",
"get_imscps_by_courses",
"(",
"$",
"courseids",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"returnedimscps",
"=",
"array",
"(",
")",
";",
"$",
"warnings",
"=",
"array",
"(",
")",
";",
"$",
"params"... | Returns a list of IMSCP packages in a provided list of courses,
if no list is provided all IMSCP packages that the user can view will be returned.
@param array $courseids the course ids
@return array of IMSCP packages details and possible warnings
@since Moodle 3.0 | [
"Returns",
"a",
"list",
"of",
"IMSCP",
"packages",
"in",
"a",
"provided",
"list",
"of",
"courses",
"if",
"no",
"list",
"is",
"provided",
"all",
"IMSCP",
"packages",
"that",
"the",
"user",
"can",
"view",
"will",
"be",
"returned",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/imscp/classes/external.php#L131-L188 |
218,058 | moodle/moodle | mod/imscp/classes/external.php | mod_imscp_external.get_imscps_by_courses_returns | public static function get_imscps_by_courses_returns() {
return new external_single_structure(
array(
'imscps' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_value(... | php | public static function get_imscps_by_courses_returns() {
return new external_single_structure(
array(
'imscps' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_value(... | [
"public",
"static",
"function",
"get_imscps_by_courses_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'imscps'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'id'",
... | Describes the get_imscps_by_courses return value.
@return external_single_structure
@since Moodle 3.0 | [
"Describes",
"the",
"get_imscps_by_courses",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/imscp/classes/external.php#L196-L223 |
218,059 | moodle/moodle | enrol/externallib.php | core_enrol_external.get_potential_users_parameters | public static function get_potential_users_parameters() {
return new external_function_parameters(
array(
'courseid' => new external_value(PARAM_INT, 'course id'),
'enrolid' => new external_value(PARAM_INT, 'enrolment id'),
'search' => new external_val... | php | public static function get_potential_users_parameters() {
return new external_function_parameters(
array(
'courseid' => new external_value(PARAM_INT, 'course id'),
'enrolid' => new external_value(PARAM_INT, 'enrolment id'),
'search' => new external_val... | [
"public",
"static",
"function",
"get_potential_users_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'courseid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'course id'",
")",
",",
"'enrolid'",
"=>",
"new"... | Returns description of method parameters value
@return external_description | [
"Returns",
"description",
"of",
"method",
"parameters",
"value"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/externallib.php#L497-L508 |
218,060 | moodle/moodle | enrol/externallib.php | core_enrol_external.get_potential_users | public static function get_potential_users($courseid, $enrolid, $search, $searchanywhere, $page, $perpage) {
global $PAGE, $DB, $CFG;
require_once($CFG->dirroot.'/enrol/locallib.php');
require_once($CFG->dirroot.'/user/lib.php');
$params = self::validate_parameters(
self::g... | php | public static function get_potential_users($courseid, $enrolid, $search, $searchanywhere, $page, $perpage) {
global $PAGE, $DB, $CFG;
require_once($CFG->dirroot.'/enrol/locallib.php');
require_once($CFG->dirroot.'/user/lib.php');
$params = self::validate_parameters(
self::g... | [
"public",
"static",
"function",
"get_potential_users",
"(",
"$",
"courseid",
",",
"$",
"enrolid",
",",
"$",
"search",
",",
"$",
"searchanywhere",
",",
"$",
"page",
",",
"$",
"perpage",
")",
"{",
"global",
"$",
"PAGE",
",",
"$",
"DB",
",",
"$",
"CFG",
... | Get potential users.
@param int $courseid Course id
@param int $enrolid Enrolment id
@param string $search The query
@param boolean $searchanywhere Match anywhere in the string
@param int $page Page number
@param int $perpage Max per page
@return array An array of users | [
"Get",
"potential",
"users",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/externallib.php#L521-L574 |
218,061 | moodle/moodle | enrol/externallib.php | core_enrol_external.get_course_enrolment_methods | public static function get_course_enrolment_methods($courseid) {
global $DB;
$params = self::validate_parameters(self::get_course_enrolment_methods_parameters(), array('courseid' => $courseid));
self::validate_context(context_system::instance());
$course = $DB->get_record('course', arr... | php | public static function get_course_enrolment_methods($courseid) {
global $DB;
$params = self::validate_parameters(self::get_course_enrolment_methods_parameters(), array('courseid' => $courseid));
self::validate_context(context_system::instance());
$course = $DB->get_record('course', arr... | [
"public",
"static",
"function",
"get_course_enrolment_methods",
"(",
"$",
"courseid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_course_enrolment_methods_parameters",
"(",
")",
",",
"array",... | Get list of active course enrolment methods for current user.
@param int $courseid
@return array of course enrolment methods
@throws moodle_exception | [
"Get",
"list",
"of",
"active",
"course",
"enrolment",
"methods",
"for",
"current",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/externallib.php#L876-L897 |
218,062 | moodle/moodle | enrol/externallib.php | core_enrol_external.edit_user_enrolment | public static function edit_user_enrolment($courseid, $ueid, $status, $timestart = 0, $timeend = 0) {
global $CFG, $DB, $PAGE;
$params = self::validate_parameters(self::edit_user_enrolment_parameters(), [
'courseid' => $courseid,
'ueid' => $ueid,
'status' => $status,... | php | public static function edit_user_enrolment($courseid, $ueid, $status, $timestart = 0, $timeend = 0) {
global $CFG, $DB, $PAGE;
$params = self::validate_parameters(self::edit_user_enrolment_parameters(), [
'courseid' => $courseid,
'ueid' => $ueid,
'status' => $status,... | [
"public",
"static",
"function",
"edit_user_enrolment",
"(",
"$",
"courseid",
",",
"$",
"ueid",
",",
"$",
"status",
",",
"$",
"timestart",
"=",
"0",
",",
"$",
"timeend",
"=",
"0",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
",",
"$",
"PAGE",
";"... | External function that updates a given user enrolment.
@param int $courseid The course ID.
@param int $ueid The user enrolment ID.
@param int $status The enrolment status.
@param int $timestart Enrolment start timestamp.
@param int $timeend Enrolment end timestamp.
@return array An array consisting of the processing r... | [
"External",
"function",
"that",
"updates",
"a",
"given",
"user",
"enrolment",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/externallib.php#L946-L1000 |
218,063 | moodle/moodle | enrol/externallib.php | core_enrol_external.unenrol_user_enrolment | public static function unenrol_user_enrolment($ueid) {
global $CFG, $DB, $PAGE;
$params = self::validate_parameters(self::unenrol_user_enrolment_parameters(), [
'ueid' => $ueid
]);
$result = false;
$errors = [];
$userenrolment = $DB->get_record('user_enrolm... | php | public static function unenrol_user_enrolment($ueid) {
global $CFG, $DB, $PAGE;
$params = self::validate_parameters(self::unenrol_user_enrolment_parameters(), [
'ueid' => $ueid
]);
$result = false;
$errors = [];
$userenrolment = $DB->get_record('user_enrolm... | [
"public",
"static",
"function",
"unenrol_user_enrolment",
"(",
"$",
"ueid",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
",",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"unenrol_user_enrolment_parameters",
... | External function that unenrols a given user enrolment.
@param int $ueid The user enrolment ID.
@return array An array consisting of the processing result, errors. | [
"External",
"function",
"that",
"unenrols",
"a",
"given",
"user",
"enrolment",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/externallib.php#L1042-L1083 |
218,064 | moodle/moodle | enrol/externallib.php | core_role_external.assign_roles | public static function assign_roles($assignments) {
global $DB;
// Do basic automatic PARAM checks on incoming data, using params description
// If any problems are found then exceptions are thrown with helpful error messages
$params = self::validate_parameters(self::assign_roles_parame... | php | public static function assign_roles($assignments) {
global $DB;
// Do basic automatic PARAM checks on incoming data, using params description
// If any problems are found then exceptions are thrown with helpful error messages
$params = self::validate_parameters(self::assign_roles_parame... | [
"public",
"static",
"function",
"assign_roles",
"(",
"$",
"assignments",
")",
"{",
"global",
"$",
"DB",
";",
"// Do basic automatic PARAM checks on incoming data, using params description",
"// If any problems are found then exceptions are thrown with helpful error messages",
"$",
"p... | Manual role assignments to users
@param array $assignments An array of manual role assignment | [
"Manual",
"role",
"assignments",
"to",
"users"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/externallib.php#L1147-L1175 |
218,065 | moodle/moodle | enrol/externallib.php | core_role_external.unassign_roles | public static function unassign_roles($unassignments) {
global $DB;
// Do basic automatic PARAM checks on incoming data, using params description
// If any problems are found then exceptions are thrown with helpful error messages
$params = self::validate_parameters(self::unassign_roles... | php | public static function unassign_roles($unassignments) {
global $DB;
// Do basic automatic PARAM checks on incoming data, using params description
// If any problems are found then exceptions are thrown with helpful error messages
$params = self::validate_parameters(self::unassign_roles... | [
"public",
"static",
"function",
"unassign_roles",
"(",
"$",
"unassignments",
")",
"{",
"global",
"$",
"DB",
";",
"// Do basic automatic PARAM checks on incoming data, using params description",
"// If any problems are found then exceptions are thrown with helpful error messages",
"$",
... | Unassign roles from users
@param array $unassignments An array of unassignment | [
"Unassign",
"roles",
"from",
"users"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/externallib.php#L1216-L1241 |
218,066 | moodle/moodle | lib/classes/useragent.php | core_useragent.instance | public static function instance($reload = false, $forceuseragent = null) {
if (!self::$instance || $reload) {
self::$instance = new core_useragent($forceuseragent);
}
return self::$instance;
} | php | public static function instance($reload = false, $forceuseragent = null) {
if (!self::$instance || $reload) {
self::$instance = new core_useragent($forceuseragent);
}
return self::$instance;
} | [
"public",
"static",
"function",
"instance",
"(",
"$",
"reload",
"=",
"false",
",",
"$",
"forceuseragent",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"instance",
"||",
"$",
"reload",
")",
"{",
"self",
"::",
"$",
"instance",
"=",
"new",
... | Get an instance of the user agent object.
@param bool $reload If set to true the user agent will be reset and all ascertations remade.
@param string $forceuseragent The string to force as the user agent, don't use unless absolutely unavoidable.
@return core_useragent | [
"Get",
"an",
"instance",
"of",
"the",
"user",
"agent",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L108-L113 |
218,067 | moodle/moodle | lib/classes/useragent.php | core_useragent.get_device_type | public static function get_device_type() {
$instance = self::instance();
if ($instance->devicetype === null) {
return $instance->guess_device_type();
}
return $instance->devicetype;
} | php | public static function get_device_type() {
$instance = self::instance();
if ($instance->devicetype === null) {
return $instance->guess_device_type();
}
return $instance->devicetype;
} | [
"public",
"static",
"function",
"get_device_type",
"(",
")",
"{",
"$",
"instance",
"=",
"self",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"instance",
"->",
"devicetype",
"===",
"null",
")",
"{",
"return",
"$",
"instance",
"->",
"guess_device_type",
... | Returns the device type we believe is being used.
@return string | [
"Returns",
"the",
"device",
"type",
"we",
"believe",
"is",
"being",
"used",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L153-L159 |
218,068 | moodle/moodle | lib/classes/useragent.php | core_useragent.guess_device_type | protected function guess_device_type() {
global $CFG;
if (empty($CFG->enabledevicedetection)) {
$this->devicetype = self::DEVICETYPE_DEFAULT;
return $this->devicetype;
}
foreach ($this->devicetypecustoms as $value => $regex) {
if (preg_match($regex, $t... | php | protected function guess_device_type() {
global $CFG;
if (empty($CFG->enabledevicedetection)) {
$this->devicetype = self::DEVICETYPE_DEFAULT;
return $this->devicetype;
}
foreach ($this->devicetypecustoms as $value => $regex) {
if (preg_match($regex, $t... | [
"protected",
"function",
"guess_device_type",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"enabledevicedetection",
")",
")",
"{",
"$",
"this",
"->",
"devicetype",
"=",
"self",
"::",
"DEVICETYPE_DEFAULT",
";",
"retur... | Guesses the device type the user agent is running on.
@return string | [
"Guesses",
"the",
"device",
"type",
"the",
"user",
"agent",
"is",
"running",
"on",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L166-L189 |
218,069 | moodle/moodle | lib/classes/useragent.php | core_useragent.is_useragent_mobile | protected function is_useragent_mobile() {
// Mobile detection PHP direct copy from open source detectmobilebrowser.com.
$phonesregex = '/android .+ mobile|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re... | php | protected function is_useragent_mobile() {
// Mobile detection PHP direct copy from open source detectmobilebrowser.com.
$phonesregex = '/android .+ mobile|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re... | [
"protected",
"function",
"is_useragent_mobile",
"(",
")",
"{",
"// Mobile detection PHP direct copy from open source detectmobilebrowser.com.",
"$",
"phonesregex",
"=",
"'/android .+ mobile|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp... | Returns true if the user appears to be on a mobile device.
@return bool | [
"Returns",
"true",
"if",
"the",
"user",
"appears",
"to",
"be",
"on",
"a",
"mobile",
"device",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L195-L200 |
218,070 | moodle/moodle | lib/classes/useragent.php | core_useragent.get_device_type_list | public static function get_device_type_list($includecustomtypes = true) {
$types = self::$devicetypes;
if ($includecustomtypes) {
$instance = self::instance();
$types = array_merge($types, array_keys($instance->devicetypecustoms));
}
return $types;
} | php | public static function get_device_type_list($includecustomtypes = true) {
$types = self::$devicetypes;
if ($includecustomtypes) {
$instance = self::instance();
$types = array_merge($types, array_keys($instance->devicetypecustoms));
}
return $types;
} | [
"public",
"static",
"function",
"get_device_type_list",
"(",
"$",
"includecustomtypes",
"=",
"true",
")",
"{",
"$",
"types",
"=",
"self",
"::",
"$",
"devicetypes",
";",
"if",
"(",
"$",
"includecustomtypes",
")",
"{",
"$",
"instance",
"=",
"self",
"::",
"in... | Gets a list of known device types.
@param bool $includecustomtypes If set to true we'll include types that have been added by the admin.
@return array | [
"Gets",
"a",
"list",
"of",
"known",
"device",
"types",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L228-L235 |
218,071 | moodle/moodle | lib/classes/useragent.php | core_useragent.get_device_type_theme | public static function get_device_type_theme($devicetype = null) {
global $CFG;
if ($devicetype === null) {
$devicetype = self::get_device_type();
}
$themevarname = self::get_device_type_cfg_var_name($devicetype);
if (empty($CFG->$themevarname)) {
return f... | php | public static function get_device_type_theme($devicetype = null) {
global $CFG;
if ($devicetype === null) {
$devicetype = self::get_device_type();
}
$themevarname = self::get_device_type_cfg_var_name($devicetype);
if (empty($CFG->$themevarname)) {
return f... | [
"public",
"static",
"function",
"get_device_type_theme",
"(",
"$",
"devicetype",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"$",
"devicetype",
"===",
"null",
")",
"{",
"$",
"devicetype",
"=",
"self",
"::",
"get_device_type",
"(",
")",
"... | Returns the theme to use for the given device type.
This used to be get_selected_theme_for_device_type.
@param null|string $devicetype The device type to find out for. Defaults to the device the user is using,
@return bool | [
"Returns",
"the",
"theme",
"to",
"use",
"for",
"the",
"given",
"device",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L244-L254 |
218,072 | moodle/moodle | lib/classes/useragent.php | core_useragent.get_user_device_type | public static function get_user_device_type() {
$device = self::get_device_type();
$switched = get_user_preferences('switchdevice'.$device, false);
if ($switched != false) {
return $switched;
}
return $device;
} | php | public static function get_user_device_type() {
$device = self::get_device_type();
$switched = get_user_preferences('switchdevice'.$device, false);
if ($switched != false) {
return $switched;
}
return $device;
} | [
"public",
"static",
"function",
"get_user_device_type",
"(",
")",
"{",
"$",
"device",
"=",
"self",
"::",
"get_device_type",
"(",
")",
";",
"$",
"switched",
"=",
"get_user_preferences",
"(",
"'switchdevice'",
".",
"$",
"device",
",",
"false",
")",
";",
"if",
... | Gets the device type the user is currently using.
@return string | [
"Gets",
"the",
"device",
"type",
"the",
"user",
"is",
"currently",
"using",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L275-L282 |
218,073 | moodle/moodle | lib/classes/useragent.php | core_useragent.set_user_device_type | public static function set_user_device_type($newdevice) {
$devicetype = self::get_device_type();
if ($newdevice == $devicetype) {
unset_user_preference('switchdevice'.$devicetype);
return true;
} else {
$devicetypes = self::get_device_type_list();
... | php | public static function set_user_device_type($newdevice) {
$devicetype = self::get_device_type();
if ($newdevice == $devicetype) {
unset_user_preference('switchdevice'.$devicetype);
return true;
} else {
$devicetypes = self::get_device_type_list();
... | [
"public",
"static",
"function",
"set_user_device_type",
"(",
"$",
"newdevice",
")",
"{",
"$",
"devicetype",
"=",
"self",
"::",
"get_device_type",
"(",
")",
";",
"if",
"(",
"$",
"newdevice",
"==",
"$",
"devicetype",
")",
"{",
"unset_user_preference",
"(",
"'s... | Switches the device type we think the user is using to what ever was given.
@param string $newdevice
@return bool
@throws coding_exception | [
"Switches",
"the",
"device",
"type",
"we",
"think",
"the",
"user",
"is",
"using",
"to",
"what",
"ever",
"was",
"given",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L290-L303 |
218,074 | moodle/moodle | lib/classes/useragent.php | core_useragent.check_browser_version | public static function check_browser_version($brand, $version = null) {
switch ($brand) {
case 'MSIE':
// Internet Explorer.
return self::check_ie_version($version);
case 'Edge':
// Microsoft Edge.
return self::check_edge_... | php | public static function check_browser_version($brand, $version = null) {
switch ($brand) {
case 'MSIE':
// Internet Explorer.
return self::check_ie_version($version);
case 'Edge':
// Microsoft Edge.
return self::check_edge_... | [
"public",
"static",
"function",
"check_browser_version",
"(",
"$",
"brand",
",",
"$",
"version",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"brand",
")",
"{",
"case",
"'MSIE'",
":",
"// Internet Explorer.",
"return",
"self",
"::",
"check_ie_version",
"(",
"$... | Returns true if the user agent matches the given brand and the version is equal to or greater than that specified.
@param string $brand The branch to check for.
@param scalar $version The version if we need to find out if it is equal to or greater than that specified.
@return bool | [
"Returns",
"true",
"if",
"the",
"user",
"agent",
"matches",
"the",
"given",
"brand",
"and",
"the",
"version",
"is",
"equal",
"to",
"or",
"greater",
"than",
"that",
"specified",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L312-L360 |
218,075 | moodle/moodle | lib/classes/useragent.php | core_useragent.check_gecko_version | public static function check_gecko_version($version = null) {
// Gecko based browsers.
// Do not look for dates any more, we expect real Firefox version here.
$useragent = self::get_user_agent_string();
if ($useragent === false) {
return false;
}
if (empty($ve... | php | public static function check_gecko_version($version = null) {
// Gecko based browsers.
// Do not look for dates any more, we expect real Firefox version here.
$useragent = self::get_user_agent_string();
if ($useragent === false) {
return false;
}
if (empty($ve... | [
"public",
"static",
"function",
"check_gecko_version",
"(",
"$",
"version",
"=",
"null",
")",
"{",
"// Gecko based browsers.",
"// Do not look for dates any more, we expect real Firefox version here.",
"$",
"useragent",
"=",
"self",
"::",
"get_user_agent_string",
"(",
")",
... | Checks the user agent is Gecko based and that the version is equal to or greater than that specified.
@param string|int $version A version to check for, returns true if its equal to or greater than that specified.
@return bool | [
"Checks",
"the",
"user",
"agent",
"is",
"Gecko",
"based",
"and",
"that",
"the",
"version",
"is",
"equal",
"to",
"or",
"greater",
"than",
"that",
"specified",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L440-L486 |
218,076 | moodle/moodle | lib/classes/useragent.php | core_useragent.check_edge_version | public static function check_edge_version($version = null) {
$useragent = self::get_user_agent_string();
if ($useragent === false) {
// No User Agent found.
return false;
}
if (strpos($useragent, 'Edge/') === false) {
// Edge was not found in the UA ... | php | public static function check_edge_version($version = null) {
$useragent = self::get_user_agent_string();
if ($useragent === false) {
// No User Agent found.
return false;
}
if (strpos($useragent, 'Edge/') === false) {
// Edge was not found in the UA ... | [
"public",
"static",
"function",
"check_edge_version",
"(",
"$",
"version",
"=",
"null",
")",
"{",
"$",
"useragent",
"=",
"self",
"::",
"get_user_agent_string",
"(",
")",
";",
"if",
"(",
"$",
"useragent",
"===",
"false",
")",
"{",
"// No User Agent found.",
"... | Check the User Agent for the version of Edge.
@param string|int $version A version to check for, returns true if its equal to or greater than that specified.
@return bool | [
"Check",
"the",
"User",
"Agent",
"for",
"the",
"version",
"of",
"Edge",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L503-L532 |
218,077 | moodle/moodle | lib/classes/useragent.php | core_useragent.check_ie_version | public static function check_ie_version($version = null) {
// Internet Explorer.
$properties = self::check_ie_properties();
if (!is_array($properties)) {
return false;
}
// In case of IE we have to deal with BC of the version parameter.
if (is_null($version)) ... | php | public static function check_ie_version($version = null) {
// Internet Explorer.
$properties = self::check_ie_properties();
if (!is_array($properties)) {
return false;
}
// In case of IE we have to deal with BC of the version parameter.
if (is_null($version)) ... | [
"public",
"static",
"function",
"check_ie_version",
"(",
"$",
"version",
"=",
"null",
")",
"{",
"// Internet Explorer.",
"$",
"properties",
"=",
"self",
"::",
"check_ie_properties",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"properties",
")",
")",... | Checks the user agent is IE and that the version is equal to or greater than that specified.
@param string|int $version A version to check for, returns true if its equal to or greater than that specified.
@return bool | [
"Checks",
"the",
"user",
"agent",
"is",
"IE",
"and",
"that",
"the",
"version",
"is",
"equal",
"to",
"or",
"greater",
"than",
"that",
"specified",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L590-L603 |
218,078 | moodle/moodle | lib/classes/useragent.php | core_useragent.check_webkit_android_version | public static function check_webkit_android_version($version = null) {
// WebKit browser on Android.
$useragent = self::get_user_agent_string();
if ($useragent === false) {
return false;
}
if (strpos($useragent, 'Android') === false) {
return false;
... | php | public static function check_webkit_android_version($version = null) {
// WebKit browser on Android.
$useragent = self::get_user_agent_string();
if ($useragent === false) {
return false;
}
if (strpos($useragent, 'Android') === false) {
return false;
... | [
"public",
"static",
"function",
"check_webkit_android_version",
"(",
"$",
"version",
"=",
"null",
")",
"{",
"// WebKit browser on Android.",
"$",
"useragent",
"=",
"self",
"::",
"get_user_agent_string",
"(",
")",
";",
"if",
"(",
"$",
"useragent",
"===",
"false",
... | Checks the user agent is Webkit based and on Android and that the version is equal to or greater than that specified.
@param string|int $version A version to check for, returns true if its equal to or greater than that specified.
@return bool | [
"Checks",
"the",
"user",
"agent",
"is",
"Webkit",
"based",
"and",
"on",
"Android",
"and",
"that",
"the",
"version",
"is",
"equal",
"to",
"or",
"greater",
"than",
"that",
"specified",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L817-L835 |
218,079 | moodle/moodle | lib/classes/useragent.php | core_useragent.get_browser_version_classes | public static function get_browser_version_classes() {
$classes = array();
if (self::is_edge()) {
$classes[] = 'edge';
} else if (self::is_ie()) {
$classes[] = 'ie';
for ($i = 12; $i >= 6; $i--) {
if (self::check_ie_version($i)) {
... | php | public static function get_browser_version_classes() {
$classes = array();
if (self::is_edge()) {
$classes[] = 'edge';
} else if (self::is_ie()) {
$classes[] = 'ie';
for ($i = 12; $i >= 6; $i--) {
if (self::check_ie_version($i)) {
... | [
"public",
"static",
"function",
"get_browser_version_classes",
"(",
")",
"{",
"$",
"classes",
"=",
"array",
"(",
")",
";",
"if",
"(",
"self",
"::",
"is_edge",
"(",
")",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"'edge'",
";",
"}",
"else",
"if",
"(",
... | Gets an array of CSS classes to represent the user agent.
@return array | [
"Gets",
"an",
"array",
"of",
"CSS",
"classes",
"to",
"represent",
"the",
"user",
"agent",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L911-L946 |
218,080 | moodle/moodle | lib/classes/useragent.php | core_useragent.supports_svg | public static function supports_svg() {
// IE 5 - 8 don't support SVG at all.
$instance = self::instance();
if ($instance->supportssvg === null) {
if ($instance->useragent === false) {
// Can't be sure, just say no.
$instance->supportssvg = false;
... | php | public static function supports_svg() {
// IE 5 - 8 don't support SVG at all.
$instance = self::instance();
if ($instance->supportssvg === null) {
if ($instance->useragent === false) {
// Can't be sure, just say no.
$instance->supportssvg = false;
... | [
"public",
"static",
"function",
"supports_svg",
"(",
")",
"{",
"// IE 5 - 8 don't support SVG at all.",
"$",
"instance",
"=",
"self",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"instance",
"->",
"supportssvg",
"===",
"null",
")",
"{",
"if",
"(",
"$",
... | Returns true if the user agent supports the display of SVG images.
@return bool | [
"Returns",
"true",
"if",
"the",
"user",
"agent",
"supports",
"the",
"display",
"of",
"SVG",
"images",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L953-L978 |
218,081 | moodle/moodle | lib/classes/useragent.php | core_useragent.supports_json_contenttype | public static function supports_json_contenttype() {
// Modern browsers other than IE correctly supports 'application/json' media type.
if (!self::check_ie_version('0')) {
return true;
}
// IE8+ supports 'application/json' media type, when NOT in Compatibility View mode.
... | php | public static function supports_json_contenttype() {
// Modern browsers other than IE correctly supports 'application/json' media type.
if (!self::check_ie_version('0')) {
return true;
}
// IE8+ supports 'application/json' media type, when NOT in Compatibility View mode.
... | [
"public",
"static",
"function",
"supports_json_contenttype",
"(",
")",
"{",
"// Modern browsers other than IE correctly supports 'application/json' media type.",
"if",
"(",
"!",
"self",
"::",
"check_ie_version",
"(",
"'0'",
")",
")",
"{",
"return",
"true",
";",
"}",
"//... | Returns true if the user agent supports the MIME media type for JSON text, as defined in RFC 4627.
@return bool | [
"Returns",
"true",
"if",
"the",
"user",
"agent",
"supports",
"the",
"MIME",
"media",
"type",
"for",
"JSON",
"text",
"as",
"defined",
"in",
"RFC",
"4627",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/useragent.php#L985-L1001 |
218,082 | moodle/moodle | analytics/classes/local/indicator/base.php | base.calculate | public function calculate($sampleids, $samplesorigin, $starttime = false, $endtime = false, $existingcalculations = array()) {
if (!PHPUNIT_TEST && CLI_SCRIPT) {
echo '.';
}
$calculations = array();
$newcalculations = array();
$notnulls = array();
foreach ($... | php | public function calculate($sampleids, $samplesorigin, $starttime = false, $endtime = false, $existingcalculations = array()) {
if (!PHPUNIT_TEST && CLI_SCRIPT) {
echo '.';
}
$calculations = array();
$newcalculations = array();
$notnulls = array();
foreach ($... | [
"public",
"function",
"calculate",
"(",
"$",
"sampleids",
",",
"$",
"samplesorigin",
",",
"$",
"starttime",
"=",
"false",
",",
"$",
"endtime",
"=",
"false",
",",
"$",
"existingcalculations",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"PHPUNIT_TEST... | Calculates the indicator.
Returns an array of values which size matches $sampleids size.
@param int[] $sampleids
@param string $samplesorigin
@param integer $starttime Limit the calculation to this timestart
@param integer $endtime Limit the calculation to this timeend
@param array $existingcalculations Existing calc... | [
"Calculates",
"the",
"indicator",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/base.php#L152-L181 |
218,083 | moodle/moodle | mod/lti/register_form.php | mod_lti_register_types_form.definition | public function definition() {
global $CFG;
$mform =& $this->_form;
$mform->addElement('header', 'setup', get_string('registration_options', 'lti'));
// Tool Provider name.
$strrequired = get_string('required');
$mform->addElement('text', 'lti_registrationname', ge... | php | public function definition() {
global $CFG;
$mform =& $this->_form;
$mform->addElement('header', 'setup', get_string('registration_options', 'lti'));
// Tool Provider name.
$strrequired = get_string('required');
$mform->addElement('text', 'lti_registrationname', ge... | [
"public",
"function",
"definition",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"mform",
"=",
"&",
"$",
"this",
"->",
"_form",
";",
"$",
"mform",
"->",
"addElement",
"(",
"'header'",
",",
"'setup'",
",",
"get_string",
"(",
"'registration_options'",
",... | Set up the form definition. | [
"Set",
"up",
"the",
"form",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/register_form.php#L44-L104 |
218,084 | moodle/moodle | mod/lti/register_form.php | mod_lti_register_types_form.disable_fields | public function disable_fields() {
$mform =& $this->_form;
$mform->disabledIf('lti_registrationurl', null);
$mform->disabledIf('lti_capabilities', null);
$mform->disabledIf('lti_services', null);
} | php | public function disable_fields() {
$mform =& $this->_form;
$mform->disabledIf('lti_registrationurl', null);
$mform->disabledIf('lti_capabilities', null);
$mform->disabledIf('lti_services', null);
} | [
"public",
"function",
"disable_fields",
"(",
")",
"{",
"$",
"mform",
"=",
"&",
"$",
"this",
"->",
"_form",
";",
"$",
"mform",
"->",
"disabledIf",
"(",
"'lti_registrationurl'",
",",
"null",
")",
";",
"$",
"mform",
"->",
"disabledIf",
"(",
"'lti_capabilities... | Set up rules for disabling fields. | [
"Set",
"up",
"rules",
"for",
"disabling",
"fields",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/register_form.php#L109-L117 |
218,085 | moodle/moodle | lib/filebrowser/file_info_context_course.php | file_info_context_course.get_course_areas | protected function get_course_areas($extensions = '*', $returnemptyfolders = false) {
global $DB;
$allareas = [
'course_summary',
'course_overviewfiles',
'course_section',
'backup_section',
'backup_course',
'backup_automated',
... | php | protected function get_course_areas($extensions = '*', $returnemptyfolders = false) {
global $DB;
$allareas = [
'course_summary',
'course_overviewfiles',
'course_section',
'backup_section',
'backup_course',
'backup_automated',
... | [
"protected",
"function",
"get_course_areas",
"(",
"$",
"extensions",
"=",
"'*'",
",",
"$",
"returnemptyfolders",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"allareas",
"=",
"[",
"'course_summary'",
",",
"'course_overviewfiles'",
",",
"'course_section... | Returns list of areas inside this course
@param string $extensions Only return areas that have files with these extensions
@param bool $returnemptyfolders return all areas always, if true it will ignore the previous argument
@return array | [
"Returns",
"list",
"of",
"areas",
"inside",
"this",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info_context_course.php#L99-L125 |
218,086 | moodle/moodle | lib/filebrowser/file_info_context_course.php | file_info_context_course.get_area_course_section | protected function get_area_course_section($itemid, $filepath, $filename) {
global $CFG, $DB;
if (!has_capability('moodle/course:update', $this->context)) {
return null;
}
if (empty($itemid)) {
// list all sections
return new file_info_area_course_se... | php | protected function get_area_course_section($itemid, $filepath, $filename) {
global $CFG, $DB;
if (!has_capability('moodle/course:update', $this->context)) {
return null;
}
if (empty($itemid)) {
// list all sections
return new file_info_area_course_se... | [
"protected",
"function",
"get_area_course_section",
"(",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"if",
"(",
"!",
"has_capability",
"(",
"'moodle/course:update'",
",",
"$",
"this",
"->"... | Gets a stored file for the course section filearea directory
@param int $itemid item ID
@param string $filepath file path
@param string $filename file name
@return file_info|null file_info instance or null if not found or access not allowed | [
"Gets",
"a",
"stored",
"file",
"for",
"the",
"course",
"section",
"filearea",
"directory"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info_context_course.php#L203-L235 |
218,087 | moodle/moodle | lib/filebrowser/file_info_context_course.php | file_info_context_course.get_area_course_legacy | protected function get_area_course_legacy($itemid, $filepath, $filename) {
if (!has_capability('moodle/course:managefiles', $this->context)) {
return null;
}
if ($this->course->id != SITEID and $this->course->legacyfiles != 2) {
// bad luck, legacy course files not used ... | php | protected function get_area_course_legacy($itemid, $filepath, $filename) {
if (!has_capability('moodle/course:managefiles', $this->context)) {
return null;
}
if ($this->course->id != SITEID and $this->course->legacyfiles != 2) {
// bad luck, legacy course files not used ... | [
"protected",
"function",
"get_area_course_legacy",
"(",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
")",
"{",
"if",
"(",
"!",
"has_capability",
"(",
"'moodle/course:managefiles'",
",",
"$",
"this",
"->",
"context",
")",
")",
"{",
"return",
"nu... | Gets a stored file for the course legacy filearea directory
@param int $itemid item ID
@param string $filepath file path
@param string $filename file name
@return file_info|null file_info instance or null if not found or access not allowed | [
"Gets",
"a",
"stored",
"file",
"for",
"the",
"course",
"legacy",
"filearea",
"directory"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info_context_course.php#L245-L272 |
218,088 | moodle/moodle | lib/filebrowser/file_info_context_course.php | file_info_context_course.get_area_backup_section | protected function get_area_backup_section($itemid, $filepath, $filename) {
global $CFG, $DB;
if (!has_capability('moodle/backup:backupcourse', $this->context) and !has_capability('moodle/restore:restorecourse', $this->context)) {
return null;
}
if (empty($itemid)) {
... | php | protected function get_area_backup_section($itemid, $filepath, $filename) {
global $CFG, $DB;
if (!has_capability('moodle/backup:backupcourse', $this->context) and !has_capability('moodle/restore:restorecourse', $this->context)) {
return null;
}
if (empty($itemid)) {
... | [
"protected",
"function",
"get_area_backup_section",
"(",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"if",
"(",
"!",
"has_capability",
"(",
"'moodle/backup:backupcourse'",
",",
"$",
"this",
... | Gets a stored file for the backup section filearea directory
@param int $itemid item ID
@param string $filepath file path
@param string $filename file name
@return file_info|null file_info instance or null if not found or access not allowed | [
"Gets",
"a",
"stored",
"file",
"for",
"the",
"backup",
"section",
"filearea",
"directory"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info_context_course.php#L360-L394 |
218,089 | moodle/moodle | lib/filebrowser/file_info_context_course.php | file_info_context_course.get_child_module | protected function get_child_module($cm) {
$cmid = is_object($cm) ? $cm->id : $cm;
if (!array_key_exists($cmid, $this->childrenmodules)) {
$this->childrenmodules[$cmid] = null;
if (!($cm instanceof cm_info)) {
$cms = get_fast_modinfo($this->course)->cms;
... | php | protected function get_child_module($cm) {
$cmid = is_object($cm) ? $cm->id : $cm;
if (!array_key_exists($cmid, $this->childrenmodules)) {
$this->childrenmodules[$cmid] = null;
if (!($cm instanceof cm_info)) {
$cms = get_fast_modinfo($this->course)->cms;
... | [
"protected",
"function",
"get_child_module",
"(",
"$",
"cm",
")",
"{",
"$",
"cmid",
"=",
"is_object",
"(",
"$",
"cm",
")",
"?",
"$",
"cm",
"->",
"id",
":",
"$",
"cm",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"cmid",
",",
"$",
"this",
"-... | Returns the child module if it is accessible by the current user
@param cm_info|int $cm
@return file_info_context_module|null | [
"Returns",
"the",
"child",
"module",
"if",
"it",
"is",
"accessible",
"by",
"the",
"current",
"user"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info_context_course.php#L438-L452 |
218,090 | moodle/moodle | lib/filebrowser/file_info_context_course.php | file_info_context_course.get_module_areas_with_files | protected function get_module_areas_with_files($extensions = '*') {
global $DB;
$params1 = ['contextid' => $this->context->id,
'emptyfilename' => '.',
'contextlevel' => CONTEXT_MODULE,
'course' => $this->course->id];
$ctxfieldsas = context_helper::get_preload... | php | protected function get_module_areas_with_files($extensions = '*') {
global $DB;
$params1 = ['contextid' => $this->context->id,
'emptyfilename' => '.',
'contextlevel' => CONTEXT_MODULE,
'course' => $this->course->id];
$ctxfieldsas = context_helper::get_preload... | [
"protected",
"function",
"get_module_areas_with_files",
"(",
"$",
"extensions",
"=",
"'*'",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params1",
"=",
"[",
"'contextid'",
"=>",
"$",
"this",
"->",
"context",
"->",
"id",
",",
"'emptyfilename'",
"=>",
"'.'",
",... | Returns list of areas inside the course modules that have files with the given extension
@param string $extensions
@return array | [
"Returns",
"list",
"of",
"areas",
"inside",
"the",
"course",
"modules",
"that",
"have",
"files",
"with",
"the",
"given",
"extension"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info_context_course.php#L525-L569 |
218,091 | moodle/moodle | lib/classes/message/message.php | message.get_fullmessagehtml | protected function get_fullmessagehtml($processorname = '') {
if (!empty($processorname) && isset($this->additionalcontent[$processorname])) {
return $this->get_message_with_additional_content($processorname, 'fullmessagehtml');
} else {
return $this->fullmessagehtml;
}
... | php | protected function get_fullmessagehtml($processorname = '') {
if (!empty($processorname) && isset($this->additionalcontent[$processorname])) {
return $this->get_message_with_additional_content($processorname, 'fullmessagehtml');
} else {
return $this->fullmessagehtml;
}
... | [
"protected",
"function",
"get_fullmessagehtml",
"(",
"$",
"processorname",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"processorname",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"additionalcontent",
"[",
"$",
"processorname",
"]",
")",
")",
... | Fullmessagehtml content including any processor specific content.
@param string $processorname Name of the processor.
@return mixed|string | [
"Fullmessagehtml",
"content",
"including",
"any",
"processor",
"specific",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/message/message.php#L173-L179 |
218,092 | moodle/moodle | lib/classes/message/message.php | message.get_fullmessage | protected function get_fullmessage($processorname = '') {
if (!empty($processorname) && isset($this->additionalcontent[$processorname])) {
return $this->get_message_with_additional_content($processorname, 'fullmessage');
} else {
return $this->fullmessage;
}
} | php | protected function get_fullmessage($processorname = '') {
if (!empty($processorname) && isset($this->additionalcontent[$processorname])) {
return $this->get_message_with_additional_content($processorname, 'fullmessage');
} else {
return $this->fullmessage;
}
} | [
"protected",
"function",
"get_fullmessage",
"(",
"$",
"processorname",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"processorname",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"additionalcontent",
"[",
"$",
"processorname",
"]",
")",
")",
"{"... | Fullmessage content including any processor specific content.
@param string $processorname Name of the processor.
@return mixed|string | [
"Fullmessage",
"content",
"including",
"any",
"processor",
"specific",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/message/message.php#L188-L194 |
218,093 | moodle/moodle | lib/classes/message/message.php | message.get_smallmessage | protected function get_smallmessage($processorname = '') {
if (!empty($processorname) && isset($this->additionalcontent[$processorname])) {
return $this->get_message_with_additional_content($processorname, 'smallmessage');
} else {
return $this->smallmessage;
}
} | php | protected function get_smallmessage($processorname = '') {
if (!empty($processorname) && isset($this->additionalcontent[$processorname])) {
return $this->get_message_with_additional_content($processorname, 'smallmessage');
} else {
return $this->smallmessage;
}
} | [
"protected",
"function",
"get_smallmessage",
"(",
"$",
"processorname",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"processorname",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"additionalcontent",
"[",
"$",
"processorname",
"]",
")",
")",
"{... | Smallmessage content including any processor specific content.
@param string $processorname Name of the processor.
@return mixed|string | [
"Smallmessage",
"content",
"including",
"any",
"processor",
"specific",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/message/message.php#L203-L209 |
218,094 | moodle/moodle | lib/classes/message/message.php | message.set_customdata | protected function set_customdata($customdata) {
// Always include the courseid (because is not stored in the notifications or messages table).
if (!empty($this->courseid) && (is_object($customdata) || is_array($customdata))) {
$customdata = (array) $customdata;
$customdata['cour... | php | protected function set_customdata($customdata) {
// Always include the courseid (because is not stored in the notifications or messages table).
if (!empty($this->courseid) && (is_object($customdata) || is_array($customdata))) {
$customdata = (array) $customdata;
$customdata['cour... | [
"protected",
"function",
"set_customdata",
"(",
"$",
"customdata",
")",
"{",
"// Always include the courseid (because is not stored in the notifications or messages table).",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"courseid",
")",
"&&",
"(",
"is_object",
"(",
... | Always JSON encode customdata.
@param mixed $customdata a data structure that must be serialisable using json_encode(). | [
"Always",
"JSON",
"encode",
"customdata",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/message/message.php#L216-L223 |
218,095 | moodle/moodle | lib/classes/message/message.php | message.get_message_with_additional_content | protected function get_message_with_additional_content($processorname, $messagetype) {
$message = $this->$messagetype;
if (isset($this->additionalcontent[$processorname]['*'])) {
// Content that needs to be added to all format.
$pattern = $this->additionalcontent[$processorname][... | php | protected function get_message_with_additional_content($processorname, $messagetype) {
$message = $this->$messagetype;
if (isset($this->additionalcontent[$processorname]['*'])) {
// Content that needs to be added to all format.
$pattern = $this->additionalcontent[$processorname][... | [
"protected",
"function",
"get_message_with_additional_content",
"(",
"$",
"processorname",
",",
"$",
"messagetype",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"$",
"messagetype",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"additionalcontent",
"[",... | Helper method used to get message content added with processor specific content.
@param string $processorname Name of the processor.
@param string $messagetype one of 'fullmessagehtml', 'fullmessage', 'smallmessage'.
@return mixed|string | [
"Helper",
"method",
"used",
"to",
"get",
"message",
"content",
"added",
"with",
"processor",
"specific",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/message/message.php#L233-L250 |
218,096 | moodle/moodle | lib/classes/message/message.php | message.__isset | public function __isset($prop) {
if (in_array($prop, $this->properties)) {
return isset($this->$prop);
}
throw new \coding_exception("Invalid property $prop specified");
} | php | public function __isset($prop) {
if (in_array($prop, $this->properties)) {
return isset($this->$prop);
}
throw new \coding_exception("Invalid property $prop specified");
} | [
"public",
"function",
"__isset",
"(",
"$",
"prop",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"prop",
",",
"$",
"this",
"->",
"properties",
")",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"$",
"prop",
")",
";",
"}",
"throw",
"new",
"\\"... | Magic method to check if property is set.
@param string $prop name of property to check.
@return bool
@throws \coding_exception | [
"Magic",
"method",
"to",
"check",
"if",
"property",
"is",
"set",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/message/message.php#L296-L301 |
218,097 | moodle/moodle | lib/classes/message/message.php | message.get_eventobject_for_processor | public function get_eventobject_for_processor($processorname) {
// This is done for Backwards compatibility. We should consider throwing notices here in future versions and requesting
// them to use proper api.
$eventdata = new \stdClass();
foreach ($this->properties as $prop) {
... | php | public function get_eventobject_for_processor($processorname) {
// This is done for Backwards compatibility. We should consider throwing notices here in future versions and requesting
// them to use proper api.
$eventdata = new \stdClass();
foreach ($this->properties as $prop) {
... | [
"public",
"function",
"get_eventobject_for_processor",
"(",
"$",
"processorname",
")",
"{",
"// This is done for Backwards compatibility. We should consider throwing notices here in future versions and requesting",
"// them to use proper api.",
"$",
"eventdata",
"=",
"new",
"\\",
"stdC... | Get a event object for a specific processor in stdClass format.
@param string $processorname Name of the processor.
@return \stdClass event object in stdClass format. | [
"Get",
"a",
"event",
"object",
"for",
"a",
"specific",
"processor",
"in",
"stdClass",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/message/message.php#L326-L336 |
218,098 | moodle/moodle | lib/classes/plugininfo/media.php | media.set_enabled_plugins | public static function set_enabled_plugins($list) {
if (empty($list)) {
$list = [];
} else if (!is_array($list)) {
$list = explode(',', $list);
}
if ($list) {
$plugins = \core_plugin_manager::instance()->get_installed_plugins('media');
$lis... | php | public static function set_enabled_plugins($list) {
if (empty($list)) {
$list = [];
} else if (!is_array($list)) {
$list = explode(',', $list);
}
if ($list) {
$plugins = \core_plugin_manager::instance()->get_installed_plugins('media');
$lis... | [
"public",
"static",
"function",
"set_enabled_plugins",
"(",
"$",
"list",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"list",
")",
")",
"{",
"$",
"list",
"=",
"[",
"]",
";",
"}",
"else",
"if",
"(",
"!",
"is_array",
"(",
"$",
"list",
")",
")",
"{",
"... | Set the list of enabled media players in the specified sort order
To be used when changing settings or in unit tests
@param string|array $list list of plugin names without frankenstyle prefix - comma-separated string or an array | [
"Set",
"the",
"list",
"of",
"enabled",
"media",
"players",
"in",
"the",
"specified",
"sort",
"order",
"To",
"be",
"used",
"when",
"changing",
"settings",
"or",
"in",
"unit",
"tests"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/plugininfo/media.php#L143-L156 |
218,099 | moodle/moodle | lib/classes/plugininfo/media.php | media.get_rank | public function get_rank() {
$classname = '\media_'.$this->name.'_plugin';
if (class_exists($classname)) {
$object = new $classname();
return $object->get_rank();
}
return 0;
} | php | public function get_rank() {
$classname = '\media_'.$this->name.'_plugin';
if (class_exists($classname)) {
$object = new $classname();
return $object->get_rank();
}
return 0;
} | [
"public",
"function",
"get_rank",
"(",
")",
"{",
"$",
"classname",
"=",
"'\\media_'",
".",
"$",
"this",
"->",
"name",
".",
"'_plugin'",
";",
"if",
"(",
"class_exists",
"(",
"$",
"classname",
")",
")",
"{",
"$",
"object",
"=",
"new",
"$",
"classname",
... | Returns the default rank of this plugin for default sort order
@return int | [
"Returns",
"the",
"default",
"rank",
"of",
"this",
"plugin",
"for",
"default",
"sort",
"order"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/plugininfo/media.php#L162-L169 |
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.