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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
220,200 | moodle/moodle | admin/tool/uploadcourse/classes/tracker.php | tool_uploadcourse_tracker.output | public function output($line, $outcome, $status, $data) {
global $OUTPUT;
if ($this->outputmode == self::NO_OUTPUT) {
return;
}
if ($this->outputmode == self::OUTPUT_PLAIN) {
$message = array(
$line,
$outcome ? 'OK' : 'NOK',
... | php | public function output($line, $outcome, $status, $data) {
global $OUTPUT;
if ($this->outputmode == self::NO_OUTPUT) {
return;
}
if ($this->outputmode == self::OUTPUT_PLAIN) {
$message = array(
$line,
$outcome ? 'OK' : 'NOK',
... | [
"public",
"function",
"output",
"(",
"$",
"line",
",",
"$",
"outcome",
",",
"$",
"status",
",",
"$",
"data",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"$",
"this",
"->",
"outputmode",
"==",
"self",
"::",
"NO_OUTPUT",
")",
"{",
"return",
";... | Output one more line.
@param int $line line number.
@param bool $outcome success or not?
@param array $status array of statuses.
@param array $data extra data to display.
@return void | [
"Output",
"one",
"more",
"line",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/uploadcourse/classes/tracker.php#L144-L186 |
220,201 | moodle/moodle | admin/tool/uploadcourse/classes/tracker.php | tool_uploadcourse_tracker.start | public function start() {
if ($this->outputmode == self::NO_OUTPUT) {
return;
}
if ($this->outputmode == self::OUTPUT_PLAIN) {
$columns = array_flip($this->columns);
unset($columns['status']);
$columns = array_flip($columns);
$this->bu... | php | public function start() {
if ($this->outputmode == self::NO_OUTPUT) {
return;
}
if ($this->outputmode == self::OUTPUT_PLAIN) {
$columns = array_flip($this->columns);
unset($columns['status']);
$columns = array_flip($columns);
$this->bu... | [
"public",
"function",
"start",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"outputmode",
"==",
"self",
"::",
"NO_OUTPUT",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"outputmode",
"==",
"self",
"::",
"OUTPUT_PLAIN",
")",
"{",
"$",
... | Start the output.
@return void | [
"Start",
"the",
"output",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/uploadcourse/classes/tracker.php#L193-L218 |
220,202 | moodle/moodle | cache/stores/mongodb/MongoDB/GridFS/WritableStream.php | WritableStream.close | public function close()
{
if ($this->isClosed) {
// TODO: Should this be an error condition? e.g. BadMethodCallException
return;
}
if (strlen($this->buffer) > 0) {
$this->insertChunkFromBuffer();
}
$this->fileCollectionInsert();
$... | php | public function close()
{
if ($this->isClosed) {
// TODO: Should this be an error condition? e.g. BadMethodCallException
return;
}
if (strlen($this->buffer) > 0) {
$this->insertChunkFromBuffer();
}
$this->fileCollectionInsert();
$... | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isClosed",
")",
"{",
"// TODO: Should this be an error condition? e.g. BadMethodCallException",
"return",
";",
"}",
"if",
"(",
"strlen",
"(",
"$",
"this",
"->",
"buffer",
")",
">",
"0... | Closes an active stream and flushes all buffered data to GridFS. | [
"Closes",
"an",
"active",
"stream",
"and",
"flushes",
"all",
"buffered",
"data",
"to",
"GridFS",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/WritableStream.php#L139-L152 |
220,203 | moodle/moodle | cache/stores/mongodb/MongoDB/GridFS/WritableStream.php | WritableStream.writeBytes | public function writeBytes($data)
{
if ($this->isClosed) {
// TODO: Should this be an error condition? e.g. BadMethodCallException
return;
}
$bytesRead = 0;
while ($bytesRead != strlen($data)) {
$initialBufferLength = strlen($this->buffer);
... | php | public function writeBytes($data)
{
if ($this->isClosed) {
// TODO: Should this be an error condition? e.g. BadMethodCallException
return;
}
$bytesRead = 0;
while ($bytesRead != strlen($data)) {
$initialBufferLength = strlen($this->buffer);
... | [
"public",
"function",
"writeBytes",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isClosed",
")",
"{",
"// TODO: Should this be an error condition? e.g. BadMethodCallException",
"return",
";",
"}",
"$",
"bytesRead",
"=",
"0",
";",
"while",
"(",
"$",... | Inserts binary data into GridFS via chunks.
Data will be buffered internally until chunkSizeBytes are accumulated, at
which point a chunk document will be inserted and the buffer reset.
@param string $data Binary data to write
@return integer | [
"Inserts",
"binary",
"data",
"into",
"GridFS",
"via",
"chunks",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/WritableStream.php#L200-L220 |
220,204 | moodle/moodle | admin/tool/log/classes/log/manager.php | manager.init | protected function init() {
if (isset($this->stores)) {
// Do not bother checking readers and writers here
// because everything is init here.
return;
}
$this->stores = array();
$this->readers = array();
$this->writers = array();
// Re... | php | protected function init() {
if (isset($this->stores)) {
// Do not bother checking readers and writers here
// because everything is init here.
return;
}
$this->stores = array();
$this->readers = array();
$this->writers = array();
// Re... | [
"protected",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"stores",
")",
")",
"{",
"// Do not bother checking readers and writers here",
"// because everything is init here.",
"return",
";",
"}",
"$",
"this",
"->",
"stores",
"=",
... | Delayed initialisation of singleton. | [
"Delayed",
"initialisation",
"of",
"singleton",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/log/manager.php#L42-L74 |
220,205 | moodle/moodle | admin/tool/log/classes/log/manager.php | manager.process | public function process(\core\event\base $event) {
$this->init();
foreach ($this->writers as $plugin => $writer) {
try {
$writer->write($event, $this);
} catch (\Exception $e) {
debugging('Exception detected when logging event ' . $event->eventname... | php | public function process(\core\event\base $event) {
$this->init();
foreach ($this->writers as $plugin => $writer) {
try {
$writer->write($event, $this);
} catch (\Exception $e) {
debugging('Exception detected when logging event ' . $event->eventname... | [
"public",
"function",
"process",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"base",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"init",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"writers",
"as",
"$",
"plugin",
"=>",
"$",
"writer",
")",
"{",
"... | Called from the observer only.
@param \core\event\base $event | [
"Called",
"from",
"the",
"observer",
"only",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/log/manager.php#L81-L91 |
220,206 | moodle/moodle | admin/tool/log/classes/log/manager.php | manager.get_readers | public function get_readers($interface = null) {
$this->init();
$return = array();
foreach ($this->readers as $plugin => $reader) {
if (empty($interface) || ($reader instanceof $interface)) {
$return[$plugin] = $reader;
}
}
return $return;... | php | public function get_readers($interface = null) {
$this->init();
$return = array();
foreach ($this->readers as $plugin => $reader) {
if (empty($interface) || ($reader instanceof $interface)) {
$return[$plugin] = $reader;
}
}
return $return;... | [
"public",
"function",
"get_readers",
"(",
"$",
"interface",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"init",
"(",
")",
";",
"$",
"return",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"readers",
"as",
"$",
"plugin",
"=>",
"$",
... | Returns list of available log readers.
This way the reports find out available sources of data.
@param string $interface Returned stores must implement this interface.
@return \core\log\reader[] list of available log data readers | [
"Returns",
"list",
"of",
"available",
"log",
"readers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/log/manager.php#L102-L112 |
220,207 | moodle/moodle | admin/tool/log/classes/log/manager.php | manager.get_supported_reports | public function get_supported_reports($logstore) {
$allstores = self::get_store_plugins();
if (empty($allstores[$logstore])) {
// Store doesn't exist.
return array();
}
$reports = get_plugin_list_with_function('report', 'supports_logstore', 'lib.php');
$... | php | public function get_supported_reports($logstore) {
$allstores = self::get_store_plugins();
if (empty($allstores[$logstore])) {
// Store doesn't exist.
return array();
}
$reports = get_plugin_list_with_function('report', 'supports_logstore', 'lib.php');
$... | [
"public",
"function",
"get_supported_reports",
"(",
"$",
"logstore",
")",
"{",
"$",
"allstores",
"=",
"self",
"::",
"get_store_plugins",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"allstores",
"[",
"$",
"logstore",
"]",
")",
")",
"{",
"// Store doesn't e... | Get a list of reports that support the given store instance.
@param string $logstore Name of the store.
@return array List of supported reports | [
"Get",
"a",
"list",
"of",
"reports",
"that",
"support",
"the",
"given",
"store",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/log/manager.php#L121-L148 |
220,208 | moodle/moodle | admin/tool/log/classes/log/manager.php | manager.get_supported_logstores | public function get_supported_logstores($component) {
$allstores = self::get_store_plugins();
$enabled = $this->stores;
$function = component_callback_exists($component, 'supports_logstore');
if (!$function) {
// The report doesn't define the callback, most probably it does... | php | public function get_supported_logstores($component) {
$allstores = self::get_store_plugins();
$enabled = $this->stores;
$function = component_callback_exists($component, 'supports_logstore');
if (!$function) {
// The report doesn't define the callback, most probably it does... | [
"public",
"function",
"get_supported_logstores",
"(",
"$",
"component",
")",
"{",
"$",
"allstores",
"=",
"self",
"::",
"get_store_plugins",
"(",
")",
";",
"$",
"enabled",
"=",
"$",
"this",
"->",
"stores",
";",
"$",
"function",
"=",
"component_callback_exists",... | For a given report, returns a list of log stores that are supported.
@param string $component component.
@return false|array list of logstores that support the given report. It returns false if the given $component doesn't
require logstores. | [
"For",
"a",
"given",
"report",
"returns",
"a",
"list",
"of",
"log",
"stores",
"that",
"are",
"supported",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/log/manager.php#L158-L177 |
220,209 | moodle/moodle | admin/tool/log/classes/log/manager.php | manager.dispose | public function dispose() {
if ($this->stores) {
foreach ($this->stores as $store) {
$store->dispose();
}
}
$this->stores = null;
$this->readers = null;
$this->writers = null;
} | php | public function dispose() {
if ($this->stores) {
foreach ($this->stores as $store) {
$store->dispose();
}
}
$this->stores = null;
$this->readers = null;
$this->writers = null;
} | [
"public",
"function",
"dispose",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"stores",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"stores",
"as",
"$",
"store",
")",
"{",
"$",
"store",
"->",
"dispose",
"(",
")",
";",
"}",
"}",
"$",
"this",
"-... | Usually called automatically from shutdown manager,
this allows us to implement buffering of write operations. | [
"Usually",
"called",
"automatically",
"from",
"shutdown",
"manager",
"this",
"allows",
"us",
"to",
"implement",
"buffering",
"of",
"write",
"operations",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/log/manager.php#L192-L201 |
220,210 | moodle/moodle | badges/classes/assertion.php | core_badges_assertion.get_badge_assertion | public function get_badge_assertion() {
global $CFG;
$assertion = array();
if ($this->_data) {
$hash = $this->_data->uniquehash;
$email = empty($this->_data->backpackemail) ? $this->_data->email : $this->_data->backpackemail;
$assertionurl = new moodle_url('/b... | php | public function get_badge_assertion() {
global $CFG;
$assertion = array();
if ($this->_data) {
$hash = $this->_data->uniquehash;
$email = empty($this->_data->backpackemail) ? $this->_data->email : $this->_data->backpackemail;
$assertionurl = new moodle_url('/b... | [
"public",
"function",
"get_badge_assertion",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"assertion",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_data",
")",
"{",
"$",
"hash",
"=",
"$",
"this",
"->",
"_data",
"->",
"uniquehash",
... | Get badge assertion.
@return array Badge assertion. | [
"Get",
"badge",
"assertion",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/assertion.php#L95-L124 |
220,211 | moodle/moodle | badges/classes/assertion.php | core_badges_assertion.get_badge_class | public function get_badge_class() {
$class = array();
if ($this->_data) {
if (empty($this->_data->courseid)) {
$context = context_system::instance();
} else {
$context = context_course::instance($this->_data->courseid);
}
$i... | php | public function get_badge_class() {
$class = array();
if ($this->_data) {
if (empty($this->_data->courseid)) {
$context = context_system::instance();
} else {
$context = context_course::instance($this->_data->courseid);
}
$i... | [
"public",
"function",
"get_badge_class",
"(",
")",
"{",
"$",
"class",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_data",
"->",
"courseid",
")",
")",
"{",
"$",
"contex... | Get badge class information.
@return array Badge Class information. | [
"Get",
"badge",
"class",
"information",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/assertion.php#L131-L150 |
220,212 | moodle/moodle | badges/classes/assertion.php | core_badges_assertion.get_issuer | public function get_issuer() {
$issuer = array();
if ($this->_data) {
// Required.
$issuer['name'] = $this->_data->issuername;
$issuer['url'] = $this->_data->issuerurl;
// Optional.
if (!empty($this->_data->issuercontact)) {
$is... | php | public function get_issuer() {
$issuer = array();
if ($this->_data) {
// Required.
$issuer['name'] = $this->_data->issuername;
$issuer['url'] = $this->_data->issuerurl;
// Optional.
if (!empty($this->_data->issuercontact)) {
$is... | [
"public",
"function",
"get_issuer",
"(",
")",
"{",
"$",
"issuer",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_data",
")",
"{",
"// Required.",
"$",
"issuer",
"[",
"'name'",
"]",
"=",
"$",
"this",
"->",
"_data",
"->",
"issuername",
... | Get badge issuer information.
@return array Issuer information. | [
"Get",
"badge",
"issuer",
"information",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/assertion.php#L157-L170 |
220,213 | moodle/moodle | badges/classes/assertion.php | core_badges_assertion.get_related_badges | public function get_related_badges(badge $badge) {
global $DB;
$arraybadges = array();
$relatedbadges = $badge->get_related_badges(true);
if ($relatedbadges) {
foreach ($relatedbadges as $rb) {
$url = new moodle_url('/badges/badge_json.php', array('id' => $rb-... | php | public function get_related_badges(badge $badge) {
global $DB;
$arraybadges = array();
$relatedbadges = $badge->get_related_badges(true);
if ($relatedbadges) {
foreach ($relatedbadges as $rb) {
$url = new moodle_url('/badges/badge_json.php', array('id' => $rb-... | [
"public",
"function",
"get_related_badges",
"(",
"badge",
"$",
"badge",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"arraybadges",
"=",
"array",
"(",
")",
";",
"$",
"relatedbadges",
"=",
"$",
"badge",
"->",
"get_related_badges",
"(",
"true",
")",
";",
"if",... | Get related badges of the badge.
@param badge $badge Badge object.
@return array|bool List related badges. | [
"Get",
"related",
"badges",
"of",
"the",
"badge",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/assertion.php#L178-L193 |
220,214 | moodle/moodle | badges/classes/assertion.php | core_badges_assertion.get_endorsement | public function get_endorsement() {
global $DB;
$endorsement = array();
$record = $DB->get_record_select('badge_endorsement', 'badgeid = ?', array($this->_data->id));
return $record;
} | php | public function get_endorsement() {
global $DB;
$endorsement = array();
$record = $DB->get_record_select('badge_endorsement', 'badgeid = ?', array($this->_data->id));
return $record;
} | [
"public",
"function",
"get_endorsement",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"endorsement",
"=",
"array",
"(",
")",
";",
"$",
"record",
"=",
"$",
"DB",
"->",
"get_record_select",
"(",
"'badge_endorsement'",
",",
"'badgeid = ?'",
",",
"array",
"("... | Get endorsement of the badge.
@return false|stdClass Endorsement information. | [
"Get",
"endorsement",
"of",
"the",
"badge",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/assertion.php#L200-L205 |
220,215 | moodle/moodle | badges/classes/assertion.php | core_badges_assertion.get_criteria_badge_class | public function get_criteria_badge_class() {
$badge = new badge($this->_data->id);
$narrative = $badge->markdown_badge_criteria();
if (!empty($narrative)) {
$criteria = array();
$criteria['id'] = $this->_url->out(false);
$criteria['narrative'] = $narrative;
... | php | public function get_criteria_badge_class() {
$badge = new badge($this->_data->id);
$narrative = $badge->markdown_badge_criteria();
if (!empty($narrative)) {
$criteria = array();
$criteria['id'] = $this->_url->out(false);
$criteria['narrative'] = $narrative;
... | [
"public",
"function",
"get_criteria_badge_class",
"(",
")",
"{",
"$",
"badge",
"=",
"new",
"badge",
"(",
"$",
"this",
"->",
"_data",
"->",
"id",
")",
";",
"$",
"narrative",
"=",
"$",
"badge",
"->",
"markdown_badge_criteria",
"(",
")",
";",
"if",
"(",
"... | Get criteria of badge class.
@return array|string Criteria information. | [
"Get",
"criteria",
"of",
"badge",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/assertion.php#L212-L223 |
220,216 | moodle/moodle | badges/classes/assertion.php | core_badges_assertion.get_alignments | public function get_alignments() {
global $DB;
$badgeid = $this->_data->id;
$alignments = array();
$items = $DB->get_records_select('badge_alignment', 'badgeid = ?', array($badgeid));
foreach ($items as $item) {
$alignment = array('targetName' => $item->targetname, 't... | php | public function get_alignments() {
global $DB;
$badgeid = $this->_data->id;
$alignments = array();
$items = $DB->get_records_select('badge_alignment', 'badgeid = ?', array($badgeid));
foreach ($items as $item) {
$alignment = array('targetName' => $item->targetname, 't... | [
"public",
"function",
"get_alignments",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"badgeid",
"=",
"$",
"this",
"->",
"_data",
"->",
"id",
";",
"$",
"alignments",
"=",
"array",
"(",
")",
";",
"$",
"items",
"=",
"$",
"DB",
"->",
"get_records_select... | Get alignment of the badge.
@return array information. | [
"Get",
"alignment",
"of",
"the",
"badge",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/assertion.php#L230-L249 |
220,217 | moodle/moodle | competency/classes/course_module_competency.php | course_module_competency.get_ruleoutcome_name | public static function get_ruleoutcome_name($ruleoutcome) {
switch ($ruleoutcome) {
case self::OUTCOME_NONE:
$strname = 'none';
break;
case self::OUTCOME_EVIDENCE:
$strname = 'evidence';
break;
case self::OUTCOM... | php | public static function get_ruleoutcome_name($ruleoutcome) {
switch ($ruleoutcome) {
case self::OUTCOME_NONE:
$strname = 'none';
break;
case self::OUTCOME_EVIDENCE:
$strname = 'evidence';
break;
case self::OUTCOM... | [
"public",
"static",
"function",
"get_ruleoutcome_name",
"(",
"$",
"ruleoutcome",
")",
"{",
"switch",
"(",
"$",
"ruleoutcome",
")",
"{",
"case",
"self",
"::",
"OUTCOME_NONE",
":",
"$",
"strname",
"=",
"'none'",
";",
"break",
";",
"case",
"self",
"::",
"OUTC... | Human readable rule name.
@param int $ruleoutcome The value of ruleoutcome.
@return lang_string | [
"Human",
"readable",
"rule",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/course_module_competency.php#L113-L134 |
220,218 | moodle/moodle | competency/classes/course_module_competency.php | course_module_competency.list_course_modules | public static function list_course_modules($competencyid, $courseid) {
global $DB;
$results = $DB->get_records_sql('SELECT coursemodules.id as id
FROM {' . self::TABLE . '} modcomp
JOIN {course_modules} coursemodules
... | php | public static function list_course_modules($competencyid, $courseid) {
global $DB;
$results = $DB->get_records_sql('SELECT coursemodules.id as id
FROM {' . self::TABLE . '} modcomp
JOIN {course_modules} coursemodules
... | [
"public",
"static",
"function",
"list_course_modules",
"(",
"$",
"competencyid",
",",
"$",
"courseid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"results",
"=",
"$",
"DB",
"->",
"get_records_sql",
"(",
"'SELECT coursemodules.id as id\n ... | Return the module IDs and visible flags that include this competency in a single course.
@param int $competencyid The competency id
@param int $courseid The course ID.
@return array of ints (cmids) | [
"Return",
"the",
"module",
"IDs",
"and",
"visible",
"flags",
"that",
"include",
"this",
"competency",
"in",
"a",
"single",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/course_module_competency.php#L170-L181 |
220,219 | moodle/moodle | competency/classes/course_module_competency.php | course_module_competency.list_course_module_competencies | public static function list_course_module_competencies($cmid) {
global $DB;
$sql = 'SELECT coursemodcomp.*
FROM {' . self::TABLE . '} coursemodcomp
JOIN {' . competency::TABLE . '} comp
ON coursemodcomp.competencyid = comp.id
WHER... | php | public static function list_course_module_competencies($cmid) {
global $DB;
$sql = 'SELECT coursemodcomp.*
FROM {' . self::TABLE . '} coursemodcomp
JOIN {' . competency::TABLE . '} comp
ON coursemodcomp.competencyid = comp.id
WHER... | [
"public",
"static",
"function",
"list_course_module_competencies",
"(",
"$",
"cmid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"'SELECT coursemodcomp.*\n FROM {'",
".",
"self",
"::",
"TABLE",
".",
"'} coursemodcomp\n JOIN {'",
... | List the course_module_competencies in this course module.
@param int $cmid The course module id
@return course_module_competency[] | [
"List",
"the",
"course_module_competencies",
"in",
"this",
"course",
"module",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/course_module_competency.php#L280-L299 |
220,220 | moodle/moodle | competency/classes/course_module_competency.php | course_module_competency.get_records_by_competencyid_in_course | public static function get_records_by_competencyid_in_course($competencyid, $courseid) {
global $DB;
$sql = 'SELECT cmc.*
FROM {' . self::TABLE . '} cmc
JOIN {course_modules} cm
ON cm.course = ?
AND cmc.cmid = cm.id
... | php | public static function get_records_by_competencyid_in_course($competencyid, $courseid) {
global $DB;
$sql = 'SELECT cmc.*
FROM {' . self::TABLE . '} cmc
JOIN {course_modules} cm
ON cm.course = ?
AND cmc.cmid = cm.id
... | [
"public",
"static",
"function",
"get_records_by_competencyid_in_course",
"(",
"$",
"competencyid",
",",
"$",
"courseid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"'SELECT cmc.*\n FROM {'",
".",
"self",
"::",
"TABLE",
".",
"'} cmc\n ... | List the relationship objects for a competency in a course.
@param int $competencyid The competency ID.
@param int $courseid The course ID.
@return course_module_competency[] | [
"List",
"the",
"relationship",
"objects",
"for",
"a",
"competency",
"in",
"a",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/course_module_competency.php#L308-L328 |
220,221 | moodle/moodle | cache/stores/mongodb/addinstanceform.php | cachestore_mongodb_addinstance_form.configuration_definition | protected function configuration_definition() {
global $OUTPUT;
$form = $this->_form;
if (!version_compare(phpversion('mongodb'), '1.5', 'ge')) {
$form->addElement('html', $OUTPUT->notification(get_string('pleaseupgrademongo', 'cachestore_mongodb')));
}
$form->addEl... | php | protected function configuration_definition() {
global $OUTPUT;
$form = $this->_form;
if (!version_compare(phpversion('mongodb'), '1.5', 'ge')) {
$form->addElement('html', $OUTPUT->notification(get_string('pleaseupgrademongo', 'cachestore_mongodb')));
}
$form->addEl... | [
"protected",
"function",
"configuration_definition",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"_form",
";",
"if",
"(",
"!",
"version_compare",
"(",
"phpversion",
"(",
"'mongodb'",
")",
",",
"'1.5'",
",",
"'ge'",
"... | The forms custom definitions. | [
"The",
"forms",
"custom",
"definitions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/addinstanceform.php#L50-L100 |
220,222 | moodle/moodle | lib/classes/session/manager.php | manager.start | public static function start() {
global $CFG, $DB, $PERF;
if (isset(self::$sessionactive)) {
debugging('Session was already started!', DEBUG_DEVELOPER);
return;
}
// Grab the time before session lock starts.
$PERF->sessionlock['start'] = microtime(true);... | php | public static function start() {
global $CFG, $DB, $PERF;
if (isset(self::$sessionactive)) {
debugging('Session was already started!', DEBUG_DEVELOPER);
return;
}
// Grab the time before session lock starts.
$PERF->sessionlock['start'] = microtime(true);... | [
"public",
"static",
"function",
"start",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
",",
"$",
"PERF",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"sessionactive",
")",
")",
"{",
"debugging",
"(",
"'Session was already started!'",
",",
"D... | Start user session.
Note: This is intended to be called only from lib/setup.php! | [
"Start",
"user",
"session",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L59-L111 |
220,223 | moodle/moodle | lib/classes/session/manager.php | manager.get_performance_info | public static function get_performance_info() {
global $CFG, $PERF;
if (!session_id()) {
return array();
}
self::load_handler();
$size = display_size(strlen(session_encode()));
$handler = get_class(self::$handler);
$info = array();
$info['si... | php | public static function get_performance_info() {
global $CFG, $PERF;
if (!session_id()) {
return array();
}
self::load_handler();
$size = display_size(strlen(session_encode()));
$handler = get_class(self::$handler);
$info = array();
$info['si... | [
"public",
"static",
"function",
"get_performance_info",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PERF",
";",
"if",
"(",
"!",
"session_id",
"(",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"self",
"::",
"load_handler",
"(",
")",
";",
... | Returns current page performance info.
@return array perf info | [
"Returns",
"current",
"page",
"performance",
"info",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L118-L152 |
220,224 | moodle/moodle | lib/classes/session/manager.php | manager.get_handler_class | public static function get_handler_class() {
global $CFG, $DB;
if (PHPUNIT_TEST) {
return '\core\session\file';
} else if (!empty($CFG->session_handler_class)) {
return $CFG->session_handler_class;
} else if (!empty($CFG->dbsessions) and $DB->session_lock_support... | php | public static function get_handler_class() {
global $CFG, $DB;
if (PHPUNIT_TEST) {
return '\core\session\file';
} else if (!empty($CFG->session_handler_class)) {
return $CFG->session_handler_class;
} else if (!empty($CFG->dbsessions) and $DB->session_lock_support... | [
"public",
"static",
"function",
"get_handler_class",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"if",
"(",
"PHPUNIT_TEST",
")",
"{",
"return",
"'\\core\\session\\file'",
";",
"}",
"else",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"... | Get fully qualified name of session handler class.
@return string The name of the handler class | [
"Get",
"fully",
"qualified",
"name",
"of",
"session",
"handler",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L159-L171 |
220,225 | moodle/moodle | lib/classes/session/manager.php | manager.init_empty_session | public static function init_empty_session() {
global $CFG;
if (isset($GLOBALS['SESSION']->notifications)) {
// Backup notifications. These should be preserved across session changes until the user fetches and clears them.
$notifications = $GLOBALS['SESSION']->notifications;
... | php | public static function init_empty_session() {
global $CFG;
if (isset($GLOBALS['SESSION']->notifications)) {
// Backup notifications. These should be preserved across session changes until the user fetches and clears them.
$notifications = $GLOBALS['SESSION']->notifications;
... | [
"public",
"static",
"function",
"init_empty_session",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"isset",
"(",
"$",
"GLOBALS",
"[",
"'SESSION'",
"]",
"->",
"notifications",
")",
")",
"{",
"// Backup notifications. These should be preserved across session c... | Empty current session, fill it with not-logged-in user info.
This is intended for installation scripts, unit tests and other
special areas. Do NOT use for logout and session termination
in normal requests! | [
"Empty",
"current",
"session",
"fill",
"it",
"with",
"not",
"-",
"logged",
"-",
"in",
"user",
"info",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L193-L220 |
220,226 | moodle/moodle | lib/classes/session/manager.php | manager.prepare_cookies | protected static function prepare_cookies() {
global $CFG;
$cookiesecure = is_moodle_cookie_secure();
if (!isset($CFG->cookiehttponly)) {
$CFG->cookiehttponly = 0;
}
// Set sessioncookie variable if it isn't already.
if (!isset($CFG->sessioncookie)) {
... | php | protected static function prepare_cookies() {
global $CFG;
$cookiesecure = is_moodle_cookie_secure();
if (!isset($CFG->cookiehttponly)) {
$CFG->cookiehttponly = 0;
}
// Set sessioncookie variable if it isn't already.
if (!isset($CFG->sessioncookie)) {
... | [
"protected",
"static",
"function",
"prepare_cookies",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"cookiesecure",
"=",
"is_moodle_cookie_secure",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"CFG",
"->",
"cookiehttponly",
")",
")",
"{",
"$",
"CFG... | Make sure all cookie and session related stuff is configured properly before session start. | [
"Make",
"sure",
"all",
"cookie",
"and",
"session",
"related",
"stuff",
"is",
"configured",
"properly",
"before",
"session",
"start",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L225-L300 |
220,227 | moodle/moodle | lib/classes/session/manager.php | manager.add_session_record | protected static function add_session_record($userid) {
global $DB;
$record = new \stdClass();
$record->state = 0;
$record->sid = session_id();
$record->sessdata = null;
$record->userid = $userid;
$record->timecreated = $record->timemodified ... | php | protected static function add_session_record($userid) {
global $DB;
$record = new \stdClass();
$record->state = 0;
$record->sid = session_id();
$record->sessdata = null;
$record->userid = $userid;
$record->timecreated = $record->timemodified ... | [
"protected",
"static",
"function",
"add_session_record",
"(",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"record",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"record",
"->",
"state",
"=",
"0",
";",
"$",
"record",
"->",
"sid",
"=",... | Insert new empty session record.
@param int $userid
@return \stdClass the new record | [
"Insert",
"new",
"empty",
"session",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L456-L469 |
220,228 | moodle/moodle | lib/classes/session/manager.php | manager.check_security | protected static function check_security() {
global $CFG;
if (!empty($_SESSION['USER']->id) and !empty($CFG->tracksessionip)) {
// Make sure current IP matches the one for this session.
$remoteaddr = getremoteaddr();
if (empty($_SESSION['USER']->sessionip)) {
... | php | protected static function check_security() {
global $CFG;
if (!empty($_SESSION['USER']->id) and !empty($CFG->tracksessionip)) {
// Make sure current IP matches the one for this session.
$remoteaddr = getremoteaddr();
if (empty($_SESSION['USER']->sessionip)) {
... | [
"protected",
"static",
"function",
"check_security",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"_SESSION",
"[",
"'USER'",
"]",
"->",
"id",
")",
"and",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"tracksessionip",
")",
")",... | Do various session security checks.
WARNING: $USER and $SESSION are set up later, do not use them yet!
@throws \core\session\exception | [
"Do",
"various",
"session",
"security",
"checks",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L477-L494 |
220,229 | moodle/moodle | lib/classes/session/manager.php | manager.terminate_current | public static function terminate_current() {
global $DB;
if (!self::$sessionactive) {
self::init_empty_session();
self::$sessionactive = false;
return;
}
try {
$DB->delete_records('external_tokens', array('sid'=>session_id(), 'tokentype'=... | php | public static function terminate_current() {
global $DB;
if (!self::$sessionactive) {
self::init_empty_session();
self::$sessionactive = false;
return;
}
try {
$DB->delete_records('external_tokens', array('sid'=>session_id(), 'tokentype'=... | [
"public",
"static",
"function",
"terminate_current",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"self",
"::",
"$",
"sessionactive",
")",
"{",
"self",
"::",
"init_empty_session",
"(",
")",
";",
"self",
"::",
"$",
"sessionactive",
"=",
"false... | Terminate current user session.
@return void | [
"Terminate",
"current",
"user",
"session",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L522-L552 |
220,230 | moodle/moodle | lib/classes/session/manager.php | manager.write_close | public static function write_close() {
global $PERF;
if (self::$sessionactive) {
// Grab the time when session lock is released.
$PERF->sessionlock['released'] = microtime(true);
if (!empty($PERF->sessionlock['gained'])) {
$PERF->sessionlock['held'] =... | php | public static function write_close() {
global $PERF;
if (self::$sessionactive) {
// Grab the time when session lock is released.
$PERF->sessionlock['released'] = microtime(true);
if (!empty($PERF->sessionlock['gained'])) {
$PERF->sessionlock['held'] =... | [
"public",
"static",
"function",
"write_close",
"(",
")",
"{",
"global",
"$",
"PERF",
";",
"if",
"(",
"self",
"::",
"$",
"sessionactive",
")",
"{",
"// Grab the time when session lock is released.",
"$",
"PERF",
"->",
"sessionlock",
"[",
"'released'",
"]",
"=",
... | No more changes in session expected.
Unblocks the sessions, other scripts may start executing in parallel. | [
"No",
"more",
"changes",
"in",
"session",
"expected",
".",
"Unblocks",
"the",
"sessions",
"other",
"scripts",
"may",
"start",
"executing",
"in",
"parallel",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L558-L592 |
220,231 | moodle/moodle | lib/classes/session/manager.php | manager.session_exists | public static function session_exists($sid) {
global $DB, $CFG;
if (empty($CFG->version)) {
// Not installed yet, do not try to access database.
return false;
}
// Note: add sessions->state checking here if it gets implemented.
if (!$record = $DB->get_re... | php | public static function session_exists($sid) {
global $DB, $CFG;
if (empty($CFG->version)) {
// Not installed yet, do not try to access database.
return false;
}
// Note: add sessions->state checking here if it gets implemented.
if (!$record = $DB->get_re... | [
"public",
"static",
"function",
"session_exists",
"(",
"$",
"sid",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"version",
")",
")",
"{",
"// Not installed yet, do not try to access database.",
"return",
"fa... | Does the PHP session with given id exist?
The session must exist both in session table and actual
session backend and the session must not be timed out.
Timeout evaluation is simplified, the auth hooks are not executed.
@param string $sid
@return bool | [
"Does",
"the",
"PHP",
"session",
"with",
"given",
"id",
"exist?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L605-L627 |
220,232 | moodle/moodle | lib/classes/session/manager.php | manager.kill_all_sessions | public static function kill_all_sessions() {
global $DB;
self::terminate_current();
self::load_handler();
self::$handler->kill_all_sessions();
try {
$DB->delete_records('sessions');
} catch (\dml_exception $ignored) {
// Do not show any warnings... | php | public static function kill_all_sessions() {
global $DB;
self::terminate_current();
self::load_handler();
self::$handler->kill_all_sessions();
try {
$DB->delete_records('sessions');
} catch (\dml_exception $ignored) {
// Do not show any warnings... | [
"public",
"static",
"function",
"kill_all_sessions",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"self",
"::",
"terminate_current",
"(",
")",
";",
"self",
"::",
"load_handler",
"(",
")",
";",
"self",
"::",
"$",
"handler",
"->",
"kill_all_sessions",
"(",
")",
... | Terminate all sessions unconditionally. | [
"Terminate",
"all",
"sessions",
"unconditionally",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L645-L658 |
220,233 | moodle/moodle | lib/classes/session/manager.php | manager.kill_session | public static function kill_session($sid) {
global $DB;
self::load_handler();
if ($sid === session_id()) {
self::write_close();
}
self::$handler->kill_session($sid);
$DB->delete_records('sessions', array('sid'=>$sid));
} | php | public static function kill_session($sid) {
global $DB;
self::load_handler();
if ($sid === session_id()) {
self::write_close();
}
self::$handler->kill_session($sid);
$DB->delete_records('sessions', array('sid'=>$sid));
} | [
"public",
"static",
"function",
"kill_session",
"(",
"$",
"sid",
")",
"{",
"global",
"$",
"DB",
";",
"self",
"::",
"load_handler",
"(",
")",
";",
"if",
"(",
"$",
"sid",
"===",
"session_id",
"(",
")",
")",
"{",
"self",
"::",
"write_close",
"(",
")",
... | Terminate give session unconditionally.
@param string $sid | [
"Terminate",
"give",
"session",
"unconditionally",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L664-L676 |
220,234 | moodle/moodle | lib/classes/session/manager.php | manager.kill_user_sessions | public static function kill_user_sessions($userid, $keepsid = null) {
global $DB;
$sessions = $DB->get_records('sessions', array('userid'=>$userid), 'id DESC', 'id, sid');
foreach ($sessions as $session) {
if ($keepsid and $keepsid === $session->sid) {
continue;
... | php | public static function kill_user_sessions($userid, $keepsid = null) {
global $DB;
$sessions = $DB->get_records('sessions', array('userid'=>$userid), 'id DESC', 'id, sid');
foreach ($sessions as $session) {
if ($keepsid and $keepsid === $session->sid) {
continue;
... | [
"public",
"static",
"function",
"kill_user_sessions",
"(",
"$",
"userid",
",",
"$",
"keepsid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sessions",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"'sessions'",
",",
"array",
"(",
"'userid'",
"=>",
... | Terminate all sessions of given user unconditionally.
@param int $userid
@param string $keepsid keep this sid if present | [
"Terminate",
"all",
"sessions",
"of",
"given",
"user",
"unconditionally",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L683-L693 |
220,235 | moodle/moodle | lib/classes/session/manager.php | manager.loginas | public static function loginas($userid, \context $context, $generateevent = true) {
global $USER;
if (self::is_loggedinas()) {
return;
}
// Switch to fresh new $_SESSION.
$_SESSION = array();
$_SESSION['REALSESSION'] = clone($GLOBALS['SESSION']);
$GL... | php | public static function loginas($userid, \context $context, $generateevent = true) {
global $USER;
if (self::is_loggedinas()) {
return;
}
// Switch to fresh new $_SESSION.
$_SESSION = array();
$_SESSION['REALSESSION'] = clone($GLOBALS['SESSION']);
$GL... | [
"public",
"static",
"function",
"loginas",
"(",
"$",
"userid",
",",
"\\",
"context",
"$",
"context",
",",
"$",
"generateevent",
"=",
"true",
")",
"{",
"global",
"$",
"USER",
";",
"if",
"(",
"self",
"::",
"is_loggedinas",
"(",
")",
")",
"{",
"return",
... | Login as another user - no security checks here.
@param int $userid
@param \context $context
@param bool $generateevent Set to false to prevent the loginas event to be generated
@return void | [
"Login",
"as",
"another",
"user",
"-",
"no",
"security",
"checks",
"here",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L887-L930 |
220,236 | moodle/moodle | lib/classes/session/manager.php | manager.keepalive | public static function keepalive($identifier = 'sessionerroruser', $component = 'error', $frequency = null) {
global $CFG, $PAGE;
if ($frequency) {
if ($frequency > $CFG->sessiontimeout) {
// Sanity check the frequency.
throw new \coding_exception('Keepalive ... | php | public static function keepalive($identifier = 'sessionerroruser', $component = 'error', $frequency = null) {
global $CFG, $PAGE;
if ($frequency) {
if ($frequency > $CFG->sessiontimeout) {
// Sanity check the frequency.
throw new \coding_exception('Keepalive ... | [
"public",
"static",
"function",
"keepalive",
"(",
"$",
"identifier",
"=",
"'sessionerroruser'",
",",
"$",
"component",
"=",
"'error'",
",",
"$",
"frequency",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"if",
"(",
"$",
"frequency",... | Add a JS session keepalive to the page.
A JS session keepalive script will be called to update the session modification time every $frequency seconds.
Upon failure, the specified error message will be shown to the user.
@param string $identifier The string identifier for the message to show on failure.
@param string... | [
"Add",
"a",
"JS",
"session",
"keepalive",
"to",
"the",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L944-L966 |
220,237 | moodle/moodle | lib/classes/session/manager.php | manager.create_login_token | private static function create_login_token() {
global $SESSION;
$state = [
'token' => random_string(32),
'created' => time() // Server time - not user time.
];
if (!isset($SESSION->logintoken)) {
$SESSION->logintoken = [];
}
// Overw... | php | private static function create_login_token() {
global $SESSION;
$state = [
'token' => random_string(32),
'created' => time() // Server time - not user time.
];
if (!isset($SESSION->logintoken)) {
$SESSION->logintoken = [];
}
// Overw... | [
"private",
"static",
"function",
"create_login_token",
"(",
")",
"{",
"global",
"$",
"SESSION",
";",
"$",
"state",
"=",
"[",
"'token'",
"=>",
"random_string",
"(",
"32",
")",
",",
"'created'",
"=>",
"time",
"(",
")",
"// Server time - not user time.",
"]",
"... | Generate a new login token and store it in the session.
@return array The current login state. | [
"Generate",
"a",
"new",
"login",
"token",
"and",
"store",
"it",
"in",
"the",
"session",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L973-L989 |
220,238 | moodle/moodle | lib/classes/session/manager.php | manager.get_login_token | public static function get_login_token() {
global $CFG, $SESSION;
$state = false;
if (!isset($SESSION->logintoken)) {
$SESSION->logintoken = [];
}
if (array_key_exists(self::$logintokenkey, $SESSION->logintoken)) {
$state = $SESSION->logintoken[self::$l... | php | public static function get_login_token() {
global $CFG, $SESSION;
$state = false;
if (!isset($SESSION->logintoken)) {
$SESSION->logintoken = [];
}
if (array_key_exists(self::$logintokenkey, $SESSION->logintoken)) {
$state = $SESSION->logintoken[self::$l... | [
"public",
"static",
"function",
"get_login_token",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"SESSION",
";",
"$",
"state",
"=",
"false",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"SESSION",
"->",
"logintoken",
")",
")",
"{",
"$",
"SESSION",
"->",
... | Get the current login token or generate a new one.
All login forms generated from Moodle must include a login token
named "logintoken" with the value being the result of this function.
Logins will be rejected if they do not include this token as well as
the username and password fields.
@return string The current log... | [
"Get",
"the",
"current",
"login",
"token",
"or",
"generate",
"a",
"new",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L1001-L1028 |
220,239 | moodle/moodle | lib/classes/session/manager.php | manager.validate_login_token | public static function validate_login_token($token = false) {
global $CFG;
if (!empty($CFG->alternateloginurl) || !empty($CFG->disablelogintoken)) {
// An external login page cannot generate the login token we need to protect CSRF on
// login requests.
// Other custo... | php | public static function validate_login_token($token = false) {
global $CFG;
if (!empty($CFG->alternateloginurl) || !empty($CFG->disablelogintoken)) {
// An external login page cannot generate the login token we need to protect CSRF on
// login requests.
// Other custo... | [
"public",
"static",
"function",
"validate_login_token",
"(",
"$",
"token",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"alternateloginurl",
")",
"||",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"disablel... | Check the submitted value against the stored login token.
@param mixed $token The value submitted in the login form that we are validating.
If false is passed for the token, this function will always return true.
@return boolean If the submitted token is valid. | [
"Check",
"the",
"submitted",
"value",
"against",
"the",
"stored",
"login",
"token",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L1037-L1065 |
220,240 | moodle/moodle | lib/classes/session/manager.php | manager.update_recent_session_locks | public static function update_recent_session_locks($sessionlock) {
global $CFG, $SESSION;
if (empty($CFG->debugsessionlock)) {
return;
}
$SESSION->recentsessionlocks = self::get_recent_session_locks();
array_push($SESSION->recentsessionlocks, $sessionlock);
... | php | public static function update_recent_session_locks($sessionlock) {
global $CFG, $SESSION;
if (empty($CFG->debugsessionlock)) {
return;
}
$SESSION->recentsessionlocks = self::get_recent_session_locks();
array_push($SESSION->recentsessionlocks, $sessionlock);
... | [
"public",
"static",
"function",
"update_recent_session_locks",
"(",
"$",
"sessionlock",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"SESSION",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"debugsessionlock",
")",
")",
"{",
"return",
";",
"}",
"$",
"SESS... | Updates the recent session locks.
This function will store session lock info of all the pages visited.
@param array $sessionlock Session lock array. | [
"Updates",
"the",
"recent",
"session",
"locks",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L1090-L1101 |
220,241 | moodle/moodle | lib/classes/session/manager.php | manager.cleanup_recent_session_locks | public static function cleanup_recent_session_locks() {
global $SESSION;
$locks = self::get_recent_session_locks();
if (count($locks) > 2) {
for ($i = count($locks) - 1; $i > 0; $i--) {
// Calculate the gap between session locks.
$gap = $locks[$i]['re... | php | public static function cleanup_recent_session_locks() {
global $SESSION;
$locks = self::get_recent_session_locks();
if (count($locks) > 2) {
for ($i = count($locks) - 1; $i > 0; $i--) {
// Calculate the gap between session locks.
$gap = $locks[$i]['re... | [
"public",
"static",
"function",
"cleanup_recent_session_locks",
"(",
")",
"{",
"global",
"$",
"SESSION",
";",
"$",
"locks",
"=",
"self",
"::",
"get_recent_session_locks",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"locks",
")",
">",
"2",
")",
"{",
"for... | Reset recent session locks array if there is a 10 seconds time gap.
@return array Recent session locks array. | [
"Reset",
"recent",
"session",
"locks",
"array",
"if",
"there",
"is",
"a",
"10",
"seconds",
"time",
"gap",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L1108-L1123 |
220,242 | moodle/moodle | lib/classes/session/manager.php | manager.get_locked_page_at | public static function get_locked_page_at($time) {
$recentsessionlocks = self::get_recent_session_locks();
foreach ($recentsessionlocks as $recentsessionlock) {
if ($time >= $recentsessionlock['gained'] &&
$time <= $recentsessionlock['released']) {
return $rec... | php | public static function get_locked_page_at($time) {
$recentsessionlocks = self::get_recent_session_locks();
foreach ($recentsessionlocks as $recentsessionlock) {
if ($time >= $recentsessionlock['gained'] &&
$time <= $recentsessionlock['released']) {
return $rec... | [
"public",
"static",
"function",
"get_locked_page_at",
"(",
"$",
"time",
")",
"{",
"$",
"recentsessionlocks",
"=",
"self",
"::",
"get_recent_session_locks",
"(",
")",
";",
"foreach",
"(",
"$",
"recentsessionlocks",
"as",
"$",
"recentsessionlock",
")",
"{",
"if",
... | Get the page that blocks other pages at a specific timestamp.
Look for a page whose lock was gained before that timestamp, and released after that timestamp.
@param float $time Time before session lock starts.
@return array|null | [
"Get",
"the",
"page",
"that",
"blocks",
"other",
"pages",
"at",
"a",
"specific",
"timestamp",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L1133-L1141 |
220,243 | moodle/moodle | lib/classes/session/manager.php | manager.display_blocking_page | public static function display_blocking_page() {
global $PERF;
$page = self::get_locked_page_at($PERF->sessionlock['start']);
$output = "Script ".me()." was blocked for ";
$output .= number_format($PERF->sessionlock['wait'], 3);
if ($page != null) {
$output .= " seco... | php | public static function display_blocking_page() {
global $PERF;
$page = self::get_locked_page_at($PERF->sessionlock['start']);
$output = "Script ".me()." was blocked for ";
$output .= number_format($PERF->sessionlock['wait'], 3);
if ($page != null) {
$output .= " seco... | [
"public",
"static",
"function",
"display_blocking_page",
"(",
")",
"{",
"global",
"$",
"PERF",
";",
"$",
"page",
"=",
"self",
"::",
"get_locked_page_at",
"(",
"$",
"PERF",
"->",
"sessionlock",
"[",
"'start'",
"]",
")",
";",
"$",
"output",
"=",
"\"Script \"... | Display the page which blocks other pages.
@return string | [
"Display",
"the",
"page",
"which",
"blocks",
"other",
"pages",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L1148-L1162 |
220,244 | moodle/moodle | lib/classes/session/manager.php | manager.sessionlock_debugging | public static function sessionlock_debugging() {
global $CFG, $PERF;
if (!empty($CFG->debugsessionlock)) {
if (isset($PERF->sessionlock['held']) && $PERF->sessionlock['held'] > $CFG->debugsessionlock) {
debugging("Script ".me()." locked the session for ".number_format($PERF-... | php | public static function sessionlock_debugging() {
global $CFG, $PERF;
if (!empty($CFG->debugsessionlock)) {
if (isset($PERF->sessionlock['held']) && $PERF->sessionlock['held'] > $CFG->debugsessionlock) {
debugging("Script ".me()." locked the session for ".number_format($PERF-... | [
"public",
"static",
"function",
"sessionlock_debugging",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PERF",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"debugsessionlock",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"PERF",
"->",
"sessi... | Display debugging info about slow and blocked script. | [
"Display",
"debugging",
"info",
"about",
"slow",
"and",
"blocked",
"script",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/manager.php#L1181-L1195 |
220,245 | moodle/moodle | question/type/randomsamatch/questiontype.php | qtype_randomsamatch.get_available_saquestions_from_category | public function get_available_saquestions_from_category($categoryid, $subcategories) {
if (isset($this->availablesaquestionsbycategory[$categoryid][$subcategories])) {
return $this->availablesaquestionsbycategory[$categoryid][$subcategories];
}
if ($subcategories) {
$cat... | php | public function get_available_saquestions_from_category($categoryid, $subcategories) {
if (isset($this->availablesaquestionsbycategory[$categoryid][$subcategories])) {
return $this->availablesaquestionsbycategory[$categoryid][$subcategories];
}
if ($subcategories) {
$cat... | [
"public",
"function",
"get_available_saquestions_from_category",
"(",
"$",
"categoryid",
",",
"$",
"subcategories",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"availablesaquestionsbycategory",
"[",
"$",
"categoryid",
"]",
"[",
"$",
"subcategories",
"]",... | Get all the usable shortanswer questions from a particular question category.
@param integer $categoryid the id of a question category.
@param bool $subcategories whether to include questions from subcategories.
@return array of question records. | [
"Get",
"all",
"the",
"usable",
"shortanswer",
"questions",
"from",
"a",
"particular",
"question",
"category",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/randomsamatch/questiontype.php#L145-L160 |
220,246 | moodle/moodle | question/type/randomsamatch/questiontype.php | qtype_randomsamatch.import_from_xml | public function import_from_xml($xml, $fromform, qformat_xml $format, $extra=null) {
// Return if data type is not our own one.
if (!isset($xml['@']['type']) || $xml['@']['type'] != $this->name()) {
return false;
}
// Import the common question headers and set the correspond... | php | public function import_from_xml($xml, $fromform, qformat_xml $format, $extra=null) {
// Return if data type is not our own one.
if (!isset($xml['@']['type']) || $xml['@']['type'] != $this->name()) {
return false;
}
// Import the common question headers and set the correspond... | [
"public",
"function",
"import_from_xml",
"(",
"$",
"xml",
",",
"$",
"fromform",
",",
"qformat_xml",
"$",
"format",
",",
"$",
"extra",
"=",
"null",
")",
"{",
"// Return if data type is not our own one.",
"if",
"(",
"!",
"isset",
"(",
"$",
"xml",
"[",
"'@'",
... | Imports the question from Moodle XML format.
@param array $xml structure containing the XML data
@param object $fromform question object to fill: ignored by this function (assumed to be null)
@param qformat_xml $format format class exporting the question
@param object $extra extra information (not required for importi... | [
"Imports",
"the",
"question",
"from",
"Moodle",
"XML",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/randomsamatch/questiontype.php#L194-L213 |
220,247 | moodle/moodle | question/type/randomsamatch/questiontype.php | qtype_randomsamatch.export_to_xml | public function export_to_xml($question, qformat_xml $format, $extra=null) {
$expout = '';
$expout .= $format->write_combined_feedback($question->options,
$question->id,
$question->contextid);
... | php | public function export_to_xml($question, qformat_xml $format, $extra=null) {
$expout = '';
$expout .= $format->write_combined_feedback($question->options,
$question->id,
$question->contextid);
... | [
"public",
"function",
"export_to_xml",
"(",
"$",
"question",
",",
"qformat_xml",
"$",
"format",
",",
"$",
"extra",
"=",
"null",
")",
"{",
"$",
"expout",
"=",
"''",
";",
"$",
"expout",
".=",
"$",
"format",
"->",
"write_combined_feedback",
"(",
"$",
"quest... | Exports the question to Moodle XML format.
@param object $question question to be exported into XML format
@param qformat_xml $format format class exporting the question
@param object $extra extra information (not required for exporting this question in this format)
@return string containing the question data in XML f... | [
"Exports",
"the",
"question",
"to",
"Moodle",
"XML",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/randomsamatch/questiontype.php#L223-L234 |
220,248 | moodle/moodle | mod/forum/classes/output/email/renderer.php | renderer.format_message_text | public function format_message_text($cm, $post) {
$context = \context_module::instance($cm->id);
$message = file_rewrite_pluginfile_urls(
$post->message,
'pluginfile.php',
$context->id,
'mod_forum',
'post',
$post->id,
[
... | php | public function format_message_text($cm, $post) {
$context = \context_module::instance($cm->id);
$message = file_rewrite_pluginfile_urls(
$post->message,
'pluginfile.php',
$context->id,
'mod_forum',
'post',
$post->id,
[
... | [
"public",
"function",
"format_message_text",
"(",
"$",
"cm",
",",
"$",
"post",
")",
"{",
"$",
"context",
"=",
"\\",
"context_module",
"::",
"instance",
"(",
"$",
"cm",
"->",
"id",
")",
";",
"$",
"message",
"=",
"file_rewrite_pluginfile_urls",
"(",
"$",
"... | The HTML version of the e-mail message.
@param \stdClass $cm
@param \stdClass $post
@return string | [
"The",
"HTML",
"version",
"of",
"the",
"e",
"-",
"mail",
"message",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/output/email/renderer.php#L57-L73 |
220,249 | moodle/moodle | user/edit_form.php | user_edit_form.validation | public function validation($usernew, $files) {
global $CFG, $DB;
$errors = parent::validation($usernew, $files);
$usernew = (object)$usernew;
$user = $DB->get_record('user', array('id' => $usernew->id));
// Validate email.
if (!isset($usernew->email)) {
... | php | public function validation($usernew, $files) {
global $CFG, $DB;
$errors = parent::validation($usernew, $files);
$usernew = (object)$usernew;
$user = $DB->get_record('user', array('id' => $usernew->id));
// Validate email.
if (!isset($usernew->email)) {
... | [
"public",
"function",
"validation",
"(",
"$",
"usernew",
",",
"$",
"files",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"errors",
"=",
"parent",
"::",
"validation",
"(",
"$",
"usernew",
",",
"$",
"files",
")",
";",
"$",
"usernew",
"="... | Validate incoming form data.
@param array $usernew
@param array $files
@return array | [
"Validate",
"incoming",
"form",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/edit_form.php#L200-L234 |
220,250 | moodle/moodle | message/output/email/classes/task/send_email_task.php | send_email_task.execute | public function execute() {
global $DB, $PAGE;
// Get the maximum id we are going to use.
// We use this as records may be added to the table while this task runs.
$this->maxid = $DB->get_field_sql("SELECT MAX(id) FROM {message_email_messages}");
// We are going to send these e... | php | public function execute() {
global $DB, $PAGE;
// Get the maximum id we are going to use.
// We use this as records may be added to the table while this task runs.
$this->maxid = $DB->get_field_sql("SELECT MAX(id) FROM {message_email_messages}");
// We are going to send these e... | [
"public",
"function",
"execute",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"PAGE",
";",
"// Get the maximum id we are going to use.",
"// We use this as records may be added to the table while this task runs.",
"$",
"this",
"->",
"maxid",
"=",
"$",
"DB",
"->",
"get_... | Send out emails. | [
"Send",
"out",
"emails",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/email/classes/task/send_email_task.php#L59-L104 |
220,251 | moodle/moodle | message/output/email/classes/task/send_email_task.php | send_email_task.get_unique_users | private function get_unique_users() : moodle_recordset {
global $DB;
$subsql = 'SELECT DISTINCT(useridto) as id
FROM {message_email_messages}
WHERE id <= ?';
$sql = "SELECT *
FROM {user} u
WHERE id IN ($subsql)";
... | php | private function get_unique_users() : moodle_recordset {
global $DB;
$subsql = 'SELECT DISTINCT(useridto) as id
FROM {message_email_messages}
WHERE id <= ?';
$sql = "SELECT *
FROM {user} u
WHERE id IN ($subsql)";
... | [
"private",
"function",
"get_unique_users",
"(",
")",
":",
"moodle_recordset",
"{",
"global",
"$",
"DB",
";",
"$",
"subsql",
"=",
"'SELECT DISTINCT(useridto) as id\n FROM {message_email_messages}\n WHERE id <= ?'",
";",
"$",
"sql",
"=",
"... | Returns an array of users in the given conversation.
@return moodle_recordset A moodle_recordset instance. | [
"Returns",
"an",
"array",
"of",
"users",
"in",
"the",
"given",
"conversation",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/email/classes/task/send_email_task.php#L111-L123 |
220,252 | moodle/moodle | message/output/email/classes/task/send_email_task.php | send_email_task.get_conversations_for_user | private function get_conversations_for_user(int $userid) : moodle_recordset {
global $DB;
// We shouldn't be joining directly on the group table as group
// conversations may (in the future) be something created that
// isn't related to an actual group in a course. However, for
... | php | private function get_conversations_for_user(int $userid) : moodle_recordset {
global $DB;
// We shouldn't be joining directly on the group table as group
// conversations may (in the future) be something created that
// isn't related to an actual group in a course. However, for
... | [
"private",
"function",
"get_conversations_for_user",
"(",
"int",
"$",
"userid",
")",
":",
"moodle_recordset",
"{",
"global",
"$",
"DB",
";",
"// We shouldn't be joining directly on the group table as group",
"// conversations may (in the future) be something created that",
"// isn'... | Returns an array of unique conversations that require processing.
@param int $userid The ID of the user we are sending a digest to.
@return moodle_recordset A moodle_recordset instance. | [
"Returns",
"an",
"array",
"of",
"unique",
"conversations",
"that",
"require",
"processing",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/email/classes/task/send_email_task.php#L131-L152 |
220,253 | moodle/moodle | message/output/email/classes/task/send_email_task.php | send_email_task.get_users_messages_for_conversation | protected function get_users_messages_for_conversation(int $conversationid, int $userid) : moodle_recordset {
global $DB;
$usernamefields = \user_picture::fields('u');
$sql = "SELECT $usernamefields, m.*
FROM {messages} m
JOIN {user} u
ON ... | php | protected function get_users_messages_for_conversation(int $conversationid, int $userid) : moodle_recordset {
global $DB;
$usernamefields = \user_picture::fields('u');
$sql = "SELECT $usernamefields, m.*
FROM {messages} m
JOIN {user} u
ON ... | [
"protected",
"function",
"get_users_messages_for_conversation",
"(",
"int",
"$",
"conversationid",
",",
"int",
"$",
"userid",
")",
":",
"moodle_recordset",
"{",
"global",
"$",
"DB",
";",
"$",
"usernamefields",
"=",
"\\",
"user_picture",
"::",
"fields",
"(",
"'u'... | Returns the messages to send to a user for a given conversation
@param int $conversationid
@param int $userid
@return moodle_recordset A moodle_recordset instance. | [
"Returns",
"the",
"messages",
"to",
"send",
"to",
"a",
"user",
"for",
"a",
"given",
"conversation"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/email/classes/task/send_email_task.php#L161-L176 |
220,254 | moodle/moodle | lib/adodb/perf/perf-db2.inc.php | perf_db2.Tables | function Tables($throwaway=0)
{
$rs = $this->conn->Execute("select tabschema,tabname,card as rows,
npages pages_used,fpages pages_allocated, tbspace tablespace
from syscat.tables where tabschema not in ('SYSCAT','SYSIBM','SYSSTAT') order by 1,2");
return rs2html($rs,false,false,false,false);
} | php | function Tables($throwaway=0)
{
$rs = $this->conn->Execute("select tabschema,tabname,card as rows,
npages pages_used,fpages pages_allocated, tbspace tablespace
from syscat.tables where tabschema not in ('SYSCAT','SYSIBM','SYSSTAT') order by 1,2");
return rs2html($rs,false,false,false,false);
} | [
"function",
"Tables",
"(",
"$",
"throwaway",
"=",
"0",
")",
"{",
"$",
"rs",
"=",
"$",
"this",
"->",
"conn",
"->",
"Execute",
"(",
"\"select tabschema,tabname,card as rows,\n\t\t\tnpages pages_used,fpages pages_allocated, tbspace tablespace\n\t\t\tfrom syscat.tables where tabsch... | Gets a list of tables
@param int $throwaway discarded variable to match the parent method
@return string The formatted table list | [
"Gets",
"a",
"list",
"of",
"tables"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/perf/perf-db2.inc.php#L101-L107 |
220,255 | moodle/moodle | lib/form/group.php | MoodleQuickForm_group.setElements | function setElements($elements){
parent::setElements($elements);
foreach ($this->_elements as $element){
if (method_exists($element, 'setHiddenLabel')){
$element->setHiddenLabel(true);
}
}
} | php | function setElements($elements){
parent::setElements($elements);
foreach ($this->_elements as $element){
if (method_exists($element, 'setHiddenLabel')){
$element->setHiddenLabel(true);
}
}
} | [
"function",
"setElements",
"(",
"$",
"elements",
")",
"{",
"parent",
"::",
"setElements",
"(",
"$",
"elements",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_elements",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"element",
"... | Sets the grouped elements and hides label
@param array $elements | [
"Sets",
"the",
"grouped",
"elements",
"and",
"hides",
"label"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/group.php#L112-L119 |
220,256 | moodle/moodle | lib/form/group.php | MoodleQuickForm_group.validateSubmitValue | public function validateSubmitValue($values) {
foreach ($this->_elements as $element) {
if (method_exists($element, 'validateSubmitValue')) {
$value = $values[$element->getName()] ?? null;
$result = $element->validateSubmitValue($value);
if (!empty($re... | php | public function validateSubmitValue($values) {
foreach ($this->_elements as $element) {
if (method_exists($element, 'validateSubmitValue')) {
$value = $values[$element->getName()] ?? null;
$result = $element->validateSubmitValue($value);
if (!empty($re... | [
"public",
"function",
"validateSubmitValue",
"(",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_elements",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"element",
",",
"'validateSubmitValue'",
")",
")",
"{",
"$",
... | Calls the validateSubmitValue function for the containing elements and returns an error string as soon as it finds one.
@param array $values Values of the containing elements.
@return string|null Validation error message or null. | [
"Calls",
"the",
"validateSubmitValue",
"function",
"for",
"the",
"containing",
"elements",
"and",
"returns",
"an",
"error",
"string",
"as",
"soon",
"as",
"it",
"finds",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/group.php#L267-L277 |
220,257 | moodle/moodle | admin/tool/messageinbound/classes/edit_handler_form.php | tool_messageinbound_edit_handler_form.get_defaultexpiration_text | protected function get_defaultexpiration_text(\core\message\inbound\handler $handler) {
switch($handler->defaultexpiration) {
case HOURSECS :
return get_string('onehour', 'tool_messageinbound');
case DAYSECS :
return get_string('oneday', 'tool_mess... | php | protected function get_defaultexpiration_text(\core\message\inbound\handler $handler) {
switch($handler->defaultexpiration) {
case HOURSECS :
return get_string('onehour', 'tool_messageinbound');
case DAYSECS :
return get_string('oneday', 'tool_mess... | [
"protected",
"function",
"get_defaultexpiration_text",
"(",
"\\",
"core",
"\\",
"message",
"\\",
"inbound",
"\\",
"handler",
"$",
"handler",
")",
"{",
"switch",
"(",
"$",
"handler",
"->",
"defaultexpiration",
")",
"{",
"case",
"HOURSECS",
":",
"return",
"get_s... | Return a text string representing the selected default expiration for the handler.
@param \core\message\inbound\handler $handler handler instance.
@return string localised text string. | [
"Return",
"a",
"text",
"string",
"representing",
"the",
"selected",
"default",
"expiration",
"for",
"the",
"handler",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/messageinbound/classes/edit_handler_form.php#L127-L142 |
220,258 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Data/Acl.php | Horde_Imap_Client_Data_Acl.diff | public function diff($rights)
{
$rlist = array_diff(str_split($rights), array_keys($this->_virtual));
return array(
'added' => implode('', array_diff($rlist, $this->_rights)),
'removed' => implode('', array_diff($this->_rights, $rlist))
);
} | php | public function diff($rights)
{
$rlist = array_diff(str_split($rights), array_keys($this->_virtual));
return array(
'added' => implode('', array_diff($rlist, $this->_rights)),
'removed' => implode('', array_diff($this->_rights, $rlist))
);
} | [
"public",
"function",
"diff",
"(",
"$",
"rights",
")",
"{",
"$",
"rlist",
"=",
"array_diff",
"(",
"str_split",
"(",
"$",
"rights",
")",
",",
"array_keys",
"(",
"$",
"this",
"->",
"_virtual",
")",
")",
";",
"return",
"array",
"(",
"'added'",
"=>",
"im... | Computes the difference to another rights string.
Virtual rights are ignored.
@param string $rights The rights to compute against.
@return array Two element array: added and removed. | [
"Computes",
"the",
"difference",
"to",
"another",
"rights",
"string",
".",
"Virtual",
"rights",
"are",
"ignored",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Data/Acl.php#L61-L69 |
220,259 | moodle/moodle | mod/assign/feedback/editpdf/classes/combined_document.php | combined_document.get_status | public function get_status() {
if ($this->combinedfile) {
// The combined file exists. Report success.
return self::STATUS_COMPLETE;
}
if (empty($this->sourcefiles)) {
// There are no source files to combine.
return self::STATUS_FAILED;
}
... | php | public function get_status() {
if ($this->combinedfile) {
// The combined file exists. Report success.
return self::STATUS_COMPLETE;
}
if (empty($this->sourcefiles)) {
// There are no source files to combine.
return self::STATUS_FAILED;
}
... | [
"public",
"function",
"get_status",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"combinedfile",
")",
"{",
"// The combined file exists. Report success.",
"return",
"self",
"::",
"STATUS_COMPLETE",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"sourcef... | Check the current status of the document combination.
Note that the combined document may not contain all the source files if some of the
source files were not able to be converted. An example is an audio file with a pdf cover sheet. Only
the cover sheet will be included in the combined document.
@return int | [
"Check",
"the",
"current",
"status",
"of",
"the",
"document",
"combination",
".",
"Note",
"that",
"the",
"combined",
"document",
"may",
"not",
"contain",
"all",
"the",
"source",
"files",
"if",
"some",
"of",
"the",
"source",
"files",
"were",
"not",
"able",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/classes/combined_document.php#L90-L135 |
220,260 | moodle/moodle | mod/assign/feedback/editpdf/classes/combined_document.php | combined_document.is_partial_conversion | public function is_partial_conversion() {
$combinedfile = $this->get_combined_file();
if (empty($combinedfile)) {
return false;
}
$filearea = $combinedfile->get_filearea();
return $filearea == document_services::PARTIAL_PDF_FILEAREA;
} | php | public function is_partial_conversion() {
$combinedfile = $this->get_combined_file();
if (empty($combinedfile)) {
return false;
}
$filearea = $combinedfile->get_filearea();
return $filearea == document_services::PARTIAL_PDF_FILEAREA;
} | [
"public",
"function",
"is_partial_conversion",
"(",
")",
"{",
"$",
"combinedfile",
"=",
"$",
"this",
"->",
"get_combined_file",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"combinedfile",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"filearea",
"=",... | Return true of the combined file contained only some of the submission files.
@return boolean | [
"Return",
"true",
"of",
"the",
"combined",
"file",
"contained",
"only",
"some",
"of",
"the",
"submission",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/classes/combined_document.php#L153-L160 |
220,261 | moodle/moodle | mod/assign/feedback/editpdf/classes/combined_document.php | combined_document.refresh_files | public function refresh_files() {
$converter = new \core_files\converter();
foreach ($this->sourcefiles as $file) {
if (is_a($file, \core_files\conversion::class)) {
$status = $file->get('status');
switch ($status) {
case \core_files\conver... | php | public function refresh_files() {
$converter = new \core_files\converter();
foreach ($this->sourcefiles as $file) {
if (is_a($file, \core_files\conversion::class)) {
$status = $file->get('status');
switch ($status) {
case \core_files\conver... | [
"public",
"function",
"refresh_files",
"(",
")",
"{",
"$",
"converter",
"=",
"new",
"\\",
"core_files",
"\\",
"converter",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"sourcefiles",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"is_a",
"(",
"$",
"fil... | Refresh the files.
This includes polling any pending conversions to see if they are complete.
@return $this | [
"Refresh",
"the",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/classes/combined_document.php#L211-L227 |
220,262 | moodle/moodle | mod/assign/feedback/editpdf/classes/combined_document.php | combined_document.combine_files | public function combine_files($contextid, $itemid) {
global $CFG;
$currentstatus = $this->get_status();
$readystatuslist = [self::STATUS_READY, self::STATUS_READY_PARTIAL];
if ($currentstatus === self::STATUS_FAILED) {
$this->store_empty_document($contextid, $itemid);
... | php | public function combine_files($contextid, $itemid) {
global $CFG;
$currentstatus = $this->get_status();
$readystatuslist = [self::STATUS_READY, self::STATUS_READY_PARTIAL];
if ($currentstatus === self::STATUS_FAILED) {
$this->store_empty_document($contextid, $itemid);
... | [
"public",
"function",
"combine_files",
"(",
"$",
"contextid",
",",
"$",
"itemid",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"currentstatus",
"=",
"$",
"this",
"->",
"get_status",
"(",
")",
";",
"$",
"readystatuslist",
"=",
"[",
"self",
"::",
"STATUS_READ... | Combine all source files into a single PDF and store it in the
file_storage API using the supplied contextid and itemid.
@param int $contextid The contextid for the file to be stored under
@param int $itemid The itemid for the file to be stored under
@return $this | [
"Combine",
"all",
"source",
"files",
"into",
"a",
"single",
"PDF",
"and",
"store",
"it",
"in",
"the",
"file_storage",
"API",
"using",
"the",
"supplied",
"contextid",
"and",
"itemid",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/classes/combined_document.php#L237-L311 |
220,263 | moodle/moodle | mod/assign/feedback/editpdf/classes/combined_document.php | combined_document.store_combined_file | protected function store_combined_file($tmpfile, $contextid, $itemid, $partial = false) {
// Store the file.
$record = $this->get_stored_file_record($contextid, $itemid, $partial);
$fs = get_file_storage();
// Delete existing files first.
$fs->delete_area_files($record->contexti... | php | protected function store_combined_file($tmpfile, $contextid, $itemid, $partial = false) {
// Store the file.
$record = $this->get_stored_file_record($contextid, $itemid, $partial);
$fs = get_file_storage();
// Delete existing files first.
$fs->delete_area_files($record->contexti... | [
"protected",
"function",
"store_combined_file",
"(",
"$",
"tmpfile",
",",
"$",
"contextid",
",",
"$",
"itemid",
",",
"$",
"partial",
"=",
"false",
")",
"{",
"// Store the file.",
"$",
"record",
"=",
"$",
"this",
"->",
"get_stored_file_record",
"(",
"$",
"con... | Store the combined file in the file_storage API.
@param string $tmpfile The path to the file on disk to be stored.
@param int $contextid The contextid for the file to be stored under
@param int $itemid The itemid for the file to be stored under
@param boolean $partial The combined pdf contains only some of the... | [
"Store",
"the",
"combined",
"file",
"in",
"the",
"file_storage",
"API",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/classes/combined_document.php#L333-L347 |
220,264 | moodle/moodle | mod/assign/feedback/editpdf/classes/combined_document.php | combined_document.store_empty_document | protected function store_empty_document($contextid, $itemid) {
// Store the file.
$record = $this->get_stored_file_record($contextid, $itemid);
$fs = get_file_storage();
// Delete existing files first.
$fs->delete_area_files($record->contextid, $record->component, $record->filea... | php | protected function store_empty_document($contextid, $itemid) {
// Store the file.
$record = $this->get_stored_file_record($contextid, $itemid);
$fs = get_file_storage();
// Delete existing files first.
$fs->delete_area_files($record->contextid, $record->component, $record->filea... | [
"protected",
"function",
"store_empty_document",
"(",
"$",
"contextid",
",",
"$",
"itemid",
")",
"{",
"// Store the file.",
"$",
"record",
"=",
"$",
"this",
"->",
"get_stored_file_record",
"(",
"$",
"contextid",
",",
"$",
"itemid",
")",
";",
"$",
"fs",
"=",
... | Store the empty document file in the file_storage API.
@param int $contextid The contextid for the file to be stored under
@param int $itemid The itemid for the file to be stored under
@return $this | [
"Store",
"the",
"empty",
"document",
"file",
"in",
"the",
"file_storage",
"API",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/classes/combined_document.php#L356-L370 |
220,265 | moodle/moodle | mod/assign/feedback/editpdf/classes/combined_document.php | combined_document.get_page_count | public function get_page_count() {
if ($this->pagecount) {
return $this->pagecount;
}
$status = $this->get_status();
if ($status === self::STATUS_FAILED) {
// The empty document will be returned.
return 1;
}
if ($status !== self::STA... | php | public function get_page_count() {
if ($this->pagecount) {
return $this->pagecount;
}
$status = $this->get_status();
if ($status === self::STATUS_FAILED) {
// The empty document will be returned.
return 1;
}
if ($status !== self::STA... | [
"public",
"function",
"get_page_count",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"pagecount",
")",
"{",
"return",
"$",
"this",
"->",
"pagecount",
";",
"}",
"$",
"status",
"=",
"$",
"this",
"->",
"get_status",
"(",
")",
";",
"if",
"(",
"$",
"sta... | Get the total number of pages in the combined document.
If there are no pages, or it is not yet possible to count them a
value of 0 is returned.
@return int | [
"Get",
"the",
"total",
"number",
"of",
"pages",
"in",
"the",
"combined",
"document",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/classes/combined_document.php#L380-L413 |
220,266 | moodle/moodle | mod/assign/feedback/editpdf/classes/combined_document.php | combined_document.get_stored_file_record | protected function get_stored_file_record($contextid, $itemid, $partial = false) {
$filearea = document_services::COMBINED_PDF_FILEAREA;
if ($partial) {
$filearea = document_services::PARTIAL_PDF_FILEAREA;
}
return (object) [
'contextid' => $contextid,
... | php | protected function get_stored_file_record($contextid, $itemid, $partial = false) {
$filearea = document_services::COMBINED_PDF_FILEAREA;
if ($partial) {
$filearea = document_services::PARTIAL_PDF_FILEAREA;
}
return (object) [
'contextid' => $contextid,
... | [
"protected",
"function",
"get_stored_file_record",
"(",
"$",
"contextid",
",",
"$",
"itemid",
",",
"$",
"partial",
"=",
"false",
")",
"{",
"$",
"filearea",
"=",
"document_services",
"::",
"COMBINED_PDF_FILEAREA",
";",
"if",
"(",
"$",
"partial",
")",
"{",
"$"... | Helper to fetch the stored_file record.
@param int $contextid The contextid for the file to be stored under
@param int $itemid The itemid for the file to be stored under
@param boolean $partial The combined file contains only some of the source files.
@return stdClass | [
"Helper",
"to",
"fetch",
"the",
"stored_file",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/classes/combined_document.php#L432-L445 |
220,267 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/DimensionReduction/LDA.php | LDA.calculateMeans | protected function calculateMeans(array $data, array $classes) : array
{
$means = [];
$counts= [];
$overallMean = array_fill(0, count($data[0]), 0.0);
foreach ($data as $index => $row) {
$label = array_search($classes[$index], $this->labels);
foreach ($row a... | php | protected function calculateMeans(array $data, array $classes) : array
{
$means = [];
$counts= [];
$overallMean = array_fill(0, count($data[0]), 0.0);
foreach ($data as $index => $row) {
$label = array_search($classes[$index], $this->labels);
foreach ($row a... | [
"protected",
"function",
"calculateMeans",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"classes",
")",
":",
"array",
"{",
"$",
"means",
"=",
"[",
"]",
";",
"$",
"counts",
"=",
"[",
"]",
";",
"$",
"overallMean",
"=",
"array_fill",
"(",
"0",
",",
"... | Calculates mean of each column for each class and returns
n by m matrix where n is number of labels and m is number of columns
@param array $data
@param array $classes
@return array | [
"Calculates",
"mean",
"of",
"each",
"column",
"for",
"each",
"class",
"and",
"returns",
"n",
"by",
"m",
"matrix",
"where",
"n",
"is",
"number",
"of",
"labels",
"and",
"m",
"is",
"number",
"of",
"columns"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/DimensionReduction/LDA.php#L118-L157 |
220,268 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/DimensionReduction/LDA.php | LDA.calculateClassVar | protected function calculateClassVar($data, $classes)
{
// s is an n (number of classes) by m (number of column) matrix
$s = array_fill(0, count($data[0]), array_fill(0, count($data[0]), 0));
$sW = new Matrix($s, false);
foreach ($data as $index => $row) {
$label = array... | php | protected function calculateClassVar($data, $classes)
{
// s is an n (number of classes) by m (number of column) matrix
$s = array_fill(0, count($data[0]), array_fill(0, count($data[0]), 0));
$sW = new Matrix($s, false);
foreach ($data as $index => $row) {
$label = array... | [
"protected",
"function",
"calculateClassVar",
"(",
"$",
"data",
",",
"$",
"classes",
")",
"{",
"// s is an n (number of classes) by m (number of column) matrix",
"$",
"s",
"=",
"array_fill",
"(",
"0",
",",
"count",
"(",
"$",
"data",
"[",
"0",
"]",
")",
",",
"a... | Returns in-class scatter matrix for each class, which
is a n by m matrix where n is number of classes and
m is number of columns
@param array $data
@param array $classes
@return Matrix | [
"Returns",
"in",
"-",
"class",
"scatter",
"matrix",
"for",
"each",
"class",
"which",
"is",
"a",
"n",
"by",
"m",
"matrix",
"where",
"n",
"is",
"number",
"of",
"classes",
"and",
"m",
"is",
"number",
"of",
"columns"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/DimensionReduction/LDA.php#L170-L186 |
220,269 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/DimensionReduction/LDA.php | LDA.calculateClassCov | protected function calculateClassCov()
{
// s is an n (number of classes) by m (number of column) matrix
$s = array_fill(0, count($this->overallMean), array_fill(0, count($this->overallMean), 0));
$sB = new Matrix($s, false);
foreach ($this->means as $index => $classMeans) {
... | php | protected function calculateClassCov()
{
// s is an n (number of classes) by m (number of column) matrix
$s = array_fill(0, count($this->overallMean), array_fill(0, count($this->overallMean), 0));
$sB = new Matrix($s, false);
foreach ($this->means as $index => $classMeans) {
... | [
"protected",
"function",
"calculateClassCov",
"(",
")",
"{",
"// s is an n (number of classes) by m (number of column) matrix",
"$",
"s",
"=",
"array_fill",
"(",
"0",
",",
"count",
"(",
"$",
"this",
"->",
"overallMean",
")",
",",
"array_fill",
"(",
"0",
",",
"coun... | Returns between-class scatter matrix for each class, which
is an n by m matrix where n is number of classes and
m is number of columns
@return Matrix | [
"Returns",
"between",
"-",
"class",
"scatter",
"matrix",
"for",
"each",
"class",
"which",
"is",
"an",
"n",
"by",
"m",
"matrix",
"where",
"n",
"is",
"number",
"of",
"classes",
"and",
"m",
"is",
"number",
"of",
"columns"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/DimensionReduction/LDA.php#L195-L208 |
220,270 | moodle/moodle | mod/glossary/classes/local/concept_cache.php | concept_cache.cm_updated | public static function cm_updated(\core\event\course_module_updated $event) {
if ($event->other['modulename'] !== 'glossary') {
return;
}
// We do not know what changed exactly, so let's reset everything that might be affected.
concept_cache::reset_course_muc($event->courseid... | php | public static function cm_updated(\core\event\course_module_updated $event) {
if ($event->other['modulename'] !== 'glossary') {
return;
}
// We do not know what changed exactly, so let's reset everything that might be affected.
concept_cache::reset_course_muc($event->courseid... | [
"public",
"static",
"function",
"cm_updated",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"course_module_updated",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"->",
"other",
"[",
"'modulename'",
"]",
"!==",
"'glossary'",
")",
"{",
"return",
";",
"}",
"/... | Event observer, do not call directly.
@param \core\event\course_module_updated $event | [
"Event",
"observer",
"do",
"not",
"call",
"directly",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/local/concept_cache.php#L40-L47 |
220,271 | moodle/moodle | mod/glossary/classes/local/concept_cache.php | concept_cache.reset_course_muc | public static function reset_course_muc($courseid) {
if (empty($courseid)) {
return;
}
$cache = \cache::make('mod_glossary', 'concepts');
$cache->delete((int)$courseid);
} | php | public static function reset_course_muc($courseid) {
if (empty($courseid)) {
return;
}
$cache = \cache::make('mod_glossary', 'concepts');
$cache->delete((int)$courseid);
} | [
"public",
"static",
"function",
"reset_course_muc",
"(",
"$",
"courseid",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"courseid",
")",
")",
"{",
"return",
";",
"}",
"$",
"cache",
"=",
"\\",
"cache",
"::",
"make",
"(",
"'mod_glossary'",
",",
"'concepts'",
"... | Reset the cache for course concepts.
@param int $courseid | [
"Reset",
"the",
"cache",
"for",
"course",
"concepts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/local/concept_cache.php#L65-L71 |
220,272 | moodle/moodle | mod/glossary/classes/local/concept_cache.php | concept_cache.reset_glossary | public static function reset_glossary($glossary) {
if (!$glossary->usedynalink) {
return;
}
self::reset_course_muc($glossary->course);
if ($glossary->globalglossary) {
self::reset_global_muc();
}
} | php | public static function reset_glossary($glossary) {
if (!$glossary->usedynalink) {
return;
}
self::reset_course_muc($glossary->course);
if ($glossary->globalglossary) {
self::reset_global_muc();
}
} | [
"public",
"static",
"function",
"reset_glossary",
"(",
"$",
"glossary",
")",
"{",
"if",
"(",
"!",
"$",
"glossary",
"->",
"usedynalink",
")",
"{",
"return",
";",
"}",
"self",
"::",
"reset_course_muc",
"(",
"$",
"glossary",
"->",
"course",
")",
";",
"if",
... | Utility method to purge caches related to given glossary.
@param \stdClass $glossary | [
"Utility",
"method",
"to",
"purge",
"caches",
"related",
"to",
"given",
"glossary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/local/concept_cache.php#L85-L93 |
220,273 | moodle/moodle | mod/glossary/classes/local/concept_cache.php | concept_cache.fetch_concepts | protected static function fetch_concepts(array $glossaries) {
global $DB;
$glossarylist = implode(',', $glossaries);
$sql = "SELECT id, glossaryid, concept, casesensitive, 0 AS category, fullmatch
FROM {glossary_entries}
WHERE glossaryid IN ($glossarylist) AN... | php | protected static function fetch_concepts(array $glossaries) {
global $DB;
$glossarylist = implode(',', $glossaries);
$sql = "SELECT id, glossaryid, concept, casesensitive, 0 AS category, fullmatch
FROM {glossary_entries}
WHERE glossaryid IN ($glossarylist) AN... | [
"protected",
"static",
"function",
"fetch_concepts",
"(",
"array",
"$",
"glossaries",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"glossarylist",
"=",
"implode",
"(",
"','",
",",
"$",
"glossaries",
")",
";",
"$",
"sql",
"=",
"\"SELECT id, glossaryid, concept, cas... | Fetch concepts for given glossaries.
@param int[] $glossaries
@return array | [
"Fetch",
"concepts",
"for",
"given",
"glossaries",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/local/concept_cache.php#L100-L146 |
220,274 | moodle/moodle | mod/glossary/classes/local/concept_cache.php | concept_cache.get_course_concepts | protected static function get_course_concepts($courseid) {
global $DB;
if (empty($courseid)) {
return array(array(), array());
}
$courseid = (int)$courseid;
// Get info on any glossaries in this course.
$modinfo = get_fast_modinfo($courseid);
$cminf... | php | protected static function get_course_concepts($courseid) {
global $DB;
if (empty($courseid)) {
return array(array(), array());
}
$courseid = (int)$courseid;
// Get info on any glossaries in this course.
$modinfo = get_fast_modinfo($courseid);
$cminf... | [
"protected",
"static",
"function",
"get_course_concepts",
"(",
"$",
"courseid",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"courseid",
")",
")",
"{",
"return",
"array",
"(",
"array",
"(",
")",
",",
"array",
"(",
")",
")",
";",
... | Get all linked concepts from course.
@param int $courseid
@return array | [
"Get",
"all",
"linked",
"concepts",
"from",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/local/concept_cache.php#L153-L227 |
220,275 | moodle/moodle | mod/glossary/classes/local/concept_cache.php | concept_cache.get_global_concepts | protected static function get_global_concepts() {
global $DB;
$cache = \cache::make('mod_glossary', 'concepts');
$data = $cache->get(0);
if (is_array($data)) {
list($glossaries, $allconcepts) = $data;
} else {
// Find all global glossaries - no access co... | php | protected static function get_global_concepts() {
global $DB;
$cache = \cache::make('mod_glossary', 'concepts');
$data = $cache->get(0);
if (is_array($data)) {
list($glossaries, $allconcepts) = $data;
} else {
// Find all global glossaries - no access co... | [
"protected",
"static",
"function",
"get_global_concepts",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"cache",
"=",
"\\",
"cache",
"::",
"make",
"(",
"'mod_glossary'",
",",
"'concepts'",
")",
";",
"$",
"data",
"=",
"$",
"cache",
"->",
"get",
"(",
"0"... | Get all linked global concepts.
@return array | [
"Get",
"all",
"linked",
"global",
"concepts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/local/concept_cache.php#L233-L271 |
220,276 | moodle/moodle | mod/glossary/classes/local/concept_cache.php | concept_cache.get_concepts | public static function get_concepts($courseid) {
list($glossaries, $concepts) = self::get_course_concepts($courseid);
list($globalglossaries, $globalconcepts) = self::get_global_concepts();
foreach ($globalconcepts as $gid => $cs) {
if (!isset($concepts[$gid])) {
$co... | php | public static function get_concepts($courseid) {
list($glossaries, $concepts) = self::get_course_concepts($courseid);
list($globalglossaries, $globalconcepts) = self::get_global_concepts();
foreach ($globalconcepts as $gid => $cs) {
if (!isset($concepts[$gid])) {
$co... | [
"public",
"static",
"function",
"get_concepts",
"(",
"$",
"courseid",
")",
"{",
"list",
"(",
"$",
"glossaries",
",",
"$",
"concepts",
")",
"=",
"self",
"::",
"get_course_concepts",
"(",
"$",
"courseid",
")",
";",
"list",
"(",
"$",
"globalglossaries",
",",
... | Get all concepts that should be linked in the given course.
@param int $courseid
@return array with two elements - array of glossaries and concepts for each glossary | [
"Get",
"all",
"concepts",
"that",
"should",
"be",
"linked",
"in",
"the",
"given",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/local/concept_cache.php#L278-L294 |
220,277 | moodle/moodle | lib/pear/HTML/QuickForm/Rule/Regex.php | HTML_QuickForm_Rule_Regex.validate | function validate($value, $regex = null)
{
if (isset($this->_data[$this->name])) {
if (!preg_match($this->_data[$this->name], $value)) {
return false;
}
} else {
if (!preg_match($regex, $value)) {
return false;
}
... | php | function validate($value, $regex = null)
{
if (isset($this->_data[$this->name])) {
if (!preg_match($this->_data[$this->name], $value)) {
return false;
}
} else {
if (!preg_match($regex, $value)) {
return false;
}
... | [
"function",
"validate",
"(",
"$",
"value",
",",
"$",
"regex",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"$",
"this",
"->",
"name",
"]",
")",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"$",
"this",
"->",
... | Validates a value using a regular expression
@param string $value Value to be checked
@param string $regex Regular expression
@access public
@return boolean true if value is valid | [
"Validates",
"a",
"value",
"using",
"a",
"regular",
"expression"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/Rule/Regex.php#L54-L66 |
220,278 | moodle/moodle | admin/tool/dataprivacy/classes/form/contextlevel.php | contextlevel.get_contextlevel_customdata | public static function get_contextlevel_customdata($contextlevel) {
$persistent = \tool_dataprivacy\contextlevel::get_record_by_contextlevel($contextlevel, false);
if (!$persistent) {
$persistent = new \tool_dataprivacy\contextlevel();
$persistent->set('contextlevel', $contextle... | php | public static function get_contextlevel_customdata($contextlevel) {
$persistent = \tool_dataprivacy\contextlevel::get_record_by_contextlevel($contextlevel, false);
if (!$persistent) {
$persistent = new \tool_dataprivacy\contextlevel();
$persistent->set('contextlevel', $contextle... | [
"public",
"static",
"function",
"get_contextlevel_customdata",
"(",
"$",
"contextlevel",
")",
"{",
"$",
"persistent",
"=",
"\\",
"tool_dataprivacy",
"\\",
"contextlevel",
"::",
"get_record_by_contextlevel",
"(",
"$",
"contextlevel",
",",
"false",
")",
";",
"if",
"... | Returns the customdata array for the provided context level.
@param int $contextlevel
@return array | [
"Returns",
"the",
"customdata",
"array",
"for",
"the",
"provided",
"context",
"level",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/form/contextlevel.php#L68-L123 |
220,279 | moodle/moodle | mod/assign/feedback/editpdf/backup/moodle2/restore_assignfeedback_editpdf_subplugin.class.php | restore_assignfeedback_editpdf_subplugin.process_assignfeedback_editpdf_files | public function process_assignfeedback_editpdf_files($data) {
$data = (object)$data;
// In this case the id is the old gradeid which will be mapped.
$this->add_related_files('assignfeedback_editpdf',
\assignfeedback_editpdf\document_services::FINAL_PDF_FILEAREA, 'grade', null, $data... | php | public function process_assignfeedback_editpdf_files($data) {
$data = (object)$data;
// In this case the id is the old gradeid which will be mapped.
$this->add_related_files('assignfeedback_editpdf',
\assignfeedback_editpdf\document_services::FINAL_PDF_FILEAREA, 'grade', null, $data... | [
"public",
"function",
"process_assignfeedback_editpdf_files",
"(",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"(",
"object",
")",
"$",
"data",
";",
"// In this case the id is the old gradeid which will be mapped.",
"$",
"this",
"->",
"add_related_files",
"(",
"'assignfeed... | Processes one feedback_editpdf_files element
@param mixed $data | [
"Processes",
"one",
"feedback_editpdf_files",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/backup/moodle2/restore_assignfeedback_editpdf_subplugin.class.php#L72-L81 |
220,280 | moodle/moodle | lib/horde/framework/Horde/Array.php | Horde_Array.arraySort | public static function arraySort(array &$array, $key = null, $dir = 0,
$assoc = true)
{
/* Return if the array is empty. */
if (empty($array)) {
return;
}
/* If no key to sort by is specified, use the first key of the
* first... | php | public static function arraySort(array &$array, $key = null, $dir = 0,
$assoc = true)
{
/* Return if the array is empty. */
if (empty($array)) {
return;
}
/* If no key to sort by is specified, use the first key of the
* first... | [
"public",
"static",
"function",
"arraySort",
"(",
"array",
"&",
"$",
"array",
",",
"$",
"key",
"=",
"null",
",",
"$",
"dir",
"=",
"0",
",",
"$",
"assoc",
"=",
"true",
")",
"{",
"/* Return if the array is empty. */",
"if",
"(",
"empty",
"(",
"$",
"array... | Sorts an array on a specified key. If the key does not exist,
defaults to the first key of the array.
@param array &$array The array to be sorted, passed by reference.
@param string $key The key by which to sort. If not specified then
the first key is used.
@param integer $dir Sort direction:
0 = ascending (d... | [
"Sorts",
"an",
"array",
"on",
"a",
"specified",
"key",
".",
"If",
"the",
"key",
"does",
"not",
"exist",
"defaults",
"to",
"the",
"first",
"key",
"of",
"the",
"array",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Array.php#L31-L55 |
220,281 | moodle/moodle | lib/horde/framework/Horde/Array.php | Horde_Array.getElement | public static function getElement(&$array, array &$keys, $value = null)
{
if (count($keys)) {
$key = array_shift($keys);
return isset($array[$key])
? self::getElement($array[$key], $keys, $value)
: false;
}
if (!is_null($value)) {
... | php | public static function getElement(&$array, array &$keys, $value = null)
{
if (count($keys)) {
$key = array_shift($keys);
return isset($array[$key])
? self::getElement($array[$key], $keys, $value)
: false;
}
if (!is_null($value)) {
... | [
"public",
"static",
"function",
"getElement",
"(",
"&",
"$",
"array",
",",
"array",
"&",
"$",
"keys",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"keys",
")",
")",
"{",
"$",
"key",
"=",
"array_shift",
"(",
"$",
"keys",... | Using an array of keys iterate through the array following the
keys to find the final key value. If a value is passed then set
that value.
@param array &$array The array to be used.
@param array &$keys The key path to follow as an array.
@param array $value If set the target element will have this value set
to it... | [
"Using",
"an",
"array",
"of",
"keys",
"iterate",
"through",
"the",
"array",
"following",
"the",
"keys",
"to",
"find",
"the",
"final",
"key",
"value",
".",
"If",
"a",
"value",
"is",
"passed",
"then",
"set",
"that",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Array.php#L92-L106 |
220,282 | moodle/moodle | lib/horde/framework/Horde/Array.php | Horde_Array.getRectangle | public static function getRectangle(array $array, $row, $col, $height,
$width)
{
$rec = array();
for ($y = $row; $y < $row + $height; $y++) {
$rec[] = array_slice($array[$y], $col, $width);
}
return $rec;
} | php | public static function getRectangle(array $array, $row, $col, $height,
$width)
{
$rec = array();
for ($y = $row; $y < $row + $height; $y++) {
$rec[] = array_slice($array[$y], $col, $width);
}
return $rec;
} | [
"public",
"static",
"function",
"getRectangle",
"(",
"array",
"$",
"array",
",",
"$",
"row",
",",
"$",
"col",
",",
"$",
"height",
",",
"$",
"width",
")",
"{",
"$",
"rec",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"y",
"=",
"$",
"row",
";",
... | Returns a rectangle of a two-dimensional array.
@param array $array The array to extract the rectangle from.
@param integer $row The start row of the rectangle.
@param integer $col The start column of the rectangle.
@param integer $height The height of the rectangle.
@param integer $width The width of t... | [
"Returns",
"a",
"rectangle",
"of",
"a",
"two",
"-",
"dimensional",
"array",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Array.php#L119-L127 |
220,283 | moodle/moodle | backup/util/plan/restore_structure_step.class.php | restore_structure_step.process | final public function process($data) {
if (!array_key_exists($data['path'], $this->pathelements)) { // Incorrect path, must not happen
throw new restore_step_exception('restore_structure_step_missing_path', $data['path']);
}
$element = $this->pathelements[$data['path']];
$obj... | php | final public function process($data) {
if (!array_key_exists($data['path'], $this->pathelements)) { // Incorrect path, must not happen
throw new restore_step_exception('restore_structure_step_missing_path', $data['path']);
}
$element = $this->pathelements[$data['path']];
$obj... | [
"final",
"public",
"function",
"process",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"data",
"[",
"'path'",
"]",
",",
"$",
"this",
"->",
"pathelements",
")",
")",
"{",
"// Incorrect path, must not happen",
"throw",
"new",
"re... | Receive one chunk of information form the xml parser processor and
dispatch it, following the naming rules | [
"Receive",
"one",
"chunk",
"of",
"information",
"form",
"the",
"xml",
"parser",
"processor",
"and",
"dispatch",
"it",
"following",
"the",
"naming",
"rules"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/plan/restore_structure_step.class.php#L121-L156 |
220,284 | moodle/moodle | backup/util/plan/restore_structure_step.class.php | restore_structure_step.add_plugin_structure | protected function add_plugin_structure($plugintype, $element) {
global $CFG;
// Check the requested plugintype is a valid one
if (!array_key_exists($plugintype, core_component::get_plugin_types($plugintype))) {
throw new restore_step_exception('incorrect_plugin_type', $plugintype... | php | protected function add_plugin_structure($plugintype, $element) {
global $CFG;
// Check the requested plugintype is a valid one
if (!array_key_exists($plugintype, core_component::get_plugin_types($plugintype))) {
throw new restore_step_exception('incorrect_plugin_type', $plugintype... | [
"protected",
"function",
"add_plugin_structure",
"(",
"$",
"plugintype",
",",
"$",
"element",
")",
"{",
"global",
"$",
"CFG",
";",
"// Check the requested plugintype is a valid one",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"plugintype",
",",
"core_component",
... | Add plugin structure to any element in the structure restore tree
@param string $plugintype type of plugin as defined by core_component::get_plugin_types()
@param restore_path_element $element element in the structure restore tree that
we are going to add plugin information to | [
"Add",
"plugin",
"structure",
"to",
"any",
"element",
"in",
"the",
"structure",
"restore",
"tree"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/plan/restore_structure_step.class.php#L266-L295 |
220,285 | moodle/moodle | backup/util/plan/restore_structure_step.class.php | restore_structure_step.add_subplugin_structure | protected function add_subplugin_structure($subplugintype, $element, $plugintype = null, $pluginname = null) {
global $CFG;
// This global declaration is required, because where we do require_once($backupfile);
// That file may in turn try to do require_once($CFG->dirroot ...).
// That w... | php | protected function add_subplugin_structure($subplugintype, $element, $plugintype = null, $pluginname = null) {
global $CFG;
// This global declaration is required, because where we do require_once($backupfile);
// That file may in turn try to do require_once($CFG->dirroot ...).
// That w... | [
"protected",
"function",
"add_subplugin_structure",
"(",
"$",
"subplugintype",
",",
"$",
"element",
",",
"$",
"plugintype",
"=",
"null",
",",
"$",
"pluginname",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"// This global declaration is required, because where ... | Add subplugin structure for a given plugin to any element in the structure restore tree
This method allows the injection of subplugins (of a specific plugin) parsing and proccessing
to any element in the restore structure.
NOTE: Initially subplugins were only available for activities (mod), so only the
{@link restore... | [
"Add",
"subplugin",
"structure",
"for",
"a",
"given",
"plugin",
"to",
"any",
"element",
"in",
"the",
"structure",
"restore",
"tree"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/plan/restore_structure_step.class.php#L315-L369 |
220,286 | moodle/moodle | backup/util/plan/restore_structure_step.class.php | restore_structure_step.launch_after_execute_methods | protected function launch_after_execute_methods() {
$alreadylaunched = array(); // To avoid multiple executions
foreach ($this->pathelements as $key => $pathelement) {
// Get the processing object
$pobject = $pathelement->get_processing_object();
// Skip null processo... | php | protected function launch_after_execute_methods() {
$alreadylaunched = array(); // To avoid multiple executions
foreach ($this->pathelements as $key => $pathelement) {
// Get the processing object
$pobject = $pathelement->get_processing_object();
// Skip null processo... | [
"protected",
"function",
"launch_after_execute_methods",
"(",
")",
"{",
"$",
"alreadylaunched",
"=",
"array",
"(",
")",
";",
"// To avoid multiple executions",
"foreach",
"(",
"$",
"this",
"->",
"pathelements",
"as",
"$",
"key",
"=>",
"$",
"pathelement",
")",
"{... | Launch all the after_execute methods present in all the processing objects
This method will launch all the after_execute methods that can be defined
both in restore_plugin and restore_structure_step classes
For restore_plugin classes the name of the method to be executed will be
"after_execute_" + connection point (a... | [
"Launch",
"all",
"the",
"after_execute",
"methods",
"present",
"in",
"all",
"the",
"processing",
"objects"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/plan/restore_structure_step.class.php#L384-L412 |
220,287 | moodle/moodle | backup/util/plan/restore_structure_step.class.php | restore_structure_step.launch_after_restore_methods | public function launch_after_restore_methods() {
$alreadylaunched = array(); // To avoid multiple executions
foreach ($this->pathelements as $pathelement) {
// Get the processing object
$pobject = $pathelement->get_processing_object();
// Skip null processors (child o... | php | public function launch_after_restore_methods() {
$alreadylaunched = array(); // To avoid multiple executions
foreach ($this->pathelements as $pathelement) {
// Get the processing object
$pobject = $pathelement->get_processing_object();
// Skip null processors (child o... | [
"public",
"function",
"launch_after_restore_methods",
"(",
")",
"{",
"$",
"alreadylaunched",
"=",
"array",
"(",
")",
";",
"// To avoid multiple executions",
"foreach",
"(",
"$",
"this",
"->",
"pathelements",
"as",
"$",
"pathelement",
")",
"{",
"// Get the processing... | Launch all the after_restore methods present in all the processing objects
This method will launch all the after_restore methods that can be defined
both in restore_plugin class
For restore_plugin classes the name of the method to be executed will be
"after_restore_" + connection point (as far as can be multiple conn... | [
"Launch",
"all",
"the",
"after_restore",
"methods",
"present",
"in",
"all",
"the",
"processing",
"objects"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/plan/restore_structure_step.class.php#L424-L451 |
220,288 | moodle/moodle | backup/util/plan/restore_structure_step.class.php | restore_structure_step.prepare_pathelements | protected function prepare_pathelements($elementsarr) {
// First iteration, push them to new array, indexed by name
// detecting duplicates in names or paths
$names = array();
$paths = array();
foreach($elementsarr as $element) {
if (!$element instanceof restore_path... | php | protected function prepare_pathelements($elementsarr) {
// First iteration, push them to new array, indexed by name
// detecting duplicates in names or paths
$names = array();
$paths = array();
foreach($elementsarr as $element) {
if (!$element instanceof restore_path... | [
"protected",
"function",
"prepare_pathelements",
"(",
"$",
"elementsarr",
")",
"{",
"// First iteration, push them to new array, indexed by name",
"// detecting duplicates in names or paths",
"$",
"names",
"=",
"array",
"(",
")",
";",
"$",
"paths",
"=",
"array",
"(",
")",... | Prepare the pathelements for processing, looking for duplicates, applying
processing objects and other adjustments | [
"Prepare",
"the",
"pathelements",
"for",
"processing",
"looking",
"for",
"duplicates",
"applying",
"processing",
"objects",
"and",
"other",
"adjustments"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/plan/restore_structure_step.class.php#L478-L510 |
220,289 | moodle/moodle | backup/util/plan/restore_structure_step.class.php | restore_structure_step.grouped_parent_exists | protected function grouped_parent_exists($pelement, $elements) {
foreach ($elements as $element) {
if ($pelement->get_path() == $element->get_path()) {
continue; // Don't compare against itself
}
// If element is grouped and parent of pelement, return true
... | php | protected function grouped_parent_exists($pelement, $elements) {
foreach ($elements as $element) {
if ($pelement->get_path() == $element->get_path()) {
continue; // Don't compare against itself
}
// If element is grouped and parent of pelement, return true
... | [
"protected",
"function",
"grouped_parent_exists",
"(",
"$",
"pelement",
",",
"$",
"elements",
")",
"{",
"foreach",
"(",
"$",
"elements",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"pelement",
"->",
"get_path",
"(",
")",
"==",
"$",
"element",
"->",
... | Given one pathelement, return true if grouped parent was found | [
"Given",
"one",
"pathelement",
"return",
"true",
"if",
"grouped",
"parent",
"was",
"found"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/plan/restore_structure_step.class.php#L515-L526 |
220,290 | moodle/moodle | lib/ltiprovider/src/ToolProvider/ToolProvider.php | ToolProvider.doToolProxyService | public function doToolProxyService()
{
// Create tool proxy
$toolProxyService = $this->findService('application/vnd.ims.lti.v2.toolproxy+json', array('POST'));
$secret = DataConnector::getRandomString(12);
$toolProxy = new MediaType\ToolProxy($this, $toolProxyService, $secret);
$htt... | php | public function doToolProxyService()
{
// Create tool proxy
$toolProxyService = $this->findService('application/vnd.ims.lti.v2.toolproxy+json', array('POST'));
$secret = DataConnector::getRandomString(12);
$toolProxy = new MediaType\ToolProxy($this, $toolProxyService, $secret);
$htt... | [
"public",
"function",
"doToolProxyService",
"(",
")",
"{",
"// Create tool proxy",
"$",
"toolProxyService",
"=",
"$",
"this",
"->",
"findService",
"(",
"'application/vnd.ims.lti.v2.toolproxy+json'",
",",
"array",
"(",
"'POST'",
")",
")",
";",
"$",
"secret",
"=",
"... | Send the tool proxy to the Tool Consumer
@return boolean True if the tool proxy was accepted | [
"Send",
"the",
"tool",
"proxy",
"to",
"the",
"Tool",
"Consumer"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ltiprovider/src/ToolProvider/ToolProvider.php#L423-L441 |
220,291 | moodle/moodle | lib/ltiprovider/src/ToolProvider/ToolProvider.php | ToolProvider.checkValue | private function checkValue($value, $values, $reason)
{
$ok = in_array($value, $values);
if (!$ok && !empty($reason)) {
$this->reason = sprintf($reason, $value);
}
return $ok;
} | php | private function checkValue($value, $values, $reason)
{
$ok = in_array($value, $values);
if (!$ok && !empty($reason)) {
$this->reason = sprintf($reason, $value);
}
return $ok;
} | [
"private",
"function",
"checkValue",
"(",
"$",
"value",
",",
"$",
"values",
",",
"$",
"reason",
")",
"{",
"$",
"ok",
"=",
"in_array",
"(",
"$",
"value",
",",
"$",
"values",
")",
";",
"if",
"(",
"!",
"$",
"ok",
"&&",
"!",
"empty",
"(",
"$",
"rea... | Validate a parameter value from an array of permitted values.
@return boolean True if value is valid | [
"Validate",
"a",
"parameter",
"value",
"from",
"an",
"array",
"of",
"permitted",
"values",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ltiprovider/src/ToolProvider/ToolProvider.php#L1261-L1271 |
220,292 | moodle/moodle | blocks/section_links/block_section_links.php | block_section_links.get_content | public function get_content() {
// The config should be loaded by now.
// If its empty then we will use the global config for the section links block.
if (isset($this->config)){
$config = $this->config;
} else{
$config = get_config('block_section_links');
... | php | public function get_content() {
// The config should be loaded by now.
// If its empty then we will use the global config for the section links block.
if (isset($this->config)){
$config = $this->config;
} else{
$config = get_config('block_section_links');
... | [
"public",
"function",
"get_content",
"(",
")",
"{",
"// The config should be loaded by now.",
"// If its empty then we will use the global config for the section links block.",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"config",
")",
")",
"{",
"$",
"config",
"=",
"$",
... | Generates the content of the block and returns it.
If the content has already been generated then the previously generated content is returned.
@return stdClass | [
"Generates",
"the",
"content",
"of",
"the",
"block",
"and",
"returns",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/section_links/block_section_links.php#L60-L139 |
220,293 | moodle/moodle | lib/classes/event/user_info_field_deleted.php | user_info_field_deleted.create_from_field | public static function create_from_field($field) {
$event = self::create(array(
'objectid' => $field->id,
'context' => \context_system::instance(),
'other' => array(
'shortname' => $field->shortname,
'name' => $field->name,
... | php | public static function create_from_field($field) {
$event = self::create(array(
'objectid' => $field->id,
'context' => \context_system::instance(),
'other' => array(
'shortname' => $field->shortname,
'name' => $field->name,
... | [
"public",
"static",
"function",
"create_from_field",
"(",
"$",
"field",
")",
"{",
"$",
"event",
"=",
"self",
"::",
"create",
"(",
"array",
"(",
"'objectid'",
"=>",
"$",
"field",
"->",
"id",
",",
"'context'",
"=>",
"\\",
"context_system",
"::",
"instance",
... | Creates an event from a profile field.
@since Moodle 3.4
@param \stdClass $field A snapshot of the deleted field.
@return \core\event\base | [
"Creates",
"an",
"event",
"from",
"a",
"profile",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/event/user_info_field_deleted.php#L62-L76 |
220,294 | moodle/moodle | lib/phpexcel/PHPExcel.php | PHPExcel.setMacrosCode | public function setMacrosCode($MacrosCode = null)
{
$this->macrosCode=$MacrosCode;
$this->setHasMacros(!is_null($MacrosCode));
} | php | public function setMacrosCode($MacrosCode = null)
{
$this->macrosCode=$MacrosCode;
$this->setHasMacros(!is_null($MacrosCode));
} | [
"public",
"function",
"setMacrosCode",
"(",
"$",
"MacrosCode",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"macrosCode",
"=",
"$",
"MacrosCode",
";",
"$",
"this",
"->",
"setHasMacros",
"(",
"!",
"is_null",
"(",
"$",
"MacrosCode",
")",
")",
";",
"}"
] | Set the macros code
@param string $MacrosCode string|null | [
"Set",
"the",
"macros",
"code"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel.php#L166-L170 |
220,295 | moodle/moodle | lib/phpexcel/PHPExcel.php | PHPExcel.getIndex | public function getIndex(PHPExcel_Worksheet $pSheet)
{
foreach ($this->workSheetCollection as $key => $value) {
if ($value->getHashCode() == $pSheet->getHashCode()) {
return $key;
}
}
throw new PHPExcel_Exception("Sheet does not exist.");
} | php | public function getIndex(PHPExcel_Worksheet $pSheet)
{
foreach ($this->workSheetCollection as $key => $value) {
if ($value->getHashCode() == $pSheet->getHashCode()) {
return $key;
}
}
throw new PHPExcel_Exception("Sheet does not exist.");
} | [
"public",
"function",
"getIndex",
"(",
"PHPExcel_Worksheet",
"$",
"pSheet",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"workSheetCollection",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"->",
"getHashCode",
"(",
")",
"==",
... | Get index for sheet
@param PHPExcel_Worksheet $pSheet
@return Sheet index
@throws PHPExcel_Exception | [
"Get",
"index",
"for",
"sheet"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel.php#L627-L636 |
220,296 | moodle/moodle | lib/phpexcel/PHPExcel.php | PHPExcel.setIndexByName | public function setIndexByName($sheetName, $newIndex)
{
$oldIndex = $this->getIndex($this->getSheetByName($sheetName));
$pSheet = array_splice(
$this->workSheetCollection,
$oldIndex,
1
);
array_splice(
$this->workSheetCollection,
... | php | public function setIndexByName($sheetName, $newIndex)
{
$oldIndex = $this->getIndex($this->getSheetByName($sheetName));
$pSheet = array_splice(
$this->workSheetCollection,
$oldIndex,
1
);
array_splice(
$this->workSheetCollection,
... | [
"public",
"function",
"setIndexByName",
"(",
"$",
"sheetName",
",",
"$",
"newIndex",
")",
"{",
"$",
"oldIndex",
"=",
"$",
"this",
"->",
"getIndex",
"(",
"$",
"this",
"->",
"getSheetByName",
"(",
"$",
"sheetName",
")",
")",
";",
"$",
"pSheet",
"=",
"arr... | Set index for sheet by sheet name.
@param string $sheetName Sheet name to modify index for
@param int $newIndex New index for the sheet
@return New sheet index
@throws PHPExcel_Exception | [
"Set",
"index",
"for",
"sheet",
"by",
"sheet",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel.php#L646-L661 |
220,297 | moodle/moodle | lib/phpexcel/PHPExcel.php | PHPExcel.setActiveSheetIndexByName | public function setActiveSheetIndexByName($pValue = '')
{
if (($worksheet = $this->getSheetByName($pValue)) instanceof PHPExcel_Worksheet) {
$this->setActiveSheetIndex($this->getIndex($worksheet));
return $worksheet;
}
throw new PHPExcel_Exception('Workbook does not ... | php | public function setActiveSheetIndexByName($pValue = '')
{
if (($worksheet = $this->getSheetByName($pValue)) instanceof PHPExcel_Worksheet) {
$this->setActiveSheetIndex($this->getIndex($worksheet));
return $worksheet;
}
throw new PHPExcel_Exception('Workbook does not ... | [
"public",
"function",
"setActiveSheetIndexByName",
"(",
"$",
"pValue",
"=",
"''",
")",
"{",
"if",
"(",
"(",
"$",
"worksheet",
"=",
"$",
"this",
"->",
"getSheetByName",
"(",
"$",
"pValue",
")",
")",
"instanceof",
"PHPExcel_Worksheet",
")",
"{",
"$",
"this",... | Set active sheet index by name
@param string $pValue Sheet title
@return PHPExcel_Worksheet
@throws PHPExcel_Exception | [
"Set",
"active",
"sheet",
"index",
"by",
"name"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel.php#L711-L719 |
220,298 | moodle/moodle | lib/phpexcel/PHPExcel.php | PHPExcel.getSheetNames | public function getSheetNames()
{
$returnValue = array();
$worksheetCount = $this->getSheetCount();
for ($i = 0; $i < $worksheetCount; ++$i) {
$returnValue[] = $this->getSheet($i)->getTitle();
}
return $returnValue;
} | php | public function getSheetNames()
{
$returnValue = array();
$worksheetCount = $this->getSheetCount();
for ($i = 0; $i < $worksheetCount; ++$i) {
$returnValue[] = $this->getSheet($i)->getTitle();
}
return $returnValue;
} | [
"public",
"function",
"getSheetNames",
"(",
")",
"{",
"$",
"returnValue",
"=",
"array",
"(",
")",
";",
"$",
"worksheetCount",
"=",
"$",
"this",
"->",
"getSheetCount",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"workshee... | Get sheet names
@return string[] | [
"Get",
"sheet",
"names"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel.php#L726-L735 |
220,299 | moodle/moodle | lib/phpexcel/PHPExcel.php | PHPExcel.addExternalSheet | public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null)
{
if ($this->sheetNameExists($pSheet->getTitle())) {
throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
}
// coun... | php | public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null)
{
if ($this->sheetNameExists($pSheet->getTitle())) {
throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
}
// coun... | [
"public",
"function",
"addExternalSheet",
"(",
"PHPExcel_Worksheet",
"$",
"pSheet",
",",
"$",
"iSheetIndex",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"sheetNameExists",
"(",
"$",
"pSheet",
"->",
"getTitle",
"(",
")",
")",
")",
"{",
"throw",
"... | Add external sheet
@param PHPExcel_Worksheet $pSheet External sheet to add
@param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
@throws PHPExcel_Exception
@return PHPExcel_Worksheet | [
"Add",
"external",
"sheet"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel.php#L745-L769 |
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.