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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
219,700 | moodle/moodle | lib/classes/update/code_manager.php | code_manager.get_archived_plugin_version | public function get_archived_plugin_version($component, $version) {
if (empty($component) or empty($version)) {
return false;
}
$archzip = $this->temproot.'/archive/'.$component.'/'.$version.'.zip';
if (file_exists($archzip)) {
return $archzip;
}
... | php | public function get_archived_plugin_version($component, $version) {
if (empty($component) or empty($version)) {
return false;
}
$archzip = $this->temproot.'/archive/'.$component.'/'.$version.'.zip';
if (file_exists($archzip)) {
return $archzip;
}
... | [
"public",
"function",
"get_archived_plugin_version",
"(",
"$",
"component",
",",
"$",
"version",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"component",
")",
"or",
"empty",
"(",
"$",
"version",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"archzip",
"... | Return the path to the ZIP file with the archive of the given plugin version.
@param string $component
@param int $version
@return string|bool false if not found, full path otherwise | [
"Return",
"the",
"path",
"to",
"the",
"ZIP",
"file",
"with",
"the",
"archive",
"of",
"the",
"given",
"plugin",
"version",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/code_manager.php#L290-L303 |
219,701 | moodle/moodle | lib/classes/update/code_manager.php | code_manager.list_plugin_folder_files | public function list_plugin_folder_files($folderpath) {
$folder = new RecursiveDirectoryIterator($folderpath);
$iterator = new RecursiveIteratorIterator($folder);
$folderpathinfo = new SplFileInfo($folderpath);
$strip = strlen($folderpathinfo->getPathInfo()->getRealPath()) + 1;
... | php | public function list_plugin_folder_files($folderpath) {
$folder = new RecursiveDirectoryIterator($folderpath);
$iterator = new RecursiveIteratorIterator($folder);
$folderpathinfo = new SplFileInfo($folderpath);
$strip = strlen($folderpathinfo->getPathInfo()->getRealPath()) + 1;
... | [
"public",
"function",
"list_plugin_folder_files",
"(",
"$",
"folderpath",
")",
"{",
"$",
"folder",
"=",
"new",
"RecursiveDirectoryIterator",
"(",
"$",
"folderpath",
")",
";",
"$",
"iterator",
"=",
"new",
"RecursiveIteratorIterator",
"(",
"$",
"folder",
")",
";",... | Returns list of all files in the given directory.
Given a path like /full/path/to/mod/workshop, it returns array like
[workshop/] => /full/path/to/mod/workshop
[workshop/lang/] => /full/path/to/mod/workshop/lang
[workshop/lang/workshop.php] => /full/path/to/mod/workshop/lang/workshop.php
...
Which mathes the format ... | [
"Returns",
"list",
"of",
"all",
"files",
"in",
"the",
"given",
"directory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/code_manager.php#L320-L341 |
219,702 | moodle/moodle | lib/classes/update/code_manager.php | code_manager.get_plugin_zip_root_dir | public function get_plugin_zip_root_dir($zipfilepath) {
$fp = get_file_packer('application/zip');
$files = $fp->list_files($zipfilepath);
if (empty($files)) {
return false;
}
$rootdirname = null;
foreach ($files as $file) {
$pathnameitems = expl... | php | public function get_plugin_zip_root_dir($zipfilepath) {
$fp = get_file_packer('application/zip');
$files = $fp->list_files($zipfilepath);
if (empty($files)) {
return false;
}
$rootdirname = null;
foreach ($files as $file) {
$pathnameitems = expl... | [
"public",
"function",
"get_plugin_zip_root_dir",
"(",
"$",
"zipfilepath",
")",
"{",
"$",
"fp",
"=",
"get_file_packer",
"(",
"'application/zip'",
")",
";",
"$",
"files",
"=",
"$",
"fp",
"->",
"list_files",
"(",
"$",
"zipfilepath",
")",
";",
"if",
"(",
"empt... | Detects the plugin's name from its ZIP file.
Plugin ZIP packages are expected to contain a single directory and the
directory name would become the plugin name once extracted to the Moodle
dirroot.
@param string $zipfilepath full path to the ZIP files
@return string|bool false on error | [
"Detects",
"the",
"plugin",
"s",
"name",
"from",
"its",
"ZIP",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/code_manager.php#L353-L381 |
219,703 | moodle/moodle | lib/classes/update/code_manager.php | code_manager.download_plugin_zip_file | protected function download_plugin_zip_file($url, $tofile) {
if (file_exists($tofile)) {
$this->debug('Error fetching plugin ZIP: target location exists.');
return false;
}
$status = $this->download_file_content($url, $tofile);
if (!$status) {
$this... | php | protected function download_plugin_zip_file($url, $tofile) {
if (file_exists($tofile)) {
$this->debug('Error fetching plugin ZIP: target location exists.');
return false;
}
$status = $this->download_file_content($url, $tofile);
if (!$status) {
$this... | [
"protected",
"function",
"download_plugin_zip_file",
"(",
"$",
"url",
",",
"$",
"tofile",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"tofile",
")",
")",
"{",
"$",
"this",
"->",
"debug",
"(",
"'Error fetching plugin ZIP: target location exists.'",
")",
";",
... | Download the ZIP file with the plugin package from the given location
@param string $url URL to the file
@param string $tofile full path to where to store the downloaded file
@return bool false on error | [
"Download",
"the",
"ZIP",
"file",
"with",
"the",
"plugin",
"package",
"from",
"the",
"given",
"location"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/code_manager.php#L409-L425 |
219,704 | moodle/moodle | lib/classes/update/code_manager.php | code_manager.rename_extracted_rootdir | protected function rename_extracted_rootdir($dirname, $rootdir, array $files) {
if (!is_dir($dirname)) {
$this->debug('Unable to rename rootdir of non-existing content');
return $files;
}
if (file_exists($dirname.'/'.$rootdir)) {
// This typically means the ... | php | protected function rename_extracted_rootdir($dirname, $rootdir, array $files) {
if (!is_dir($dirname)) {
$this->debug('Unable to rename rootdir of non-existing content');
return $files;
}
if (file_exists($dirname.'/'.$rootdir)) {
// This typically means the ... | [
"protected",
"function",
"rename_extracted_rootdir",
"(",
"$",
"dirname",
",",
"$",
"rootdir",
",",
"array",
"$",
"files",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"dirname",
")",
")",
"{",
"$",
"this",
"->",
"debug",
"(",
"'Unable to rename rootdir o... | Renames the root directory of the extracted ZIP package.
This internal helper method assumes that the plugin ZIP package has been
extracted into a temporary empty directory so the plugin folder is the
only folder there. The ZIP package is supposed to be validated so that
it contains just a single root folder.
@param ... | [
"Renames",
"the",
"root",
"directory",
"of",
"the",
"extracted",
"ZIP",
"package",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/code_manager.php#L463-L501 |
219,705 | moodle/moodle | lib/classes/update/code_manager.php | code_manager.set_plugin_files_permissions | protected function set_plugin_files_permissions($targetdir, array $files) {
$dirpermissions = fileperms($targetdir);
$filepermissions = ($dirpermissions & 0666);
foreach ($files as $subpath => $notusedhere) {
$path = $targetdir.'/'.$subpath;
if (is_dir($path)) {
... | php | protected function set_plugin_files_permissions($targetdir, array $files) {
$dirpermissions = fileperms($targetdir);
$filepermissions = ($dirpermissions & 0666);
foreach ($files as $subpath => $notusedhere) {
$path = $targetdir.'/'.$subpath;
if (is_dir($path)) {
... | [
"protected",
"function",
"set_plugin_files_permissions",
"(",
"$",
"targetdir",
",",
"array",
"$",
"files",
")",
"{",
"$",
"dirpermissions",
"=",
"fileperms",
"(",
"$",
"targetdir",
")",
";",
"$",
"filepermissions",
"=",
"(",
"$",
"dirpermissions",
"&",
"0666"... | Sets the permissions of extracted subdirs and files
As a result of unzipping, the subdirs and files are created with
permissions set to $CFG->directorypermissions and $CFG->filepermissions.
These are too benevolent by default (777 and 666 respectively) for PHP
scripts and may lead to HTTP 500 errors in some environmen... | [
"Sets",
"the",
"permissions",
"of",
"extracted",
"subdirs",
"and",
"files"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/code_manager.php#L517-L530 |
219,706 | moodle/moodle | lib/classes/update/code_manager.php | code_manager.move_extracted_plugin_files | protected function move_extracted_plugin_files($sourcedir, $targetdir, array $files) {
global $CFG;
foreach ($files as $file => $status) {
if ($status !== true) {
throw new moodle_exception('corrupted_archive_structure', 'core_plugin', '', $file, $status);
}
... | php | protected function move_extracted_plugin_files($sourcedir, $targetdir, array $files) {
global $CFG;
foreach ($files as $file => $status) {
if ($status !== true) {
throw new moodle_exception('corrupted_archive_structure', 'core_plugin', '', $file, $status);
}
... | [
"protected",
"function",
"move_extracted_plugin_files",
"(",
"$",
"sourcedir",
",",
"$",
"targetdir",
",",
"array",
"$",
"files",
")",
"{",
"global",
"$",
"CFG",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
"=>",
"$",
"status",
")",
"{",
"if",
... | Moves the extracted contents of the plugin ZIP into the target location.
@param string $sourcedir full path to the directory the ZIP file was extracted to
@param mixed $targetdir full path to the directory where the files should be moved to
@param array $files list of extracted files | [
"Moves",
"the",
"extracted",
"contents",
"of",
"the",
"plugin",
"ZIP",
"into",
"the",
"target",
"location",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/code_manager.php#L539-L560 |
219,707 | moodle/moodle | lib/adodb/drivers/adodb-postgres7.inc.php | ADODB_postgres7.SelectLimit | function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
{
$offsetStr = ($offset >= 0) ? " OFFSET ".((integer)$offset) : '';
$limitStr = ($nrows >= 0) ? " LIMIT ".((integer)$nrows) : '';
if ($secs2cache)
$rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
else... | php | function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
{
$offsetStr = ($offset >= 0) ? " OFFSET ".((integer)$offset) : '';
$limitStr = ($nrows >= 0) ? " LIMIT ".((integer)$nrows) : '';
if ($secs2cache)
$rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
else... | [
"function",
"SelectLimit",
"(",
"$",
"sql",
",",
"$",
"nrows",
"=",
"-",
"1",
",",
"$",
"offset",
"=",
"-",
"1",
",",
"$",
"inputarr",
"=",
"false",
",",
"$",
"secs2cache",
"=",
"0",
")",
"{",
"$",
"offsetStr",
"=",
"(",
"$",
"offset",
">=",
"0... | which makes obsolete the LIMIT limit,offset syntax | [
"which",
"makes",
"obsolete",
"the",
"LIMIT",
"limit",
"offset",
"syntax"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-postgres7.inc.php#L110-L120 |
219,708 | moodle/moodle | lib/adodb/drivers/adodb-postgres7.inc.php | ADODB_postgres7._generateMetaColumnsSQL | protected function _generateMetaColumnsSQL($table, $schema)
{
if ($schema) {
return sprintf($this->metaColumnsSQL1, $table, $table, $table, $schema);
}
else {
return sprintf($this->metaColumnsSQL, $table, $table, $schema);
}
} | php | protected function _generateMetaColumnsSQL($table, $schema)
{
if ($schema) {
return sprintf($this->metaColumnsSQL1, $table, $table, $table, $schema);
}
else {
return sprintf($this->metaColumnsSQL, $table, $table, $schema);
}
} | [
"protected",
"function",
"_generateMetaColumnsSQL",
"(",
"$",
"table",
",",
"$",
"schema",
")",
"{",
"if",
"(",
"$",
"schema",
")",
"{",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"metaColumnsSQL1",
",",
"$",
"table",
",",
"$",
"table",
",",
"$",
"ta... | Generate the SQL to retrieve MetaColumns data
@param string $table Table name
@param string $schema Schema name (can be blank)
@return string SQL statement to execute | [
"Generate",
"the",
"SQL",
"to",
"retrieve",
"MetaColumns",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-postgres7.inc.php#L139-L147 |
219,709 | moodle/moodle | lib/adodb/drivers/adodb-postgres7.inc.php | ADODB_postgres7._old_MetaForeignKeys | function _old_MetaForeignKeys($table, $owner=false, $upper=false)
{
$sql = 'SELECT t.tgargs as args
FROM
pg_trigger t,pg_class c,pg_proc p
WHERE
t.tgenabled AND
t.tgrelid = c.oid AND
t.tgfoid = p.oid AND
p.proname = \'RI_FKey_check_ins\' AND
c.relname = \''.strtolower($table).'\'
ORDER BY
t.tgre... | php | function _old_MetaForeignKeys($table, $owner=false, $upper=false)
{
$sql = 'SELECT t.tgargs as args
FROM
pg_trigger t,pg_class c,pg_proc p
WHERE
t.tgenabled AND
t.tgrelid = c.oid AND
t.tgfoid = p.oid AND
p.proname = \'RI_FKey_check_ins\' AND
c.relname = \''.strtolower($table).'\'
ORDER BY
t.tgre... | [
"function",
"_old_MetaForeignKeys",
"(",
"$",
"table",
",",
"$",
"owner",
"=",
"false",
",",
"$",
"upper",
"=",
"false",
")",
"{",
"$",
"sql",
"=",
"'SELECT t.tgargs as args\n\t\tFROM\n\t\tpg_trigger t,pg_class c,pg_proc p\n\t\tWHERE\n\t\tt.tgenabled AND\n\t\tt.tgrelid = c.oi... | from Edward Jaramilla, improved version - works on pg 7.4 | [
"from",
"Edward",
"Jaramilla",
"improved",
"version",
"-",
"works",
"on",
"pg",
"7",
".",
"4"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-postgres7.inc.php#L201-L232 |
219,710 | moodle/moodle | lib/adodb/drivers/adodb-postgres7.inc.php | ADODB_postgres7.GetCharSet | function GetCharSet()
{
//we will use ADO's builtin property charSet
$this->charSet = @pg_client_encoding($this->_connectionID);
if (!$this->charSet) {
return false;
} else {
return $this->charSet;
}
} | php | function GetCharSet()
{
//we will use ADO's builtin property charSet
$this->charSet = @pg_client_encoding($this->_connectionID);
if (!$this->charSet) {
return false;
} else {
return $this->charSet;
}
} | [
"function",
"GetCharSet",
"(",
")",
"{",
"//we will use ADO's builtin property charSet",
"$",
"this",
"->",
"charSet",
"=",
"@",
"pg_client_encoding",
"(",
"$",
"this",
"->",
"_connectionID",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"charSet",
")",
"{",
... | it will return 'SQL_ANSI' always | [
"it",
"will",
"return",
"SQL_ANSI",
"always"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-postgres7.inc.php#L277-L286 |
219,711 | moodle/moodle | lib/adodb/drivers/adodb-postgres7.inc.php | ADODB_postgres7.SetCharSet | function SetCharSet($charset_name)
{
$this->GetCharSet();
if ($this->charSet !== $charset_name) {
$if = pg_set_client_encoding($this->_connectionID, $charset_name);
if ($if == "0" & $this->GetCharSet() == $charset_name) {
return true;
} else return false;
} else return true;
} | php | function SetCharSet($charset_name)
{
$this->GetCharSet();
if ($this->charSet !== $charset_name) {
$if = pg_set_client_encoding($this->_connectionID, $charset_name);
if ($if == "0" & $this->GetCharSet() == $charset_name) {
return true;
} else return false;
} else return true;
} | [
"function",
"SetCharSet",
"(",
"$",
"charset_name",
")",
"{",
"$",
"this",
"->",
"GetCharSet",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"charSet",
"!==",
"$",
"charset_name",
")",
"{",
"$",
"if",
"=",
"pg_set_client_encoding",
"(",
"$",
"this",
"->... | SetCharSet - switch the client encoding | [
"SetCharSet",
"-",
"switch",
"the",
"client",
"encoding"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-postgres7.inc.php#L289-L298 |
219,712 | moodle/moodle | question/type/match/backup/moodle2/restore_qtype_match_plugin.class.php | restore_qtype_match_plugin.recode_legacy_state_answer | public function recode_legacy_state_answer($state) {
$answer = $state->answer;
$resultarr = array();
foreach (explode(',', $answer) as $pair) {
$pairarr = explode('-', $pair);
$id = $pairarr[0];
$code = $pairarr[1];
$newid = $this->get_mappingid('q... | php | public function recode_legacy_state_answer($state) {
$answer = $state->answer;
$resultarr = array();
foreach (explode(',', $answer) as $pair) {
$pairarr = explode('-', $pair);
$id = $pairarr[0];
$code = $pairarr[1];
$newid = $this->get_mappingid('q... | [
"public",
"function",
"recode_legacy_state_answer",
"(",
"$",
"state",
")",
"{",
"$",
"answer",
"=",
"$",
"state",
"->",
"answer",
";",
"$",
"resultarr",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"explode",
"(",
"','",
",",
"$",
"answer",
")",
"as",... | Given one question_states record, return the answer
recoded pointing to all the restored stuff for match questions.
answer is one comma separated list of hypen separated pairs
containing question_match_sub->id and question_match_sub->code, which
has been remapped to be qtype_match_subquestions->id, since code no longe... | [
"Given",
"one",
"question_states",
"record",
"return",
"the",
"answer",
"recoded",
"pointing",
"to",
"all",
"the",
"restored",
"stuff",
"for",
"match",
"questions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/match/backup/moodle2/restore_qtype_match_plugin.class.php#L201-L217 |
219,713 | moodle/moodle | course/classes/search/section.php | section.get_document_recordset | public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
global $DB;
list ($contextjoin, $contextparams) = $this->get_course_level_context_restriction_sql($context, 'c');
if ($contextjoin === null) {
return null;
}
$comparetext = $DB->sq... | php | public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
global $DB;
list ($contextjoin, $contextparams) = $this->get_course_level_context_restriction_sql($context, 'c');
if ($contextjoin === null) {
return null;
}
$comparetext = $DB->sq... | [
"public",
"function",
"get_document_recordset",
"(",
"$",
"modifiedfrom",
"=",
"0",
",",
"\\",
"context",
"$",
"context",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"contextjoin",
",",
"$",
"contextparams",
")",
"=",
"$",
"this",
... | Returns recordset containing required data for indexing course sections.
@param int $modifiedfrom timestamp
@param \context|null $context Restriction context
@return \moodle_recordset|null Recordset or null if no change possible | [
"Returns",
"recordset",
"containing",
"required",
"data",
"for",
"indexing",
"course",
"sections",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/search/section.php#L54-L78 |
219,714 | moodle/moodle | course/classes/search/section.php | section.check_access | public function check_access($id) {
global $DB;
// Check we can get the section and the course modinfo.
$sectionrec = $DB->get_record('course_sections', ['id' => $id], '*', IGNORE_MISSING);
if (!$sectionrec) {
return \core_search\manager::ACCESS_DELETED;
}
tr... | php | public function check_access($id) {
global $DB;
// Check we can get the section and the course modinfo.
$sectionrec = $DB->get_record('course_sections', ['id' => $id], '*', IGNORE_MISSING);
if (!$sectionrec) {
return \core_search\manager::ACCESS_DELETED;
}
tr... | [
"public",
"function",
"check_access",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"DB",
";",
"// Check we can get the section and the course modinfo.",
"$",
"sectionrec",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'course_sections'",
",",
"[",
"'id'",
"=>",
"$",
"id... | Whether the user can access the section or not.
@param int $id The course section id.
@return int One of the \core_search\manager:ACCESS_xx constants | [
"Whether",
"the",
"user",
"can",
"access",
"the",
"section",
"or",
"not",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/search/section.php#L123-L147 |
219,715 | moodle/moodle | course/classes/search/section.php | section.get_doc_url | public function get_doc_url(\core_search\document $doc) {
global $DB;
$section = $DB->get_field('course_sections', 'section', ['id' => $doc->get('itemid')], MUST_EXIST);
$format = course_get_format($doc->get('courseid'));
return $format->get_view_url($section);
} | php | public function get_doc_url(\core_search\document $doc) {
global $DB;
$section = $DB->get_field('course_sections', 'section', ['id' => $doc->get('itemid')], MUST_EXIST);
$format = course_get_format($doc->get('courseid'));
return $format->get_view_url($section);
} | [
"public",
"function",
"get_doc_url",
"(",
"\\",
"core_search",
"\\",
"document",
"$",
"doc",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"section",
"=",
"$",
"DB",
"->",
"get_field",
"(",
"'course_sections'",
",",
"'section'",
",",
"[",
"'id'",
"=>",
"$",
... | Gets a link to the section.
@param \core_search\document $doc
@return \moodle_url | [
"Gets",
"a",
"link",
"to",
"the",
"section",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/search/section.php#L155-L160 |
219,716 | moodle/moodle | course/classes/analytics/target/course_competencies.php | course_competencies.get_num_competencies_in_course | protected function get_num_competencies_in_course ($courseid) {
if (!isset($this->coursecompetencies[$courseid])) {
$ccs = \core_competency\api::count_competencies_in_course($courseid);
// Save the number of competencies per course to avoid another database access in calculate_sample().... | php | protected function get_num_competencies_in_course ($courseid) {
if (!isset($this->coursecompetencies[$courseid])) {
$ccs = \core_competency\api::count_competencies_in_course($courseid);
// Save the number of competencies per course to avoid another database access in calculate_sample().... | [
"protected",
"function",
"get_num_competencies_in_course",
"(",
"$",
"courseid",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"coursecompetencies",
"[",
"$",
"courseid",
"]",
")",
")",
"{",
"$",
"ccs",
"=",
"\\",
"core_competency",
"\\",
"api... | Count the competencies in a course.
Save the value in $coursecompetencies array to prevent new accesses to the database.
@param int $courseid The course id.
@return int Number of competencies assigned to the course. | [
"Count",
"the",
"competencies",
"in",
"a",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/analytics/target/course_competencies.php#L52-L62 |
219,717 | moodle/moodle | course/classes/analytics/target/course_competencies.php | course_competencies.calculate_sample | protected function calculate_sample($sampleid, \core_analytics\analysable $course, $starttime = false, $endtime = false) {
$userenrol = $this->retrieve('user_enrolments', $sampleid);
$key = $course->get_id();
// Number of competencies in the course.
$ccs = $this->get_num_competencies_i... | php | protected function calculate_sample($sampleid, \core_analytics\analysable $course, $starttime = false, $endtime = false) {
$userenrol = $this->retrieve('user_enrolments', $sampleid);
$key = $course->get_id();
// Number of competencies in the course.
$ccs = $this->get_num_competencies_i... | [
"protected",
"function",
"calculate_sample",
"(",
"$",
"sampleid",
",",
"\\",
"core_analytics",
"\\",
"analysable",
"$",
"course",
",",
"$",
"starttime",
"=",
"false",
",",
"$",
"endtime",
"=",
"false",
")",
"{",
"$",
"userenrol",
"=",
"$",
"this",
"->",
... | To have the proficiency or not in each of the competencies assigned to the course sets the target value.
@param int $sampleid
@param \core_analytics\analysable $course
@param int $starttime
@param int $endtime
@return float 0 -> competencies achieved, 1 -> competencies not achieved | [
"To",
"have",
"the",
"proficiency",
"or",
"not",
"in",
"each",
"of",
"the",
"competencies",
"assigned",
"to",
"the",
"course",
"sets",
"the",
"target",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/analytics/target/course_competencies.php#L119-L135 |
219,718 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Ids/Map.php | Horde_Imap_Client_Ids_Map.update | public function update($ids)
{
if (empty($ids)) {
return false;
} elseif (empty($this->_ids)) {
$this->_ids = $ids;
$change = true;
} else {
$change = false;
foreach ($ids as $k => $v) {
if (!isset($this->_ids[$k]) |... | php | public function update($ids)
{
if (empty($ids)) {
return false;
} elseif (empty($this->_ids)) {
$this->_ids = $ids;
$change = true;
} else {
$change = false;
foreach ($ids as $k => $v) {
if (!isset($this->_ids[$k]) |... | [
"public",
"function",
"update",
"(",
"$",
"ids",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"ids",
")",
")",
"{",
"return",
"false",
";",
"}",
"elseif",
"(",
"empty",
"(",
"$",
"this",
"->",
"_ids",
")",
")",
"{",
"$",
"this",
"->",
"_ids",
"=",
... | Updates the mapping.
@param array $ids Array of sequence -> UID mapping.
@return boolean True if the mapping changed. | [
"Updates",
"the",
"mapping",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Ids/Map.php#L79-L101 |
219,719 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Ids/Map.php | Horde_Imap_Client_Ids_Map.remove | public function remove(Horde_Imap_Client_Ids $ids)
{
/* For sequence numbers, we need to reindex anytime we have an index
* that appears equal to or after a previously seen index. If an IMAP
* server is smart, it will expunge in reverse order instead. */
if ($ids->sequence) {
... | php | public function remove(Horde_Imap_Client_Ids $ids)
{
/* For sequence numbers, we need to reindex anytime we have an index
* that appears equal to or after a previously seen index. If an IMAP
* server is smart, it will expunge in reverse order instead. */
if ($ids->sequence) {
... | [
"public",
"function",
"remove",
"(",
"Horde_Imap_Client_Ids",
"$",
"ids",
")",
"{",
"/* For sequence numbers, we need to reindex anytime we have an index\n * that appears equal to or after a previously seen index. If an IMAP\n * server is smart, it will expunge in reverse order ins... | Removes messages from the ID mapping.
@param Horde_Imap_Client_Ids $ids IDs to remove. | [
"Removes",
"messages",
"from",
"the",
"ID",
"mapping",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Ids/Map.php#L126-L182 |
219,720 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Ids/Map.php | Horde_Imap_Client_Ids_Map.sort | public function sort()
{
if (!$this->_sorted) {
ksort($this->_ids, SORT_NUMERIC);
$this->_sorted = true;
}
} | php | public function sort()
{
if (!$this->_sorted) {
ksort($this->_ids, SORT_NUMERIC);
$this->_sorted = true;
}
} | [
"public",
"function",
"sort",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_sorted",
")",
"{",
"ksort",
"(",
"$",
"this",
"->",
"_ids",
",",
"SORT_NUMERIC",
")",
";",
"$",
"this",
"->",
"_sorted",
"=",
"true",
";",
"}",
"}"
] | Sort the map. | [
"Sort",
"the",
"map",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Ids/Map.php#L187-L193 |
219,721 | moodle/moodle | lib/boxlib.php | boxnet_client.get_file_info | public function get_file_info($fileid) {
$this->reset_state();
$result = $this->request($this->make_url("/files/$fileid"));
return json_decode($result);
} | php | public function get_file_info($fileid) {
$this->reset_state();
$result = $this->request($this->make_url("/files/$fileid"));
return json_decode($result);
} | [
"public",
"function",
"get_file_info",
"(",
"$",
"fileid",
")",
"{",
"$",
"this",
"->",
"reset_state",
"(",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"request",
"(",
"$",
"this",
"->",
"make_url",
"(",
"\"/files/$fileid\"",
")",
")",
";",
"retur... | Get info of a file.
@param int $fileid File ID.
@return object | [
"Get",
"info",
"of",
"a",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/boxlib.php#L91-L95 |
219,722 | moodle/moodle | lib/boxlib.php | boxnet_client.get_folder_items | public function get_folder_items($folderid = 0) {
$this->reset_state();
$result = $this->request($this->make_url("/folders/$folderid/items",
array('fields' => 'id,name,type,modified_at,size,owned_by')));
return json_decode($result);
} | php | public function get_folder_items($folderid = 0) {
$this->reset_state();
$result = $this->request($this->make_url("/folders/$folderid/items",
array('fields' => 'id,name,type,modified_at,size,owned_by')));
return json_decode($result);
} | [
"public",
"function",
"get_folder_items",
"(",
"$",
"folderid",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"reset_state",
"(",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"request",
"(",
"$",
"this",
"->",
"make_url",
"(",
"\"/folders/$folderid/items\"",
... | Get a folder content.
@param int $folderid Folder ID.
@return object | [
"Get",
"a",
"folder",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/boxlib.php#L103-L108 |
219,723 | moodle/moodle | lib/boxlib.php | boxnet_client.log_out | public function log_out() {
if ($accesstoken = $this->get_accesstoken()) {
$params = array(
'client_id' => $this->get_clientid(),
'client_secret' => $this->get_clientsecret(),
'token' => $accesstoken->token
);
$this->reset_state... | php | public function log_out() {
if ($accesstoken = $this->get_accesstoken()) {
$params = array(
'client_id' => $this->get_clientid(),
'client_secret' => $this->get_clientsecret(),
'token' => $accesstoken->token
);
$this->reset_state... | [
"public",
"function",
"log_out",
"(",
")",
"{",
"if",
"(",
"$",
"accesstoken",
"=",
"$",
"this",
"->",
"get_accesstoken",
"(",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'client_id'",
"=>",
"$",
"this",
"->",
"get_clientid",
"(",
")",
",",
"'c... | Log out.
@return void | [
"Log",
"out",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/boxlib.php#L115-L126 |
219,724 | moodle/moodle | lib/boxlib.php | boxnet_client.make_url | protected function make_url($uri, $params = array(), $uploadapi = false) {
$api = $uploadapi ? self::UPLOAD_API : self::API;
$url = new moodle_url($api . '/' . ltrim($uri, '/'), $params);
return $url->out(false);
} | php | protected function make_url($uri, $params = array(), $uploadapi = false) {
$api = $uploadapi ? self::UPLOAD_API : self::API;
$url = new moodle_url($api . '/' . ltrim($uri, '/'), $params);
return $url->out(false);
} | [
"protected",
"function",
"make_url",
"(",
"$",
"uri",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"uploadapi",
"=",
"false",
")",
"{",
"$",
"api",
"=",
"$",
"uploadapi",
"?",
"self",
"::",
"UPLOAD_API",
":",
"self",
"::",
"API",
";",
"$",... | Build a request URL.
@param string $uri The URI to request.
@param array $params Query string parameters.
@param bool $uploadapi Whether this works with the upload API or not.
@return string | [
"Build",
"a",
"request",
"URL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/boxlib.php#L136-L140 |
219,725 | moodle/moodle | lib/boxlib.php | boxnet_client.share_file | public function share_file($fileid, $businesscheck = true) {
// Sharing the file, this requires a PUT request with data within it. We cannot use
// the standard PUT request 'CURLOPT_PUT' because it expects a file.
$data = array('shared_link' => array('access' => 'open', 'permissions' =>
... | php | public function share_file($fileid, $businesscheck = true) {
// Sharing the file, this requires a PUT request with data within it. We cannot use
// the standard PUT request 'CURLOPT_PUT' because it expects a file.
$data = array('shared_link' => array('access' => 'open', 'permissions' =>
... | [
"public",
"function",
"share_file",
"(",
"$",
"fileid",
",",
"$",
"businesscheck",
"=",
"true",
")",
"{",
"// Sharing the file, this requires a PUT request with data within it. We cannot use",
"// the standard PUT request 'CURLOPT_PUT' because it expects a file.",
"$",
"data",
"=",... | Share a file and return the link to it.
@param string $fileid The file ID.
@param bool $businesscheck Whether or not to check if the user can share files, has a business account.
@return object | [
"Share",
"a",
"file",
"and",
"return",
"the",
"link",
"to",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/boxlib.php#L190-L214 |
219,726 | moodle/moodle | question/type/ddwtos/renderer.php | qtype_ddwtos_renderer.clear_wrong | public function clear_wrong(question_attempt $qa, $reallyclear = true) {
$question = $qa->get_question();
$response = $qa->get_last_qt_data();
if (!empty($response) && $reallyclear) {
$cleanresponse = $question->clear_wrong_from_response($response);
} else {
$cle... | php | public function clear_wrong(question_attempt $qa, $reallyclear = true) {
$question = $qa->get_question();
$response = $qa->get_last_qt_data();
if (!empty($response) && $reallyclear) {
$cleanresponse = $question->clear_wrong_from_response($response);
} else {
$cle... | [
"public",
"function",
"clear_wrong",
"(",
"question_attempt",
"$",
"qa",
",",
"$",
"reallyclear",
"=",
"true",
")",
"{",
"$",
"question",
"=",
"$",
"qa",
"->",
"get_question",
"(",
")",
";",
"$",
"response",
"=",
"$",
"qa",
"->",
"get_last_qt_data",
"(",... | Actually, this question type abuses this method to always output the
hidden fields it needs.
@param question_attempt $qa the question attempt.
@param bool $reallyclear whether we are really clearing the responses, or just outputting them.
@return string HTML to output. | [
"Actually",
"this",
"question",
"type",
"abuses",
"this",
"method",
"to",
"always",
"output",
"the",
"hidden",
"fields",
"it",
"needs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/ddwtos/renderer.php#L144-L192 |
219,727 | moodle/moodle | lib/php-css-parser/OutputFormat.php | OutputFormatter.safely | public function safely($cCode) {
if($this->oFormat->get('IgnoreExceptions')) {
// If output exceptions are ignored, run the code with exception guards
try {
return $cCode();
} catch (OutputException $e) {
return null;
} //Do nothing
} else {
// Run the code as-is
return $cCode();
}
} | php | public function safely($cCode) {
if($this->oFormat->get('IgnoreExceptions')) {
// If output exceptions are ignored, run the code with exception guards
try {
return $cCode();
} catch (OutputException $e) {
return null;
} //Do nothing
} else {
// Run the code as-is
return $cCode();
}
} | [
"public",
"function",
"safely",
"(",
"$",
"cCode",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oFormat",
"->",
"get",
"(",
"'IgnoreExceptions'",
")",
")",
"{",
"// If output exceptions are ignored, run the code with exception guards",
"try",
"{",
"return",
"$",
"cCod... | Runs the given code, either swallowing or passing exceptions, depending on the bIgnoreExceptions setting. | [
"Runs",
"the",
"given",
"code",
"either",
"swallowing",
"or",
"passing",
"exceptions",
"depending",
"on",
"the",
"bIgnoreExceptions",
"setting",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/php-css-parser/OutputFormat.php#L229-L241 |
219,728 | moodle/moodle | question/category_class.php | question_category_object.initialize | public function initialize($page, $contexts, $currentcat, $defaultcategory, $todelete, $addcontexts) {
$lastlist = null;
foreach ($contexts as $context){
$this->editlists[$context->id] = new question_category_list('ul', '', true, $this->pageurl, $page, 'cpage', QUESTION_PAGE_LENGTH, $context... | php | public function initialize($page, $contexts, $currentcat, $defaultcategory, $todelete, $addcontexts) {
$lastlist = null;
foreach ($contexts as $context){
$this->editlists[$context->id] = new question_category_list('ul', '', true, $this->pageurl, $page, 'cpage', QUESTION_PAGE_LENGTH, $context... | [
"public",
"function",
"initialize",
"(",
"$",
"page",
",",
"$",
"contexts",
",",
"$",
"currentcat",
",",
"$",
"defaultcategory",
",",
"$",
"todelete",
",",
"$",
"addcontexts",
")",
"{",
"$",
"lastlist",
"=",
"null",
";",
"foreach",
"(",
"$",
"contexts",
... | Initializes this classes general category-related variables | [
"Initializes",
"this",
"classes",
"general",
"category",
"-",
"related",
"variables"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/category_class.php#L247-L267 |
219,729 | moodle/moodle | question/category_class.php | question_category_object.get_course_ids | public function get_course_ids($categories) {
$courseids = array();
foreach ($categories as $key=>$cat) {
$courseids[$key] = $cat->course;
if (!empty($cat->children)) {
$courseids = array_merge($courseids, $this->get_course_ids($cat->children));
}
... | php | public function get_course_ids($categories) {
$courseids = array();
foreach ($categories as $key=>$cat) {
$courseids[$key] = $cat->course;
if (!empty($cat->children)) {
$courseids = array_merge($courseids, $this->get_course_ids($cat->children));
}
... | [
"public",
"function",
"get_course_ids",
"(",
"$",
"categories",
")",
"{",
"$",
"courseids",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"categories",
"as",
"$",
"key",
"=>",
"$",
"cat",
")",
"{",
"$",
"courseids",
"[",
"$",
"key",
"]",
"=",
"... | gets all the courseids for the given categories
@param array categories contains category objects in a tree representation
@return array courseids flat array in form categoryid=>courseid | [
"gets",
"all",
"the",
"courseids",
"for",
"the",
"given",
"categories"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/category_class.php#L323-L332 |
219,730 | moodle/moodle | question/category_class.php | question_category_object.set_viable_parents | public function set_viable_parents(&$parentstrings, $category) {
unset($parentstrings[$category->id]);
if (isset($category->children)) {
foreach ($category->children as $child) {
$this->set_viable_parents($parentstrings, $child);
}
}
} | php | public function set_viable_parents(&$parentstrings, $category) {
unset($parentstrings[$category->id]);
if (isset($category->children)) {
foreach ($category->children as $child) {
$this->set_viable_parents($parentstrings, $child);
}
}
} | [
"public",
"function",
"set_viable_parents",
"(",
"&",
"$",
"parentstrings",
",",
"$",
"category",
")",
"{",
"unset",
"(",
"$",
"parentstrings",
"[",
"$",
"category",
"->",
"id",
"]",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"category",
"->",
"children",
... | Sets the viable parents
Viable parents are any except for the category itself, or any of it's descendants
The parentstrings parameter is passed by reference and changed by this function.
@param array parentstrings a list of parentstrings
@param object category | [
"Sets",
"the",
"viable",
"parents"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/category_class.php#L361-L369 |
219,731 | moodle/moodle | question/category_class.php | question_category_object.get_question_categories | public function get_question_categories($parent=null, $sort="sortorder ASC") {
global $COURSE, $DB;
if (is_null($parent)) {
$categories = $DB->get_records('question_categories', array('course' => $COURSE->id), $sort);
} else {
$select = "parent = ? AND course = ?";
... | php | public function get_question_categories($parent=null, $sort="sortorder ASC") {
global $COURSE, $DB;
if (is_null($parent)) {
$categories = $DB->get_records('question_categories', array('course' => $COURSE->id), $sort);
} else {
$select = "parent = ? AND course = ?";
... | [
"public",
"function",
"get_question_categories",
"(",
"$",
"parent",
"=",
"null",
",",
"$",
"sort",
"=",
"\"sortorder ASC\"",
")",
"{",
"global",
"$",
"COURSE",
",",
"$",
"DB",
";",
"if",
"(",
"is_null",
"(",
"$",
"parent",
")",
")",
"{",
"$",
"categor... | Gets question categories
@param int parent - if given, restrict records to those with this parent id.
@param string sort - [[sortfield [,sortfield]] {ASC|DESC}]
@return array categories | [
"Gets",
"question",
"categories"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/category_class.php#L378-L387 |
219,732 | moodle/moodle | question/category_class.php | question_category_object.delete_category | public function delete_category($categoryid) {
global $CFG, $DB;
question_can_delete_cat($categoryid);
if (!$category = $DB->get_record("question_categories", array("id" => $categoryid))) { // security
print_error('unknowcategory');
}
/// Send the children categories... | php | public function delete_category($categoryid) {
global $CFG, $DB;
question_can_delete_cat($categoryid);
if (!$category = $DB->get_record("question_categories", array("id" => $categoryid))) { // security
print_error('unknowcategory');
}
/// Send the children categories... | [
"public",
"function",
"delete_category",
"(",
"$",
"categoryid",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"question_can_delete_cat",
"(",
"$",
"categoryid",
")",
";",
"if",
"(",
"!",
"$",
"category",
"=",
"$",
"DB",
"->",
"get_record",
"(",
... | Deletes an existing question category
@param int deletecat id of category to delete | [
"Deletes",
"an",
"existing",
"question",
"category"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/category_class.php#L394-L411 |
219,733 | moodle/moodle | question/category_class.php | question_category_object.add_category | public function add_category($newparent, $newcategory, $newinfo, $return = false, $newinfoformat = FORMAT_HTML,
$idnumber = null) {
global $DB;
if (empty($newcategory)) {
print_error('categorynamecantbeblank', 'question');
}
list($parentid, $contextid) = explode('... | php | public function add_category($newparent, $newcategory, $newinfo, $return = false, $newinfoformat = FORMAT_HTML,
$idnumber = null) {
global $DB;
if (empty($newcategory)) {
print_error('categorynamecantbeblank', 'question');
}
list($parentid, $contextid) = explode('... | [
"public",
"function",
"add_category",
"(",
"$",
"newparent",
",",
"$",
"newcategory",
",",
"$",
"newinfo",
",",
"$",
"return",
"=",
"false",
",",
"$",
"newinfoformat",
"=",
"FORMAT_HTML",
",",
"$",
"idnumber",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
... | Creates a new category with given params | [
"Creates",
"a",
"new",
"category",
"with",
"given",
"params"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/category_class.php#L438-L489 |
219,734 | moodle/moodle | mod/quiz/report/statistics/classes/calculator.php | calculator.attempt_counts_and_averages | protected function attempt_counts_and_averages($quizid, \core\dml\sql_join $groupstudentsjoins) {
global $DB;
$attempttotals = new \stdClass();
foreach (array_keys(quiz_get_grading_options()) as $which) {
list($fromqa, $whereqa, $qaparams) = quiz_statistics_attempts_sql($quizid, $g... | php | protected function attempt_counts_and_averages($quizid, \core\dml\sql_join $groupstudentsjoins) {
global $DB;
$attempttotals = new \stdClass();
foreach (array_keys(quiz_get_grading_options()) as $which) {
list($fromqa, $whereqa, $qaparams) = quiz_statistics_attempts_sql($quizid, $g... | [
"protected",
"function",
"attempt_counts_and_averages",
"(",
"$",
"quizid",
",",
"\\",
"core",
"\\",
"dml",
"\\",
"sql_join",
"$",
"groupstudentsjoins",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"attempttotals",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
... | Calculating count and mean of marks for first and ALL attempts by students.
See : http://docs.moodle.org/dev/Quiz_item_analysis_calculations_in_practise
#Calculating_MEAN_of_grades_for_all_attempts_by_students
@param int $quizid
@param \core\dml\sql_join $groupstudentsjoins Contains joins, wheres, params for students ... | [
"Calculating",
"count",
"and",
"mean",
"of",
"marks",
"for",
"first",
"and",
"ALL",
"attempts",
"by",
"students",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/statistics/classes/calculator.php#L209-L224 |
219,735 | moodle/moodle | mod/quiz/report/statistics/classes/calculator.php | calculator.median | protected function median($s, $fromqa, $whereqa, $qaparams) {
global $DB;
if ($s % 2 == 0) {
// An even number of attempts.
$limitoffset = $s / 2 - 1;
$limit = 2;
} else {
$limitoffset = floor($s / 2);
$limit = 1;
}
$sq... | php | protected function median($s, $fromqa, $whereqa, $qaparams) {
global $DB;
if ($s % 2 == 0) {
// An even number of attempts.
$limitoffset = $s / 2 - 1;
$limit = 2;
} else {
$limitoffset = floor($s / 2);
$limit = 1;
}
$sq... | [
"protected",
"function",
"median",
"(",
"$",
"s",
",",
"$",
"fromqa",
",",
"$",
"whereqa",
",",
"$",
"qaparams",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"s",
"%",
"2",
"==",
"0",
")",
"{",
"// An even number of attempts.",
"$",
"limitoffs... | Median mark.
http://docs.moodle.org/dev/Quiz_statistics_calculations#Median_Score
@param $s integer count of attempts
@param $fromqa string
@param $whereqa string
@param $qaparams string
@return float | [
"Median",
"mark",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/statistics/classes/calculator.php#L237-L256 |
219,736 | moodle/moodle | mod/quiz/report/statistics/classes/calculator.php | calculator.sum_of_powers_of_difference_to_mean | protected function sum_of_powers_of_difference_to_mean($mean, $fromqa, $whereqa, $qaparams) {
global $DB;
$sql = "SELECT
SUM(POWER((quiza.sumgrades - $mean), 2)) AS power2,
SUM(POWER((quiza.sumgrades - $mean), 3)) AS power3,
SUM(POWER((quiza.s... | php | protected function sum_of_powers_of_difference_to_mean($mean, $fromqa, $whereqa, $qaparams) {
global $DB;
$sql = "SELECT
SUM(POWER((quiza.sumgrades - $mean), 2)) AS power2,
SUM(POWER((quiza.sumgrades - $mean), 3)) AS power3,
SUM(POWER((quiza.s... | [
"protected",
"function",
"sum_of_powers_of_difference_to_mean",
"(",
"$",
"mean",
",",
"$",
"fromqa",
",",
"$",
"whereqa",
",",
"$",
"qaparams",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT\n SUM(POWER((quiza.sumgrades - $mean), 2)... | Fetch the sum of squared, cubed and to the power 4 differences between sumgrade and it's mean.
Explanation here : http://docs.moodle.org/dev/Quiz_item_analysis_calculations_in_practise
#Calculating_Standard_Deviation.2C_Skewness_and_Kurtosis_of_grades_for_all_attempts_by_students
@param $mean
@param $fromqa
@param $w... | [
"Fetch",
"the",
"sum",
"of",
"squared",
"cubed",
"and",
"to",
"the",
"power",
"4",
"differences",
"between",
"sumgrade",
"and",
"it",
"s",
"mean",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/statistics/classes/calculator.php#L270-L282 |
219,737 | moodle/moodle | question/type/ddmarker/edit_ddmarker_form.php | qtype_ddmarker_edit_form.get_image_size_in_draft_area | public function get_image_size_in_draft_area($draftitemid) {
global $USER;
$usercontext = context_user::instance($USER->id);
$fs = get_file_storage();
$draftfiles = $fs->get_area_files($usercontext->id, 'user', 'draft', $draftitemid, 'id');
if ($draftfiles) {
foreach ... | php | public function get_image_size_in_draft_area($draftitemid) {
global $USER;
$usercontext = context_user::instance($USER->id);
$fs = get_file_storage();
$draftfiles = $fs->get_area_files($usercontext->id, 'user', 'draft', $draftitemid, 'id');
if ($draftfiles) {
foreach ... | [
"public",
"function",
"get_image_size_in_draft_area",
"(",
"$",
"draftitemid",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"usercontext",
"=",
"context_user",
"::",
"instance",
"(",
"$",
"USER",
"->",
"id",
")",
";",
"$",
"fs",
"=",
"get_file_storage",
"(",
... | Gets the width and height of a draft image.
@param int $draftitemid ID of the draft image
@return array Return array of the width and height of the draft image. | [
"Gets",
"the",
"width",
"and",
"height",
"of",
"a",
"draft",
"image",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/ddmarker/edit_ddmarker_form.php#L266-L284 |
219,738 | moodle/moodle | lib/flickrlib.php | phpFlickr.buildPhotoURL | function buildPhotoURL ($photo, $size = "Medium")
{
//receives an array (can use the individual photo data returned
//from an API call) and returns a URL (doesn't mean that the
//file size exists)
$sizes = array(
"square" => "_s",
"thumbnail" => "_t",
... | php | function buildPhotoURL ($photo, $size = "Medium")
{
//receives an array (can use the individual photo data returned
//from an API call) and returns a URL (doesn't mean that the
//file size exists)
$sizes = array(
"square" => "_s",
"thumbnail" => "_t",
... | [
"function",
"buildPhotoURL",
"(",
"$",
"photo",
",",
"$",
"size",
"=",
"\"Medium\"",
")",
"{",
"//receives an array (can use the individual photo data returned",
"//from an API call) and returns a URL (doesn't mean that the",
"//file size exists)",
"$",
"sizes",
"=",
"array",
"... | These functions are front ends for the flickr calls | [
"These",
"functions",
"are",
"front",
"ends",
"for",
"the",
"flickr",
"calls"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrlib.php#L208-L233 |
219,739 | moodle/moodle | lib/flickrlib.php | phpFlickr.groups_pools_add | function groups_pools_add ($photo_id, $group_id)
{
/** http://www.flickr.com/services/api/flickr.groups.pools.add.html */
$this->request("flickr.groups.pools.add", array("photo_id"=>$photo_id, "group_id"=>$group_id), TRUE);
return $this->parsed_response ? true : false;
} | php | function groups_pools_add ($photo_id, $group_id)
{
/** http://www.flickr.com/services/api/flickr.groups.pools.add.html */
$this->request("flickr.groups.pools.add", array("photo_id"=>$photo_id, "group_id"=>$group_id), TRUE);
return $this->parsed_response ? true : false;
} | [
"function",
"groups_pools_add",
"(",
"$",
"photo_id",
",",
"$",
"group_id",
")",
"{",
"/** http://www.flickr.com/services/api/flickr.groups.pools.add.html */",
"$",
"this",
"->",
"request",
"(",
"\"flickr.groups.pools.add\"",
",",
"array",
"(",
"\"photo_id\"",
"=>",
"$",
... | Groups Pools Methods | [
"Groups",
"Pools",
"Methods"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrlib.php#L411-L416 |
219,740 | moodle/moodle | lib/flickrlib.php | phpFlickr.photos_comments_addComment | function photos_comments_addComment($photo_id, $comment_text) {
/** http://www.flickr.com/services/api/flickr.photos.comments.addComment.html */
$this->request("flickr.photos.comments.addComment", array("photo_id" => $photo_id, "comment_text"=>$comment_text), TRUE);
return $this->parsed_response... | php | function photos_comments_addComment($photo_id, $comment_text) {
/** http://www.flickr.com/services/api/flickr.photos.comments.addComment.html */
$this->request("flickr.photos.comments.addComment", array("photo_id" => $photo_id, "comment_text"=>$comment_text), TRUE);
return $this->parsed_response... | [
"function",
"photos_comments_addComment",
"(",
"$",
"photo_id",
",",
"$",
"comment_text",
")",
"{",
"/** http://www.flickr.com/services/api/flickr.photos.comments.addComment.html */",
"$",
"this",
"->",
"request",
"(",
"\"flickr.photos.comments.addComment\"",
",",
"array",
"(",... | Photos - Comments Methods | [
"Photos",
"-",
"Comments",
"Methods"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrlib.php#L728-L732 |
219,741 | moodle/moodle | lib/flickrlib.php | phpFlickr.photos_geo_getLocation | function photos_geo_getLocation($photo_id)
{
/** http://www.flickr.com/services/api/flickr.photos.geo.getLocation.html */
$this->request("flickr.photos.geo.getLocation", array("photo_id"=>$photo_id));
return $this->parsed_response ? $this->parsed_response['photo'] : false;
} | php | function photos_geo_getLocation($photo_id)
{
/** http://www.flickr.com/services/api/flickr.photos.geo.getLocation.html */
$this->request("flickr.photos.geo.getLocation", array("photo_id"=>$photo_id));
return $this->parsed_response ? $this->parsed_response['photo'] : false;
} | [
"function",
"photos_geo_getLocation",
"(",
"$",
"photo_id",
")",
"{",
"/** http://www.flickr.com/services/api/flickr.photos.geo.getLocation.html */",
"$",
"this",
"->",
"request",
"(",
"\"flickr.photos.geo.getLocation\"",
",",
"array",
"(",
"\"photo_id\"",
"=>",
"$",
"photo_i... | Photos - Geo Methods | [
"Photos",
"-",
"Geo",
"Methods"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrlib.php#L754-L759 |
219,742 | moodle/moodle | lib/flickrlib.php | phpFlickr.photos_notes_add | function photos_notes_add($photo_id, $note_x, $note_y, $note_w, $note_h, $note_text)
{
/** http://www.flickr.com/services/api/flickr.photos.notes.add.html */
$this->request("flickr.photos.notes.add", array("photo_id" => $photo_id, "note_x" => $note_x, "note_y" => $note_y, "note_w" => $note_w, "note_... | php | function photos_notes_add($photo_id, $note_x, $note_y, $note_w, $note_h, $note_text)
{
/** http://www.flickr.com/services/api/flickr.photos.notes.add.html */
$this->request("flickr.photos.notes.add", array("photo_id" => $photo_id, "note_x" => $note_x, "note_y" => $note_y, "note_w" => $note_w, "note_... | [
"function",
"photos_notes_add",
"(",
"$",
"photo_id",
",",
"$",
"note_x",
",",
"$",
"note_y",
",",
"$",
"note_w",
",",
"$",
"note_h",
",",
"$",
"note_text",
")",
"{",
"/** http://www.flickr.com/services/api/flickr.photos.notes.add.html */",
"$",
"this",
"->",
"req... | Photos - Notes Methods | [
"Photos",
"-",
"Notes",
"Methods"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrlib.php#L806-L811 |
219,743 | moodle/moodle | lib/flickrlib.php | phpFlickr.photos_transform_rotate | function photos_transform_rotate($photo_id, $degrees)
{
/** http://www.flickr.com/services/api/flickr.photos.transform.rotate.html */
$this->request("flickr.photos.transform.rotate", array("photo_id" => $photo_id, "degrees" => $degrees), TRUE);
return $this->parsed_response ? true : false;
... | php | function photos_transform_rotate($photo_id, $degrees)
{
/** http://www.flickr.com/services/api/flickr.photos.transform.rotate.html */
$this->request("flickr.photos.transform.rotate", array("photo_id" => $photo_id, "degrees" => $degrees), TRUE);
return $this->parsed_response ? true : false;
... | [
"function",
"photos_transform_rotate",
"(",
"$",
"photo_id",
",",
"$",
"degrees",
")",
"{",
"/** http://www.flickr.com/services/api/flickr.photos.transform.rotate.html */",
"$",
"this",
"->",
"request",
"(",
"\"flickr.photos.transform.rotate\"",
",",
"array",
"(",
"\"photo_id... | Photos - Transform Methods | [
"Photos",
"-",
"Transform",
"Methods"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrlib.php#L828-L833 |
219,744 | moodle/moodle | lib/flickrlib.php | phpFlickr.photos_upload_checkTickets | function photos_upload_checkTickets($tickets)
{
/** http://www.flickr.com/services/api/flickr.photos.upload.checkTickets.html */
if (is_array($tickets)) {
$tickets = implode(",", $tickets);
}
$this->request("flickr.photos.upload.checkTickets", array("tickets" => $tickets)... | php | function photos_upload_checkTickets($tickets)
{
/** http://www.flickr.com/services/api/flickr.photos.upload.checkTickets.html */
if (is_array($tickets)) {
$tickets = implode(",", $tickets);
}
$this->request("flickr.photos.upload.checkTickets", array("tickets" => $tickets)... | [
"function",
"photos_upload_checkTickets",
"(",
"$",
"tickets",
")",
"{",
"/** http://www.flickr.com/services/api/flickr.photos.upload.checkTickets.html */",
"if",
"(",
"is_array",
"(",
"$",
"tickets",
")",
")",
"{",
"$",
"tickets",
"=",
"implode",
"(",
"\",\"",
",",
"... | Photos - Upload Methods | [
"Photos",
"-",
"Upload",
"Methods"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrlib.php#L836-L844 |
219,745 | moodle/moodle | lib/flickrlib.php | phpFlickr.photosets_comments_addComment | function photosets_comments_addComment($photoset_id, $comment_text) {
/** http://www.flickr.com/services/api/flickr.photosets.comments.addComment.html */
$this->request("flickr.photosets.comments.addComment", array("photoset_id" => $photoset_id, "comment_text"=>$comment_text), TRUE);
return $thi... | php | function photosets_comments_addComment($photoset_id, $comment_text) {
/** http://www.flickr.com/services/api/flickr.photosets.comments.addComment.html */
$this->request("flickr.photosets.comments.addComment", array("photoset_id" => $photoset_id, "comment_text"=>$comment_text), TRUE);
return $thi... | [
"function",
"photosets_comments_addComment",
"(",
"$",
"photoset_id",
",",
"$",
"comment_text",
")",
"{",
"/** http://www.flickr.com/services/api/flickr.photosets.comments.addComment.html */",
"$",
"this",
"->",
"request",
"(",
"\"flickr.photosets.comments.addComment\"",
",",
"ar... | Photosets Comments Methods | [
"Photosets",
"Comments",
"Methods"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrlib.php#L928-L932 |
219,746 | moodle/moodle | course/classes/analytics/indicator/activities_due.php | activities_due.get_provide_event_action_num_params | private function get_provide_event_action_num_params(string $modulename) {
$functionname = 'mod_' . $modulename . '_core_calendar_provide_event_action';
$reflection = new \ReflectionFunction($functionname);
return $reflection->getNumberOfParameters();
} | php | private function get_provide_event_action_num_params(string $modulename) {
$functionname = 'mod_' . $modulename . '_core_calendar_provide_event_action';
$reflection = new \ReflectionFunction($functionname);
return $reflection->getNumberOfParameters();
} | [
"private",
"function",
"get_provide_event_action_num_params",
"(",
"string",
"$",
"modulename",
")",
"{",
"$",
"functionname",
"=",
"'mod_'",
".",
"$",
"modulename",
".",
"'_core_calendar_provide_event_action'",
";",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionFun... | Returns the number of params declared in core_calendar_provide_event_action's implementation.
@param string $modulename The module name
@return int | [
"Returns",
"the",
"number",
"of",
"params",
"declared",
"in",
"core_calendar_provide_event_action",
"s",
"implementation",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/analytics/indicator/activities_due.php#L95-L99 |
219,747 | moodle/moodle | mod/assign/extensionform.php | mod_assign_extension_form.validation | public function validation($data, $files) {
$errors = parent::validation($data, $files);
if ($this->instance->duedate && $data['extensionduedate']) {
if ($this->instance->duedate > $data['extensionduedate']) {
$errors['extensionduedate'] = get_string('extensionnotafterduedate... | php | public function validation($data, $files) {
$errors = parent::validation($data, $files);
if ($this->instance->duedate && $data['extensionduedate']) {
if ($this->instance->duedate > $data['extensionduedate']) {
$errors['extensionduedate'] = get_string('extensionnotafterduedate... | [
"public",
"function",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"$",
"errors",
"=",
"parent",
"::",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
";",
"if",
"(",
"$",
"this",
"->",
"instance",
"->",
"duedate",
"&&",
"$"... | Perform validation on the extension form
@param array $data
@param array $files | [
"Perform",
"validation",
"on",
"the",
"extension",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/extensionform.php#L121-L135 |
219,748 | moodle/moodle | mod/lti/service/toolproxy/classes/local/resources/toolproxy.php | toolproxy.lti_extract_parameters | private static function lti_extract_parameters($parameters) {
$params = array();
foreach ($parameters as $parameter) {
if (isset($parameter->variable)) {
$value = '$' . $parameter->variable;
} else {
$value = $parameter->fixed;
if ... | php | private static function lti_extract_parameters($parameters) {
$params = array();
foreach ($parameters as $parameter) {
if (isset($parameter->variable)) {
$value = '$' . $parameter->variable;
} else {
$value = $parameter->fixed;
if ... | [
"private",
"static",
"function",
"lti_extract_parameters",
"(",
"$",
"parameters",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"parameter",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"parameter",
"->",... | Extracts the message parameters from the tool proxy entry
@param array $parameters Parameter section of a message
@return String containing parameters | [
"Extracts",
"the",
"message",
"parameters",
"from",
"the",
"tool",
"proxy",
"entry"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/service/toolproxy/classes/local/resources/toolproxy.php#L278-L298 |
219,749 | moodle/moodle | course/renderer.php | core_course_renderer.course_info_box | public function course_info_box(stdClass $course) {
$content = '';
$content .= $this->output->box_start('generalbox info');
$chelper = new coursecat_helper();
$chelper->set_show_courses(self::COURSECAT_SHOW_COURSES_EXPANDED);
$content .= $this->coursecat_coursebox($chelper, $cour... | php | public function course_info_box(stdClass $course) {
$content = '';
$content .= $this->output->box_start('generalbox info');
$chelper = new coursecat_helper();
$chelper->set_show_courses(self::COURSECAT_SHOW_COURSES_EXPANDED);
$content .= $this->coursecat_coursebox($chelper, $cour... | [
"public",
"function",
"course_info_box",
"(",
"stdClass",
"$",
"course",
")",
"{",
"$",
"content",
"=",
"''",
";",
"$",
"content",
".=",
"$",
"this",
"->",
"output",
"->",
"box_start",
"(",
"'generalbox info'",
")",
";",
"$",
"chelper",
"=",
"new",
"cour... | Renders course info box.
@param stdClass $course
@return string | [
"Renders",
"course",
"info",
"box",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L84-L92 |
219,750 | moodle/moodle | course/renderer.php | core_course_renderer.course_modchooser | public function course_modchooser($modules, $course) {
if (!$this->page->requires->should_create_one_time_item_now('core_course_modchooser')) {
return '';
}
$modchooser = new \core_course\output\modchooser($course, $modules);
return $this->render($modchooser);
} | php | public function course_modchooser($modules, $course) {
if (!$this->page->requires->should_create_one_time_item_now('core_course_modchooser')) {
return '';
}
$modchooser = new \core_course\output\modchooser($course, $modules);
return $this->render($modchooser);
} | [
"public",
"function",
"course_modchooser",
"(",
"$",
"modules",
",",
"$",
"course",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"page",
"->",
"requires",
"->",
"should_create_one_time_item_now",
"(",
"'core_course_modchooser'",
")",
")",
"{",
"return",
"''",
... | Build the HTML for the module chooser javascript popup
@param array $modules A set of modules as returned form @see
get_module_metadata
@param object $course The course that will be displayed
@return string The composed HTML for the module | [
"Build",
"the",
"HTML",
"for",
"the",
"module",
"chooser",
"javascript",
"popup"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L143-L149 |
219,751 | moodle/moodle | course/renderer.php | core_course_renderer.course_section_cm_edit_actions | public function course_section_cm_edit_actions($actions, cm_info $mod = null, $displayoptions = array()) {
global $CFG;
if (empty($actions)) {
return '';
}
if (isset($displayoptions['ownerselector'])) {
$ownerselector = $displayoptions['ownerselector'];
... | php | public function course_section_cm_edit_actions($actions, cm_info $mod = null, $displayoptions = array()) {
global $CFG;
if (empty($actions)) {
return '';
}
if (isset($displayoptions['ownerselector'])) {
$ownerselector = $displayoptions['ownerselector'];
... | [
"public",
"function",
"course_section_cm_edit_actions",
"(",
"$",
"actions",
",",
"cm_info",
"$",
"mod",
"=",
"null",
",",
"$",
"displayoptions",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"actions",
")",
... | Renders HTML for displaying the sequence of course module editing buttons
@see course_get_cm_edit_actions()
@param action_link[] $actions Array of action_link objects
@param cm_info $mod The module we are displaying actions for.
@param array $displayoptions additional display options:
ownerselector => A JS/CSS select... | [
"Renders",
"HTML",
"for",
"displaying",
"the",
"sequence",
"of",
"course",
"module",
"editing",
"buttons"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L203-L243 |
219,752 | moodle/moodle | course/renderer.php | core_course_renderer.course_search_form | public function course_search_form($value = '', $format = 'plain') {
static $count = 0;
$formid = 'coursesearch';
if ((++$count) > 1) {
$formid .= $count;
}
switch ($format) {
case 'navbar' :
$formid = 'coursesearchnavbar';
... | php | public function course_search_form($value = '', $format = 'plain') {
static $count = 0;
$formid = 'coursesearch';
if ((++$count) > 1) {
$formid .= $count;
}
switch ($format) {
case 'navbar' :
$formid = 'coursesearchnavbar';
... | [
"public",
"function",
"course_search_form",
"(",
"$",
"value",
"=",
"''",
",",
"$",
"format",
"=",
"'plain'",
")",
"{",
"static",
"$",
"count",
"=",
"0",
";",
"$",
"formid",
"=",
"'coursesearch'",
";",
"if",
"(",
"(",
"++",
"$",
"count",
")",
">",
... | Renders html to display a course search form.
@param string $value default value to populate the search field
@param string $format display format - 'plain' (default), 'short' or 'navbar'
@return string | [
"Renders",
"html",
"to",
"display",
"a",
"course",
"search",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L353-L388 |
219,753 | moodle/moodle | course/renderer.php | core_course_renderer.is_cm_conditionally_hidden | protected function is_cm_conditionally_hidden(cm_info $mod) {
global $CFG;
$conditionalhidden = false;
if (!empty($CFG->enableavailability)) {
$info = new \core_availability\info_module($mod);
$conditionalhidden = !$info->is_available_for_all();
}
return $... | php | protected function is_cm_conditionally_hidden(cm_info $mod) {
global $CFG;
$conditionalhidden = false;
if (!empty($CFG->enableavailability)) {
$info = new \core_availability\info_module($mod);
$conditionalhidden = !$info->is_available_for_all();
}
return $... | [
"protected",
"function",
"is_cm_conditionally_hidden",
"(",
"cm_info",
"$",
"mod",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"conditionalhidden",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"enableavailability",
")",
")",
"{",
"$",
... | Checks if course module has any conditions that may make it unavailable for
all or some of the students
This function is internal and is only used to create CSS classes for the module name/text
@param cm_info $mod
@return bool | [
"Checks",
"if",
"course",
"module",
"has",
"any",
"conditions",
"that",
"may",
"make",
"it",
"unavailable",
"for",
"all",
"or",
"some",
"of",
"the",
"students"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L532-L540 |
219,754 | moodle/moodle | course/renderer.php | core_course_renderer.availability_info | public function availability_info($text, $additionalclasses = '') {
$data = ['text' => $text, 'classes' => $additionalclasses];
$additionalclasses = array_filter(explode(' ', $additionalclasses));
if (in_array('ishidden', $additionalclasses)) {
$data['ishidden'] = 1;
} els... | php | public function availability_info($text, $additionalclasses = '') {
$data = ['text' => $text, 'classes' => $additionalclasses];
$additionalclasses = array_filter(explode(' ', $additionalclasses));
if (in_array('ishidden', $additionalclasses)) {
$data['ishidden'] = 1;
} els... | [
"public",
"function",
"availability_info",
"(",
"$",
"text",
",",
"$",
"additionalclasses",
"=",
"''",
")",
"{",
"$",
"data",
"=",
"[",
"'text'",
"=>",
"$",
"text",
",",
"'classes'",
"=>",
"$",
"additionalclasses",
"]",
";",
"$",
"additionalclasses",
"=",
... | Displays availability info for a course section or course module
@param string $text
@param string $additionalclasses
@return string | [
"Displays",
"availability",
"info",
"for",
"a",
"course",
"section",
"or",
"course",
"module"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L704-L724 |
219,755 | moodle/moodle | course/renderer.php | core_course_renderer.course_section_cm_list_item | public function course_section_cm_list_item($course, &$completioninfo, cm_info $mod, $sectionreturn, $displayoptions = array()) {
$output = '';
if ($modulehtml = $this->course_section_cm($course, $completioninfo, $mod, $sectionreturn, $displayoptions)) {
$modclasses = 'activity ' . $mod->mod... | php | public function course_section_cm_list_item($course, &$completioninfo, cm_info $mod, $sectionreturn, $displayoptions = array()) {
$output = '';
if ($modulehtml = $this->course_section_cm($course, $completioninfo, $mod, $sectionreturn, $displayoptions)) {
$modclasses = 'activity ' . $mod->mod... | [
"public",
"function",
"course_section_cm_list_item",
"(",
"$",
"course",
",",
"&",
"$",
"completioninfo",
",",
"cm_info",
"$",
"mod",
",",
"$",
"sectionreturn",
",",
"$",
"displayoptions",
"=",
"array",
"(",
")",
")",
"{",
"$",
"output",
"=",
"''",
";",
... | Renders HTML to display one course module for display within a section.
This function calls:
{@link core_course_renderer::course_section_cm()}
@param stdClass $course
@param completion_info $completioninfo
@param cm_info $mod
@param int|null $sectionreturn
@param array $displayoptions
@return String | [
"Renders",
"HTML",
"to",
"display",
"one",
"course",
"module",
"for",
"display",
"within",
"a",
"section",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L798-L805 |
219,756 | moodle/moodle | course/renderer.php | core_course_renderer.course_section_cm | public function course_section_cm($course, &$completioninfo, cm_info $mod, $sectionreturn, $displayoptions = array()) {
$output = '';
// We return empty string (because course module will not be displayed at all)
// if:
// 1) The activity is not visible to users
// and
//... | php | public function course_section_cm($course, &$completioninfo, cm_info $mod, $sectionreturn, $displayoptions = array()) {
$output = '';
// We return empty string (because course module will not be displayed at all)
// if:
// 1) The activity is not visible to users
// and
//... | [
"public",
"function",
"course_section_cm",
"(",
"$",
"course",
",",
"&",
"$",
"completioninfo",
",",
"cm_info",
"$",
"mod",
",",
"$",
"sectionreturn",
",",
"$",
"displayoptions",
"=",
"array",
"(",
")",
")",
"{",
"$",
"output",
"=",
"''",
";",
"// We ret... | Renders HTML to display one course module in a course section
This includes link, content, availability, completion info and additional information
that module type wants to display (i.e. number of unread forum posts)
This function calls:
{@link core_course_renderer::course_section_cm_name()}
{@link core_course_rende... | [
"Renders",
"HTML",
"to",
"display",
"one",
"course",
"module",
"in",
"a",
"course",
"section"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L828-L920 |
219,757 | moodle/moodle | course/renderer.php | core_course_renderer.course_section_cm_unavailable_error_message | public function course_section_cm_unavailable_error_message(cm_info $cm) {
if ($cm->uservisible) {
return null;
}
if (!$cm->availableinfo) {
return get_string('activityiscurrentlyhidden');
}
$altname = get_accesshide(' ' . $cm->modfullname);
$name... | php | public function course_section_cm_unavailable_error_message(cm_info $cm) {
if ($cm->uservisible) {
return null;
}
if (!$cm->availableinfo) {
return get_string('activityiscurrentlyhidden');
}
$altname = get_accesshide(' ' . $cm->modfullname);
$name... | [
"public",
"function",
"course_section_cm_unavailable_error_message",
"(",
"cm_info",
"$",
"cm",
")",
"{",
"if",
"(",
"$",
"cm",
"->",
"uservisible",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"$",
"cm",
"->",
"availableinfo",
")",
"{",
"return",... | Message displayed to the user when they try to access unavailable activity following URL
This method is a very simplified version of {@link course_section_cm()} to be part of the error
notification only. It also does not check if module is visible on course page or not.
The message will be displayed inside notificati... | [
"Message",
"displayed",
"to",
"the",
"user",
"when",
"they",
"try",
"to",
"access",
"unavailable",
"activity",
"following",
"URL"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L933-L948 |
219,758 | moodle/moodle | course/renderer.php | core_course_renderer.course_section_cm_list | public function course_section_cm_list($course, $section, $sectionreturn = null, $displayoptions = array()) {
global $USER;
$output = '';
$modinfo = get_fast_modinfo($course);
if (is_object($section)) {
$section = $modinfo->get_section_info($section->section);
} else... | php | public function course_section_cm_list($course, $section, $sectionreturn = null, $displayoptions = array()) {
global $USER;
$output = '';
$modinfo = get_fast_modinfo($course);
if (is_object($section)) {
$section = $modinfo->get_section_info($section->section);
} else... | [
"public",
"function",
"course_section_cm_list",
"(",
"$",
"course",
",",
"$",
"section",
",",
"$",
"sectionreturn",
"=",
"null",
",",
"$",
"displayoptions",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"output",
"=",
"''",
";",
"$... | Renders HTML to display a list of course modules in a course section
Also displays "move here" controls in Javascript-disabled mode
This function calls {@link core_course_renderer::course_section_cm()}
@param stdClass $course course object
@param int|stdClass|section_info $section relative section number or section o... | [
"Renders",
"HTML",
"to",
"display",
"a",
"list",
"of",
"course",
"modules",
"in",
"a",
"course",
"section",
"Also",
"displays",
"move",
"here",
"controls",
"in",
"Javascript",
"-",
"disabled",
"mode"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L962-L1024 |
219,759 | moodle/moodle | course/renderer.php | core_course_renderer.courses_list | public function courses_list($courses, $showcategoryname = false, $additionalclasses = null, $paginationurl = null, $totalcount = null, $page = 0, $perpage = null) {
global $CFG;
// create instance of coursecat_helper to pass display options to function rendering courses list
$chelper = new cour... | php | public function courses_list($courses, $showcategoryname = false, $additionalclasses = null, $paginationurl = null, $totalcount = null, $page = 0, $perpage = null) {
global $CFG;
// create instance of coursecat_helper to pass display options to function rendering courses list
$chelper = new cour... | [
"public",
"function",
"courses_list",
"(",
"$",
"courses",
",",
"$",
"showcategoryname",
"=",
"false",
",",
"$",
"additionalclasses",
"=",
"null",
",",
"$",
"paginationurl",
"=",
"null",
",",
"$",
"totalcount",
"=",
"null",
",",
"$",
"page",
"=",
"0",
",... | Displays a custom list of courses with paging bar if necessary
If $paginationurl is specified but $totalcount is not, the link 'View more'
appears under the list.
If both $paginationurl and $totalcount are specified, and $totalcount is
bigger than count($courses), a paging bar is displayed above and under the
courses... | [
"Displays",
"a",
"custom",
"list",
"of",
"courses",
"with",
"paging",
"bar",
"if",
"necessary"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L1045-L1072 |
219,760 | moodle/moodle | course/renderer.php | core_course_renderer.coursecat_category_content | protected function coursecat_category_content(coursecat_helper $chelper, $coursecat, $depth) {
$content = '';
// Subcategories
$content .= $this->coursecat_subcategories($chelper, $coursecat, $depth);
// AUTO show courses: Courses will be shown expanded if this is not nested category,
... | php | protected function coursecat_category_content(coursecat_helper $chelper, $coursecat, $depth) {
$content = '';
// Subcategories
$content .= $this->coursecat_subcategories($chelper, $coursecat, $depth);
// AUTO show courses: Courses will be shown expanded if this is not nested category,
... | [
"protected",
"function",
"coursecat_category_content",
"(",
"coursecat_helper",
"$",
"chelper",
",",
"$",
"coursecat",
",",
"$",
"depth",
")",
"{",
"$",
"content",
"=",
"''",
";",
"// Subcategories",
"$",
"content",
".=",
"$",
"this",
"->",
"coursecat_subcategor... | Returns HTML to display the subcategories and courses in the given category
This method is re-used by AJAX to expand content of not loaded category
@param coursecat_helper $chelper various display options
@param core_course_category $coursecat
@param int $depth depth of the category in the current tree
@return string | [
"Returns",
"HTML",
"to",
"display",
"the",
"subcategories",
"and",
"courses",
"in",
"the",
"given",
"category"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L1428-L1462 |
219,761 | moodle/moodle | course/renderer.php | core_course_renderer.coursecat_category | protected function coursecat_category(coursecat_helper $chelper, $coursecat, $depth) {
// open category tag
$classes = array('category');
if (empty($coursecat->visible)) {
$classes[] = 'dimmed_category';
}
if ($chelper->get_subcat_depth() > 0 && $depth >= $chelper->ge... | php | protected function coursecat_category(coursecat_helper $chelper, $coursecat, $depth) {
// open category tag
$classes = array('category');
if (empty($coursecat->visible)) {
$classes[] = 'dimmed_category';
}
if ($chelper->get_subcat_depth() > 0 && $depth >= $chelper->ge... | [
"protected",
"function",
"coursecat_category",
"(",
"coursecat_helper",
"$",
"chelper",
",",
"$",
"coursecat",
",",
"$",
"depth",
")",
"{",
"// open category tag",
"$",
"classes",
"=",
"array",
"(",
"'category'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"cour... | Returns HTML to display a course category as a part of a tree
This is an internal function, to display a particular category and all its contents
use {@link core_course_renderer::course_category()}
@param coursecat_helper $chelper various display options
@param core_course_category $coursecat
@param int $depth depth ... | [
"Returns",
"HTML",
"to",
"display",
"a",
"course",
"category",
"as",
"a",
"part",
"of",
"a",
"tree"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L1475-L1534 |
219,762 | moodle/moodle | course/renderer.php | core_course_renderer.coursecat_tree | protected function coursecat_tree(coursecat_helper $chelper, $coursecat) {
// Reset the category expanded flag for this course category tree first.
$this->categoryexpandedonload = false;
$categorycontent = $this->coursecat_category_content($chelper, $coursecat, 0);
if (empty($categorycon... | php | protected function coursecat_tree(coursecat_helper $chelper, $coursecat) {
// Reset the category expanded flag for this course category tree first.
$this->categoryexpandedonload = false;
$categorycontent = $this->coursecat_category_content($chelper, $coursecat, 0);
if (empty($categorycon... | [
"protected",
"function",
"coursecat_tree",
"(",
"coursecat_helper",
"$",
"chelper",
",",
"$",
"coursecat",
")",
"{",
"// Reset the category expanded flag for this course category tree first.",
"$",
"this",
"->",
"categoryexpandedonload",
"=",
"false",
";",
"$",
"categorycon... | Returns HTML to display a tree of subcategories and courses in the given category
@param coursecat_helper $chelper various display options
@param core_course_category $coursecat top category (this category's name and description will NOT be added to the tree)
@return string | [
"Returns",
"HTML",
"to",
"display",
"a",
"tree",
"of",
"subcategories",
"and",
"courses",
"in",
"the",
"given",
"category"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L1543-L1581 |
219,763 | moodle/moodle | course/renderer.php | core_course_renderer.search_courses | public function search_courses($searchcriteria) {
global $CFG;
$content = '';
if (!empty($searchcriteria)) {
// print search results
$displayoptions = array('sort' => array('displayname' => 1));
// take the current page and number of results per page from que... | php | public function search_courses($searchcriteria) {
global $CFG;
$content = '';
if (!empty($searchcriteria)) {
// print search results
$displayoptions = array('sort' => array('displayname' => 1));
// take the current page and number of results per page from que... | [
"public",
"function",
"search_courses",
"(",
"$",
"searchcriteria",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"content",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"searchcriteria",
")",
")",
"{",
"// print search results",
"$",
"displayoptions",
"... | Renders html to display search result page
@param array $searchcriteria may contain elements: search, blocklist, modulelist, tagid
@return string | [
"Renders",
"html",
"to",
"display",
"search",
"result",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L1762-L1820 |
219,764 | moodle/moodle | course/renderer.php | core_course_renderer.tagged_courses | public function tagged_courses($tagid, $exclusivemode = true, $ctx = 0, $rec = true, $displayoptions = null) {
global $CFG;
if (empty($displayoptions)) {
$displayoptions = array();
}
$showcategories = !core_course_category::is_simple_site();
$displayoptions += array('... | php | public function tagged_courses($tagid, $exclusivemode = true, $ctx = 0, $rec = true, $displayoptions = null) {
global $CFG;
if (empty($displayoptions)) {
$displayoptions = array();
}
$showcategories = !core_course_category::is_simple_site();
$displayoptions += array('... | [
"public",
"function",
"tagged_courses",
"(",
"$",
"tagid",
",",
"$",
"exclusivemode",
"=",
"true",
",",
"$",
"ctx",
"=",
"0",
",",
"$",
"rec",
"=",
"true",
",",
"$",
"displayoptions",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"em... | Renders html to print list of courses tagged with particular tag
@param int $tagid id of the tag
@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
@param int $fromctx context id where the link was displayed, may... | [
"Renders",
"html",
"to",
"print",
"list",
"of",
"courses",
"tagged",
"with",
"particular",
"tag"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L1835-L1873 |
219,765 | moodle/moodle | course/renderer.php | core_course_renderer.frontpage_remote_course | protected function frontpage_remote_course(stdClass $course) {
$url = new moodle_url('/auth/mnet/jump.php', array(
'hostid' => $course->hostid,
'wantsurl' => '/course/view.php?id='. $course->remoteid
));
$output = '';
$output .= html_writer::start_tag('div', arra... | php | protected function frontpage_remote_course(stdClass $course) {
$url = new moodle_url('/auth/mnet/jump.php', array(
'hostid' => $course->hostid,
'wantsurl' => '/course/view.php?id='. $course->remoteid
));
$output = '';
$output .= html_writer::start_tag('div', arra... | [
"protected",
"function",
"frontpage_remote_course",
"(",
"stdClass",
"$",
"course",
")",
"{",
"$",
"url",
"=",
"new",
"moodle_url",
"(",
"'/auth/mnet/jump.php'",
",",
"array",
"(",
"'hostid'",
"=>",
"$",
"course",
"->",
"hostid",
",",
"'wantsurl'",
"=>",
"'/co... | Returns HTML to display one remote course
@param stdClass $course remote course information, contains properties:
id, remoteid, shortname, fullname, hostid, summary, summaryformat, cat_name, hostname
@return string | [
"Returns",
"HTML",
"to",
"display",
"one",
"remote",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L1882-L1911 |
219,766 | moodle/moodle | course/renderer.php | core_course_renderer.frontpage_remote_host | protected function frontpage_remote_host($host) {
$output = '';
$output .= html_writer::start_tag('div', array('class' => 'coursebox remotehost clearfix'));
$output .= html_writer::start_tag('div', array('class' => 'info'));
$output .= html_writer::start_tag('h3', array('class' => 'name'... | php | protected function frontpage_remote_host($host) {
$output = '';
$output .= html_writer::start_tag('div', array('class' => 'coursebox remotehost clearfix'));
$output .= html_writer::start_tag('div', array('class' => 'info'));
$output .= html_writer::start_tag('h3', array('class' => 'name'... | [
"protected",
"function",
"frontpage_remote_host",
"(",
"$",
"host",
")",
"{",
"$",
"output",
"=",
"''",
";",
"$",
"output",
".=",
"html_writer",
"::",
"start_tag",
"(",
"'div'",
",",
"array",
"(",
"'class'",
"=>",
"'coursebox remotehost clearfix'",
")",
")",
... | Returns HTML to display one remote host
@param array $host host information, contains properties: name, url, count
@return string | [
"Returns",
"HTML",
"to",
"display",
"one",
"remote",
"host"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L1919-L1934 |
219,767 | moodle/moodle | course/renderer.php | core_course_renderer.frontpage_my_courses | public function frontpage_my_courses() {
global $USER, $CFG, $DB;
if (!isloggedin() or isguestuser()) {
return '';
}
$output = '';
$courses = enrol_get_my_courses('summary, summaryformat');
$rhosts = array();
$rcourses = array();
if (!empt... | php | public function frontpage_my_courses() {
global $USER, $CFG, $DB;
if (!isloggedin() or isguestuser()) {
return '';
}
$output = '';
$courses = enrol_get_my_courses('summary, summaryformat');
$rhosts = array();
$rcourses = array();
if (!empt... | [
"public",
"function",
"frontpage_my_courses",
"(",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"CFG",
",",
"$",
"DB",
";",
"if",
"(",
"!",
"isloggedin",
"(",
")",
"or",
"isguestuser",
"(",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"output",
"=",... | Returns HTML to print list of courses user is enrolled to for the frontpage
Also lists remote courses or remote hosts if MNET authorisation is used
@return string | [
"Returns",
"HTML",
"to",
"print",
"list",
"of",
"courses",
"user",
"is",
"enrolled",
"to",
"for",
"the",
"frontpage"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L1943-L2000 |
219,768 | moodle/moodle | course/renderer.php | core_course_renderer.frontpage_available_courses | public function frontpage_available_courses() {
global $CFG;
$chelper = new coursecat_helper();
$chelper->set_show_courses(self::COURSECAT_SHOW_COURSES_EXPANDED)->
set_courses_display_options(array(
'recursive' => true,
'limit' => $CFG->fr... | php | public function frontpage_available_courses() {
global $CFG;
$chelper = new coursecat_helper();
$chelper->set_show_courses(self::COURSECAT_SHOW_COURSES_EXPANDED)->
set_courses_display_options(array(
'recursive' => true,
'limit' => $CFG->fr... | [
"public",
"function",
"frontpage_available_courses",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"chelper",
"=",
"new",
"coursecat_helper",
"(",
")",
";",
"$",
"chelper",
"->",
"set_show_courses",
"(",
"self",
"::",
"COURSECAT_SHOW_COURSES_EXPANDED",
")",
"->... | Returns HTML to print list of available courses for the frontpage
@return string | [
"Returns",
"HTML",
"to",
"print",
"list",
"of",
"available",
"courses",
"for",
"the",
"frontpage"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2007-L2026 |
219,769 | moodle/moodle | course/renderer.php | core_course_renderer.add_new_course_button | public function add_new_course_button() {
global $CFG;
// Print link to create a new course, for the 1st available category.
$output = $this->container_start('buttons');
$url = new moodle_url('/course/edit.php', array('category' => $CFG->defaultrequestcategory, 'returnto' => 'topcat'));
... | php | public function add_new_course_button() {
global $CFG;
// Print link to create a new course, for the 1st available category.
$output = $this->container_start('buttons');
$url = new moodle_url('/course/edit.php', array('category' => $CFG->defaultrequestcategory, 'returnto' => 'topcat'));
... | [
"public",
"function",
"add_new_course_button",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// Print link to create a new course, for the 1st available category.",
"$",
"output",
"=",
"$",
"this",
"->",
"container_start",
"(",
"'buttons'",
")",
";",
"$",
"url",
"=",
"... | Returns HTML to the "add new course" button for the page
@return string | [
"Returns",
"HTML",
"to",
"the",
"add",
"new",
"course",
"button",
"for",
"the",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2033-L2041 |
219,770 | moodle/moodle | course/renderer.php | core_course_renderer.frontpage_combo_list | public function frontpage_combo_list() {
global $CFG;
// TODO MDL-10965 improve.
$tree = core_course_category::top();
if (!$tree->get_children_count()) {
return '';
}
$chelper = new coursecat_helper();
$chelper->set_subcat_depth($CFG->maxcategorydepth)... | php | public function frontpage_combo_list() {
global $CFG;
// TODO MDL-10965 improve.
$tree = core_course_category::top();
if (!$tree->get_children_count()) {
return '';
}
$chelper = new coursecat_helper();
$chelper->set_subcat_depth($CFG->maxcategorydepth)... | [
"public",
"function",
"frontpage_combo_list",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// TODO MDL-10965 improve.",
"$",
"tree",
"=",
"core_course_category",
"::",
"top",
"(",
")",
";",
"if",
"(",
"!",
"$",
"tree",
"->",
"get_children_count",
"(",
")",
")"... | Returns HTML to print tree with course categories and courses for the frontpage
@return string | [
"Returns",
"HTML",
"to",
"print",
"tree",
"with",
"course",
"categories",
"and",
"courses",
"for",
"the",
"frontpage"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2048-L2069 |
219,771 | moodle/moodle | course/renderer.php | core_course_renderer.render_activity_navigation | public function render_activity_navigation(\core_course\output\activity_navigation $page) {
$data = $page->export_for_template($this->output);
return $this->output->render_from_template('core_course/activity_navigation', $data);
} | php | public function render_activity_navigation(\core_course\output\activity_navigation $page) {
$data = $page->export_for_template($this->output);
return $this->output->render_from_template('core_course/activity_navigation', $data);
} | [
"public",
"function",
"render_activity_navigation",
"(",
"\\",
"core_course",
"\\",
"output",
"\\",
"activity_navigation",
"$",
"page",
")",
"{",
"$",
"data",
"=",
"$",
"page",
"->",
"export_for_template",
"(",
"$",
"this",
"->",
"output",
")",
";",
"return",
... | Renders the activity navigation.
Defer to template.
@param \core_course\output\activity_navigation $page
@return string html for the page | [
"Renders",
"the",
"activity",
"navigation",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2103-L2106 |
219,772 | moodle/moodle | course/renderer.php | core_course_renderer.publicationselector | public function publicationselector($courseid) {
$text = '';
$advertiseurl = new moodle_url("/course/publish/metadata.php",
array('sesskey' => sesskey(), 'id' => $courseid, 'advertise' => true));
$advertisebutton = new single_button($advertiseurl, get_string('advertise', 'hub'));
... | php | public function publicationselector($courseid) {
$text = '';
$advertiseurl = new moodle_url("/course/publish/metadata.php",
array('sesskey' => sesskey(), 'id' => $courseid, 'advertise' => true));
$advertisebutton = new single_button($advertiseurl, get_string('advertise', 'hub'));
... | [
"public",
"function",
"publicationselector",
"(",
"$",
"courseid",
")",
"{",
"$",
"text",
"=",
"''",
";",
"$",
"advertiseurl",
"=",
"new",
"moodle_url",
"(",
"\"/course/publish/metadata.php\"",
",",
"array",
"(",
"'sesskey'",
"=>",
"sesskey",
"(",
")",
",",
... | Display the selector to advertise or publish a course
@param int $courseid | [
"Display",
"the",
"selector",
"to",
"advertise",
"or",
"publish",
"a",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2112-L2132 |
219,773 | moodle/moodle | course/renderer.php | core_course_renderer.confirmunpublishing | public function confirmunpublishing($publication) {
$optionsyes = array('sesskey' => sesskey(), 'id' => $publication->courseid,
'hubcourseid' => $publication->hubcourseid,
'cancel' => true, 'publicationid' => $publication->id, 'confirm' => true);
$optionsno = array('sesskey' => s... | php | public function confirmunpublishing($publication) {
$optionsyes = array('sesskey' => sesskey(), 'id' => $publication->courseid,
'hubcourseid' => $publication->hubcourseid,
'cancel' => true, 'publicationid' => $publication->id, 'confirm' => true);
$optionsno = array('sesskey' => s... | [
"public",
"function",
"confirmunpublishing",
"(",
"$",
"publication",
")",
"{",
"$",
"optionsyes",
"=",
"array",
"(",
"'sesskey'",
"=>",
"sesskey",
"(",
")",
",",
"'id'",
"=>",
"$",
"publication",
"->",
"courseid",
",",
"'hubcourseid'",
"=>",
"$",
"publicati... | Display unpublishing confirmation page
@param stdClass $publication
$publication->courseshortname
$publication->courseid
$publication->hubname
$publication->huburl
$publication->id | [
"Display",
"unpublishing",
"confirmation",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2215-L2228 |
219,774 | moodle/moodle | course/renderer.php | core_course_renderer.sendingbackupinfo | public function sendingbackupinfo($backupfile) {
$sizeinfo = new stdClass();
$sizeinfo->total = number_format($backupfile->get_filesize() / 1000000, 2);
$html = html_writer::tag('div', get_string('sendingsize', 'hub', $sizeinfo),
array('class' => 'courseuploadtextinfo'));
ret... | php | public function sendingbackupinfo($backupfile) {
$sizeinfo = new stdClass();
$sizeinfo->total = number_format($backupfile->get_filesize() / 1000000, 2);
$html = html_writer::tag('div', get_string('sendingsize', 'hub', $sizeinfo),
array('class' => 'courseuploadtextinfo'));
ret... | [
"public",
"function",
"sendingbackupinfo",
"(",
"$",
"backupfile",
")",
"{",
"$",
"sizeinfo",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"sizeinfo",
"->",
"total",
"=",
"number_format",
"(",
"$",
"backupfile",
"->",
"get_filesize",
"(",
")",
"/",
"1000000... | Display waiting information about backup size during uploading backup process
@param object $backupfile the backup stored_file
@return $html string | [
"Display",
"waiting",
"information",
"about",
"backup",
"size",
"during",
"uploading",
"backup",
"process"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2235-L2241 |
219,775 | moodle/moodle | course/renderer.php | core_course_renderer.sentbackupinfo | public function sentbackupinfo($id) {
$html = html_writer::tag('div', get_string('sent', 'hub'),
array('class' => 'courseuploadtextinfo'));
$publishindexurl = new moodle_url('/course/publish/index.php',
array('sesskey' => sesskey(), 'id' => $id,
'published' => tru... | php | public function sentbackupinfo($id) {
$html = html_writer::tag('div', get_string('sent', 'hub'),
array('class' => 'courseuploadtextinfo'));
$publishindexurl = new moodle_url('/course/publish/index.php',
array('sesskey' => sesskey(), 'id' => $id,
'published' => tru... | [
"public",
"function",
"sentbackupinfo",
"(",
"$",
"id",
")",
"{",
"$",
"html",
"=",
"html_writer",
"::",
"tag",
"(",
"'div'",
",",
"get_string",
"(",
"'sent'",
",",
"'hub'",
")",
",",
"array",
"(",
"'class'",
"=>",
"'courseuploadtextinfo'",
")",
")",
";"... | Display upload successfull message and a button to the publish index page
@param int $id the course id
@return $html string | [
"Display",
"upload",
"successfull",
"message",
"and",
"a",
"button",
"to",
"the",
"publish",
"index",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2248-L2258 |
219,776 | moodle/moodle | course/renderer.php | coursecat_helper.set_courses_display_options | public function set_courses_display_options($options) {
$this->coursesdisplayoptions = $options;
$this->set_show_courses($this->showcourses); // this will calculate special display options
return $this;
} | php | public function set_courses_display_options($options) {
$this->coursesdisplayoptions = $options;
$this->set_show_courses($this->showcourses); // this will calculate special display options
return $this;
} | [
"public",
"function",
"set_courses_display_options",
"(",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"coursesdisplayoptions",
"=",
"$",
"options",
";",
"$",
"this",
"->",
"set_show_courses",
"(",
"$",
"this",
"->",
"showcourses",
")",
";",
"// this will calcul... | Sets options to display list of courses
Options are later submitted as argument to core_course_category::get_courses() and/or core_course_category::search_courses()
Options that core_course_category::get_courses() accept:
- recursive - return courses from subcategories as well. Use with care,
this may be a huge list!... | [
"Sets",
"options",
"to",
"display",
"list",
"of",
"courses"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2592-L2596 |
219,777 | moodle/moodle | course/renderer.php | coursecat_helper.get_courses_display_option | public function get_courses_display_option($optionname, $defaultvalue = null) {
if (array_key_exists($optionname, $this->coursesdisplayoptions)) {
return $this->coursesdisplayoptions[$optionname];
} else {
return $defaultvalue;
}
} | php | public function get_courses_display_option($optionname, $defaultvalue = null) {
if (array_key_exists($optionname, $this->coursesdisplayoptions)) {
return $this->coursesdisplayoptions[$optionname];
} else {
return $defaultvalue;
}
} | [
"public",
"function",
"get_courses_display_option",
"(",
"$",
"optionname",
",",
"$",
"defaultvalue",
"=",
"null",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"optionname",
",",
"$",
"this",
"->",
"coursesdisplayoptions",
")",
")",
"{",
"return",
"$",
... | Return the specified option to display list of courses
@param string $optionname option name
@param mixed $defaultvalue default value for option if it is not specified
@return mixed | [
"Return",
"the",
"specified",
"option",
"to",
"display",
"list",
"of",
"courses"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2619-L2625 |
219,778 | moodle/moodle | course/renderer.php | coursecat_helper.get_categories_display_option | public function get_categories_display_option($optionname, $defaultvalue = null) {
if (array_key_exists($optionname, $this->categoriesdisplayoptions)) {
return $this->categoriesdisplayoptions[$optionname];
} else {
return $defaultvalue;
}
} | php | public function get_categories_display_option($optionname, $defaultvalue = null) {
if (array_key_exists($optionname, $this->categoriesdisplayoptions)) {
return $this->categoriesdisplayoptions[$optionname];
} else {
return $defaultvalue;
}
} | [
"public",
"function",
"get_categories_display_option",
"(",
"$",
"optionname",
",",
"$",
"defaultvalue",
"=",
"null",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"optionname",
",",
"$",
"this",
"->",
"categoriesdisplayoptions",
")",
")",
"{",
"return",
... | Return the specified option to display list of subcategories
@param string $optionname option name
@param mixed $defaultvalue default value for option if it is not specified
@return mixed | [
"Return",
"the",
"specified",
"option",
"to",
"display",
"list",
"of",
"subcategories"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2660-L2666 |
219,779 | moodle/moodle | course/renderer.php | coursecat_helper.get_and_erase_attributes | public function get_and_erase_attributes($classname) {
$attributes = $this->attributes;
$this->attributes = array();
if (empty($attributes['class'])) {
$attributes['class'] = '';
}
$attributes['class'] = $classname . ' '. $attributes['class'];
return $attribut... | php | public function get_and_erase_attributes($classname) {
$attributes = $this->attributes;
$this->attributes = array();
if (empty($attributes['class'])) {
$attributes['class'] = '';
}
$attributes['class'] = $classname . ' '. $attributes['class'];
return $attribut... | [
"public",
"function",
"get_and_erase_attributes",
"(",
"$",
"classname",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"attributes",
";",
"$",
"this",
"->",
"attributes",
"=",
"array",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"attributes",
"["... | Return all attributes and erases them so they are not applied again
@param string $classname adds additional class name to the beginning of $attributes['class']
@return array | [
"Return",
"all",
"attributes",
"and",
"erases",
"them",
"so",
"they",
"are",
"not",
"applied",
"again"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2696-L2704 |
219,780 | moodle/moodle | course/renderer.php | coursecat_helper.get_category_formatted_description | public function get_category_formatted_description($coursecat, $options = null) {
if ($coursecat->id && $coursecat->is_uservisible() && !empty($coursecat->description)) {
if (!isset($coursecat->descriptionformat)) {
$descriptionformat = FORMAT_MOODLE;
} else {
... | php | public function get_category_formatted_description($coursecat, $options = null) {
if ($coursecat->id && $coursecat->is_uservisible() && !empty($coursecat->description)) {
if (!isset($coursecat->descriptionformat)) {
$descriptionformat = FORMAT_MOODLE;
} else {
... | [
"public",
"function",
"get_category_formatted_description",
"(",
"$",
"coursecat",
",",
"$",
"options",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"coursecat",
"->",
"id",
"&&",
"$",
"coursecat",
"->",
"is_uservisible",
"(",
")",
"&&",
"!",
"empty",
"(",
"$",
... | Returns formatted and filtered description of the given category
@param core_course_category $coursecat category
@param stdClass|array $options format options, by default [noclean,overflowdiv],
if context is not specified it will be added automatically
@return string|null | [
"Returns",
"formatted",
"and",
"filtered",
"description",
"of",
"the",
"given",
"category"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2727-L2748 |
219,781 | moodle/moodle | course/renderer.php | coursecat_helper.get_course_formatted_summary | public function get_course_formatted_summary($course, $options = array()) {
global $CFG;
require_once($CFG->libdir. '/filelib.php');
if (!$course->has_summary()) {
return '';
}
$options = (array)$options;
$context = context_course::instance($course->id);
... | php | public function get_course_formatted_summary($course, $options = array()) {
global $CFG;
require_once($CFG->libdir. '/filelib.php');
if (!$course->has_summary()) {
return '';
}
$options = (array)$options;
$context = context_course::instance($course->id);
... | [
"public",
"function",
"get_course_formatted_summary",
"(",
"$",
"course",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/filelib.php'",
")",
";",
"if",
"(",
"!",
... | Returns given course's summary with proper embedded files urls and formatted
@param core_course_list_element $course
@param array|stdClass $options additional formatting options
@return string | [
"Returns",
"given",
"course",
"s",
"summary",
"with",
"proper",
"embedded",
"files",
"urls",
"and",
"formatted"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2757-L2781 |
219,782 | moodle/moodle | course/renderer.php | coursecat_helper.get_course_formatted_name | public function get_course_formatted_name($course, $options = array()) {
$options = (array)$options;
if (!isset($options['context'])) {
$options['context'] = context_course::instance($course->id);
}
$name = format_string(get_course_display_name_for_list($course), true, $optio... | php | public function get_course_formatted_name($course, $options = array()) {
$options = (array)$options;
if (!isset($options['context'])) {
$options['context'] = context_course::instance($course->id);
}
$name = format_string(get_course_display_name_for_list($course), true, $optio... | [
"public",
"function",
"get_course_formatted_name",
"(",
"$",
"course",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"=",
"(",
"array",
")",
"$",
"options",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'context'",
... | Returns course name as it is configured to appear in courses lists formatted to course context
@param core_course_list_element $course
@param array|stdClass $options additional formatting options
@return string | [
"Returns",
"course",
"name",
"as",
"it",
"is",
"configured",
"to",
"appear",
"in",
"courses",
"lists",
"formatted",
"to",
"course",
"context"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/renderer.php#L2790-L2800 |
219,783 | moodle/moodle | lib/outputcomponents.php | user_picture.fields | public static function fields($tableprefix = '', array $extrafields = NULL, $idalias = 'id', $fieldprefix = '') {
if (!$tableprefix and !$extrafields and !$idalias) {
return implode(',', self::$fields);
}
if ($tableprefix) {
$tableprefix .= '.';
}
foreach ... | php | public static function fields($tableprefix = '', array $extrafields = NULL, $idalias = 'id', $fieldprefix = '') {
if (!$tableprefix and !$extrafields and !$idalias) {
return implode(',', self::$fields);
}
if ($tableprefix) {
$tableprefix .= '.';
}
foreach ... | [
"public",
"static",
"function",
"fields",
"(",
"$",
"tableprefix",
"=",
"''",
",",
"array",
"$",
"extrafields",
"=",
"NULL",
",",
"$",
"idalias",
"=",
"'id'",
",",
"$",
"fieldprefix",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"tableprefix",
"and",
"!... | Returns a list of required user fields, useful when fetching required user info from db.
In some cases we have to fetch the user data together with some other information,
the idalias is useful there because the id would otherwise override the main
id of the result record. Please note it has to be converted back to id... | [
"Returns",
"a",
"list",
"of",
"required",
"user",
"fields",
"useful",
"when",
"fetching",
"required",
"user",
"info",
"from",
"db",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L259-L291 |
219,784 | moodle/moodle | lib/outputcomponents.php | user_picture.unalias | public static function unalias(stdClass $record, array $extrafields = null, $idalias = 'id', $fieldprefix = '') {
if (empty($idalias)) {
$idalias = 'id';
}
$return = new stdClass();
foreach (self::$fields as $field) {
if ($field === 'id') {
if (... | php | public static function unalias(stdClass $record, array $extrafields = null, $idalias = 'id', $fieldprefix = '') {
if (empty($idalias)) {
$idalias = 'id';
}
$return = new stdClass();
foreach (self::$fields as $field) {
if ($field === 'id') {
if (... | [
"public",
"static",
"function",
"unalias",
"(",
"stdClass",
"$",
"record",
",",
"array",
"$",
"extrafields",
"=",
"null",
",",
"$",
"idalias",
"=",
"'id'",
",",
"$",
"fieldprefix",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"idalias",
")",
")... | Extract the aliased user fields from a given record
Given a record that was previously obtained using {@link self::fields()} with aliases,
this method extracts user related unaliased fields.
@param stdClass $record containing user picture fields
@param array $extrafields extra fields included in the $record
@param st... | [
"Extract",
"the",
"aliased",
"user",
"fields",
"from",
"a",
"given",
"record"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L305-L335 |
219,785 | moodle/moodle | lib/outputcomponents.php | help_icon.diag_strings | public function diag_strings() {
$sm = get_string_manager();
if (!$sm->string_exists($this->identifier, $this->component)) {
debugging("Help title string does not exist: [$this->identifier, $this->component]");
}
if (!$sm->string_exists($this->identifier.'_help', $this->compo... | php | public function diag_strings() {
$sm = get_string_manager();
if (!$sm->string_exists($this->identifier, $this->component)) {
debugging("Help title string does not exist: [$this->identifier, $this->component]");
}
if (!$sm->string_exists($this->identifier.'_help', $this->compo... | [
"public",
"function",
"diag_strings",
"(",
")",
"{",
"$",
"sm",
"=",
"get_string_manager",
"(",
")",
";",
"if",
"(",
"!",
"$",
"sm",
"->",
"string_exists",
"(",
"$",
"this",
"->",
"identifier",
",",
"$",
"this",
"->",
"component",
")",
")",
"{",
"deb... | Verifies that both help strings exists, shows debug warnings if not | [
"Verifies",
"that",
"both",
"help",
"strings",
"exists",
"shows",
"debug",
"warnings",
"if",
"not"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L496-L504 |
219,786 | moodle/moodle | lib/outputcomponents.php | pix_icon.export_for_pix | public function export_for_pix() {
$title = isset($this->attributes['title']) ? $this->attributes['title'] : '';
if (empty($title)) {
$title = isset($this->attributes['alt']) ? $this->attributes['alt'] : '';
}
return [
'key' => $this->pix,
'component' ... | php | public function export_for_pix() {
$title = isset($this->attributes['title']) ? $this->attributes['title'] : '';
if (empty($title)) {
$title = isset($this->attributes['alt']) ? $this->attributes['alt'] : '';
}
return [
'key' => $this->pix,
'component' ... | [
"public",
"function",
"export_for_pix",
"(",
")",
"{",
"$",
"title",
"=",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"'title'",
"]",
")",
"?",
"$",
"this",
"->",
"attributes",
"[",
"'title'",
"]",
":",
"''",
";",
"if",
"(",
"empty",
"(",
"... | Much simpler version of export that will produce the data required to render this pix with the
pix helper in a mustache tag.
@return array | [
"Much",
"simpler",
"version",
"of",
"export",
"that",
"will",
"produce",
"the",
"data",
"required",
"to",
"render",
"this",
"pix",
"with",
"the",
"pix",
"helper",
"in",
"a",
"mustache",
"tag",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L753-L763 |
219,787 | moodle/moodle | lib/outputcomponents.php | url_select.clean_url | protected function clean_url($value) {
global $CFG;
if (empty($value)) {
// Nothing.
} else if (strpos($value, $CFG->wwwroot . '/') === 0) {
$value = str_replace($CFG->wwwroot, '', $value);
} else if (strpos($value, '/') !== 0) {
debugging("Invalid ... | php | protected function clean_url($value) {
global $CFG;
if (empty($value)) {
// Nothing.
} else if (strpos($value, $CFG->wwwroot . '/') === 0) {
$value = str_replace($CFG->wwwroot, '', $value);
} else if (strpos($value, '/') !== 0) {
debugging("Invalid ... | [
"protected",
"function",
"clean_url",
"(",
"$",
"value",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"// Nothing.",
"}",
"else",
"if",
"(",
"strpos",
"(",
"$",
"value",
",",
"$",
"CFG",
"->",
"wwwroot"... | Clean a URL.
@param string $value The URL.
@return The cleaned URL. | [
"Clean",
"a",
"URL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1341-L1355 |
219,788 | moodle/moodle | lib/outputcomponents.php | url_select.flatten_options | protected function flatten_options($options, $nothing) {
$flattened = [];
foreach ($options as $value => $option) {
if (is_array($option)) {
foreach ($option as $groupname => $optoptions) {
if (!isset($flattened[$groupname])) {
$fl... | php | protected function flatten_options($options, $nothing) {
$flattened = [];
foreach ($options as $value => $option) {
if (is_array($option)) {
foreach ($option as $groupname => $optoptions) {
if (!isset($flattened[$groupname])) {
$fl... | [
"protected",
"function",
"flatten_options",
"(",
"$",
"options",
",",
"$",
"nothing",
")",
"{",
"$",
"flattened",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"value",
"=>",
"$",
"option",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
... | Flatten the options for Mustache.
This also cleans the URLs.
@param array $options The options.
@param array $nothing The nothing option.
@return array | [
"Flatten",
"the",
"options",
"for",
"Mustache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1366-L1416 |
219,789 | moodle/moodle | lib/outputcomponents.php | html_writer.tag | public static function tag($tagname, $contents, array $attributes = null) {
return self::start_tag($tagname, $attributes) . $contents . self::end_tag($tagname);
} | php | public static function tag($tagname, $contents, array $attributes = null) {
return self::start_tag($tagname, $attributes) . $contents . self::end_tag($tagname);
} | [
"public",
"static",
"function",
"tag",
"(",
"$",
"tagname",
",",
"$",
"contents",
",",
"array",
"$",
"attributes",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"start_tag",
"(",
"$",
"tagname",
",",
"$",
"attributes",
")",
".",
"$",
"contents",
".",
... | Outputs a tag with attributes and contents
@param string $tagname The name of tag ('a', 'img', 'span' etc.)
@param string $contents What goes between the opening and closing tags
@param array $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.)
@return string HTML fragment | [
"Outputs",
"a",
"tag",
"with",
"attributes",
"and",
"contents"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1642-L1644 |
219,790 | moodle/moodle | lib/outputcomponents.php | html_writer.nonempty_tag | public static function nonempty_tag($tagname, $contents, array $attributes = null) {
if ($contents === '' || is_null($contents)) {
return '';
}
return self::tag($tagname, $contents, $attributes);
} | php | public static function nonempty_tag($tagname, $contents, array $attributes = null) {
if ($contents === '' || is_null($contents)) {
return '';
}
return self::tag($tagname, $contents, $attributes);
} | [
"public",
"static",
"function",
"nonempty_tag",
"(",
"$",
"tagname",
",",
"$",
"contents",
",",
"array",
"$",
"attributes",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"contents",
"===",
"''",
"||",
"is_null",
"(",
"$",
"contents",
")",
")",
"{",
"return",
... | Outputs a tag, but only if the contents are not empty
@param string $tagname The name of tag ('a', 'img', 'span' etc.)
@param string $contents What goes between the opening and closing tags
@param array $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.)
@return string HTML fragment | [
"Outputs",
"a",
"tag",
"but",
"only",
"if",
"the",
"contents",
"are",
"not",
"empty"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1686-L1691 |
219,791 | moodle/moodle | lib/outputcomponents.php | html_writer.attribute | public static function attribute($name, $value) {
if ($value instanceof moodle_url) {
return ' ' . $name . '="' . $value->out() . '"';
}
// special case, we do not want these in output
if ($value === null) {
return '';
}
// no sloppy trimming her... | php | public static function attribute($name, $value) {
if ($value instanceof moodle_url) {
return ' ' . $name . '="' . $value->out() . '"';
}
// special case, we do not want these in output
if ($value === null) {
return '';
}
// no sloppy trimming her... | [
"public",
"static",
"function",
"attribute",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"moodle_url",
")",
"{",
"return",
"' '",
".",
"$",
"name",
".",
"'=\"'",
".",
"$",
"value",
"->",
"out",
"(",
")",
".... | Outputs a HTML attribute and value
@param string $name The name of the attribute ('src', 'href', 'class' etc.)
@param string $value The value of the attribute. The value will be escaped with {@link s()}
@return string HTML fragment | [
"Outputs",
"a",
"HTML",
"attribute",
"and",
"value"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1700-L1712 |
219,792 | moodle/moodle | lib/outputcomponents.php | html_writer.attributes | public static function attributes(array $attributes = null) {
$attributes = (array)$attributes;
$output = '';
foreach ($attributes as $name => $value) {
$output .= self::attribute($name, $value);
}
return $output;
} | php | public static function attributes(array $attributes = null) {
$attributes = (array)$attributes;
$output = '';
foreach ($attributes as $name => $value) {
$output .= self::attribute($name, $value);
}
return $output;
} | [
"public",
"static",
"function",
"attributes",
"(",
"array",
"$",
"attributes",
"=",
"null",
")",
"{",
"$",
"attributes",
"=",
"(",
"array",
")",
"$",
"attributes",
";",
"$",
"output",
"=",
"''",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"name"... | Outputs a list of HTML attributes and values
@param array $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.)
The values will be escaped with {@link s()}
@return string HTML fragment | [
"Outputs",
"a",
"list",
"of",
"HTML",
"attributes",
"and",
"values"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1721-L1728 |
219,793 | moodle/moodle | lib/outputcomponents.php | html_writer.img | public static function img($src, $alt, array $attributes = null) {
$attributes = (array)$attributes;
$attributes['src'] = $src;
$attributes['alt'] = $alt;
return self::empty_tag('img', $attributes);
} | php | public static function img($src, $alt, array $attributes = null) {
$attributes = (array)$attributes;
$attributes['src'] = $src;
$attributes['alt'] = $alt;
return self::empty_tag('img', $attributes);
} | [
"public",
"static",
"function",
"img",
"(",
"$",
"src",
",",
"$",
"alt",
",",
"array",
"$",
"attributes",
"=",
"null",
")",
"{",
"$",
"attributes",
"=",
"(",
"array",
")",
"$",
"attributes",
";",
"$",
"attributes",
"[",
"'src'",
"]",
"=",
"$",
"src... | Generates a simple image tag with attributes.
@param string $src The source of image
@param string $alt The alternate text for image
@param array $attributes The tag attributes (array('height' => $max_height, 'class' => 'class1') etc.)
@return string HTML fragment | [
"Generates",
"a",
"simple",
"image",
"tag",
"with",
"attributes",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1738-L1744 |
219,794 | moodle/moodle | lib/outputcomponents.php | html_writer.random_id | public static function random_id($base='random') {
static $counter = 0;
static $uniq;
if (!isset($uniq)) {
$uniq = uniqid();
}
$counter++;
return $base.$uniq.$counter;
} | php | public static function random_id($base='random') {
static $counter = 0;
static $uniq;
if (!isset($uniq)) {
$uniq = uniqid();
}
$counter++;
return $base.$uniq.$counter;
} | [
"public",
"static",
"function",
"random_id",
"(",
"$",
"base",
"=",
"'random'",
")",
"{",
"static",
"$",
"counter",
"=",
"0",
";",
"static",
"$",
"uniq",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"uniq",
")",
")",
"{",
"$",
"uniq",
"=",
"uniqid",
"... | Generates random html element id.
@staticvar int $counter
@staticvar type $uniq
@param string $base A string fragment that will be included in the random ID.
@return string A unique ID | [
"Generates",
"random",
"html",
"element",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1754-L1764 |
219,795 | moodle/moodle | lib/outputcomponents.php | html_writer.link | public static function link($url, $text, array $attributes = null) {
$attributes = (array)$attributes;
$attributes['href'] = $url;
return self::tag('a', $text, $attributes);
} | php | public static function link($url, $text, array $attributes = null) {
$attributes = (array)$attributes;
$attributes['href'] = $url;
return self::tag('a', $text, $attributes);
} | [
"public",
"static",
"function",
"link",
"(",
"$",
"url",
",",
"$",
"text",
",",
"array",
"$",
"attributes",
"=",
"null",
")",
"{",
"$",
"attributes",
"=",
"(",
"array",
")",
"$",
"attributes",
";",
"$",
"attributes",
"[",
"'href'",
"]",
"=",
"$",
"... | Generates a simple html link
@param string|moodle_url $url The URL
@param string $text The text
@param array $attributes HTML attributes
@return string HTML fragment | [
"Generates",
"a",
"simple",
"html",
"link"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1774-L1778 |
219,796 | moodle/moodle | lib/outputcomponents.php | html_writer.checkbox | public static function checkbox($name, $value, $checked = true, $label = '', array $attributes = null) {
$attributes = (array)$attributes;
$output = '';
if ($label !== '' and !is_null($label)) {
if (empty($attributes['id'])) {
$attributes['id'] = self::random_id('che... | php | public static function checkbox($name, $value, $checked = true, $label = '', array $attributes = null) {
$attributes = (array)$attributes;
$output = '';
if ($label !== '' and !is_null($label)) {
if (empty($attributes['id'])) {
$attributes['id'] = self::random_id('che... | [
"public",
"static",
"function",
"checkbox",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"checked",
"=",
"true",
",",
"$",
"label",
"=",
"''",
",",
"array",
"$",
"attributes",
"=",
"null",
")",
"{",
"$",
"attributes",
"=",
"(",
"array",
")",
"$",... | Generates a simple checkbox with optional label
@param string $name The name of the checkbox
@param string $value The value of the checkbox
@param bool $checked Whether the checkbox is checked
@param string $label The label for the checkbox
@param array $attributes Any attributes to apply to the checkbox
@return strin... | [
"Generates",
"a",
"simple",
"checkbox",
"with",
"optional",
"label"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1790-L1811 |
219,797 | moodle/moodle | lib/outputcomponents.php | html_writer.select | public static function select(array $options, $name, $selected = '', $nothing = array('' => 'choosedots'), array $attributes = null) {
$attributes = (array)$attributes;
if (is_array($nothing)) {
foreach ($nothing as $k=>$v) {
if ($v === 'choose' or $v === 'choosedots') {
... | php | public static function select(array $options, $name, $selected = '', $nothing = array('' => 'choosedots'), array $attributes = null) {
$attributes = (array)$attributes;
if (is_array($nothing)) {
foreach ($nothing as $k=>$v) {
if ($v === 'choose' or $v === 'choosedots') {
... | [
"public",
"static",
"function",
"select",
"(",
"array",
"$",
"options",
",",
"$",
"name",
",",
"$",
"selected",
"=",
"''",
",",
"$",
"nothing",
"=",
"array",
"(",
"''",
"=>",
"'choosedots'",
")",
",",
"array",
"$",
"attributes",
"=",
"null",
")",
"{"... | Generates a simple select form field
@param array $options associative array value=>label ex.:
array(1=>'One, 2=>Two)
it is also possible to specify optgroup as complex label array ex.:
array(array('Odd'=>array(1=>'One', 3=>'Three)), array('Even'=>array(2=>'Two')))
array(1=>'One', '--1uniquekey'=>array('More'=>array(2... | [
"Generates",
"a",
"simple",
"select",
"form",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1840-L1896 |
219,798 | moodle/moodle | lib/outputcomponents.php | html_writer.select_option | private static function select_option($label, $value, array $selected) {
$attributes = array();
$value = (string)$value;
if (in_array($value, $selected, true)) {
$attributes['selected'] = 'selected';
}
$attributes['value'] = $value;
return self::tag('option', ... | php | private static function select_option($label, $value, array $selected) {
$attributes = array();
$value = (string)$value;
if (in_array($value, $selected, true)) {
$attributes['selected'] = 'selected';
}
$attributes['value'] = $value;
return self::tag('option', ... | [
"private",
"static",
"function",
"select_option",
"(",
"$",
"label",
",",
"$",
"value",
",",
"array",
"$",
"selected",
")",
"{",
"$",
"attributes",
"=",
"array",
"(",
")",
";",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"value",
";",
"if",
"(",
"i... | Returns HTML to display a select box option.
@param string $label The label to display as the option.
@param string|int $value The value the option represents
@param array $selected An array of selected options
@return string HTML fragment | [
"Returns",
"HTML",
"to",
"display",
"a",
"select",
"box",
"option",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1906-L1914 |
219,799 | moodle/moodle | lib/outputcomponents.php | html_writer.select_optgroup | private static function select_optgroup($groupname, $options, array $selected) {
if (empty($options)) {
return '';
}
$attributes = array('label'=>$groupname);
$output = '';
foreach ($options as $value=>$label) {
$output .= self::select_option($label, $valu... | php | private static function select_optgroup($groupname, $options, array $selected) {
if (empty($options)) {
return '';
}
$attributes = array('label'=>$groupname);
$output = '';
foreach ($options as $value=>$label) {
$output .= self::select_option($label, $valu... | [
"private",
"static",
"function",
"select_optgroup",
"(",
"$",
"groupname",
",",
"$",
"options",
",",
"array",
"$",
"selected",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"options",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"attributes",
"=",
"array",
... | Returns HTML to display a select box option group.
@param string $groupname The label to use for the group
@param array $options The options in the group
@param array $selected An array of selected values.
@return string HTML fragment. | [
"Returns",
"HTML",
"to",
"display",
"a",
"select",
"box",
"option",
"group",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputcomponents.php#L1924-L1934 |
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.