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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
213,100 | moodle/moodle | mod/workshop/classes/privacy/provider.php | provider.export_assessment_forms | protected static function export_assessment_forms(\stdClass $user, \context $context, array $subcontext, int $assessmentid) {
foreach (\workshop::available_strategies_list() as $strategy => $title) {
$providername = '\workshopform_'.$strategy.'\privacy\provider';
if (is_subclass_of($pr... | php | protected static function export_assessment_forms(\stdClass $user, \context $context, array $subcontext, int $assessmentid) {
foreach (\workshop::available_strategies_list() as $strategy => $title) {
$providername = '\workshopform_'.$strategy.'\privacy\provider';
if (is_subclass_of($pr... | [
"protected",
"static",
"function",
"export_assessment_forms",
"(",
"\\",
"stdClass",
"$",
"user",
",",
"\\",
"context",
"$",
"context",
",",
"array",
"$",
"subcontext",
",",
"int",
"$",
"assessmentid",
")",
"{",
"foreach",
"(",
"\\",
"workshop",
"::",
"avail... | Export the grading strategy data related to the particular assessment.
@param stdClass $user User we are exporting for
@param context $context Workshop activity content
@param array $subcontext Subcontext path of the assessment
@param int $assessmentid ID of the exported assessment | [
"Export",
"the",
"grading",
"strategy",
"data",
"related",
"to",
"the",
"particular",
"assessment",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/classes/privacy/provider.php#L546-L565 |
213,101 | moodle/moodle | mod/workshop/classes/privacy/provider.php | provider.delete_data_for_all_users_in_context | public static function delete_data_for_all_users_in_context(\context $context) {
global $CFG, $DB;
require_once($CFG->libdir.'/gradelib.php');
if ($context->contextlevel != CONTEXT_MODULE) {
return;
}
$cm = get_coursemodule_from_id('workshop', $context->instanceid, ... | php | public static function delete_data_for_all_users_in_context(\context $context) {
global $CFG, $DB;
require_once($CFG->libdir.'/gradelib.php');
if ($context->contextlevel != CONTEXT_MODULE) {
return;
}
$cm = get_coursemodule_from_id('workshop', $context->instanceid, ... | [
"public",
"static",
"function",
"delete_data_for_all_users_in_context",
"(",
"\\",
"context",
"$",
"context",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/gradelib.php'",
")",
";",
"if",
"(",
... | Delete personal data for all users in the context.
@param context $context Context to delete personal data from. | [
"Delete",
"personal",
"data",
"for",
"all",
"users",
"in",
"the",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/classes/privacy/provider.php#L572-L607 |
213,102 | moodle/moodle | auth/cas/CAS/CAS/Request/CurlMultiRequest.php | CAS_Request_CurlMultiRequest.addRequest | public function addRequest (CAS_Request_RequestInterface $request)
{
if ($this->_sent) {
throw new CAS_OutOfSequenceException(
'Request has already been sent cannot '.__METHOD__
);
}
if (!$request instanceof CAS_Request_CurlRequest) {
throw... | php | public function addRequest (CAS_Request_RequestInterface $request)
{
if ($this->_sent) {
throw new CAS_OutOfSequenceException(
'Request has already been sent cannot '.__METHOD__
);
}
if (!$request instanceof CAS_Request_CurlRequest) {
throw... | [
"public",
"function",
"addRequest",
"(",
"CAS_Request_RequestInterface",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_sent",
")",
"{",
"throw",
"new",
"CAS_OutOfSequenceException",
"(",
"'Request has already been sent cannot '",
".",
"__METHOD__",
")",
... | Add a new Request to this batch.
Note, implementations will likely restrict requests to their own concrete
class hierarchy.
@param CAS_Request_RequestInterface $request reqest to add
@return void
@throws CAS_OutOfSequenceException If called after the Request has been sent.
@throws CAS_InvalidArgumentException If pass... | [
"Add",
"a",
"new",
"Request",
"to",
"this",
"batch",
".",
"Note",
"implementations",
"will",
"likely",
"restrict",
"requests",
"to",
"their",
"own",
"concrete",
"class",
"hierarchy",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Request/CurlMultiRequest.php#L64-L78 |
213,103 | moodle/moodle | auth/cas/CAS/CAS/Request/CurlMultiRequest.php | CAS_Request_CurlMultiRequest.send | public function send ()
{
if ($this->_sent) {
throw new CAS_OutOfSequenceException(
'Request has already been sent cannot send again.'
);
}
if (!count($this->_requests)) {
throw new CAS_OutOfSequenceException(
'At least one ... | php | public function send ()
{
if ($this->_sent) {
throw new CAS_OutOfSequenceException(
'Request has already been sent cannot send again.'
);
}
if (!count($this->_requests)) {
throw new CAS_OutOfSequenceException(
'At least one ... | [
"public",
"function",
"send",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_sent",
")",
"{",
"throw",
"new",
"CAS_OutOfSequenceException",
"(",
"'Request has already been sent cannot send again.'",
")",
";",
"}",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"... | Perform the request. After sending, all requests will have their
responses poulated.
@return bool TRUE on success, FALSE on failure.
@throws CAS_OutOfSequenceException If called multiple times. | [
"Perform",
"the",
"request",
".",
"After",
"sending",
"all",
"requests",
"will",
"have",
"their",
"responses",
"poulated",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Request/CurlMultiRequest.php#L106-L145 |
213,104 | moodle/moodle | blog/locallib.php | blog_entry.get_attachments | public function get_attachments() {
global $CFG;
require_once($CFG->libdir.'/filelib.php');
$syscontext = context_system::instance();
$fs = get_file_storage();
$files = $fs->get_area_files($syscontext->id, 'blog', 'attachment', $this->id);
// Adding a blog_entry_atta... | php | public function get_attachments() {
global $CFG;
require_once($CFG->libdir.'/filelib.php');
$syscontext = context_system::instance();
$fs = get_file_storage();
$files = $fs->get_area_files($syscontext->id, 'blog', 'attachment', $this->id);
// Adding a blog_entry_atta... | [
"public",
"function",
"get_attachments",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/filelib.php'",
")",
";",
"$",
"syscontext",
"=",
"context_system",
"::",
"instance",
"(",
")",
";",
"$",
"fs",
"="... | Gets the entry attachments list
@return array List of blog_entry_attachment instances | [
"Gets",
"the",
"entry",
"attachments",
"list"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/locallib.php#L209-L230 |
213,105 | moodle/moodle | blog/locallib.php | blog_entry.edit | public function edit($params=array(), $form=null, $summaryoptions=array(), $attachmentoptions=array()) {
global $CFG, $DB;
$sitecontext = context_system::instance();
$entry = $this;
$this->form = $form;
foreach ($params as $var => $val) {
$entry->$var = $val;
... | php | public function edit($params=array(), $form=null, $summaryoptions=array(), $attachmentoptions=array()) {
global $CFG, $DB;
$sitecontext = context_system::instance();
$entry = $this;
$this->form = $form;
foreach ($params as $var => $val) {
$entry->$var = $val;
... | [
"public",
"function",
"edit",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"form",
"=",
"null",
",",
"$",
"summaryoptions",
"=",
"array",
"(",
")",
",",
"$",
"attachmentoptions",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"CFG",
",",... | Updates this entry in the database. Access control checks must be done by calling code.
@param array $params Entry parameters.
@param moodleform $form Used for attachments.
@param array $summaryoptions Summary options.
@param array $attachmentoptions Attachment options.
@... | [
"Updates",
"this",
"entry",
"in",
"the",
"database",
".",
"Access",
"control",
"checks",
"must",
"be",
"done",
"by",
"calling",
"code",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/locallib.php#L284-L320 |
213,106 | moodle/moodle | blog/locallib.php | blog_entry.delete | public function delete() {
global $DB;
$this->delete_attachments();
$this->remove_associations();
// Get record to pass onto the event.
$record = $DB->get_record('post', array('id' => $this->id));
$DB->delete_records('post', array('id' => $this->id));
core_tag_t... | php | public function delete() {
global $DB;
$this->delete_attachments();
$this->remove_associations();
// Get record to pass onto the event.
$record = $DB->get_record('post', array('id' => $this->id));
$DB->delete_records('post', array('id' => $this->id));
core_tag_t... | [
"public",
"function",
"delete",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"delete_attachments",
"(",
")",
";",
"$",
"this",
"->",
"remove_associations",
"(",
")",
";",
"// Get record to pass onto the event.",
"$",
"record",
"=",
"$",
"DB",
... | Deletes this entry from the database. Access control checks must be done by calling code.
@return void | [
"Deletes",
"this",
"entry",
"from",
"the",
"database",
".",
"Access",
"control",
"checks",
"must",
"be",
"done",
"by",
"calling",
"code",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/locallib.php#L327-L345 |
213,107 | moodle/moodle | blog/locallib.php | blog_entry.add_associations | public function add_associations($unused = null) {
if ($unused !== null) {
debugging('Illegal argument used in blog_entry->add_associations()', DEBUG_DEVELOPER);
}
$this->remove_associations();
if (!empty($this->courseassoc)) {
$this->add_association($this->cou... | php | public function add_associations($unused = null) {
if ($unused !== null) {
debugging('Illegal argument used in blog_entry->add_associations()', DEBUG_DEVELOPER);
}
$this->remove_associations();
if (!empty($this->courseassoc)) {
$this->add_association($this->cou... | [
"public",
"function",
"add_associations",
"(",
"$",
"unused",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"unused",
"!==",
"null",
")",
"{",
"debugging",
"(",
"'Illegal argument used in blog_entry->add_associations()'",
",",
"DEBUG_DEVELOPER",
")",
";",
"}",
"$",
"th... | Function to add all context associations to an entry.
@param string $unused This does nothing, do not use it. | [
"Function",
"to",
"add",
"all",
"context",
"associations",
"to",
"an",
"entry",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/locallib.php#L352-L367 |
213,108 | moodle/moodle | blog/locallib.php | blog_entry.add_association | public function add_association($contextid, $unused = null) {
global $DB;
if ($unused !== null) {
debugging('Illegal argument used in blog_entry->add_association()', DEBUG_DEVELOPER);
}
$assocobject = new StdClass;
$assocobject->contextid = $contextid;
$asso... | php | public function add_association($contextid, $unused = null) {
global $DB;
if ($unused !== null) {
debugging('Illegal argument used in blog_entry->add_association()', DEBUG_DEVELOPER);
}
$assocobject = new StdClass;
$assocobject->contextid = $contextid;
$asso... | [
"public",
"function",
"add_association",
"(",
"$",
"contextid",
",",
"$",
"unused",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"unused",
"!==",
"null",
")",
"{",
"debugging",
"(",
"'Illegal argument used in blog_entry->add_association()'",
... | Add a single association for a blog entry
@param int $contextid - id of context to associate with the blog entry.
@param string $unused This does nothing, do not use it. | [
"Add",
"a",
"single",
"association",
"for",
"a",
"blog",
"entry"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/locallib.php#L375-L402 |
213,109 | moodle/moodle | blog/locallib.php | blog_entry.remove_associations | public function remove_associations() {
global $DB;
$associations = $DB->get_records('blog_association', array('blogid' => $this->id));
foreach ($associations as $association) {
// Trigger an association deleted event.
$context = context::instance_by_id($association->co... | php | public function remove_associations() {
global $DB;
$associations = $DB->get_records('blog_association', array('blogid' => $this->id));
foreach ($associations as $association) {
// Trigger an association deleted event.
$context = context::instance_by_id($association->co... | [
"public",
"function",
"remove_associations",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"associations",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"'blog_association'",
",",
"array",
"(",
"'blogid'",
"=>",
"$",
"this",
"->",
"id",
")",
")",
";",
"forea... | remove all associations for a blog entry
@return void | [
"remove",
"all",
"associations",
"for",
"a",
"blog",
"entry"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/locallib.php#L409-L429 |
213,110 | moodle/moodle | blog/locallib.php | blog_entry.delete_attachments | public function delete_attachments() {
$fs = get_file_storage();
$fs->delete_area_files(SYSCONTEXTID, 'blog', 'attachment', $this->id);
$fs->delete_area_files(SYSCONTEXTID, 'blog', 'post', $this->id);
} | php | public function delete_attachments() {
$fs = get_file_storage();
$fs->delete_area_files(SYSCONTEXTID, 'blog', 'attachment', $this->id);
$fs->delete_area_files(SYSCONTEXTID, 'blog', 'post', $this->id);
} | [
"public",
"function",
"delete_attachments",
"(",
")",
"{",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"$",
"fs",
"->",
"delete_area_files",
"(",
"SYSCONTEXTID",
",",
"'blog'",
",",
"'attachment'",
",",
"$",
"this",
"->",
"id",
")",
";",
"$",
"fs"... | Deletes all the user files in the attachments area for an entry
@return void | [
"Deletes",
"all",
"the",
"user",
"files",
"in",
"the",
"attachments",
"area",
"for",
"an",
"entry"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/locallib.php#L436-L440 |
213,111 | moodle/moodle | blog/locallib.php | blog_entry.get_applicable_publish_states | public static function get_applicable_publish_states() {
global $CFG;
$options = array();
// Everyone gets draft access.
if ($CFG->bloglevel >= BLOG_USER_LEVEL) {
$options['draft'] = get_string('publishtonoone', 'blog');
}
if ($CFG->bloglevel > BLOG_USER_LEV... | php | public static function get_applicable_publish_states() {
global $CFG;
$options = array();
// Everyone gets draft access.
if ($CFG->bloglevel >= BLOG_USER_LEVEL) {
$options['draft'] = get_string('publishtonoone', 'blog');
}
if ($CFG->bloglevel > BLOG_USER_LEV... | [
"public",
"static",
"function",
"get_applicable_publish_states",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"options",
"=",
"array",
"(",
")",
";",
"// Everyone gets draft access.",
"if",
"(",
"$",
"CFG",
"->",
"bloglevel",
">=",
"BLOG_USER_LEVEL",
")",
"{... | Use this function to retrieve a list of publish states available for
the currently logged in user.
@return array This function returns an array ideal for sending to moodles'
choose_from_menu function. | [
"Use",
"this",
"function",
"to",
"retrieve",
"a",
"list",
"of",
"publish",
"states",
"available",
"for",
"the",
"currently",
"logged",
"in",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/locallib.php#L534-L552 |
213,112 | moodle/moodle | blog/locallib.php | blog_listing.get_entries | public function get_entries($start=0, $limit=10) {
global $DB;
if ($this->entries === null) {
if ($sqlarray = $this->get_entry_fetch_sql(false, 'created DESC')) {
$this->entries = $DB->get_records_sql($sqlarray['sql'], $sqlarray['params'], $start, $limit);
if... | php | public function get_entries($start=0, $limit=10) {
global $DB;
if ($this->entries === null) {
if ($sqlarray = $this->get_entry_fetch_sql(false, 'created DESC')) {
$this->entries = $DB->get_records_sql($sqlarray['sql'], $sqlarray['params'], $start, $limit);
if... | [
"public",
"function",
"get_entries",
"(",
"$",
"start",
"=",
"0",
",",
"$",
"limit",
"=",
"10",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"entries",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"sqlarray",
"=",
"$",
"this",
... | Fetches the array of blog entries.
@return array | [
"Fetches",
"the",
"array",
"of",
"blog",
"entries",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/locallib.php#L609-L624 |
213,113 | moodle/moodle | blog/locallib.php | blog_listing.count_entries | public function count_entries() {
global $DB;
if ($this->totalentries === null) {
if ($sqlarray = $this->get_entry_fetch_sql(true)) {
$this->totalentries = $DB->count_records_sql($sqlarray['sql'], $sqlarray['params']);
} else {
$this->totalentries ... | php | public function count_entries() {
global $DB;
if ($this->totalentries === null) {
if ($sqlarray = $this->get_entry_fetch_sql(true)) {
$this->totalentries = $DB->count_records_sql($sqlarray['sql'], $sqlarray['params']);
} else {
$this->totalentries ... | [
"public",
"function",
"count_entries",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"totalentries",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"sqlarray",
"=",
"$",
"this",
"->",
"get_entry_fetch_sql",
"(",
"true",
")",
")",
"... | Finds total number of blog entries
@return int | [
"Finds",
"total",
"number",
"of",
"blog",
"entries"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/locallib.php#L631-L641 |
213,114 | moodle/moodle | blog/locallib.php | blog_listing.print_entries | public function print_entries() {
global $CFG, $USER, $DB, $OUTPUT, $PAGE;
$sitecontext = context_system::instance();
// Blog renderer.
$output = $PAGE->get_renderer('blog');
$page = optional_param('blogpage', 0, PARAM_INT);
$limit = optional_param('limit', get_user_pr... | php | public function print_entries() {
global $CFG, $USER, $DB, $OUTPUT, $PAGE;
$sitecontext = context_system::instance();
// Blog renderer.
$output = $PAGE->get_renderer('blog');
$page = optional_param('blogpage', 0, PARAM_INT);
$limit = optional_param('limit', get_user_pr... | [
"public",
"function",
"print_entries",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"USER",
",",
"$",
"DB",
",",
"$",
"OUTPUT",
",",
"$",
"PAGE",
";",
"$",
"sitecontext",
"=",
"context_system",
"::",
"instance",
"(",
")",
";",
"// Blog renderer.",
"$... | Outputs all the blog entries aggregated by this blog listing.
@return void | [
"Outputs",
"all",
"the",
"blog",
"entries",
"aggregated",
"by",
"this",
"blog",
"listing",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/locallib.php#L718-L789 |
213,115 | moodle/moodle | filter/emoticon/filter.php | filter_emoticon.filter | public function filter($text, array $options = array()) {
if (!isset($options['originalformat'])) {
// if the format is not specified, we are probably called by {@see format_string()}
// in that case, it would be dangerous to replace text with the image because it could
// b... | php | public function filter($text, array $options = array()) {
if (!isset($options['originalformat'])) {
// if the format is not specified, we are probably called by {@see format_string()}
// in that case, it would be dangerous to replace text with the image because it could
// b... | [
"public",
"function",
"filter",
"(",
"$",
"text",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'originalformat'",
"]",
")",
")",
"{",
"// if the format is not specified, we are probably c... | Apply the filter to the text
@see filter_manager::apply_filter_chain()
@param string $text to be processed by the text
@param array $options filter options
@return string text after processing | [
"Apply",
"the",
"filter",
"to",
"the",
"text"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/filter/emoticon/filter.php#L59-L71 |
213,116 | moodle/moodle | filter/emoticon/filter.php | filter_emoticon.replace_emoticons | protected function replace_emoticons($text) {
global $CFG, $OUTPUT, $PAGE;
$lang = current_language();
$theme = $PAGE->theme->name;
if (!isset(self::$emoticontexts[$lang][$theme]) or !isset(self::$emoticonimgs[$lang][$theme])) {
// prepare internal caches
$manag... | php | protected function replace_emoticons($text) {
global $CFG, $OUTPUT, $PAGE;
$lang = current_language();
$theme = $PAGE->theme->name;
if (!isset(self::$emoticontexts[$lang][$theme]) or !isset(self::$emoticonimgs[$lang][$theme])) {
// prepare internal caches
$manag... | [
"protected",
"function",
"replace_emoticons",
"(",
"$",
"text",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"OUTPUT",
",",
"$",
"PAGE",
";",
"$",
"lang",
"=",
"current_language",
"(",
")",
";",
"$",
"theme",
"=",
"$",
"PAGE",
"->",
"theme",
"->",
"name... | Replace emoticons found in the text with their images
@param string $text to modify
@return string the modified result | [
"Replace",
"emoticons",
"found",
"in",
"the",
"text",
"with",
"their",
"images"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/filter/emoticon/filter.php#L83-L149 |
213,117 | moodle/moodle | admin/tool/uploadcourse/classes/base_form.php | tool_uploadcourse_base_form.add_import_options | public function add_import_options() {
$mform = $this->_form;
// Upload settings and file.
$mform->addElement('header', 'importoptionshdr', get_string('importoptions', 'tool_uploadcourse'));
$mform->setExpanded('importoptionshdr', true);
$choices = array(
tool_uploa... | php | public function add_import_options() {
$mform = $this->_form;
// Upload settings and file.
$mform->addElement('header', 'importoptionshdr', get_string('importoptions', 'tool_uploadcourse'));
$mform->setExpanded('importoptionshdr', true);
$choices = array(
tool_uploa... | [
"public",
"function",
"add_import_options",
"(",
")",
"{",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"// Upload settings and file.",
"$",
"mform",
"->",
"addElement",
"(",
"'header'",
",",
"'importoptionshdr'",
",",
"get_string",
"(",
"'importoptions'",
... | Adds the import settings part.
@return void | [
"Adds",
"the",
"import",
"settings",
"part",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/uploadcourse/classes/base_form.php#L50-L96 |
213,118 | moodle/moodle | auth/oauth2/classes/privacy/provider.php | provider.export_user_data | public static function export_user_data(approved_contextlist $contextlist) {
global $DB;
// Export oauth2 linked accounts.
$context = \context_user::instance($contextlist->get_user()->id);
$sql = "SELECT ll.id, ll.username, ll.email, ll.timecreated, ll.timemodified, oi.name as issuernam... | php | public static function export_user_data(approved_contextlist $contextlist) {
global $DB;
// Export oauth2 linked accounts.
$context = \context_user::instance($contextlist->get_user()->id);
$sql = "SELECT ll.id, ll.username, ll.email, ll.timecreated, ll.timemodified, oi.name as issuernam... | [
"public",
"static",
"function",
"export_user_data",
"(",
"approved_contextlist",
"$",
"contextlist",
")",
"{",
"global",
"$",
"DB",
";",
"// Export oauth2 linked accounts.",
"$",
"context",
"=",
"\\",
"context_user",
"::",
"instance",
"(",
"$",
"contextlist",
"->",
... | Export all oauth2 information for the list of contexts and this user.
@param approved_contextlist $contextlist The list of approved contexts for a user. | [
"Export",
"all",
"oauth2",
"information",
"for",
"the",
"list",
"of",
"contexts",
"and",
"this",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/privacy/provider.php#L114-L137 |
213,119 | moodle/moodle | grade/report/singleview/classes/local/screen/tablelike.php | tablelike.format_definition | public function format_definition($line, $grade) {
foreach ($this->definition() as $i => $field) {
// Table tab index.
$tab = ($i * $this->total) + $this->index;
$classname = '\\gradereport_singleview\\local\\ui\\' . $field;
$html = new $classname($grade, $tab);
... | php | public function format_definition($line, $grade) {
foreach ($this->definition() as $i => $field) {
// Table tab index.
$tab = ($i * $this->total) + $this->index;
$classname = '\\gradereport_singleview\\local\\ui\\' . $field;
$html = new $classname($grade, $tab);
... | [
"public",
"function",
"format_definition",
"(",
"$",
"line",
",",
"$",
"grade",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"definition",
"(",
")",
"as",
"$",
"i",
"=>",
"$",
"field",
")",
"{",
"// Table tab index.",
"$",
"tab",
"=",
"(",
"$",
"i",
... | Get a element to generate the HTML for this table row
@param array $line This is a list of lines in the table (modified)
@param grade_grade $grade The grade.
@return string | [
"Get",
"a",
"element",
"to",
"generate",
"the",
"HTML",
"for",
"this",
"table",
"row"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/screen/tablelike.php#L133-L153 |
213,120 | moodle/moodle | grade/report/singleview/classes/local/screen/tablelike.php | tablelike.html | public function html() {
global $OUTPUT;
if (!empty($this->initerrors)) {
$warnings = '';
foreach ($this->initerrors as $mesg) {
$warnings .= $OUTPUT->notification($mesg);
}
return $warnings;
}
$table = new html_table();
... | php | public function html() {
global $OUTPUT;
if (!empty($this->initerrors)) {
$warnings = '';
foreach ($this->initerrors as $mesg) {
$warnings .= $OUTPUT->notification($mesg);
}
return $warnings;
}
$table = new html_table();
... | [
"public",
"function",
"html",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"initerrors",
")",
")",
"{",
"$",
"warnings",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"initerrors",
"as",
"$",
... | Get the HTML for the whole table
@return string | [
"Get",
"the",
"HTML",
"for",
"the",
"whole",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/screen/tablelike.php#L159-L212 |
213,121 | moodle/moodle | report/loglive/classes/renderable.php | report_loglive_renderable.setup_table_ajax | protected function setup_table_ajax() {
$filter = $this->setup_filters();
$this->tablelog = new report_loglive_table_log_ajax('report_loglive', $filter);
$this->tablelog->define_baseurl($this->url);
} | php | protected function setup_table_ajax() {
$filter = $this->setup_filters();
$this->tablelog = new report_loglive_table_log_ajax('report_loglive', $filter);
$this->tablelog->define_baseurl($this->url);
} | [
"protected",
"function",
"setup_table_ajax",
"(",
")",
"{",
"$",
"filter",
"=",
"$",
"this",
"->",
"setup_filters",
"(",
")",
";",
"$",
"this",
"->",
"tablelog",
"=",
"new",
"report_loglive_table_log_ajax",
"(",
"'report_loglive'",
",",
"$",
"filter",
")",
"... | Setup table log for ajax output. | [
"Setup",
"table",
"log",
"for",
"ajax",
"output",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/loglive/classes/renderable.php#L159-L163 |
213,122 | moodle/moodle | report/loglive/classes/renderable.php | report_loglive_renderable.set_refresh_rate | protected function set_refresh_rate() {
if (defined('BEHAT_SITE_RUNNING')) {
// Hack for behat tests.
$this->refresh = 5;
} else {
if (defined('REPORT_LOGLIVE_REFRESH')) {
// Backward compatibility.
$this->refresh = REPORT_LOGLIVE_REFER... | php | protected function set_refresh_rate() {
if (defined('BEHAT_SITE_RUNNING')) {
// Hack for behat tests.
$this->refresh = 5;
} else {
if (defined('REPORT_LOGLIVE_REFRESH')) {
// Backward compatibility.
$this->refresh = REPORT_LOGLIVE_REFER... | [
"protected",
"function",
"set_refresh_rate",
"(",
")",
"{",
"if",
"(",
"defined",
"(",
"'BEHAT_SITE_RUNNING'",
")",
")",
"{",
"// Hack for behat tests.",
"$",
"this",
"->",
"refresh",
"=",
"5",
";",
"}",
"else",
"{",
"if",
"(",
"defined",
"(",
"'REPORT_LOGLI... | Set refresh rate of the live updates. | [
"Set",
"refresh",
"rate",
"of",
"the",
"live",
"updates",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/loglive/classes/renderable.php#L191-L204 |
213,123 | moodle/moodle | report/loglive/classes/renderable.php | report_loglive_renderable.get_table | public function get_table($ajax = false) {
if (empty($this->tablelog)) {
if ($ajax) {
$this->setup_table_ajax();
} else {
$this->setup_table();
}
}
return $this->tablelog;
} | php | public function get_table($ajax = false) {
if (empty($this->tablelog)) {
if ($ajax) {
$this->setup_table_ajax();
} else {
$this->setup_table();
}
}
return $this->tablelog;
} | [
"public",
"function",
"get_table",
"(",
"$",
"ajax",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"tablelog",
")",
")",
"{",
"if",
"(",
"$",
"ajax",
")",
"{",
"$",
"this",
"->",
"setup_table_ajax",
"(",
")",
";",
"}",
"else... | Setup table and return it.
@param bool $ajax If set to true report_loglive_table_log_ajax is set instead of report_loglive_table_log.
@return report_loglive_table_log|report_loglive_table_log_ajax table object | [
"Setup",
"table",
"and",
"return",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/loglive/classes/renderable.php#L220-L229 |
213,124 | moodle/moodle | mod/assign/backup/moodle2/restore_assign_stepslib.php | restore_assign_activity_structure_step.define_structure | protected function define_structure() {
$paths = array();
// To know if we are including userinfo.
$userinfo = $this->get_setting_value('userinfo');
// Define each element separated.
$paths[] = new restore_path_element('assign', '/activity/assign');
if ($userinfo) {
... | php | protected function define_structure() {
$paths = array();
// To know if we are including userinfo.
$userinfo = $this->get_setting_value('userinfo');
// Define each element separated.
$paths[] = new restore_path_element('assign', '/activity/assign');
if ($userinfo) {
... | [
"protected",
"function",
"define_structure",
"(",
")",
"{",
"$",
"paths",
"=",
"array",
"(",
")",
";",
"// To know if we are including userinfo.",
"$",
"userinfo",
"=",
"$",
"this",
"->",
"get_setting_value",
"(",
"'userinfo'",
")",
";",
"// Define each element sepa... | Define the structure of the restore workflow.
@return restore_path_element $structure | [
"Define",
"the",
"structure",
"of",
"the",
"restore",
"workflow",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/backup/moodle2/restore_assign_stepslib.php#L49-L75 |
213,125 | moodle/moodle | mod/assign/backup/moodle2/restore_assign_stepslib.php | restore_assign_activity_structure_step.process_assign | protected function process_assign($data) {
global $DB;
$data = (object)$data;
$oldid = $data->id;
$data->course = $this->get_courseid();
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
// See MDL-9367.
... | php | protected function process_assign($data) {
global $DB;
$data = (object)$data;
$oldid = $data->id;
$data->course = $this->get_courseid();
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
// See MDL-9367.
... | [
"protected",
"function",
"process_assign",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"(",
"object",
")",
"$",
"data",
";",
"$",
"oldid",
"=",
"$",
"data",
"->",
"id",
";",
"$",
"data",
"->",
"course",
"=",
"$",
"this... | Process an assign restore.
@param object $data The data in object form
@return void | [
"Process",
"an",
"assign",
"restore",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/backup/moodle2/restore_assign_stepslib.php#L83-L146 |
213,126 | moodle/moodle | mod/assign/backup/moodle2/restore_assign_stepslib.php | restore_assign_activity_structure_step.process_assign_userflag | protected function process_assign_userflag($data) {
global $DB;
$data = (object)$data;
$oldid = $data->id;
$data->assignment = $this->get_new_parentid('assign');
$data->userid = $this->get_mappingid('user', $data->userid);
if (!empty($data->allocatedmarker)) {
... | php | protected function process_assign_userflag($data) {
global $DB;
$data = (object)$data;
$oldid = $data->id;
$data->assignment = $this->get_new_parentid('assign');
$data->userid = $this->get_mappingid('user', $data->userid);
if (!empty($data->allocatedmarker)) {
... | [
"protected",
"function",
"process_assign_userflag",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"(",
"object",
")",
"$",
"data",
";",
"$",
"oldid",
"=",
"$",
"data",
"->",
"id",
";",
"$",
"data",
"->",
"assignment",
"=",
... | Process a user_flags restore
@param object $data The data in object form
@return void | [
"Process",
"a",
"user_flags",
"restore"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/backup/moodle2/restore_assign_stepslib.php#L194-L214 |
213,127 | moodle/moodle | mod/assign/backup/moodle2/restore_assign_stepslib.php | restore_assign_activity_structure_step.process_assign_grade | protected function process_assign_grade($data) {
global $DB;
$data = (object)$data;
$oldid = $data->id;
$data->assignment = $this->get_new_parentid('assign');
$data->userid = $this->get_mappingid('user', $data->userid);
$data->grader = $this->get_mappingid('user', $dat... | php | protected function process_assign_grade($data) {
global $DB;
$data = (object)$data;
$oldid = $data->id;
$data->assignment = $this->get_new_parentid('assign');
$data->userid = $this->get_mappingid('user', $data->userid);
$data->grader = $this->get_mappingid('user', $dat... | [
"protected",
"function",
"process_assign_grade",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"(",
"object",
")",
"$",
"data",
";",
"$",
"oldid",
"=",
"$",
"data",
"->",
"id",
";",
"$",
"data",
"->",
"assignment",
"=",
"$... | Process a grade restore
@param object $data The data in object form
@return void | [
"Process",
"a",
"grade",
"restore"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/backup/moodle2/restore_assign_stepslib.php#L221-L260 |
213,128 | moodle/moodle | mod/assign/backup/moodle2/restore_assign_stepslib.php | restore_assign_activity_structure_step.process_assign_plugin_config | protected function process_assign_plugin_config($data) {
global $DB;
$data = (object)$data;
$oldid = $data->id;
$data->assignment = $this->get_new_parentid('assign');
$newitemid = $DB->insert_record('assign_plugin_config', $data);
} | php | protected function process_assign_plugin_config($data) {
global $DB;
$data = (object)$data;
$oldid = $data->id;
$data->assignment = $this->get_new_parentid('assign');
$newitemid = $DB->insert_record('assign_plugin_config', $data);
} | [
"protected",
"function",
"process_assign_plugin_config",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"(",
"object",
")",
"$",
"data",
";",
"$",
"oldid",
"=",
"$",
"data",
"->",
"id",
";",
"$",
"data",
"->",
"assignment",
"... | Process a plugin-config restore
@param object $data The data in object form
@return void | [
"Process",
"a",
"plugin",
"-",
"config",
"restore"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/backup/moodle2/restore_assign_stepslib.php#L267-L276 |
213,129 | moodle/moodle | mod/assign/backup/moodle2/restore_assign_stepslib.php | restore_assign_activity_structure_step.add_plugin_config_files | protected function add_plugin_config_files($subtype) {
$dummyassign = new assign(null, null, null);
$plugins = $dummyassign->load_plugins($subtype);
foreach ($plugins as $plugin) {
$component = $plugin->get_subtype() . '_' . $plugin->get_type();
$areas = $plugin->get_conf... | php | protected function add_plugin_config_files($subtype) {
$dummyassign = new assign(null, null, null);
$plugins = $dummyassign->load_plugins($subtype);
foreach ($plugins as $plugin) {
$component = $plugin->get_subtype() . '_' . $plugin->get_type();
$areas = $plugin->get_conf... | [
"protected",
"function",
"add_plugin_config_files",
"(",
"$",
"subtype",
")",
"{",
"$",
"dummyassign",
"=",
"new",
"assign",
"(",
"null",
",",
"null",
",",
"null",
")",
";",
"$",
"plugins",
"=",
"$",
"dummyassign",
"->",
"load_plugins",
"(",
"$",
"subtype"... | Restore files from plugin configuration
@param string $subtype the plugin type to handle
@return void | [
"Restore",
"files",
"from",
"plugin",
"configuration"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/backup/moodle2/restore_assign_stepslib.php#L364-L374 |
213,130 | moodle/moodle | mod/assign/backup/moodle2/restore_assign_stepslib.php | restore_assign_activity_structure_step.process_assign_override | protected function process_assign_override($data) {
global $DB;
$data = (object)$data;
$oldid = $data->id;
// Based on userinfo, we'll restore user overides or no.
$userinfo = $this->get_setting_value('userinfo');
// Skip user overrides if we are not restoring userinfo... | php | protected function process_assign_override($data) {
global $DB;
$data = (object)$data;
$oldid = $data->id;
// Based on userinfo, we'll restore user overides or no.
$userinfo = $this->get_setting_value('userinfo');
// Skip user overrides if we are not restoring userinfo... | [
"protected",
"function",
"process_assign_override",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"(",
"object",
")",
"$",
"data",
";",
"$",
"oldid",
"=",
"$",
"data",
"->",
"id",
";",
"// Based on userinfo, we'll restore user overi... | Process a assign override restore
@param object $data The data in object form
@return void | [
"Process",
"a",
"assign",
"override",
"restore"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/backup/moodle2/restore_assign_stepslib.php#L381-L418 |
213,131 | moodle/moodle | mod/assign/backup/moodle2/restore_assign_stepslib.php | restore_assign_activity_structure_step.after_execute | protected function after_execute() {
$this->add_related_files('mod_assign', 'intro', null);
$this->add_related_files('mod_assign', 'introattachment', null);
$this->add_plugin_config_files('assignsubmission');
$this->add_plugin_config_files('assignfeedback');
$this->set_latest_s... | php | protected function after_execute() {
$this->add_related_files('mod_assign', 'intro', null);
$this->add_related_files('mod_assign', 'introattachment', null);
$this->add_plugin_config_files('assignsubmission');
$this->add_plugin_config_files('assignfeedback');
$this->set_latest_s... | [
"protected",
"function",
"after_execute",
"(",
")",
"{",
"$",
"this",
"->",
"add_related_files",
"(",
"'mod_assign'",
",",
"'intro'",
",",
"null",
")",
";",
"$",
"this",
"->",
"add_related_files",
"(",
"'mod_assign'",
",",
"'introattachment'",
",",
"null",
")"... | Once the database tables have been fully restored, restore the files
@return void | [
"Once",
"the",
"database",
"tables",
"have",
"been",
"fully",
"restored",
"restore",
"the",
"files"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/backup/moodle2/restore_assign_stepslib.php#L424-L432 |
213,132 | moodle/moodle | admin/tool/lp/classes/page_helper.php | page_helper.setup_for_course | public static function setup_for_course(moodle_url $url, $course, $subtitle = '') {
global $PAGE;
$context = context_course::instance($course->id);
$PAGE->set_course($course);
if (!empty($subtitle)) {
$title = $subtitle;
} else {
$title = get_string('co... | php | public static function setup_for_course(moodle_url $url, $course, $subtitle = '') {
global $PAGE;
$context = context_course::instance($course->id);
$PAGE->set_course($course);
if (!empty($subtitle)) {
$title = $subtitle;
} else {
$title = get_string('co... | [
"public",
"static",
"function",
"setup_for_course",
"(",
"moodle_url",
"$",
"url",
",",
"$",
"course",
",",
"$",
"subtitle",
"=",
"''",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"context",
"=",
"context_course",
"::",
"instance",
"(",
"$",
"course",
"->... | Set-up a course page.
Example:
list($title, $subtitle) = page_helper::setup_for_course($pagecontextid, $url, $course, $pagetitle);
echo $OUTPUT->heading($title);
echo $OUTPUT->heading($subtitle, 3);
@param moodle_url $url The current page.
@param stdClass $course The course.
@param string $subtitle The title of th... | [
"Set",
"-",
"up",
"a",
"course",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/lp/classes/page_helper.php#L62-L90 |
213,133 | moodle/moodle | admin/tool/lp/classes/page_helper.php | page_helper.setup_for_template | public static function setup_for_template($pagecontextid, moodle_url $url, $template = null, $subtitle = '',
$returntype = null) {
global $PAGE, $SITE;
$pagecontext = context::instance_by_id($pagecontextid);
$context = $pagecontext;
if (!emp... | php | public static function setup_for_template($pagecontextid, moodle_url $url, $template = null, $subtitle = '',
$returntype = null) {
global $PAGE, $SITE;
$pagecontext = context::instance_by_id($pagecontextid);
$context = $pagecontext;
if (!emp... | [
"public",
"static",
"function",
"setup_for_template",
"(",
"$",
"pagecontextid",
",",
"moodle_url",
"$",
"url",
",",
"$",
"template",
"=",
"null",
",",
"$",
"subtitle",
"=",
"''",
",",
"$",
"returntype",
"=",
"null",
")",
"{",
"global",
"$",
"PAGE",
",",... | Set-up a template page.
Example:
list($title, $subtitle) = page_helper::setup_for_template($pagecontextid, $url, $template, $pagetitle);
echo $OUTPUT->heading($title);
echo $OUTPUT->heading($subtitle, 3);
@param int $pagecontextid The page context ID.
@param moodle_url $url The current page.
@param \core_competenc... | [
"Set",
"-",
"up",
"a",
"template",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/lp/classes/page_helper.php#L110-L168 |
213,134 | moodle/moodle | admin/tool/lp/classes/page_helper.php | page_helper.setup_for_plan | public static function setup_for_plan($userid, moodle_url $url, $plan = null, $subtitle = '', $returntype = null) {
global $PAGE, $USER;
// Check that the user is a valid user.
$user = core_user::get_user($userid);
if (!$user || !core_user::is_real_user($userid)) {
throw new... | php | public static function setup_for_plan($userid, moodle_url $url, $plan = null, $subtitle = '', $returntype = null) {
global $PAGE, $USER;
// Check that the user is a valid user.
$user = core_user::get_user($userid);
if (!$user || !core_user::is_real_user($userid)) {
throw new... | [
"public",
"static",
"function",
"setup_for_plan",
"(",
"$",
"userid",
",",
"moodle_url",
"$",
"url",
",",
"$",
"plan",
"=",
"null",
",",
"$",
"subtitle",
"=",
"''",
",",
"$",
"returntype",
"=",
"null",
")",
"{",
"global",
"$",
"PAGE",
",",
"$",
"USER... | Set-up a plan page.
Example:
list($title, $subtitle) = page_helper::setup_for_plan($url, $template, $pagetitle);
echo $OUTPUT->heading($title);
echo $OUTPUT->heading($subtitle, 3);
@param int $userid The user ID.
@param moodle_url $url The current page.
@param \core_competency\plan $plan The plan, if any.
@param ... | [
"Set",
"-",
"up",
"a",
"plan",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/lp/classes/page_helper.php#L188-L242 |
213,135 | moodle/moodle | admin/tool/lp/classes/page_helper.php | page_helper.setup_for_framework | public static function setup_for_framework($id, $pagecontextid, $framework = null, $returntype = null) {
global $PAGE;
// We keep the original context in the URLs, so that we remain in the same context.
$url = new moodle_url("/admin/tool/lp/editcompetencyframework.php", array('id' => $id, 'page... | php | public static function setup_for_framework($id, $pagecontextid, $framework = null, $returntype = null) {
global $PAGE;
// We keep the original context in the URLs, so that we remain in the same context.
$url = new moodle_url("/admin/tool/lp/editcompetencyframework.php", array('id' => $id, 'page... | [
"public",
"static",
"function",
"setup_for_framework",
"(",
"$",
"id",
",",
"$",
"pagecontextid",
",",
"$",
"framework",
"=",
"null",
",",
"$",
"returntype",
"=",
"null",
")",
"{",
"global",
"$",
"PAGE",
";",
"// We keep the original context in the URLs, so that w... | Set-up a framework page.
Example:
list($pagetitle, $pagesubtitle, $url, $frameworksurl) = page_helper::setup_for_framework($id, $pagecontextid);
echo $OUTPUT->heading($pagetitle);
echo $OUTPUT->heading($pagesubtitle, 3);
@param int $id The framework ID.
@param int $pagecontextid The page context ID.
@param \core_c... | [
"Set",
"-",
"up",
"a",
"framework",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/lp/classes/page_helper.php#L336-L376 |
213,136 | moodle/moodle | admin/tool/lp/classes/page_helper.php | page_helper.setup_for_competency | public static function setup_for_competency($pagecontextid, moodle_url $url, $framework, $competency = null, $parent = null) {
global $PAGE, $SITE;
// Set page context.
$pagecontext = context::instance_by_id($pagecontextid);
$PAGE->set_context($pagecontext);
// Set page heading... | php | public static function setup_for_competency($pagecontextid, moodle_url $url, $framework, $competency = null, $parent = null) {
global $PAGE, $SITE;
// Set page context.
$pagecontext = context::instance_by_id($pagecontextid);
$PAGE->set_context($pagecontext);
// Set page heading... | [
"public",
"static",
"function",
"setup_for_competency",
"(",
"$",
"pagecontextid",
",",
"moodle_url",
"$",
"url",
",",
"$",
"framework",
",",
"$",
"competency",
"=",
"null",
",",
"$",
"parent",
"=",
"null",
")",
"{",
"global",
"$",
"PAGE",
",",
"$",
"SIT... | Set-up a competency page.
Example:
list($title, $subtitle) = page_helper::setup_for_competency($pagecontextid, $url, $competency, $pagetitle);
echo $OUTPUT->heading($title);
echo $OUTPUT->heading($subtitle, 3);
@param int $pagecontextid The page context ID.
@param moodle_url $url The current page.
@param \core_com... | [
"Set",
"-",
"up",
"a",
"competency",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/lp/classes/page_helper.php#L397-L460 |
213,137 | moodle/moodle | lib/classes/task/database_logger.php | database_logger.store_log_for_task | public static function store_log_for_task(task_base $task, string $logpath, bool $failed,
int $dbreads, int $dbwrites, float $timestart, float $timeend) {
global $DB;
// Write this log to the database.
$logdata = (object) [
'type' => is_a($task, scheduled_task::class) ? ... | php | public static function store_log_for_task(task_base $task, string $logpath, bool $failed,
int $dbreads, int $dbwrites, float $timestart, float $timeend) {
global $DB;
// Write this log to the database.
$logdata = (object) [
'type' => is_a($task, scheduled_task::class) ? ... | [
"public",
"static",
"function",
"store_log_for_task",
"(",
"task_base",
"$",
"task",
",",
"string",
"$",
"logpath",
",",
"bool",
"$",
"failed",
",",
"int",
"$",
"dbreads",
",",
"int",
"$",
"dbwrites",
",",
"float",
"$",
"timestart",
",",
"float",
"$",
"t... | Store the log for the specified task.
@param task_base $task The task that the log belongs to.
@param string $logpath The path to the log on disk
@param bool $failed Whether the task failed
@param int $dbreads The number of DB reads
@param int $dbwrites The number of DB writes
@... | [
"Store",
"the",
"log",
"for",
"the",
"specified",
"task",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/database_logger.php#L62-L85 |
213,138 | moodle/moodle | lib/classes/task/database_logger.php | database_logger.cleanup | public static function cleanup() {
global $CFG, $DB;
// Delete logs older than the retention period.
$params = [
'retentionperiod' => time() - $CFG->task_logretention,
];
$logids = $DB->get_fieldset_select('task_log', 'id', 'timestart < :retentionperiod', $params);
... | php | public static function cleanup() {
global $CFG, $DB;
// Delete logs older than the retention period.
$params = [
'retentionperiod' => time() - $CFG->task_logretention,
];
$logids = $DB->get_fieldset_select('task_log', 'id', 'timestart < :retentionperiod', $params);
... | [
"public",
"static",
"function",
"cleanup",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"// Delete logs older than the retention period.",
"$",
"params",
"=",
"[",
"'retentionperiod'",
"=>",
"time",
"(",
")",
"-",
"$",
"CFG",
"->",
"task_logretent... | Cleanup old task logs. | [
"Cleanup",
"old",
"task",
"logs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/database_logger.php#L113-L152 |
213,139 | moodle/moodle | lib/phpexcel/PHPExcel/Shared/Font.php | PHPExcel_Shared_Font.getTextWidthPixelsExact | public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0)
{
if (!function_exists('imagettfbbox')) {
throw new PHPExcel_Exception('GD library needs to be enabled');
}
// font size should really be supplied in pixels in GD2,
// but sin... | php | public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0)
{
if (!function_exists('imagettfbbox')) {
throw new PHPExcel_Exception('GD library needs to be enabled');
}
// font size should really be supplied in pixels in GD2,
// but sin... | [
"public",
"static",
"function",
"getTextWidthPixelsExact",
"(",
"$",
"text",
",",
"PHPExcel_Style_Font",
"$",
"font",
",",
"$",
"rotation",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'imagettfbbox'",
")",
")",
"{",
"throw",
"new",
"PHPExcel... | Get GD text width in pixels for a string of text in a certain font at a certain rotation angle
@param string $text
@param PHPExcel_Style_Font
@param int $rotation
@return int
@throws PHPExcel_Exception | [
"Get",
"GD",
"text",
"width",
"in",
"pixels",
"for",
"a",
"string",
"of",
"text",
"in",
"a",
"certain",
"font",
"at",
"a",
"certain",
"rotation",
"angle"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/Font.php#L305-L330 |
213,140 | moodle/moodle | lib/phpexcel/PHPExcel/Shared/Font.php | PHPExcel_Shared_Font.getTextWidthPixelsApprox | public static function getTextWidthPixelsApprox($columnText, PHPExcel_Style_Font $font = null, $rotation = 0)
{
$fontName = $font->getName();
$fontSize = $font->getSize();
// Calculate column width in pixels. We assume fixed glyph width. Result varies with font name and size.
switch... | php | public static function getTextWidthPixelsApprox($columnText, PHPExcel_Style_Font $font = null, $rotation = 0)
{
$fontName = $font->getName();
$fontSize = $font->getSize();
// Calculate column width in pixels. We assume fixed glyph width. Result varies with font name and size.
switch... | [
"public",
"static",
"function",
"getTextWidthPixelsApprox",
"(",
"$",
"columnText",
",",
"PHPExcel_Style_Font",
"$",
"font",
"=",
"null",
",",
"$",
"rotation",
"=",
"0",
")",
"{",
"$",
"fontName",
"=",
"$",
"font",
"->",
"getName",
"(",
")",
";",
"$",
"f... | Get approximate width in pixels for a string of text in a certain font at a certain rotation angle
@param string $columnText
@param PHPExcel_Style_Font $font
@param int $rotation
@return int Text width in pixels (no padding added) | [
"Get",
"approximate",
"width",
"in",
"pixels",
"for",
"a",
"string",
"of",
"text",
"in",
"a",
"certain",
"font",
"at",
"a",
"certain",
"rotation",
"angle"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/Font.php#L340-L388 |
213,141 | moodle/moodle | lib/phpexcel/PHPExcel/Shared/Font.php | PHPExcel_Shared_Font.getCharsetFromFontName | public static function getCharsetFromFontName($name)
{
switch ($name) {
// Add more cases. Check FONT records in real Excel files.
case 'EucrosiaUPC':
return self::CHARSET_ANSI_THAI;
case 'Wingdings':
return self::CHARSET_SYMBOL;
... | php | public static function getCharsetFromFontName($name)
{
switch ($name) {
// Add more cases. Check FONT records in real Excel files.
case 'EucrosiaUPC':
return self::CHARSET_ANSI_THAI;
case 'Wingdings':
return self::CHARSET_SYMBOL;
... | [
"public",
"static",
"function",
"getCharsetFromFontName",
"(",
"$",
"name",
")",
"{",
"switch",
"(",
"$",
"name",
")",
"{",
"// Add more cases. Check FONT records in real Excel files.",
"case",
"'EucrosiaUPC'",
":",
"return",
"self",
"::",
"CHARSET_ANSI_THAI",
";",
"c... | Returns the associated charset for the font name.
@param string $name Font name
@return int Character set code | [
"Returns",
"the",
"associated",
"charset",
"for",
"the",
"font",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/Font.php#L541-L556 |
213,142 | moodle/moodle | lib/phpexcel/PHPExcel/Shared/Font.php | PHPExcel_Shared_Font.getDefaultRowHeightByFont | public static function getDefaultRowHeightByFont(PHPExcel_Style_Font $font)
{
switch ($font->getName()) {
case 'Arial':
switch ($font->getSize()) {
case 10:
// inspection of Arial 10 workbook says 12.75pt ~17px
$... | php | public static function getDefaultRowHeightByFont(PHPExcel_Style_Font $font)
{
switch ($font->getName()) {
case 'Arial':
switch ($font->getSize()) {
case 10:
// inspection of Arial 10 workbook says 12.75pt ~17px
$... | [
"public",
"static",
"function",
"getDefaultRowHeightByFont",
"(",
"PHPExcel_Style_Font",
"$",
"font",
")",
"{",
"switch",
"(",
"$",
"font",
"->",
"getName",
"(",
")",
")",
"{",
"case",
"'Arial'",
":",
"switch",
"(",
"$",
"font",
"->",
"getSize",
"(",
")",
... | Get the effective row height for rows without a row dimension or rows with height -1
For example, for Calibri 11 this is 15 points
@param PHPExcel_Style_Font $font The workbooks default font
@return float Row height in points | [
"Get",
"the",
"effective",
"row",
"height",
"for",
"rows",
"without",
"a",
"row",
"dimension",
"or",
"rows",
"with",
"height",
"-",
"1",
"For",
"example",
"for",
"Calibri",
"11",
"this",
"is",
"15",
"points"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/Font.php#L598-L740 |
213,143 | moodle/moodle | question/type/calculatedmulti/backup/moodle2/restore_qtype_calculatedmulti_plugin.class.php | restore_qtype_calculatedmulti_plugin.recode_legacy_state_answer | public function recode_legacy_state_answer($state) {
$answer = $state->answer;
$result = '';
// Datasetxx-yy:zz format.
if (preg_match('~^dataset([0-9]+)-(.*)$~', $answer, $matches)) {
$itemid = $matches[1];
$subanswer = $matches[2];
// Delegate suban... | php | public function recode_legacy_state_answer($state) {
$answer = $state->answer;
$result = '';
// Datasetxx-yy:zz format.
if (preg_match('~^dataset([0-9]+)-(.*)$~', $answer, $matches)) {
$itemid = $matches[1];
$subanswer = $matches[2];
// Delegate suban... | [
"public",
"function",
"recode_legacy_state_answer",
"(",
"$",
"state",
")",
"{",
"$",
"answer",
"=",
"$",
"state",
"->",
"answer",
";",
"$",
"result",
"=",
"''",
";",
"// Datasetxx-yy:zz format.",
"if",
"(",
"preg_match",
"(",
"'~^dataset([0-9]+)-(.*)$~'",
",",
... | Given one question_states record, return the answer
recoded pointing to all the restored stuff for calculatedmulti questions
answer format is datasetxx-yy:zz, where xx is the itemnumber in the dataset
(doesn't need conversion), and both yy and zz are two (hypen speparated)
lists of comma separated question_answers, th... | [
"Given",
"one",
"question_states",
"record",
"return",
"the",
"answer",
"recoded",
"pointing",
"to",
"all",
"the",
"restored",
"stuff",
"for",
"calculatedmulti",
"questions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculatedmulti/backup/moodle2/restore_qtype_calculatedmulti_plugin.class.php#L57-L71 |
213,144 | moodle/moodle | cache/classes/definition.php | cache_definition.load_adhoc | public static function load_adhoc($mode, $component, $area, array $options = array()) {
$id = 'adhoc/'.$component.'_'.$area;
$definition = array(
'mode' => $mode,
'component' => $component,
'area' => $area,
);
if (!empty($options['simplekeys'])) {
... | php | public static function load_adhoc($mode, $component, $area, array $options = array()) {
$id = 'adhoc/'.$component.'_'.$area;
$definition = array(
'mode' => $mode,
'component' => $component,
'area' => $area,
);
if (!empty($options['simplekeys'])) {
... | [
"public",
"static",
"function",
"load_adhoc",
"(",
"$",
"mode",
",",
"$",
"component",
",",
"$",
"area",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"id",
"=",
"'adhoc/'",
".",
"$",
"component",
".",
"'_'",
".",
"$",
"area"... | Creates an ah-hoc cache definition given the required params.
Please note that when using an adhoc definition you cannot set any of the optional params.
This is because we cannot guarantee consistent access and we don't want to mislead people into thinking that.
@param int $mode One of cache_store::MODE_*
@param stri... | [
"Creates",
"an",
"ah",
"-",
"hoc",
"cache",
"definition",
"given",
"the",
"required",
"params",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/definition.php#L562-L592 |
213,145 | moodle/moodle | cache/classes/definition.php | cache_definition.get_cache_class | public function get_cache_class() {
if (!is_null($this->overrideclass)) {
return $this->overrideclass;
}
return cache_helper::get_class_for_mode($this->mode);
} | php | public function get_cache_class() {
if (!is_null($this->overrideclass)) {
return $this->overrideclass;
}
return cache_helper::get_class_for_mode($this->mode);
} | [
"public",
"function",
"get_cache_class",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"overrideclass",
")",
")",
"{",
"return",
"$",
"this",
"->",
"overrideclass",
";",
"}",
"return",
"cache_helper",
"::",
"get_class_for_mode",
"(",
"$... | Returns the cache loader class that should be used for this definition.
@return string | [
"Returns",
"the",
"cache",
"loader",
"class",
"that",
"should",
"be",
"used",
"for",
"this",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/definition.php#L598-L603 |
213,146 | moodle/moodle | cache/classes/definition.php | cache_definition.get_name | public function get_name() {
$identifier = 'cachedef_'.clean_param($this->area, PARAM_STRINGID);
$component = $this->component;
if ($component === 'core') {
$component = 'cache';
}
return new lang_string($identifier, $component);
} | php | public function get_name() {
$identifier = 'cachedef_'.clean_param($this->area, PARAM_STRINGID);
$component = $this->component;
if ($component === 'core') {
$component = 'cache';
}
return new lang_string($identifier, $component);
} | [
"public",
"function",
"get_name",
"(",
")",
"{",
"$",
"identifier",
"=",
"'cachedef_'",
".",
"clean_param",
"(",
"$",
"this",
"->",
"area",
",",
"PARAM_STRINGID",
")",
";",
"$",
"component",
"=",
"$",
"this",
"->",
"component",
";",
"if",
"(",
"$",
"co... | Returns the name for this definition
@return string | [
"Returns",
"the",
"name",
"for",
"this",
"definition"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/definition.php#L617-L624 |
213,147 | moodle/moodle | cache/classes/definition.php | cache_definition.set_identifiers | public function set_identifiers(array $identifiers = array()) {
if ($this->identifiers !== null) {
throw new coding_exception("You can only set identifiers on initial definition creation." .
" Define a new cache to set different identifiers.");
}
if (!empty($identifie... | php | public function set_identifiers(array $identifiers = array()) {
if ($this->identifiers !== null) {
throw new coding_exception("You can only set identifiers on initial definition creation." .
" Define a new cache to set different identifiers.");
}
if (!empty($identifie... | [
"public",
"function",
"set_identifiers",
"(",
"array",
"$",
"identifiers",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"identifiers",
"!==",
"null",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"\"You can only set identifiers on initial... | Sets the identifiers for this definition, or updates them if they have already been set.
@param array $identifiers
@return bool false if no identifiers where changed, true otherwise.
@throws coding_exception | [
"Sets",
"the",
"identifiers",
"for",
"this",
"definition",
"or",
"updates",
"them",
"if",
"they",
"have",
"already",
"been",
"set",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/definition.php#L790-L815 |
213,148 | moodle/moodle | cache/classes/definition.php | cache_definition.get_requirements_bin | public function get_requirements_bin() {
$requires = 0;
if ($this->require_data_guarantee()) {
$requires += cache_store::SUPPORTS_DATA_GUARANTEE;
}
if ($this->require_multiple_identifiers()) {
$requires += cache_store::SUPPORTS_MULTIPLE_IDENTIFIERS;
}
... | php | public function get_requirements_bin() {
$requires = 0;
if ($this->require_data_guarantee()) {
$requires += cache_store::SUPPORTS_DATA_GUARANTEE;
}
if ($this->require_multiple_identifiers()) {
$requires += cache_store::SUPPORTS_MULTIPLE_IDENTIFIERS;
}
... | [
"public",
"function",
"get_requirements_bin",
"(",
")",
"{",
"$",
"requires",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"require_data_guarantee",
"(",
")",
")",
"{",
"$",
"requires",
"+=",
"cache_store",
"::",
"SUPPORTS_DATA_GUARANTEE",
";",
"}",
"if",
... | Returns the requirements of this definition as a binary flag.
@return int | [
"Returns",
"the",
"requirements",
"of",
"this",
"definition",
"as",
"a",
"binary",
"flag",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/definition.php#L821-L833 |
213,149 | moodle/moodle | cache/classes/definition.php | cache_definition.generate_single_key_prefix | public function generate_single_key_prefix() {
if ($this->keyprefixsingle === null) {
$this->keyprefixsingle = $this->mode.'/'.$this->component.'/'.$this->area;
$this->keyprefixsingle .= '/'.$this->get_cache_identifier();
$identifiers = $this->get_identifiers();
i... | php | public function generate_single_key_prefix() {
if ($this->keyprefixsingle === null) {
$this->keyprefixsingle = $this->mode.'/'.$this->component.'/'.$this->area;
$this->keyprefixsingle .= '/'.$this->get_cache_identifier();
$identifiers = $this->get_identifiers();
i... | [
"public",
"function",
"generate_single_key_prefix",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"keyprefixsingle",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"keyprefixsingle",
"=",
"$",
"this",
"->",
"mode",
".",
"'/'",
".",
"$",
"this",
"->",
"compon... | Generates a single key prefix for this definition
@return string | [
"Generates",
"a",
"single",
"key",
"prefix",
"for",
"this",
"definition"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/definition.php#L897-L910 |
213,150 | moodle/moodle | cache/classes/definition.php | cache_definition.generate_multi_key_parts | public function generate_multi_key_parts() {
if ($this->keyprefixmulti === null) {
$this->keyprefixmulti = array(
'mode' => $this->mode,
'component' => $this->component,
'area' => $this->area,
'siteidentifier' => $this->get_cache_identi... | php | public function generate_multi_key_parts() {
if ($this->keyprefixmulti === null) {
$this->keyprefixmulti = array(
'mode' => $this->mode,
'component' => $this->component,
'area' => $this->area,
'siteidentifier' => $this->get_cache_identi... | [
"public",
"function",
"generate_multi_key_parts",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"keyprefixmulti",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"keyprefixmulti",
"=",
"array",
"(",
"'mode'",
"=>",
"$",
"this",
"->",
"mode",
",",
"'component'",... | Generates a multi key prefix for this definition
@return array | [
"Generates",
"a",
"multi",
"key",
"prefix",
"for",
"this",
"definition"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/definition.php#L917-L934 |
213,151 | moodle/moodle | cache/classes/definition.php | cache_definition.get_cache_identifier | protected function get_cache_identifier() {
$identifiers = array();
if ($this->selectedsharingoption & self::SHARING_ALL) {
// Nothing to do here.
} else {
if ($this->selectedsharingoption & self::SHARING_SITEID) {
$identifiers[] = cache_helper::get_site_i... | php | protected function get_cache_identifier() {
$identifiers = array();
if ($this->selectedsharingoption & self::SHARING_ALL) {
// Nothing to do here.
} else {
if ($this->selectedsharingoption & self::SHARING_SITEID) {
$identifiers[] = cache_helper::get_site_i... | [
"protected",
"function",
"get_cache_identifier",
"(",
")",
"{",
"$",
"identifiers",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"selectedsharingoption",
"&",
"self",
"::",
"SHARING_ALL",
")",
"{",
"// Nothing to do here.",
"}",
"else",
"{",
"i... | Returns a cache identification string.
@return string A string to be used as part of keys. | [
"Returns",
"a",
"cache",
"identification",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/definition.php#L969-L985 |
213,152 | moodle/moodle | blocks/navigation/block_navigation.php | block_navigation.get_required_javascript | function get_required_javascript() {
parent::get_required_javascript();
$arguments = array(
'instanceid' => $this->instance->id
);
$this->page->requires->string_for_js('viewallcourses', 'moodle');
$this->page->requires->js_call_amd('block_navigation/navblock', 'init',... | php | function get_required_javascript() {
parent::get_required_javascript();
$arguments = array(
'instanceid' => $this->instance->id
);
$this->page->requires->string_for_js('viewallcourses', 'moodle');
$this->page->requires->js_call_amd('block_navigation/navblock', 'init',... | [
"function",
"get_required_javascript",
"(",
")",
"{",
"parent",
"::",
"get_required_javascript",
"(",
")",
";",
"$",
"arguments",
"=",
"array",
"(",
"'instanceid'",
"=>",
"$",
"this",
"->",
"instance",
"->",
"id",
")",
";",
"$",
"this",
"->",
"page",
"->",... | Gets Javascript that may be required for navigation | [
"Gets",
"Javascript",
"that",
"may",
"be",
"required",
"for",
"navigation"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/navigation/block_navigation.php#L109-L116 |
213,153 | moodle/moodle | blocks/navigation/block_navigation.php | block_navigation.html_attributes | public function html_attributes() {
$attributes = parent::html_attributes();
if (!empty($this->config->enablehoverexpansion) && $this->config->enablehoverexpansion == 'yes') {
$attributes['class'] .= ' block_js_expansion';
}
return $attributes;
} | php | public function html_attributes() {
$attributes = parent::html_attributes();
if (!empty($this->config->enablehoverexpansion) && $this->config->enablehoverexpansion == 'yes') {
$attributes['class'] .= ' block_js_expansion';
}
return $attributes;
} | [
"public",
"function",
"html_attributes",
"(",
")",
"{",
"$",
"attributes",
"=",
"parent",
"::",
"html_attributes",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"config",
"->",
"enablehoverexpansion",
")",
"&&",
"$",
"this",
"->",
"conf... | Returns the attributes to set for this block
This function returns an array of HTML attributes for this block including
the defaults.
{@link block_tree::html_attributes()} is used to get the default arguments
and then we check whether the user has enabled hover expansion and add the
appropriate hover class if it has.
... | [
"Returns",
"the",
"attributes",
"to",
"set",
"for",
"this",
"block"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/navigation/block_navigation.php#L232-L238 |
213,154 | moodle/moodle | blocks/navigation/block_navigation.php | block_navigation.trim | public function trim(navigation_node $node, $mode=1, $long=50, $short=25, $recurse=true) {
switch ($mode) {
case self::TRIM_RIGHT :
if (core_text::strlen($node->text)>($long+3)) {
// Truncate the text to $long characters
$node->text = $this->tr... | php | public function trim(navigation_node $node, $mode=1, $long=50, $short=25, $recurse=true) {
switch ($mode) {
case self::TRIM_RIGHT :
if (core_text::strlen($node->text)>($long+3)) {
// Truncate the text to $long characters
$node->text = $this->tr... | [
"public",
"function",
"trim",
"(",
"navigation_node",
"$",
"node",
",",
"$",
"mode",
"=",
"1",
",",
"$",
"long",
"=",
"50",
",",
"$",
"short",
"=",
"25",
",",
"$",
"recurse",
"=",
"true",
")",
"{",
"switch",
"(",
"$",
"mode",
")",
"{",
"case",
... | Trims the text and shorttext properties of this node and optionally
all of its children.
@param navigation_node $node
@param int $mode One of navigation_node::TRIM_*
@param int $long The length to trim text to
@param int $short The length to trim shorttext to
@param bool $recurse Recurse all children | [
"Trims",
"the",
"text",
"and",
"shorttext",
"properties",
"of",
"this",
"node",
"and",
"optionally",
"all",
"of",
"its",
"children",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/navigation/block_navigation.php#L250-L288 |
213,155 | moodle/moodle | blocks/navigation/block_navigation.php | block_navigation.trim_left | protected function trim_left($string, $length) {
return '...'.core_text::substr($string, core_text::strlen($string)-$length, $length);
} | php | protected function trim_left($string, $length) {
return '...'.core_text::substr($string, core_text::strlen($string)-$length, $length);
} | [
"protected",
"function",
"trim_left",
"(",
"$",
"string",
",",
"$",
"length",
")",
"{",
"return",
"'...'",
".",
"core_text",
"::",
"substr",
"(",
"$",
"string",
",",
"core_text",
"::",
"strlen",
"(",
"$",
"string",
")",
"-",
"$",
"length",
",",
"$",
... | Truncate a string from the left
@param string $string The string to truncate
@param int $length The length to truncate to
@return string The truncated string | [
"Truncate",
"a",
"string",
"from",
"the",
"left"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/navigation/block_navigation.php#L295-L297 |
213,156 | moodle/moodle | blocks/navigation/block_navigation.php | block_navigation.trim_center | protected function trim_center($string, $length) {
$trimlength = ceil($length/2);
$start = core_text::substr($string, 0, $trimlength);
$end = core_text::substr($string, core_text::strlen($string)-$trimlength);
$string = $start.'...'.$end;
return $string;
} | php | protected function trim_center($string, $length) {
$trimlength = ceil($length/2);
$start = core_text::substr($string, 0, $trimlength);
$end = core_text::substr($string, core_text::strlen($string)-$trimlength);
$string = $start.'...'.$end;
return $string;
} | [
"protected",
"function",
"trim_center",
"(",
"$",
"string",
",",
"$",
"length",
")",
"{",
"$",
"trimlength",
"=",
"ceil",
"(",
"$",
"length",
"/",
"2",
")",
";",
"$",
"start",
"=",
"core_text",
"::",
"substr",
"(",
"$",
"string",
",",
"0",
",",
"$"... | Truncate a string in the center
@param string $string The string to truncate
@param int $length The length to truncate to
@return string The truncated string | [
"Truncate",
"a",
"string",
"in",
"the",
"center"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/navigation/block_navigation.php#L313-L319 |
213,157 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Fetch/Results.php | Horde_Imap_Client_Fetch_Results.get | public function get($key)
{
if (!isset($this->_data[$key])) {
$this->_data[$key] = new $this->_obClass();
}
return $this->_data[$key];
} | php | public function get($key)
{
if (!isset($this->_data[$key])) {
$this->_data[$key] = new $this->_obClass();
}
return $this->_data[$key];
} | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"this",
"->",
"_data",
"[",
"$",
"key",
"]",
"=",
"new",
"$",
"this",
"->",
"_obClass"... | Return a fetch object, creating and storing an empty object in the
results set if it doesn't currently exist.
@param string $key The key to retrieve.
@return Horde_Imap_Client_Data_Fetch The fetch object. | [
"Return",
"a",
"fetch",
"object",
"creating",
"and",
"storing",
"an",
"empty",
"object",
"in",
"the",
"results",
"set",
"if",
"it",
"doesn",
"t",
"currently",
"exist",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Fetch/Results.php#L87-L94 |
213,158 | moodle/moodle | lib/xmldb/xmldb_object.php | xmldb_object.findObjectInArray | public function findObjectInArray($objectname, $arr) {
foreach ($arr as $i => $object) {
if ($objectname == $object->getName()) {
return $i;
}
}
return null;
} | php | public function findObjectInArray($objectname, $arr) {
foreach ($arr as $i => $object) {
if ($objectname == $object->getName()) {
return $i;
}
}
return null;
} | [
"public",
"function",
"findObjectInArray",
"(",
"$",
"objectname",
",",
"$",
"arr",
")",
"{",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"i",
"=>",
"$",
"object",
")",
"{",
"if",
"(",
"$",
"objectname",
"==",
"$",
"object",
"->",
"getName",
"(",
")",
"... | Returns the position of one object in the array.
@param string $objectname
@param array $arr
@return mixed | [
"Returns",
"the",
"position",
"of",
"one",
"object",
"in",
"the",
"array",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmldb/xmldb_object.php#L316-L323 |
213,159 | moodle/moodle | lib/xmldb/xmldb_object.php | xmldb_object.comma2array | public function comma2array($string) {
$foundquotes = array();
$foundconcats = array();
// Extract all the concat elements from the string
preg_match_all("/(CONCAT\(.*?\))/is", $string, $matches);
foreach (array_unique($matches[0]) as $key=>$value) {
$foundconcats[... | php | public function comma2array($string) {
$foundquotes = array();
$foundconcats = array();
// Extract all the concat elements from the string
preg_match_all("/(CONCAT\(.*?\))/is", $string, $matches);
foreach (array_unique($matches[0]) as $key=>$value) {
$foundconcats[... | [
"public",
"function",
"comma2array",
"(",
"$",
"string",
")",
"{",
"$",
"foundquotes",
"=",
"array",
"(",
")",
";",
"$",
"foundconcats",
"=",
"array",
"(",
")",
";",
"// Extract all the concat elements from the string",
"preg_match_all",
"(",
"\"/(CONCAT\\(.*?\\))/i... | Returns one array of elements from one comma separated string,
supporting quoted strings containing commas and concat function calls
@param string $string
@return array | [
"Returns",
"one",
"array",
"of",
"elements",
"from",
"one",
"comma",
"separated",
"string",
"supporting",
"quoted",
"strings",
"containing",
"commas",
"and",
"concat",
"function",
"calls"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmldb/xmldb_object.php#L362-L408 |
213,160 | moodle/moodle | mod/forum/classes/local/builders/exported_discussion.php | exported_discussion.build | public function build(
stdClass $user,
forum_entity $forum,
discussion_entity $discussion
) : array {
$favouriteids = [];
if ($this->is_favourited($discussion, $forum->get_context(), $user)) {
$favouriteids[] = $discussion->get_id();
}
$groupsbyi... | php | public function build(
stdClass $user,
forum_entity $forum,
discussion_entity $discussion
) : array {
$favouriteids = [];
if ($this->is_favourited($discussion, $forum->get_context(), $user)) {
$favouriteids[] = $discussion->get_id();
}
$groupsbyi... | [
"public",
"function",
"build",
"(",
"stdClass",
"$",
"user",
",",
"forum_entity",
"$",
"forum",
",",
"discussion_entity",
"$",
"discussion",
")",
":",
"array",
"{",
"$",
"favouriteids",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"is_favourited",
"... | Build any additional variables for the exported discussion for a given set of discussions.
This will typically be used for a list of discussions in the same forum.
@param stdClass $user The user to export the posts for.
@param forum_entity $forum The forum that each of the $discussions belong to
@param discussion_ent... | [
"Build",
"any",
"additional",
"variables",
"for",
"the",
"exported",
"discussion",
"for",
"a",
"given",
"set",
"of",
"discussions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/builders/exported_discussion.php#L104-L121 |
213,161 | moodle/moodle | mod/forum/classes/local/builders/exported_discussion.php | exported_discussion.is_favourited | public function is_favourited(discussion_entity $discussion, \context_module $forumcontext, \stdClass $user) {
if (!isloggedin()) {
return false;
}
$usercontext = \context_user::instance($user->id);
$ufservice = \core_favourites\service_factory::get_service_for_user_context(... | php | public function is_favourited(discussion_entity $discussion, \context_module $forumcontext, \stdClass $user) {
if (!isloggedin()) {
return false;
}
$usercontext = \context_user::instance($user->id);
$ufservice = \core_favourites\service_factory::get_service_for_user_context(... | [
"public",
"function",
"is_favourited",
"(",
"discussion_entity",
"$",
"discussion",
",",
"\\",
"context_module",
"$",
"forumcontext",
",",
"\\",
"stdClass",
"$",
"user",
")",
"{",
"if",
"(",
"!",
"isloggedin",
"(",
")",
")",
"{",
"return",
"false",
";",
"}... | Check whether the provided discussion has been favourited by the user.
@param discussion_entity $discussion The discussion record
@param \context_module $forumcontext Forum context
@param \stdClass $user The user to check the favourite against
@return bool Whether or not the user has favourited the discussion | [
"Check",
"whether",
"the",
"provided",
"discussion",
"has",
"been",
"favourited",
"by",
"the",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/builders/exported_discussion.php#L144-L152 |
213,162 | moodle/moodle | lib/adodb/adodb-memcache.lib.inc.php | ADODB_Cache_MemCache.connect | function connect(&$err)
{
if (!function_exists('memcache_pconnect')) {
$err = 'Memcache module PECL extension not found!';
return false;
}
$memcache = new MemCache;
if (!is_array($this->hosts)) $this->hosts = array($this->hosts);
$failcnt = 0;
foreach($this->hosts as $host) {
if (!@$m... | php | function connect(&$err)
{
if (!function_exists('memcache_pconnect')) {
$err = 'Memcache module PECL extension not found!';
return false;
}
$memcache = new MemCache;
if (!is_array($this->hosts)) $this->hosts = array($this->hosts);
$failcnt = 0;
foreach($this->hosts as $host) {
if (!@$m... | [
"function",
"connect",
"(",
"&",
"$",
"err",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'memcache_pconnect'",
")",
")",
"{",
"$",
"err",
"=",
"'Memcache module PECL extension not found!'",
";",
"return",
"false",
";",
"}",
"$",
"memcache",
"=",
"new"... | implement as lazy connection. The connection only occurs on CacheExecute call | [
"implement",
"as",
"lazy",
"connection",
".",
"The",
"connection",
"only",
"occurs",
"on",
"CacheExecute",
"call"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-memcache.lib.inc.php#L61-L85 |
213,163 | moodle/moodle | lib/adodb/adodb-memcache.lib.inc.php | ADODB_Cache_MemCache.writecache | function writecache($filename, $contents, $debug, $secs2cache)
{
if (!$this->_connected) {
$err = '';
if (!$this->connect($err) && $debug) ADOConnection::outp($err);
}
if (!$this->_memcache) return false;
if (!$this->_memcache->set($filename, $contents, $this->compress ? MEMCACHE_COMPRESSED : 0, ... | php | function writecache($filename, $contents, $debug, $secs2cache)
{
if (!$this->_connected) {
$err = '';
if (!$this->connect($err) && $debug) ADOConnection::outp($err);
}
if (!$this->_memcache) return false;
if (!$this->_memcache->set($filename, $contents, $this->compress ? MEMCACHE_COMPRESSED : 0, ... | [
"function",
"writecache",
"(",
"$",
"filename",
",",
"$",
"contents",
",",
"$",
"debug",
",",
"$",
"secs2cache",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_connected",
")",
"{",
"$",
"err",
"=",
"''",
";",
"if",
"(",
"!",
"$",
"this",
"->",
... | returns true or false. true if successful save | [
"returns",
"true",
"or",
"false",
".",
"true",
"if",
"successful",
"save"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-memcache.lib.inc.php#L88-L102 |
213,164 | moodle/moodle | lib/adodb/adodb-memcache.lib.inc.php | ADODB_Cache_MemCache.readcache | function readcache($filename, &$err, $secs2cache, $rsClass)
{
$false = false;
if (!$this->_connected) $this->connect($err);
if (!$this->_memcache) return $false;
$rs = $this->_memcache->get($filename);
if (!$rs) {
$err = 'Item with such key doesn\'t exists on the memcached server.';
return $fa... | php | function readcache($filename, &$err, $secs2cache, $rsClass)
{
$false = false;
if (!$this->_connected) $this->connect($err);
if (!$this->_memcache) return $false;
$rs = $this->_memcache->get($filename);
if (!$rs) {
$err = 'Item with such key doesn\'t exists on the memcached server.';
return $fa... | [
"function",
"readcache",
"(",
"$",
"filename",
",",
"&",
"$",
"err",
",",
"$",
"secs2cache",
",",
"$",
"rsClass",
")",
"{",
"$",
"false",
"=",
"false",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_connected",
")",
"$",
"this",
"->",
"connect",
"(",
... | returns a recordset | [
"returns",
"a",
"recordset"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-memcache.lib.inc.php#L105-L149 |
213,165 | moodle/moodle | user/classes/output/myprofile/tree.php | tree.add_node | public function add_node(node $node) {
$name = $node->name;
if (isset($this->nodes[$name])) {
throw new \coding_exception("Node name $name already used");
}
$this->nodes[$node->name] = $node;
} | php | public function add_node(node $node) {
$name = $node->name;
if (isset($this->nodes[$name])) {
throw new \coding_exception("Node name $name already used");
}
$this->nodes[$node->name] = $node;
} | [
"public",
"function",
"add_node",
"(",
"node",
"$",
"node",
")",
"{",
"$",
"name",
"=",
"$",
"node",
"->",
"name",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"nodes",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"coding_excep... | Add a node to the tree.
@param node $node node object.
@throws \coding_exception | [
"Add",
"a",
"node",
"to",
"the",
"tree",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/output/myprofile/tree.php#L59-L65 |
213,166 | moodle/moodle | user/classes/output/myprofile/tree.php | tree.add_category | public function add_category(category $cat) {
$name = $cat->name;
if (isset($this->categories[$name])) {
throw new \coding_exception("Category name $name already used");
}
$this->categories[$cat->name] = $cat;
} | php | public function add_category(category $cat) {
$name = $cat->name;
if (isset($this->categories[$name])) {
throw new \coding_exception("Category name $name already used");
}
$this->categories[$cat->name] = $cat;
} | [
"public",
"function",
"add_category",
"(",
"category",
"$",
"cat",
")",
"{",
"$",
"name",
"=",
"$",
"cat",
"->",
"name",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"categories",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"c... | Add a category to the tree.
@param category $cat category object.
@throws \coding_exception | [
"Add",
"a",
"category",
"to",
"the",
"tree",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/output/myprofile/tree.php#L74-L80 |
213,167 | moodle/moodle | user/classes/output/myprofile/tree.php | tree.sort_categories | public function sort_categories() {
$this->attach_nodes_to_categories();
$tempcategories = array();
foreach ($this->categories as $category) {
$after = $category->after;
if ($after == null) {
// Can go anywhere in the tree.
$category->sort_... | php | public function sort_categories() {
$this->attach_nodes_to_categories();
$tempcategories = array();
foreach ($this->categories as $category) {
$after = $category->after;
if ($after == null) {
// Can go anywhere in the tree.
$category->sort_... | [
"public",
"function",
"sort_categories",
"(",
")",
"{",
"$",
"this",
"->",
"attach_nodes_to_categories",
"(",
")",
";",
"$",
"tempcategories",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"categories",
"as",
"$",
"category",
")",
"{",
... | Sort categories and nodes. Builds the tree structure that would be displayed to the user.
@throws \coding_exception | [
"Sort",
"categories",
"and",
"nodes",
".",
"Builds",
"the",
"tree",
"structure",
"that",
"would",
"be",
"displayed",
"to",
"the",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/output/myprofile/tree.php#L87-L104 |
213,168 | moodle/moodle | user/classes/output/myprofile/tree.php | tree.attach_nodes_to_categories | protected function attach_nodes_to_categories() {
foreach ($this->nodes as $node) {
$parentcat = $node->parentcat;
if (!isset($this->categories[$parentcat])) {
throw new \coding_exception("Category $parentcat doesn't exist");
} else {
$this->ca... | php | protected function attach_nodes_to_categories() {
foreach ($this->nodes as $node) {
$parentcat = $node->parentcat;
if (!isset($this->categories[$parentcat])) {
throw new \coding_exception("Category $parentcat doesn't exist");
} else {
$this->ca... | [
"protected",
"function",
"attach_nodes_to_categories",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"nodes",
"as",
"$",
"node",
")",
"{",
"$",
"parentcat",
"=",
"$",
"node",
"->",
"parentcat",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
... | Attach various nodes to their respective categories.
@throws \coding_exception | [
"Attach",
"various",
"nodes",
"to",
"their",
"respective",
"categories",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/output/myprofile/tree.php#L111-L120 |
213,169 | moodle/moodle | user/classes/output/myprofile/tree.php | tree.find_categories_after | protected function find_categories_after($category) {
$return = array();
$categoryarray = $this->categories;
foreach ($categoryarray as $categoryelement) {
if ($categoryelement->after == $category->name) {
// Find all categories that comes after this category as well.... | php | protected function find_categories_after($category) {
$return = array();
$categoryarray = $this->categories;
foreach ($categoryarray as $categoryelement) {
if ($categoryelement->after == $category->name) {
// Find all categories that comes after this category as well.... | [
"protected",
"function",
"find_categories_after",
"(",
"$",
"category",
")",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"$",
"categoryarray",
"=",
"$",
"this",
"->",
"categories",
";",
"foreach",
"(",
"$",
"categoryarray",
"as",
"$",
"categoryelement",... | Find all category nodes that should be displayed after a given a category node.
@param category $category category object
@return category[] array of category objects
@throws \coding_exception | [
"Find",
"all",
"category",
"nodes",
"that",
"should",
"be",
"displayed",
"after",
"a",
"given",
"a",
"category",
"node",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/output/myprofile/tree.php#L130-L142 |
213,170 | moodle/moodle | lib/filebrowser/file_info_context_coursecat.php | file_info_context_coursecat.get_courses | protected function get_courses($hiddencats) {
global $DB, $CFG;
require_once($CFG->libdir.'/modinfolib.php');
$params = array('category' => $this->category->id, 'contextlevel' => CONTEXT_COURSE);
$sql = 'c.category = :category';
foreach ($hiddencats as $category) {
... | php | protected function get_courses($hiddencats) {
global $DB, $CFG;
require_once($CFG->libdir.'/modinfolib.php');
$params = array('category' => $this->category->id, 'contextlevel' => CONTEXT_COURSE);
$sql = 'c.category = :category';
foreach ($hiddencats as $category) {
... | [
"protected",
"function",
"get_courses",
"(",
"$",
"hiddencats",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/modinfolib.php'",
")",
";",
"$",
"params",
"=",
"array",
"(",
"'category'",
"=>"... | List of courses in this category and in hidden subcategories
@param array $hiddencats list of categories that are hidden from current user and returned by {@link get_categories()}
@return array list of courses | [
"List",
"of",
"courses",
"in",
"this",
"category",
"and",
"in",
"hidden",
"subcategories"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info_context_coursecat.php#L191-L212 |
213,171 | moodle/moodle | lib/filebrowser/file_info_context_coursecat.php | file_info_context_coursecat.get_categories | protected function get_categories() {
global $DB;
$fields = 'c.*, ' . context_helper::get_preload_record_columns_sql('ctx');
$coursecats = $DB->get_records_sql('SELECT ' . $fields . ' FROM {course_categories} c
LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextleve... | php | protected function get_categories() {
global $DB;
$fields = 'c.*, ' . context_helper::get_preload_record_columns_sql('ctx');
$coursecats = $DB->get_records_sql('SELECT ' . $fields . ' FROM {course_categories} c
LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextleve... | [
"protected",
"function",
"get_categories",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"fields",
"=",
"'c.*, '",
".",
"context_helper",
"::",
"get_preload_record_columns_sql",
"(",
"'ctx'",
")",
";",
"$",
"coursecats",
"=",
"$",
"DB",
"->",
"get_records_sql"... | Finds accessible and non-accessible direct subcategories
@return array [$coursecats, $hiddencats] - child categories that are visible to the current user and not visible | [
"Finds",
"accessible",
"and",
"non",
"-",
"accessible",
"direct",
"subcategories"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info_context_coursecat.php#L219-L237 |
213,172 | moodle/moodle | lib/filebrowser/file_info_context_coursecat.php | file_info_context_coursecat.get_child_course | protected function get_child_course($course) {
context_helper::preload_from_record($course);
$context = context_course::instance($course->id);
$child = new file_info_context_course($this->browser, $context, $course);
return $child->get_file_info(null, null, null, null, null);
} | php | protected function get_child_course($course) {
context_helper::preload_from_record($course);
$context = context_course::instance($course->id);
$child = new file_info_context_course($this->browser, $context, $course);
return $child->get_file_info(null, null, null, null, null);
} | [
"protected",
"function",
"get_child_course",
"(",
"$",
"course",
")",
"{",
"context_helper",
"::",
"preload_from_record",
"(",
"$",
"course",
")",
";",
"$",
"context",
"=",
"context_course",
"::",
"instance",
"(",
"$",
"course",
"->",
"id",
")",
";",
"$",
... | Returns the file info element for a given course or null if course is not accessible
@param stdClass $course may contain context fields for preloading
@return file_info_context_course|null | [
"Returns",
"the",
"file",
"info",
"element",
"for",
"a",
"given",
"course",
"or",
"null",
"if",
"course",
"is",
"not",
"accessible"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info_context_coursecat.php#L245-L250 |
213,173 | moodle/moodle | lib/google/src/Google/Client.php | Google_Client.verifySignedJwt | public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null)
{
$auth = new Google_Auth_OAuth2($this);
$certs = $auth->retrieveCertsFromLocation($cert_location);
return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry);
} | php | public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null)
{
$auth = new Google_Auth_OAuth2($this);
$certs = $auth->retrieveCertsFromLocation($cert_location);
return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry);
} | [
"public",
"function",
"verifySignedJwt",
"(",
"$",
"id_token",
",",
"$",
"cert_location",
",",
"$",
"audience",
",",
"$",
"issuer",
",",
"$",
"max_expiry",
"=",
"null",
")",
"{",
"$",
"auth",
"=",
"new",
"Google_Auth_OAuth2",
"(",
"$",
"this",
")",
";",
... | Verify a JWT that was signed with your own certificates.
@param $id_token string The JWT token
@param $cert_location array of certificates
@param $audience string the expected consumer of the token
@param $issuer string the expected issuer, defaults to Google
@param [$max_expiry] the max lifetime of a token, defaults ... | [
"Verify",
"a",
"JWT",
"that",
"was",
"signed",
"with",
"your",
"own",
"certificates",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Client.php#L495-L500 |
213,174 | moodle/moodle | admin/tool/analytics/classes/output/renderer.php | renderer.render_evaluate_results | public function render_evaluate_results($results, $logs = array()) {
global $OUTPUT;
$output = '';
foreach ($results as $timesplittingid => $result) {
if (!CLI_SCRIPT) {
$output .= $OUTPUT->box_start('generalbox mb-3');
}
// Check that the ... | php | public function render_evaluate_results($results, $logs = array()) {
global $OUTPUT;
$output = '';
foreach ($results as $timesplittingid => $result) {
if (!CLI_SCRIPT) {
$output .= $OUTPUT->box_start('generalbox mb-3');
}
// Check that the ... | [
"public",
"function",
"render_evaluate_results",
"(",
"$",
"results",
",",
"$",
"logs",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"output",
"=",
"''",
";",
"foreach",
"(",
"$",
"results",
"as",
"$",
"timesplittingid",
"=>",
"... | Web interface evaluate results.
@param \stdClass[] $results
@param string[] $logs
@return string HTML | [
"Web",
"interface",
"evaluate",
"results",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/analytics/classes/output/renderer.php#L76-L137 |
213,175 | moodle/moodle | lib/horde/framework/Horde/Mime/Magic.php | Horde_Mime_Magic._getMimeExtensionMap | protected static function _getMimeExtensionMap()
{
if (is_null(self::$_map)) {
require __DIR__ . '/mime.mapping.php';
self::$_map = $mime_extension_map;
}
return self::$_map;
} | php | protected static function _getMimeExtensionMap()
{
if (is_null(self::$_map)) {
require __DIR__ . '/mime.mapping.php';
self::$_map = $mime_extension_map;
}
return self::$_map;
} | [
"protected",
"static",
"function",
"_getMimeExtensionMap",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"_map",
")",
")",
"{",
"require",
"__DIR__",
".",
"'/mime.mapping.php'",
";",
"self",
"::",
"$",
"_map",
"=",
"$",
"mime_extension_map",
... | Returns a copy of the MIME extension map.
@return array The MIME extension map. | [
"Returns",
"a",
"copy",
"of",
"the",
"MIME",
"extension",
"map",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Magic.php#L38-L46 |
213,176 | moodle/moodle | lib/horde/framework/Horde/Mime/Magic.php | Horde_Mime_Magic.extToMime | public static function extToMime($ext)
{
if (empty($ext)) {
return 'application/octet-stream';
}
$ext = Horde_String::lower($ext);
$map = self::_getMimeExtensionMap();
$pos = 0;
while (!isset($map[$ext])) {
if (($pos = strpos($ext, '.')) === ... | php | public static function extToMime($ext)
{
if (empty($ext)) {
return 'application/octet-stream';
}
$ext = Horde_String::lower($ext);
$map = self::_getMimeExtensionMap();
$pos = 0;
while (!isset($map[$ext])) {
if (($pos = strpos($ext, '.')) === ... | [
"public",
"static",
"function",
"extToMime",
"(",
"$",
"ext",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"ext",
")",
")",
"{",
"return",
"'application/octet-stream'",
";",
"}",
"$",
"ext",
"=",
"Horde_String",
"::",
"lower",
"(",
"$",
"ext",
")",
";",
"... | Attempt to convert a file extension to a MIME type, based
on the global Horde and application specific config files.
If we cannot map the file extension to a specific type, then
we fall back to a custom MIME handler 'x-extension/$ext', which
can be used as a normal MIME type internally throughout Horde.
@param string... | [
"Attempt",
"to",
"convert",
"a",
"file",
"extension",
"to",
"a",
"MIME",
"type",
"based",
"on",
"the",
"global",
"Horde",
"and",
"application",
"specific",
"config",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Magic.php#L60-L80 |
213,177 | moodle/moodle | lib/horde/framework/Horde/Mime/Magic.php | Horde_Mime_Magic.filenameToMime | public static function filenameToMime($filename, $unknown = true)
{
$pos = strlen($filename) + 1;
$type = '';
$map = self::_getMimeExtensionMap();
for ($i = 0; $i <= $map['__MAXPERIOD__']; ++$i) {
$npos = strrpos(substr($filename, 0, $pos - 1), '.');
if ($npo... | php | public static function filenameToMime($filename, $unknown = true)
{
$pos = strlen($filename) + 1;
$type = '';
$map = self::_getMimeExtensionMap();
for ($i = 0; $i <= $map['__MAXPERIOD__']; ++$i) {
$npos = strrpos(substr($filename, 0, $pos - 1), '.');
if ($npo... | [
"public",
"static",
"function",
"filenameToMime",
"(",
"$",
"filename",
",",
"$",
"unknown",
"=",
"true",
")",
"{",
"$",
"pos",
"=",
"strlen",
"(",
"$",
"filename",
")",
"+",
"1",
";",
"$",
"type",
"=",
"''",
";",
"$",
"map",
"=",
"self",
"::",
"... | Attempt to convert a filename to a MIME type, based on the global Horde
and application specific config files.
@param string $filename The filename to be mapped to a MIME type.
@param boolean $unknown How should unknown extensions be handled? If
true, will return 'x-extension/*' types. If
false, will return 'applic... | [
"Attempt",
"to",
"convert",
"a",
"filename",
"to",
"a",
"MIME",
"type",
"based",
"on",
"the",
"global",
"Horde",
"and",
"application",
"specific",
"config",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Magic.php#L93-L112 |
213,178 | moodle/moodle | lib/horde/framework/Horde/Mime/Magic.php | Horde_Mime_Magic.mimeToExt | public static function mimeToExt($type)
{
if (empty($type)) {
return false;
}
if (($key = array_search($type, self::_getMimeExtensionMap())) === false) {
list($major, $minor) = explode('/', $type);
if ($major == 'x-extension') {
return $mi... | php | public static function mimeToExt($type)
{
if (empty($type)) {
return false;
}
if (($key = array_search($type, self::_getMimeExtensionMap())) === false) {
list($major, $minor) = explode('/', $type);
if ($major == 'x-extension') {
return $mi... | [
"public",
"static",
"function",
"mimeToExt",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"type",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"type",
",",
"self",
"::",
"_get... | Attempt to convert a MIME type to a file extension, based
on the global Horde and application specific config files.
If we cannot map the type to a file extension, we return false.
@param string $type The MIME type to be mapped to a file extension.
@return string The file extension of the MIME type. | [
"Attempt",
"to",
"convert",
"a",
"MIME",
"type",
"to",
"a",
"file",
"extension",
"based",
"on",
"the",
"global",
"Horde",
"and",
"application",
"specific",
"config",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Magic.php#L124-L142 |
213,179 | moodle/moodle | lib/horde/framework/Horde/Mime/Magic.php | Horde_Mime_Magic.analyzeFile | public static function analyzeFile($path, $magic_db = null,
$opts = array())
{
if (Horde_Util::extensionExists('fileinfo')) {
$res = empty($magic_db)
? finfo_open(FILEINFO_MIME)
: finfo_open(FILEINFO_MIME, $magic_db);
... | php | public static function analyzeFile($path, $magic_db = null,
$opts = array())
{
if (Horde_Util::extensionExists('fileinfo')) {
$res = empty($magic_db)
? finfo_open(FILEINFO_MIME)
: finfo_open(FILEINFO_MIME, $magic_db);
... | [
"public",
"static",
"function",
"analyzeFile",
"(",
"$",
"path",
",",
"$",
"magic_db",
"=",
"null",
",",
"$",
"opts",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"Horde_Util",
"::",
"extensionExists",
"(",
"'fileinfo'",
")",
")",
"{",
"$",
"res",
"=... | Attempt to determine the MIME type of an unknown file.
@param string $path The path to the file to analyze.
@param string $magic_db Path to the mime magic database.
@param array $opts Additional options:
- nostrip: (boolean) Don't strip parameter information from MIME
type string.
DEFAULT: false
@return m... | [
"Attempt",
"to",
"determine",
"the",
"MIME",
"type",
"of",
"an",
"unknown",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Magic.php#L157-L187 |
213,180 | moodle/moodle | lib/horde/framework/Horde/Mime/Magic.php | Horde_Mime_Magic.analyzeData | public static function analyzeData($data, $magic_db = null,
$opts = array())
{
/* If the PHP Mimetype extension is available, use that. */
if (Horde_Util::extensionExists('fileinfo')) {
$res = empty($magic_db)
? @finfo_open(FILEINFO_... | php | public static function analyzeData($data, $magic_db = null,
$opts = array())
{
/* If the PHP Mimetype extension is available, use that. */
if (Horde_Util::extensionExists('fileinfo')) {
$res = empty($magic_db)
? @finfo_open(FILEINFO_... | [
"public",
"static",
"function",
"analyzeData",
"(",
"$",
"data",
",",
"$",
"magic_db",
"=",
"null",
",",
"$",
"opts",
"=",
"array",
"(",
")",
")",
"{",
"/* If the PHP Mimetype extension is available, use that. */",
"if",
"(",
"Horde_Util",
"::",
"extensionExists",... | Attempt to determine the MIME type of an unknown byte stream.
@param string $data The file data to analyze.
@param string $magic_db Path to the mime magic database.
@param array $opts Additional options:
- nostrip: (boolean) Don't strip parameter information from MIME
type string.
DEFAULT: false
@return m... | [
"Attempt",
"to",
"determine",
"the",
"MIME",
"type",
"of",
"an",
"unknown",
"byte",
"stream",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Magic.php#L202-L233 |
213,181 | moodle/moodle | lib/adodb/adodb-active-recordx.inc.php | ADODB_Active_Table.updateColsCount | function updateColsCount()
{
$this->_colsCount = sizeof($this->flds);
foreach($this->_belongsTo as $foreignTable)
$this->_colsCount += sizeof($foreignTable->TableInfo()->flds);
foreach($this->_hasMany as $foreignTable)
$this->_colsCount += sizeof($foreignTable->TableInfo()->flds);
} | php | function updateColsCount()
{
$this->_colsCount = sizeof($this->flds);
foreach($this->_belongsTo as $foreignTable)
$this->_colsCount += sizeof($foreignTable->TableInfo()->flds);
foreach($this->_hasMany as $foreignTable)
$this->_colsCount += sizeof($foreignTable->TableInfo()->flds);
} | [
"function",
"updateColsCount",
"(",
")",
"{",
"$",
"this",
"->",
"_colsCount",
"=",
"sizeof",
"(",
"$",
"this",
"->",
"flds",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_belongsTo",
"as",
"$",
"foreignTable",
")",
"$",
"this",
"->",
"_colsCount",
"+... | total columns count, including relations | [
"total",
"columns",
"count",
"including",
"relations"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-active-recordx.inc.php#L54-L61 |
213,182 | moodle/moodle | lib/adodb/adodb-active-recordx.inc.php | ADODB_Active_Record.Error | function Error($err,$fn)
{
global $_ADODB_ACTIVE_DBS;
$fn = get_class($this).'::'.$fn;
$this->_lasterr = $fn.': '.$err;
if ($this->_dbat < 0) {
$db = false;
}
else {
$activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
$db = $activedb->db;
}
if (function_exists('adodb_throw')) {
if (!$db) {
... | php | function Error($err,$fn)
{
global $_ADODB_ACTIVE_DBS;
$fn = get_class($this).'::'.$fn;
$this->_lasterr = $fn.': '.$err;
if ($this->_dbat < 0) {
$db = false;
}
else {
$activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
$db = $activedb->db;
}
if (function_exists('adodb_throw')) {
if (!$db) {
... | [
"function",
"Error",
"(",
"$",
"err",
",",
"$",
"fn",
")",
"{",
"global",
"$",
"_ADODB_ACTIVE_DBS",
";",
"$",
"fn",
"=",
"get_class",
"(",
"$",
"this",
")",
".",
"'::'",
".",
"$",
"fn",
";",
"$",
"this",
"->",
"_lasterr",
"=",
"$",
"fn",
".",
"... | error handler for both PHP4+5. | [
"error",
"handler",
"for",
"both",
"PHP4",
"+",
"5",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-active-recordx.inc.php#L575-L603 |
213,183 | moodle/moodle | lib/adodb/adodb-active-recordx.inc.php | ADODB_Active_Record.ErrorMsg | function ErrorMsg()
{
if (!function_exists('adodb_throw')) {
if ($this->_dbat < 0) {
$db = false;
}
else {
$db = $this->DB();
}
// last error could be database error too
if ($db && $db->ErrorMsg()) {
return $db->ErrorMsg();
}
}
return $this->_lasterr;
} | php | function ErrorMsg()
{
if (!function_exists('adodb_throw')) {
if ($this->_dbat < 0) {
$db = false;
}
else {
$db = $this->DB();
}
// last error could be database error too
if ($db && $db->ErrorMsg()) {
return $db->ErrorMsg();
}
}
return $this->_lasterr;
} | [
"function",
"ErrorMsg",
"(",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'adodb_throw'",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_dbat",
"<",
"0",
")",
"{",
"$",
"db",
"=",
"false",
";",
"}",
"else",
"{",
"$",
"db",
"=",
"$",
"this... | return last error message | [
"return",
"last",
"error",
"message"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-active-recordx.inc.php#L606-L622 |
213,184 | moodle/moodle | lib/adodb/adodb-active-recordx.inc.php | ADODB_Active_Record.DB | function DB()
{
global $_ADODB_ACTIVE_DBS;
if ($this->_dbat < 0) {
$false = false;
$this->Error("No database connection set: use ADOdb_Active_Record::SetDatabaseAdaptor(\$db)", "DB");
return $false;
}
$activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
$db = $activedb->db;
return $db;
} | php | function DB()
{
global $_ADODB_ACTIVE_DBS;
if ($this->_dbat < 0) {
$false = false;
$this->Error("No database connection set: use ADOdb_Active_Record::SetDatabaseAdaptor(\$db)", "DB");
return $false;
}
$activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
$db = $activedb->db;
return $db;
} | [
"function",
"DB",
"(",
")",
"{",
"global",
"$",
"_ADODB_ACTIVE_DBS",
";",
"if",
"(",
"$",
"this",
"->",
"_dbat",
"<",
"0",
")",
"{",
"$",
"false",
"=",
"false",
";",
"$",
"this",
"->",
"Error",
"(",
"\"No database connection set: use ADOdb_Active_Record::Set... | retrieve ADOConnection from _ADODB_Active_DBs | [
"retrieve",
"ADOConnection",
"from",
"_ADODB_Active_DBs"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-active-recordx.inc.php#L636-L648 |
213,185 | moodle/moodle | lib/adodb/adodb-active-recordx.inc.php | ADODB_Active_Record.LastInsertID | function LastInsertID(&$db,$fieldname)
{
if ($db->hasInsertID) {
$val = $db->Insert_ID($this->_table,$fieldname);
}
else {
$val = false;
}
if (is_null($val) || $val === false) {
// this might not work reliably in multi-user environment
return $db->GetOne("select max(".$fieldname.") from ".$this-... | php | function LastInsertID(&$db,$fieldname)
{
if ($db->hasInsertID) {
$val = $db->Insert_ID($this->_table,$fieldname);
}
else {
$val = false;
}
if (is_null($val) || $val === false) {
// this might not work reliably in multi-user environment
return $db->GetOne("select max(".$fieldname.") from ".$this-... | [
"function",
"LastInsertID",
"(",
"&",
"$",
"db",
",",
"$",
"fieldname",
")",
"{",
"if",
"(",
"$",
"db",
"->",
"hasInsertID",
")",
"{",
"$",
"val",
"=",
"$",
"db",
"->",
"Insert_ID",
"(",
"$",
"this",
"->",
"_table",
",",
"$",
"fieldname",
")",
";... | get last inserted id for INSERT | [
"get",
"last",
"inserted",
"id",
"for",
"INSERT"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-active-recordx.inc.php#L753-L767 |
213,186 | moodle/moodle | analytics/classes/calculable.php | calculable.get_time_range_weeks_number | protected function get_time_range_weeks_number($starttime, $endtime) {
if ($endtime <= $starttime) {
throw new \coding_exception('End time timestamp should be greater than start time.');
}
$starttimedt = new \DateTime();
$starttimedt->setTimestamp($starttime);
$start... | php | protected function get_time_range_weeks_number($starttime, $endtime) {
if ($endtime <= $starttime) {
throw new \coding_exception('End time timestamp should be greater than start time.');
}
$starttimedt = new \DateTime();
$starttimedt->setTimestamp($starttime);
$start... | [
"protected",
"function",
"get_time_range_weeks_number",
"(",
"$",
"starttime",
",",
"$",
"endtime",
")",
"{",
"if",
"(",
"$",
"endtime",
"<=",
"$",
"starttime",
")",
"{",
"throw",
"new",
"\\",
"coding_exception",
"(",
"'End time timestamp should be greater than star... | Returns the number of weeks a time range contains.
Useful for calculations that depend on the time range duration. Note that it returns
a float, rounding the float may lead to inaccurate results.
@param int $starttime
@param int $endtime
@return float | [
"Returns",
"the",
"number",
"of",
"weeks",
"a",
"time",
"range",
"contains",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/calculable.php#L156-L170 |
213,187 | moodle/moodle | analytics/classes/calculable.php | calculable.classify_value | protected function classify_value($value, $ranges) {
// To automatically return calculated values from min to max values.
$rangeweight = (static::get_max_value() - static::get_min_value()) / (count($ranges) - 1);
foreach ($ranges as $key => $range) {
$match = false;
i... | php | protected function classify_value($value, $ranges) {
// To automatically return calculated values from min to max values.
$rangeweight = (static::get_max_value() - static::get_min_value()) / (count($ranges) - 1);
foreach ($ranges as $key => $range) {
$match = false;
i... | [
"protected",
"function",
"classify_value",
"(",
"$",
"value",
",",
"$",
"ranges",
")",
"{",
"// To automatically return calculated values from min to max values.",
"$",
"rangeweight",
"=",
"(",
"static",
"::",
"get_max_value",
"(",
")",
"-",
"static",
"::",
"get_min_v... | Classifies the provided value into the provided range according to the ranges predicates.
Use:
- eq as 'equal'
- ne as 'not equal'
- lt as 'lower than'
- le as 'lower or equal than'
- gt as 'greater than'
- ge as 'greater or equal than'
@throws \coding_exception
@param int|float $value
@param array $ranges e.g. [ ['l... | [
"Classifies",
"the",
"provided",
"value",
"into",
"the",
"provided",
"range",
"according",
"to",
"the",
"ranges",
"predicates",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/calculable.php#L198-L257 |
213,188 | moodle/moodle | analytics/classes/calculable.php | calculable.array_merge_recursive_keep_keys | private function array_merge_recursive_keep_keys() {
$arrays = func_get_args();
$base = array_shift($arrays);
foreach ($arrays as $array) {
reset($base);
foreach ($array as $key => $value) {
if (is_array($value) && !empty($base[$key]) && is_array($base[$k... | php | private function array_merge_recursive_keep_keys() {
$arrays = func_get_args();
$base = array_shift($arrays);
foreach ($arrays as $array) {
reset($base);
foreach ($array as $key => $value) {
if (is_array($value) && !empty($base[$key]) && is_array($base[$k... | [
"private",
"function",
"array_merge_recursive_keep_keys",
"(",
")",
"{",
"$",
"arrays",
"=",
"func_get_args",
"(",
")",
";",
"$",
"base",
"=",
"array_shift",
"(",
"$",
"arrays",
")",
";",
"foreach",
"(",
"$",
"arrays",
"as",
"$",
"array",
")",
"{",
"rese... | Merges arrays recursively keeping the same keys the original arrays have.
@link http://php.net/manual/es/function.array-merge-recursive.php#114818
@return array | [
"Merges",
"arrays",
"recursively",
"keeping",
"the",
"same",
"keys",
"the",
"original",
"arrays",
"have",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/calculable.php#L265-L284 |
213,189 | moodle/moodle | mod/data/field/file/field.class.php | data_field_file.notemptyfield | function notemptyfield($value, $name) {
global $USER;
$names = explode('_', $name);
if ($names[2] == 'file') {
$usercontext = context_user::instance($USER->id);
$fs = get_file_storage();
$files = $fs->get_area_files($usercontext->id, 'user', 'draft', $value);... | php | function notemptyfield($value, $name) {
global $USER;
$names = explode('_', $name);
if ($names[2] == 'file') {
$usercontext = context_user::instance($USER->id);
$fs = get_file_storage();
$files = $fs->get_area_files($usercontext->id, 'user', 'draft', $value);... | [
"function",
"notemptyfield",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"names",
"=",
"explode",
"(",
"'_'",
",",
"$",
"name",
")",
";",
"if",
"(",
"$",
"names",
"[",
"2",
"]",
"==",
"'file'",
")",
"{",
"$",... | Custom notempty function
@param string $value
@param string $name
@return bool | [
"Custom",
"notempty",
"function"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/field/file/field.class.php#L197-L208 |
213,190 | moodle/moodle | admin/tool/log/store/legacy/classes/privacy/provider.php | provider.delete_data_for_userlist | public static function delete_data_for_userlist(\core_privacy\local\request\approved_userlist $userlist) {
global $DB;
list($sql, $params) = static::get_sql_where_from_contexts([$userlist->get_context()]);
if (empty($sql)) {
return;
}
list($usersql, $userparams) = $DB... | php | public static function delete_data_for_userlist(\core_privacy\local\request\approved_userlist $userlist) {
global $DB;
list($sql, $params) = static::get_sql_where_from_contexts([$userlist->get_context()]);
if (empty($sql)) {
return;
}
list($usersql, $userparams) = $DB... | [
"public",
"static",
"function",
"delete_data_for_userlist",
"(",
"\\",
"core_privacy",
"\\",
"local",
"\\",
"request",
"\\",
"approved_userlist",
"$",
"userlist",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"sql",
",",
"$",
"params",
")",
"=",
"s... | Delete all data for a list of users in the specified context.
@param \core_privacy\local\request\approved_userlist $userlist The specific context and users to delete data for.
@return void | [
"Delete",
"all",
"data",
"for",
"a",
"list",
"of",
"users",
"in",
"the",
"specified",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/store/legacy/classes/privacy/provider.php#L195-L204 |
213,191 | moodle/moodle | admin/tool/log/store/legacy/classes/privacy/provider.php | provider.get_sql_where_from_contexts | protected static function get_sql_where_from_contexts(array $contexts) {
global $DB;
$sorted = array_reduce($contexts, function ($carry, $context) {
$level = $context->contextlevel;
if ($level == CONTEXT_MODULE || $level == CONTEXT_COURSE) {
$carry[$level][] = $c... | php | protected static function get_sql_where_from_contexts(array $contexts) {
global $DB;
$sorted = array_reduce($contexts, function ($carry, $context) {
$level = $context->contextlevel;
if ($level == CONTEXT_MODULE || $level == CONTEXT_COURSE) {
$carry[$level][] = $c... | [
"protected",
"static",
"function",
"get_sql_where_from_contexts",
"(",
"array",
"$",
"contexts",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sorted",
"=",
"array_reduce",
"(",
"$",
"contexts",
",",
"function",
"(",
"$",
"carry",
",",
"$",
"context",
")",
"{"... | Get an SQL where statement from a list of contexts.
@param array $contexts The contexts.
@return array [$sql, $params] | [
"Get",
"an",
"SQL",
"where",
"statement",
"from",
"a",
"list",
"of",
"contexts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/store/legacy/classes/privacy/provider.php#L212-L254 |
213,192 | moodle/moodle | admin/tool/xmldb/actions/view_xml/view_xml.class.php | view_xml.init | function init() {
parent::init();
// Set own core attributes
$this->can_subaction = ACTION_NONE;
//$this->can_subaction = ACTION_HAVE_SUBACTIONS;
// Set own custom attributes
$this->sesskey_protected = false; // This action doesn't need sesskey protection
// Get... | php | function init() {
parent::init();
// Set own core attributes
$this->can_subaction = ACTION_NONE;
//$this->can_subaction = ACTION_HAVE_SUBACTIONS;
// Set own custom attributes
$this->sesskey_protected = false; // This action doesn't need sesskey protection
// Get... | [
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"// Set own core attributes",
"$",
"this",
"->",
"can_subaction",
"=",
"ACTION_NONE",
";",
"//$this->can_subaction = ACTION_HAVE_SUBACTIONS;",
"// Set own custom attributes",
"$",
"this",
"->",
... | Init method, every subclass will have its own | [
"Init",
"method",
"every",
"subclass",
"will",
"have",
"its",
"own"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/xmldb/actions/view_xml/view_xml.class.php#L35-L48 |
213,193 | moodle/moodle | report/loglive/classes/renderer.php | report_loglive_renderer.render_report_loglive | protected function render_report_loglive(report_loglive_renderable $reportloglive) {
if (empty($reportloglive->selectedlogreader)) {
return $this->output->notification(get_string('nologreaderenabled', 'report_loglive'), 'notifyproblem');
}
$table = $reportloglive->get_table();
... | php | protected function render_report_loglive(report_loglive_renderable $reportloglive) {
if (empty($reportloglive->selectedlogreader)) {
return $this->output->notification(get_string('nologreaderenabled', 'report_loglive'), 'notifyproblem');
}
$table = $reportloglive->get_table();
... | [
"protected",
"function",
"render_report_loglive",
"(",
"report_loglive_renderable",
"$",
"reportloglive",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"reportloglive",
"->",
"selectedlogreader",
")",
")",
"{",
"return",
"$",
"this",
"->",
"output",
"->",
"notification"... | Return html to render the loglive page..
@param report_loglive_renderable $reportloglive object of report_log.
@return string html used to render the page; | [
"Return",
"html",
"to",
"render",
"the",
"loglive",
"page",
".."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/loglive/classes/renderer.php#L56-L63 |
213,194 | moodle/moodle | lib/minify/matthiasmullie-minify/src/CSS.php | CSS.moveImportsToTop | protected function moveImportsToTop($content)
{
if (preg_match_all('/@import[^;]+;/', $content, $matches)) {
// remove from content
foreach ($matches[0] as $import) {
$content = str_replace($import, '', $content);
}
// add to top
$... | php | protected function moveImportsToTop($content)
{
if (preg_match_all('/@import[^;]+;/', $content, $matches)) {
// remove from content
foreach ($matches[0] as $import) {
$content = str_replace($import, '', $content);
}
// add to top
$... | [
"protected",
"function",
"moveImportsToTop",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"preg_match_all",
"(",
"'/@import[^;]+;/'",
",",
"$",
"content",
",",
"$",
"matches",
")",
")",
"{",
"// remove from content",
"foreach",
"(",
"$",
"matches",
"[",
"0",
"]... | Move any import statements to the top.
@param string $content Nearly finished CSS content
@return string | [
"Move",
"any",
"import",
"statements",
"to",
"the",
"top",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/minify/matthiasmullie-minify/src/CSS.php#L77-L90 |
213,195 | moodle/moodle | lib/minify/matthiasmullie-minify/src/CSS.php | CSS.combineImports | protected function combineImports($source, $content, $parents)
{
$importRegexes = array(
// @import url(xxx)
'/
# import statement
@import
# whitespace
\s+
# open url()
url\(
# (opt... | php | protected function combineImports($source, $content, $parents)
{
$importRegexes = array(
// @import url(xxx)
'/
# import statement
@import
# whitespace
\s+
# open url()
url\(
# (opt... | [
"protected",
"function",
"combineImports",
"(",
"$",
"source",
",",
"$",
"content",
",",
"$",
"parents",
")",
"{",
"$",
"importRegexes",
"=",
"array",
"(",
"// @import url(xxx)",
"'/\n # import statement\n @import\n\n # whitespace\n ... | Combine CSS from import statements.
@import's will be loaded and their content merged into the original file,
to save HTTP requests.
@param string $source The file to combine imports for
@param string $content The CSS content to combine imports for
@param string[] $parents Parent paths, for circular reference ch... | [
"Combine",
"CSS",
"from",
"import",
"statements",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/minify/matthiasmullie-minify/src/CSS.php#L106-L224 |
213,196 | moodle/moodle | lib/minify/matthiasmullie-minify/src/CSS.php | CSS.importFiles | protected function importFiles($source, $content)
{
$regex = '/url\((["\']?)(.+?)\\1\)/i';
if ($this->importExtensions && preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) {
$search = array();
$replace = array();
// loop the matches
foreach ... | php | protected function importFiles($source, $content)
{
$regex = '/url\((["\']?)(.+?)\\1\)/i';
if ($this->importExtensions && preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) {
$search = array();
$replace = array();
// loop the matches
foreach ... | [
"protected",
"function",
"importFiles",
"(",
"$",
"source",
",",
"$",
"content",
")",
"{",
"$",
"regex",
"=",
"'/url\\(([\"\\']?)(.+?)\\\\1\\)/i'",
";",
"if",
"(",
"$",
"this",
"->",
"importExtensions",
"&&",
"preg_match_all",
"(",
"$",
"regex",
",",
"$",
"c... | Import files into the CSS, base64-ized.
@url(image.jpg) images will be loaded and their content merged into the
original file, to save HTTP requests.
@param string $source The file to import files for
@param string $content The CSS content to import files for
@return string | [
"Import",
"files",
"into",
"the",
"CSS",
"base64",
"-",
"ized",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/minify/matthiasmullie-minify/src/CSS.php#L237-L273 |
213,197 | moodle/moodle | lib/minify/matthiasmullie-minify/src/CSS.php | CSS.execute | public function execute($path = null, $parents = array())
{
$content = '';
// loop CSS data (raw data and files)
foreach ($this->data as $source => $css) {
/*
* Let's first take out strings & comments, since we can't just
* remove whitespace anywhere. I... | php | public function execute($path = null, $parents = array())
{
$content = '';
// loop CSS data (raw data and files)
foreach ($this->data as $source => $css) {
/*
* Let's first take out strings & comments, since we can't just
* remove whitespace anywhere. I... | [
"public",
"function",
"execute",
"(",
"$",
"path",
"=",
"null",
",",
"$",
"parents",
"=",
"array",
"(",
")",
")",
"{",
"$",
"content",
"=",
"''",
";",
"// loop CSS data (raw data and files)",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"source"... | Minify the data.
Perform CSS optimizations.
@param string[optional] $path Path to write the data to
@param string[] $parents Parent paths, for circular reference checks
@return string The minified data | [
"Minify",
"the",
"data",
".",
"Perform",
"CSS",
"optimizations",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/minify/matthiasmullie-minify/src/CSS.php#L284-L331 |
213,198 | moodle/moodle | lib/minify/matthiasmullie-minify/src/CSS.php | CSS.shortenFontWeights | protected function shortenFontWeights($content)
{
$weights = array(
'normal' => 400,
'bold' => 700,
);
$callback = function ($match) use ($weights) {
return $match[1].$weights[$match[2]];
};
return preg_replace_callback('/(font-weight\s*:... | php | protected function shortenFontWeights($content)
{
$weights = array(
'normal' => 400,
'bold' => 700,
);
$callback = function ($match) use ($weights) {
return $match[1].$weights[$match[2]];
};
return preg_replace_callback('/(font-weight\s*:... | [
"protected",
"function",
"shortenFontWeights",
"(",
"$",
"content",
")",
"{",
"$",
"weights",
"=",
"array",
"(",
"'normal'",
"=>",
"400",
",",
"'bold'",
"=>",
"700",
",",
")",
";",
"$",
"callback",
"=",
"function",
"(",
"$",
"match",
")",
"use",
"(",
... | Shorten CSS font weights.
@param string $content The CSS content to shorten the font weights for
@return string | [
"Shorten",
"CSS",
"font",
"weights",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/minify/matthiasmullie-minify/src/CSS.php#L523-L535 |
213,199 | moodle/moodle | mod/wiki/parser/markups/creole.php | creole_parser.escape_token_string | private function escape_token_string(&$text, $token) {
$text = str_replace("~".$token, $this->protect($token), $text);
} | php | private function escape_token_string(&$text, $token) {
$text = str_replace("~".$token, $this->protect($token), $text);
} | [
"private",
"function",
"escape_token_string",
"(",
"&",
"$",
"text",
",",
"$",
"token",
")",
"{",
"$",
"text",
"=",
"str_replace",
"(",
"\"~\"",
".",
"$",
"token",
",",
"$",
"this",
"->",
"protect",
"(",
"$",
"token",
")",
",",
"$",
"text",
")",
";... | Escape token when it is "negated" | [
"Escape",
"token",
"when",
"it",
"is",
"negated"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/parser/markups/creole.php#L168-L170 |
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.