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,300 | moodle/moodle | grade/report/singleview/classes/local/ui/feedback.php | feedback.set | public function set($value) {
$finalgrade = false;
$trimmed = trim($value);
if (empty($trimmed)) {
$feedback = null;
} else {
$feedback = $value;
}
$this->grade->grade_item->update_final_grade(
$this->grade->userid, $finalgrade, 'singl... | php | public function set($value) {
$finalgrade = false;
$trimmed = trim($value);
if (empty($trimmed)) {
$feedback = null;
} else {
$feedback = $value;
}
$this->grade->grade_item->update_final_grade(
$this->grade->userid, $finalgrade, 'singl... | [
"public",
"function",
"set",
"(",
"$",
"value",
")",
"{",
"$",
"finalgrade",
"=",
"false",
";",
"$",
"trimmed",
"=",
"trim",
"(",
"$",
"value",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"trimmed",
")",
")",
"{",
"$",
"feedback",
"=",
"null",
";",
... | Update the value for this input.
@param string $value The new feedback value.
@return string Any error message | [
"Update",
"the",
"value",
"for",
"this",
"input",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/ui/feedback.php#L108-L121 |
214,301 | moodle/moodle | mod/feedback/classes/structure.php | mod_feedback_structure.get_items | public function get_items($hasvalueonly = false) {
global $DB;
if ($this->allitems === null) {
if ($this->templateid) {
$this->allitems = $DB->get_records('feedback_item', ['template' => $this->templateid], 'position');
} else {
$this->allitems = $... | php | public function get_items($hasvalueonly = false) {
global $DB;
if ($this->allitems === null) {
if ($this->templateid) {
$this->allitems = $DB->get_records('feedback_item', ['template' => $this->templateid], 'position');
} else {
$this->allitems = $... | [
"public",
"function",
"get_items",
"(",
"$",
"hasvalueonly",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"allitems",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"templateid",
")",
"{",
"$",
"this",
"->... | Get all items in this feedback or this template
@param bool $hasvalueonly only count items with a value.
@return array of objects from feedback_item with an additional attribute 'itemnr' | [
"Get",
"all",
"items",
"in",
"this",
"feedback",
"or",
"this",
"template"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/structure.php#L146-L165 |
214,302 | moodle/moodle | mod/feedback/classes/structure.php | mod_feedback_structure.is_empty | public function is_empty() {
$items = $this->get_items();
$displayeditems = array_filter($items, function($item) {
return $item->typ !== 'pagebreak';
});
return !$displayeditems;
} | php | public function is_empty() {
$items = $this->get_items();
$displayeditems = array_filter($items, function($item) {
return $item->typ !== 'pagebreak';
});
return !$displayeditems;
} | [
"public",
"function",
"is_empty",
"(",
")",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"get_items",
"(",
")",
";",
"$",
"displayeditems",
"=",
"array_filter",
"(",
"$",
"items",
",",
"function",
"(",
"$",
"item",
")",
"{",
"return",
"$",
"item",
"->"... | Is the items list empty?
@return bool | [
"Is",
"the",
"items",
"list",
"empty?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/structure.php#L171-L177 |
214,303 | moodle/moodle | mod/feedback/classes/structure.php | mod_feedback_structure.page_after_submit | public function page_after_submit() {
global $CFG;
require_once($CFG->libdir . '/filelib.php');
$pageaftersubmit = $this->get_feedback()->page_after_submit;
if (empty($pageaftersubmit)) {
return null;
}
$pageaftersubmitformat = $this->get_feedback()->page_aft... | php | public function page_after_submit() {
global $CFG;
require_once($CFG->libdir . '/filelib.php');
$pageaftersubmit = $this->get_feedback()->page_after_submit;
if (empty($pageaftersubmit)) {
return null;
}
$pageaftersubmitformat = $this->get_feedback()->page_aft... | [
"public",
"function",
"page_after_submit",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/filelib.php'",
")",
";",
"$",
"pageaftersubmit",
"=",
"$",
"this",
"->",
"get_feedback",
"(",
")",
"->",
"page_aft... | Returns the formatted text of the page after submit or null if it is not set
@return string|null | [
"Returns",
"the",
"formatted",
"text",
"of",
"the",
"page",
"after",
"submit",
"or",
"null",
"if",
"it",
"is",
"not",
"set"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/structure.php#L192-L207 |
214,304 | moodle/moodle | mod/feedback/classes/structure.php | mod_feedback_structure.can_view_analysis | public function can_view_analysis() {
global $USER;
$context = context_module::instance($this->cm->id);
if (has_capability('mod/feedback:viewreports', $context, $this->userid)) {
return true;
}
if (intval($this->get_feedback()->publish_stats) != 1 ||
... | php | public function can_view_analysis() {
global $USER;
$context = context_module::instance($this->cm->id);
if (has_capability('mod/feedback:viewreports', $context, $this->userid)) {
return true;
}
if (intval($this->get_feedback()->publish_stats) != 1 ||
... | [
"public",
"function",
"can_view_analysis",
"(",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"context",
"=",
"context_module",
"::",
"instance",
"(",
"$",
"this",
"->",
"cm",
"->",
"id",
")",
";",
"if",
"(",
"has_capability",
"(",
"'mod/feedback:viewreports'",... | Checks if current user is able to view feedback on this course.
@return bool | [
"Checks",
"if",
"current",
"user",
"is",
"able",
"to",
"view",
"feedback",
"on",
"this",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/structure.php#L214-L233 |
214,305 | moodle/moodle | mod/feedback/classes/structure.php | mod_feedback_structure.is_already_submitted | public function is_already_submitted($anycourseid = false) {
global $DB, $USER;
if ((!isloggedin() && $USER->id == $this->userid) || isguestuser($this->userid)) {
return false;
}
$params = array('userid' => $this->userid, 'feedback' => $this->feedback->id);
if (!$an... | php | public function is_already_submitted($anycourseid = false) {
global $DB, $USER;
if ((!isloggedin() && $USER->id == $this->userid) || isguestuser($this->userid)) {
return false;
}
$params = array('userid' => $this->userid, 'feedback' => $this->feedback->id);
if (!$an... | [
"public",
"function",
"is_already_submitted",
"(",
"$",
"anycourseid",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"if",
"(",
"(",
"!",
"isloggedin",
"(",
")",
"&&",
"$",
"USER",
"->",
"id",
"==",
"$",
"this",
"->",
"userid",
... | check for multiple_submit = false.
if the feedback is global so the courseid must be given
@param bool $anycourseid if true checks if this feedback was submitted in any course, otherwise checks $this->courseid .
Applicable to frontpage feedbacks only
@return bool true if the feedback already is submitted otherwise fal... | [
"check",
"for",
"multiple_submit",
"=",
"false",
".",
"if",
"the",
"feedback",
"is",
"global",
"so",
"the",
"courseid",
"must",
"be",
"given"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/structure.php#L243-L255 |
214,306 | moodle/moodle | mod/feedback/classes/structure.php | mod_feedback_structure.check_course_is_mapped | public function check_course_is_mapped() {
global $DB;
if ($this->feedback->course != SITEID) {
return true;
}
if ($DB->get_records('feedback_sitecourse_map', array('feedbackid' => $this->feedback->id))) {
$params = array('feedbackid' => $this->feedback->id, 'cour... | php | public function check_course_is_mapped() {
global $DB;
if ($this->feedback->course != SITEID) {
return true;
}
if ($DB->get_records('feedback_sitecourse_map', array('feedbackid' => $this->feedback->id))) {
$params = array('feedbackid' => $this->feedback->id, 'cour... | [
"public",
"function",
"check_course_is_mapped",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"feedback",
"->",
"course",
"!=",
"SITEID",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"DB",
"->",
"get_records",
"(",
"... | Check whether the feedback is mapped to the given courseid. | [
"Check",
"whether",
"the",
"feedback",
"is",
"mapped",
"to",
"the",
"given",
"courseid",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/structure.php#L260-L273 |
214,307 | moodle/moodle | mod/feedback/classes/structure.php | mod_feedback_structure.shuffle_anonym_responses | public function shuffle_anonym_responses() {
global $DB;
$params = array('feedback' => $this->feedback->id,
'random_response' => 0,
'anonymous_response' => FEEDBACK_ANONYMOUS_YES);
if ($DB->count_records('feedback_completed', $params, 'random_response')) {
//... | php | public function shuffle_anonym_responses() {
global $DB;
$params = array('feedback' => $this->feedback->id,
'random_response' => 0,
'anonymous_response' => FEEDBACK_ANONYMOUS_YES);
if ($DB->count_records('feedback_completed', $params, 'random_response')) {
//... | [
"public",
"function",
"shuffle_anonym_responses",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
"=",
"array",
"(",
"'feedback'",
"=>",
"$",
"this",
"->",
"feedback",
"->",
"id",
",",
"'random_response'",
"=>",
"0",
",",
"'anonymous_response'",
"=>"... | If there are any new responses to the anonymous feedback, re-shuffle all
responses and assign response number to each of them. | [
"If",
"there",
"are",
"any",
"new",
"responses",
"to",
"the",
"anonymous",
"feedback",
"re",
"-",
"shuffle",
"all",
"responses",
"and",
"assign",
"response",
"number",
"to",
"each",
"of",
"them",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/structure.php#L279-L296 |
214,308 | moodle/moodle | mod/feedback/classes/structure.php | mod_feedback_structure.get_completed_courses | public function get_completed_courses() {
global $DB;
if ($this->get_feedback()->course != SITEID) {
return [];
}
if ($this->allcourses !== null) {
return $this->allcourses;
}
$courseselect = "SELECT fbc.courseid
FROM {feedback_compl... | php | public function get_completed_courses() {
global $DB;
if ($this->get_feedback()->course != SITEID) {
return [];
}
if ($this->allcourses !== null) {
return $this->allcourses;
}
$courseselect = "SELECT fbc.courseid
FROM {feedback_compl... | [
"public",
"function",
"get_completed_courses",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"get_feedback",
"(",
")",
"->",
"course",
"!=",
"SITEID",
")",
"{",
"return",
"[",
"]",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"a... | For the frontpage feedback returns the list of courses with at least one completed feedback
@return array id=>name pairs of courses | [
"For",
"the",
"frontpage",
"feedback",
"returns",
"the",
"list",
"of",
"courses",
"with",
"at",
"least",
"one",
"completed",
"feedback"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/structure.php#L331-L366 |
214,309 | moodle/moodle | lib/adodb/drivers/adodb-ibase.inc.php | ADODB_ibase._Execute | function _Execute($sql,$inputarr=false)
{
global $ADODB_COUNTRECS;
if ($this->_logsql) {
$savecrecs = $ADODB_COUNTRECS;
$ADODB_COUNTRECS = true; // force countrecs
$ret = ADOConnection::_Execute($sql,$inputarr);
$ADODB_COUNTRECS = $savecrecs;
} else {
$ret = ADOConnection::_Execute($sql,$inputarr)... | php | function _Execute($sql,$inputarr=false)
{
global $ADODB_COUNTRECS;
if ($this->_logsql) {
$savecrecs = $ADODB_COUNTRECS;
$ADODB_COUNTRECS = true; // force countrecs
$ret = ADOConnection::_Execute($sql,$inputarr);
$ADODB_COUNTRECS = $savecrecs;
} else {
$ret = ADOConnection::_Execute($sql,$inputarr)... | [
"function",
"_Execute",
"(",
"$",
"sql",
",",
"$",
"inputarr",
"=",
"false",
")",
"{",
"global",
"$",
"ADODB_COUNTRECS",
";",
"if",
"(",
"$",
"this",
"->",
"_logsql",
")",
"{",
"$",
"savecrecs",
"=",
"$",
"ADODB_COUNTRECS",
";",
"$",
"ADODB_COUNTRECS",
... | it appears that ibase extension cannot support multiple concurrent queryid's | [
"it",
"appears",
"that",
"ibase",
"extension",
"cannot",
"support",
"multiple",
"concurrent",
"queryid",
"s"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-ibase.inc.php#L177-L190 |
214,310 | moodle/moodle | lib/adodb/drivers/adodb-ibase.inc.php | ADODB_ibase._ConvertFieldType | function _ConvertFieldType(&$fld, $ftype, $flen, $fscale, $fsubtype, $fprecision, $dialect3)
{
$fscale = abs($fscale);
$fld->max_length = $flen;
$fld->scale = null;
switch($ftype){
case 7:
case 8:
if ($dialect3) {
switch($fsubtype){
case 0:
$fld->type = ($ftype == 7 ? 'smallint' : '... | php | function _ConvertFieldType(&$fld, $ftype, $flen, $fscale, $fsubtype, $fprecision, $dialect3)
{
$fscale = abs($fscale);
$fld->max_length = $flen;
$fld->scale = null;
switch($ftype){
case 7:
case 8:
if ($dialect3) {
switch($fsubtype){
case 0:
$fld->type = ($ftype == 7 ? 'smallint' : '... | [
"function",
"_ConvertFieldType",
"(",
"&",
"$",
"fld",
",",
"$",
"ftype",
",",
"$",
"flen",
",",
"$",
"fscale",
",",
"$",
"fsubtype",
",",
"$",
"fprecision",
",",
"$",
"dialect3",
")",
"{",
"$",
"fscale",
"=",
"abs",
"(",
"$",
"fscale",
")",
";",
... | OPN STUFF start | [
"OPN",
"STUFF",
"start"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-ibase.inc.php#L412-L506 |
214,311 | moodle/moodle | lib/adodb/drivers/adodb-ibase.inc.php | ADODB_ibase.MetaColumns | function MetaColumns($table, $normalize=true)
{
global $ADODB_FETCH_MODE;
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
$ADODB_FETCH_MODE = $save;
$false = false;
if ($rs === false) {
return $false;
}
$re... | php | function MetaColumns($table, $normalize=true)
{
global $ADODB_FETCH_MODE;
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
$ADODB_FETCH_MODE = $save;
$false = false;
if ($rs === false) {
return $false;
}
$re... | [
"function",
"MetaColumns",
"(",
"$",
"table",
",",
"$",
"normalize",
"=",
"true",
")",
"{",
"global",
"$",
"ADODB_FETCH_MODE",
";",
"$",
"save",
"=",
"$",
"ADODB_FETCH_MODE",
";",
"$",
"ADODB_FETCH_MODE",
"=",
"ADODB_FETCH_NUM",
";",
"$",
"rs",
"=",
"$",
... | returns array of ADOFieldObjects for current table | [
"returns",
"array",
"of",
"ADOFieldObjects",
"for",
"current",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-ibase.inc.php#L510-L569 |
214,312 | moodle/moodle | lib/adodb/drivers/adodb-ibase.inc.php | ADODB_ibase._BlobDecode_old | function _BlobDecode_old( $blob )
{
$blobid = ibase_blob_open($this->_connectionID, $blob );
$realblob = ibase_blob_get( $blobid,$this->maxblobsize); // 2nd param is max size of blob -- Kevin Boillet <kevinboillet@yahoo.fr>
while($string = ibase_blob_get($blobid, 8192)){
$realblob .= $string;
}
ibase_blob... | php | function _BlobDecode_old( $blob )
{
$blobid = ibase_blob_open($this->_connectionID, $blob );
$realblob = ibase_blob_get( $blobid,$this->maxblobsize); // 2nd param is max size of blob -- Kevin Boillet <kevinboillet@yahoo.fr>
while($string = ibase_blob_get($blobid, 8192)){
$realblob .= $string;
}
ibase_blob... | [
"function",
"_BlobDecode_old",
"(",
"$",
"blob",
")",
"{",
"$",
"blobid",
"=",
"ibase_blob_open",
"(",
"$",
"this",
"->",
"_connectionID",
",",
"$",
"blob",
")",
";",
"$",
"realblob",
"=",
"ibase_blob_get",
"(",
"$",
"blobid",
",",
"$",
"this",
"->",
"... | still used to auto-decode all blob's | [
"still",
"used",
"to",
"auto",
"-",
"decode",
"all",
"blob",
"s"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-ibase.inc.php#L590-L600 |
214,313 | moodle/moodle | lib/adodb/drivers/adodb-ibase.inc.php | ADODB_ibase.SQLDate | function SQLDate($fmt, $col=false)
{
if (!$col) $col = $this->sysDate;
$s = '';
$len = strlen($fmt);
for ($i=0; $i < $len; $i++) {
if ($s) $s .= '||';
$ch = $fmt[$i];
switch($ch) {
case 'Y':
case 'y':
$s .= "extract(year from $col)";
break;
case 'M':
case 'm':
$s .= "extract(m... | php | function SQLDate($fmt, $col=false)
{
if (!$col) $col = $this->sysDate;
$s = '';
$len = strlen($fmt);
for ($i=0; $i < $len; $i++) {
if ($s) $s .= '||';
$ch = $fmt[$i];
switch($ch) {
case 'Y':
case 'y':
$s .= "extract(year from $col)";
break;
case 'M':
case 'm':
$s .= "extract(m... | [
"function",
"SQLDate",
"(",
"$",
"fmt",
",",
"$",
"col",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"col",
")",
"$",
"col",
"=",
"$",
"this",
"->",
"sysDate",
";",
"$",
"s",
"=",
"''",
";",
"$",
"len",
"=",
"strlen",
"(",
"$",
"fmt",
")",... | problem - does not zero-fill the day and month yet | [
"problem",
"-",
"does",
"not",
"zero",
"-",
"fill",
"the",
"day",
"and",
"month",
"yet"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-ibase.inc.php#L701-L750 |
214,314 | moodle/moodle | user/profile/field/datetime/define.class.php | profile_define_datetime.define_form_specific | public function define_form_specific($form) {
// Get the current calendar in use - see MDL-18375.
$calendartype = \core_calendar\type_factory::get_calendar_instance();
// Create variables to store start and end.
list($year, $month, $day) = explode('_', date('Y_m_d'));
$currentda... | php | public function define_form_specific($form) {
// Get the current calendar in use - see MDL-18375.
$calendartype = \core_calendar\type_factory::get_calendar_instance();
// Create variables to store start and end.
list($year, $month, $day) = explode('_', date('Y_m_d'));
$currentda... | [
"public",
"function",
"define_form_specific",
"(",
"$",
"form",
")",
"{",
"// Get the current calendar in use - see MDL-18375.",
"$",
"calendartype",
"=",
"\\",
"core_calendar",
"\\",
"type_factory",
"::",
"get_calendar_instance",
"(",
")",
";",
"// Create variables to stor... | Define the setting for a datetime custom field.
@param moodleform $form the user form | [
"Define",
"the",
"setting",
"for",
"a",
"datetime",
"custom",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/field/datetime/define.class.php#L38-L75 |
214,315 | moodle/moodle | user/profile/field/datetime/define.class.php | profile_define_datetime.define_validate_specific | public function define_validate_specific($data, $files) {
$errors = array();
// Make sure the start year is not greater than the end year.
if ($data->param1 > $data->param2) {
$errors['param1'] = get_string('startyearafterend', 'profilefield_datetime');
}
return $er... | php | public function define_validate_specific($data, $files) {
$errors = array();
// Make sure the start year is not greater than the end year.
if ($data->param1 > $data->param2) {
$errors['param1'] = get_string('startyearafterend', 'profilefield_datetime');
}
return $er... | [
"public",
"function",
"define_validate_specific",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"// Make sure the start year is not greater than the end year.",
"if",
"(",
"$",
"data",
"->",
"param1",
">",
"$",
"data"... | Validate the data from the profile field form.
@param stdClass $data from the add/edit profile field form
@param array $files
@return array associative array of error messages | [
"Validate",
"the",
"data",
"from",
"the",
"profile",
"field",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/field/datetime/define.class.php#L84-L93 |
214,316 | moodle/moodle | user/profile/field/datetime/define.class.php | profile_define_datetime.define_after_data | public function define_after_data(&$mform) {
global $DB;
// If we are adding a new profile field then the dates have already been set
// by setDefault to the correct dates in the used calendar system. We only want
// to execute the rest of the code when we have the years in the DB saved... | php | public function define_after_data(&$mform) {
global $DB;
// If we are adding a new profile field then the dates have already been set
// by setDefault to the correct dates in the used calendar system. We only want
// to execute the rest of the code when we have the years in the DB saved... | [
"public",
"function",
"define_after_data",
"(",
"&",
"$",
"mform",
")",
"{",
"global",
"$",
"DB",
";",
"// If we are adding a new profile field then the dates have already been set",
"// by setDefault to the correct dates in the used calendar system. We only want",
"// to execute the r... | Alter form based on submitted or existing data.
@param moodleform $mform | [
"Alter",
"form",
"based",
"on",
"submitted",
"or",
"existing",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/field/datetime/define.class.php#L100-L140 |
214,317 | moodle/moodle | user/profile/field/datetime/define.class.php | profile_define_datetime.define_save_preprocess | public function define_save_preprocess($data) {
// Get the current calendar in use - see MDL-18375.
$calendartype = \core_calendar\type_factory::get_calendar_instance();
// Check if the start year was changed, if it was then convert from the start of that year.
if ($data->param1 != $dat... | php | public function define_save_preprocess($data) {
// Get the current calendar in use - see MDL-18375.
$calendartype = \core_calendar\type_factory::get_calendar_instance();
// Check if the start year was changed, if it was then convert from the start of that year.
if ($data->param1 != $dat... | [
"public",
"function",
"define_save_preprocess",
"(",
"$",
"data",
")",
"{",
"// Get the current calendar in use - see MDL-18375.",
"$",
"calendartype",
"=",
"\\",
"core_calendar",
"\\",
"type_factory",
"::",
"get_calendar_instance",
"(",
")",
";",
"// Check if the start yea... | Preprocess data from the profile field form before
it is saved.
@param stdClass $data from the add/edit profile field form
@return stdClass processed data object | [
"Preprocess",
"data",
"from",
"the",
"profile",
"field",
"form",
"before",
"it",
"is",
"saved",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/field/datetime/define.class.php#L149-L178 |
214,318 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/Zipper.php | HTMLPurifier_Zipper.next | public function next($t) {
if ($t !== NULL) array_push($this->front, $t);
return empty($this->back) ? NULL : array_pop($this->back);
} | php | public function next($t) {
if ($t !== NULL) array_push($this->front, $t);
return empty($this->back) ? NULL : array_pop($this->back);
} | [
"public",
"function",
"next",
"(",
"$",
"t",
")",
"{",
"if",
"(",
"$",
"t",
"!==",
"NULL",
")",
"array_push",
"(",
"$",
"this",
"->",
"front",
",",
"$",
"t",
")",
";",
"return",
"empty",
"(",
"$",
"this",
"->",
"back",
")",
"?",
"NULL",
":",
... | Move hole to the next element.
@param $t Element to fill hole with
@return Original contents of new hole. | [
"Move",
"hole",
"to",
"the",
"next",
"element",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Zipper.php#L61-L64 |
214,319 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/Zipper.php | HTMLPurifier_Zipper.advance | public function advance($t, $n) {
for ($i = 0; $i < $n; $i++) {
$t = $this->next($t);
}
return $t;
} | php | public function advance($t, $n) {
for ($i = 0; $i < $n; $i++) {
$t = $this->next($t);
}
return $t;
} | [
"public",
"function",
"advance",
"(",
"$",
"t",
",",
"$",
"n",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"n",
";",
"$",
"i",
"++",
")",
"{",
"$",
"t",
"=",
"$",
"this",
"->",
"next",
"(",
"$",
"t",
")",
";",
"... | Iterated hole advancement.
@param $t Element to fill hole with
@param $i How many forward to advance hole
@return Original contents of new hole, i away | [
"Iterated",
"hole",
"advancement",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Zipper.php#L72-L77 |
214,320 | moodle/moodle | message/output/email/classes/event_observers.php | event_observers.message_viewed | public static function message_viewed(\core\event\message_viewed $event) {
global $DB;
$userid = $event->userid;
$messageid = $event->other['messageid'];
$DB->delete_records('message_email_messages', ['useridto' => $userid, 'messageid' => $messageid]);
} | php | public static function message_viewed(\core\event\message_viewed $event) {
global $DB;
$userid = $event->userid;
$messageid = $event->other['messageid'];
$DB->delete_records('message_email_messages', ['useridto' => $userid, 'messageid' => $messageid]);
} | [
"public",
"static",
"function",
"message_viewed",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"message_viewed",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"userid",
"=",
"$",
"event",
"->",
"userid",
";",
"$",
"messageid",
"=",
"$",
"event",
"-... | Message viewed event handler.
@param \core\event\message_viewed $event The message viewed event. | [
"Message",
"viewed",
"event",
"handler",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/email/classes/event_observers.php#L43-L50 |
214,321 | moodle/moodle | course/format/weeks/backup/moodle2/restore_format_weeks_plugin.class.php | restore_format_weeks_plugin.update_automatic_end_date | protected function update_automatic_end_date($enddate) {
global $DB;
// At this stage the 'course_format_options' table will already have a value set for this option as it is
// part of the course format and the default will have been set.
// Get the current course format option.
... | php | protected function update_automatic_end_date($enddate) {
global $DB;
// At this stage the 'course_format_options' table will already have a value set for this option as it is
// part of the course format and the default will have been set.
// Get the current course format option.
... | [
"protected",
"function",
"update_automatic_end_date",
"(",
"$",
"enddate",
")",
"{",
"global",
"$",
"DB",
";",
"// At this stage the 'course_format_options' table will already have a value set for this option as it is",
"// part of the course format and the default will have been set.",
... | Handles setting the automatic end date for a restored course.
@param int $enddate The end date in the backup file. | [
"Handles",
"setting",
"the",
"automatic",
"end",
"date",
"for",
"a",
"restored",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/weeks/backup/moodle2/restore_format_weeks_plugin.class.php#L60-L89 |
214,322 | moodle/moodle | course/format/weeks/backup/moodle2/restore_format_weeks_plugin.class.php | restore_format_weeks_plugin.update_course_sections_visibility | protected function update_course_sections_visibility($numsections) {
global $DB;
$backupinfo = $this->step->get_task()->get_info();
foreach ($backupinfo->sections as $key => $section) {
// For each section from the backup file check if it was restored and if was "orphaned" in the or... | php | protected function update_course_sections_visibility($numsections) {
global $DB;
$backupinfo = $this->step->get_task()->get_info();
foreach ($backupinfo->sections as $key => $section) {
// For each section from the backup file check if it was restored and if was "orphaned" in the or... | [
"protected",
"function",
"update_course_sections_visibility",
"(",
"$",
"numsections",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"backupinfo",
"=",
"$",
"this",
"->",
"step",
"->",
"get_task",
"(",
")",
"->",
"get_info",
"(",
")",
";",
"foreach",
"(",
"$",
... | Handles updating the visibility of sections in the restored course.
@param int $numsections The number of sections in the restored course. | [
"Handles",
"updating",
"the",
"visibility",
"of",
"sections",
"in",
"the",
"restored",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/weeks/backup/moodle2/restore_format_weeks_plugin.class.php#L96-L114 |
214,323 | moodle/moodle | course/format/weeks/backup/moodle2/restore_format_weeks_plugin.class.php | restore_format_weeks_plugin.define_course_plugin_structure | public function define_course_plugin_structure() {
global $DB;
// Since this method is executed before the restore we can do some pre-checks here.
// In case of merging backup into existing course find the current number of sections.
$target = $this->step->get_task()->get_target();
... | php | public function define_course_plugin_structure() {
global $DB;
// Since this method is executed before the restore we can do some pre-checks here.
// In case of merging backup into existing course find the current number of sections.
$target = $this->step->get_task()->get_target();
... | [
"public",
"function",
"define_course_plugin_structure",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"// Since this method is executed before the restore we can do some pre-checks here.",
"// In case of merging backup into existing course find the current number of sections.",
"$",
"target",
... | Creates a dummy path element in order to be able to execute code after restore
@return restore_path_element[] | [
"Creates",
"a",
"dummy",
"path",
"element",
"in",
"order",
"to",
"be",
"able",
"to",
"execute",
"code",
"after",
"restore"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/weeks/backup/moodle2/restore_format_weeks_plugin.class.php#L121-L137 |
214,324 | moodle/moodle | backup/util/xml/output/file_xml_output.class.php | file_xml_output.init | protected function init() {
if (!file_exists(dirname($this->fullpath))) {
throw new xml_output_exception('directory_not_exists', dirname($this->fullpath));
}
if (file_exists($this->fullpath)) {
throw new xml_output_exception('file_already_exists', $this->fullpath);
... | php | protected function init() {
if (!file_exists(dirname($this->fullpath))) {
throw new xml_output_exception('directory_not_exists', dirname($this->fullpath));
}
if (file_exists($this->fullpath)) {
throw new xml_output_exception('file_already_exists', $this->fullpath);
... | [
"protected",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"dirname",
"(",
"$",
"this",
"->",
"fullpath",
")",
")",
")",
"{",
"throw",
"new",
"xml_output_exception",
"(",
"'directory_not_exists'",
",",
"dirname",
"(",
"$",
"this",
... | Private API starts here | [
"Private",
"API",
"starts",
"here"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/xml/output/file_xml_output.class.php#L44-L58 |
214,325 | moodle/moodle | backup/util/ui/restore_ui_stage.class.php | restore_ui_independent_stage.get_progress_reporter | public function get_progress_reporter() {
if (!$this->progressreporter) {
$this->progressreporter = new \core\progress\none();
}
return $this->progressreporter;
} | php | public function get_progress_reporter() {
if (!$this->progressreporter) {
$this->progressreporter = new \core\progress\none();
}
return $this->progressreporter;
} | [
"public",
"function",
"get_progress_reporter",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"progressreporter",
")",
"{",
"$",
"this",
"->",
"progressreporter",
"=",
"new",
"\\",
"core",
"\\",
"progress",
"\\",
"none",
"(",
")",
";",
"}",
"return",
... | Gets the progress reporter object in use for this restore UI stage.
IMPORTANT: This progress reporter is used only for UI progress that is
outside the restore controller. The restore controller has its own
progress reporter which is used for progress during the main restore.
Use the restore controller's progress repor... | [
"Gets",
"the",
"progress",
"reporter",
"object",
"in",
"use",
"for",
"this",
"restore",
"UI",
"stage",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui_stage.class.php#L149-L154 |
214,326 | moodle/moodle | backup/util/ui/restore_ui_stage.class.php | restore_ui_stage_confirm.process | public function process() {
$backuptempdir = make_backup_temp_directory('');
if ($this->filename) {
$archivepath = $backuptempdir . '/' . $this->filename;
if (!file_exists($archivepath)) {
throw new restore_ui_exception('invalidrestorefile');
}
... | php | public function process() {
$backuptempdir = make_backup_temp_directory('');
if ($this->filename) {
$archivepath = $backuptempdir . '/' . $this->filename;
if (!file_exists($archivepath)) {
throw new restore_ui_exception('invalidrestorefile');
}
... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"backuptempdir",
"=",
"make_backup_temp_directory",
"(",
"''",
")",
";",
"if",
"(",
"$",
"this",
"->",
"filename",
")",
"{",
"$",
"archivepath",
"=",
"$",
"backuptempdir",
".",
"'/'",
".",
"$",
"this",... | Processes this restore stage
@return bool
@throws restore_ui_exception | [
"Processes",
"this",
"restore",
"stage"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui_stage.class.php#L290-L310 |
214,327 | moodle/moodle | backup/util/ui/restore_ui_stage.class.php | restore_ui_stage_confirm.extract_file_to_dir | protected function extract_file_to_dir($source) {
global $USER;
$this->filepath = restore_controller::get_tempdir_name($this->contextid, $USER->id);
$backuptempdir = make_backup_temp_directory('', false);
$fb = get_file_packer('application/vnd.moodle.backup');
$result = $fb->ex... | php | protected function extract_file_to_dir($source) {
global $USER;
$this->filepath = restore_controller::get_tempdir_name($this->contextid, $USER->id);
$backuptempdir = make_backup_temp_directory('', false);
$fb = get_file_packer('application/vnd.moodle.backup');
$result = $fb->ex... | [
"protected",
"function",
"extract_file_to_dir",
"(",
"$",
"source",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"this",
"->",
"filepath",
"=",
"restore_controller",
"::",
"get_tempdir_name",
"(",
"$",
"this",
"->",
"contextid",
",",
"$",
"USER",
"->",
"id",
... | Extracts the file.
@param string|stored_file $source Archive file to extract
@return bool | [
"Extracts",
"the",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui_stage.class.php#L318-L333 |
214,328 | moodle/moodle | backup/util/ui/restore_ui_stage.class.php | restore_ui_stage_confirm.display | public function display(core_backup_renderer $renderer) {
$prevstageurl = new moodle_url('/backup/restorefile.php', array('contextid' => $this->contextid));
$nextstageurl = new moodle_url('/backup/restore.php', array(
'contextid' => $this->contextid,
'filepath' => $this->filepa... | php | public function display(core_backup_renderer $renderer) {
$prevstageurl = new moodle_url('/backup/restorefile.php', array('contextid' => $this->contextid));
$nextstageurl = new moodle_url('/backup/restore.php', array(
'contextid' => $this->contextid,
'filepath' => $this->filepa... | [
"public",
"function",
"display",
"(",
"core_backup_renderer",
"$",
"renderer",
")",
"{",
"$",
"prevstageurl",
"=",
"new",
"moodle_url",
"(",
"'/backup/restorefile.php'",
",",
"array",
"(",
"'contextid'",
"=>",
"$",
"this",
"->",
"contextid",
")",
")",
";",
"$"... | Renders the confirmation stage screen
@param core_backup_renderer $renderer renderer instance to use
@return string HTML code | [
"Renders",
"the",
"confirmation",
"stage",
"screen"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui_stage.class.php#L362-L386 |
214,329 | moodle/moodle | backup/util/ui/restore_ui_stage.class.php | restore_ui_stage_destination.process | public function process() {
global $DB;
$filepathdir = make_backup_temp_directory($this->filepath, false);
if (!file_exists($filepathdir) || !is_dir($filepathdir)) {
throw new restore_ui_exception('invalidrestorepath');
}
if (optional_param('searchcourses', false, PAR... | php | public function process() {
global $DB;
$filepathdir = make_backup_temp_directory($this->filepath, false);
if (!file_exists($filepathdir) || !is_dir($filepathdir)) {
throw new restore_ui_exception('invalidrestorepath');
}
if (optional_param('searchcourses', false, PAR... | [
"public",
"function",
"process",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"filepathdir",
"=",
"make_backup_temp_directory",
"(",
"$",
"this",
"->",
"filepath",
",",
"false",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"filepathdir",
")",
"||"... | Processes the destination stage.
@return bool
@throws coding_exception
@throws restore_ui_exception | [
"Processes",
"the",
"destination",
"stage",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui_stage.class.php#L476-L497 |
214,330 | moodle/moodle | backup/util/ui/restore_ui_stage.class.php | restore_ui_stage_destination.display | public function display(core_backup_renderer $renderer) {
$format = backup_general_helper::detect_backup_format($this->filepath);
if ($format === backup::FORMAT_MOODLE) {
// Standard Moodle 2 format, let use get the type of the backup.
$details = backup_general_helper::get_back... | php | public function display(core_backup_renderer $renderer) {
$format = backup_general_helper::detect_backup_format($this->filepath);
if ($format === backup::FORMAT_MOODLE) {
// Standard Moodle 2 format, let use get the type of the backup.
$details = backup_general_helper::get_back... | [
"public",
"function",
"display",
"(",
"core_backup_renderer",
"$",
"renderer",
")",
"{",
"$",
"format",
"=",
"backup_general_helper",
"::",
"detect_backup_format",
"(",
"$",
"this",
"->",
"filepath",
")",
";",
"if",
"(",
"$",
"format",
"===",
"backup",
"::",
... | Renders the destination stage screen
@param core_backup_renderer $renderer renderer instance to use
@return string HTML code | [
"Renders",
"the",
"destination",
"stage",
"screen"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui_stage.class.php#L505-L538 |
214,331 | moodle/moodle | backup/util/ui/restore_ui_stage.class.php | restore_ui_stage_settings.process | public function process(base_moodleform $form = null) {
$form = $this->initialise_stage_form();
if ($form->is_cancelled()) {
$this->ui->cancel_process();
}
$data = $form->get_data();
if ($data && confirm_sesskey()) {
$tasks = $this->ui->get_tasks();
... | php | public function process(base_moodleform $form = null) {
$form = $this->initialise_stage_form();
if ($form->is_cancelled()) {
$this->ui->cancel_process();
}
$data = $form->get_data();
if ($data && confirm_sesskey()) {
$tasks = $this->ui->get_tasks();
... | [
"public",
"function",
"process",
"(",
"base_moodleform",
"$",
"form",
"=",
"null",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"initialise_stage_form",
"(",
")",
";",
"if",
"(",
"$",
"form",
"->",
"is_cancelled",
"(",
")",
")",
"{",
"$",
"this",
"... | Process the settings stage.
@param base_moodleform $form
@return bool|int | [
"Process",
"the",
"settings",
"stage",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui_stage.class.php#L610-L643 |
214,332 | moodle/moodle | backup/util/ui/restore_ui_stage.class.php | restore_ui_stage_settings.initialise_stage_form | protected function initialise_stage_form() {
global $PAGE;
if ($this->stageform === null) {
$form = new restore_settings_form($this, $PAGE->url);
// Store as a variable so we can iterate by reference.
$tasks = $this->ui->get_tasks();
$headingprinted = fals... | php | protected function initialise_stage_form() {
global $PAGE;
if ($this->stageform === null) {
$form = new restore_settings_form($this, $PAGE->url);
// Store as a variable so we can iterate by reference.
$tasks = $this->ui->get_tasks();
$headingprinted = fals... | [
"protected",
"function",
"initialise_stage_form",
"(",
")",
"{",
"global",
"$",
"PAGE",
";",
"if",
"(",
"$",
"this",
"->",
"stageform",
"===",
"null",
")",
"{",
"$",
"form",
"=",
"new",
"restore_settings_form",
"(",
"$",
"this",
",",
"$",
"PAGE",
"->",
... | Initialise the stage form.
@return backup_moodleform|base_moodleform|restore_settings_form
@throws coding_exception | [
"Initialise",
"the",
"stage",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui_stage.class.php#L651-L687 |
214,333 | moodle/moodle | backup/util/ui/restore_ui_stage.class.php | restore_ui_stage_review.process | public function process(base_moodleform $form = null) {
$form = $this->initialise_stage_form();
// Check it hasn't been cancelled.
if ($form->is_cancelled()) {
$this->ui->cancel_process();
}
$data = $form->get_data();
if ($data && confirm_sesskey()) {
... | php | public function process(base_moodleform $form = null) {
$form = $this->initialise_stage_form();
// Check it hasn't been cancelled.
if ($form->is_cancelled()) {
$this->ui->cancel_process();
}
$data = $form->get_data();
if ($data && confirm_sesskey()) {
... | [
"public",
"function",
"process",
"(",
"base_moodleform",
"$",
"form",
"=",
"null",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"initialise_stage_form",
"(",
")",
";",
"// Check it hasn't been cancelled.",
"if",
"(",
"$",
"form",
"->",
"is_cancelled",
"(",
... | Processes the confirmation stage
@param base_moodleform $form
@return int The number of changes the user made | [
"Processes",
"the",
"confirmation",
"stage"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui_stage.class.php#L870-L883 |
214,334 | moodle/moodle | backup/util/ui/restore_ui_stage.class.php | restore_ui_stage_process.process | public function process(base_moodleform $form = null) {
if (optional_param('cancel', false, PARAM_BOOL)) {
redirect(new moodle_url('/course/view.php', array('id' => $this->get_ui()->get_controller()->get_courseid())));
}
// First decide whether a substage is needed.
$rc = $t... | php | public function process(base_moodleform $form = null) {
if (optional_param('cancel', false, PARAM_BOOL)) {
redirect(new moodle_url('/course/view.php', array('id' => $this->get_ui()->get_controller()->get_courseid())));
}
// First decide whether a substage is needed.
$rc = $t... | [
"public",
"function",
"process",
"(",
"base_moodleform",
"$",
"form",
"=",
"null",
")",
"{",
"if",
"(",
"optional_param",
"(",
"'cancel'",
",",
"false",
",",
"PARAM_BOOL",
")",
")",
"{",
"redirect",
"(",
"new",
"moodle_url",
"(",
"'/course/view.php'",
",",
... | Processes the final stage.
In this case it checks to see if there is a sub stage that we need to display
before execution, if there is we gear up to display the subpage, otherwise
we return true which will lead to execution of the restore and the loading
of the completed stage.
@param base_moodleform $form | [
"Processes",
"the",
"final",
"stage",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui_stage.class.php#L980-L1019 |
214,335 | moodle/moodle | backup/util/ui/restore_ui_stage.class.php | restore_ui_stage_process.display | public function display(core_backup_renderer $renderer) {
global $PAGE;
$html = '';
$haserrors = false;
$url = new moodle_url($PAGE->url, array(
'restore' => $this->get_uniqueid(),
'stage' => restore_ui::STAGE_PROCESS,
'substage' => $this->subs... | php | public function display(core_backup_renderer $renderer) {
global $PAGE;
$html = '';
$haserrors = false;
$url = new moodle_url($PAGE->url, array(
'restore' => $this->get_uniqueid(),
'stage' => restore_ui::STAGE_PROCESS,
'substage' => $this->subs... | [
"public",
"function",
"display",
"(",
"core_backup_renderer",
"$",
"renderer",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"html",
"=",
"''",
";",
"$",
"haserrors",
"=",
"false",
";",
"$",
"url",
"=",
"new",
"moodle_url",
"(",
"$",
"PAGE",
"->",
"url",
... | Renders the process stage screen
@throws restore_ui_exception
@param core_backup_renderer $renderer renderer instance to use
@return string HTML code | [
"Renders",
"the",
"process",
"stage",
"screen"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui_stage.class.php#L1034-L1093 |
214,336 | moodle/moodle | lib/classes/update/checker.php | checker.fetch | public function fetch() {
$response = $this->get_response();
$this->validate_response($response);
$this->store_response($response);
// We need to reset plugin manager's caches - the currently existing
// singleton is not aware of eventually available updates we just fetched.
... | php | public function fetch() {
$response = $this->get_response();
$this->validate_response($response);
$this->store_response($response);
// We need to reset plugin manager's caches - the currently existing
// singleton is not aware of eventually available updates we just fetched.
... | [
"public",
"function",
"fetch",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"get_response",
"(",
")",
";",
"$",
"this",
"->",
"validate_response",
"(",
"$",
"response",
")",
";",
"$",
"this",
"->",
"store_response",
"(",
"$",
"response",
")"... | Fetches the available update status from the remote site
@throws checker_exception | [
"Fetches",
"the",
"available",
"update",
"status",
"from",
"the",
"remote",
"site"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L122-L131 |
214,337 | moodle/moodle | lib/classes/update/checker.php | checker.get_update_info | public function get_update_info($component, array $options = array()) {
if (!isset($options['minmaturity'])) {
$options['minmaturity'] = 0;
}
if (!isset($options['notifybuilds'])) {
$options['notifybuilds'] = false;
}
if ($component === 'core') {
... | php | public function get_update_info($component, array $options = array()) {
if (!isset($options['minmaturity'])) {
$options['minmaturity'] = 0;
}
if (!isset($options['notifybuilds'])) {
$options['notifybuilds'] = false;
}
if ($component === 'core') {
... | [
"public",
"function",
"get_update_info",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'minmaturity'",
"]",
")",
")",
"{",
"$",
"options",
"[",
"'minmaturity'"... | Returns the available update information for the given component
This method returns null if the most recent response does not contain any information
about it. The returned structure is an array of available updates for the given
component. Each update info is an object with at least one property called
'version'. Ot... | [
"Returns",
"the",
"available",
"update",
"information",
"for",
"the",
"given",
"component"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L149-L191 |
214,338 | moodle/moodle | lib/classes/update/checker.php | checker.cron | public function cron() {
global $CFG;
if (!$this->enabled() or !$this->cron_autocheck_enabled()) {
$this->cron_mtrace('Automatic check for available updates not enabled, skipping.');
return;
}
$now = $this->cron_current_timestamp();
if ($this->cron_has_... | php | public function cron() {
global $CFG;
if (!$this->enabled() or !$this->cron_autocheck_enabled()) {
$this->cron_mtrace('Automatic check for available updates not enabled, skipping.');
return;
}
$now = $this->cron_current_timestamp();
if ($this->cron_has_... | [
"public",
"function",
"cron",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"enabled",
"(",
")",
"or",
"!",
"$",
"this",
"->",
"cron_autocheck_enabled",
"(",
")",
")",
"{",
"$",
"this",
"->",
"cron_mtrace",
"(",
"'Aut... | The method being run via cron.php | [
"The",
"method",
"being",
"run",
"via",
"cron",
".",
"php"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L196-L224 |
214,339 | moodle/moodle | lib/classes/update/checker.php | checker.get_response | protected function get_response() {
global $CFG;
require_once($CFG->libdir.'/filelib.php');
$curl = new \curl(array('proxy' => true));
$response = $curl->post($this->prepare_request_url(), $this->prepare_request_params(), $this->prepare_request_options());
$curlerrno = $curl->ge... | php | protected function get_response() {
global $CFG;
require_once($CFG->libdir.'/filelib.php');
$curl = new \curl(array('proxy' => true));
$response = $curl->post($this->prepare_request_url(), $this->prepare_request_params(), $this->prepare_request_options());
$curlerrno = $curl->ge... | [
"protected",
"function",
"get_response",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/filelib.php'",
")",
";",
"$",
"curl",
"=",
"new",
"\\",
"curl",
"(",
"array",
"(",
"'proxy'",
"=>",
"true",
")",... | Makes cURL request to get data from the remote site
@return string raw request result
@throws checker_exception | [
"Makes",
"cURL",
"request",
"to",
"get",
"data",
"from",
"the",
"remote",
"site"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L234-L249 |
214,340 | moodle/moodle | lib/classes/update/checker.php | checker.validate_response | protected function validate_response($response) {
$response = $this->decode_response($response);
if (empty($response)) {
throw new checker_exception('err_response_empty');
}
if (empty($response['status']) or $response['status'] !== 'OK') {
throw new checker_exc... | php | protected function validate_response($response) {
$response = $this->decode_response($response);
if (empty($response)) {
throw new checker_exception('err_response_empty');
}
if (empty($response['status']) or $response['status'] !== 'OK') {
throw new checker_exc... | [
"protected",
"function",
"validate_response",
"(",
"$",
"response",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"decode_response",
"(",
"$",
"response",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"response",
")",
")",
"{",
"throw",
"new",
"checker_ex... | Makes sure the response is valid, has correct API format etc.
@param string $response raw response as returned by the {@link self::get_response()}
@throws checker_exception | [
"Makes",
"sure",
"the",
"response",
"is",
"valid",
"has",
"correct",
"API",
"format",
"etc",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L257-L276 |
214,341 | moodle/moodle | lib/classes/update/checker.php | checker.store_response | protected function store_response($response) {
set_config('recentfetch', time(), 'core_plugin');
set_config('recentresponse', $response, 'core_plugin');
if (defined('CACHE_DISABLE_ALL') and CACHE_DISABLE_ALL) {
// Very nasty hack to work around cache coherency issues on admin/index... | php | protected function store_response($response) {
set_config('recentfetch', time(), 'core_plugin');
set_config('recentresponse', $response, 'core_plugin');
if (defined('CACHE_DISABLE_ALL') and CACHE_DISABLE_ALL) {
// Very nasty hack to work around cache coherency issues on admin/index... | [
"protected",
"function",
"store_response",
"(",
"$",
"response",
")",
"{",
"set_config",
"(",
"'recentfetch'",
",",
"time",
"(",
")",
",",
"'core_plugin'",
")",
";",
"set_config",
"(",
"'recentresponse'",
",",
"$",
"response",
",",
"'core_plugin'",
")",
";",
... | Stores the valid fetched response for later usage
This implementation uses the config_plugins table as the permanent storage.
@param string $response raw valid data returned by {@link self::get_response()} | [
"Stores",
"the",
"valid",
"fetched",
"response",
"for",
"later",
"usage"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L295-L307 |
214,342 | moodle/moodle | lib/classes/update/checker.php | checker.restore_response | protected function restore_response($forcereload = false) {
if (!$forcereload and !is_null($this->recentresponse)) {
// We already have it, nothing to do.
return;
}
$config = get_config('core_plugin');
if (!empty($config->recentresponse) and !empty($config->rec... | php | protected function restore_response($forcereload = false) {
if (!$forcereload and !is_null($this->recentresponse)) {
// We already have it, nothing to do.
return;
}
$config = get_config('core_plugin');
if (!empty($config->recentresponse) and !empty($config->rec... | [
"protected",
"function",
"restore_response",
"(",
"$",
"forcereload",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"forcereload",
"and",
"!",
"is_null",
"(",
"$",
"this",
"->",
"recentresponse",
")",
")",
"{",
"// We already have it, nothing to do.",
"return",
... | Loads the most recent raw response record we have fetched
After this method is called, $this->recentresponse is set to an array. If the
array is empty, then either no data have been fetched yet or the fetched data
do not have expected format (and thence they are ignored and a debugging
message is displayed).
This imp... | [
"Loads",
"the",
"most",
"recent",
"raw",
"response",
"record",
"we",
"have",
"fetched"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L321-L346 |
214,343 | moodle/moodle | lib/classes/update/checker.php | checker.load_current_environment | protected function load_current_environment($forcereload=false) {
global $CFG;
if (!is_null($this->currentversion) and !$forcereload) {
// Nothing to do.
return;
}
$version = null;
$release = null;
require($CFG->dirroot.'/version.php');
... | php | protected function load_current_environment($forcereload=false) {
global $CFG;
if (!is_null($this->currentversion) and !$forcereload) {
// Nothing to do.
return;
}
$version = null;
$release = null;
require($CFG->dirroot.'/version.php');
... | [
"protected",
"function",
"load_current_environment",
"(",
"$",
"forcereload",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"currentversion",
")",
"and",
"!",
"$",
"forcereload",
")",
"{",
"// Nothing... | Sets the properties currentversion, currentrelease, currentbranch and currentplugins
@param bool $forcereload | [
"Sets",
"the",
"properties",
"currentversion",
"currentrelease",
"currentbranch",
"and",
"currentplugins"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L425-L449 |
214,344 | moodle/moodle | lib/classes/update/checker.php | checker.prepare_request_params | protected function prepare_request_params() {
global $CFG;
$this->load_current_environment();
$this->restore_response();
$params = array();
$params['format'] = 'json';
if (isset($this->recentresponse['ticket'])) {
$params['ticket'] = $this->recentresponse['... | php | protected function prepare_request_params() {
global $CFG;
$this->load_current_environment();
$this->restore_response();
$params = array();
$params['format'] = 'json';
if (isset($this->recentresponse['ticket'])) {
$params['ticket'] = $this->recentresponse['... | [
"protected",
"function",
"prepare_request_params",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"this",
"->",
"load_current_environment",
"(",
")",
";",
"$",
"this",
"->",
"restore_response",
"(",
")",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
"... | Returns the list of HTTP params to be sent to the updates provider URL
@return array of (string)param => (string)value | [
"Returns",
"the",
"list",
"of",
"HTTP",
"params",
"to",
"be",
"sent",
"to",
"the",
"updates",
"provider",
"URL"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L456-L490 |
214,345 | moodle/moodle | lib/classes/update/checker.php | checker.cron_has_fresh_fetch | protected function cron_has_fresh_fetch($now) {
$recent = $this->get_last_timefetched();
if (empty($recent)) {
return false;
}
if ($now < $recent) {
$this->cron_mtrace('The most recent fetch is reported to be in the future, this is weird!');
return t... | php | protected function cron_has_fresh_fetch($now) {
$recent = $this->get_last_timefetched();
if (empty($recent)) {
return false;
}
if ($now < $recent) {
$this->cron_mtrace('The most recent fetch is reported to be in the future, this is weird!');
return t... | [
"protected",
"function",
"cron_has_fresh_fetch",
"(",
"$",
"now",
")",
"{",
"$",
"recent",
"=",
"$",
"this",
"->",
"get_last_timefetched",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"recent",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"... | Decide if the recently fetched data are still fresh enough
@param int $now current timestamp
@return bool true if no need to re-fetch, false otherwise | [
"Decide",
"if",
"the",
"recently",
"fetched",
"data",
"are",
"still",
"fresh",
"enough"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L547-L564 |
214,346 | moodle/moodle | lib/classes/update/checker.php | checker.cron_execution_offset | protected function cron_execution_offset() {
global $CFG;
if (empty($CFG->updatecronoffset)) {
set_config('updatecronoffset', rand(1, 5 * HOURSECS));
}
return $CFG->updatecronoffset;
} | php | protected function cron_execution_offset() {
global $CFG;
if (empty($CFG->updatecronoffset)) {
set_config('updatecronoffset', rand(1, 5 * HOURSECS));
}
return $CFG->updatecronoffset;
} | [
"protected",
"function",
"cron_execution_offset",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"updatecronoffset",
")",
")",
"{",
"set_config",
"(",
"'updatecronoffset'",
",",
"rand",
"(",
"1",
",",
"5",
"*",
"HOUR... | Returns the cron execution offset for this site
The main {@link self::cron()} is supposed to run every night in some random time
between 01:00 and 06:00 AM (local time). The exact moment is defined by so called
execution offset, that is the amount of time after 01:00 AM. The offset value is
initially generated randoml... | [
"Returns",
"the",
"cron",
"execution",
"offset",
"for",
"this",
"site"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L602-L610 |
214,347 | moodle/moodle | lib/classes/update/checker.php | checker.cron_execute | protected function cron_execute() {
try {
$this->restore_response();
$previous = $this->recentresponse;
$this->fetch();
$this->restore_response(true);
$current = $this->recentresponse;
$changes = $this->compare_responses($previous, $curren... | php | protected function cron_execute() {
try {
$this->restore_response();
$previous = $this->recentresponse;
$this->fetch();
$this->restore_response(true);
$current = $this->recentresponse;
$changes = $this->compare_responses($previous, $curren... | [
"protected",
"function",
"cron_execute",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"restore_response",
"(",
")",
";",
"$",
"previous",
"=",
"$",
"this",
"->",
"recentresponse",
";",
"$",
"this",
"->",
"fetch",
"(",
")",
";",
"$",
"this",
"->",
"r... | Fetch available updates info and eventually send notification to site admins | [
"Fetch",
"available",
"updates",
"info",
"and",
"eventually",
"send",
"notification",
"to",
"site",
"admins"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L615-L630 |
214,348 | moodle/moodle | lib/classes/update/checker.php | checker.cron_notifications | protected function cron_notifications(array $changes) {
global $CFG;
if (empty($changes)) {
return array();
}
$notifications = array();
$pluginman = \core_plugin_manager::instance();
$plugins = $pluginman->get_plugins();
foreach ($changes as $compon... | php | protected function cron_notifications(array $changes) {
global $CFG;
if (empty($changes)) {
return array();
}
$notifications = array();
$pluginman = \core_plugin_manager::instance();
$plugins = $pluginman->get_plugins();
foreach ($changes as $compon... | [
"protected",
"function",
"cron_notifications",
"(",
"array",
"$",
"changes",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"changes",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"notifications",
"=",
"array",
"(",
... | Given the list of changes in available updates, pick those to send to site admins
@param array $changes as returned by {@link self::compare_responses()}
@return array of \core\update\info objects to send to site admins | [
"Given",
"the",
"list",
"of",
"changes",
"in",
"available",
"updates",
"pick",
"those",
"to",
"send",
"to",
"site",
"admins"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L638-L696 |
214,349 | moodle/moodle | lib/classes/update/checker.php | checker.is_same_release | protected function is_same_release($remote, $local=null) {
if (is_null($local)) {
$this->load_current_environment();
$local = $this->currentrelease;
}
$pattern = '/^([0-9\.\+]+)([^(]*)/';
preg_match($pattern, $remote, $remotematches);
preg_match($patter... | php | protected function is_same_release($remote, $local=null) {
if (is_null($local)) {
$this->load_current_environment();
$local = $this->currentrelease;
}
$pattern = '/^([0-9\.\+]+)([^(]*)/';
preg_match($pattern, $remote, $remotematches);
preg_match($patter... | [
"protected",
"function",
"is_same_release",
"(",
"$",
"remote",
",",
"$",
"local",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"local",
")",
")",
"{",
"$",
"this",
"->",
"load_current_environment",
"(",
")",
";",
"$",
"local",
"=",
"$",
"t... | Compare two release labels and decide if they are the same
@param string $remote release info of the available update
@param null|string $local release info of the local code, defaults to $release defined in version.php
@return boolean true if the releases declare the same minor+major version | [
"Compare",
"two",
"release",
"labels",
"and",
"decide",
"if",
"they",
"are",
"the",
"same"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/checker.php#L824-L844 |
214,350 | moodle/moodle | calendar/classes/external/footer_options_exporter.php | footer_options_exporter.get_manage_subscriptions_button | protected function get_manage_subscriptions_button() {
if (calendar_user_can_add_event($this->calendar->course)) {
$managesubscriptionurl = new moodle_url('/calendar/managesubscriptions.php', $this->get_link_params());
return new \single_button($managesubscriptionurl,
... | php | protected function get_manage_subscriptions_button() {
if (calendar_user_can_add_event($this->calendar->course)) {
$managesubscriptionurl = new moodle_url('/calendar/managesubscriptions.php', $this->get_link_params());
return new \single_button($managesubscriptionurl,
... | [
"protected",
"function",
"get_manage_subscriptions_button",
"(",
")",
"{",
"if",
"(",
"calendar_user_can_add_event",
"(",
"$",
"this",
"->",
"calendar",
"->",
"course",
")",
")",
"{",
"$",
"managesubscriptionurl",
"=",
"new",
"moodle_url",
"(",
"'/calendar/managesub... | Get manage subscription button.
@return string The manage subscription button html. | [
"Get",
"manage",
"subscription",
"button",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/footer_options_exporter.php#L84-L90 |
214,351 | moodle/moodle | calendar/classes/external/footer_options_exporter.php | footer_options_exporter.get_link_params | protected function get_link_params() {
$params = [];
if (SITEID !== $this->calendar->course->id) {
$params['course'] = $this->calendar->course->id;
} else if (null !== $this->calendar->categoryid && $this->calendar->categoryid > 0) {
$params['category'] = $this->calendar-... | php | protected function get_link_params() {
$params = [];
if (SITEID !== $this->calendar->course->id) {
$params['course'] = $this->calendar->course->id;
} else if (null !== $this->calendar->categoryid && $this->calendar->categoryid > 0) {
$params['category'] = $this->calendar-... | [
"protected",
"function",
"get_link_params",
"(",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"if",
"(",
"SITEID",
"!==",
"$",
"this",
"->",
"calendar",
"->",
"course",
"->",
"id",
")",
"{",
"$",
"params",
"[",
"'course'",
"]",
"=",
"$",
"this",
"-... | Get the list of URL parameters for calendar links.
@return array | [
"Get",
"the",
"list",
"of",
"URL",
"parameters",
"for",
"calendar",
"links",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/footer_options_exporter.php#L97-L108 |
214,352 | moodle/moodle | cache/stores/mongodb/MongoDB/Operation/MapReduce.php | MapReduce.createCommand | private function createCommand(Server $server)
{
$cmd = [
'mapReduce' => $this->collectionName,
'map' => $this->map,
'reduce' => $this->reduce,
'out' => $this->out,
];
foreach (['finalize', 'jsMode', 'limit', 'maxTimeMS', 'verbose'] as $option... | php | private function createCommand(Server $server)
{
$cmd = [
'mapReduce' => $this->collectionName,
'map' => $this->map,
'reduce' => $this->reduce,
'out' => $this->out,
];
foreach (['finalize', 'jsMode', 'limit', 'maxTimeMS', 'verbose'] as $option... | [
"private",
"function",
"createCommand",
"(",
"Server",
"$",
"server",
")",
"{",
"$",
"cmd",
"=",
"[",
"'mapReduce'",
"=>",
"$",
"this",
"->",
"collectionName",
",",
"'map'",
"=>",
"$",
"this",
"->",
"map",
",",
"'reduce'",
"=>",
"$",
"this",
"->",
"red... | Create the mapReduce command.
@param Server $server
@return Command | [
"Create",
"the",
"mapReduce",
"command",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/Operation/MapReduce.php#L273-L299 |
214,353 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.compile | public function compile($source, array $tree, $name, $customEscape = false, $charset = 'UTF-8', $strictCallables = false, $entityFlags = ENT_COMPAT)
{
$this->pragmas = $this->defaultPragmas;
$this->sections = array();
$this->blocks = array();
$this->source ... | php | public function compile($source, array $tree, $name, $customEscape = false, $charset = 'UTF-8', $strictCallables = false, $entityFlags = ENT_COMPAT)
{
$this->pragmas = $this->defaultPragmas;
$this->sections = array();
$this->blocks = array();
$this->source ... | [
"public",
"function",
"compile",
"(",
"$",
"source",
",",
"array",
"$",
"tree",
",",
"$",
"name",
",",
"$",
"customEscape",
"=",
"false",
",",
"$",
"charset",
"=",
"'UTF-8'",
",",
"$",
"strictCallables",
"=",
"false",
",",
"$",
"entityFlags",
"=",
"ENT... | Compile a Mustache token parse tree into PHP source code.
@param string $source Mustache Template source code
@param string $tree Parse tree of Mustache tokens
@param string $name Mustache Template class name
@param bool $customEscape (default: false)
@param string $charset ... | [
"Compile",
"a",
"Mustache",
"token",
"parse",
"tree",
"into",
"PHP",
"source",
"code",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L43-L56 |
214,354 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.writeCode | private function writeCode($tree, $name)
{
$code = $this->walk($tree);
$sections = implode("\n", $this->sections);
$blocks = implode("\n", $this->blocks);
$klass = empty($this->sections) && empty($this->blocks) ? self::KLASS_NO_LAMBDAS : self::KLASS;
$callable = $th... | php | private function writeCode($tree, $name)
{
$code = $this->walk($tree);
$sections = implode("\n", $this->sections);
$blocks = implode("\n", $this->blocks);
$klass = empty($this->sections) && empty($this->blocks) ? self::KLASS_NO_LAMBDAS : self::KLASS;
$callable = $th... | [
"private",
"function",
"writeCode",
"(",
"$",
"tree",
",",
"$",
"name",
")",
"{",
"$",
"code",
"=",
"$",
"this",
"->",
"walk",
"(",
"$",
"tree",
")",
";",
"$",
"sections",
"=",
"implode",
"(",
"\"\\n\"",
",",
"$",
"this",
"->",
"sections",
")",
"... | Generate Mustache Template class PHP source.
@param array $tree Parse tree of Mustache tokens
@param string $name Mustache Template class name
@return string Generated PHP source code | [
"Generate",
"Mustache",
"Template",
"class",
"PHP",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L225-L235 |
214,355 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.blockVar | private function blockVar($nodes, $id, $start, $end, $otag, $ctag, $level)
{
$id = var_export($id, true);
$else = $this->walk($nodes, $level);
if ($else !== '') {
$else = sprintf($this->prepare(self::BLOCK_VAR_ELSE, $level + 1, false, true), $else);
}
return spr... | php | private function blockVar($nodes, $id, $start, $end, $otag, $ctag, $level)
{
$id = var_export($id, true);
$else = $this->walk($nodes, $level);
if ($else !== '') {
$else = sprintf($this->prepare(self::BLOCK_VAR_ELSE, $level + 1, false, true), $else);
}
return spr... | [
"private",
"function",
"blockVar",
"(",
"$",
"nodes",
",",
"$",
"id",
",",
"$",
"start",
",",
"$",
"end",
",",
"$",
"otag",
",",
"$",
"ctag",
",",
"$",
"level",
")",
"{",
"$",
"id",
"=",
"var_export",
"(",
"$",
"id",
",",
"true",
")",
";",
"$... | Generate Mustache Template inheritance block variable PHP source.
@param array $nodes Array of child tokens
@param string $id Section name
@param int $start Section start offset
@param int $end Section end offset
@param string $otag Current Mustache opening tag
@param string $ctag Current Mustache closin... | [
"Generate",
"Mustache",
"Template",
"inheritance",
"block",
"variable",
"PHP",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L259-L269 |
214,356 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.blockArg | private function blockArg($nodes, $id, $start, $end, $otag, $ctag, $level)
{
$key = $this->block($nodes);
$keystr = var_export($key, true);
$id = var_export($id, true);
return sprintf($this->prepare(self::BLOCK_ARG, $level), $id, $key);
} | php | private function blockArg($nodes, $id, $start, $end, $otag, $ctag, $level)
{
$key = $this->block($nodes);
$keystr = var_export($key, true);
$id = var_export($id, true);
return sprintf($this->prepare(self::BLOCK_ARG, $level), $id, $key);
} | [
"private",
"function",
"blockArg",
"(",
"$",
"nodes",
",",
"$",
"id",
",",
"$",
"start",
",",
"$",
"end",
",",
"$",
"otag",
",",
"$",
"ctag",
",",
"$",
"level",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"block",
"(",
"$",
"nodes",
")",
";... | Generate Mustache Template inheritance block argument PHP source.
@param array $nodes Array of child tokens
@param string $id Section name
@param int $start Section start offset
@param int $end Section end offset
@param string $otag Current Mustache opening tag
@param string $ctag Current Mustache closin... | [
"Generate",
"Mustache",
"Template",
"inheritance",
"block",
"argument",
"PHP",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L286-L293 |
214,357 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.block | private function block($nodes)
{
$code = $this->walk($nodes, 0);
$key = ucfirst(md5($code));
if (!isset($this->blocks[$key])) {
$this->blocks[$key] = sprintf($this->prepare(self::BLOCK_FUNCTION, 0), $key, $code);
}
return $key;
} | php | private function block($nodes)
{
$code = $this->walk($nodes, 0);
$key = ucfirst(md5($code));
if (!isset($this->blocks[$key])) {
$this->blocks[$key] = sprintf($this->prepare(self::BLOCK_FUNCTION, 0), $key, $code);
}
return $key;
} | [
"private",
"function",
"block",
"(",
"$",
"nodes",
")",
"{",
"$",
"code",
"=",
"$",
"this",
"->",
"walk",
"(",
"$",
"nodes",
",",
"0",
")",
";",
"$",
"key",
"=",
"ucfirst",
"(",
"md5",
"(",
"$",
"code",
")",
")",
";",
"if",
"(",
"!",
"isset",... | Generate Mustache Template inheritance block function PHP source.
@param array $nodes Array of child tokens
@return string key of new block function | [
"Generate",
"Mustache",
"Template",
"inheritance",
"block",
"function",
"PHP",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L311-L321 |
214,358 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.section | private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level)
{
$source = var_export(substr($this->source, $start, $end - $start), true);
$callable = $this->getCallable();
if ($otag !== '{{' || $ctag !== '}}') {
$delimTag = var_export(sprintf('{{= %s %s =... | php | private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level)
{
$source = var_export(substr($this->source, $start, $end - $start), true);
$callable = $this->getCallable();
if ($otag !== '{{' || $ctag !== '}}') {
$delimTag = var_export(sprintf('{{= %s %s =... | [
"private",
"function",
"section",
"(",
"$",
"nodes",
",",
"$",
"id",
",",
"$",
"filters",
",",
"$",
"start",
",",
"$",
"end",
",",
"$",
"otag",
",",
"$",
"ctag",
",",
"$",
"level",
")",
"{",
"$",
"source",
"=",
"var_export",
"(",
"substr",
"(",
... | Generate Mustache Template section PHP source.
@param array $nodes Array of child tokens
@param string $id Section name
@param string[] $filters Array of filters
@param int $start Section start offset
@param int $end Section end offset
@param string $otag Current Mustache opening tag
@... | [
"Generate",
"Mustache",
"Template",
"section",
"PHP",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L371-L396 |
214,359 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.invertedSection | private function invertedSection($nodes, $id, $filters, $level)
{
$method = $this->getFindMethod($id);
$id = var_export($id, true);
$filters = $this->getFilters($filters, $level);
return sprintf($this->prepare(self::INVERTED_SECTION, $level), $id, $method, $id, $filters, $this... | php | private function invertedSection($nodes, $id, $filters, $level)
{
$method = $this->getFindMethod($id);
$id = var_export($id, true);
$filters = $this->getFilters($filters, $level);
return sprintf($this->prepare(self::INVERTED_SECTION, $level), $id, $method, $id, $filters, $this... | [
"private",
"function",
"invertedSection",
"(",
"$",
"nodes",
",",
"$",
"id",
",",
"$",
"filters",
",",
"$",
"level",
")",
"{",
"$",
"method",
"=",
"$",
"this",
"->",
"getFindMethod",
"(",
"$",
"id",
")",
";",
"$",
"id",
"=",
"var_export",
"(",
"$",... | Generate Mustache Template inverted section PHP source.
@param array $nodes Array of child tokens
@param string $id Section name
@param string[] $filters Array of filters
@param int $level
@return string Generated inverted section PHP source code | [
"Generate",
"Mustache",
"Template",
"inverted",
"section",
"PHP",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L416-L423 |
214,360 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.partial | private function partial($id, $indent, $level)
{
if ($indent !== '') {
$indentParam = sprintf(self::PARTIAL_INDENT, var_export($indent, true));
} else {
$indentParam = '';
}
return sprintf(
$this->prepare(self::PARTIAL, $level),
var_ex... | php | private function partial($id, $indent, $level)
{
if ($indent !== '') {
$indentParam = sprintf(self::PARTIAL_INDENT, var_export($indent, true));
} else {
$indentParam = '';
}
return sprintf(
$this->prepare(self::PARTIAL, $level),
var_ex... | [
"private",
"function",
"partial",
"(",
"$",
"id",
",",
"$",
"indent",
",",
"$",
"level",
")",
"{",
"if",
"(",
"$",
"indent",
"!==",
"''",
")",
"{",
"$",
"indentParam",
"=",
"sprintf",
"(",
"self",
"::",
"PARTIAL_INDENT",
",",
"var_export",
"(",
"$",
... | Generate Mustache Template partial call PHP source.
@param string $id Partial name
@param string $indent Whitespace indent to apply to partial
@param int $level
@return string Generated partial call PHP source code | [
"Generate",
"Mustache",
"Template",
"partial",
"call",
"PHP",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L441-L454 |
214,361 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.parent | private function parent($id, $indent, array $children, $level)
{
$realChildren = array_filter($children, array(__CLASS__, 'onlyBlockArgs'));
if (empty($realChildren)) {
return sprintf($this->prepare(self::PARENT_NO_CONTEXT, $level), var_export($id, true));
}
return spri... | php | private function parent($id, $indent, array $children, $level)
{
$realChildren = array_filter($children, array(__CLASS__, 'onlyBlockArgs'));
if (empty($realChildren)) {
return sprintf($this->prepare(self::PARENT_NO_CONTEXT, $level), var_export($id, true));
}
return spri... | [
"private",
"function",
"parent",
"(",
"$",
"id",
",",
"$",
"indent",
",",
"array",
"$",
"children",
",",
"$",
"level",
")",
"{",
"$",
"realChildren",
"=",
"array_filter",
"(",
"$",
"children",
",",
"array",
"(",
"__CLASS__",
",",
"'onlyBlockArgs'",
")",
... | Generate Mustache Template inheritance parent call PHP source.
@param string $id Parent tag name
@param string $indent Whitespace indent to apply to parent
@param array $children Child nodes
@param int $level
@return string Generated PHP source code | [
"Generate",
"Mustache",
"Template",
"inheritance",
"parent",
"call",
"PHP",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L481-L494 |
214,362 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.variable | private function variable($id, $filters, $escape, $level)
{
$method = $this->getFindMethod($id);
$id = ($method !== 'last') ? var_export($id, true) : '';
$filters = $this->getFilters($filters, $level);
$value = $escape ? $this->getEscape() : '$value';
return sprintf(... | php | private function variable($id, $filters, $escape, $level)
{
$method = $this->getFindMethod($id);
$id = ($method !== 'last') ? var_export($id, true) : '';
$filters = $this->getFilters($filters, $level);
$value = $escape ? $this->getEscape() : '$value';
return sprintf(... | [
"private",
"function",
"variable",
"(",
"$",
"id",
",",
"$",
"filters",
",",
"$",
"escape",
",",
"$",
"level",
")",
"{",
"$",
"method",
"=",
"$",
"this",
"->",
"getFindMethod",
"(",
"$",
"id",
")",
";",
"$",
"id",
"=",
"(",
"$",
"method",
"!==",
... | Generate Mustache Template variable interpolation PHP source.
@param string $id Variable name
@param string[] $filters Array of filters
@param bool $escape Escape the variable value for output?
@param int $level
@return string Generated variable interpolation PHP source | [
"Generate",
"Mustache",
"Template",
"variable",
"interpolation",
"PHP",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L523-L531 |
214,363 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.getFilters | private function getFilters(array $filters, $level)
{
if (empty($filters)) {
return '';
}
$name = array_shift($filters);
$method = $this->getFindMethod($name);
$filter = ($method !== 'last') ? var_export($name, true) : '';
$callable = $this->getCa... | php | private function getFilters(array $filters, $level)
{
if (empty($filters)) {
return '';
}
$name = array_shift($filters);
$method = $this->getFindMethod($name);
$filter = ($method !== 'last') ? var_export($name, true) : '';
$callable = $this->getCa... | [
"private",
"function",
"getFilters",
"(",
"array",
"$",
"filters",
",",
"$",
"level",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"filters",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"name",
"=",
"array_shift",
"(",
"$",
"filters",
")",
";",
"$",
... | Generate Mustache Template variable filtering PHP source.
@param string[] $filters Array of filters
@param int $level
@return string Generated filter PHP source | [
"Generate",
"Mustache",
"Template",
"variable",
"filtering",
"PHP",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L549-L562 |
214,364 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.text | private function text($text, $level)
{
$indentNextLine = (substr($text, -1) === "\n");
$code = sprintf($this->prepare(self::TEXT, $level), $this->flushIndent(), var_export($text, true));
$this->indentNextLine = $indentNextLine;
return $code;
} | php | private function text($text, $level)
{
$indentNextLine = (substr($text, -1) === "\n");
$code = sprintf($this->prepare(self::TEXT, $level), $this->flushIndent(), var_export($text, true));
$this->indentNextLine = $indentNextLine;
return $code;
} | [
"private",
"function",
"text",
"(",
"$",
"text",
",",
"$",
"level",
")",
"{",
"$",
"indentNextLine",
"=",
"(",
"substr",
"(",
"$",
"text",
",",
"-",
"1",
")",
"===",
"\"\\n\"",
")",
";",
"$",
"code",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"prepa... | Generate Mustache Template output Buffer call PHP source.
@param string $text
@param int $level
@return string Generated output Buffer call PHP source | [
"Generate",
"Mustache",
"Template",
"output",
"Buffer",
"call",
"PHP",
"source",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L575-L582 |
214,365 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.prepare | private function prepare($text, $bonus = 0, $prependNewline = true, $appendNewline = false)
{
$text = ($prependNewline ? "\n" : '') . trim($text);
if ($prependNewline) {
$bonus++;
}
if ($appendNewline) {
$text .= "\n";
}
return preg_replace("/... | php | private function prepare($text, $bonus = 0, $prependNewline = true, $appendNewline = false)
{
$text = ($prependNewline ? "\n" : '') . trim($text);
if ($prependNewline) {
$bonus++;
}
if ($appendNewline) {
$text .= "\n";
}
return preg_replace("/... | [
"private",
"function",
"prepare",
"(",
"$",
"text",
",",
"$",
"bonus",
"=",
"0",
",",
"$",
"prependNewline",
"=",
"true",
",",
"$",
"appendNewline",
"=",
"false",
")",
"{",
"$",
"text",
"=",
"(",
"$",
"prependNewline",
"?",
"\"\\n\"",
":",
"''",
")",... | Prepare PHP source code snippet for output.
@param string $text
@param int $bonus Additional indent level (default: 0)
@param bool $prependNewline Prepend a newline to the snippet? (default: true)
@param bool $appendNewline Append a newline to the snippet? (default: false)
@return string PHP source c... | [
"Prepare",
"PHP",
"source",
"code",
"snippet",
"for",
"output",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L594-L605 |
214,366 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.getEscape | private function getEscape($value = '$value')
{
if ($this->customEscape) {
return sprintf(self::CUSTOM_ESCAPE, $value);
}
return sprintf(self::DEFAULT_ESCAPE, $value, var_export($this->entityFlags, true), var_export($this->charset, true));
} | php | private function getEscape($value = '$value')
{
if ($this->customEscape) {
return sprintf(self::CUSTOM_ESCAPE, $value);
}
return sprintf(self::DEFAULT_ESCAPE, $value, var_export($this->entityFlags, true), var_export($this->charset, true));
} | [
"private",
"function",
"getEscape",
"(",
"$",
"value",
"=",
"'$value'",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"customEscape",
")",
"{",
"return",
"sprintf",
"(",
"self",
"::",
"CUSTOM_ESCAPE",
",",
"$",
"value",
")",
";",
"}",
"return",
"sprintf",
"(... | Get the current escaper.
@param string $value (default: '$value')
@return string Either a custom callback, or an inline call to `htmlspecialchars` | [
"Get",
"the",
"current",
"escaper",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L617-L624 |
214,367 | moodle/moodle | lib/mustache/src/Mustache/Compiler.php | Mustache_Compiler.getCallable | private function getCallable($variable = '$value')
{
$tpl = $this->strictCallables ? self::STRICT_IS_CALLABLE : self::IS_CALLABLE;
return sprintf($tpl, $variable, $variable);
} | php | private function getCallable($variable = '$value')
{
$tpl = $this->strictCallables ? self::STRICT_IS_CALLABLE : self::IS_CALLABLE;
return sprintf($tpl, $variable, $variable);
} | [
"private",
"function",
"getCallable",
"(",
"$",
"variable",
"=",
"'$value'",
")",
"{",
"$",
"tpl",
"=",
"$",
"this",
"->",
"strictCallables",
"?",
"self",
"::",
"STRICT_IS_CALLABLE",
":",
"self",
"::",
"IS_CALLABLE",
";",
"return",
"sprintf",
"(",
"$",
"tp... | Helper function to compile strict vs lax "is callable" logic.
@param string $variable (default: '$value')
@return string "is callable" logic | [
"Helper",
"function",
"to",
"compile",
"strict",
"vs",
"lax",
"is",
"callable",
"logic",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Compiler.php#L668-L673 |
214,368 | moodle/moodle | admin/tool/mobile/classes/external.php | external.get_config | public static function get_config($section = '') {
$params = self::validate_parameters(self::get_config_parameters(), array('section' => $section));
$settings = api::get_config($params['section']);
$result['settings'] = array();
foreach ($settings as $name => $value) {
$res... | php | public static function get_config($section = '') {
$params = self::validate_parameters(self::get_config_parameters(), array('section' => $section));
$settings = api::get_config($params['section']);
$result['settings'] = array();
foreach ($settings as $name => $value) {
$res... | [
"public",
"static",
"function",
"get_config",
"(",
"$",
"section",
"=",
"''",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_config_parameters",
"(",
")",
",",
"array",
"(",
"'section'",
"=>",
"$",
"section",
")"... | Returns a list of site settings, filtering by section.
@param string $section settings section name
@return array with the settings and warnings
@since Moodle 3.2 | [
"Returns",
"a",
"list",
"of",
"site",
"settings",
"filtering",
"by",
"section",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/mobile/classes/external.php#L208-L223 |
214,369 | moodle/moodle | admin/tool/mobile/classes/external.php | external.get_autologin_key | public static function get_autologin_key($privatetoken) {
global $CFG, $DB, $USER;
$params = self::validate_parameters(self::get_autologin_key_parameters(), array('privatetoken' => $privatetoken));
$privatetoken = $params['privatetoken'];
$context = context_system::instance();
... | php | public static function get_autologin_key($privatetoken) {
global $CFG, $DB, $USER;
$params = self::validate_parameters(self::get_autologin_key_parameters(), array('privatetoken' => $privatetoken));
$privatetoken = $params['privatetoken'];
$context = context_system::instance();
... | [
"public",
"static",
"function",
"get_autologin_key",
"(",
"$",
"privatetoken",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_autologin_key_parameters",
... | Creates an auto-login key for the current user. Is created only in https sites and is restricted by time and ip address.
Please note that it only works if the request comes from the Moodle mobile or desktop app.
@param string $privatetoken the user private token for validating the request
@return array with the setti... | [
"Creates",
"an",
"auto",
"-",
"login",
"key",
"for",
"the",
"current",
"user",
".",
"Is",
"created",
"only",
"in",
"https",
"sites",
"and",
"is",
"restricted",
"by",
"time",
"and",
"ip",
"address",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/mobile/classes/external.php#L271-L329 |
214,370 | moodle/moodle | admin/tool/mobile/classes/external.php | external.get_content | public static function get_content($component, $method, $args = array()) {
global $OUTPUT, $PAGE, $USER;
$params = self::validate_parameters(self::get_content_parameters(),
array(
'component' => $component,
'method' => $method,
'args' => $args... | php | public static function get_content($component, $method, $args = array()) {
global $OUTPUT, $PAGE, $USER;
$params = self::validate_parameters(self::get_content_parameters(),
array(
'component' => $component,
'method' => $method,
'args' => $args... | [
"public",
"static",
"function",
"get_content",
"(",
"$",
"component",
",",
"$",
"method",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"OUTPUT",
",",
"$",
"PAGE",
",",
"$",
"USER",
";",
"$",
"params",
"=",
"self",
"::",
"valid... | Returns a piece of content to be displayed in the Mobile app, it usually returns a template, javascript and
other structured data that will be used to render a view in the Mobile app..
Callbacks (placed in \$component\output\mobile) that are called by this web service are responsible for doing the
appropriate security... | [
"Returns",
"a",
"piece",
"of",
"content",
"to",
"be",
"displayed",
"in",
"the",
"Mobile",
"app",
"it",
"usually",
"returns",
"a",
"template",
"javascript",
"and",
"other",
"structured",
"data",
"that",
"will",
"be",
"used",
"to",
"render",
"a",
"view",
"in... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/mobile/classes/external.php#L384-L427 |
214,371 | moodle/moodle | admin/tool/mobile/classes/external.php | external.call_external_functions | public static function call_external_functions($requests) {
global $SESSION;
$params = self::validate_parameters(self::call_external_functions_parameters(), ['requests' => $requests]);
// We need to check if the functions being called are included in the service of the current token.
/... | php | public static function call_external_functions($requests) {
global $SESSION;
$params = self::validate_parameters(self::call_external_functions_parameters(), ['requests' => $requests]);
// We need to check if the functions being called are included in the service of the current token.
/... | [
"public",
"static",
"function",
"call_external_functions",
"(",
"$",
"requests",
")",
"{",
"global",
"$",
"SESSION",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"call_external_functions_parameters",
"(",
")",
",",
"[",
"'requ... | Call multiple external functions and return all responses.
@param array $requests List of requests.
@return array Responses.
@since Moodle 3.7 | [
"Call",
"multiple",
"external",
"functions",
"and",
"return",
"all",
"responses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/mobile/classes/external.php#L501-L568 |
214,372 | moodle/moodle | mod/quiz/report/default.php | quiz_default_report.get_current_group | public function get_current_group($cm, $course, $context) {
$groupmode = groups_get_activity_groupmode($cm, $course);
$currentgroup = groups_get_activity_group($cm, true);
if ($groupmode == SEPARATEGROUPS && !$currentgroup && !has_capability('moodle/site:accessallgroups', $context)) {
... | php | public function get_current_group($cm, $course, $context) {
$groupmode = groups_get_activity_groupmode($cm, $course);
$currentgroup = groups_get_activity_group($cm, true);
if ($groupmode == SEPARATEGROUPS && !$currentgroup && !has_capability('moodle/site:accessallgroups', $context)) {
... | [
"public",
"function",
"get_current_group",
"(",
"$",
"cm",
",",
"$",
"course",
",",
"$",
"context",
")",
"{",
"$",
"groupmode",
"=",
"groups_get_activity_groupmode",
"(",
"$",
"cm",
",",
"$",
"course",
")",
";",
"$",
"currentgroup",
"=",
"groups_get_activity... | Get the current group for the user user looking at the report.
@param object $cm the course_module information.
@param object $coures the course settings.
@param context $context the quiz context.
@return int the current group id, if applicable. 0 for all users,
NO_GROUPS_ALLOWED if the user cannot see any group. | [
"Get",
"the",
"current",
"group",
"for",
"the",
"user",
"user",
"looking",
"at",
"the",
"report",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/default.php#L83-L92 |
214,373 | moodle/moodle | grade/import/csv/classes/output/renderer.php | gradeimport_csv_renderer.standard_upload_file_form | public function standard_upload_file_form($course, $mform) {
$output = groups_print_course_menu($course, 'index.php?id=' . $course->id, true);
$output .= html_writer::start_tag('div', array('class' => 'clearer'));
$output .= html_writer::end_tag('div');
// Form.
ob_start();
... | php | public function standard_upload_file_form($course, $mform) {
$output = groups_print_course_menu($course, 'index.php?id=' . $course->id, true);
$output .= html_writer::start_tag('div', array('class' => 'clearer'));
$output .= html_writer::end_tag('div');
// Form.
ob_start();
... | [
"public",
"function",
"standard_upload_file_form",
"(",
"$",
"course",
",",
"$",
"mform",
")",
"{",
"$",
"output",
"=",
"groups_print_course_menu",
"(",
"$",
"course",
",",
"'index.php?id='",
".",
"$",
"course",
"->",
"id",
",",
"true",
")",
";",
"$",
"out... | A renderer for the standard upload file form.
@param object $course The course we are doing all of this action in.
@param object $mform The mform for uploading CSV files.
@return string html to be displayed. | [
"A",
"renderer",
"for",
"the",
"standard",
"upload",
"file",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/output/renderer.php#L43-L56 |
214,374 | moodle/moodle | grade/import/csv/classes/output/renderer.php | gradeimport_csv_renderer.import_preview_page | public function import_preview_page($header, $data) {
$html = $this->output->heading(get_string('importpreview', 'grades'));
$table = new html_table();
$table->head = $header;
$table->data = $data;
$html .= html_writer::table($table);
return $html;
} | php | public function import_preview_page($header, $data) {
$html = $this->output->heading(get_string('importpreview', 'grades'));
$table = new html_table();
$table->head = $header;
$table->data = $data;
$html .= html_writer::table($table);
return $html;
} | [
"public",
"function",
"import_preview_page",
"(",
"$",
"header",
",",
"$",
"data",
")",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"output",
"->",
"heading",
"(",
"get_string",
"(",
"'importpreview'",
",",
"'grades'",
")",
")",
";",
"$",
"table",
"=",
"... | A renderer for the CSV file preview.
@param array $header Column headers from the CSV file.
@param array $data The rest of the data from the CSV file.
@return string html to be displayed. | [
"A",
"renderer",
"for",
"the",
"CSV",
"file",
"preview",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/output/renderer.php#L65-L75 |
214,375 | moodle/moodle | grade/import/csv/classes/output/renderer.php | gradeimport_csv_renderer.errors | public function errors($errors) {
$html = '';
foreach ($errors as $error) {
$html .= $this->output->notification($error);
}
return $html;
} | php | public function errors($errors) {
$html = '';
foreach ($errors as $error) {
$html .= $this->output->notification($error);
}
return $html;
} | [
"public",
"function",
"errors",
"(",
"$",
"errors",
")",
"{",
"$",
"html",
"=",
"''",
";",
"foreach",
"(",
"$",
"errors",
"as",
"$",
"error",
")",
"{",
"$",
"html",
".=",
"$",
"this",
"->",
"output",
"->",
"notification",
"(",
"$",
"error",
")",
... | A renderer for errors generated trying to import the CSV file.
@param array $errors Display import errors.
@return string errors as html to be displayed. | [
"A",
"renderer",
"for",
"errors",
"generated",
"trying",
"to",
"import",
"the",
"CSV",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/import/csv/classes/output/renderer.php#L83-L89 |
214,376 | moodle/moodle | report/log/classes/renderer.php | report_log_renderer.render_report_log | protected function render_report_log(report_log_renderable $reportlog) {
if (empty($reportlog->selectedlogreader)) {
echo $this->output->notification(get_string('nologreaderenabled', 'report_log'), 'notifyproblem');
return;
}
if ($reportlog->showselectorform) {
... | php | protected function render_report_log(report_log_renderable $reportlog) {
if (empty($reportlog->selectedlogreader)) {
echo $this->output->notification(get_string('nologreaderenabled', 'report_log'), 'notifyproblem');
return;
}
if ($reportlog->showselectorform) {
... | [
"protected",
"function",
"render_report_log",
"(",
"report_log_renderable",
"$",
"reportlog",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"reportlog",
"->",
"selectedlogreader",
")",
")",
"{",
"echo",
"$",
"this",
"->",
"output",
"->",
"notification",
"(",
"get_st... | Render log report page.
@param report_log_renderable $reportlog object of report_log. | [
"Render",
"log",
"report",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/log/classes/renderer.php#L52-L64 |
214,377 | moodle/moodle | course/classes/analytics/target/course_gradetopass.php | course_gradetopass.get_course_gradetopass | protected function get_course_gradetopass($courseid) {
if (!isset($this->coursesgradetopass[$courseid])) {
// Get course grade_item.
$courseitem = \grade_item::fetch_course_item($courseid);
$ci = array();
$ci['courseitemid'] = $courseitem->id;
if ($c... | php | protected function get_course_gradetopass($courseid) {
if (!isset($this->coursesgradetopass[$courseid])) {
// Get course grade_item.
$courseitem = \grade_item::fetch_course_item($courseid);
$ci = array();
$ci['courseitemid'] = $courseitem->id;
if ($c... | [
"protected",
"function",
"get_course_gradetopass",
"(",
"$",
"courseid",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"coursesgradetopass",
"[",
"$",
"courseid",
"]",
")",
")",
"{",
"// Get course grade_item.",
"$",
"courseitem",
"=",
"\\",
"gr... | Returns the grade to pass a course.
Save the value in $coursesgradetopass array to prevent new accesses to the database.
@param int $courseid The course id.
@return array The courseitem id and the required grade to pass the course. | [
"Returns",
"the",
"grade",
"to",
"pass",
"a",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/analytics/target/course_gradetopass.php#L59-L76 |
214,378 | moodle/moodle | course/classes/analytics/target/course_gradetopass.php | course_gradetopass.get_user_grade | protected function get_user_grade($courseitemid, $userid) {
// If the user grade for this course is not available, get all the grades for the course.
if (!isset($this->coursesgrades[$courseitemid])) {
// Ony a course is cached to avoid high memory usage.
unset($this->coursesgrade... | php | protected function get_user_grade($courseitemid, $userid) {
// If the user grade for this course is not available, get all the grades for the course.
if (!isset($this->coursesgrades[$courseitemid])) {
// Ony a course is cached to avoid high memory usage.
unset($this->coursesgrade... | [
"protected",
"function",
"get_user_grade",
"(",
"$",
"courseitemid",
",",
"$",
"userid",
")",
"{",
"// If the user grade for this course is not available, get all the grades for the course.",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"coursesgrades",
"[",
"$",
"c... | Returns the grade of a user in a course.
Saves the grades of all course users in $coursesgrades array to prevent new accesses to the database.
@param int $courseitemid The course item id.
@param int $userid the user whose grade is requested.
@return array The courseitem id and the required grade to pass the course. | [
"Returns",
"the",
"grade",
"of",
"a",
"user",
"in",
"a",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/analytics/target/course_gradetopass.php#L87-L107 |
214,379 | moodle/moodle | course/classes/analytics/target/course_gradetopass.php | course_gradetopass.calculate_sample | protected function calculate_sample($sampleid, \core_analytics\analysable $course, $starttime = false, $endtime = false) {
$userenrol = $this->retrieve('user_enrolments', $sampleid);
// Get course grade to pass.
$courseitem = $this->get_course_gradetopass($course->get_id());
// Get th... | php | protected function calculate_sample($sampleid, \core_analytics\analysable $course, $starttime = false, $endtime = false) {
$userenrol = $this->retrieve('user_enrolments', $sampleid);
// Get course grade to pass.
$courseitem = $this->get_course_gradetopass($course->get_id());
// Get th... | [
"protected",
"function",
"calculate_sample",
"(",
"$",
"sampleid",
",",
"\\",
"core_analytics",
"\\",
"analysable",
"$",
"course",
",",
"$",
"starttime",
"=",
"false",
",",
"$",
"endtime",
"=",
"false",
")",
"{",
"$",
"userenrol",
"=",
"$",
"this",
"->",
... | The user's grade in the course sets the target value.
@param int $sampleid
@param \core_analytics\analysable $course
@param int $starttime
@param int $endtime
@return float 0 -> course grade to pass achieved, 1 -> course grade to pass not achieved | [
"The",
"user",
"s",
"grade",
"in",
"the",
"course",
"sets",
"the",
"target",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/analytics/target/course_gradetopass.php#L165-L180 |
214,380 | moodle/moodle | admin/tool/dataprivacy/classes/contextlevel.php | contextlevel.get_record_by_contextlevel | public static function get_record_by_contextlevel($contextlevel, $exception = true) {
global $DB;
$cache = \cache::make('tool_dataprivacy', 'contextlevel');
if ($data = $cache->get($contextlevel)) {
return new static(0, $data);
}
if (!$record = $DB->get_record(self:... | php | public static function get_record_by_contextlevel($contextlevel, $exception = true) {
global $DB;
$cache = \cache::make('tool_dataprivacy', 'contextlevel');
if ($data = $cache->get($contextlevel)) {
return new static(0, $data);
}
if (!$record = $DB->get_record(self:... | [
"public",
"static",
"function",
"get_record_by_contextlevel",
"(",
"$",
"contextlevel",
",",
"$",
"exception",
"=",
"true",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"cache",
"=",
"\\",
"cache",
"::",
"make",
"(",
"'tool_dataprivacy'",
",",
"'contextlevel'",
... | Returns an instance by contextlevel.
@param mixed $contextlevel
@param mixed $exception
@return null | [
"Returns",
"an",
"instance",
"by",
"contextlevel",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/contextlevel.php#L69-L86 |
214,381 | moodle/moodle | enrol/manual/lib.php | enrol_manual_plugin.get_manual_enrol_link | public function get_manual_enrol_link($instance) {
$name = $this->get_name();
if ($instance->enrol !== $name) {
throw new coding_exception('invalid enrol instance!');
}
if (!enrol_is_enabled($name)) {
return NULL;
}
$context = context_course::ins... | php | public function get_manual_enrol_link($instance) {
$name = $this->get_name();
if ($instance->enrol !== $name) {
throw new coding_exception('invalid enrol instance!');
}
if (!enrol_is_enabled($name)) {
return NULL;
}
$context = context_course::ins... | [
"public",
"function",
"get_manual_enrol_link",
"(",
"$",
"instance",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"get_name",
"(",
")",
";",
"if",
"(",
"$",
"instance",
"->",
"enrol",
"!==",
"$",
"name",
")",
"{",
"throw",
"new",
"coding_exception",
... | Returns link to manual enrol UI if exists.
Does the access control tests automatically.
@param stdClass $instance
@return moodle_url | [
"Returns",
"link",
"to",
"manual",
"enrol",
"UI",
"if",
"exists",
".",
"Does",
"the",
"access",
"control",
"tests",
"automatically",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/manual/lib.php#L59-L78 |
214,382 | moodle/moodle | enrol/manual/lib.php | enrol_manual_plugin.get_action_icons | public function get_action_icons(stdClass $instance) {
global $OUTPUT;
$context = context_course::instance($instance->courseid);
$icons = array();
if (has_capability('enrol/manual:enrol', $context) or has_capability('enrol/manual:unenrol', $context)) {
$managelink = new moo... | php | public function get_action_icons(stdClass $instance) {
global $OUTPUT;
$context = context_course::instance($instance->courseid);
$icons = array();
if (has_capability('enrol/manual:enrol', $context) or has_capability('enrol/manual:unenrol', $context)) {
$managelink = new moo... | [
"public",
"function",
"get_action_icons",
"(",
"stdClass",
"$",
"instance",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"context",
"=",
"context_course",
"::",
"instance",
"(",
"$",
"instance",
"->",
"courseid",
")",
";",
"$",
"icons",
"=",
"array",
"(",
... | Returns edit icons for the page with list of instances.
@param stdClass $instance
@return array | [
"Returns",
"edit",
"icons",
"for",
"the",
"page",
"with",
"list",
"of",
"instances",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/manual/lib.php#L107-L121 |
214,383 | moodle/moodle | enrol/manual/lib.php | enrol_manual_plugin.get_manual_enrol_button | public function get_manual_enrol_button(course_enrolment_manager $manager) {
global $CFG, $PAGE;
require_once($CFG->dirroot.'/cohort/lib.php');
$instance = null;
$instances = array();
foreach ($manager->get_enrolment_instances() as $tempinstance) {
if ($tempinstance-... | php | public function get_manual_enrol_button(course_enrolment_manager $manager) {
global $CFG, $PAGE;
require_once($CFG->dirroot.'/cohort/lib.php');
$instance = null;
$instances = array();
foreach ($manager->get_enrolment_instances() as $tempinstance) {
if ($tempinstance-... | [
"public",
"function",
"get_manual_enrol_button",
"(",
"course_enrolment_manager",
"$",
"manager",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/cohort/lib.php'",
")",
";",
"$",
"instance",
"=",... | Returns a button to manually enrol users through the manual enrolment plugin.
By default the first manual enrolment plugin instance available in the course is used.
If no manual enrolment instances exist within the course then false is returned.
This function also adds a quickenrolment JS ui to the page so that users... | [
"Returns",
"a",
"button",
"to",
"manually",
"enrol",
"users",
"through",
"the",
"manual",
"enrolment",
"plugin",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/manual/lib.php#L196-L228 |
214,384 | moodle/moodle | enrol/manual/lib.php | enrol_manual_plugin.get_bulk_operations | public function get_bulk_operations(course_enrolment_manager $manager) {
global $CFG;
require_once($CFG->dirroot.'/enrol/manual/locallib.php');
$context = $manager->get_context();
$bulkoperations = array();
if (has_capability("enrol/manual:manage", $context)) {
$bulko... | php | public function get_bulk_operations(course_enrolment_manager $manager) {
global $CFG;
require_once($CFG->dirroot.'/enrol/manual/locallib.php');
$context = $manager->get_context();
$bulkoperations = array();
if (has_capability("enrol/manual:manage", $context)) {
$bulko... | [
"public",
"function",
"get_bulk_operations",
"(",
"course_enrolment_manager",
"$",
"manager",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/enrol/manual/locallib.php'",
")",
";",
"$",
"context",
"=",
"$",
"manager... | The manual plugin has several bulk operations that can be performed.
@param course_enrolment_manager $manager
@return array | [
"The",
"manual",
"plugin",
"has",
"several",
"bulk",
"operations",
"that",
"can",
"be",
"performed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/manual/lib.php#L359-L371 |
214,385 | moodle/moodle | enrol/manual/lib.php | enrol_manual_plugin.enrol_cohort | public function enrol_cohort(stdClass $instance, $cohortid, $roleid = null, $timestart = 0, $timeend = 0, $status = null, $recovergrades = null) {
global $DB;
$context = context_course::instance($instance->courseid);
list($esql, $params) = get_enrolled_sql($context);
$sql = "SELECT cm.us... | php | public function enrol_cohort(stdClass $instance, $cohortid, $roleid = null, $timestart = 0, $timeend = 0, $status = null, $recovergrades = null) {
global $DB;
$context = context_course::instance($instance->courseid);
list($esql, $params) = get_enrolled_sql($context);
$sql = "SELECT cm.us... | [
"public",
"function",
"enrol_cohort",
"(",
"stdClass",
"$",
"instance",
",",
"$",
"cohortid",
",",
"$",
"roleid",
"=",
"null",
",",
"$",
"timestart",
"=",
"0",
",",
"$",
"timeend",
"=",
"0",
",",
"$",
"status",
"=",
"null",
",",
"$",
"recovergrades",
... | Enrol all not enrolled cohort members into course via enrol instance.
@param stdClass $instance
@param int $cohortid
@param int $roleid optional role id
@param int $timestart 0 means unknown
@param int $timeend 0 means forever
@param int $status default to ENROL_USER_ACTIVE for new enrolments, no change by default in ... | [
"Enrol",
"all",
"not",
"enrolled",
"cohort",
"members",
"into",
"course",
"via",
"enrol",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/manual/lib.php#L506-L517 |
214,386 | moodle/moodle | badges/criteria/award_criteria_cohort.php | award_criteria_cohort.validate | public function validate() {
global $DB;
$params = array_keys($this->params);
$method = ($this->method == BADGE_CRITERIA_AGGREGATION_ALL);
$singleparam = (count($params) == 1);
foreach ($params as $param) {
// Perform check if there only one parameter with any type o... | php | public function validate() {
global $DB;
$params = array_keys($this->params);
$method = ($this->method == BADGE_CRITERIA_AGGREGATION_ALL);
$singleparam = (count($params) == 1);
foreach ($params as $param) {
// Perform check if there only one parameter with any type o... | [
"public",
"function",
"validate",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"params",
")",
";",
"$",
"method",
"=",
"(",
"$",
"this",
"->",
"method",
"==",
"BADGE_CRITERIA_AGGREGATION_ALL",
")",
... | Checks criteria for any major problems.
@return array A list containing status and an error message (if any). | [
"Checks",
"criteria",
"for",
"any",
"major",
"problems",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/criteria/award_criteria_cohort.php#L197-L212 |
214,387 | moodle/moodle | group/classes/privacy/provider.php | provider.get_group_members_in_context | public static function get_group_members_in_context(userlist $userlist, string $component, int $itemid = 0) {
$context = $userlist->get_context();
if (!$context instanceof \context_course) {
return;
}
// Group members in the given context.
$sql = "SELECT gm.userid
... | php | public static function get_group_members_in_context(userlist $userlist, string $component, int $itemid = 0) {
$context = $userlist->get_context();
if (!$context instanceof \context_course) {
return;
}
// Group members in the given context.
$sql = "SELECT gm.userid
... | [
"public",
"static",
"function",
"get_group_members_in_context",
"(",
"userlist",
"$",
"userlist",
",",
"string",
"$",
"component",
",",
"int",
"$",
"itemid",
"=",
"0",
")",
"{",
"$",
"context",
"=",
"$",
"userlist",
"->",
"get_context",
"(",
")",
";",
"if"... | Add the list of users who are members of some groups in the specified constraints.
@param userlist $userlist The userlist to add the users to.
@param string $component The component to check.
@param int $itemid Optional itemid associated with component. | [
"Add",
"the",
"list",
"of",
"users",
"who",
"are",
"members",
"of",
"some",
"groups",
"in",
"the",
"specified",
"constraints",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/group/classes/privacy/provider.php#L229-L255 |
214,388 | moodle/moodle | group/classes/privacy/provider.php | provider.get_contexts_for_group_member | public static function get_contexts_for_group_member(int $userid, string $component, int $itemid = 0) {
$contextlist = new contextlist();
$sql = "SELECT ctx.id
FROM {groups_members} gm
JOIN {groups} g ON gm.groupid = g.id
JOIN {context} ctx ON g.cou... | php | public static function get_contexts_for_group_member(int $userid, string $component, int $itemid = 0) {
$contextlist = new contextlist();
$sql = "SELECT ctx.id
FROM {groups_members} gm
JOIN {groups} g ON gm.groupid = g.id
JOIN {context} ctx ON g.cou... | [
"public",
"static",
"function",
"get_contexts_for_group_member",
"(",
"int",
"$",
"userid",
",",
"string",
"$",
"component",
",",
"int",
"$",
"itemid",
"=",
"0",
")",
"{",
"$",
"contextlist",
"=",
"new",
"contextlist",
"(",
")",
";",
"$",
"sql",
"=",
"\"... | Get the list of contexts that contain group membership for the specified user.
@param int $userid The user to search.
@param string $component The component to check.
@param int $itemid Optional itemid associated with component.
@return contextlist The contextlist containing the list o... | [
"Get",
"the",
"list",
"of",
"contexts",
"that",
"contain",
"group",
"membership",
"for",
"the",
"specified",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/group/classes/privacy/provider.php#L307-L333 |
214,389 | moodle/moodle | admin/tool/xmldb/actions/XMLDBAction.class.php | XMLDBAction.init | function init() {
$this->does_generate = ACTION_NONE;
$this->title = strtolower(get_class($this));
$this->str = array();
$this->output = NULL;
$this->errormsg = NULL;
$this->subaction = NULL;
$this->sesskey_protected = true;
} | php | function init() {
$this->does_generate = ACTION_NONE;
$this->title = strtolower(get_class($this));
$this->str = array();
$this->output = NULL;
$this->errormsg = NULL;
$this->subaction = NULL;
$this->sesskey_protected = true;
} | [
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"does_generate",
"=",
"ACTION_NONE",
";",
"$",
"this",
"->",
"title",
"=",
"strtolower",
"(",
"get_class",
"(",
"$",
"this",
")",
")",
";",
"$",
"this",
"->",
"str",
"=",
"array",
"(",
")",
";",... | Init method, every subclass will have its own,
always calling the parent one | [
"Init",
"method",
"every",
"subclass",
"will",
"have",
"its",
"own",
"always",
"calling",
"the",
"parent",
"one"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/xmldb/actions/XMLDBAction.class.php#L67-L75 |
214,390 | moodle/moodle | admin/tool/xmldb/actions/XMLDBAction.class.php | XMLDBAction.loadStrings | function loadStrings($strings) {
// Load some commonly used strings
if (get_string_manager()->string_exists($this->title, 'tool_xmldb')) {
$this->str['title'] = get_string($this->title, 'tool_xmldb');
} else {
$this->str['title'] = $this->title;
}
// Now ... | php | function loadStrings($strings) {
// Load some commonly used strings
if (get_string_manager()->string_exists($this->title, 'tool_xmldb')) {
$this->str['title'] = get_string($this->title, 'tool_xmldb');
} else {
$this->str['title'] = $this->title;
}
// Now ... | [
"function",
"loadStrings",
"(",
"$",
"strings",
")",
"{",
"// Load some commonly used strings",
"if",
"(",
"get_string_manager",
"(",
")",
"->",
"string_exists",
"(",
"$",
"this",
"->",
"title",
",",
"'tool_xmldb'",
")",
")",
"{",
"$",
"this",
"->",
"str",
"... | loadStrings method, loads the required strings specified in the
array parameter
@param string[] $strings | [
"loadStrings",
"method",
"loads",
"the",
"required",
"strings",
"specified",
"in",
"the",
"array",
"parameter"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/xmldb/actions/XMLDBAction.class.php#L126-L140 |
214,391 | moodle/moodle | admin/tool/xmldb/actions/XMLDBAction.class.php | XMLDBAction.invoke | function invoke() {
global $SESSION;
// Sesskey protection
if ($this->sesskey_protected) {
require_sesskey();
}
// If we are used any dir, save it in the lastused session object
// Some actions can use it to perform positioning
if ($lastused = optio... | php | function invoke() {
global $SESSION;
// Sesskey protection
if ($this->sesskey_protected) {
require_sesskey();
}
// If we are used any dir, save it in the lastused session object
// Some actions can use it to perform positioning
if ($lastused = optio... | [
"function",
"invoke",
"(",
")",
"{",
"global",
"$",
"SESSION",
";",
"// Sesskey protection",
"if",
"(",
"$",
"this",
"->",
"sesskey_protected",
")",
"{",
"require_sesskey",
"(",
")",
";",
"}",
"// If we are used any dir, save it in the lastused session object",
"// So... | main invoke method, it sets the postaction attribute
if possible and checks sesskey_protected if needed | [
"main",
"invoke",
"method",
"it",
"sets",
"the",
"postaction",
"attribute",
"if",
"possible",
"and",
"checks",
"sesskey_protected",
"if",
"needed"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/xmldb/actions/XMLDBAction.class.php#L146-L166 |
214,392 | moodle/moodle | admin/tool/xmldb/actions/XMLDBAction.class.php | XMLDBAction.launch | function launch($action) {
global $CFG;
// Get the action path and invoke it
$actionsroot = "$CFG->dirroot/$CFG->admin/tool/xmldb/actions";
$actionclass = $action . '.class.php';
$actionpath = "$actionsroot/$action/$actionclass";
// Load and invoke the proper action
... | php | function launch($action) {
global $CFG;
// Get the action path and invoke it
$actionsroot = "$CFG->dirroot/$CFG->admin/tool/xmldb/actions";
$actionclass = $action . '.class.php';
$actionpath = "$actionsroot/$action/$actionclass";
// Load and invoke the proper action
... | [
"function",
"launch",
"(",
"$",
"action",
")",
"{",
"global",
"$",
"CFG",
";",
"// Get the action path and invoke it",
"$",
"actionsroot",
"=",
"\"$CFG->dirroot/$CFG->admin/tool/xmldb/actions\"",
";",
"$",
"actionclass",
"=",
"$",
"action",
".",
"'.class.php'",
";",
... | launch method, used to easily call invoke methods between actions
@param string $action
@return mixed | [
"launch",
"method",
"used",
"to",
"easily",
"call",
"invoke",
"methods",
"between",
"actions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/xmldb/actions/XMLDBAction.class.php#L173-L206 |
214,393 | moodle/moodle | auth/oauth2/classes/output/renderer.php | renderer.linked_logins_table | public function linked_logins_table($linkedlogins) {
global $CFG;
$table = new html_table();
$table->head = [
get_string('issuer', 'auth_oauth2'),
get_string('info', 'auth_oauth2'),
get_string('edit'),
];
$table->attributes['class'] = 'admint... | php | public function linked_logins_table($linkedlogins) {
global $CFG;
$table = new html_table();
$table->head = [
get_string('issuer', 'auth_oauth2'),
get_string('info', 'auth_oauth2'),
get_string('edit'),
];
$table->attributes['class'] = 'admint... | [
"public",
"function",
"linked_logins_table",
"(",
"$",
"linkedlogins",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"table",
"=",
"new",
"html_table",
"(",
")",
";",
"$",
"table",
"->",
"head",
"=",
"[",
"get_string",
"(",
"'issuer'",
",",
"'auth_oauth2'",
... | This function will render one beautiful table with all the linked_logins.
@param \auth\oauth2\linked_login[] $linkedlogins - list of all linked logins.
@return string HTML to output. | [
"This",
"function",
"will",
"render",
"one",
"beautiful",
"table",
"with",
"all",
"the",
"linked_logins",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/output/renderer.php#L49-L95 |
214,394 | moodle/moodle | lib/adodb/adodb-pager.inc.php | ADODB_Pager.Render_First | function Render_First($anchor=true)
{
global $PHP_SELF;
if ($anchor) {
?>
<a href="<?php echo $PHP_SELF,'?',$this->id;?>_next_page=1"><?php echo $this->first;?></a>
<?php
} else {
print "$this->first ";
}
} | php | function Render_First($anchor=true)
{
global $PHP_SELF;
if ($anchor) {
?>
<a href="<?php echo $PHP_SELF,'?',$this->id;?>_next_page=1"><?php echo $this->first;?></a>
<?php
} else {
print "$this->first ";
}
} | [
"function",
"Render_First",
"(",
"$",
"anchor",
"=",
"true",
")",
"{",
"global",
"$",
"PHP_SELF",
";",
"if",
"(",
"$",
"anchor",
")",
"{",
"?>\n\t\t<a href=\"<?php",
"echo",
"$",
"PHP_SELF",
",",
"'?'",
",",
"$",
"this",
"->",
"id",
";",
"?>_next_page=1\... | Display link to first page | [
"Display",
"link",
"to",
"first",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-pager.inc.php#L85-L95 |
214,395 | moodle/moodle | lib/adodb/adodb-pager.inc.php | ADODB_Pager.render_next | function render_next($anchor=true)
{
global $PHP_SELF;
if ($anchor) {
?>
<a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() + 1 ?>"><?php echo $this->next;?></a>
<?php
} else {
print "$this->next ";
}
} | php | function render_next($anchor=true)
{
global $PHP_SELF;
if ($anchor) {
?>
<a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() + 1 ?>"><?php echo $this->next;?></a>
<?php
} else {
print "$this->next ";
}
} | [
"function",
"render_next",
"(",
"$",
"anchor",
"=",
"true",
")",
"{",
"global",
"$",
"PHP_SELF",
";",
"if",
"(",
"$",
"anchor",
")",
"{",
"?>\n\t\t<a href=\"<?php",
"echo",
"$",
"PHP_SELF",
",",
"'?'",
",",
"$",
"this",
"->",
"id",
",",
"'_next_page='",
... | Display link to next page | [
"Display",
"link",
"to",
"next",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-pager.inc.php#L99-L110 |
214,396 | moodle/moodle | lib/adodb/adodb-pager.inc.php | ADODB_Pager.render_last | function render_last($anchor=true)
{
global $PHP_SELF;
if (!$this->db->pageExecuteCountRows) return;
if ($anchor) {
?>
<a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->LastPageNo() ?>"><?php echo $this->last;?></a>
<?php
} else {
print "$this->last ";
}
} | php | function render_last($anchor=true)
{
global $PHP_SELF;
if (!$this->db->pageExecuteCountRows) return;
if ($anchor) {
?>
<a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->LastPageNo() ?>"><?php echo $this->last;?></a>
<?php
} else {
print "$this->last ";
}
} | [
"function",
"render_last",
"(",
"$",
"anchor",
"=",
"true",
")",
"{",
"global",
"$",
"PHP_SELF",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"db",
"->",
"pageExecuteCountRows",
")",
"return",
";",
"if",
"(",
"$",
"anchor",
")",
"{",
"?>\n\t\t\t<a href=\"<?ph... | last page counting. | [
"last",
"page",
"counting",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-pager.inc.php#L118-L131 |
214,397 | moodle/moodle | lib/adodb/adodb-pager.inc.php | ADODB_Pager.render_pagelinks | function render_pagelinks()
{
global $PHP_SELF;
$pages = $this->rs->LastPageNo();
$linksperpage = $this->linksPerPage ? $this->linksPerPage : $pages;
for($i=1; $i <= $pages; $i+=$linksperpage)
{
if($this->rs->AbsolutePage() >= $i)
... | php | function render_pagelinks()
{
global $PHP_SELF;
$pages = $this->rs->LastPageNo();
$linksperpage = $this->linksPerPage ? $this->linksPerPage : $pages;
for($i=1; $i <= $pages; $i+=$linksperpage)
{
if($this->rs->AbsolutePage() >= $i)
... | [
"function",
"render_pagelinks",
"(",
")",
"{",
"global",
"$",
"PHP_SELF",
";",
"$",
"pages",
"=",
"$",
"this",
"->",
"rs",
"->",
"LastPageNo",
"(",
")",
";",
"$",
"linksperpage",
"=",
"$",
"this",
"->",
"linksPerPage",
"?",
"$",
"this",
"->",
"linksPer... | original code by "Pablo Costa" <pablo@cbsp.com.br> | [
"original",
"code",
"by",
"Pablo",
"Costa",
"<pablo"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-pager.inc.php#L135-L168 |
214,398 | moodle/moodle | lib/adodb/adodb-pager.inc.php | ADODB_Pager.render_prev | function render_prev($anchor=true)
{
global $PHP_SELF;
if ($anchor) {
?>
<a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() - 1 ?>"><?php echo $this->prev;?></a>
<?php
} else {
print "$this->prev ";
}
} | php | function render_prev($anchor=true)
{
global $PHP_SELF;
if ($anchor) {
?>
<a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() - 1 ?>"><?php echo $this->prev;?></a>
<?php
} else {
print "$this->prev ";
}
} | [
"function",
"render_prev",
"(",
"$",
"anchor",
"=",
"true",
")",
"{",
"global",
"$",
"PHP_SELF",
";",
"if",
"(",
"$",
"anchor",
")",
"{",
"?>\n\t\t<a href=\"<?php",
"echo",
"$",
"PHP_SELF",
",",
"'?'",
",",
"$",
"this",
"->",
"id",
",",
"'_next_page='",
... | Link to previous page | [
"Link",
"to",
"previous",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-pager.inc.php#L170-L180 |
214,399 | moodle/moodle | lib/adodb/adodb-pager.inc.php | ADODB_Pager.RenderGrid | function RenderGrid()
{
global $gSQLBlockRows; // used by rs2html to indicate how many rows to display
include_once(ADODB_DIR.'/tohtml.inc.php');
ob_start();
$gSQLBlockRows = $this->rows;
rs2html($this->rs,$this->gridAttributes,$this->gridHeader,$this->htmlSpecialChars);
$s = ob_get_contents();
ob_end_cle... | php | function RenderGrid()
{
global $gSQLBlockRows; // used by rs2html to indicate how many rows to display
include_once(ADODB_DIR.'/tohtml.inc.php');
ob_start();
$gSQLBlockRows = $this->rows;
rs2html($this->rs,$this->gridAttributes,$this->gridHeader,$this->htmlSpecialChars);
$s = ob_get_contents();
ob_end_cle... | [
"function",
"RenderGrid",
"(",
")",
"{",
"global",
"$",
"gSQLBlockRows",
";",
"// used by rs2html to indicate how many rows to display",
"include_once",
"(",
"ADODB_DIR",
".",
"'/tohtml.inc.php'",
")",
";",
"ob_start",
"(",
")",
";",
"$",
"gSQLBlockRows",
"=",
"$",
... | We use output buffering to keep code clean and readable. | [
"We",
"use",
"output",
"buffering",
"to",
"keep",
"code",
"clean",
"and",
"readable",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-pager.inc.php#L187-L197 |
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.