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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
218,200 | moodle/moodle | tag/classes/external.php | core_tag_external.get_tag_areas | public static function get_tag_areas() {
global $CFG, $PAGE;
if (empty($CFG->usetags)) {
throw new moodle_exception('tagsaredisabled', 'tag');
}
$context = context_system::instance();
self::validate_context($context);
$PAGE->set_context($context); // Needed ... | php | public static function get_tag_areas() {
global $CFG, $PAGE;
if (empty($CFG->usetags)) {
throw new moodle_exception('tagsaredisabled', 'tag');
}
$context = context_system::instance();
self::validate_context($context);
$PAGE->set_context($context); // Needed ... | [
"public",
"static",
"function",
"get_tag_areas",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"usetags",
")",
")",
"{",
"throw",
"new",
"moodle_exception",
"(",
"'tagsaredisabled'",
",",
"'tag'",
... | Retrieves existing tag areas.
@return array an array of warnings and objects containing the plugin information
@throws moodle_exception
@since Moodle 3.7 | [
"Retrieves",
"existing",
"tag",
"areas",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/external.php#L474-L505 |
218,201 | moodle/moodle | tag/classes/external.php | core_tag_external.get_tag_collections | public static function get_tag_collections() {
global $CFG, $PAGE;
if (empty($CFG->usetags)) {
throw new moodle_exception('tagsaredisabled', 'tag');
}
$context = context_system::instance();
self::validate_context($context);
$PAGE->set_context($context); // N... | php | public static function get_tag_collections() {
global $CFG, $PAGE;
if (empty($CFG->usetags)) {
throw new moodle_exception('tagsaredisabled', 'tag');
}
$context = context_system::instance();
self::validate_context($context);
$PAGE->set_context($context); // N... | [
"public",
"static",
"function",
"get_tag_collections",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"usetags",
")",
")",
"{",
"throw",
"new",
"moodle_exception",
"(",
"'tagsaredisabled'",
",",
"'t... | Retrieves existing tag collections.
@return array an array of warnings and tag collections
@throws moodle_exception
@since Moodle 3.7 | [
"Retrieves",
"existing",
"tag",
"collections",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/external.php#L541-L564 |
218,202 | moodle/moodle | tag/classes/external.php | core_tag_external.get_tag_cloud | public static function get_tag_cloud($tagcollid = 0, $isstandard = false, $limit = 150, $sort = 'name',
$search = '', $fromctx = 0, $ctx = 0, $rec = 1) {
global $CFG, $PAGE;
$params = self::validate_parameters(self::get_tag_cloud_parameters(),
array(
'tagcollid' ... | php | public static function get_tag_cloud($tagcollid = 0, $isstandard = false, $limit = 150, $sort = 'name',
$search = '', $fromctx = 0, $ctx = 0, $rec = 1) {
global $CFG, $PAGE;
$params = self::validate_parameters(self::get_tag_cloud_parameters(),
array(
'tagcollid' ... | [
"public",
"static",
"function",
"get_tag_cloud",
"(",
"$",
"tagcollid",
"=",
"0",
",",
"$",
"isstandard",
"=",
"false",
",",
"$",
"limit",
"=",
"150",
",",
"$",
"sort",
"=",
"'name'",
",",
"$",
"search",
"=",
"''",
",",
"$",
"fromctx",
"=",
"0",
",... | Retrieves a tag cloud for display.
@param int $tagcollid tag collection id
@param bool $isstandard return only standard tags
@param int $limit maximum number of tags to retrieve, tags are sorted by the instance count
descending here regardless of $sort parameter
@param string $sort sort order for display, default 'nam... | [
"Retrieves",
"a",
"tag",
"cloud",
"for",
"display",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/external.php#L622-L655 |
218,203 | moodle/moodle | blocks/glossary_random/block_glossary_random.php | block_glossary_random.get_glossary_cm | protected function get_glossary_cm() {
global $DB;
if (empty($this->config->glossary)) {
// No glossary is configured.
return null;
}
if (!empty($this->glossarycm)) {
return $this->glossarycm;
}
if (!empty($this->page->course->id)) {
... | php | protected function get_glossary_cm() {
global $DB;
if (empty($this->config->glossary)) {
// No glossary is configured.
return null;
}
if (!empty($this->glossarycm)) {
return $this->glossarycm;
}
if (!empty($this->page->course->id)) {
... | [
"protected",
"function",
"get_glossary_cm",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"config",
"->",
"glossary",
")",
")",
"{",
"// No glossary is configured.",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"empt... | Checks if glossary is available - it should be either located in the same course or be global
@return null|cm_info|stdClass object with properties 'id' (course module id) and 'uservisible' | [
"Checks",
"if",
"glossary",
"is",
"available",
"-",
"it",
"should",
"be",
"either",
"located",
"in",
"the",
"same",
"course",
"or",
"be",
"global"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/glossary_random/block_glossary_random.php#L171-L215 |
218,204 | moodle/moodle | lib/jabber/XMPP/XMPP.php | XMPPHP_XMPP.sasl_success_handler | protected function sasl_success_handler($xml) {
$this->log->log("Auth success!");
$this->authed = true;
$this->reset();
} | php | protected function sasl_success_handler($xml) {
$this->log->log("Auth success!");
$this->authed = true;
$this->reset();
} | [
"protected",
"function",
"sasl_success_handler",
"(",
"$",
"xml",
")",
"{",
"$",
"this",
"->",
"log",
"->",
"log",
"(",
"\"Auth success!\"",
")",
";",
"$",
"this",
"->",
"authed",
"=",
"true",
";",
"$",
"this",
"->",
"reset",
"(",
")",
";",
"}"
] | SASL success handler
@param string $xml | [
"SASL",
"success",
"handler"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMPP.php#L295-L299 |
218,205 | moodle/moodle | lib/jabber/XMPP/XMPP.php | XMPPHP_XMPP.resource_bind_handler | protected function resource_bind_handler($xml) {
if($xml->attrs['type'] == 'result') {
$this->log->log("Bound to " . $xml->sub('bind')->sub('jid')->data);
$this->fulljid = $xml->sub('bind')->sub('jid')->data;
$jidarray = explode('/',$this->fulljid);
$this->jid = $jidarray[0];
}
$id = $this->getId();
... | php | protected function resource_bind_handler($xml) {
if($xml->attrs['type'] == 'result') {
$this->log->log("Bound to " . $xml->sub('bind')->sub('jid')->data);
$this->fulljid = $xml->sub('bind')->sub('jid')->data;
$jidarray = explode('/',$this->fulljid);
$this->jid = $jidarray[0];
}
$id = $this->getId();
... | [
"protected",
"function",
"resource_bind_handler",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"$",
"xml",
"->",
"attrs",
"[",
"'type'",
"]",
"==",
"'result'",
")",
"{",
"$",
"this",
"->",
"log",
"->",
"log",
"(",
"\"Bound to \"",
".",
"$",
"xml",
"->",
"su... | Resource bind handler
@param string $xml | [
"Resource",
"bind",
"handler"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMPP.php#L318-L328 |
218,206 | moodle/moodle | lib/jabber/XMPP/XMPP.php | XMPPHP_XMPP.session_start_handler | protected function session_start_handler($xml) {
$this->log->log("Session started");
$this->session_started = true;
$this->event('session_start');
} | php | protected function session_start_handler($xml) {
$this->log->log("Session started");
$this->session_started = true;
$this->event('session_start');
} | [
"protected",
"function",
"session_start_handler",
"(",
"$",
"xml",
")",
"{",
"$",
"this",
"->",
"log",
"->",
"log",
"(",
"\"Session started\"",
")",
";",
"$",
"this",
"->",
"session_started",
"=",
"true",
";",
"$",
"this",
"->",
"event",
"(",
"'session_sta... | Session start handler
@param string $xml | [
"Session",
"start",
"handler"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMPP.php#L379-L383 |
218,207 | moodle/moodle | lib/jabber/XMPP/XMPP.php | XMPPHP_XMPP.tls_proceed_handler | protected function tls_proceed_handler($xml) {
$this->log->log("Starting TLS encryption");
stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT);
$this->reset();
} | php | protected function tls_proceed_handler($xml) {
$this->log->log("Starting TLS encryption");
stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT);
$this->reset();
} | [
"protected",
"function",
"tls_proceed_handler",
"(",
"$",
"xml",
")",
"{",
"$",
"this",
"->",
"log",
"->",
"log",
"(",
"\"Starting TLS encryption\"",
")",
";",
"stream_socket_enable_crypto",
"(",
"$",
"this",
"->",
"socket",
",",
"true",
",",
"STREAM_CRYPTO_METH... | TLS proceed handler
@param string $xml | [
"TLS",
"proceed",
"handler"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMPP.php#L390-L394 |
218,208 | moodle/moodle | lib/jabber/XMPP/XMPP.php | XMPPHP_XMPP.getVCard | public function getVCard($jid = Null) {
$id = $this->getID();
$this->addIdHandler($id, 'vcard_get_handler');
if($jid) {
$this->send("<iq type='get' id='$id' to='$jid'><vCard xmlns='vcard-temp' /></iq>");
} else {
$this->send("<iq type='get' id='$id'><vCard xmlns='vcard-temp' /></iq>");
}
} | php | public function getVCard($jid = Null) {
$id = $this->getID();
$this->addIdHandler($id, 'vcard_get_handler');
if($jid) {
$this->send("<iq type='get' id='$id' to='$jid'><vCard xmlns='vcard-temp' /></iq>");
} else {
$this->send("<iq type='get' id='$id'><vCard xmlns='vcard-temp' /></iq>");
}
} | [
"public",
"function",
"getVCard",
"(",
"$",
"jid",
"=",
"Null",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getID",
"(",
")",
";",
"$",
"this",
"->",
"addIdHandler",
"(",
"$",
"id",
",",
"'vcard_get_handler'",
")",
";",
"if",
"(",
"$",
"jid",
"... | Retrieves the vcard | [
"Retrieves",
"the",
"vcard"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMPP.php#L400-L408 |
218,209 | moodle/moodle | lib/jabber/XMPP/XMPP.php | XMPPHP_XMPP.vcard_get_handler | protected function vcard_get_handler($xml) {
$vcard_array = array();
$vcard = $xml->sub('vcard');
// go through all of the sub elements and add them to the vcard array
foreach ($vcard->subs as $sub) {
if ($sub->subs) {
$vcard_array[$sub->name] = array();
foreach ($sub->subs as $sub_child) {
$vca... | php | protected function vcard_get_handler($xml) {
$vcard_array = array();
$vcard = $xml->sub('vcard');
// go through all of the sub elements and add them to the vcard array
foreach ($vcard->subs as $sub) {
if ($sub->subs) {
$vcard_array[$sub->name] = array();
foreach ($sub->subs as $sub_child) {
$vca... | [
"protected",
"function",
"vcard_get_handler",
"(",
"$",
"xml",
")",
"{",
"$",
"vcard_array",
"=",
"array",
"(",
")",
";",
"$",
"vcard",
"=",
"$",
"xml",
"->",
"sub",
"(",
"'vcard'",
")",
";",
"// go through all of the sub elements and add them to the vcard array",... | VCard retrieval handler
@param XML Object $xml | [
"VCard",
"retrieval",
"handler"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMPP.php#L415-L431 |
218,210 | moodle/moodle | admin/tool/recyclebin/classes/category_bin.php | category_bin.get_item | public function get_item($itemid) {
global $DB;
$item = $DB->get_record('tool_recyclebin_category', array(
'id' => $itemid
), '*', MUST_EXIST);
$item->name = get_course_display_name_for_list($item);
return $item;
} | php | public function get_item($itemid) {
global $DB;
$item = $DB->get_record('tool_recyclebin_category', array(
'id' => $itemid
), '*', MUST_EXIST);
$item->name = get_course_display_name_for_list($item);
return $item;
} | [
"public",
"function",
"get_item",
"(",
"$",
"itemid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"item",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'tool_recyclebin_category'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"itemid",
")",
",",
"'*'",
",",
"MUST_EX... | Returns an item from the recycle bin.
@param int $itemid Item ID to retrieve.
@return \stdClass the item. | [
"Returns",
"an",
"item",
"from",
"the",
"recycle",
"bin",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/recyclebin/classes/category_bin.php#L69-L79 |
218,211 | moodle/moodle | admin/tool/recyclebin/classes/category_bin.php | category_bin.get_items | public function get_items() {
global $DB;
$items = $DB->get_records('tool_recyclebin_category', array(
'categoryid' => $this->_categoryid
));
foreach ($items as $item) {
$item->name = get_course_display_name_for_list($item);
}
return $items;
... | php | public function get_items() {
global $DB;
$items = $DB->get_records('tool_recyclebin_category', array(
'categoryid' => $this->_categoryid
));
foreach ($items as $item) {
$item->name = get_course_display_name_for_list($item);
}
return $items;
... | [
"public",
"function",
"get_items",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"items",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"'tool_recyclebin_category'",
",",
"array",
"(",
"'categoryid'",
"=>",
"$",
"this",
"->",
"_categoryid",
")",
")",
";",
"f... | Returns a list of items in the recycle bin for this course.
@return array the list of items. | [
"Returns",
"a",
"list",
"of",
"items",
"in",
"the",
"recycle",
"bin",
"for",
"this",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/recyclebin/classes/category_bin.php#L86-L98 |
218,212 | moodle/moodle | admin/tool/recyclebin/classes/category_bin.php | category_bin.store_item | public function store_item($course) {
global $CFG, $DB;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
// As far as recycle bin is using MODE_AUTOMATED, it observes the backup_auto_storage
// setting (storing backups @ real location. For recycle bin we want ... | php | public function store_item($course) {
global $CFG, $DB;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
// As far as recycle bin is using MODE_AUTOMATED, it observes the backup_auto_storage
// setting (storing backups @ real location. For recycle bin we want ... | [
"public",
"function",
"store_item",
"(",
"$",
"course",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/backup/util/includes/backup_includes.php'",
")",
";",
"// As far as recycle bin is using MODE_AUTOM... | Store a course in the recycle bin.
@param \stdClass $course Course
@throws \moodle_exception | [
"Store",
"a",
"course",
"in",
"the",
"recycle",
"bin",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/recyclebin/classes/category_bin.php#L106-L189 |
218,213 | moodle/moodle | user/classes/participants_table.php | participants_table.out | public function out($pagesize, $useinitialsbar, $downloadhelpbutton = '') {
global $PAGE;
parent::out($pagesize, $useinitialsbar, $downloadhelpbutton);
if (has_capability('moodle/course:enrolreview', $this->context)) {
$params = ['contextid' => $this->context->id, 'courseid' => $th... | php | public function out($pagesize, $useinitialsbar, $downloadhelpbutton = '') {
global $PAGE;
parent::out($pagesize, $useinitialsbar, $downloadhelpbutton);
if (has_capability('moodle/course:enrolreview', $this->context)) {
$params = ['contextid' => $this->context->id, 'courseid' => $th... | [
"public",
"function",
"out",
"(",
"$",
"pagesize",
",",
"$",
"useinitialsbar",
",",
"$",
"downloadhelpbutton",
"=",
"''",
")",
"{",
"global",
"$",
"PAGE",
";",
"parent",
"::",
"out",
"(",
"$",
"pagesize",
",",
"$",
"useinitialsbar",
",",
"$",
"downloadhe... | Render the participants table.
@param int $pagesize Size of page for paginated displayed table.
@param bool $useinitialsbar Whether to use the initials bar which will only be used if there is a fullname column defined.
@param string $downloadhelpbutton | [
"Render",
"the",
"participants",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/participants_table.php#L251-L260 |
218,214 | moodle/moodle | user/classes/participants_table.php | participants_table.col_fullname | public function col_fullname($data) {
global $OUTPUT;
return $OUTPUT->user_picture($data, array('size' => 35, 'courseid' => $this->course->id, 'includefullname' => true));
} | php | public function col_fullname($data) {
global $OUTPUT;
return $OUTPUT->user_picture($data, array('size' => 35, 'courseid' => $this->course->id, 'includefullname' => true));
} | [
"public",
"function",
"col_fullname",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"return",
"$",
"OUTPUT",
"->",
"user_picture",
"(",
"$",
"data",
",",
"array",
"(",
"'size'",
"=>",
"35",
",",
"'courseid'",
"=>",
"$",
"this",
"->",
"cours... | Generate the fullname column.
@param \stdClass $data
@return string | [
"Generate",
"the",
"fullname",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/participants_table.php#L283-L287 |
218,215 | moodle/moodle | user/classes/participants_table.php | participants_table.col_roles | public function col_roles($data) {
global $OUTPUT;
$roles = isset($this->allroleassignments[$data->id]) ? $this->allroleassignments[$data->id] : [];
$editable = new \core_user\output\user_roles_editable($this->course,
$this->context,... | php | public function col_roles($data) {
global $OUTPUT;
$roles = isset($this->allroleassignments[$data->id]) ? $this->allroleassignments[$data->id] : [];
$editable = new \core_user\output\user_roles_editable($this->course,
$this->context,... | [
"public",
"function",
"col_roles",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"roles",
"=",
"isset",
"(",
"$",
"this",
"->",
"allroleassignments",
"[",
"$",
"data",
"->",
"id",
"]",
")",
"?",
"$",
"this",
"->",
"allroleassignments",... | User roles column.
@param \stdClass $data
@return string | [
"User",
"roles",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/participants_table.php#L295-L309 |
218,216 | moodle/moodle | user/classes/participants_table.php | participants_table.col_groups | public function col_groups($data) {
global $OUTPUT;
$usergroups = [];
foreach ($this->groups as $coursegroup) {
if (isset($coursegroup->members[$data->id])) {
$usergroups[] = $coursegroup->id;
}
}
$editable = new \core_group\output\user_gr... | php | public function col_groups($data) {
global $OUTPUT;
$usergroups = [];
foreach ($this->groups as $coursegroup) {
if (isset($coursegroup->members[$data->id])) {
$usergroups[] = $coursegroup->id;
}
}
$editable = new \core_group\output\user_gr... | [
"public",
"function",
"col_groups",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"usergroups",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"groups",
"as",
"$",
"coursegroup",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"cou... | Generate the groups column.
@param \stdClass $data
@return string | [
"Generate",
"the",
"groups",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/participants_table.php#L317-L328 |
218,217 | moodle/moodle | user/classes/participants_table.php | participants_table.col_status | public function col_status($data) {
global $CFG, $OUTPUT, $PAGE;
$enrolstatusoutput = '';
$canreviewenrol = has_capability('moodle/course:enrolreview', $this->context);
if ($canreviewenrol) {
$canviewfullnames = has_capability('moodle/site:viewfullnames', $this->context);
... | php | public function col_status($data) {
global $CFG, $OUTPUT, $PAGE;
$enrolstatusoutput = '';
$canreviewenrol = has_capability('moodle/course:enrolreview', $this->context);
if ($canreviewenrol) {
$canviewfullnames = has_capability('moodle/site:viewfullnames', $this->context);
... | [
"public",
"function",
"col_status",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"OUTPUT",
",",
"$",
"PAGE",
";",
"$",
"enrolstatusoutput",
"=",
"''",
";",
"$",
"canreviewenrol",
"=",
"has_capability",
"(",
"'moodle/course:enrolreview'",
",",
... | Generate the status column.
@param \stdClass $data The data object.
@return string | [
"Generate",
"the",
"status",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/participants_table.php#L363-L410 |
218,218 | moodle/moodle | user/classes/participants_table.php | participants_table.other_cols | public function other_cols($colname, $data) {
// Do not process if it is not a part of the extra fields.
if (!in_array($colname, $this->extrafields)) {
return '';
}
return s($data->{$colname});
} | php | public function other_cols($colname, $data) {
// Do not process if it is not a part of the extra fields.
if (!in_array($colname, $this->extrafields)) {
return '';
}
return s($data->{$colname});
} | [
"public",
"function",
"other_cols",
"(",
"$",
"colname",
",",
"$",
"data",
")",
"{",
"// Do not process if it is not a part of the extra fields.",
"if",
"(",
"!",
"in_array",
"(",
"$",
"colname",
",",
"$",
"this",
"->",
"extrafields",
")",
")",
"{",
"return",
... | This function is used for the extra user fields.
These are being dynamically added to the table so there are no functions 'col_<userfieldname>' as
the list has the potential to increase in the future and we don't want to have to remember to add
a new method to this class. We also don't want to pollute this class with ... | [
"This",
"function",
"is",
"used",
"for",
"the",
"extra",
"user",
"fields",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/participants_table.php#L423-L430 |
218,219 | moodle/moodle | mod/workshop/form/accumulative/backup/moodle2/restore_workshopform_accumulative_subplugin.class.php | restore_workshopform_accumulative_subplugin.define_referenceassessment_subplugin_structure | protected function define_referenceassessment_subplugin_structure() {
$paths = array();
$elename = $this->get_namefor('referencegrade');
$elepath = $this->get_pathfor('/workshopform_accumulative_referencegrade'); // we used get_recommended_name() so this works
$paths[] = new restore_pa... | php | protected function define_referenceassessment_subplugin_structure() {
$paths = array();
$elename = $this->get_namefor('referencegrade');
$elepath = $this->get_pathfor('/workshopform_accumulative_referencegrade'); // we used get_recommended_name() so this works
$paths[] = new restore_pa... | [
"protected",
"function",
"define_referenceassessment_subplugin_structure",
"(",
")",
"{",
"$",
"paths",
"=",
"array",
"(",
")",
";",
"$",
"elename",
"=",
"$",
"this",
"->",
"get_namefor",
"(",
"'referencegrade'",
")",
";",
"$",
"elepath",
"=",
"$",
"this",
"... | Returns the paths to be handled by the subplugin at referenceassessment level | [
"Returns",
"the",
"paths",
"to",
"be",
"handled",
"by",
"the",
"subplugin",
"at",
"referenceassessment",
"level"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/form/accumulative/backup/moodle2/restore_workshopform_accumulative_subplugin.class.php#L53-L62 |
218,220 | moodle/moodle | mod/workshop/form/accumulative/backup/moodle2/restore_workshopform_accumulative_subplugin.class.php | restore_workshopform_accumulative_subplugin.define_exampleassessment_subplugin_structure | protected function define_exampleassessment_subplugin_structure() {
$paths = array();
$elename = $this->get_namefor('examplegrade');
$elepath = $this->get_pathfor('/workshopform_accumulative_examplegrade'); // we used get_recommended_name() so this works
$paths[] = new restore_path_ele... | php | protected function define_exampleassessment_subplugin_structure() {
$paths = array();
$elename = $this->get_namefor('examplegrade');
$elepath = $this->get_pathfor('/workshopform_accumulative_examplegrade'); // we used get_recommended_name() so this works
$paths[] = new restore_path_ele... | [
"protected",
"function",
"define_exampleassessment_subplugin_structure",
"(",
")",
"{",
"$",
"paths",
"=",
"array",
"(",
")",
";",
"$",
"elename",
"=",
"$",
"this",
"->",
"get_namefor",
"(",
"'examplegrade'",
")",
";",
"$",
"elepath",
"=",
"$",
"this",
"->",... | Returns the paths to be handled by the subplugin at exampleassessment level | [
"Returns",
"the",
"paths",
"to",
"be",
"handled",
"by",
"the",
"subplugin",
"at",
"exampleassessment",
"level"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/form/accumulative/backup/moodle2/restore_workshopform_accumulative_subplugin.class.php#L67-L76 |
218,221 | moodle/moodle | mod/workshop/form/accumulative/backup/moodle2/restore_workshopform_accumulative_subplugin.class.php | restore_workshopform_accumulative_subplugin.define_assessment_subplugin_structure | protected function define_assessment_subplugin_structure() {
$paths = array();
$elename = $this->get_namefor('grade');
$elepath = $this->get_pathfor('/workshopform_accumulative_grade'); // we used get_recommended_name() so this works
$paths[] = new restore_path_element($elename, $elepa... | php | protected function define_assessment_subplugin_structure() {
$paths = array();
$elename = $this->get_namefor('grade');
$elepath = $this->get_pathfor('/workshopform_accumulative_grade'); // we used get_recommended_name() so this works
$paths[] = new restore_path_element($elename, $elepa... | [
"protected",
"function",
"define_assessment_subplugin_structure",
"(",
")",
"{",
"$",
"paths",
"=",
"array",
"(",
")",
";",
"$",
"elename",
"=",
"$",
"this",
"->",
"get_namefor",
"(",
"'grade'",
")",
";",
"$",
"elepath",
"=",
"$",
"this",
"->",
"get_pathfo... | Returns the paths to be handled by the subplugin at assessment level | [
"Returns",
"the",
"paths",
"to",
"be",
"handled",
"by",
"the",
"subplugin",
"at",
"assessment",
"level"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/form/accumulative/backup/moodle2/restore_workshopform_accumulative_subplugin.class.php#L81-L90 |
218,222 | moodle/moodle | mod/workshop/form/accumulative/backup/moodle2/restore_workshopform_accumulative_subplugin.class.php | restore_workshopform_accumulative_subplugin.process_workshopform_accumulative_dimension | public function process_workshopform_accumulative_dimension($data) {
global $DB;
$data = (object)$data;
$oldid = $data->id;
$data->workshopid = $this->get_new_parentid('workshop');
if ($data->grade < 0) { // scale found, get mapping
$data->grade = -($this->get_mappi... | php | public function process_workshopform_accumulative_dimension($data) {
global $DB;
$data = (object)$data;
$oldid = $data->id;
$data->workshopid = $this->get_new_parentid('workshop');
if ($data->grade < 0) { // scale found, get mapping
$data->grade = -($this->get_mappi... | [
"public",
"function",
"process_workshopform_accumulative_dimension",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"(",
"object",
")",
"$",
"data",
";",
"$",
"oldid",
"=",
"$",
"data",
"->",
"id",
";",
"$",
"data",
"->",
"work... | Processes the workshopform_accumulative_dimension element | [
"Processes",
"the",
"workshopform_accumulative_dimension",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/form/accumulative/backup/moodle2/restore_workshopform_accumulative_subplugin.class.php#L99-L115 |
218,223 | moodle/moodle | grade/grading/lib.php | grading_manager.set_component | public function set_component($component) {
$this->areacache = null;
list($type, $name) = core_component::normalize_component($component);
$this->component = $type.'_'.$name;
} | php | public function set_component($component) {
$this->areacache = null;
list($type, $name) = core_component::normalize_component($component);
$this->component = $type.'_'.$name;
} | [
"public",
"function",
"set_component",
"(",
"$",
"component",
")",
"{",
"$",
"this",
"->",
"areacache",
"=",
"null",
";",
"list",
"(",
"$",
"type",
",",
"$",
"name",
")",
"=",
"core_component",
"::",
"normalize_component",
"(",
"$",
"component",
")",
";"... | Sets the component the manager operates on
@param string $component the frankenstyle name of the component | [
"Sets",
"the",
"component",
"the",
"manager",
"operates",
"on"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L140-L144 |
218,224 | moodle/moodle | grade/grading/lib.php | grading_manager.get_component_title | public function get_component_title() {
$this->ensure_isset(array('context', 'component'));
if ($this->get_context()->contextlevel == CONTEXT_SYSTEM) {
if ($this->get_component() == 'core_grading') {
$title = ''; // we are in the bank UI
} else {
... | php | public function get_component_title() {
$this->ensure_isset(array('context', 'component'));
if ($this->get_context()->contextlevel == CONTEXT_SYSTEM) {
if ($this->get_component() == 'core_grading') {
$title = ''; // we are in the bank UI
} else {
... | [
"public",
"function",
"get_component_title",
"(",
")",
"{",
"$",
"this",
"->",
"ensure_isset",
"(",
"array",
"(",
"'context'",
",",
"'component'",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"get_context",
"(",
")",
"->",
"contextlevel",
"==",
"CONTEXT_SY... | Returns a text describing the context and the component
At the moment this works for gradable areas in course modules. In the future, this
method should be improved so it works for other contexts (blocks, gradebook items etc)
or subplugins.
@return string | [
"Returns",
"a",
"text",
"describing",
"the",
"context",
"and",
"the",
"component"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L174-L200 |
218,225 | moodle/moodle | grade/grading/lib.php | grading_manager.get_area_title | public function get_area_title() {
if ($this->get_context()->contextlevel == CONTEXT_SYSTEM) {
return '';
} else if ($this->get_context()->contextlevel >= CONTEXT_COURSE) {
$this->ensure_isset(array('context', 'component', 'area'));
$areas = $this->get_available_are... | php | public function get_area_title() {
if ($this->get_context()->contextlevel == CONTEXT_SYSTEM) {
return '';
} else if ($this->get_context()->contextlevel >= CONTEXT_COURSE) {
$this->ensure_isset(array('context', 'component', 'area'));
$areas = $this->get_available_are... | [
"public",
"function",
"get_area_title",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"get_context",
"(",
")",
"->",
"contextlevel",
"==",
"CONTEXT_SYSTEM",
")",
"{",
"return",
"''",
";",
"}",
"else",
"if",
"(",
"$",
"this",
"->",
"get_context",
"(",
")... | Returns the localized title of the currently set area
@return string | [
"Returns",
"the",
"localized",
"title",
"of",
"the",
"currently",
"set",
"area"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L207-L225 |
218,226 | moodle/moodle | grade/grading/lib.php | grading_manager.load | public function load($areaid) {
global $DB;
$this->areacache = $DB->get_record('grading_areas', array('id' => $areaid), '*', MUST_EXIST);
$this->context = context::instance_by_id($this->areacache->contextid, MUST_EXIST);
$this->component = $this->areacache->component;
$this->are... | php | public function load($areaid) {
global $DB;
$this->areacache = $DB->get_record('grading_areas', array('id' => $areaid), '*', MUST_EXIST);
$this->context = context::instance_by_id($this->areacache->contextid, MUST_EXIST);
$this->component = $this->areacache->component;
$this->are... | [
"public",
"function",
"load",
"(",
"$",
"areaid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"areacache",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'grading_areas'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"areaid",
")",
",",
"'*'",
",",
... | Loads the gradable area info from the database
@param int $areaid | [
"Loads",
"the",
"gradable",
"area",
"info",
"from",
"the",
"database"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L232-L239 |
218,227 | moodle/moodle | grade/grading/lib.php | grading_manager.available_methods | public static function available_methods($includenone = true) {
if ($includenone) {
$list = array('' => get_string('gradingmethodnone', 'core_grading'));
} else {
$list = array();
}
foreach (core_component::get_plugin_list('gradingform') as $name => $location) {... | php | public static function available_methods($includenone = true) {
if ($includenone) {
$list = array('' => get_string('gradingmethodnone', 'core_grading'));
} else {
$list = array();
}
foreach (core_component::get_plugin_list('gradingform') as $name => $location) {... | [
"public",
"static",
"function",
"available_methods",
"(",
"$",
"includenone",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"includenone",
")",
"{",
"$",
"list",
"=",
"array",
"(",
"''",
"=>",
"get_string",
"(",
"'gradingmethodnone'",
",",
"'core_grading'",
")",
... | Returns the list of installed grading plugins together, optionally extended
with a simple direct grading.
@param bool $includenone should the 'Simple direct grading' be included
@return array of the (string)name => (string)localized title of the method | [
"Returns",
"the",
"list",
"of",
"installed",
"grading",
"plugins",
"together",
"optionally",
"extended",
"with",
"a",
"simple",
"direct",
"grading",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L248-L261 |
218,228 | moodle/moodle | grade/grading/lib.php | grading_manager.available_areas | public static function available_areas($component) {
global $CFG;
list($plugintype, $pluginname) = core_component::normalize_component($component);
if ($component === 'core_grading') {
return array();
} else if ($plugintype === 'mod') {
return plugin_callback('... | php | public static function available_areas($component) {
global $CFG;
list($plugintype, $pluginname) = core_component::normalize_component($component);
if ($component === 'core_grading') {
return array();
} else if ($plugintype === 'mod') {
return plugin_callback('... | [
"public",
"static",
"function",
"available_areas",
"(",
"$",
"component",
")",
"{",
"global",
"$",
"CFG",
";",
"list",
"(",
"$",
"plugintype",
",",
"$",
"pluginname",
")",
"=",
"core_component",
"::",
"normalize_component",
"(",
"$",
"component",
")",
";",
... | Returns the list of gradable areas provided by the given component
This performs a callback to the library of the relevant plugin to obtain
the list of supported areas.
@param string $component normalized component name
@return array of (string)areacode => (string)localized title of the area | [
"Returns",
"the",
"list",
"of",
"gradable",
"areas",
"provided",
"by",
"the",
"given",
"component"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L288-L302 |
218,229 | moodle/moodle | grade/grading/lib.php | grading_manager.get_available_areas | public function get_available_areas() {
global $CFG;
$this->ensure_isset(array('context', 'component'));
if ($this->get_context()->contextlevel == CONTEXT_SYSTEM) {
if ($this->get_component() !== 'core_grading') {
throw new coding_exception('Unsupported component at... | php | public function get_available_areas() {
global $CFG;
$this->ensure_isset(array('context', 'component'));
if ($this->get_context()->contextlevel == CONTEXT_SYSTEM) {
if ($this->get_component() !== 'core_grading') {
throw new coding_exception('Unsupported component at... | [
"public",
"function",
"get_available_areas",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"this",
"->",
"ensure_isset",
"(",
"array",
"(",
"'context'",
",",
"'component'",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"get_context",
"(",
")",
"->",
"c... | Returns the list of gradable areas in the given context and component
This performs a callback to the library of the relevant plugin to obtain
the list of supported areas.
@return array of (string)areacode => (string)localized title of the area | [
"Returns",
"the",
"list",
"of",
"gradable",
"areas",
"in",
"the",
"given",
"context",
"and",
"component"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L312-L331 |
218,230 | moodle/moodle | grade/grading/lib.php | grading_manager.get_active_method | public function get_active_method() {
global $DB;
$this->ensure_isset(array('context', 'component', 'area'));
// get the current grading area record if it exists
if (is_null($this->areacache)) {
$this->areacache = $DB->get_record('grading_areas', array(
'con... | php | public function get_active_method() {
global $DB;
$this->ensure_isset(array('context', 'component', 'area'));
// get the current grading area record if it exists
if (is_null($this->areacache)) {
$this->areacache = $DB->get_record('grading_areas', array(
'con... | [
"public",
"function",
"get_active_method",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"ensure_isset",
"(",
"array",
"(",
"'context'",
",",
"'component'",
",",
"'area'",
")",
")",
";",
"// get the current grading area record if it exists",
"if",
... | Returns the currently active grading method in the gradable area
@return string|null the name of the grading plugin of null if it has not been set | [
"Returns",
"the",
"currently",
"active",
"grading",
"method",
"in",
"the",
"gradable",
"area"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L338-L358 |
218,231 | moodle/moodle | grade/grading/lib.php | grading_manager.set_active_method | public function set_active_method($method) {
global $DB;
$this->ensure_isset(array('context', 'component', 'area'));
// make sure the passed method is empty or a valid plugin name
if (empty($method)) {
$method = null;
} else {
if ('gradingform_'.$method ... | php | public function set_active_method($method) {
global $DB;
$this->ensure_isset(array('context', 'component', 'area'));
// make sure the passed method is empty or a valid plugin name
if (empty($method)) {
$method = null;
} else {
if ('gradingform_'.$method ... | [
"public",
"function",
"set_active_method",
"(",
"$",
"method",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"ensure_isset",
"(",
"array",
"(",
"'context'",
",",
"'component'",
",",
"'area'",
")",
")",
";",
"// make sure the passed method is empty or a ... | Sets the currently active grading method in the gradable area
@param string $method the method name, eg 'rubric' (must be available)
@return bool true if the method changed or was just set, false otherwise | [
"Sets",
"the",
"currently",
"active",
"grading",
"method",
"in",
"the",
"gradable",
"area"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L366-L416 |
218,232 | moodle/moodle | grade/grading/lib.php | grading_manager.extend_settings_navigation | public function extend_settings_navigation(settings_navigation $settingsnav, navigation_node $modulenode=null) {
$this->ensure_isset(array('context', 'component'));
$areas = $this->get_available_areas();
if (empty($areas)) {
// no money, no funny
return;
} els... | php | public function extend_settings_navigation(settings_navigation $settingsnav, navigation_node $modulenode=null) {
$this->ensure_isset(array('context', 'component'));
$areas = $this->get_available_areas();
if (empty($areas)) {
// no money, no funny
return;
} els... | [
"public",
"function",
"extend_settings_navigation",
"(",
"settings_navigation",
"$",
"settingsnav",
",",
"navigation_node",
"$",
"modulenode",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"ensure_isset",
"(",
"array",
"(",
"'context'",
",",
"'component'",
")",
")",
... | Extends the settings navigation with the grading settings
This function is called when the context for the page is an activity module with the
FEATURE_ADVANCED_GRADING and the user has the permission moodle/grade:managegradingforms.
@param settings_navigation $settingsnav {@link settings_navigation}
@param navigation... | [
"Extends",
"the",
"settings",
"navigation",
"with",
"the",
"grading",
"settings"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L427-L465 |
218,233 | moodle/moodle | grade/grading/lib.php | grading_manager.extend_navigation | public function extend_navigation(global_navigation $navigation, navigation_node $modulenode=null) {
$this->ensure_isset(array('context', 'component'));
$areas = $this->get_available_areas();
foreach ($areas as $areaname => $areatitle) {
$this->set_area($areaname);
if ($... | php | public function extend_navigation(global_navigation $navigation, navigation_node $modulenode=null) {
$this->ensure_isset(array('context', 'component'));
$areas = $this->get_available_areas();
foreach ($areas as $areaname => $areatitle) {
$this->set_area($areaname);
if ($... | [
"public",
"function",
"extend_navigation",
"(",
"global_navigation",
"$",
"navigation",
",",
"navigation_node",
"$",
"modulenode",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"ensure_isset",
"(",
"array",
"(",
"'context'",
",",
"'component'",
")",
")",
";",
"$",... | Extends the module navigation with the advanced grading information
This function is called when the context for the page is an activity module with the
FEATURE_ADVANCED_GRADING.
@param global_navigation $navigation
@param navigation_node $modulenode | [
"Extends",
"the",
"module",
"navigation",
"with",
"the",
"advanced",
"grading",
"information"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L476-L486 |
218,234 | moodle/moodle | grade/grading/lib.php | grading_manager.get_controller | public function get_controller($method) {
global $CFG, $DB;
$this->ensure_isset(array('context', 'component', 'area'));
// make sure the passed method is a valid plugin name
if ('gradingform_'.$method !== clean_param('gradingform_'.$method, PARAM_COMPONENT)) {
throw new moo... | php | public function get_controller($method) {
global $CFG, $DB;
$this->ensure_isset(array('context', 'component', 'area'));
// make sure the passed method is a valid plugin name
if ('gradingform_'.$method !== clean_param('gradingform_'.$method, PARAM_COMPONENT)) {
throw new moo... | [
"public",
"function",
"get_controller",
"(",
"$",
"method",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"this",
"->",
"ensure_isset",
"(",
"array",
"(",
"'context'",
",",
"'component'",
",",
"'area'",
")",
")",
";",
"// make sure the passed m... | Returns the given method's controller in the gradable area
@param string $method the method name, eg 'rubric' (must be available)
@return gradingform_controller | [
"Returns",
"the",
"given",
"method",
"s",
"controller",
"in",
"the",
"gradable",
"area"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L494-L532 |
218,235 | moodle/moodle | grade/grading/lib.php | grading_manager.get_active_controller | public function get_active_controller() {
if ($gradingmethod = $this->get_active_method()) {
$controller = $this->get_controller($gradingmethod);
if ($controller->is_form_available()) {
return $controller;
}
}
return null;
} | php | public function get_active_controller() {
if ($gradingmethod = $this->get_active_method()) {
$controller = $this->get_controller($gradingmethod);
if ($controller->is_form_available()) {
return $controller;
}
}
return null;
} | [
"public",
"function",
"get_active_controller",
"(",
")",
"{",
"if",
"(",
"$",
"gradingmethod",
"=",
"$",
"this",
"->",
"get_active_method",
"(",
")",
")",
"{",
"$",
"controller",
"=",
"$",
"this",
"->",
"get_controller",
"(",
"$",
"gradingmethod",
")",
";"... | Returns the controller for the active method if it is available
@return null|gradingform_controller | [
"Returns",
"the",
"controller",
"for",
"the",
"active",
"method",
"if",
"it",
"is",
"available"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L539-L547 |
218,236 | moodle/moodle | grade/grading/lib.php | grading_manager.get_management_url | public function get_management_url(moodle_url $returnurl = null) {
$this->ensure_isset(array('context', 'component'));
if ($this->areacache) {
$params = array('areaid' => $this->areacache->id);
} else {
$params = array('contextid' => $this->context->id, 'component' => $... | php | public function get_management_url(moodle_url $returnurl = null) {
$this->ensure_isset(array('context', 'component'));
if ($this->areacache) {
$params = array('areaid' => $this->areacache->id);
} else {
$params = array('contextid' => $this->context->id, 'component' => $... | [
"public",
"function",
"get_management_url",
"(",
"moodle_url",
"$",
"returnurl",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"ensure_isset",
"(",
"array",
"(",
"'context'",
",",
"'component'",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"areacache",
")",
... | Returns the URL of the grading area management page
@param moodle_url $returnurl optional URL of the page where the user should be sent back to
@return moodle_url | [
"Returns",
"the",
"URL",
"of",
"the",
"grading",
"area",
"management",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L555-L573 |
218,237 | moodle/moodle | grade/grading/lib.php | grading_manager.create_shared_area | public function create_shared_area($method) {
global $DB;
// generate some unique random name for the new area
$name = $method . '_' . sha1(rand().uniqid($method, true));
// create new area record
$area = array(
'contextid' => context_system::instance()->id,
... | php | public function create_shared_area($method) {
global $DB;
// generate some unique random name for the new area
$name = $method . '_' . sha1(rand().uniqid($method, true));
// create new area record
$area = array(
'contextid' => context_system::instance()->id,
... | [
"public",
"function",
"create_shared_area",
"(",
"$",
"method",
")",
"{",
"global",
"$",
"DB",
";",
"// generate some unique random name for the new area",
"$",
"name",
"=",
"$",
"method",
".",
"'_'",
".",
"sha1",
"(",
"rand",
"(",
")",
".",
"uniqid",
"(",
"... | Creates a new shared area to hold a grading form template
Shared area are implemented as virtual gradable areas at the system level context
with the component set to core_grading and unique random area name.
@param string $method the name of the plugin we create the area for
@return int the new area id | [
"Creates",
"a",
"new",
"shared",
"area",
"to",
"hold",
"a",
"grading",
"form",
"template"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L584-L596 |
218,238 | moodle/moodle | grade/grading/lib.php | grading_manager.delete_all_for_context | public static function delete_all_for_context($contextid) {
global $DB;
$areaids = $DB->get_fieldset_select('grading_areas', 'id', 'contextid = ?', array($contextid));
$methods = array_keys(self::available_methods(false));
foreach($areaids as $areaid) {
$manager = get_gradi... | php | public static function delete_all_for_context($contextid) {
global $DB;
$areaids = $DB->get_fieldset_select('grading_areas', 'id', 'contextid = ?', array($contextid));
$methods = array_keys(self::available_methods(false));
foreach($areaids as $areaid) {
$manager = get_gradi... | [
"public",
"static",
"function",
"delete_all_for_context",
"(",
"$",
"contextid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"areaids",
"=",
"$",
"DB",
"->",
"get_fieldset_select",
"(",
"'grading_areas'",
",",
"'id'",
",",
"'contextid = ?'",
",",
"array",
"(",
... | Removes all data associated with the given context
This is called by {@link context::delete_content()}
@param int $contextid context id | [
"Removes",
"all",
"data",
"associated",
"with",
"the",
"given",
"context"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L605-L620 |
218,239 | moodle/moodle | grade/grading/lib.php | grading_manager.tokenize | public static function tokenize($needle) {
// check if we are searching for the exact phrase
if (preg_match('/^[\s]*"[\s]*(.*?)[\s]*"[\s]*$/', $needle, $matches)) {
$token = $matches[1];
if ($token === '') {
return array();
} else {
re... | php | public static function tokenize($needle) {
// check if we are searching for the exact phrase
if (preg_match('/^[\s]*"[\s]*(.*?)[\s]*"[\s]*$/', $needle, $matches)) {
$token = $matches[1];
if ($token === '') {
return array();
} else {
re... | [
"public",
"static",
"function",
"tokenize",
"(",
"$",
"needle",
")",
"{",
"// check if we are searching for the exact phrase",
"if",
"(",
"preg_match",
"(",
"'/^[\\s]*\"[\\s]*(.*?)[\\s]*\"[\\s]*$/'",
",",
"$",
"needle",
",",
"$",
"matches",
")",
")",
"{",
"$",
"toke... | Helper method to tokenize the given string
Splits the given string into smaller strings. This is a helper method for
full text searching in grading forms. If the given string is surrounded with
double quotes, the resulting array consists of a single item containing the
quoted content.
Otherwise, string like 'grammar,... | [
"Helper",
"method",
"to",
"tokenize",
"the",
"given",
"string"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L639-L665 |
218,240 | moodle/moodle | grade/grading/lib.php | grading_manager.ensure_isset | private function ensure_isset(array $properties) {
foreach ($properties as $property) {
if (!isset($this->$property)) {
throw new coding_exception('The property "'.$property.'" is not set.');
}
}
} | php | private function ensure_isset(array $properties) {
foreach ($properties as $property) {
if (!isset($this->$property)) {
throw new coding_exception('The property "'.$property.'" is not set.');
}
}
} | [
"private",
"function",
"ensure_isset",
"(",
"array",
"$",
"properties",
")",
"{",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"property",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"$",
"property",
")",
")",
"{",
"throw",
"new",
"co... | Make sure that the given properties were set to some not-null value
@param array $properties the list of properties
@throws coding_exception | [
"Make",
"sure",
"that",
"the",
"given",
"properties",
"were",
"set",
"to",
"some",
"not",
"-",
"null",
"value"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/lib.php#L675-L681 |
218,241 | moodle/moodle | admin/tool/recyclebin/classes/base_bin.php | base_bin.delete_all_items | public function delete_all_items() {
// Cleanup all items.
$items = $this->get_items();
foreach ($items as $item) {
if ($this->can_delete()) {
$this->delete_item($item);
}
}
} | php | public function delete_all_items() {
// Cleanup all items.
$items = $this->get_items();
foreach ($items as $item) {
if ($this->can_delete()) {
$this->delete_item($item);
}
}
} | [
"public",
"function",
"delete_all_items",
"(",
")",
"{",
"// Cleanup all items.",
"$",
"items",
"=",
"$",
"this",
"->",
"get_items",
"(",
")",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"can_delete",
"... | Empty the recycle bin. | [
"Empty",
"the",
"recycle",
"bin",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/recyclebin/classes/base_bin.php#L81-L89 |
218,242 | moodle/moodle | customfield/field/textarea/classes/field_controller.php | field_controller.delete | public function delete() : bool {
global $DB;
$fs = get_file_storage();
// Delete files in the defaultvalue.
$fs->delete_area_files($this->get_handler()->get_configuration_context()->id, 'customfield_textarea',
'defaultvalue', $this->get('id'));
// Delete files in t... | php | public function delete() : bool {
global $DB;
$fs = get_file_storage();
// Delete files in the defaultvalue.
$fs->delete_area_files($this->get_handler()->get_configuration_context()->id, 'customfield_textarea',
'defaultvalue', $this->get('id'));
// Delete files in t... | [
"public",
"function",
"delete",
"(",
")",
":",
"bool",
"{",
"global",
"$",
"DB",
";",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"// Delete files in the defaultvalue.",
"$",
"fs",
"->",
"delete_area_files",
"(",
"$",
"this",
"->",
"get_handler",
"(",... | Before delete bulk actions | [
"Before",
"delete",
"bulk",
"actions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/field/textarea/classes/field_controller.php#L45-L65 |
218,243 | moodle/moodle | customfield/field/textarea/classes/field_controller.php | field_controller.prepare_for_config_form | public function prepare_for_config_form(\stdClass $formdata) {
if (!empty($formdata->configdata['defaultvalue'])) {
$textoptions = $this->value_editor_options();
$context = $textoptions['context'];
$record = new \stdClass();
$record->defaultvalue = $formdata->co... | php | public function prepare_for_config_form(\stdClass $formdata) {
if (!empty($formdata->configdata['defaultvalue'])) {
$textoptions = $this->value_editor_options();
$context = $textoptions['context'];
$record = new \stdClass();
$record->defaultvalue = $formdata->co... | [
"public",
"function",
"prepare_for_config_form",
"(",
"\\",
"stdClass",
"$",
"formdata",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"formdata",
"->",
"configdata",
"[",
"'defaultvalue'",
"]",
")",
")",
"{",
"$",
"textoptions",
"=",
"$",
"this",
"->",
"... | Prepare the field data to set in the configuration form
Necessary if some preprocessing required for editor or filemanager fields
@param \stdClass $formdata | [
"Prepare",
"the",
"field",
"data",
"to",
"set",
"in",
"the",
"configuration",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/field/textarea/classes/field_controller.php#L74-L87 |
218,244 | moodle/moodle | customfield/field/textarea/classes/field_controller.php | field_controller.value_editor_options | public function value_editor_options(\context $context = null) {
global $CFG;
require_once($CFG->libdir.'/formslib.php');
if (!$context) {
$context = $this->get_handler()->get_configuration_context();
}
return ['maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG-... | php | public function value_editor_options(\context $context = null) {
global $CFG;
require_once($CFG->libdir.'/formslib.php');
if (!$context) {
$context = $this->get_handler()->get_configuration_context();
}
return ['maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG-... | [
"public",
"function",
"value_editor_options",
"(",
"\\",
"context",
"$",
"context",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/formslib.php'",
")",
";",
"if",
"(",
"!",
"$",
"context",
")",
... | Options for editor
@param \context|null $context context if known, otherwise configuration context will be used
@return array | [
"Options",
"for",
"editor"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/field/textarea/classes/field_controller.php#L110-L117 |
218,245 | moodle/moodle | customfield/field/textarea/classes/field_controller.php | field_controller.save | public function save() {
$configdata = $this->get('configdata');
if (!array_key_exists('defaultvalue_editor', $configdata)) {
$this->field->save();
return;
}
if (!$this->get('id')) {
$this->field->save();
}
// Store files.
$te... | php | public function save() {
$configdata = $this->get('configdata');
if (!array_key_exists('defaultvalue_editor', $configdata)) {
$this->field->save();
return;
}
if (!$this->get('id')) {
$this->field->save();
}
// Store files.
$te... | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"configdata",
"=",
"$",
"this",
"->",
"get",
"(",
"'configdata'",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"'defaultvalue_editor'",
",",
"$",
"configdata",
")",
")",
"{",
"$",
"this",
"->",
"f... | Saves the field configuration | [
"Saves",
"the",
"field",
"configuration"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/field/textarea/classes/field_controller.php#L122-L144 |
218,246 | moodle/moodle | competency/classes/external/performance_helper.php | performance_helper.get_context_from_competency | public function get_context_from_competency(competency $competency) {
$frameworkid = $competency->get('competencyframeworkid');
if (!isset($this->frameworkscontexts[$frameworkid])) {
$framework = $this->get_framework_from_competency($competency);
$this->frameworkscontexts[$framew... | php | public function get_context_from_competency(competency $competency) {
$frameworkid = $competency->get('competencyframeworkid');
if (!isset($this->frameworkscontexts[$frameworkid])) {
$framework = $this->get_framework_from_competency($competency);
$this->frameworkscontexts[$framew... | [
"public",
"function",
"get_context_from_competency",
"(",
"competency",
"$",
"competency",
")",
"{",
"$",
"frameworkid",
"=",
"$",
"competency",
"->",
"get",
"(",
"'competencyframeworkid'",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"frameworks... | Get the context of a competency.
@param competency $competency The competency.
@return \context | [
"Get",
"the",
"context",
"of",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external/performance_helper.php#L63-L70 |
218,247 | moodle/moodle | competency/classes/external/performance_helper.php | performance_helper.get_framework_from_competency | public function get_framework_from_competency(competency $competency) {
$frameworkid = $competency->get('competencyframeworkid');
if (!isset($this->frameworks[$frameworkid])) {
$this->frameworks[$frameworkid] = $competency->get_framework();
}
return $this->frameworks[$framewo... | php | public function get_framework_from_competency(competency $competency) {
$frameworkid = $competency->get('competencyframeworkid');
if (!isset($this->frameworks[$frameworkid])) {
$this->frameworks[$frameworkid] = $competency->get_framework();
}
return $this->frameworks[$framewo... | [
"public",
"function",
"get_framework_from_competency",
"(",
"competency",
"$",
"competency",
")",
"{",
"$",
"frameworkid",
"=",
"$",
"competency",
"->",
"get",
"(",
"'competencyframeworkid'",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"framewor... | Get the framework of a competency.
@param competency $competency The competency.
@return competency_framework | [
"Get",
"the",
"framework",
"of",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external/performance_helper.php#L78-L84 |
218,248 | moodle/moodle | competency/classes/external/performance_helper.php | performance_helper.get_scale_from_competency | public function get_scale_from_competency(competency $competency) {
$scaleid = $competency->get('scaleid');
if ($scaleid !== null && !isset($this->scales[$scaleid])) {
$this->scales[$scaleid] = $competency->get_scale();
} else if ($scaleid === null) {
$framework = $this-... | php | public function get_scale_from_competency(competency $competency) {
$scaleid = $competency->get('scaleid');
if ($scaleid !== null && !isset($this->scales[$scaleid])) {
$this->scales[$scaleid] = $competency->get_scale();
} else if ($scaleid === null) {
$framework = $this-... | [
"public",
"function",
"get_scale_from_competency",
"(",
"competency",
"$",
"competency",
")",
"{",
"$",
"scaleid",
"=",
"$",
"competency",
"->",
"get",
"(",
"'scaleid'",
")",
";",
"if",
"(",
"$",
"scaleid",
"!==",
"null",
"&&",
"!",
"isset",
"(",
"$",
"t... | Get the scale of a competency.
/!\ Make sure that this is always kept in sync with:
- core_competency\competency::get_scale()
- core_competency\competency_framework::get_scale()
@param competency $competency The competency.
@return \grade_scale | [
"Get",
"the",
"scale",
"of",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external/performance_helper.php#L96-L110 |
218,249 | moodle/moodle | competency/classes/external/performance_helper.php | performance_helper.ingest_framework | public function ingest_framework(competency_framework $framework) {
$id = $framework->get('id');
$this->frameworks[$id] = $framework;
} | php | public function ingest_framework(competency_framework $framework) {
$id = $framework->get('id');
$this->frameworks[$id] = $framework;
} | [
"public",
"function",
"ingest_framework",
"(",
"competency_framework",
"$",
"framework",
")",
"{",
"$",
"id",
"=",
"$",
"framework",
"->",
"get",
"(",
"'id'",
")",
";",
"$",
"this",
"->",
"frameworks",
"[",
"$",
"id",
"]",
"=",
"$",
"framework",
";",
"... | Ingest a framework to avoid additional fetching.
@param competency_framework $framework The framework.
@return void | [
"Ingest",
"a",
"framework",
"to",
"avoid",
"additional",
"fetching",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external/performance_helper.php#L118-L121 |
218,250 | moodle/moodle | lib/externallib.php | external_api.validate_context | public static function validate_context($context) {
global $CFG, $PAGE;
if (empty($context)) {
throw new invalid_parameter_exception('Context does not exist');
}
if (empty(self::$contextrestriction)) {
self::$contextrestriction = context_system::instance();
... | php | public static function validate_context($context) {
global $CFG, $PAGE;
if (empty($context)) {
throw new invalid_parameter_exception('Context does not exist');
}
if (empty(self::$contextrestriction)) {
self::$contextrestriction = context_system::instance();
... | [
"public",
"static",
"function",
"validate_context",
"(",
"$",
"context",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"if",
"(",
"empty",
"(",
"$",
"context",
")",
")",
"{",
"throw",
"new",
"invalid_parameter_exception",
"(",
"'Context does not exi... | Makes sure user may execute functions in this context.
@param stdClass $context
@since Moodle 2.0 | [
"Makes",
"sure",
"user",
"may",
"execute",
"functions",
"in",
"this",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/externallib.php#L472-L500 |
218,251 | moodle/moodle | lib/externallib.php | external_api.get_context_from_params | protected static function get_context_from_params($param) {
$levels = context_helper::get_all_levels();
if (!empty($param['contextid'])) {
return context::instance_by_id($param['contextid'], IGNORE_MISSING);
} else if (!empty($param['contextlevel']) && isset($param['instanceid'])) {
... | php | protected static function get_context_from_params($param) {
$levels = context_helper::get_all_levels();
if (!empty($param['contextid'])) {
return context::instance_by_id($param['contextid'], IGNORE_MISSING);
} else if (!empty($param['contextlevel']) && isset($param['instanceid'])) {
... | [
"protected",
"static",
"function",
"get_context_from_params",
"(",
"$",
"param",
")",
"{",
"$",
"levels",
"=",
"context_helper",
"::",
"get_all_levels",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"param",
"[",
"'contextid'",
"]",
")",
")",
"{",
"r... | Get context from passed parameters.
The passed array must either contain a contextid or a combination of context level and instance id to fetch the context.
For example, the context level can be "course" and instanceid can be courseid.
See context_helper::get_all_levels() for a list of valid context levels.
@param ar... | [
"Get",
"context",
"from",
"passed",
"parameters",
".",
"The",
"passed",
"array",
"must",
"either",
"contain",
"a",
"contextid",
"or",
"a",
"combination",
"of",
"context",
"level",
"and",
"instance",
"id",
"to",
"fetch",
"the",
"context",
".",
"For",
"example... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/externallib.php#L514-L528 |
218,252 | moodle/moodle | lib/externallib.php | external_util.validate_courses | public static function validate_courses($courseids, $courses = array(), $addcontext = false) {
// Delete duplicates.
$courseids = array_unique($courseids);
$warnings = array();
// Remove courses which are not even requested.
$courses = array_intersect_key($courses, array_flip($... | php | public static function validate_courses($courseids, $courses = array(), $addcontext = false) {
// Delete duplicates.
$courseids = array_unique($courseids);
$warnings = array();
// Remove courses which are not even requested.
$courses = array_intersect_key($courses, array_flip($... | [
"public",
"static",
"function",
"validate_courses",
"(",
"$",
"courseids",
",",
"$",
"courses",
"=",
"array",
"(",
")",
",",
"$",
"addcontext",
"=",
"false",
")",
"{",
"// Delete duplicates.",
"$",
"courseids",
"=",
"array_unique",
"(",
"$",
"courseids",
")"... | Validate a list of courses, returning the complete course objects for valid courses.
@param array $courseids A list of course ids
@param array $courses An array of courses already pre-fetched, indexed by course id.
@param bool $addcontext True if the returned course object should include the full context object.
... | [
"Validate",
"a",
"list",
"of",
"courses",
"returning",
"the",
"complete",
"course",
"objects",
"for",
"valid",
"courses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/externallib.php#L1342-L1374 |
218,253 | moodle/moodle | lib/externallib.php | external_files.get_properties_for_exporter | public static function get_properties_for_exporter() {
return [
'filename' => array(
'type' => PARAM_FILE,
'description' => 'File name.',
'optional' => true,
'null' => NULL_NOT_ALLOWED,
),
'filepath' => array(
... | php | public static function get_properties_for_exporter() {
return [
'filename' => array(
'type' => PARAM_FILE,
'description' => 'File name.',
'optional' => true,
'null' => NULL_NOT_ALLOWED,
),
'filepath' => array(
... | [
"public",
"static",
"function",
"get_properties_for_exporter",
"(",
")",
"{",
"return",
"[",
"'filename'",
"=>",
"array",
"(",
"'type'",
"=>",
"PARAM_FILE",
",",
"'description'",
"=>",
"'File name.'",
",",
"'optional'",
"=>",
"true",
",",
"'null'",
"=>",
"NULL_N... | Return the properties ready to be used by an exporter.
@return array properties
@since Moodle 3.3 | [
"Return",
"the",
"properties",
"ready",
"to",
"be",
"used",
"by",
"an",
"exporter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/externallib.php#L1455-L1506 |
218,254 | moodle/moodle | lib/ddl/sql_generator.php | sql_generator.getFieldSQL | public function getFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause = NULL, $skip_default_clause = NULL, $skip_notnull_clause = NULL, $specify_nulls_clause = NULL, $specify_field_name = true) {
if ($error = $xmldb_field->validateDefinition($xmldb_table)) {
throw new coding_exception($error);
... | php | public function getFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause = NULL, $skip_default_clause = NULL, $skip_notnull_clause = NULL, $specify_nulls_clause = NULL, $specify_field_name = true) {
if ($error = $xmldb_field->validateDefinition($xmldb_table)) {
throw new coding_exception($error);
... | [
"public",
"function",
"getFieldSQL",
"(",
"$",
"xmldb_table",
",",
"$",
"xmldb_field",
",",
"$",
"skip_type_clause",
"=",
"NULL",
",",
"$",
"skip_default_clause",
"=",
"NULL",
",",
"$",
"skip_notnull_clause",
"=",
"NULL",
",",
"$",
"specify_nulls_clause",
"=",
... | Given one correct xmldb_field, returns the complete SQL line to create it.
@param xmldb_table $xmldb_table The table related to $xmldb_field.
@param xmldb_field $xmldb_field The instance of xmldb_field to create the SQL from.
@param string $skip_type_clause The type clause on alter columns, NULL by default.
@param str... | [
"Given",
"one",
"correct",
"xmldb_field",
"returns",
"the",
"complete",
"SQL",
"line",
"to",
"create",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/sql_generator.php#L454-L527 |
218,255 | moodle/moodle | lib/ddl/sql_generator.php | sql_generator.getKeySQL | public function getKeySQL($xmldb_table, $xmldb_key) {
$key = '';
switch ($xmldb_key->getType()) {
case XMLDB_KEY_PRIMARY:
if ($this->primary_keys) {
if ($this->primary_key_name !== null) {
$key = $this->getEncQuoted($this->primary... | php | public function getKeySQL($xmldb_table, $xmldb_key) {
$key = '';
switch ($xmldb_key->getType()) {
case XMLDB_KEY_PRIMARY:
if ($this->primary_keys) {
if ($this->primary_key_name !== null) {
$key = $this->getEncQuoted($this->primary... | [
"public",
"function",
"getKeySQL",
"(",
"$",
"xmldb_table",
",",
"$",
"xmldb_key",
")",
"{",
"$",
"key",
"=",
"''",
";",
"switch",
"(",
"$",
"xmldb_key",
"->",
"getType",
"(",
")",
")",
"{",
"case",
"XMLDB_KEY_PRIMARY",
":",
"if",
"(",
"$",
"this",
"... | Given one correct xmldb_key, returns its specs.
@param xmldb_table $xmldb_table The table related to $xmldb_key.
@param xmldb_key $xmldb_key The xmldb_key's specifications requested.
@return string SQL statement about the xmldb_key. | [
"Given",
"one",
"correct",
"xmldb_key",
"returns",
"its",
"specs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/sql_generator.php#L536-L569 |
218,256 | moodle/moodle | lib/ddl/sql_generator.php | sql_generator.getDefaultValue | public function getDefaultValue($xmldb_field) {
$default = null;
if ($xmldb_field->getDefault() !== NULL) {
if ($xmldb_field->getType() == XMLDB_TYPE_CHAR ||
$xmldb_field->getType() == XMLDB_TYPE_TEXT) {
if ($xmldb_field->getDefault() === '') { // If pas... | php | public function getDefaultValue($xmldb_field) {
$default = null;
if ($xmldb_field->getDefault() !== NULL) {
if ($xmldb_field->getType() == XMLDB_TYPE_CHAR ||
$xmldb_field->getType() == XMLDB_TYPE_TEXT) {
if ($xmldb_field->getDefault() === '') { // If pas... | [
"public",
"function",
"getDefaultValue",
"(",
"$",
"xmldb_field",
")",
"{",
"$",
"default",
"=",
"null",
";",
"if",
"(",
"$",
"xmldb_field",
"->",
"getDefault",
"(",
")",
"!==",
"NULL",
")",
"{",
"if",
"(",
"$",
"xmldb_field",
"->",
"getType",
"(",
")"... | Give one xmldb_field, returns the correct "default value" for the current configuration
@param xmldb_field $xmldb_field The field.
@return The default value of the field. | [
"Give",
"one",
"xmldb_field",
"returns",
"the",
"correct",
"default",
"value",
"for",
"the",
"current",
"configuration"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/sql_generator.php#L577-L610 |
218,257 | moodle/moodle | lib/ddl/sql_generator.php | sql_generator.getDefaultClause | public function getDefaultClause($xmldb_field) {
$defaultvalue = $this->getDefaultValue ($xmldb_field);
if ($defaultvalue !== null) {
return ' DEFAULT ' . $defaultvalue;
} else {
return null;
}
} | php | public function getDefaultClause($xmldb_field) {
$defaultvalue = $this->getDefaultValue ($xmldb_field);
if ($defaultvalue !== null) {
return ' DEFAULT ' . $defaultvalue;
} else {
return null;
}
} | [
"public",
"function",
"getDefaultClause",
"(",
"$",
"xmldb_field",
")",
"{",
"$",
"defaultvalue",
"=",
"$",
"this",
"->",
"getDefaultValue",
"(",
"$",
"xmldb_field",
")",
";",
"if",
"(",
"$",
"defaultvalue",
"!==",
"null",
")",
"{",
"return",
"' DEFAULT '",
... | Given one xmldb_field, returns the correct "default clause" for the current configuration.
@param xmldb_field $xmldb_field The xmldb_field.
@return The SQL clause for generating the default value as in $xmldb_field. | [
"Given",
"one",
"xmldb_field",
"returns",
"the",
"correct",
"default",
"clause",
"for",
"the",
"current",
"configuration",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/sql_generator.php#L618-L627 |
218,258 | moodle/moodle | lib/ddl/sql_generator.php | sql_generator.getDropFieldSQL | public function getDropFieldSQL($xmldb_table, $xmldb_field) {
$results = array();
// Get the quoted name of the table and field
$tablename = $this->getTableName($xmldb_table);
$fieldname = $this->getEncQuoted($xmldb_field->getName());
// Build the standard alter table drop
... | php | public function getDropFieldSQL($xmldb_table, $xmldb_field) {
$results = array();
// Get the quoted name of the table and field
$tablename = $this->getTableName($xmldb_table);
$fieldname = $this->getEncQuoted($xmldb_field->getName());
// Build the standard alter table drop
... | [
"public",
"function",
"getDropFieldSQL",
"(",
"$",
"xmldb_table",
",",
"$",
"xmldb_field",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"// Get the quoted name of the table and field",
"$",
"tablename",
"=",
"$",
"this",
"->",
"getTableName",
"(",
"$",... | Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop the field from the table.
@param xmldb_table $xmldb_table The table related to $xmldb_field.
@param xmldb_field $xmldb_field The instance of xmldb_field to create the SQL from.
@return array The SQL statement for dropping a field from ... | [
"Given",
"one",
"xmldb_table",
"and",
"one",
"xmldb_field",
"return",
"the",
"SQL",
"statements",
"needed",
"to",
"drop",
"the",
"field",
"from",
"the",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/sql_generator.php#L719-L731 |
218,259 | moodle/moodle | lib/ddl/sql_generator.php | sql_generator.getRenameIndexSQL | function getRenameIndexSQL($xmldb_table, $xmldb_index, $newname) {
// Some DB doesn't support index renaming (MySQL) so this can be empty
if (empty($this->rename_index_sql)) {
return array();
}
// Get the real index name
$dbindexname = $this->mdb->get_manager()->find... | php | function getRenameIndexSQL($xmldb_table, $xmldb_index, $newname) {
// Some DB doesn't support index renaming (MySQL) so this can be empty
if (empty($this->rename_index_sql)) {
return array();
}
// Get the real index name
$dbindexname = $this->mdb->get_manager()->find... | [
"function",
"getRenameIndexSQL",
"(",
"$",
"xmldb_table",
",",
"$",
"xmldb_index",
",",
"$",
"newname",
")",
"{",
"// Some DB doesn't support index renaming (MySQL) so this can be empty",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"rename_index_sql",
")",
")",
"{",
... | Given one xmldb_table and one xmldb_index, return the SQL statements needed to rename the index in the table
Experimental! Shouldn't be used at all!
@param xmldb_table $xmldb_table The xmldb_table instance to rename the index on.
@param xmldb_index $xmldb_index The xmldb_index to rename.
@param string $newname The xml... | [
"Given",
"one",
"xmldb_table",
"and",
"one",
"xmldb_index",
"return",
"the",
"SQL",
"statements",
"needed",
"to",
"rename",
"the",
"index",
"in",
"the",
"table",
"Experimental!",
"Shouldn",
"t",
"be",
"used",
"at",
"all!"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/sql_generator.php#L1041-L1055 |
218,260 | moodle/moodle | lib/ddl/sql_generator.php | sql_generator.getExecuteInsertSQL | function getExecuteInsertSQL($statement) {
$results = array(); //Array where all the sentences will be stored
if ($sentences = $statement->getSentences()) {
foreach ($sentences as $sentence) {
// Get the list of fields
$fields = $statement->getFieldsFr... | php | function getExecuteInsertSQL($statement) {
$results = array(); //Array where all the sentences will be stored
if ($sentences = $statement->getSentences()) {
foreach ($sentences as $sentence) {
// Get the list of fields
$fields = $statement->getFieldsFr... | [
"function",
"getExecuteInsertSQL",
"(",
"$",
"statement",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"//Array where all the sentences will be stored",
"if",
"(",
"$",
"sentences",
"=",
"$",
"statement",
"->",
"getSentences",
"(",
")",
")",
"{",
"fo... | Given one XMLDB Statement, build the needed SQL insert sentences to execute it.
@param string $statement SQL statement.
@return array Array of sentences in the SQL statement. | [
"Given",
"one",
"XMLDB",
"Statement",
"build",
"the",
"needed",
"SQL",
"insert",
"sentences",
"to",
"execute",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/sql_generator.php#L1158-L1205 |
218,261 | moodle/moodle | lib/ddl/sql_generator.php | sql_generator.getAllReservedWords | public static function getAllReservedWords() {
global $CFG;
$generators = array('mysql', 'postgres', 'oracle', 'mssql');
$reserved_words = array();
foreach($generators as $generator) {
$class = $generator . '_sql_generator';
require_once("$CFG->libdir/ddl/$class... | php | public static function getAllReservedWords() {
global $CFG;
$generators = array('mysql', 'postgres', 'oracle', 'mssql');
$reserved_words = array();
foreach($generators as $generator) {
$class = $generator . '_sql_generator';
require_once("$CFG->libdir/ddl/$class... | [
"public",
"static",
"function",
"getAllReservedWords",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"generators",
"=",
"array",
"(",
"'mysql'",
",",
"'postgres'",
",",
"'oracle'",
",",
"'mssql'",
")",
";",
"$",
"reserved_words",
"=",
"array",
"(",
")",
... | Returns all reserved words in supported databases.
Reserved words should be lowercase.
@return array ('word'=>array(databases)) | [
"Returns",
"all",
"reserved",
"words",
"in",
"supported",
"databases",
".",
"Reserved",
"words",
"should",
"be",
"lowercase",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/sql_generator.php#L1382-L1397 |
218,262 | moodle/moodle | lib/ddl/sql_generator.php | sql_generator.get_nullable_fields_in_index | public function get_nullable_fields_in_index($xmldb_table, $xmldb_index) {
global $DB;
// If we don't have the field info passed in, we need to query it from the DB.
$fieldsfromdb = null;
$nullablefields = [];
foreach ($xmldb_index->getFields() as $fieldname) {
if (... | php | public function get_nullable_fields_in_index($xmldb_table, $xmldb_index) {
global $DB;
// If we don't have the field info passed in, we need to query it from the DB.
$fieldsfromdb = null;
$nullablefields = [];
foreach ($xmldb_index->getFields() as $fieldname) {
if (... | [
"public",
"function",
"get_nullable_fields_in_index",
"(",
"$",
"xmldb_table",
",",
"$",
"xmldb_index",
")",
"{",
"global",
"$",
"DB",
";",
"// If we don't have the field info passed in, we need to query it from the DB.",
"$",
"fieldsfromdb",
"=",
"null",
";",
"$",
"nulla... | Get the fields from an index definition that might be null.
@param xmldb_table $xmldb_table the table
@param xmldb_index $xmldb_index the index
@return array list of fields in the index definition that might be null. | [
"Get",
"the",
"fields",
"from",
"an",
"index",
"definition",
"that",
"might",
"be",
"null",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/sql_generator.php#L1418-L1450 |
218,263 | moodle/moodle | auth/email/classes/external.php | auth_email_external.get_signup_settings_returns | public static function get_signup_settings_returns() {
return new external_single_structure(
array(
'namefields' => new external_multiple_structure(
new external_value(PARAM_NOTAGS, 'The order of the name fields')
),
'passwordpoli... | php | public static function get_signup_settings_returns() {
return new external_single_structure(
array(
'namefields' => new external_multiple_structure(
new external_value(PARAM_NOTAGS, 'The order of the name fields')
),
'passwordpoli... | [
"public",
"static",
"function",
"get_signup_settings_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'namefields'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_value",
"(",
"PARAM_NOTAGS",
",",
"'The order... | Describes the get_signup_settings return value.
@return external_single_structure
@since Moodle 3.2 | [
"Describes",
"the",
"get_signup_settings",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/email/classes/external.php#L136-L182 |
218,264 | moodle/moodle | auth/email/classes/external.php | auth_email_external.signup_user_parameters | public static function signup_user_parameters() {
return new external_function_parameters(
array(
'username' => new external_value(core_user::get_property_type('username'), 'Username'),
'password' => new external_value(core_user::get_property_type('password'), 'Plain ... | php | public static function signup_user_parameters() {
return new external_function_parameters(
array(
'username' => new external_value(core_user::get_property_type('username'), 'Username'),
'password' => new external_value(core_user::get_property_type('password'), 'Plain ... | [
"public",
"static",
"function",
"signup_user_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'username'",
"=>",
"new",
"external_value",
"(",
"core_user",
"::",
"get_property_type",
"(",
"'username'",
")",
",",
"'User... | Describes the parameters for signup_user.
@return external_function_parameters
@since Moodle 3.2 | [
"Describes",
"the",
"parameters",
"for",
"signup_user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/email/classes/external.php#L190-L215 |
218,265 | moodle/moodle | cache/stores/mongodb/MongoDB/GridFS/StreamWrapper.php | StreamWrapper.stream_open | public function stream_open($path, $mode, $options, &$openedPath)
{
$this->initProtocol($path);
$this->mode = $mode;
if ($mode === 'r') {
return $this->initReadableStream();
}
if ($mode === 'w') {
return $this->initWritableStream();
}
... | php | public function stream_open($path, $mode, $options, &$openedPath)
{
$this->initProtocol($path);
$this->mode = $mode;
if ($mode === 'r') {
return $this->initReadableStream();
}
if ($mode === 'w') {
return $this->initWritableStream();
}
... | [
"public",
"function",
"stream_open",
"(",
"$",
"path",
",",
"$",
"mode",
",",
"$",
"options",
",",
"&",
"$",
"openedPath",
")",
"{",
"$",
"this",
"->",
"initProtocol",
"(",
"$",
"path",
")",
";",
"$",
"this",
"->",
"mode",
"=",
"$",
"mode",
";",
... | Opens the stream.
@see http://php.net/manual/en/streamwrapper.stream-open.php
@param string $path Path to the file resource
@param string $mode Mode used to open the file (only "r" and "w" are supported)
@param integer $options Additional flags set by the streams API
@param string $openedPath Not use... | [
"Opens",
"the",
"stream",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/StreamWrapper.php#L100-L114 |
218,266 | moodle/moodle | cache/stores/mongodb/MongoDB/GridFS/StreamWrapper.php | StreamWrapper.stream_seek | public function stream_seek($offset, $whence = \SEEK_SET)
{
$size = $this->stream->getSize();
if ($whence === \SEEK_CUR) {
$offset += $this->stream->tell();
}
if ($whence === \SEEK_END) {
$offset += $size;
}
// WritableStreams are always pos... | php | public function stream_seek($offset, $whence = \SEEK_SET)
{
$size = $this->stream->getSize();
if ($whence === \SEEK_CUR) {
$offset += $this->stream->tell();
}
if ($whence === \SEEK_END) {
$offset += $size;
}
// WritableStreams are always pos... | [
"public",
"function",
"stream_seek",
"(",
"$",
"offset",
",",
"$",
"whence",
"=",
"\\",
"SEEK_SET",
")",
"{",
"$",
"size",
"=",
"$",
"this",
"->",
"stream",
"->",
"getSize",
"(",
")",
";",
"if",
"(",
"$",
"whence",
"===",
"\\",
"SEEK_CUR",
")",
"{"... | Return the current position of the stream.
@see http://php.net/manual/en/streamwrapper.stream-seek.php
@param integer $offset Stream offset to seek to
@param integer $whence One of SEEK_SET, SEEK_CUR, or SEEK_END
@return boolean True if the position was updated and false otherwise | [
"Return",
"the",
"current",
"position",
"of",
"the",
"stream",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/StreamWrapper.php#L148-L172 |
218,267 | moodle/moodle | cache/stores/mongodb/MongoDB/GridFS/StreamWrapper.php | StreamWrapper.stream_stat | public function stream_stat()
{
$stat = $this->getStatTemplate();
$stat[2] = $stat['mode'] = $this->stream instanceof ReadableStream
? 0100444 // S_IFREG & S_IRUSR & S_IRGRP & S_IROTH
: 0100222; // S_IFREG & S_IWUSR & S_IWGRP & S_IWOTH
$stat[7] = $stat['size'] = $th... | php | public function stream_stat()
{
$stat = $this->getStatTemplate();
$stat[2] = $stat['mode'] = $this->stream instanceof ReadableStream
? 0100444 // S_IFREG & S_IRUSR & S_IRGRP & S_IROTH
: 0100222; // S_IFREG & S_IWUSR & S_IWGRP & S_IWOTH
$stat[7] = $stat['size'] = $th... | [
"public",
"function",
"stream_stat",
"(",
")",
"{",
"$",
"stat",
"=",
"$",
"this",
"->",
"getStatTemplate",
"(",
")",
";",
"$",
"stat",
"[",
"2",
"]",
"=",
"$",
"stat",
"[",
"'mode'",
"]",
"=",
"$",
"this",
"->",
"stream",
"instanceof",
"ReadableStre... | Return information about the stream.
@see http://php.net/manual/en/streamwrapper.stream-stat.php
@return array | [
"Return",
"information",
"about",
"the",
"stream",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/StreamWrapper.php#L180-L202 |
218,268 | moodle/moodle | cache/stores/mongodb/MongoDB/GridFS/StreamWrapper.php | StreamWrapper.initReadableStream | private function initReadableStream()
{
$context = stream_context_get_options($this->context);
$this->stream = new ReadableStream(
$context[$this->protocol]['collectionWrapper'],
$context[$this->protocol]['file']
);
return true;
} | php | private function initReadableStream()
{
$context = stream_context_get_options($this->context);
$this->stream = new ReadableStream(
$context[$this->protocol]['collectionWrapper'],
$context[$this->protocol]['file']
);
return true;
} | [
"private",
"function",
"initReadableStream",
"(",
")",
"{",
"$",
"context",
"=",
"stream_context_get_options",
"(",
"$",
"this",
"->",
"context",
")",
";",
"$",
"this",
"->",
"stream",
"=",
"new",
"ReadableStream",
"(",
"$",
"context",
"[",
"$",
"this",
"-... | Initialize the internal stream for reading.
@see StreamWrapper::stream_open()
@return boolean | [
"Initialize",
"the",
"internal",
"stream",
"for",
"reading",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/StreamWrapper.php#L278-L288 |
218,269 | moodle/moodle | cache/stores/mongodb/MongoDB/GridFS/StreamWrapper.php | StreamWrapper.initWritableStream | private function initWritableStream()
{
$context = stream_context_get_options($this->context);
$this->stream = new WritableStream(
$context[$this->protocol]['collectionWrapper'],
$context[$this->protocol]['filename'],
$context[$this->protocol]['options']
... | php | private function initWritableStream()
{
$context = stream_context_get_options($this->context);
$this->stream = new WritableStream(
$context[$this->protocol]['collectionWrapper'],
$context[$this->protocol]['filename'],
$context[$this->protocol]['options']
... | [
"private",
"function",
"initWritableStream",
"(",
")",
"{",
"$",
"context",
"=",
"stream_context_get_options",
"(",
"$",
"this",
"->",
"context",
")",
";",
"$",
"this",
"->",
"stream",
"=",
"new",
"WritableStream",
"(",
"$",
"context",
"[",
"$",
"this",
"-... | Initialize the internal stream for writing.
@see StreamWrapper::stream_open()
@return boolean | [
"Initialize",
"the",
"internal",
"stream",
"for",
"writing",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/StreamWrapper.php#L296-L307 |
218,270 | moodle/moodle | admin/tool/monitor/classes/eventlist.php | eventlist.get_file_list | protected static function get_file_list($directory) {
global $CFG;
$directoryroot = $CFG->dirroot;
$finalfiles = array();
if (is_dir($directory)) {
if ($handle = opendir($directory)) {
$files = scandir($directory);
foreach ($files as $file) {
... | php | protected static function get_file_list($directory) {
global $CFG;
$directoryroot = $CFG->dirroot;
$finalfiles = array();
if (is_dir($directory)) {
if ($handle = opendir($directory)) {
$files = scandir($directory);
foreach ($files as $file) {
... | [
"protected",
"static",
"function",
"get_file_list",
"(",
"$",
"directory",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"directoryroot",
"=",
"$",
"CFG",
"->",
"dirroot",
";",
"$",
"finalfiles",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_dir",
"(",
"$",
... | Returns a list of files with a full directory path in a specified directory.
@param string $directory location of files.
@return array full location of files from the specified directory. | [
"Returns",
"a",
"list",
"of",
"files",
"with",
"a",
"full",
"directory",
"path",
"in",
"a",
"specified",
"directory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/eventlist.php#L137-L157 |
218,271 | moodle/moodle | admin/tool/monitor/classes/eventlist.php | eventlist.get_all_eventlist | public static function get_all_eventlist($withoutcomponent = false) {
if ($withoutcomponent) {
$return = array_merge(self::get_core_eventlist(), self::get_non_core_eventlist($withoutcomponent));
array_multisort($return, SORT_NATURAL);
} else {
$return = array_merge(ar... | php | public static function get_all_eventlist($withoutcomponent = false) {
if ($withoutcomponent) {
$return = array_merge(self::get_core_eventlist(), self::get_non_core_eventlist($withoutcomponent));
array_multisort($return, SORT_NATURAL);
} else {
$return = array_merge(ar... | [
"public",
"static",
"function",
"get_all_eventlist",
"(",
"$",
"withoutcomponent",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"withoutcomponent",
")",
"{",
"$",
"return",
"=",
"array_merge",
"(",
"self",
"::",
"get_core_eventlist",
"(",
")",
",",
"self",
"::",
... | Get a list of events present in the system.
@param bool $withoutcomponent Return an eventlist without associated components.
@return array list of events present in the system. | [
"Get",
"a",
"list",
"of",
"events",
"present",
"in",
"the",
"system",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/eventlist.php#L166-L175 |
218,272 | moodle/moodle | admin/tool/monitor/classes/eventlist.php | eventlist.get_plugin_list | public static function get_plugin_list($eventlist = array()) {
if (empty($eventlist)) {
$eventlist = self::get_all_eventlist();
}
$plugins = array_keys($eventlist);
$return = array();
foreach ($plugins as $plugin) {
if ($plugin === 'core') {
... | php | public static function get_plugin_list($eventlist = array()) {
if (empty($eventlist)) {
$eventlist = self::get_all_eventlist();
}
$plugins = array_keys($eventlist);
$return = array();
foreach ($plugins as $plugin) {
if ($plugin === 'core') {
... | [
"public",
"static",
"function",
"get_plugin_list",
"(",
"$",
"eventlist",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"eventlist",
")",
")",
"{",
"$",
"eventlist",
"=",
"self",
"::",
"get_all_eventlist",
"(",
")",
";",
"}",
"$",
"... | Return list of plugins that have events.
@param array $eventlist a list of events present in the system {@link eventlist::get_all_eventlist}.
@return array list of plugins with human readable name. | [
"Return",
"list",
"of",
"plugins",
"that",
"have",
"events",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/eventlist.php#L184-L201 |
218,273 | moodle/moodle | admin/tool/monitor/classes/eventlist.php | eventlist.validate_event_plugin | public static function validate_event_plugin($plugin, $eventname, $eventlist = array()) {
if (empty($eventlist)) {
$eventlist = self::get_all_eventlist();
}
if (isset($eventlist[$plugin][$eventname])) {
return true;
}
return false;
} | php | public static function validate_event_plugin($plugin, $eventname, $eventlist = array()) {
if (empty($eventlist)) {
$eventlist = self::get_all_eventlist();
}
if (isset($eventlist[$plugin][$eventname])) {
return true;
}
return false;
} | [
"public",
"static",
"function",
"validate_event_plugin",
"(",
"$",
"plugin",
",",
"$",
"eventname",
",",
"$",
"eventlist",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"eventlist",
")",
")",
"{",
"$",
"eventlist",
"=",
"self",
"::",
... | validate if the given event belongs to the given plugin.
@param string $plugin Frankenstyle name of the plugin.
@param string $eventname Full qualified event name.
@param array $eventlist List of events generated by {@link eventlist::get_all_eventlist}
@return bool Returns true if the selected event belongs to the se... | [
"validate",
"if",
"the",
"given",
"event",
"belongs",
"to",
"the",
"given",
"plugin",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/eventlist.php#L212-L221 |
218,274 | moodle/moodle | admin/tool/generator/classes/site_backend.php | tool_generator_site_backend.get_size_choices | public static function get_size_choices() {
$options = array();
for ($size = self::MIN_SIZE; $size <= self::MAX_SIZE; $size++) {
$options[$size] = get_string('sitesize_' . $size, 'tool_generator');
}
return $options;
} | php | public static function get_size_choices() {
$options = array();
for ($size = self::MIN_SIZE; $size <= self::MAX_SIZE; $size++) {
$options[$size] = get_string('sitesize_' . $size, 'tool_generator');
}
return $options;
} | [
"public",
"static",
"function",
"get_size_choices",
"(",
")",
"{",
"$",
"options",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"size",
"=",
"self",
"::",
"MIN_SIZE",
";",
"$",
"size",
"<=",
"self",
"::",
"MAX_SIZE",
";",
"$",
"size",
"++",
")",
"... | Gets a list of size choices supported by this backend.
@return array List of size (int) => text description for display | [
"Gets",
"a",
"list",
"of",
"size",
"choices",
"supported",
"by",
"this",
"backend",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/generator/classes/site_backend.php#L81-L87 |
218,275 | moodle/moodle | admin/tool/generator/classes/site_backend.php | tool_generator_site_backend.run_create_course | protected function run_create_course($shortname, $coursesize) {
// We are in $CFG->dirroot.
$command = 'php admin/tool/generator/cli/maketestcourse.php';
$options = array(
'--shortname="' . $shortname . '"',
'--size="' . get_string('shortsize_' . $coursesize, 'tool_gene... | php | protected function run_create_course($shortname, $coursesize) {
// We are in $CFG->dirroot.
$command = 'php admin/tool/generator/cli/maketestcourse.php';
$options = array(
'--shortname="' . $shortname . '"',
'--size="' . get_string('shortsize_' . $coursesize, 'tool_gene... | [
"protected",
"function",
"run_create_course",
"(",
"$",
"shortname",
",",
"$",
"coursesize",
")",
"{",
"// We are in $CFG->dirroot.",
"$",
"command",
"=",
"'php admin/tool/generator/cli/maketestcourse.php'",
";",
"$",
"options",
"=",
"array",
"(",
"'--shortname=\"'",
".... | Creates a course with the specified shortname, coursesize and the provided maketestsite options.
@param string $shortname The course shortname
@param int $coursesize One of the possible course sizes.
@return void | [
"Creates",
"a",
"course",
"with",
"the",
"specified",
"shortname",
"coursesize",
"and",
"the",
"provided",
"maketestsite",
"options",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/generator/classes/site_backend.php#L138-L178 |
218,276 | moodle/moodle | lib/mlbackend/python/classes/processor.php | processor.is_ready | public function is_ready() {
if (empty($this->pathtopython)) {
$settingurl = new \moodle_url('/admin/settings.php', array('section' => 'systempaths'));
return get_string('pythonpathnotdefined', 'mlbackend_python', $settingurl->out());
}
// Check the installed pip package... | php | public function is_ready() {
if (empty($this->pathtopython)) {
$settingurl = new \moodle_url('/admin/settings.php', array('section' => 'systempaths'));
return get_string('pythonpathnotdefined', 'mlbackend_python', $settingurl->out());
}
// Check the installed pip package... | [
"public",
"function",
"is_ready",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"pathtopython",
")",
")",
"{",
"$",
"settingurl",
"=",
"new",
"\\",
"moodle_url",
"(",
"'/admin/settings.php'",
",",
"array",
"(",
"'section'",
"=>",
"'systempaths... | Is the plugin ready to be used?.
@return bool|string Returns true on success, a string detailing the error otherwise | [
"Is",
"the",
"plugin",
"ready",
"to",
"be",
"used?",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/python/classes/processor.php#L67-L106 |
218,277 | moodle/moodle | lib/mlbackend/python/classes/processor.php | processor.check_pip_package_version | public static function check_pip_package_version($actual, $required = self::REQUIRED_PIP_PACKAGE_VERSION) {
if (empty($actual)) {
return -1;
}
if (version_compare($actual, $required, '<')) {
return -1;
}
$parts = explode('.', $required);
$requir... | php | public static function check_pip_package_version($actual, $required = self::REQUIRED_PIP_PACKAGE_VERSION) {
if (empty($actual)) {
return -1;
}
if (version_compare($actual, $required, '<')) {
return -1;
}
$parts = explode('.', $required);
$requir... | [
"public",
"static",
"function",
"check_pip_package_version",
"(",
"$",
"actual",
",",
"$",
"required",
"=",
"self",
"::",
"REQUIRED_PIP_PACKAGE_VERSION",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"actual",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"if",
... | Check that the given package version can be used and return the error status.
When evaluating the version, we assume the sematic versioning scheme as described at
https://semver.org/.
@param string $actual The actual Python package version
@param string $required The required version of the package
@return int -1 = a... | [
"Check",
"that",
"the",
"given",
"package",
"version",
"can",
"be",
"used",
"and",
"return",
"the",
"error",
"status",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/python/classes/processor.php#L420-L443 |
218,278 | moodle/moodle | badges/classes/observer.php | core_badges_observer.course_module_criteria_review | public static function course_module_criteria_review(\core\event\course_module_completion_updated $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
$eventdata = $event->get_record_snapshot('course_modules_completion'... | php | public static function course_module_criteria_review(\core\event\course_module_completion_updated $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
$eventdata = $event->get_record_snapshot('course_modules_completion'... | [
"public",
"static",
"function",
"course_module_criteria_review",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"course_module_completion_updated",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
... | Triggered when 'course_module_completion_updated' event is triggered.
@param \core\event\course_module_completion_updated $event | [
"Triggered",
"when",
"course_module_completion_updated",
"event",
"is",
"triggered",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/observer.php#L36-L70 |
218,279 | moodle/moodle | badges/classes/observer.php | core_badges_observer.competency_criteria_review | public static function competency_criteria_review(\core\event\competency_evidence_created $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
if (!get_config('core_competency', 'enabled')) {
return;
... | php | public static function competency_criteria_review(\core\event\competency_evidence_created $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
if (!get_config('core_competency', 'enabled')) {
return;
... | [
"public",
"static",
"function",
"competency_criteria_review",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"competency_evidence_created",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"enableb... | Triggered when '\core\event\competency_evidence_created' event is triggered.
@param \core\event\competency_evidence_created $event | [
"Triggered",
"when",
"\\",
"core",
"\\",
"event",
"\\",
"competency_evidence_created",
"event",
"is",
"triggered",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/observer.php#L77-L111 |
218,280 | moodle/moodle | badges/classes/observer.php | core_badges_observer.course_criteria_review | public static function course_criteria_review(\core\event\course_completed $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
$userid = $event->relateduserid;
$courseid = $event->courseid;
// ... | php | public static function course_criteria_review(\core\event\course_completed $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
$userid = $event->relateduserid;
$courseid = $event->courseid;
// ... | [
"public",
"static",
"function",
"course_criteria_review",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"course_completed",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"enablebadges",
")",
... | Triggered when 'course_completed' event is triggered.
@param \core\event\course_completed $event | [
"Triggered",
"when",
"course_completed",
"event",
"is",
"triggered",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/observer.php#L118-L147 |
218,281 | moodle/moodle | badges/classes/observer.php | core_badges_observer.badge_criteria_review | public static function badge_criteria_review(\core\event\badge_awarded $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
$userid = $event->relateduserid;
if ($rs = $DB->get_records('badge_criteria', array... | php | public static function badge_criteria_review(\core\event\badge_awarded $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
$userid = $event->relateduserid;
if ($rs = $DB->get_records('badge_criteria', array... | [
"public",
"static",
"function",
"badge_criteria_review",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"badge_awarded",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"enablebadges",
")",
")... | Triggered when 'badge_awarded' event happens.
@param \core\event\badge_awarded $event event generated when a badge is awarded. | [
"Triggered",
"when",
"badge_awarded",
"event",
"happens",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/observer.php#L154-L179 |
218,282 | moodle/moodle | badges/classes/observer.php | core_badges_observer.profile_criteria_review | public static function profile_criteria_review(\core\event\user_updated $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
$userid = $event->objectid;
if ($rs = $DB->get_records('badge_criteria', array('cr... | php | public static function profile_criteria_review(\core\event\user_updated $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
$userid = $event->objectid;
if ($rs = $DB->get_records('badge_criteria', array('cr... | [
"public",
"static",
"function",
"profile_criteria_review",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"user_updated",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"enablebadges",
")",
"... | Triggered when 'user_updated' event happens.
@param \core\event\user_updated $event event generated when user profile is updated. | [
"Triggered",
"when",
"user_updated",
"event",
"happens",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/observer.php#L185-L210 |
218,283 | moodle/moodle | badges/classes/observer.php | core_badges_observer.cohort_criteria_review | public static function cohort_criteria_review(\core\event\cohort_member_added $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
$cohortid = $event->objectid;
$userid = $event->relateduserid;
/... | php | public static function cohort_criteria_review(\core\event\cohort_member_added $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
$cohortid = $event->objectid;
$userid = $event->relateduserid;
/... | [
"public",
"static",
"function",
"cohort_criteria_review",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"cohort_member_added",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"enablebadges",
")... | Triggered when the 'cohort_member_added' event happens.
@param \core\event\cohort_member_added $event generated when a user is added to a cohort | [
"Triggered",
"when",
"the",
"cohort_member_added",
"event",
"happens",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/classes/observer.php#L217-L255 |
218,284 | moodle/moodle | lib/horde/framework/Horde/Crypt/Blowfish/Php.php | Horde_Crypt_Blowfish_Php._init | protected function _init()
{
if (!isset($this->_ob) ||
($this->_ob->md5 != hash('md5', $this->key))) {
switch ($this->cipher) {
case 'cbc':
$this->_ob = new Horde_Crypt_Blowfish_Php_Cbc($this->key);
break;
case 'ecb':
... | php | protected function _init()
{
if (!isset($this->_ob) ||
($this->_ob->md5 != hash('md5', $this->key))) {
switch ($this->cipher) {
case 'cbc':
$this->_ob = new Horde_Crypt_Blowfish_Php_Cbc($this->key);
break;
case 'ecb':
... | [
"protected",
"function",
"_init",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_ob",
")",
"||",
"(",
"$",
"this",
"->",
"_ob",
"->",
"md5",
"!=",
"hash",
"(",
"'md5'",
",",
"$",
"this",
"->",
"key",
")",
")",
")",
"{",
"sw... | Initialize the subclass. | [
"Initialize",
"the",
"subclass",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Crypt/Blowfish/Php.php#L59-L73 |
218,285 | moodle/moodle | admin/tool/log/classes/helper/reader.php | reader.get_name | public function get_name() {
if (get_string_manager()->string_exists('pluginname', $this->component)) {
return get_string('pluginname', $this->component);
}
return $this->store;
} | php | public function get_name() {
if (get_string_manager()->string_exists('pluginname', $this->component)) {
return get_string('pluginname', $this->component);
}
return $this->store;
} | [
"public",
"function",
"get_name",
"(",
")",
"{",
"if",
"(",
"get_string_manager",
"(",
")",
"->",
"string_exists",
"(",
"'pluginname'",
",",
"$",
"this",
"->",
"component",
")",
")",
"{",
"return",
"get_string",
"(",
"'pluginname'",
",",
"$",
"this",
"->",... | Default get name api.
@return string name of the store. | [
"Default",
"get",
"name",
"api",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/helper/reader.php#L46-L51 |
218,286 | moodle/moodle | admin/tool/log/classes/helper/reader.php | reader.get_description | public function get_description() {
if (get_string_manager()->string_exists('pluginname_desc', $this->component)) {
return get_string('pluginname_desc', $this->component);
}
return $this->store;
} | php | public function get_description() {
if (get_string_manager()->string_exists('pluginname_desc', $this->component)) {
return get_string('pluginname_desc', $this->component);
}
return $this->store;
} | [
"public",
"function",
"get_description",
"(",
")",
"{",
"if",
"(",
"get_string_manager",
"(",
")",
"->",
"string_exists",
"(",
"'pluginname_desc'",
",",
"$",
"this",
"->",
"component",
")",
")",
"{",
"return",
"get_string",
"(",
"'pluginname_desc'",
",",
"$",
... | Default get description method.
@return string description of the store. | [
"Default",
"get",
"description",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/helper/reader.php#L58-L63 |
218,287 | moodle/moodle | admin/tool/log/classes/helper/reader.php | reader.decode_other | public static function decode_other(?string $other) {
if ($other === 'N;' || preg_match('~^.:~', $other)) {
return unserialize($other);
} else {
return json_decode($other, true);
}
} | php | public static function decode_other(?string $other) {
if ($other === 'N;' || preg_match('~^.:~', $other)) {
return unserialize($other);
} else {
return json_decode($other, true);
}
} | [
"public",
"static",
"function",
"decode_other",
"(",
"?",
"string",
"$",
"other",
")",
"{",
"if",
"(",
"$",
"other",
"===",
"'N;'",
"||",
"preg_match",
"(",
"'~^.:~'",
",",
"$",
"other",
")",
")",
"{",
"return",
"unserialize",
"(",
"$",
"other",
")",
... | Function decodes the other field into an array using either PHP serialisation or JSON.
Note that this does not rely on the config setting, it supports both formats, so you can
use it for data before/after making a change to the config setting.
The return value is usually an array but it can also be null or a boolean ... | [
"Function",
"decodes",
"the",
"other",
"field",
"into",
"an",
"array",
"using",
"either",
"PHP",
"serialisation",
"or",
"JSON",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/helper/reader.php#L76-L82 |
218,288 | moodle/moodle | backup/util/helper/restore_decode_processor.class.php | restore_decode_processor.decode_content | public function decode_content($content) {
if (!$content = $this->precheck_content($content)) { // Perform some prechecks
return false;
}
// Iterate over all rules, chaining results
foreach ($this->rules as $rule) {
$content = $rule->decode($content);
}
... | php | public function decode_content($content) {
if (!$content = $this->precheck_content($content)) { // Perform some prechecks
return false;
}
// Iterate over all rules, chaining results
foreach ($this->rules as $rule) {
$content = $rule->decode($content);
}
... | [
"public",
"function",
"decode_content",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"!",
"$",
"content",
"=",
"$",
"this",
"->",
"precheck_content",
"(",
"$",
"content",
")",
")",
"{",
"// Perform some prechecks",
"return",
"false",
";",
"}",
"// Iterate over ... | Receive content from restore_decode_content objects
and apply all the restore_decode_rules to them | [
"Receive",
"content",
"from",
"restore_decode_content",
"objects",
"and",
"apply",
"all",
"the",
"restore_decode_rules",
"to",
"them"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/restore_decode_processor.class.php#L89-L98 |
218,289 | moodle/moodle | lib/php-css-parser/RuleSet/DeclarationBlock.php | DeclarationBlock.removeSelector | public function removeSelector($mSelector) {
if($mSelector instanceof Selector) {
$mSelector = $mSelector->getSelector();
}
foreach($this->aSelectors as $iKey => $oSelector) {
if($oSelector->getSelector() === $mSelector) {
unset($this->aSelectors[$iKey]);
return true;
}
}
return false;
} | php | public function removeSelector($mSelector) {
if($mSelector instanceof Selector) {
$mSelector = $mSelector->getSelector();
}
foreach($this->aSelectors as $iKey => $oSelector) {
if($oSelector->getSelector() === $mSelector) {
unset($this->aSelectors[$iKey]);
return true;
}
}
return false;
} | [
"public",
"function",
"removeSelector",
"(",
"$",
"mSelector",
")",
"{",
"if",
"(",
"$",
"mSelector",
"instanceof",
"Selector",
")",
"{",
"$",
"mSelector",
"=",
"$",
"mSelector",
"->",
"getSelector",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",... | remove one of the selector of the block | [
"remove",
"one",
"of",
"the",
"selector",
"of",
"the",
"block"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/php-css-parser/RuleSet/DeclarationBlock.php#L41-L52 |
218,290 | moodle/moodle | lib/classes/oauth2/issuer.php | issuer.get_endpoint_url | public function get_endpoint_url($type) {
$endpoint = endpoint::get_record([
'issuerid' => $this->get('id'),
'name' => $type . '_endpoint'
]);
if ($endpoint) {
return $endpoint->get('url');
}
return false;
} | php | public function get_endpoint_url($type) {
$endpoint = endpoint::get_record([
'issuerid' => $this->get('id'),
'name' => $type . '_endpoint'
]);
if ($endpoint) {
return $endpoint->get('url');
}
return false;
} | [
"public",
"function",
"get_endpoint_url",
"(",
"$",
"type",
")",
"{",
"$",
"endpoint",
"=",
"endpoint",
"::",
"get_record",
"(",
"[",
"'issuerid'",
"=>",
"$",
"this",
"->",
"get",
"(",
"'id'",
")",
",",
"'name'",
"=>",
"$",
"type",
".",
"'_endpoint'",
... | Helper the get a named service endpoint.
@param string $type
@return string|false | [
"Helper",
"the",
"get",
"a",
"named",
"service",
"endpoint",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/issuer.php#L132-L142 |
218,291 | moodle/moodle | lib/classes/oauth2/issuer.php | issuer.is_valid_login_domain | public function is_valid_login_domain($email) {
if (empty($this->get('alloweddomains'))) {
return true;
}
$validdomains = explode(',', $this->get('alloweddomains'));
$parts = explode('@', $email, 2);
$emaildomain = '';
if (count($parts) > 1) {
$e... | php | public function is_valid_login_domain($email) {
if (empty($this->get('alloweddomains'))) {
return true;
}
$validdomains = explode(',', $this->get('alloweddomains'));
$parts = explode('@', $email, 2);
$emaildomain = '';
if (count($parts) > 1) {
$e... | [
"public",
"function",
"is_valid_login_domain",
"(",
"$",
"email",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"get",
"(",
"'alloweddomains'",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"validdomains",
"=",
"explode",
"(",
"','",
","... | Perform matching against the list of allowed login domains for this issuer.
@param string $email The email to check.
@return boolean | [
"Perform",
"matching",
"against",
"the",
"list",
"of",
"allowed",
"login",
"domains",
"for",
"this",
"issuer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/issuer.php#L150-L164 |
218,292 | moodle/moodle | lib/classes/oauth2/issuer.php | issuer.is_system_account_connected | public function is_system_account_connected() {
if (!$this->is_configured()) {
return false;
}
$sys = system_account::get_record(['issuerid' => $this->get('id')]);
if (empty($sys) || empty($sys->get('refreshtoken'))) {
return false;
}
$scopes = ap... | php | public function is_system_account_connected() {
if (!$this->is_configured()) {
return false;
}
$sys = system_account::get_record(['issuerid' => $this->get('id')]);
if (empty($sys) || empty($sys->get('refreshtoken'))) {
return false;
}
$scopes = ap... | [
"public",
"function",
"is_system_account_connected",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_configured",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"sys",
"=",
"system_account",
"::",
"get_record",
"(",
"[",
"'issuerid'",
"=>",
... | Do we have a refresh token for a system account?
@return boolean | [
"Do",
"we",
"have",
"a",
"refresh",
"token",
"for",
"a",
"system",
"account?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/issuer.php#L187-L212 |
218,293 | moodle/moodle | lib/classes/oauth2/issuer.php | issuer.validate_baseurl | protected function validate_baseurl($value) {
global $CFG;
include_once($CFG->dirroot . '/lib/validateurlsyntax.php');
if (!empty($value) && !validateUrlSyntax($value, 'S+')) {
return new lang_string('sslonlyaccess', 'error');
}
return true;
} | php | protected function validate_baseurl($value) {
global $CFG;
include_once($CFG->dirroot . '/lib/validateurlsyntax.php');
if (!empty($value) && !validateUrlSyntax($value, 'S+')) {
return new lang_string('sslonlyaccess', 'error');
}
return true;
} | [
"protected",
"function",
"validate_baseurl",
"(",
"$",
"value",
")",
"{",
"global",
"$",
"CFG",
";",
"include_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/lib/validateurlsyntax.php'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"value",
")",
"&&",
"... | Custom validator for end point URLs.
Because we send Bearer tokens we must ensure SSL.
@param string $value The value to check.
@return lang_string|boolean | [
"Custom",
"validator",
"for",
"end",
"point",
"URLs",
".",
"Because",
"we",
"send",
"Bearer",
"tokens",
"we",
"must",
"ensure",
"SSL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/issuer.php#L221-L228 |
218,294 | moodle/moodle | admin/tool/health/index.php | problem_000018.find_problems | public function find_problems() {
global $DB;
static $answer = null;
if (is_null($answer)) {
$categories = $DB->get_records('course_categories', array(), 'id');
// Look for missing parents.
$missingparent = tool_health_category_find_missing_parents($categori... | php | public function find_problems() {
global $DB;
static $answer = null;
if (is_null($answer)) {
$categories = $DB->get_records('course_categories', array(), 'id');
// Look for missing parents.
$missingparent = tool_health_category_find_missing_parents($categori... | [
"public",
"function",
"find_problems",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"$",
"answer",
"=",
"null",
";",
"if",
"(",
"is_null",
"(",
"$",
"answer",
")",
")",
"{",
"$",
"categories",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"'course_... | Search for problems in the course categories.
@uses $DB
@return array List of categories that contain missing parents or loops. | [
"Search",
"for",
"problems",
"in",
"the",
"course",
"categories",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/health/index.php#L685-L702 |
218,295 | moodle/moodle | admin/tool/health/index.php | problem_000018.exists | public function exists() {
list($missingparent, $loops) = $this->find_problems();
return !empty($missingparent) || !empty($loops);
} | php | public function exists() {
list($missingparent, $loops) = $this->find_problems();
return !empty($missingparent) || !empty($loops);
} | [
"public",
"function",
"exists",
"(",
")",
"{",
"list",
"(",
"$",
"missingparent",
",",
"$",
"loops",
")",
"=",
"$",
"this",
"->",
"find_problems",
"(",
")",
";",
"return",
"!",
"empty",
"(",
"$",
"missingparent",
")",
"||",
"!",
"empty",
"(",
"$",
... | Check if the problem exists.
@return boolean True if either missing parents or loops found | [
"Check",
"if",
"the",
"problem",
"exists",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/health/index.php#L709-L712 |
218,296 | moodle/moodle | admin/tool/health/index.php | problem_000018.description | public function description() {
list($missingparent, $loops) = $this->find_problems();
$description = '<p>The course categories should be arranged into tree ' .
' structures by the course_categories.parent field. Sometimes ' .
' this tree structure gets messed up.</p>';
... | php | public function description() {
list($missingparent, $loops) = $this->find_problems();
$description = '<p>The course categories should be arranged into tree ' .
' structures by the course_categories.parent field. Sometimes ' .
' this tree structure gets messed up.</p>';
... | [
"public",
"function",
"description",
"(",
")",
"{",
"list",
"(",
"$",
"missingparent",
",",
"$",
"loops",
")",
"=",
"$",
"this",
"->",
"find_problems",
"(",
")",
";",
"$",
"description",
"=",
"'<p>The course categories should be arranged into tree '",
".",
"' st... | Generate problem description.
@return string HTML containing details of the problem. | [
"Generate",
"problem",
"description",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/health/index.php#L728-L739 |
218,297 | moodle/moodle | admin/tool/health/index.php | problem_000018.solution | public function solution() {
global $CFG;
list($missingparent, $loops) = $this->find_problems();
$solution = '<p>Consider executing the following SQL queries. These fix ' .
'the problem by moving some categories to the top level.</p>';
if (!empty($missingparent)) {
... | php | public function solution() {
global $CFG;
list($missingparent, $loops) = $this->find_problems();
$solution = '<p>Consider executing the following SQL queries. These fix ' .
'the problem by moving some categories to the top level.</p>';
if (!empty($missingparent)) {
... | [
"public",
"function",
"solution",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"list",
"(",
"$",
"missingparent",
",",
"$",
"loops",
")",
"=",
"$",
"this",
"->",
"find_problems",
"(",
")",
";",
"$",
"solution",
"=",
"'<p>Consider executing the following SQL que... | Generate solution text.
@uses $CFG
@return string HTML containing the suggested solution. | [
"Generate",
"solution",
"text",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/health/index.php#L747-L767 |
218,298 | moodle/moodle | course/classes/editcategory_form.php | core_course_editcategory_form.get_description_editor_options | public function get_description_editor_options() {
global $CFG;
$context = $this->_customdata['context'];
$itemid = $this->_customdata['itemid'];
return array(
'maxfiles' => EDITOR_UNLIMITED_FILES,
'maxbytes' => $CFG->maxbytes,
'trusttext' => true,
... | php | public function get_description_editor_options() {
global $CFG;
$context = $this->_customdata['context'];
$itemid = $this->_customdata['itemid'];
return array(
'maxfiles' => EDITOR_UNLIMITED_FILES,
'maxbytes' => $CFG->maxbytes,
'trusttext' => true,
... | [
"public",
"function",
"get_description_editor_options",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"context",
"=",
"$",
"this",
"->",
"_customdata",
"[",
"'context'",
"]",
";",
"$",
"itemid",
"=",
"$",
"this",
"->",
"_customdata",
"[",
"'itemid'",
"]",... | Returns the description editor options.
@return array | [
"Returns",
"the",
"description",
"editor",
"options",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/editcategory_form.php#L101-L112 |
218,299 | moodle/moodle | course/classes/editcategory_form.php | core_course_editcategory_form.validation | public function validation($data, $files) {
global $DB;
$errors = parent::validation($data, $files);
if (!empty($data['idnumber'])) {
if ($existing = $DB->get_record('course_categories', array('idnumber' => $data['idnumber']))) {
if (!$data['id'] || $existing->id != $... | php | public function validation($data, $files) {
global $DB;
$errors = parent::validation($data, $files);
if (!empty($data['idnumber'])) {
if ($existing = $DB->get_record('course_categories', array('idnumber' => $data['idnumber']))) {
if (!$data['id'] || $existing->id != $... | [
"public",
"function",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"errors",
"=",
"parent",
"::",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"data... | Validates the data submit for this form.
@param array $data An array of key,value data pairs.
@param array $files Any files that may have been submit as well.
@return array An array of errors. | [
"Validates",
"the",
"data",
"submit",
"for",
"this",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/editcategory_form.php#L121-L132 |
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.