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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
217,600 | moodle/moodle | lib/behat/behat_field_manager.php | behat_field_manager.get_field_instance | public static function get_field_instance($type, NodeElement $fieldnode, Session $session) {
global $CFG;
// If the field is not part of a moodleform, we should still try to find out
// which field type are we dealing with.
if ($type == 'field' &&
$guessedtype = self::g... | php | public static function get_field_instance($type, NodeElement $fieldnode, Session $session) {
global $CFG;
// If the field is not part of a moodleform, we should still try to find out
// which field type are we dealing with.
if ($type == 'field' &&
$guessedtype = self::g... | [
"public",
"static",
"function",
"get_field_instance",
"(",
"$",
"type",
",",
"NodeElement",
"$",
"fieldnode",
",",
"Session",
"$",
"session",
")",
"{",
"global",
"$",
"CFG",
";",
"// If the field is not part of a moodleform, we should still try to find out",
"// which fie... | Returns the appropiate behat_form_field according to the provided type.
It defaults to behat_form_field.
@param string $type The field type (checkbox, date_selector, text...)
@param NodeElement $fieldnode
@param Session $session The behat session
@return behat_form_field | [
"Returns",
"the",
"appropiate",
"behat_form_field",
"according",
"to",
"the",
"provided",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_field_manager.php#L104-L127 |
217,601 | moodle/moodle | lib/behat/behat_field_manager.php | behat_field_manager.guess_field_type | public static function guess_field_type(NodeElement $fieldnode, Session $session) {
// Textareas are considered text based elements.
$tagname = strtolower($fieldnode->getTagName());
if ($tagname == 'textarea') {
// If there is an iframe with $id + _ifr there a TinyMCE editor loaded... | php | public static function guess_field_type(NodeElement $fieldnode, Session $session) {
// Textareas are considered text based elements.
$tagname = strtolower($fieldnode->getTagName());
if ($tagname == 'textarea') {
// If there is an iframe with $id + _ifr there a TinyMCE editor loaded... | [
"public",
"static",
"function",
"guess_field_type",
"(",
"NodeElement",
"$",
"fieldnode",
",",
"Session",
"$",
"session",
")",
"{",
"// Textareas are considered text based elements.",
"$",
"tagname",
"=",
"strtolower",
"(",
"$",
"fieldnode",
"->",
"getTagName",
"(",
... | Guesses a basic field type and returns it.
This method is intended to detect HTML form fields when no
moodleform-specific elements have been detected.
@param NodeElement $fieldnode
@param Session $session
@return string|bool The field type or false. | [
"Guesses",
"a",
"basic",
"field",
"type",
"and",
"returns",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_field_manager.php#L139-L179 |
217,602 | moodle/moodle | notes/edit_form.php | note_edit_form.definition | public function definition() {
$mform =& $this->_form;
$mform->addElement('header', 'general', get_string('note', 'notes'));
$mform->addElement('textarea', 'content', get_string('content', 'notes'), array('rows' => 15, 'cols' => 40));
$mform->setType('content', PARAM_RAW);
$mfor... | php | public function definition() {
$mform =& $this->_form;
$mform->addElement('header', 'general', get_string('note', 'notes'));
$mform->addElement('textarea', 'content', get_string('content', 'notes'), array('rows' => 15, 'cols' => 40));
$mform->setType('content', PARAM_RAW);
$mfor... | [
"public",
"function",
"definition",
"(",
")",
"{",
"$",
"mform",
"=",
"&",
"$",
"this",
"->",
"_form",
";",
"$",
"mform",
"->",
"addElement",
"(",
"'header'",
",",
"'general'",
",",
"get_string",
"(",
"'note'",
",",
"'notes'",
")",
")",
";",
"$",
"mf... | Define the form for editing notes | [
"Define",
"the",
"form",
"for",
"editing",
"notes"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/notes/edit_form.php#L28-L52 |
217,603 | moodle/moodle | tag/classes/tag.php | core_tag_tag.make_display_name | public static function make_display_name($tag, $ashtml = true) {
global $CFG;
if (empty($CFG->keeptagnamecase)) {
// This is the normalized tag name.
$tagname = core_text::strtotitle($tag->name);
} else {
// Original casing of the tag name.
$tagna... | php | public static function make_display_name($tag, $ashtml = true) {
global $CFG;
if (empty($CFG->keeptagnamecase)) {
// This is the normalized tag name.
$tagname = core_text::strtotitle($tag->name);
} else {
// Original casing of the tag name.
$tagna... | [
"public",
"static",
"function",
"make_display_name",
"(",
"$",
"tag",
",",
"$",
"ashtml",
"=",
"true",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"keeptagnamecase",
")",
")",
"{",
"// This is the normalized tag name.",
... | Prepares tag name ready to be displayed
@param stdClass|core_tag_tag $tag record from db table tag, must contain properties name and rawname
@param bool $ashtml (default true) if true will return htmlspecialchars encoded string
@return string | [
"Prepares",
"tag",
"name",
"ready",
"to",
"be",
"displayed"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L135-L150 |
217,604 | moodle/moodle | tag/classes/tag.php | core_tag_tag.get | public static function get($id, $returnfields = 'id, name, rawname, tagcollid', $strictness = IGNORE_MISSING) {
global $DB;
$record = $DB->get_record('tag', array('id' => $id), $returnfields, $strictness);
if ($record) {
return new static($record);
}
return false;
... | php | public static function get($id, $returnfields = 'id, name, rawname, tagcollid', $strictness = IGNORE_MISSING) {
global $DB;
$record = $DB->get_record('tag', array('id' => $id), $returnfields, $strictness);
if ($record) {
return new static($record);
}
return false;
... | [
"public",
"static",
"function",
"get",
"(",
"$",
"id",
",",
"$",
"returnfields",
"=",
"'id, name, rawname, tagcollid'",
",",
"$",
"strictness",
"=",
"IGNORE_MISSING",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"record",
"=",
"$",
"DB",
"->",
"get_record",
"(... | Simple function to just return a single tag object by its id
@param int $id
@param string $returnfields which fields do we want returned from table {tag}.
Default value is 'id,name,rawname,tagcollid',
specify '*' to include all fields.
@param int $strictness IGNORE_MISSING means compatible mode, false returne... | [
"Simple",
"function",
"to",
"just",
"return",
"a",
"single",
"tag",
"object",
"by",
"its",
"id"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L202-L209 |
217,605 | moodle/moodle | tag/classes/tag.php | core_tag_tag.get_bulk | public static function get_bulk($ids, $returnfields = 'id, name, rawname, tagcollid') {
global $DB;
$result = array();
if (empty($ids)) {
return $result;
}
list($sql, $params) = $DB->get_in_or_equal($ids);
$records = $DB->get_records_select('tag', 'id '.$sql, ... | php | public static function get_bulk($ids, $returnfields = 'id, name, rawname, tagcollid') {
global $DB;
$result = array();
if (empty($ids)) {
return $result;
}
list($sql, $params) = $DB->get_in_or_equal($ids);
$records = $DB->get_records_select('tag', 'id '.$sql, ... | [
"public",
"static",
"function",
"get_bulk",
"(",
"$",
"ids",
",",
"$",
"returnfields",
"=",
"'id, name, rawname, tagcollid'",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"ids",
")",
")",... | Simple function to just return an array of tag objects by their ids
@param int[] $ids
@param string $returnfields which fields do we want returned from table {tag}.
Default value is 'id,name,rawname,tagcollid',
specify '*' to include all fields.
@return core_tag_tag[] array of retrieved tags | [
"Simple",
"function",
"to",
"just",
"return",
"an",
"array",
"of",
"tag",
"objects",
"by",
"their",
"ids"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L220-L232 |
217,606 | moodle/moodle | tag/classes/tag.php | core_tag_tag.get_by_name | public static function get_by_name($tagcollid, $name, $returnfields='id, name, rawname, tagcollid',
$strictness = IGNORE_MISSING) {
global $DB;
if ($tagcollid == 0) {
$tags = static::guess_by_name($name, $returnfields);
if ($tags) {
$tag = ... | php | public static function get_by_name($tagcollid, $name, $returnfields='id, name, rawname, tagcollid',
$strictness = IGNORE_MISSING) {
global $DB;
if ($tagcollid == 0) {
$tags = static::guess_by_name($name, $returnfields);
if ($tags) {
$tag = ... | [
"public",
"static",
"function",
"get_by_name",
"(",
"$",
"tagcollid",
",",
"$",
"name",
",",
"$",
"returnfields",
"=",
"'id, name, rawname, tagcollid'",
",",
"$",
"strictness",
"=",
"IGNORE_MISSING",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"tagco... | Simple function to just return a single tag object by tagcollid and name
@param int $tagcollid tag collection to use,
if 0 is given we will try to guess the tag collection and return the first match
@param string $name tag name
@param string $returnfields which fields do we want returned. This is a comma separated str... | [
"Simple",
"function",
"to",
"just",
"return",
"a",
"single",
"tag",
"object",
"by",
"tagcollid",
"and",
"name"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L247-L267 |
217,607 | moodle/moodle | tag/classes/tag.php | core_tag_tag.guess_by_name | public static function guess_by_name($name, $returnfields='id, name, rawname, tagcollid') {
global $DB;
if (empty($name)) {
return array();
}
$tagcolls = core_tag_collection::get_collections();
list($sql, $params) = $DB->get_in_or_equal(array_keys($tagcolls), SQL_PARA... | php | public static function guess_by_name($name, $returnfields='id, name, rawname, tagcollid') {
global $DB;
if (empty($name)) {
return array();
}
$tagcolls = core_tag_collection::get_collections();
list($sql, $params) = $DB->get_in_or_equal(array_keys($tagcolls), SQL_PARA... | [
"public",
"static",
"function",
"guess_by_name",
"(",
"$",
"name",
",",
"$",
"returnfields",
"=",
"'id, name, rawname, tagcollid'",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"return",
"array",
"(",
")",
";",... | Looking in all tag collections for the tag with the given name
@param string $name tag name
@param string $returnfields
@return array array of core_tag_tag instances | [
"Looking",
"in",
"all",
"tag",
"collections",
"for",
"the",
"tag",
"with",
"the",
"given",
"name"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L276-L297 |
217,608 | moodle/moodle | tag/classes/tag.php | core_tag_tag.get_by_name_bulk | public static function get_by_name_bulk($tagcollid, $tags, $returnfields = 'id, name, rawname, tagcollid') {
global $DB;
if (empty($tags)) {
return array();
}
$cleantags = self::normalize(self::normalize($tags, false)); // Format: rawname => normalised name.
list($... | php | public static function get_by_name_bulk($tagcollid, $tags, $returnfields = 'id, name, rawname, tagcollid') {
global $DB;
if (empty($tags)) {
return array();
}
$cleantags = self::normalize(self::normalize($tags, false)); // Format: rawname => normalised name.
list($... | [
"public",
"static",
"function",
"get_by_name_bulk",
"(",
"$",
"tagcollid",
",",
"$",
"tags",
",",
"$",
"returnfields",
"=",
"'id, name, rawname, tagcollid'",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"tags",
")",
")",
"{",
"return",... | Returns the list of tag objects by tag collection id and the list of tag names
@param int $tagcollid
@param array $tags array of tags to look for
@param string $returnfields list of DB fields to return, must contain 'id', 'name' and 'rawname'
@return array tag-indexed array of objects. No value for a key ... | [
"Returns",
"the",
"list",
"of",
"tag",
"objects",
"by",
"tag",
"collection",
"id",
"and",
"the",
"list",
"of",
"tag",
"names"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L307-L327 |
217,609 | moodle/moodle | tag/classes/tag.php | core_tag_tag.normalize | public static function normalize($rawtags, $tolowercase = true) {
$result = array();
foreach ($rawtags as $rawtag) {
$rawtag = trim($rawtag);
if (strval($rawtag) !== '') {
$clean = clean_param($rawtag, PARAM_TAG);
if ($tolowercase) {
... | php | public static function normalize($rawtags, $tolowercase = true) {
$result = array();
foreach ($rawtags as $rawtag) {
$rawtag = trim($rawtag);
if (strval($rawtag) !== '') {
$clean = clean_param($rawtag, PARAM_TAG);
if ($tolowercase) {
... | [
"public",
"static",
"function",
"normalize",
"(",
"$",
"rawtags",
",",
"$",
"tolowercase",
"=",
"true",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"rawtags",
"as",
"$",
"rawtag",
")",
"{",
"$",
"rawtag",
"=",
"trim",
... | Function that normalizes a list of tag names.
@param array $rawtags array of tags
@param bool $tolowercase convert to lower case?
@return array lowercased normalized tags, indexed by the normalized tag, in the same order as the original array.
(Eg: 'Banana' => 'banana'). | [
"Function",
"that",
"normalizes",
"a",
"list",
"of",
"tag",
"names",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L338-L352 |
217,610 | moodle/moodle | tag/classes/tag.php | core_tag_tag.make_url | public static function make_url($tagcollid, $name, $exclusivemode = 0, $fromctx = 0, $ctx = 0, $rec = 1) {
$coll = core_tag_collection::get_by_id($tagcollid);
if (!empty($coll->customurl)) {
$url = '/' . ltrim(trim($coll->customurl), '/');
} else {
$url = '/tag/index.php'... | php | public static function make_url($tagcollid, $name, $exclusivemode = 0, $fromctx = 0, $ctx = 0, $rec = 1) {
$coll = core_tag_collection::get_by_id($tagcollid);
if (!empty($coll->customurl)) {
$url = '/' . ltrim(trim($coll->customurl), '/');
} else {
$url = '/tag/index.php'... | [
"public",
"static",
"function",
"make_url",
"(",
"$",
"tagcollid",
",",
"$",
"name",
",",
"$",
"exclusivemode",
"=",
"0",
",",
"$",
"fromctx",
"=",
"0",
",",
"$",
"ctx",
"=",
"0",
",",
"$",
"rec",
"=",
"1",
")",
"{",
"$",
"coll",
"=",
"core_tag_c... | Creates a URL to view a tag
@param int $tagcollid
@param string $name
@param int $exclusivemode
@param int $fromctx context id where this tag cloud is displayed
@param int $ctx context id for tag view link
@param int $rec recursive argument for tag view link
@return \moodle_url | [
"Creates",
"a",
"URL",
"to",
"view",
"a",
"tag"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L388-L409 |
217,611 | moodle/moodle | tag/classes/tag.php | core_tag_tag.get_view_url | public function get_view_url($exclusivemode = 0, $fromctx = 0, $ctx = 0, $rec = 1) {
return static::make_url($this->record->tagcollid, $this->record->rawname,
$exclusivemode, $fromctx, $ctx, $rec);
} | php | public function get_view_url($exclusivemode = 0, $fromctx = 0, $ctx = 0, $rec = 1) {
return static::make_url($this->record->tagcollid, $this->record->rawname,
$exclusivemode, $fromctx, $ctx, $rec);
} | [
"public",
"function",
"get_view_url",
"(",
"$",
"exclusivemode",
"=",
"0",
",",
"$",
"fromctx",
"=",
"0",
",",
"$",
"ctx",
"=",
"0",
",",
"$",
"rec",
"=",
"1",
")",
"{",
"return",
"static",
"::",
"make_url",
"(",
"$",
"this",
"->",
"record",
"->",
... | Returns URL to view the tag
@param int $exclusivemode
@param int $fromctx context id where this tag cloud is displayed
@param int $ctx context id for tag view link
@param int $rec recursive argument for tag view link
@return \moodle_url | [
"Returns",
"URL",
"to",
"view",
"the",
"tag"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L420-L423 |
217,612 | moodle/moodle | tag/classes/tag.php | core_tag_tag.ensure_fields_exist | protected function ensure_fields_exist($list, $caller) {
global $DB;
$missing = array_diff($list, array_keys((array)$this->record));
if ($missing) {
debugging('core_tag_tag::' . $caller . '() must be called on fully retrieved tag object. Missing fields: '.
join(',... | php | protected function ensure_fields_exist($list, $caller) {
global $DB;
$missing = array_diff($list, array_keys((array)$this->record));
if ($missing) {
debugging('core_tag_tag::' . $caller . '() must be called on fully retrieved tag object. Missing fields: '.
join(',... | [
"protected",
"function",
"ensure_fields_exist",
"(",
"$",
"list",
",",
"$",
"caller",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"missing",
"=",
"array_diff",
"(",
"$",
"list",
",",
"array_keys",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"record",
")",
... | Validates that the required fields were retrieved and retrieves them if missing
@param array $list array of the fields that need to be validated
@param string $caller name of the function that requested it, for the debugging message | [
"Validates",
"that",
"the",
"required",
"fields",
"were",
"retrieved",
"and",
"retrieves",
"them",
"if",
"missing"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L431-L439 |
217,613 | moodle/moodle | tag/classes/tag.php | core_tag_tag.delete_instance_as_record | protected function delete_instance_as_record($taginstance, $fullobject = false) {
global $DB;
$this->ensure_fields_exist(array('name', 'rawname', 'isstandard'), 'delete_instance_as_record');
$DB->delete_records('tag_instance', array('id' => $taginstance->id));
// We can not fire an ev... | php | protected function delete_instance_as_record($taginstance, $fullobject = false) {
global $DB;
$this->ensure_fields_exist(array('name', 'rawname', 'isstandard'), 'delete_instance_as_record');
$DB->delete_records('tag_instance', array('id' => $taginstance->id));
// We can not fire an ev... | [
"protected",
"function",
"delete_instance_as_record",
"(",
"$",
"taginstance",
",",
"$",
"fullobject",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"ensure_fields_exist",
"(",
"array",
"(",
"'name'",
",",
"'rawname'",
",",
"'isstandard'... | Deletes the tag instance given the record from tag_instance DB table
@param stdClass $taginstance
@param bool $fullobject whether $taginstance contains all fields from DB table tag_instance
(in this case it is safe to add a record snapshot to the event)
@return bool | [
"Deletes",
"the",
"tag",
"instance",
"given",
"the",
"record",
"from",
"tag_instance",
"DB",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L449-L473 |
217,614 | moodle/moodle | tag/classes/tag.php | core_tag_tag.delete_instance | protected function delete_instance($component, $itemtype, $itemid, $tiuserid = 0) {
global $DB;
$params = array('tagid' => $this->id,
'itemtype' => $itemtype, 'itemid' => $itemid);
if ($tiuserid) {
$params['tiuserid'] = $tiuserid;
}
if ($component) {
... | php | protected function delete_instance($component, $itemtype, $itemid, $tiuserid = 0) {
global $DB;
$params = array('tagid' => $this->id,
'itemtype' => $itemtype, 'itemid' => $itemid);
if ($tiuserid) {
$params['tiuserid'] = $tiuserid;
}
if ($component) {
... | [
"protected",
"function",
"delete_instance",
"(",
"$",
"component",
",",
"$",
"itemtype",
",",
"$",
"itemid",
",",
"$",
"tiuserid",
"=",
"0",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
"=",
"array",
"(",
"'tagid'",
"=>",
"$",
"this",
"->",
"id... | Delete one instance of a tag. If the last instance was deleted, it will also delete the tag, unless it is standard.
@param string $component component responsible for tagging. For BC it can be empty but in this case the
query will be slow because DB index will not be used.
@param string $itemtype the type of th... | [
"Delete",
"one",
"instance",
"of",
"a",
"tag",
".",
"If",
"the",
"last",
"instance",
"was",
"deleted",
"it",
"will",
"also",
"delete",
"the",
"tag",
"unless",
"it",
"is",
"standard",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L484-L500 |
217,615 | moodle/moodle | tag/classes/tag.php | core_tag_tag.delete_instances_as_record | public static function delete_instances_as_record(array $taginstances) {
global $DB;
if (empty($taginstances)) {
return;
}
$taginstanceids = array_map(function($taginstance) {
return $taginstance->id;
}, $taginstances);
// Now remove all the tag ... | php | public static function delete_instances_as_record(array $taginstances) {
global $DB;
if (empty($taginstances)) {
return;
}
$taginstanceids = array_map(function($taginstance) {
return $taginstance->id;
}, $taginstances);
// Now remove all the tag ... | [
"public",
"static",
"function",
"delete_instances_as_record",
"(",
"array",
"$",
"taginstances",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"taginstances",
")",
")",
"{",
"return",
";",
"}",
"$",
"taginstanceids",
"=",
"array_map",
"... | Bulk delete all tag instances.
@param stdClass[] $taginstances A list of tag_instance records to delete. Each
record must also contain the name and rawname
columns from the related tag record. | [
"Bulk",
"delete",
"all",
"tag",
"instances",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L509-L534 |
217,616 | moodle/moodle | tag/classes/tag.php | core_tag_tag.delete_instances_by_id | public static function delete_instances_by_id(array $taginstanceids) {
global $DB;
if (empty($taginstanceids)) {
return;
}
list($idsql, $params) = $DB->get_in_or_equal($taginstanceids);
$sql = "SELECT ti.*, t.name, t.rawname, t.isstandard
FROM {tag... | php | public static function delete_instances_by_id(array $taginstanceids) {
global $DB;
if (empty($taginstanceids)) {
return;
}
list($idsql, $params) = $DB->get_in_or_equal($taginstanceids);
$sql = "SELECT ti.*, t.name, t.rawname, t.isstandard
FROM {tag... | [
"public",
"static",
"function",
"delete_instances_by_id",
"(",
"array",
"$",
"taginstanceids",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"taginstanceids",
")",
")",
"{",
"return",
";",
"}",
"list",
"(",
"$",
"idsql",
",",
"$",
"... | Bulk delete all tag instances by tag id.
@param int[] $taginstanceids List of tag instance ids to be deleted. | [
"Bulk",
"delete",
"all",
"tag",
"instances",
"by",
"tag",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L541-L558 |
217,617 | moodle/moodle | tag/classes/tag.php | core_tag_tag.delete_instances | public static function delete_instances($component, $itemtype = null, $contextid = null) {
global $DB;
$sql = "SELECT ti.*, t.name, t.rawname, t.isstandard
FROM {tag_instance} ti
JOIN {tag} t
ON ti.tagid = t.id
WHERE ti.component ... | php | public static function delete_instances($component, $itemtype = null, $contextid = null) {
global $DB;
$sql = "SELECT ti.*, t.name, t.rawname, t.isstandard
FROM {tag_instance} ti
JOIN {tag} t
ON ti.tagid = t.id
WHERE ti.component ... | [
"public",
"static",
"function",
"delete_instances",
"(",
"$",
"component",
",",
"$",
"itemtype",
"=",
"null",
",",
"$",
"contextid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT ti.*, t.name, t.rawname, t.isstandard\n ... | Bulk delete all tag instances for a component or tag area
@param string $component
@param string $itemtype (optional)
@param int $contextid (optional) | [
"Bulk",
"delete",
"all",
"tag",
"instances",
"for",
"a",
"component",
"or",
"tag",
"area"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L567-L588 |
217,618 | moodle/moodle | tag/classes/tag.php | core_tag_tag.add_instance | protected function add_instance($component, $itemtype, $itemid, context $context, $ordering, $tiuserid = 0) {
global $DB;
$this->ensure_fields_exist(array('name', 'rawname'), 'add_instance');
$taginstance = new stdClass;
$taginstance->tagid = $this->id;
$taginstance->comp... | php | protected function add_instance($component, $itemtype, $itemid, context $context, $ordering, $tiuserid = 0) {
global $DB;
$this->ensure_fields_exist(array('name', 'rawname'), 'add_instance');
$taginstance = new stdClass;
$taginstance->tagid = $this->id;
$taginstance->comp... | [
"protected",
"function",
"add_instance",
"(",
"$",
"component",
",",
"$",
"itemtype",
",",
"$",
"itemid",
",",
"context",
"$",
"context",
",",
"$",
"ordering",
",",
"$",
"tiuserid",
"=",
"0",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"en... | Adds a tag instance
@param string $component
@param string $itemtype
@param string $itemid
@param context $context
@param int $ordering
@param int $tiuserid tag instance user id, only needed for tag areas with user tagging (such as core/course)
@return int id of tag_instance | [
"Adds",
"a",
"tag",
"instance"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L601-L622 |
217,619 | moodle/moodle | tag/classes/tag.php | core_tag_tag.update_instance_ordering | protected function update_instance_ordering($instanceid, $ordering) {
global $DB;
$data = new stdClass();
$data->id = $instanceid;
$data->ordering = $ordering;
$data->timemodified = time();
$DB->update_record('tag_instance', $data);
} | php | protected function update_instance_ordering($instanceid, $ordering) {
global $DB;
$data = new stdClass();
$data->id = $instanceid;
$data->ordering = $ordering;
$data->timemodified = time();
$DB->update_record('tag_instance', $data);
} | [
"protected",
"function",
"update_instance_ordering",
"(",
"$",
"instanceid",
",",
"$",
"ordering",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"data",
"->",
"id",
"=",
"$",
"instanceid",
";",
"$",
"data"... | Updates the ordering on tag instance
@param int $instanceid
@param int $ordering | [
"Updates",
"the",
"ordering",
"on",
"tag",
"instance"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L630-L638 |
217,620 | moodle/moodle | tag/classes/tag.php | core_tag_tag.get_items_tags | public static function get_items_tags($component, $itemtype, $itemids, $standardonly = self::BOTH_STANDARD_AND_NOT,
$tiuserid = 0) {
global $DB;
if (static::is_enabled($component, $itemtype) === false) {
// Tagging area is properly defined but not enabled - return empty array.
... | php | public static function get_items_tags($component, $itemtype, $itemids, $standardonly = self::BOTH_STANDARD_AND_NOT,
$tiuserid = 0) {
global $DB;
if (static::is_enabled($component, $itemtype) === false) {
// Tagging area is properly defined but not enabled - return empty array.
... | [
"public",
"static",
"function",
"get_items_tags",
"(",
"$",
"component",
",",
"$",
"itemtype",
",",
"$",
"itemids",
",",
"$",
"standardonly",
"=",
"self",
"::",
"BOTH_STANDARD_AND_NOT",
",",
"$",
"tiuserid",
"=",
"0",
")",
"{",
"global",
"$",
"DB",
";",
... | Get the array of core_tag_tag objects associated with a list of items.
Use {@link core_tag_tag::get_item_tags_array()} if you wish to get the same data as simple array.
@param string $component component responsible for tagging. For BC it can be empty but in this case the
query will be slow because DB index will not ... | [
"Get",
"the",
"array",
"of",
"core_tag_tag",
"objects",
"associated",
"with",
"a",
"list",
"of",
"items",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L653-L694 |
217,621 | moodle/moodle | tag/classes/tag.php | core_tag_tag.get_item_tags_array | public static function get_item_tags_array($component, $itemtype, $itemid, $standardonly = self::BOTH_STANDARD_AND_NOT,
$tiuserid = 0, $ashtml = true) {
$tags = array();
foreach (static::get_item_tags($component, $itemtype, $itemid, $standardonly, $tiuserid) as $tag) {
$tags[$tag... | php | public static function get_item_tags_array($component, $itemtype, $itemid, $standardonly = self::BOTH_STANDARD_AND_NOT,
$tiuserid = 0, $ashtml = true) {
$tags = array();
foreach (static::get_item_tags($component, $itemtype, $itemid, $standardonly, $tiuserid) as $tag) {
$tags[$tag... | [
"public",
"static",
"function",
"get_item_tags_array",
"(",
"$",
"component",
",",
"$",
"itemtype",
",",
"$",
"itemid",
",",
"$",
"standardonly",
"=",
"self",
"::",
"BOTH_STANDARD_AND_NOT",
",",
"$",
"tiuserid",
"=",
"0",
",",
"$",
"ashtml",
"=",
"true",
"... | Returns the list of display names of the tags that are associated with an item
This method is usually used to prefill the form data for the 'tags' form element
@param string $component component responsible for tagging. For BC it can be empty but in this case the
query will be slow because DB index will not be used.
... | [
"Returns",
"the",
"list",
"of",
"display",
"names",
"of",
"the",
"tags",
"that",
"are",
"associated",
"with",
"an",
"item"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L729-L736 |
217,622 | moodle/moodle | tag/classes/tag.php | core_tag_tag.remove_all_item_tags | public static function remove_all_item_tags($component, $itemtype, $itemid, $tiuserid = 0) {
$context = context_system::instance(); // Context will not be used.
static::set_item_tags($component, $itemtype, $itemid, $context, null, $tiuserid);
} | php | public static function remove_all_item_tags($component, $itemtype, $itemid, $tiuserid = 0) {
$context = context_system::instance(); // Context will not be used.
static::set_item_tags($component, $itemtype, $itemid, $context, null, $tiuserid);
} | [
"public",
"static",
"function",
"remove_all_item_tags",
"(",
"$",
"component",
",",
"$",
"itemtype",
",",
"$",
"itemid",
",",
"$",
"tiuserid",
"=",
"0",
")",
"{",
"$",
"context",
"=",
"context_system",
"::",
"instance",
"(",
")",
";",
"// Context will not be... | Removes all tags from an item.
All tags will be removed even if tagging is disabled in this area. This is
usually called when the item itself has been deleted.
@param string $component component responsible for tagging
@param string $itemtype type of the tagged item
@param int $itemid
@param int $tiuserid tag instanc... | [
"Removes",
"all",
"tags",
"from",
"an",
"item",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L857-L860 |
217,623 | moodle/moodle | tag/classes/tag.php | core_tag_tag.add_item_tag | public static function add_item_tag($component, $itemtype, $itemid, context $context, $tagname, $tiuserid = 0) {
global $DB;
if (static::is_enabled($component, $itemtype) === false) {
// Tagging area is properly defined but not enabled - do nothing.
return null;
}
... | php | public static function add_item_tag($component, $itemtype, $itemid, context $context, $tagname, $tiuserid = 0) {
global $DB;
if (static::is_enabled($component, $itemtype) === false) {
// Tagging area is properly defined but not enabled - do nothing.
return null;
}
... | [
"public",
"static",
"function",
"add_item_tag",
"(",
"$",
"component",
",",
"$",
"itemtype",
",",
"$",
"itemid",
",",
"context",
"$",
"context",
",",
"$",
"tagname",
",",
"$",
"tiuserid",
"=",
"0",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"stat... | Adds a tag to an item, without overwriting the current tags.
If the tag has already been added to the record, no changes are made.
@param string $component the component that was tagged
@param string $itemtype the type of record to tag ('post' for blogs, 'user' for users, etc.)
@param int $itemid the id of the record... | [
"Adds",
"a",
"tag",
"to",
"an",
"item",
"without",
"overwriting",
"the",
"current",
"tags",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L875-L914 |
217,624 | moodle/moodle | tag/classes/tag.php | core_tag_tag.remove_item_tag | public static function remove_item_tag($component, $itemtype, $itemid, $tagname, $tiuserid = 0) {
global $DB;
if (static::is_enabled($component, $itemtype) === false) {
// Tagging area is properly defined but not enabled - do nothing.
return array();
}
$rawname ... | php | public static function remove_item_tag($component, $itemtype, $itemid, $tagname, $tiuserid = 0) {
global $DB;
if (static::is_enabled($component, $itemtype) === false) {
// Tagging area is properly defined but not enabled - do nothing.
return array();
}
$rawname ... | [
"public",
"static",
"function",
"remove_item_tag",
"(",
"$",
"component",
",",
"$",
"itemtype",
",",
"$",
"itemid",
",",
"$",
"tagname",
",",
"$",
"tiuserid",
"=",
"0",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"static",
"::",
"is_enabled",
"(",
... | Removes the tag from an item without changing the other tags
@param string $component the component that was tagged
@param string $itemtype the type of record to tag ('post' for blogs, 'user' for users, etc.)
@param int $itemid the id of the record to tag
@param string $tagname the tag to remove
@param int $tiuserid t... | [
"Removes",
"the",
"tag",
"from",
"an",
"item",
"without",
"changing",
"the",
"other",
"tags"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L925-L959 |
217,625 | moodle/moodle | tag/classes/tag.php | core_tag_tag.move_context | public static function move_context($component, $itemtype, $oldcontext, $newcontext) {
global $DB;
if ($oldcontext instanceof context) {
$oldcontext = $oldcontext->id;
}
if ($newcontext instanceof context) {
$newcontext = $newcontext->id;
}
$DB->se... | php | public static function move_context($component, $itemtype, $oldcontext, $newcontext) {
global $DB;
if ($oldcontext instanceof context) {
$oldcontext = $oldcontext->id;
}
if ($newcontext instanceof context) {
$newcontext = $newcontext->id;
}
$DB->se... | [
"public",
"static",
"function",
"move_context",
"(",
"$",
"component",
",",
"$",
"itemtype",
",",
"$",
"oldcontext",
",",
"$",
"newcontext",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"oldcontext",
"instanceof",
"context",
")",
"{",
"$",
"oldcon... | Allows to move all tag instances from one context to another
@param string $component the component that was tagged
@param string $itemtype the type of record to tag ('post' for blogs, 'user' for users, etc.)
@param context $oldcontext
@param context $newcontext | [
"Allows",
"to",
"move",
"all",
"tag",
"instances",
"from",
"one",
"context",
"to",
"another"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L969-L979 |
217,626 | moodle/moodle | tag/classes/tag.php | core_tag_tag.change_items_context | public static function change_items_context($component, $itemtype, $itemids, $newcontext) {
global $DB;
if (empty($itemids)) {
return;
}
if (!is_array($itemids)) {
$itemids = array($itemids);
}
list($sql, $params) = $DB->get_in_or_equal($itemids, S... | php | public static function change_items_context($component, $itemtype, $itemids, $newcontext) {
global $DB;
if (empty($itemids)) {
return;
}
if (!is_array($itemids)) {
$itemids = array($itemids);
}
list($sql, $params) = $DB->get_in_or_equal($itemids, S... | [
"public",
"static",
"function",
"change_items_context",
"(",
"$",
"component",
",",
"$",
"itemtype",
",",
"$",
"itemids",
",",
"$",
"newcontext",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"itemids",
")",
")",
"{",
"return",
";",... | Moves all tags of the specified items to the new context
@param string $component the component that was tagged
@param string $itemtype the type of record to tag ('post' for blogs, 'user' for users, etc.)
@param array $itemids
@param context|int $newcontext target context to move tags to | [
"Moves",
"all",
"tags",
"of",
"the",
"specified",
"items",
"to",
"the",
"new",
"context"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L989-L1006 |
217,627 | moodle/moodle | tag/classes/tag.php | core_tag_tag.change_instances_context | public static function change_instances_context(array $taginstanceids, context $newcontext) {
global $DB;
if (empty($taginstanceids)) {
return;
}
list($sql, $params) = $DB->get_in_or_equal($taginstanceids);
$DB->set_field_select('tag_instance', 'contextid', $newcont... | php | public static function change_instances_context(array $taginstanceids, context $newcontext) {
global $DB;
if (empty($taginstanceids)) {
return;
}
list($sql, $params) = $DB->get_in_or_equal($taginstanceids);
$DB->set_field_select('tag_instance', 'contextid', $newcont... | [
"public",
"static",
"function",
"change_instances_context",
"(",
"array",
"$",
"taginstanceids",
",",
"context",
"$",
"newcontext",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"taginstanceids",
")",
")",
"{",
"return",
";",
"}",
"list... | Moves all of the specified tag instances into a new context.
@param array $taginstanceids The list of tag instance ids that should be moved
@param context $newcontext The context to move the tag instances into | [
"Moves",
"all",
"of",
"the",
"specified",
"tag",
"instances",
"into",
"a",
"new",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L1014-L1023 |
217,628 | moodle/moodle | tag/classes/tag.php | core_tag_tag.flag | public function flag() {
global $DB;
$this->ensure_fields_exist(array('name', 'userid', 'rawname', 'flag'), 'flag');
// Update all the tags to flagged.
$this->timemodified = time();
$this->flag++;
$DB->update_record('tag', array('timemodified' => $this->timemodified,
... | php | public function flag() {
global $DB;
$this->ensure_fields_exist(array('name', 'userid', 'rawname', 'flag'), 'flag');
// Update all the tags to flagged.
$this->timemodified = time();
$this->flag++;
$DB->update_record('tag', array('timemodified' => $this->timemodified,
... | [
"public",
"function",
"flag",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"ensure_fields_exist",
"(",
"array",
"(",
"'name'",
",",
"'userid'",
",",
"'rawname'",
",",
"'flag'",
")",
",",
"'flag'",
")",
";",
"// Update all the tags to flagged."... | Flag a tag as inappropriate | [
"Flag",
"a",
"tag",
"as",
"inappropriate"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L1105-L1127 |
217,629 | moodle/moodle | tag/classes/tag.php | core_tag_tag.set_related_tags | public function set_related_tags($tagnames) {
$context = context_system::instance();
$tagobjects = $tagnames ? static::create_if_missing($this->tagcollid, $tagnames) : array();
unset($tagobjects[$this->name]); // Never link to itself.
$currenttags = static::get_item_tags('core', 'tag', ... | php | public function set_related_tags($tagnames) {
$context = context_system::instance();
$tagobjects = $tagnames ? static::create_if_missing($this->tagcollid, $tagnames) : array();
unset($tagobjects[$this->name]); // Never link to itself.
$currenttags = static::get_item_tags('core', 'tag', ... | [
"public",
"function",
"set_related_tags",
"(",
"$",
"tagnames",
")",
"{",
"$",
"context",
"=",
"context_system",
"::",
"instance",
"(",
")",
";",
"$",
"tagobjects",
"=",
"$",
"tagnames",
"?",
"static",
"::",
"create_if_missing",
"(",
"$",
"this",
"->",
"ta... | Sets the list of tags related to this one.
Tag relations are recorded by two instances linking two tags to each other.
For tag relations ordering is not used and may be random.
@param array $tagnames | [
"Sets",
"the",
"list",
"of",
"tags",
"related",
"to",
"this",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L1167-L1196 |
217,630 | moodle/moodle | tag/classes/tag.php | core_tag_tag.add_related_tags | public function add_related_tags($tagnames) {
$context = context_system::instance();
$tagobjects = static::create_if_missing($this->tagcollid, $tagnames);
$currenttags = static::get_item_tags('core', 'tag', $this->id);
foreach ($tagobjects as $name => $tag) {
foreach ($curr... | php | public function add_related_tags($tagnames) {
$context = context_system::instance();
$tagobjects = static::create_if_missing($this->tagcollid, $tagnames);
$currenttags = static::get_item_tags('core', 'tag', $this->id);
foreach ($tagobjects as $name => $tag) {
foreach ($curr... | [
"public",
"function",
"add_related_tags",
"(",
"$",
"tagnames",
")",
"{",
"$",
"context",
"=",
"context_system",
"::",
"instance",
"(",
")",
";",
"$",
"tagobjects",
"=",
"static",
"::",
"create_if_missing",
"(",
"$",
"this",
"->",
"tagcollid",
",",
"$",
"t... | Adds to the list of related tags without removing existing
Tag relations are recorded by two instances linking two tags to each other.
For tag relations ordering is not used and may be random.
@param array $tagnames | [
"Adds",
"to",
"the",
"list",
"of",
"related",
"tags",
"without",
"removing",
"existing"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L1206-L1222 |
217,631 | moodle/moodle | tag/classes/tag.php | core_tag_tag.get_correlated_tags | public function get_correlated_tags($keepduplicates = false) {
global $DB;
$correlated = $DB->get_field('tag_correlation', 'correlatedtags', array('tagid' => $this->id));
if (!$correlated) {
return array();
}
$correlated = preg_split('/\s*,\s*/', trim($correlated), ... | php | public function get_correlated_tags($keepduplicates = false) {
global $DB;
$correlated = $DB->get_field('tag_correlation', 'correlatedtags', array('tagid' => $this->id));
if (!$correlated) {
return array();
}
$correlated = preg_split('/\s*,\s*/', trim($correlated), ... | [
"public",
"function",
"get_correlated_tags",
"(",
"$",
"keepduplicates",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"correlated",
"=",
"$",
"DB",
"->",
"get_field",
"(",
"'tag_correlation'",
",",
"'correlatedtags'",
",",
"array",
"(",
"'tagid'",
... | Returns the correlated tags of a tag, retrieved from the tag_correlation table.
Correlated tags are calculated in cron based on existing tag instances.
@param bool $keepduplicates if true, will return one record for each existing
tag instance which may result in duplicates of the actual tags
@return core_tag_tag[] an... | [
"Returns",
"the",
"correlated",
"tags",
"of",
"a",
"tag",
"retrieved",
"from",
"the",
"tag_correlation",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L1233-L1264 |
217,632 | moodle/moodle | tag/classes/tag.php | core_tag_tag.get_related_tags | public function get_related_tags() {
$manual = $this->get_manual_related_tags();
$automatic = $this->get_correlated_tags();
$relatedtags = array_merge($manual, $automatic);
// Remove duplicated tags (multiple instances of the same tag).
$seen = array();
foreach ($related... | php | public function get_related_tags() {
$manual = $this->get_manual_related_tags();
$automatic = $this->get_correlated_tags();
$relatedtags = array_merge($manual, $automatic);
// Remove duplicated tags (multiple instances of the same tag).
$seen = array();
foreach ($related... | [
"public",
"function",
"get_related_tags",
"(",
")",
"{",
"$",
"manual",
"=",
"$",
"this",
"->",
"get_manual_related_tags",
"(",
")",
";",
"$",
"automatic",
"=",
"$",
"this",
"->",
"get_correlated_tags",
"(",
")",
";",
"$",
"relatedtags",
"=",
"array_merge",
... | Returns tags related to a tag
Related tags of a tag come from two sources:
- manually added related tags, which are tag_instance entries for that tag
- correlated tags, which are calculated
@return core_tag_tag[] an array of tag objects | [
"Returns",
"tags",
"related",
"to",
"a",
"tag"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L1284-L1300 |
217,633 | moodle/moodle | tag/classes/tag.php | core_tag_tag.count_tagged_items | public function count_tagged_items($component, $itemtype, $subquery = '', $params = array()) {
global $DB;
if (empty($itemtype) || !$DB->get_manager()->table_exists($itemtype)) {
return 0;
}
$params = $params ? $params : array();
$query = "SELECT COUNT(it.id)
... | php | public function count_tagged_items($component, $itemtype, $subquery = '', $params = array()) {
global $DB;
if (empty($itemtype) || !$DB->get_manager()->table_exists($itemtype)) {
return 0;
}
$params = $params ? $params : array();
$query = "SELECT COUNT(it.id)
... | [
"public",
"function",
"count_tagged_items",
"(",
"$",
"component",
",",
"$",
"itemtype",
",",
"$",
"subquery",
"=",
"''",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"itemtype",
")",
... | Count how many items are tagged with a specific tag.
@param string $component component responsible for tagging. For BC it can be empty but in this case the
query will be slow because DB index will not be used.
@param string $itemtype type to restrict search to
@param string $subquery additional query ... | [
"Count",
"how",
"many",
"items",
"are",
"tagged",
"with",
"a",
"specific",
"tag",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L1349-L1371 |
217,634 | moodle/moodle | tag/classes/tag.php | core_tag_tag.is_item_tagged_with | public static function is_item_tagged_with($component, $itemtype, $itemid, $tagname) {
global $DB;
$tagcollid = core_tag_area::get_collection($component, $itemtype);
$query = 'SELECT 1 FROM {tag} t
JOIN {tag_instance} ti ON ti.tagid = t.id
WHERE t.name = ?... | php | public static function is_item_tagged_with($component, $itemtype, $itemid, $tagname) {
global $DB;
$tagcollid = core_tag_area::get_collection($component, $itemtype);
$query = 'SELECT 1 FROM {tag} t
JOIN {tag_instance} ti ON ti.tagid = t.id
WHERE t.name = ?... | [
"public",
"static",
"function",
"is_item_tagged_with",
"(",
"$",
"component",
",",
"$",
"itemtype",
",",
"$",
"itemid",
",",
"$",
"tagname",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"tagcollid",
"=",
"core_tag_area",
"::",
"get_collection",
"(",
"$",
"comp... | Determine if an item is tagged with a specific tag
Note that this is a static method and not a method of core_tag object because the tag might not exist yet,
for example user searches for "php" and we offer him to add "php" to his interests.
@param string $component component responsible for tagging. For BC it ca... | [
"Determine",
"if",
"an",
"item",
"is",
"tagged",
"with",
"a",
"specific",
"tag"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L1386-L1399 |
217,635 | moodle/moodle | tag/classes/tag.php | core_tag_tag.get_formatted_description | public function get_formatted_description($options = array()) {
$options = empty($options) ? array() : (array)$options;
$options += array('para' => false, 'overflowdiv' => true);
$description = file_rewrite_pluginfile_urls($this->description, 'pluginfile.php',
context_system::ins... | php | public function get_formatted_description($options = array()) {
$options = empty($options) ? array() : (array)$options;
$options += array('para' => false, 'overflowdiv' => true);
$description = file_rewrite_pluginfile_urls($this->description, 'pluginfile.php',
context_system::ins... | [
"public",
"function",
"get_formatted_description",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"=",
"empty",
"(",
"$",
"options",
")",
"?",
"array",
"(",
")",
":",
"(",
"array",
")",
"$",
"options",
";",
"$",
"options",
"+=... | Returns formatted description of the tag
@param array $options
@return string | [
"Returns",
"formatted",
"description",
"of",
"the",
"tag"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L1443-L1449 |
217,636 | moodle/moodle | tag/classes/tag.php | core_tag_tag.delete_tags | public static function delete_tags($tagids) {
global $DB;
if (!is_array($tagids)) {
$tagids = array($tagids);
}
if (empty($tagids)) {
return;
}
// Use the tagids to create a select statement to be used later.
list($tagsql, $tagparams) = $... | php | public static function delete_tags($tagids) {
global $DB;
if (!is_array($tagids)) {
$tagids = array($tagids);
}
if (empty($tagids)) {
return;
}
// Use the tagids to create a select statement to be used later.
list($tagsql, $tagparams) = $... | [
"public",
"static",
"function",
"delete_tags",
"(",
"$",
"tagids",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"tagids",
")",
")",
"{",
"$",
"tagids",
"=",
"array",
"(",
"$",
"tagids",
")",
";",
"}",
"if",
"(",
"empt... | Delete one or more tag, and all their instances if there are any left.
@param int|array $tagids one tagid (int), or one array of tagids to delete
@return bool true on success, false otherwise | [
"Delete",
"one",
"or",
"more",
"tag",
"and",
"all",
"their",
"instances",
"if",
"there",
"are",
"any",
"left",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L1507-L1583 |
217,637 | moodle/moodle | tag/classes/tag.php | core_tag_tag.combine_correlated_tags | protected function combine_correlated_tags($tags) {
global $DB;
$ids = array_map(function($t) {
return $t->id;
}, $tags);
// Retrieve the correlated tags of this tag and correlated tags of all tags to be merged in one query
// but store them separately. Calculate the... | php | protected function combine_correlated_tags($tags) {
global $DB;
$ids = array_map(function($t) {
return $t->id;
}, $tags);
// Retrieve the correlated tags of this tag and correlated tags of all tags to be merged in one query
// but store them separately. Calculate the... | [
"protected",
"function",
"combine_correlated_tags",
"(",
"$",
"tags",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"ids",
"=",
"array_map",
"(",
"function",
"(",
"$",
"t",
")",
"{",
"return",
"$",
"t",
"->",
"id",
";",
"}",
",",
"$",
"tags",
")",
";",
... | Combine together correlated tags of several tags
This is a help method for method combine_tags()
@param core_tag_tag[] $tags | [
"Combine",
"together",
"correlated",
"tags",
"of",
"several",
"tags"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/tag.php#L1592-L1644 |
217,638 | moodle/moodle | grade/grading/form/guide/renderer.php | gradingform_guide_renderer.display_regrade_confirmation | public function display_regrade_confirmation($elementname, $changelevel, $value) {
$html = html_writer::start_tag('div', array('class' => 'gradingform_guide-regrade', 'role' => 'alert'));
if ($changelevel<=2) {
$html .= get_string('regrademessage1', 'gradingform_guide');
$selecto... | php | public function display_regrade_confirmation($elementname, $changelevel, $value) {
$html = html_writer::start_tag('div', array('class' => 'gradingform_guide-regrade', 'role' => 'alert'));
if ($changelevel<=2) {
$html .= get_string('regrademessage1', 'gradingform_guide');
$selecto... | [
"public",
"function",
"display_regrade_confirmation",
"(",
"$",
"elementname",
",",
"$",
"changelevel",
",",
"$",
"value",
")",
"{",
"$",
"html",
"=",
"html_writer",
"::",
"start_tag",
"(",
"'div'",
",",
"array",
"(",
"'class'",
"=>",
"'gradingform_guide-regrade... | Displays a confirmation message after a regrade has occured
@param string $elementname
@param int $changelevel
@param int $value The regrade option that was used
@return string | [
"Displays",
"a",
"confirmation",
"message",
"after",
"a",
"regrade",
"has",
"occured"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/guide/renderer.php#L753-L768 |
217,639 | moodle/moodle | grade/grading/form/guide/renderer.php | gradingform_guide_renderer.display_guide_mapping_explained | public function display_guide_mapping_explained($scores) {
$html = '';
if (!$scores) {
return $html;
}
if (isset($scores['modulegrade']) && $scores['maxscore'] != $scores['modulegrade']) {
$html .= $this->box(html_writer::tag('div', get_string('guidemappingexplain... | php | public function display_guide_mapping_explained($scores) {
$html = '';
if (!$scores) {
return $html;
}
if (isset($scores['modulegrade']) && $scores['maxscore'] != $scores['modulegrade']) {
$html .= $this->box(html_writer::tag('div', get_string('guidemappingexplain... | [
"public",
"function",
"display_guide_mapping_explained",
"(",
"$",
"scores",
")",
"{",
"$",
"html",
"=",
"''",
";",
"if",
"(",
"!",
"$",
"scores",
")",
"{",
"return",
"$",
"html",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"scores",
"[",
"'modulegrade'",
... | Generates and returns HTML code to display information box about how guide score is converted to the grade
@param array $scores
@return string | [
"Generates",
"and",
"returns",
"HTML",
"code",
"to",
"display",
"information",
"box",
"about",
"how",
"guide",
"score",
"is",
"converted",
"to",
"the",
"grade"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/guide/renderer.php#L775-L786 |
217,640 | moodle/moodle | blocks/rss_client/classes/output/renderer.php | renderer.render_item | public function render_item(\templatable $item) {
$data = $item->export_for_template($this);
return $this->render_from_template('block_rss_client/item', $data);
} | php | public function render_item(\templatable $item) {
$data = $item->export_for_template($this);
return $this->render_from_template('block_rss_client/item', $data);
} | [
"public",
"function",
"render_item",
"(",
"\\",
"templatable",
"$",
"item",
")",
"{",
"$",
"data",
"=",
"$",
"item",
"->",
"export_for_template",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
"render_from_template",
"(",
"'block_rss_client/item'",
... | Render an RSS Item
@param templatable $item
@return string|boolean | [
"Render",
"an",
"RSS",
"Item"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/rss_client/classes/output/renderer.php#L46-L50 |
217,641 | moodle/moodle | blocks/rss_client/classes/output/renderer.php | renderer.render_feed | public function render_feed(\templatable $feed) {
$data = $feed->export_for_template($this);
return $this->render_from_template('block_rss_client/feed', $data);
} | php | public function render_feed(\templatable $feed) {
$data = $feed->export_for_template($this);
return $this->render_from_template('block_rss_client/feed', $data);
} | [
"public",
"function",
"render_feed",
"(",
"\\",
"templatable",
"$",
"feed",
")",
"{",
"$",
"data",
"=",
"$",
"feed",
"->",
"export_for_template",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
"render_from_template",
"(",
"'block_rss_client/feed'",
... | Render an RSS Feed
@param templatable $feed
@return string|boolean | [
"Render",
"an",
"RSS",
"Feed"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/rss_client/classes/output/renderer.php#L58-L62 |
217,642 | moodle/moodle | blocks/rss_client/classes/output/renderer.php | renderer.render_block | public function render_block(\templatable $block) {
$data = $block->export_for_template($this);
return $this->render_from_template('block_rss_client/block', $data);
} | php | public function render_block(\templatable $block) {
$data = $block->export_for_template($this);
return $this->render_from_template('block_rss_client/block', $data);
} | [
"public",
"function",
"render_block",
"(",
"\\",
"templatable",
"$",
"block",
")",
"{",
"$",
"data",
"=",
"$",
"block",
"->",
"export_for_template",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
"render_from_template",
"(",
"'block_rss_client/block'... | Render an RSS feeds block
@param \templatable $block
@return string|boolean | [
"Render",
"an",
"RSS",
"feeds",
"block"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/rss_client/classes/output/renderer.php#L70-L74 |
217,643 | moodle/moodle | blocks/rss_client/classes/output/renderer.php | renderer.render_footer | public function render_footer(\templatable $footer) {
$data = $footer->export_for_template($this);
return $this->render_from_template('block_rss_client/footer', $data);
} | php | public function render_footer(\templatable $footer) {
$data = $footer->export_for_template($this);
return $this->render_from_template('block_rss_client/footer', $data);
} | [
"public",
"function",
"render_footer",
"(",
"\\",
"templatable",
"$",
"footer",
")",
"{",
"$",
"data",
"=",
"$",
"footer",
"->",
"export_for_template",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
"render_from_template",
"(",
"'block_rss_client/foo... | Render the block footer
@param templatable $footer
@return string|boolean | [
"Render",
"the",
"block",
"footer"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/rss_client/classes/output/renderer.php#L82-L86 |
217,644 | moodle/moodle | blocks/rss_client/classes/output/renderer.php | renderer.format_description | public function format_description($description) {
$description = format_text($description, FORMAT_HTML, array('para' => false));
$description = break_up_long_words($description, 30);
return $description;
} | php | public function format_description($description) {
$description = format_text($description, FORMAT_HTML, array('para' => false));
$description = break_up_long_words($description, 30);
return $description;
} | [
"public",
"function",
"format_description",
"(",
"$",
"description",
")",
"{",
"$",
"description",
"=",
"format_text",
"(",
"$",
"description",
",",
"FORMAT_HTML",
",",
"array",
"(",
"'para'",
"=>",
"false",
")",
")",
";",
"$",
"description",
"=",
"break_up_... | Format an RSS item description
@param string $description
@return string | [
"Format",
"an",
"RSS",
"item",
"description"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/rss_client/classes/output/renderer.php#L115-L120 |
217,645 | moodle/moodle | mod/quiz/addrandomform.php | quiz_add_random_form.get_number_of_questions_to_add_choices | private function get_number_of_questions_to_add_choices() {
$maxrand = 100;
$randomcount = array();
for ($i = 1; $i <= min(10, $maxrand); $i++) {
$randomcount[$i] = $i;
}
for ($i = 20; $i <= min(100, $maxrand); $i += 10) {
$randomcount[$i] = $i;
}
... | php | private function get_number_of_questions_to_add_choices() {
$maxrand = 100;
$randomcount = array();
for ($i = 1; $i <= min(10, $maxrand); $i++) {
$randomcount[$i] = $i;
}
for ($i = 20; $i <= min(100, $maxrand); $i += 10) {
$randomcount[$i] = $i;
}
... | [
"private",
"function",
"get_number_of_questions_to_add_choices",
"(",
")",
"{",
"$",
"maxrand",
"=",
"100",
";",
"$",
"randomcount",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<=",
"min",
"(",
"10",
",",
"$",
"maxran... | Return an arbitrary array for the dropdown menu
@return array of integers array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100) | [
"Return",
"an",
"arbitrary",
"array",
"for",
"the",
"dropdown",
"menu"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/addrandomform.php#L131-L141 |
217,646 | moodle/moodle | grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php | backup_gradingform_guide_plugin.define_definition_plugin_structure | protected function define_definition_plugin_structure() {
// Append data only if the grand-parent element has 'method' set to 'guide'.
$plugin = $this->get_plugin_element(null, '../../method', 'guide');
// Create a visible container for our data.
$pluginwrapper = new backup_nested_elem... | php | protected function define_definition_plugin_structure() {
// Append data only if the grand-parent element has 'method' set to 'guide'.
$plugin = $this->get_plugin_element(null, '../../method', 'guide');
// Create a visible container for our data.
$pluginwrapper = new backup_nested_elem... | [
"protected",
"function",
"define_definition_plugin_structure",
"(",
")",
"{",
"// Append data only if the grand-parent element has 'method' set to 'guide'.",
"$",
"plugin",
"=",
"$",
"this",
"->",
"get_plugin_element",
"(",
"null",
",",
"'../../method'",
",",
"'guide'",
")",
... | Declares marking guide structures to append to the grading form definition
@return backup_plugin_element | [
"Declares",
"marking",
"guide",
"structures",
"to",
"append",
"to",
"the",
"grading",
"form",
"definition"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php#L40-L83 |
217,647 | moodle/moodle | grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php | backup_gradingform_guide_plugin.define_instance_plugin_structure | protected function define_instance_plugin_structure() {
// Append data only if the ancestor 'definition' element has 'method' set to 'guide'.
$plugin = $this->get_plugin_element(null, '../../../../method', 'guide');
// Create a visible container for our data.
$pluginwrapper = new backu... | php | protected function define_instance_plugin_structure() {
// Append data only if the ancestor 'definition' element has 'method' set to 'guide'.
$plugin = $this->get_plugin_element(null, '../../../../method', 'guide');
// Create a visible container for our data.
$pluginwrapper = new backu... | [
"protected",
"function",
"define_instance_plugin_structure",
"(",
")",
"{",
"// Append data only if the ancestor 'definition' element has 'method' set to 'guide'.",
"$",
"plugin",
"=",
"$",
"this",
"->",
"get_plugin_element",
"(",
"null",
",",
"'../../../../method'",
",",
"'gui... | Declares marking guide structures to append to the grading form instances
@return backup_plugin_element | [
"Declares",
"marking",
"guide",
"structures",
"to",
"append",
"to",
"the",
"grading",
"form",
"instances"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php#L89-L121 |
217,648 | moodle/moodle | admin/tool/usertours/classes/local/target/unattached.php | unattached.add_disabled_constraints_to_form | public static function add_disabled_constraints_to_form(\MoodleQuickForm $mform) {
$myvalue = \tool_usertours\target::get_target_constant_for_class(get_class());
foreach (array_keys(self::$forcedsettings) as $settingname) {
$mform->hideIf($settingname, 'targettype', 'eq', $myvalue);
... | php | public static function add_disabled_constraints_to_form(\MoodleQuickForm $mform) {
$myvalue = \tool_usertours\target::get_target_constant_for_class(get_class());
foreach (array_keys(self::$forcedsettings) as $settingname) {
$mform->hideIf($settingname, 'targettype', 'eq', $myvalue);
... | [
"public",
"static",
"function",
"add_disabled_constraints_to_form",
"(",
"\\",
"MoodleQuickForm",
"$",
"mform",
")",
"{",
"$",
"myvalue",
"=",
"\\",
"tool_usertours",
"\\",
"target",
"::",
"get_target_constant_for_class",
"(",
"get_class",
"(",
")",
")",
";",
"for... | Add the disabledIf values.
@param MoodleQuickForm $mform The form to add configuration to. | [
"Add",
"the",
"disabledIf",
"values",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/local/target/unattached.php#L83-L89 |
217,649 | moodle/moodle | message/classes/search/base_message.php | base_message.get_doc_url | public function get_doc_url(\core_search\document $doc) {
$users = $this->get_current_other_users($doc);
$position = 'm'.$doc->get('itemid');
return new \moodle_url('/message/index.php', array('history' => MESSAGE_HISTORY_ALL,
'user1' => $users['currentuserid'], 'user2' => $users... | php | public function get_doc_url(\core_search\document $doc) {
$users = $this->get_current_other_users($doc);
$position = 'm'.$doc->get('itemid');
return new \moodle_url('/message/index.php', array('history' => MESSAGE_HISTORY_ALL,
'user1' => $users['currentuserid'], 'user2' => $users... | [
"public",
"function",
"get_doc_url",
"(",
"\\",
"core_search",
"\\",
"document",
"$",
"doc",
")",
"{",
"$",
"users",
"=",
"$",
"this",
"->",
"get_current_other_users",
"(",
"$",
"doc",
")",
";",
"$",
"position",
"=",
"'m'",
".",
"$",
"doc",
"->",
"get"... | Link to the message.
@param \core_search\document $doc
@return \moodle_url | [
"Link",
"to",
"the",
"message",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/search/base_message.php#L96-L101 |
217,650 | moodle/moodle | message/classes/search/base_message.php | base_message.get_context_url | public function get_context_url(\core_search\document $doc) {
$users = $this->get_current_other_users($doc);
return new \moodle_url('/message/index.php', array('user1' => $users['currentuserid'], 'user2' => $users['otheruserid']));
} | php | public function get_context_url(\core_search\document $doc) {
$users = $this->get_current_other_users($doc);
return new \moodle_url('/message/index.php', array('user1' => $users['currentuserid'], 'user2' => $users['otheruserid']));
} | [
"public",
"function",
"get_context_url",
"(",
"\\",
"core_search",
"\\",
"document",
"$",
"doc",
")",
"{",
"$",
"users",
"=",
"$",
"this",
"->",
"get_current_other_users",
"(",
"$",
"doc",
")",
";",
"return",
"new",
"\\",
"moodle_url",
"(",
"'/message/index.... | Link to the conversation.
@param \core_search\document $doc
@return \moodle_url | [
"Link",
"to",
"the",
"conversation",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/search/base_message.php#L109-L112 |
217,651 | moodle/moodle | message/classes/search/base_message.php | base_message.get_document_recordset_helper | protected function get_document_recordset_helper($modifiedfrom, \context $context = null,
$userfield) {
global $DB;
if ($userfield == 'useridto') {
$userfield = 'mcm.userid';
} else {
$userfield = 'm.useridfrom';
}
// Set up basic query.
... | php | protected function get_document_recordset_helper($modifiedfrom, \context $context = null,
$userfield) {
global $DB;
if ($userfield == 'useridto') {
$userfield = 'mcm.userid';
} else {
$userfield = 'm.useridfrom';
}
// Set up basic query.
... | [
"protected",
"function",
"get_document_recordset_helper",
"(",
"$",
"modifiedfrom",
",",
"\\",
"context",
"$",
"context",
"=",
"null",
",",
"$",
"userfield",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"userfield",
"==",
"'useridto'",
")",
"{",
"$"... | Helper function to implement get_document_recordset for subclasses.
@param int $modifiedfrom Modified from date
@param \context|null $context Context or null
@param string $userfield Name of user field (from or to) being considered
@return \moodle_recordset|null Recordset or null if no results possible
@throws \coding... | [
"Helper",
"function",
"to",
"implement",
"get_document_recordset",
"for",
"subclasses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/search/base_message.php#L144-L198 |
217,652 | moodle/moodle | mod/assign/submission/file/locallib.php | assign_submission_file.get_settings | public function get_settings(MoodleQuickForm $mform) {
global $CFG, $COURSE;
if ($this->assignment->has_instance()) {
$defaultmaxfilesubmissions = $this->get_config('maxfilesubmissions');
$defaultmaxsubmissionsizebytes = $this->get_config('maxsubmissionsizebytes');
$... | php | public function get_settings(MoodleQuickForm $mform) {
global $CFG, $COURSE;
if ($this->assignment->has_instance()) {
$defaultmaxfilesubmissions = $this->get_config('maxfilesubmissions');
$defaultmaxsubmissionsizebytes = $this->get_config('maxsubmissionsizebytes');
$... | [
"public",
"function",
"get_settings",
"(",
"MoodleQuickForm",
"$",
"mform",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"COURSE",
";",
"if",
"(",
"$",
"this",
"->",
"assignment",
"->",
"has_instance",
"(",
")",
")",
"{",
"$",
"defaultmaxfilesubmissions",
"="... | Get the default setting for file submission plugin
@param MoodleQuickForm $mform The form to add elements to
@return void | [
"Get",
"the",
"default",
"setting",
"for",
"file",
"submission",
"plugin"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/file/locallib.php#L67-L120 |
217,653 | moodle/moodle | mod/assign/submission/file/locallib.php | assign_submission_file.save_settings | public function save_settings(stdClass $data) {
$this->set_config('maxfilesubmissions', $data->assignsubmission_file_maxfiles);
$this->set_config('maxsubmissionsizebytes', $data->assignsubmission_file_maxsizebytes);
if (!empty($data->assignsubmission_file_filetypes)) {
$this->set_co... | php | public function save_settings(stdClass $data) {
$this->set_config('maxfilesubmissions', $data->assignsubmission_file_maxfiles);
$this->set_config('maxsubmissionsizebytes', $data->assignsubmission_file_maxsizebytes);
if (!empty($data->assignsubmission_file_filetypes)) {
$this->set_co... | [
"public",
"function",
"save_settings",
"(",
"stdClass",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"set_config",
"(",
"'maxfilesubmissions'",
",",
"$",
"data",
"->",
"assignsubmission_file_maxfiles",
")",
";",
"$",
"this",
"->",
"set_config",
"(",
"'maxsubmission... | Save the settings for file submission plugin
@param stdClass $data
@return bool | [
"Save",
"the",
"settings",
"for",
"file",
"submission",
"plugin"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/file/locallib.php#L128-L139 |
217,654 | moodle/moodle | mod/assign/submission/file/locallib.php | assign_submission_file.get_file_options | private function get_file_options() {
$fileoptions = array('subdirs' => 1,
'maxbytes' => $this->get_config('maxsubmissionsizebytes'),
'maxfiles' => $this->get_config('maxfilesubmissions'),
'accepted_types' => $this->... | php | private function get_file_options() {
$fileoptions = array('subdirs' => 1,
'maxbytes' => $this->get_config('maxsubmissionsizebytes'),
'maxfiles' => $this->get_config('maxfilesubmissions'),
'accepted_types' => $this->... | [
"private",
"function",
"get_file_options",
"(",
")",
"{",
"$",
"fileoptions",
"=",
"array",
"(",
"'subdirs'",
"=>",
"1",
",",
"'maxbytes'",
"=>",
"$",
"this",
"->",
"get_config",
"(",
"'maxsubmissionsizebytes'",
")",
",",
"'maxfiles'",
"=>",
"$",
"this",
"->... | File format options
@return array | [
"File",
"format",
"options"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/file/locallib.php#L146-L157 |
217,655 | moodle/moodle | mod/assign/submission/file/locallib.php | assign_submission_file.get_form_elements | public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data) {
global $OUTPUT;
if ($this->get_config('maxfilesubmissions') <= 0) {
return false;
}
$fileoptions = $this->get_file_options();
$submissionid = $submission ? $submission->id : 0;
... | php | public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data) {
global $OUTPUT;
if ($this->get_config('maxfilesubmissions') <= 0) {
return false;
}
$fileoptions = $this->get_file_options();
$submissionid = $submission ? $submission->id : 0;
... | [
"public",
"function",
"get_form_elements",
"(",
"$",
"submission",
",",
"MoodleQuickForm",
"$",
"mform",
",",
"stdClass",
"$",
"data",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"$",
"this",
"->",
"get_config",
"(",
"'maxfilesubmissions'",
")",
"<=",... | Add elements to submission form
@param mixed $submission stdClass|null
@param MoodleQuickForm $mform
@param stdClass $data
@return bool | [
"Add",
"elements",
"to",
"submission",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/file/locallib.php#L167-L187 |
217,656 | moodle/moodle | mod/assign/submission/file/locallib.php | assign_submission_file.count_files | private function count_files($submissionid, $area) {
$fs = get_file_storage();
$files = $fs->get_area_files($this->assignment->get_context()->id,
'assignsubmission_file',
$area,
$submissionid,
... | php | private function count_files($submissionid, $area) {
$fs = get_file_storage();
$files = $fs->get_area_files($this->assignment->get_context()->id,
'assignsubmission_file',
$area,
$submissionid,
... | [
"private",
"function",
"count_files",
"(",
"$",
"submissionid",
",",
"$",
"area",
")",
"{",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"$",
"files",
"=",
"$",
"fs",
"->",
"get_area_files",
"(",
"$",
"this",
"->",
"assignment",
"->",
"get_context"... | Count the number of files
@param int $submissionid
@param string $area
@return int | [
"Count",
"the",
"number",
"of",
"files"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/file/locallib.php#L196-L206 |
217,657 | moodle/moodle | mod/assign/submission/file/locallib.php | assign_submission_file.remove | public function remove(stdClass $submission) {
$fs = get_file_storage();
$fs->delete_area_files($this->assignment->get_context()->id,
'assignsubmission_file',
ASSIGNSUBMISSION_FILE_FILEAREA,
$submission->id);
... | php | public function remove(stdClass $submission) {
$fs = get_file_storage();
$fs->delete_area_files($this->assignment->get_context()->id,
'assignsubmission_file',
ASSIGNSUBMISSION_FILE_FILEAREA,
$submission->id);
... | [
"public",
"function",
"remove",
"(",
"stdClass",
"$",
"submission",
")",
"{",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"$",
"fs",
"->",
"delete_area_files",
"(",
"$",
"this",
"->",
"assignment",
"->",
"get_context",
"(",
")",
"->",
"id",
",",
... | Remove files from this submission.
@param stdClass $submission The submission
@return boolean | [
"Remove",
"files",
"from",
"this",
"submission",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/file/locallib.php#L316-L324 |
217,658 | moodle/moodle | mod/assign/submission/file/locallib.php | assign_submission_file.get_files | public function get_files(stdClass $submission, stdClass $user) {
$result = array();
$fs = get_file_storage();
$files = $fs->get_area_files($this->assignment->get_context()->id,
'assignsubmission_file',
ASSIGNSUBMISSION_F... | php | public function get_files(stdClass $submission, stdClass $user) {
$result = array();
$fs = get_file_storage();
$files = $fs->get_area_files($this->assignment->get_context()->id,
'assignsubmission_file',
ASSIGNSUBMISSION_F... | [
"public",
"function",
"get_files",
"(",
"stdClass",
"$",
"submission",
",",
"stdClass",
"$",
"user",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"$",
"files",
"=",
"$",
"fs",
"->",
"get_are... | Produce a list of files suitable for export that represent this feedback or submission
@param stdClass $submission The submission
@param stdClass $user The user record - unused
@return array - return an array of files indexed by filename | [
"Produce",
"a",
"list",
"of",
"files",
"suitable",
"for",
"export",
"that",
"represent",
"this",
"feedback",
"or",
"submission"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/file/locallib.php#L333-L353 |
217,659 | moodle/moodle | mod/assign/submission/file/locallib.php | assign_submission_file.view_summary | public function view_summary(stdClass $submission, & $showviewlink) {
$count = $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA);
// Show we show a link to view all files for this plugin?
$showviewlink = $count > ASSIGNSUBMISSION_FILE_MAXSUMMARYFILES;
if ($count <= ASS... | php | public function view_summary(stdClass $submission, & $showviewlink) {
$count = $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA);
// Show we show a link to view all files for this plugin?
$showviewlink = $count > ASSIGNSUBMISSION_FILE_MAXSUMMARYFILES;
if ($count <= ASS... | [
"public",
"function",
"view_summary",
"(",
"stdClass",
"$",
"submission",
",",
"&",
"$",
"showviewlink",
")",
"{",
"$",
"count",
"=",
"$",
"this",
"->",
"count_files",
"(",
"$",
"submission",
"->",
"id",
",",
"ASSIGNSUBMISSION_FILE_FILEAREA",
")",
";",
"// S... | Display the list of files in the submission status table
@param stdClass $submission
@param bool $showviewlink Set this to true if the list of files is long
@return string | [
"Display",
"the",
"list",
"of",
"files",
"in",
"the",
"submission",
"status",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/file/locallib.php#L362-L374 |
217,660 | moodle/moodle | mod/assign/submission/file/locallib.php | assign_submission_file.get_config_for_external | public function get_config_for_external() {
global $CFG;
$configs = $this->get_config();
// Get a size in bytes.
if ($configs->maxsubmissionsizebytes == 0) {
$configs->maxsubmissionsizebytes = get_max_upload_file_size($CFG->maxbytes, $this->assignment->get_course()->maxbyte... | php | public function get_config_for_external() {
global $CFG;
$configs = $this->get_config();
// Get a size in bytes.
if ($configs->maxsubmissionsizebytes == 0) {
$configs->maxsubmissionsizebytes = get_max_upload_file_size($CFG->maxbytes, $this->assignment->get_course()->maxbyte... | [
"public",
"function",
"get_config_for_external",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"configs",
"=",
"$",
"this",
"->",
"get_config",
"(",
")",
";",
"// Get a size in bytes.",
"if",
"(",
"$",
"configs",
"->",
"maxsubmissionsizebytes",
"==",
"0",
"... | Return the plugin configs for external functions.
@return array the list of settings
@since Moodle 3.2 | [
"Return",
"the",
"plugin",
"configs",
"for",
"external",
"functions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/file/locallib.php#L608-L619 |
217,661 | moodle/moodle | mod/assign/submission/file/locallib.php | assign_submission_file.get_configured_typesets | private function get_configured_typesets() {
$typeslist = (string)$this->get_config('filetypeslist');
$util = new \core_form\filetypes_util();
$sets = $util->normalize_file_types($typeslist);
return $sets;
} | php | private function get_configured_typesets() {
$typeslist = (string)$this->get_config('filetypeslist');
$util = new \core_form\filetypes_util();
$sets = $util->normalize_file_types($typeslist);
return $sets;
} | [
"private",
"function",
"get_configured_typesets",
"(",
")",
"{",
"$",
"typeslist",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"get_config",
"(",
"'filetypeslist'",
")",
";",
"$",
"util",
"=",
"new",
"\\",
"core_form",
"\\",
"filetypes_util",
"(",
")",
";"... | Get the type sets configured for this assignment.
@return array('groupname', 'mime/type', ...) | [
"Get",
"the",
"type",
"sets",
"configured",
"for",
"this",
"assignment",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/file/locallib.php#L626-L633 |
217,662 | moodle/moodle | mod/assign/classes/privacy/provider.php | provider.get_metadata | public static function get_metadata(collection $collection) : collection {
$assigngrades = [
'userid' => 'privacy:metadata:userid',
'timecreated' => 'privacy:metadata:timecreated',
'timemodified' => 'timemodified',
'grader' => 'privacy:metadata:gra... | php | public static function get_metadata(collection $collection) : collection {
$assigngrades = [
'userid' => 'privacy:metadata:userid',
'timecreated' => 'privacy:metadata:timecreated',
'timemodified' => 'timemodified',
'grader' => 'privacy:metadata:gra... | [
"public",
"static",
"function",
"get_metadata",
"(",
"collection",
"$",
"collection",
")",
":",
"collection",
"{",
"$",
"assigngrades",
"=",
"[",
"'userid'",
"=>",
"'privacy:metadata:userid'",
",",
"'timecreated'",
"=>",
"'privacy:metadata:timecreated'",
",",
"'timemo... | Provides meta data that is stored about a user with mod_assign
@param collection $collection A collection of meta data items to be added to.
@return collection Returns the collection of metadata. | [
"Provides",
"meta",
"data",
"that",
"is",
"stored",
"about",
"a",
"user",
"with",
"mod_assign"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/privacy/provider.php#L72-L128 |
217,663 | moodle/moodle | mod/assign/classes/privacy/provider.php | provider.get_contexts_for_userid | public static function get_contexts_for_userid(int $userid) : contextlist {
$params = ['modulename' => 'assign',
'contextlevel' => CONTEXT_MODULE,
'userid' => $userid,
'graderid' => $userid,
'aouserid' => $userid,
'as... | php | public static function get_contexts_for_userid(int $userid) : contextlist {
$params = ['modulename' => 'assign',
'contextlevel' => CONTEXT_MODULE,
'userid' => $userid,
'graderid' => $userid,
'aouserid' => $userid,
'as... | [
"public",
"static",
"function",
"get_contexts_for_userid",
"(",
"int",
"$",
"userid",
")",
":",
"contextlist",
"{",
"$",
"params",
"=",
"[",
"'modulename'",
"=>",
"'assign'",
",",
"'contextlevel'",
"=>",
"CONTEXT_MODULE",
",",
"'userid'",
"=>",
"$",
"userid",
... | Returns all of the contexts that has information relating to the userid.
@param int $userid The user ID.
@return contextlist an object with the contexts related to a userid. | [
"Returns",
"all",
"of",
"the",
"contexts",
"that",
"has",
"information",
"relating",
"to",
"the",
"userid",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/privacy/provider.php#L136-L202 |
217,664 | moodle/moodle | mod/assign/classes/privacy/provider.php | provider.export_user_data | public static function export_user_data(approved_contextlist $contextlist) {
foreach ($contextlist->get_contexts() as $context) {
// Check that the context is a module context.
if ($context->contextlevel != CONTEXT_MODULE) {
continue;
}
$user = $co... | php | public static function export_user_data(approved_contextlist $contextlist) {
foreach ($contextlist->get_contexts() as $context) {
// Check that the context is a module context.
if ($context->contextlevel != CONTEXT_MODULE) {
continue;
}
$user = $co... | [
"public",
"static",
"function",
"export_user_data",
"(",
"approved_contextlist",
"$",
"contextlist",
")",
"{",
"foreach",
"(",
"$",
"contextlist",
"->",
"get_contexts",
"(",
")",
"as",
"$",
"context",
")",
"{",
"// Check that the context is a module context.",
"if",
... | Write out the user data filtered by contexts.
@param approved_contextlist $contextlist contexts that we are writing data out from. | [
"Write",
"out",
"the",
"user",
"data",
"filtered",
"by",
"contexts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/privacy/provider.php#L279-L315 |
217,665 | moodle/moodle | mod/assign/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 $DB;
if ($context->contextlevel == CONTEXT_MODULE) {
$cm = get_coursemodule_from_id('assign', $context->instanceid);
if ($cm) {
// Get the assignment related to this context.
... | php | public static function delete_data_for_all_users_in_context(\context $context) {
global $DB;
if ($context->contextlevel == CONTEXT_MODULE) {
$cm = get_coursemodule_from_id('assign', $context->instanceid);
if ($cm) {
// Get the assignment related to this context.
... | [
"public",
"static",
"function",
"delete_data_for_all_users_in_context",
"(",
"\\",
"context",
"$",
"context",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"context",
"->",
"contextlevel",
"==",
"CONTEXT_MODULE",
")",
"{",
"$",
"cm",
"=",
"get_coursemodu... | Delete all use data which matches the specified context.
@param \context $context The module context. | [
"Delete",
"all",
"use",
"data",
"which",
"matches",
"the",
"specified",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/privacy/provider.php#L322-L353 |
217,666 | moodle/moodle | mod/assign/classes/privacy/provider.php | provider.delete_overrides_for_users | protected static function delete_overrides_for_users(\assign $assign, array $userids = []) {
global $DB;
$assignid = $assign->get_instance()->id;
$usersql = '';
$params = ['assignid' => $assignid];
if (!empty($userids)) {
list($usersql, $userparams) = $DB->get_in_or_... | php | protected static function delete_overrides_for_users(\assign $assign, array $userids = []) {
global $DB;
$assignid = $assign->get_instance()->id;
$usersql = '';
$params = ['assignid' => $assignid];
if (!empty($userids)) {
list($usersql, $userparams) = $DB->get_in_or_... | [
"protected",
"static",
"function",
"delete_overrides_for_users",
"(",
"\\",
"assign",
"$",
"assign",
",",
"array",
"$",
"userids",
"=",
"[",
"]",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"assignid",
"=",
"$",
"assign",
"->",
"get_instance",
"(",
")",
"->... | Deletes assignment overrides in bulk
@param \assign $assign The assignment object
@param array $userids An array of user IDs | [
"Deletes",
"assignment",
"overrides",
"in",
"bulk"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/privacy/provider.php#L452-L483 |
217,667 | moodle/moodle | mod/assign/classes/privacy/provider.php | provider.get_graded_users | protected static function get_graded_users(int $userid, \assign $assign) {
$params = ['grader' => $userid, 'assignid' => $assign->get_instance()->id];
$sql = "SELECT DISTINCT userid AS id
FROM {assign_grades}
WHERE grader = :grader AND assignment = :assignid";
... | php | protected static function get_graded_users(int $userid, \assign $assign) {
$params = ['grader' => $userid, 'assignid' => $assign->get_instance()->id];
$sql = "SELECT DISTINCT userid AS id
FROM {assign_grades}
WHERE grader = :grader AND assignment = :assignid";
... | [
"protected",
"static",
"function",
"get_graded_users",
"(",
"int",
"$",
"userid",
",",
"\\",
"assign",
"$",
"assign",
")",
"{",
"$",
"params",
"=",
"[",
"'grader'",
"=>",
"$",
"userid",
",",
"'assignid'",
"=>",
"$",
"assign",
"->",
"get_instance",
"(",
"... | Find out if this user has graded any users.
@param int $userid The user ID (potential teacher).
@param assign $assign The assignment object.
@return array If successful an array of objects with userids that this user graded, otherwise false. | [
"Find",
"out",
"if",
"this",
"user",
"has",
"graded",
"any",
"users",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/privacy/provider.php#L492-L509 |
217,668 | moodle/moodle | mod/assign/classes/privacy/provider.php | provider.store_assign_user_flags | protected static function store_assign_user_flags(\context $context, \assign $assign, int $userid) {
$datatypes = ['locked' => get_string('locksubmissions', 'mod_assign'),
'mailed' => get_string('privacy:metadata:mailed', 'mod_assign'),
'extensionduedate' => get_strin... | php | protected static function store_assign_user_flags(\context $context, \assign $assign, int $userid) {
$datatypes = ['locked' => get_string('locksubmissions', 'mod_assign'),
'mailed' => get_string('privacy:metadata:mailed', 'mod_assign'),
'extensionduedate' => get_strin... | [
"protected",
"static",
"function",
"store_assign_user_flags",
"(",
"\\",
"context",
"$",
"context",
",",
"\\",
"assign",
"$",
"assign",
",",
"int",
"$",
"userid",
")",
"{",
"$",
"datatypes",
"=",
"[",
"'locked'",
"=>",
"get_string",
"(",
"'locksubmissions'",
... | Writes out various user meta data about the assignment.
@param \context $context The context of this assignment.
@param \assign $assign The assignment object.
@param int $userid The user ID | [
"Writes",
"out",
"various",
"user",
"meta",
"data",
"about",
"the",
"assignment",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/privacy/provider.php#L518-L537 |
217,669 | moodle/moodle | mod/assign/classes/privacy/provider.php | provider.export_grade_data | protected static function export_grade_data(\stdClass $grade, \context $context, array $currentpath) {
$gradedata = (object)[
'timecreated' => transform::datetime($grade->timecreated),
'timemodified' => transform::datetime($grade->timemodified),
'grader' => transform::user($g... | php | protected static function export_grade_data(\stdClass $grade, \context $context, array $currentpath) {
$gradedata = (object)[
'timecreated' => transform::datetime($grade->timecreated),
'timemodified' => transform::datetime($grade->timemodified),
'grader' => transform::user($g... | [
"protected",
"static",
"function",
"export_grade_data",
"(",
"\\",
"stdClass",
"$",
"grade",
",",
"\\",
"context",
"$",
"context",
",",
"array",
"$",
"currentpath",
")",
"{",
"$",
"gradedata",
"=",
"(",
"object",
")",
"[",
"'timecreated'",
"=>",
"transform",... | Formats and then exports the user's grade data.
@param \stdClass $grade The assign grade object
@param \context $context The context object
@param array $currentpath Current directory path that we are exporting to. | [
"Formats",
"and",
"then",
"exports",
"the",
"user",
"s",
"grade",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/privacy/provider.php#L546-L556 |
217,670 | moodle/moodle | mod/assign/classes/privacy/provider.php | provider.export_submission_data | protected static function export_submission_data(\stdClass $submission, \context $context, array $currentpath) {
$submissiondata = (object)[
'timecreated' => transform::datetime($submission->timecreated),
'timemodified' => transform::datetime($submission->timemodified),
'stat... | php | protected static function export_submission_data(\stdClass $submission, \context $context, array $currentpath) {
$submissiondata = (object)[
'timecreated' => transform::datetime($submission->timecreated),
'timemodified' => transform::datetime($submission->timemodified),
'stat... | [
"protected",
"static",
"function",
"export_submission_data",
"(",
"\\",
"stdClass",
"$",
"submission",
",",
"\\",
"context",
"$",
"context",
",",
"array",
"$",
"currentpath",
")",
"{",
"$",
"submissiondata",
"=",
"(",
"object",
")",
"[",
"'timecreated'",
"=>",... | Formats and then exports the user's submission data.
@param \stdClass $submission The assign submission object
@param \context $context The context object
@param array $currentpath Current directory path that we are exporting to. | [
"Formats",
"and",
"then",
"exports",
"the",
"user",
"s",
"submission",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/privacy/provider.php#L565-L576 |
217,671 | moodle/moodle | mod/assign/classes/privacy/provider.php | provider.export_user_preferences | public static function export_user_preferences(int $userid) {
$context = \context_system::instance();
$assignpreferences = [
'assign_perpage' => ['string' => get_string('privacy:metadata:assignperpage', 'mod_assign'), 'bool' => false],
'assign_filter' => ['string' => get_string('... | php | public static function export_user_preferences(int $userid) {
$context = \context_system::instance();
$assignpreferences = [
'assign_perpage' => ['string' => get_string('privacy:metadata:assignperpage', 'mod_assign'), 'bool' => false],
'assign_filter' => ['string' => get_string('... | [
"public",
"static",
"function",
"export_user_preferences",
"(",
"int",
"$",
"userid",
")",
"{",
"$",
"context",
"=",
"\\",
"context_system",
"::",
"instance",
"(",
")",
";",
"$",
"assignpreferences",
"=",
"[",
"'assign_perpage'",
"=>",
"[",
"'string'",
"=>",
... | Stores the user preferences related to mod_assign.
@param int $userid The user ID that we want the preferences for. | [
"Stores",
"the",
"user",
"preferences",
"related",
"to",
"mod_assign",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/privacy/provider.php#L583-L604 |
217,672 | moodle/moodle | mod/assign/classes/privacy/provider.php | provider.export_overrides | public static function export_overrides(\context $context, \assign $assign, \stdClass $user) {
$overrides = $assign->override_exists($user->id);
// Overrides returns an array with data in it, but an override with actual data will have the assign ID set.
if (isset($overrides->assignid)) {
... | php | public static function export_overrides(\context $context, \assign $assign, \stdClass $user) {
$overrides = $assign->override_exists($user->id);
// Overrides returns an array with data in it, but an override with actual data will have the assign ID set.
if (isset($overrides->assignid)) {
... | [
"public",
"static",
"function",
"export_overrides",
"(",
"\\",
"context",
"$",
"context",
",",
"\\",
"assign",
"$",
"assign",
",",
"\\",
"stdClass",
"$",
"user",
")",
"{",
"$",
"overrides",
"=",
"$",
"assign",
"->",
"override_exists",
"(",
"$",
"user",
"... | Export overrides for this assignment.
@param \context $context Context
@param \assign $assign The assign object.
@param \stdClass $user The user object. | [
"Export",
"overrides",
"for",
"this",
"assignment",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/privacy/provider.php#L613-L632 |
217,673 | moodle/moodle | mod/assign/classes/privacy/provider.php | provider.export_submission | protected static function export_submission(\assign $assign, \stdClass $user, \context_module $context, array $path,
bool $exportforteacher = false) {
$submissions = $assign->get_all_submissions($user->id);
$teacher = ($exportforteacher) ? $user : null;
$gradingmanager = get_grading_... | php | protected static function export_submission(\assign $assign, \stdClass $user, \context_module $context, array $path,
bool $exportforteacher = false) {
$submissions = $assign->get_all_submissions($user->id);
$teacher = ($exportforteacher) ? $user : null;
$gradingmanager = get_grading_... | [
"protected",
"static",
"function",
"export_submission",
"(",
"\\",
"assign",
"$",
"assign",
",",
"\\",
"stdClass",
"$",
"user",
",",
"\\",
"context_module",
"$",
"context",
",",
"array",
"$",
"path",
",",
"bool",
"$",
"exportforteacher",
"=",
"false",
")",
... | Exports assignment submission data for a user.
@param \assign $assign The assignment object
@param \stdClass $user The user object
@param \context_module $context The context
@param array $path The path for exporting data
@param bool|boolean $... | [
"Exports",
"assignment",
"submission",
"data",
"for",
"a",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/classes/privacy/provider.php#L643-L674 |
217,674 | moodle/moodle | mod/forum/classes/local/builders/exported_discussion_summaries.php | exported_discussion_summaries.get_favourites | private function get_favourites(stdClass $user) : array {
$ids = [];
if (isloggedin()) {
$usercontext = \context_user::instance($user->id);
$ufservice = \core_favourites\service_factory::get_service_for_user_context($usercontext);
$favourites = $ufservice->find_favou... | php | private function get_favourites(stdClass $user) : array {
$ids = [];
if (isloggedin()) {
$usercontext = \context_user::instance($user->id);
$ufservice = \core_favourites\service_factory::get_service_for_user_context($usercontext);
$favourites = $ufservice->find_favou... | [
"private",
"function",
"get_favourites",
"(",
"stdClass",
"$",
"user",
")",
":",
"array",
"{",
"$",
"ids",
"=",
"[",
"]",
";",
"if",
"(",
"isloggedin",
"(",
")",
")",
"{",
"$",
"usercontext",
"=",
"\\",
"context_user",
"::",
"instance",
"(",
"$",
"us... | Get a list of all favourited discussions.
@param stdClass $user The user we are getting favourites for
@return int[] A list of favourited itemids | [
"Get",
"a",
"list",
"of",
"all",
"favourited",
"discussions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/builders/exported_discussion_summaries.php#L189-L202 |
217,675 | moodle/moodle | mod/forum/classes/local/builders/exported_discussion_summaries.php | exported_discussion_summaries.get_author_groups_from_posts | private function get_author_groups_from_posts(array $posts, $forum) : array {
$course = $forum->get_course_record();
$coursemodule = $forum->get_course_module_record();
$authorids = array_reduce($posts, function($carry, $post) {
$carry[$post->get_author_id()] = true;
retu... | php | private function get_author_groups_from_posts(array $posts, $forum) : array {
$course = $forum->get_course_record();
$coursemodule = $forum->get_course_module_record();
$authorids = array_reduce($posts, function($carry, $post) {
$carry[$post->get_author_id()] = true;
retu... | [
"private",
"function",
"get_author_groups_from_posts",
"(",
"array",
"$",
"posts",
",",
"$",
"forum",
")",
":",
"array",
"{",
"$",
"course",
"=",
"$",
"forum",
"->",
"get_course_record",
"(",
")",
";",
"$",
"coursemodule",
"=",
"$",
"forum",
"->",
"get_cou... | Get the author's groups for a list of posts.
@param post_entity[] $posts The list of posts
@param forum_entity $forum The forum entity
@return array Author groups indexed by author id | [
"Get",
"the",
"author",
"s",
"groups",
"for",
"a",
"list",
"of",
"posts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/builders/exported_discussion_summaries.php#L223-L256 |
217,676 | moodle/moodle | lib/spout/src/Spout/Reader/XLSX/Helper/SharedStringsHelper.php | SharedStringsHelper.hasSharedStrings | public function hasSharedStrings()
{
$hasSharedStrings = false;
$zip = new \ZipArchive();
if ($zip->open($this->filePath) === true) {
$hasSharedStrings = ($zip->locateName(self::SHARED_STRINGS_XML_FILE_PATH) !== false);
$zip->close();
}
return $hasSh... | php | public function hasSharedStrings()
{
$hasSharedStrings = false;
$zip = new \ZipArchive();
if ($zip->open($this->filePath) === true) {
$hasSharedStrings = ($zip->locateName(self::SHARED_STRINGS_XML_FILE_PATH) !== false);
$zip->close();
}
return $hasSh... | [
"public",
"function",
"hasSharedStrings",
"(",
")",
"{",
"$",
"hasSharedStrings",
"=",
"false",
";",
"$",
"zip",
"=",
"new",
"\\",
"ZipArchive",
"(",
")",
";",
"if",
"(",
"$",
"zip",
"->",
"open",
"(",
"$",
"this",
"->",
"filePath",
")",
"===",
"true... | Returns whether the XLSX file contains a shared strings XML file
@return bool | [
"Returns",
"whether",
"the",
"XLSX",
"file",
"contains",
"a",
"shared",
"strings",
"XML",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/XLSX/Helper/SharedStringsHelper.php#L61-L72 |
217,677 | moodle/moodle | lib/spout/src/Spout/Reader/XLSX/Helper/SharedStringsHelper.php | SharedStringsHelper.processSharedStringsItem | protected function processSharedStringsItem($xmlReader, $sharedStringIndex)
{
$sharedStringValue = '';
// NOTE: expand() will automatically decode all XML entities of the child nodes
$siNode = $xmlReader->expand();
$textNodes = $siNode->getElementsByTagName(self::XML_NODE_T);
... | php | protected function processSharedStringsItem($xmlReader, $sharedStringIndex)
{
$sharedStringValue = '';
// NOTE: expand() will automatically decode all XML entities of the child nodes
$siNode = $xmlReader->expand();
$textNodes = $siNode->getElementsByTagName(self::XML_NODE_T);
... | [
"protected",
"function",
"processSharedStringsItem",
"(",
"$",
"xmlReader",
",",
"$",
"sharedStringIndex",
")",
"{",
"$",
"sharedStringValue",
"=",
"''",
";",
"// NOTE: expand() will automatically decode all XML entities of the child nodes",
"$",
"siNode",
"=",
"$",
"xmlRea... | Processes the shared strings item XML node which the given XML reader is positioned on.
@param \Box\Spout\Reader\Wrapper\XMLReader $xmlReader XML Reader positioned on a "<si>" node
@param int $sharedStringIndex Index of the processed shared strings item
@return void | [
"Processes",
"the",
"shared",
"strings",
"item",
"XML",
"node",
"which",
"the",
"given",
"XML",
"reader",
"is",
"positioned",
"on",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/XLSX/Helper/SharedStringsHelper.php#L165-L183 |
217,678 | moodle/moodle | course/edit_form.php | course_edit_form.definition_after_data | function definition_after_data() {
global $DB;
$mform = $this->_form;
// add available groupings
$courseid = $mform->getElementValue('id');
if ($courseid and $mform->elementExists('defaultgroupingid')) {
$options = array();
if ($groupings = $DB->get_reco... | php | function definition_after_data() {
global $DB;
$mform = $this->_form;
// add available groupings
$courseid = $mform->getElementValue('id');
if ($courseid and $mform->elementExists('defaultgroupingid')) {
$options = array();
if ($groupings = $DB->get_reco... | [
"function",
"definition_after_data",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"// add available groupings",
"$",
"courseid",
"=",
"$",
"mform",
"->",
"getElementValue",
"(",
"'id'",
")",
";",
"if",
"(",
... | Fill in the current page data for this course. | [
"Fill",
"in",
"the",
"current",
"page",
"data",
"for",
"this",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/edit_form.php#L351-L397 |
217,679 | moodle/moodle | lib/spout/src/Spout/Writer/AbstractWriter.php | AbstractWriter.openToFile | public function openToFile($outputFilePath)
{
$this->outputFilePath = $outputFilePath;
$this->filePointer = $this->globalFunctionsHelper->fopen($this->outputFilePath, 'wb+');
$this->throwIfFilePointerIsNotAvailable();
$this->openWriter();
$this->isWriterOpened = true;
... | php | public function openToFile($outputFilePath)
{
$this->outputFilePath = $outputFilePath;
$this->filePointer = $this->globalFunctionsHelper->fopen($this->outputFilePath, 'wb+');
$this->throwIfFilePointerIsNotAvailable();
$this->openWriter();
$this->isWriterOpened = true;
... | [
"public",
"function",
"openToFile",
"(",
"$",
"outputFilePath",
")",
"{",
"$",
"this",
"->",
"outputFilePath",
"=",
"$",
"outputFilePath",
";",
"$",
"this",
"->",
"filePointer",
"=",
"$",
"this",
"->",
"globalFunctionsHelper",
"->",
"fopen",
"(",
"$",
"this"... | Inits the writer and opens it to accept data.
By using this method, the data will be written to a file.
@api
@param string $outputFilePath Path of the output file that will contain the data
@return AbstractWriter
@throws \Box\Spout\Common\Exception\IOException If the writer cannot be opened or if the given path is no... | [
"Inits",
"the",
"writer",
"and",
"opens",
"it",
"to",
"accept",
"data",
".",
"By",
"using",
"this",
"method",
"the",
"data",
"will",
"be",
"written",
"to",
"a",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/AbstractWriter.php#L110-L121 |
217,680 | moodle/moodle | lib/spout/src/Spout/Writer/AbstractWriter.php | AbstractWriter.openToBrowser | public function openToBrowser($outputFileName)
{
$this->outputFilePath = $this->globalFunctionsHelper->basename($outputFileName);
$this->filePointer = $this->globalFunctionsHelper->fopen('php://output', 'w');
$this->throwIfFilePointerIsNotAvailable();
// Clear any previous output (... | php | public function openToBrowser($outputFileName)
{
$this->outputFilePath = $this->globalFunctionsHelper->basename($outputFileName);
$this->filePointer = $this->globalFunctionsHelper->fopen('php://output', 'w');
$this->throwIfFilePointerIsNotAvailable();
// Clear any previous output (... | [
"public",
"function",
"openToBrowser",
"(",
"$",
"outputFileName",
")",
"{",
"$",
"this",
"->",
"outputFilePath",
"=",
"$",
"this",
"->",
"globalFunctionsHelper",
"->",
"basename",
"(",
"$",
"outputFileName",
")",
";",
"$",
"this",
"->",
"filePointer",
"=",
... | Inits the writer and opens it to accept data.
By using this method, the data will be outputted directly to the browser.
@codeCoverageIgnore
@api
@param string $outputFileName Name of the output file that will contain the data. If a path is passed in, only the file name will be kept
@return AbstractWriter
@throws \Bo... | [
"Inits",
"the",
"writer",
"and",
"opens",
"it",
"to",
"accept",
"data",
".",
"By",
"using",
"this",
"method",
"the",
"data",
"will",
"be",
"outputted",
"directly",
"to",
"the",
"browser",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/AbstractWriter.php#L134-L163 |
217,681 | moodle/moodle | lib/spout/src/Spout/Writer/AbstractWriter.php | AbstractWriter.close | public function close()
{
if (!$this->isWriterOpened) {
return;
}
$this->closeWriter();
if (is_resource($this->filePointer)) {
$this->globalFunctionsHelper->fclose($this->filePointer);
}
$this->isWriterOpened = false;
} | php | public function close()
{
if (!$this->isWriterOpened) {
return;
}
$this->closeWriter();
if (is_resource($this->filePointer)) {
$this->globalFunctionsHelper->fclose($this->filePointer);
}
$this->isWriterOpened = false;
} | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isWriterOpened",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"closeWriter",
"(",
")",
";",
"if",
"(",
"is_resource",
"(",
"$",
"this",
"->",
"filePointer",
")",
... | Closes the writer. This will close the streamer as well, preventing new data
to be written to the file.
@api
@return void | [
"Closes",
"the",
"writer",
".",
"This",
"will",
"close",
"the",
"streamer",
"as",
"well",
"preventing",
"new",
"data",
"to",
"be",
"written",
"to",
"the",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/AbstractWriter.php#L351-L364 |
217,682 | moodle/moodle | mod/chat/classes/task/cron_task.php | cron_task.execute | public function execute() {
global $CFG, $DB;
require_once($CFG->dirroot . '/mod/chat/lib.php');
chat_update_chat_times();
chat_delete_old_users();
$timenow = time();
$subselect = "SELECT c.keepdays
FROM {chat} c
WHERE c.id... | php | public function execute() {
global $CFG, $DB;
require_once($CFG->dirroot . '/mod/chat/lib.php');
chat_update_chat_times();
chat_delete_old_users();
$timenow = time();
$subselect = "SELECT c.keepdays
FROM {chat} c
WHERE c.id... | [
"public",
"function",
"execute",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/mod/chat/lib.php'",
")",
";",
"chat_update_chat_times",
"(",
")",
";",
"chat_delete_old_users",
"(",
")",
"... | Run chat cron. | [
"Run",
"chat",
"cron",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/chat/classes/task/cron_task.php#L49-L64 |
217,683 | moodle/moodle | lib/classes/output/mustache_pix_helper.php | mustache_pix_helper.pix | public function pix($text, Mustache_LambdaHelper $helper) {
// Split the text into an array of variables.
$key = strtok($text, ",");
$key = trim($helper->render($key));
$component = strtok(",");
$component = trim($helper->render($component));
if (!$component) {
... | php | public function pix($text, Mustache_LambdaHelper $helper) {
// Split the text into an array of variables.
$key = strtok($text, ",");
$key = trim($helper->render($key));
$component = strtok(",");
$component = trim($helper->render($component));
if (!$component) {
... | [
"public",
"function",
"pix",
"(",
"$",
"text",
",",
"Mustache_LambdaHelper",
"$",
"helper",
")",
"{",
"// Split the text into an array of variables.",
"$",
"key",
"=",
"strtok",
"(",
"$",
"text",
",",
"\",\"",
")",
";",
"$",
"key",
"=",
"trim",
"(",
"$",
"... | Read a pix icon name from a template and get it from pix_icon.
{{#pix}}t/edit,component,Anything else is alt text{{/pix}}
The args are comma separated and only the first is required.
@param string $text The text to parse for arguments.
@param Mustache_LambdaHelper $helper Used to render nested mustache variables.
@r... | [
"Read",
"a",
"pix",
"icon",
"name",
"from",
"a",
"template",
"and",
"get",
"it",
"from",
"pix_icon",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/output/mustache_pix_helper.php#L62-L77 |
217,684 | moodle/moodle | availability/condition/profile/classes/condition.php | condition.is_field_condition_met | protected static function is_field_condition_met($operator, $uservalue, $value) {
if ($uservalue === false) {
// If the user value is false this is an instant fail.
// All user values come from the database as either data or the default.
// They will always be a string.
... | php | protected static function is_field_condition_met($operator, $uservalue, $value) {
if ($uservalue === false) {
// If the user value is false this is an instant fail.
// All user values come from the database as either data or the default.
// They will always be a string.
... | [
"protected",
"static",
"function",
"is_field_condition_met",
"(",
"$",
"operator",
",",
"$",
"uservalue",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"uservalue",
"===",
"false",
")",
"{",
"// If the user value is false this is an instant fail.",
"// All user values ... | Returns true if a field meets the required conditions, false otherwise.
@param string $operator the requirement/condition
@param string $uservalue the user's value
@param string $value the value required
@return boolean True if conditions are met | [
"Returns",
"true",
"if",
"a",
"field",
"meets",
"the",
"required",
"conditions",
"false",
"otherwise",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/availability/condition/profile/classes/condition.php#L267-L322 |
217,685 | moodle/moodle | availability/condition/profile/classes/condition.php | condition.get_custom_profile_fields | public static function get_custom_profile_fields() {
global $DB, $CFG;
if (self::$customprofilefields === null) {
// Get fields and store them indexed by shortname.
require_once($CFG->dirroot . '/user/profile/lib.php');
$fields = profile_get_custom_fields(true);
... | php | public static function get_custom_profile_fields() {
global $DB, $CFG;
if (self::$customprofilefields === null) {
// Get fields and store them indexed by shortname.
require_once($CFG->dirroot . '/user/profile/lib.php');
$fields = profile_get_custom_fields(true);
... | [
"public",
"static",
"function",
"get_custom_profile_fields",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"if",
"(",
"self",
"::",
"$",
"customprofilefields",
"===",
"null",
")",
"{",
"// Get fields and store them indexed by shortname.",
"require_once",... | Gets data about custom profile fields. Cached statically in current
request.
This only includes fields which can be tested by the system (those whose
data is cached in $USER object) - basically doesn't include textarea type
fields.
@return array Array of records indexed by shortname | [
"Gets",
"data",
"about",
"custom",
"profile",
"fields",
".",
"Cached",
"statically",
"in",
"current",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/availability/condition/profile/classes/condition.php#L334-L347 |
217,686 | moodle/moodle | availability/condition/profile/classes/condition.php | condition.get_cached_user_profile_field | protected function get_cached_user_profile_field($userid) {
global $USER, $DB, $CFG;
$iscurrentuser = $USER->id == $userid;
if (isguestuser($userid) || ($iscurrentuser && !isloggedin())) {
// Must be logged in and can't be the guest.
return false;
}
// Cu... | php | protected function get_cached_user_profile_field($userid) {
global $USER, $DB, $CFG;
$iscurrentuser = $USER->id == $userid;
if (isguestuser($userid) || ($iscurrentuser && !isloggedin())) {
// Must be logged in and can't be the guest.
return false;
}
// Cu... | [
"protected",
"function",
"get_cached_user_profile_field",
"(",
"$",
"userid",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"DB",
",",
"$",
"CFG",
";",
"$",
"iscurrentuser",
"=",
"$",
"USER",
"->",
"id",
"==",
"$",
"userid",
";",
"if",
"(",
"isguestuser",
... | Return the value for a user's profile field
@param int $userid User ID
@return string|bool Value, or false if user does not have a value for this field | [
"Return",
"the",
"value",
"for",
"a",
"user",
"s",
"profile",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/availability/condition/profile/classes/condition.php#L362-L440 |
217,687 | moodle/moodle | availability/condition/profile/classes/condition.php | condition.get_condition_sql | private function get_condition_sql($field, $field2 = null, $istext = false) {
global $DB;
if (is_null($field2)) {
$field2 = $field;
}
$params = array();
switch($this->operator) {
case self::OP_CONTAINS:
$sql = $DB->sql_like($field, self::u... | php | private function get_condition_sql($field, $field2 = null, $istext = false) {
global $DB;
if (is_null($field2)) {
$field2 = $field;
}
$params = array();
switch($this->operator) {
case self::OP_CONTAINS:
$sql = $DB->sql_like($field, self::u... | [
"private",
"function",
"get_condition_sql",
"(",
"$",
"field",
",",
"$",
"field2",
"=",
"null",
",",
"$",
"istext",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"is_null",
"(",
"$",
"field2",
")",
")",
"{",
"$",
"field2",
"=",
"$",
... | Gets SQL to match a field against this condition. The second copy of the
field is in case you're using variables for the field so that it needs
to be two different ones.
@param string $field Field name
@param string $field2 Second copy of field name (default same).
@param boolean $istext Any of the fields correspond t... | [
"Gets",
"SQL",
"to",
"match",
"a",
"field",
"against",
"this",
"condition",
".",
"The",
"second",
"copy",
"of",
"the",
"field",
"is",
"in",
"case",
"you",
"re",
"using",
"variables",
"for",
"the",
"field",
"so",
"that",
"it",
"needs",
"to",
"be",
"two"... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/availability/condition/profile/classes/condition.php#L513-L569 |
217,688 | moodle/moodle | repository/wikimedia/wikimedia.php | wikimedia.get_thumb_url | public function get_thumb_url($image_url, $orig_width, $orig_height, $thumb_width = 75, $force = false) {
global $OUTPUT;
if (!$force && $orig_width <= $thumb_width && $orig_height <= $thumb_width) {
return $image_url;
} else {
$thumb_url = '';
$commons_main_... | php | public function get_thumb_url($image_url, $orig_width, $orig_height, $thumb_width = 75, $force = false) {
global $OUTPUT;
if (!$force && $orig_width <= $thumb_width && $orig_height <= $thumb_width) {
return $image_url;
} else {
$thumb_url = '';
$commons_main_... | [
"public",
"function",
"get_thumb_url",
"(",
"$",
"image_url",
",",
"$",
"orig_width",
",",
"$",
"orig_height",
",",
"$",
"thumb_width",
"=",
"75",
",",
"$",
"force",
"=",
"false",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"!",
"$",
"force",
... | Generate thumbnail URL from image URL.
@param string $image_url
@param int $orig_width
@param int $orig_height
@param int $thumb_width
@param bool $force When true, forces the generation of a thumb URL.
@global object OUTPUT
@return string | [
"Generate",
"thumbnail",
"URL",
"from",
"image",
"URL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/wikimedia/wikimedia.php#L113-L139 |
217,689 | moodle/moodle | lib/behat/form_field/behat_form_field.php | behat_form_field.guess_type | private function guess_type() {
global $CFG;
// We default to the text-based field if nothing was detected.
if (!$type = behat_field_manager::guess_field_type($this->field, $this->session)) {
$type = 'text';
}
$classname = 'behat_form_' . $type;
$classpath =... | php | private function guess_type() {
global $CFG;
// We default to the text-based field if nothing was detected.
if (!$type = behat_field_manager::guess_field_type($this->field, $this->session)) {
$type = 'text';
}
$classname = 'behat_form_' . $type;
$classpath =... | [
"private",
"function",
"guess_type",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// We default to the text-based field if nothing was detected.",
"if",
"(",
"!",
"$",
"type",
"=",
"behat_field_manager",
"::",
"guess_field_type",
"(",
"$",
"this",
"->",
"field",
",",
... | Guesses the element type we are dealing with in case is not a text-based element.
This class is the generic field type, behat_field_manager::get_form_field()
should be able to find the appropiate class for the field type, but
in cases like moodle form group elements we can not find the type of
the field through the DO... | [
"Guesses",
"the",
"element",
"type",
"we",
"are",
"dealing",
"with",
"in",
"case",
"is",
"not",
"a",
"text",
"-",
"based",
"element",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_field.php#L162-L174 |
217,690 | moodle/moodle | lib/behat/form_field/behat_form_field.php | behat_form_field.get_internal_field_id | protected function get_internal_field_id() {
if (!$this->running_javascript()) {
throw new coding_exception('You can only get an internal ID using the selenium driver.');
}
return $this->session->getDriver()->getWebDriverSession()->element('xpath', $this->field->getXPath())->getID(... | php | protected function get_internal_field_id() {
if (!$this->running_javascript()) {
throw new coding_exception('You can only get an internal ID using the selenium driver.');
}
return $this->session->getDriver()->getWebDriverSession()->element('xpath', $this->field->getXPath())->getID(... | [
"protected",
"function",
"get_internal_field_id",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"running_javascript",
"(",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'You can only get an internal ID using the selenium driver.'",
")",
";",
"}",
"ret... | Gets the field internal id used by selenium wire protocol.
Only available when running_javascript().
@throws coding_exception
@return int | [
"Gets",
"the",
"field",
"internal",
"id",
"used",
"by",
"selenium",
"wire",
"protocol",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_field.php#L207-L214 |
217,691 | moodle/moodle | lib/behat/form_field/behat_form_field.php | behat_form_field.get_field_locator | protected function get_field_locator($locatortype = false) {
if (!empty($this->fieldlocator)) {
return $this->fieldlocator;
}
$fieldid = $this->field->getAttribute('id');
// Defaults to label.
if ($locatortype == 'label' || $locatortype == false) {
$la... | php | protected function get_field_locator($locatortype = false) {
if (!empty($this->fieldlocator)) {
return $this->fieldlocator;
}
$fieldid = $this->field->getAttribute('id');
// Defaults to label.
if ($locatortype == 'label' || $locatortype == false) {
$la... | [
"protected",
"function",
"get_field_locator",
"(",
"$",
"locatortype",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldlocator",
")",
")",
"{",
"return",
"$",
"this",
"->",
"fieldlocator",
";",
"}",
"$",
"fieldid",
"=",
"... | Gets the field locator.
Defaults to the field label but you can
specify other locators if you are interested.
Public visibility as in most cases will be hard to
use this method in a generic way, as fields can
be selected using multiple ways (label, id, name...).
@throws coding_exception
@param string $locatortype
@r... | [
"Gets",
"the",
"field",
"locator",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_field.php#L243-L285 |
217,692 | moodle/moodle | lib/phpexcel/PHPExcel/Chart/GridLines.php | PHPExcel_Chart_GridLines.setLineColorProperties | public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD)
{
$this->activateObject()
->lineProperties['color'] = $this->setColorProperties(
$value,
$alpha,
$type
);
} | php | public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD)
{
$this->activateObject()
->lineProperties['color'] = $this->setColorProperties(
$value,
$alpha,
$type
);
} | [
"public",
"function",
"setLineColorProperties",
"(",
"$",
"value",
",",
"$",
"alpha",
"=",
"0",
",",
"$",
"type",
"=",
"self",
"::",
"EXCEL_COLOR_TYPE_STANDARD",
")",
"{",
"$",
"this",
"->",
"activateObject",
"(",
")",
"->",
"lineProperties",
"[",
"'color'",... | Set Line Color Properties
@param string $value
@param int $alpha
@param string $type | [
"Set",
"Line",
"Color",
"Properties"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Chart/GridLines.php#L115-L123 |
217,693 | moodle/moodle | lib/phpexcel/PHPExcel/Chart/GridLines.php | PHPExcel_Chart_GridLines.setGlowProperties | public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
{
$this
->activateObject()
->setGlowSize($size)
->setGlowColor($color_value, $color_alpha, $color_type);
} | php | public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
{
$this
->activateObject()
->setGlowSize($size)
->setGlowColor($color_value, $color_alpha, $color_type);
} | [
"public",
"function",
"setGlowProperties",
"(",
"$",
"size",
",",
"$",
"color_value",
"=",
"null",
",",
"$",
"color_alpha",
"=",
"null",
",",
"$",
"color_type",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"activateObject",
"(",
")",
"->",
"setGlowSize",
"(... | Set Glow Properties
@param float $size
@param string $color_value
@param int $color_alpha
@param string $color_type | [
"Set",
"Glow",
"Properties"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Chart/GridLines.php#L207-L213 |
217,694 | moodle/moodle | lib/phpexcel/PHPExcel/Chart/GridLines.php | PHPExcel_Chart_GridLines.setSoftEdgesSize | public function setSoftEdgesSize($size)
{
if (!is_null($size)) {
$this->activateObject();
$softEdges['size'] = (string) $this->getExcelPointsWidth($size);
}
} | php | public function setSoftEdgesSize($size)
{
if (!is_null($size)) {
$this->activateObject();
$softEdges['size'] = (string) $this->getExcelPointsWidth($size);
}
} | [
"public",
"function",
"setSoftEdgesSize",
"(",
"$",
"size",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"size",
")",
")",
"{",
"$",
"this",
"->",
"activateObject",
"(",
")",
";",
"$",
"softEdges",
"[",
"'size'",
"]",
"=",
"(",
"string",
")",
"$"... | Set Soft Edges Size
@param float $size | [
"Set",
"Soft",
"Edges",
"Size"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Chart/GridLines.php#L455-L461 |
217,695 | moodle/moodle | course/classes/output/bulk_activity_completion_renderer.php | core_course_bulk_activity_completion_renderer.navigation | public function navigation($courseorid, $page) {
$tabs = core_completion\manager::get_available_completion_tabs($courseorid);
if (count($tabs) > 1) {
return $this->tabtree($tabs, $page);
} else {
return '';
}
} | php | public function navigation($courseorid, $page) {
$tabs = core_completion\manager::get_available_completion_tabs($courseorid);
if (count($tabs) > 1) {
return $this->tabtree($tabs, $page);
} else {
return '';
}
} | [
"public",
"function",
"navigation",
"(",
"$",
"courseorid",
",",
"$",
"page",
")",
"{",
"$",
"tabs",
"=",
"core_completion",
"\\",
"manager",
"::",
"get_available_completion_tabs",
"(",
"$",
"courseorid",
")",
";",
"if",
"(",
"count",
"(",
"$",
"tabs",
")"... | Render the navigation tabs for the completion page.
@param int|stdClass $courseorid the course object or id.
@param String $page the tab to focus.
@return string html | [
"Render",
"the",
"navigation",
"tabs",
"for",
"the",
"completion",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/output/bulk_activity_completion_renderer.php#L45-L52 |
217,696 | moodle/moodle | course/classes/output/bulk_activity_completion_renderer.php | core_course_bulk_activity_completion_renderer.edit_bulk_completion | public function edit_bulk_completion($form, $activities) {
ob_start();
$form->display();
$formhtml = ob_get_contents();
ob_end_clean();
$data = (object)[
'form' => $formhtml,
'activities' => array_values($activities),
'activitiescount' => coun... | php | public function edit_bulk_completion($form, $activities) {
ob_start();
$form->display();
$formhtml = ob_get_contents();
ob_end_clean();
$data = (object)[
'form' => $formhtml,
'activities' => array_values($activities),
'activitiescount' => coun... | [
"public",
"function",
"edit_bulk_completion",
"(",
"$",
"form",
",",
"$",
"activities",
")",
"{",
"ob_start",
"(",
")",
";",
"$",
"form",
"->",
"display",
"(",
")",
";",
"$",
"formhtml",
"=",
"ob_get_contents",
"(",
")",
";",
"ob_end_clean",
"(",
")",
... | Renders the form for bulk editing activities completion
@param moodleform $form
@param array $activities
@return string | [
"Renders",
"the",
"form",
"for",
"bulk",
"editing",
"activities",
"completion"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/output/bulk_activity_completion_renderer.php#L81-L93 |
217,697 | moodle/moodle | course/classes/output/bulk_activity_completion_renderer.php | core_course_bulk_activity_completion_renderer.edit_default_completion | public function edit_default_completion($form, $modules) {
ob_start();
$form->display();
$formhtml = ob_get_contents();
ob_end_clean();
$data = (object)[
'form' => $formhtml,
'modules' => array_values($modules),
'modulescount' => count($module... | php | public function edit_default_completion($form, $modules) {
ob_start();
$form->display();
$formhtml = ob_get_contents();
ob_end_clean();
$data = (object)[
'form' => $formhtml,
'modules' => array_values($modules),
'modulescount' => count($module... | [
"public",
"function",
"edit_default_completion",
"(",
"$",
"form",
",",
"$",
"modules",
")",
"{",
"ob_start",
"(",
")",
";",
"$",
"form",
"->",
"display",
"(",
")",
";",
"$",
"formhtml",
"=",
"ob_get_contents",
"(",
")",
";",
"ob_end_clean",
"(",
")",
... | Renders the form for editing default completion
@param moodleform $form
@param array $modules
@return string | [
"Renders",
"the",
"form",
"for",
"editing",
"default",
"completion"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/output/bulk_activity_completion_renderer.php#L102-L114 |
217,698 | moodle/moodle | cache/stores/mongodb/MongoDB/ChangeStream.php | ChangeStream.isResumableError | private function isResumableError(RuntimeException $exception)
{
if ($exception instanceof ConnectionException) {
return true;
}
if ( ! $exception instanceof ServerException) {
return false;
}
if (in_array($exception->getCode(), [self::$errorCodeCapp... | php | private function isResumableError(RuntimeException $exception)
{
if ($exception instanceof ConnectionException) {
return true;
}
if ( ! $exception instanceof ServerException) {
return false;
}
if (in_array($exception->getCode(), [self::$errorCodeCapp... | [
"private",
"function",
"isResumableError",
"(",
"RuntimeException",
"$",
"exception",
")",
"{",
"if",
"(",
"$",
"exception",
"instanceof",
"ConnectionException",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"!",
"$",
"exception",
"instanceof",
"ServerExcepti... | Determines if an exception is a resumable error.
@see https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.rst#resumable-error
@param RuntimeException $exception
@return boolean | [
"Determines",
"if",
"an",
"exception",
"is",
"a",
"resumable",
"error",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/ChangeStream.php#L200-L215 |
217,699 | moodle/moodle | cache/stores/mongodb/MongoDB/ChangeStream.php | ChangeStream.resume | private function resume()
{
$newChangeStream = call_user_func($this->resumeCallable, $this->resumeToken);
$this->csIt = $newChangeStream->csIt;
$this->csIt->rewind();
} | php | private function resume()
{
$newChangeStream = call_user_func($this->resumeCallable, $this->resumeToken);
$this->csIt = $newChangeStream->csIt;
$this->csIt->rewind();
} | [
"private",
"function",
"resume",
"(",
")",
"{",
"$",
"newChangeStream",
"=",
"call_user_func",
"(",
"$",
"this",
"->",
"resumeCallable",
",",
"$",
"this",
"->",
"resumeToken",
")",
";",
"$",
"this",
"->",
"csIt",
"=",
"$",
"newChangeStream",
"->",
"csIt",
... | Creates a new changeStream after a resumable server error.
@return void | [
"Creates",
"a",
"new",
"changeStream",
"after",
"a",
"resumable",
"server",
"error",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/ChangeStream.php#L222-L227 |
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.