id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
215,700 | moodle/moodle | question/type/multichoice/backup/moodle1/lib.php | moodle1_qtype_multichoice_handler.write_multichoice | protected function write_multichoice(array $multichoices, $oldquestiontextformat, $questionid) {
global $CFG;
// The grouped array is supposed to have just one element - let us use foreach anyway
// just to be sure we do not loose anything.
foreach ($multichoices as $multichoice) {
... | php | protected function write_multichoice(array $multichoices, $oldquestiontextformat, $questionid) {
global $CFG;
// The grouped array is supposed to have just one element - let us use foreach anyway
// just to be sure we do not loose anything.
foreach ($multichoices as $multichoice) {
... | [
"protected",
"function",
"write_multichoice",
"(",
"array",
"$",
"multichoices",
",",
"$",
"oldquestiontextformat",
",",
"$",
"questionid",
")",
"{",
"global",
"$",
"CFG",
";",
"// The grouped array is supposed to have just one element - let us use foreach anyway",
"// just t... | Converts the multichoice info and writes it into the question.xml
@param array $multichoices the grouped structure
@param int $oldquestiontextformat - {@see moodle1_question_bank_handler::process_question()}
@param int $questionid question id | [
"Converts",
"the",
"multichoice",
"info",
"and",
"writes",
"it",
"into",
"the",
"question",
".",
"xml"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/multichoice/backup/moodle1/lib.php#L77-L113 |
215,701 | moodle/moodle | backup/moodle2/backup_stepslib.php | backup_activity_structure_step.prepare_activity_structure | protected function prepare_activity_structure($activitystructure) {
// Create the wrap element
$activity = new backup_nested_element('activity', array('id', 'moduleid', 'modulename', 'contextid'), null);
// Build the tree
$activity->add_child($activitystructure);
// Set the so... | php | protected function prepare_activity_structure($activitystructure) {
// Create the wrap element
$activity = new backup_nested_element('activity', array('id', 'moduleid', 'modulename', 'contextid'), null);
// Build the tree
$activity->add_child($activitystructure);
// Set the so... | [
"protected",
"function",
"prepare_activity_structure",
"(",
"$",
"activitystructure",
")",
"{",
"// Create the wrap element",
"$",
"activity",
"=",
"new",
"backup_nested_element",
"(",
"'activity'",
",",
"array",
"(",
"'id'",
",",
"'moduleid'",
",",
"'modulename'",
",... | Wraps any activity backup structure within the common 'activity' element
that will include common to all activities information like id, context...
@param backup_nested_element $activitystructure the element to wrap
@return backup_nested_element the $activitystructure wrapped by the common 'activity' element | [
"Wraps",
"any",
"activity",
"backup",
"structure",
"within",
"the",
"common",
"activity",
"element",
"that",
"will",
"include",
"common",
"to",
"all",
"activities",
"information",
"like",
"id",
"context",
"..."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/backup_stepslib.php#L105-L124 |
215,702 | moodle/moodle | backup/moodle2/backup_stepslib.php | backup_gradebook_structure_step.execute_condition | protected function execute_condition() {
$courseid = $this->get_courseid();
if ($courseid == SITEID) {
return false;
}
return backup_plan_dbops::require_gradebook_backup($courseid, $this->get_backupid());
} | php | protected function execute_condition() {
$courseid = $this->get_courseid();
if ($courseid == SITEID) {
return false;
}
return backup_plan_dbops::require_gradebook_backup($courseid, $this->get_backupid());
} | [
"protected",
"function",
"execute_condition",
"(",
")",
"{",
"$",
"courseid",
"=",
"$",
"this",
"->",
"get_courseid",
"(",
")",
";",
"if",
"(",
"$",
"courseid",
"==",
"SITEID",
")",
"{",
"return",
"false",
";",
"}",
"return",
"backup_plan_dbops",
"::",
"... | We need to decide conditionally, based on dynamic information
about the execution of this step. Only will be executed if all
the module gradeitems have been already included in backup | [
"We",
"need",
"to",
"decide",
"conditionally",
"based",
"on",
"dynamic",
"information",
"about",
"the",
"execution",
"of",
"this",
"step",
".",
"Only",
"will",
"be",
"executed",
"if",
"all",
"the",
"module",
"gradeitems",
"have",
"been",
"already",
"included",... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/backup_stepslib.php#L961-L968 |
215,703 | moodle/moodle | backup/moodle2/backup_stepslib.php | backup_enrolments_execution_step.define_execution | protected function define_execution() {
global $DB;
$plugins = enrol_get_plugins(true);
$enrols = $DB->get_records('enrol', array(
'courseid' => $this->task->get_courseid()));
// Allow each enrol plugin to add annotations.
foreach ($enrols as $enrol) {
... | php | protected function define_execution() {
global $DB;
$plugins = enrol_get_plugins(true);
$enrols = $DB->get_records('enrol', array(
'courseid' => $this->task->get_courseid()));
// Allow each enrol plugin to add annotations.
foreach ($enrols as $enrol) {
... | [
"protected",
"function",
"define_execution",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"plugins",
"=",
"enrol_get_plugins",
"(",
"true",
")",
";",
"$",
"enrols",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"'enrol'",
",",
"array",
"(",
"'courseid'",
"=... | Function that will contain all the code to be executed. | [
"Function",
"that",
"will",
"contain",
"all",
"the",
"code",
"to",
"be",
"executed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/backup_stepslib.php#L2090-L2103 |
215,704 | moodle/moodle | backup/moodle2/backup_stepslib.php | backup_activity_grading_structure_step.execute_condition | protected function execute_condition() {
// No grades on the front page.
if ($this->get_courseid() == SITEID) {
return false;
}
return plugin_supports('mod', $this->get_task()->get_modulename(), FEATURE_ADVANCED_GRADING, false);
} | php | protected function execute_condition() {
// No grades on the front page.
if ($this->get_courseid() == SITEID) {
return false;
}
return plugin_supports('mod', $this->get_task()->get_modulename(), FEATURE_ADVANCED_GRADING, false);
} | [
"protected",
"function",
"execute_condition",
"(",
")",
"{",
"// No grades on the front page.",
"if",
"(",
"$",
"this",
"->",
"get_courseid",
"(",
")",
"==",
"SITEID",
")",
"{",
"return",
"false",
";",
"}",
"return",
"plugin_supports",
"(",
"'mod'",
",",
"$",
... | Include the grading.xml only if the module supports advanced grading | [
"Include",
"the",
"grading",
".",
"xml",
"only",
"if",
"the",
"module",
"supports",
"advanced",
"grading"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/backup_stepslib.php#L2374-L2382 |
215,705 | moodle/moodle | backup/moodle2/backup_stepslib.php | backup_activity_grading_structure_step.define_structure | protected function define_structure() {
// To know if we are including userinfo
$userinfo = $this->get_setting_value('userinfo');
// Define the elements
$areas = new backup_nested_element('areas');
$area = new backup_nested_element('area', array('id'), array(
'are... | php | protected function define_structure() {
// To know if we are including userinfo
$userinfo = $this->get_setting_value('userinfo');
// Define the elements
$areas = new backup_nested_element('areas');
$area = new backup_nested_element('area', array('id'), array(
'are... | [
"protected",
"function",
"define_structure",
"(",
")",
"{",
"// To know if we are including userinfo",
"$",
"userinfo",
"=",
"$",
"this",
"->",
"get_setting_value",
"(",
"'userinfo'",
")",
";",
"// Define the elements",
"$",
"areas",
"=",
"new",
"backup_nested_element",... | Declares the gradable areas structures and data sources | [
"Declares",
"the",
"gradable",
"areas",
"structures",
"and",
"data",
"sources"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/backup_stepslib.php#L2387-L2444 |
215,706 | moodle/moodle | lib/behat/form_field/behat_form_checkbox.php | behat_form_checkbox.set_value | public function set_value($value) {
if (!empty($value) && !$this->field->isChecked()) {
if (!$this->running_javascript()) {
$this->field->check();
return;
}
// Check it if it should be checked and it is not.
$this->field->click()... | php | public function set_value($value) {
if (!empty($value) && !$this->field->isChecked()) {
if (!$this->running_javascript()) {
$this->field->check();
return;
}
// Check it if it should be checked and it is not.
$this->field->click()... | [
"public",
"function",
"set_value",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"value",
")",
"&&",
"!",
"$",
"this",
"->",
"field",
"->",
"isChecked",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"running_javascript",
... | Sets the value of a checkbox.
Anything !empty() is considered checked.
@param string $value
@return void | [
"Sets",
"the",
"value",
"of",
"a",
"checkbox",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_checkbox.php#L48-L76 |
215,707 | moodle/moodle | lib/behat/form_field/behat_form_checkbox.php | behat_form_checkbox.matches | public function matches($expectedvalue = false) {
$ischecked = $this->field->isChecked();
// Any non-empty value provided means that it should be checked.
if (!empty($expectedvalue) && $ischecked) {
return true;
} else if (empty($expectedvalue) && !$ischecked) {
... | php | public function matches($expectedvalue = false) {
$ischecked = $this->field->isChecked();
// Any non-empty value provided means that it should be checked.
if (!empty($expectedvalue) && $ischecked) {
return true;
} else if (empty($expectedvalue) && !$ischecked) {
... | [
"public",
"function",
"matches",
"(",
"$",
"expectedvalue",
"=",
"false",
")",
"{",
"$",
"ischecked",
"=",
"$",
"this",
"->",
"field",
"->",
"isChecked",
"(",
")",
";",
"// Any non-empty value provided means that it should be checked.",
"if",
"(",
"!",
"empty",
... | Is it enabled?
@param string $expectedvalue Anything !empty() is considered checked.
@return bool | [
"Is",
"it",
"enabled?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_checkbox.php#L93-L105 |
215,708 | moodle/moodle | lib/behat/form_field/behat_form_checkbox.php | behat_form_checkbox.trigger_on_change | protected function trigger_on_change() {
$driver = $this->session->getDriver();
if ($driver instanceof \Moodle\BehatExtension\Driver\MoodleSelenium2Driver) {
$driver->triggerSynScript(
$this->field->getXPath(),
"Syn.trigger('change', {}, {{ELEMENT}})"
... | php | protected function trigger_on_change() {
$driver = $this->session->getDriver();
if ($driver instanceof \Moodle\BehatExtension\Driver\MoodleSelenium2Driver) {
$driver->triggerSynScript(
$this->field->getXPath(),
"Syn.trigger('change', {}, {{ELEMENT}})"
... | [
"protected",
"function",
"trigger_on_change",
"(",
")",
"{",
"$",
"driver",
"=",
"$",
"this",
"->",
"session",
"->",
"getDriver",
"(",
")",
";",
"if",
"(",
"$",
"driver",
"instanceof",
"\\",
"Moodle",
"\\",
"BehatExtension",
"\\",
"Driver",
"\\",
"MoodleSe... | Trigger on change event. | [
"Trigger",
"on",
"change",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_checkbox.php#L110-L118 |
215,709 | moodle/moodle | lib/classes/progress/display.php | display.start_html | public function start_html() {
if ($this->bar) {
throw new \coding_exception('Already started');
}
$this->bar = new \progress_bar();
$this->bar->create();
echo \html_writer::start_div('wibbler');
} | php | public function start_html() {
if ($this->bar) {
throw new \coding_exception('Already started');
}
$this->bar = new \progress_bar();
$this->bar->create();
echo \html_writer::start_div('wibbler');
} | [
"public",
"function",
"start_html",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"bar",
")",
"{",
"throw",
"new",
"\\",
"coding_exception",
"(",
"'Already started'",
")",
";",
"}",
"$",
"this",
"->",
"bar",
"=",
"new",
"\\",
"progress_bar",
"(",
")",
... | Starts to output progress.
Called in constructor and in update_progress if required.
@throws \coding_exception If already started | [
"Starts",
"to",
"output",
"progress",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/progress/display.php#L78-L85 |
215,710 | moodle/moodle | lib/classes/progress/display.php | display.update_progress | public function update_progress() {
// If finished...
if (!$this->is_in_progress_section()) {
if ($this->bar) {
$this->end_html();
}
} else {
if (!$this->bar) {
$this->start_html();
}
// In case of indete... | php | public function update_progress() {
// If finished...
if (!$this->is_in_progress_section()) {
if ($this->bar) {
$this->end_html();
}
} else {
if (!$this->bar) {
$this->start_html();
}
// In case of indete... | [
"public",
"function",
"update_progress",
"(",
")",
"{",
"// If finished...",
"if",
"(",
"!",
"$",
"this",
"->",
"is_in_progress_section",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"bar",
")",
"{",
"$",
"this",
"->",
"end_html",
"(",
")",
";",
... | When progress is updated, updates the bar.
@see \core\progress\base::update_progress() | [
"When",
"progress",
"is",
"updated",
"updates",
"the",
"bar",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/progress/display.php#L107-L155 |
215,711 | moodle/moodle | mod/assign/upgradelib.php | assign_upgrade_manager.duplicate_course_module | private function duplicate_course_module(stdClass $cm, $moduleid, $newinstanceid) {
global $DB, $CFG;
$newcm = new stdClass();
$newcm->course = $cm->course;
$newcm->module = $moduleid;
$newcm->instance = $newinstanceid;
$newcm->visible ... | php | private function duplicate_course_module(stdClass $cm, $moduleid, $newinstanceid) {
global $DB, $CFG;
$newcm = new stdClass();
$newcm->course = $cm->course;
$newcm->module = $moduleid;
$newcm->instance = $newinstanceid;
$newcm->visible ... | [
"private",
"function",
"duplicate_course_module",
"(",
"stdClass",
"$",
"cm",
",",
"$",
"moduleid",
",",
"$",
"newinstanceid",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"$",
"newcm",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"newcm",
"->",... | Create a duplicate course module record so we can create the upgraded
assign module alongside the old assignment module.
@param stdClass $cm The old course module record
@param int $moduleid The id of the new assign module
@param int $newinstanceid The id of the new instance of the assign module
@return mixed stdClass... | [
"Create",
"a",
"duplicate",
"course",
"module",
"record",
"so",
"we",
"can",
"create",
"the",
"upgraded",
"assign",
"module",
"alongside",
"the",
"old",
"assignment",
"module",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/upgradelib.php#L376-L415 |
215,712 | moodle/moodle | lib/google/src/Google/Service/Compute.php | Google_Service_Compute_Images_Resource.listImages | public function listImages($project, $optParams = array())
{
$params = array('project' => $project);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_Compute_ImageList");
} | php | public function listImages($project, $optParams = array())
{
$params = array('project' => $project);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_Compute_ImageList");
} | [
"public",
"function",
"listImages",
"(",
"$",
"project",
",",
"$",
"optParams",
"=",
"array",
"(",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'project'",
"=>",
"$",
"project",
")",
";",
"$",
"params",
"=",
"array_merge",
"(",
"$",
"params",
",... | Retrieves the list of private images available to the specified project.
Private images are images you create that belong to your project. This method
does not get any images that belong to other projects, including publicly-
available images, like Debian 7. If you want to get a list of publicly-
available images, use ... | [
"Retrieves",
"the",
"list",
"of",
"private",
"images",
"available",
"to",
"the",
"specified",
"project",
".",
"Private",
"images",
"are",
"images",
"you",
"create",
"that",
"belong",
"to",
"your",
"project",
".",
"This",
"method",
"does",
"not",
"get",
"any"... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Service/Compute.php#L5605-L5610 |
215,713 | moodle/moodle | question/type/randomsamatch/db/upgradelib.php | qtype_randomsamatch_qe2_attempt_updater.explode_answer | protected function explode_answer($answer) {
if (!$answer) {
return array();
}
$bits = explode(',', $answer);
$selections = array();
foreach ($bits as $bit) {
list($stem, $choice) = explode('-', $bit);
$selections[$stem] = $choice;
}
... | php | protected function explode_answer($answer) {
if (!$answer) {
return array();
}
$bits = explode(',', $answer);
$selections = array();
foreach ($bits as $bit) {
list($stem, $choice) = explode('-', $bit);
$selections[$stem] = $choice;
}
... | [
"protected",
"function",
"explode_answer",
"(",
"$",
"answer",
")",
"{",
"if",
"(",
"!",
"$",
"answer",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"bits",
"=",
"explode",
"(",
"','",
",",
"$",
"answer",
")",
";",
"$",
"selections",
"=",
... | Explode the answer saved as a string in state
@param string $answer comma separated list of dash separated pairs
@return array | [
"Explode",
"the",
"answer",
"saved",
"as",
"a",
"string",
"in",
"state"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/randomsamatch/db/upgradelib.php#L70-L81 |
215,714 | moodle/moodle | question/type/randomsamatch/db/upgradelib.php | qtype_randomsamatch_qe2_attempt_updater.lookup_choice | protected function lookup_choice($choice) {
if (array_key_exists($choice, $this->choices)) {
// Easy case: choice is a key in the choices array.
return $choice;
} else {
// But choice can also be the id of a shortanser correct answer
// without been a key ... | php | protected function lookup_choice($choice) {
if (array_key_exists($choice, $this->choices)) {
// Easy case: choice is a key in the choices array.
return $choice;
} else {
// But choice can also be the id of a shortanser correct answer
// without been a key ... | [
"protected",
"function",
"lookup_choice",
"(",
"$",
"choice",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"choice",
",",
"$",
"this",
"->",
"choices",
")",
")",
"{",
"// Easy case: choice is a key in the choices array.",
"return",
"$",
"choice",
";",
"}",... | Find the index corresponding to a choice
@param integer $choice
@return integer | [
"Find",
"the",
"index",
"corresponding",
"to",
"a",
"choice"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/randomsamatch/db/upgradelib.php#L97-L112 |
215,715 | moodle/moodle | auth/ldap/classes/admin_setting_special_ntlm_configtext.php | auth_ldap_admin_setting_special_ntlm_configtext.validate | public function validate($data) {
if (get_config('auth_ldap', 'ntlmsso_type') === 'ntlm') {
$format = trim($data);
if (!empty($format) && !preg_match('/%username%/i', $format)) {
return get_string('auth_ntlmsso_missing_username', 'auth_ldap');
}
}
... | php | public function validate($data) {
if (get_config('auth_ldap', 'ntlmsso_type') === 'ntlm') {
$format = trim($data);
if (!empty($format) && !preg_match('/%username%/i', $format)) {
return get_string('auth_ntlmsso_missing_username', 'auth_ldap');
}
}
... | [
"public",
"function",
"validate",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"get_config",
"(",
"'auth_ldap'",
",",
"'ntlmsso_type'",
")",
"===",
"'ntlm'",
")",
"{",
"$",
"format",
"=",
"trim",
"(",
"$",
"data",
")",
";",
"if",
"(",
"!",
"empty",
"(",
... | We need to validate the username format when using NTLM.
@param string $data Form data.
@return string Empty when no errors. | [
"We",
"need",
"to",
"validate",
"the",
"username",
"format",
"when",
"using",
"NTLM",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/ldap/classes/admin_setting_special_ntlm_configtext.php#L42-L52 |
215,716 | moodle/moodle | lib/classes/update/api.php | api.find_plugin | public function find_plugin($component, $reqversion=ANY_VERSION, $branch=null) {
global $CFG;
$params = array(
'plugin' => $component,
'format' => 'json',
);
if ($reqversion === ANY_VERSION) {
$params['minversion'] = 0;
} else {
$... | php | public function find_plugin($component, $reqversion=ANY_VERSION, $branch=null) {
global $CFG;
$params = array(
'plugin' => $component,
'format' => 'json',
);
if ($reqversion === ANY_VERSION) {
$params['minversion'] = 0;
} else {
$... | [
"public",
"function",
"find_plugin",
"(",
"$",
"component",
",",
"$",
"reqversion",
"=",
"ANY_VERSION",
",",
"$",
"branch",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"params",
"=",
"array",
"(",
"'plugin'",
"=>",
"$",
"component",
",",
"'f... | Locate the given plugin in the plugin directory.
Uses pluginfo.php end-point to find a plugin with the given component
name, that suits best for the given Moodle core branch. Minimal required
plugin version can be specified. This is typically used for resolving
dependencies.
False is returned on error, or if there is... | [
"Locate",
"the",
"given",
"plugin",
"in",
"the",
"plugin",
"directory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/api.php#L128-L149 |
215,717 | moodle/moodle | lib/classes/update/api.php | api.validate_pluginfo_format | public function validate_pluginfo_format($data) {
if (empty($data) or !is_object($data)) {
return false;
}
$output = new remote_info();
$rootproperties = array('id' => 1, 'name' => 1, 'component' => 1, 'source' => 0, 'doc' => 0,
'bugs' => 0, 'discussion' => 0, ... | php | public function validate_pluginfo_format($data) {
if (empty($data) or !is_object($data)) {
return false;
}
$output = new remote_info();
$rootproperties = array('id' => 1, 'name' => 1, 'component' => 1, 'source' => 0, 'doc' => 0,
'bugs' => 0, 'discussion' => 0, ... | [
"public",
"function",
"validate_pluginfo_format",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
"or",
"!",
"is_object",
"(",
"$",
"data",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"output",
"=",
"new",
"remote_info",
"... | Makes sure the given data format match the expected output of the pluginfo service.
Object validated by this method is guaranteed to contain all the data
provided by the pluginfo.php version this client works with (self::APIVER).
@param stdClass $data
@return \core\update\remote_info|bool false if data are not valid,... | [
"Makes",
"sure",
"the",
"given",
"data",
"format",
"match",
"the",
"expected",
"output",
"of",
"the",
"pluginfo",
"service",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/api.php#L160-L215 |
215,718 | moodle/moodle | lib/classes/update/api.php | api.call_pluginfo_service | protected function call_pluginfo_service(array $params) {
$serviceurl = $this->get_serviceurl_pluginfo();
$response = $this->call_service($serviceurl, $params);
if ($response) {
if ($response->info['http_code'] == 404) {
// There is no such plugin found in the plugi... | php | protected function call_pluginfo_service(array $params) {
$serviceurl = $this->get_serviceurl_pluginfo();
$response = $this->call_service($serviceurl, $params);
if ($response) {
if ($response->info['http_code'] == 404) {
// There is no such plugin found in the plugi... | [
"protected",
"function",
"call_pluginfo_service",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"serviceurl",
"=",
"$",
"this",
"->",
"get_serviceurl_pluginfo",
"(",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"call_service",
"(",
"$",
"serviceurl",
","... | Calls the pluginfo.php end-point with given parameters.
@param array $params
@return \core\update\remote_info|bool | [
"Calls",
"the",
"pluginfo",
".",
"php",
"end",
"-",
"point",
"with",
"given",
"parameters",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/api.php#L223-L245 |
215,719 | moodle/moodle | lib/classes/update/api.php | api.call_service | protected function call_service($serviceurl, array $params=array()) {
$response = (object)array(
'data' => null,
'info' => null,
'status' => null,
);
$curl = new curl();
$response->data = json_decode($curl->get($serviceurl, $params, array(
... | php | protected function call_service($serviceurl, array $params=array()) {
$response = (object)array(
'data' => null,
'info' => null,
'status' => null,
);
$curl = new curl();
$response->data = json_decode($curl->get($serviceurl, $params, array(
... | [
"protected",
"function",
"call_service",
"(",
"$",
"serviceurl",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"response",
"=",
"(",
"object",
")",
"array",
"(",
"'data'",
"=>",
"null",
",",
"'info'",
"=>",
"null",
",",
"'status'"... | Calls the given end-point service with the given parameters.
Returns false on cURL error and/or SSL verification failure. Otherwise
an object with the response, cURL info and HTTP status message is
returned.
@param string $serviceurl
@param array $params
@return stdClass|bool | [
"Calls",
"the",
"given",
"end",
"-",
"point",
"service",
"with",
"the",
"given",
"parameters",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/api.php#L258-L291 |
215,720 | moodle/moodle | lib/classes/update/api.php | api.convert_branch_numbering_format | protected function convert_branch_numbering_format($branch) {
$branch = (string)$branch;
if (strpos($branch, '.') === false) {
$branch = substr($branch, 0, -1).'.'.substr($branch, -1);
}
return $branch;
} | php | protected function convert_branch_numbering_format($branch) {
$branch = (string)$branch;
if (strpos($branch, '.') === false) {
$branch = substr($branch, 0, -1).'.'.substr($branch, -1);
}
return $branch;
} | [
"protected",
"function",
"convert_branch_numbering_format",
"(",
"$",
"branch",
")",
"{",
"$",
"branch",
"=",
"(",
"string",
")",
"$",
"branch",
";",
"if",
"(",
"strpos",
"(",
"$",
"branch",
",",
"'.'",
")",
"===",
"false",
")",
"{",
"$",
"branch",
"="... | Converts the given branch from XY format to the X.Y format
The syntax of $CFG->branch uses the XY format that suits the Moodle docs
versioning and stable branches numbering scheme. The API at
download.moodle.org uses the X.Y numbering scheme.
@param int $branch moodle branch in the XY format (e.g. 29, 30, 31 etc)
@re... | [
"Converts",
"the",
"given",
"branch",
"from",
"XY",
"format",
"to",
"the",
"X",
".",
"Y",
"format"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/api.php#L303-L312 |
215,721 | moodle/moodle | lib/classes/update/api.php | api.get_serviceurl_pluginfo | protected function get_serviceurl_pluginfo() {
global $CFG;
if (!empty($CFG->config_php_settings['alternativepluginfoserviceurl'])) {
return $CFG->config_php_settings['alternativepluginfoserviceurl'];
} else {
return self::APIROOT.'/'.self::APIVER.'/pluginfo.php';
... | php | protected function get_serviceurl_pluginfo() {
global $CFG;
if (!empty($CFG->config_php_settings['alternativepluginfoserviceurl'])) {
return $CFG->config_php_settings['alternativepluginfoserviceurl'];
} else {
return self::APIROOT.'/'.self::APIVER.'/pluginfo.php';
... | [
"protected",
"function",
"get_serviceurl_pluginfo",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"config_php_settings",
"[",
"'alternativepluginfoserviceurl'",
"]",
")",
")",
"{",
"return",
"$",
"CFG",
"->",
"conf... | Returns URL of the pluginfo.php API end-point.
@return string | [
"Returns",
"URL",
"of",
"the",
"pluginfo",
".",
"php",
"API",
"end",
"-",
"point",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/api.php#L319-L327 |
215,722 | moodle/moodle | mod/book/tool/print/classes/output/renderer.php | renderer.render_print_book_page | public function render_print_book_page(print_book_page $page) {
$data = $page->export_for_template($this);
return parent::render_from_template('booktool_print/print_book', $data);
} | php | public function render_print_book_page(print_book_page $page) {
$data = $page->export_for_template($this);
return parent::render_from_template('booktool_print/print_book', $data);
} | [
"public",
"function",
"render_print_book_page",
"(",
"print_book_page",
"$",
"page",
")",
"{",
"$",
"data",
"=",
"$",
"page",
"->",
"export_for_template",
"(",
"$",
"this",
")",
";",
"return",
"parent",
"::",
"render_from_template",
"(",
"'booktool_print/print_boo... | Render the print book page.
@param print_book_page $page
@return string html for the page
@throws moodle_exception | [
"Render",
"the",
"print",
"book",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/book/tool/print/classes/output/renderer.php#L50-L53 |
215,723 | moodle/moodle | mod/book/tool/print/classes/output/renderer.php | renderer.render_print_book_chapter_page | public function render_print_book_chapter_page(print_book_chapter_page $page) {
$data = $page->export_for_template($this);
return parent::render_from_template('booktool_print/print_book_chapter', $data);
} | php | public function render_print_book_chapter_page(print_book_chapter_page $page) {
$data = $page->export_for_template($this);
return parent::render_from_template('booktool_print/print_book_chapter', $data);
} | [
"public",
"function",
"render_print_book_chapter_page",
"(",
"print_book_chapter_page",
"$",
"page",
")",
"{",
"$",
"data",
"=",
"$",
"page",
"->",
"export_for_template",
"(",
"$",
"this",
")",
";",
"return",
"parent",
"::",
"render_from_template",
"(",
"'booktool... | Render the print book chapter page.
@param print_book_chapter_page $page
@return string html for the page
@throws moodle_exception | [
"Render",
"the",
"print",
"book",
"chapter",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/book/tool/print/classes/output/renderer.php#L62-L65 |
215,724 | moodle/moodle | mod/book/tool/print/classes/output/renderer.php | renderer.render_print_book_chapter_dialog_link | public function render_print_book_chapter_dialog_link() {
$printtext = get_string('printchapter', 'booktool_print');
$printicon = $this->output->pix_icon('chapter', $printtext, 'booktool_print',
array('class' => 'icon'));
$printlinkatt = array('onclick' => 'window.print();return ... | php | public function render_print_book_chapter_dialog_link() {
$printtext = get_string('printchapter', 'booktool_print');
$printicon = $this->output->pix_icon('chapter', $printtext, 'booktool_print',
array('class' => 'icon'));
$printlinkatt = array('onclick' => 'window.print();return ... | [
"public",
"function",
"render_print_book_chapter_dialog_link",
"(",
")",
"{",
"$",
"printtext",
"=",
"get_string",
"(",
"'printchapter'",
",",
"'booktool_print'",
")",
";",
"$",
"printicon",
"=",
"$",
"this",
"->",
"output",
"->",
"pix_icon",
"(",
"'chapter'",
"... | Render the print book chapter link.
@return string html for the link | [
"Render",
"the",
"print",
"book",
"chapter",
"link",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/book/tool/print/classes/output/renderer.php#L72-L78 |
215,725 | moodle/moodle | mod/book/tool/print/classes/output/renderer.php | renderer.render_print_book_toc | public function render_print_book_toc($chapters, $book, $cm) {
$first = true;
$context = context_module::instance($cm->id);
$toc = ''; // Representation of toc (HTML).
switch ($book->numbering) {
case BOOK_NUM_NONE:
$toc .= html_writer::start_tag('div', ar... | php | public function render_print_book_toc($chapters, $book, $cm) {
$first = true;
$context = context_module::instance($cm->id);
$toc = ''; // Representation of toc (HTML).
switch ($book->numbering) {
case BOOK_NUM_NONE:
$toc .= html_writer::start_tag('div', ar... | [
"public",
"function",
"render_print_book_toc",
"(",
"$",
"chapters",
",",
"$",
"book",
",",
"$",
"cm",
")",
"{",
"$",
"first",
"=",
"true",
";",
"$",
"context",
"=",
"context_module",
"::",
"instance",
"(",
"$",
"cm",
"->",
"id",
")",
";",
"$",
"toc"... | Render the print book table of contents.
@param array $chapters Array of book chapters
@param object $book The book object
@param object $cm The curse module object
@return string html for the TOC | [
"Render",
"the",
"print",
"book",
"table",
"of",
"contents",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/book/tool/print/classes/output/renderer.php#L101-L174 |
215,726 | moodle/moodle | mod/book/tool/print/classes/output/renderer.php | renderer.render_print_book_chapter | public function render_print_book_chapter($chapter, $chapters, $book, $cm) {
global $OUTPUT;
$context = context_module::instance($cm->id);
$title = book_get_chapter_title($chapter->id, $chapters, $book, $context);
$chaptervisible = $chapter->hidden ? false : true;
$bookchapter... | php | public function render_print_book_chapter($chapter, $chapters, $book, $cm) {
global $OUTPUT;
$context = context_module::instance($cm->id);
$title = book_get_chapter_title($chapter->id, $chapters, $book, $context);
$chaptervisible = $chapter->hidden ? false : true;
$bookchapter... | [
"public",
"function",
"render_print_book_chapter",
"(",
"$",
"chapter",
",",
"$",
"chapters",
",",
"$",
"book",
",",
"$",
"cm",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"context",
"=",
"context_module",
"::",
"instance",
"(",
"$",
"cm",
"->",
"id",
... | Render the print book chapter.
@param object $chapter The book chapter object
@param array $chapters The array of book chapters
@param object $book The book object
@param object $cm The course module object
@return array The array containing the content of the book chapter and visibility information | [
"Render",
"the",
"print",
"book",
"chapter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/book/tool/print/classes/output/renderer.php#L185-L209 |
215,727 | moodle/moodle | badges/classes/external.php | core_badges_external.get_user_badges_parameters | public static function get_user_badges_parameters() {
return new external_function_parameters (
array(
'userid' => new external_value(PARAM_INT, 'Badges only for this user id, empty for current user', VALUE_DEFAULT, 0),
'courseid' => new external_value(PARAM_INT, 'Fil... | php | public static function get_user_badges_parameters() {
return new external_function_parameters (
array(
'userid' => new external_value(PARAM_INT, 'Badges only for this user id, empty for current user', VALUE_DEFAULT, 0),
'courseid' => new external_value(PARAM_INT, 'Fil... | [
"public",
"static",
"function",
"get_user_badges_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'userid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'Badges only for this user id, empty for current user'",
",",
... | Describes the parameters for get_user_badges.
@return external_function_parameters
@since Moodle 3.1 | [
"Describes",
"the",
"parameters",
"for",
"get_user_badges",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/external.php#L51-L62 |
215,728 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Cache/Backend/Cache.php | Horde_Imap_Client_Cache_Backend_Cache._getCid | protected function _getCid($mailbox, $slice)
{
return implode('|', array(
'horde_imap_client',
$this->_params['username'],
$mailbox,
$this->_params['hostspec'],
$this->_params['port'],
$slice,
self::VERSION
));
} | php | protected function _getCid($mailbox, $slice)
{
return implode('|', array(
'horde_imap_client',
$this->_params['username'],
$mailbox,
$this->_params['hostspec'],
$this->_params['port'],
$slice,
self::VERSION
));
} | [
"protected",
"function",
"_getCid",
"(",
"$",
"mailbox",
",",
"$",
"slice",
")",
"{",
"return",
"implode",
"(",
"'|'",
",",
"array",
"(",
"'horde_imap_client'",
",",
"$",
"this",
"->",
"_params",
"[",
"'username'",
"]",
",",
"$",
"mailbox",
",",
"$",
"... | Create the unique ID used to store the data in the cache.
@param string $mailbox The mailbox to cache.
@param string $slice The cache slice.
@return string The cache ID. | [
"Create",
"the",
"unique",
"ID",
"used",
"to",
"store",
"the",
"data",
"in",
"the",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Cache/Backend/Cache.php#L337-L348 |
215,729 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Cache/Backend/Cache.php | Horde_Imap_Client_Cache_Backend_Cache._loadSlice | protected function _loadSlice($mailbox, $slice)
{
$cache_id = $this->_getCid($mailbox, $slice);
if (!empty($this->_loaded[$cache_id])) {
return;
}
if (($data = $this->_cache->get($cache_id, 0)) !== false) {
try {
$data = @unserialize($data);
... | php | protected function _loadSlice($mailbox, $slice)
{
$cache_id = $this->_getCid($mailbox, $slice);
if (!empty($this->_loaded[$cache_id])) {
return;
}
if (($data = $this->_cache->get($cache_id, 0)) !== false) {
try {
$data = @unserialize($data);
... | [
"protected",
"function",
"_loadSlice",
"(",
"$",
"mailbox",
",",
"$",
"slice",
")",
"{",
"$",
"cache_id",
"=",
"$",
"this",
"->",
"_getCid",
"(",
"$",
"mailbox",
",",
"$",
"slice",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_loaded... | Load UIDs from a cache slice.
@param string $mailbox The mailbox to load.
@param integer $slice The slice to load. | [
"Load",
"UIDs",
"from",
"a",
"cache",
"slice",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Cache/Backend/Cache.php#L398-L427 |
215,730 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Cache/Backend/Cache.php | Horde_Imap_Client_Cache_Backend_Cache._loadSliceMap | protected function _loadSliceMap($mailbox, $uidvalid = null)
{
if (!isset($this->_slicemap[$mailbox]) &&
(($data = $this->_cache->get($this->_getCid($mailbox, 'slicemap'), 0)) !== false)) {
try {
if (($slice = @unserialize($data)) &&
is_array($slic... | php | protected function _loadSliceMap($mailbox, $uidvalid = null)
{
if (!isset($this->_slicemap[$mailbox]) &&
(($data = $this->_cache->get($this->_getCid($mailbox, 'slicemap'), 0)) !== false)) {
try {
if (($slice = @unserialize($data)) &&
is_array($slic... | [
"protected",
"function",
"_loadSliceMap",
"(",
"$",
"mailbox",
",",
"$",
"uidvalid",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_slicemap",
"[",
"$",
"mailbox",
"]",
")",
"&&",
"(",
"(",
"$",
"data",
"=",
"$",
"this",
... | Load the slicemap for a given mailbox. The slicemap contains
the uidvalidity information, the UIDs->slice lookup table, and any
metadata that needs to be saved for the mailbox.
@param string $mailbox The mailbox.
@param integer $uidvalid The IMAP uidvalidity value of the mailbox. | [
"Load",
"the",
"slicemap",
"for",
"a",
"given",
"mailbox",
".",
"The",
"slicemap",
"contains",
"the",
"uidvalidity",
"information",
"the",
"UIDs",
"-",
">",
"slice",
"lookup",
"table",
"and",
"any",
"metadata",
"that",
"needs",
"to",
"be",
"saved",
"for",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Cache/Backend/Cache.php#L437-L473 |
215,731 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Cache/Backend/Cache.php | Horde_Imap_Client_Cache_Backend_Cache._toUpdate | protected function _toUpdate($mailbox, $type, $data)
{
if (!isset($this->_update[$mailbox])) {
$this->_update[$mailbox] = array(
'add' => array(),
'slice' => array()
);
}
$this->_update[$mailbox][$type] = ($type == 'slicemap')
... | php | protected function _toUpdate($mailbox, $type, $data)
{
if (!isset($this->_update[$mailbox])) {
$this->_update[$mailbox] = array(
'add' => array(),
'slice' => array()
);
}
$this->_update[$mailbox][$type] = ($type == 'slicemap')
... | [
"protected",
"function",
"_toUpdate",
"(",
"$",
"mailbox",
",",
"$",
"type",
",",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_update",
"[",
"$",
"mailbox",
"]",
")",
")",
"{",
"$",
"this",
"->",
"_update",
"[",
"$",
... | Add update entry for a mailbox.
@param string $mailbox The mailbox.
@param string $type 'add', 'slice', or 'slicemap'.
@param mixed $data The data to update. | [
"Add",
"update",
"entry",
"for",
"a",
"mailbox",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Cache/Backend/Cache.php#L482-L494 |
215,732 | moodle/moodle | lib/xmldb/xmldb_index.php | xmldb_index.set_attributes | public function set_attributes($type, $fields, $hints = array()) {
$this->unique = !empty($type) ? true : false;
$this->fields = $fields;
$this->hints = $hints;
} | php | public function set_attributes($type, $fields, $hints = array()) {
$this->unique = !empty($type) ? true : false;
$this->fields = $fields;
$this->hints = $hints;
} | [
"public",
"function",
"set_attributes",
"(",
"$",
"type",
",",
"$",
"fields",
",",
"$",
"hints",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"unique",
"=",
"!",
"empty",
"(",
"$",
"type",
")",
"?",
"true",
":",
"false",
";",
"$",
"this",... | Set all the attributes of one xmldb_index
@param string type XMLDB_INDEX_UNIQUE, XMLDB_INDEX_NOTUNIQUE
@param array fields an array of fieldnames to build the index over
@param array $hints array of optional hints | [
"Set",
"all",
"the",
"attributes",
"of",
"one",
"xmldb_index"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmldb/xmldb_index.php#L79-L83 |
215,733 | moodle/moodle | lib/xmldb/xmldb_index.php | xmldb_index.calculateHash | public function calculateHash($recursive = false) {
if (!$this->loaded) {
$this->hash = null;
} else {
$key = $this->unique . implode (', ', $this->fields) . implode (', ', $this->hints);
$this->hash = md5($key);
}
} | php | public function calculateHash($recursive = false) {
if (!$this->loaded) {
$this->hash = null;
} else {
$key = $this->unique . implode (', ', $this->fields) . implode (', ', $this->hints);
$this->hash = md5($key);
}
} | [
"public",
"function",
"calculateHash",
"(",
"$",
"recursive",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"loaded",
")",
"{",
"$",
"this",
"->",
"hash",
"=",
"null",
";",
"}",
"else",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"uniqu... | This function calculate and set the hash of one xmldb_index
@retur nvoid, changes $this->hash | [
"This",
"function",
"calculate",
"and",
"set",
"the",
"hash",
"of",
"one",
"xmldb_index"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmldb/xmldb_index.php#L224-L231 |
215,734 | moodle/moodle | lib/xmldb/xmldb_index.php | xmldb_index.xmlOutput | public function xmlOutput() {
$o = '';
$o.= ' <INDEX NAME="' . $this->name . '"';
if ($this->unique) {
$unique = 'true';
} else {
$unique = 'false';
}
$o.= ' UNIQUE="' . $unique . '"';
$o.= ' FIELDS="' . implode(', ', $this->fields) ... | php | public function xmlOutput() {
$o = '';
$o.= ' <INDEX NAME="' . $this->name . '"';
if ($this->unique) {
$unique = 'true';
} else {
$unique = 'false';
}
$o.= ' UNIQUE="' . $unique . '"';
$o.= ' FIELDS="' . implode(', ', $this->fields) ... | [
"public",
"function",
"xmlOutput",
"(",
")",
"{",
"$",
"o",
"=",
"''",
";",
"$",
"o",
".=",
"' <INDEX NAME=\"'",
".",
"$",
"this",
"->",
"name",
".",
"'\"'",
";",
"if",
"(",
"$",
"this",
"->",
"unique",
")",
"{",
"$",
"unique",
"=",
"'true'"... | This function will output the XML text for one index
@return string | [
"This",
"function",
"will",
"output",
"the",
"XML",
"text",
"for",
"one",
"index"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmldb/xmldb_index.php#L237-L256 |
215,735 | moodle/moodle | lib/xmldb/xmldb_index.php | xmldb_index.setFromADOIndex | public function setFromADOIndex($adoindex) {
// Set the unique field
$this->unique = false;
// Set the fields, converting all them to lowercase
$fields = array_flip(array_change_key_case(array_flip($adoindex['columns'])));
$this->fields = $fields;
// Some more fields
... | php | public function setFromADOIndex($adoindex) {
// Set the unique field
$this->unique = false;
// Set the fields, converting all them to lowercase
$fields = array_flip(array_change_key_case(array_flip($adoindex['columns'])));
$this->fields = $fields;
// Some more fields
... | [
"public",
"function",
"setFromADOIndex",
"(",
"$",
"adoindex",
")",
"{",
"// Set the unique field",
"$",
"this",
"->",
"unique",
"=",
"false",
";",
"// Set the fields, converting all them to lowercase",
"$",
"fields",
"=",
"array_flip",
"(",
"array_change_key_case",
"("... | This function will set all the attributes of the xmldb_index object
based on information passed in one ADOindex
@param array
@return void | [
"This",
"function",
"will",
"set",
"all",
"the",
"attributes",
"of",
"the",
"xmldb_index",
"object",
"based",
"on",
"information",
"passed",
"in",
"one",
"ADOindex"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmldb/xmldb_index.php#L264-L274 |
215,736 | moodle/moodle | lib/xmldb/xmldb_index.php | xmldb_index.getPHP | public function getPHP() {
$result = '';
// The type
$unique = $this->getUnique();
if (!empty($unique)) {
$result .= 'XMLDB_INDEX_UNIQUE, ';
} else {
$result .= 'XMLDB_INDEX_NOTUNIQUE, ';
}
// The fields
$indexfields = $this->getF... | php | public function getPHP() {
$result = '';
// The type
$unique = $this->getUnique();
if (!empty($unique)) {
$result .= 'XMLDB_INDEX_UNIQUE, ';
} else {
$result .= 'XMLDB_INDEX_NOTUNIQUE, ';
}
// The fields
$indexfields = $this->getF... | [
"public",
"function",
"getPHP",
"(",
")",
"{",
"$",
"result",
"=",
"''",
";",
"// The type",
"$",
"unique",
"=",
"$",
"this",
"->",
"getUnique",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"unique",
")",
")",
"{",
"$",
"result",
".=",
"'XML... | Returns the PHP code needed to define one xmldb_index
@return string | [
"Returns",
"the",
"PHP",
"code",
"needed",
"to",
"define",
"one",
"xmldb_index"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmldb/xmldb_index.php#L280-L306 |
215,737 | moodle/moodle | lib/xmldb/xmldb_index.php | xmldb_index.validateDefinition | public function validateDefinition(xmldb_table $xmldb_table=null) {
if (!$xmldb_table) {
return 'Invalid xmldb_index->validateDefinition() call, $xmldb_table is required.';
}
$total = 0;
foreach ($this->getFields() as $fieldname) {
if (!$field = $xmldb_table->get... | php | public function validateDefinition(xmldb_table $xmldb_table=null) {
if (!$xmldb_table) {
return 'Invalid xmldb_index->validateDefinition() call, $xmldb_table is required.';
}
$total = 0;
foreach ($this->getFields() as $fieldname) {
if (!$field = $xmldb_table->get... | [
"public",
"function",
"validateDefinition",
"(",
"xmldb_table",
"$",
"xmldb_table",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"xmldb_table",
")",
"{",
"return",
"'Invalid xmldb_index->validateDefinition() call, $xmldb_table is required.'",
";",
"}",
"$",
"total",
"=... | Validates the index restrictions.
The error message should not be localised because it is intended for developers,
end users and admins should never see these problems!
@param xmldb_table $xmldb_table optional when object is table
@return string null if ok, error message if problem found | [
"Validates",
"the",
"index",
"restrictions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmldb/xmldb_index.php#L339-L396 |
215,738 | moodle/moodle | lib/adminlib.php | admin_category.set_sorting | public function set_sorting($sort, $asc = true, $split = true) {
$this->sort = (bool)$sort;
$this->sortasc = (bool)$asc;
$this->sortsplit = (bool)$split;
} | php | public function set_sorting($sort, $asc = true, $split = true) {
$this->sort = (bool)$sort;
$this->sortasc = (bool)$asc;
$this->sortsplit = (bool)$split;
} | [
"public",
"function",
"set_sorting",
"(",
"$",
"sort",
",",
"$",
"asc",
"=",
"true",
",",
"$",
"split",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"sort",
"=",
"(",
"bool",
")",
"$",
"sort",
";",
"$",
"this",
"->",
"sortasc",
"=",
"(",
"bool",
"... | Sets sorting on this category.
Please note this function doesn't actually do the sorting.
It can be called anytime.
Sorting occurs when the user calls get_children.
Code using the children array directly won't see the sorted results.
@param bool $sort If set to true children will be sorted, if false they won't be.
@p... | [
"Sets",
"sorting",
"on",
"this",
"category",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1026-L1030 |
215,739 | moodle/moodle | lib/adminlib.php | admin_category.get_children | public function get_children() {
// If we should sort and it hasn't already been sorted.
if ($this->sort && !$this->sorted) {
if ($this->sortsplit) {
$categories = array();
$pages = array();
foreach ($this->children as $child) {
... | php | public function get_children() {
// If we should sort and it hasn't already been sorted.
if ($this->sort && !$this->sorted) {
if ($this->sortsplit) {
$categories = array();
$pages = array();
foreach ($this->children as $child) {
... | [
"public",
"function",
"get_children",
"(",
")",
"{",
"// If we should sort and it hasn't already been sorted.",
"if",
"(",
"$",
"this",
"->",
"sort",
"&&",
"!",
"$",
"this",
"->",
"sorted",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"sortsplit",
")",
"{",
"$",
... | Returns the children associated with this category.
@return part_of_admin_tree[] | [
"Returns",
"the",
"children",
"associated",
"with",
"this",
"category",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1037-L1066 |
215,740 | moodle/moodle | lib/adminlib.php | admin_root.purge_children | public function purge_children($requirefulltree) {
$this->children = array();
$this->fulltree = ($requirefulltree || $this->fulltree);
$this->loaded = false;
//break circular dependencies - this helps PHP 5.2
while($this->category_cache) {
array_pop($this->category_... | php | public function purge_children($requirefulltree) {
$this->children = array();
$this->fulltree = ($requirefulltree || $this->fulltree);
$this->loaded = false;
//break circular dependencies - this helps PHP 5.2
while($this->category_cache) {
array_pop($this->category_... | [
"public",
"function",
"purge_children",
"(",
"$",
"requirefulltree",
")",
"{",
"$",
"this",
"->",
"children",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"fulltree",
"=",
"(",
"$",
"requirefulltree",
"||",
"$",
"this",
"->",
"fulltree",
")",
";",
"... | Empties children array, and sets loaded to false
@param bool $requirefulltree | [
"Empties",
"children",
"array",
"and",
"sets",
"loaded",
"to",
"false"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1163-L1172 |
215,741 | moodle/moodle | lib/adminlib.php | admin_settingdependency.parse_name | private function parse_name($name) {
$bits = explode('/', $name);
$name = array_pop($bits);
$plugin = '';
if ($bits) {
$plugin = array_pop($bits);
if ($plugin === 'moodle') {
$plugin = '';
}
}
return 's_'.$plugin.'_'.$na... | php | private function parse_name($name) {
$bits = explode('/', $name);
$name = array_pop($bits);
$plugin = '';
if ($bits) {
$plugin = array_pop($bits);
if ($plugin === 'moodle') {
$plugin = '';
}
}
return 's_'.$plugin.'_'.$na... | [
"private",
"function",
"parse_name",
"(",
"$",
"name",
")",
"{",
"$",
"bits",
"=",
"explode",
"(",
"'/'",
",",
"$",
"name",
")",
";",
"$",
"name",
"=",
"array_pop",
"(",
"$",
"bits",
")",
";",
"$",
"plugin",
"=",
"''",
";",
"if",
"(",
"$",
"bit... | Convert the setting name into the form field name.
@param string $name
@return string | [
"Convert",
"the",
"setting",
"name",
"into",
"the",
"form",
"field",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1363-L1374 |
215,742 | moodle/moodle | lib/adminlib.php | admin_settingdependency.prepare_for_javascript | public static function prepare_for_javascript($dependencies) {
$result = [];
foreach ($dependencies as $d) {
if (!isset($result[$d->dependenton])) {
$result[$d->dependenton] = [];
}
if (!isset($result[$d->dependenton][$d->condition])) {
... | php | public static function prepare_for_javascript($dependencies) {
$result = [];
foreach ($dependencies as $d) {
if (!isset($result[$d->dependenton])) {
$result[$d->dependenton] = [];
}
if (!isset($result[$d->dependenton][$d->condition])) {
... | [
"public",
"static",
"function",
"prepare_for_javascript",
"(",
"$",
"dependencies",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"dependencies",
"as",
"$",
"d",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"result",
"[",
"$",
"d"... | Gather together all the dependencies in a format suitable for initialising javascript
@param admin_settingdependency[] $dependencies
@return array | [
"Gather",
"together",
"all",
"the",
"dependencies",
"in",
"a",
"format",
"suitable",
"for",
"initialising",
"javascript"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1381-L1396 |
215,743 | moodle/moodle | lib/adminlib.php | admin_settingpage.search | public function search($query) {
$found = array();
foreach ($this->settings as $setting) {
if ($setting->is_related($query)) {
$found[] = $setting;
}
}
if ($found) {
$result = new stdClass();
$result->page = $this;
... | php | public function search($query) {
$found = array();
foreach ($this->settings as $setting) {
if ($setting->is_related($query)) {
$found[] = $setting;
}
}
if ($found) {
$result = new stdClass();
$result->page = $this;
... | [
"public",
"function",
"search",
"(",
"$",
"query",
")",
"{",
"$",
"found",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"settings",
"as",
"$",
"setting",
")",
"{",
"if",
"(",
"$",
"setting",
"->",
"is_related",
"(",
"$",
"query",... | Search string in settings page.
@param string $query
@return array | [
"Search",
"string",
"in",
"settings",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1482-L1512 |
215,744 | moodle/moodle | lib/adminlib.php | admin_settingpage.add | public function add($setting) {
if (!($setting instanceof admin_setting)) {
debugging('error - not a setting instance');
return false;
}
$name = $setting->name;
if ($setting->plugin) {
$name = $setting->plugin . $name;
}
$this->setting... | php | public function add($setting) {
if (!($setting instanceof admin_setting)) {
debugging('error - not a setting instance');
return false;
}
$name = $setting->name;
if ($setting->plugin) {
$name = $setting->plugin . $name;
}
$this->setting... | [
"public",
"function",
"add",
"(",
"$",
"setting",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"setting",
"instanceof",
"admin_setting",
")",
")",
"{",
"debugging",
"(",
"'error - not a setting instance'",
")",
";",
"return",
"false",
";",
"}",
"$",
"name",
"=",
... | adds an admin_setting to this admin_settingpage
not the same as add for admin_category. adds an admin_setting to this admin_settingpage. settings appear (on the settingpage) in the order in which they're added
n.b. each admin_setting in an admin_settingpage must have a unique internal name
@param object $setting is t... | [
"adds",
"an",
"admin_setting",
"to",
"this",
"admin_settingpage"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1533-L1545 |
215,745 | moodle/moodle | lib/adminlib.php | admin_settingpage.hide_if | public function hide_if($settingname, $dependenton, $condition = 'notchecked', $value = '1') {
$this->dependencies[] = new admin_settingdependency($settingname, $dependenton, $condition, $value);
// Reformat the dependency name to the plugin | name format used in the display.
$dependenton = str... | php | public function hide_if($settingname, $dependenton, $condition = 'notchecked', $value = '1') {
$this->dependencies[] = new admin_settingdependency($settingname, $dependenton, $condition, $value);
// Reformat the dependency name to the plugin | name format used in the display.
$dependenton = str... | [
"public",
"function",
"hide_if",
"(",
"$",
"settingname",
",",
"$",
"dependenton",
",",
"$",
"condition",
"=",
"'notchecked'",
",",
"$",
"value",
"=",
"'1'",
")",
"{",
"$",
"this",
"->",
"dependencies",
"[",
"]",
"=",
"new",
"admin_settingdependency",
"(",... | Hide the named setting if the specified condition is matched.
@param string $settingname
@param string $dependenton
@param string $condition
@param string $value | [
"Hide",
"the",
"named",
"setting",
"if",
"the",
"specified",
"condition",
"is",
"matched",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1555-L1568 |
215,746 | moodle/moodle | lib/adminlib.php | admin_settingpage.show_save | public function show_save() {
foreach($this->settings as $setting) {
if (empty($setting->nosave)) {
return true;
}
}
return false;
} | php | public function show_save() {
foreach($this->settings as $setting) {
if (empty($setting->nosave)) {
return true;
}
}
return false;
} | [
"public",
"function",
"show_save",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"settings",
"as",
"$",
"setting",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"setting",
"->",
"nosave",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"fal... | Show we display Save button at the page bottom?
@return bool | [
"Show",
"we",
"display",
"Save",
"button",
"at",
"the",
"page",
"bottom?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1620-L1627 |
215,747 | moodle/moodle | lib/adminlib.php | admin_setting.set_flag_options | protected function set_flag_options($enabled, $default, $shortname, $displayname) {
if (empty($this->flags[$shortname])) {
$this->flags[$shortname] = new admin_setting_flag($enabled, $default, $shortname, $displayname);
} else {
$this->flags[$shortname]->set_options($enabled, $de... | php | protected function set_flag_options($enabled, $default, $shortname, $displayname) {
if (empty($this->flags[$shortname])) {
$this->flags[$shortname] = new admin_setting_flag($enabled, $default, $shortname, $displayname);
} else {
$this->flags[$shortname]->set_options($enabled, $de... | [
"protected",
"function",
"set_flag_options",
"(",
"$",
"enabled",
",",
"$",
"default",
",",
"$",
"shortname",
",",
"$",
"displayname",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"flags",
"[",
"$",
"shortname",
"]",
")",
")",
"{",
"$",
"thi... | Generic function to add a flag to this admin setting.
@param bool $enabled - One of self::OPTION_ENABLED or self::OPTION_DISABLED
@param bool $default - The default for the flag
@param string $shortname - The shortname for this flag. Used as a suffix for the setting name.
@param string $displayname - The display name ... | [
"Generic",
"function",
"to",
"add",
"a",
"flag",
"to",
"this",
"admin",
"setting",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1703-L1709 |
215,748 | moodle/moodle | lib/adminlib.php | admin_setting.get_setting_flag_value | public function get_setting_flag_value(admin_setting_flag $flag) {
$value = $this->config_read($this->name . '_' . $flag->get_shortname());
if (!isset($value)) {
$value = $flag->get_default();
}
return !empty($value);
} | php | public function get_setting_flag_value(admin_setting_flag $flag) {
$value = $this->config_read($this->name . '_' . $flag->get_shortname());
if (!isset($value)) {
$value = $flag->get_default();
}
return !empty($value);
} | [
"public",
"function",
"get_setting_flag_value",
"(",
"admin_setting_flag",
"$",
"flag",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"config_read",
"(",
"$",
"this",
"->",
"name",
".",
"'_'",
".",
"$",
"flag",
"->",
"get_shortname",
"(",
")",
")",
";"... | Get the currently saved value for a setting flag
@param admin_setting_flag $flag - One of the admin_setting_flag for this admin_setting.
@return bool | [
"Get",
"the",
"currently",
"saved",
"value",
"for",
"a",
"setting",
"flag"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1748-L1755 |
215,749 | moodle/moodle | lib/adminlib.php | admin_setting.get_setting_flag_defaults | public function get_setting_flag_defaults(& $defaults) {
foreach ($this->flags as $flag) {
if ($flag->is_enabled() && $flag->get_default()) {
$defaults[] = $flag->get_displayname();
}
}
} | php | public function get_setting_flag_defaults(& $defaults) {
foreach ($this->flags as $flag) {
if ($flag->is_enabled() && $flag->get_default()) {
$defaults[] = $flag->get_displayname();
}
}
} | [
"public",
"function",
"get_setting_flag_defaults",
"(",
"&",
"$",
"defaults",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"flags",
"as",
"$",
"flag",
")",
"{",
"if",
"(",
"$",
"flag",
"->",
"is_enabled",
"(",
")",
"&&",
"$",
"flag",
"->",
"get_default... | Get the list of defaults for the flags on this setting.
@param array of strings describing the defaults for this setting. This is appended to by this function. | [
"Get",
"the",
"list",
"of",
"defaults",
"for",
"the",
"flags",
"on",
"this",
"setting",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1762-L1768 |
215,750 | moodle/moodle | lib/adminlib.php | admin_setting.output_setting_flags | public function output_setting_flags() {
$output = '';
foreach ($this->flags as $flag) {
if ($flag->is_enabled()) {
$output .= $flag->output_setting_flag($this);
}
}
if (!empty($output)) {
return html_writer::tag('span', $output, arra... | php | public function output_setting_flags() {
$output = '';
foreach ($this->flags as $flag) {
if ($flag->is_enabled()) {
$output .= $flag->output_setting_flag($this);
}
}
if (!empty($output)) {
return html_writer::tag('span', $output, arra... | [
"public",
"function",
"output_setting_flags",
"(",
")",
"{",
"$",
"output",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"flags",
"as",
"$",
"flag",
")",
"{",
"if",
"(",
"$",
"flag",
"->",
"is_enabled",
"(",
")",
")",
"{",
"$",
"output",
".="... | Output the input fields for the advanced and locked flags on this setting.
@param bool $adv - The current value of the advanced flag.
@param bool $locked - The current value of the locked flag.
@return string $output - The html for the flags. | [
"Output",
"the",
"input",
"fields",
"for",
"the",
"advanced",
"and",
"locked",
"flags",
"on",
"this",
"setting",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1777-L1790 |
215,751 | moodle/moodle | lib/adminlib.php | admin_setting.write_setting_flags | public function write_setting_flags($data) {
$result = true;
foreach ($this->flags as $flag) {
$result = $result && $flag->write_setting_flag($this, $data);
}
return $result;
} | php | public function write_setting_flags($data) {
$result = true;
foreach ($this->flags as $flag) {
$result = $result && $flag->write_setting_flag($this, $data);
}
return $result;
} | [
"public",
"function",
"write_setting_flags",
"(",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"flags",
"as",
"$",
"flag",
")",
"{",
"$",
"result",
"=",
"$",
"result",
"&&",
"$",
"flag",
"->",
"write_sett... | Write the values of the flags for this admin setting.
@param array $data - The data submitted from the form or null to set the default value for new installs.
@return bool - true if successful. | [
"Write",
"the",
"values",
"of",
"the",
"flags",
"for",
"this",
"admin",
"setting",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1798-L1804 |
215,752 | moodle/moodle | lib/adminlib.php | admin_setting.config_read | public function config_read($name) {
global $CFG;
if (!empty($this->plugin)) {
$value = get_config($this->plugin, $name);
return $value === false ? NULL : $value;
} else {
if (isset($CFG->$name)) {
return $CFG->$name;
} else {
... | php | public function config_read($name) {
global $CFG;
if (!empty($this->plugin)) {
$value = get_config($this->plugin, $name);
return $value === false ? NULL : $value;
} else {
if (isset($CFG->$name)) {
return $CFG->$name;
} else {
... | [
"public",
"function",
"config_read",
"(",
"$",
"name",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"plugin",
")",
")",
"{",
"$",
"value",
"=",
"get_config",
"(",
"$",
"this",
"->",
"plugin",
",",
"$",
"na... | Returns the config if possible
@return mixed returns config if successful else null | [
"Returns",
"the",
"config",
"if",
"possible"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1864-L1877 |
215,753 | moodle/moodle | lib/adminlib.php | admin_setting.config_write | public function config_write($name, $value) {
global $DB, $USER, $CFG;
if ($this->nosave) {
return true;
}
// make sure it is a real change
$oldvalue = get_config($this->plugin, $name);
$oldvalue = ($oldvalue === false) ? null : $oldvalue; // normalise
... | php | public function config_write($name, $value) {
global $DB, $USER, $CFG;
if ($this->nosave) {
return true;
}
// make sure it is a real change
$oldvalue = get_config($this->plugin, $name);
$oldvalue = ($oldvalue === false) ? null : $oldvalue; // normalise
... | [
"public",
"function",
"config_write",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
",",
"$",
"CFG",
";",
"if",
"(",
"$",
"this",
"->",
"nosave",
")",
"{",
"return",
"true",
";",
"}",
"// make sure it is a real... | Used to set a config pair and log change
@param string $name
@param mixed $value Gets converted to string if not null
@return bool Write setting to config table | [
"Used",
"to",
"set",
"a",
"config",
"pair",
"and",
"log",
"change"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1886-L1914 |
215,754 | moodle/moodle | lib/adminlib.php | admin_setting.get_defaultsetting | public function get_defaultsetting() {
$adminroot = admin_get_root(false, false);
if (!empty($adminroot->custom_defaults)) {
$plugin = is_null($this->plugin) ? 'moodle' : $this->plugin;
if (isset($adminroot->custom_defaults[$plugin])) {
if (array_key_exists($this... | php | public function get_defaultsetting() {
$adminroot = admin_get_root(false, false);
if (!empty($adminroot->custom_defaults)) {
$plugin = is_null($this->plugin) ? 'moodle' : $this->plugin;
if (isset($adminroot->custom_defaults[$plugin])) {
if (array_key_exists($this... | [
"public",
"function",
"get_defaultsetting",
"(",
")",
"{",
"$",
"adminroot",
"=",
"admin_get_root",
"(",
"false",
",",
"false",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"adminroot",
"->",
"custom_defaults",
")",
")",
"{",
"$",
"plugin",
"=",
"is_null... | Returns default setting if exists
@return mixed array or string depending on instance; NULL means no default, user must supply | [
"Returns",
"default",
"setting",
"if",
"exists"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1936-L1947 |
215,755 | moodle/moodle | lib/adminlib.php | admin_setting.post_write_settings | public function post_write_settings($original) {
// Comparison must work for arrays too.
if (serialize($original) === serialize($this->get_setting())) {
return false;
}
$callbackfunction = $this->updatedcallback;
if (!empty($callbackfunction) and is_callable($callbac... | php | public function post_write_settings($original) {
// Comparison must work for arrays too.
if (serialize($original) === serialize($this->get_setting())) {
return false;
}
$callbackfunction = $this->updatedcallback;
if (!empty($callbackfunction) and is_callable($callbac... | [
"public",
"function",
"post_write_settings",
"(",
"$",
"original",
")",
"{",
"// Comparison must work for arrays too.",
"if",
"(",
"serialize",
"(",
"$",
"original",
")",
"===",
"serialize",
"(",
"$",
"this",
"->",
"get_setting",
"(",
")",
")",
")",
"{",
"retu... | Execute postupdatecallback if necessary.
@param mixed $original original value before write_setting()
@return bool true if changed, false if not. | [
"Execute",
"postupdatecallback",
"if",
"necessary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L1984-L1995 |
215,756 | moodle/moodle | lib/adminlib.php | admin_setting_flag.output_setting_flag | public function output_setting_flag(admin_setting $setting) {
global $OUTPUT;
$value = $setting->get_setting_flag_value($this);
$context = new stdClass();
$context->id = $setting->get_id() . '_' . $this->get_shortname();
$context->name = $setting->get_full_name() . '_' . $this... | php | public function output_setting_flag(admin_setting $setting) {
global $OUTPUT;
$value = $setting->get_setting_flag_value($this);
$context = new stdClass();
$context->id = $setting->get_id() . '_' . $this->get_shortname();
$context->name = $setting->get_full_name() . '_' . $this... | [
"public",
"function",
"output_setting_flag",
"(",
"admin_setting",
"$",
"setting",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"value",
"=",
"$",
"setting",
"->",
"get_setting_flag_value",
"(",
"$",
"this",
")",
";",
"$",
"context",
"=",
"new",
"stdClass",
... | Output the checkbox for this setting flag. Should only be called if the flag is enabled.
@param admin_setting $setting - The admin setting for this flag
@return string - The html for the checkbox. | [
"Output",
"the",
"checkbox",
"for",
"this",
"setting",
"flag",
".",
"Should",
"only",
"be",
"called",
"if",
"the",
"flag",
"is",
"enabled",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L2177-L2190 |
215,757 | moodle/moodle | lib/adminlib.php | admin_setting_configtext.get_force_ltr | public function get_force_ltr() {
$forceltr = parent::get_force_ltr();
if ($forceltr === null) {
return !is_rtl_compatible($this->paramtype);
}
return $forceltr;
} | php | public function get_force_ltr() {
$forceltr = parent::get_force_ltr();
if ($forceltr === null) {
return !is_rtl_compatible($this->paramtype);
}
return $forceltr;
} | [
"public",
"function",
"get_force_ltr",
"(",
")",
"{",
"$",
"forceltr",
"=",
"parent",
"::",
"get_force_ltr",
"(",
")",
";",
"if",
"(",
"$",
"forceltr",
"===",
"null",
")",
"{",
"return",
"!",
"is_rtl_compatible",
"(",
"$",
"this",
"->",
"paramtype",
")",... | Get whether this should be displayed in LTR mode.
Try to guess from the PARAM type unless specifically set. | [
"Get",
"whether",
"this",
"should",
"be",
"displayed",
"in",
"LTR",
"mode",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L2360-L2366 |
215,758 | moodle/moodle | lib/adminlib.php | admin_setting_configtext.output_html | public function output_html($data, $query='') {
global $OUTPUT;
$default = $this->get_defaultsetting();
$context = (object) [
'size' => $this->size,
'id' => $this->get_id(),
'name' => $this->get_full_name(),
'value' => $data,
'forceltr... | php | public function output_html($data, $query='') {
global $OUTPUT;
$default = $this->get_defaultsetting();
$context = (object) [
'size' => $this->size,
'id' => $this->get_id(),
'name' => $this->get_full_name(),
'value' => $data,
'forceltr... | [
"public",
"function",
"output_html",
"(",
"$",
"data",
",",
"$",
"query",
"=",
"''",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"default",
"=",
"$",
"this",
"->",
"get_defaultsetting",
"(",
")",
";",
"$",
"context",
"=",
"(",
"object",
")",
"[",
... | Return an XHTML string for the setting
@return string Returns an XHTML string | [
"Return",
"an",
"XHTML",
"string",
"for",
"the",
"setting"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L2421-L2435 |
215,759 | moodle/moodle | lib/adminlib.php | admin_setting_configempty.output_html | public function output_html($data, $query='') {
global $OUTPUT;
$context = (object) [
'id' => $this->get_id(),
'name' => $this->get_full_name()
];
$element = $OUTPUT->render_from_template('core_admin/setting_configempty', $context);
return format_admin_s... | php | public function output_html($data, $query='') {
global $OUTPUT;
$context = (object) [
'id' => $this->get_id(),
'name' => $this->get_full_name()
];
$element = $OUTPUT->render_from_template('core_admin/setting_configempty', $context);
return format_admin_s... | [
"public",
"function",
"output_html",
"(",
"$",
"data",
",",
"$",
"query",
"=",
"''",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"context",
"=",
"(",
"object",
")",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"get_id",
"(",
")",
",",
"'name'",
"=>",
"... | Returns an XHTML string for the hidden field
@param string $data
@param string $query
@return string XHTML string for the editor | [
"Returns",
"an",
"XHTML",
"string",
"for",
"the",
"hidden",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L2681-L2691 |
215,760 | moodle/moodle | lib/adminlib.php | admin_setting_configfile.write_setting | public function write_setting($data) {
global $CFG;
if (!empty($CFG->preventexecpath)) {
if ($this->get_setting() === null) {
// Use default during installation.
$data = $this->get_defaultsetting();
if ($data === null) {
$da... | php | public function write_setting($data) {
global $CFG;
if (!empty($CFG->preventexecpath)) {
if ($this->get_setting() === null) {
// Use default during installation.
$data = $this->get_defaultsetting();
if ($data === null) {
$da... | [
"public",
"function",
"write_setting",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"preventexecpath",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"get_setting",
"(",
")",
"===",
"null",
")... | Checks if execpatch has been disabled in config.php | [
"Checks",
"if",
"execpatch",
"has",
"been",
"disabled",
"in",
"config",
".",
"php"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L2749-L2763 |
215,761 | moodle/moodle | lib/adminlib.php | admin_setting_configexecutable.output_html | public function output_html($data, $query='') {
global $CFG, $OUTPUT;
$default = $this->get_defaultsetting();
require_once("$CFG->libdir/filelib.php");
$context = (object) [
'id' => $this->get_id(),
'name' => $this->get_full_name(),
'size' => $this->s... | php | public function output_html($data, $query='') {
global $CFG, $OUTPUT;
$default = $this->get_defaultsetting();
require_once("$CFG->libdir/filelib.php");
$context = (object) [
'id' => $this->get_id(),
'name' => $this->get_full_name(),
'size' => $this->s... | [
"public",
"function",
"output_html",
"(",
"$",
"data",
",",
"$",
"query",
"=",
"''",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"OUTPUT",
";",
"$",
"default",
"=",
"$",
"this",
"->",
"get_defaultsetting",
"(",
")",
";",
"require_once",
"(",
"\"$CFG->lib... | Returns an XHTML field
@param string $data This is the value for the field
@param string $query
@return string XHTML field | [
"Returns",
"an",
"XHTML",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L2782-L2805 |
215,762 | moodle/moodle | lib/adminlib.php | admin_setting_configcheckbox.write_setting | public function write_setting($data) {
if ((string)$data === $this->yes) { // convert to strings before comparison
$data = $this->yes;
} else {
$data = $this->no;
}
return ($this->config_write($this->name, $data) ? '' : get_string('errorsetting', 'admin'));
} | php | public function write_setting($data) {
if ((string)$data === $this->yes) { // convert to strings before comparison
$data = $this->yes;
} else {
$data = $this->no;
}
return ($this->config_write($this->name, $data) ? '' : get_string('errorsetting', 'admin'));
} | [
"public",
"function",
"write_setting",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"(",
"string",
")",
"$",
"data",
"===",
"$",
"this",
"->",
"yes",
")",
"{",
"// convert to strings before comparison",
"$",
"data",
"=",
"$",
"this",
"->",
"yes",
";",
"}",
"... | Sets the value for the setting
Sets the value for the setting to either the yes or no values
of the object by comparing $data to yes
@param mixed $data Gets converted to str for comparison against yes value
@return string empty string or error | [
"Sets",
"the",
"value",
"for",
"the",
"setting"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L2893-L2900 |
215,763 | moodle/moodle | lib/adminlib.php | admin_setting_configcheckbox.output_html | public function output_html($data, $query='') {
global $OUTPUT;
$context = (object) [
'id' => $this->get_id(),
'name' => $this->get_full_name(),
'no' => $this->no,
'value' => $this->yes,
'checked' => (string) $data === $this->yes,
];
... | php | public function output_html($data, $query='') {
global $OUTPUT;
$context = (object) [
'id' => $this->get_id(),
'name' => $this->get_full_name(),
'no' => $this->no,
'value' => $this->yes,
'checked' => (string) $data === $this->yes,
];
... | [
"public",
"function",
"output_html",
"(",
"$",
"data",
",",
"$",
"query",
"=",
"''",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"context",
"=",
"(",
"object",
")",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"get_id",
"(",
")",
",",
"'name'",
"=>",
"... | Returns an XHTML checkbox field
@param string $data If $data matches yes then checkbox is checked
@param string $query
@return string XHTML field | [
"Returns",
"an",
"XHTML",
"checkbox",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L2909-L2934 |
215,764 | moodle/moodle | lib/adminlib.php | admin_setting_configmulticheckbox2.get_setting | public function get_setting() {
$result = $this->config_read($this->name);
if (is_null($result)) {
return NULL;
}
if (!$this->load_choices()) {
return NULL;
}
$result = str_pad($result, count($this->choices), '0');
$result = preg_split('//'... | php | public function get_setting() {
$result = $this->config_read($this->name);
if (is_null($result)) {
return NULL;
}
if (!$this->load_choices()) {
return NULL;
}
$result = str_pad($result, count($this->choices), '0');
$result = preg_split('//'... | [
"public",
"function",
"get_setting",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"config_read",
"(",
"$",
"this",
"->",
"name",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"result",
")",
")",
"{",
"return",
"NULL",
";",
"}",
"if",
"(",
"!... | Returns the setting if set
@return mixed null if not set, else an array of set settings | [
"Returns",
"the",
"setting",
"if",
"set"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L3122-L3140 |
215,765 | moodle/moodle | lib/adminlib.php | admin_setting_configmultiselect.output_html | public function output_html($data, $query='') {
global $OUTPUT;
if (!$this->load_choices() or empty($this->choices)) {
return '';
}
$default = $this->get_defaultsetting();
if (is_null($default)) {
$default = array();
}
if (is_null($data))... | php | public function output_html($data, $query='') {
global $OUTPUT;
if (!$this->load_choices() or empty($this->choices)) {
return '';
}
$default = $this->get_defaultsetting();
if (is_null($default)) {
$default = array();
}
if (is_null($data))... | [
"public",
"function",
"output_html",
"(",
"$",
"data",
",",
"$",
"query",
"=",
"''",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"load_choices",
"(",
")",
"or",
"empty",
"(",
"$",
"this",
"->",
"choices",
")",
")",
... | Returns XHTML multi-select field
@todo Add vartype handling to ensure $data is an array
@param array $data Array of values to select by default
@param string $query
@return string XHTML multi-select field | [
"Returns",
"XHTML",
"multi",
"-",
"select",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L3463-L3532 |
215,766 | moodle/moodle | lib/adminlib.php | admin_setting_configtime.get_setting | public function get_setting() {
$result1 = $this->config_read($this->name);
$result2 = $this->config_read($this->name2);
if (is_null($result1) or is_null($result2)) {
return NULL;
}
return array('h' => $result1, 'm' => $result2);
} | php | public function get_setting() {
$result1 = $this->config_read($this->name);
$result2 = $this->config_read($this->name2);
if (is_null($result1) or is_null($result2)) {
return NULL;
}
return array('h' => $result1, 'm' => $result2);
} | [
"public",
"function",
"get_setting",
"(",
")",
"{",
"$",
"result1",
"=",
"$",
"this",
"->",
"config_read",
"(",
"$",
"this",
"->",
"name",
")",
";",
"$",
"result2",
"=",
"$",
"this",
"->",
"config_read",
"(",
"$",
"this",
"->",
"name2",
")",
";",
"... | Get the selected time
@return mixed An array containing 'h'=>xx, 'm'=>xx, or null if not set | [
"Get",
"the",
"selected",
"time"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L3565-L3573 |
215,767 | moodle/moodle | lib/adminlib.php | admin_setting_configtime.output_html | public function output_html($data, $query='') {
global $OUTPUT;
$default = $this->get_defaultsetting();
if (is_array($default)) {
$defaultinfo = $default['h'].':'.$default['m'];
} else {
$defaultinfo = NULL;
}
$context = (object) [
'i... | php | public function output_html($data, $query='') {
global $OUTPUT;
$default = $this->get_defaultsetting();
if (is_array($default)) {
$defaultinfo = $default['h'].':'.$default['m'];
} else {
$defaultinfo = NULL;
}
$context = (object) [
'i... | [
"public",
"function",
"output_html",
"(",
"$",
"data",
",",
"$",
"query",
"=",
"''",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"default",
"=",
"$",
"this",
"->",
"get_defaultsetting",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"default",
")",... | Returns XHTML time select fields
@param array $data Must be form 'h'=>xx, 'm'=>xx
@param string $query
@return string XHTML time select fields and wrapping div(s) | [
"Returns",
"XHTML",
"time",
"select",
"fields"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L3597-L3630 |
215,768 | moodle/moodle | lib/adminlib.php | admin_setting_configduration.get_duration_text | protected static function get_duration_text($seconds) {
if (empty($seconds)) {
return get_string('none');
}
$data = self::parse_seconds($seconds);
switch ($data['u']) {
case (60*60*24*7):
return get_string('numweeks', '', $data['v']);
c... | php | protected static function get_duration_text($seconds) {
if (empty($seconds)) {
return get_string('none');
}
$data = self::parse_seconds($seconds);
switch ($data['u']) {
case (60*60*24*7):
return get_string('numweeks', '', $data['v']);
c... | [
"protected",
"static",
"function",
"get_duration_text",
"(",
"$",
"seconds",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"seconds",
")",
")",
"{",
"return",
"get_string",
"(",
"'none'",
")",
";",
"}",
"$",
"data",
"=",
"self",
"::",
"parse_seconds",
"(",
"... | Converts seconds to some more user friendly string.
@static
@param int $seconds
@return string | [
"Converts",
"seconds",
"to",
"some",
"more",
"user",
"friendly",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L3689-L3706 |
215,769 | moodle/moodle | lib/adminlib.php | admin_setting_configduration.parse_seconds | protected static function parse_seconds($seconds) {
foreach (self::get_units() as $unit => $unused) {
if ($seconds % $unit === 0) {
return array('v'=>(int)($seconds/$unit), 'u'=>$unit);
}
}
return array('v'=>(int)$seconds, 'u'=>1);
} | php | protected static function parse_seconds($seconds) {
foreach (self::get_units() as $unit => $unused) {
if ($seconds % $unit === 0) {
return array('v'=>(int)($seconds/$unit), 'u'=>$unit);
}
}
return array('v'=>(int)$seconds, 'u'=>1);
} | [
"protected",
"static",
"function",
"parse_seconds",
"(",
"$",
"seconds",
")",
"{",
"foreach",
"(",
"self",
"::",
"get_units",
"(",
")",
"as",
"$",
"unit",
"=>",
"$",
"unused",
")",
"{",
"if",
"(",
"$",
"seconds",
"%",
"$",
"unit",
"===",
"0",
")",
... | Finds suitable units for given duration.
@static
@param int $seconds
@return array | [
"Finds",
"suitable",
"units",
"for",
"given",
"duration",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L3714-L3721 |
215,770 | moodle/moodle | lib/adminlib.php | admin_setting_configduration.get_setting | public function get_setting() {
$seconds = $this->config_read($this->name);
if (is_null($seconds)) {
return null;
}
return self::parse_seconds($seconds);
} | php | public function get_setting() {
$seconds = $this->config_read($this->name);
if (is_null($seconds)) {
return null;
}
return self::parse_seconds($seconds);
} | [
"public",
"function",
"get_setting",
"(",
")",
"{",
"$",
"seconds",
"=",
"$",
"this",
"->",
"config_read",
"(",
"$",
"this",
"->",
"name",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"seconds",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"se... | Get the selected duration as array.
@return mixed An array containing 'v'=>xx, 'u'=>xx, or null if not set | [
"Get",
"the",
"selected",
"duration",
"as",
"array",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L3728-L3735 |
215,771 | moodle/moodle | lib/adminlib.php | admin_setting_configduration.write_setting | public function write_setting($data) {
if (!is_array($data)) {
return '';
}
$seconds = (int)($data['v']*$data['u']);
if ($seconds < 0) {
return get_string('errorsetting', 'admin');
}
$result = $this->config_write($this->name, $seconds);
r... | php | public function write_setting($data) {
if (!is_array($data)) {
return '';
}
$seconds = (int)($data['v']*$data['u']);
if ($seconds < 0) {
return get_string('errorsetting', 'admin');
}
$result = $this->config_write($this->name, $seconds);
r... | [
"public",
"function",
"write_setting",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"seconds",
"=",
"(",
"int",
")",
"(",
"$",
"data",
"[",
"'v'",
"]",
"*",
"$",
"data",... | Store the duration as seconds.
@param array $data Must be form 'h'=>xx, 'm'=>xx
@return bool true if success, false if not | [
"Store",
"the",
"duration",
"as",
"seconds",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L3743-L3755 |
215,772 | moodle/moodle | lib/adminlib.php | admin_setting_configduration.output_html | public function output_html($data, $query='') {
global $OUTPUT;
$default = $this->get_defaultsetting();
if (is_number($default)) {
$defaultinfo = self::get_duration_text($default);
} else if (is_array($default)) {
$defaultinfo = self::get_duration_text($default['... | php | public function output_html($data, $query='') {
global $OUTPUT;
$default = $this->get_defaultsetting();
if (is_number($default)) {
$defaultinfo = self::get_duration_text($default);
} else if (is_array($default)) {
$defaultinfo = self::get_duration_text($default['... | [
"public",
"function",
"output_html",
"(",
"$",
"data",
",",
"$",
"query",
"=",
"''",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"default",
"=",
"$",
"this",
"->",
"get_defaultsetting",
"(",
")",
";",
"if",
"(",
"is_number",
"(",
"$",
"default",
")"... | Returns duration text+select fields.
@param array $data Must be form 'v'=>xx, 'u'=>xx
@param string $query
@return string duration text+select fields and wrapping div(s) | [
"Returns",
"duration",
"text",
"+",
"select",
"fields",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L3764-L3796 |
215,773 | moodle/moodle | lib/adminlib.php | admin_setting_configiplist.validate | public function validate($data) {
if(!empty($data)) {
$lines = explode("\n", $data);
} else {
return true;
}
$result = true;
$badips = array();
foreach ($lines as $line) {
$tokens = explode('#', $line);
$ip = trim($tokens[0]... | php | public function validate($data) {
if(!empty($data)) {
$lines = explode("\n", $data);
} else {
return true;
}
$result = true;
$badips = array();
foreach ($lines as $line) {
$tokens = explode('#', $line);
$ip = trim($tokens[0]... | [
"public",
"function",
"validate",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"data",
")",
";",
"}",
"else",
"{",
"return",
"true",
";",
"}",
"$",... | Validate the contents of the textarea as IP addresses
Used to validate a new line separated list of IP addresses collected from
a textarea control
@param string $data A list of IP Addresses separated by new lines
@return mixed bool true for success or string:error on failure | [
"Validate",
"the",
"contents",
"of",
"the",
"textarea",
"as",
"IP",
"addresses"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L3842-L3869 |
215,774 | moodle/moodle | lib/adminlib.php | admin_setting_configmixedhostiplist.ace_decode | protected function ace_decode($data) {
$entries = explode("\n", $data);
foreach ($entries as $key => $entry) {
$entry = trim($entry);
if (strpos($entry, 'xn--') !== false) {
$entries[$key] = idn_to_utf8($entry, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS4... | php | protected function ace_decode($data) {
$entries = explode("\n", $data);
foreach ($entries as $key => $entry) {
$entry = trim($entry);
if (strpos($entry, 'xn--') !== false) {
$entries[$key] = idn_to_utf8($entry, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS4... | [
"protected",
"function",
"ace_decode",
"(",
"$",
"data",
")",
"{",
"$",
"entries",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"data",
")",
";",
"foreach",
"(",
"$",
"entries",
"as",
"$",
"key",
"=>",
"$",
"entry",
")",
"{",
"$",
"entry",
"=",
"trim"... | Decode any ascii-encoded domain names back to their utf-8 representation for display.
@param string $data the setting data, as found in the database.
@return string $data the setting data, with all ascii-encoded IDNs decoded back to their utf-8 representation. | [
"Decode",
"any",
"ascii",
"-",
"encoded",
"domain",
"names",
"back",
"to",
"their",
"utf",
"-",
"8",
"representation",
"for",
"display",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L3951-L3960 |
215,775 | moodle/moodle | lib/adminlib.php | admin_setting_configmixedhostiplist.get_setting | public function get_setting() {
// Here, we need to decode any ascii-encoded IDNs back to their native, utf-8 representation.
$data = $this->config_read($this->name);
if (function_exists('idn_to_utf8') && !is_null($data)) {
$data = $this->ace_decode($data);
}
return $... | php | public function get_setting() {
// Here, we need to decode any ascii-encoded IDNs back to their native, utf-8 representation.
$data = $this->config_read($this->name);
if (function_exists('idn_to_utf8') && !is_null($data)) {
$data = $this->ace_decode($data);
}
return $... | [
"public",
"function",
"get_setting",
"(",
")",
"{",
"// Here, we need to decode any ascii-encoded IDNs back to their native, utf-8 representation.",
"$",
"data",
"=",
"$",
"this",
"->",
"config_read",
"(",
"$",
"this",
"->",
"name",
")",
";",
"if",
"(",
"function_exists... | Override, providing utf8-decoding for ascii-encoded IDN strings.
@return mixed returns punycode-converted setting string if successful, else null. | [
"Override",
"providing",
"utf8",
"-",
"decoding",
"for",
"ascii",
"-",
"encoded",
"IDN",
"strings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L3967-L3974 |
215,776 | moodle/moodle | lib/adminlib.php | admin_setting_configportlist.validate | public function validate($data) {
if (empty($data)) {
return true;
}
$ports = explode("\n", $data);
$badentries = [];
foreach ($ports as $port) {
$port = trim($port);
if (empty($port)) {
return get_string('validateemptylineerror... | php | public function validate($data) {
if (empty($data)) {
return true;
}
$ports = explode("\n", $data);
$badentries = [];
foreach ($ports as $port) {
$port = trim($port);
if (empty($port)) {
return get_string('validateemptylineerror... | [
"public",
"function",
"validate",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"ports",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"data",
")",
";",
"$",
"badentries",
"=",
"[",
... | Validate the contents of the textarea as port numbers.
Used to validate a new line separated list of ports collected from a textarea control.
@param string $data A list of ports separated by new lines
@return mixed bool true for success or string:error on failure | [
"Validate",
"the",
"contents",
"of",
"the",
"textarea",
"as",
"port",
"numbers",
".",
"Used",
"to",
"validate",
"a",
"new",
"line",
"separated",
"list",
"of",
"ports",
"collected",
"from",
"a",
"textarea",
"control",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L4016-L4037 |
215,777 | moodle/moodle | lib/adminlib.php | admin_setting_users_with_capability.load_choices | function load_choices() {
if (is_array($this->choices)) {
return true;
}
list($sort, $sortparams) = users_order_by_sql('u');
if (!empty($sortparams)) {
throw new coding_exception('users_order_by_sql returned some query parameters. ' .
'This is ... | php | function load_choices() {
if (is_array($this->choices)) {
return true;
}
list($sort, $sortparams) = users_order_by_sql('u');
if (!empty($sortparams)) {
throw new coding_exception('users_order_by_sql returned some query parameters. ' .
'This is ... | [
"function",
"load_choices",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"choices",
")",
")",
"{",
"return",
"true",
";",
"}",
"list",
"(",
"$",
"sort",
",",
"$",
"sortparams",
")",
"=",
"users_order_by_sql",
"(",
"'u'",
")",
";",
... | Load all of the uses who have the capability into choice array
@return bool Always returns true | [
"Load",
"all",
"of",
"the",
"uses",
"who",
"have",
"the",
"capability",
"into",
"choice",
"array"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L4081-L4109 |
215,778 | moodle/moodle | lib/adminlib.php | admin_setting_users_with_capability.get_defaultsetting | public function get_defaultsetting() {
$this->load_choices();
$defaultsetting = parent::get_defaultsetting();
if (empty($defaultsetting)) {
return array('$@NONE@$');
} else if (array_key_exists($defaultsetting, $this->choices)) {
return $defaultsetting;
... | php | public function get_defaultsetting() {
$this->load_choices();
$defaultsetting = parent::get_defaultsetting();
if (empty($defaultsetting)) {
return array('$@NONE@$');
} else if (array_key_exists($defaultsetting, $this->choices)) {
return $defaultsetting;
... | [
"public",
"function",
"get_defaultsetting",
"(",
")",
"{",
"$",
"this",
"->",
"load_choices",
"(",
")",
";",
"$",
"defaultsetting",
"=",
"parent",
"::",
"get_defaultsetting",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"defaultsetting",
")",
")",
"{",
"... | Returns the default setting for class
@return mixed Array, or string. Empty string if no default | [
"Returns",
"the",
"default",
"setting",
"for",
"class"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L4116-L4126 |
215,779 | moodle/moodle | lib/adminlib.php | admin_setting_users_with_capability.get_setting | public function get_setting() {
$result = parent::get_setting();
if ($result === null) {
// this is necessary for settings upgrade
return null;
}
if (empty($result)) {
$result = array('$@NONE@$');
}
return $result;
} | php | public function get_setting() {
$result = parent::get_setting();
if ($result === null) {
// this is necessary for settings upgrade
return null;
}
if (empty($result)) {
$result = array('$@NONE@$');
}
return $result;
} | [
"public",
"function",
"get_setting",
"(",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"get_setting",
"(",
")",
";",
"if",
"(",
"$",
"result",
"===",
"null",
")",
"{",
"// this is necessary for settings upgrade",
"return",
"null",
";",
"}",
"if",
"(",
"em... | Returns the current setting
@return mixed array or string | [
"Returns",
"the",
"current",
"setting"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L4133-L4143 |
215,780 | moodle/moodle | lib/adminlib.php | admin_setting_courselist_frontpage.load_choices | public function load_choices() {
if (is_array($this->choices)) {
return true;
}
$this->choices = array(FRONTPAGENEWS => get_string('frontpagenews'),
FRONTPAGEALLCOURSELIST => get_string('frontpagecourselist'),
FRONTPAGEENROLLEDCOURSELIST => get_string... | php | public function load_choices() {
if (is_array($this->choices)) {
return true;
}
$this->choices = array(FRONTPAGENEWS => get_string('frontpagenews'),
FRONTPAGEALLCOURSELIST => get_string('frontpagecourselist'),
FRONTPAGEENROLLEDCOURSELIST => get_string... | [
"public",
"function",
"load_choices",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"choices",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"this",
"->",
"choices",
"=",
"array",
"(",
"FRONTPAGENEWS",
"=>",
"get_string",
"(",
"'front... | Loads the choices available
@return bool always returns true | [
"Loads",
"the",
"choices",
"available"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L4342-L4357 |
215,781 | moodle/moodle | lib/adminlib.php | admin_setting_courselist_frontpage.write_setting | public function write_setting($data) {
if (!is_array($data)) {
return '';
}
$this->load_choices();
$save = array();
foreach($data as $datum) {
if ($datum == 'none' or !array_key_exists($datum, $this->choices)) {
continue;
}
... | php | public function write_setting($data) {
if (!is_array($data)) {
return '';
}
$this->load_choices();
$save = array();
foreach($data as $datum) {
if ($datum == 'none' or !array_key_exists($datum, $this->choices)) {
continue;
}
... | [
"public",
"function",
"write_setting",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"this",
"->",
"load_choices",
"(",
")",
";",
"$",
"save",
"=",
"array",
"(",
")",
";",
... | Save the selected options
@param array $data
@return mixed empty string (data is not an array) or bool true=success false=failure | [
"Save",
"the",
"selected",
"options"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L4381-L4394 |
215,782 | moodle/moodle | lib/adminlib.php | admin_setting_courselist_frontpage.output_html | public function output_html($data, $query='') {
global $OUTPUT;
$this->load_choices();
$currentsetting = array();
foreach ($data as $key) {
if ($key != 'none' and array_key_exists($key, $this->choices)) {
$currentsetting[] = $key; // already selected first
... | php | public function output_html($data, $query='') {
global $OUTPUT;
$this->load_choices();
$currentsetting = array();
foreach ($data as $key) {
if ($key != 'none' and array_key_exists($key, $this->choices)) {
$currentsetting[] = $key; // already selected first
... | [
"public",
"function",
"output_html",
"(",
"$",
"data",
",",
"$",
"query",
"=",
"''",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"this",
"->",
"load_choices",
"(",
")",
";",
"$",
"currentsetting",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
... | Return XHTML select field and wrapping div
@todo Add vartype handling to make sure $data is an array
@param array $data Array of elements to select by default
@return string XHTML select field and wrapping div | [
"Return",
"XHTML",
"select",
"field",
"and",
"wrapping",
"div"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L4403-L4441 |
215,783 | moodle/moodle | lib/adminlib.php | admin_setting_sitesettext.get_setting | public function get_setting() {
$site = course_get_format(get_site())->get_course();
return $site->{$this->name} != '' ? $site->{$this->name} : NULL;
} | php | public function get_setting() {
$site = course_get_format(get_site())->get_course();
return $site->{$this->name} != '' ? $site->{$this->name} : NULL;
} | [
"public",
"function",
"get_setting",
"(",
")",
"{",
"$",
"site",
"=",
"course_get_format",
"(",
"get_site",
"(",
")",
")",
"->",
"get_course",
"(",
")",
";",
"return",
"$",
"site",
"->",
"{",
"$",
"this",
"->",
"name",
"}",
"!=",
"''",
"?",
"$",
"s... | Return the current setting
@return mixed string or null | [
"Return",
"the",
"current",
"setting"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L4509-L4512 |
215,784 | moodle/moodle | lib/adminlib.php | admin_setting_sitesettext.validate | public function validate($data) {
global $DB, $SITE;
$cleaned = clean_param($data, PARAM_TEXT);
if ($cleaned === '') {
return get_string('required');
}
if ($this->name ==='shortname' &&
$DB->record_exists_sql('SELECT id from {course} WHERE shortname = ... | php | public function validate($data) {
global $DB, $SITE;
$cleaned = clean_param($data, PARAM_TEXT);
if ($cleaned === '') {
return get_string('required');
}
if ($this->name ==='shortname' &&
$DB->record_exists_sql('SELECT id from {course} WHERE shortname = ... | [
"public",
"function",
"validate",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"SITE",
";",
"$",
"cleaned",
"=",
"clean_param",
"(",
"$",
"data",
",",
"PARAM_TEXT",
")",
";",
"if",
"(",
"$",
"cleaned",
"===",
"''",
")",
"{",
"return",... | Validate the selected data
@param string $data The selected value to validate
@return mixed true or message string | [
"Validate",
"the",
"selected",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L4520-L4535 |
215,785 | moodle/moodle | lib/adminlib.php | admin_setting_emoticons.process_form_data | protected function process_form_data(array $form) {
$count = count($form); // number of form field values
if ($count % 5) {
// we must get five fields per emoticon object
return false;
}
$emoticons = array();
for ($i = 0; $i < $count / 5; $i++) {
... | php | protected function process_form_data(array $form) {
$count = count($form); // number of form field values
if ($count % 5) {
// we must get five fields per emoticon object
return false;
}
$emoticons = array();
for ($i = 0; $i < $count / 5; $i++) {
... | [
"protected",
"function",
"process_form_data",
"(",
"array",
"$",
"form",
")",
"{",
"$",
"count",
"=",
"count",
"(",
"$",
"form",
")",
";",
"// number of form field values",
"if",
"(",
"$",
"count",
"%",
"5",
")",
"{",
"// we must get five fields per emoticon obj... | Converts the data from admin settings form into an array of emoticon objects
@see self::prepare_form_data()
@param array $data array of admin form fields and values
@return false|array of emoticon objects | [
"Converts",
"the",
"data",
"from",
"admin",
"settings",
"form",
"into",
"an",
"array",
"of",
"emoticon",
"objects"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L4776-L4815 |
215,786 | moodle/moodle | lib/adminlib.php | admin_setting_special_calendar_weekend.get_setting | public function get_setting() {
$result = $this->config_read($this->name);
if (is_null($result)) {
return NULL;
}
if ($result === '') {
return array();
}
$settings = array();
for ($i=0; $i<7; $i++) {
if ($result & (1 << $i)) {
... | php | public function get_setting() {
$result = $this->config_read($this->name);
if (is_null($result)) {
return NULL;
}
if ($result === '') {
return array();
}
$settings = array();
for ($i=0; $i<7; $i++) {
if ($result & (1 << $i)) {
... | [
"public",
"function",
"get_setting",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"config_read",
"(",
"$",
"this",
"->",
"name",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"result",
")",
")",
"{",
"return",
"NULL",
";",
"}",
"if",
"(",
"$... | Gets the current settings as an array
@return mixed Null if none, else array of settings | [
"Gets",
"the",
"current",
"settings",
"as",
"an",
"array"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L5057-L5072 |
215,787 | moodle/moodle | lib/adminlib.php | admin_setting_special_calendar_weekend.write_setting | public function write_setting($data) {
if (!is_array($data)) {
return '';
}
unset($data['xxxxx']);
$result = 0;
foreach($data as $index) {
$result |= 1 << $index;
}
return ($this->config_write($this->name, $result) ? '' : get_string('errors... | php | public function write_setting($data) {
if (!is_array($data)) {
return '';
}
unset($data['xxxxx']);
$result = 0;
foreach($data as $index) {
$result |= 1 << $index;
}
return ($this->config_write($this->name, $result) ? '' : get_string('errors... | [
"public",
"function",
"write_setting",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
"''",
";",
"}",
"unset",
"(",
"$",
"data",
"[",
"'xxxxx'",
"]",
")",
";",
"$",
"result",
"=",
"0",
";",
"f... | Save the new settings
@param array $data Array of new settings
@return bool | [
"Save",
"the",
"new",
"settings"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L5080-L5090 |
215,788 | moodle/moodle | lib/adminlib.php | admin_setting_special_calendar_weekend.output_html | public function output_html($data, $query='') {
global $OUTPUT;
// The order matters very much because of the implied numeric keys.
$days = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
$context = (object) [
'name' => $this->get_full_na... | php | public function output_html($data, $query='') {
global $OUTPUT;
// The order matters very much because of the implied numeric keys.
$days = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
$context = (object) [
'name' => $this->get_full_na... | [
"public",
"function",
"output_html",
"(",
"$",
"data",
",",
"$",
"query",
"=",
"''",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"// The order matters very much because of the implied numeric keys.",
"$",
"days",
"=",
"array",
"(",
"'sunday'",
",",
"'monday'",
",",
... | Return XHTML to display the control
@param array $data array of selected days
@param string $query
@return string XHTML for display (field + wrapping div(s) | [
"Return",
"XHTML",
"to",
"display",
"the",
"control"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L5099-L5120 |
215,789 | moodle/moodle | lib/adminlib.php | admin_setting_pickroles.load_choices | public function load_choices() {
global $CFG, $DB;
if (during_initial_install()) {
return false;
}
if (is_array($this->choices)) {
return true;
}
if ($roles = get_all_roles()) {
$this->choices = role_fix_names($roles, null, ROLENAME_ORI... | php | public function load_choices() {
global $CFG, $DB;
if (during_initial_install()) {
return false;
}
if (is_array($this->choices)) {
return true;
}
if ($roles = get_all_roles()) {
$this->choices = role_fix_names($roles, null, ROLENAME_ORI... | [
"public",
"function",
"load_choices",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"if",
"(",
"during_initial_install",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"choices",
")",
")",
... | Load roles as choices
@return bool true=>success, false=>error | [
"Load",
"roles",
"as",
"choices"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L5179-L5193 |
215,790 | moodle/moodle | lib/adminlib.php | admin_setting_pickroles.get_defaultsetting | public function get_defaultsetting() {
global $CFG;
if (during_initial_install()) {
return null;
}
$result = array();
foreach($this->types as $archetype) {
if ($caproles = get_archetype_roles($archetype)) {
foreach ($caproles as $caprole) ... | php | public function get_defaultsetting() {
global $CFG;
if (during_initial_install()) {
return null;
}
$result = array();
foreach($this->types as $archetype) {
if ($caproles = get_archetype_roles($archetype)) {
foreach ($caproles as $caprole) ... | [
"public",
"function",
"get_defaultsetting",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"during_initial_install",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
... | Return the default setting for this control
@return array Array of default settings | [
"Return",
"the",
"default",
"setting",
"for",
"this",
"control"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L5200-L5215 |
215,791 | moodle/moodle | lib/adminlib.php | admin_setting_special_gradelimiting.write_setting | function write_setting($data) {
$previous = $this->get_setting();
if ($previous === null) {
if ($data) {
$this->regrade_all();
}
} else {
if ($data != $previous) {
$this->regrade_all();
}
}
return ($... | php | function write_setting($data) {
$previous = $this->get_setting();
if ($previous === null) {
if ($data) {
$this->regrade_all();
}
} else {
if ($data != $previous) {
$this->regrade_all();
}
}
return ($... | [
"function",
"write_setting",
"(",
"$",
"data",
")",
"{",
"$",
"previous",
"=",
"$",
"this",
"->",
"get_setting",
"(",
")",
";",
"if",
"(",
"$",
"previous",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"regrade_all",... | Saves the new settings
@param mixed $data
@return string empty string or error message | [
"Saves",
"the",
"new",
"settings"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L5478-L5491 |
215,792 | moodle/moodle | lib/adminlib.php | admin_setting_special_grademinmaxtouse.write_setting | function write_setting($data) {
global $CFG;
$previous = $this->get_setting();
$result = parent::write_setting($data);
// If saved and the value has changed.
if (empty($result) && $previous != $data) {
require_once($CFG->libdir . '/gradelib.php');
grade_... | php | function write_setting($data) {
global $CFG;
$previous = $this->get_setting();
$result = parent::write_setting($data);
// If saved and the value has changed.
if (empty($result) && $previous != $data) {
require_once($CFG->libdir . '/gradelib.php');
grade_... | [
"function",
"write_setting",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"previous",
"=",
"$",
"this",
"->",
"get_setting",
"(",
")",
";",
"$",
"result",
"=",
"parent",
"::",
"write_setting",
"(",
"$",
"data",
")",
";",
"// If saved and... | Saves the new setting.
@param mixed $data
@return string empty string or error message | [
"Saves",
"the",
"new",
"setting",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L5523-L5536 |
215,793 | moodle/moodle | lib/adminlib.php | admin_setting_special_gradeexport.load_choices | public function load_choices() {
if (is_array($this->choices)) {
return true;
}
$this->choices = array();
if ($plugins = core_component::get_plugin_list('gradeexport')) {
foreach($plugins as $plugin => $unused) {
$this->choices[$plugin] = get_stri... | php | public function load_choices() {
if (is_array($this->choices)) {
return true;
}
$this->choices = array();
if ($plugins = core_component::get_plugin_list('gradeexport')) {
foreach($plugins as $plugin => $unused) {
$this->choices[$plugin] = get_stri... | [
"public",
"function",
"load_choices",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"choices",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"this",
"->",
"choices",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"plugins",
"=",
"... | Load the available choices for the multicheckbox
@return bool always returns true | [
"Load",
"the",
"available",
"choices",
"for",
"the",
"multicheckbox"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L5560-L5572 |
215,794 | moodle/moodle | lib/adminlib.php | admin_setting_gradecat_combo.output_html | public function output_html($data, $query='') {
global $OUTPUT;
$value = $data['value'];
$default = $this->get_defaultsetting();
if (!is_null($default)) {
$defaultinfo = array();
if (isset($this->choices[$default['value']])) {
$defaultinfo[] = $... | php | public function output_html($data, $query='') {
global $OUTPUT;
$value = $data['value'];
$default = $this->get_defaultsetting();
if (!is_null($default)) {
$defaultinfo = array();
if (isset($this->choices[$default['value']])) {
$defaultinfo[] = $... | [
"public",
"function",
"output_html",
"(",
"$",
"data",
",",
"$",
"query",
"=",
"''",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"value",
"=",
"$",
"data",
"[",
"'value'",
"]",
";",
"$",
"default",
"=",
"$",
"this",
"->",
"get_defaultsetting",
"(",
... | Return XHTML to display the field and wrapping div
@todo Add vartype handling to ensure $data is array
@param array $data Associative array of value=>xx, forced=>xx, adv=>xx
@param string $query
@return string XHTML to display control | [
"Return",
"XHTML",
"to",
"display",
"the",
"field",
"and",
"wrapping",
"div"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L5791-L5832 |
215,795 | moodle/moodle | lib/adminlib.php | admin_setting_grade_profilereport.load_choices | public function load_choices() {
if (is_array($this->choices)) {
return true;
}
$this->choices = array();
global $CFG;
require_once($CFG->libdir.'/gradelib.php');
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
... | php | public function load_choices() {
if (is_array($this->choices)) {
return true;
}
$this->choices = array();
global $CFG;
require_once($CFG->libdir.'/gradelib.php');
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
... | [
"public",
"function",
"load_choices",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"choices",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"this",
"->",
"choices",
"=",
"array",
"(",
")",
";",
"global",
"$",
"CFG",
";",
"require... | Loads an array of choices for the configselect control
@return bool always return true | [
"Loads",
"an",
"array",
"of",
"choices",
"for",
"the",
"configselect",
"control"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L5854-L5873 |
215,796 | moodle/moodle | lib/adminlib.php | admin_setting_my_grades_report.load_choices | public function load_choices() {
global $CFG; // Remove this line and behold the horror of behat test failures!
$this->choices = array();
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
if (file_exists($plugindir . '/lib.php')) {
re... | php | public function load_choices() {
global $CFG; // Remove this line and behold the horror of behat test failures!
$this->choices = array();
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
if (file_exists($plugindir . '/lib.php')) {
re... | [
"public",
"function",
"load_choices",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// Remove this line and behold the horror of behat test failures!",
"$",
"this",
"->",
"choices",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"core_component",
"::",
"get_plugin_list",
... | Loads an array of choices for the configselect control.
@return bool always returns true. | [
"Loads",
"an",
"array",
"of",
"choices",
"for",
"the",
"configselect",
"control",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L5897-L5920 |
215,797 | moodle/moodle | lib/adminlib.php | admin_setting_special_registerauth.load_choices | public function load_choices() {
global $CFG;
if (is_array($this->choices)) {
return true;
}
$this->choices = array();
$this->choices[''] = get_string('disable');
$authsenabled = get_enabled_auth_plugins(true);
foreach ($authsenabled as $auth) {
... | php | public function load_choices() {
global $CFG;
if (is_array($this->choices)) {
return true;
}
$this->choices = array();
$this->choices[''] = get_string('disable');
$authsenabled = get_enabled_auth_plugins(true);
foreach ($authsenabled as $auth) {
... | [
"public",
"function",
"load_choices",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"choices",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"this",
"->",
"choices",
"=",
"array",
"(",
")",
";",
"$",
"... | Loads the possible choices for the array
@return bool always returns true | [
"Loads",
"the",
"possible",
"choices",
"for",
"the",
"array"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L5956-L5977 |
215,798 | moodle/moodle | lib/adminlib.php | admin_page_managemods.search | public function search($query) {
global $CFG, $DB;
if ($result = parent::search($query)) {
return $result;
}
$found = false;
if ($modules = $DB->get_records('modules')) {
foreach ($modules as $module) {
if (!file_exists("$CFG->dirroot/mod/... | php | public function search($query) {
global $CFG, $DB;
if ($result = parent::search($query)) {
return $result;
}
$found = false;
if ($modules = $DB->get_records('modules')) {
foreach ($modules as $module) {
if (!file_exists("$CFG->dirroot/mod/... | [
"public",
"function",
"search",
"(",
"$",
"query",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"if",
"(",
"$",
"result",
"=",
"parent",
"::",
"search",
"(",
"$",
"query",
")",
")",
"{",
"return",
"$",
"result",
";",
"}",
"$",
"found",
... | Try to find the specified module
@param string $query The module to search for
@return array | [
"Try",
"to",
"find",
"the",
"specified",
"module"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L6016-L6047 |
215,799 | moodle/moodle | lib/adminlib.php | admin_page_manageblocks.search | public function search($query) {
global $CFG, $DB;
if ($result = parent::search($query)) {
return $result;
}
$found = false;
if ($blocks = $DB->get_records('block')) {
foreach ($blocks as $block) {
if (!file_exists("$CFG->dirroot/blocks/$b... | php | public function search($query) {
global $CFG, $DB;
if ($result = parent::search($query)) {
return $result;
}
$found = false;
if ($blocks = $DB->get_records('block')) {
foreach ($blocks as $block) {
if (!file_exists("$CFG->dirroot/blocks/$b... | [
"public",
"function",
"search",
"(",
"$",
"query",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"if",
"(",
"$",
"result",
"=",
"parent",
"::",
"search",
"(",
"$",
"query",
")",
")",
"{",
"return",
"$",
"result",
";",
"}",
"$",
"found",
... | Search for a specific block
@param string $query The string to search for
@return array | [
"Search",
"for",
"a",
"specific",
"block"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adminlib.php#L6297-L6328 |
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.