id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
213,900 | moodle/moodle | lib/licenselib.php | license_manager.add | static public function add($license) {
global $DB;
if ($record = $DB->get_record('license', array('shortname'=>$license->shortname))) {
// record exists
if ($record->version < $license->version) {
// update license record
$license->enabled = $recor... | php | static public function add($license) {
global $DB;
if ($record = $DB->get_record('license', array('shortname'=>$license->shortname))) {
// record exists
if ($record->version < $license->version) {
// update license record
$license->enabled = $recor... | [
"static",
"public",
"function",
"add",
"(",
"$",
"license",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"record",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'license'",
",",
"array",
"(",
"'shortname'",
"=>",
"$",
"license",
"->",
"shortname",
... | Adding a new license type
@param object $license {
shortname => string a shortname of license, will be refered by files table[required]
fullname => string the fullname of the license [required]
source => string the homepage of the license type[required]
enabled => int is it enabled?
version => int a version number us... | [
"Adding",
"a",
"new",
"license",
"type"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/licenselib.php#L42-L56 |
213,901 | moodle/moodle | lib/licenselib.php | license_manager.get_licenses | static public function get_licenses($param = null) {
global $DB;
if (empty($param) || !is_array($param)) {
$param = array();
}
// get licenses by conditions
if ($records = $DB->get_records('license', $param)) {
return $records;
} else {
... | php | static public function get_licenses($param = null) {
global $DB;
if (empty($param) || !is_array($param)) {
$param = array();
}
// get licenses by conditions
if ($records = $DB->get_records('license', $param)) {
return $records;
} else {
... | [
"static",
"public",
"function",
"get_licenses",
"(",
"$",
"param",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"param",
")",
"||",
"!",
"is_array",
"(",
"$",
"param",
")",
")",
"{",
"$",
"param",
"=",
"array",
"... | Get license records
@param mixed $param
@return array | [
"Get",
"license",
"records"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/licenselib.php#L63-L74 |
213,902 | moodle/moodle | lib/licenselib.php | license_manager.enable | static public function enable($license) {
global $DB;
if ($license = self::get_license_by_shortname($license)) {
$license->enabled = 1;
$DB->update_record('license', $license);
}
self::set_active_licenses();
return true;
} | php | static public function enable($license) {
global $DB;
if ($license = self::get_license_by_shortname($license)) {
$license->enabled = 1;
$DB->update_record('license', $license);
}
self::set_active_licenses();
return true;
} | [
"static",
"public",
"function",
"enable",
"(",
"$",
"license",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"license",
"=",
"self",
"::",
"get_license_by_shortname",
"(",
"$",
"license",
")",
")",
"{",
"$",
"license",
"->",
"enabled",
"=",
"1",
... | Enable a license
@param string $license the shortname of license
@return boolean | [
"Enable",
"a",
"license"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/licenselib.php#L95-L103 |
213,903 | moodle/moodle | lib/licenselib.php | license_manager.disable | static public function disable($license) {
global $DB, $CFG;
// Site default license cannot be disabled!
if ($license == $CFG->sitedefaultlicense) {
print_error('error');
}
if ($license = self::get_license_by_shortname($license)) {
$license->enabled = 0;
... | php | static public function disable($license) {
global $DB, $CFG;
// Site default license cannot be disabled!
if ($license == $CFG->sitedefaultlicense) {
print_error('error');
}
if ($license = self::get_license_by_shortname($license)) {
$license->enabled = 0;
... | [
"static",
"public",
"function",
"disable",
"(",
"$",
"license",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"// Site default license cannot be disabled!",
"if",
"(",
"$",
"license",
"==",
"$",
"CFG",
"->",
"sitedefaultlicense",
")",
"{",
"print_error"... | Disable a license
@param string $license the shortname of license
@return boolean | [
"Disable",
"a",
"license"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/licenselib.php#L110-L122 |
213,904 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Tokenize.php | Horde_Imap_Client_Tokenize.addLiteralStream | public function addLiteralStream($data)
{
$pos = $this->_stream->pos();
if (!isset($this->_literals[$pos])) {
$this->_literals[$pos] = new Horde_Stream_Temp();
}
$this->_literals[$pos]->add($data);
} | php | public function addLiteralStream($data)
{
$pos = $this->_stream->pos();
if (!isset($this->_literals[$pos])) {
$this->_literals[$pos] = new Horde_Stream_Temp();
}
$this->_literals[$pos]->add($data);
} | [
"public",
"function",
"addLiteralStream",
"(",
"$",
"data",
")",
"{",
"$",
"pos",
"=",
"$",
"this",
"->",
"_stream",
"->",
"pos",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_literals",
"[",
"$",
"pos",
"]",
")",
")",
"{",
... | Add data to literal stream at the current position.
@param mixed $data Data to add (string, resource, or Horde_Stream
object). | [
"Add",
"data",
"to",
"literal",
"stream",
"at",
"the",
"current",
"position",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Tokenize.php#L147-L154 |
213,905 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Tokenize.php | Horde_Imap_Client_Tokenize.flushIterator | public function flushIterator($return = true, $sublevel = true)
{
$out = array();
if ($return) {
$this->_nextModify = array(
'level' => $sublevel ? $this->_level : 0,
'out' => array()
);
$this->next();
$out = $this->_ne... | php | public function flushIterator($return = true, $sublevel = true)
{
$out = array();
if ($return) {
$this->_nextModify = array(
'level' => $sublevel ? $this->_level : 0,
'out' => array()
);
$this->next();
$out = $this->_ne... | [
"public",
"function",
"flushIterator",
"(",
"$",
"return",
"=",
"true",
",",
"$",
"sublevel",
"=",
"true",
")",
"{",
"$",
"out",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"return",
")",
"{",
"$",
"this",
"->",
"_nextModify",
"=",
"array",
"(",
... | Flush the remaining entries left in the iterator.
@param boolean $return If true, return entries. Only returns entries
on the current level.
@param boolean $sublevel Only flush items in current sublevel?
@return array The entries if $return is true. | [
"Flush",
"the",
"remaining",
"entries",
"left",
"in",
"the",
"iterator",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Tokenize.php#L165-L190 |
213,906 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Tokenize.php | Horde_Imap_Client_Tokenize.getLiteralLength | public function getLiteralLength()
{
if ($this->_stream->substring(-1, 1) === '}') {
$literal_data = $this->_stream->getString(
$this->_stream->search('{', true) - 1
);
$literal_len = substr($literal_data, 2, -1);
if (is_numeric($literal_len))... | php | public function getLiteralLength()
{
if ($this->_stream->substring(-1, 1) === '}') {
$literal_data = $this->_stream->getString(
$this->_stream->search('{', true) - 1
);
$literal_len = substr($literal_data, 2, -1);
if (is_numeric($literal_len))... | [
"public",
"function",
"getLiteralLength",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_stream",
"->",
"substring",
"(",
"-",
"1",
",",
"1",
")",
"===",
"'}'",
")",
"{",
"$",
"literal_data",
"=",
"$",
"this",
"->",
"_stream",
"->",
"getString",
"(",... | Return literal length data located at the end of the stream.
@return mixed Null if no literal data found, or an array with these
keys:
- binary: (boolean) True if this is a literal8.
- length: (integer) Length of the literal. | [
"Return",
"literal",
"length",
"data",
"located",
"at",
"the",
"end",
"of",
"the",
"stream",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Tokenize.php#L200-L217 |
213,907 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Tokenize.php | Horde_Imap_Client_Tokenize.nextStream | public function nextStream()
{
$changed = $this->_literalStream;
$this->_literalStream = true;
$out = $this->next();
if ($changed) {
$this->_literalStream = false;
}
return $out;
} | php | public function nextStream()
{
$changed = $this->_literalStream;
$this->_literalStream = true;
$out = $this->next();
if ($changed) {
$this->_literalStream = false;
}
return $out;
} | [
"public",
"function",
"nextStream",
"(",
")",
"{",
"$",
"changed",
"=",
"$",
"this",
"->",
"_literalStream",
";",
"$",
"this",
"->",
"_literalStream",
"=",
"true",
";",
"$",
"out",
"=",
"$",
"this",
"->",
"next",
"(",
")",
";",
"if",
"(",
"$",
"cha... | Force return of literal data as stream, if next token.
@see next() | [
"Force",
"return",
"of",
"literal",
"data",
"as",
"stream",
"if",
"next",
"token",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Tokenize.php#L382-L394 |
213,908 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/Printer/ConfigForm.php | HTMLPurifier_Printer_ConfigForm.setTextareaDimensions | public function setTextareaDimensions($cols = null, $rows = null)
{
if ($cols) {
$this->fields['default']->cols = $cols;
}
if ($rows) {
$this->fields['default']->rows = $rows;
}
} | php | public function setTextareaDimensions($cols = null, $rows = null)
{
if ($cols) {
$this->fields['default']->cols = $cols;
}
if ($rows) {
$this->fields['default']->rows = $rows;
}
} | [
"public",
"function",
"setTextareaDimensions",
"(",
"$",
"cols",
"=",
"null",
",",
"$",
"rows",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"cols",
")",
"{",
"$",
"this",
"->",
"fields",
"[",
"'default'",
"]",
"->",
"cols",
"=",
"$",
"cols",
";",
"}",
... | Sets default column and row size for textareas in sub-printers
@param $cols Integer columns of textarea, null to use default
@param $rows Integer rows of textarea, null to use default | [
"Sets",
"default",
"column",
"and",
"row",
"size",
"for",
"textareas",
"in",
"sub",
"-",
"printers"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Printer/ConfigForm.php#L59-L67 |
213,909 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/Printer/ConfigForm.php | HTMLPurifier_Printer_ConfigForm.render | public function render($config, $allowed = true, $render_controls = true)
{
if (is_array($config) && isset($config[0])) {
$gen_config = $config[0];
$config = $config[1];
} else {
$gen_config = $config;
}
$this->config = $config;
$this->gen... | php | public function render($config, $allowed = true, $render_controls = true)
{
if (is_array($config) && isset($config[0])) {
$gen_config = $config[0];
$config = $config[1];
} else {
$gen_config = $config;
}
$this->config = $config;
$this->gen... | [
"public",
"function",
"render",
"(",
"$",
"config",
",",
"$",
"allowed",
"=",
"true",
",",
"$",
"render_controls",
"=",
"true",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"config",
")",
"&&",
"isset",
"(",
"$",
"config",
"[",
"0",
"]",
")",
")",
... | Returns HTML output for a configuration form
@param HTMLPurifier_Config|array $config Configuration object of current form state, or an array
where [0] has an HTML namespace and [1] is being rendered.
@param array|bool $allowed Optional namespace(s) and directives to restrict form to.
@param bool $render_controls
@retu... | [
"Returns",
"HTML",
"output",
"for",
"a",
"configuration",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Printer/ConfigForm.php#L93-L136 |
213,910 | moodle/moodle | user/profile/field/menu/define.class.php | profile_define_menu.define_validate_specific | public function define_validate_specific($data, $files) {
$err = array();
$data->param1 = str_replace("\r", '', $data->param1);
// Check that we have at least 2 options.
if (($options = explode("\n", $data->param1)) === false) {
$err['param1'] = get_string('profilemenunoopt... | php | public function define_validate_specific($data, $files) {
$err = array();
$data->param1 = str_replace("\r", '', $data->param1);
// Check that we have at least 2 options.
if (($options = explode("\n", $data->param1)) === false) {
$err['param1'] = get_string('profilemenunoopt... | [
"public",
"function",
"define_validate_specific",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"$",
"err",
"=",
"array",
"(",
")",
";",
"$",
"data",
"->",
"param1",
"=",
"str_replace",
"(",
"\"\\r\"",
",",
"''",
",",
"$",
"data",
"->",
"param1",
")... | Validates data for the profile field.
@param array $data
@param array $files
@return array | [
"Validates",
"data",
"for",
"the",
"profile",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/field/menu/define.class.php#L54-L69 |
213,911 | moodle/moodle | mod/assign/renderer.php | mod_assign_renderer.add_table_row_tuple | private function add_table_row_tuple(html_table $table, $first, $second) {
$row = new html_table_row();
$cell1 = new html_table_cell($first);
$cell2 = new html_table_cell($second);
$row->cells = array($cell1, $cell2);
$table->data[] = $row;
} | php | private function add_table_row_tuple(html_table $table, $first, $second) {
$row = new html_table_row();
$cell1 = new html_table_cell($first);
$cell2 = new html_table_cell($second);
$row->cells = array($cell1, $cell2);
$table->data[] = $row;
} | [
"private",
"function",
"add_table_row_tuple",
"(",
"html_table",
"$",
"table",
",",
"$",
"first",
",",
"$",
"second",
")",
"{",
"$",
"row",
"=",
"new",
"html_table_row",
"(",
")",
";",
"$",
"cell1",
"=",
"new",
"html_table_cell",
"(",
"$",
"first",
")",
... | Utility function to add a row of data to a table with 2 columns. Modified
the table param and does not return a value
@param html_table $table The table to append the row of data to
@param string $first The first column text
@param string $second The second column text
@return void | [
"Utility",
"function",
"to",
"add",
"a",
"row",
"of",
"data",
"to",
"a",
"table",
"with",
"2",
"columns",
".",
"Modified",
"the",
"table",
"param",
"and",
"does",
"not",
"return",
"a",
"value"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/renderer.php#L81-L87 |
213,912 | moodle/moodle | mod/assign/renderer.php | mod_assign_renderer.render_assign_gradingmessage | public function render_assign_gradingmessage(assign_gradingmessage $result) {
$urlparams = array('id' => $result->coursemoduleid, 'action'=>'grading');
if (!empty($result->page)) {
$urlparams['page'] = $result->page;
}
$url = new moodle_url('/mod/assign/view.php', $urlparams)... | php | public function render_assign_gradingmessage(assign_gradingmessage $result) {
$urlparams = array('id' => $result->coursemoduleid, 'action'=>'grading');
if (!empty($result->page)) {
$urlparams['page'] = $result->page;
}
$url = new moodle_url('/mod/assign/view.php', $urlparams)... | [
"public",
"function",
"render_assign_gradingmessage",
"(",
"assign_gradingmessage",
"$",
"result",
")",
"{",
"$",
"urlparams",
"=",
"array",
"(",
"'id'",
"=>",
"$",
"result",
"->",
"coursemoduleid",
",",
"'action'",
"=>",
"'grading'",
")",
";",
"if",
"(",
"!",... | Render a grading message notification
@param assign_gradingmessage $result The result to render
@return string | [
"Render",
"a",
"grading",
"message",
"notification"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/renderer.php#L94-L107 |
213,913 | moodle/moodle | mod/assign/renderer.php | mod_assign_renderer.render_assign_form | public function render_assign_form(assign_form $form) {
$o = '';
if ($form->jsinitfunction) {
$this->page->requires->js_init_call($form->jsinitfunction, array());
}
$o .= $this->output->box_start('boxaligncenter ' . $form->classname);
$o .= $this->moodleform($form->fo... | php | public function render_assign_form(assign_form $form) {
$o = '';
if ($form->jsinitfunction) {
$this->page->requires->js_init_call($form->jsinitfunction, array());
}
$o .= $this->output->box_start('boxaligncenter ' . $form->classname);
$o .= $this->moodleform($form->fo... | [
"public",
"function",
"render_assign_form",
"(",
"assign_form",
"$",
"form",
")",
"{",
"$",
"o",
"=",
"''",
";",
"if",
"(",
"$",
"form",
"->",
"jsinitfunction",
")",
"{",
"$",
"this",
"->",
"page",
"->",
"requires",
"->",
"js_init_call",
"(",
"$",
"for... | Render the generic form
@param assign_form $form The form to render
@return string | [
"Render",
"the",
"generic",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/renderer.php#L114-L123 |
213,914 | moodle/moodle | mod/assign/renderer.php | mod_assign_renderer.render_assign_user_summary | public function render_assign_user_summary(assign_user_summary $summary) {
$o = '';
$supendedclass = '';
$suspendedicon = '';
if (!$summary->user) {
return;
}
if ($summary->suspendeduser) {
$supendedclass = ' usersuspended';
$suspende... | php | public function render_assign_user_summary(assign_user_summary $summary) {
$o = '';
$supendedclass = '';
$suspendedicon = '';
if (!$summary->user) {
return;
}
if ($summary->suspendeduser) {
$supendedclass = ' usersuspended';
$suspende... | [
"public",
"function",
"render_assign_user_summary",
"(",
"assign_user_summary",
"$",
"summary",
")",
"{",
"$",
"o",
"=",
"''",
";",
"$",
"supendedclass",
"=",
"''",
";",
"$",
"suspendedicon",
"=",
"''",
";",
"if",
"(",
"!",
"$",
"summary",
"->",
"user",
... | Render the user summary
@param assign_user_summary $summary The user summary to render
@return string | [
"Render",
"the",
"user",
"summary"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/renderer.php#L131-L169 |
213,915 | moodle/moodle | mod/assign/renderer.php | mod_assign_renderer.render_assign_submit_for_grading_page | public function render_assign_submit_for_grading_page($page) {
$o = '';
$o .= $this->output->container_start('submitforgrading');
$o .= $this->output->heading(get_string('confirmsubmissionheading', 'assign'), 3);
$cancelurl = new moodle_url('/mod/assign/view.php', array('id' => $page->... | php | public function render_assign_submit_for_grading_page($page) {
$o = '';
$o .= $this->output->container_start('submitforgrading');
$o .= $this->output->heading(get_string('confirmsubmissionheading', 'assign'), 3);
$cancelurl = new moodle_url('/mod/assign/view.php', array('id' => $page->... | [
"public",
"function",
"render_assign_submit_for_grading_page",
"(",
"$",
"page",
")",
"{",
"$",
"o",
"=",
"''",
";",
"$",
"o",
".=",
"$",
"this",
"->",
"output",
"->",
"container_start",
"(",
"'submitforgrading'",
")",
";",
"$",
"o",
".=",
"$",
"this",
"... | Render the submit for grading page
@param assign_submit_for_grading_page $page
@return string | [
"Render",
"the",
"submit",
"for",
"grading",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/renderer.php#L177-L201 |
213,916 | moodle/moodle | mod/assign/renderer.php | mod_assign_renderer.render_assign_header | public function render_assign_header(assign_header $header) {
$o = '';
if ($header->subpage) {
$this->page->navbar->add($header->subpage);
$args = ['contextname' => $header->context->get_context_name(false, true), 'subpage' => $header->subpage];
$title = get_string('... | php | public function render_assign_header(assign_header $header) {
$o = '';
if ($header->subpage) {
$this->page->navbar->add($header->subpage);
$args = ['contextname' => $header->context->get_context_name(false, true), 'subpage' => $header->subpage];
$title = get_string('... | [
"public",
"function",
"render_assign_header",
"(",
"assign_header",
"$",
"header",
")",
"{",
"$",
"o",
"=",
"''",
";",
"if",
"(",
"$",
"header",
"->",
"subpage",
")",
"{",
"$",
"this",
"->",
"page",
"->",
"navbar",
"->",
"add",
"(",
"$",
"header",
"-... | Render the header.
@param assign_header $header
@return string | [
"Render",
"the",
"header",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/renderer.php#L218-L249 |
213,917 | moodle/moodle | mod/assign/renderer.php | mod_assign_renderer.render_assign_attempt_history_chooser | public function render_assign_attempt_history_chooser(assign_attempt_history_chooser $history) {
$o = '';
$context = $history->export_for_template($this);
$o .= $this->render_from_template('mod_assign/attempt_history_chooser', $context);
return $o;
} | php | public function render_assign_attempt_history_chooser(assign_attempt_history_chooser $history) {
$o = '';
$context = $history->export_for_template($this);
$o .= $this->render_from_template('mod_assign/attempt_history_chooser', $context);
return $o;
} | [
"public",
"function",
"render_assign_attempt_history_chooser",
"(",
"assign_attempt_history_chooser",
"$",
"history",
")",
"{",
"$",
"o",
"=",
"''",
";",
"$",
"context",
"=",
"$",
"history",
"->",
"export_for_template",
"(",
"$",
"this",
")",
";",
"$",
"o",
".... | Output the attempt history chooser for this assignment
@param assign_attempt_history_chooser $history
@return string | [
"Output",
"the",
"attempt",
"history",
"chooser",
"for",
"this",
"assignment"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/renderer.php#L996-L1003 |
213,918 | moodle/moodle | mod/assign/renderer.php | mod_assign_renderer.render_assign_grading_table | public function render_assign_grading_table(assign_grading_table $table) {
$o = '';
$o .= $this->output->box_start('boxaligncenter gradingtable');
$this->page->requires->js_init_call('M.mod_assign.init_grading_table', array());
$this->page->requires->string_for_js('nousersselected', 'as... | php | public function render_assign_grading_table(assign_grading_table $table) {
$o = '';
$o .= $this->output->box_start('boxaligncenter gradingtable');
$this->page->requires->js_init_call('M.mod_assign.init_grading_table', array());
$this->page->requires->string_for_js('nousersselected', 'as... | [
"public",
"function",
"render_assign_grading_table",
"(",
"assign_grading_table",
"$",
"table",
")",
"{",
"$",
"o",
"=",
"''",
";",
"$",
"o",
".=",
"$",
"this",
"->",
"output",
"->",
"box_start",
"(",
"'boxaligncenter gradingtable'",
")",
";",
"$",
"this",
"... | Render the grading table.
@param assign_grading_table $table
@return string | [
"Render",
"the",
"grading",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/renderer.php#L1237-L1263 |
213,919 | moodle/moodle | mod/assign/renderer.php | mod_assign_renderer.render_assign_course_index_summary | public function render_assign_course_index_summary(assign_course_index_summary $indexsummary) {
$o = '';
$strplural = get_string('modulenameplural', 'assign');
$strsectionname = $indexsummary->courseformatname;
$strduedate = get_string('duedate', 'assign');
$strsubmission = get... | php | public function render_assign_course_index_summary(assign_course_index_summary $indexsummary) {
$o = '';
$strplural = get_string('modulenameplural', 'assign');
$strsectionname = $indexsummary->courseformatname;
$strduedate = get_string('duedate', 'assign');
$strsubmission = get... | [
"public",
"function",
"render_assign_course_index_summary",
"(",
"assign_course_index_summary",
"$",
"indexsummary",
")",
"{",
"$",
"o",
"=",
"''",
";",
"$",
"strplural",
"=",
"get_string",
"(",
"'modulenameplural'",
",",
"'assign'",
")",
";",
"$",
"strsectionname",... | Render a course index summary
@param assign_course_index_summary $indexsummary
@return string | [
"Render",
"a",
"course",
"index",
"summary"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/renderer.php#L1340-L1390 |
213,920 | moodle/moodle | mod/assign/renderer.php | mod_assign_renderer.flexible_table | protected function flexible_table(flexible_table $table, $rowsperpage, $displaylinks) {
$o = '';
ob_start();
$table->out($rowsperpage, $displaylinks);
$o = ob_get_contents();
ob_end_clean();
return $o;
} | php | protected function flexible_table(flexible_table $table, $rowsperpage, $displaylinks) {
$o = '';
ob_start();
$table->out($rowsperpage, $displaylinks);
$o = ob_get_contents();
ob_end_clean();
return $o;
} | [
"protected",
"function",
"flexible_table",
"(",
"flexible_table",
"$",
"table",
",",
"$",
"rowsperpage",
",",
"$",
"displaylinks",
")",
"{",
"$",
"o",
"=",
"''",
";",
"ob_start",
"(",
")",
";",
"$",
"table",
"->",
"out",
"(",
"$",
"rowsperpage",
",",
"... | Helper method dealing with the fact we can not just fetch the output of flexible_table
@param flexible_table $table The table to render
@param int $rowsperpage How many assignments to render in a page
@param bool $displaylinks - Whether to render links in the table
(e.g. downloads would not enable this)
@return string... | [
"Helper",
"method",
"dealing",
"with",
"the",
"fact",
"we",
"can",
"not",
"just",
"fetch",
"the",
"output",
"of",
"flexible_table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/renderer.php#L1463-L1472 |
213,921 | moodle/moodle | mod/assign/renderer.php | mod_assign_renderer.render_grading_app | public function render_grading_app(grading_app $app) {
$context = $app->export_for_template($this);
return $this->render_from_template('mod_assign/grading_app', $context);
} | php | public function render_grading_app(grading_app $app) {
$context = $app->export_for_template($this);
return $this->render_from_template('mod_assign/grading_app', $context);
} | [
"public",
"function",
"render_grading_app",
"(",
"grading_app",
"$",
"app",
")",
"{",
"$",
"context",
"=",
"$",
"app",
"->",
"export_for_template",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
"render_from_template",
"(",
"'mod_assign/grading_app'",
... | Defer to template..
@param grading_app $app - All the data to render the grading app. | [
"Defer",
"to",
"template",
".."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/renderer.php#L1496-L1499 |
213,922 | moodle/moodle | lib/xmlize.php | core_xml_parser.startelement | private function startelement($parser, $name, $attrs) {
$current = &$this->current;
$level = &$this->level;
if (!empty($name)) {
if ($level == 0) {
$current[$level][$name] = array();
$current[$level][$name]["@"] = $attrs; // Attribute.
... | php | private function startelement($parser, $name, $attrs) {
$current = &$this->current;
$level = &$this->level;
if (!empty($name)) {
if ($level == 0) {
$current[$level][$name] = array();
$current[$level][$name]["@"] = $attrs; // Attribute.
... | [
"private",
"function",
"startelement",
"(",
"$",
"parser",
",",
"$",
"name",
",",
"$",
"attrs",
")",
"{",
"$",
"current",
"=",
"&",
"$",
"this",
"->",
"current",
";",
"$",
"level",
"=",
"&",
"$",
"this",
"->",
"level",
";",
"if",
"(",
"!",
"empty... | Is called when tags are opened.
Note: Used by xml element handler as callback.
@author Kilian Singer
@param resource $parser The XML parser resource.
@param string $name The XML source to parse.
@param array $attrs Stores attributes of XML tag. | [
"Is",
"called",
"when",
"tags",
"are",
"opened",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmlize.php#L101-L124 |
213,923 | moodle/moodle | lib/xmlize.php | core_xml_parser.endelement | private function endelement($parser, $name) {
$current = &$this->current;
$level = &$this->level;
if (!empty($name)) {
if (empty($current[$level])) {
$current[$level] = '';
} else if (array_key_exists(0, $current[$level])) {
if (count($curr... | php | private function endelement($parser, $name) {
$current = &$this->current;
$level = &$this->level;
if (!empty($name)) {
if (empty($current[$level])) {
$current[$level] = '';
} else if (array_key_exists(0, $current[$level])) {
if (count($curr... | [
"private",
"function",
"endelement",
"(",
"$",
"parser",
",",
"$",
"name",
")",
"{",
"$",
"current",
"=",
"&",
"$",
"this",
"->",
"current",
";",
"$",
"level",
"=",
"&",
"$",
"this",
"->",
"level",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"name",
... | Is called when tags are closed.
Note: Used by xml element handler as callback.
@author Kilian Singer
@param resource $parser The XML parser resource.
@param string $name The XML source to parse. | [
"Is",
"called",
"when",
"tags",
"are",
"closed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmlize.php#L135-L149 |
213,924 | moodle/moodle | lib/xmlize.php | core_xml_parser.characterdata | private function characterdata($parser, $data) {
$current = &$this->current;
$level = &$this->level;
if (($data == "0") || (!empty($data) && trim($data) != "")) {
$siz = count($current[$level]);
if ($siz == 0) {
$current[$level][0] = $data;
} e... | php | private function characterdata($parser, $data) {
$current = &$this->current;
$level = &$this->level;
if (($data == "0") || (!empty($data) && trim($data) != "")) {
$siz = count($current[$level]);
if ($siz == 0) {
$current[$level][0] = $data;
} e... | [
"private",
"function",
"characterdata",
"(",
"$",
"parser",
",",
"$",
"data",
")",
"{",
"$",
"current",
"=",
"&",
"$",
"this",
"->",
"current",
";",
"$",
"level",
"=",
"&",
"$",
"this",
"->",
"level",
";",
"if",
"(",
"(",
"$",
"data",
"==",
"\"0\... | Is called for text between the start and the end of tags.
Note: Used by xml element handler as callback.
@author Kilian Singer
@param resource $parser The XML parser resource.
@param string $data The XML source to parse. | [
"Is",
"called",
"for",
"text",
"between",
"the",
"start",
"and",
"the",
"end",
"of",
"tags",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmlize.php#L159-L180 |
213,925 | moodle/moodle | lib/xmlize.php | core_xml_parser.parse | public function parse($data, $whitespace = 1, $encoding = 'UTF-8', $reporterrors = false) {
$data = trim($data);
$this->xml = array();
$this->current = array();
$this->level = 0;
$this->current[0] = & $this->xml;
$parser = xml_parser_create($encoding);
xml_parser_... | php | public function parse($data, $whitespace = 1, $encoding = 'UTF-8', $reporterrors = false) {
$data = trim($data);
$this->xml = array();
$this->current = array();
$this->level = 0;
$this->current[0] = & $this->xml;
$parser = xml_parser_create($encoding);
xml_parser_... | [
"public",
"function",
"parse",
"(",
"$",
"data",
",",
"$",
"whitespace",
"=",
"1",
",",
"$",
"encoding",
"=",
"'UTF-8'",
",",
"$",
"reporterrors",
"=",
"false",
")",
"{",
"$",
"data",
"=",
"trim",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"x... | Parses XML string.
Note: Interface is kept equal to previous version.
@author Kilian Singer
@param string $data the XML source to parse.
@param int $whitespace If set to 1 allows the parser to skip "space" characters in xml document. Default is 1
@param string $encoding Specify an OUTPUT encoding. If not specified, i... | [
"Parses",
"XML",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmlize.php#L195-L227 |
213,926 | moodle/moodle | mod/resource/backup/moodle1/lib.php | moodle1_mod_resource_handler.on_resource_end | public function on_resource_end(array $data) {
if ($successor = $this->get_successor($data['type'], $data['reference'])) {
$successor->on_legacy_resource_end($data);
}
} | php | public function on_resource_end(array $data) {
if ($successor = $this->get_successor($data['type'], $data['reference'])) {
$successor->on_legacy_resource_end($data);
}
} | [
"public",
"function",
"on_resource_end",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"successor",
"=",
"$",
"this",
"->",
"get_successor",
"(",
"$",
"data",
"[",
"'type'",
"]",
",",
"$",
"data",
"[",
"'reference'",
"]",
")",
")",
"{",
"$",
... | Give succesors a chance to finish their job | [
"Give",
"succesors",
"a",
"chance",
"to",
"finish",
"their",
"job"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/resource/backup/moodle1/lib.php#L235-L239 |
213,927 | moodle/moodle | mod/resource/backup/moodle1/lib.php | moodle1_mod_resource_handler.get_successor | protected function get_successor($type, $reference) {
switch ($type) {
case 'text':
case 'html':
$name = 'page';
break;
case 'directory':
$name = 'folder';
break;
case 'ims':
$name = ... | php | protected function get_successor($type, $reference) {
switch ($type) {
case 'text':
case 'html':
$name = 'page';
break;
case 'directory':
$name = 'folder';
break;
case 'ims':
$name = ... | [
"protected",
"function",
"get_successor",
"(",
"$",
"type",
",",
"$",
"reference",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'text'",
":",
"case",
"'html'",
":",
"$",
"name",
"=",
"'page'",
";",
"break",
";",
"case",
"'directory'",
":",
... | Returns the handler of the new 2.0 mod type according the given type of the legacy 1.9 resource
@param string $type the value of the 'type' field in 1.9 resource
@param string $reference a file path. Necessary to differentiate files from web URLs
@throws moodle1_convert_exception for the unknown types
@return null|moo... | [
"Returns",
"the",
"handler",
"of",
"the",
"new",
"2",
".",
"0",
"mod",
"type",
"according",
"the",
"given",
"type",
"of",
"the",
"legacy",
"1",
".",
"9",
"resource"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/resource/backup/moodle1/lib.php#L251-L305 |
213,928 | moodle/moodle | user/renderer.php | core_user_renderer.user_list | public function user_list($userlist, $exclusivemode) {
$tagfeed = new core_tag\output\tagfeed();
foreach ($userlist as $user) {
$userpicture = $this->output->user_picture($user, array('size' => $exclusivemode ? 100 : 35));
$fullname = fullname($user);
if (user_can_vie... | php | public function user_list($userlist, $exclusivemode) {
$tagfeed = new core_tag\output\tagfeed();
foreach ($userlist as $user) {
$userpicture = $this->output->user_picture($user, array('size' => $exclusivemode ? 100 : 35));
$fullname = fullname($user);
if (user_can_vie... | [
"public",
"function",
"user_list",
"(",
"$",
"userlist",
",",
"$",
"exclusivemode",
")",
"{",
"$",
"tagfeed",
"=",
"new",
"core_tag",
"\\",
"output",
"\\",
"tagfeed",
"(",
")",
";",
"foreach",
"(",
"$",
"userlist",
"as",
"$",
"user",
")",
"{",
"$",
"... | Displays the list of tagged users
@param array $userlist
@param bool $exclusivemode if set to true it means that no other entities tagged with this tag
are displayed on the page and the per-page limit may be bigger
@return string | [
"Displays",
"the",
"list",
"of",
"tagged",
"users"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/renderer.php#L86-L110 |
213,929 | moodle/moodle | user/renderer.php | core_user_renderer.format_filter_option | protected function format_filter_option($filtertype, $criteria, $value, $label) {
$optionlabel = get_string('filteroption', 'moodle', (object)['criteria' => $criteria, 'value' => $label]);
$optionvalue = "$filtertype:$value";
return [$optionvalue => $optionlabel];
} | php | protected function format_filter_option($filtertype, $criteria, $value, $label) {
$optionlabel = get_string('filteroption', 'moodle', (object)['criteria' => $criteria, 'value' => $label]);
$optionvalue = "$filtertype:$value";
return [$optionvalue => $optionlabel];
} | [
"protected",
"function",
"format_filter_option",
"(",
"$",
"filtertype",
",",
"$",
"criteria",
",",
"$",
"value",
",",
"$",
"label",
")",
"{",
"$",
"optionlabel",
"=",
"get_string",
"(",
"'filteroption'",
",",
"'moodle'",
",",
"(",
"object",
")",
"[",
"'cr... | Returns a formatted filter option.
@param int $filtertype The filter type (e.g. status, role, group, enrolment, last access).
@param string $criteria The string label of the filter type.
@param int $value The value for the filter option.
@param string $label The string representation of the filter option's value.
@ret... | [
"Returns",
"a",
"formatted",
"filter",
"option",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/renderer.php#L272-L276 |
213,930 | moodle/moodle | user/renderer.php | core_user_renderer.handle_missing_applied_filters | private function handle_missing_applied_filters($filtersapplied, $filteroptions) {
global $DB;
foreach ($filtersapplied as $filter) {
if (!array_key_exists($filter, $filteroptions)) {
$filtervalue = explode(':', $filter);
if (count($filtervalue) !== 2) {
... | php | private function handle_missing_applied_filters($filtersapplied, $filteroptions) {
global $DB;
foreach ($filtersapplied as $filter) {
if (!array_key_exists($filter, $filteroptions)) {
$filtervalue = explode(':', $filter);
if (count($filtervalue) !== 2) {
... | [
"private",
"function",
"handle_missing_applied_filters",
"(",
"$",
"filtersapplied",
",",
"$",
"filteroptions",
")",
"{",
"global",
"$",
"DB",
";",
"foreach",
"(",
"$",
"filtersapplied",
"as",
"$",
"filter",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
... | Handles cases when after reloading the applied filters are missing in the filter options.
@param array $filtersapplied The applied filters.
@param array $filteroptions The filter options.
@return array The formatted options with the ['filtertype:value' => 'criteria: label'] format. | [
"Handles",
"cases",
"when",
"after",
"reloading",
"the",
"applied",
"filters",
"are",
"missing",
"in",
"the",
"filter",
"options",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/renderer.php#L285-L346 |
213,931 | moodle/moodle | course/format/lib.php | format_base.get_format_or_default | protected static final function get_format_or_default($format) {
global $CFG;
require_once($CFG->dirroot . '/course/lib.php');
if (array_key_exists($format, self::$classesforformat)) {
return self::$classesforformat[$format];
}
$plugins = get_sorted_course_formats()... | php | protected static final function get_format_or_default($format) {
global $CFG;
require_once($CFG->dirroot . '/course/lib.php');
if (array_key_exists($format, self::$classesforformat)) {
return self::$classesforformat[$format];
}
$plugins = get_sorted_course_formats()... | [
"protected",
"static",
"final",
"function",
"get_format_or_default",
"(",
"$",
"format",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/course/lib.php'",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"form... | Validates that course format exists and enabled and returns either itself or default format
@param string $format
@return string | [
"Validates",
"that",
"course",
"format",
"exists",
"and",
"enabled",
"and",
"returns",
"either",
"itself",
"or",
"default",
"format"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L98-L130 |
213,932 | moodle/moodle | course/format/lib.php | format_base.get_class_name | protected static final function get_class_name($format) {
global $CFG;
static $classnames = array('site' => 'format_site');
if (!isset($classnames[$format])) {
$plugins = core_component::get_plugin_list('format');
$usedformat = self::get_format_or_default($format);
... | php | protected static final function get_class_name($format) {
global $CFG;
static $classnames = array('site' => 'format_site');
if (!isset($classnames[$format])) {
$plugins = core_component::get_plugin_list('format');
$usedformat = self::get_format_or_default($format);
... | [
"protected",
"static",
"final",
"function",
"get_class_name",
"(",
"$",
"format",
")",
"{",
"global",
"$",
"CFG",
";",
"static",
"$",
"classnames",
"=",
"array",
"(",
"'site'",
"=>",
"'format_site'",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"classnam... | Get class name for the format
If course format xxx does not declare class format_xxx, format_legacy will be returned.
This function also includes lib.php file from corresponding format plugin
@param string $format
@return string | [
"Get",
"class",
"name",
"for",
"the",
"format"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L141-L157 |
213,933 | moodle/moodle | course/format/lib.php | format_base.instance | public static final function instance($courseorid) {
global $DB;
if (!is_object($courseorid)) {
$courseid = (int)$courseorid;
if ($courseid && isset(self::$instances[$courseid]) && count(self::$instances[$courseid]) == 1) {
$formats = array_keys(self::$instances[$... | php | public static final function instance($courseorid) {
global $DB;
if (!is_object($courseorid)) {
$courseid = (int)$courseorid;
if ($courseid && isset(self::$instances[$courseid]) && count(self::$instances[$courseid]) == 1) {
$formats = array_keys(self::$instances[$... | [
"public",
"static",
"final",
"function",
"instance",
"(",
"$",
"courseorid",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"courseorid",
")",
")",
"{",
"$",
"courseid",
"=",
"(",
"int",
")",
"$",
"courseorid",
";",
"if",
... | Returns an instance of the class
@todo MDL-35727 use MUC for caching of instances, limit the number of cached instances
@param int|stdClass $courseorid either course id or
an object that has the property 'format' and may contain property 'id'
@return format_base | [
"Returns",
"an",
"instance",
"of",
"the",
"class"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L168-L193 |
213,934 | moodle/moodle | course/format/lib.php | format_base.get_course | public function get_course() {
global $DB;
if (!$this->courseid) {
return null;
}
if ($this->course === false) {
$this->course = get_course($this->courseid);
$options = $this->get_format_options();
$dbcoursecolumns = null;
forea... | php | public function get_course() {
global $DB;
if (!$this->courseid) {
return null;
}
if ($this->course === false) {
$this->course = get_course($this->courseid);
$options = $this->get_format_options();
$dbcoursecolumns = null;
forea... | [
"public",
"function",
"get_course",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"courseid",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"course",
"===",
"false",
")",
"{",
"$",
"this",
"->",... | Returns a record from course database table plus additional fields
that course format defines
@return stdClass | [
"Returns",
"a",
"record",
"from",
"course",
"database",
"table",
"plus",
"additional",
"fields",
"that",
"course",
"format",
"defines"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L240-L266 |
213,935 | moodle/moodle | course/format/lib.php | format_base.get_last_section_number | public function get_last_section_number() {
$course = $this->get_course();
if (isset($course->numsections)) {
return $course->numsections;
}
$modinfo = get_fast_modinfo($course);
$sections = $modinfo->get_section_info_all();
return (int)max(array_keys($section... | php | public function get_last_section_number() {
$course = $this->get_course();
if (isset($course->numsections)) {
return $course->numsections;
}
$modinfo = get_fast_modinfo($course);
$sections = $modinfo->get_section_info_all();
return (int)max(array_keys($section... | [
"public",
"function",
"get_last_section_number",
"(",
")",
"{",
"$",
"course",
"=",
"$",
"this",
"->",
"get_course",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"course",
"->",
"numsections",
")",
")",
"{",
"return",
"$",
"course",
"->",
"numsections",
... | Method used in the rendered and during backup instead of legacy 'numsections'
Default renderer will treat sections with sectionnumber greater that the value returned by this
method as "orphaned" and not display them on the course page unless in editing mode.
Backup will store this value as 'numsections'.
This method ... | [
"Method",
"used",
"in",
"the",
"rendered",
"and",
"during",
"backup",
"instead",
"of",
"legacy",
"numsections"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L280-L288 |
213,936 | moodle/moodle | course/format/lib.php | format_base.get_section | public final function get_section($section, $strictness = IGNORE_MISSING) {
if (is_object($section)) {
$sectionnum = $section->section;
} else {
$sectionnum = $section;
}
$sections = $this->get_sections();
if (array_key_exists($sectionnum, $sections)) {
... | php | public final function get_section($section, $strictness = IGNORE_MISSING) {
if (is_object($section)) {
$sectionnum = $section->section;
} else {
$sectionnum = $section;
}
$sections = $this->get_sections();
if (array_key_exists($sectionnum, $sections)) {
... | [
"public",
"final",
"function",
"get_section",
"(",
"$",
"section",
",",
"$",
"strictness",
"=",
"IGNORE_MISSING",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"section",
")",
")",
"{",
"$",
"sectionnum",
"=",
"$",
"section",
"->",
"section",
";",
"}",
"... | Returns information about section used in course
@param int|stdClass $section either section number (field course_section.section) or row from course_section table
@param int $strictness
@return section_info | [
"Returns",
"information",
"about",
"section",
"used",
"in",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L362-L376 |
213,937 | moodle/moodle | course/format/lib.php | format_base.get_format_options | public function get_format_options($section = null) {
global $DB;
if ($section === null) {
$options = $this->course_format_options();
} else {
$options = $this->section_format_options();
}
if (empty($options)) {
// there are no option for cours... | php | public function get_format_options($section = null) {
global $DB;
if ($section === null) {
$options = $this->course_format_options();
} else {
$options = $this->section_format_options();
}
if (empty($options)) {
// there are no option for cours... | [
"public",
"function",
"get_format_options",
"(",
"$",
"section",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"section",
"===",
"null",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"course_format_options",
"(",
")",
";",
"}",
... | Returns the format options stored for this course or course section
When overriding please note that this function is called from rebuild_course_cache()
and section_info object, therefore using of get_fast_modinfo() and/or any function that
accesses it may lead to recursion.
@param null|int|stdClass|section_info $sec... | [
"Returns",
"the",
"format",
"options",
"stored",
"for",
"this",
"course",
"or",
"course",
"section"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L620-L678 |
213,938 | moodle/moodle | course/format/lib.php | format_base.validate_format_options | protected function validate_format_options(array $rawdata, int $sectionid = null) : array {
if (!$sectionid) {
$allformatoptions = $this->course_format_options(true);
} else {
$allformatoptions = $this->section_format_options(true);
}
$data = array_intersect_key($... | php | protected function validate_format_options(array $rawdata, int $sectionid = null) : array {
if (!$sectionid) {
$allformatoptions = $this->course_format_options(true);
} else {
$allformatoptions = $this->section_format_options(true);
}
$data = array_intersect_key($... | [
"protected",
"function",
"validate_format_options",
"(",
"array",
"$",
"rawdata",
",",
"int",
"$",
"sectionid",
"=",
"null",
")",
":",
"array",
"{",
"if",
"(",
"!",
"$",
"sectionid",
")",
"{",
"$",
"allformatoptions",
"=",
"$",
"this",
"->",
"course_format... | Prepares values of course or section format options before storing them in DB
If an option has invalid value it is not returned
@param array $rawdata associative array of the proposed course/section format options
@param int|null $sectionid null if it is course format option
@return array array of options that have v... | [
"Prepares",
"values",
"of",
"course",
"or",
"section",
"format",
"options",
"before",
"storing",
"them",
"in",
"DB"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L759-L775 |
213,939 | moodle/moodle | course/format/lib.php | format_base.update_format_options | protected function update_format_options($data, $sectionid = null) {
global $DB;
$data = $this->validate_format_options((array)$data, $sectionid);
if (!$sectionid) {
$allformatoptions = $this->course_format_options();
$sectionid = 0;
} else {
$allforma... | php | protected function update_format_options($data, $sectionid = null) {
global $DB;
$data = $this->validate_format_options((array)$data, $sectionid);
if (!$sectionid) {
$allformatoptions = $this->course_format_options();
$sectionid = 0;
} else {
$allforma... | [
"protected",
"function",
"update_format_options",
"(",
"$",
"data",
",",
"$",
"sectionid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"validate_format_options",
"(",
"(",
"array",
")",
"$",
"data",
",",
"$",
"... | Updates format options for a course or section
If $data does not contain property with the option name, the option will not be updated
@param stdClass|array $data return value from {@link moodleform::get_data()} or array with data
@param null|int null if these are options for course or section id (course_sections.id)... | [
"Updates",
"format",
"options",
"for",
"a",
"course",
"or",
"section"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L797-L863 |
213,940 | moodle/moodle | course/format/lib.php | format_base.editsection_form | public function editsection_form($action, $customdata = array()) {
global $CFG;
require_once($CFG->dirroot. '/course/editsection_form.php');
$context = context_course::instance($this->courseid);
if (!array_key_exists('course', $customdata)) {
$customdata['course'] = $this->ge... | php | public function editsection_form($action, $customdata = array()) {
global $CFG;
require_once($CFG->dirroot. '/course/editsection_form.php');
$context = context_course::instance($this->courseid);
if (!array_key_exists('course', $customdata)) {
$customdata['course'] = $this->ge... | [
"public",
"function",
"editsection_form",
"(",
"$",
"action",
",",
"$",
"customdata",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/course/editsection_form.php'",
")",
";",
"$",
"cont... | Return an instance of moodleform to edit a specified section
Default implementation returns instance of editsection_form that automatically adds
additional fields defined in {@link format_base::section_format_options()}
Format plugins may extend editsection_form if they want to have custom edit section form.
@param ... | [
"Return",
"an",
"instance",
"of",
"moodleform",
"to",
"edit",
"a",
"specified",
"section"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L908-L916 |
213,941 | moodle/moodle | course/format/lib.php | format_base.is_section_current | public function is_section_current($section) {
if (is_object($section)) {
$sectionnum = $section->section;
} else {
$sectionnum = $section;
}
return ($sectionnum && ($course = $this->get_course()) && $course->marker == $sectionnum);
} | php | public function is_section_current($section) {
if (is_object($section)) {
$sectionnum = $section->section;
} else {
$sectionnum = $section;
}
return ($sectionnum && ($course = $this->get_course()) && $course->marker == $sectionnum);
} | [
"public",
"function",
"is_section_current",
"(",
"$",
"section",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"section",
")",
")",
"{",
"$",
"sectionnum",
"=",
"$",
"section",
"->",
"section",
";",
"}",
"else",
"{",
"$",
"sectionnum",
"=",
"$",
"section... | Returns true if the specified section is current
By default we analyze $course->marker
@param int|stdClass|section_info $section
@return bool | [
"Returns",
"true",
"if",
"the",
"specified",
"section",
"is",
"current"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L1011-L1018 |
213,942 | moodle/moodle | course/format/lib.php | format_base.delete_section | public function delete_section($section, $forcedeleteifnotempty = false) {
global $DB;
if (!$this->uses_sections()) {
// Not possible to delete section if sections are not used.
return false;
}
if (!is_object($section)) {
$section = $DB->get_record('co... | php | public function delete_section($section, $forcedeleteifnotempty = false) {
global $DB;
if (!$this->uses_sections()) {
// Not possible to delete section if sections are not used.
return false;
}
if (!is_object($section)) {
$section = $DB->get_record('co... | [
"public",
"function",
"delete_section",
"(",
"$",
"section",
",",
"$",
"forcedeleteifnotempty",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"uses_sections",
"(",
")",
")",
"{",
"// Not possible to delete section if sect... | Deletes a section
Do not call this function directly, instead call {@link course_delete_section()}
@param int|stdClass|section_info $section
@param bool $forcedeleteifnotempty if set to false section will not be deleted if it has modules in it.
@return bool whether section was deleted | [
"Deletes",
"a",
"section"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L1067-L1125 |
213,943 | moodle/moodle | course/format/lib.php | format_base.inplace_editable_update_section_name | public function inplace_editable_update_section_name($section, $itemtype, $newvalue) {
if ($itemtype === 'sectionname' || $itemtype === 'sectionnamenl') {
$context = context_course::instance($section->course);
external_api::validate_context($context);
require_capability('mood... | php | public function inplace_editable_update_section_name($section, $itemtype, $newvalue) {
if ($itemtype === 'sectionname' || $itemtype === 'sectionnamenl') {
$context = context_course::instance($section->course);
external_api::validate_context($context);
require_capability('mood... | [
"public",
"function",
"inplace_editable_update_section_name",
"(",
"$",
"section",
",",
"$",
"itemtype",
",",
"$",
"newvalue",
")",
"{",
"if",
"(",
"$",
"itemtype",
"===",
"'sectionname'",
"||",
"$",
"itemtype",
"===",
"'sectionnamenl'",
")",
"{",
"$",
"contex... | Updates the value in the database and modifies this object respectively.
ALWAYS check user permissions before performing an update! Throw exceptions if permissions are not sufficient
or value is not legit.
@param stdClass $section
@param string $itemtype
@param mixed $newvalue
@return \core\output\inplace_editable | [
"Updates",
"the",
"value",
"in",
"the",
"database",
"and",
"modifies",
"this",
"object",
"respectively",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L1183-L1195 |
213,944 | moodle/moodle | course/format/lib.php | format_base.get_default_course_enddate | public function get_default_course_enddate($mform, $fieldnames = array()) {
if (empty($fieldnames)) {
$fieldnames = array('startdate' => 'startdate');
}
$startdate = $this->get_form_start_date($mform, $fieldnames);
$courseduration = intval(get_config('moodlecourse', 'course... | php | public function get_default_course_enddate($mform, $fieldnames = array()) {
if (empty($fieldnames)) {
$fieldnames = array('startdate' => 'startdate');
}
$startdate = $this->get_form_start_date($mform, $fieldnames);
$courseduration = intval(get_config('moodlecourse', 'course... | [
"public",
"function",
"get_default_course_enddate",
"(",
"$",
"mform",
",",
"$",
"fieldnames",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"fieldnames",
")",
")",
"{",
"$",
"fieldnames",
"=",
"array",
"(",
"'startdate'",
"=>",
"'start... | Returns the default end date value based on the start date.
This is the default implementation for course formats, it is based on
moodlecourse/courseduration setting. Course formats like format_weeks for
example can overwrite this method and return a value based on their internal options.
@param moodleform $mform
@pa... | [
"Returns",
"the",
"default",
"end",
"date",
"value",
"based",
"on",
"the",
"start",
"date",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L1209-L1223 |
213,945 | moodle/moodle | course/format/lib.php | format_base.supports_news | public function supports_news() {
// For backwards compatibility, check if default blocks include the news_items block.
$defaultblocks = $this->get_default_blocks();
foreach ($defaultblocks as $blocks) {
if (in_array('news_items', $blocks)) {
return true;
... | php | public function supports_news() {
// For backwards compatibility, check if default blocks include the news_items block.
$defaultblocks = $this->get_default_blocks();
foreach ($defaultblocks as $blocks) {
if (in_array('news_items', $blocks)) {
return true;
... | [
"public",
"function",
"supports_news",
"(",
")",
"{",
"// For backwards compatibility, check if default blocks include the news_items block.",
"$",
"defaultblocks",
"=",
"$",
"this",
"->",
"get_default_blocks",
"(",
")",
";",
"foreach",
"(",
"$",
"defaultblocks",
"as",
"$... | Indicates whether the course format supports the creation of the Announcements forum.
For course format plugin developers, please override this to return true if you want the Announcements forum
to be created upon course creation.
@return bool | [
"Indicates",
"whether",
"the",
"course",
"format",
"supports",
"the",
"creation",
"of",
"the",
"Announcements",
"forum",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L1233-L1243 |
213,946 | moodle/moodle | course/format/lib.php | format_base.get_form_start_date | protected function get_form_start_date($mform, $fieldnames) {
$startdate = $mform->getElementValue($fieldnames['startdate']);
return $mform->getElement($fieldnames['startdate'])->exportValue($startdate);
} | php | protected function get_form_start_date($mform, $fieldnames) {
$startdate = $mform->getElementValue($fieldnames['startdate']);
return $mform->getElement($fieldnames['startdate'])->exportValue($startdate);
} | [
"protected",
"function",
"get_form_start_date",
"(",
"$",
"mform",
",",
"$",
"fieldnames",
")",
"{",
"$",
"startdate",
"=",
"$",
"mform",
"->",
"getElementValue",
"(",
"$",
"fieldnames",
"[",
"'startdate'",
"]",
")",
";",
"return",
"$",
"mform",
"->",
"get... | Get the start date value from the course settings page form.
@param moodleform $mform
@param array $fieldnames The form - field names mapping.
@return int | [
"Get",
"the",
"start",
"date",
"value",
"from",
"the",
"course",
"settings",
"page",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L1252-L1255 |
213,947 | moodle/moodle | course/format/lib.php | format_site.course_format_options | public function course_format_options($foreditform = false) {
static $courseformatoptions = false;
if ($courseformatoptions === false) {
$courseformatoptions = array(
'numsections' => array(
'default' => 1,
'type' => PARAM_INT,
... | php | public function course_format_options($foreditform = false) {
static $courseformatoptions = false;
if ($courseformatoptions === false) {
$courseformatoptions = array(
'numsections' => array(
'default' => 1,
'type' => PARAM_INT,
... | [
"public",
"function",
"course_format_options",
"(",
"$",
"foreditform",
"=",
"false",
")",
"{",
"static",
"$",
"courseformatoptions",
"=",
"false",
";",
"if",
"(",
"$",
"courseformatoptions",
"===",
"false",
")",
"{",
"$",
"courseformatoptions",
"=",
"array",
... | Definitions of the additional options that site uses
@param bool $foreditform
@return array of options | [
"Definitions",
"of",
"the",
"additional",
"options",
"that",
"site",
"uses"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/lib.php#L1378-L1389 |
213,948 | moodle/moodle | question/type/random/questiontype.php | qtype_random.init_qtype_lists | protected function init_qtype_lists() {
if (!is_null($this->excludedqtypes)) {
return; // Already done.
}
$excludedqtypes = array();
$manualqtypes = array();
foreach (question_bank::get_all_qtypes() as $qtype) {
$quotedname = "'" . $qtype->name() . "'";
... | php | protected function init_qtype_lists() {
if (!is_null($this->excludedqtypes)) {
return; // Already done.
}
$excludedqtypes = array();
$manualqtypes = array();
foreach (question_bank::get_all_qtypes() as $qtype) {
$quotedname = "'" . $qtype->name() . "'";
... | [
"protected",
"function",
"init_qtype_lists",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"excludedqtypes",
")",
")",
"{",
"return",
";",
"// Already done.",
"}",
"$",
"excludedqtypes",
"=",
"array",
"(",
")",
";",
"$",
"manualqtypes",... | This method needs to be called before the ->excludedqtypes and
->manualqtypes fields can be used. | [
"This",
"method",
"needs",
"to",
"be",
"called",
"before",
"the",
"-",
">",
"excludedqtypes",
"and",
"-",
">",
"manualqtypes",
"fields",
"can",
"be",
"used",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/random/questiontype.php#L100-L116 |
213,949 | moodle/moodle | question/type/random/questiontype.php | qtype_random.get_available_questions_from_category | public function get_available_questions_from_category($categoryid, $subcategories) {
if (isset($this->availablequestionsbycategory[$categoryid][$subcategories])) {
return $this->availablequestionsbycategory[$categoryid][$subcategories];
}
$this->init_qtype_lists();
if ($subc... | php | public function get_available_questions_from_category($categoryid, $subcategories) {
if (isset($this->availablequestionsbycategory[$categoryid][$subcategories])) {
return $this->availablequestionsbycategory[$categoryid][$subcategories];
}
$this->init_qtype_lists();
if ($subc... | [
"public",
"function",
"get_available_questions_from_category",
"(",
"$",
"categoryid",
",",
"$",
"subcategories",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"availablequestionsbycategory",
"[",
"$",
"categoryid",
"]",
"[",
"$",
"subcategories",
"]",
"... | Get all the usable questions from a particular question category.
@param int $categoryid the id of a question category.
@param bool whether to include questions from subcategories.
@param string $questionsinuse comma-separated list of question ids to
exclude from consideration.
@return array of question records. | [
"Get",
"all",
"the",
"usable",
"questions",
"from",
"a",
"particular",
"question",
"category",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/random/questiontype.php#L251-L267 |
213,950 | moodle/moodle | question/type/random/questiontype.php | qtype_random.choose_other_question | public function choose_other_question($questiondata, $excludedquestions, $allowshuffle = true, $forcequestionid = null) {
$available = $this->get_available_questions_from_category($questiondata->category,
!empty($questiondata->questiontext));
shuffle($available);
if ($forcequest... | php | public function choose_other_question($questiondata, $excludedquestions, $allowshuffle = true, $forcequestionid = null) {
$available = $this->get_available_questions_from_category($questiondata->category,
!empty($questiondata->questiontext));
shuffle($available);
if ($forcequest... | [
"public",
"function",
"choose_other_question",
"(",
"$",
"questiondata",
",",
"$",
"excludedquestions",
",",
"$",
"allowshuffle",
"=",
"true",
",",
"$",
"forcequestionid",
"=",
"null",
")",
"{",
"$",
"available",
"=",
"$",
"this",
"->",
"get_available_questions_... | Load the definition of another question picked randomly by this question.
@param object $questiondata the data defining a random question.
@param array $excludedquestions of question ids. We will no pick any question whose id is in this list.
@param bool $allowshuffle if false, then any shuffl... | [
"Load",
"the",
"definition",
"of",
"another",
"question",
"picked",
"randomly",
"by",
"this",
"question",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/random/questiontype.php#L283-L308 |
213,951 | moodle/moodle | lib/pear/HTML/QuickForm/file.php | HTML_QuickForm_file.moveUploadedFile | function moveUploadedFile($dest, $fileName = '')
{
if ($dest != '' && substr($dest, -1) != '/') {
$dest .= '/';
}
$fileName = ($fileName != '') ? $fileName : basename($this->_value['name']);
if (move_uploaded_file($this->_value['tmp_name'], $dest . $fileName)) {
... | php | function moveUploadedFile($dest, $fileName = '')
{
if ($dest != '' && substr($dest, -1) != '/') {
$dest .= '/';
}
$fileName = ($fileName != '') ? $fileName : basename($this->_value['name']);
if (move_uploaded_file($this->_value['tmp_name'], $dest . $fileName)) {
... | [
"function",
"moveUploadedFile",
"(",
"$",
"dest",
",",
"$",
"fileName",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"dest",
"!=",
"''",
"&&",
"substr",
"(",
"$",
"dest",
",",
"-",
"1",
")",
"!=",
"'/'",
")",
"{",
"$",
"dest",
".=",
"'/'",
";",
"}",
... | Moves an uploaded file into the destination
@param string Destination directory path
@param string New file name
@access public
@return bool Whether the file was moved successfully | [
"Moves",
"an",
"uploaded",
"file",
"into",
"the",
"destination"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/file.php#L205-L216 |
213,952 | moodle/moodle | lib/pear/HTML/QuickForm/file.php | HTML_QuickForm_file._ruleIsUploadedFile | function _ruleIsUploadedFile($elementValue)
{
if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
(!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) {
return is_uploaded_file($elementValue['tmp_name']);
} else {
return fa... | php | function _ruleIsUploadedFile($elementValue)
{
if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
(!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) {
return is_uploaded_file($elementValue['tmp_name']);
} else {
return fa... | [
"function",
"_ruleIsUploadedFile",
"(",
"$",
"elementValue",
")",
"{",
"if",
"(",
"(",
"isset",
"(",
"$",
"elementValue",
"[",
"'error'",
"]",
")",
"&&",
"$",
"elementValue",
"[",
"'error'",
"]",
"==",
"0",
")",
"||",
"(",
"!",
"empty",
"(",
"$",
"el... | Checks if the given element contains an uploaded file
@param array Uploaded file info (from $_FILES)
@access private
@return bool true if file has been uploaded, false otherwise | [
"Checks",
"if",
"the",
"given",
"element",
"contains",
"an",
"uploaded",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/file.php#L242-L250 |
213,953 | moodle/moodle | lib/pear/HTML/QuickForm/file.php | HTML_QuickForm_file._ruleCheckMaxFileSize | function _ruleCheckMaxFileSize($elementValue, $maxSize)
{
if (!empty($elementValue['error']) &&
(UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error'])) {
return false;
}
if (!HTML_QuickForm_file::_ruleIsUploadedFile($element... | php | function _ruleCheckMaxFileSize($elementValue, $maxSize)
{
if (!empty($elementValue['error']) &&
(UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error'])) {
return false;
}
if (!HTML_QuickForm_file::_ruleIsUploadedFile($element... | [
"function",
"_ruleCheckMaxFileSize",
"(",
"$",
"elementValue",
",",
"$",
"maxSize",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"elementValue",
"[",
"'error'",
"]",
")",
"&&",
"(",
"UPLOAD_ERR_FORM_SIZE",
"==",
"$",
"elementValue",
"[",
"'error'",
"]",
"|... | Checks that the file does not exceed the max file size
@param array Uploaded file info (from $_FILES)
@param int Max file size
@access private
@return bool true if filesize is lower than maxsize, false otherwise | [
"Checks",
"that",
"the",
"file",
"does",
"not",
"exceed",
"the",
"max",
"file",
"size"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/file.php#L263-L273 |
213,954 | moodle/moodle | lib/pear/HTML/QuickForm/file.php | HTML_QuickForm_file._ruleCheckMimeType | function _ruleCheckMimeType($elementValue, $mimeType)
{
if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
return true;
}
if (is_array($mimeType)) {
return in_array($elementValue['type'], $mimeType);
}
return $elementValue['type'] == $mime... | php | function _ruleCheckMimeType($elementValue, $mimeType)
{
if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
return true;
}
if (is_array($mimeType)) {
return in_array($elementValue['type'], $mimeType);
}
return $elementValue['type'] == $mime... | [
"function",
"_ruleCheckMimeType",
"(",
"$",
"elementValue",
",",
"$",
"mimeType",
")",
"{",
"if",
"(",
"!",
"HTML_QuickForm_file",
"::",
"_ruleIsUploadedFile",
"(",
"$",
"elementValue",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"is_array",
"(",
... | Checks if the given element contains an uploaded file of the right mime type
@param array Uploaded file info (from $_FILES)
@param mixed Mime Type (can be an array of allowed types)
@access private
@return bool true if mimetype is correct, false otherwise | [
"Checks",
"if",
"the",
"given",
"element",
"contains",
"an",
"uploaded",
"file",
"of",
"the",
"right",
"mime",
"type"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/file.php#L286-L295 |
213,955 | moodle/moodle | lib/pear/HTML/QuickForm/file.php | HTML_QuickForm_file._ruleCheckFileName | function _ruleCheckFileName($elementValue, $regex)
{
if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
return true;
}
return preg_match($regex, $elementValue['name']);
} | php | function _ruleCheckFileName($elementValue, $regex)
{
if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
return true;
}
return preg_match($regex, $elementValue['name']);
} | [
"function",
"_ruleCheckFileName",
"(",
"$",
"elementValue",
",",
"$",
"regex",
")",
"{",
"if",
"(",
"!",
"HTML_QuickForm_file",
"::",
"_ruleIsUploadedFile",
"(",
"$",
"elementValue",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"preg_match",
"(",
"$"... | Checks if the given element contains an uploaded file of the filename regex
@param array Uploaded file info (from $_FILES)
@param string Regular expression
@access private
@return bool true if name matches regex, false otherwise | [
"Checks",
"if",
"the",
"given",
"element",
"contains",
"an",
"uploaded",
"file",
"of",
"the",
"filename",
"regex"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/file.php#L308-L314 |
213,956 | moodle/moodle | enrol/mnet/lib.php | enrol_mnet_plugin.can_add_instance | public function can_add_instance($courseid) {
global $CFG, $DB;
require_once($CFG->dirroot.'/mnet/service/enrol/locallib.php');
$service = mnetservice_enrol::get_instance();
if (!$service->is_available()) {
return false;
}
$coursecontext = context_course::ins... | php | public function can_add_instance($courseid) {
global $CFG, $DB;
require_once($CFG->dirroot.'/mnet/service/enrol/locallib.php');
$service = mnetservice_enrol::get_instance();
if (!$service->is_available()) {
return false;
}
$coursecontext = context_course::ins... | [
"public",
"function",
"can_add_instance",
"(",
"$",
"courseid",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/mnet/service/enrol/locallib.php'",
")",
";",
"$",
"service",
"=",
"mnetservice_enrol"... | Returns true if a new instance can be added to this course.
The link is returned only if there are some MNet peers that we publish enrolment service to.
@param int $courseid id of the course to add the instance to
@return boolean | [
"Returns",
"true",
"if",
"a",
"new",
"instance",
"can",
"be",
"added",
"to",
"this",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/mnet/lib.php#L72-L90 |
213,957 | moodle/moodle | enrol/mnet/lib.php | enrol_mnet_plugin.get_valid_hosts_options | protected function get_valid_hosts_options() {
global $CFG;
require_once($CFG->dirroot.'/mnet/service/enrol/locallib.php');
$service = mnetservice_enrol::get_instance();
$subscribers = $service->get_remote_subscribers();
$hosts = array(0 => get_string('remotesubscribersall', 'e... | php | protected function get_valid_hosts_options() {
global $CFG;
require_once($CFG->dirroot.'/mnet/service/enrol/locallib.php');
$service = mnetservice_enrol::get_instance();
$subscribers = $service->get_remote_subscribers();
$hosts = array(0 => get_string('remotesubscribersall', 'e... | [
"protected",
"function",
"get_valid_hosts_options",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/mnet/service/enrol/locallib.php'",
")",
";",
"$",
"service",
"=",
"mnetservice_enrol",
"::",
"get_instance",
"("... | Return an array of valid options for the hosts property.
@return array | [
"Return",
"an",
"array",
"of",
"valid",
"options",
"for",
"the",
"hosts",
"property",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/mnet/lib.php#L119-L131 |
213,958 | moodle/moodle | blocks/html/block_html.php | block_html.instance_copy | public function instance_copy($fromid) {
$fromcontext = context_block::instance($fromid);
$fs = get_file_storage();
// This extra check if file area is empty adds one query if it is not empty but saves several if it is.
if (!$fs->is_area_empty($fromcontext->id, 'block_html', 'content', 0... | php | public function instance_copy($fromid) {
$fromcontext = context_block::instance($fromid);
$fs = get_file_storage();
// This extra check if file area is empty adds one query if it is not empty but saves several if it is.
if (!$fs->is_area_empty($fromcontext->id, 'block_html', 'content', 0... | [
"public",
"function",
"instance_copy",
"(",
"$",
"fromid",
")",
"{",
"$",
"fromcontext",
"=",
"context_block",
"::",
"instance",
"(",
"$",
"fromid",
")",
";",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"// This extra check if file area is empty adds one qu... | Copy any block-specific data when copying to a new block instance.
@param int $fromid the id number of the block instance to copy from
@return boolean | [
"Copy",
"any",
"block",
"-",
"specific",
"data",
"when",
"copying",
"to",
"a",
"new",
"block",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/html/block_html.php#L151-L161 |
213,959 | moodle/moodle | mod/forum/classes/local/vaults/post_read_receipt_collection.php | post_read_receipt_collection.from_db_records | protected function from_db_records(array $results) {
$entityfactory = $this->get_entity_factory();
$records = array_map(function($result) {
return $result['record'];
}, $results);
return $entityfactory->get_post_read_receipt_collection_from_stdclasses($records);
} | php | protected function from_db_records(array $results) {
$entityfactory = $this->get_entity_factory();
$records = array_map(function($result) {
return $result['record'];
}, $results);
return $entityfactory->get_post_read_receipt_collection_from_stdclasses($records);
} | [
"protected",
"function",
"from_db_records",
"(",
"array",
"$",
"results",
")",
"{",
"$",
"entityfactory",
"=",
"$",
"this",
"->",
"get_entity_factory",
"(",
")",
";",
"$",
"records",
"=",
"array_map",
"(",
"function",
"(",
"$",
"result",
")",
"{",
"return"... | Convert the DB records into post_read_receipt_collection entities.
@param array $results The DB records
@return post_read_receipt_collection | [
"Convert",
"the",
"DB",
"records",
"into",
"post_read_receipt_collection",
"entities",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/post_read_receipt_collection.php#L77-L84 |
213,960 | moodle/moodle | privacy/classes/local/request/userlist_base.php | userlist_base.add_userids | protected function add_userids(array $userids) : userlist_base {
$this->set_userids(array_merge($this->get_userids(), $userids));
return $this;
} | php | protected function add_userids(array $userids) : userlist_base {
$this->set_userids(array_merge($this->get_userids(), $userids));
return $this;
} | [
"protected",
"function",
"add_userids",
"(",
"array",
"$",
"userids",
")",
":",
"userlist_base",
"{",
"$",
"this",
"->",
"set_userids",
"(",
"array_merge",
"(",
"$",
"this",
"->",
"get_userids",
"(",
")",
",",
"$",
"userids",
")",
")",
";",
"return",
"$"... | Add a set of additional userids.
@param array $userids The list of users.
@return $this | [
"Add",
"a",
"set",
"of",
"additional",
"userids",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/local/request/userlist_base.php#L92-L96 |
213,961 | moodle/moodle | privacy/classes/local/request/userlist_base.php | userlist_base.get_users | public function get_users() : array {
$users = [];
foreach ($this->userids as $userid) {
if ($user = \core_user::get_user($userid)) {
$users[] = $user;
}
}
return $users;
} | php | public function get_users() : array {
$users = [];
foreach ($this->userids as $userid) {
if ($user = \core_user::get_user($userid)) {
$users[] = $user;
}
}
return $users;
} | [
"public",
"function",
"get_users",
"(",
")",
":",
"array",
"{",
"$",
"users",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"userids",
"as",
"$",
"userid",
")",
"{",
"if",
"(",
"$",
"user",
"=",
"\\",
"core_user",
"::",
"get_user",
"(",
... | Get the complete list of user objects that relate to this request.
@return \stdClass[] | [
"Get",
"the",
"complete",
"list",
"of",
"user",
"objects",
"that",
"relate",
"to",
"this",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/local/request/userlist_base.php#L112-L121 |
213,962 | moodle/moodle | privacy/classes/local/request/userlist_base.php | userlist_base.current | public function current() {
$user = \core_user::get_user($this->userids[$this->iteratorposition]);
if (false === $user) {
// This user was not found.
unset($this->userids[$this->iteratorposition]);
// Check to see if there are any more users left.
if ($t... | php | public function current() {
$user = \core_user::get_user($this->userids[$this->iteratorposition]);
if (false === $user) {
// This user was not found.
unset($this->userids[$this->iteratorposition]);
// Check to see if there are any more users left.
if ($t... | [
"public",
"function",
"current",
"(",
")",
"{",
"$",
"user",
"=",
"\\",
"core_user",
"::",
"get_user",
"(",
"$",
"this",
"->",
"userids",
"[",
"$",
"this",
"->",
"iteratorposition",
"]",
")",
";",
"if",
"(",
"false",
"===",
"$",
"user",
")",
"{",
"... | Return the current user.
@return \user | [
"Return",
"the",
"current",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/local/request/userlist_base.php#L149-L168 |
213,963 | moodle/moodle | search/engine/solr/classes/document.php | document.format_text | protected function format_text($text) {
// Since we allow output for highlighting, we need to encode html entities.
// This ensures plaintext html chars don't become valid html.
$out = s($text);
$startcount = 0;
$endcount = 0;
// Remove end/start pairs that span a few c... | php | protected function format_text($text) {
// Since we allow output for highlighting, we need to encode html entities.
// This ensures plaintext html chars don't become valid html.
$out = s($text);
$startcount = 0;
$endcount = 0;
// Remove end/start pairs that span a few c... | [
"protected",
"function",
"format_text",
"(",
"$",
"text",
")",
"{",
"// Since we allow output for highlighting, we need to encode html entities.",
"// This ensures plaintext html chars don't become valid html.",
"$",
"out",
"=",
"s",
"(",
"$",
"text",
")",
";",
"$",
"startcou... | Formats a text string coming from the search engine.
@param string $text Text to format
@return string HTML text to be renderer | [
"Formats",
"a",
"text",
"string",
"coming",
"from",
"the",
"search",
"engine",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/engine/solr/classes/document.php#L135-L162 |
213,964 | moodle/moodle | search/engine/solr/classes/document.php | document.apply_defaults | protected function apply_defaults() {
parent::apply_defaults();
// We want to set the solr_filegroupingid to id if it isn't set.
if (!isset($this->data['solr_filegroupingid'])) {
$this->data['solr_filegroupingid'] = $this->data['id'];
}
} | php | protected function apply_defaults() {
parent::apply_defaults();
// We want to set the solr_filegroupingid to id if it isn't set.
if (!isset($this->data['solr_filegroupingid'])) {
$this->data['solr_filegroupingid'] = $this->data['id'];
}
} | [
"protected",
"function",
"apply_defaults",
"(",
")",
"{",
"parent",
"::",
"apply_defaults",
"(",
")",
";",
"// We want to set the solr_filegroupingid to id if it isn't set.",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'solr_filegroupingid'",
"]",
... | Apply any defaults to unset fields before export. Called after document building, but before export.
Sub-classes of this should make sure to call parent::apply_defaults(). | [
"Apply",
"any",
"defaults",
"to",
"unset",
"fields",
"before",
"export",
".",
"Called",
"after",
"document",
"building",
"but",
"before",
"export",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/engine/solr/classes/document.php#L169-L176 |
213,965 | moodle/moodle | search/engine/solr/classes/document.php | document.export_file_for_engine | public function export_file_for_engine($file) {
$data = $this->export_for_engine();
// Content is index in the main document.
unset($data['content']);
unset($data['description1']);
unset($data['description2']);
// Going to append the fileid to give it a unique id.
... | php | public function export_file_for_engine($file) {
$data = $this->export_for_engine();
// Content is index in the main document.
unset($data['content']);
unset($data['description1']);
unset($data['description2']);
// Going to append the fileid to give it a unique id.
... | [
"public",
"function",
"export_file_for_engine",
"(",
"$",
"file",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"export_for_engine",
"(",
")",
";",
"// Content is index in the main document.",
"unset",
"(",
"$",
"data",
"[",
"'content'",
"]",
")",
";",
"unset... | Export the data for the given file in relation to this document.
@param \stored_file $file The stored file we are talking about.
@return array | [
"Export",
"the",
"data",
"for",
"the",
"given",
"file",
"in",
"relation",
"to",
"this",
"document",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/engine/solr/classes/document.php#L184-L202 |
213,966 | moodle/moodle | lib/horde/framework/Horde/Translation.php | Horde_Translation.t | public static function t($message)
{
if (!isset(static::$_handlers[static::$_domain])) {
static::loadHandler('Horde_Translation_Handler_Gettext');
}
return static::$_handlers[static::$_domain]->t($message);
} | php | public static function t($message)
{
if (!isset(static::$_handlers[static::$_domain])) {
static::loadHandler('Horde_Translation_Handler_Gettext');
}
return static::$_handlers[static::$_domain]->t($message);
} | [
"public",
"static",
"function",
"t",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"_handlers",
"[",
"static",
"::",
"$",
"_domain",
"]",
")",
")",
"{",
"static",
"::",
"loadHandler",
"(",
"'Horde_Translation_Handler_G... | Returns the translation of a message.
@var string $message The string to translate.
@return string The string translation, or the original string if no
translation exists. | [
"Returns",
"the",
"translation",
"of",
"a",
"message",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Translation.php#L90-L96 |
213,967 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Base/Alerts.php | Horde_Imap_Client_Base_Alerts.add | public function add($alert, $type = null)
{
$this->_alert = new stdClass;
$this->_alert->alert = $alert;
if (!is_null($type)) {
$this->_alert->type = $type;
}
$this->notify();
} | php | public function add($alert, $type = null)
{
$this->_alert = new stdClass;
$this->_alert->alert = $alert;
if (!is_null($type)) {
$this->_alert->type = $type;
}
$this->notify();
} | [
"public",
"function",
"add",
"(",
"$",
"alert",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_alert",
"=",
"new",
"stdClass",
";",
"$",
"this",
"->",
"_alert",
"->",
"alert",
"=",
"$",
"alert",
";",
"if",
"(",
"!",
"is_null",
"(",... | Add an alert.
@param string $alert The alert string.
@param string $type The alert type. | [
"Add",
"an",
"alert",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Base/Alerts.php#L47-L56 |
213,968 | moodle/moodle | mod/forum/mod_form.php | mod_forum_mod_form.add_completion_rules | public function add_completion_rules() {
$mform =& $this->_form;
$group=array();
$group[] =& $mform->createElement('checkbox', 'completionpostsenabled', '', get_string('completionposts','forum'));
$group[] =& $mform->createElement('text', 'completionposts', '', array('size'=>3));
... | php | public function add_completion_rules() {
$mform =& $this->_form;
$group=array();
$group[] =& $mform->createElement('checkbox', 'completionpostsenabled', '', get_string('completionposts','forum'));
$group[] =& $mform->createElement('text', 'completionposts', '', array('size'=>3));
... | [
"public",
"function",
"add_completion_rules",
"(",
")",
"{",
"$",
"mform",
"=",
"&",
"$",
"this",
"->",
"_form",
";",
"$",
"group",
"=",
"array",
"(",
")",
";",
"$",
"group",
"[",
"]",
"=",
"&",
"$",
"mform",
"->",
"createElement",
"(",
"'checkbox'",... | Add custom completion rules.
@return array Array of string IDs of added items, empty array if none | [
"Add",
"custom",
"completion",
"rules",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/mod_form.php#L286-L311 |
213,969 | moodle/moodle | message/classes/privacy/provider.php | provider.export_user_preferences | public static function export_user_preferences(int $userid) {
$preferences = get_user_preferences(null, null, $userid);
foreach ($preferences as $name => $value) {
if (
(substr($name, 0, 16) == 'message_provider') ||
($name == 'message_blocknoncontacts') ||
... | php | public static function export_user_preferences(int $userid) {
$preferences = get_user_preferences(null, null, $userid);
foreach ($preferences as $name => $value) {
if (
(substr($name, 0, 16) == 'message_provider') ||
($name == 'message_blocknoncontacts') ||
... | [
"public",
"static",
"function",
"export_user_preferences",
"(",
"int",
"$",
"userid",
")",
"{",
"$",
"preferences",
"=",
"get_user_preferences",
"(",
"null",
",",
"null",
",",
"$",
"userid",
")",
";",
"foreach",
"(",
"$",
"preferences",
"as",
"$",
"name",
... | Store all user preferences for core message.
@param int $userid The userid of the user whose data is to be exported. | [
"Store",
"all",
"user",
"preferences",
"for",
"core",
"message",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/privacy/provider.php#L183-L202 |
213,970 | moodle/moodle | message/classes/privacy/provider.php | provider.export_conversations | public static function export_conversations(int $userid, string $component, string $itemtype, \context $context,
array $subcontext = [], int $itemid = 0) {
global $DB;
// Search for conversations for this user in this area.
$sql = "SELECT DISTINCT... | php | public static function export_conversations(int $userid, string $component, string $itemtype, \context $context,
array $subcontext = [], int $itemid = 0) {
global $DB;
// Search for conversations for this user in this area.
$sql = "SELECT DISTINCT... | [
"public",
"static",
"function",
"export_conversations",
"(",
"int",
"$",
"userid",
",",
"string",
"$",
"component",
",",
"string",
"$",
"itemtype",
",",
"\\",
"context",
"$",
"context",
",",
"array",
"$",
"subcontext",
"=",
"[",
"]",
",",
"int",
"$",
"it... | Store all conversations which match the specified component, itemtype, and itemid.
Conversations without context (for now, the private ones) are stored in '<$context> | Messages | <Other user id>'.
Conversations with context are stored in '<$context> | Messages | <Conversation item type> | <Conversation name>'.
@para... | [
"Store",
"all",
"conversations",
"which",
"match",
"the",
"specified",
"component",
"itemtype",
"and",
"itemid",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/privacy/provider.php#L503-L536 |
213,971 | moodle/moodle | message/classes/privacy/provider.php | provider.delete_user_data | protected static function delete_user_data(int $userid) {
global $DB;
// Delete individual conversations information for this user.
self::delete_user_data_conversations($userid, [], '', '');
// Delete contacts, requests, users blocked and notifications.
$DB->delete_records_sele... | php | protected static function delete_user_data(int $userid) {
global $DB;
// Delete individual conversations information for this user.
self::delete_user_data_conversations($userid, [], '', '');
// Delete contacts, requests, users blocked and notifications.
$DB->delete_records_sele... | [
"protected",
"static",
"function",
"delete_user_data",
"(",
"int",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"// Delete individual conversations information for this user.",
"self",
"::",
"delete_user_data_conversations",
"(",
"$",
"userid",
",",
"[",
"]",
",... | Delete all user data for the specified user.
@param int $userid The user id | [
"Delete",
"all",
"user",
"data",
"for",
"the",
"specified",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/privacy/provider.php#L814-L825 |
213,972 | moodle/moodle | message/classes/privacy/provider.php | provider.export_user_data_contacts | protected static function export_user_data_contacts(int $userid) {
global $DB;
$context = \context_user::instance($userid);
// Get the user's contacts.
if ($contacts = $DB->get_records_select('message_contacts', 'userid = ? OR contactid = ?', [$userid, $userid], 'id ASC')) {
... | php | protected static function export_user_data_contacts(int $userid) {
global $DB;
$context = \context_user::instance($userid);
// Get the user's contacts.
if ($contacts = $DB->get_records_select('message_contacts', 'userid = ? OR contactid = ?', [$userid, $userid], 'id ASC')) {
... | [
"protected",
"static",
"function",
"export_user_data_contacts",
"(",
"int",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"context",
"=",
"\\",
"context_user",
"::",
"instance",
"(",
"$",
"userid",
")",
";",
"// Get the user's contacts.",
"if",
"(",
... | Export the messaging contact data.
@param int $userid | [
"Export",
"the",
"messaging",
"contact",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/privacy/provider.php#L832-L847 |
213,973 | moodle/moodle | message/classes/privacy/provider.php | provider.export_user_data_contact_requests | protected static function export_user_data_contact_requests(int $userid) {
global $DB;
$context = \context_user::instance($userid);
if ($contactrequests = $DB->get_records_select('message_contact_requests', 'userid = ? OR requesteduserid = ?',
[$userid, $userid], 'id ASC')) {
... | php | protected static function export_user_data_contact_requests(int $userid) {
global $DB;
$context = \context_user::instance($userid);
if ($contactrequests = $DB->get_records_select('message_contact_requests', 'userid = ? OR requesteduserid = ?',
[$userid, $userid], 'id ASC')) {
... | [
"protected",
"static",
"function",
"export_user_data_contact_requests",
"(",
"int",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"context",
"=",
"\\",
"context_user",
"::",
"instance",
"(",
"$",
"userid",
")",
";",
"if",
"(",
"$",
"contactrequests... | Export the messaging contact requests data.
@param int $userid | [
"Export",
"the",
"messaging",
"contact",
"requests",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/privacy/provider.php#L854-L879 |
213,974 | moodle/moodle | message/classes/privacy/provider.php | provider.export_user_data_blocked_users | protected static function export_user_data_blocked_users(int $userid) {
global $DB;
$context = \context_user::instance($userid);
if ($blockedusers = $DB->get_records('message_users_blocked', ['userid' => $userid], 'id ASC')) {
$blockedusersdata = [];
foreach ($blockedus... | php | protected static function export_user_data_blocked_users(int $userid) {
global $DB;
$context = \context_user::instance($userid);
if ($blockedusers = $DB->get_records('message_users_blocked', ['userid' => $userid], 'id ASC')) {
$blockedusersdata = [];
foreach ($blockedus... | [
"protected",
"static",
"function",
"export_user_data_blocked_users",
"(",
"int",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"context",
"=",
"\\",
"context_user",
"::",
"instance",
"(",
"$",
"userid",
")",
";",
"if",
"(",
"$",
"blockedusers",
"... | Export the messaging blocked users data.
@param int $userid | [
"Export",
"the",
"messaging",
"blocked",
"users",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/privacy/provider.php#L886-L900 |
213,975 | moodle/moodle | message/classes/privacy/provider.php | provider.export_user_data_notifications | protected static function export_user_data_notifications(int $userid) {
global $DB;
$context = \context_user::instance($userid);
$notificationdata = [];
$select = "useridfrom = ? OR useridto = ?";
$notifications = $DB->get_recordset_select('notifications', $select, [$userid, $u... | php | protected static function export_user_data_notifications(int $userid) {
global $DB;
$context = \context_user::instance($userid);
$notificationdata = [];
$select = "useridfrom = ? OR useridto = ?";
$notifications = $DB->get_recordset_select('notifications', $select, [$userid, $u... | [
"protected",
"static",
"function",
"export_user_data_notifications",
"(",
"int",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"context",
"=",
"\\",
"context_user",
"::",
"instance",
"(",
"$",
"userid",
")",
";",
"$",
"notificationdata",
"=",
"[",
... | Export the notification data.
@param int $userid | [
"Export",
"the",
"notification",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/privacy/provider.php#L1028-L1057 |
213,976 | moodle/moodle | lib/classes/scss.php | core_scss.to_css | public function to_css() {
$content = implode(';', $this->scssprepend);
if (!empty($this->scssfile)) {
$content .= file_get_contents($this->scssfile);
}
$content .= implode(';', $this->scsscontent);
return $this->compile($content);
} | php | public function to_css() {
$content = implode(';', $this->scssprepend);
if (!empty($this->scssfile)) {
$content .= file_get_contents($this->scssfile);
}
$content .= implode(';', $this->scsscontent);
return $this->compile($content);
} | [
"public",
"function",
"to_css",
"(",
")",
"{",
"$",
"content",
"=",
"implode",
"(",
"';'",
",",
"$",
"this",
"->",
"scssprepend",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"scssfile",
")",
")",
"{",
"$",
"content",
".=",
"file_get_... | Compiles to CSS.
@return string | [
"Compiles",
"to",
"CSS",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/scss.php#L92-L99 |
213,977 | moodle/moodle | lib/classes/scss.php | core_scss.compile | public function compile($code, $path = null) {
global $CFG;
$pathtosassc = trim($CFG->pathtosassc ?? '');
if (!empty($pathtosassc) && is_executable($pathtosassc) && !is_dir($pathtosassc)) {
$process = proc_open(
$pathtosassc . ' -I' . implode(':', $this->importPaths... | php | public function compile($code, $path = null) {
global $CFG;
$pathtosassc = trim($CFG->pathtosassc ?? '');
if (!empty($pathtosassc) && is_executable($pathtosassc) && !is_dir($pathtosassc)) {
$process = proc_open(
$pathtosassc . ' -I' . implode(':', $this->importPaths... | [
"public",
"function",
"compile",
"(",
"$",
"code",
",",
"$",
"path",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"pathtosassc",
"=",
"trim",
"(",
"$",
"CFG",
"->",
"pathtosassc",
"??",
"''",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",... | Compile scss.
Overrides ScssPHP's implementation, using the SassC compiler if it is available.
@param string $code SCSS to compile.
@param string $path Path to SCSS to compile.
@return string The compiled CSS. | [
"Compile",
"scss",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/scss.php#L111-L147 |
213,978 | moodle/moodle | lib/classes/scss.php | core_scss.is_valid_file | protected function is_valid_file($path) {
global $CFG;
$realpath = realpath($path);
// Additional theme directory.
$addthemedirectory = core_component::get_plugin_types()['theme'];
$addrealroot = realpath($addthemedirectory);
// Original theme directory.
$theme... | php | protected function is_valid_file($path) {
global $CFG;
$realpath = realpath($path);
// Additional theme directory.
$addthemedirectory = core_component::get_plugin_types()['theme'];
$addrealroot = realpath($addthemedirectory);
// Original theme directory.
$theme... | [
"protected",
"function",
"is_valid_file",
"(",
"$",
"path",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"realpath",
"=",
"realpath",
"(",
"$",
"path",
")",
";",
"// Additional theme directory.",
"$",
"addthemedirectory",
"=",
"core_component",
"::",
"get_plugin_ty... | Is the given file valid for import ?
@param $path
@return bool | [
"Is",
"the",
"given",
"file",
"valid",
"for",
"import",
"?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/scss.php#L184-L202 |
213,979 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.get_browse_modes_from_display_format | protected static function get_browse_modes_from_display_format($format) {
global $DB;
$formats = array();
$dp = $DB->get_record('glossary_formats', array('name' => $format), '*', IGNORE_MISSING);
if ($dp) {
$formats = glossary_get_visible_tabs($dp);
}
// Alw... | php | protected static function get_browse_modes_from_display_format($format) {
global $DB;
$formats = array();
$dp = $DB->get_record('glossary_formats', array('name' => $format), '*', IGNORE_MISSING);
if ($dp) {
$formats = glossary_get_visible_tabs($dp);
}
// Alw... | [
"protected",
"static",
"function",
"get_browse_modes_from_display_format",
"(",
"$",
"format",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"formats",
"=",
"array",
"(",
")",
";",
"$",
"dp",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'glossary_formats'",
",",
"... | Get the browse modes from the display format.
This returns some of the terms that can be used when reporting a glossary being viewed.
@param string $format The display format of the glossary.
@return array Containing some of all of the following: letter, cat, date, author. | [
"Get",
"the",
"browse",
"modes",
"from",
"the",
"display",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L51-L74 |
213,980 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.get_entry_return_structure | protected static function get_entry_return_structure($includecat = false) {
$params = array(
'id' => new external_value(PARAM_INT, 'The entry ID'),
'glossaryid' => new external_value(PARAM_INT, 'The glossary ID'),
'userid' => new external_value(PARAM_INT, 'Author ID'),
... | php | protected static function get_entry_return_structure($includecat = false) {
$params = array(
'id' => new external_value(PARAM_INT, 'The entry ID'),
'glossaryid' => new external_value(PARAM_INT, 'The glossary ID'),
'userid' => new external_value(PARAM_INT, 'Author ID'),
... | [
"protected",
"static",
"function",
"get_entry_return_structure",
"(",
"$",
"includecat",
"=",
"false",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'id'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'The entry ID'",
")",
",",
"'glossaryid'",
"=>",
"... | Get the return value of an entry.
@param bool $includecat Whether the definition should include category info.
@return external_definition | [
"Get",
"the",
"return",
"value",
"of",
"an",
"entry",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L82-L118 |
213,981 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.fill_entry_details | protected static function fill_entry_details($entry, $context) {
global $PAGE;
$canviewfullnames = has_capability('moodle/site:viewfullnames', $context);
// Format concept and definition.
$entry->concept = external_format_string($entry->concept, $context->id);
list($entry->defin... | php | protected static function fill_entry_details($entry, $context) {
global $PAGE;
$canviewfullnames = has_capability('moodle/site:viewfullnames', $context);
// Format concept and definition.
$entry->concept = external_format_string($entry->concept, $context->id);
list($entry->defin... | [
"protected",
"static",
"function",
"fill_entry_details",
"(",
"$",
"entry",
",",
"$",
"context",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"canviewfullnames",
"=",
"has_capability",
"(",
"'moodle/site:viewfullnames'",
",",
"$",
"context",
")",
";",
"// Format c... | Fill in an entry object.
This adds additional required fields for the external function to return.
@param stdClass $entry The entry.
@param context $context The context the entry belongs to.
@return void | [
"Fill",
"in",
"an",
"entry",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L129-L157 |
213,982 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.validate_glossary | protected static function validate_glossary($id) {
global $DB;
$glossary = $DB->get_record('glossary', array('id' => $id), '*', MUST_EXIST);
list($course, $cm) = get_course_and_cm_from_instance($glossary, 'glossary');
$context = context_module::instance($cm->id);
self::validate_c... | php | protected static function validate_glossary($id) {
global $DB;
$glossary = $DB->get_record('glossary', array('id' => $id), '*', MUST_EXIST);
list($course, $cm) = get_course_and_cm_from_instance($glossary, 'glossary');
$context = context_module::instance($cm->id);
self::validate_c... | [
"protected",
"static",
"function",
"validate_glossary",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"glossary",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'glossary'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"id",
")",
",",
"'*'",
",",
"MUS... | Validate a glossary via ID.
@param int $id The glossary ID.
@return array Contains glossary, context, course and cm. | [
"Validate",
"a",
"glossary",
"via",
"ID",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L165-L172 |
213,983 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.get_glossaries_by_courses | public static function get_glossaries_by_courses($courseids = array()) {
$params = self::validate_parameters(self::get_glossaries_by_courses_parameters(), array('courseids' => $courseids));
$warnings = array();
$courses = array();
$courseids = $params['courseids'];
if (empty($c... | php | public static function get_glossaries_by_courses($courseids = array()) {
$params = self::validate_parameters(self::get_glossaries_by_courses_parameters(), array('courseids' => $courseids));
$warnings = array();
$courses = array();
$courseids = $params['courseids'];
if (empty($c... | [
"public",
"static",
"function",
"get_glossaries_by_courses",
"(",
"$",
"courseids",
"=",
"array",
"(",
")",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_glossaries_by_courses_parameters",
"(",
")",
",",
"array",
"(",... | Returns a list of glossaries in a provided list of courses.
If no list is provided all glossaries that the user can view will be returned.
@param array $courseids the course IDs.
@return array of glossaries
@since Moodle 3.1 | [
"Returns",
"a",
"list",
"of",
"glossaries",
"in",
"a",
"provided",
"list",
"of",
"courses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L200-L247 |
213,984 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.view_glossary | public static function view_glossary($id, $mode) {
$params = self::validate_parameters(self::view_glossary_parameters(), array(
'id' => $id,
'mode' => $mode
));
$id = $params['id'];
$mode = $params['mode'];
$warnings = array();
// Get and validate... | php | public static function view_glossary($id, $mode) {
$params = self::validate_parameters(self::view_glossary_parameters(), array(
'id' => $id,
'mode' => $mode
));
$id = $params['id'];
$mode = $params['mode'];
$warnings = array();
// Get and validate... | [
"public",
"static",
"function",
"view_glossary",
"(",
"$",
"id",
",",
"$",
"mode",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"view_glossary_parameters",
"(",
")",
",",
"array",
"(",
"'id'",
"=>",
"$",
"id",
","... | Notify that the course module was viewed.
@param int $id The glossary instance ID.
@param string $mode The view mode.
@return array of warnings and status result
@since Moodle 3.1
@throws moodle_exception | [
"Notify",
"that",
"the",
"course",
"module",
"was",
"viewed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L336-L355 |
213,985 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.view_entry | public static function view_entry($id) {
global $DB, $USER;
$params = self::validate_parameters(self::view_entry_parameters(), array('id' => $id));
$id = $params['id'];
$warnings = array();
// Get and validate the glossary.
$entry = $DB->get_record('glossary_entries', a... | php | public static function view_entry($id) {
global $DB, $USER;
$params = self::validate_parameters(self::view_entry_parameters(), array('id' => $id));
$id = $params['id'];
$warnings = array();
// Get and validate the glossary.
$entry = $DB->get_record('glossary_entries', a... | [
"public",
"static",
"function",
"view_entry",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"view_entry_parameters",
"(",
")",
",",
"array",
"(",
"'id'",
... | Notify that the entry was viewed.
@param int $id The entry ID.
@return array of warnings and status result
@since Moodle 3.1
@throws moodle_exception
@throws invalid_parameter_exception | [
"Notify",
"that",
"the",
"entry",
"was",
"viewed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L391-L413 |
213,986 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.get_entries_by_letter | public static function get_entries_by_letter($id, $letter, $from, $limit, $options) {
$params = self::validate_parameters(self::get_entries_by_letter_parameters(), array(
'id' => $id,
'letter' => $letter,
'from' => $from,
'limit' => $limit,
'options' =... | php | public static function get_entries_by_letter($id, $letter, $from, $limit, $options) {
$params = self::validate_parameters(self::get_entries_by_letter_parameters(), array(
'id' => $id,
'letter' => $letter,
'from' => $from,
'limit' => $limit,
'options' =... | [
"public",
"static",
"function",
"get_entries_by_letter",
"(",
"$",
"id",
",",
"$",
"letter",
",",
"$",
"from",
",",
"$",
"limit",
",",
"$",
"options",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_entries_by_let... | Browse a glossary entries by letter.
@param int $id The glossary ID.
@param string $letter A letter, or a special keyword.
@param int $from Start returning records from here.
@param int $limit Number of records to return.
@param array $options Array of options.
@return array Containing count, entries and warnings.
@si... | [
"Browse",
"a",
"glossary",
"entries",
"by",
"letter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L460-L497 |
213,987 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.get_categories | public static function get_categories($id, $from, $limit) {
$params = self::validate_parameters(self::get_categories_parameters(), array(
'id' => $id,
'from' => $from,
'limit' => $limit
));
$id = $params['id'];
$from = $params['from'];
$limit =... | php | public static function get_categories($id, $from, $limit) {
$params = self::validate_parameters(self::get_categories_parameters(), array(
'id' => $id,
'from' => $from,
'limit' => $limit
));
$id = $params['id'];
$from = $params['from'];
$limit =... | [
"public",
"static",
"function",
"get_categories",
"(",
"$",
"id",
",",
"$",
"from",
",",
"$",
"limit",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_categories_parameters",
"(",
")",
",",
"array",
"(",
"'id'",
... | Get the categories of a glossary.
@param int $id The glossary ID.
@param int $from Start returning records from here.
@param int $limit Number of records to return.
@return array Containing count, categories and warnings.
@since Moodle 3.1
@throws moodle_exception | [
"Get",
"the",
"categories",
"of",
"a",
"glossary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L639-L666 |
213,988 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.get_entries_by_category | public static function get_entries_by_category($id, $categoryid, $from, $limit, $options) {
global $DB;
$params = self::validate_parameters(self::get_entries_by_category_parameters(), array(
'id' => $id,
'categoryid' => $categoryid,
'from' => $from,
'limi... | php | public static function get_entries_by_category($id, $categoryid, $from, $limit, $options) {
global $DB;
$params = self::validate_parameters(self::get_entries_by_category_parameters(), array(
'id' => $id,
'categoryid' => $categoryid,
'from' => $from,
'limi... | [
"public",
"static",
"function",
"get_entries_by_category",
"(",
"$",
"id",
",",
"$",
"categoryid",
",",
"$",
"from",
",",
"$",
"limit",
",",
"$",
"options",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",... | Browse a glossary entries by category.
@param int $id The glossary ID.
@param int $categoryid The category ID.
@param int $from Start returning records from here.
@param int $limit Number of records to return.
@param array $options Array of options.
@return array Containing count, entries and warnings.
@since Moodle 3... | [
"Browse",
"a",
"glossary",
"entries",
"by",
"category",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L722-L775 |
213,989 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.get_authors | public static function get_authors($id, $from, $limit, $options) {
global $PAGE;
$params = self::validate_parameters(self::get_authors_parameters(), array(
'id' => $id,
'from' => $from,
'limit' => $limit,
'options' => $options,
));
$id = $... | php | public static function get_authors($id, $from, $limit, $options) {
global $PAGE;
$params = self::validate_parameters(self::get_authors_parameters(), array(
'id' => $id,
'from' => $from,
'limit' => $limit,
'options' => $options,
));
$id = $... | [
"public",
"static",
"function",
"get_authors",
"(",
"$",
"id",
",",
"$",
"from",
",",
"$",
"limit",
",",
"$",
"options",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_authors_parame... | Get the authors of a glossary.
@param int $id The glossary ID.
@param int $from Start returning records from here.
@param int $limit Number of records to return.
@param array $options Array of options.
@return array Containing count, authors and warnings.
@since Moodle 3.1
@throws moodle_exception | [
"Get",
"the",
"authors",
"of",
"a",
"glossary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L823-L862 |
213,990 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.get_entries_by_search | public static function get_entries_by_search($id, $query, $fullsearch, $order, $sort, $from, $limit, $options) {
$params = self::validate_parameters(self::get_entries_by_search_parameters(), array(
'id' => $id,
'query' => $query,
'fullsearch' => $fullsearch,
'orde... | php | public static function get_entries_by_search($id, $query, $fullsearch, $order, $sort, $from, $limit, $options) {
$params = self::validate_parameters(self::get_entries_by_search_parameters(), array(
'id' => $id,
'query' => $query,
'fullsearch' => $fullsearch,
'orde... | [
"public",
"static",
"function",
"get_entries_by_search",
"(",
"$",
"id",
",",
"$",
"query",
",",
"$",
"fullsearch",
",",
"$",
"order",
",",
"$",
"sort",
",",
"$",
"from",
",",
"$",
"limit",
",",
"$",
"options",
")",
"{",
"$",
"params",
"=",
"self",
... | Browse a glossary entries using the search.
@param int $id The glossary ID.
@param string $query The search query.
@param bool $fullsearch Whether or not full search is required.
@param string $order The way to order the results.
@param string $sort The direction of the order.
@param int $from Start returning records ... | [
"Browse",
"a",
"glossary",
"entries",
"using",
"the",
"search",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L1134-L1179 |
213,991 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.get_entry_by_id | public static function get_entry_by_id($id) {
global $DB, $USER;
$params = self::validate_parameters(self::get_entry_by_id_parameters(), array('id' => $id));
$id = $params['id'];
$warnings = array();
// Get and validate the glossary.
$entry = $DB->get_record('glossary_e... | php | public static function get_entry_by_id($id) {
global $DB, $USER;
$params = self::validate_parameters(self::get_entry_by_id_parameters(), array('id' => $id));
$id = $params['id'];
$warnings = array();
// Get and validate the glossary.
$entry = $DB->get_record('glossary_e... | [
"public",
"static",
"function",
"get_entry_by_id",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_entry_by_id_parameters",
"(",
")",
",",
"array",
"(",
... | Get an entry.
@param int $id The entry ID.
@return array Containing entry and warnings.
@since Moodle 3.1
@throws moodle_exception
@throws invalid_parameter_exception | [
"Get",
"an",
"entry",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L1389-L1413 |
213,992 | moodle/moodle | mod/glossary/classes/external.php | mod_glossary_external.add_entry | public static function add_entry($glossaryid, $concept, $definition, $definitionformat, $options = array()) {
global $CFG;
$params = self::validate_parameters(self::add_entry_parameters(), array(
'glossaryid' => $glossaryid,
'concept' => $concept,
'definition' => $de... | php | public static function add_entry($glossaryid, $concept, $definition, $definitionformat, $options = array()) {
global $CFG;
$params = self::validate_parameters(self::add_entry_parameters(), array(
'glossaryid' => $glossaryid,
'concept' => $concept,
'definition' => $de... | [
"public",
"static",
"function",
"add_entry",
"(",
"$",
"glossaryid",
",",
"$",
"concept",
",",
"$",
"definition",
",",
"$",
"definitionformat",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"params",
"=",
"self"... | Add a new entry to a given glossary.
@param int $glossaryid the glosary id
@param string $concept the glossary concept
@param string $definition the concept definition
@param int $definitionformat the concept definition format
@param array $options additional settings
@return array Containing entry and warnings... | [
"Add",
"a",
"new",
"entry",
"to",
"a",
"given",
"glossary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/external.php#L1474-L1546 |
213,993 | moodle/moodle | enrol/meta/locallib.php | enrol_meta_handler.sync_course_instances | protected static function sync_course_instances($courseid, $userid) {
global $DB;
static $preventrecursion = false;
// does anything want to sync with this parent?
if (!$enrols = $DB->get_records('enrol', array('customint1'=>$courseid, 'enrol'=>'meta'), 'id ASC')) {
return;... | php | protected static function sync_course_instances($courseid, $userid) {
global $DB;
static $preventrecursion = false;
// does anything want to sync with this parent?
if (!$enrols = $DB->get_records('enrol', array('customint1'=>$courseid, 'enrol'=>'meta'), 'id ASC')) {
return;... | [
"protected",
"static",
"function",
"sync_course_instances",
"(",
"$",
"courseid",
",",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"static",
"$",
"preventrecursion",
"=",
"false",
";",
"// does anything want to sync with this parent?",
"if",
"(",
"!",
"$",
... | Synchronise meta enrolments of this user in this course
@static
@param int $courseid
@param int $userid
@return void | [
"Synchronise",
"meta",
"enrolments",
"of",
"this",
"user",
"in",
"this",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/meta/locallib.php#L43-L69 |
213,994 | moodle/moodle | enrol/meta/locallib.php | enrol_meta_handler.user_not_supposed_to_be_here | protected static function user_not_supposed_to_be_here($instance, $ue, context_course $context, $plugin) {
if (!$ue) {
// Not enrolled yet - simple!
return;
}
$userid = $ue->userid;
$unenrolaction = $plugin->get_config('unenrolaction', ENROL_EXT_REMOVED_SUSPENDNO... | php | protected static function user_not_supposed_to_be_here($instance, $ue, context_course $context, $plugin) {
if (!$ue) {
// Not enrolled yet - simple!
return;
}
$userid = $ue->userid;
$unenrolaction = $plugin->get_config('unenrolaction', ENROL_EXT_REMOVED_SUSPENDNO... | [
"protected",
"static",
"function",
"user_not_supposed_to_be_here",
"(",
"$",
"instance",
",",
"$",
"ue",
",",
"context_course",
"$",
"context",
",",
"$",
"plugin",
")",
"{",
"if",
"(",
"!",
"$",
"ue",
")",
"{",
"// Not enrolled yet - simple!",
"return",
";",
... | Deal with users that are not supposed to be enrolled via this instance
@static
@param stdClass $instance
@param stdClass $ue
@param context_course $context
@param enrol_meta $plugin
@return void | [
"Deal",
"with",
"users",
"that",
"are",
"not",
"supposed",
"to",
"be",
"enrolled",
"via",
"this",
"instance"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/meta/locallib.php#L224-L251 |
213,995 | moodle/moodle | grade/import/csv/classes/load_data.php | gradeimport_csv_load_data.load_csv_content | public function load_csv_content($text, $encoding, $separator, $previewrows) {
$this->raise_limits();
$this->iid = csv_import_reader::get_new_iid('grade');
$csvimport = new csv_import_reader($this->iid, 'grade');
$csvimport->load_csv_content($text, $encoding, $separator);
$this... | php | public function load_csv_content($text, $encoding, $separator, $previewrows) {
$this->raise_limits();
$this->iid = csv_import_reader::get_new_iid('grade');
$csvimport = new csv_import_reader($this->iid, 'grade');
$csvimport->load_csv_content($text, $encoding, $separator);
$this... | [
"public",
"function",
"load_csv_content",
"(",
"$",
"text",
",",
"$",
"encoding",
",",
"$",
"separator",
",",
"$",
"previewrows",
")",
"{",
"$",
"this",
"->",
"raise_limits",
"(",
")",
";",
"$",
"this",
"->",
"iid",
"=",
"csv_import_reader",
"::",
"get_n... | Load CSV content for previewing.
@param string $text The grade data being imported.
@param string $encoding The type of encoding the file uses.
@param string $separator The separator being used to define each field.
@param int $previewrows How many rows are being previewed. | [
"Load",
"CSV",
"content",
"for",
"previewing",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/load_data.php#L71-L97 |
213,996 | moodle/moodle | grade/import/csv/classes/load_data.php | gradeimport_csv_load_data.fetch_grade_items | public static function fetch_grade_items($courseid) {
$gradeitems = null;
if ($allgradeitems = grade_item::fetch_all(array('courseid' => $courseid))) {
foreach ($allgradeitems as $gradeitem) {
// Skip course type and category type.
if ($gradeitem->itemtype == ... | php | public static function fetch_grade_items($courseid) {
$gradeitems = null;
if ($allgradeitems = grade_item::fetch_all(array('courseid' => $courseid))) {
foreach ($allgradeitems as $gradeitem) {
// Skip course type and category type.
if ($gradeitem->itemtype == ... | [
"public",
"static",
"function",
"fetch_grade_items",
"(",
"$",
"courseid",
")",
"{",
"$",
"gradeitems",
"=",
"null",
";",
"if",
"(",
"$",
"allgradeitems",
"=",
"grade_item",
"::",
"fetch_all",
"(",
"array",
"(",
"'courseid'",
"=>",
"$",
"courseid",
")",
")... | Gets all of the grade items in this course.
@param int $courseid Course id;
@return array An array of grade items for the course. | [
"Gets",
"all",
"of",
"the",
"grade",
"items",
"in",
"this",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/load_data.php#L105-L125 |
213,997 | moodle/moodle | grade/import/csv/classes/load_data.php | gradeimport_csv_load_data.trim_headers | protected function trim_headers() {
foreach ($this->headers as $i => $h) {
$h = trim($h); // Remove whitespace.
$h = clean_param($h, PARAM_RAW); // Clean the header.
$this->headers[$i] = $h;
}
} | php | protected function trim_headers() {
foreach ($this->headers as $i => $h) {
$h = trim($h); // Remove whitespace.
$h = clean_param($h, PARAM_RAW); // Clean the header.
$this->headers[$i] = $h;
}
} | [
"protected",
"function",
"trim_headers",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"headers",
"as",
"$",
"i",
"=>",
"$",
"h",
")",
"{",
"$",
"h",
"=",
"trim",
"(",
"$",
"h",
")",
";",
"// Remove whitespace.",
"$",
"h",
"=",
"clean_param",
"... | Cleans the column headers from the CSV file. | [
"Cleans",
"the",
"column",
"headers",
"from",
"the",
"CSV",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/load_data.php#L130-L136 |
213,998 | moodle/moodle | grade/import/csv/classes/load_data.php | gradeimport_csv_load_data.insert_grade_record | protected function insert_grade_record($record, $studentid) {
global $DB, $USER, $CFG;
$record->importcode = $this->importcode;
$record->userid = $studentid;
$record->importer = $USER->id;
// By default the maximum grade is 100.
$gradepointmaximum = 100;
// ... | php | protected function insert_grade_record($record, $studentid) {
global $DB, $USER, $CFG;
$record->importcode = $this->importcode;
$record->userid = $studentid;
$record->importer = $USER->id;
// By default the maximum grade is 100.
$gradepointmaximum = 100;
// ... | [
"protected",
"function",
"insert_grade_record",
"(",
"$",
"record",
",",
"$",
"studentid",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
",",
"$",
"CFG",
";",
"$",
"record",
"->",
"importcode",
"=",
"$",
"this",
"->",
"importcode",
";",
"$",
"record... | Inserts a record into the grade_import_values table. This also adds common record information.
@param object $record The grade record being inserted into the database.
@param int $studentid The student ID.
@return bool|int true or insert id on success. Null if the grade value is too high. | [
"Inserts",
"a",
"record",
"into",
"the",
"grade_import_values",
"table",
".",
"This",
"also",
"adds",
"common",
"record",
"information",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/load_data.php#L156-L175 |
213,999 | moodle/moodle | grade/import/csv/classes/load_data.php | gradeimport_csv_load_data.import_new_grade_item | protected function import_new_grade_item($header, $key, $value) {
global $DB, $USER;
// First check if header is already in temp database.
if (empty($this->newgradeitems[$key])) {
$newgradeitem = new stdClass();
$newgradeitem->itemname = $header[$key];
$newg... | php | protected function import_new_grade_item($header, $key, $value) {
global $DB, $USER;
// First check if header is already in temp database.
if (empty($this->newgradeitems[$key])) {
$newgradeitem = new stdClass();
$newgradeitem->itemname = $header[$key];
$newg... | [
"protected",
"function",
"import_new_grade_item",
"(",
"$",
"header",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"// First check if header is already in temp database.",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",... | Insert the new grade into the grade item buffer table.
@param array $header The column headers from the CSV file.
@param int $key Current row identifier.
@param string $value The value for this row (final grade).
@return stdClass new grade that is ready for commiting to the gradebook. | [
"Insert",
"the",
"new",
"grade",
"into",
"the",
"grade",
"item",
"buffer",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/load_data.php#L185-L212 |
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.