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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
214,000 | moodle/moodle | grade/import/csv/classes/load_data.php | gradeimport_csv_load_data.check_user_exists | protected function check_user_exists($value, $userfields) {
global $DB;
$user = null;
$errorkey = false;
// The user may use the incorrect field to match the user. This could result in an exception.
try {
$field = $userfields['field'];
// Fields that can ... | php | protected function check_user_exists($value, $userfields) {
global $DB;
$user = null;
$errorkey = false;
// The user may use the incorrect field to match the user. This could result in an exception.
try {
$field = $userfields['field'];
// Fields that can ... | [
"protected",
"function",
"check_user_exists",
"(",
"$",
"value",
",",
"$",
"userfields",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"user",
"=",
"null",
";",
"$",
"errorkey",
"=",
"false",
";",
"// The user may use the incorrect field to match the user. This could res... | Check that the user is in the system.
@param string $value The value, from the csv file, being mapped to identify the user.
@param array $userfields Contains the field and label being mapped from.
@return int Returns the user ID if it exists, otherwise null. | [
"Check",
"that",
"the",
"user",
"is",
"in",
"the",
"system",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/load_data.php#L221-L260 |
214,001 | moodle/moodle | grade/import/csv/classes/load_data.php | gradeimport_csv_load_data.create_feedback | protected function create_feedback($courseid, $itemid, $value) {
// Case of an id, only maps id of a grade_item.
// This was idnumber.
if (!new grade_item(array('id' => $itemid, 'courseid' => $courseid))) {
// Supplied bad mapping, should not be possible since user
// had... | php | protected function create_feedback($courseid, $itemid, $value) {
// Case of an id, only maps id of a grade_item.
// This was idnumber.
if (!new grade_item(array('id' => $itemid, 'courseid' => $courseid))) {
// Supplied bad mapping, should not be possible since user
// had... | [
"protected",
"function",
"create_feedback",
"(",
"$",
"courseid",
",",
"$",
"itemid",
",",
"$",
"value",
")",
"{",
"// Case of an id, only maps id of a grade_item.",
"// This was idnumber.",
"if",
"(",
"!",
"new",
"grade_item",
"(",
"array",
"(",
"'id'",
"=>",
"$"... | Check to see if the feedback matches a grade item.
@param int $courseid The course ID.
@param int $itemid The ID of the grade item that the feedback relates to.
@param string $value The actual feedback being imported.
@return object Creates a feedback object with the item ID and the feedback value. | [
"Check",
"to",
"see",
"if",
"the",
"feedback",
"matches",
"a",
"grade",
"item",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/load_data.php#L270-L285 |
214,002 | moodle/moodle | grade/import/csv/classes/load_data.php | gradeimport_csv_load_data.update_grade_item | protected function update_grade_item($courseid, $map, $key, $verbosescales, $value) {
// Case of an id, only maps id of a grade_item.
// This was idnumber.
if (!$gradeitem = new grade_item(array('id' => $map[$key], 'courseid' => $courseid))) {
// Supplied bad mapping, should not be p... | php | protected function update_grade_item($courseid, $map, $key, $verbosescales, $value) {
// Case of an id, only maps id of a grade_item.
// This was idnumber.
if (!$gradeitem = new grade_item(array('id' => $map[$key], 'courseid' => $courseid))) {
// Supplied bad mapping, should not be p... | [
"protected",
"function",
"update_grade_item",
"(",
"$",
"courseid",
",",
"$",
"map",
",",
"$",
"key",
",",
"$",
"verbosescales",
",",
"$",
"value",
")",
"{",
"// Case of an id, only maps id of a grade_item.",
"// This was idnumber.",
"if",
"(",
"!",
"$",
"gradeite... | This updates existing grade items.
@param int $courseid The course ID.
@param array $map Mapping information provided by the user.
@param int $key The line that we are currently working on.
@param bool $verbosescales Form setting for grading with scales.
@param string $value The grade value.
@return array grades to be... | [
"This",
"updates",
"existing",
"grade",
"items",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/load_data.php#L297-L349 |
214,003 | moodle/moodle | grade/import/csv/classes/load_data.php | gradeimport_csv_load_data.cleanup_import | protected function cleanup_import($notification) {
$this->status = false;
import_cleanup($this->importcode);
$this->gradebookerrors[] = $notification;
} | php | protected function cleanup_import($notification) {
$this->status = false;
import_cleanup($this->importcode);
$this->gradebookerrors[] = $notification;
} | [
"protected",
"function",
"cleanup_import",
"(",
"$",
"notification",
")",
"{",
"$",
"this",
"->",
"status",
"=",
"false",
";",
"import_cleanup",
"(",
"$",
"this",
"->",
"importcode",
")",
";",
"$",
"this",
"->",
"gradebookerrors",
"[",
"]",
"=",
"$",
"no... | Clean up failed CSV grade import. Clears the temp table for inserting grades.
@param string $notification The error message to display from the unsuccessful grade import. | [
"Clean",
"up",
"failed",
"CSV",
"grade",
"import",
".",
"Clears",
"the",
"temp",
"table",
"for",
"inserting",
"grades",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/load_data.php#L356-L360 |
214,004 | moodle/moodle | grade/import/csv/classes/load_data.php | gradeimport_csv_load_data.map_user_data_with_value | protected function map_user_data_with_value($mappingidentifier, $value, $header, $map, $key, $courseid, $feedbackgradeid,
$verbosescales) {
// Fields that the user can be mapped from.
$userfields = array(
'userid' => array(
'field' => 'id',
'label... | php | protected function map_user_data_with_value($mappingidentifier, $value, $header, $map, $key, $courseid, $feedbackgradeid,
$verbosescales) {
// Fields that the user can be mapped from.
$userfields = array(
'userid' => array(
'field' => 'id',
'label... | [
"protected",
"function",
"map_user_data_with_value",
"(",
"$",
"mappingidentifier",
",",
"$",
"value",
",",
"$",
"header",
",",
"$",
"map",
",",
"$",
"key",
",",
"$",
"courseid",
",",
"$",
"feedbackgradeid",
",",
"$",
"verbosescales",
")",
"{",
"// Fields th... | Check user mapping.
@param string $mappingidentifier The user field that we are matching together.
@param string $value The value we are checking / importing.
@param array $header The column headers of the csv file.
@param array $map Mapping information provided by the user.
@param int $key Current row identifier.
@pa... | [
"Check",
"user",
"mapping",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/load_data.php#L374-L428 |
214,005 | moodle/moodle | admin/tool/uploaduser/locallib.php | uu_progress_tracker.start | public function start() {
$ci = 0;
echo '<table id="uuresults" class="generaltable boxaligncenter flexible-wrap" summary="'.get_string('uploadusersresult', 'tool_uploaduser').'">';
echo '<tr class="heading r0">';
echo '<th class="header c'.$ci++.'" scope="col">'.get_string('status').'</t... | php | public function start() {
$ci = 0;
echo '<table id="uuresults" class="generaltable boxaligncenter flexible-wrap" summary="'.get_string('uploadusersresult', 'tool_uploaduser').'">';
echo '<tr class="heading r0">';
echo '<th class="header c'.$ci++.'" scope="col">'.get_string('status').'</t... | [
"public",
"function",
"start",
"(",
")",
"{",
"$",
"ci",
"=",
"0",
";",
"echo",
"'<table id=\"uuresults\" class=\"generaltable boxaligncenter flexible-wrap\" summary=\"'",
".",
"get_string",
"(",
"'uploadusersresult'",
",",
"'tool_uploaduser'",
")",
".",
"'\">'",
";",
"... | Print table header.
@return void | [
"Print",
"table",
"header",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/uploaduser/locallib.php#L65-L83 |
214,006 | moodle/moodle | admin/tool/uploaduser/locallib.php | uu_progress_tracker.flush | public function flush() {
if (empty($this->_row) or empty($this->_row['line']['normal'])) {
// Nothing to print - each line has to have at least number
$this->_row = array();
foreach ($this->columns as $col) {
$this->_row[$col] = array('normal'=>'', 'info'=>''... | php | public function flush() {
if (empty($this->_row) or empty($this->_row['line']['normal'])) {
// Nothing to print - each line has to have at least number
$this->_row = array();
foreach ($this->columns as $col) {
$this->_row[$col] = array('normal'=>'', 'info'=>''... | [
"public",
"function",
"flush",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_row",
")",
"or",
"empty",
"(",
"$",
"this",
"->",
"_row",
"[",
"'line'",
"]",
"[",
"'normal'",
"]",
")",
")",
"{",
"// Nothing to print - each line has to have at... | Flush previous line and start a new one.
@return void | [
"Flush",
"previous",
"line",
"and",
"start",
"a",
"new",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/uploaduser/locallib.php#L89-L121 |
214,007 | moodle/moodle | admin/tool/uploaduser/locallib.php | uu_progress_tracker.track | public function track($col, $msg, $level = 'normal', $merge = true) {
if (empty($this->_row)) {
$this->flush(); //init arrays
}
if (!in_array($col, $this->columns)) {
debugging('Incorrect column:'.$col);
return;
}
if ($merge) {
if (... | php | public function track($col, $msg, $level = 'normal', $merge = true) {
if (empty($this->_row)) {
$this->flush(); //init arrays
}
if (!in_array($col, $this->columns)) {
debugging('Incorrect column:'.$col);
return;
}
if ($merge) {
if (... | [
"public",
"function",
"track",
"(",
"$",
"col",
",",
"$",
"msg",
",",
"$",
"level",
"=",
"'normal'",
",",
"$",
"merge",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_row",
")",
")",
"{",
"$",
"this",
"->",
"flush",
"(",
... | Add tracking info
@param string $col name of column
@param string $msg message
@param string $level 'normal', 'warning' or 'error'
@param bool $merge true means add as new line, false means override all previous text of the same type
@return void | [
"Add",
"tracking",
"info"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/uploaduser/locallib.php#L131-L147 |
214,008 | moodle/moodle | question/format/blackboard_six/format.php | qformat_blackboard_six.get_filecontent | public function get_filecontent($path) {
$fullpath = $this->tempdir . '/' . $path;
if (is_file($fullpath) && is_readable($fullpath)) {
return file_get_contents($fullpath);
}
return false;
} | php | public function get_filecontent($path) {
$fullpath = $this->tempdir . '/' . $path;
if (is_file($fullpath) && is_readable($fullpath)) {
return file_get_contents($fullpath);
}
return false;
} | [
"public",
"function",
"get_filecontent",
"(",
"$",
"path",
")",
"{",
"$",
"fullpath",
"=",
"$",
"this",
"->",
"tempdir",
".",
"'/'",
".",
"$",
"path",
";",
"if",
"(",
"is_file",
"(",
"$",
"fullpath",
")",
"&&",
"is_readable",
"(",
"$",
"fullpath",
")... | Return the content of a file given by its path in the tempdir directory.
@param string $path path to the file inside tempdir
@return mixed contents array or false on failure | [
"Return",
"the",
"content",
"of",
"a",
"file",
"given",
"by",
"its",
"path",
"in",
"the",
"tempdir",
"directory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/blackboard_six/format.php#L67-L73 |
214,009 | moodle/moodle | lib/simplepie/library/SimplePie/Cache.php | SimplePie_Cache.parse_URL | public static function parse_URL($url)
{
$params = parse_url($url);
$params['extras'] = array();
if (isset($params['query']))
{
parse_str($params['query'], $params['extras']);
}
return $params;
} | php | public static function parse_URL($url)
{
$params = parse_url($url);
$params['extras'] = array();
if (isset($params['query']))
{
parse_str($params['query'], $params['extras']);
}
return $params;
} | [
"public",
"static",
"function",
"parse_URL",
"(",
"$",
"url",
")",
"{",
"$",
"params",
"=",
"parse_url",
"(",
"$",
"url",
")",
";",
"$",
"params",
"[",
"'extras'",
"]",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'q... | Parse a URL into an array
@param string $url
@return array | [
"Parse",
"a",
"URL",
"into",
"an",
"array"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Cache.php#L124-L133 |
214,010 | moodle/moodle | admin/tool/usertours/classes/output/tour.php | tour.export_for_template | public function export_for_template(\renderer_base $output) {
$result = (object) [
'name' => $this->tour->get_tour_key(),
'steps' => [],
];
foreach ($this->tour->get_steps() as $step) {
$result->steps[] = (new step($step))->export_for_template($output);
... | php | public function export_for_template(\renderer_base $output) {
$result = (object) [
'name' => $this->tour->get_tour_key(),
'steps' => [],
];
foreach ($this->tour->get_steps() as $step) {
$result->steps[] = (new step($step))->export_for_template($output);
... | [
"public",
"function",
"export_for_template",
"(",
"\\",
"renderer_base",
"$",
"output",
")",
"{",
"$",
"result",
"=",
"(",
"object",
")",
"[",
"'name'",
"=>",
"$",
"this",
"->",
"tour",
"->",
"get_tour_key",
"(",
")",
",",
"'steps'",
"=>",
"[",
"]",
",... | Prepare the data for export.
@param \renderer_base $output The output renderable.
@return object | [
"Prepare",
"the",
"data",
"for",
"export",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/output/tour.php#L59-L70 |
214,011 | moodle/moodle | lib/horde/framework/Horde/Stream/Wrapper/String.php | Horde_Stream_Wrapper_String.getStream | public static function getStream(&$string)
{
if (!self::$_id) {
stream_wrapper_register(self::WRAPPER_NAME, __CLASS__);
}
/* Needed to keep reference. */
$ob = new stdClass;
$ob->string = &$string;
return fopen(
self::WRAPPER_NAME . '://' . +... | php | public static function getStream(&$string)
{
if (!self::$_id) {
stream_wrapper_register(self::WRAPPER_NAME, __CLASS__);
}
/* Needed to keep reference. */
$ob = new stdClass;
$ob->string = &$string;
return fopen(
self::WRAPPER_NAME . '://' . +... | [
"public",
"static",
"function",
"getStream",
"(",
"&",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"_id",
")",
"{",
"stream_wrapper_register",
"(",
"self",
"::",
"WRAPPER_NAME",
",",
"__CLASS__",
")",
";",
"}",
"/* Needed to keep reference. *... | Create a stream from a PHP string.
@since 2.1.0
@param string &$string A PHP string variable.
@return resource A PHP stream pointing to the variable. | [
"Create",
"a",
"stream",
"from",
"a",
"PHP",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Stream/Wrapper/String.php#L66-L86 |
214,012 | moodle/moodle | lib/google/src/Google/Http/REST.php | Google_Http_REST.doExecute | public static function doExecute(Google_Client $client, Google_Http_Request $req)
{
$httpRequest = $client->getIo()->makeRequest($req);
$httpRequest->setExpectedClass($req->getExpectedClass());
return self::decodeHttpResponse($httpRequest, $client);
} | php | public static function doExecute(Google_Client $client, Google_Http_Request $req)
{
$httpRequest = $client->getIo()->makeRequest($req);
$httpRequest->setExpectedClass($req->getExpectedClass());
return self::decodeHttpResponse($httpRequest, $client);
} | [
"public",
"static",
"function",
"doExecute",
"(",
"Google_Client",
"$",
"client",
",",
"Google_Http_Request",
"$",
"req",
")",
"{",
"$",
"httpRequest",
"=",
"$",
"client",
"->",
"getIo",
"(",
")",
"->",
"makeRequest",
"(",
"$",
"req",
")",
";",
"$",
"htt... | Executes a Google_Http_Request
@param Google_Client $client
@param Google_Http_Request $req
@return array decoded result
@throws Google_Service_Exception on server side error (ie: not authenticated,
invalid or malformed post body, invalid url) | [
"Executes",
"a",
"Google_Http_Request"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Http/REST.php#L58-L63 |
214,013 | moodle/moodle | lib/classes/event/competency_user_competency_viewed_in_course.php | competency_user_competency_viewed_in_course.create_from_user_competency_viewed_in_course | public static function create_from_user_competency_viewed_in_course(user_competency_course $usercompetencycourse) {
if (!$usercompetencycourse->get('id')) {
throw new \coding_exception('The user competency course ID must be set.');
}
$params = array(
'objectid' => $userco... | php | public static function create_from_user_competency_viewed_in_course(user_competency_course $usercompetencycourse) {
if (!$usercompetencycourse->get('id')) {
throw new \coding_exception('The user competency course ID must be set.');
}
$params = array(
'objectid' => $userco... | [
"public",
"static",
"function",
"create_from_user_competency_viewed_in_course",
"(",
"user_competency_course",
"$",
"usercompetencycourse",
")",
"{",
"if",
"(",
"!",
"$",
"usercompetencycourse",
"->",
"get",
"(",
"'id'",
")",
")",
"{",
"throw",
"new",
"\\",
"coding_... | Convenience method to instantiate the event in course.
@param user_competency_course $usercompetencycourse The user competency for the course.
@return self | [
"Convenience",
"method",
"to",
"instantiate",
"the",
"event",
"in",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/event/competency_user_competency_viewed_in_course.php#L54-L72 |
214,014 | moodle/moodle | completion/data_object.php | data_object.load_optional_fields | public function load_optional_fields() {
global $DB;
foreach ($this->optional_fields as $field=>$default) {
if (property_exists($this, $field)) {
continue;
}
if (empty($this->id)) {
$this->$field = $default;
} else {
... | php | public function load_optional_fields() {
global $DB;
foreach ($this->optional_fields as $field=>$default) {
if (property_exists($this, $field)) {
continue;
}
if (empty($this->id)) {
$this->$field = $default;
} else {
... | [
"public",
"function",
"load_optional_fields",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"foreach",
"(",
"$",
"this",
"->",
"optional_fields",
"as",
"$",
"field",
"=>",
"$",
"default",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"$",
"... | Makes sure all the optional fields are loaded.
If id present (==instance exists in db) fetches data from db.
Defaults are used for new instances. | [
"Makes",
"sure",
"all",
"the",
"optional",
"fields",
"are",
"loaded",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/data_object.php#L138-L150 |
214,015 | moodle/moodle | completion/data_object.php | data_object.fetch_helper | protected static function fetch_helper($table, $classname, $params) {
if ($instances = self::fetch_all_helper($table, $classname, $params)) {
if (count($instances) > 1) {
// we should not tolerate any errors here - problems might appear later
print_error('morethanoner... | php | protected static function fetch_helper($table, $classname, $params) {
if ($instances = self::fetch_all_helper($table, $classname, $params)) {
if (count($instances) > 1) {
// we should not tolerate any errors here - problems might appear later
print_error('morethanoner... | [
"protected",
"static",
"function",
"fetch_helper",
"(",
"$",
"table",
",",
"$",
"classname",
",",
"$",
"params",
")",
"{",
"if",
"(",
"$",
"instances",
"=",
"self",
"::",
"fetch_all_helper",
"(",
"$",
"table",
",",
"$",
"classname",
",",
"$",
"params",
... | Factory method - uses the parameters to retrieve matching instance from the DB.
@final
@param string $table The table name to fetch from
@param string $classname The class that you want the result instantiated as
@param array $params Any params required to select the desired row
@return object Instance of $classname o... | [
"Factory",
"method",
"-",
"uses",
"the",
"parameters",
"to",
"retrieve",
"matching",
"instance",
"from",
"the",
"DB",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/data_object.php#L187-L197 |
214,016 | moodle/moodle | completion/data_object.php | data_object.fetch_all_helper | public static function fetch_all_helper($table, $classname, $params) {
$instance = new $classname();
$classvars = (array)$instance;
$params = (array)$params;
$wheresql = array();
$dbparams = array();
foreach ($params as $var=>$value) {
if (!in_array($var... | php | public static function fetch_all_helper($table, $classname, $params) {
$instance = new $classname();
$classvars = (array)$instance;
$params = (array)$params;
$wheresql = array();
$dbparams = array();
foreach ($params as $var=>$value) {
if (!in_array($var... | [
"public",
"static",
"function",
"fetch_all_helper",
"(",
"$",
"table",
",",
"$",
"classname",
",",
"$",
"params",
")",
"{",
"$",
"instance",
"=",
"new",
"$",
"classname",
"(",
")",
";",
"$",
"classvars",
"=",
"(",
"array",
")",
"$",
"instance",
";",
... | Factory method - uses the parameters to retrieve all matching instances from the DB.
@final
@param string $table The table name to fetch from
@param string $classname The class that you want the result instantiated as
@param array $params Any params required to select the desired row
@return mixed array of object inst... | [
"Factory",
"method",
"-",
"uses",
"the",
"parameters",
"to",
"retrieve",
"all",
"matching",
"instances",
"from",
"the",
"DB",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/data_object.php#L208-L250 |
214,017 | moodle/moodle | completion/data_object.php | data_object.get_record_data | public function get_record_data() {
$data = new stdClass();
foreach ($this as $var=>$value) {
if (in_array($var, $this->required_fields) or array_key_exists($var, $this->optional_fields)) {
if (is_object($value) or is_array($value)) {
debugging("Incorrect... | php | public function get_record_data() {
$data = new stdClass();
foreach ($this as $var=>$value) {
if (in_array($var, $this->required_fields) or array_key_exists($var, $this->optional_fields)) {
if (is_object($value) or is_array($value)) {
debugging("Incorrect... | [
"public",
"function",
"get_record_data",
"(",
")",
"{",
"$",
"data",
"=",
"new",
"stdClass",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"var",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"var",
",",
"$",
"this",
"->... | Returns object with fields and values that are defined in database
@return stdClass | [
"Returns",
"object",
"with",
"fields",
"and",
"values",
"that",
"are",
"defined",
"in",
"database"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/data_object.php#L302-L315 |
214,018 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_handlers_factory.get_plugin_handlers | protected static function get_plugin_handlers($type, moodle1_converter $converter) {
global $CFG;
$handlers = array();
$plugins = core_component::get_plugin_list($type);
foreach ($plugins as $name => $dir) {
$handlerfile = $dir . '/backup/moodle1/lib.php';
$hand... | php | protected static function get_plugin_handlers($type, moodle1_converter $converter) {
global $CFG;
$handlers = array();
$plugins = core_component::get_plugin_list($type);
foreach ($plugins as $name => $dir) {
$handlerfile = $dir . '/backup/moodle1/lib.php';
$hand... | [
"protected",
"static",
"function",
"get_plugin_handlers",
"(",
"$",
"type",
",",
"moodle1_converter",
"$",
"converter",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"handlers",
"=",
"array",
"(",
")",
";",
"$",
"plugins",
"=",
"core_component",
"::",
"get_plugi... | Runs through all plugins of a specific type and instantiates their handlers
@todo ask mod's subplugins
@param string $type the plugin type
@param moodle1_converter $converter the converter requesting the handler
@throws moodle1_convert_exception
@return array of {@link moodle1_handler} instances | [
"Runs",
"through",
"all",
"plugins",
"of",
"a",
"specific",
"type",
"and",
"instantiates",
"their",
"handlers"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L83-L105 |
214,019 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_xml_handler.close_xml_writer | protected function close_xml_writer() {
if ($this->xmlwriter instanceof xml_writer) {
$this->xmlwriter->stop();
}
unset($this->xmlwriter);
$this->xmlwriter = null;
$this->xmlfilename = null;
} | php | protected function close_xml_writer() {
if ($this->xmlwriter instanceof xml_writer) {
$this->xmlwriter->stop();
}
unset($this->xmlwriter);
$this->xmlwriter = null;
$this->xmlfilename = null;
} | [
"protected",
"function",
"close_xml_writer",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"xmlwriter",
"instanceof",
"xml_writer",
")",
"{",
"$",
"this",
"->",
"xmlwriter",
"->",
"stop",
"(",
")",
";",
"}",
"unset",
"(",
"$",
"this",
"->",
"xmlwriter",
... | Close the XML writer
At the moment, the caller must close all tags before calling
@return void | [
"Close",
"the",
"XML",
"writer"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L189-L196 |
214,020 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_xml_handler.write_xml | protected function write_xml($element, array $data, array $attribs = array(), $parent = '/') {
if (!$this->has_xml_writer()) {
throw new moodle1_convert_exception('write_xml_without_writer');
}
$mypath = $parent . $element;
$myattribs = array();
// detect proper... | php | protected function write_xml($element, array $data, array $attribs = array(), $parent = '/') {
if (!$this->has_xml_writer()) {
throw new moodle1_convert_exception('write_xml_without_writer');
}
$mypath = $parent . $element;
$myattribs = array();
// detect proper... | [
"protected",
"function",
"write_xml",
"(",
"$",
"element",
",",
"array",
"$",
"data",
",",
"array",
"$",
"attribs",
"=",
"array",
"(",
")",
",",
"$",
"parent",
"=",
"'/'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has_xml_writer",
"(",
")",
")"... | Writes the given XML tree data into the currently opened file
@param string $element the name of the root element of the tree
@param array $data the associative array of data to write
@param array $attribs list of additional fields written as attributes instead of nested elements
@param string $parent used internally ... | [
"Writes",
"the",
"given",
"XML",
"tree",
"data",
"into",
"the",
"currently",
"opened",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L220-L263 |
214,021 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_xml_handler.make_sure_xml_exists | protected function make_sure_xml_exists($filename, $rootelement = false, $content = array()) {
$existed = file_exists($this->converter->get_workdir_path().'/'.$filename);
if ($existed) {
return true;
}
if ($rootelement !== false) {
$this->open_xml_writer($filen... | php | protected function make_sure_xml_exists($filename, $rootelement = false, $content = array()) {
$existed = file_exists($this->converter->get_workdir_path().'/'.$filename);
if ($existed) {
return true;
}
if ($rootelement !== false) {
$this->open_xml_writer($filen... | [
"protected",
"function",
"make_sure_xml_exists",
"(",
"$",
"filename",
",",
"$",
"rootelement",
"=",
"false",
",",
"$",
"content",
"=",
"array",
"(",
")",
")",
"{",
"$",
"existed",
"=",
"file_exists",
"(",
"$",
"this",
"->",
"converter",
"->",
"get_workdir... | Makes sure that a new XML file exists, or creates it itself
This is here so we can check that all XML files that the restore process relies on have
been created by an executed handler. If the file is not found, this method can create it
using the given $rootelement as an empty root container in the file.
@param strin... | [
"Makes",
"sure",
"that",
"a",
"new",
"XML",
"file",
"exists",
"or",
"creates",
"it",
"itself"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L277-L292 |
214,022 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_files_handler.migrate_course_files | protected function migrate_course_files() {
$ids = array();
$fileman = $this->converter->get_file_manager($this->converter->get_contextid(CONTEXT_COURSE), 'course', 'legacy');
$this->converter->set_stash('course_files_ids', array());
if (file_exists($this->converter->get_tempdir_path().... | php | protected function migrate_course_files() {
$ids = array();
$fileman = $this->converter->get_file_manager($this->converter->get_contextid(CONTEXT_COURSE), 'course', 'legacy');
$this->converter->set_stash('course_files_ids', array());
if (file_exists($this->converter->get_tempdir_path().... | [
"protected",
"function",
"migrate_course_files",
"(",
")",
"{",
"$",
"ids",
"=",
"array",
"(",
")",
";",
"$",
"fileman",
"=",
"$",
"this",
"->",
"converter",
"->",
"get_file_manager",
"(",
"$",
"this",
"->",
"converter",
"->",
"get_contextid",
"(",
"CONTEX... | Migrates course_files in the converter workdir | [
"Migrates",
"course_files",
"in",
"the",
"converter",
"workdir"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L573-L582 |
214,023 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_course_outline_handler.on_course_modules_end | public function on_course_modules_end() {
foreach ($this->converter->get_stash('modnameslist') as $modname) {
$modinfo = $this->converter->get_stash('modinfo_'.$modname);
foreach ($modinfo['instances'] as $modinstanceid => $modinstance) {
$cminfo = $this->converter->g... | php | public function on_course_modules_end() {
foreach ($this->converter->get_stash('modnameslist') as $modname) {
$modinfo = $this->converter->get_stash('modinfo_'.$modname);
foreach ($modinfo['instances'] as $modinstanceid => $modinstance) {
$cminfo = $this->converter->g... | [
"public",
"function",
"on_course_modules_end",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"converter",
"->",
"get_stash",
"(",
"'modnameslist'",
")",
"as",
"$",
"modname",
")",
"{",
"$",
"modinfo",
"=",
"$",
"this",
"->",
"converter",
"->",
"get_sta... | Writes the information collected by mod handlers | [
"Writes",
"the",
"information",
"collected",
"by",
"mod",
"handlers"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L924-L956 |
214,024 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_roles_definition_handler.process_roles_role | public function process_roles_role($data) {
if (!$this->has_xml_writer()) {
$this->open_xml_writer('roles.xml');
$this->xmlwriter->begin_tag('roles_definition');
}
if (!isset($data['nameincourse'])) {
$data['nameincourse'] = null;
}
$this->wri... | php | public function process_roles_role($data) {
if (!$this->has_xml_writer()) {
$this->open_xml_writer('roles.xml');
$this->xmlwriter->begin_tag('roles_definition');
}
if (!isset($data['nameincourse'])) {
$data['nameincourse'] = null;
}
$this->wri... | [
"public",
"function",
"process_roles_role",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has_xml_writer",
"(",
")",
")",
"{",
"$",
"this",
"->",
"open_xml_writer",
"(",
"'roles.xml'",
")",
";",
"$",
"this",
"->",
"xmlwriter",
"->",
"... | If there are any roles defined in moodle.xml, convert them to roles.xml | [
"If",
"there",
"are",
"any",
"roles",
"defined",
"in",
"moodle",
".",
"xml",
"convert",
"them",
"to",
"roles",
".",
"xml"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L987-L997 |
214,025 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_roles_definition_handler.on_roles_end | public function on_roles_end() {
if (!$this->has_xml_writer()) {
// no roles defined in moodle.xml so {link self::process_roles_role()}
// was never executed
$this->open_xml_writer('roles.xml');
$this->write_xml('roles_definition', array());
} else {
... | php | public function on_roles_end() {
if (!$this->has_xml_writer()) {
// no roles defined in moodle.xml so {link self::process_roles_role()}
// was never executed
$this->open_xml_writer('roles.xml');
$this->write_xml('roles_definition', array());
} else {
... | [
"public",
"function",
"on_roles_end",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has_xml_writer",
"(",
")",
")",
"{",
"// no roles defined in moodle.xml so {link self::process_roles_role()}",
"// was never executed",
"$",
"this",
"->",
"open_xml_writer",
"(",
... | Finishes writing roles.xml | [
"Finishes",
"writing",
"roles",
".",
"xml"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1002-L1015 |
214,026 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_question_bank_handler.get_paths | public function get_paths() {
$paths = array(
new convert_path('question_categories', '/MOODLE_BACKUP/COURSE/QUESTION_CATEGORIES'),
new convert_path(
'question_category', '/MOODLE_BACKUP/COURSE/QUESTION_CATEGORIES/QUESTION_CATEGORY',
array(
... | php | public function get_paths() {
$paths = array(
new convert_path('question_categories', '/MOODLE_BACKUP/COURSE/QUESTION_CATEGORIES'),
new convert_path(
'question_category', '/MOODLE_BACKUP/COURSE/QUESTION_CATEGORIES/QUESTION_CATEGORY',
array(
... | [
"public",
"function",
"get_paths",
"(",
")",
"{",
"$",
"paths",
"=",
"array",
"(",
"new",
"convert_path",
"(",
"'question_categories'",
",",
"'/MOODLE_BACKUP/COURSE/QUESTION_CATEGORIES'",
")",
",",
"new",
"convert_path",
"(",
"'question_category'",
",",
"'/MOODLE_BACK... | Registers path that are not qtype-specific | [
"Registers",
"path",
"that",
"are",
"not",
"qtype",
"-",
"specific"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1063-L1094 |
214,027 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_question_bank_handler.on_question_categories_start | public function on_question_categories_start() {
$this->open_xml_writer('questions.xml');
$this->xmlwriter->begin_tag('question_categories');
if (is_null($this->fileman)) {
$this->fileman = $this->converter->get_file_manager();
}
} | php | public function on_question_categories_start() {
$this->open_xml_writer('questions.xml');
$this->xmlwriter->begin_tag('question_categories');
if (is_null($this->fileman)) {
$this->fileman = $this->converter->get_file_manager();
}
} | [
"public",
"function",
"on_question_categories_start",
"(",
")",
"{",
"$",
"this",
"->",
"open_xml_writer",
"(",
"'questions.xml'",
")",
";",
"$",
"this",
"->",
"xmlwriter",
"->",
"begin_tag",
"(",
"'question_categories'",
")",
";",
"if",
"(",
"is_null",
"(",
"... | Starts writing questions.xml and prepares the file manager instance | [
"Starts",
"writing",
"questions",
".",
"xml",
"and",
"prepares",
"the",
"file",
"manager",
"instance"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1099-L1105 |
214,028 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_question_bank_handler.on_question_category_start | public function on_question_category_start() {
$this->currentcategory = array();
$this->currentcategoryraw = array();
$this->currentcategorywritten = false;
$this->questionswrapperwritten = false;
} | php | public function on_question_category_start() {
$this->currentcategory = array();
$this->currentcategoryraw = array();
$this->currentcategorywritten = false;
$this->questionswrapperwritten = false;
} | [
"public",
"function",
"on_question_category_start",
"(",
")",
"{",
"$",
"this",
"->",
"currentcategory",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"currentcategoryraw",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"currentcategorywritten",
"=",
"fal... | Initializes the current category cache | [
"Initializes",
"the",
"current",
"category",
"cache"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1110-L1115 |
214,029 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_question_bank_handler.process_question_category | public function process_question_category($data, $raw) {
$this->currentcategory = array_merge($this->currentcategory, $data);
$this->currentcategoryraw = array_merge($this->currentcategoryraw, $raw);
} | php | public function process_question_category($data, $raw) {
$this->currentcategory = array_merge($this->currentcategory, $data);
$this->currentcategoryraw = array_merge($this->currentcategoryraw, $raw);
} | [
"public",
"function",
"process_question_category",
"(",
"$",
"data",
",",
"$",
"raw",
")",
"{",
"$",
"this",
"->",
"currentcategory",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"currentcategory",
",",
"$",
"data",
")",
";",
"$",
"this",
"->",
"currentcate... | Populates the current question category data
Bacuse of the known subpath-in-the-middle problem (CONTEXT in this case), this is actually
called twice for both halves of the data. We merge them here into the currentcategory array. | [
"Populates",
"the",
"current",
"question",
"category",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1123-L1126 |
214,030 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_question_bank_handler.process_question_category_context | public function process_question_category_context($data) {
switch ($data['level']) {
case 'module':
$this->currentcategory['contextid'] = $this->converter->get_contextid(CONTEXT_MODULE, $data['instance']);
$this->currentcategory['contextlevel'] = CONTEXT_MODULE;
$thi... | php | public function process_question_category_context($data) {
switch ($data['level']) {
case 'module':
$this->currentcategory['contextid'] = $this->converter->get_contextid(CONTEXT_MODULE, $data['instance']);
$this->currentcategory['contextlevel'] = CONTEXT_MODULE;
$thi... | [
"public",
"function",
"process_question_category_context",
"(",
"$",
"data",
")",
"{",
"switch",
"(",
"$",
"data",
"[",
"'level'",
"]",
")",
"{",
"case",
"'module'",
":",
"$",
"this",
"->",
"currentcategory",
"[",
"'contextid'",
"]",
"=",
"$",
"this",
"->"... | Inject the context related information into the current category | [
"Inject",
"the",
"context",
"related",
"information",
"into",
"the",
"current",
"category"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1131-L1160 |
214,031 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_question_bank_handler.get_qtype_handler | protected function get_qtype_handler($qtype) {
if (is_null($this->qtypehandlers)) {
// initialize the list of qtype handler instances
$this->qtypehandlers = array();
foreach (core_component::get_plugin_list('qtype') as $qtypename => $qtypelocation) {
$filenam... | php | protected function get_qtype_handler($qtype) {
if (is_null($this->qtypehandlers)) {
// initialize the list of qtype handler instances
$this->qtypehandlers = array();
foreach (core_component::get_plugin_list('qtype') as $qtypename => $qtypelocation) {
$filenam... | [
"protected",
"function",
"get_qtype_handler",
"(",
"$",
"qtype",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"qtypehandlers",
")",
")",
"{",
"// initialize the list of qtype handler instances",
"$",
"this",
"->",
"qtypehandlers",
"=",
"array",
"(",
"... | Provides access to the qtype handlers
Returns either list of all qtype handler instances (if passed '*') or a particular handler
for the given qtype or false if the qtype is not supported.
@throws moodle1_convert_exception
@param string $qtype the name of the question type or '*' for returning all
@return array|moodl... | [
"Provides",
"access",
"to",
"the",
"qtype",
"handlers"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1334-L1362 |
214,032 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_scales_handler.on_scales_start | public function on_scales_start() {
$syscontextid = $this->converter->get_contextid(CONTEXT_SYSTEM);
$this->fileman = $this->converter->get_file_manager($syscontextid, 'grade', 'scale');
} | php | public function on_scales_start() {
$syscontextid = $this->converter->get_contextid(CONTEXT_SYSTEM);
$this->fileman = $this->converter->get_file_manager($syscontextid, 'grade', 'scale');
} | [
"public",
"function",
"on_scales_start",
"(",
")",
"{",
"$",
"syscontextid",
"=",
"$",
"this",
"->",
"converter",
"->",
"get_contextid",
"(",
"CONTEXT_SYSTEM",
")",
";",
"$",
"this",
"->",
"fileman",
"=",
"$",
"this",
"->",
"converter",
"->",
"get_file_manag... | Prepare the file manager for the files embedded in the scale description field | [
"Prepare",
"the",
"file",
"manager",
"for",
"the",
"files",
"embedded",
"in",
"the",
"scale",
"description",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1397-L1400 |
214,033 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_outcomes_handler.on_gradebook_grade_outcomes_start | public function on_gradebook_grade_outcomes_start() {
$syscontextid = $this->converter->get_contextid(CONTEXT_SYSTEM);
$this->fileman = $this->converter->get_file_manager($syscontextid, 'grade', 'outcome');
$this->open_xml_writer('outcomes.xml');
$this->xmlwriter->begin_tag('outcomes_... | php | public function on_gradebook_grade_outcomes_start() {
$syscontextid = $this->converter->get_contextid(CONTEXT_SYSTEM);
$this->fileman = $this->converter->get_file_manager($syscontextid, 'grade', 'outcome');
$this->open_xml_writer('outcomes.xml');
$this->xmlwriter->begin_tag('outcomes_... | [
"public",
"function",
"on_gradebook_grade_outcomes_start",
"(",
")",
"{",
"$",
"syscontextid",
"=",
"$",
"this",
"->",
"converter",
"->",
"get_contextid",
"(",
"CONTEXT_SYSTEM",
")",
";",
"$",
"this",
"->",
"fileman",
"=",
"$",
"this",
"->",
"converter",
"->",... | Prepares the file manager and starts writing outcomes.xml | [
"Prepares",
"the",
"file",
"manager",
"and",
"starts",
"writing",
"outcomes",
".",
"xml"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1456-L1463 |
214,034 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_outcomes_handler.process_gradebook_grade_outcome | public function process_gradebook_grade_outcome(array $data, array $raw) {
global $CFG;
// replay the upgrade step 2009110400
if ($CFG->texteditors !== 'textarea') {
$data['description'] = text_to_html($data['description'], false, false, true);
$data['descriptionfo... | php | public function process_gradebook_grade_outcome(array $data, array $raw) {
global $CFG;
// replay the upgrade step 2009110400
if ($CFG->texteditors !== 'textarea') {
$data['description'] = text_to_html($data['description'], false, false, true);
$data['descriptionfo... | [
"public",
"function",
"process_gradebook_grade_outcome",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"raw",
")",
"{",
"global",
"$",
"CFG",
";",
"// replay the upgrade step 2009110400",
"if",
"(",
"$",
"CFG",
"->",
"texteditors",
"!==",
"'textarea'",
")",
"{",... | Processes GRADE_OUTCOME tags progressively | [
"Processes",
"GRADE_OUTCOME",
"tags",
"progressively"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1468-L1485 |
214,035 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_gradebook_handler.process_gradebook_grade_category | public function process_gradebook_grade_category(array $data, array $raw) {
$this->categoryparent[$data['id']] = $data['parent'];
$this->converter->set_stash('gradebook_gradecategory', $data, $data['id']);
} | php | public function process_gradebook_grade_category(array $data, array $raw) {
$this->categoryparent[$data['id']] = $data['parent'];
$this->converter->set_stash('gradebook_gradecategory', $data, $data['id']);
} | [
"public",
"function",
"process_gradebook_grade_category",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"raw",
")",
"{",
"$",
"this",
"->",
"categoryparent",
"[",
"$",
"data",
"[",
"'id'",
"]",
"]",
"=",
"$",
"data",
"[",
"'parent'",
"]",
";",
"$",
"th... | Processes one GRADE_CATEGORY data | [
"Processes",
"one",
"GRADE_CATEGORY",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1549-L1552 |
214,036 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_gradebook_handler.process_gradebook_grade_item | public function process_gradebook_grade_item(array $data, array $raw) {
// here we use get_nextid() to get a nondecreasing sequence
$data['sortorder'] = $this->converter->get_nextid();
if ($data['itemtype'] === 'mod') {
return $this->process_mod_grade_item($data, $raw);
} ... | php | public function process_gradebook_grade_item(array $data, array $raw) {
// here we use get_nextid() to get a nondecreasing sequence
$data['sortorder'] = $this->converter->get_nextid();
if ($data['itemtype'] === 'mod') {
return $this->process_mod_grade_item($data, $raw);
} ... | [
"public",
"function",
"process_gradebook_grade_item",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"raw",
")",
"{",
"// here we use get_nextid() to get a nondecreasing sequence",
"$",
"data",
"[",
"'sortorder'",
"]",
"=",
"$",
"this",
"->",
"converter",
"->",
"get_... | Processes one GRADE_ITEM data | [
"Processes",
"one",
"GRADE_ITEM",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1557-L1571 |
214,037 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_gradebook_handler.process_mod_grade_item | protected function process_mod_grade_item(array $data, array $raw) {
$stashname = 'gradebook_modgradeitem_'.$data['itemmodule'];
$stashitemid = $data['iteminstance'];
$gradeitems = $this->converter->get_stash_or_default($stashname, $stashitemid, array());
// typically there will be ... | php | protected function process_mod_grade_item(array $data, array $raw) {
$stashname = 'gradebook_modgradeitem_'.$data['itemmodule'];
$stashitemid = $data['iteminstance'];
$gradeitems = $this->converter->get_stash_or_default($stashname, $stashitemid, array());
// typically there will be ... | [
"protected",
"function",
"process_mod_grade_item",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"raw",
")",
"{",
"$",
"stashname",
"=",
"'gradebook_modgradeitem_'",
".",
"$",
"data",
"[",
"'itemmodule'",
"]",
";",
"$",
"stashitemid",
"=",
"$",
"data",
"[",
... | Processes one GRADE_ITEM of the type 'mod' | [
"Processes",
"one",
"GRADE_ITEM",
"of",
"the",
"type",
"mod"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1576-L1588 |
214,038 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_gradebook_handler.process_nonmod_grade_item | protected function process_nonmod_grade_item(array $data, array $raw) {
$stashname = 'gradebook_nonmodgradeitem';
$stashitemid = $data['id'];
$this->converter->set_stash($stashname, $data, $stashitemid);
return $data;
} | php | protected function process_nonmod_grade_item(array $data, array $raw) {
$stashname = 'gradebook_nonmodgradeitem';
$stashitemid = $data['id'];
$this->converter->set_stash($stashname, $data, $stashitemid);
return $data;
} | [
"protected",
"function",
"process_nonmod_grade_item",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"raw",
")",
"{",
"$",
"stashname",
"=",
"'gradebook_nonmodgradeitem'",
";",
"$",
"stashitemid",
"=",
"$",
"data",
"[",
"'id'",
"]",
";",
"$",
"this",
"->",
... | Processes one GRADE_ITEM of te type 'manual' or 'course' or 'category' | [
"Processes",
"one",
"GRADE_ITEM",
"of",
"te",
"type",
"manual",
"or",
"course",
"or",
"category"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1593-L1600 |
214,039 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_gradebook_handler.on_gradebook_end | public function on_gradebook_end() {
$this->open_xml_writer('gradebook.xml');
$this->xmlwriter->begin_tag('gradebook');
$this->write_grade_categories();
$this->write_grade_items();
$this->write_grade_letters();
$this->xmlwriter->end_tag('gradebook');
$this->close... | php | public function on_gradebook_end() {
$this->open_xml_writer('gradebook.xml');
$this->xmlwriter->begin_tag('gradebook');
$this->write_grade_categories();
$this->write_grade_items();
$this->write_grade_letters();
$this->xmlwriter->end_tag('gradebook');
$this->close... | [
"public",
"function",
"on_gradebook_end",
"(",
")",
"{",
"$",
"this",
"->",
"open_xml_writer",
"(",
"'gradebook.xml'",
")",
";",
"$",
"this",
"->",
"xmlwriter",
"->",
"begin_tag",
"(",
"'gradebook'",
")",
";",
"$",
"this",
"->",
"write_grade_categories",
"(",
... | Writes the collected information into gradebook.xml | [
"Writes",
"the",
"collected",
"information",
"into",
"gradebook",
".",
"xml"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1611-L1620 |
214,040 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_gradebook_handler.calculate_category_path | protected function calculate_category_path($categoryid) {
if (!array_key_exists($categoryid, $this->categoryparent)) {
throw new moodle1_convert_exception('gradebook_unknown_categoryid', null, $categoryid);
}
$path = array($categoryid);
$parent = $this->categoryparent[$cate... | php | protected function calculate_category_path($categoryid) {
if (!array_key_exists($categoryid, $this->categoryparent)) {
throw new moodle1_convert_exception('gradebook_unknown_categoryid', null, $categoryid);
}
$path = array($categoryid);
$parent = $this->categoryparent[$cate... | [
"protected",
"function",
"calculate_category_path",
"(",
"$",
"categoryid",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"categoryid",
",",
"$",
"this",
"->",
"categoryparent",
")",
")",
"{",
"throw",
"new",
"moodle1_convert_exception",
"(",
"'gradebo... | Calculates the path to the grade_category
Moodle 1.9 backup does not store the grade_category's depth and path. This method is used
to repopulate this information using the $this->categoryparent values.
@param int $categoryid
@return array of ids including the categoryid | [
"Calculates",
"the",
"path",
"to",
"the",
"grade_category"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1647-L1664 |
214,041 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_qtype_handler.write_answers | protected function write_answers(array $answers, $qtype) {
$this->xmlwriter->begin_tag('answers');
foreach ($answers as $elementname => $elements) {
foreach ($elements as $element) {
$answer = $this->convert_answer($element, $qtype);
// Migrate images in answ... | php | protected function write_answers(array $answers, $qtype) {
$this->xmlwriter->begin_tag('answers');
foreach ($answers as $elementname => $elements) {
foreach ($elements as $element) {
$answer = $this->convert_answer($element, $qtype);
// Migrate images in answ... | [
"protected",
"function",
"write_answers",
"(",
"array",
"$",
"answers",
",",
"$",
"qtype",
")",
"{",
"$",
"this",
"->",
"xmlwriter",
"->",
"begin_tag",
"(",
"'answers'",
")",
";",
"foreach",
"(",
"$",
"answers",
"as",
"$",
"elementname",
"=>",
"$",
"elem... | Converts the answers and writes them into the questions.xml
The structure "answers" is used by several qtypes. It contains data from {question_answers} table.
@param array $answers as parsed by the grouped parser in moodle.xml
@param string $qtype containing the answers | [
"Converts",
"the",
"answers",
"and",
"writes",
"them",
"into",
"the",
"questions",
".",
"xml"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1763-L1781 |
214,042 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_qtype_handler.migrate_files | protected function migrate_files($text, $component, $filearea, $itemid) {
$context = $this->qbankhandler->get_current_category_context();
$fileman = $this->qbankhandler->get_file_manager();
$fileman->contextid = $context['contextid'];
$fileman->component = $component;
$fileman->f... | php | protected function migrate_files($text, $component, $filearea, $itemid) {
$context = $this->qbankhandler->get_current_category_context();
$fileman = $this->qbankhandler->get_file_manager();
$fileman->contextid = $context['contextid'];
$fileman->component = $component;
$fileman->f... | [
"protected",
"function",
"migrate_files",
"(",
"$",
"text",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemid",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"qbankhandler",
"->",
"get_current_category_context",
"(",
")",
";",
"$",
"filema... | Migrate files belonging to one qtype plugin text field.
@param array $text the html fragment containing references to files
@param string $component the component for restored files
@param string $filearea the file area for restored files
@param int $itemid the itemid for restored files
@return string the text for th... | [
"Migrate",
"files",
"belonging",
"to",
"one",
"qtype",
"plugin",
"text",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1793-L1802 |
214,043 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_qtype_handler.write_numerical_units | protected function write_numerical_units(array $numericalunits) {
$this->xmlwriter->begin_tag('numerical_units');
foreach ($numericalunits as $elementname => $elements) {
foreach ($elements as $element) {
$element['id'] = $this->converter->get_nextid();
$this... | php | protected function write_numerical_units(array $numericalunits) {
$this->xmlwriter->begin_tag('numerical_units');
foreach ($numericalunits as $elementname => $elements) {
foreach ($elements as $element) {
$element['id'] = $this->converter->get_nextid();
$this... | [
"protected",
"function",
"write_numerical_units",
"(",
"array",
"$",
"numericalunits",
")",
"{",
"$",
"this",
"->",
"xmlwriter",
"->",
"begin_tag",
"(",
"'numerical_units'",
")",
";",
"foreach",
"(",
"$",
"numericalunits",
"as",
"$",
"elementname",
"=>",
"$",
... | Writes the grouped numerical_units structure
@param array $numericalunits | [
"Writes",
"the",
"grouped",
"numerical_units",
"structure"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1809-L1819 |
214,044 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_qtype_handler.write_numerical_options | protected function write_numerical_options(array $numericaloption) {
$this->xmlwriter->begin_tag('numerical_options');
if (!empty($numericaloption)) {
$this->write_xml('numerical_option', $numericaloption, array('/numerical_option/id'));
}
$this->xmlwriter->end_tag('numerica... | php | protected function write_numerical_options(array $numericaloption) {
$this->xmlwriter->begin_tag('numerical_options');
if (!empty($numericaloption)) {
$this->write_xml('numerical_option', $numericaloption, array('/numerical_option/id'));
}
$this->xmlwriter->end_tag('numerica... | [
"protected",
"function",
"write_numerical_options",
"(",
"array",
"$",
"numericaloption",
")",
"{",
"$",
"this",
"->",
"xmlwriter",
"->",
"begin_tag",
"(",
"'numerical_options'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"numericaloption",
")",
")",
"{",
... | Writes the numerical_options structure
@see get_default_numerical_options()
@param array $numericaloption | [
"Writes",
"the",
"numerical_options",
"structure"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1827-L1834 |
214,045 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_qtype_handler.get_default_numerical_options | protected function get_default_numerical_options($oldquestiontextformat, $units) {
global $CFG;
// replay the upgrade step 2009100100 - new table
$options = array(
'id' => $this->converter->get_nextid(),
'instructions' => null,
'instruct... | php | protected function get_default_numerical_options($oldquestiontextformat, $units) {
global $CFG;
// replay the upgrade step 2009100100 - new table
$options = array(
'id' => $this->converter->get_nextid(),
'instructions' => null,
'instruct... | [
"protected",
"function",
"get_default_numerical_options",
"(",
"$",
"oldquestiontextformat",
",",
"$",
"units",
")",
"{",
"global",
"$",
"CFG",
";",
"// replay the upgrade step 2009100100 - new table",
"$",
"options",
"=",
"array",
"(",
"'id'",
"=>",
"$",
"this",
"-... | Returns default numerical_option structure
This structure is not present in moodle.xml, we create a new artificial one here.
@see write_numerical_options()
@param int $oldquestiontextformat
@return array | [
"Returns",
"default",
"numerical_option",
"structure"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1845-L1872 |
214,046 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_qtype_handler.write_dataset_definitions | protected function write_dataset_definitions(array $datasetdefinitions) {
$this->xmlwriter->begin_tag('dataset_definitions');
foreach ($datasetdefinitions as $datasetdefinition) {
$this->xmlwriter->begin_tag('dataset_definition', array('id' => $this->converter->get_nextid()));
f... | php | protected function write_dataset_definitions(array $datasetdefinitions) {
$this->xmlwriter->begin_tag('dataset_definitions');
foreach ($datasetdefinitions as $datasetdefinition) {
$this->xmlwriter->begin_tag('dataset_definition', array('id' => $this->converter->get_nextid()));
f... | [
"protected",
"function",
"write_dataset_definitions",
"(",
"array",
"$",
"datasetdefinitions",
")",
"{",
"$",
"this",
"->",
"xmlwriter",
"->",
"begin_tag",
"(",
"'dataset_definitions'",
")",
";",
"foreach",
"(",
"$",
"datasetdefinitions",
"as",
"$",
"datasetdefiniti... | Writes the dataset_definitions structure
@param array $datasetdefinitions array of dataset_definition structures | [
"Writes",
"the",
"dataset_definitions",
"structure"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L1879-L1898 |
214,047 | moodle/moodle | backup/converter/moodle1/handlerlib.php | moodle1_mod_handler.get_cminfo | protected function get_cminfo($instance, $modname = null) {
if (is_null($modname)) {
$modname = $this->pluginname;
}
return $this->converter->get_stash('cminfo_'.$modname, $instance);
} | php | protected function get_cminfo($instance, $modname = null) {
if (is_null($modname)) {
$modname = $this->pluginname;
}
return $this->converter->get_stash('cminfo_'.$modname, $instance);
} | [
"protected",
"function",
"get_cminfo",
"(",
"$",
"instance",
",",
"$",
"modname",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"modname",
")",
")",
"{",
"$",
"modname",
"=",
"$",
"this",
"->",
"pluginname",
";",
"}",
"return",
"$",
"this",
... | Returns course module information for the given instance id
The information for this instance id has been stashed by
{@link moodle1_course_outline_handler::process_course_module()}
@param int $instance the module instance id
@param string $modname the module type, defaults to $this->pluginname
@return int | [
"Returns",
"course",
"module",
"information",
"for",
"the",
"given",
"instance",
"id"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/converter/moodle1/handlerlib.php#L2005-L2011 |
214,048 | moodle/moodle | blocks/rss_client/classes/task/refreshfeeds.php | refreshfeeds.execute | public function execute() {
global $CFG, $DB;
require_once("{$CFG->libdir}/simplepie/moodle_simplepie.php");
// We are going to measure execution times.
$starttime = microtime();
$starttimesec = time();
// Fetch all site feeds.
$rs = $DB->get_recordset('block_rs... | php | public function execute() {
global $CFG, $DB;
require_once("{$CFG->libdir}/simplepie/moodle_simplepie.php");
// We are going to measure execution times.
$starttime = microtime();
$starttimesec = time();
// Fetch all site feeds.
$rs = $DB->get_recordset('block_rs... | [
"public",
"function",
"execute",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"\"{$CFG->libdir}/simplepie/moodle_simplepie.php\"",
")",
";",
"// We are going to measure execution times.",
"$",
"starttime",
"=",
"microtime",
"(",
")",
... | This task goes through all the feeds. If the feed has a skipuntil value
that is less than the current time cron will attempt to retrieve it
with the cache duration set to 0 in order to force the retrieval of
the item and refresh the cache.
If a feed fails then the skipuntil time of that feed is set to be
later than th... | [
"This",
"task",
"goes",
"through",
"all",
"the",
"feeds",
".",
"If",
"the",
"feed",
"has",
"a",
"skipuntil",
"value",
"that",
"is",
"less",
"than",
"the",
"current",
"time",
"cron",
"will",
"attempt",
"to",
"retrieve",
"it",
"with",
"the",
"cache",
"dura... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/rss_client/classes/task/refreshfeeds.php#L69-L114 |
214,049 | moodle/moodle | blocks/rss_client/classes/task/refreshfeeds.php | refreshfeeds.fetch_feed | protected function fetch_feed(string $url) : \moodle_simplepie {
// Fetch the rss feed, using standard simplepie caching so feeds will be renewed only if cache has expired.
\core_php_time_limit::raise(60);
$feed = new \moodle_simplepie();
// Set timeout for longer than normal to be agr... | php | protected function fetch_feed(string $url) : \moodle_simplepie {
// Fetch the rss feed, using standard simplepie caching so feeds will be renewed only if cache has expired.
\core_php_time_limit::raise(60);
$feed = new \moodle_simplepie();
// Set timeout for longer than normal to be agr... | [
"protected",
"function",
"fetch_feed",
"(",
"string",
"$",
"url",
")",
":",
"\\",
"moodle_simplepie",
"{",
"// Fetch the rss feed, using standard simplepie caching so feeds will be renewed only if cache has expired.",
"\\",
"core_php_time_limit",
"::",
"raise",
"(",
"60",
")",
... | Fetch a feed for the specified URL.
@param string $url The URL to fetch
@return \moodle_simplepie | [
"Fetch",
"a",
"feed",
"for",
"the",
"specified",
"URL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/rss_client/classes/task/refreshfeeds.php#L122-L135 |
214,050 | moodle/moodle | blocks/rss_client/classes/task/refreshfeeds.php | refreshfeeds.calculate_skiptime | protected function calculate_skiptime(int $currentskip) : int {
// If the feed has never failed, then the initial skiptime will be 0. We use a default of 5 minutes in this case.
// If the feed has previously failed then we double that time.
$newskiptime = max(MINSECS * 5, ($currentskip * 2));
... | php | protected function calculate_skiptime(int $currentskip) : int {
// If the feed has never failed, then the initial skiptime will be 0. We use a default of 5 minutes in this case.
// If the feed has previously failed then we double that time.
$newskiptime = max(MINSECS * 5, ($currentskip * 2));
... | [
"protected",
"function",
"calculate_skiptime",
"(",
"int",
"$",
"currentskip",
")",
":",
"int",
"{",
"// If the feed has never failed, then the initial skiptime will be 0. We use a default of 5 minutes in this case.",
"// If the feed has previously failed then we double that time.",
"$",
... | Calculates a new skip time for a record based on the current skip time.
@param int $currentskip The current skip time of a record.
@return int The newly calculated skip time. | [
"Calculates",
"a",
"new",
"skip",
"time",
"for",
"a",
"record",
"based",
"on",
"the",
"current",
"skip",
"time",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/rss_client/classes/task/refreshfeeds.php#L143-L150 |
214,051 | moodle/moodle | calendar/externallib.php | core_calendar_external.delete_calendar_events | public static function delete_calendar_events($events) {
global $DB;
// Parameter validation.
$params = self::validate_parameters(self:: delete_calendar_events_parameters(), array('events' => $events));
$transaction = $DB->start_delegated_transaction();
foreach ($params['event... | php | public static function delete_calendar_events($events) {
global $DB;
// Parameter validation.
$params = self::validate_parameters(self:: delete_calendar_events_parameters(), array('events' => $events));
$transaction = $DB->start_delegated_transaction();
foreach ($params['event... | [
"public",
"static",
"function",
"delete_calendar_events",
"(",
"$",
"events",
")",
"{",
"global",
"$",
"DB",
";",
"// Parameter validation.",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"delete_calendar_events_parameters",
"(",
")",
... | Delete Calendar events
@param array $eventids A list of event ids with repeat flag to delete
@return null
@since Moodle 2.5 | [
"Delete",
"Calendar",
"events"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/externallib.php#L82-L105 |
214,052 | moodle/moodle | calendar/externallib.php | core_calendar_external.get_calendar_action_events_by_timesort | public static function get_calendar_action_events_by_timesort($timesortfrom = 0, $timesortto = null,
$aftereventid = 0, $limitnum = 20, $limittononsuspendedevents = false,
$userid = null) {
global $PAGE... | php | public static function get_calendar_action_events_by_timesort($timesortfrom = 0, $timesortto = null,
$aftereventid = 0, $limitnum = 20, $limittononsuspendedevents = false,
$userid = null) {
global $PAGE... | [
"public",
"static",
"function",
"get_calendar_action_events_by_timesort",
"(",
"$",
"timesortfrom",
"=",
"0",
",",
"$",
"timesortto",
"=",
"null",
",",
"$",
"aftereventid",
"=",
"0",
",",
"$",
"limitnum",
"=",
"20",
",",
"$",
"limittononsuspendedevents",
"=",
... | Get calendar action events based on the timesort value.
@since Moodle 3.3
@param null|int $timesortfrom Events after this time (inclusive)
@param null|int $timesortto Events before this time (inclusive)
@param null|int $aftereventid Get events with ids greater than this one
@param int $limitnum Limit the number of res... | [
"Get",
"calendar",
"action",
"events",
"based",
"on",
"the",
"timesort",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/externallib.php#L425-L468 |
214,053 | moodle/moodle | calendar/externallib.php | core_calendar_external.get_calendar_action_events_by_course | public static function get_calendar_action_events_by_course(
$courseid, $timesortfrom = null, $timesortto = null, $aftereventid = 0, $limitnum = 20) {
global $PAGE, $USER;
$user = null;
$params = self::validate_parameters(
self::get_calendar_action_events_by_course_paramete... | php | public static function get_calendar_action_events_by_course(
$courseid, $timesortfrom = null, $timesortto = null, $aftereventid = 0, $limitnum = 20) {
global $PAGE, $USER;
$user = null;
$params = self::validate_parameters(
self::get_calendar_action_events_by_course_paramete... | [
"public",
"static",
"function",
"get_calendar_action_events_by_course",
"(",
"$",
"courseid",
",",
"$",
"timesortfrom",
"=",
"null",
",",
"$",
"timesortto",
"=",
"null",
",",
"$",
"aftereventid",
"=",
"0",
",",
"$",
"limitnum",
"=",
"20",
")",
"{",
"global",... | Get calendar action events for the given course.
@since Moodle 3.3
@param int $courseid Only events in this course
@param null|int $timesortfrom Events after this time (inclusive)
@param null|int $timesortto Events before this time (inclusive)
@param null|int $aftereventid Get events with ids greater than this one
@pa... | [
"Get",
"calendar",
"action",
"events",
"for",
"the",
"given",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/externallib.php#L508-L552 |
214,054 | moodle/moodle | calendar/externallib.php | core_calendar_external.get_calendar_action_events_by_courses | public static function get_calendar_action_events_by_courses(
array $courseids, $timesortfrom = null, $timesortto = null, $limitnum = 10) {
global $PAGE, $USER;
$user = null;
$params = self::validate_parameters(
self::get_calendar_action_events_by_courses_parameters(),
... | php | public static function get_calendar_action_events_by_courses(
array $courseids, $timesortfrom = null, $timesortto = null, $limitnum = 10) {
global $PAGE, $USER;
$user = null;
$params = self::validate_parameters(
self::get_calendar_action_events_by_courses_parameters(),
... | [
"public",
"static",
"function",
"get_calendar_action_events_by_courses",
"(",
"array",
"$",
"courseids",
",",
"$",
"timesortfrom",
"=",
"null",
",",
"$",
"timesortto",
"=",
"null",
",",
"$",
"limitnum",
"=",
"10",
")",
"{",
"global",
"$",
"PAGE",
",",
"$",
... | Get calendar action events for a given list of courses.
@since Moodle 3.3
@param array $courseids Only include events for these courses
@param null|int $timesortfrom Events after this time (inclusive)
@param null|int $timesortto Events before this time (inclusive)
@param int $limitnum Limit the number of results per c... | [
"Get",
"calendar",
"action",
"events",
"for",
"a",
"given",
"list",
"of",
"courses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/externallib.php#L591-L636 |
214,055 | moodle/moodle | calendar/externallib.php | core_calendar_external.create_calendar_events | public static function create_calendar_events($events) {
global $DB, $USER;
// Parameter validation.
$params = self::validate_parameters(self::create_calendar_events_parameters(), array('events' => $events));
$transaction = $DB->start_delegated_transaction();
$return = array();... | php | public static function create_calendar_events($events) {
global $DB, $USER;
// Parameter validation.
$params = self::validate_parameters(self::create_calendar_events_parameters(), array('events' => $events));
$transaction = $DB->start_delegated_transaction();
$return = array();... | [
"public",
"static",
"function",
"create_calendar_events",
"(",
"$",
"events",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"// Parameter validation.",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"create_calendar_events_para... | Delete Calendar events.
@param array $events A list of events to create.
@return array array of events created.
@since Moodle 2.5
@throws moodle_exception if user doesnt have the permission to create events. | [
"Delete",
"Calendar",
"events",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/externallib.php#L686-L734 |
214,056 | moodle/moodle | calendar/externallib.php | core_calendar_external.get_calendar_event_by_id | public static function get_calendar_event_by_id($eventid) {
global $PAGE, $USER;
$params = self::validate_parameters(self::get_calendar_event_by_id_parameters(), ['eventid' => $eventid]);
$context = \context_user::instance($USER->id);
self::validate_context($context);
$warnings... | php | public static function get_calendar_event_by_id($eventid) {
global $PAGE, $USER;
$params = self::validate_parameters(self::get_calendar_event_by_id_parameters(), ['eventid' => $eventid]);
$context = \context_user::instance($USER->id);
self::validate_context($context);
$warnings... | [
"public",
"static",
"function",
"get_calendar_event_by_id",
"(",
"$",
"eventid",
")",
"{",
"global",
"$",
"PAGE",
",",
"$",
"USER",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_calendar_event_by_id_parameters",
"(",
")",
... | Get calendar event by id.
@param int $eventid The calendar event id to be retrieved.
@return array Array of event details | [
"Get",
"calendar",
"event",
"by",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/externallib.php#L791-L824 |
214,057 | moodle/moodle | calendar/externallib.php | core_calendar_external.get_calendar_day_view | public static function get_calendar_day_view($year, $month, $day, $courseid, $categoryid) {
global $DB, $USER, $PAGE;
// Parameter validation.
$params = self::validate_parameters(self::get_calendar_day_view_parameters(), [
'year' => $year,
'month' => $month,
... | php | public static function get_calendar_day_view($year, $month, $day, $courseid, $categoryid) {
global $DB, $USER, $PAGE;
// Parameter validation.
$params = self::validate_parameters(self::get_calendar_day_view_parameters(), [
'year' => $year,
'month' => $month,
... | [
"public",
"static",
"function",
"get_calendar_day_view",
"(",
"$",
"year",
",",
"$",
"month",
",",
"$",
"day",
",",
"$",
"courseid",
",",
"$",
"categoryid",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
",",
"$",
"PAGE",
";",
"// Parameter validation.... | Get data for the daily calendar view.
@param int $year The year to be shown
@param int $month The month to be shown
@param int $day The day to be shown
@param int $courseid The course to be included
@return array | [
"Get",
"data",
"for",
"the",
"daily",
"calendar",
"view",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/externallib.php#L1064-L1088 |
214,058 | moodle/moodle | calendar/externallib.php | core_calendar_external.update_event_start_day | public static function update_event_start_day($eventid, $daytimestamp) {
global $USER, $PAGE;
// Parameter validation.
$params = self::validate_parameters(self::update_event_start_day_parameters(), [
'eventid' => $eventid,
'daytimestamp' => $daytimestamp,
]);
... | php | public static function update_event_start_day($eventid, $daytimestamp) {
global $USER, $PAGE;
// Parameter validation.
$params = self::validate_parameters(self::update_event_start_day_parameters(), [
'eventid' => $eventid,
'daytimestamp' => $daytimestamp,
]);
... | [
"public",
"static",
"function",
"update_event_start_day",
"(",
"$",
"eventid",
",",
"$",
"daytimestamp",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"PAGE",
";",
"// Parameter validation.",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"... | Change the start day for the given calendar event to the day that
corresponds with the provided timestamp.
The timestamp only needs to be anytime within the desired day as only
the date data is extracted from it.
The event's original time of day is maintained, only the date is shifted.
@param int $eventid Id of even... | [
"Change",
"the",
"start",
"day",
"for",
"the",
"given",
"calendar",
"event",
"to",
"the",
"day",
"that",
"corresponds",
"with",
"the",
"provided",
"timestamp",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/externallib.php#L1144-L1182 |
214,059 | moodle/moodle | calendar/externallib.php | core_calendar_external.get_calendar_access_information | public static function get_calendar_access_information($courseid = 0) {
$params = self::validate_parameters(self::get_calendar_access_information_parameters(), ['courseid' => $courseid]);
if (empty($params['courseid']) || $params['courseid'] == SITEID) {
$context = \context_system::instanc... | php | public static function get_calendar_access_information($courseid = 0) {
$params = self::validate_parameters(self::get_calendar_access_information_parameters(), ['courseid' => $courseid]);
if (empty($params['courseid']) || $params['courseid'] == SITEID) {
$context = \context_system::instanc... | [
"public",
"static",
"function",
"get_calendar_access_information",
"(",
"$",
"courseid",
"=",
"0",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_calendar_access_information_parameters",
"(",
")",
",",
"[",
"'courseid'",
... | Convenience function to retrieve some permissions information for the given course calendar.
@param int $courseid Course to check, empty for site.
@return array The access information
@throws moodle_exception
@since Moodle 3.7 | [
"Convenience",
"function",
"to",
"retrieve",
"some",
"permissions",
"information",
"for",
"the",
"given",
"course",
"calendar",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/externallib.php#L1271-L1289 |
214,060 | moodle/moodle | calendar/externallib.php | core_calendar_external.get_allowed_event_types | public static function get_allowed_event_types($courseid = 0) {
$params = self::validate_parameters(self::get_allowed_event_types_parameters(), ['courseid' => $courseid]);
if (empty($params['courseid']) || $params['courseid'] == SITEID) {
$context = \context_system::instance();
} e... | php | public static function get_allowed_event_types($courseid = 0) {
$params = self::validate_parameters(self::get_allowed_event_types_parameters(), ['courseid' => $courseid]);
if (empty($params['courseid']) || $params['courseid'] == SITEID) {
$context = \context_system::instance();
} e... | [
"public",
"static",
"function",
"get_allowed_event_types",
"(",
"$",
"courseid",
"=",
"0",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_allowed_event_types_parameters",
"(",
")",
",",
"[",
"'courseid'",
"=>",
"$",
... | Get the type of events a user can create in the given course.
@param int $courseid Course to check, empty for site.
@return array The types allowed
@throws moodle_exception
@since Moodle 3.7 | [
"Get",
"the",
"type",
"of",
"events",
"a",
"user",
"can",
"create",
"in",
"the",
"given",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/externallib.php#L1331-L1349 |
214,061 | moodle/moodle | mod/assign/feedback/editpdf/classes/comments_quick_list.php | comments_quick_list.get_comments | public static function get_comments() {
global $DB, $USER;
$comments = array();
$records = $DB->get_records('assignfeedback_editpdf_quick', array('userid'=>$USER->id));
return $records;
} | php | public static function get_comments() {
global $DB, $USER;
$comments = array();
$records = $DB->get_records('assignfeedback_editpdf_quick', array('userid'=>$USER->id));
return $records;
} | [
"public",
"static",
"function",
"get_comments",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"comments",
"=",
"array",
"(",
")",
";",
"$",
"records",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"'assignfeedback_editpdf_quick'",
",",
"arr... | Get all comments for the current user.
@return array(comment) | [
"Get",
"all",
"comments",
"for",
"the",
"current",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/classes/comments_quick_list.php#L41-L48 |
214,062 | moodle/moodle | mod/assign/feedback/editpdf/classes/comments_quick_list.php | comments_quick_list.add_comment | public static function add_comment($commenttext, $width, $colour) {
global $DB, $USER;
$comment = new \stdClass();
$comment->userid = $USER->id;
$comment->rawtext = $commenttext;
$comment->width = $width;
$comment->colour = $colour;
$comment->id = $DB->insert_re... | php | public static function add_comment($commenttext, $width, $colour) {
global $DB, $USER;
$comment = new \stdClass();
$comment->userid = $USER->id;
$comment->rawtext = $commenttext;
$comment->width = $width;
$comment->colour = $colour;
$comment->id = $DB->insert_re... | [
"public",
"static",
"function",
"add_comment",
"(",
"$",
"commenttext",
",",
"$",
"width",
",",
"$",
"colour",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"comment",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"comment",
"->",
... | Add a comment to the quick list.
@param string $commenttext
@param int $width
@param string $colour
@return stdClass - the comment record (with new id set) | [
"Add",
"a",
"comment",
"to",
"the",
"quick",
"list",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/classes/comments_quick_list.php#L57-L68 |
214,063 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Base/Mailbox.php | Horde_Imap_Client_Base_Mailbox.getStatus | public function getStatus($entry)
{
if (isset($this->_status[$entry])) {
return $this->_status[$entry];
}
switch ($entry) {
case Horde_Imap_Client::STATUS_FLAGS:
case Horde_Imap_Client::STATUS_SYNCFLAGUIDS:
case Horde_Imap_Client::STATUS_SYNCVANISHED:
... | php | public function getStatus($entry)
{
if (isset($this->_status[$entry])) {
return $this->_status[$entry];
}
switch ($entry) {
case Horde_Imap_Client::STATUS_FLAGS:
case Horde_Imap_Client::STATUS_SYNCFLAGUIDS:
case Horde_Imap_Client::STATUS_SYNCVANISHED:
... | [
"public",
"function",
"getStatus",
"(",
"$",
"entry",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_status",
"[",
"$",
"entry",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_status",
"[",
"$",
"entry",
"]",
";",
"}",
"switch",
"(",... | Get status information for the mailbox.
@param integer $entry STATUS_* constant.
@return mixed Status information. | [
"Get",
"status",
"information",
"for",
"the",
"mailbox",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Base/Mailbox.php#L74-L121 |
214,064 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Base/Mailbox.php | Horde_Imap_Client_Base_Mailbox.setStatus | public function setStatus($entry, $value)
{
switch ($entry) {
case Horde_Imap_Client::STATUS_FIRSTUNSEEN:
case Horde_Imap_Client::STATUS_HIGHESTMODSEQ:
case Horde_Imap_Client::STATUS_MESSAGES:
case Horde_Imap_Client::STATUS_UNSEEN:
case Horde_Imap_Client::STATUS_UIDNE... | php | public function setStatus($entry, $value)
{
switch ($entry) {
case Horde_Imap_Client::STATUS_FIRSTUNSEEN:
case Horde_Imap_Client::STATUS_HIGHESTMODSEQ:
case Horde_Imap_Client::STATUS_MESSAGES:
case Horde_Imap_Client::STATUS_UNSEEN:
case Horde_Imap_Client::STATUS_UIDNE... | [
"public",
"function",
"setStatus",
"(",
"$",
"entry",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"entry",
")",
"{",
"case",
"Horde_Imap_Client",
"::",
"STATUS_FIRSTUNSEEN",
":",
"case",
"Horde_Imap_Client",
"::",
"STATUS_HIGHESTMODSEQ",
":",
"case",
"Hor... | Set status information for the mailbox.
@param integer $entry STATUS_* constant.
@param mixed $value Status information. | [
"Set",
"status",
"information",
"for",
"the",
"mailbox",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Base/Mailbox.php#L129-L166 |
214,065 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Base/Mailbox.php | Horde_Imap_Client_Base_Mailbox.reset | public function reset()
{
$keep = array(
Horde_Imap_Client::STATUS_SYNCFLAGUIDS,
Horde_Imap_Client::STATUS_SYNCMODSEQ,
Horde_Imap_Client::STATUS_SYNCVANISHED
);
foreach (array_diff(array_keys($this->_status), $keep) as $val) {
unset($this->_st... | php | public function reset()
{
$keep = array(
Horde_Imap_Client::STATUS_SYNCFLAGUIDS,
Horde_Imap_Client::STATUS_SYNCMODSEQ,
Horde_Imap_Client::STATUS_SYNCVANISHED
);
foreach (array_diff(array_keys($this->_status), $keep) as $val) {
unset($this->_st... | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"keep",
"=",
"array",
"(",
"Horde_Imap_Client",
"::",
"STATUS_SYNCFLAGUIDS",
",",
"Horde_Imap_Client",
"::",
"STATUS_SYNCMODSEQ",
",",
"Horde_Imap_Client",
"::",
"STATUS_SYNCVANISHED",
")",
";",
"foreach",
"(",
"a... | Reset the mailbox information. | [
"Reset",
"the",
"mailbox",
"information",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Base/Mailbox.php#L171-L185 |
214,066 | moodle/moodle | lib/ltiprovider/src/ToolProvider/User.php | User.getResourceLink | public function getResourceLink()
{
if (is_null($this->resourceLink) && !is_null($this->resourceLinkId)) {
$this->resourceLink = ResourceLink::fromRecordId($this->resourceLinkId, $this->getDataConnector());
}
return $this->resourceLink;
} | php | public function getResourceLink()
{
if (is_null($this->resourceLink) && !is_null($this->resourceLinkId)) {
$this->resourceLink = ResourceLink::fromRecordId($this->resourceLinkId, $this->getDataConnector());
}
return $this->resourceLink;
} | [
"public",
"function",
"getResourceLink",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"resourceLink",
")",
"&&",
"!",
"is_null",
"(",
"$",
"this",
"->",
"resourceLinkId",
")",
")",
"{",
"$",
"this",
"->",
"resourceLink",
"=",
"ResourceLin... | Get resource link.
@return ResourceLink Resource link object | [
"Get",
"resource",
"link",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ltiprovider/src/ToolProvider/User.php#L188-L197 |
214,067 | moodle/moodle | lib/ltiprovider/src/ToolProvider/User.php | User.fromResourceLink | public static function fromResourceLink($resourceLink, $ltiUserId)
{
$user = new User();
$user->resourceLink = $resourceLink;
if (!is_null($resourceLink)) {
$user->resourceLinkId = $resourceLink->getRecordId();
$user->dataConnector = $resourceLink->getDataConnector()... | php | public static function fromResourceLink($resourceLink, $ltiUserId)
{
$user = new User();
$user->resourceLink = $resourceLink;
if (!is_null($resourceLink)) {
$user->resourceLinkId = $resourceLink->getRecordId();
$user->dataConnector = $resourceLink->getDataConnector()... | [
"public",
"static",
"function",
"fromResourceLink",
"(",
"$",
"resourceLink",
",",
"$",
"ltiUserId",
")",
"{",
"$",
"user",
"=",
"new",
"User",
"(",
")",
";",
"$",
"user",
"->",
"resourceLink",
"=",
"$",
"resourceLink",
";",
"if",
"(",
"!",
"is_null",
... | Class constructor from resource link.
@param ResourceLink $resourceLink Resource_Link object
@param string $ltiUserId User ID value
@return User | [
"Class",
"constructor",
"from",
"resource",
"link",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ltiprovider/src/ToolProvider/User.php#L413-L429 |
214,068 | moodle/moodle | lib/ltiprovider/src/ToolProvider/User.php | User.hasRole | private function hasRole($role) {
if (substr($role, 0, 4) !== 'urn:')
{
$role = 'urn:lti:role:ims/lis/' . $role;
}
return in_array($role, $this->roles);
} | php | private function hasRole($role) {
if (substr($role, 0, 4) !== 'urn:')
{
$role = 'urn:lti:role:ims/lis/' . $role;
}
return in_array($role, $this->roles);
} | [
"private",
"function",
"hasRole",
"(",
"$",
"role",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"role",
",",
"0",
",",
"4",
")",
"!==",
"'urn:'",
")",
"{",
"$",
"role",
"=",
"'urn:lti:role:ims/lis/'",
".",
"$",
"role",
";",
"}",
"return",
"in_array",
... | Check whether the user has a specified role name.
@param string $role Name of role
@return boolean True if the user has the specified role | [
"Check",
"whether",
"the",
"user",
"has",
"a",
"specified",
"role",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ltiprovider/src/ToolProvider/User.php#L442-L451 |
214,069 | moodle/moodle | lib/horde/framework/Horde/Support/ConsistentHash.php | Horde_Support_ConsistentHash.addNodes | public function addNodes($nodes, $weight = 1)
{
foreach ($nodes as $node) {
$this->_nodes[] = array('n' => $node, 'w' => $weight);
$this->_nodeCount++;
$nodeIndex = $this->_nodeCount - 1;
$nodeString = serialize($node);
$numberOfReplicas = (int)(... | php | public function addNodes($nodes, $weight = 1)
{
foreach ($nodes as $node) {
$this->_nodes[] = array('n' => $node, 'w' => $weight);
$this->_nodeCount++;
$nodeIndex = $this->_nodeCount - 1;
$nodeString = serialize($node);
$numberOfReplicas = (int)(... | [
"public",
"function",
"addNodes",
"(",
"$",
"nodes",
",",
"$",
"weight",
"=",
"1",
")",
"{",
"foreach",
"(",
"$",
"nodes",
"as",
"$",
"node",
")",
"{",
"$",
"this",
"->",
"_nodes",
"[",
"]",
"=",
"array",
"(",
"'n'",
"=>",
"$",
"node",
",",
"'w... | Add multiple nodes to the hash with the same weight.
@param array $nodes An array of nodes.
@param integer $weight The weight to add the nodes with. | [
"Add",
"multiple",
"nodes",
"to",
"the",
"hash",
"with",
"the",
"same",
"weight",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/ConsistentHash.php#L166-L182 |
214,070 | moodle/moodle | lib/horde/framework/Horde/Support/ConsistentHash.php | Horde_Support_ConsistentHash._updateCircle | protected function _updateCircle()
{
// Sort the circle
ksort($this->_circle);
// Now that the hashes are sorted, generate numeric indices into the
// circle.
$this->_pointMap = array_keys($this->_circle);
$this->_pointCount = count($this->_pointMap);
} | php | protected function _updateCircle()
{
// Sort the circle
ksort($this->_circle);
// Now that the hashes are sorted, generate numeric indices into the
// circle.
$this->_pointMap = array_keys($this->_circle);
$this->_pointCount = count($this->_pointMap);
} | [
"protected",
"function",
"_updateCircle",
"(",
")",
"{",
"// Sort the circle",
"ksort",
"(",
"$",
"this",
"->",
"_circle",
")",
";",
"// Now that the hashes are sorted, generate numeric indices into the",
"// circle.",
"$",
"this",
"->",
"_pointMap",
"=",
"array_keys",
... | Maintain the circle and arrays of points. | [
"Maintain",
"the",
"circle",
"and",
"arrays",
"of",
"points",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/ConsistentHash.php#L233-L242 |
214,071 | moodle/moodle | blocks/tag_youtube/block_tag_youtube.php | block_tag_youtube.fetch_request | public function fetch_request($request) {
throw new coding_exception('Sorry, this function has been deprecated in Moodle 2.8.8, 2.9.2 and 3.0. Use block_tag_youtube::get_service instead.');
$c = new curl(array('cache' => true, 'module_cache'=>'tag_youtube'));
$c->setopt(array('CURLOPT_TIMEOUT' ... | php | public function fetch_request($request) {
throw new coding_exception('Sorry, this function has been deprecated in Moodle 2.8.8, 2.9.2 and 3.0. Use block_tag_youtube::get_service instead.');
$c = new curl(array('cache' => true, 'module_cache'=>'tag_youtube'));
$c->setopt(array('CURLOPT_TIMEOUT' ... | [
"public",
"function",
"fetch_request",
"(",
"$",
"request",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Sorry, this function has been deprecated in Moodle 2.8.8, 2.9.2 and 3.0. Use block_tag_youtube::get_service instead.'",
")",
";",
"$",
"c",
"=",
"new",
"curl",
"("... | Sends a request to fetch data.
@see block_tag_youtube::service
@deprecated since Moodle 2.8.8, 2.9.2 and 3.0 MDL-49085 - please do not use this function any more.
@param string $request
@throws coding_exception | [
"Sends",
"a",
"request",
"to",
"fetch",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/tag_youtube/block_tag_youtube.php#L217-L227 |
214,072 | moodle/moodle | blocks/tag_youtube/block_tag_youtube.php | block_tag_youtube.get_error_message | protected function get_error_message($message = null) {
global $OUTPUT;
if (empty($message)) {
$message = get_string('apierror', 'block_tag_youtube');
}
return $OUTPUT->notification($message);
} | php | protected function get_error_message($message = null) {
global $OUTPUT;
if (empty($message)) {
$message = get_string('apierror', 'block_tag_youtube');
}
return $OUTPUT->notification($message);
} | [
"protected",
"function",
"get_error_message",
"(",
"$",
"message",
"=",
"null",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"empty",
"(",
"$",
"message",
")",
")",
"{",
"$",
"message",
"=",
"get_string",
"(",
"'apierror'",
",",
"'block_tag_youtube'"... | Returns an error message.
Useful when the block is not properly set or something goes wrong.
@param string $message The message to display.
@return string HTML | [
"Returns",
"an",
"error",
"message",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/tag_youtube/block_tag_youtube.php#L249-L256 |
214,073 | moodle/moodle | blocks/tag_youtube/block_tag_youtube.php | block_tag_youtube.get_service | protected function get_service() {
global $CFG;
if (!$apikey = get_config('block_tag_youtube', 'apikey')) {
return false;
}
// Wrapped in an if in case we call different get_videos_* multiple times.
if (!isset($this->service)) {
require_once($CFG->libdir... | php | protected function get_service() {
global $CFG;
if (!$apikey = get_config('block_tag_youtube', 'apikey')) {
return false;
}
// Wrapped in an if in case we call different get_videos_* multiple times.
if (!isset($this->service)) {
require_once($CFG->libdir... | [
"protected",
"function",
"get_service",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"$",
"apikey",
"=",
"get_config",
"(",
"'block_tag_youtube'",
",",
"'apikey'",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Wrapped in an if in case we call di... | Gets the youtube service object.
@return Google_Service_YouTube | [
"Gets",
"the",
"youtube",
"service",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/tag_youtube/block_tag_youtube.php#L263-L280 |
214,074 | moodle/moodle | blocks/tag_youtube/block_tag_youtube.php | block_tag_youtube.render_items | protected function render_items($videosdata) {
if (!$videosdata || empty($videosdata->items)) {
if (!empty($videosdata->error)) {
debugging('Error fetching data from youtube: ' . $videosdata->error->message, DEBUG_DEVELOPER);
}
return '';
}
/... | php | protected function render_items($videosdata) {
if (!$videosdata || empty($videosdata->items)) {
if (!empty($videosdata->error)) {
debugging('Error fetching data from youtube: ' . $videosdata->error->message, DEBUG_DEVELOPER);
}
return '';
}
/... | [
"protected",
"function",
"render_items",
"(",
"$",
"videosdata",
")",
"{",
"if",
"(",
"!",
"$",
"videosdata",
"||",
"empty",
"(",
"$",
"videosdata",
"->",
"items",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"videosdata",
"->",
"error",
")",
")... | Renders the list of items.
@param array $videosdata
@return string HTML | [
"Renders",
"the",
"list",
"of",
"items",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/tag_youtube/block_tag_youtube.php#L288-L342 |
214,075 | moodle/moodle | competency/classes/template_competency.php | template_competency.count_templates | public static function count_templates($competencyid, $onlyvisible) {
global $DB;
$sql = 'SELECT COUNT(tpl.id)
FROM {' . self::TABLE . '} tplcomp
JOIN {' . template::TABLE . '} tpl
ON tplcomp.templateid = tpl.id
WHERE tplcomp.comp... | php | public static function count_templates($competencyid, $onlyvisible) {
global $DB;
$sql = 'SELECT COUNT(tpl.id)
FROM {' . self::TABLE . '} tplcomp
JOIN {' . template::TABLE . '} tpl
ON tplcomp.templateid = tpl.id
WHERE tplcomp.comp... | [
"public",
"static",
"function",
"count_templates",
"(",
"$",
"competencyid",
",",
"$",
"onlyvisible",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"'SELECT COUNT(tpl.id)\n FROM {'",
".",
"self",
"::",
"TABLE",
".",
"'} tplcomp\n ... | Count the templates using a competency.
@param int $competencyid The competency id
@param bool $onlyvisible If true, only count visible templates using this competency.
@return int | [
"Count",
"the",
"templates",
"using",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/template_competency.php#L68-L86 |
214,076 | moodle/moodle | competency/classes/template_competency.php | template_competency.list_templates | public static function list_templates($competencyid, $onlyvisible) {
global $DB;
$sql = 'SELECT tpl.*
FROM {' . template::TABLE . '} tpl
JOIN {' . self::TABLE . '} tplcomp
ON tplcomp.templateid = tpl.id
WHERE tplcomp.competencyid ... | php | public static function list_templates($competencyid, $onlyvisible) {
global $DB;
$sql = 'SELECT tpl.*
FROM {' . template::TABLE . '} tpl
JOIN {' . self::TABLE . '} tplcomp
ON tplcomp.templateid = tpl.id
WHERE tplcomp.competencyid ... | [
"public",
"static",
"function",
"list_templates",
"(",
"$",
"competencyid",
",",
"$",
"onlyvisible",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"'SELECT tpl.*\n FROM {'",
".",
"template",
"::",
"TABLE",
".",
"'} tpl\n JOIN... | List the templates using a competency.
@param int $competencyid The competency id
@param bool $onlyvisible If true, only count visible templates using this competency.
@return array[competency] | [
"List",
"the",
"templates",
"using",
"a",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/template_competency.php#L95-L120 |
214,077 | moodle/moodle | competency/classes/template_competency.php | template_competency.count_competencies_with_no_courses | public static function count_competencies_with_no_courses($templateid) {
global $DB;
$sql = 'SELECT COUNT(comp.id)
FROM {' . self::TABLE . '} tplcomp
JOIN {' . competency::TABLE . '} comp
ON tplcomp.competencyid = comp.id
LEFT JO... | php | public static function count_competencies_with_no_courses($templateid) {
global $DB;
$sql = 'SELECT COUNT(comp.id)
FROM {' . self::TABLE . '} tplcomp
JOIN {' . competency::TABLE . '} comp
ON tplcomp.competencyid = comp.id
LEFT JO... | [
"public",
"static",
"function",
"count_competencies_with_no_courses",
"(",
"$",
"templateid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"'SELECT COUNT(comp.id)\n FROM {'",
".",
"self",
"::",
"TABLE",
".",
"'} tplcomp\n JOIN {'"... | Count the competencies in a template with no links to courses.
@param int $templateid The template id
@return int | [
"Count",
"the",
"competencies",
"in",
"a",
"template",
"with",
"no",
"links",
"to",
"courses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/template_competency.php#L149-L164 |
214,078 | moodle/moodle | competency/classes/template_competency.php | template_competency.list_competencies | public static function list_competencies($templateid) {
global $DB;
$sql = 'SELECT comp.*
FROM {' . competency::TABLE . '} comp
JOIN {' . self::TABLE . '} tplcomp
ON tplcomp.competencyid = comp.id
WHERE tplcomp.templateid = ?
... | php | public static function list_competencies($templateid) {
global $DB;
$sql = 'SELECT comp.*
FROM {' . competency::TABLE . '} comp
JOIN {' . self::TABLE . '} tplcomp
ON tplcomp.competencyid = comp.id
WHERE tplcomp.templateid = ?
... | [
"public",
"static",
"function",
"list_competencies",
"(",
"$",
"templateid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"'SELECT comp.*\n FROM {'",
".",
"competency",
"::",
"TABLE",
".",
"'} comp\n JOIN {'",
".",
"self",
"... | List the competencies in this template.
@param int $templateid The template id
@return array[competency] | [
"List",
"the",
"competencies",
"in",
"this",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/template_competency.php#L197-L217 |
214,079 | moodle/moodle | admin/tool/policy/classes/event/acceptance_base.php | acceptance_base.create_from_record | public static function create_from_record($record) {
$event = static::create([
'objectid' => $record->id,
'relateduserid' => $record->userid,
'context' => \context_user::instance($record->userid),
'other' => [
'policyversionid' => $record->policyve... | php | public static function create_from_record($record) {
$event = static::create([
'objectid' => $record->id,
'relateduserid' => $record->userid,
'context' => \context_user::instance($record->userid),
'other' => [
'policyversionid' => $record->policyve... | [
"public",
"static",
"function",
"create_from_record",
"(",
"$",
"record",
")",
"{",
"$",
"event",
"=",
"static",
"::",
"create",
"(",
"[",
"'objectid'",
"=>",
"$",
"record",
"->",
"id",
",",
"'relateduserid'",
"=>",
"$",
"record",
"->",
"userid",
",",
"'... | Create event from record.
@param stdClass $record
@return acceptance_created | [
"Create",
"event",
"from",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/event/acceptance_base.php#L54-L67 |
214,080 | moodle/moodle | lib/google/src/Google/Http/CacheParser.php | Google_Http_CacheParser.isRequestCacheable | public static function isRequestCacheable(Google_Http_Request $resp)
{
$method = $resp->getRequestMethod();
if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) {
return false;
}
// Don't cache authorized requests/responses.
// [rfc2616-14.8] When a shared cache receives a request contai... | php | public static function isRequestCacheable(Google_Http_Request $resp)
{
$method = $resp->getRequestMethod();
if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) {
return false;
}
// Don't cache authorized requests/responses.
// [rfc2616-14.8] When a shared cache receives a request contai... | [
"public",
"static",
"function",
"isRequestCacheable",
"(",
"Google_Http_Request",
"$",
"resp",
")",
"{",
"$",
"method",
"=",
"$",
"resp",
"->",
"getRequestMethod",
"(",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"method",
",",
"self",
"::",
"$",
"CA... | Check if an HTTP request can be cached by a private local cache.
@static
@param Google_Http_Request $resp
@return bool True if the request is cacheable.
False if the request is uncacheable. | [
"Check",
"if",
"an",
"HTTP",
"request",
"can",
"be",
"cached",
"by",
"a",
"private",
"local",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Http/CacheParser.php#L39-L55 |
214,081 | moodle/moodle | lib/google/src/Google/Http/CacheParser.php | Google_Http_CacheParser.isResponseCacheable | public static function isResponseCacheable(Google_Http_Request $resp)
{
// First, check if the HTTP request was cacheable before inspecting the
// HTTP response.
if (false == self::isRequestCacheable($resp)) {
return false;
}
$code = $resp->getResponseHttpCode();
if (! in_array($code, s... | php | public static function isResponseCacheable(Google_Http_Request $resp)
{
// First, check if the HTTP request was cacheable before inspecting the
// HTTP response.
if (false == self::isRequestCacheable($resp)) {
return false;
}
$code = $resp->getResponseHttpCode();
if (! in_array($code, s... | [
"public",
"static",
"function",
"isResponseCacheable",
"(",
"Google_Http_Request",
"$",
"resp",
")",
"{",
"// First, check if the HTTP request was cacheable before inspecting the",
"// HTTP response.",
"if",
"(",
"false",
"==",
"self",
"::",
"isRequestCacheable",
"(",
"$",
... | Check if an HTTP response can be cached by a private local cache.
@static
@param Google_Http_Request $resp
@return bool True if the response is cacheable.
False if the response is un-cacheable. | [
"Check",
"if",
"an",
"HTTP",
"response",
"can",
"be",
"cached",
"by",
"a",
"private",
"local",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Http/CacheParser.php#L65-L109 |
214,082 | moodle/moodle | search/classes/base_activity.php | base_activity.get_document_recordset | public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
global $DB;
list ($contextjoin, $contextparams) = $this->get_context_restriction_sql(
$context, $this->get_module_name(), 'modtable');
if ($contextjoin === null) {
return null;
... | php | public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
global $DB;
list ($contextjoin, $contextparams) = $this->get_context_restriction_sql(
$context, $this->get_module_name(), 'modtable');
if ($contextjoin === null) {
return null;
... | [
"public",
"function",
"get_document_recordset",
"(",
"$",
"modifiedfrom",
"=",
"0",
",",
"\\",
"context",
"$",
"context",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"contextjoin",
",",
"$",
"contextparams",
")",
"=",
"$",
"this",
... | Returns recordset containing all activities within the given context.
@param \context|null $context Context
@param int $modifiedfrom Return only records modified after this date
@return \moodle_recordset|null Recordset, or null if no possible activities in given context | [
"Returns",
"recordset",
"containing",
"all",
"activities",
"within",
"the",
"given",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/base_activity.php#L64-L75 |
214,083 | moodle/moodle | search/classes/base_activity.php | base_activity.get_context_url | public function get_context_url(\core_search\document $doc) {
$cminfo = $this->get_cm($this->get_module_name(), strval($doc->get('itemid')), $doc->get('courseid'));
return new \moodle_url('/mod/' . $this->get_module_name() . '/view.php', array('id' => $cminfo->id));
} | php | public function get_context_url(\core_search\document $doc) {
$cminfo = $this->get_cm($this->get_module_name(), strval($doc->get('itemid')), $doc->get('courseid'));
return new \moodle_url('/mod/' . $this->get_module_name() . '/view.php', array('id' => $cminfo->id));
} | [
"public",
"function",
"get_context_url",
"(",
"\\",
"core_search",
"\\",
"document",
"$",
"doc",
")",
"{",
"$",
"cminfo",
"=",
"$",
"this",
"->",
"get_cm",
"(",
"$",
"this",
"->",
"get_module_name",
"(",
")",
",",
"strval",
"(",
"$",
"doc",
"->",
"get"... | Link to the module instance.
@param \core_search\document $doc
@return \moodle_url | [
"Link",
"to",
"the",
"module",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/base_activity.php#L170-L173 |
214,084 | moodle/moodle | search/classes/base_activity.php | base_activity.get_activity | protected function get_activity($instanceid) {
global $DB;
if (empty($this->activitiesdata[$this->get_module_name()][$instanceid])) {
$this->activitiesdata[$this->get_module_name()][$instanceid] = $DB->get_record($this->get_module_name(),
array('id' => $instanceid), '*', MUS... | php | protected function get_activity($instanceid) {
global $DB;
if (empty($this->activitiesdata[$this->get_module_name()][$instanceid])) {
$this->activitiesdata[$this->get_module_name()][$instanceid] = $DB->get_record($this->get_module_name(),
array('id' => $instanceid), '*', MUS... | [
"protected",
"function",
"get_activity",
"(",
"$",
"instanceid",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"activitiesdata",
"[",
"$",
"this",
"->",
"get_module_name",
"(",
")",
"]",
"[",
"$",
"instanceid",
"]",
")... | Returns an activity instance. Internally uses the class component to know which activity module should be retrieved.
@param int $instanceid
@return stdClass | [
"Returns",
"an",
"activity",
"instance",
".",
"Internally",
"uses",
"the",
"class",
"component",
"to",
"know",
"which",
"activity",
"module",
"should",
"be",
"retrieved",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/base_activity.php#L181-L190 |
214,085 | moodle/moodle | mod/data/classes/event/record_updated.php | record_updated.get_legacy_logdata | public function get_legacy_logdata() {
return array($this->courseid, 'data', 'update', 'view.php?d=' . $this->other['dataid'] . '&rid=' . $this->objectid,
$this->other['dataid'], $this->contextinstanceid);
} | php | public function get_legacy_logdata() {
return array($this->courseid, 'data', 'update', 'view.php?d=' . $this->other['dataid'] . '&rid=' . $this->objectid,
$this->other['dataid'], $this->contextinstanceid);
} | [
"public",
"function",
"get_legacy_logdata",
"(",
")",
"{",
"return",
"array",
"(",
"$",
"this",
"->",
"courseid",
",",
"'data'",
",",
"'update'",
",",
"'view.php?d='",
".",
"$",
"this",
"->",
"other",
"[",
"'dataid'",
"]",
".",
"'&rid='",
".",
"$",
"... | Get the legacy event log data.
@return array | [
"Get",
"the",
"legacy",
"event",
"log",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/classes/event/record_updated.php#L89-L92 |
214,086 | moodle/moodle | lib/classes/plugininfo/repository.php | repository.is_uninstall_allowed | public function is_uninstall_allowed() {
if ($this->name === 'upload' || $this->name === 'coursefiles' || $this->name === 'user' || $this->name === 'recent') {
return false;
} else {
return true;
}
} | php | public function is_uninstall_allowed() {
if ($this->name === 'upload' || $this->name === 'coursefiles' || $this->name === 'user' || $this->name === 'recent') {
return false;
} else {
return true;
}
} | [
"public",
"function",
"is_uninstall_allowed",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"name",
"===",
"'upload'",
"||",
"$",
"this",
"->",
"name",
"===",
"'coursefiles'",
"||",
"$",
"this",
"->",
"name",
"===",
"'user'",
"||",
"$",
"this",
"->",
"n... | Defines if there should be a way to uninstall the plugin via the administration UI.
@return boolean | [
"Defines",
"if",
"there",
"should",
"be",
"a",
"way",
"to",
"uninstall",
"the",
"plugin",
"via",
"the",
"administration",
"UI",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/plugininfo/repository.php#L75-L81 |
214,087 | moodle/moodle | lib/classes/plugininfo/repository.php | repository.uninstall_cleanup | public function uninstall_cleanup() {
global $CFG;
require_once($CFG->dirroot.'/repository/lib.php');
$repo = \repository::get_type_by_typename($this->name);
if ($repo) {
$repo->delete(true);
}
parent::uninstall_cleanup();
} | php | public function uninstall_cleanup() {
global $CFG;
require_once($CFG->dirroot.'/repository/lib.php');
$repo = \repository::get_type_by_typename($this->name);
if ($repo) {
$repo->delete(true);
}
parent::uninstall_cleanup();
} | [
"public",
"function",
"uninstall_cleanup",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/repository/lib.php'",
")",
";",
"$",
"repo",
"=",
"\\",
"repository",
"::",
"get_type_by_typename",
"(",
"$",
"this... | Pre-uninstall hook.
This is intended for disabling of plugin, some DB table purging, etc.
Converts all linked files to standard files when repository is removed
and cleans up all records in the DB for that repository. | [
"Pre",
"-",
"uninstall",
"hook",
".",
"This",
"is",
"intended",
"for",
"disabling",
"of",
"plugin",
"some",
"DB",
"table",
"purging",
"etc",
".",
"Converts",
"all",
"linked",
"files",
"to",
"standard",
"files",
"when",
"repository",
"is",
"removed",
"and",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/plugininfo/repository.php#L89-L99 |
214,088 | moodle/moodle | enrol/lti/ims-blti/blti.php | BLTI.decodeBase64 | function decodeBase64($info) {
$keysNoEncode = array("lti_version", "lti_message_type", "tool_consumer_instance_description", "tool_consumer_instance_guid", "oauth_consumer_key", "custom_lti_message_encoded_base64", "oauth_nonce", "oauth_version", "oauth_callback", "oauth_timestamp", "basiclti_submit", "oauth_... | php | function decodeBase64($info) {
$keysNoEncode = array("lti_version", "lti_message_type", "tool_consumer_instance_description", "tool_consumer_instance_guid", "oauth_consumer_key", "custom_lti_message_encoded_base64", "oauth_nonce", "oauth_version", "oauth_callback", "oauth_timestamp", "basiclti_submit", "oauth_... | [
"function",
"decodeBase64",
"(",
"$",
"info",
")",
"{",
"$",
"keysNoEncode",
"=",
"array",
"(",
"\"lti_version\"",
",",
"\"lti_message_type\"",
",",
"\"tool_consumer_instance_description\"",
",",
"\"tool_consumer_instance_guid\"",
",",
"\"oauth_consumer_key\"",
",",
"\"cu... | Data submitter are in base64 then we have to decode
@author Antoni Bertran (antoni@tresipunt.com)
@param $info array
@date 20120801 | [
"Data",
"submitter",
"are",
"in",
"base64",
"then",
"we",
"have",
"to",
"decode"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/ims-blti/blti.php#L267-L274 |
214,089 | moodle/moodle | mod/forum/classes/post_form.php | mod_forum_post_form.attachment_options | public static function attachment_options($forum) {
global $COURSE, $PAGE, $CFG;
$maxbytes = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $COURSE->maxbytes, $forum->maxbytes);
return array(
'subdirs' => 0,
'maxbytes' => $maxbytes,
'maxfiles' =... | php | public static function attachment_options($forum) {
global $COURSE, $PAGE, $CFG;
$maxbytes = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $COURSE->maxbytes, $forum->maxbytes);
return array(
'subdirs' => 0,
'maxbytes' => $maxbytes,
'maxfiles' =... | [
"public",
"static",
"function",
"attachment_options",
"(",
"$",
"forum",
")",
"{",
"global",
"$",
"COURSE",
",",
"$",
"PAGE",
",",
"$",
"CFG",
";",
"$",
"maxbytes",
"=",
"get_user_max_upload_file_size",
"(",
"$",
"PAGE",
"->",
"context",
",",
"$",
"CFG",
... | Returns the options array to use in filemanager for forum attachments
@param stdClass $forum
@return array | [
"Returns",
"the",
"options",
"array",
"to",
"use",
"in",
"filemanager",
"for",
"forum",
"attachments"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/post_form.php#L45-L55 |
214,090 | moodle/moodle | mod/forum/classes/post_form.php | mod_forum_post_form.editor_options | public static function editor_options(context_module $context, $postid) {
global $COURSE, $PAGE, $CFG;
// TODO: add max files and max size support
$maxbytes = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $COURSE->maxbytes);
return array(
'maxfiles' => EDITOR_... | php | public static function editor_options(context_module $context, $postid) {
global $COURSE, $PAGE, $CFG;
// TODO: add max files and max size support
$maxbytes = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $COURSE->maxbytes);
return array(
'maxfiles' => EDITOR_... | [
"public",
"static",
"function",
"editor_options",
"(",
"context_module",
"$",
"context",
",",
"$",
"postid",
")",
"{",
"global",
"$",
"COURSE",
",",
"$",
"PAGE",
",",
"$",
"CFG",
";",
"// TODO: add max files and max size support",
"$",
"maxbytes",
"=",
"get_user... | Returns the options array to use in forum text editor
@param context_module $context
@param int $postid post id, use null when adding new post
@return array | [
"Returns",
"the",
"options",
"array",
"to",
"use",
"in",
"forum",
"text",
"editor"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/post_form.php#L64-L75 |
214,091 | moodle/moodle | admin/roles/classes/preset.php | core_role_preset.send_export_xml | public static function send_export_xml($roleid) {
global $CFG, $DB;
require_once($CFG->libdir . '/filelib.php');
$role = $DB->get_record('role', array('id'=>$roleid), '*', MUST_EXIST);
if ($role->shortname) {
$filename = $role->shortname.'.xml';
} else {
... | php | public static function send_export_xml($roleid) {
global $CFG, $DB;
require_once($CFG->libdir . '/filelib.php');
$role = $DB->get_record('role', array('id'=>$roleid), '*', MUST_EXIST);
if ($role->shortname) {
$filename = $role->shortname.'.xml';
} else {
... | [
"public",
"static",
"function",
"send_export_xml",
"(",
"$",
"roleid",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/filelib.php'",
")",
";",
"$",
"role",
"=",
"$",
"DB",
"->",
"get_record... | Send role export xml file to browser.
@param int $roleid
@return void does not return, send the file to output | [
"Send",
"role",
"export",
"xml",
"file",
"to",
"browser",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/roles/classes/preset.php#L42-L56 |
214,092 | moodle/moodle | admin/roles/classes/preset.php | core_role_preset.is_valid_preset | public static function is_valid_preset($xml) {
$dom = new DOMDocument();
if (!$dom->loadXML($xml)) {
return false;
} else {
$val = @$dom->schemaValidate(__DIR__.'/../role_schema.xml');
if (!$val) {
return false;
}
}
... | php | public static function is_valid_preset($xml) {
$dom = new DOMDocument();
if (!$dom->loadXML($xml)) {
return false;
} else {
$val = @$dom->schemaValidate(__DIR__.'/../role_schema.xml');
if (!$val) {
return false;
}
}
... | [
"public",
"static",
"function",
"is_valid_preset",
"(",
"$",
"xml",
")",
"{",
"$",
"dom",
"=",
"new",
"DOMDocument",
"(",
")",
";",
"if",
"(",
"!",
"$",
"dom",
"->",
"loadXML",
"(",
"$",
"xml",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
... | Is this XML valid role preset?
@param string $xml
@return bool | [
"Is",
"this",
"XML",
"valid",
"role",
"preset?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/roles/classes/preset.php#L141-L152 |
214,093 | moodle/moodle | lib/php-css-parser/Rule/Rule.php | Rule.addValue | public function addValue($mValue, $sType = ' ') {
if (!is_array($mValue)) {
$mValue = array($mValue);
}
if (!$this->mValue instanceof RuleValueList || $this->mValue->getListSeparator() !== $sType) {
$mCurrentValue = $this->mValue;
$this->mValue = new RuleValueList($sType, $this->iLineNo);
if ($mCurren... | php | public function addValue($mValue, $sType = ' ') {
if (!is_array($mValue)) {
$mValue = array($mValue);
}
if (!$this->mValue instanceof RuleValueList || $this->mValue->getListSeparator() !== $sType) {
$mCurrentValue = $this->mValue;
$this->mValue = new RuleValueList($sType, $this->iLineNo);
if ($mCurren... | [
"public",
"function",
"addValue",
"(",
"$",
"mValue",
",",
"$",
"sType",
"=",
"' '",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"mValue",
")",
")",
"{",
"$",
"mValue",
"=",
"array",
"(",
"$",
"mValue",
")",
";",
"}",
"if",
"(",
"!",
"$",
... | Adds a value to the existing value. Value will be appended if a RuleValueList exists of the given type. Otherwise, the existing value will be wrapped by one. | [
"Adds",
"a",
"value",
"to",
"the",
"existing",
"value",
".",
"Value",
"will",
"be",
"appended",
"if",
"a",
"RuleValueList",
"exists",
"of",
"the",
"given",
"type",
".",
"Otherwise",
"the",
"existing",
"value",
"will",
"be",
"wrapped",
"by",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/php-css-parser/Rule/Rule.php#L119-L133 |
214,094 | moodle/moodle | admin/tool/mobile/classes/api.php | api.get_autologin_key | public static function get_autologin_key() {
global $USER;
// Delete previous keys.
delete_user_key('tool_mobile', $USER->id);
// Create a new key.
$iprestriction = getremoteaddr();
$validuntil = time() + self::LOGIN_KEY_TTL;
return create_user_key('tool_mobile',... | php | public static function get_autologin_key() {
global $USER;
// Delete previous keys.
delete_user_key('tool_mobile', $USER->id);
// Create a new key.
$iprestriction = getremoteaddr();
$validuntil = time() + self::LOGIN_KEY_TTL;
return create_user_key('tool_mobile',... | [
"public",
"static",
"function",
"get_autologin_key",
"(",
")",
"{",
"global",
"$",
"USER",
";",
"// Delete previous keys.",
"delete_user_key",
"(",
"'tool_mobile'",
",",
"$",
"USER",
"->",
"id",
")",
";",
"// Create a new key.",
"$",
"iprestriction",
"=",
"getremo... | Creates an auto-login key for the current user, this key is restricted by time and ip address.
@return string the key
@since Moodle 3.2 | [
"Creates",
"an",
"auto",
"-",
"login",
"key",
"for",
"the",
"current",
"user",
"this",
"key",
"is",
"restricted",
"by",
"time",
"and",
"ip",
"address",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/mobile/classes/api.php#L324-L333 |
214,095 | moodle/moodle | admin/tool/mobile/classes/api.php | api.get_potential_config_issues | public static function get_potential_config_issues() {
global $CFG;
require_once($CFG->dirroot . "/lib/filelib.php");
require_once($CFG->dirroot . '/message/lib.php');
$warnings = array();
$curl = new curl();
// Return certificate information and verify the certificate.... | php | public static function get_potential_config_issues() {
global $CFG;
require_once($CFG->dirroot . "/lib/filelib.php");
require_once($CFG->dirroot . '/message/lib.php');
$warnings = array();
$curl = new curl();
// Return certificate information and verify the certificate.... | [
"public",
"static",
"function",
"get_potential_config_issues",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"\"/lib/filelib.php\"",
")",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/message/... | This function check the current site for potential configuration issues that may prevent the mobile app to work.
@return array list of potential issues
@since Moodle 3.4 | [
"This",
"function",
"check",
"the",
"current",
"site",
"for",
"potential",
"configuration",
"issues",
"that",
"may",
"prevent",
"the",
"mobile",
"app",
"to",
"work",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/mobile/classes/api.php#L479-L554 |
214,096 | moodle/moodle | grade/report/singleview/classes/local/ui/checkbox_attribute.php | checkbox_attribute.html | public function html() {
$attributes = array(
'type' => 'checkbox',
'name' => $this->name,
'value' => 1,
'id' => $this->name
);
// UCSB fixed user should not be able to override locked grade.
if ( $this->locked) {
$attributes[... | php | public function html() {
$attributes = array(
'type' => 'checkbox',
'name' => $this->name,
'value' => 1,
'id' => $this->name
);
// UCSB fixed user should not be able to override locked grade.
if ( $this->locked) {
$attributes[... | [
"public",
"function",
"html",
"(",
")",
"{",
"$",
"attributes",
"=",
"array",
"(",
"'type'",
"=>",
"'checkbox'",
",",
"'name'",
"=>",
"$",
"this",
"->",
"name",
",",
"'value'",
"=>",
"1",
",",
"'id'",
"=>",
"$",
"this",
"->",
"name",
")",
";",
"// ... | Generate the HTML
@return string | [
"Generate",
"the",
"HTML"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/ui/checkbox_attribute.php#L69-L105 |
214,097 | moodle/moodle | course/format/topics/backup/moodle2/restore_format_topics_plugin.class.php | restore_format_topics_plugin.need_restore_numsections | protected function need_restore_numsections() {
$backupinfo = $this->step->get_task()->get_info();
$backuprelease = $backupinfo->backup_release;
return version_compare($backuprelease, '3.3', 'lt');
} | php | protected function need_restore_numsections() {
$backupinfo = $this->step->get_task()->get_info();
$backuprelease = $backupinfo->backup_release;
return version_compare($backuprelease, '3.3', 'lt');
} | [
"protected",
"function",
"need_restore_numsections",
"(",
")",
"{",
"$",
"backupinfo",
"=",
"$",
"this",
"->",
"step",
"->",
"get_task",
"(",
")",
"->",
"get_info",
"(",
")",
";",
"$",
"backuprelease",
"=",
"$",
"backupinfo",
"->",
"backup_release",
";",
"... | Checks if backup file was made on Moodle before 3.3 and we should respect the 'numsections'
and potential "orphaned" sections in the end of the course.
@return bool | [
"Checks",
"if",
"backup",
"file",
"was",
"made",
"on",
"Moodle",
"before",
"3",
".",
"3",
"and",
"we",
"should",
"respect",
"the",
"numsections",
"and",
"potential",
"orphaned",
"sections",
"in",
"the",
"end",
"of",
"the",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/topics/backup/moodle2/restore_format_topics_plugin.class.php#L49-L53 |
214,098 | moodle/moodle | auth/oauth2/classes/auth.php | auth.user_login | public function user_login($username, $password) {
$cached = $this->get_static_user_info();
if (empty($cached)) {
// This means we were called as part of a normal login flow - without using oauth.
return false;
}
$verifyusername = $cached['username'];
if (... | php | public function user_login($username, $password) {
$cached = $this->get_static_user_info();
if (empty($cached)) {
// This means we were called as part of a normal login flow - without using oauth.
return false;
}
$verifyusername = $cached['username'];
if (... | [
"public",
"function",
"user_login",
"(",
"$",
"username",
",",
"$",
"password",
")",
"{",
"$",
"cached",
"=",
"$",
"this",
"->",
"get_static_user_info",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"cached",
")",
")",
"{",
"// This means we were called as ... | Returns true if the username and password work or don't exist and false
if the user exists and the password is wrong.
@param string $username The username
@param string $password The password
@return bool Authentication success or failure. | [
"Returns",
"true",
"if",
"the",
"username",
"and",
"password",
"work",
"or",
"don",
"t",
"exist",
"and",
"false",
"if",
"the",
"user",
"exists",
"and",
"the",
"password",
"is",
"wrong",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/auth.php#L75-L86 |
214,099 | moodle/moodle | auth/oauth2/classes/auth.php | auth.get_userinfo | public function get_userinfo($username) {
$cached = $this->get_static_user_info();
if (!empty($cached) && $cached['username'] == $username) {
return $cached;
}
return false;
} | php | public function get_userinfo($username) {
$cached = $this->get_static_user_info();
if (!empty($cached) && $cached['username'] == $username) {
return $cached;
}
return false;
} | [
"public",
"function",
"get_userinfo",
"(",
"$",
"username",
")",
"{",
"$",
"cached",
"=",
"$",
"this",
"->",
"get_static_user_info",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"cached",
")",
"&&",
"$",
"cached",
"[",
"'username'",
"]",
"==",
"... | Return the userinfo from the oauth handshake. Will only be valid
for the logged in user.
@param string $username | [
"Return",
"the",
"userinfo",
"from",
"the",
"oauth",
"handshake",
".",
"Will",
"only",
"be",
"valid",
"for",
"the",
"logged",
"in",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/auth.php#L160-L166 |
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.