id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
215,500 | moodle/moodle | message/classes/task/migrate_message_data.php | migrate_message_data.migrate_data | private function migrate_data($userid, $otheruserid) {
global $DB;
if ($userid == $otheruserid) {
// Since 3.7, pending self-conversations should be migrated during the upgrading process so shouldn't be any
// self-conversations on the legacy tables. However, this extra-check ha... | php | private function migrate_data($userid, $otheruserid) {
global $DB;
if ($userid == $otheruserid) {
// Since 3.7, pending self-conversations should be migrated during the upgrading process so shouldn't be any
// self-conversations on the legacy tables. However, this extra-check ha... | [
"private",
"function",
"migrate_data",
"(",
"$",
"userid",
",",
"$",
"otheruserid",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"userid",
"==",
"$",
"otheruserid",
")",
"{",
"// Since 3.7, pending self-conversations should be migrated during the upgrading proc... | Helper function to deal with migrating the data.
@param int $userid The current user id.
@param int $otheruserid The user id of the other user in the conversation.
@throws \dml_exception | [
"Helper",
"function",
"to",
"deal",
"with",
"migrating",
"the",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/task/migrate_message_data.php#L122-L176 |
215,501 | moodle/moodle | message/classes/task/migrate_message_data.php | migrate_message_data.migrate_notification | private function migrate_notification($notification, $isread) {
global $DB;
$tabledata = new \stdClass();
$tabledata->useridfrom = $notification->useridfrom;
$tabledata->useridto = $notification->useridto;
$tabledata->subject = $notification->subject;
$tabledata->fullmes... | php | private function migrate_notification($notification, $isread) {
global $DB;
$tabledata = new \stdClass();
$tabledata->useridfrom = $notification->useridfrom;
$tabledata->useridto = $notification->useridto;
$tabledata->subject = $notification->subject;
$tabledata->fullmes... | [
"private",
"function",
"migrate_notification",
"(",
"$",
"notification",
",",
"$",
"isread",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"tabledata",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"tabledata",
"->",
"useridfrom",
"=",
"$",
"notification",
... | Helper function to deal with migrating an individual notification.
@param \stdClass $notification
@param bool $isread Was the notification read?
@throws \dml_exception | [
"Helper",
"function",
"to",
"deal",
"with",
"migrating",
"an",
"individual",
"notification",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/task/migrate_message_data.php#L185-L213 |
215,502 | moodle/moodle | message/classes/task/migrate_message_data.php | migrate_message_data.migrate_message | private function migrate_message($conversationid, $message) {
global $DB;
// Create the object we will be inserting into the database.
$tabledata = new \stdClass();
$tabledata->useridfrom = $message->useridfrom;
$tabledata->conversationid = $conversationid;
$tabledata->s... | php | private function migrate_message($conversationid, $message) {
global $DB;
// Create the object we will be inserting into the database.
$tabledata = new \stdClass();
$tabledata->useridfrom = $message->useridfrom;
$tabledata->conversationid = $conversationid;
$tabledata->s... | [
"private",
"function",
"migrate_message",
"(",
"$",
"conversationid",
",",
"$",
"message",
")",
"{",
"global",
"$",
"DB",
";",
"// Create the object we will be inserting into the database.",
"$",
"tabledata",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"tabl... | Helper function to deal with migrating an individual message.
@param int $conversationid The conversation between the two users.
@param \stdClass $message The message from either the 'message' or 'message_read' table
@throws \dml_exception | [
"Helper",
"function",
"to",
"deal",
"with",
"migrating",
"an",
"individual",
"message",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/task/migrate_message_data.php#L222-L271 |
215,503 | moodle/moodle | message/classes/task/migrate_message_data.php | migrate_message_data.queue_task | public static function queue_task($userid) {
// Let's set up the adhoc task.
$task = new \core_message\task\migrate_message_data();
$task->set_custom_data(
[
'userid' => $userid
]
);
// Queue it.
\core\task\manager::queue_adhoc_tas... | php | public static function queue_task($userid) {
// Let's set up the adhoc task.
$task = new \core_message\task\migrate_message_data();
$task->set_custom_data(
[
'userid' => $userid
]
);
// Queue it.
\core\task\manager::queue_adhoc_tas... | [
"public",
"static",
"function",
"queue_task",
"(",
"$",
"userid",
")",
"{",
"// Let's set up the adhoc task.",
"$",
"task",
"=",
"new",
"\\",
"core_message",
"\\",
"task",
"\\",
"migrate_message_data",
"(",
")",
";",
"$",
"task",
"->",
"set_custom_data",
"(",
... | Queues the task.
@param int $userid | [
"Queues",
"the",
"task",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/task/migrate_message_data.php#L278-L289 |
215,504 | moodle/moodle | admin/tool/policy/classes/policy_exporter.php | policy_exporter.define_other_properties | protected static function define_other_properties() {
return [
'currentversion' => [
'type' => policy_version_exporter::read_properties_definition(),
'null' => NULL_ALLOWED,
],
'draftversions' => [
'type' => policy_version_expor... | php | protected static function define_other_properties() {
return [
'currentversion' => [
'type' => policy_version_exporter::read_properties_definition(),
'null' => NULL_ALLOWED,
],
'draftversions' => [
'type' => policy_version_expor... | [
"protected",
"static",
"function",
"define_other_properties",
"(",
")",
"{",
"return",
"[",
"'currentversion'",
"=>",
"[",
"'type'",
"=>",
"policy_version_exporter",
"::",
"read_properties_definition",
"(",
")",
",",
"'null'",
"=>",
"NULL_ALLOWED",
",",
"]",
",",
... | Return the list of additional, generated dynamically from the given properties.
@return array | [
"Return",
"the",
"list",
"of",
"additional",
"generated",
"dynamically",
"from",
"the",
"given",
"properties",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/policy_exporter.php#L77-L92 |
215,505 | moodle/moodle | backup/util/helper/restore_decode_rule.class.php | restore_decode_rule.get_mapping | protected function get_mapping($itemname, $itemid) {
// Check restoreid is set
if (!$this->restoreid) {
throw new restore_decode_rule_exception('decode_rule_restoreid_not_set');
}
if (!$found = restore_dbops::get_backup_ids_record($this->restoreid, $itemname, $itemid)) {
... | php | protected function get_mapping($itemname, $itemid) {
// Check restoreid is set
if (!$this->restoreid) {
throw new restore_decode_rule_exception('decode_rule_restoreid_not_set');
}
if (!$found = restore_dbops::get_backup_ids_record($this->restoreid, $itemname, $itemid)) {
... | [
"protected",
"function",
"get_mapping",
"(",
"$",
"itemname",
",",
"$",
"itemid",
")",
"{",
"// Check restoreid is set",
"if",
"(",
"!",
"$",
"this",
"->",
"restoreid",
")",
"{",
"throw",
"new",
"restore_decode_rule_exception",
"(",
"'decode_rule_restoreid_not_set'"... | Looks for mapping values in backup_ids table, simple wrapper over get_backup_ids_record | [
"Looks",
"for",
"mapping",
"values",
"in",
"backup_ids",
"table",
"simple",
"wrapper",
"over",
"get_backup_ids_record"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/restore_decode_rule.class.php#L110-L119 |
215,506 | moodle/moodle | backup/util/helper/restore_decode_rule.class.php | restore_decode_rule.validate_params | protected function validate_params($linkname, $urltemplate, $mappings) {
// Check linkname is A-Z0-9
if (empty($linkname) || preg_match('/[^A-Z0-9]/', $linkname)) {
throw new restore_decode_rule_exception('decode_rule_incorrect_name', $linkname);
}
// Look urltemplate starts ... | php | protected function validate_params($linkname, $urltemplate, $mappings) {
// Check linkname is A-Z0-9
if (empty($linkname) || preg_match('/[^A-Z0-9]/', $linkname)) {
throw new restore_decode_rule_exception('decode_rule_incorrect_name', $linkname);
}
// Look urltemplate starts ... | [
"protected",
"function",
"validate_params",
"(",
"$",
"linkname",
",",
"$",
"urltemplate",
",",
"$",
"mappings",
")",
"{",
"// Check linkname is A-Z0-9",
"if",
"(",
"empty",
"(",
"$",
"linkname",
")",
"||",
"preg_match",
"(",
"'/[^A-Z0-9]/'",
",",
"$",
"linkna... | Perform all the validations and checks on the rule attributes | [
"Perform",
"all",
"the",
"validations",
"and",
"checks",
"on",
"the",
"rule",
"attributes"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/restore_decode_rule.class.php#L137-L172 |
215,507 | moodle/moodle | backup/util/helper/restore_decode_rule.class.php | restore_decode_rule.get_calculated_regexp | protected function get_calculated_regexp() {
$regexp = '/\$@' . $this->linkname;
foreach ($this->mappings as $key => $value) {
$regexp .= '\*(\d+)';
}
$regexp .= '@\$/';
return $regexp;
} | php | protected function get_calculated_regexp() {
$regexp = '/\$@' . $this->linkname;
foreach ($this->mappings as $key => $value) {
$regexp .= '\*(\d+)';
}
$regexp .= '@\$/';
return $regexp;
} | [
"protected",
"function",
"get_calculated_regexp",
"(",
")",
"{",
"$",
"regexp",
"=",
"'/\\$@'",
".",
"$",
"this",
"->",
"linkname",
";",
"foreach",
"(",
"$",
"this",
"->",
"mappings",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"regexp",
".=",... | based on rule definition, build the regular expression to execute on decode | [
"based",
"on",
"rule",
"definition",
"build",
"the",
"regular",
"expression",
"to",
"execute",
"on",
"decode"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/restore_decode_rule.class.php#L177-L184 |
215,508 | moodle/moodle | cache/stores/session/lib.php | session_data_store.flush_store | protected static function flush_store() {
$ids = array_keys(self::$sessionstore);
unset(self::$sessionstore);
self::$sessionstore = array();
foreach ($ids as $id) {
self::$sessionstore[$id] = array();
}
} | php | protected static function flush_store() {
$ids = array_keys(self::$sessionstore);
unset(self::$sessionstore);
self::$sessionstore = array();
foreach ($ids as $id) {
self::$sessionstore[$id] = array();
}
} | [
"protected",
"static",
"function",
"flush_store",
"(",
")",
"{",
"$",
"ids",
"=",
"array_keys",
"(",
"self",
"::",
"$",
"sessionstore",
")",
";",
"unset",
"(",
"self",
"::",
"$",
"sessionstore",
")",
";",
"self",
"::",
"$",
"sessionstore",
"=",
"array",
... | Flushes the store of all data. | [
"Flushes",
"the",
"store",
"of",
"all",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/session/lib.php#L77-L84 |
215,509 | moodle/moodle | cache/stores/session/lib.php | cachestore_session.has_any | public function has_any(array $keys) {
$maxtime = 0;
if ($this->ttl != 0) {
$maxtime = cache::now() - $this->ttl;
}
foreach ($keys as $key) {
if (isset($this->store[$key]) && ($this->ttl == 0 || $this->store[$key][1] >= $maxtime)) {
return true;
... | php | public function has_any(array $keys) {
$maxtime = 0;
if ($this->ttl != 0) {
$maxtime = cache::now() - $this->ttl;
}
foreach ($keys as $key) {
if (isset($this->store[$key]) && ($this->ttl == 0 || $this->store[$key][1] >= $maxtime)) {
return true;
... | [
"public",
"function",
"has_any",
"(",
"array",
"$",
"keys",
")",
"{",
"$",
"maxtime",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"ttl",
"!=",
"0",
")",
"{",
"$",
"maxtime",
"=",
"cache",
"::",
"now",
"(",
")",
"-",
"$",
"this",
"->",
"ttl",
... | Returns true if the store contains records for any of the given keys.
@param array $keys
@return bool | [
"Returns",
"true",
"if",
"the",
"store",
"contains",
"records",
"for",
"any",
"of",
"the",
"given",
"keys",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/session/lib.php#L403-L415 |
215,510 | moodle/moodle | cache/stores/session/lib.php | cachestore_session.check_ttl | protected function check_ttl() {
if ($this->ttl === 0) {
return 0;
}
$maxtime = cache::now() - $this->ttl;
$count = 0;
for ($value = reset($this->store); $value !== false; $value = next($this->store)) {
if ($value[1] >= $maxtime) {
// We kn... | php | protected function check_ttl() {
if ($this->ttl === 0) {
return 0;
}
$maxtime = cache::now() - $this->ttl;
$count = 0;
for ($value = reset($this->store); $value !== false; $value = next($this->store)) {
if ($value[1] >= $maxtime) {
// We kn... | [
"protected",
"function",
"check_ttl",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ttl",
"===",
"0",
")",
"{",
"return",
"0",
";",
"}",
"$",
"maxtime",
"=",
"cache",
"::",
"now",
"(",
")",
"-",
"$",
"this",
"->",
"ttl",
";",
"$",
"count",
"=",... | Removes expired elements.
@return int number of removed elements | [
"Removes",
"expired",
"elements",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/session/lib.php#L539-L560 |
215,511 | moodle/moodle | privacy/classes/manager.php | manager.get_null_provider_reason | public function get_null_provider_reason(string $component) : string {
if ($this->component_implements($component, null_provider::class)) {
$reason = $this->handled_component_class_callback($component, null_provider::class, 'get_reason', []);
return empty($reason) ? 'privacy:reason' : $r... | php | public function get_null_provider_reason(string $component) : string {
if ($this->component_implements($component, null_provider::class)) {
$reason = $this->handled_component_class_callback($component, null_provider::class, 'get_reason', []);
return empty($reason) ? 'privacy:reason' : $r... | [
"public",
"function",
"get_null_provider_reason",
"(",
"string",
"$",
"component",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"component_implements",
"(",
"$",
"component",
",",
"null_provider",
"::",
"class",
")",
")",
"{",
"$",
"reason",
"=",
... | Retrieve the reason for implementing the null provider interface.
@param string $component Frankenstyle component name.
@return string The key to retrieve the language string for the null provider reason. | [
"Retrieve",
"the",
"reason",
"for",
"implementing",
"the",
"null",
"provider",
"interface",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/manager.php#L168-L175 |
215,512 | moodle/moodle | privacy/classes/manager.php | manager.is_empty_subsystem | public static function is_empty_subsystem($component) {
if (strpos($component, 'core_') === 0) {
if (null === \core_component::get_subsystem_directory(substr($component, 5))) {
// This is a subsystem without a directory.
return true;
}
}
r... | php | public static function is_empty_subsystem($component) {
if (strpos($component, 'core_') === 0) {
if (null === \core_component::get_subsystem_directory(substr($component, 5))) {
// This is a subsystem without a directory.
return true;
}
}
r... | [
"public",
"static",
"function",
"is_empty_subsystem",
"(",
"$",
"component",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"component",
",",
"'core_'",
")",
"===",
"0",
")",
"{",
"if",
"(",
"null",
"===",
"\\",
"core_component",
"::",
"get_subsystem_directory",
... | Return whether this is an 'empty' subsystem - that is, a subsystem without a directory.
@param string $component Frankenstyle component name.
@return string The key to retrieve the language string for the null provider reason. | [
"Return",
"whether",
"this",
"is",
"an",
"empty",
"subsystem",
"-",
"that",
"is",
"a",
"subsystem",
"without",
"a",
"directory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/manager.php#L183-L192 |
215,513 | moodle/moodle | privacy/classes/manager.php | manager.get_metadata_for_components | public function get_metadata_for_components() : array {
// Get the metadata, and put into an assoc array indexed by component name.
$metadata = [];
foreach ($this->get_component_list() as $component) {
$componentmetadata = $this->handled_component_class_callback($component, metadata_... | php | public function get_metadata_for_components() : array {
// Get the metadata, and put into an assoc array indexed by component name.
$metadata = [];
foreach ($this->get_component_list() as $component) {
$componentmetadata = $this->handled_component_class_callback($component, metadata_... | [
"public",
"function",
"get_metadata_for_components",
"(",
")",
":",
"array",
"{",
"// Get the metadata, and put into an assoc array indexed by component name.",
"$",
"metadata",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"get_component_list",
"(",
")",
"as",... | Get the privacy metadata for all components.
@return collection[] The array of collection objects, indexed by frankenstyle component name. | [
"Get",
"the",
"privacy",
"metadata",
"for",
"all",
"components",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/manager.php#L199-L210 |
215,514 | moodle/moodle | privacy/classes/manager.php | manager.get_contexts_for_userid | public function get_contexts_for_userid(int $userid) : contextlist_collection {
$progress = static::get_log_tracer();
$components = $this->get_component_list();
$a = (object) [
'total' => count($components),
'progress' => 0,
'component' => '',
'da... | php | public function get_contexts_for_userid(int $userid) : contextlist_collection {
$progress = static::get_log_tracer();
$components = $this->get_component_list();
$a = (object) [
'total' => count($components),
'progress' => 0,
'component' => '',
'da... | [
"public",
"function",
"get_contexts_for_userid",
"(",
"int",
"$",
"userid",
")",
":",
"contextlist_collection",
"{",
"$",
"progress",
"=",
"static",
"::",
"get_log_tracer",
"(",
")",
";",
"$",
"components",
"=",
"$",
"this",
"->",
"get_component_list",
"(",
")... | Gets a collection of resultset objects for all components.
@param int $userid the id of the user we're fetching contexts for.
@return contextlist_collection the collection of contextlist items for the respective components. | [
"Gets",
"a",
"collection",
"of",
"resultset",
"objects",
"for",
"all",
"components",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/manager.php#L219-L257 |
215,515 | moodle/moodle | privacy/classes/manager.php | manager.get_users_in_context | public function get_users_in_context(\context $context) : \core_privacy\local\request\userlist_collection {
$progress = static::get_log_tracer();
$components = $this->get_component_list();
$a = (object) [
'total' => count($components),
'progress' => 0,
'compo... | php | public function get_users_in_context(\context $context) : \core_privacy\local\request\userlist_collection {
$progress = static::get_log_tracer();
$components = $this->get_component_list();
$a = (object) [
'total' => count($components),
'progress' => 0,
'compo... | [
"public",
"function",
"get_users_in_context",
"(",
"\\",
"context",
"$",
"context",
")",
":",
"\\",
"core_privacy",
"\\",
"local",
"\\",
"request",
"\\",
"userlist_collection",
"{",
"$",
"progress",
"=",
"static",
"::",
"get_log_tracer",
"(",
")",
";",
"$",
... | Gets a collection of users for all components in the specified context.
@param \context $context The context to search
@return userlist_collection the collection of userlist items for the respective components. | [
"Gets",
"a",
"collection",
"of",
"users",
"for",
"all",
"components",
"in",
"the",
"specified",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/manager.php#L265-L297 |
215,516 | moodle/moodle | privacy/classes/manager.php | manager.export_user_data | public function export_user_data(contextlist_collection $contextlistcollection) {
$progress = static::get_log_tracer();
$a = (object) [
'total' => count($contextlistcollection),
'progress' => 0,
'component' => '',
'datetime' => userdate(time()),
]... | php | public function export_user_data(contextlist_collection $contextlistcollection) {
$progress = static::get_log_tracer();
$a = (object) [
'total' => count($contextlistcollection),
'progress' => 0,
'component' => '',
'datetime' => userdate(time()),
]... | [
"public",
"function",
"export_user_data",
"(",
"contextlist_collection",
"$",
"contextlistcollection",
")",
"{",
"$",
"progress",
"=",
"static",
"::",
"get_log_tracer",
"(",
")",
";",
"$",
"a",
"=",
"(",
"object",
")",
"[",
"'total'",
"=>",
"count",
"(",
"$"... | Export all user data for the specified approved_contextlist items.
Note: userid and component are stored in each respective approved_contextlist.
@param contextlist_collection $contextlistcollection the collection of contextlists for all components.
@return string the location of the exported data.
@throws \moodle_ex... | [
"Export",
"all",
"user",
"data",
"for",
"the",
"specified",
"approved_contextlist",
"items",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/manager.php#L309-L375 |
215,517 | moodle/moodle | privacy/classes/manager.php | manager.delete_data_for_user | public function delete_data_for_user(contextlist_collection $contextlistcollection) {
$progress = static::get_log_tracer();
$a = (object) [
'total' => count($contextlistcollection),
'progress' => 0,
'component' => '',
'datetime' => userdate(time()),
... | php | public function delete_data_for_user(contextlist_collection $contextlistcollection) {
$progress = static::get_log_tracer();
$a = (object) [
'total' => count($contextlistcollection),
'progress' => 0,
'component' => '',
'datetime' => userdate(time()),
... | [
"public",
"function",
"delete_data_for_user",
"(",
"contextlist_collection",
"$",
"contextlistcollection",
")",
"{",
"$",
"progress",
"=",
"static",
"::",
"get_log_tracer",
"(",
")",
";",
"$",
"a",
"=",
"(",
"object",
")",
"[",
"'total'",
"=>",
"count",
"(",
... | Delete all user data for approved contexts lists provided in the collection.
This call relates to the forgetting of an entire user.
Note: userid and component are stored in each respective approved_contextlist.
@param contextlist_collection $contextlistcollection the collections of approved_contextlist items on whic... | [
"Delete",
"all",
"user",
"data",
"for",
"approved",
"contexts",
"lists",
"provided",
"in",
"the",
"collection",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/manager.php#L388-L422 |
215,518 | moodle/moodle | privacy/classes/manager.php | manager.delete_data_for_users_in_context | public function delete_data_for_users_in_context(\core_privacy\local\request\userlist_collection $collection) {
$progress = static::get_log_tracer();
$a = (object) [
'contextid' => $collection->get_context()->id,
'total' => count($collection),
'progress' => 0,
... | php | public function delete_data_for_users_in_context(\core_privacy\local\request\userlist_collection $collection) {
$progress = static::get_log_tracer();
$a = (object) [
'contextid' => $collection->get_context()->id,
'total' => count($collection),
'progress' => 0,
... | [
"public",
"function",
"delete_data_for_users_in_context",
"(",
"\\",
"core_privacy",
"\\",
"local",
"\\",
"request",
"\\",
"userlist_collection",
"$",
"collection",
")",
"{",
"$",
"progress",
"=",
"static",
"::",
"get_log_tracer",
"(",
")",
";",
"$",
"a",
"=",
... | Delete all user data for all specified users in a context.
@param \core_privacy\local\request\userlist_collection $collection | [
"Delete",
"all",
"user",
"data",
"for",
"all",
"specified",
"users",
"in",
"a",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/manager.php#L429-L464 |
215,519 | moodle/moodle | privacy/classes/manager.php | manager.delete_data_for_all_users_in_context | public function delete_data_for_all_users_in_context(\context $context) {
$progress = static::get_log_tracer();
$components = $this->get_component_list();
$a = (object) [
'total' => count($components),
'progress' => 0,
'component' => '',
'datetime... | php | public function delete_data_for_all_users_in_context(\context $context) {
$progress = static::get_log_tracer();
$components = $this->get_component_list();
$a = (object) [
'total' => count($components),
'progress' => 0,
'component' => '',
'datetime... | [
"public",
"function",
"delete_data_for_all_users_in_context",
"(",
"\\",
"context",
"$",
"context",
")",
"{",
"$",
"progress",
"=",
"static",
"::",
"get_log_tracer",
"(",
")",
";",
"$",
"components",
"=",
"$",
"this",
"->",
"get_component_list",
"(",
")",
";",... | Delete all use data which matches the specified deletion criteria.
@param \context $context The specific context to delete data for. | [
"Delete",
"all",
"use",
"data",
"which",
"matches",
"the",
"specified",
"deletion",
"criteria",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/manager.php#L471-L498 |
215,520 | moodle/moodle | privacy/classes/manager.php | manager.plugintype_class_callback | public static function plugintype_class_callback(string $plugintype, string $interface, string $methodname, array $params) {
$components = \core_component::get_plugin_list($plugintype);
foreach (array_keys($components) as $component) {
static::component_class_callback("{$plugintype}_{$compon... | php | public static function plugintype_class_callback(string $plugintype, string $interface, string $methodname, array $params) {
$components = \core_component::get_plugin_list($plugintype);
foreach (array_keys($components) as $component) {
static::component_class_callback("{$plugintype}_{$compon... | [
"public",
"static",
"function",
"plugintype_class_callback",
"(",
"string",
"$",
"plugintype",
",",
"string",
"$",
"interface",
",",
"string",
"$",
"methodname",
",",
"array",
"$",
"params",
")",
"{",
"$",
"components",
"=",
"\\",
"core_component",
"::",
"get_... | Call the named method with the specified params on any plugintype implementing the relevant interface.
@param string $plugintype The plugingtype to check
@param string $interface The interface to implement
@param string $methodname The method to call
@param array $params The params to call | [
"Call",
"the",
"named",
"method",
"with",
"the",
"specified",
"params",
"on",
"any",
"plugintype",
"implementing",
"the",
"relevant",
"interface",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/manager.php#L559-L564 |
215,521 | moodle/moodle | privacy/classes/manager.php | manager.component_class_callback_failed | protected function component_class_callback_failed(\Throwable $e, string $component, string $interface,
string $methodname, array $params) {
if ($this->observer) {
call_user_func_array([$this->observer, 'handle_component_failure'], func_get_args());
}
} | php | protected function component_class_callback_failed(\Throwable $e, string $component, string $interface,
string $methodname, array $params) {
if ($this->observer) {
call_user_func_array([$this->observer, 'handle_component_failure'], func_get_args());
}
} | [
"protected",
"function",
"component_class_callback_failed",
"(",
"\\",
"Throwable",
"$",
"e",
",",
"string",
"$",
"component",
",",
"string",
"$",
"interface",
",",
"string",
"$",
"methodname",
",",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"$",
"this",
... | Notifies the observer of any failure.
@param \Throwable $e
@param string $component
@param string $interface
@param string $methodname
@param array $params | [
"Notifies",
"the",
"observer",
"of",
"any",
"failure",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/manager.php#L629-L634 |
215,522 | moodle/moodle | analytics/classes/local/target/base.php | base.prediction_actions | public function prediction_actions(\core_analytics\prediction $prediction, $includedetailsaction = false,
$isinsightuser = false) {
global $PAGE;
$predictionid = $prediction->get_prediction_data()->id;
$PAGE->requires->js_call_amd('report_insights/actions', 'init', array($predictio... | php | public function prediction_actions(\core_analytics\prediction $prediction, $includedetailsaction = false,
$isinsightuser = false) {
global $PAGE;
$predictionid = $prediction->get_prediction_data()->id;
$PAGE->requires->js_call_amd('report_insights/actions', 'init', array($predictio... | [
"public",
"function",
"prediction_actions",
"(",
"\\",
"core_analytics",
"\\",
"prediction",
"$",
"prediction",
",",
"$",
"includedetailsaction",
"=",
"false",
",",
"$",
"isinsightuser",
"=",
"false",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"predictionid",
... | Suggested actions for a user.
@param \core_analytics\prediction $prediction
@param bool $includedetailsaction
@param bool $isinsightuser
@return \core_analytics\prediction_action[] | [
"Suggested",
"actions",
"for",
"a",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/target/base.php#L128-L167 |
215,523 | moodle/moodle | analytics/classes/local/target/base.php | base.get_view_details_text | private function get_view_details_text() {
if ($this->based_on_assumptions()) {
$analyserclass = $this->get_analyser_class();
if ($analyserclass::one_sample_per_analysable()) {
$detailstext = get_string('viewinsightdetails', 'analytics');
} else {
... | php | private function get_view_details_text() {
if ($this->based_on_assumptions()) {
$analyserclass = $this->get_analyser_class();
if ($analyserclass::one_sample_per_analysable()) {
$detailstext = get_string('viewinsightdetails', 'analytics');
} else {
... | [
"private",
"function",
"get_view_details_text",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"based_on_assumptions",
"(",
")",
")",
"{",
"$",
"analyserclass",
"=",
"$",
"this",
"->",
"get_analyser_class",
"(",
")",
";",
"if",
"(",
"$",
"analyserclass",
"::... | Returns the view details link text.
@return string | [
"Returns",
"the",
"view",
"details",
"link",
"text",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/target/base.php#L173-L186 |
215,524 | moodle/moodle | analytics/classes/local/target/base.php | base.generate_insight_notifications | public function generate_insight_notifications($modelid, $samplecontexts, array $predictions = []) {
// Delegate the processing of insights to the insights_generator.
$insightsgenerator = new \core_analytics\insights_generator($modelid, $this);
$insightsgenerator->generate($samplecontexts, $pred... | php | public function generate_insight_notifications($modelid, $samplecontexts, array $predictions = []) {
// Delegate the processing of insights to the insights_generator.
$insightsgenerator = new \core_analytics\insights_generator($modelid, $this);
$insightsgenerator->generate($samplecontexts, $pred... | [
"public",
"function",
"generate_insight_notifications",
"(",
"$",
"modelid",
",",
"$",
"samplecontexts",
",",
"array",
"$",
"predictions",
"=",
"[",
"]",
")",
"{",
"// Delegate the processing of insights to the insights_generator.",
"$",
"insightsgenerator",
"=",
"new",
... | Generates insights notifications
@param int $modelid
@param \context[] $samplecontexts
@param \core_analytics\prediction[] $predictions
@return void | [
"Generates",
"insights",
"notifications"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/target/base.php#L213-L217 |
215,525 | moodle/moodle | analytics/classes/local/target/base.php | base.get_insights_users | public function get_insights_users(\context $context) {
if ($context->contextlevel === CONTEXT_USER) {
$users = [$context->instanceid => \core_user::get_user($context->instanceid)];
} else if ($context->contextlevel >= CONTEXT_COURSE) {
// At course level or below only enrolled u... | php | public function get_insights_users(\context $context) {
if ($context->contextlevel === CONTEXT_USER) {
$users = [$context->instanceid => \core_user::get_user($context->instanceid)];
} else if ($context->contextlevel >= CONTEXT_COURSE) {
// At course level or below only enrolled u... | [
"public",
"function",
"get_insights_users",
"(",
"\\",
"context",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"context",
"->",
"contextlevel",
"===",
"CONTEXT_USER",
")",
"{",
"$",
"users",
"=",
"[",
"$",
"context",
"->",
"instanceid",
"=>",
"\\",
"core_user... | Returns the list of users that will receive insights notifications.
Feel free to overwrite if you need to but keep in mind that moodle/analytics:listinsights
or moodle/analytics:listowninsights capability is required to access the list of insights.
@param \context $context
@return array | [
"Returns",
"the",
"list",
"of",
"users",
"that",
"will",
"receive",
"insights",
"notifications",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/target/base.php#L228-L239 |
215,526 | moodle/moodle | analytics/classes/local/target/base.php | base.calculate | public function calculate($sampleids, \core_analytics\analysable $analysable, $starttime = false, $endtime = false) {
if (!PHPUNIT_TEST && CLI_SCRIPT) {
echo '.';
}
$calculations = [];
foreach ($sampleids as $sampleid => $unusedsampleid) {
// No time limits whe... | php | public function calculate($sampleids, \core_analytics\analysable $analysable, $starttime = false, $endtime = false) {
if (!PHPUNIT_TEST && CLI_SCRIPT) {
echo '.';
}
$calculations = [];
foreach ($sampleids as $sampleid => $unusedsampleid) {
// No time limits whe... | [
"public",
"function",
"calculate",
"(",
"$",
"sampleids",
",",
"\\",
"core_analytics",
"\\",
"analysable",
"$",
"analysable",
",",
"$",
"starttime",
"=",
"false",
",",
"$",
"endtime",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"PHPUNIT_TEST",
"&&",
"CLI_SCRIP... | Calculates the target.
Returns an array of values which size matches $sampleids size.
Rows with null values will be skipped as invalid by time splitting methods.
@param array $sampleids
@param \core_analytics\analysable $analysable
@param int $starttime
@param int $endtime
@return array The format to follow is [user... | [
"Calculates",
"the",
"target",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/target/base.php#L325-L350 |
215,527 | moodle/moodle | analytics/classes/local/target/base.php | base.filter_out_invalid_samples | public function filter_out_invalid_samples(&$sampleids, \core_analytics\analysable $analysable, $fortraining = true) {
foreach ($sampleids as $sampleid => $unusedsampleid) {
if (!$this->is_valid_sample($sampleid, $analysable, $fortraining)) {
// Skip it and remove the sample from the... | php | public function filter_out_invalid_samples(&$sampleids, \core_analytics\analysable $analysable, $fortraining = true) {
foreach ($sampleids as $sampleid => $unusedsampleid) {
if (!$this->is_valid_sample($sampleid, $analysable, $fortraining)) {
// Skip it and remove the sample from the... | [
"public",
"function",
"filter_out_invalid_samples",
"(",
"&",
"$",
"sampleids",
",",
"\\",
"core_analytics",
"\\",
"analysable",
"$",
"analysable",
",",
"$",
"fortraining",
"=",
"true",
")",
"{",
"foreach",
"(",
"$",
"sampleids",
"as",
"$",
"sampleid",
"=>",
... | Filters out invalid samples for training.
@param int[] $sampleids
@param \core_analytics\analysable $analysable
@param bool $fortraining
@return void | [
"Filters",
"out",
"invalid",
"samples",
"for",
"training",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/target/base.php#L360-L367 |
215,528 | moodle/moodle | admin/tool/policy/classes/api.php | api.get_current_versions_ids | public static function get_current_versions_ids($audience = null) {
global $DB;
$sql = "SELECT v.policyid, v.id
FROM {tool_policy} d
LEFT JOIN {tool_policy_versions} v ON v.policyid = d.id
WHERE d.currentversionid = v.id";
$params = [];
if ($audienc... | php | public static function get_current_versions_ids($audience = null) {
global $DB;
$sql = "SELECT v.policyid, v.id
FROM {tool_policy} d
LEFT JOIN {tool_policy_versions} v ON v.policyid = d.id
WHERE d.currentversionid = v.id";
$params = [];
if ($audienc... | [
"public",
"static",
"function",
"get_current_versions_ids",
"(",
"$",
"audience",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT v.policyid, v.id\n FROM {tool_policy} d\n LEFT JOIN {tool_policy_versions} v ON v.policyid = d.id\... | Checks if there are any current policies defined and returns their ids only
@param array $audience If defined, filter against the given audience (AUDIENCE_ALL always included)
@return array of version ids indexed by policies ids | [
"Checks",
"if",
"there",
"are",
"any",
"current",
"policies",
"defined",
"and",
"returns",
"their",
"ids",
"only"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L77-L89 |
215,529 | moodle/moodle | admin/tool/policy/classes/api.php | api.count_total_users | public static function count_total_users() {
global $DB, $CFG;
static $cached = null;
if ($cached === null) {
$cached = $DB->count_records_select('user', 'deleted = 0 AND id <> ?', [$CFG->siteguest]);
}
return $cached;
} | php | public static function count_total_users() {
global $DB, $CFG;
static $cached = null;
if ($cached === null) {
$cached = $DB->count_records_select('user', 'deleted = 0 AND id <> ?', [$CFG->siteguest]);
}
return $cached;
} | [
"public",
"static",
"function",
"count_total_users",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"static",
"$",
"cached",
"=",
"null",
";",
"if",
"(",
"$",
"cached",
"===",
"null",
")",
"{",
"$",
"cached",
"=",
"$",
"DB",
"->",
"count... | Returns total number of users who are expected to accept site policy
@return int|null | [
"Returns",
"total",
"number",
"of",
"users",
"who",
"are",
"expected",
"to",
"accept",
"site",
"policy"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L196-L203 |
215,530 | moodle/moodle | admin/tool/policy/classes/api.php | api.get_policy_version | public static function get_policy_version($versionid, $policies = null) {
if ($policies === null) {
$policies = self::list_policies();
}
foreach ($policies as $policy) {
if ($policy->currentversionid == $versionid) {
return $policy->currentversion;
... | php | public static function get_policy_version($versionid, $policies = null) {
if ($policies === null) {
$policies = self::list_policies();
}
foreach ($policies as $policy) {
if ($policy->currentversionid == $versionid) {
return $policy->currentversion;
... | [
"public",
"static",
"function",
"get_policy_version",
"(",
"$",
"versionid",
",",
"$",
"policies",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"policies",
"===",
"null",
")",
"{",
"$",
"policies",
"=",
"self",
"::",
"list_policies",
"(",
")",
";",
"}",
"for... | Load a particular policy document version.
@param int $versionid ID of the policy document version.
@param array $policies cached result of self::list_policies() in case this function needs to be called in a loop
@return stdClass - exported {@link tool_policy\policy_exporter} instance | [
"Load",
"a",
"particular",
"policy",
"document",
"version",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L212-L236 |
215,531 | moodle/moodle | admin/tool/policy/classes/api.php | api.fix_revision_values | public static function fix_revision_values(array $versions) {
$byrev = [];
foreach ($versions as $version) {
if ($version->revision === '') {
$version->revision = userdate($version->timecreated, get_string('strftimedate', 'core_langconfig'));
}
$byre... | php | public static function fix_revision_values(array $versions) {
$byrev = [];
foreach ($versions as $version) {
if ($version->revision === '') {
$version->revision = userdate($version->timecreated, get_string('strftimedate', 'core_langconfig'));
}
$byre... | [
"public",
"static",
"function",
"fix_revision_values",
"(",
"array",
"$",
"versions",
")",
"{",
"$",
"byrev",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"versions",
"as",
"$",
"version",
")",
"{",
"if",
"(",
"$",
"version",
"->",
"revision",
"===",
"''",... | Make sure that each version has a unique revision value.
Empty value are replaced with a timecreated date. Duplicates are suffixed with v1, v2, v3, ... etc.
@param array $versions List of objects with id, timecreated and revision properties | [
"Make",
"sure",
"that",
"each",
"version",
"has",
"a",
"unique",
"revision",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L245-L270 |
215,532 | moodle/moodle | admin/tool/policy/classes/api.php | api.can_user_view_policy_version | public static function can_user_view_policy_version($policy, $behalfid = null, $userid = null) {
global $USER;
if ($policy->status == policy_version::STATUS_ACTIVE) {
return true;
}
if (empty($userid)) {
$userid = $USER->id;
}
// Check if the us... | php | public static function can_user_view_policy_version($policy, $behalfid = null, $userid = null) {
global $USER;
if ($policy->status == policy_version::STATUS_ACTIVE) {
return true;
}
if (empty($userid)) {
$userid = $USER->id;
}
// Check if the us... | [
"public",
"static",
"function",
"can_user_view_policy_version",
"(",
"$",
"policy",
",",
"$",
"behalfid",
"=",
"null",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"USER",
";",
"if",
"(",
"$",
"policy",
"->",
"status",
"==",
"policy_version",
... | Can the user view the given policy version document?
@param stdClass $policy - exported {@link tool_policy\policy_exporter} instance
@param int $behalfid The id of user on whose behalf the user is viewing the policy
@param int $userid The user whom access is evaluated, defaults to the current one
@return bool | [
"Can",
"the",
"user",
"view",
"the",
"given",
"policy",
"version",
"document?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L280-L331 |
215,533 | moodle/moodle | admin/tool/policy/classes/api.php | api.get_user_minors | public static function get_user_minors($userid, array $extrafields = null) {
global $DB;
$ctxfields = context_helper::get_preload_record_columns_sql('c');
$namefields = get_all_user_name_fields(true, 'u');
$pixfields = user_picture::fields('u', $extrafields);
$sql = "SELECT $ct... | php | public static function get_user_minors($userid, array $extrafields = null) {
global $DB;
$ctxfields = context_helper::get_preload_record_columns_sql('c');
$namefields = get_all_user_name_fields(true, 'u');
$pixfields = user_picture::fields('u', $extrafields);
$sql = "SELECT $ct... | [
"public",
"static",
"function",
"get_user_minors",
"(",
"$",
"userid",
",",
"array",
"$",
"extrafields",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"ctxfields",
"=",
"context_helper",
"::",
"get_preload_record_columns_sql",
"(",
"'c'",
")",
";",
"... | Return the user's minors - other users on which behalf we can accept policies.
Returned objects contain all the standard user name and picture fields as well as the context instanceid.
@param int $userid The id if the user with parental responsibility
@param array $extrafields Extra fields to be included in result
@r... | [
"Return",
"the",
"user",
"s",
"minors",
"-",
"other",
"users",
"on",
"which",
"behalf",
"we",
"can",
"accept",
"policies",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L342-L371 |
215,534 | moodle/moodle | admin/tool/policy/classes/api.php | api.form_policydoc_add | public static function form_policydoc_add(stdClass $form) {
global $DB;
$form = clone($form);
$form->policyid = $DB->insert_record('tool_policy', (object) [
'sortorder' => 999,
]);
static::distribute_policy_document_sortorder();
return static::form_policyd... | php | public static function form_policydoc_add(stdClass $form) {
global $DB;
$form = clone($form);
$form->policyid = $DB->insert_record('tool_policy', (object) [
'sortorder' => 999,
]);
static::distribute_policy_document_sortorder();
return static::form_policyd... | [
"public",
"static",
"function",
"form_policydoc_add",
"(",
"stdClass",
"$",
"form",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"form",
"=",
"clone",
"(",
"$",
"form",
")",
";",
"$",
"form",
"->",
"policyid",
"=",
"$",
"DB",
"->",
"insert_record",
"(",
... | Save the data from the policydoc form as a new policy document.
@param stdClass $form data submitted from the {@link \tool_policy\form\policydoc} form.
@return \tool_policy\policy_version persistent | [
"Save",
"the",
"data",
"from",
"the",
"policydoc",
"form",
"as",
"a",
"new",
"policy",
"document",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L407-L419 |
215,535 | moodle/moodle | admin/tool/policy/classes/api.php | api.form_policydoc_update_new | public static function form_policydoc_update_new(stdClass $form) {
global $DB;
if (empty($form->policyid)) {
throw new coding_exception('Invalid policy document ID');
}
$form = clone($form);
$form->id = $DB->insert_record('tool_policy_versions', (new policy_version... | php | public static function form_policydoc_update_new(stdClass $form) {
global $DB;
if (empty($form->policyid)) {
throw new coding_exception('Invalid policy document ID');
}
$form = clone($form);
$form->id = $DB->insert_record('tool_policy_versions', (new policy_version... | [
"public",
"static",
"function",
"form_policydoc_update_new",
"(",
"stdClass",
"$",
"form",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"form",
"->",
"policyid",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Invalid policy do... | Save the data from the policydoc form as a new policy document version.
@param stdClass $form data submitted from the {@link \tool_policy\form\policydoc} form.
@return \tool_policy\policy_version persistent | [
"Save",
"the",
"data",
"from",
"the",
"policydoc",
"form",
"as",
"a",
"new",
"policy",
"document",
"version",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L427-L442 |
215,536 | moodle/moodle | admin/tool/policy/classes/api.php | api.form_policydoc_update_overwrite | public static function form_policydoc_update_overwrite(stdClass $form) {
$form = clone($form);
unset($form->timecreated);
$summaryfieldoptions = static::policy_summary_field_options();
$form = file_postupdate_standard_editor($form, 'summary', $summaryfieldoptions, $summaryfieldoptions[... | php | public static function form_policydoc_update_overwrite(stdClass $form) {
$form = clone($form);
unset($form->timecreated);
$summaryfieldoptions = static::policy_summary_field_options();
$form = file_postupdate_standard_editor($form, 'summary', $summaryfieldoptions, $summaryfieldoptions[... | [
"public",
"static",
"function",
"form_policydoc_update_overwrite",
"(",
"stdClass",
"$",
"form",
")",
"{",
"$",
"form",
"=",
"clone",
"(",
"$",
"form",
")",
";",
"unset",
"(",
"$",
"form",
"->",
"timecreated",
")",
";",
"$",
"summaryfieldoptions",
"=",
"st... | Save the data from the policydoc form, overwriting the existing policy document version.
@param stdClass $form data submitted from the {@link \tool_policy\form\policydoc} form.
@return \tool_policy\policy_version persistent | [
"Save",
"the",
"data",
"from",
"the",
"policydoc",
"form",
"overwriting",
"the",
"existing",
"policy",
"document",
"version",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L451-L477 |
215,537 | moodle/moodle | admin/tool/policy/classes/api.php | api.make_current | public static function make_current($versionid) {
global $DB, $USER;
$policyversion = new policy_version($versionid);
if (! $policyversion->get('id') || $policyversion->get('archived')) {
throw new coding_exception('Version not found or is archived');
}
// Archive c... | php | public static function make_current($versionid) {
global $DB, $USER;
$policyversion = new policy_version($versionid);
if (! $policyversion->get('id') || $policyversion->get('archived')) {
throw new coding_exception('Version not found or is archived');
}
// Archive c... | [
"public",
"static",
"function",
"make_current",
"(",
"$",
"versionid",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"policyversion",
"=",
"new",
"policy_version",
"(",
"$",
"versionid",
")",
";",
"if",
"(",
"!",
"$",
"policyversion",
"->",
... | Make the given version the current active one.
@param int $versionid | [
"Make",
"the",
"given",
"version",
"the",
"current",
"active",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L484-L511 |
215,538 | moodle/moodle | admin/tool/policy/classes/api.php | api.inactivate | public static function inactivate($policyid) {
global $DB;
if ($currentversionid = $DB->get_field('tool_policy', 'currentversionid', ['id' => $policyid])) {
// Archive the current version.
$DB->set_field('tool_policy_versions', 'archived', 1, ['id' => $currentversionid]);
... | php | public static function inactivate($policyid) {
global $DB;
if ($currentversionid = $DB->get_field('tool_policy', 'currentversionid', ['id' => $policyid])) {
// Archive the current version.
$DB->set_field('tool_policy_versions', 'archived', 1, ['id' => $currentversionid]);
... | [
"public",
"static",
"function",
"inactivate",
"(",
"$",
"policyid",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"currentversionid",
"=",
"$",
"DB",
"->",
"get_field",
"(",
"'tool_policy'",
",",
"'currentversionid'",
",",
"[",
"'id'",
"=>",
"$",
"... | Inactivate the policy document - no version marked as current and the document does not apply.
@param int $policyid | [
"Inactivate",
"the",
"policy",
"document",
"-",
"no",
"version",
"marked",
"as",
"current",
"and",
"the",
"document",
"does",
"not",
"apply",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L518-L527 |
215,539 | moodle/moodle | admin/tool/policy/classes/api.php | api.revert_to_draft | public static function revert_to_draft($versionid) {
$policyversion = new policy_version($versionid);
if (!$policyversion->get('id') || !$policyversion->get('archived')) {
throw new coding_exception('Version not found or is not archived');
}
$formdata = static::form_policydo... | php | public static function revert_to_draft($versionid) {
$policyversion = new policy_version($versionid);
if (!$policyversion->get('id') || !$policyversion->get('archived')) {
throw new coding_exception('Version not found or is not archived');
}
$formdata = static::form_policydo... | [
"public",
"static",
"function",
"revert_to_draft",
"(",
"$",
"versionid",
")",
"{",
"$",
"policyversion",
"=",
"new",
"policy_version",
"(",
"$",
"versionid",
")",
";",
"if",
"(",
"!",
"$",
"policyversion",
"->",
"get",
"(",
"'id'",
")",
"||",
"!",
"$",
... | Create a new draft policy document from an archived version.
@param int $versionid
@return \tool_policy\policy_version persistent | [
"Create",
"a",
"new",
"draft",
"policy",
"document",
"from",
"an",
"archived",
"version",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L535-L545 |
215,540 | moodle/moodle | admin/tool/policy/classes/api.php | api.distribute_policy_document_sortorder | protected static function distribute_policy_document_sortorder() {
global $DB;
$sql = "SELECT p.id, p.sortorder, MAX(v.timecreated) AS timerecentcreated
FROM {tool_policy} p
LEFT JOIN {tool_policy_versions} v ON v.policyid = p.id
GROUP BY p.id, p.sortorder
... | php | protected static function distribute_policy_document_sortorder() {
global $DB;
$sql = "SELECT p.id, p.sortorder, MAX(v.timecreated) AS timerecentcreated
FROM {tool_policy} p
LEFT JOIN {tool_policy_versions} v ON v.policyid = p.id
GROUP BY p.id, p.sortorder
... | [
"protected",
"static",
"function",
"distribute_policy_document_sortorder",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT p.id, p.sortorder, MAX(v.timecreated) AS timerecentcreated\n FROM {tool_policy} p\n LEFT JOIN {tool_policy_versions}... | Re-sets the sortorder field of the policy documents to even values. | [
"Re",
"-",
"sets",
"the",
"sortorder",
"field",
"of",
"the",
"policy",
"documents",
"to",
"even",
"values",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L615-L635 |
215,541 | moodle/moodle | admin/tool/policy/classes/api.php | api.move_policy_document | protected static function move_policy_document($policyid, $step) {
global $DB;
$sortorder = $DB->get_field('tool_policy', 'sortorder', ['id' => $policyid], MUST_EXIST);
$DB->set_field('tool_policy', 'sortorder', $sortorder + $step, ['id' => $policyid]);
static::distribute_policy_documen... | php | protected static function move_policy_document($policyid, $step) {
global $DB;
$sortorder = $DB->get_field('tool_policy', 'sortorder', ['id' => $policyid], MUST_EXIST);
$DB->set_field('tool_policy', 'sortorder', $sortorder + $step, ['id' => $policyid]);
static::distribute_policy_documen... | [
"protected",
"static",
"function",
"move_policy_document",
"(",
"$",
"policyid",
",",
"$",
"step",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sortorder",
"=",
"$",
"DB",
"->",
"get_field",
"(",
"'tool_policy'",
",",
"'sortorder'",
",",
"[",
"'id'",
"=>",
... | Change the policy document's sortorder.
@param int $policyid
@param int $step | [
"Change",
"the",
"policy",
"document",
"s",
"sortorder",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L643-L649 |
215,542 | moodle/moodle | admin/tool/policy/classes/api.php | api.get_user_acceptances | public static function get_user_acceptances($userid, $versions = null) {
global $DB;
list($vsql, $vparams) = ['', []];
if (!empty($versions)) {
list($vsql, $vparams) = $DB->get_in_or_equal($versions, SQL_PARAMS_NAMED, 'ver');
$vsql = ' AND a.policyversionid ' . $vsql;
... | php | public static function get_user_acceptances($userid, $versions = null) {
global $DB;
list($vsql, $vparams) = ['', []];
if (!empty($versions)) {
list($vsql, $vparams) = $DB->get_in_or_equal($versions, SQL_PARAMS_NAMED, 'ver');
$vsql = ' AND a.policyversionid ' . $vsql;
... | [
"public",
"static",
"function",
"get_user_acceptances",
"(",
"$",
"userid",
",",
"$",
"versions",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"vsql",
",",
"$",
"vparams",
")",
"=",
"[",
"''",
",",
"[",
"]",
"]",
";",
"if",
... | Returns list of acceptances for this user.
@param int $userid id of a user.
@param int|array $versions list of policy versions.
@return array list of acceptances indexed by versionid. | [
"Returns",
"list",
"of",
"acceptances",
"for",
"this",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L676-L703 |
215,543 | moodle/moodle | admin/tool/policy/classes/api.php | api.get_user_version_acceptance | public static function get_user_version_acceptance($userid, $versionid, $acceptances = null) {
if (empty($acceptances)) {
$acceptances = static::get_user_acceptances($userid, $versionid);
}
if (array_key_exists($versionid, $acceptances)) {
// The policy version has ever b... | php | public static function get_user_version_acceptance($userid, $versionid, $acceptances = null) {
if (empty($acceptances)) {
$acceptances = static::get_user_acceptances($userid, $versionid);
}
if (array_key_exists($versionid, $acceptances)) {
// The policy version has ever b... | [
"public",
"static",
"function",
"get_user_version_acceptance",
"(",
"$",
"userid",
",",
"$",
"versionid",
",",
"$",
"acceptances",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"acceptances",
")",
")",
"{",
"$",
"acceptances",
"=",
"static",
"::",
... | Returns version acceptance for this user.
@param int $userid User identifier.
@param int $versionid Policy version identifier.
@param array|null $acceptances List of policy version acceptances indexed by versionid.
@return stdClass|null Acceptance object if the user has ever accepted this version or null if not. | [
"Returns",
"version",
"acceptance",
"for",
"this",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L713-L723 |
215,544 | moodle/moodle | admin/tool/policy/classes/api.php | api.is_user_version_accepted | public static function is_user_version_accepted($userid, $versionid, $acceptances = null) {
$acceptance = static::get_user_version_acceptance($userid, $versionid, $acceptances);
if (!empty($acceptance)) {
return (bool) $acceptance->status;
}
return null;
} | php | public static function is_user_version_accepted($userid, $versionid, $acceptances = null) {
$acceptance = static::get_user_version_acceptance($userid, $versionid, $acceptances);
if (!empty($acceptance)) {
return (bool) $acceptance->status;
}
return null;
} | [
"public",
"static",
"function",
"is_user_version_accepted",
"(",
"$",
"userid",
",",
"$",
"versionid",
",",
"$",
"acceptances",
"=",
"null",
")",
"{",
"$",
"acceptance",
"=",
"static",
"::",
"get_user_version_acceptance",
"(",
"$",
"userid",
",",
"$",
"version... | Did the user accept the given policy version?
@param int $userid User identifier.
@param int $versionid Policy version identifier.
@param array|null $acceptances Pre-loaded list of policy version acceptances indexed by versionid.
@return bool|null True/false if this user accepted/declined the policy; null otherwise. | [
"Did",
"the",
"user",
"accept",
"the",
"given",
"policy",
"version?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L733-L742 |
215,545 | moodle/moodle | admin/tool/policy/classes/api.php | api.get_policies_with_acceptances | public static function get_policies_with_acceptances($userid) {
// Get the list of policies and versions that current user is able to see
// and the respective acceptance records for the selected user.
$policies = static::list_policies();
$acceptances = static::get_user_acceptances($user... | php | public static function get_policies_with_acceptances($userid) {
// Get the list of policies and versions that current user is able to see
// and the respective acceptance records for the selected user.
$policies = static::list_policies();
$acceptances = static::get_user_acceptances($user... | [
"public",
"static",
"function",
"get_policies_with_acceptances",
"(",
"$",
"userid",
")",
"{",
"// Get the list of policies and versions that current user is able to see",
"// and the respective acceptance records for the selected user.",
"$",
"policies",
"=",
"static",
"::",
"list_p... | Get the list of policies and versions that current user is able to see and the respective acceptance records for
the selected user.
@param int $userid
@return array array with the same structure that list_policies() returns with additional attribute acceptance for versions | [
"Get",
"the",
"list",
"of",
"policies",
"and",
"versions",
"that",
"current",
"user",
"is",
"able",
"to",
"see",
"and",
"the",
"respective",
"acceptance",
"records",
"for",
"the",
"selected",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L751-L780 |
215,546 | moodle/moodle | admin/tool/policy/classes/api.php | api.accept_policies | public static function accept_policies($policyversionid, $userid = null, $note = null, $lang = null) {
static::set_acceptances_status($policyversionid, $userid, $note, $lang, 1);
} | php | public static function accept_policies($policyversionid, $userid = null, $note = null, $lang = null) {
static::set_acceptances_status($policyversionid, $userid, $note, $lang, 1);
} | [
"public",
"static",
"function",
"accept_policies",
"(",
"$",
"policyversionid",
",",
"$",
"userid",
"=",
"null",
",",
"$",
"note",
"=",
"null",
",",
"$",
"lang",
"=",
"null",
")",
"{",
"static",
"::",
"set_acceptances_status",
"(",
"$",
"policyversionid",
... | Mark the given policy versions as accepted by the user.
@param array|int $policyversionid Policy version id(s) to set acceptance status for.
@param int|null $userid Id of the user accepting the policy version, defaults to the current one.
@param string|null $note Note to be recorded.
@param string|null $lang Language ... | [
"Mark",
"the",
"given",
"policy",
"versions",
"as",
"accepted",
"by",
"the",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L928-L930 |
215,547 | moodle/moodle | admin/tool/policy/classes/api.php | api.decline_policies | public static function decline_policies($policyversionid, $userid = null, $note = null, $lang = null) {
static::set_acceptances_status($policyversionid, $userid, $note, $lang, 0);
} | php | public static function decline_policies($policyversionid, $userid = null, $note = null, $lang = null) {
static::set_acceptances_status($policyversionid, $userid, $note, $lang, 0);
} | [
"public",
"static",
"function",
"decline_policies",
"(",
"$",
"policyversionid",
",",
"$",
"userid",
"=",
"null",
",",
"$",
"note",
"=",
"null",
",",
"$",
"lang",
"=",
"null",
")",
"{",
"static",
"::",
"set_acceptances_status",
"(",
"$",
"policyversionid",
... | Mark the given policy versions as declined by the user.
@param array|int $policyversionid Policy version id(s) to set acceptance status for.
@param int|null $userid Id of the user accepting the policy version, defaults to the current one.
@param string|null $note Note to be recorded.
@param string|null $lang Language ... | [
"Mark",
"the",
"given",
"policy",
"versions",
"as",
"declined",
"by",
"the",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L940-L942 |
215,548 | moodle/moodle | admin/tool/policy/classes/api.php | api.set_acceptances_status | protected static function set_acceptances_status($policyversionid, $userid = null, $note = null, $lang = null, $status = 1) {
global $DB, $USER;
// Validate arguments and capabilities.
if (empty($policyversionid)) {
return;
} else if (!is_array($policyversionid)) {
... | php | protected static function set_acceptances_status($policyversionid, $userid = null, $note = null, $lang = null, $status = 1) {
global $DB, $USER;
// Validate arguments and capabilities.
if (empty($policyversionid)) {
return;
} else if (!is_array($policyversionid)) {
... | [
"protected",
"static",
"function",
"set_acceptances_status",
"(",
"$",
"policyversionid",
",",
"$",
"userid",
"=",
"null",
",",
"$",
"note",
"=",
"null",
",",
"$",
"lang",
"=",
"null",
",",
"$",
"status",
"=",
"1",
")",
"{",
"global",
"$",
"DB",
",",
... | Mark the given policy versions as accepted or declined by the user.
@param array|int $policyversionid Policy version id(s) to set acceptance status for.
@param int|null $userid Id of the user accepting the policy version, defaults to the current one.
@param string|null $note Note to be recorded.
@param string|null $la... | [
"Mark",
"the",
"given",
"policy",
"versions",
"as",
"accepted",
"or",
"declined",
"by",
"the",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L953-L998 |
215,549 | moodle/moodle | admin/tool/policy/classes/api.php | api.revoke_acceptance | public static function revoke_acceptance($policyversionid, $userid, $note = null) {
global $DB, $USER;
if (!$userid) {
$userid = $USER->id;
}
self::can_accept_policies([$policyversionid], $userid, true);
if ($currentacceptance = $DB->get_record('tool_policy_acceptanc... | php | public static function revoke_acceptance($policyversionid, $userid, $note = null) {
global $DB, $USER;
if (!$userid) {
$userid = $USER->id;
}
self::can_accept_policies([$policyversionid], $userid, true);
if ($currentacceptance = $DB->get_record('tool_policy_acceptanc... | [
"public",
"static",
"function",
"revoke_acceptance",
"(",
"$",
"policyversionid",
",",
"$",
"userid",
",",
"$",
"note",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"if",
"(",
"!",
"$",
"userid",
")",
"{",
"$",
"userid",
"=",
... | May be used to revert accidentally granted acceptance for another user
@param int $policyversionid
@param int $userid
@param null $note | [
"May",
"be",
"used",
"to",
"revert",
"accidentally",
"granted",
"acceptance",
"for",
"another",
"user"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L1049-L1066 |
215,550 | moodle/moodle | admin/tool/policy/classes/api.php | api.create_acceptances_user_created | public static function create_acceptances_user_created(\core\event\user_created $event) {
global $USER, $CFG, $DB;
// Do nothing if not set as the site policies handler.
if (empty($CFG->sitepolicyhandler) || $CFG->sitepolicyhandler !== 'tool_policy') {
return;
}
$us... | php | public static function create_acceptances_user_created(\core\event\user_created $event) {
global $USER, $CFG, $DB;
// Do nothing if not set as the site policies handler.
if (empty($CFG->sitepolicyhandler) || $CFG->sitepolicyhandler !== 'tool_policy') {
return;
}
$us... | [
"public",
"static",
"function",
"create_acceptances_user_created",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"user_created",
"$",
"event",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"CFG",
",",
"$",
"DB",
";",
"// Do nothing if not set as the site policies handler.",
... | Create user policy acceptances when the user is created.
@param \core\event\user_created $event | [
"Create",
"user",
"policy",
"acceptances",
"when",
"the",
"user",
"is",
"created",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L1073-L1117 |
215,551 | moodle/moodle | admin/tool/policy/classes/api.php | api.get_agreement_optional | public static function get_agreement_optional($versionid) {
global $DB;
$optcache = \cache::make('tool_policy', 'policy_optional');
$hit = $optcache->get($versionid);
if ($hit === false) {
$flags = $DB->get_records_menu('tool_policy_versions', null, '', 'id, optional');
... | php | public static function get_agreement_optional($versionid) {
global $DB;
$optcache = \cache::make('tool_policy', 'policy_optional');
$hit = $optcache->get($versionid);
if ($hit === false) {
$flags = $DB->get_records_menu('tool_policy_versions', null, '', 'id, optional');
... | [
"public",
"static",
"function",
"get_agreement_optional",
"(",
"$",
"versionid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"optcache",
"=",
"\\",
"cache",
"::",
"make",
"(",
"'tool_policy'",
",",
"'policy_optional'",
")",
";",
"$",
"hit",
"=",
"$",
"optcach... | Returns the value of the optional flag for the given policy version.
Optimised for being called multiple times by making use of a request cache. The cache is normally populated as a
side effect of calling {@link self::list_policies()} and in most cases should be warm enough for hits.
@param int $versionid
@return int... | [
"Returns",
"the",
"value",
"of",
"the",
"optional",
"flag",
"for",
"the",
"given",
"policy",
"version",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/api.php#L1128-L1142 |
215,552 | moodle/moodle | blocks/recentlyaccesseditems/classes/observer.php | observer.store | public static function store(\core\event\base $event) {
global $DB;
if (!isloggedin() or \core\session\manager::is_loggedinas() or isguestuser()) {
// No access tracking.
return;
}
$conditions = [
'userid' => $event->userid
];
$recor... | php | public static function store(\core\event\base $event) {
global $DB;
if (!isloggedin() or \core\session\manager::is_loggedinas() or isguestuser()) {
// No access tracking.
return;
}
$conditions = [
'userid' => $event->userid
];
$recor... | [
"public",
"static",
"function",
"store",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"base",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"isloggedin",
"(",
")",
"or",
"\\",
"core",
"\\",
"session",
"\\",
"manager",
"::",
"is_loggedi... | Register items views in block_recentlyaccesseditems table.
When the item is view for the first time, a new record is created. If the item was viewed before, the time is
updated.
@param \core\event\base $event | [
"Register",
"items",
"views",
"in",
"block_recentlyaccesseditems",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/recentlyaccesseditems/classes/observer.php#L53-L93 |
215,553 | moodle/moodle | blocks/recentlyaccesseditems/classes/observer.php | observer.remove | public static function remove(\core\event\base $event) {
global $DB;
$DB->delete_records(self::$table, array('cmid' => $event->contextinstanceid));
} | php | public static function remove(\core\event\base $event) {
global $DB;
$DB->delete_records(self::$table, array('cmid' => $event->contextinstanceid));
} | [
"public",
"static",
"function",
"remove",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"base",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"DB",
"->",
"delete_records",
"(",
"self",
"::",
"$",
"table",
",",
"array",
"(",
"'cmid'",
"=>",
"$",
... | Remove record when course module is deleted.
@param \core\event\base $event | [
"Remove",
"record",
"when",
"course",
"module",
"is",
"deleted",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/recentlyaccesseditems/classes/observer.php#L100-L104 |
215,554 | moodle/moodle | admin/tool/policy/classes/output/user_agreement.php | user_agreement.export_for_download | public function export_for_download() {
if (count($this->versions) == 1) {
if ($this->accepted) {
if ($this->onbehalf) {
return get_string('acceptancestatusacceptedbehalf', 'tool_policy');
} else {
return get_string('acceptance... | php | public function export_for_download() {
if (count($this->versions) == 1) {
if ($this->accepted) {
if ($this->onbehalf) {
return get_string('acceptancestatusacceptedbehalf', 'tool_policy');
} else {
return get_string('acceptance... | [
"public",
"function",
"export_for_download",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"versions",
")",
"==",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"accepted",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"onbehalf",
")",
"{",
... | Describe the status with a plain text for downloading purposes.
@return string | [
"Describe",
"the",
"status",
"with",
"a",
"plain",
"text",
"for",
"downloading",
"purposes",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/output/user_agreement.php#L309-L344 |
215,555 | moodle/moodle | lib/filebrowser/virtual_root_file.php | virtual_root_file.get_pathnamehash | public function get_pathnamehash() {
return sha1('/'.$this->get_contextid().'/'.$this->get_component().'/'.$this->get_filearea().'/'.$this->get_itemid().$this->get_filepath().$this->get_filename());
} | php | public function get_pathnamehash() {
return sha1('/'.$this->get_contextid().'/'.$this->get_component().'/'.$this->get_filearea().'/'.$this->get_itemid().$this->get_filepath().$this->get_filename());
} | [
"public",
"function",
"get_pathnamehash",
"(",
")",
"{",
"return",
"sha1",
"(",
"'/'",
".",
"$",
"this",
"->",
"get_contextid",
"(",
")",
".",
"'/'",
".",
"$",
"this",
"->",
"get_component",
"(",
")",
".",
"'/'",
".",
"$",
"this",
"->",
"get_filearea",... | Returns path name hash
@return string | [
"Returns",
"path",
"name",
"hash"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/virtual_root_file.php#L313-L315 |
215,556 | moodle/moodle | mod/workshop/eval/lib.php | workshop_evaluation_settings_form.definition | public function definition() {
$mform = $this->_form;
$workshop = $this->_customdata['workshop'];
$mform->addElement('header', 'general', get_string('evaluationsettings', 'mod_workshop'));
$this->definition_sub();
$mform->addElement('submit', 'submit', get_string('aggregategr... | php | public function definition() {
$mform = $this->_form;
$workshop = $this->_customdata['workshop'];
$mform->addElement('header', 'general', get_string('evaluationsettings', 'mod_workshop'));
$this->definition_sub();
$mform->addElement('submit', 'submit', get_string('aggregategr... | [
"public",
"function",
"definition",
"(",
")",
"{",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"$",
"workshop",
"=",
"$",
"this",
"->",
"_customdata",
"[",
"'workshop'",
"]",
";",
"$",
"mform",
"->",
"addElement",
"(",
"'header'",
",",
"'genera... | Defines the common form fields. | [
"Defines",
"the",
"common",
"form",
"fields",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/eval/lib.php#L81-L91 |
215,557 | moodle/moodle | lib/spout/src/Spout/Reader/AbstractReader.php | AbstractReader.open | public function open($filePath)
{
if ($this->isStreamWrapper($filePath) && (!$this->doesSupportStreamWrapper() || !$this->isSupportedStreamWrapper($filePath))) {
throw new IOException("Could not open $filePath for reading! Stream wrapper used is not supported for this type of file.");
}
... | php | public function open($filePath)
{
if ($this->isStreamWrapper($filePath) && (!$this->doesSupportStreamWrapper() || !$this->isSupportedStreamWrapper($filePath))) {
throw new IOException("Could not open $filePath for reading! Stream wrapper used is not supported for this type of file.");
}
... | [
"public",
"function",
"open",
"(",
"$",
"filePath",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isStreamWrapper",
"(",
"$",
"filePath",
")",
"&&",
"(",
"!",
"$",
"this",
"->",
"doesSupportStreamWrapper",
"(",
")",
"||",
"!",
"$",
"this",
"->",
"isSupporte... | Prepares the reader to read the given file. It also makes sure
that the file exists and is readable.
@api
@param string $filePath Path of the file to be read
@return void
@throws \Box\Spout\Common\Exception\IOException If the file at the given path does not exist, is not readable or is corrupted | [
"Prepares",
"the",
"reader",
"to",
"read",
"the",
"given",
"file",
".",
"It",
"also",
"makes",
"sure",
"that",
"the",
"file",
"exists",
"and",
"is",
"readable",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/AbstractReader.php#L106-L128 |
215,558 | moodle/moodle | lib/spout/src/Spout/Reader/AbstractReader.php | AbstractReader.close | public function close()
{
if ($this->isStreamOpened) {
$this->closeReader();
$sheetIterator = $this->getConcreteSheetIterator();
if ($sheetIterator) {
$sheetIterator->end();
}
$this->isStreamOpened = false;
}
} | php | public function close()
{
if ($this->isStreamOpened) {
$this->closeReader();
$sheetIterator = $this->getConcreteSheetIterator();
if ($sheetIterator) {
$sheetIterator->end();
}
$this->isStreamOpened = false;
}
} | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isStreamOpened",
")",
"{",
"$",
"this",
"->",
"closeReader",
"(",
")",
";",
"$",
"sheetIterator",
"=",
"$",
"this",
"->",
"getConcreteSheetIterator",
"(",
")",
";",
"if",
"(",... | Closes the reader, preventing any additional reading
@api
@return void | [
"Closes",
"the",
"reader",
"preventing",
"any",
"additional",
"reading"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/AbstractReader.php#L225-L237 |
215,559 | moodle/moodle | mod/data/field/latlong/field.class.php | data_field_latlong.field_validation | public function field_validation($values) {
$valuecount = 0;
// The lat long class has two values that need to be checked.
foreach ($values as $value) {
if (isset($value->value) && !($value->value == '')) {
$valuecount++;
}
}
// If we have ... | php | public function field_validation($values) {
$valuecount = 0;
// The lat long class has two values that need to be checked.
foreach ($values as $value) {
if (isset($value->value) && !($value->value == '')) {
$valuecount++;
}
}
// If we have ... | [
"public",
"function",
"field_validation",
"(",
"$",
"values",
")",
"{",
"$",
"valuecount",
"=",
"0",
";",
"// The lat long class has two values that need to be checked.",
"foreach",
"(",
"$",
"values",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
... | Validate values for this field.
Both the Latitude and the Longitude fields need to be filled in.
@param array $values The entered values for the lat. and long.
@return string|bool Error message or false. | [
"Validate",
"values",
"for",
"this",
"field",
".",
"Both",
"the",
"Latitude",
"and",
"the",
"Longitude",
"fields",
"need",
"to",
"be",
"filled",
"in",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/field/latlong/field.class.php#L286-L300 |
215,560 | moodle/moodle | competency/classes/template.php | template.validate_duedate | protected function validate_duedate($value) {
// During update.
if ($this->get('id')) {
$before = $this->beforeupdate->get('duedate');
// The value has not changed, then it's always OK.
if ($before == $value) {
return true;
}
}
... | php | protected function validate_duedate($value) {
// During update.
if ($this->get('id')) {
$before = $this->beforeupdate->get('duedate');
// The value has not changed, then it's always OK.
if ($before == $value) {
return true;
}
}
... | [
"protected",
"function",
"validate_duedate",
"(",
"$",
"value",
")",
"{",
"// During update.",
"if",
"(",
"$",
"this",
"->",
"get",
"(",
"'id'",
")",
")",
"{",
"$",
"before",
"=",
"$",
"this",
"->",
"beforeupdate",
"->",
"get",
"(",
"'duedate'",
")",
"... | Validate the due date.
The due date can always be changed, but when it is it must be:
- unset
- set in the future.
@param int $value The due date.
@return bool|lang_string | [
"Validate",
"the",
"due",
"date",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/template.php#L174-L194 |
215,561 | moodle/moodle | lib/external/externallib.php | core_external.get_strings_parameters | public static function get_strings_parameters() {
return new external_function_parameters(
array('strings' => new external_multiple_structure (
new external_single_structure (array(
'stringid' => new external_value(PARAM_STRINGID, 'string identifier'),
... | php | public static function get_strings_parameters() {
return new external_function_parameters(
array('strings' => new external_multiple_structure (
new external_single_structure (array(
'stringid' => new external_value(PARAM_STRINGID, 'string identifier'),
... | [
"public",
"static",
"function",
"get_strings_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'strings'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'stringid'"... | Returns description of get_string parameters
@return external_function_parameters
@since Moodle 2.4 | [
"Returns",
"description",
"of",
"get_string",
"parameters"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/external/externallib.php#L136-L154 |
215,562 | moodle/moodle | lib/external/externallib.php | core_external.get_user_dates_parameters | public static function get_user_dates_parameters() {
return new external_function_parameters(
[
'contextid' => new external_value(
PARAM_INT,
'Context ID. Either use this value, or level and instanceid.',
VALUE_DEFAULT,
... | php | public static function get_user_dates_parameters() {
return new external_function_parameters(
[
'contextid' => new external_value(
PARAM_INT,
'Context ID. Either use this value, or level and instanceid.',
VALUE_DEFAULT,
... | [
"public",
"static",
"function",
"get_user_dates_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"[",
"'contextid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'Context ID. Either use this value, or level and instanceid.'",
",",
... | Returns description of get_user_dates parameters
@return external_function_parameters | [
"Returns",
"description",
"of",
"get_user_dates",
"parameters"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/external/externallib.php#L210-L241 |
215,563 | moodle/moodle | lib/external/externallib.php | core_external.get_user_dates | public static function get_user_dates($contextid, $contextlevel, $instanceid, $timestamps) {
$params = self::validate_parameters(
self::get_user_dates_parameters(),
[
'contextid' => $contextid,
'contextlevel' => $contextlevel,
'instanceid' ... | php | public static function get_user_dates($contextid, $contextlevel, $instanceid, $timestamps) {
$params = self::validate_parameters(
self::get_user_dates_parameters(),
[
'contextid' => $contextid,
'contextlevel' => $contextlevel,
'instanceid' ... | [
"public",
"static",
"function",
"get_user_dates",
"(",
"$",
"contextid",
",",
"$",
"contextlevel",
",",
"$",
"instanceid",
",",
"$",
"timestamps",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_user_dates_parameters",
... | Format an array of timestamps.
@param int|null $contextid The contenxt id
@param string|null $contextlevel The context level
@param int|null $instanceid The instnace id for the context level
@param array $timestamps Timestamps to format
@return array | [
"Format",
"an",
"array",
"of",
"timestamps",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/external/externallib.php#L252-L271 |
215,564 | moodle/moodle | lib/external/externallib.php | core_external.get_fragment_parameters | public static function get_fragment_parameters() {
return new external_function_parameters(
array(
'component' => new external_value(PARAM_COMPONENT, 'Component for the callback e.g. mod_assign'),
'callback' => new external_value(PARAM_ALPHANUMEXT, 'Name of the callba... | php | public static function get_fragment_parameters() {
return new external_function_parameters(
array(
'component' => new external_value(PARAM_COMPONENT, 'Component for the callback e.g. mod_assign'),
'callback' => new external_value(PARAM_ALPHANUMEXT, 'Name of the callba... | [
"public",
"static",
"function",
"get_fragment_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'component'",
"=>",
"new",
"external_value",
"(",
"PARAM_COMPONENT",
",",
"'Component for the callback e.g. mod_assign'",
")",
",... | Returns description of get_fragment parameters
@return external_function_parameters
@since Moodle 3.1 | [
"Returns",
"description",
"of",
"get_fragment",
"parameters"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/external/externallib.php#L353-L369 |
215,565 | moodle/moodle | lib/external/externallib.php | core_external.get_fragment | public static function get_fragment($component, $callback, $contextid, $args = null) {
global $OUTPUT, $PAGE;
$params = self::validate_parameters(self::get_fragment_parameters(),
array(
'component' => $component,
'callback' => $callback,
... | php | public static function get_fragment($component, $callback, $contextid, $args = null) {
global $OUTPUT, $PAGE;
$params = self::validate_parameters(self::get_fragment_parameters(),
array(
'component' => $component,
'callback' => $callback,
... | [
"public",
"static",
"function",
"get_fragment",
"(",
"$",
"component",
",",
"$",
"callback",
",",
"$",
"contextid",
",",
"$",
"args",
"=",
"null",
")",
"{",
"global",
"$",
"OUTPUT",
",",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_par... | Get a HTML fragment for inserting into something. Initial use is for inserting mforms into
a page using AJAX.
This web service is designed to be called only via AJAX and not directly.
Callbacks that are called by this web service are responsible for doing the appropriate security checks
to access the information return... | [
"Get",
"a",
"HTML",
"fragment",
"for",
"inserting",
"into",
"something",
".",
"Initial",
"use",
"is",
"for",
"inserting",
"mforms",
"into",
"a",
"page",
"using",
"AJAX",
".",
"This",
"web",
"service",
"is",
"designed",
"to",
"be",
"called",
"only",
"via",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/external/externallib.php#L385-L419 |
215,566 | moodle/moodle | lib/external/externallib.php | core_external.update_inplace_editable | public static function update_inplace_editable($component, $itemtype, $itemid, $value) {
global $PAGE;
// Validate and normalize parameters.
$params = self::validate_parameters(self::update_inplace_editable_parameters(),
array('component' => $component, 'itemtype' => $itemt... | php | public static function update_inplace_editable($component, $itemtype, $itemid, $value) {
global $PAGE;
// Validate and normalize parameters.
$params = self::validate_parameters(self::update_inplace_editable_parameters(),
array('component' => $component, 'itemtype' => $itemt... | [
"public",
"static",
"function",
"update_inplace_editable",
"(",
"$",
"component",
",",
"$",
"itemtype",
",",
"$",
"itemid",
",",
"$",
"value",
")",
"{",
"global",
"$",
"PAGE",
";",
"// Validate and normalize parameters.",
"$",
"params",
"=",
"self",
"::",
"val... | Update any component's editable value assuming that component implements necessary callback
@since Moodle 3.1
@param string $component
@param string $itemtype
@param string $itemid
@param string $value | [
"Update",
"any",
"component",
"s",
"editable",
"value",
"assuming",
"that",
"component",
"implements",
"necessary",
"callback"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/external/externallib.php#L461-L475 |
215,567 | moodle/moodle | lib/external/externallib.php | core_external.fetch_notifications | public static function fetch_notifications($contextid) {
global $PAGE;
self::validate_parameters(self::fetch_notifications_parameters(), [
'contextid' => $contextid,
]);
$context = \context::instance_by_id($contextid);
self::validate_context($context);
... | php | public static function fetch_notifications($contextid) {
global $PAGE;
self::validate_parameters(self::fetch_notifications_parameters(), [
'contextid' => $contextid,
]);
$context = \context::instance_by_id($contextid);
self::validate_context($context);
... | [
"public",
"static",
"function",
"fetch_notifications",
"(",
"$",
"contextid",
")",
"{",
"global",
"$",
"PAGE",
";",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"fetch_notifications_parameters",
"(",
")",
",",
"[",
"'contextid'",
"=>",
"$",
"contextid... | Returns the list of notifications against the current session.
@return array
@since Moodle 3.1 | [
"Returns",
"the",
"list",
"of",
"notifications",
"against",
"the",
"current",
"session",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/external/externallib.php#L541-L552 |
215,568 | moodle/moodle | mod/workshop/form/accumulative/backup/moodle2/backup_workshopform_accumulative_subplugin.class.php | backup_workshopform_accumulative_subplugin.dimension_grades_structure | private function dimension_grades_structure($elementname) {
// create XML elements
$subplugin = $this->get_subplugin_element(); // virtual optigroup element
$subpluginwrapper = new backup_nested_element($this->get_recommended_name());
$subplugingrade = new backup_nested_element($element... | php | private function dimension_grades_structure($elementname) {
// create XML elements
$subplugin = $this->get_subplugin_element(); // virtual optigroup element
$subpluginwrapper = new backup_nested_element($this->get_recommended_name());
$subplugingrade = new backup_nested_element($element... | [
"private",
"function",
"dimension_grades_structure",
"(",
"$",
"elementname",
")",
"{",
"// create XML elements",
"$",
"subplugin",
"=",
"$",
"this",
"->",
"get_subplugin_element",
"(",
")",
";",
"// virtual optigroup element",
"$",
"subpluginwrapper",
"=",
"new",
"ba... | Returns the structure of dimension grades
@param string first parameter of {@link backup_nested_element} constructor | [
"Returns",
"the",
"structure",
"of",
"dimension",
"grades"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/form/accumulative/backup/moodle2/backup_workshopform_accumulative_subplugin.class.php#L87-L107 |
215,569 | moodle/moodle | lib/behat/classes/behat_config_manager.php | behat_config_manager.update_config_file | public static function update_config_file($component = '', $testsrunner = true, $tags = '',
$themesuitewithallfeatures = false, $parallelruns = 0, $run = 0) {
global $CFG;
// Behat must have a separate behat.yml to have access to the whole set of features and steps definitions.
if ($te... | php | public static function update_config_file($component = '', $testsrunner = true, $tags = '',
$themesuitewithallfeatures = false, $parallelruns = 0, $run = 0) {
global $CFG;
// Behat must have a separate behat.yml to have access to the whole set of features and steps definitions.
if ($te... | [
"public",
"static",
"function",
"update_config_file",
"(",
"$",
"component",
"=",
"''",
",",
"$",
"testsrunner",
"=",
"true",
",",
"$",
"tags",
"=",
"''",
",",
"$",
"themesuitewithallfeatures",
"=",
"false",
",",
"$",
"parallelruns",
"=",
"0",
",",
"$",
... | Updates a config file
The tests runner and the steps definitions list uses different
config files to avoid problems with concurrent executions.
The steps definitions list can be filtered by component so it's
behat.yml is different from the $CFG->dirroot one.
@param string $component Restricts the obtained steps def... | [
"Updates",
"a",
"config",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/classes/behat_config_manager.php#L83-L132 |
215,570 | moodle/moodle | lib/behat/classes/behat_config_manager.php | behat_config_manager.get_steps_list_config_filepath | public static function get_steps_list_config_filepath() {
global $USER;
// We don't cygwin-it as it is called using exec() which uses cmd.exe.
$userdir = behat_command::get_behat_dir() . '/users/' . $USER->id;
make_writable_directory($userdir);
return $userdir . '/behat.yml';
... | php | public static function get_steps_list_config_filepath() {
global $USER;
// We don't cygwin-it as it is called using exec() which uses cmd.exe.
$userdir = behat_command::get_behat_dir() . '/users/' . $USER->id;
make_writable_directory($userdir);
return $userdir . '/behat.yml';
... | [
"public",
"static",
"function",
"get_steps_list_config_filepath",
"(",
")",
"{",
"global",
"$",
"USER",
";",
"// We don't cygwin-it as it is called using exec() which uses cmd.exe.",
"$",
"userdir",
"=",
"behat_command",
"::",
"get_behat_dir",
"(",
")",
".",
"'/users/'",
... | Returns the behat config file path used by the steps definition list
@return string | [
"Returns",
"the",
"behat",
"config",
"file",
"path",
"used",
"by",
"the",
"steps",
"definition",
"list"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/classes/behat_config_manager.php#L155-L163 |
215,571 | moodle/moodle | lib/behat/classes/behat_config_manager.php | behat_config_manager.get_behat_cli_config_filepath | public static function get_behat_cli_config_filepath($runprocess = 0) {
global $CFG;
if ($runprocess) {
if (isset($CFG->behat_parallel_run[$runprocess - 1 ]['behat_dataroot'])) {
$command = $CFG->behat_parallel_run[$runprocess - 1]['behat_dataroot'];
} else {
... | php | public static function get_behat_cli_config_filepath($runprocess = 0) {
global $CFG;
if ($runprocess) {
if (isset($CFG->behat_parallel_run[$runprocess - 1 ]['behat_dataroot'])) {
$command = $CFG->behat_parallel_run[$runprocess - 1]['behat_dataroot'];
} else {
... | [
"public",
"static",
"function",
"get_behat_cli_config_filepath",
"(",
"$",
"runprocess",
"=",
"0",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"$",
"runprocess",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"CFG",
"->",
"behat_parallel_run",
"[",
"$",
"ru... | Returns the behat config file path used by the behat cli command.
@param int $runprocess Runprocess.
@return string | [
"Returns",
"the",
"behat",
"config",
"file",
"path",
"used",
"by",
"the",
"behat",
"cli",
"command",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/classes/behat_config_manager.php#L171-L191 |
215,572 | moodle/moodle | lib/behat/classes/behat_config_manager.php | behat_config_manager.get_behat_run_config_value | public final static function get_behat_run_config_value($key) {
$parallelrunconfigfile = self::get_behat_run_config_file_path();
if (file_exists($parallelrunconfigfile)) {
if ($parallelrunconfigs = @json_decode(file_get_contents($parallelrunconfigfile), true)) {
if (isset($p... | php | public final static function get_behat_run_config_value($key) {
$parallelrunconfigfile = self::get_behat_run_config_file_path();
if (file_exists($parallelrunconfigfile)) {
if ($parallelrunconfigs = @json_decode(file_get_contents($parallelrunconfigfile), true)) {
if (isset($p... | [
"public",
"final",
"static",
"function",
"get_behat_run_config_value",
"(",
"$",
"key",
")",
"{",
"$",
"parallelrunconfigfile",
"=",
"self",
"::",
"get_behat_run_config_file_path",
"(",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"parallelrunconfigfile",
")",
")... | Get config for parallel run.
@param string $key Key to store
@return string|int|array value which is stored. | [
"Get",
"config",
"for",
"parallel",
"run",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/classes/behat_config_manager.php#L209-L221 |
215,573 | moodle/moodle | lib/behat/classes/behat_config_manager.php | behat_config_manager.drop_parallel_site_links | public final static function drop_parallel_site_links() {
global $CFG;
// Get parallel test runs.
$parallelrun = self::get_behat_run_config_value('parallel');
if (empty($parallelrun)) {
return false;
}
// If parallel run then remove links and original file.... | php | public final static function drop_parallel_site_links() {
global $CFG;
// Get parallel test runs.
$parallelrun = self::get_behat_run_config_value('parallel');
if (empty($parallelrun)) {
return false;
}
// If parallel run then remove links and original file.... | [
"public",
"final",
"static",
"function",
"drop_parallel_site_links",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// Get parallel test runs.",
"$",
"parallelrun",
"=",
"self",
"::",
"get_behat_run_config_value",
"(",
"'parallel'",
")",
";",
"if",
"(",
"empty",
"(",
... | Drops parallel site links.
@return bool true on success else false. | [
"Drops",
"parallel",
"site",
"links",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/classes/behat_config_manager.php#L247-L270 |
215,574 | moodle/moodle | lib/behat/classes/behat_config_manager.php | behat_config_manager.create_parallel_site_links | public final static function create_parallel_site_links($fromrun, $torun) {
global $CFG;
// Create site symlink if necessary.
clearstatcache();
for ($i = $fromrun; $i <= $torun; $i++) {
// Don't create links for specified sites, as they should be accessible.
if (... | php | public final static function create_parallel_site_links($fromrun, $torun) {
global $CFG;
// Create site symlink if necessary.
clearstatcache();
for ($i = $fromrun; $i <= $torun; $i++) {
// Don't create links for specified sites, as they should be accessible.
if (... | [
"public",
"final",
"static",
"function",
"create_parallel_site_links",
"(",
"$",
"fromrun",
",",
"$",
"torun",
")",
"{",
"global",
"$",
"CFG",
";",
"// Create site symlink if necessary.",
"clearstatcache",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"fromru... | Create parallel site links.
@param int $fromrun first run
@param int $torun last run.
@return bool true for sucess, else false. | [
"Create",
"parallel",
"site",
"links",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/classes/behat_config_manager.php#L279-L303 |
215,575 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Cache.php | Horde_Imap_Client_Cache.get | public function get($mailbox, array $uids = array(), $fields = array(),
$uidvalid = null)
{
$mailbox = strval($mailbox);
if (empty($uids)) {
$ret = $this->_backend->getCachedUids($mailbox, $uidvalid);
} else {
$ret = $this->_backend->get($mail... | php | public function get($mailbox, array $uids = array(), $fields = array(),
$uidvalid = null)
{
$mailbox = strval($mailbox);
if (empty($uids)) {
$ret = $this->_backend->getCachedUids($mailbox, $uidvalid);
} else {
$ret = $this->_backend->get($mail... | [
"public",
"function",
"get",
"(",
"$",
"mailbox",
",",
"array",
"$",
"uids",
"=",
"array",
"(",
")",
",",
"$",
"fields",
"=",
"array",
"(",
")",
",",
"$",
"uidvalid",
"=",
"null",
")",
"{",
"$",
"mailbox",
"=",
"strval",
"(",
"$",
"mailbox",
")",... | Get information from the cache.
@param string $mailbox An IMAP mailbox string.
@param array $uids The list of message UIDs to retrieve
information for. If empty, returns the list
of cached UIDs.
@param array $fields An array of fields to retrieve. If empty,
returns all cached fields.
@param integer $uid... | [
"Get",
"information",
"from",
"the",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Cache.php#L104-L125 |
215,576 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Cache.php | Horde_Imap_Client_Cache.set | public function set($mailbox, $data, $uidvalid)
{
$mailbox = strval($mailbox);
if (empty($data)) {
$this->_backend->getMetaData($mailbox, $uidvalid, array('uidvalid'));
} else {
$this->_backend->set($mailbox, $data, $uidvalid);
if ($this->_debug) {
... | php | public function set($mailbox, $data, $uidvalid)
{
$mailbox = strval($mailbox);
if (empty($data)) {
$this->_backend->getMetaData($mailbox, $uidvalid, array('uidvalid'));
} else {
$this->_backend->set($mailbox, $data, $uidvalid);
if ($this->_debug) {
... | [
"public",
"function",
"set",
"(",
"$",
"mailbox",
",",
"$",
"data",
",",
"$",
"uidvalid",
")",
"{",
"$",
"mailbox",
"=",
"strval",
"(",
"$",
"mailbox",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"$",
"this",
"->",
"_backend",
... | Store information in cache.
@param string $mailbox An IMAP mailbox string.
@param array $data The list of data to save. The keys are the
UIDs, the values are an array of information
to save. If empty, do a check to make sure
the uidvalidity is still valid.
@param integer $uidvalid The IMAP uidvalidity value... | [
"Store",
"information",
"in",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Cache.php#L137-L154 |
215,577 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Cache.php | Horde_Imap_Client_Cache.getMetaData | public function getMetaData($mailbox, $uidvalid = null,
array $entries = array())
{
return $this->_backend->getMetaData(strval($mailbox), $uidvalid, $entries);
} | php | public function getMetaData($mailbox, $uidvalid = null,
array $entries = array())
{
return $this->_backend->getMetaData(strval($mailbox), $uidvalid, $entries);
} | [
"public",
"function",
"getMetaData",
"(",
"$",
"mailbox",
",",
"$",
"uidvalid",
"=",
"null",
",",
"array",
"$",
"entries",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_backend",
"->",
"getMetaData",
"(",
"strval",
"(",
"$",
"mailbox... | Get metadata information for a mailbox.
@param string $mailbox An IMAP mailbox string.
@param integer $uidvalid The IMAP uidvalidity value of the mailbox.
@param array $entries An array of entries to return. If empty,
returns all metadata.
@return array The requested metadata. Requested entries that do not
e... | [
"Get",
"metadata",
"information",
"for",
"a",
"mailbox",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Cache.php#L169-L173 |
215,578 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Cache.php | Horde_Imap_Client_Cache.setMetaData | public function setMetaData($mailbox, $uidvalid, array $data = array())
{
unset($data['uidvalid']);
if (!empty($data)) {
if (!empty($uidvalid)) {
$data['uidvalid'] = $uidvalid;
}
$mailbox = strval($mailbox);
$this->_backend->setMetaDa... | php | public function setMetaData($mailbox, $uidvalid, array $data = array())
{
unset($data['uidvalid']);
if (!empty($data)) {
if (!empty($uidvalid)) {
$data['uidvalid'] = $uidvalid;
}
$mailbox = strval($mailbox);
$this->_backend->setMetaDa... | [
"public",
"function",
"setMetaData",
"(",
"$",
"mailbox",
",",
"$",
"uidvalid",
",",
"array",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"unset",
"(",
"$",
"data",
"[",
"'uidvalid'",
"]",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"data",
"... | Set metadata information for a mailbox.
@param string $mailbox An IMAP mailbox string.
@param integer $uidvalid The IMAP uidvalidity value of the mailbox.
@param array $data The list of data to save. The keys are the
metadata IDs, the values are the associated
data. The following labels are reserved:
'uidva... | [
"Set",
"metadata",
"information",
"for",
"a",
"mailbox",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Cache.php#L185-L205 |
215,579 | moodle/moodle | course/classes/analytics/target/course_enrolments.php | course_enrolments.is_valid_sample | public function is_valid_sample($sampleid, \core_analytics\analysable $course, $fortraining = true) {
$userenrol = $this->retrieve('user_enrolments', $sampleid);
if ($userenrol->timeend && $course->get_start() > $userenrol->timeend) {
// Discard enrolments which time end is prior to the cou... | php | public function is_valid_sample($sampleid, \core_analytics\analysable $course, $fortraining = true) {
$userenrol = $this->retrieve('user_enrolments', $sampleid);
if ($userenrol->timeend && $course->get_start() > $userenrol->timeend) {
// Discard enrolments which time end is prior to the cou... | [
"public",
"function",
"is_valid_sample",
"(",
"$",
"sampleid",
",",
"\\",
"core_analytics",
"\\",
"analysable",
"$",
"course",
",",
"$",
"fortraining",
"=",
"true",
")",
"{",
"$",
"userenrol",
"=",
"$",
"this",
"->",
"retrieve",
"(",
"'user_enrolments'",
","... | Discard student enrolments that are invalid.
@param int $sampleid
@param \core_analytics\analysable $course
@param bool $fortraining
@return bool | [
"Discard",
"student",
"enrolments",
"that",
"are",
"invalid",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/analytics/target/course_enrolments.php#L123-L149 |
215,580 | moodle/moodle | report/eventlist/classes/filter_form.php | report_eventlist_filter_form.definition | public function definition() {
$mform = $this->_form;
$mform->disable_form_change_checker();
$componentarray = $this->_customdata['components'];
$edulevelarray = $this->_customdata['edulevel'];
$crudarray = $this->_customdata['crud'];
$mform->addElement('header', 'displ... | php | public function definition() {
$mform = $this->_form;
$mform->disable_form_change_checker();
$componentarray = $this->_customdata['components'];
$edulevelarray = $this->_customdata['edulevel'];
$crudarray = $this->_customdata['crud'];
$mform->addElement('header', 'displ... | [
"public",
"function",
"definition",
"(",
")",
"{",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"$",
"mform",
"->",
"disable_form_change_checker",
"(",
")",
";",
"$",
"componentarray",
"=",
"$",
"this",
"->",
"_customdata",
"[",
"'components'",
"]",... | Form definition method. | [
"Form",
"definition",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/eventlist/classes/filter_form.php#L33-L54 |
215,581 | moodle/moodle | lib/spout/src/Spout/Writer/CSV/Writer.php | Writer.openWriter | protected function openWriter()
{
if ($this->shouldAddBOM) {
// Adds UTF-8 BOM for Unicode compatibility
$this->globalFunctionsHelper->fputs($this->filePointer, EncodingHelper::BOM_UTF8);
}
} | php | protected function openWriter()
{
if ($this->shouldAddBOM) {
// Adds UTF-8 BOM for Unicode compatibility
$this->globalFunctionsHelper->fputs($this->filePointer, EncodingHelper::BOM_UTF8);
}
} | [
"protected",
"function",
"openWriter",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shouldAddBOM",
")",
"{",
"// Adds UTF-8 BOM for Unicode compatibility",
"$",
"this",
"->",
"globalFunctionsHelper",
"->",
"fputs",
"(",
"$",
"this",
"->",
"filePointer",
",",
"E... | Opens the CSV streamer and makes it ready to accept data.
@return void | [
"Opens",
"the",
"CSV",
"streamer",
"and",
"makes",
"it",
"ready",
"to",
"accept",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/CSV/Writer.php#L78-L84 |
215,582 | moodle/moodle | lib/spout/src/Spout/Writer/CSV/Writer.php | Writer.addRowToWriter | protected function addRowToWriter(array $dataRow, $style)
{
$wasWriteSuccessful = $this->globalFunctionsHelper->fputcsv($this->filePointer, $dataRow, $this->fieldDelimiter, $this->fieldEnclosure);
if ($wasWriteSuccessful === false) {
throw new IOException('Unable to write data');
... | php | protected function addRowToWriter(array $dataRow, $style)
{
$wasWriteSuccessful = $this->globalFunctionsHelper->fputcsv($this->filePointer, $dataRow, $this->fieldDelimiter, $this->fieldEnclosure);
if ($wasWriteSuccessful === false) {
throw new IOException('Unable to write data');
... | [
"protected",
"function",
"addRowToWriter",
"(",
"array",
"$",
"dataRow",
",",
"$",
"style",
")",
"{",
"$",
"wasWriteSuccessful",
"=",
"$",
"this",
"->",
"globalFunctionsHelper",
"->",
"fputcsv",
"(",
"$",
"this",
"->",
"filePointer",
",",
"$",
"dataRow",
","... | Adds data to the currently opened writer.
@param array $dataRow Array containing data to be written.
Example $dataRow = ['data1', 1234, null, '', 'data5'];
@param \Box\Spout\Writer\Style\Style $style Ignored here since CSV does not support styling.
@return void
@throws \Box\Spout\Common\Exception\IOException If unabl... | [
"Adds",
"data",
"to",
"the",
"currently",
"opened",
"writer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/CSV/Writer.php#L95-L106 |
215,583 | moodle/moodle | lib/dtl/database_importer.php | database_importer.begin_table_import | public function begin_table_import($tablename, $schemaHash) {
if ($this->transactionmode == 'pertable') {
$this->transaction = $this->mdb->start_delegated_transaction();
}
if (!$table = $this->schema->getTable($tablename)) {
throw new dbtransfer_exception('unknowntableexc... | php | public function begin_table_import($tablename, $schemaHash) {
if ($this->transactionmode == 'pertable') {
$this->transaction = $this->mdb->start_delegated_transaction();
}
if (!$table = $this->schema->getTable($tablename)) {
throw new dbtransfer_exception('unknowntableexc... | [
"public",
"function",
"begin_table_import",
"(",
"$",
"tablename",
",",
"$",
"schemaHash",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"transactionmode",
"==",
"'pertable'",
")",
"{",
"$",
"this",
"->",
"transaction",
"=",
"$",
"this",
"->",
"mdb",
"->",
"st... | Callback function. Should be called only once per table import operation,
before any table changes are made. It will delete all table data.
@throws dbtransfer_exception an unknown table import is attempted
@throws ddl_table_missing_exception if the table is missing
@param string $tablename - the name of the table tha... | [
"Callback",
"function",
".",
"Should",
"be",
"called",
"only",
"once",
"per",
"table",
"import",
"operation",
"before",
"any",
"table",
"changes",
"are",
"made",
".",
"It",
"will",
"delete",
"all",
"table",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dtl/database_importer.php#L142-L157 |
215,584 | moodle/moodle | lib/dtl/database_importer.php | database_importer.finish_table_import | public function finish_table_import($tablename) {
$table = $this->schema->getTable($tablename);
$fields = $table->getFields();
foreach ($fields as $field) {
if ($field->getSequence()) {
$this->manager->reset_sequence($tablename);
return;
}... | php | public function finish_table_import($tablename) {
$table = $this->schema->getTable($tablename);
$fields = $table->getFields();
foreach ($fields as $field) {
if ($field->getSequence()) {
$this->manager->reset_sequence($tablename);
return;
}... | [
"public",
"function",
"finish_table_import",
"(",
"$",
"tablename",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"schema",
"->",
"getTable",
"(",
"$",
"tablename",
")",
";",
"$",
"fields",
"=",
"$",
"table",
"->",
"getFields",
"(",
")",
";",
"foreac... | Callback function. Should be called only once per table import operation,
after all table changes are made. It will reset table sequences if any.
@param string $tablename
@return void | [
"Callback",
"function",
".",
"Should",
"be",
"called",
"only",
"once",
"per",
"table",
"import",
"operation",
"after",
"all",
"table",
"changes",
"are",
"made",
".",
"It",
"will",
"reset",
"table",
"sequences",
"if",
"any",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dtl/database_importer.php#L165-L177 |
215,585 | moodle/moodle | question/renderer.php | core_question_bank_renderer.extra_horizontal_navigation | public function extra_horizontal_navigation() {
// Horizontal navigation for question bank.
if ($questionnode = $this->page->settingsnav->find("questionbank", \navigation_node::TYPE_CONTAINER)) {
if ($children = $questionnode->children) {
$tabs = [];
foreach (... | php | public function extra_horizontal_navigation() {
// Horizontal navigation for question bank.
if ($questionnode = $this->page->settingsnav->find("questionbank", \navigation_node::TYPE_CONTAINER)) {
if ($children = $questionnode->children) {
$tabs = [];
foreach (... | [
"public",
"function",
"extra_horizontal_navigation",
"(",
")",
"{",
"// Horizontal navigation for question bank.",
"if",
"(",
"$",
"questionnode",
"=",
"$",
"this",
"->",
"page",
"->",
"settingsnav",
"->",
"find",
"(",
"\"questionbank\"",
",",
"\\",
"navigation_node",... | Display additional navigation if needed.
@return string | [
"Display",
"additional",
"navigation",
"if",
"needed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/renderer.php#L43-L56 |
215,586 | moodle/moodle | question/renderer.php | core_question_bank_renderer.qtype_icon | public function qtype_icon($qtype) {
$qtype = question_bank::get_qtype($qtype, false);
$namestr = $qtype->local_name();
return $this->image_icon('icon', $namestr, $qtype->plugin_name(), array('title' => $namestr));
} | php | public function qtype_icon($qtype) {
$qtype = question_bank::get_qtype($qtype, false);
$namestr = $qtype->local_name();
return $this->image_icon('icon', $namestr, $qtype->plugin_name(), array('title' => $namestr));
} | [
"public",
"function",
"qtype_icon",
"(",
"$",
"qtype",
")",
"{",
"$",
"qtype",
"=",
"question_bank",
"::",
"get_qtype",
"(",
"$",
"qtype",
",",
"false",
")",
";",
"$",
"namestr",
"=",
"$",
"qtype",
"->",
"local_name",
"(",
")",
";",
"return",
"$",
"t... | Output the icon for a question type.
@param string $qtype the question type.
@return string HTML fragment. | [
"Output",
"the",
"icon",
"for",
"a",
"question",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/renderer.php#L64-L69 |
215,587 | moodle/moodle | enrol/lti/classes/task/sync_members.php | sync_members.execute | public function execute() {
if (!is_enabled_auth('lti')) {
mtrace('Skipping task - ' . get_string('pluginnotenabled', 'auth', get_string('pluginname', 'auth_lti')));
return;
}
// Check if the enrolment plugin is disabled - isn't really necessary as the task should not ru... | php | public function execute() {
if (!is_enabled_auth('lti')) {
mtrace('Skipping task - ' . get_string('pluginnotenabled', 'auth', get_string('pluginname', 'auth_lti')));
return;
}
// Check if the enrolment plugin is disabled - isn't really necessary as the task should not ru... | [
"public",
"function",
"execute",
"(",
")",
"{",
"if",
"(",
"!",
"is_enabled_auth",
"(",
"'lti'",
")",
")",
"{",
"mtrace",
"(",
"'Skipping task - '",
".",
"get_string",
"(",
"'pluginnotenabled'",
",",
"'auth'",
",",
"get_string",
"(",
"'pluginname'",
",",
"'a... | Performs the synchronisation of members. | [
"Performs",
"the",
"synchronisation",
"of",
"members",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/task/sync_members.php#L71-L133 |
215,588 | moodle/moodle | enrol/lti/classes/task/sync_members.php | sync_members.fetch_members_from_consumer | protected function fetch_members_from_consumer(ToolConsumer $consumer) {
$dataconnector = $this->dataconnector;
// Get membership URL template from consumer profile data.
$defaultmembershipsurl = null;
if (isset($consumer->profile->service_offered)) {
$servicesoffered = $con... | php | protected function fetch_members_from_consumer(ToolConsumer $consumer) {
$dataconnector = $this->dataconnector;
// Get membership URL template from consumer profile data.
$defaultmembershipsurl = null;
if (isset($consumer->profile->service_offered)) {
$servicesoffered = $con... | [
"protected",
"function",
"fetch_members_from_consumer",
"(",
"ToolConsumer",
"$",
"consumer",
")",
"{",
"$",
"dataconnector",
"=",
"$",
"this",
"->",
"dataconnector",
";",
"// Get membership URL template from consumer profile data.",
"$",
"defaultmembershipsurl",
"=",
"null... | Fetches the members that belong to a ToolConsumer.
@param ToolConsumer $consumer
@return bool|User[] | [
"Fetches",
"the",
"members",
"that",
"belong",
"to",
"a",
"ToolConsumer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/task/sync_members.php#L141-L191 |
215,589 | moodle/moodle | enrol/lti/classes/task/sync_members.php | sync_members.sync_member_information | protected function sync_member_information(stdClass $tool, ToolConsumer $consumer, $members) {
global $DB;
$usercount = 0;
$enrolcount = 0;
// Process member information.
foreach ($members as $member) {
$usercount++;
// Set the user data.
$us... | php | protected function sync_member_information(stdClass $tool, ToolConsumer $consumer, $members) {
global $DB;
$usercount = 0;
$enrolcount = 0;
// Process member information.
foreach ($members as $member) {
$usercount++;
// Set the user data.
$us... | [
"protected",
"function",
"sync_member_information",
"(",
"stdClass",
"$",
"tool",
",",
"ToolConsumer",
"$",
"consumer",
",",
"$",
"members",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"usercount",
"=",
"0",
";",
"$",
"enrolcount",
"=",
"0",
";",
"// Process ... | Performs synchronisation of member information and enrolments.
@param stdClass $tool
@param ToolConsumer $consumer
@param User[] $members
@return array An array containing the number of members that were processed and the number of members that were enrolled. | [
"Performs",
"synchronisation",
"of",
"member",
"information",
"and",
"enrolments",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/task/sync_members.php#L221-L294 |
215,590 | moodle/moodle | enrol/lti/classes/task/sync_members.php | sync_members.sync_unenrol | protected function sync_unenrol(stdClass $tool) {
global $DB;
$ltiplugin = enrol_get_plugin('lti');
if (!$this->should_sync_unenrol($tool->membersyncmode)) {
return 0;
}
if (empty($this->currentusers)) {
return 0;
}
$unenrolcount = 0;
... | php | protected function sync_unenrol(stdClass $tool) {
global $DB;
$ltiplugin = enrol_get_plugin('lti');
if (!$this->should_sync_unenrol($tool->membersyncmode)) {
return 0;
}
if (empty($this->currentusers)) {
return 0;
}
$unenrolcount = 0;
... | [
"protected",
"function",
"sync_unenrol",
"(",
"stdClass",
"$",
"tool",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"ltiplugin",
"=",
"enrol_get_plugin",
"(",
"'lti'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"should_sync_unenrol",
"(",
"$",
"tool",
"->"... | Performs unenrolment of users that are no longer enrolled in the consumer side.
@param stdClass $tool The tool record object.
@return int The number of users that have been unenrolled. | [
"Performs",
"unenrolment",
"of",
"users",
"that",
"are",
"no",
"longer",
"enrolled",
"in",
"the",
"consumer",
"side",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/task/sync_members.php#L302-L333 |
215,591 | moodle/moodle | enrol/lti/classes/task/sync_members.php | sync_members.sync_profile_images | protected function sync_profile_images() {
$counter = 0;
foreach ($this->userphotos as $userid => $url) {
if ($url) {
$result = helper::update_user_profile_image($userid, $url);
if ($result === helper::PROFILE_IMAGE_UPDATE_SUCCESSFUL) {
$co... | php | protected function sync_profile_images() {
$counter = 0;
foreach ($this->userphotos as $userid => $url) {
if ($url) {
$result = helper::update_user_profile_image($userid, $url);
if ($result === helper::PROFILE_IMAGE_UPDATE_SUCCESSFUL) {
$co... | [
"protected",
"function",
"sync_profile_images",
"(",
")",
"{",
"$",
"counter",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"userphotos",
"as",
"$",
"userid",
"=>",
"$",
"url",
")",
"{",
"if",
"(",
"$",
"url",
")",
"{",
"$",
"result",
"=",
"he... | Performs synchronisation of user profile images. | [
"Performs",
"synchronisation",
"of",
"user",
"profile",
"images",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/task/sync_members.php#L338-L352 |
215,592 | moodle/moodle | enrol/lti/classes/task/sync_members.php | sync_members.do_context_membership_request | protected function do_context_membership_request(Context $context, ResourceLink $resourcelink = null,
$membershipsurltemplate = '') {
$dataconnector = $this->dataconnector;
// Flag to indicate whether to save the context later.
$contextupdate... | php | protected function do_context_membership_request(Context $context, ResourceLink $resourcelink = null,
$membershipsurltemplate = '') {
$dataconnector = $this->dataconnector;
// Flag to indicate whether to save the context later.
$contextupdate... | [
"protected",
"function",
"do_context_membership_request",
"(",
"Context",
"$",
"context",
",",
"ResourceLink",
"$",
"resourcelink",
"=",
"null",
",",
"$",
"membershipsurltemplate",
"=",
"''",
")",
"{",
"$",
"dataconnector",
"=",
"$",
"this",
"->",
"dataconnector",... | Performs membership service request using an LTI Context object.
If the context has a 'custom_context_memberships_url' setting, we use this to perform the membership service request.
Otherwise, if a context is associated with resource link, we try first to get the members using the
ResourceLink::doMembershipsService()... | [
"Performs",
"membership",
"service",
"request",
"using",
"an",
"LTI",
"Context",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/task/sync_members.php#L368-L447 |
215,593 | moodle/moodle | filter/mediaplugin/filter.php | filter_mediaplugin.setup | public function setup($page, $context) {
// This only requires execution once per request.
static $jsinitialised = false;
if ($jsinitialised) {
return;
}
$jsinitialised = true;
// Set up the media manager so that media plugins requiring JS are initialised.
... | php | public function setup($page, $context) {
// This only requires execution once per request.
static $jsinitialised = false;
if ($jsinitialised) {
return;
}
$jsinitialised = true;
// Set up the media manager so that media plugins requiring JS are initialised.
... | [
"public",
"function",
"setup",
"(",
"$",
"page",
",",
"$",
"context",
")",
"{",
"// This only requires execution once per request.",
"static",
"$",
"jsinitialised",
"=",
"false",
";",
"if",
"(",
"$",
"jsinitialised",
")",
"{",
"return",
";",
"}",
"$",
"jsiniti... | Setup page with filter requirements and other prepare stuff.
@param moodle_page $page The page we are going to add requirements to.
@param context $context The context which contents are going to be filtered. | [
"Setup",
"page",
"with",
"filter",
"requirements",
"and",
"other",
"prepare",
"stuff",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/filter/mediaplugin/filter.php#L52-L62 |
215,594 | moodle/moodle | filter/mediaplugin/filter.php | filter_mediaplugin.callback | private function callback(array $matches) {
$mediamanager = core_media_manager::instance();
global $CFG, $PAGE;
// Check if we ignore it.
if (preg_match('/class="[^"]*nomediaplugin/i', $matches[0])) {
return $matches[0];
}
// Get name.
$name = trim($... | php | private function callback(array $matches) {
$mediamanager = core_media_manager::instance();
global $CFG, $PAGE;
// Check if we ignore it.
if (preg_match('/class="[^"]*nomediaplugin/i', $matches[0])) {
return $matches[0];
}
// Get name.
$name = trim($... | [
"private",
"function",
"callback",
"(",
"array",
"$",
"matches",
")",
"{",
"$",
"mediamanager",
"=",
"core_media_manager",
"::",
"instance",
"(",
")",
";",
"global",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"// Check if we ignore it.",
"if",
"(",
"preg_match",
"("... | Replace link with embedded content, if supported.
@param array $matches
@return string | [
"Replace",
"link",
"with",
"embedded",
"content",
"if",
"supported",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/filter/mediaplugin/filter.php#L144-L164 |
215,595 | moodle/moodle | lib/pdflib.php | pdf.get_font_families | public function get_font_families() {
$families = array();
foreach ($this->fontlist as $font) {
if (strpos($font, 'uni2cid') === 0) {
// This is not an font file.
continue;
}
if (strpos($font, 'cid0') === 0) {
// These d... | php | public function get_font_families() {
$families = array();
foreach ($this->fontlist as $font) {
if (strpos($font, 'uni2cid') === 0) {
// This is not an font file.
continue;
}
if (strpos($font, 'cid0') === 0) {
// These d... | [
"public",
"function",
"get_font_families",
"(",
")",
"{",
"$",
"families",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"fontlist",
"as",
"$",
"font",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"font",
",",
"'uni2cid'",
")",
"===",
... | Returns list of font families and types of fonts.
@return array multidimensional array with font families as keys and B, I, BI and N as values. | [
"Returns",
"list",
"of",
"font",
"families",
"and",
"types",
"of",
"fonts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pdflib.php#L209-L252 |
215,596 | moodle/moodle | cache/locks/file/lib.php | cachelock_file.lock | public function lock($key, $ownerid, $block = false) {
// Get the name of the lock file we want to use.
$lockfile = $this->get_lock_file($key);
// Attempt to create a handle to the lock file.
// Mode xb is the secret to this whole function.
// x = Creates the file and opens it... | php | public function lock($key, $ownerid, $block = false) {
// Get the name of the lock file we want to use.
$lockfile = $this->get_lock_file($key);
// Attempt to create a handle to the lock file.
// Mode xb is the secret to this whole function.
// x = Creates the file and opens it... | [
"public",
"function",
"lock",
"(",
"$",
"key",
",",
"$",
"ownerid",
",",
"$",
"block",
"=",
"false",
")",
"{",
"// Get the name of the lock file we want to use.",
"$",
"lockfile",
"=",
"$",
"this",
"->",
"get_lock_file",
"(",
"$",
"key",
")",
";",
"// Attemp... | Acquire a lock.
If the lock can be acquired:
This function will return true.
If the lock cannot be acquired the result of this method is determined by the block param:
$block = true (default)
The function will block any further execution unti the lock can be acquired.
This involves the function attempting to acquire ... | [
"Acquire",
"a",
"lock",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locks/file/lib.php#L125-L171 |
215,597 | moodle/moodle | cache/locks/file/lib.php | cachelock_file.unlock | public function unlock($key, $ownerid, $forceunlock = false) {
if (array_key_exists($key, $this->locks)) {
@unlink($this->locks[$key]);
unset($this->locks[$key]);
return true;
} else if ($forceunlock) {
$lockfile = $this->get_lock_file($key);
i... | php | public function unlock($key, $ownerid, $forceunlock = false) {
if (array_key_exists($key, $this->locks)) {
@unlink($this->locks[$key]);
unset($this->locks[$key]);
return true;
} else if ($forceunlock) {
$lockfile = $this->get_lock_file($key);
i... | [
"public",
"function",
"unlock",
"(",
"$",
"key",
",",
"$",
"ownerid",
",",
"$",
"forceunlock",
"=",
"false",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"locks",
")",
")",
"{",
"@",
"unlink",
"(",
"$",
"this",
... | Releases an acquired lock.
For more details see {@link cache_lock::unlock()}
@param string $key
@param string $ownerid A unique identifier for the owner of this lock. Not used by default.
@param bool $forceunlock If set to true the lock will be removed if it exists regardless of whether or not we own it.
@return bool | [
"Releases",
"an",
"acquired",
"lock",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locks/file/lib.php#L183-L197 |
215,598 | moodle/moodle | cache/locks/file/lib.php | cachelock_file.check_state | public function check_state($key, $ownerid) {
if (array_key_exists($key, $this->locks)) {
// The key is locked and we own it.
return true;
}
$lockfile = $this->get_lock_file($key);
if (file_exists($lockfile)) {
// The key is locked and we don't own it.... | php | public function check_state($key, $ownerid) {
if (array_key_exists($key, $this->locks)) {
// The key is locked and we own it.
return true;
}
$lockfile = $this->get_lock_file($key);
if (file_exists($lockfile)) {
// The key is locked and we don't own it.... | [
"public",
"function",
"check_state",
"(",
"$",
"key",
",",
"$",
"ownerid",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"locks",
")",
")",
"{",
"// The key is locked and we own it.",
"return",
"true",
";",
"}",
"$",
"... | Checks if the given key is locked.
@param string $key
@param string $ownerid | [
"Checks",
"if",
"the",
"given",
"key",
"is",
"locked",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locks/file/lib.php#L205-L216 |
215,599 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/Math/Statistic/Covariance.php | Covariance.fromXYArrays | public static function fromXYArrays(array $x, array $y, $sample = true, float $meanX = null, float $meanY = null)
{
if (empty($x) || empty($y)) {
throw InvalidArgumentException::arrayCantBeEmpty();
}
$n = count($x);
if ($sample && $n === 1) {
throw InvalidArg... | php | public static function fromXYArrays(array $x, array $y, $sample = true, float $meanX = null, float $meanY = null)
{
if (empty($x) || empty($y)) {
throw InvalidArgumentException::arrayCantBeEmpty();
}
$n = count($x);
if ($sample && $n === 1) {
throw InvalidArg... | [
"public",
"static",
"function",
"fromXYArrays",
"(",
"array",
"$",
"x",
",",
"array",
"$",
"y",
",",
"$",
"sample",
"=",
"true",
",",
"float",
"$",
"meanX",
"=",
"null",
",",
"float",
"$",
"meanY",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
... | Calculates covariance from two given arrays, x and y, respectively
@param array $x
@param array $y
@param bool $sample
@param float $meanX
@param float $meanY
@return float
@throws InvalidArgumentException | [
"Calculates",
"covariance",
"from",
"two",
"given",
"arrays",
"x",
"and",
"y",
"respectively"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Math/Statistic/Covariance.php#L24-L54 |
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.