id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
219,400 | moodle/moodle | lib/form/float.php | MoodleQuickForm_float.exportValue | public function exportValue(&$submitValues, $assoc = false) {
$value = $this->_findValue($submitValues);
if (null === $value) {
$value = $this->getValue();
} else if ($value) {
$value = unformat_float($value, true);
}
return $this->_prepareValue($value, $a... | php | public function exportValue(&$submitValues, $assoc = false) {
$value = $this->_findValue($submitValues);
if (null === $value) {
$value = $this->getValue();
} else if ($value) {
$value = unformat_float($value, true);
}
return $this->_prepareValue($value, $a... | [
"public",
"function",
"exportValue",
"(",
"&",
"$",
"submitValues",
",",
"$",
"assoc",
"=",
"false",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"_findValue",
"(",
"$",
"submitValues",
")",
";",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
... | Returns a 'safe' element's value.
@param array $submitValues array of submitted values to search
@param bool $assoc whether to return the value as associative array
@return mixed | [
"Returns",
"a",
"safe",
"element",
"s",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/float.php#L134-L142 |
219,401 | moodle/moodle | lib/form/float.php | MoodleQuickForm_float.format_float | private function format_float($value) {
if (is_numeric($value)) {
if ($value > 0) {
$decimals = strlen($value) - strlen(floor($value)) - 1;
} else {
$decimals = strlen($value) - strlen(ceil($value)) - 1;
}
$value = format_float($val... | php | private function format_float($value) {
if (is_numeric($value)) {
if ($value > 0) {
$decimals = strlen($value) - strlen(floor($value)) - 1;
} else {
$decimals = strlen($value) - strlen(ceil($value)) - 1;
}
$value = format_float($val... | [
"private",
"function",
"format_float",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"$",
"value",
">",
"0",
")",
"{",
"$",
"decimals",
"=",
"strlen",
"(",
"$",
"value",
")",
"-",
"strlen",
"("... | Given a float, prints it nicely.
This function reserves the number of decimal places.
@param float|null $value The float number to format
@return string Localised float | [
"Given",
"a",
"float",
"prints",
"it",
"nicely",
".",
"This",
"function",
"reserves",
"the",
"number",
"of",
"decimal",
"places",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/float.php#L176-L186 |
219,402 | moodle/moodle | lib/phpexcel/PHPExcel/Writer/Excel2007/Workbook.php | PHPExcel_Writer_Excel2007_Workbook.writeDefinedNameForNamedRange | private function writeDefinedNameForNamedRange(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange)
{
// definedName for named range
$objWriter->startElement('definedName');
$objWriter->writeAttribute('name', $pNamedRange->getName());
if ($pNamedRange->getLo... | php | private function writeDefinedNameForNamedRange(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange)
{
// definedName for named range
$objWriter->startElement('definedName');
$objWriter->writeAttribute('name', $pNamedRange->getName());
if ($pNamedRange->getLo... | [
"private",
"function",
"writeDefinedNameForNamedRange",
"(",
"PHPExcel_Shared_XMLWriter",
"$",
"objWriter",
"=",
"null",
",",
"PHPExcel_NamedRange",
"$",
"pNamedRange",
")",
"{",
"// definedName for named range",
"$",
"objWriter",
"->",
"startElement",
"(",
"'definedName'",... | Write Defined Name for named range
@param PHPExcel_Shared_XMLWriter $objWriter XML Writer
@param PHPExcel_NamedRange $pNamedRange
@throws PHPExcel_Writer_Exception | [
"Write",
"Defined",
"Name",
"for",
"named",
"range"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Writer/Excel2007/Workbook.php#L311-L333 |
219,403 | moodle/moodle | lib/phpexcel/PHPExcel/Writer/Excel2007/Workbook.php | PHPExcel_Writer_Excel2007_Workbook.writeDefinedNameForAutofilter | private function writeDefinedNameForAutofilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
{
// definedName for autoFilter
$autoFilterRange = $pSheet->getAutoFilter()->getRange();
if (!empty($autoFilterRange)) {
$objWriter->start... | php | private function writeDefinedNameForAutofilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
{
// definedName for autoFilter
$autoFilterRange = $pSheet->getAutoFilter()->getRange();
if (!empty($autoFilterRange)) {
$objWriter->start... | [
"private",
"function",
"writeDefinedNameForAutofilter",
"(",
"PHPExcel_Shared_XMLWriter",
"$",
"objWriter",
"=",
"null",
",",
"PHPExcel_Worksheet",
"$",
"pSheet",
"=",
"null",
",",
"$",
"pSheetId",
"=",
"0",
")",
"{",
"// definedName for autoFilter",
"$",
"autoFilterR... | Write Defined Name for autoFilter
@param PHPExcel_Shared_XMLWriter $objWriter XML Writer
@param PHPExcel_Worksheet $pSheet
@param int $pSheetId
@throws PHPExcel_Writer_Exception | [
"Write",
"Defined",
"Name",
"for",
"autoFilter"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Writer/Excel2007/Workbook.php#L343-L369 |
219,404 | moodle/moodle | message/output/popup/externallib.php | message_popup_external.get_popup_notifications_parameters | public static function get_popup_notifications_parameters() {
return new external_function_parameters(
array(
'useridto' => new external_value(PARAM_INT, 'the user id who received the message, 0 for current user'),
'newestfirst' => new external_value(
... | php | public static function get_popup_notifications_parameters() {
return new external_function_parameters(
array(
'useridto' => new external_value(PARAM_INT, 'the user id who received the message, 0 for current user'),
'newestfirst' => new external_value(
... | [
"public",
"static",
"function",
"get_popup_notifications_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'useridto'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'the user id who received the message, 0 for current u... | Get popup notifications parameters description.
@return external_function_parameters
@since 3.2 | [
"Get",
"popup",
"notifications",
"parameters",
"description",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/popup/externallib.php#L47-L58 |
219,405 | moodle/moodle | message/output/popup/externallib.php | message_popup_external.get_popup_notifications | public static function get_popup_notifications($useridto, $newestfirst, $limit, $offset) {
global $USER, $PAGE;
$params = self::validate_parameters(
self::get_popup_notifications_parameters(),
array(
'useridto' => $useridto,
'newestfirst' => $newe... | php | public static function get_popup_notifications($useridto, $newestfirst, $limit, $offset) {
global $USER, $PAGE;
$params = self::validate_parameters(
self::get_popup_notifications_parameters(),
array(
'useridto' => $useridto,
'newestfirst' => $newe... | [
"public",
"static",
"function",
"get_popup_notifications",
"(",
"$",
"useridto",
",",
"$",
"newestfirst",
",",
"$",
"limit",
",",
"$",
"offset",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters"... | Get notifications function.
@since 3.2
@throws invalid_parameter_exception
@throws moodle_exception
@param int $useridto the user id who received the message
@param bool $newestfirst true for ordering by newest first, false for oldest first
@param int $limit the number o... | [
"Get",
"notifications",
"function",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/popup/externallib.php#L72-L131 |
219,406 | moodle/moodle | message/output/popup/externallib.php | message_popup_external.get_popup_notifications_returns | public static function get_popup_notifications_returns() {
return new external_single_structure(
array(
'notifications' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new extern... | php | public static function get_popup_notifications_returns() {
return new external_single_structure(
array(
'notifications' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new extern... | [
"public",
"static",
"function",
"get_popup_notifications_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'notifications'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
... | Get notifications return description.
@return external_single_structure
@since 3.2 | [
"Get",
"notifications",
"return",
"description",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/popup/externallib.php#L139-L176 |
219,407 | moodle/moodle | message/output/popup/externallib.php | message_popup_external.get_unread_popup_notification_count | public static function get_unread_popup_notification_count($useridto) {
global $USER;
$params = self::validate_parameters(
self::get_unread_popup_notification_count_parameters(),
array('useridto' => $useridto)
);
$context = context_system::instance();
se... | php | public static function get_unread_popup_notification_count($useridto) {
global $USER;
$params = self::validate_parameters(
self::get_unread_popup_notification_count_parameters(),
array('useridto' => $useridto)
);
$context = context_system::instance();
se... | [
"public",
"static",
"function",
"get_unread_popup_notification_count",
"(",
"$",
"useridto",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_unread_popup_notification_count_parameters",
"(",
")",
... | Get unread notification count function.
@since 3.2
@throws invalid_parameter_exception
@throws moodle_exception
@param int $useridto the user id who received the message
@return external_description | [
"Get",
"unread",
"notification",
"count",
"function",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/popup/externallib.php#L201-L228 |
219,408 | moodle/moodle | admin/tool/templatelibrary/classes/api.php | api.list_templates | public static function list_templates($component = '', $search = '', $themename = '') {
global $CFG, $PAGE;
if (empty($themename)) {
$themename = $PAGE->theme->name;
}
$themeconfig = \theme_config::load($themename);
$templatedirs = array();
$results = array(... | php | public static function list_templates($component = '', $search = '', $themename = '') {
global $CFG, $PAGE;
if (empty($themename)) {
$themename = $PAGE->theme->name;
}
$themeconfig = \theme_config::load($themename);
$templatedirs = array();
$results = array(... | [
"public",
"static",
"function",
"list_templates",
"(",
"$",
"component",
"=",
"''",
",",
"$",
"search",
"=",
"''",
",",
"$",
"themename",
"=",
"''",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"if",
"(",
"empty",
"(",
"$",
"themename",
"... | Return a list of details about installed templates.
@param string $component Filter the list to a single component.
@param string $search Search string to optionally filter the list of templates.
@param string $themename The name of the current theme.
@return array[string] Where each template is in the form "component... | [
"Return",
"a",
"list",
"of",
"details",
"about",
"installed",
"templates",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/templatelibrary/classes/api.php#L49-L116 |
219,409 | moodle/moodle | blocks/tags/edit_form.php | block_tags_edit_form.add_collection_selector | protected function add_collection_selector($mform) {
$tagcolls = core_tag_collection::get_collections_menu(false, false, get_string('anycollection', 'block_tags'));
if (count($tagcolls) <= 1) {
return;
}
$tagcollssearchable = core_tag_collection::get_collections_menu(false, ... | php | protected function add_collection_selector($mform) {
$tagcolls = core_tag_collection::get_collections_menu(false, false, get_string('anycollection', 'block_tags'));
if (count($tagcolls) <= 1) {
return;
}
$tagcollssearchable = core_tag_collection::get_collections_menu(false, ... | [
"protected",
"function",
"add_collection_selector",
"(",
"$",
"mform",
")",
"{",
"$",
"tagcolls",
"=",
"core_tag_collection",
"::",
"get_collections_menu",
"(",
"false",
",",
"false",
",",
"get_string",
"(",
"'anycollection'",
",",
"'block_tags'",
")",
")",
";",
... | Add the tag collection selector
@param object $mform the form being built. | [
"Add",
"the",
"tag",
"collection",
"selector"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/tags/edit_form.php#L79-L99 |
219,410 | moodle/moodle | lib/classes/event/user_info_category_created.php | user_info_category_created.create_from_category | public static function create_from_category($category) {
$event = self::create(array(
'objectid' => $category->id,
'context' => \context_system::instance(),
'other' => array(
'name' => $category->name,
)
));
$event->add_record_snap... | php | public static function create_from_category($category) {
$event = self::create(array(
'objectid' => $category->id,
'context' => \context_system::instance(),
'other' => array(
'name' => $category->name,
)
));
$event->add_record_snap... | [
"public",
"static",
"function",
"create_from_category",
"(",
"$",
"category",
")",
"{",
"$",
"event",
"=",
"self",
"::",
"create",
"(",
"array",
"(",
"'objectid'",
"=>",
"$",
"category",
"->",
"id",
",",
"'context'",
"=>",
"\\",
"context_system",
"::",
"in... | Creates an event from a profile info category.
@since Moodle 3.4
@param \stdClass $category A sna[pshot of the created category.
@return \core\event\base | [
"Creates",
"an",
"event",
"from",
"a",
"profile",
"info",
"category",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/event/user_info_category_created.php#L61-L73 |
219,411 | moodle/moodle | privacy/classes/local/request/userlist_collection.php | userlist_collection.add_userlist | public function add_userlist(userlist_base $userlist) : userlist_collection {
$component = $userlist->get_component();
if (isset($this->userlists[$component])) {
throw new \moodle_exception("A userlist has already been added for the '{$component}' component");
}
$this->userl... | php | public function add_userlist(userlist_base $userlist) : userlist_collection {
$component = $userlist->get_component();
if (isset($this->userlists[$component])) {
throw new \moodle_exception("A userlist has already been added for the '{$component}' component");
}
$this->userl... | [
"public",
"function",
"add_userlist",
"(",
"userlist_base",
"$",
"userlist",
")",
":",
"userlist_collection",
"{",
"$",
"component",
"=",
"$",
"userlist",
"->",
"get_component",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"userlists",
"[",
"... | Add a userlist to this collection.
@param userlist_base $userlist the userlist to export.
@return $this | [
"Add",
"a",
"userlist",
"to",
"this",
"collection",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/local/request/userlist_collection.php#L77-L86 |
219,412 | moodle/moodle | privacy/classes/local/request/userlist_collection.php | userlist_collection.get_userlist_for_component | public function get_userlist_for_component(string $component) {
if (isset($this->userlists[$component])) {
return $this->userlists[$component];
}
return null;
} | php | public function get_userlist_for_component(string $component) {
if (isset($this->userlists[$component])) {
return $this->userlists[$component];
}
return null;
} | [
"public",
"function",
"get_userlist_for_component",
"(",
"string",
"$",
"component",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"userlists",
"[",
"$",
"component",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"userlists",
"[",
"$",
"compon... | Get the userlist for the specified component.
@param string $component the frankenstyle name of the component to fetch for.
@return userlist_base|null | [
"Get",
"the",
"userlist",
"for",
"the",
"specified",
"component",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/local/request/userlist_collection.php#L104-L110 |
219,413 | moodle/moodle | question/classes/statistics/questions/all_calculated_for_qubaid_condition.php | all_calculated_for_qubaid_condition.initialise_for_subq | public function initialise_for_subq($step, $variant = null) {
$newsubqstat = new calculated_for_subquestion($step, $variant);
if ($variant === null) {
$this->subquestionstats[$step->questionid] = $newsubqstat;
} else {
$this->subquestionstats[$step->questionid]->variantst... | php | public function initialise_for_subq($step, $variant = null) {
$newsubqstat = new calculated_for_subquestion($step, $variant);
if ($variant === null) {
$this->subquestionstats[$step->questionid] = $newsubqstat;
} else {
$this->subquestionstats[$step->questionid]->variantst... | [
"public",
"function",
"initialise_for_subq",
"(",
"$",
"step",
",",
"$",
"variant",
"=",
"null",
")",
"{",
"$",
"newsubqstat",
"=",
"new",
"calculated_for_subquestion",
"(",
"$",
"step",
",",
"$",
"variant",
")",
";",
"if",
"(",
"$",
"variant",
"===",
"n... | Set up a calculated_for_subquestion instance ready to store a randomly selected question's stats.
@param object $step
@param int|null $variant Is this to keep track of a variant's stats? If so what is the variant, if not null. | [
"Set",
"up",
"a",
"calculated_for_subquestion",
"instance",
"ready",
"to",
"store",
"a",
"randomly",
"selected",
"question",
"s",
"stats",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/all_calculated_for_qubaid_condition.php#L67-L74 |
219,414 | moodle/moodle | question/classes/statistics/questions/all_calculated_for_qubaid_condition.php | all_calculated_for_qubaid_condition.initialise_for_slot | public function initialise_for_slot($slot, $question, $variant = null) {
$newqstat = new calculated($question, $slot, $variant);
if ($variant === null) {
$this->questionstats[$slot] = $newqstat;
} else {
$this->questionstats[$slot]->variantstats[$variant] = $newqstat;
... | php | public function initialise_for_slot($slot, $question, $variant = null) {
$newqstat = new calculated($question, $slot, $variant);
if ($variant === null) {
$this->questionstats[$slot] = $newqstat;
} else {
$this->questionstats[$slot]->variantstats[$variant] = $newqstat;
... | [
"public",
"function",
"initialise_for_slot",
"(",
"$",
"slot",
",",
"$",
"question",
",",
"$",
"variant",
"=",
"null",
")",
"{",
"$",
"newqstat",
"=",
"new",
"calculated",
"(",
"$",
"question",
",",
"$",
"slot",
",",
"$",
"variant",
")",
";",
"if",
"... | Set up a calculated instance ready to store a slot question's stats.
@param int $slot
@param object $question
@param int|null $variant Is this to keep track of a variant's stats? If so what is the variant, if not null. | [
"Set",
"up",
"a",
"calculated",
"instance",
"ready",
"to",
"store",
"a",
"slot",
"question",
"s",
"stats",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/all_calculated_for_qubaid_condition.php#L83-L90 |
219,415 | moodle/moodle | question/classes/statistics/questions/all_calculated_for_qubaid_condition.php | all_calculated_for_qubaid_condition.for_subq | public function for_subq($questionid, $variant = null) {
if ($variant === null) {
if (!isset($this->subquestionstats[$questionid])) {
throw new \coding_exception('Reference to unknown question id ' . $questionid);
} else {
return $this->subquestionstats[$q... | php | public function for_subq($questionid, $variant = null) {
if ($variant === null) {
if (!isset($this->subquestionstats[$questionid])) {
throw new \coding_exception('Reference to unknown question id ' . $questionid);
} else {
return $this->subquestionstats[$q... | [
"public",
"function",
"for_subq",
"(",
"$",
"questionid",
",",
"$",
"variant",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"variant",
"===",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"subquestionstats",
"[",
"$",
"questionid",
"]"... | Reference for a item stats instance for a questionid and optional variant no.
@param int $questionid The id of the sub question.
@param int|null $variant if not null then we want the object to store a variant of a sub-question's stats.
@return calculated|calculated_for_subquestion stats instance for a questionid and ... | [
"Reference",
"for",
"a",
"item",
"stats",
"instance",
"for",
"a",
"questionid",
"and",
"optional",
"variant",
"no",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/all_calculated_for_qubaid_condition.php#L116-L131 |
219,416 | moodle/moodle | question/classes/statistics/questions/all_calculated_for_qubaid_condition.php | all_calculated_for_qubaid_condition.for_slot | public function for_slot($slot, $variant = null) {
if ($variant === null) {
if (!isset($this->questionstats[$slot])) {
throw new \coding_exception('Reference to unknown slot ' . $slot);
} else {
return $this->questionstats[$slot];
}
} e... | php | public function for_slot($slot, $variant = null) {
if ($variant === null) {
if (!isset($this->questionstats[$slot])) {
throw new \coding_exception('Reference to unknown slot ' . $slot);
} else {
return $this->questionstats[$slot];
}
} e... | [
"public",
"function",
"for_slot",
"(",
"$",
"slot",
",",
"$",
"variant",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"variant",
"===",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"questionstats",
"[",
"$",
"slot",
"]",
")",
")",... | Get position stats instance for a slot and optional variant no.
@param int $slot The slot no.
@param int|null $variant if provided then we want the object which stores a variant of a position's stats.
@return calculated|calculated_for_subquestion An instance of the class storing the calculated position stats.
@throws... | [
"Get",
"position",
"stats",
"instance",
"for",
"a",
"slot",
"and",
"optional",
"variant",
"no",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/all_calculated_for_qubaid_condition.php#L174-L188 |
219,417 | moodle/moodle | question/classes/statistics/questions/all_calculated_for_qubaid_condition.php | all_calculated_for_qubaid_condition.get_last_calculated_time | public function get_last_calculated_time($qubaids) {
global $DB;
$timemodified = time() - self::TIME_TO_CACHE;
return $DB->get_field_select('question_statistics', 'timemodified', 'hashcode = ? AND timemodified > ?',
array($qubaids->get_hash_code(), $timemodi... | php | public function get_last_calculated_time($qubaids) {
global $DB;
$timemodified = time() - self::TIME_TO_CACHE;
return $DB->get_field_select('question_statistics', 'timemodified', 'hashcode = ? AND timemodified > ?',
array($qubaids->get_hash_code(), $timemodi... | [
"public",
"function",
"get_last_calculated_time",
"(",
"$",
"qubaids",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"timemodified",
"=",
"time",
"(",
")",
"-",
"self",
"::",
"TIME_TO_CACHE",
";",
"return",
"$",
"DB",
"->",
"get_field_select",
"(",
"'question_sta... | Find time of non-expired statistics in the database.
@param \qubaid_condition $qubaids Which question usages to look for stats for?
@return int|bool Time of cached record that matches this qubaid_condition or false if non found. | [
"Find",
"time",
"of",
"non",
"-",
"expired",
"statistics",
"in",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/all_calculated_for_qubaid_condition.php#L244-L250 |
219,418 | moodle/moodle | question/classes/statistics/questions/all_calculated_for_qubaid_condition.php | all_calculated_for_qubaid_condition.cache | public function cache($qubaids) {
foreach ($this->get_all_slots() as $slot) {
$this->for_slot($slot)->cache($qubaids);
}
foreach ($this->get_all_subq_ids() as $subqid) {
$this->for_subq($subqid)->cache($qubaids);
}
} | php | public function cache($qubaids) {
foreach ($this->get_all_slots() as $slot) {
$this->for_slot($slot)->cache($qubaids);
}
foreach ($this->get_all_subq_ids() as $subqid) {
$this->for_subq($subqid)->cache($qubaids);
}
} | [
"public",
"function",
"cache",
"(",
"$",
"qubaids",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"get_all_slots",
"(",
")",
"as",
"$",
"slot",
")",
"{",
"$",
"this",
"->",
"for_slot",
"(",
"$",
"slot",
")",
"->",
"cache",
"(",
"$",
"qubaids",
")",
... | Save stats to db.
@param \qubaid_condition $qubaids Which question usages are we caching the stats of? | [
"Save",
"stats",
"to",
"db",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/all_calculated_for_qubaid_condition.php#L257-L265 |
219,419 | moodle/moodle | question/classes/statistics/questions/all_calculated_for_qubaid_condition.php | all_calculated_for_qubaid_condition.any_error_messages | public function any_error_messages() {
$errors = array();
foreach ($this->get_all_slots() as $slot) {
foreach ($this->for_slot($slot)->get_sub_question_ids() as $subqid) {
if ($this->for_subq($subqid)->differentweights) {
$name = $this->for_subq($subqid)->... | php | public function any_error_messages() {
$errors = array();
foreach ($this->get_all_slots() as $slot) {
foreach ($this->for_slot($slot)->get_sub_question_ids() as $subqid) {
if ($this->for_subq($subqid)->differentweights) {
$name = $this->for_subq($subqid)->... | [
"public",
"function",
"any_error_messages",
"(",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"get_all_slots",
"(",
")",
"as",
"$",
"slot",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"for_slot",
"(",
"$",... | Call after calculations to output any error messages.
@return string[] Array of strings describing error messages found during stats calculation. | [
"Call",
"after",
"calculations",
"to",
"output",
"any",
"error",
"messages",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/all_calculated_for_qubaid_condition.php#L295-L306 |
219,420 | moodle/moodle | question/classes/statistics/questions/all_calculated_for_qubaid_condition.php | all_calculated_for_qubaid_condition.make_new_subq_stat_for | protected function make_new_subq_stat_for($displaynumber, $slot, $subqid, $variant = null) {
$slotstat = fullclone($this->for_subq($subqid, $variant));
$slotstat->question->number = $this->for_slot($slot)->question->number;
$slotstat->subqdisplayorder = $displaynumber;
return $slotstat;
... | php | protected function make_new_subq_stat_for($displaynumber, $slot, $subqid, $variant = null) {
$slotstat = fullclone($this->for_subq($subqid, $variant));
$slotstat->question->number = $this->for_slot($slot)->question->number;
$slotstat->subqdisplayorder = $displaynumber;
return $slotstat;
... | [
"protected",
"function",
"make_new_subq_stat_for",
"(",
"$",
"displaynumber",
",",
"$",
"slot",
",",
"$",
"subqid",
",",
"$",
"variant",
"=",
"null",
")",
"{",
"$",
"slotstat",
"=",
"fullclone",
"(",
"$",
"this",
"->",
"for_subq",
"(",
"$",
"subqid",
","... | We need a new object for display. Sub-question stats can appear more than once in different slots.
So we create a clone of the object and then we can set properties on the object that are per slot.
@param int $displaynumber The display number for this sub question.
@param int $slot ... | [
"We",
"need",
"a",
"new",
"object",
"for",
"display",
".",
"Sub",
"-",
"question",
"stats",
"can",
"appear",
"more",
"than",
"once",
"in",
"different",
"slots",
".",
"So",
"we",
"create",
"a",
"clone",
"of",
"the",
"object",
"and",
"then",
"we",
"can",... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/all_calculated_for_qubaid_condition.php#L437-L442 |
219,421 | moodle/moodle | question/classes/statistics/questions/all_calculated_for_qubaid_condition.php | all_calculated_for_qubaid_condition.make_new_calculated_question_summary_stat | protected function make_new_calculated_question_summary_stat($randomquestioncalculated, $subquestionstats) {
$question = $randomquestioncalculated->question;
$slot = $randomquestioncalculated->slot;
$calculatedsummary = new calculated_question_summary($question, $slot, $subquestionstats);
... | php | protected function make_new_calculated_question_summary_stat($randomquestioncalculated, $subquestionstats) {
$question = $randomquestioncalculated->question;
$slot = $randomquestioncalculated->slot;
$calculatedsummary = new calculated_question_summary($question, $slot, $subquestionstats);
... | [
"protected",
"function",
"make_new_calculated_question_summary_stat",
"(",
"$",
"randomquestioncalculated",
",",
"$",
"subquestionstats",
")",
"{",
"$",
"question",
"=",
"$",
"randomquestioncalculated",
"->",
"question",
";",
"$",
"slot",
"=",
"$",
"randomquestioncalcul... | Create a summary calculated object for a calculated question. This is used as a placeholder
to indicate that a calculated question has sub questions or variations to show rather than listing each
subquestion or variation directly.
@param calculated $randomquestioncalculated The calculated instance for the random ques... | [
"Create",
"a",
"summary",
"calculated",
"object",
"for",
"a",
"calculated",
"question",
".",
"This",
"is",
"used",
"as",
"a",
"placeholder",
"to",
"indicate",
"that",
"a",
"calculated",
"question",
"has",
"sub",
"questions",
"or",
"variations",
"to",
"show",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/all_calculated_for_qubaid_condition.php#L453-L459 |
219,422 | moodle/moodle | mod/forum/classes/local/factories/legacy_data_mapper.php | legacy_data_mapper.get_legacy_data_mapper_for_vault | public function get_legacy_data_mapper_for_vault($entity) {
switch($entity) {
case 'forum':
return $this->get_forum_data_mapper();
case 'discussion':
return $this->get_discussion_data_mapper();
case 'post':
return $this->get_pos... | php | public function get_legacy_data_mapper_for_vault($entity) {
switch($entity) {
case 'forum':
return $this->get_forum_data_mapper();
case 'discussion':
return $this->get_discussion_data_mapper();
case 'post':
return $this->get_pos... | [
"public",
"function",
"get_legacy_data_mapper_for_vault",
"(",
"$",
"entity",
")",
"{",
"switch",
"(",
"$",
"entity",
")",
"{",
"case",
"'forum'",
":",
"return",
"$",
"this",
"->",
"get_forum_data_mapper",
"(",
")",
";",
"case",
"'discussion'",
":",
"return",
... | Get the corresponding entity based on the supplied value
@param string $entity
@return author_data_mapper|discussion_data_mapper|forum_data_mapper|post_data_mapper | [
"Get",
"the",
"corresponding",
"entity",
"based",
"on",
"the",
"supplied",
"value"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/legacy_data_mapper.php#L87-L98 |
219,423 | moodle/moodle | admin/tool/dataprivacy/classes/metadata_registry.php | metadata_registry.format_metadata | protected function format_metadata($collection, $component, $internaldata) {
foreach ($collection as $collectioninfo) {
$privacyfields = $collectioninfo->get_privacy_fields();
$fields = '';
if (!empty($privacyfields)) {
$fields = array_map(function($key, $fiel... | php | protected function format_metadata($collection, $component, $internaldata) {
foreach ($collection as $collectioninfo) {
$privacyfields = $collectioninfo->get_privacy_fields();
$fields = '';
if (!empty($privacyfields)) {
$fields = array_map(function($key, $fiel... | [
"protected",
"function",
"format_metadata",
"(",
"$",
"collection",
",",
"$",
"component",
",",
"$",
"internaldata",
")",
"{",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"collectioninfo",
")",
"{",
"$",
"privacyfields",
"=",
"$",
"collectioninfo",
"->",
"... | Formats the metadata for use with a template.
@param array $collection The collection associated with the component that we want to expand and format.
@param string $component The component that we are dealing in
@param array $internaldata The array to add the formatted metadata to.
@return array The internal data ... | [
"Formats",
"the",
"metadata",
"for",
"use",
"with",
"a",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/metadata_registry.php#L122-L149 |
219,424 | moodle/moodle | admin/tool/dataprivacy/classes/metadata_registry.php | metadata_registry.get_full_component_list | protected function get_full_component_list() {
global $CFG;
$list = \core_component::get_component_list();
$list['core']['core'] = "{$CFG->dirroot}/lib";
$formattedlist = [];
foreach ($list as $plugintype => $plugin) {
$formattedlist[] = ['plugin_type' => $plugintype... | php | protected function get_full_component_list() {
global $CFG;
$list = \core_component::get_component_list();
$list['core']['core'] = "{$CFG->dirroot}/lib";
$formattedlist = [];
foreach ($list as $plugintype => $plugin) {
$formattedlist[] = ['plugin_type' => $plugintype... | [
"protected",
"function",
"get_full_component_list",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"list",
"=",
"\\",
"core_component",
"::",
"get_component_list",
"(",
")",
";",
"$",
"list",
"[",
"'core'",
"]",
"[",
"'core'",
"]",
"=",
"\"{$CFG->dirroot}/li... | Return the full list of components.
@return array An array of plugin types which contain plugin data. | [
"Return",
"the",
"full",
"list",
"of",
"components",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/metadata_registry.php#L156-L167 |
219,425 | moodle/moodle | admin/tool/dataprivacy/classes/metadata_registry.php | metadata_registry.get_contrib_list | protected function get_contrib_list() {
return array_map(function($plugins) {
return array_filter($plugins, function($plugindata) {
return !$plugindata->is_standard();
});
}, \core_plugin_manager::instance()->get_plugins());
} | php | protected function get_contrib_list() {
return array_map(function($plugins) {
return array_filter($plugins, function($plugindata) {
return !$plugindata->is_standard();
});
}, \core_plugin_manager::instance()->get_plugins());
} | [
"protected",
"function",
"get_contrib_list",
"(",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"plugins",
")",
"{",
"return",
"array_filter",
"(",
"$",
"plugins",
",",
"function",
"(",
"$",
"plugindata",
")",
"{",
"return",
"!",
"$",
"plugin... | Returns a list of contributed plugins installed on the system.
@return array A list of contributed plugins installed. | [
"Returns",
"a",
"list",
"of",
"contributed",
"plugins",
"installed",
"on",
"the",
"system",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/metadata_registry.php#L174-L180 |
219,426 | moodle/moodle | lib/adodb/datadict/datadict-mysql.inc.php | ADODB2_mysql.MetaType | function MetaType($t,$len=-1,$fieldobj=false)
{
if (is_object($t)) {
$fieldobj = $t;
$t = $fieldobj->type;
$len = $fieldobj->max_length;
}
$is_serial = is_object($fieldobj) && $fieldobj->primary_key && $fieldobj->auto_increment;
$len = -1; // mysql max_length is not accurate
switch (strtoupper($t))... | php | function MetaType($t,$len=-1,$fieldobj=false)
{
if (is_object($t)) {
$fieldobj = $t;
$t = $fieldobj->type;
$len = $fieldobj->max_length;
}
$is_serial = is_object($fieldobj) && $fieldobj->primary_key && $fieldobj->auto_increment;
$len = -1; // mysql max_length is not accurate
switch (strtoupper($t))... | [
"function",
"MetaType",
"(",
"$",
"t",
",",
"$",
"len",
"=",
"-",
"1",
",",
"$",
"fieldobj",
"=",
"false",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"t",
")",
")",
"{",
"$",
"fieldobj",
"=",
"$",
"t",
";",
"$",
"t",
"=",
"$",
"fieldobj",
... | needs column-definition! | [
"needs",
"column",
"-",
"definition!"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/datadict/datadict-mysql.inc.php#L27-L79 |
219,427 | moodle/moodle | auth/cas/CAS/CAS/ProxiedService/Http/Post.php | CAS_ProxiedService_Http_Post.populateRequest | protected function populateRequest (CAS_Request_RequestInterface $request)
{
if (empty($this->_contentType) && !empty($this->_body)) {
throw new CAS_ProxiedService_Exception(
"If you pass a POST body, you must specify a content type via "
.get_class($this).'->setC... | php | protected function populateRequest (CAS_Request_RequestInterface $request)
{
if (empty($this->_contentType) && !empty($this->_body)) {
throw new CAS_ProxiedService_Exception(
"If you pass a POST body, you must specify a content type via "
.get_class($this).'->setC... | [
"protected",
"function",
"populateRequest",
"(",
"CAS_Request_RequestInterface",
"$",
"request",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_contentType",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"_body",
")",
")",
"{",
"throw",
"new",
... | Add any other parts of the request needed by concrete classes
@param CAS_Request_RequestInterface $request request interface class
@return void | [
"Add",
"any",
"other",
"parts",
"of",
"the",
"request",
"needed",
"by",
"concrete",
"classes"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/ProxiedService/Http/Post.php#L133-L148 |
219,428 | moodle/moodle | lib/editor/tinymce/classes/plugin.php | editor_tinymce_plugin.add_button_before | protected function add_button_before(array &$params, $row, $button,
$before = '', $alwaysadd = true) {
if ($button !== '|' && $this->find_button($params, $button)) {
return true;
}
$row = $this->fix_row($params, $row);
$field = 'theme_advanced_buttons' . $row;
... | php | protected function add_button_before(array &$params, $row, $button,
$before = '', $alwaysadd = true) {
if ($button !== '|' && $this->find_button($params, $button)) {
return true;
}
$row = $this->fix_row($params, $row);
$field = 'theme_advanced_buttons' . $row;
... | [
"protected",
"function",
"add_button_before",
"(",
"array",
"&",
"$",
"params",
",",
"$",
"row",
",",
"$",
"button",
",",
"$",
"before",
"=",
"''",
",",
"$",
"alwaysadd",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"button",
"!==",
"'|'",
"&&",
"$",
"th... | Adds a button to the editor.
Specify the location of this button using the $before variable. If you
leave this blank, the button will be added at the start.
If you want to try different possible locations depending on existing
plugins you can set $alwaysadd to false and check the return value
to see if it succeeded.
... | [
"Adds",
"a",
"button",
"to",
"the",
"editor",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/editor/tinymce/classes/plugin.php#L230-L261 |
219,429 | moodle/moodle | lib/editor/tinymce/classes/plugin.php | editor_tinymce_plugin.find_button | protected function find_button(array &$params, $button) {
foreach ($params as $key => $value) {
if (preg_match('/^theme_advanced_buttons(\d+)$/', $key, $matches) &&
strpos(','. $value. ',', ','. $button. ',') !== false) {
return (int)$matches[1];
}
... | php | protected function find_button(array &$params, $button) {
foreach ($params as $key => $value) {
if (preg_match('/^theme_advanced_buttons(\d+)$/', $key, $matches) &&
strpos(','. $value. ',', ','. $button. ',') !== false) {
return (int)$matches[1];
}
... | [
"protected",
"function",
"find_button",
"(",
"array",
"&",
"$",
"params",
",",
"$",
"button",
")",
"{",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^theme_advanced_buttons(\\d+)$/'",
",",
... | Tests if button is already present.
@param array $params TinyMCE init parameters array
@param string $button button name
@return false|int false if button is not found, row number otherwise (row numbers start from 1) | [
"Tests",
"if",
"button",
"is",
"already",
"present",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/editor/tinymce/classes/plugin.php#L270-L278 |
219,430 | moodle/moodle | lib/editor/tinymce/classes/plugin.php | editor_tinymce_plugin.fix_row | private function fix_row(array &$params, $row) {
if ($row <= 1) {
// Row 1 is always present.
return 1;
} else if (isset($params['theme_advanced_buttons' . $row])) {
return $row;
} else {
return $this->count_button_rows($params);
}
} | php | private function fix_row(array &$params, $row) {
if ($row <= 1) {
// Row 1 is always present.
return 1;
} else if (isset($params['theme_advanced_buttons' . $row])) {
return $row;
} else {
return $this->count_button_rows($params);
}
} | [
"private",
"function",
"fix_row",
"(",
"array",
"&",
"$",
"params",
",",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"row",
"<=",
"1",
")",
"{",
"// Row 1 is always present.",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
... | Checks the row value is valid, fix if necessary.
@param array $params TinyMCE init parameters array
@param int $row Row to add button if exists
@return int requested row if exists, lower number if does not exist. | [
"Checks",
"the",
"row",
"value",
"is",
"valid",
"fix",
"if",
"necessary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/editor/tinymce/classes/plugin.php#L287-L296 |
219,431 | moodle/moodle | lib/editor/tinymce/classes/plugin.php | editor_tinymce_plugin.add_js_plugin | protected function add_js_plugin(&$params, $pluginname='', $jsfile='editor_plugin.js') {
global $CFG;
// Set default plugin name.
if ($pluginname === '') {
$pluginname = $this->plugin;
}
// Add plugin to list in params, so it doesn't try to load it again.
$p... | php | protected function add_js_plugin(&$params, $pluginname='', $jsfile='editor_plugin.js') {
global $CFG;
// Set default plugin name.
if ($pluginname === '') {
$pluginname = $this->plugin;
}
// Add plugin to list in params, so it doesn't try to load it again.
$p... | [
"protected",
"function",
"add_js_plugin",
"(",
"&",
"$",
"params",
",",
"$",
"pluginname",
"=",
"''",
",",
"$",
"jsfile",
"=",
"'editor_plugin.js'",
")",
"{",
"global",
"$",
"CFG",
";",
"// Set default plugin name.",
"if",
"(",
"$",
"pluginname",
"===",
"''"... | Adds a JavaScript plugin into TinyMCE. Note that adding a plugin does
not by itself add a button; you must do both.
If you leave $pluginname blank (default) it uses the folder name.
@param array $params TinyMCE init parameters array
@param string $pluginname Identifier for plugin within TinyMCE
@param string $jsfile ... | [
"Adds",
"a",
"JavaScript",
"plugin",
"into",
"TinyMCE",
".",
"Note",
"that",
"adding",
"a",
"plugin",
"does",
"not",
"by",
"itself",
"add",
"a",
"button",
";",
"you",
"must",
"do",
"both",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/editor/tinymce/classes/plugin.php#L325-L346 |
219,432 | moodle/moodle | lib/editor/tinymce/classes/plugin.php | editor_tinymce_plugin.get_version | protected function get_version() {
global $CFG;
$plugin = new stdClass;
require($CFG->dirroot . '/lib/editor/tinymce/plugins/' . $this->plugin . '/version.php');
return $plugin->version;
} | php | protected function get_version() {
global $CFG;
$plugin = new stdClass;
require($CFG->dirroot . '/lib/editor/tinymce/plugins/' . $this->plugin . '/version.php');
return $plugin->version;
} | [
"protected",
"function",
"get_version",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"plugin",
"=",
"new",
"stdClass",
";",
"require",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/lib/editor/tinymce/plugins/'",
".",
"$",
"this",
"->",
"plugin",
".",
"'/vers... | Obtains version number from version.php for this plugin.
@return string Version number | [
"Obtains",
"version",
"number",
"from",
"version",
".",
"php",
"for",
"this",
"plugin",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/editor/tinymce/classes/plugin.php#L394-L400 |
219,433 | moodle/moodle | lib/editor/tinymce/classes/plugin.php | editor_tinymce_plugin.all_update_init_params | public static function all_update_init_params(array &$params,
context $context, array $options = null) {
global $CFG;
// Get list of plugin directories.
$plugins = core_component::get_plugin_list('tinymce');
// Get list of disabled subplugins.
$disabled = array();
... | php | public static function all_update_init_params(array &$params,
context $context, array $options = null) {
global $CFG;
// Get list of plugin directories.
$plugins = core_component::get_plugin_list('tinymce');
// Get list of disabled subplugins.
$disabled = array();
... | [
"public",
"static",
"function",
"all_update_init_params",
"(",
"array",
"&",
"$",
"params",
",",
"context",
"$",
"context",
",",
"array",
"$",
"options",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"// Get list of plugin directories.",
"$",
"plugins",
"=... | Calls all available plugins to adjust the TinyMCE init parameters.
@param array $params TinyMCE init parameters array
@param context $context Context where editor is being shown
@param array $options Options for this editor | [
"Calls",
"all",
"available",
"plugins",
"to",
"adjust",
"the",
"TinyMCE",
"init",
"parameters",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/editor/tinymce/classes/plugin.php#L409-L445 |
219,434 | moodle/moodle | lib/editor/tinymce/classes/plugin.php | editor_tinymce_plugin.get | public static function get($plugin) {
$dir = core_component::get_component_directory('tinymce_' . $plugin);
require_once($dir . '/lib.php');
$classname = 'tinymce_' . $plugin;
return new $classname($plugin);
} | php | public static function get($plugin) {
$dir = core_component::get_component_directory('tinymce_' . $plugin);
require_once($dir . '/lib.php');
$classname = 'tinymce_' . $plugin;
return new $classname($plugin);
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"plugin",
")",
"{",
"$",
"dir",
"=",
"core_component",
"::",
"get_component_directory",
"(",
"'tinymce_'",
".",
"$",
"plugin",
")",
";",
"require_once",
"(",
"$",
"dir",
".",
"'/lib.php'",
")",
";",
"$",
"... | Gets a named plugin object. Will cause fatal error if plugin doesn't exist.
@param string $plugin Name of plugin e.g. 'moodleemoticon'
@return editor_tinymce_plugin Plugin object | [
"Gets",
"a",
"named",
"plugin",
"object",
".",
"Will",
"cause",
"fatal",
"error",
"if",
"plugin",
"doesn",
"t",
"exist",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/editor/tinymce/classes/plugin.php#L453-L458 |
219,435 | moodle/moodle | lib/editor/tinymce/classes/plugin.php | editor_tinymce_plugin.compare_plugins | public static function compare_plugins(editor_tinymce_plugin $a, editor_tinymce_plugin $b) {
// Use sort order first.
$order = $a->get_sort_order() - $b->get_sort_order();
if ($order != 0) {
return $order;
}
// Then sort alphabetically.
return strcmp($a->plug... | php | public static function compare_plugins(editor_tinymce_plugin $a, editor_tinymce_plugin $b) {
// Use sort order first.
$order = $a->get_sort_order() - $b->get_sort_order();
if ($order != 0) {
return $order;
}
// Then sort alphabetically.
return strcmp($a->plug... | [
"public",
"static",
"function",
"compare_plugins",
"(",
"editor_tinymce_plugin",
"$",
"a",
",",
"editor_tinymce_plugin",
"$",
"b",
")",
"{",
"// Use sort order first.",
"$",
"order",
"=",
"$",
"a",
"->",
"get_sort_order",
"(",
")",
"-",
"$",
"b",
"->",
"get_so... | Compares two plugins.
@param editor_tinymce_plugin $a
@param editor_tinymce_plugin $b
@return Negative number if $a is before $b | [
"Compares",
"two",
"plugins",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/editor/tinymce/classes/plugin.php#L466-L475 |
219,436 | moodle/moodle | admin/tool/dataprivacy/classes/local/helper.php | helper.get_request_type_string | public static function get_request_type_string($requesttype) {
$types = self::get_request_types();
if (!isset($types[$requesttype])) {
throw new moodle_exception('errorinvalidrequesttype', 'tool_dataprivacy');
}
return $types[$requesttype];
} | php | public static function get_request_type_string($requesttype) {
$types = self::get_request_types();
if (!isset($types[$requesttype])) {
throw new moodle_exception('errorinvalidrequesttype', 'tool_dataprivacy');
}
return $types[$requesttype];
} | [
"public",
"static",
"function",
"get_request_type_string",
"(",
"$",
"requesttype",
")",
"{",
"$",
"types",
"=",
"self",
"::",
"get_request_types",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"types",
"[",
"$",
"requesttype",
"]",
")",
")",
"{",
... | Retrieves the human-readable text value of a data request type.
@param int $requesttype The request type.
@return string
@throws coding_exception
@throws moodle_exception | [
"Retrieves",
"the",
"human",
"-",
"readable",
"text",
"value",
"of",
"a",
"data",
"request",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/local/helper.php#L65-L71 |
219,437 | moodle/moodle | admin/tool/dataprivacy/classes/local/helper.php | helper.get_shortened_request_type_string | public static function get_shortened_request_type_string($requesttype) {
$types = self::get_request_types_short();
if (!isset($types[$requesttype])) {
throw new moodle_exception('errorinvalidrequesttype', 'tool_dataprivacy');
}
return $types[$requesttype];
} | php | public static function get_shortened_request_type_string($requesttype) {
$types = self::get_request_types_short();
if (!isset($types[$requesttype])) {
throw new moodle_exception('errorinvalidrequesttype', 'tool_dataprivacy');
}
return $types[$requesttype];
} | [
"public",
"static",
"function",
"get_shortened_request_type_string",
"(",
"$",
"requesttype",
")",
"{",
"$",
"types",
"=",
"self",
"::",
"get_request_types_short",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"types",
"[",
"$",
"requesttype",
"]",
")",
... | Retrieves the human-readable shortened text value of a data request type.
@param int $requesttype The request type.
@return string
@throws coding_exception
@throws moodle_exception | [
"Retrieves",
"the",
"human",
"-",
"readable",
"shortened",
"text",
"value",
"of",
"a",
"data",
"request",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/local/helper.php#L81-L87 |
219,438 | moodle/moodle | admin/tool/dataprivacy/classes/local/helper.php | helper.get_request_types | public static function get_request_types() {
return [
api::DATAREQUEST_TYPE_EXPORT => get_string('requesttypeexport', 'tool_dataprivacy'),
api::DATAREQUEST_TYPE_DELETE => get_string('requesttypedelete', 'tool_dataprivacy'),
api::DATAREQUEST_TYPE_OTHERS => get_string('requestt... | php | public static function get_request_types() {
return [
api::DATAREQUEST_TYPE_EXPORT => get_string('requesttypeexport', 'tool_dataprivacy'),
api::DATAREQUEST_TYPE_DELETE => get_string('requesttypedelete', 'tool_dataprivacy'),
api::DATAREQUEST_TYPE_OTHERS => get_string('requestt... | [
"public",
"static",
"function",
"get_request_types",
"(",
")",
"{",
"return",
"[",
"api",
"::",
"DATAREQUEST_TYPE_EXPORT",
"=>",
"get_string",
"(",
"'requesttypeexport'",
",",
"'tool_dataprivacy'",
")",
",",
"api",
"::",
"DATAREQUEST_TYPE_DELETE",
"=>",
"get_string",
... | Returns the key value-pairs of request type code and their string value.
@return array | [
"Returns",
"the",
"key",
"value",
"-",
"pairs",
"of",
"request",
"type",
"code",
"and",
"their",
"string",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/local/helper.php#L94-L100 |
219,439 | moodle/moodle | admin/tool/dataprivacy/classes/local/helper.php | helper.get_request_types_short | public static function get_request_types_short() {
return [
api::DATAREQUEST_TYPE_EXPORT => get_string('requesttypeexportshort', 'tool_dataprivacy'),
api::DATAREQUEST_TYPE_DELETE => get_string('requesttypedeleteshort', 'tool_dataprivacy'),
api::DATAREQUEST_TYPE_OTHERS => get_... | php | public static function get_request_types_short() {
return [
api::DATAREQUEST_TYPE_EXPORT => get_string('requesttypeexportshort', 'tool_dataprivacy'),
api::DATAREQUEST_TYPE_DELETE => get_string('requesttypedeleteshort', 'tool_dataprivacy'),
api::DATAREQUEST_TYPE_OTHERS => get_... | [
"public",
"static",
"function",
"get_request_types_short",
"(",
")",
"{",
"return",
"[",
"api",
"::",
"DATAREQUEST_TYPE_EXPORT",
"=>",
"get_string",
"(",
"'requesttypeexportshort'",
",",
"'tool_dataprivacy'",
")",
",",
"api",
"::",
"DATAREQUEST_TYPE_DELETE",
"=>",
"ge... | Returns the key value-pairs of request type code and their shortened string value.
@return array | [
"Returns",
"the",
"key",
"value",
"-",
"pairs",
"of",
"request",
"type",
"code",
"and",
"their",
"shortened",
"string",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/local/helper.php#L107-L113 |
219,440 | moodle/moodle | admin/tool/dataprivacy/classes/local/helper.php | helper.get_request_status_string | public static function get_request_status_string($status) {
$statuses = self::get_request_statuses();
if (!isset($statuses[$status])) {
throw new moodle_exception('errorinvalidrequeststatus', 'tool_dataprivacy');
}
return $statuses[$status];
} | php | public static function get_request_status_string($status) {
$statuses = self::get_request_statuses();
if (!isset($statuses[$status])) {
throw new moodle_exception('errorinvalidrequeststatus', 'tool_dataprivacy');
}
return $statuses[$status];
} | [
"public",
"static",
"function",
"get_request_status_string",
"(",
"$",
"status",
")",
"{",
"$",
"statuses",
"=",
"self",
"::",
"get_request_statuses",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"statuses",
"[",
"$",
"status",
"]",
")",
")",
"{",
... | Retrieves the human-readable value of a data request status.
@param int $status The request status.
@return string
@throws moodle_exception | [
"Retrieves",
"the",
"human",
"-",
"readable",
"value",
"of",
"a",
"data",
"request",
"status",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/local/helper.php#L122-L129 |
219,441 | moodle/moodle | admin/tool/dataprivacy/classes/local/helper.php | helper.get_request_statuses | public static function get_request_statuses() {
return [
api::DATAREQUEST_STATUS_PENDING => get_string('statuspending', 'tool_dataprivacy'),
api::DATAREQUEST_STATUS_AWAITING_APPROVAL => get_string('statusawaitingapproval', 'tool_dataprivacy'),
api::DATAREQUEST_STATUS_APPROVED... | php | public static function get_request_statuses() {
return [
api::DATAREQUEST_STATUS_PENDING => get_string('statuspending', 'tool_dataprivacy'),
api::DATAREQUEST_STATUS_AWAITING_APPROVAL => get_string('statusawaitingapproval', 'tool_dataprivacy'),
api::DATAREQUEST_STATUS_APPROVED... | [
"public",
"static",
"function",
"get_request_statuses",
"(",
")",
"{",
"return",
"[",
"api",
"::",
"DATAREQUEST_STATUS_PENDING",
"=>",
"get_string",
"(",
"'statuspending'",
",",
"'tool_dataprivacy'",
")",
",",
"api",
"::",
"DATAREQUEST_STATUS_AWAITING_APPROVAL",
"=>",
... | Returns the key value-pairs of request status code and string value.
@return array | [
"Returns",
"the",
"key",
"value",
"-",
"pairs",
"of",
"request",
"status",
"code",
"and",
"string",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/local/helper.php#L136-L149 |
219,442 | moodle/moodle | admin/tool/dataprivacy/classes/local/helper.php | helper.get_request_creation_method_string | public static function get_request_creation_method_string($creation) {
$creationmethods = self::get_request_creation_methods();
if (!isset($creationmethods[$creation])) {
throw new moodle_exception('errorinvalidrequestcreationmethod', 'tool_dataprivacy');
}
return $creationm... | php | public static function get_request_creation_method_string($creation) {
$creationmethods = self::get_request_creation_methods();
if (!isset($creationmethods[$creation])) {
throw new moodle_exception('errorinvalidrequestcreationmethod', 'tool_dataprivacy');
}
return $creationm... | [
"public",
"static",
"function",
"get_request_creation_method_string",
"(",
"$",
"creation",
")",
"{",
"$",
"creationmethods",
"=",
"self",
"::",
"get_request_creation_methods",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"creationmethods",
"[",
"$",
"creat... | Retrieves the human-readable value of a data request creation method.
@param int $creation The request creation method.
@return string
@throws moodle_exception | [
"Retrieves",
"the",
"human",
"-",
"readable",
"value",
"of",
"a",
"data",
"request",
"creation",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/local/helper.php#L158-L165 |
219,443 | moodle/moodle | admin/tool/dataprivacy/classes/local/helper.php | helper.get_children_of_user | public static function get_children_of_user($userid) {
global $DB;
// Get users that the user has role assignments to.
$allusernames = get_all_user_name_fields(true, 'u');
$sql = "SELECT u.id, $allusernames
FROM {role_assignments} ra, {context} c, {user} u
... | php | public static function get_children_of_user($userid) {
global $DB;
// Get users that the user has role assignments to.
$allusernames = get_all_user_name_fields(true, 'u');
$sql = "SELECT u.id, $allusernames
FROM {role_assignments} ra, {context} c, {user} u
... | [
"public",
"static",
"function",
"get_children_of_user",
"(",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"// Get users that the user has role assignments to.",
"$",
"allusernames",
"=",
"get_all_user_name_fields",
"(",
"true",
",",
"'u'",
")",
";",
"$",
"sql"... | Get the users that a user can make data request for.
E.g. User having a parent role and has the 'tool/dataprivacy:makedatarequestsforchildren' capability.
@param int $userid The user's ID.
@return array | [
"Get",
"the",
"users",
"that",
"a",
"user",
"can",
"make",
"data",
"request",
"for",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/local/helper.php#L186-L215 |
219,444 | moodle/moodle | admin/tool/dataprivacy/classes/local/helper.php | helper.get_request_filter_options | public static function get_request_filter_options() {
$filters = [
self::FILTER_TYPE => (object)[
'name' => get_string('requesttype', 'tool_dataprivacy'),
'options' => self::get_request_types_short()
],
self::FILTER_STATUS => (object)[
... | php | public static function get_request_filter_options() {
$filters = [
self::FILTER_TYPE => (object)[
'name' => get_string('requesttype', 'tool_dataprivacy'),
'options' => self::get_request_types_short()
],
self::FILTER_STATUS => (object)[
... | [
"public",
"static",
"function",
"get_request_filter_options",
"(",
")",
"{",
"$",
"filters",
"=",
"[",
"self",
"::",
"FILTER_TYPE",
"=>",
"(",
"object",
")",
"[",
"'name'",
"=>",
"get_string",
"(",
"'requesttype'",
",",
"'tool_dataprivacy'",
")",
",",
"'option... | Get options for the data requests filter.
@return array
@throws coding_exception | [
"Get",
"options",
"for",
"the",
"data",
"requests",
"filter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/local/helper.php#L223-L249 |
219,445 | moodle/moodle | mod/assignment/type/offline/backup/moodle2/backup_assignment_offline_subplugin.class.php | backup_assignment_offline_subplugin.define_assignment_subplugin_structure | protected function define_assignment_subplugin_structure() {
return false; // This subplugin backup is only one example. Skip it.
/**
* Any activity sublugins is always rooted by one backup_subplugin_element()
* Those elements have some unique characteristics:
* - They are,... | php | protected function define_assignment_subplugin_structure() {
return false; // This subplugin backup is only one example. Skip it.
/**
* Any activity sublugins is always rooted by one backup_subplugin_element()
* Those elements have some unique characteristics:
* - They are,... | [
"protected",
"function",
"define_assignment_subplugin_structure",
"(",
")",
"{",
"return",
"false",
";",
"// This subplugin backup is only one example. Skip it.",
"/**\n * Any activity sublugins is always rooted by one backup_subplugin_element()\n * Those elements have some uniqu... | Returns the subplugin information to attach at assignment element | [
"Returns",
"the",
"subplugin",
"information",
"to",
"attach",
"at",
"assignment",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assignment/type/offline/backup/moodle2/backup_assignment_offline_subplugin.class.php#L39-L87 |
219,446 | moodle/moodle | mod/assignment/type/offline/backup/moodle2/backup_assignment_offline_subplugin.class.php | backup_assignment_offline_subplugin.define_submission_subplugin_structure | protected function define_submission_subplugin_structure() {
return false; // This subplugin backup is only one example. Skip it.
// remember this has not XML representation
$subplugin = $this->get_subplugin_element(null, '/assignment/assignmenttype', 'offline');
// type of the subplu... | php | protected function define_submission_subplugin_structure() {
return false; // This subplugin backup is only one example. Skip it.
// remember this has not XML representation
$subplugin = $this->get_subplugin_element(null, '/assignment/assignmenttype', 'offline');
// type of the subplu... | [
"protected",
"function",
"define_submission_subplugin_structure",
"(",
")",
"{",
"return",
"false",
";",
"// This subplugin backup is only one example. Skip it.",
"// remember this has not XML representation",
"$",
"subplugin",
"=",
"$",
"this",
"->",
"get_subplugin_element",
"("... | Returns the subplugin information to attach at submission element | [
"Returns",
"the",
"subplugin",
"information",
"to",
"attach",
"at",
"submission",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assignment/type/offline/backup/moodle2/backup_assignment_offline_subplugin.class.php#L92-L111 |
219,447 | moodle/moodle | grade/report/singleview/classes/local/ui/text_attribute.php | text_attribute.html | public function html() {
global $OUTPUT;
$context = (object) [
'id' => $this->name,
'name' => $this->name,
'value' => $this->value,
'disabled' => $this->isdisabled,
];
$context->label = '';
if (preg_match("/^feedback/", $this->nam... | php | public function html() {
global $OUTPUT;
$context = (object) [
'id' => $this->name,
'name' => $this->name,
'value' => $this->value,
'disabled' => $this->isdisabled,
];
$context->label = '';
if (preg_match("/^feedback/", $this->nam... | [
"public",
"function",
"html",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"context",
"=",
"(",
"object",
")",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"name",
",",
"'name'",
"=>",
"$",
"this",
"->",
"name",
",",
"'value'",
"=>",
"$",
"this",
"... | Render the html for this field.
@return string The HTML. | [
"Render",
"the",
"html",
"for",
"this",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/ui/text_attribute.php#L67-L87 |
219,448 | moodle/moodle | cohort/externallib.php | core_cohort_external.create_cohorts | public static function create_cohorts($cohorts) {
global $CFG, $DB;
require_once("$CFG->dirroot/cohort/lib.php");
$params = self::validate_parameters(self::create_cohorts_parameters(), array('cohorts' => $cohorts));
$availablethemes = cohort_get_list_of_themes();
$transaction ... | php | public static function create_cohorts($cohorts) {
global $CFG, $DB;
require_once("$CFG->dirroot/cohort/lib.php");
$params = self::validate_parameters(self::create_cohorts_parameters(), array('cohorts' => $cohorts));
$availablethemes = cohort_get_list_of_themes();
$transaction ... | [
"public",
"static",
"function",
"create_cohorts",
"(",
"$",
"cohorts",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"\"$CFG->dirroot/cohort/lib.php\"",
")",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",... | Create one or more cohorts
@param array $cohorts An array of cohorts to create.
@return array An array of arrays
@since Moodle 2.5 | [
"Create",
"one",
"or",
"more",
"cohorts"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cohort/externallib.php#L75-L137 |
219,449 | moodle/moodle | cohort/externallib.php | core_cohort_external.get_cohorts | public static function get_cohorts($cohortids = array()) {
global $DB, $CFG;
$params = self::validate_parameters(self::get_cohorts_parameters(), array('cohortids' => $cohortids));
if (empty($cohortids)) {
$cohorts = $DB->get_records('cohort');
} else {
$cohorts ... | php | public static function get_cohorts($cohortids = array()) {
global $DB, $CFG;
$params = self::validate_parameters(self::get_cohorts_parameters(), array('cohortids' => $cohortids));
if (empty($cohortids)) {
$cohorts = $DB->get_records('cohort');
} else {
$cohorts ... | [
"public",
"static",
"function",
"get_cohorts",
"(",
"$",
"cohortids",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_cohorts_parameters",
"(",
... | Get cohorts definition specified by ids
@param array $cohortids array of cohort ids
@return array of cohort objects (id, courseid, name)
@since Moodle 2.5 | [
"Get",
"cohorts",
"definition",
"specified",
"by",
"ids"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cohort/externallib.php#L241-L276 |
219,450 | moodle/moodle | cohort/externallib.php | core_cohort_external.search_cohorts | public static function search_cohorts($query, $context, $includes = 'parents', $limitfrom = 0, $limitnum = 25) {
global $CFG;
require_once($CFG->dirroot . '/cohort/lib.php');
$params = self::validate_parameters(self::search_cohorts_parameters(), array(
'query' => $query,
... | php | public static function search_cohorts($query, $context, $includes = 'parents', $limitfrom = 0, $limitnum = 25) {
global $CFG;
require_once($CFG->dirroot . '/cohort/lib.php');
$params = self::validate_parameters(self::search_cohorts_parameters(), array(
'query' => $query,
... | [
"public",
"static",
"function",
"search_cohorts",
"(",
"$",
"query",
",",
"$",
"context",
",",
"$",
"includes",
"=",
"'parents'",
",",
"$",
"limitfrom",
"=",
"0",
",",
"$",
"limitnum",
"=",
"25",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"("... | Search cohorts.
@param string $query
@param array $context
@param string $includes
@param int $limitfrom
@param int $limitnum
@return array | [
"Search",
"cohorts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cohort/externallib.php#L348-L413 |
219,451 | moodle/moodle | cohort/externallib.php | core_cohort_external.delete_cohort_members | public static function delete_cohort_members($members) {
global $CFG, $DB;
require_once("$CFG->dirroot/cohort/lib.php");
// Validate parameters.
$params = self::validate_parameters(self::delete_cohort_members_parameters(), array('members' => $members));
$transaction = $DB->star... | php | public static function delete_cohort_members($members) {
global $CFG, $DB;
require_once("$CFG->dirroot/cohort/lib.php");
// Validate parameters.
$params = self::validate_parameters(self::delete_cohort_members_parameters(), array('members' => $members));
$transaction = $DB->star... | [
"public",
"static",
"function",
"delete_cohort_members",
"(",
"$",
"members",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"\"$CFG->dirroot/cohort/lib.php\"",
")",
";",
"// Validate parameters.",
"$",
"params",
"=",
"self",
"::",
"va... | Delete cohort members
@param array $members of arrays with keys userid, cohortid
@since Moodle 2.5 | [
"Delete",
"cohort",
"members"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cohort/externallib.php#L718-L748 |
219,452 | moodle/moodle | cohort/externallib.php | core_cohort_external.get_cohort_members | public static function get_cohort_members($cohortids) {
global $DB;
$params = self::validate_parameters(self::get_cohort_members_parameters(), array('cohortids' => $cohortids));
$members = array();
foreach ($params['cohortids'] as $cohortid) {
// Validate params.
... | php | public static function get_cohort_members($cohortids) {
global $DB;
$params = self::validate_parameters(self::get_cohort_members_parameters(), array('cohortids' => $cohortids));
$members = array();
foreach ($params['cohortids'] as $cohortid) {
// Validate params.
... | [
"public",
"static",
"function",
"get_cohort_members",
"(",
"$",
"cohortids",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_cohort_members_parameters",
"(",
")",
",",
"array",
"(",
"'cohorti... | Return all members for a cohort
@param array $cohortids array of cohort ids
@return array with cohort id keys containing arrays of user ids
@since Moodle 2.5 | [
"Return",
"all",
"members",
"for",
"a",
"cohort"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cohort/externallib.php#L781-L806 |
219,453 | moodle/moodle | course/classes/list_element.php | core_course_list_element.has_summary | public function has_summary() {
if (isset($this->record->hassummary)) {
return !empty($this->record->hassummary);
}
if (!isset($this->record->summary)) {
// We need to retrieve summary.
$this->__get('summary');
}
return !empty($this->record->su... | php | public function has_summary() {
if (isset($this->record->hassummary)) {
return !empty($this->record->hassummary);
}
if (!isset($this->record->summary)) {
// We need to retrieve summary.
$this->__get('summary');
}
return !empty($this->record->su... | [
"public",
"function",
"has_summary",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"record",
"->",
"hassummary",
")",
")",
"{",
"return",
"!",
"empty",
"(",
"$",
"this",
"->",
"record",
"->",
"hassummary",
")",
";",
"}",
"if",
"(",
"!"... | Indicates if the course has non-empty summary field
@return bool | [
"Indicates",
"if",
"the",
"course",
"has",
"non",
"-",
"empty",
"summary",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/list_element.php#L110-L119 |
219,454 | moodle/moodle | course/classes/list_element.php | core_course_list_element.has_course_contacts | public function has_course_contacts() {
if (!isset($this->record->managers)) {
$courses = array($this->id => &$this->record);
core_course_category::preload_course_contacts($courses);
}
return !empty($this->record->managers);
} | php | public function has_course_contacts() {
if (!isset($this->record->managers)) {
$courses = array($this->id => &$this->record);
core_course_category::preload_course_contacts($courses);
}
return !empty($this->record->managers);
} | [
"public",
"function",
"has_course_contacts",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"record",
"->",
"managers",
")",
")",
"{",
"$",
"courses",
"=",
"array",
"(",
"$",
"this",
"->",
"id",
"=>",
"&",
"$",
"this",
"->",
"recor... | Indicates if the course have course contacts to display
@return bool | [
"Indicates",
"if",
"the",
"course",
"have",
"course",
"contacts",
"to",
"display"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/list_element.php#L126-L132 |
219,455 | moodle/moodle | course/classes/list_element.php | core_course_list_element.get_custom_fields | public function get_custom_fields() : array {
if (!isset($this->record->customfields)) {
$this->record->customfields = \core_course\customfield\course_handler::create()->get_instance_data($this->id);
}
return $this->record->customfields;
} | php | public function get_custom_fields() : array {
if (!isset($this->record->customfields)) {
$this->record->customfields = \core_course\customfield\course_handler::create()->get_instance_data($this->id);
}
return $this->record->customfields;
} | [
"public",
"function",
"get_custom_fields",
"(",
")",
":",
"array",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"record",
"->",
"customfields",
")",
")",
"{",
"$",
"this",
"->",
"record",
"->",
"customfields",
"=",
"\\",
"core_course",
"\\",
"... | Returns custom fields data for this course
@return \core_customfield\data_controller[] | [
"Returns",
"custom",
"fields",
"data",
"for",
"this",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/list_element.php#L208-L213 |
219,456 | moodle/moodle | course/classes/list_element.php | core_course_list_element.has_course_overviewfiles | public function has_course_overviewfiles() {
global $CFG;
if (empty($CFG->courseoverviewfileslimit)) {
return false;
}
$fs = get_file_storage();
$context = context_course::instance($this->id);
return !$fs->is_area_empty($context->id, 'course', 'overviewfiles')... | php | public function has_course_overviewfiles() {
global $CFG;
if (empty($CFG->courseoverviewfileslimit)) {
return false;
}
$fs = get_file_storage();
$context = context_course::instance($this->id);
return !$fs->is_area_empty($context->id, 'course', 'overviewfiles')... | [
"public",
"function",
"has_course_overviewfiles",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"courseoverviewfileslimit",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
"... | Checks if course has any associated overview files
@return bool | [
"Checks",
"if",
"course",
"has",
"any",
"associated",
"overview",
"files"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/list_element.php#L230-L238 |
219,457 | moodle/moodle | course/classes/list_element.php | core_course_list_element.get_course_overviewfiles | public function get_course_overviewfiles() {
global $CFG;
if (empty($CFG->courseoverviewfileslimit)) {
return array();
}
require_once($CFG->libdir. '/filestorage/file_storage.php');
require_once($CFG->dirroot. '/course/lib.php');
$fs = get_file_storage();
... | php | public function get_course_overviewfiles() {
global $CFG;
if (empty($CFG->courseoverviewfileslimit)) {
return array();
}
require_once($CFG->libdir. '/filestorage/file_storage.php');
require_once($CFG->dirroot. '/course/lib.php');
$fs = get_file_storage();
... | [
"public",
"function",
"get_course_overviewfiles",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"courseoverviewfileslimit",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"require_once",
"(",
"$",
"CFG",
"->"... | Returns all course overview files
@return array array of stored_file objects | [
"Returns",
"all",
"course",
"overview",
"files"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/list_element.php#L245-L273 |
219,458 | moodle/moodle | course/classes/list_element.php | core_course_list_element.getIterator | public function getIterator() {
$ret = array('id' => $this->record->id);
foreach ($this->record as $property => $value) {
$ret[$property] = $value;
}
return new ArrayIterator($ret);
} | php | public function getIterator() {
$ret = array('id' => $this->record->id);
foreach ($this->record as $property => $value) {
$ret[$property] = $value;
}
return new ArrayIterator($ret);
} | [
"public",
"function",
"getIterator",
"(",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
"'id'",
"=>",
"$",
"this",
"->",
"record",
"->",
"id",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"record",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
... | Create an iterator because magic vars can't be seen by 'foreach'.
Exclude context fields
Implementing method from interface IteratorAggregate
@return ArrayIterator | [
"Create",
"an",
"iterator",
"because",
"magic",
"vars",
"can",
"t",
"be",
"seen",
"by",
"foreach",
".",
"Exclude",
"context",
"fields"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/list_element.php#L339-L345 |
219,459 | moodle/moodle | course/classes/list_element.php | core_course_list_element.can_access | public function can_access() {
if ($this->canaccess === null) {
$this->canaccess = can_access_course($this->record);
}
return $this->canaccess;
} | php | public function can_access() {
if ($this->canaccess === null) {
$this->canaccess = can_access_course($this->record);
}
return $this->canaccess;
} | [
"public",
"function",
"can_access",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"canaccess",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"canaccess",
"=",
"can_access_course",
"(",
"$",
"this",
"->",
"record",
")",
";",
"}",
"return",
"$",
"this",
"... | Returns true if the current user can access this course.
@return bool | [
"Returns",
"true",
"if",
"the",
"current",
"user",
"can",
"access",
"this",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/list_element.php#L375-L380 |
219,460 | moodle/moodle | lib/spout/src/Spout/Common/Helper/EncodingHelper.php | EncodingHelper.getBytesOffsetToSkipBOM | public function getBytesOffsetToSkipBOM($filePointer, $encoding)
{
$byteOffsetToSkipBom = 0;
if ($this->hasBOM($filePointer, $encoding)) {
$bomUsed = $this->supportedEncodingsWithBom[$encoding];
// we skip the N first bytes
$byteOffsetToSkipBom = strlen($bomUsed... | php | public function getBytesOffsetToSkipBOM($filePointer, $encoding)
{
$byteOffsetToSkipBom = 0;
if ($this->hasBOM($filePointer, $encoding)) {
$bomUsed = $this->supportedEncodingsWithBom[$encoding];
// we skip the N first bytes
$byteOffsetToSkipBom = strlen($bomUsed... | [
"public",
"function",
"getBytesOffsetToSkipBOM",
"(",
"$",
"filePointer",
",",
"$",
"encoding",
")",
"{",
"$",
"byteOffsetToSkipBom",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"hasBOM",
"(",
"$",
"filePointer",
",",
"$",
"encoding",
")",
")",
"{",
"$"... | Returns the number of bytes to use as offset in order to skip the BOM.
@param resource $filePointer Pointer to the file to check
@param string $encoding Encoding of the file to check
@return int Bytes offset to apply to skip the BOM (0 means no BOM) | [
"Returns",
"the",
"number",
"of",
"bytes",
"to",
"use",
"as",
"offset",
"in",
"order",
"to",
"skip",
"the",
"BOM",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Common/Helper/EncodingHelper.php#L58-L70 |
219,461 | moodle/moodle | lib/spout/src/Spout/Common/Helper/EncodingHelper.php | EncodingHelper.hasBOM | protected function hasBOM($filePointer, $encoding)
{
$hasBOM = false;
$this->globalFunctionsHelper->rewind($filePointer);
if (array_key_exists($encoding, $this->supportedEncodingsWithBom)) {
$potentialBom = $this->supportedEncodingsWithBom[$encoding];
$numBytesInBom... | php | protected function hasBOM($filePointer, $encoding)
{
$hasBOM = false;
$this->globalFunctionsHelper->rewind($filePointer);
if (array_key_exists($encoding, $this->supportedEncodingsWithBom)) {
$potentialBom = $this->supportedEncodingsWithBom[$encoding];
$numBytesInBom... | [
"protected",
"function",
"hasBOM",
"(",
"$",
"filePointer",
",",
"$",
"encoding",
")",
"{",
"$",
"hasBOM",
"=",
"false",
";",
"$",
"this",
"->",
"globalFunctionsHelper",
"->",
"rewind",
"(",
"$",
"filePointer",
")",
";",
"if",
"(",
"array_key_exists",
"(",... | Returns whether the file identified by the given pointer has a BOM.
@param resource $filePointer Pointer to the file to check
@param string $encoding Encoding of the file to check
@return bool TRUE if the file has a BOM, FALSE otherwise | [
"Returns",
"whether",
"the",
"file",
"identified",
"by",
"the",
"given",
"pointer",
"has",
"a",
"BOM",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Common/Helper/EncodingHelper.php#L79-L93 |
219,462 | moodle/moodle | lib/spout/src/Spout/Common/Helper/EncodingHelper.php | EncodingHelper.attemptConversion | protected function attemptConversion($string, $sourceEncoding, $targetEncoding)
{
// if source and target encodings are the same, it's a no-op
if ($sourceEncoding === $targetEncoding) {
return $string;
}
$convertedString = null;
if ($this->canUseIconv()) {
... | php | protected function attemptConversion($string, $sourceEncoding, $targetEncoding)
{
// if source and target encodings are the same, it's a no-op
if ($sourceEncoding === $targetEncoding) {
return $string;
}
$convertedString = null;
if ($this->canUseIconv()) {
... | [
"protected",
"function",
"attemptConversion",
"(",
"$",
"string",
",",
"$",
"sourceEncoding",
",",
"$",
"targetEncoding",
")",
"{",
"// if source and target encodings are the same, it's a no-op",
"if",
"(",
"$",
"sourceEncoding",
"===",
"$",
"targetEncoding",
")",
"{",
... | Attempts to convert the given string to the given encoding.
Depending on what is installed on the server, we will try to iconv or mbstring.
@param string $string string to be converted
@param string $sourceEncoding The encoding used to encode the source string
@param string $targetEncoding The encoding the string shou... | [
"Attempts",
"to",
"convert",
"the",
"given",
"string",
"to",
"the",
"given",
"encoding",
".",
"Depending",
"on",
"what",
"is",
"installed",
"on",
"the",
"server",
"we",
"will",
"try",
"to",
"iconv",
"or",
"mbstring",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Common/Helper/EncodingHelper.php#L131-L153 |
219,463 | moodle/moodle | mod/data/locallib.php | data_portfolio_caller.load_data | public function load_data() {
global $DB, $USER;
if (!$this->cm = get_coursemodule_from_id('data', $this->id)) {
throw new portfolio_caller_exception('invalidid', 'data');
}
if (!$this->data = $DB->get_record('data', array('id' => $this->cm->instance))) {
throw ne... | php | public function load_data() {
global $DB, $USER;
if (!$this->cm = get_coursemodule_from_id('data', $this->id)) {
throw new portfolio_caller_exception('invalidid', 'data');
}
if (!$this->data = $DB->get_record('data', array('id' => $this->cm->instance))) {
throw ne... | [
"public",
"function",
"load_data",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"cm",
"=",
"get_coursemodule_from_id",
"(",
"'data'",
",",
"$",
"this",
"->",
"id",
")",
")",
"{",
"throw",
"new",
"por... | load up the data needed for the export
@global object $DB | [
"load",
"up",
"the",
"data",
"needed",
"for",
"the",
"export"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/locallib.php#L82-L121 |
219,464 | moodle/moodle | mod/data/locallib.php | data_portfolio_caller.get_sha1 | public function get_sha1() {
// in the case that we're exporting a subclass of 'file' and we have a singlefile,
// then we're not exporting any metadata, just the file by itself by mimetype.
if ($this->exporter->get('format') instanceof portfolio_format_file && $this->singlefile) {
r... | php | public function get_sha1() {
// in the case that we're exporting a subclass of 'file' and we have a singlefile,
// then we're not exporting any metadata, just the file by itself by mimetype.
if ($this->exporter->get('format') instanceof portfolio_format_file && $this->singlefile) {
r... | [
"public",
"function",
"get_sha1",
"(",
")",
"{",
"// in the case that we're exporting a subclass of 'file' and we have a singlefile,",
"// then we're not exporting any metadata, just the file by itself by mimetype.",
"if",
"(",
"$",
"this",
"->",
"exporter",
"->",
"get",
"(",
"'for... | Calculate the shal1 of this export
Dependent on the export format.
@return string | [
"Calculate",
"the",
"shal1",
"of",
"this",
"export",
"Dependent",
"on",
"the",
"export",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/locallib.php#L144-L170 |
219,465 | moodle/moodle | mod/data/locallib.php | data_portfolio_caller.check_permissions | public function check_permissions() {
if ($this->recordid) {
if (data_isowner($this->recordid)) {
return has_capability('mod/data:exportownentry', context_module::instance($this->cm->id));
}
return has_capability('mod/data:exportentry', context_module::instanc... | php | public function check_permissions() {
if ($this->recordid) {
if (data_isowner($this->recordid)) {
return has_capability('mod/data:exportownentry', context_module::instance($this->cm->id));
}
return has_capability('mod/data:exportentry', context_module::instanc... | [
"public",
"function",
"check_permissions",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"recordid",
")",
"{",
"if",
"(",
"data_isowner",
"(",
"$",
"this",
"->",
"recordid",
")",
")",
"{",
"return",
"has_capability",
"(",
"'mod/data:exportownentry'",
",",
"... | Verify the user can still export this entry
@return bool | [
"Verify",
"the",
"user",
"can",
"still",
"export",
"this",
"entry"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/locallib.php#L243-L254 |
219,466 | moodle/moodle | mod/data/locallib.php | data_portfolio_caller.exportentry | private function exportentry($record) {
// Replacing tags
$patterns = array();
$replacement = array();
$files = array();
// Then we generate strings to replace for normal tags
$format = $this->get('exporter')->get('format');
foreach ($this->fields as $field) {
... | php | private function exportentry($record) {
// Replacing tags
$patterns = array();
$replacement = array();
$files = array();
// Then we generate strings to replace for normal tags
$format = $this->get('exporter')->get('format');
foreach ($this->fields as $field) {
... | [
"private",
"function",
"exportentry",
"(",
"$",
"record",
")",
"{",
"// Replacing tags",
"$",
"patterns",
"=",
"array",
"(",
")",
";",
"$",
"replacement",
"=",
"array",
"(",
")",
";",
"$",
"files",
"=",
"array",
"(",
")",
";",
"// Then we generate strings ... | Prepare a single entry for export, replacing all the content etc
@param stdclass $record the entry to export
@return array with key 0 = the html content, key 1 = array of attachments | [
"Prepare",
"a",
"single",
"entry",
"for",
"export",
"replacing",
"all",
"the",
"content",
"etc"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/locallib.php#L285-L334 |
219,467 | moodle/moodle | mod/lti/classes/privacy/provider.php | provider.export_user_data_lti_submissions | protected static function export_user_data_lti_submissions(approved_contextlist $contextlist) {
global $DB;
// Filter out any contexts that are not related to modules.
$cmids = array_reduce($contextlist->get_contexts(), function($carry, $context) {
if ($context->contextlevel == CONT... | php | protected static function export_user_data_lti_submissions(approved_contextlist $contextlist) {
global $DB;
// Filter out any contexts that are not related to modules.
$cmids = array_reduce($contextlist->get_contexts(), function($carry, $context) {
if ($context->contextlevel == CONT... | [
"protected",
"static",
"function",
"export_user_data_lti_submissions",
"(",
"approved_contextlist",
"$",
"contextlist",
")",
"{",
"global",
"$",
"DB",
";",
"// Filter out any contexts that are not related to modules.",
"$",
"cmids",
"=",
"array_reduce",
"(",
"$",
"contextli... | Export personal data for the given approved_contextlist related to LTI submissions.
@param approved_contextlist $contextlist a list of contexts approved for export. | [
"Export",
"personal",
"data",
"for",
"the",
"given",
"approved_contextlist",
"related",
"to",
"LTI",
"submissions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/privacy/provider.php#L293-L332 |
219,468 | moodle/moodle | mod/lti/classes/privacy/provider.php | provider.export_user_data_lti_types | protected static function export_user_data_lti_types(approved_contextlist $contextlist) {
global $DB;
// Filter out any contexts that are not related to courses.
$courseids = array_reduce($contextlist->get_contexts(), function($carry, $context) {
if ($context->contextlevel == CONTEX... | php | protected static function export_user_data_lti_types(approved_contextlist $contextlist) {
global $DB;
// Filter out any contexts that are not related to courses.
$courseids = array_reduce($contextlist->get_contexts(), function($carry, $context) {
if ($context->contextlevel == CONTEX... | [
"protected",
"static",
"function",
"export_user_data_lti_types",
"(",
"approved_contextlist",
"$",
"contextlist",
")",
"{",
"global",
"$",
"DB",
";",
"// Filter out any contexts that are not related to courses.",
"$",
"courseids",
"=",
"array_reduce",
"(",
"$",
"contextlist... | Export personal data for the given approved_contextlist related to LTI types.
@param approved_contextlist $contextlist a list of contexts approved for export. | [
"Export",
"personal",
"data",
"for",
"the",
"given",
"approved_contextlist",
"related",
"to",
"LTI",
"types",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/privacy/provider.php#L339-L374 |
219,469 | moodle/moodle | mod/lti/classes/privacy/provider.php | provider.export_user_data_lti_tool_proxies | protected static function export_user_data_lti_tool_proxies(approved_contextlist $contextlist) {
global $DB;
// Filter out any contexts that are not related to system context.
$systemcontexts = array_filter($contextlist->get_contexts(), function($context) {
return $context->contextl... | php | protected static function export_user_data_lti_tool_proxies(approved_contextlist $contextlist) {
global $DB;
// Filter out any contexts that are not related to system context.
$systemcontexts = array_filter($contextlist->get_contexts(), function($context) {
return $context->contextl... | [
"protected",
"static",
"function",
"export_user_data_lti_tool_proxies",
"(",
"approved_contextlist",
"$",
"contextlist",
")",
"{",
"global",
"$",
"DB",
";",
"// Filter out any contexts that are not related to system context.",
"$",
"systemcontexts",
"=",
"array_filter",
"(",
... | Export personal data for the given approved_contextlist related to LTI tool proxies.
@param approved_contextlist $contextlist a list of contexts approved for export. | [
"Export",
"personal",
"data",
"for",
"the",
"given",
"approved_contextlist",
"related",
"to",
"LTI",
"tool",
"proxies",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/privacy/provider.php#L381-L411 |
219,470 | moodle/moodle | admin/tool/analytics/classes/output/restorable_models.php | restorable_models.export_for_template | public function export_for_template(\renderer_base $output) {
$components = [];
foreach ($this->models as $componentname => $modelslist) {
$component = [
'name' => $this->component_name($componentname),
'component' => $componentname,
'models'... | php | public function export_for_template(\renderer_base $output) {
$components = [];
foreach ($this->models as $componentname => $modelslist) {
$component = [
'name' => $this->component_name($componentname),
'component' => $componentname,
'models'... | [
"public",
"function",
"export_for_template",
"(",
"\\",
"renderer_base",
"$",
"output",
")",
"{",
"$",
"components",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"models",
"as",
"$",
"componentname",
"=>",
"$",
"modelslist",
")",
"{",
"$",
"com... | Export the list of models to be rendered.
@param renderer_base $output
@return string | [
"Export",
"the",
"list",
"of",
"models",
"to",
"be",
"rendered",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/analytics/classes/output/restorable_models.php#L57-L125 |
219,471 | moodle/moodle | admin/tool/analytics/classes/output/restorable_models.php | restorable_models.component_name | protected function component_name(string $component): string {
if ($component === 'core' || strpos($component, 'core_')) {
return get_string('componentcore', 'tool_analytics');
} else {
return get_string('pluginname', $component);
}
} | php | protected function component_name(string $component): string {
if ($component === 'core' || strpos($component, 'core_')) {
return get_string('componentcore', 'tool_analytics');
} else {
return get_string('pluginname', $component);
}
} | [
"protected",
"function",
"component_name",
"(",
"string",
"$",
"component",
")",
":",
"string",
"{",
"if",
"(",
"$",
"component",
"===",
"'core'",
"||",
"strpos",
"(",
"$",
"component",
",",
"'core_'",
")",
")",
"{",
"return",
"get_string",
"(",
"'componen... | Return a human readable name for the given frankenstyle component.
@param string $component Frankenstyle component such as 'core', 'core_analytics' or 'mod_workshop'
@return string Human readable name of the component | [
"Return",
"a",
"human",
"readable",
"name",
"for",
"the",
"given",
"frankenstyle",
"component",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/analytics/classes/output/restorable_models.php#L133-L141 |
219,472 | moodle/moodle | customfield/classes/data_controller.php | data_controller.create | public static function create(int $id, \stdClass $record = null, field_controller $field = null) : data_controller {
global $DB;
if ($id && $record) {
// This warning really should be in persistent as well.
debugging('Too many parameters, either id need to be specified or a recor... | php | public static function create(int $id, \stdClass $record = null, field_controller $field = null) : data_controller {
global $DB;
if ($id && $record) {
// This warning really should be in persistent as well.
debugging('Too many parameters, either id need to be specified or a recor... | [
"public",
"static",
"function",
"create",
"(",
"int",
"$",
"id",
",",
"\\",
"stdClass",
"$",
"record",
"=",
"null",
",",
"field_controller",
"$",
"field",
"=",
"null",
")",
":",
"data_controller",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"id",
... | Creates an instance of data_controller
Parameters $id, $record and $field can complement each other but not conflict.
If $id is not specified, fieldid must be present either in $record or in $field.
If $id is not specified, instanceid must be present in $record
No DB queries are performed if both $record and $field a... | [
"Creates",
"an",
"instance",
"of",
"data_controller"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/data_controller.php#L85-L118 |
219,473 | moodle/moodle | customfield/classes/data_controller.php | data_controller.is_empty | protected function is_empty($value) : bool {
if ($this->datafield() === 'value' || $this->datafield() === 'charvalue' || $this->datafield() === 'shortcharvalue') {
return '' . $value === '';
}
return empty($value);
} | php | protected function is_empty($value) : bool {
if ($this->datafield() === 'value' || $this->datafield() === 'charvalue' || $this->datafield() === 'shortcharvalue') {
return '' . $value === '';
}
return empty($value);
} | [
"protected",
"function",
"is_empty",
"(",
"$",
"value",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"datafield",
"(",
")",
"===",
"'value'",
"||",
"$",
"this",
"->",
"datafield",
"(",
")",
"===",
"'charvalue'",
"||",
"$",
"this",
"->",
"data... | Checks if the value is empty
@param mixed $value
@return bool | [
"Checks",
"if",
"the",
"value",
"is",
"empty"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/data_controller.php#L226-L231 |
219,474 | moodle/moodle | customfield/classes/data_controller.php | data_controller.is_unique | protected function is_unique($value) : bool {
global $DB;
$datafield = $this->datafield();
$where = "fieldid = ? AND {$datafield} = ?";
$params = [$this->get_field()->get('id'), $value];
if ($this->get('id')) {
$where .= ' AND id <> ?';
$params[] = $this->... | php | protected function is_unique($value) : bool {
global $DB;
$datafield = $this->datafield();
$where = "fieldid = ? AND {$datafield} = ?";
$params = [$this->get_field()->get('id'), $value];
if ($this->get('id')) {
$where .= ' AND id <> ?';
$params[] = $this->... | [
"protected",
"function",
"is_unique",
"(",
"$",
"value",
")",
":",
"bool",
"{",
"global",
"$",
"DB",
";",
"$",
"datafield",
"=",
"$",
"this",
"->",
"datafield",
"(",
")",
";",
"$",
"where",
"=",
"\"fieldid = ? AND {$datafield} = ?\"",
";",
"$",
"params",
... | Checks if the value is unique
@param mixed $value
@return bool | [
"Checks",
"if",
"the",
"value",
"is",
"unique"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/data_controller.php#L239-L249 |
219,475 | moodle/moodle | customfield/classes/data_controller.php | data_controller.display | public function display() : string {
global $PAGE;
$output = $PAGE->get_renderer('core_customfield');
return $output->render(new field_data($this));
} | php | public function display() : string {
global $PAGE;
$output = $PAGE->get_renderer('core_customfield');
return $output->render(new field_data($this));
} | [
"public",
"function",
"display",
"(",
")",
":",
"string",
"{",
"global",
"$",
"PAGE",
";",
"$",
"output",
"=",
"$",
"PAGE",
"->",
"get_renderer",
"(",
"'core_customfield'",
")",
";",
"return",
"$",
"output",
"->",
"render",
"(",
"new",
"field_data",
"(",... | Used by handlers to display data on various places.
@return string | [
"Used",
"by",
"handlers",
"to",
"display",
"data",
"on",
"various",
"places",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/data_controller.php#L284-L288 |
219,476 | moodle/moodle | customfield/classes/data_controller.php | data_controller.get_context | public function get_context() : \context {
if ($this->get('contextid')) {
return \context::instance_by_id($this->get('contextid'));
} else if ($this->get('instanceid')) {
return $this->get_field()->get_handler()->get_instance_context($this->get('instanceid'));
} else {
... | php | public function get_context() : \context {
if ($this->get('contextid')) {
return \context::instance_by_id($this->get('contextid'));
} else if ($this->get('instanceid')) {
return $this->get_field()->get_handler()->get_instance_context($this->get('instanceid'));
} else {
... | [
"public",
"function",
"get_context",
"(",
")",
":",
"\\",
"context",
"{",
"if",
"(",
"$",
"this",
"->",
"get",
"(",
"'contextid'",
")",
")",
"{",
"return",
"\\",
"context",
"::",
"instance_by_id",
"(",
"$",
"this",
"->",
"get",
"(",
"'contextid'",
")",... | Return the context of the field
@return \context | [
"Return",
"the",
"context",
"of",
"the",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/data_controller.php#L314-L323 |
219,477 | moodle/moodle | customfield/classes/data_controller.php | data_controller.export_value | public function export_value() {
$value = $this->get_value();
if ($this->is_empty($value)) {
return null;
}
if ($this->datafield() === 'intvalue') {
return (int)$value;
} else if ($this->datafield() === 'decvalue') {
return (float)$value;
... | php | public function export_value() {
$value = $this->get_value();
if ($this->is_empty($value)) {
return null;
}
if ($this->datafield() === 'intvalue') {
return (int)$value;
} else if ($this->datafield() === 'decvalue') {
return (float)$value;
... | [
"public",
"function",
"export_value",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"get_value",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"is_empty",
"(",
"$",
"value",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"this",... | Returns value in a human-readable format or default value if data record is not present
This is the default implementation that most likely needs to be overridden
@return mixed|null value or null if empty | [
"Returns",
"value",
"in",
"a",
"human",
"-",
"readable",
"format",
"or",
"default",
"value",
"if",
"data",
"record",
"is",
"not",
"present"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/data_controller.php#L339-L355 |
219,478 | moodle/moodle | availability/classes/info_module.php | info_module.is_user_visible | public static function is_user_visible($cmorid, $userid = 0, $checkcourse = true) {
global $USER, $DB, $CFG;
// Evaluate user id.
if (!$userid) {
$userid = $USER->id;
}
// If this happens to be already called with a cm_info for the right user
// then just re... | php | public static function is_user_visible($cmorid, $userid = 0, $checkcourse = true) {
global $USER, $DB, $CFG;
// Evaluate user id.
if (!$userid) {
$userid = $USER->id;
}
// If this happens to be already called with a cm_info for the right user
// then just re... | [
"public",
"static",
"function",
"is_user_visible",
"(",
"$",
"cmorid",
",",
"$",
"userid",
"=",
"0",
",",
"$",
"checkcourse",
"=",
"true",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"DB",
",",
"$",
"CFG",
";",
"// Evaluate user id.",
"if",
"(",
"!",
... | Checks if an activity is visible to the given user.
Unlike other checks in the availability system, this check includes the
$cm->visible flag. It is equivalent to $cm->uservisible.
If you have already checked (or do not care whether) the user has access
to the course, you can set $checkcourse to false to save it chec... | [
"Checks",
"if",
"an",
"activity",
"is",
"visible",
"to",
"the",
"given",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/availability/classes/info_module.php#L166-L225 |
219,479 | moodle/moodle | lib/portfoliolib.php | portfolio_add_button.set_callback_options | public function set_callback_options($class, array $argarray, $component) {
global $CFG;
// Require the base class first before any other files.
require_once($CFG->libdir . '/portfolio/caller.php');
// Include any potential callback files and check for errors.
portfolio_include... | php | public function set_callback_options($class, array $argarray, $component) {
global $CFG;
// Require the base class first before any other files.
require_once($CFG->libdir . '/portfolio/caller.php');
// Include any potential callback files and check for errors.
portfolio_include... | [
"public",
"function",
"set_callback_options",
"(",
"$",
"class",
",",
"array",
"$",
"argarray",
",",
"$",
"component",
")",
"{",
"global",
"$",
"CFG",
";",
"// Require the base class first before any other files.",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
... | Function to set the callback options
@param string $class Name of the class containing the callback functions
activity components should ALWAYS use their name_portfolio_caller
other locations must use something unique
@param array $argarray This can be an array or hash of arguments to pass
back to the callback functio... | [
"Function",
"to",
"set",
"the",
"callback",
"options"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfoliolib.php#L153-L169 |
219,480 | moodle/moodle | lib/portfoliolib.php | portfolio_add_button.set_format_by_file | public function set_format_by_file(stored_file $file, $extraformats=null) {
$this->file = $file;
$fileformat = portfolio_format_from_mimetype($file->get_mimetype());
if (is_string($extraformats)) {
$extraformats = array($extraformats);
} else if (!is_array($extraformats)) {
... | php | public function set_format_by_file(stored_file $file, $extraformats=null) {
$this->file = $file;
$fileformat = portfolio_format_from_mimetype($file->get_mimetype());
if (is_string($extraformats)) {
$extraformats = array($extraformats);
} else if (!is_array($extraformats)) {
... | [
"public",
"function",
"set_format_by_file",
"(",
"stored_file",
"$",
"file",
",",
"$",
"extraformats",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"file",
"=",
"$",
"file",
";",
"$",
"fileformat",
"=",
"portfolio_format_from_mimetype",
"(",
"$",
"file",
"->",
... | If we already know we have exactly one file,
bypass set_formats and just pass the file
so we can detect the formats by mimetype.
@param stored_file $file file to set the format from
@param array $extraformats any additional formats other than by mimetype
eg leap2a etc | [
"If",
"we",
"already",
"know",
"we",
"have",
"exactly",
"one",
"file",
"bypass",
"set_formats",
"and",
"just",
"pass",
"the",
"file",
"so",
"we",
"can",
"detect",
"the",
"formats",
"by",
"mimetype",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfoliolib.php#L217-L226 |
219,481 | moodle/moodle | lib/portfoliolib.php | portfolio_add_button.is_renderable | private function is_renderable() {
global $CFG;
if (empty($CFG->enableportfolios)) {
return false;
}
if (defined('PORTFOLIO_INTERNAL')) {
// something somewhere has detected a risk of this being called during inside the preparation
// eg forum_print_at... | php | private function is_renderable() {
global $CFG;
if (empty($CFG->enableportfolios)) {
return false;
}
if (defined('PORTFOLIO_INTERNAL')) {
// something somewhere has detected a risk of this being called during inside the preparation
// eg forum_print_at... | [
"private",
"function",
"is_renderable",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"enableportfolios",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"defined",
"(",
"'PORTFOLIO_INTERNAL'",
")",
")",
"{... | Perform some internal checks.
These are not errors, just situations
where it's not appropriate to add the button
@return bool | [
"Perform",
"some",
"internal",
"checks",
".",
"These",
"are",
"not",
"errors",
"just",
"situations",
"where",
"it",
"s",
"not",
"appropriate",
"to",
"add",
"the",
"button"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfoliolib.php#L391-L405 |
219,482 | moodle/moodle | backup/util/xml/xml_writer.class.php | xml_writer.start | public function start() {
if ($this->running === true) {
throw new xml_writer_exception('xml_writer_already_started');
}
if ($this->running === false) {
throw new xml_writer_exception('xml_writer_already_stopped');
}
$this->output->start(); // Initialize w... | php | public function start() {
if ($this->running === true) {
throw new xml_writer_exception('xml_writer_already_started');
}
if ($this->running === false) {
throw new xml_writer_exception('xml_writer_already_stopped');
}
$this->output->start(); // Initialize w... | [
"public",
"function",
"start",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"running",
"===",
"true",
")",
"{",
"throw",
"new",
"xml_writer_exception",
"(",
"'xml_writer_already_started'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"running",
"===",
"f... | Initializes the XML writer, preparing it to accept instructions, also
invoking the underlying @xml_output init method to be ready for operation | [
"Initializes",
"the",
"XML",
"writer",
"preparing",
"it",
"to",
"accept",
"instructions",
"also",
"invoking",
"the",
"underlying"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/xml/xml_writer.class.php#L85-L99 |
219,483 | moodle/moodle | backup/util/xml/xml_writer.class.php | xml_writer.stop | public function stop() {
if (is_null($this->running)) {
throw new xml_writer_exception('xml_writer_not_started');
}
if ($this->running === false) {
throw new xml_writer_exception('xml_writer_already_stopped');
}
if ($this->level > 0) { // Cannot stop if no... | php | public function stop() {
if (is_null($this->running)) {
throw new xml_writer_exception('xml_writer_not_started');
}
if ($this->running === false) {
throw new xml_writer_exception('xml_writer_already_stopped');
}
if ($this->level > 0) { // Cannot stop if no... | [
"public",
"function",
"stop",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"running",
")",
")",
"{",
"throw",
"new",
"xml_writer_exception",
"(",
"'xml_writer_not_started'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"running",
"===",
... | Finishes the XML writer, not accepting instructions any more, also
invoking the underlying @xml_output finish method to close/flush everything as needed | [
"Finishes",
"the",
"XML",
"writer",
"not",
"accepting",
"instructions",
"any",
"more",
"also",
"invoking",
"the",
"underlying"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/xml/xml_writer.class.php#L105-L117 |
219,484 | moodle/moodle | backup/util/xml/xml_writer.class.php | xml_writer.end_tag | public function end_tag($tag) {
// TODO: check the tag name is valid
if ($this->level == 0) { // Nothing to end, already at level 0
throw new xml_writer_exception('xml_writer_end_tag_no_match');
}
$pre = $this->lastwastext ? '' : "\n" . str_repeat(' ', ($this->level - 1) * ... | php | public function end_tag($tag) {
// TODO: check the tag name is valid
if ($this->level == 0) { // Nothing to end, already at level 0
throw new xml_writer_exception('xml_writer_end_tag_no_match');
}
$pre = $this->lastwastext ? '' : "\n" . str_repeat(' ', ($this->level - 1) * ... | [
"public",
"function",
"end_tag",
"(",
"$",
"tag",
")",
"{",
"// TODO: check the tag name is valid",
"if",
"(",
"$",
"this",
"->",
"level",
"==",
"0",
")",
"{",
"// Nothing to end, already at level 0",
"throw",
"new",
"xml_writer_exception",
"(",
"'xml_writer_end_tag_n... | Outputs one XML end tag | [
"Outputs",
"one",
"XML",
"end",
"tag"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/xml/xml_writer.class.php#L180-L204 |
219,485 | moodle/moodle | backup/util/xml/xml_writer.class.php | xml_writer.text_content | protected function text_content($content) {
if (!is_null($this->contenttransformer)) { // Apply content transformation
$content = $this->contenttransformer->process($content);
}
return is_null($content) ? null : $this->xml_safe_text_content($content); // Safe UTF-8 and encode
} | php | protected function text_content($content) {
if (!is_null($this->contenttransformer)) { // Apply content transformation
$content = $this->contenttransformer->process($content);
}
return is_null($content) ? null : $this->xml_safe_text_content($content); // Safe UTF-8 and encode
} | [
"protected",
"function",
"text_content",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"contenttransformer",
")",
")",
"{",
"// Apply content transformation",
"$",
"content",
"=",
"$",
"this",
"->",
"contenttransformer",
"->... | Returns text contents processed by the corresponding @xml_contenttransformer | [
"Returns",
"text",
"contents",
"processed",
"by",
"the",
"corresponding"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/xml/xml_writer.class.php#L271-L276 |
219,486 | moodle/moodle | lib/classes/event/course_section_created.php | course_section_created.create_from_section | public static function create_from_section($section) {
$event = self::create([
'context' => \context_course::instance($section->course),
'objectid' => $section->id,
'other' => ['sectionnum' => $section->section]
]);
$event->add_record_snapshot('course_sections... | php | public static function create_from_section($section) {
$event = self::create([
'context' => \context_course::instance($section->course),
'objectid' => $section->id,
'other' => ['sectionnum' => $section->section]
]);
$event->add_record_snapshot('course_sections... | [
"public",
"static",
"function",
"create_from_section",
"(",
"$",
"section",
")",
"{",
"$",
"event",
"=",
"self",
"::",
"create",
"(",
"[",
"'context'",
"=>",
"\\",
"context_course",
"::",
"instance",
"(",
"$",
"section",
"->",
"course",
")",
",",
"'objecti... | Creates event from the section object
@param \stdClass $section
@return course_section_created | [
"Creates",
"event",
"from",
"the",
"section",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/event/course_section_created.php#L61-L69 |
219,487 | moodle/moodle | lib/filestorage/mbz_packer.php | mbz_packer.get_packer_for_read_operation | protected function get_packer_for_read_operation($archivefile) {
global $CFG;
require_once($CFG->dirroot . '/lib/filestorage/tgz_packer.php');
if (tgz_packer::is_tgz_file($archivefile)) {
return get_file_packer('application/x-gzip');
} else {
return get_file_pack... | php | protected function get_packer_for_read_operation($archivefile) {
global $CFG;
require_once($CFG->dirroot . '/lib/filestorage/tgz_packer.php');
if (tgz_packer::is_tgz_file($archivefile)) {
return get_file_packer('application/x-gzip');
} else {
return get_file_pack... | [
"protected",
"function",
"get_packer_for_read_operation",
"(",
"$",
"archivefile",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/lib/filestorage/tgz_packer.php'",
")",
";",
"if",
"(",
"tgz_packer",
"::",
"is_tgz_fil... | Selects appropriate packer for existing archive depending on file contents.
@param string|stored_file $archivefile full pathname of zip file or stored_file instance
@return file_packer Suitable packer | [
"Selects",
"appropriate",
"packer",
"for",
"existing",
"archive",
"depending",
"on",
"file",
"contents",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/mbz_packer.php#L165-L174 |
219,488 | moodle/moodle | lib/lessphp/Visitor/processExtends.php | Less_Visitor_processExtends.HasMatches | private function HasMatches($extend, $haystackSelectorPath){
if( !$extend->selector->cacheable ){
return true;
}
$first_el = $extend->selector->_oelements[0];
foreach($haystackSelectorPath as $hackstackSelector){
if( !$hackstackSelector->cacheable ){
return true;
}
if( in_array($first_el, $h... | php | private function HasMatches($extend, $haystackSelectorPath){
if( !$extend->selector->cacheable ){
return true;
}
$first_el = $extend->selector->_oelements[0];
foreach($haystackSelectorPath as $hackstackSelector){
if( !$hackstackSelector->cacheable ){
return true;
}
if( in_array($first_el, $h... | [
"private",
"function",
"HasMatches",
"(",
"$",
"extend",
",",
"$",
"haystackSelectorPath",
")",
"{",
"if",
"(",
"!",
"$",
"extend",
"->",
"selector",
"->",
"cacheable",
")",
"{",
"return",
"true",
";",
"}",
"$",
"first_el",
"=",
"$",
"extend",
"->",
"s... | Reduces Bootstrap 3.1 compile time from ~6.5s to ~5.6s | [
"Reduces",
"Bootstrap",
"3",
".",
"1",
"compile",
"time",
"from",
"~6",
".",
"5s",
"to",
"~5",
".",
"6s"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Visitor/processExtends.php#L259-L278 |
219,489 | moodle/moodle | lib/spout/src/Spout/Writer/AbstractMultiSheetsWriter.php | AbstractMultiSheetsWriter.getSheets | public function getSheets()
{
$this->throwIfBookIsNotAvailable();
$externalSheets = [];
$worksheets = $this->getWorkbook()->getWorksheets();
/** @var Common\Internal\WorksheetInterface $worksheet */
foreach ($worksheets as $worksheet) {
$externalSheets[] = $work... | php | public function getSheets()
{
$this->throwIfBookIsNotAvailable();
$externalSheets = [];
$worksheets = $this->getWorkbook()->getWorksheets();
/** @var Common\Internal\WorksheetInterface $worksheet */
foreach ($worksheets as $worksheet) {
$externalSheets[] = $work... | [
"public",
"function",
"getSheets",
"(",
")",
"{",
"$",
"this",
"->",
"throwIfBookIsNotAvailable",
"(",
")",
";",
"$",
"externalSheets",
"=",
"[",
"]",
";",
"$",
"worksheets",
"=",
"$",
"this",
"->",
"getWorkbook",
"(",
")",
"->",
"getWorksheets",
"(",
")... | Returns all the workbook's sheets
@api
@return Common\Sheet[] All the workbook's sheets
@throws \Box\Spout\Writer\Exception\WriterNotOpenedException If the writer has not been opened yet | [
"Returns",
"all",
"the",
"workbook",
"s",
"sheets"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/AbstractMultiSheetsWriter.php#L47-L60 |
219,490 | moodle/moodle | calendar/classes/external/calendar_day_exporter.php | calendar_day_exporter.get_course_filter_selector | protected function get_course_filter_selector(renderer_base $output) {
$langstr = get_string('dayviewfor', 'calendar');
return $output->course_filter_selector($this->url, $langstr, $this->calendar->course->id);
} | php | protected function get_course_filter_selector(renderer_base $output) {
$langstr = get_string('dayviewfor', 'calendar');
return $output->course_filter_selector($this->url, $langstr, $this->calendar->course->id);
} | [
"protected",
"function",
"get_course_filter_selector",
"(",
"renderer_base",
"$",
"output",
")",
"{",
"$",
"langstr",
"=",
"get_string",
"(",
"'dayviewfor'",
",",
"'calendar'",
")",
";",
"return",
"$",
"output",
"->",
"course_filter_selector",
"(",
"$",
"this",
... | Get the course filter selector.
@param renderer_base $output
@return string The html code for the course filter selector. | [
"Get",
"the",
"course",
"filter",
"selector",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/calendar_day_exporter.php#L242-L245 |
219,491 | moodle/moodle | calendar/classes/external/calendar_day_exporter.php | calendar_day_exporter.get_previous_day_data | protected function get_previous_day_data() {
$type = $this->related['type'];
$time = $type->get_prev_day($this->calendar->time);
return $type->timestamp_to_date_array($time);
} | php | protected function get_previous_day_data() {
$type = $this->related['type'];
$time = $type->get_prev_day($this->calendar->time);
return $type->timestamp_to_date_array($time);
} | [
"protected",
"function",
"get_previous_day_data",
"(",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"related",
"[",
"'type'",
"]",
";",
"$",
"time",
"=",
"$",
"type",
"->",
"get_prev_day",
"(",
"$",
"this",
"->",
"calendar",
"->",
"time",
")",
";",
... | Get the previous day timestamp.
@return int The previous day timestamp. | [
"Get",
"the",
"previous",
"day",
"timestamp",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/calendar_day_exporter.php#L265-L270 |
219,492 | moodle/moodle | calendar/classes/external/calendar_day_exporter.php | calendar_day_exporter.get_next_day_data | protected function get_next_day_data() {
$type = $this->related['type'];
$time = $type->get_next_day($this->calendar->time);
return $type->timestamp_to_date_array($time);
} | php | protected function get_next_day_data() {
$type = $this->related['type'];
$time = $type->get_next_day($this->calendar->time);
return $type->timestamp_to_date_array($time);
} | [
"protected",
"function",
"get_next_day_data",
"(",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"related",
"[",
"'type'",
"]",
";",
"$",
"time",
"=",
"$",
"type",
"->",
"get_next_day",
"(",
"$",
"this",
"->",
"calendar",
"->",
"time",
")",
";",
"re... | Get the next day timestamp.
@return int The next day timestamp. | [
"Get",
"the",
"next",
"day",
"timestamp",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/calendar_day_exporter.php#L277-L282 |
219,493 | moodle/moodle | mod/wiki/parser/parser.php | generic_parser.process_block_rule | protected function process_block_rule($name, $block) {
$this->rulestack[] = array('callback' => method_exists($this, $name."_block_rule") ? $name."_block_rule" : null, 'rule' => $block);
$this->string = preg_replace_callback($block['expression'], array($this, 'block_callback'), $this->string);
... | php | protected function process_block_rule($name, $block) {
$this->rulestack[] = array('callback' => method_exists($this, $name."_block_rule") ? $name."_block_rule" : null, 'rule' => $block);
$this->string = preg_replace_callback($block['expression'], array($this, 'block_callback'), $this->string);
... | [
"protected",
"function",
"process_block_rule",
"(",
"$",
"name",
",",
"$",
"block",
")",
"{",
"$",
"this",
"->",
"rulestack",
"[",
"]",
"=",
"array",
"(",
"'callback'",
"=>",
"method_exists",
"(",
"$",
"this",
",",
"$",
"name",
".",
"\"_block_rule\"",
")... | Block processing function & callbacks | [
"Block",
"processing",
"function",
"&",
"callbacks"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/parser/parser.php#L146-L152 |
219,494 | moodle/moodle | mod/wiki/parser/parser.php | generic_parser.rules | protected final function rules(&$text, $rules = null) {
if($rules === null) {
$rules = array('except' => array());
}
else if(is_array($rules) && count($rules) > 1) {
$rules = array('only' => $rules);
}
if(isset($rules['only']) && is_array($rules['only']))... | php | protected final function rules(&$text, $rules = null) {
if($rules === null) {
$rules = array('except' => array());
}
else if(is_array($rules) && count($rules) > 1) {
$rules = array('only' => $rules);
}
if(isset($rules['only']) && is_array($rules['only']))... | [
"protected",
"final",
"function",
"rules",
"(",
"&",
"$",
"text",
",",
"$",
"rules",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"rules",
"===",
"null",
")",
"{",
"$",
"rules",
"=",
"array",
"(",
"'except'",
"=>",
"array",
"(",
")",
")",
";",
"}",
"... | Rules processing function & callback | [
"Rules",
"processing",
"function",
"&",
"callback"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/parser/parser.php#L184-L208 |
219,495 | moodle/moodle | mod/wiki/parser/parser.php | generic_parser.initialize_nowiki_index | private function initialize_nowiki_index() {
$token = "\Q".$this->nowikitoken."\E";
$this->string = preg_replace_callback("/".$token."\d+".$token."/", array($this, "initialize_nowiki_index_callback"), $this->string);
} | php | private function initialize_nowiki_index() {
$token = "\Q".$this->nowikitoken."\E";
$this->string = preg_replace_callback("/".$token."\d+".$token."/", array($this, "initialize_nowiki_index_callback"), $this->string);
} | [
"private",
"function",
"initialize_nowiki_index",
"(",
")",
"{",
"$",
"token",
"=",
"\"\\Q\"",
".",
"$",
"this",
"->",
"nowikitoken",
".",
"\"\\E\"",
";",
"$",
"this",
"->",
"string",
"=",
"preg_replace_callback",
"(",
"\"/\"",
".",
"$",
"token",
".",
"\"\... | Special nowiki parser index | [
"Special",
"nowiki",
"parser",
"index"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/parser/parser.php#L244-L247 |
219,496 | moodle/moodle | availability/condition/group/classes/condition.php | condition.include_after_restore | public function include_after_restore($restoreid, $courseid, \base_logger $logger,
$name, \base_task $task) {
return !$this->groupid || $task->get_setting_value('groups');
} | php | public function include_after_restore($restoreid, $courseid, \base_logger $logger,
$name, \base_task $task) {
return !$this->groupid || $task->get_setting_value('groups');
} | [
"public",
"function",
"include_after_restore",
"(",
"$",
"restoreid",
",",
"$",
"courseid",
",",
"\\",
"base_logger",
"$",
"logger",
",",
"$",
"name",
",",
"\\",
"base_task",
"$",
"task",
")",
"{",
"return",
"!",
"$",
"this",
"->",
"groupid",
"||",
"$",
... | Include this condition only if we are including groups in restore, or
if it's a generic 'same activity' one.
@param int $restoreid The restore Id.
@param int $courseid The ID of the course.
@param base_logger $logger The logger being used.
@param string $name Name of item being restored.
@param base_task $task The tas... | [
"Include",
"this",
"condition",
"only",
"if",
"we",
"are",
"including",
"groups",
"in",
"restore",
"or",
"if",
"it",
"s",
"a",
"generic",
"same",
"activity",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/availability/condition/group/classes/condition.php#L142-L145 |
219,497 | moodle/moodle | question/format/xml/format.php | qformat_xml.trans_format | public function trans_format($name) {
$name = trim($name);
if ($name == 'moodle_auto_format') {
return FORMAT_MOODLE;
} else if ($name == 'html') {
return FORMAT_HTML;
} else if ($name == 'plain_text') {
return FORMAT_PLAIN;
} else if ($name =... | php | public function trans_format($name) {
$name = trim($name);
if ($name == 'moodle_auto_format') {
return FORMAT_MOODLE;
} else if ($name == 'html') {
return FORMAT_HTML;
} else if ($name == 'plain_text') {
return FORMAT_PLAIN;
} else if ($name =... | [
"public",
"function",
"trans_format",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"trim",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"name",
"==",
"'moodle_auto_format'",
")",
"{",
"return",
"FORMAT_MOODLE",
";",
"}",
"else",
"if",
"(",
"$",
"name... | Translate human readable format name
into internal Moodle code number
Note the reverse function is called get_format.
@param string name format name from xml file
@return int Moodle format code | [
"Translate",
"human",
"readable",
"format",
"name",
"into",
"internal",
"Moodle",
"code",
"number",
"Note",
"the",
"reverse",
"function",
"is",
"called",
"get_format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/xml/format.php#L70-L87 |
219,498 | moodle/moodle | question/format/xml/format.php | qformat_xml.getpath | public function getpath($xml, $path, $default, $istext=false, $error='') {
foreach ($path as $index) {
if (!isset($xml[$index])) {
if (!empty($error)) {
$this->error($error);
return false;
} else {
return $de... | php | public function getpath($xml, $path, $default, $istext=false, $error='') {
foreach ($path as $index) {
if (!isset($xml[$index])) {
if (!empty($error)) {
$this->error($error);
return false;
} else {
return $de... | [
"public",
"function",
"getpath",
"(",
"$",
"xml",
",",
"$",
"path",
",",
"$",
"default",
",",
"$",
"istext",
"=",
"false",
",",
"$",
"error",
"=",
"''",
")",
"{",
"foreach",
"(",
"$",
"path",
"as",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"isset... | return the value of a node, given a path to the node
if it doesn't exist return the default value
@param array xml data to read
@param array path path to node expressed as array
@param mixed default
@param bool istext process as text
@param string error if set value must exist, return false and issue message if not
@re... | [
"return",
"the",
"value",
"of",
"a",
"node",
"given",
"a",
"path",
"to",
"the",
"node",
"if",
"it",
"doesn",
"t",
"exist",
"return",
"the",
"default",
"value"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/xml/format.php#L128-L150 |
219,499 | moodle/moodle | question/format/xml/format.php | qformat_xml.import_answer | public function import_answer($answer, $withanswerfiles = false, $defaultformat = 'html') {
$ans = new stdClass();
if ($withanswerfiles) {
$ans->answer = $this->import_text_with_files($answer, array(), '', $defaultformat);
} else {
$ans->answer = array();
$an... | php | public function import_answer($answer, $withanswerfiles = false, $defaultformat = 'html') {
$ans = new stdClass();
if ($withanswerfiles) {
$ans->answer = $this->import_text_with_files($answer, array(), '', $defaultformat);
} else {
$ans->answer = array();
$an... | [
"public",
"function",
"import_answer",
"(",
"$",
"answer",
",",
"$",
"withanswerfiles",
"=",
"false",
",",
"$",
"defaultformat",
"=",
"'html'",
")",
"{",
"$",
"ans",
"=",
"new",
"stdClass",
"(",
")",
";",
"if",
"(",
"$",
"withanswerfiles",
")",
"{",
"$... | Import the common parts of a single answer
@param array answer xml tree for single answer
@param bool $withanswerfiles if true, the answers are HTML (or $defaultformat)
and so may contain files, otherwise the answers are plain text.
@param array Default text format for the feedback, and the answers if $withanswerfiles
... | [
"Import",
"the",
"common",
"parts",
"of",
"a",
"single",
"answer"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/xml/format.php#L275-L291 |
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.