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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
217,800 | moodle/moodle | lib/modinfolib.php | course_modinfo.instance | public static function instance($courseorid, $userid = 0) {
global $USER;
if (is_object($courseorid)) {
$course = $courseorid;
} else {
$course = (object)array('id' => $courseorid);
}
if (empty($userid)) {
$userid = $USER->id;
}
... | php | public static function instance($courseorid, $userid = 0) {
global $USER;
if (is_object($courseorid)) {
$course = $courseorid;
} else {
$course = (object)array('id' => $courseorid);
}
if (empty($userid)) {
$userid = $USER->id;
}
... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"courseorid",
",",
"$",
"userid",
"=",
"0",
")",
"{",
"global",
"$",
"USER",
";",
"if",
"(",
"is_object",
"(",
"$",
"courseorid",
")",
")",
"{",
"$",
"course",
"=",
"$",
"courseorid",
";",
"}",
... | Returns the instance of course_modinfo for the specified course and specified user
This function uses static cache for the retrieved instances. The cache
size is limited by MAX_MODINFO_CACHE_SIZE. If instance is not found in
the static cache or it was created for another user or the cacherev validation
failed - a new ... | [
"Returns",
"the",
"instance",
"of",
"course_modinfo",
"for",
"the",
"specified",
"course",
"and",
"specified",
"user"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L395-L433 |
217,801 | moodle/moodle | lib/modinfolib.php | course_modinfo.get_course_cache_lock | protected static function get_course_cache_lock($courseid) {
// Get database lock to ensure this doesn't happen multiple times in parallel. Wait a
// reasonable time for the lock to be released, so we can give a suitable error message.
// In case the system crashes while building the course cach... | php | protected static function get_course_cache_lock($courseid) {
// Get database lock to ensure this doesn't happen multiple times in parallel. Wait a
// reasonable time for the lock to be released, so we can give a suitable error message.
// In case the system crashes while building the course cach... | [
"protected",
"static",
"function",
"get_course_cache_lock",
"(",
"$",
"courseid",
")",
"{",
"// Get database lock to ensure this doesn't happen multiple times in parallel. Wait a",
"// reasonable time for the lock to be released, so we can give a suitable error message.",
"// In case the syste... | Gets a lock for rebuilding the cache of a single course.
Caller must release the returned lock.
This is used to ensure that the cache rebuild doesn't happen multiple times in parallel.
This function will wait up to 1 minute for the lock to be obtained. If the lock cannot
be obtained, it throws an exception.
@param i... | [
"Gets",
"a",
"lock",
"for",
"rebuilding",
"the",
"cache",
"of",
"a",
"single",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L609-L622 |
217,802 | moodle/moodle | lib/modinfolib.php | course_modinfo.build_course_cache | public static function build_course_cache($course) {
if (empty($course->id)) {
throw new coding_exception('Object $course is missing required property \id\'');
}
$lock = self::get_course_cache_lock($course->id);
try {
return self::inner_build_course_cache($course... | php | public static function build_course_cache($course) {
if (empty($course->id)) {
throw new coding_exception('Object $course is missing required property \id\'');
}
$lock = self::get_course_cache_lock($course->id);
try {
return self::inner_build_course_cache($course... | [
"public",
"static",
"function",
"build_course_cache",
"(",
"$",
"course",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"course",
"->",
"id",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Object $course is missing required property \\id\\''",
")",
";",
"}"... | Builds and stores in MUC object containing information about course
modules and sections together with cached fields from table course.
@param stdClass $course object from DB table course. Must have property 'id'
but preferably should have all cached fields.
@return stdClass object with all cached keys of the course p... | [
"Builds",
"and",
"stores",
"in",
"MUC",
"object",
"containing",
"information",
"about",
"course",
"modules",
"and",
"sections",
"together",
"with",
"cached",
"fields",
"from",
"table",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L635-L646 |
217,803 | moodle/moodle | lib/modinfolib.php | course_modinfo.inner_build_course_cache | protected static function inner_build_course_cache($course, \core\lock\lock $lock) {
global $DB, $CFG;
require_once("{$CFG->dirroot}/course/lib.php");
// Ensure object has all necessary fields.
foreach (self::$cachedfields as $key) {
if (!isset($course->$key)) {
... | php | protected static function inner_build_course_cache($course, \core\lock\lock $lock) {
global $DB, $CFG;
require_once("{$CFG->dirroot}/course/lib.php");
// Ensure object has all necessary fields.
foreach (self::$cachedfields as $key) {
if (!isset($course->$key)) {
... | [
"protected",
"static",
"function",
"inner_build_course_cache",
"(",
"$",
"course",
",",
"\\",
"core",
"\\",
"lock",
"\\",
"lock",
"$",
"lock",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"require_once",
"(",
"\"{$CFG->dirroot}/course/lib.php\"",
")",
... | Called to build course cache when there is already a lock obtained.
@param stdClass $course object from DB table course
@param \core\lock\lock $lock Lock object - not actually used, just there to indicate you have a lock
@return stdClass Course object that has been stored in MUC | [
"Called",
"to",
"build",
"course",
"cache",
"when",
"there",
"is",
"already",
"a",
"lock",
"obtained",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L655-L680 |
217,804 | moodle/moodle | lib/modinfolib.php | cm_info.get_module_type_name | public function get_module_type_name($plural = false) {
$modnames = get_module_types_names($plural);
if (isset($modnames[$this->modname])) {
return $modnames[$this->modname];
} else {
return null;
}
} | php | public function get_module_type_name($plural = false) {
$modnames = get_module_types_names($plural);
if (isset($modnames[$this->modname])) {
return $modnames[$this->modname];
} else {
return null;
}
} | [
"public",
"function",
"get_module_type_name",
"(",
"$",
"plural",
"=",
"false",
")",
"{",
"$",
"modnames",
"=",
"get_module_types_names",
"(",
"$",
"plural",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"modnames",
"[",
"$",
"this",
"->",
"modname",
"]",
")",... | Returns a localised human-readable name of the module type
@param bool $plural return plural form
@return string | [
"Returns",
"a",
"localised",
"human",
"-",
"readable",
"name",
"of",
"the",
"module",
"type"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L1492-L1499 |
217,805 | moodle/moodle | lib/modinfolib.php | cm_info.get_effective_groupmode | private function get_effective_groupmode() {
$groupmode = $this->groupmode;
if ($this->modinfo->get_course()->groupmodeforce) {
$groupmode = $this->modinfo->get_course()->groupmode;
if ($groupmode != NOGROUPS && !plugin_supports('mod', $this->modname, FEATURE_GROUPS, false)) {
... | php | private function get_effective_groupmode() {
$groupmode = $this->groupmode;
if ($this->modinfo->get_course()->groupmodeforce) {
$groupmode = $this->modinfo->get_course()->groupmode;
if ($groupmode != NOGROUPS && !plugin_supports('mod', $this->modname, FEATURE_GROUPS, false)) {
... | [
"private",
"function",
"get_effective_groupmode",
"(",
")",
"{",
"$",
"groupmode",
"=",
"$",
"this",
"->",
"groupmode",
";",
"if",
"(",
"$",
"this",
"->",
"modinfo",
"->",
"get_course",
"(",
")",
"->",
"groupmodeforce",
")",
"{",
"$",
"groupmode",
"=",
"... | Returns effective groupmode of the module that may be overwritten by forced course groupmode.
@return int one of constants NOGROUPS, SEPARATEGROUPS, VISIBLEGROUPS | [
"Returns",
"effective",
"groupmode",
"of",
"the",
"module",
"that",
"may",
"be",
"overwritten",
"by",
"forced",
"course",
"groupmode",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L1574-L1583 |
217,806 | moodle/moodle | lib/modinfolib.php | cm_info.get_course_module_record | public function get_course_module_record($additionalfields = false) {
$cmrecord = new stdClass();
// Standard fields from table course_modules.
static $cmfields = array('id', 'course', 'module', 'instance', 'section', 'idnumber', 'added',
'score', 'indent', 'visible', 'visibleoncour... | php | public function get_course_module_record($additionalfields = false) {
$cmrecord = new stdClass();
// Standard fields from table course_modules.
static $cmfields = array('id', 'course', 'module', 'instance', 'section', 'idnumber', 'added',
'score', 'indent', 'visible', 'visibleoncour... | [
"public",
"function",
"get_course_module_record",
"(",
"$",
"additionalfields",
"=",
"false",
")",
"{",
"$",
"cmrecord",
"=",
"new",
"stdClass",
"(",
")",
";",
"// Standard fields from table course_modules.",
"static",
"$",
"cmfields",
"=",
"array",
"(",
"'id'",
"... | Returns itself in the form of stdClass.
The object includes all fields that table course_modules has and additionally
fields 'name', 'modname', 'sectionnum' (if requested).
This can be used as a faster alternative to {@link get_coursemodule_from_id()}
@param bool $additionalfields include additional fields 'name', '... | [
"Returns",
"itself",
"in",
"the",
"form",
"of",
"stdClass",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L1603-L1623 |
217,807 | moodle/moodle | lib/modinfolib.php | cm_info.obtain_dynamic_data | private function obtain_dynamic_data() {
global $CFG;
$userid = $this->modinfo->get_user_id();
if ($this->state >= self::STATE_BUILDING_DYNAMIC || $userid == -1) {
return;
}
$this->state = self::STATE_BUILDING_DYNAMIC;
if (!empty($CFG->enableavailability)) {
... | php | private function obtain_dynamic_data() {
global $CFG;
$userid = $this->modinfo->get_user_id();
if ($this->state >= self::STATE_BUILDING_DYNAMIC || $userid == -1) {
return;
}
$this->state = self::STATE_BUILDING_DYNAMIC;
if (!empty($CFG->enableavailability)) {
... | [
"private",
"function",
"obtain_dynamic_data",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"userid",
"=",
"$",
"this",
"->",
"modinfo",
"->",
"get_user_id",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"state",
">=",
"self",
"::",
"STATE_BUILDING_DYNAM... | If dynamic data for this course-module is not yet available, gets it.
This function is automatically called when requesting any course_modinfo property
that can be modified by modules (have a set_xxx method).
Dynamic data is data which does not come directly from the cache but is calculated at
runtime based on the cu... | [
"If",
"dynamic",
"data",
"for",
"this",
"course",
"-",
"module",
"is",
"not",
"yet",
"available",
"gets",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L1878-L1915 |
217,808 | moodle/moodle | lib/modinfolib.php | cm_info.is_stealth | public function is_stealth() {
return !$this->visibleoncoursepage ||
($this->visible && ($section = $this->get_section_info()) && !$section->visible);
} | php | public function is_stealth() {
return !$this->visibleoncoursepage ||
($this->visible && ($section = $this->get_section_info()) && !$section->visible);
} | [
"public",
"function",
"is_stealth",
"(",
")",
"{",
"return",
"!",
"$",
"this",
"->",
"visibleoncoursepage",
"||",
"(",
"$",
"this",
"->",
"visible",
"&&",
"(",
"$",
"section",
"=",
"$",
"this",
"->",
"get_section_info",
"(",
")",
")",
"&&",
"!",
"$",
... | Whether this module is available but hidden from course page
"Stealth" modules are the ones that are not shown on course page but available by following url.
They are normally also displayed in grade reports and other reports.
Module will be stealth either if visibleoncoursepage=0 or it is a visible module inside the ... | [
"Whether",
"this",
"module",
"is",
"available",
"but",
"hidden",
"from",
"course",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L1949-L1952 |
217,809 | moodle/moodle | lib/modinfolib.php | cm_info.update_user_visible | private function update_user_visible() {
$userid = $this->modinfo->get_user_id();
if ($userid == -1) {
return null;
}
$this->uservisible = true;
// If the module is being deleted, set the uservisible state to false and return.
if ($this->deletioninprogress) {... | php | private function update_user_visible() {
$userid = $this->modinfo->get_user_id();
if ($userid == -1) {
return null;
}
$this->uservisible = true;
// If the module is being deleted, set the uservisible state to false and return.
if ($this->deletioninprogress) {... | [
"private",
"function",
"update_user_visible",
"(",
")",
"{",
"$",
"userid",
"=",
"$",
"this",
"->",
"modinfo",
"->",
"get_user_id",
"(",
")",
";",
"if",
"(",
"$",
"userid",
"==",
"-",
"1",
")",
"{",
"return",
"null",
";",
"}",
"$",
"this",
"->",
"u... | Works out whether activity is available to the current user
If the activity is unavailable, additional checks are required to determine if its hidden or greyed out
@return void | [
"Works",
"out",
"whether",
"activity",
"is",
"available",
"to",
"the",
"current",
"user"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L1992-L2031 |
217,810 | moodle/moodle | lib/modinfolib.php | cm_info.obtain_view_data | private function obtain_view_data() {
if ($this->state >= self::STATE_BUILDING_VIEW || $this->modinfo->get_user_id() == -1) {
return;
}
$this->obtain_dynamic_data();
$this->state = self::STATE_BUILDING_VIEW;
// Let module make changes at this point
$this->cal... | php | private function obtain_view_data() {
if ($this->state >= self::STATE_BUILDING_VIEW || $this->modinfo->get_user_id() == -1) {
return;
}
$this->obtain_dynamic_data();
$this->state = self::STATE_BUILDING_VIEW;
// Let module make changes at this point
$this->cal... | [
"private",
"function",
"obtain_view_data",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"state",
">=",
"self",
"::",
"STATE_BUILDING_VIEW",
"||",
"$",
"this",
"->",
"modinfo",
"->",
"get_user_id",
"(",
")",
"==",
"-",
"1",
")",
"{",
"return",
";",
"}",... | If view data for this course-module is not yet available, obtains it.
This function is automatically called if any of the functions (marked) which require
view data are called.
View data is data which is needed only for displaying the course main page (& any similar
functionality on other pages) but is not needed in ... | [
"If",
"view",
"data",
"for",
"this",
"course",
"-",
"module",
"is",
"not",
"yet",
"available",
"obtains",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L2115-L2125 |
217,811 | moodle/moodle | lib/modinfolib.php | section_info.__isset | public function __isset($name) {
if (method_exists($this, 'get_'.$name) ||
property_exists($this, '_'.$name) ||
array_key_exists($name, self::$sectionformatoptions[$this->modinfo->get_course()->format])) {
$value = $this->__get($name);
return isset($value)... | php | public function __isset($name) {
if (method_exists($this, 'get_'.$name) ||
property_exists($this, '_'.$name) ||
array_key_exists($name, self::$sectionformatoptions[$this->modinfo->get_course()->format])) {
$value = $this->__get($name);
return isset($value)... | [
"public",
"function",
"__isset",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"'get_'",
".",
"$",
"name",
")",
"||",
"property_exists",
"(",
"$",
"this",
",",
"'_'",
".",
"$",
"name",
")",
"||",
"array_key_exists",
"... | Magic method to check if the property is set
@param string $name name of the property
@return bool | [
"Magic",
"method",
"to",
"check",
"if",
"the",
"property",
"is",
"set"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L2703-L2711 |
217,812 | moodle/moodle | lib/modinfolib.php | section_info.__empty | public function __empty($name) {
if (method_exists($this, 'get_'.$name) ||
property_exists($this, '_'.$name) ||
array_key_exists($name, self::$sectionformatoptions[$this->modinfo->get_course()->format])) {
$value = $this->__get($name);
return empty($value)... | php | public function __empty($name) {
if (method_exists($this, 'get_'.$name) ||
property_exists($this, '_'.$name) ||
array_key_exists($name, self::$sectionformatoptions[$this->modinfo->get_course()->format])) {
$value = $this->__get($name);
return empty($value)... | [
"public",
"function",
"__empty",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"'get_'",
".",
"$",
"name",
")",
"||",
"property_exists",
"(",
"$",
"this",
",",
"'_'",
".",
"$",
"name",
")",
"||",
"array_key_exists",
"... | Magic method to check if the property is empty
@param string $name name of the property
@return bool | [
"Magic",
"method",
"to",
"check",
"if",
"the",
"property",
"is",
"empty"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L2719-L2727 |
217,813 | moodle/moodle | lib/modinfolib.php | section_info.get_available | private function get_available() {
global $CFG;
$userid = $this->modinfo->get_user_id();
if ($this->_available !== null || $userid == -1) {
// Has already been calculated or does not need calculation.
return $this->_available;
}
$this->_available = true;
... | php | private function get_available() {
global $CFG;
$userid = $this->modinfo->get_user_id();
if ($this->_available !== null || $userid == -1) {
// Has already been calculated or does not need calculation.
return $this->_available;
}
$this->_available = true;
... | [
"private",
"function",
"get_available",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"userid",
"=",
"$",
"this",
"->",
"modinfo",
"->",
"get_user_id",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_available",
"!==",
"null",
"||",
"$",
"userid",
"=... | Finds whether this section is available at the moment for the current user.
The value can be accessed publicly as $sectioninfo->available
@return bool | [
"Finds",
"whether",
"this",
"section",
"is",
"available",
"at",
"the",
"moment",
"for",
"the",
"current",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L2762-L2786 |
217,814 | moodle/moodle | lib/modinfolib.php | section_info.get_sequence | private function get_sequence() {
if (!empty($this->modinfo->sections[$this->_section])) {
return implode(',', $this->modinfo->sections[$this->_section]);
} else {
return '';
}
} | php | private function get_sequence() {
if (!empty($this->modinfo->sections[$this->_section])) {
return implode(',', $this->modinfo->sections[$this->_section]);
} else {
return '';
}
} | [
"private",
"function",
"get_sequence",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"modinfo",
"->",
"sections",
"[",
"$",
"this",
"->",
"_section",
"]",
")",
")",
"{",
"return",
"implode",
"(",
"','",
",",
"$",
"this",
"->",
"mo... | Restores the course_sections.sequence value
@return string | [
"Restores",
"the",
"course_sections",
".",
"sequence",
"value"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L2853-L2859 |
217,815 | moodle/moodle | lib/modinfolib.php | section_info.convert_for_section_cache | public static function convert_for_section_cache($section) {
global $CFG;
// Course id stored in course table
unset($section->course);
// Section number stored in array key
unset($section->section);
// Sequence stored implicity in modinfo $sections array
unset($s... | php | public static function convert_for_section_cache($section) {
global $CFG;
// Course id stored in course table
unset($section->course);
// Section number stored in array key
unset($section->section);
// Sequence stored implicity in modinfo $sections array
unset($s... | [
"public",
"static",
"function",
"convert_for_section_cache",
"(",
"$",
"section",
")",
"{",
"global",
"$",
"CFG",
";",
"// Course id stored in course table",
"unset",
"(",
"$",
"section",
"->",
"course",
")",
";",
"// Section number stored in array key",
"unset",
"(",... | Prepares section data for inclusion in sectioncache cache, removing items
that are set to defaults, and adding availability data if required.
Called by build_section_cache in course_modinfo only; do not use otherwise.
@param object $section Raw section data object | [
"Prepares",
"section",
"data",
"for",
"inclusion",
"in",
"sectioncache",
"cache",
"removing",
"items",
"that",
"are",
"set",
"to",
"defaults",
"and",
"adding",
"availability",
"data",
"if",
"required",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L2886-L2904 |
217,816 | moodle/moodle | backup/moodle2/backup_block_task.class.php | backup_block_task.get_taskbasepath | public function get_taskbasepath() {
$basepath = $this->get_basepath();
// Module blocks are under module dir
if (!empty($this->moduleid)) {
$basepath .= '/activities/' . $this->modulename . '_' . $this->moduleid .
'/blocks/' . $this->blockname . '_' . $this... | php | public function get_taskbasepath() {
$basepath = $this->get_basepath();
// Module blocks are under module dir
if (!empty($this->moduleid)) {
$basepath .= '/activities/' . $this->modulename . '_' . $this->moduleid .
'/blocks/' . $this->blockname . '_' . $this... | [
"public",
"function",
"get_taskbasepath",
"(",
")",
"{",
"$",
"basepath",
"=",
"$",
"this",
"->",
"get_basepath",
"(",
")",
";",
"// Module blocks are under module dir",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"moduleid",
")",
")",
"{",
"$",
"base... | Block tasks have their own directory to write files | [
"Block",
"tasks",
"have",
"their",
"own",
"directory",
"to",
"write",
"files"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/backup_block_task.class.php#L107-L120 |
217,817 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.load_from_record | public static function load_from_record($record, $clean = false) {
$tour = new self();
return $tour->reload_from_record($record, $clean);
} | php | public static function load_from_record($record, $clean = false) {
$tour = new self();
return $tour->reload_from_record($record, $clean);
} | [
"public",
"static",
"function",
"load_from_record",
"(",
"$",
"record",
",",
"$",
"clean",
"=",
"false",
")",
"{",
"$",
"tour",
"=",
"new",
"self",
"(",
")",
";",
"return",
"$",
"tour",
"->",
"reload_from_record",
"(",
"$",
"record",
",",
"$",
"clean",... | Create an instance of tour from its provided DB record.
@param stdClass $record The record of the tour to load.
@param boolean $clean Clean the values.
@return tour | [
"Create",
"an",
"instance",
"of",
"tour",
"from",
"its",
"provided",
"DB",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L133-L136 |
217,818 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.reload_from_record | protected function reload_from_record($record, $clean = false) {
$this->id = $record->id;
if (!property_exists($record, 'description')) {
if (property_exists($record, 'comment')) {
$record->description = $record->comment;
unset($record->comment);
... | php | protected function reload_from_record($record, $clean = false) {
$this->id = $record->id;
if (!property_exists($record, 'description')) {
if (property_exists($record, 'comment')) {
$record->description = $record->comment;
unset($record->comment);
... | [
"protected",
"function",
"reload_from_record",
"(",
"$",
"record",
",",
"$",
"clean",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"$",
"record",
"->",
"id",
";",
"if",
"(",
"!",
"property_exists",
"(",
"$",
"record",
",",
"'description'",
")"... | Reload the tour into the current object.
@param stdClass $record The record to reload.
@param boolean $clean Clean the values.
@return tour | [
"Reload",
"the",
"tour",
"into",
"the",
"current",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L168-L193 |
217,819 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.get_steps | public function get_steps() {
if (empty($this->steps)) {
$this->steps = helper::get_steps($this->id);
}
return $this->steps;
} | php | public function get_steps() {
if (empty($this->steps)) {
$this->steps = helper::get_steps($this->id);
}
return $this->steps;
} | [
"public",
"function",
"get_steps",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"steps",
")",
")",
"{",
"$",
"this",
"->",
"steps",
"=",
"helper",
"::",
"get_steps",
"(",
"$",
"this",
"->",
"id",
")",
";",
"}",
"return",
"$",
"this"... | Fetch all steps in the tour.
@return stdClass[] | [
"Fetch",
"all",
"steps",
"in",
"the",
"tour",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L200-L206 |
217,820 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.set_name | public function set_name($value) {
$this->name = clean_param($value, PARAM_TEXT);
$this->dirty = true;
return $this;
} | php | public function set_name($value) {
$this->name = clean_param($value, PARAM_TEXT);
$this->dirty = true;
return $this;
} | [
"public",
"function",
"set_name",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"clean_param",
"(",
"$",
"value",
",",
"PARAM_TEXT",
")",
";",
"$",
"this",
"->",
"dirty",
"=",
"true",
";",
"return",
"$",
"this",
";",
"}"
] | Set the name of the tour to the specified value.
@param string $value The new name.
@return $this | [
"Set",
"the",
"name",
"of",
"the",
"tour",
"to",
"the",
"specified",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L241-L246 |
217,821 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.set_description | public function set_description($value) {
$this->description = clean_text($value);
$this->dirty = true;
return $this;
} | php | public function set_description($value) {
$this->description = clean_text($value);
$this->dirty = true;
return $this;
} | [
"public",
"function",
"set_description",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"description",
"=",
"clean_text",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"dirty",
"=",
"true",
";",
"return",
"$",
"this",
";",
"}"
] | Set the description of the tour to the specified value.
@param string $value The new description.
@return $this | [
"Set",
"the",
"description",
"of",
"the",
"tour",
"to",
"the",
"specified",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L263-L268 |
217,822 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.to_record | public function to_record() {
return (object) array(
'id' => $this->id,
'name' => $this->name,
'description' => $this->description,
'pathmatch' => $this->pathmatch,
'enabled' => $this->enabled,
'sortorder' ... | php | public function to_record() {
return (object) array(
'id' => $this->id,
'name' => $this->name,
'description' => $this->description,
'pathmatch' => $this->pathmatch,
'enabled' => $this->enabled,
'sortorder' ... | [
"public",
"function",
"to_record",
"(",
")",
"{",
"return",
"(",
"object",
")",
"array",
"(",
"'id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'name'",
"=>",
"$",
"this",
"->",
"name",
",",
"'description'",
"=>",
"$",
"this",
"->",
"description",
",",
"'... | Prepare this tour for saving to the database.
@return object | [
"Prepare",
"this",
"tour",
"for",
"saving",
"to",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L373-L383 |
217,823 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.is_last_tour | public function is_last_tour($tourcount = null) {
if ($tourcount === null) {
$tourcount = helper::count_tours();
}
return ($this->get_sortorder() === ($tourcount - 1));
} | php | public function is_last_tour($tourcount = null) {
if ($tourcount === null) {
$tourcount = helper::count_tours();
}
return ($this->get_sortorder() === ($tourcount - 1));
} | [
"public",
"function",
"is_last_tour",
"(",
"$",
"tourcount",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"tourcount",
"===",
"null",
")",
"{",
"$",
"tourcount",
"=",
"helper",
"::",
"count_tours",
"(",
")",
";",
"}",
"return",
"(",
"$",
"this",
"->",
"get... | Whether this tour is the last tour.
@param int $tourcount The pre-fetched count of tours
@return boolean | [
"Whether",
"this",
"tour",
"is",
"the",
"last",
"tour",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L409-L414 |
217,824 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.set_config | public function set_config($key, $value) {
if ($this->config === null) {
$this->config = (object) array();
}
$this->config->$key = $value;
$this->dirty = true;
return $this;
} | php | public function set_config($key, $value) {
if ($this->config === null) {
$this->config = (object) array();
}
$this->config->$key = $value;
$this->dirty = true;
return $this;
} | [
"public",
"function",
"set_config",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"(",
"object",
")",
"array",
"(",
")",
";",
"}",
"$",
"this",
"... | Set the configuration item as specified.
@param string $key The configuration key to set.
@param mixed $value The new value for the configuration item.
@return $this | [
"Set",
"the",
"configuration",
"item",
"as",
"specified",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L491-L499 |
217,825 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.reset_step_sortorder | public function reset_step_sortorder() {
global $DB;
$steps = $DB->get_records('tool_usertours_steps', array('tourid' => $this->id), 'sortorder ASC', 'id');
$index = 0;
foreach ($steps as $step) {
$DB->set_field('tool_usertours_steps', 'sortorder', $index, array('id' => $ste... | php | public function reset_step_sortorder() {
global $DB;
$steps = $DB->get_records('tool_usertours_steps', array('tourid' => $this->id), 'sortorder ASC', 'id');
$index = 0;
foreach ($steps as $step) {
$DB->set_field('tool_usertours_steps', 'sortorder', $index, array('id' => $ste... | [
"public",
"function",
"reset_step_sortorder",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"steps",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"'tool_usertours_steps'",
",",
"array",
"(",
"'tourid'",
"=>",
"$",
"this",
"->",
"id",
")",
",",
"'sortorder ASC... | Reset the sortorder for all steps in the tour.
@return $this | [
"Reset",
"the",
"sortorder",
"for",
"all",
"steps",
"in",
"the",
"tour",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L562-L577 |
217,826 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.should_show_for_user | public function should_show_for_user() {
if (!$this->is_enabled()) {
// The tour is disabled - it should not be shown.
return false;
}
if ($tourcompletiondate = get_user_preferences(self::TOUR_LAST_COMPLETED_BY_USER . $this->get_id(), null)) {
if ($tourresetd... | php | public function should_show_for_user() {
if (!$this->is_enabled()) {
// The tour is disabled - it should not be shown.
return false;
}
if ($tourcompletiondate = get_user_preferences(self::TOUR_LAST_COMPLETED_BY_USER . $this->get_id(), null)) {
if ($tourresetd... | [
"public",
"function",
"should_show_for_user",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_enabled",
"(",
")",
")",
"{",
"// The tour is disabled - it should not be shown.",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"tourcompletiondate",
"=",
"get_us... | Whether this tour should be displayed to the user.
@return boolean | [
"Whether",
"this",
"tour",
"should",
"be",
"displayed",
"to",
"the",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L584-L604 |
217,827 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.get_tour_key | public function get_tour_key() {
global $USER;
$tourtime = $this->get_config('majorupdatetime', null);
if ($tourtime === null) {
// This tour has no majorupdate time.
// Set one now to prevent repeated displays to the user.
$this->set_config('majorupdatetime... | php | public function get_tour_key() {
global $USER;
$tourtime = $this->get_config('majorupdatetime', null);
if ($tourtime === null) {
// This tour has no majorupdate time.
// Set one now to prevent repeated displays to the user.
$this->set_config('majorupdatetime... | [
"public",
"function",
"get_tour_key",
"(",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"tourtime",
"=",
"$",
"this",
"->",
"get_config",
"(",
"'majorupdatetime'",
",",
"null",
")",
";",
"if",
"(",
"$",
"tourtime",
"===",
"null",
")",
"{",
"// This tour ha... | Get the key for this tour.
This is used in the session cookie to determine whether the user has seen this tour before. | [
"Get",
"the",
"key",
"for",
"this",
"tour",
".",
"This",
"is",
"used",
"in",
"the",
"session",
"cookie",
"to",
"determine",
"whether",
"the",
"user",
"has",
"seen",
"this",
"tour",
"before",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L610-L628 |
217,828 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.mark_major_change | public function mark_major_change() {
global $DB;
// Clear old reset and completion notes.
$DB->delete_records('user_preferences', ['name' => self::TOUR_LAST_COMPLETED_BY_USER . $this->get_id()]);
$DB->delete_records('user_preferences', ['name' => self::TOUR_REQUESTED_BY_USER . $this->g... | php | public function mark_major_change() {
global $DB;
// Clear old reset and completion notes.
$DB->delete_records('user_preferences', ['name' => self::TOUR_LAST_COMPLETED_BY_USER . $this->get_id()]);
$DB->delete_records('user_preferences', ['name' => self::TOUR_REQUESTED_BY_USER . $this->g... | [
"public",
"function",
"mark_major_change",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"// Clear old reset and completion notes.",
"$",
"DB",
"->",
"delete_records",
"(",
"'user_preferences'",
",",
"[",
"'name'",
"=>",
"self",
"::",
"TOUR_LAST_COMPLETED_BY_USER",
".",
... | Update a tour giving it a new major update time.
This will ensure that it is displayed to all users, even those who have already seen it.
@return $this | [
"Update",
"a",
"tour",
"giving",
"it",
"a",
"new",
"major",
"update",
"time",
".",
"This",
"will",
"ensure",
"that",
"it",
"is",
"displayed",
"to",
"all",
"users",
"even",
"those",
"who",
"have",
"already",
"seen",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L658-L668 |
217,829 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.get_filter_values | public function get_filter_values($filter) {
if ($allvalues = (array) $this->get_config('filtervalues')) {
if (isset($allvalues[$filter])) {
return $allvalues[$filter];
}
}
return [];
} | php | public function get_filter_values($filter) {
if ($allvalues = (array) $this->get_config('filtervalues')) {
if (isset($allvalues[$filter])) {
return $allvalues[$filter];
}
}
return [];
} | [
"public",
"function",
"get_filter_values",
"(",
"$",
"filter",
")",
"{",
"if",
"(",
"$",
"allvalues",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"get_config",
"(",
"'filtervalues'",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"allvalues",
"[",
"$",
... | Get the configured filter values.
@param string $filter The filter to retrieve values for.
@return array | [
"Get",
"the",
"configured",
"filter",
"values",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L727-L735 |
217,830 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.set_filter_values | public function set_filter_values($filter, array $values = []) {
$allvalues = (array) $this->get_config('filtervalues', []);
$allvalues[$filter] = $values;
return $this->set_config('filtervalues', $allvalues);
} | php | public function set_filter_values($filter, array $values = []) {
$allvalues = (array) $this->get_config('filtervalues', []);
$allvalues[$filter] = $values;
return $this->set_config('filtervalues', $allvalues);
} | [
"public",
"function",
"set_filter_values",
"(",
"$",
"filter",
",",
"array",
"$",
"values",
"=",
"[",
"]",
")",
"{",
"$",
"allvalues",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"get_config",
"(",
"'filtervalues'",
",",
"[",
"]",
")",
";",
"$",
"allv... | Set the values for the specified filter.
@param string $filter The filter to set.
@param array $values The values to set.
@return $this | [
"Set",
"the",
"values",
"for",
"the",
"specified",
"filter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L744-L749 |
217,831 | moodle/moodle | admin/tool/usertours/classes/tour.php | tour.matches_all_filters | public function matches_all_filters(\context $context) {
$filters = helper::get_all_filters();
// All filters must match.
// If any one filter fails to match, we return false.
foreach ($filters as $filterclass) {
if (!$filterclass::filter_matches($this, $context)) {
... | php | public function matches_all_filters(\context $context) {
$filters = helper::get_all_filters();
// All filters must match.
// If any one filter fails to match, we return false.
foreach ($filters as $filterclass) {
if (!$filterclass::filter_matches($this, $context)) {
... | [
"public",
"function",
"matches_all_filters",
"(",
"\\",
"context",
"$",
"context",
")",
"{",
"$",
"filters",
"=",
"helper",
"::",
"get_all_filters",
"(",
")",
";",
"// All filters must match.",
"// If any one filter fails to match, we return false.",
"foreach",
"(",
"$"... | Check whether this tour matches all filters.
@param context $context The context to check
@return bool | [
"Check",
"whether",
"this",
"tour",
"matches",
"all",
"filters",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/tour.php#L757-L769 |
217,832 | moodle/moodle | admin/tool/generator/classes/course_backend.php | tool_generator_course_backend.create_course | private function create_course() {
$this->log('createcourse', $this->shortname);
$courserecord = array(
'shortname' => $this->shortname,
'fullname' => $this->fullname,
'numsections' => self::$paramsections[$this->size],
'startdate' => usergetmidnight(time(... | php | private function create_course() {
$this->log('createcourse', $this->shortname);
$courserecord = array(
'shortname' => $this->shortname,
'fullname' => $this->fullname,
'numsections' => self::$paramsections[$this->size],
'startdate' => usergetmidnight(time(... | [
"private",
"function",
"create_course",
"(",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'createcourse'",
",",
"$",
"this",
"->",
"shortname",
")",
";",
"$",
"courserecord",
"=",
"array",
"(",
"'shortname'",
"=>",
"$",
"this",
"->",
"shortname",
",",
"'ful... | Creates the actual course.
@return stdClass Course record | [
"Creates",
"the",
"actual",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/generator/classes/course_backend.php#L249-L263 |
217,833 | moodle/moodle | admin/tool/generator/classes/course_backend.php | tool_generator_course_backend.create_user_accounts | private function create_user_accounts($first, $last) {
global $CFG;
$this->log('createaccounts', (object)array('from' => $first, 'to' => $last), true);
$count = $last - $first + 1;
$done = 0;
for ($number = $first; $number <= $last; $number++, $done++) {
// Work out ... | php | private function create_user_accounts($first, $last) {
global $CFG;
$this->log('createaccounts', (object)array('from' => $first, 'to' => $last), true);
$count = $last - $first + 1;
$done = 0;
for ($number = $first; $number <= $last; $number++, $done++) {
// Work out ... | [
"private",
"function",
"create_user_accounts",
"(",
"$",
"first",
",",
"$",
"last",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"this",
"->",
"log",
"(",
"'createaccounts'",
",",
"(",
"object",
")",
"array",
"(",
"'from'",
"=>",
"$",
"first",
",",
"'to'"... | Creates user accounts with a numeric range.
@param int $first Number of first user
@param int $last Number of last user | [
"Creates",
"user",
"accounts",
"with",
"a",
"numeric",
"range",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/generator/classes/course_backend.php#L343-L370 |
217,834 | moodle/moodle | admin/tool/generator/classes/course_backend.php | tool_generator_course_backend.create_assignments | private function create_assignments() {
// Set up generator.
$assigngenerator = $this->generator->get_plugin_generator('mod_assign');
// Create assignments.
$number = self::$paramassignments[$this->size];
$this->log('createassignments', $number, true);
for ($i = 0; $i < ... | php | private function create_assignments() {
// Set up generator.
$assigngenerator = $this->generator->get_plugin_generator('mod_assign');
// Create assignments.
$number = self::$paramassignments[$this->size];
$this->log('createassignments', $number, true);
for ($i = 0; $i < ... | [
"private",
"function",
"create_assignments",
"(",
")",
"{",
"// Set up generator.",
"$",
"assigngenerator",
"=",
"$",
"this",
"->",
"generator",
"->",
"get_plugin_generator",
"(",
"'mod_assign'",
")",
";",
"// Create assignments.",
"$",
"number",
"=",
"self",
"::",
... | Creates a number of Assignment activities. | [
"Creates",
"a",
"number",
"of",
"Assignment",
"activities",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/generator/classes/course_backend.php#L375-L390 |
217,835 | moodle/moodle | admin/tool/generator/classes/course_backend.php | tool_generator_course_backend.create_pages | private function create_pages() {
// Set up generator.
$pagegenerator = $this->generator->get_plugin_generator('mod_page');
// Create pages.
$number = self::$parampages[$this->size];
$this->log('createpages', $number, true);
for ($i = 0; $i < $number; $i++) {
... | php | private function create_pages() {
// Set up generator.
$pagegenerator = $this->generator->get_plugin_generator('mod_page');
// Create pages.
$number = self::$parampages[$this->size];
$this->log('createpages', $number, true);
for ($i = 0; $i < $number; $i++) {
... | [
"private",
"function",
"create_pages",
"(",
")",
"{",
"// Set up generator.",
"$",
"pagegenerator",
"=",
"$",
"this",
"->",
"generator",
"->",
"get_plugin_generator",
"(",
"'mod_page'",
")",
";",
"// Create pages.",
"$",
"number",
"=",
"self",
"::",
"$",
"paramp... | Creates a number of Page activities. | [
"Creates",
"a",
"number",
"of",
"Page",
"activities",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/generator/classes/course_backend.php#L395-L410 |
217,836 | moodle/moodle | admin/tool/generator/classes/course_backend.php | tool_generator_course_backend.create_small_files | private function create_small_files() {
$count = self::$paramsmallfilecount[$this->size];
$this->log('createsmallfiles', $count, true);
// Create resource with default textfile only.
$resourcegenerator = $this->generator->get_plugin_generator('mod_resource');
$record = array('co... | php | private function create_small_files() {
$count = self::$paramsmallfilecount[$this->size];
$this->log('createsmallfiles', $count, true);
// Create resource with default textfile only.
$resourcegenerator = $this->generator->get_plugin_generator('mod_resource');
$record = array('co... | [
"private",
"function",
"create_small_files",
"(",
")",
"{",
"$",
"count",
"=",
"self",
"::",
"$",
"paramsmallfilecount",
"[",
"$",
"this",
"->",
"size",
"]",
";",
"$",
"this",
"->",
"log",
"(",
"'createsmallfiles'",
",",
"$",
"count",
",",
"true",
")",
... | Creates one resource activity with a lot of small files. | [
"Creates",
"one",
"resource",
"activity",
"with",
"a",
"lot",
"of",
"small",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/generator/classes/course_backend.php#L415-L443 |
217,837 | moodle/moodle | admin/tool/generator/classes/course_backend.php | tool_generator_course_backend.create_big_files | private function create_big_files() {
// Work out how many files and how many blocks to use (up to 64KB).
$count = self::$parambigfilecount[$this->size];
$filesize = $this->limit_filesize(self::$parambigfilesize[$this->size]);
$blocks = ceil($filesize / 65536);
$blocksize = floor... | php | private function create_big_files() {
// Work out how many files and how many blocks to use (up to 64KB).
$count = self::$parambigfilecount[$this->size];
$filesize = $this->limit_filesize(self::$parambigfilesize[$this->size]);
$blocks = ceil($filesize / 65536);
$blocksize = floor... | [
"private",
"function",
"create_big_files",
"(",
")",
"{",
"// Work out how many files and how many blocks to use (up to 64KB).",
"$",
"count",
"=",
"self",
"::",
"$",
"parambigfilecount",
"[",
"$",
"this",
"->",
"size",
"]",
";",
"$",
"filesize",
"=",
"$",
"this",
... | Creates a number of resource activities with one big file each. | [
"Creates",
"a",
"number",
"of",
"resource",
"activities",
"with",
"one",
"big",
"file",
"each",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/generator/classes/course_backend.php#L448-L493 |
217,838 | moodle/moodle | admin/tool/generator/classes/course_backend.php | tool_generator_course_backend.create_forum | private function create_forum() {
global $DB;
$discussions = self::$paramforumdiscussions[$this->size];
$posts = self::$paramforumposts[$this->size];
$totalposts = $discussions * $posts;
$this->log('createforum', $totalposts, true);
// Create empty forum.
$foru... | php | private function create_forum() {
global $DB;
$discussions = self::$paramforumdiscussions[$this->size];
$posts = self::$paramforumposts[$this->size];
$totalposts = $discussions * $posts;
$this->log('createforum', $totalposts, true);
// Create empty forum.
$foru... | [
"private",
"function",
"create_forum",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"discussions",
"=",
"self",
"::",
"$",
"paramforumdiscussions",
"[",
"$",
"this",
"->",
"size",
"]",
";",
"$",
"posts",
"=",
"self",
"::",
"$",
"paramforumposts",
"[",
... | Creates one forum activity with a bunch of posts. | [
"Creates",
"one",
"forum",
"activity",
"with",
"a",
"bunch",
"of",
"posts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/generator/classes/course_backend.php#L498-L531 |
217,839 | moodle/moodle | admin/tool/generator/classes/course_backend.php | tool_generator_course_backend.get_target_section | private function get_target_section() {
if (!$this->fixeddataset) {
$key = rand(1, self::$paramsections[$this->size]);
} else {
// Using section 1.
$key = 1;
}
return $key;
} | php | private function get_target_section() {
if (!$this->fixeddataset) {
$key = rand(1, self::$paramsections[$this->size]);
} else {
// Using section 1.
$key = 1;
}
return $key;
} | [
"private",
"function",
"get_target_section",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"fixeddataset",
")",
"{",
"$",
"key",
"=",
"rand",
"(",
"1",
",",
"self",
"::",
"$",
"paramsections",
"[",
"$",
"this",
"->",
"size",
"]",
")",
";",
"}",... | Gets a section number.
Depends on $this->fixeddataset.
@return int A section number from 1 to the number of sections | [
"Gets",
"a",
"section",
"number",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/generator/classes/course_backend.php#L540-L550 |
217,840 | moodle/moodle | admin/tool/generator/classes/course_backend.php | tool_generator_course_backend.get_target_user | private function get_target_user() {
if (!$this->fixeddataset) {
$userid = $this->userids[rand(1, self::$paramusers[$this->size])];
} else if ($userid = current($this->userids)) {
// Moving pointer to the next user.
next($this->userids);
} else {
... | php | private function get_target_user() {
if (!$this->fixeddataset) {
$userid = $this->userids[rand(1, self::$paramusers[$this->size])];
} else if ($userid = current($this->userids)) {
// Moving pointer to the next user.
next($this->userids);
} else {
... | [
"private",
"function",
"get_target_user",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"fixeddataset",
")",
"{",
"$",
"userid",
"=",
"$",
"this",
"->",
"userids",
"[",
"rand",
"(",
"1",
",",
"self",
"::",
"$",
"paramusers",
"[",
"$",
"this",
"... | Gets a user id.
Depends on $this->fixeddataset.
@return int A user id for a random created user | [
"Gets",
"a",
"user",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/generator/classes/course_backend.php#L559-L572 |
217,841 | moodle/moodle | admin/tool/generator/classes/course_backend.php | tool_generator_course_backend.limit_filesize | private function limit_filesize($length) {
// Limit to $this->filesizelimit.
if (is_numeric($this->filesizelimit) && $length > $this->filesizelimit) {
$length = floor($this->filesizelimit);
}
return $length;
} | php | private function limit_filesize($length) {
// Limit to $this->filesizelimit.
if (is_numeric($this->filesizelimit) && $length > $this->filesizelimit) {
$length = floor($this->filesizelimit);
}
return $length;
} | [
"private",
"function",
"limit_filesize",
"(",
"$",
"length",
")",
"{",
"// Limit to $this->filesizelimit.",
"if",
"(",
"is_numeric",
"(",
"$",
"this",
"->",
"filesizelimit",
")",
"&&",
"$",
"length",
">",
"$",
"this",
"->",
"filesizelimit",
")",
"{",
"$",
"l... | Restricts the binary file size if necessary
@param int $length The total length
@return int The limited length if a limit was specified. | [
"Restricts",
"the",
"binary",
"file",
"size",
"if",
"necessary"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/generator/classes/course_backend.php#L580-L588 |
217,842 | moodle/moodle | lib/horde/framework/Horde/Text/Flowed.php | Horde_Text_Flowed.toFlowed | public function toFlowed($quote = false, array $opts = array())
{
$txt = '';
$this->_reformat(true, $quote, empty($opts['nowrap']));
foreach ($this->_output as $line) {
$txt .= $line['text'] . "\n";
}
return $txt;
} | php | public function toFlowed($quote = false, array $opts = array())
{
$txt = '';
$this->_reformat(true, $quote, empty($opts['nowrap']));
foreach ($this->_output as $line) {
$txt .= $line['text'] . "\n";
}
return $txt;
} | [
"public",
"function",
"toFlowed",
"(",
"$",
"quote",
"=",
"false",
",",
"array",
"$",
"opts",
"=",
"array",
"(",
")",
")",
"{",
"$",
"txt",
"=",
"''",
";",
"$",
"this",
"->",
"_reformat",
"(",
"true",
",",
"$",
"quote",
",",
"empty",
"(",
"$",
... | Reformats the input string, where the string is 'format=fixed' plain
text as described in RFC 2646.
@param boolean $quote Add level of quoting to each line?
@param array $opts Additional options:
<pre>
'nowrap' - (boolean) If true, does not wrap unquoted lines.
DEFAULT: false
</pre>
@return string The text conv... | [
"Reformats",
"the",
"input",
"string",
"where",
"the",
"string",
"is",
"format",
"=",
"fixed",
"plain",
"text",
"as",
"described",
"in",
"RFC",
"2646",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Text/Flowed.php#L169-L179 |
217,843 | moodle/moodle | lib/classes/plugininfo/local.php | local.load_settings | public function load_settings(\part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) {
global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them.
$ADMIN = $adminroot; // May be used in settings.php.
$plugininfo = $this; // Also can be used inside settings.... | php | public function load_settings(\part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) {
global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them.
$ADMIN = $adminroot; // May be used in settings.php.
$plugininfo = $this; // Also can be used inside settings.... | [
"public",
"function",
"load_settings",
"(",
"\\",
"part_of_admin_tree",
"$",
"adminroot",
",",
"$",
"parentnodename",
",",
"$",
"hassiteconfig",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"USER",
",",
"$",
"DB",
",",
"$",
"OUTPUT",
",",
"$",
"PAGE",
";",
... | Loads plugin settings to the settings tree
This function usually includes settings.php file in plugins folder.
Alternatively it can create a link to some settings page (instance of admin_externalpage)
@param \part_of_admin_tree $adminroot
@param string $parentnodename
@param bool $hassiteconfig whether the current us... | [
"Loads",
"plugin",
"settings",
"to",
"the",
"settings",
"tree"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/plugininfo/local.php#L57-L69 |
217,844 | moodle/moodle | mod/workshop/allocation/scheduled/classes/task/cron_task.php | cron_task.execute | public function execute() {
global $CFG, $DB;
$sql = "SELECT w.*
FROM {workshopallocation_scheduled} a
JOIN {workshop} w ON a.workshopid = w.id
WHERE a.enabled = 1
AND w.phase = 20
AND w.submissionend > 0
... | php | public function execute() {
global $CFG, $DB;
$sql = "SELECT w.*
FROM {workshopallocation_scheduled} a
JOIN {workshop} w ON a.workshopid = w.id
WHERE a.enabled = 1
AND w.phase = 20
AND w.submissionend > 0
... | [
"public",
"function",
"execute",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT w.*\n FROM {workshopallocation_scheduled} a\n JOIN {workshop} w ON a.workshopid = w.id\n WHERE a.enabled = 1\n ... | Run scheduled allocation cron. | [
"Run",
"scheduled",
"allocation",
"cron",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/allocation/scheduled/classes/task/cron_task.php#L48-L77 |
217,845 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.convertCharset | public static function convertCharset($input, $from, $to, $force = false)
{
/* Don't bother converting numbers. */
if (is_numeric($input)) {
return $input;
}
/* If the from and to character sets are identical, return now. */
if (!$force && $from == $to) {
... | php | public static function convertCharset($input, $from, $to, $force = false)
{
/* Don't bother converting numbers. */
if (is_numeric($input)) {
return $input;
}
/* If the from and to character sets are identical, return now. */
if (!$force && $from == $to) {
... | [
"public",
"static",
"function",
"convertCharset",
"(",
"$",
"input",
",",
"$",
"from",
",",
"$",
"to",
",",
"$",
"force",
"=",
"false",
")",
"{",
"/* Don't bother converting numbers. */",
"if",
"(",
"is_numeric",
"(",
"$",
"input",
")",
")",
"{",
"return",... | Converts a string from one charset to another.
Uses the iconv or the mbstring extensions.
The original string is returned if conversion failed or none
of the extensions were available.
@param mixed $input The data to be converted. If $input is an an
array, the array's values get converted
recursively.
@param strin... | [
"Converts",
"a",
"string",
"from",
"one",
"charset",
"to",
"another",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L50-L97 |
217,846 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String._convertCharset | protected static function _convertCharset($input, $from, $to)
{
/* Use utf8_[en|de]code() if possible and if the string isn't too
* large (less than 16 MB = 16 * 1024 * 1024 = 16777216 bytes) - these
* functions use more memory. */
if (Horde_Util::extensionExists('xml') &&
... | php | protected static function _convertCharset($input, $from, $to)
{
/* Use utf8_[en|de]code() if possible and if the string isn't too
* large (less than 16 MB = 16 * 1024 * 1024 = 16777216 bytes) - these
* functions use more memory. */
if (Horde_Util::extensionExists('xml') &&
... | [
"protected",
"static",
"function",
"_convertCharset",
"(",
"$",
"input",
",",
"$",
"from",
",",
"$",
"to",
")",
"{",
"/* Use utf8_[en|de]code() if possible and if the string isn't too\n * large (less than 16 MB = 16 * 1024 * 1024 = 16777216 bytes) - these\n * functions ... | Internal function used to do charset conversion.
@param string $input See self::convertCharset().
@param string $from See self::convertCharset().
@param string $to See self::convertCharset().
@return string The converted string. | [
"Internal",
"function",
"used",
"to",
"do",
"charset",
"conversion",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L108-L167 |
217,847 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.lower | public static function lower($string, $locale = false, $charset = null)
{
if ($locale) {
if (Horde_Util::extensionExists('mbstring')) {
if (is_null($charset)) {
throw new InvalidArgumentException('$charset argument must not be null');
}
... | php | public static function lower($string, $locale = false, $charset = null)
{
if ($locale) {
if (Horde_Util::extensionExists('mbstring')) {
if (is_null($charset)) {
throw new InvalidArgumentException('$charset argument must not be null');
}
... | [
"public",
"static",
"function",
"lower",
"(",
"$",
"string",
",",
"$",
"locale",
"=",
"false",
",",
"$",
"charset",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"locale",
")",
"{",
"if",
"(",
"Horde_Util",
"::",
"extensionExists",
"(",
"'mbstring'",
")",
"... | Makes a string lowercase.
@param string $string The string to be converted.
@param boolean $locale If true the string will be converted based on
a given charset, locale independent else.
@param string $charset If $locale is true, the charset to use when
converting.
@return string The string with lowercase charac... | [
"Makes",
"a",
"string",
"lowercase",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L180-L203 |
217,848 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.upper | public static function upper($string, $locale = false, $charset = null)
{
if ($locale) {
if (Horde_Util::extensionExists('mbstring')) {
if (is_null($charset)) {
throw new InvalidArgumentException('$charset argument must not be null');
}
... | php | public static function upper($string, $locale = false, $charset = null)
{
if ($locale) {
if (Horde_Util::extensionExists('mbstring')) {
if (is_null($charset)) {
throw new InvalidArgumentException('$charset argument must not be null');
}
... | [
"public",
"static",
"function",
"upper",
"(",
"$",
"string",
",",
"$",
"locale",
"=",
"false",
",",
"$",
"charset",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"locale",
")",
"{",
"if",
"(",
"Horde_Util",
"::",
"extensionExists",
"(",
"'mbstring'",
")",
"... | Makes a string uppercase.
@param string $string The string to be converted.
@param boolean $locale If true the string will be converted based on a
given charset, locale independent else.
@param string $charset If $locale is true, the charset to use when
converting. If not provided the current charset.
@return str... | [
"Makes",
"a",
"string",
"uppercase",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L216-L239 |
217,849 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.ucfirst | public static function ucfirst($string, $locale = false, $charset = null)
{
if ($locale) {
if (is_null($charset)) {
throw new InvalidArgumentException('$charset argument must not be null');
}
$first = self::substr($string, 0, 1, $charset);
if (... | php | public static function ucfirst($string, $locale = false, $charset = null)
{
if ($locale) {
if (is_null($charset)) {
throw new InvalidArgumentException('$charset argument must not be null');
}
$first = self::substr($string, 0, 1, $charset);
if (... | [
"public",
"static",
"function",
"ucfirst",
"(",
"$",
"string",
",",
"$",
"locale",
"=",
"false",
",",
"$",
"charset",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"locale",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"charset",
")",
")",
"{",
"throw",
"n... | Returns a string with the first letter capitalized if it is
alphabetic.
@param string $string The string to be capitalized.
@param boolean $locale If true the string will be converted based on a
given charset, locale independent else.
@param string $charset The charset to use, defaults to current charset.
@return... | [
"Returns",
"a",
"string",
"with",
"the",
"first",
"letter",
"capitalized",
"if",
"it",
"is",
"alphabetic",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L252-L267 |
217,850 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.ucwords | public static function ucwords($string, $locale = false, $charset = null)
{
$words = preg_split('/(\s+)/', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
for ($i = 0, $c = count($words); $i < $c; $i += 2) {
$words[$i] = self::ucfirst($words[$i], $locale, $charset);
}
return impl... | php | public static function ucwords($string, $locale = false, $charset = null)
{
$words = preg_split('/(\s+)/', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
for ($i = 0, $c = count($words); $i < $c; $i += 2) {
$words[$i] = self::ucfirst($words[$i], $locale, $charset);
}
return impl... | [
"public",
"static",
"function",
"ucwords",
"(",
"$",
"string",
",",
"$",
"locale",
"=",
"false",
",",
"$",
"charset",
"=",
"null",
")",
"{",
"$",
"words",
"=",
"preg_split",
"(",
"'/(\\s+)/'",
",",
"$",
"string",
",",
"-",
"1",
",",
"PREG_SPLIT_DELIM_C... | Returns a string with the first letter of each word capitalized if it is
alphabetic.
Sentences are splitted into words at whitestrings.
@param string $string The string to be capitalized.
@param boolean $locale If true the string will be converted based on a
given charset, locale independent else.
@param string $c... | [
"Returns",
"a",
"string",
"with",
"the",
"first",
"letter",
"of",
"each",
"word",
"capitalized",
"if",
"it",
"is",
"alphabetic",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L282-L289 |
217,851 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String._pos | protected static function _pos(
$haystack, $needle, $offset, $charset, $func
)
{
if (Horde_Util::extensionExists('mbstring')) {
unset($php_errormsg);
$track_errors = ini_set('track_errors', 1);
$ret = @call_user_func('mb_' . $func, $haystack, $needle, $offset,... | php | protected static function _pos(
$haystack, $needle, $offset, $charset, $func
)
{
if (Horde_Util::extensionExists('mbstring')) {
unset($php_errormsg);
$track_errors = ini_set('track_errors', 1);
$ret = @call_user_func('mb_' . $func, $haystack, $needle, $offset,... | [
"protected",
"static",
"function",
"_pos",
"(",
"$",
"haystack",
",",
"$",
"needle",
",",
"$",
"offset",
",",
"$",
"charset",
",",
"$",
"func",
")",
"{",
"if",
"(",
"Horde_Util",
"::",
"extensionExists",
"(",
"'mbstring'",
")",
")",
"{",
"unset",
"(",
... | Perform string position searches.
@param string $haystack The string to search through.
@param string $needle The string to search for.
@param integer $offset Character in $haystack to start searching at.
@param string $charset Charset of $needle.
@param string $func Function to use.
@return integer The... | [
"Perform",
"string",
"position",
"searches",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L482-L516 |
217,852 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.truncate | public static function truncate($text, $length = 100)
{
return (self::length($text) > $length)
? rtrim(self::substr($text, 0, $length - 3)) . '...'
: $text;
} | php | public static function truncate($text, $length = 100)
{
return (self::length($text) > $length)
? rtrim(self::substr($text, 0, $length - 3)) . '...'
: $text;
} | [
"public",
"static",
"function",
"truncate",
"(",
"$",
"text",
",",
"$",
"length",
"=",
"100",
")",
"{",
"return",
"(",
"self",
"::",
"length",
"(",
"$",
"text",
")",
">",
"$",
"length",
")",
"?",
"rtrim",
"(",
"self",
"::",
"substr",
"(",
"$",
"t... | Return a truncated string, suitable for notifications.
@param string $text The original string.
@param integer $length The maximum length.
@return string The truncated string, if longer than $length. | [
"Return",
"a",
"truncated",
"string",
"suitable",
"for",
"notifications",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L689-L694 |
217,853 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.abbreviate | public static function abbreviate($text, $length = 20)
{
return (self::length($text) > $length)
? rtrim(self::substr($text, 0, round(($length - 3) / 2))) . '...' . ltrim(self::substr($text, (($length - 3) / 2) * -1))
: $text;
} | php | public static function abbreviate($text, $length = 20)
{
return (self::length($text) > $length)
? rtrim(self::substr($text, 0, round(($length - 3) / 2))) . '...' . ltrim(self::substr($text, (($length - 3) / 2) * -1))
: $text;
} | [
"public",
"static",
"function",
"abbreviate",
"(",
"$",
"text",
",",
"$",
"length",
"=",
"20",
")",
"{",
"return",
"(",
"self",
"::",
"length",
"(",
"$",
"text",
")",
">",
"$",
"length",
")",
"?",
"rtrim",
"(",
"self",
"::",
"substr",
"(",
"$",
"... | Return an abbreviated string, with characters in the middle of the
excessively long string replaced by '...'.
@param string $text The original string.
@param integer $length The length at which to abbreviate.
@return string The abbreviated string, if longer than $length. | [
"Return",
"an",
"abbreviated",
"string",
"with",
"characters",
"in",
"the",
"middle",
"of",
"the",
"excessively",
"long",
"string",
"replaced",
"by",
"...",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L705-L710 |
217,854 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.common | public static function common($str1, $str2)
{
for ($result = '', $i = 0;
isset($str1[$i]) && isset($str2[$i]) && $str1[$i] == $str2[$i];
$i++) {
$result .= $str1[$i];
}
return $result;
} | php | public static function common($str1, $str2)
{
for ($result = '', $i = 0;
isset($str1[$i]) && isset($str2[$i]) && $str1[$i] == $str2[$i];
$i++) {
$result .= $str1[$i];
}
return $result;
} | [
"public",
"static",
"function",
"common",
"(",
"$",
"str1",
",",
"$",
"str2",
")",
"{",
"for",
"(",
"$",
"result",
"=",
"''",
",",
"$",
"i",
"=",
"0",
";",
"isset",
"(",
"$",
"str1",
"[",
"$",
"i",
"]",
")",
"&&",
"isset",
"(",
"$",
"str2",
... | Returns the common leading part of two strings.
@param string $str1 A string.
@param string $str2 Another string.
@return string The start of $str1 and $str2 that is identical in both. | [
"Returns",
"the",
"common",
"leading",
"part",
"of",
"two",
"strings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L720-L728 |
217,855 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.isAlpha | public static function isAlpha($string, $charset)
{
if (!Horde_Util::extensionExists('mbstring')) {
return ctype_alpha($string);
}
$charset = self::_mbstringCharset($charset);
$old_charset = mb_regex_encoding();
if ($charset != $old_charset) {
@mb_re... | php | public static function isAlpha($string, $charset)
{
if (!Horde_Util::extensionExists('mbstring')) {
return ctype_alpha($string);
}
$charset = self::_mbstringCharset($charset);
$old_charset = mb_regex_encoding();
if ($charset != $old_charset) {
@mb_re... | [
"public",
"static",
"function",
"isAlpha",
"(",
"$",
"string",
",",
"$",
"charset",
")",
"{",
"if",
"(",
"!",
"Horde_Util",
"::",
"extensionExists",
"(",
"'mbstring'",
")",
")",
"{",
"return",
"ctype_alpha",
"(",
"$",
"string",
")",
";",
"}",
"$",
"cha... | Returns true if the every character in the parameter is an alphabetic
character.
@param string $string The string to test.
@param string $charset The charset to use when testing the string.
@return boolean True if the parameter was alphabetic only. | [
"Returns",
"true",
"if",
"the",
"every",
"character",
"in",
"the",
"parameter",
"is",
"an",
"alphabetic",
"character",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L739-L757 |
217,856 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.isLower | public static function isLower($string, $charset)
{
return ((self::lower($string, true, $charset) === $string) &&
self::isAlpha($string, $charset));
} | php | public static function isLower($string, $charset)
{
return ((self::lower($string, true, $charset) === $string) &&
self::isAlpha($string, $charset));
} | [
"public",
"static",
"function",
"isLower",
"(",
"$",
"string",
",",
"$",
"charset",
")",
"{",
"return",
"(",
"(",
"self",
"::",
"lower",
"(",
"$",
"string",
",",
"true",
",",
"$",
"charset",
")",
"===",
"$",
"string",
")",
"&&",
"self",
"::",
"isAl... | Returns true if ever character in the parameter is a lowercase letter in
the current locale.
@param string $string The string to test.
@param string $charset The charset to use when testing the string.
@return boolean True if the parameter was lowercase. | [
"Returns",
"true",
"if",
"ever",
"character",
"in",
"the",
"parameter",
"is",
"a",
"lowercase",
"letter",
"in",
"the",
"current",
"locale",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L768-L772 |
217,857 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.isUpper | public static function isUpper($string, $charset)
{
return ((self::upper($string, true, $charset) === $string) &&
self::isAlpha($string, $charset));
} | php | public static function isUpper($string, $charset)
{
return ((self::upper($string, true, $charset) === $string) &&
self::isAlpha($string, $charset));
} | [
"public",
"static",
"function",
"isUpper",
"(",
"$",
"string",
",",
"$",
"charset",
")",
"{",
"return",
"(",
"(",
"self",
"::",
"upper",
"(",
"$",
"string",
",",
"true",
",",
"$",
"charset",
")",
"===",
"$",
"string",
")",
"&&",
"self",
"::",
"isAl... | Returns true if every character in the parameter is an uppercase letter
in the current locale.
@param string $string The string to test.
@param string $charset The charset to use when testing the string.
@return boolean True if the parameter was uppercase. | [
"Returns",
"true",
"if",
"every",
"character",
"in",
"the",
"parameter",
"is",
"an",
"uppercase",
"letter",
"in",
"the",
"current",
"locale",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L783-L787 |
217,858 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.regexMatch | public static function regexMatch($text, $regex, $charset = null)
{
if (!empty($charset)) {
$regex = self::convertCharset($regex, $charset, 'utf-8');
$text = self::convertCharset($text, $charset, 'utf-8');
}
$matches = array();
foreach ($regex as $val) {
... | php | public static function regexMatch($text, $regex, $charset = null)
{
if (!empty($charset)) {
$regex = self::convertCharset($regex, $charset, 'utf-8');
$text = self::convertCharset($text, $charset, 'utf-8');
}
$matches = array();
foreach ($regex as $val) {
... | [
"public",
"static",
"function",
"regexMatch",
"(",
"$",
"text",
",",
"$",
"regex",
",",
"$",
"charset",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"charset",
")",
")",
"{",
"$",
"regex",
"=",
"self",
"::",
"convertCharset",
"(",
"$",... | Performs a multibyte safe regex match search on the text provided.
@param string $text The text to search.
@param array $regex The regular expressions to use, without perl
regex delimiters (e.g. '/' or '|').
@param string $charset The character set of the text.
@return array The matches array from the first... | [
"Performs",
"a",
"multibyte",
"safe",
"regex",
"match",
"search",
"on",
"the",
"text",
"provided",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L799-L818 |
217,859 | moodle/moodle | lib/horde/framework/Horde/String.php | Horde_String.validUtf8 | public static function validUtf8($text)
{
$text = strval($text);
// First check for illegal surrogate pair sequences. See RFC 3629.
if (preg_match('/\xE0[\x80-\x9F][\x80-\xBF]|\xED[\xA0-\xBF][\x80-\xBF]/S', $text)) {
return false;
}
for ($i = 0, $len = strlen($t... | php | public static function validUtf8($text)
{
$text = strval($text);
// First check for illegal surrogate pair sequences. See RFC 3629.
if (preg_match('/\xE0[\x80-\x9F][\x80-\xBF]|\xED[\xA0-\xBF][\x80-\xBF]/S', $text)) {
return false;
}
for ($i = 0, $len = strlen($t... | [
"public",
"static",
"function",
"validUtf8",
"(",
"$",
"text",
")",
"{",
"$",
"text",
"=",
"strval",
"(",
"$",
"text",
")",
";",
"// First check for illegal surrogate pair sequences. See RFC 3629.",
"if",
"(",
"preg_match",
"(",
"'/\\xE0[\\x80-\\x9F][\\x80-\\xBF]|\\xED[... | Check to see if a string is valid UTF-8.
@param string $text The text to check.
@return boolean True if valid UTF-8. | [
"Check",
"to",
"see",
"if",
"a",
"string",
"is",
"valid",
"UTF",
"-",
"8",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/String.php#L827-L866 |
217,860 | moodle/moodle | enrol/self/externallib.php | enrol_self_external.get_instance_info | public static function get_instance_info($instanceid) {
global $DB, $CFG;
require_once($CFG->libdir . '/enrollib.php');
$params = self::validate_parameters(self::get_instance_info_parameters(), array('instanceid' => $instanceid));
// Retrieve self enrolment plugin.
$enrolplugi... | php | public static function get_instance_info($instanceid) {
global $DB, $CFG;
require_once($CFG->libdir . '/enrollib.php');
$params = self::validate_parameters(self::get_instance_info_parameters(), array('instanceid' => $instanceid));
// Retrieve self enrolment plugin.
$enrolplugi... | [
"public",
"static",
"function",
"get_instance_info",
"(",
"$",
"instanceid",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/enrollib.php'",
")",
";",
"$",
"params",
"=",
"self",
"::",
"valida... | Return self-enrolment instance information.
@param int $instanceid instance id of self enrolment plugin.
@return array instance information.
@throws moodle_exception | [
"Return",
"self",
"-",
"enrolment",
"instance",
"information",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/self/externallib.php#L57-L85 |
217,861 | moodle/moodle | mod/lti/classes/service_exception_handler.php | service_exception_handler.handle | public function handle($exception) {
$message = $exception->getMessage();
// Add the exception backtrace for developers.
if (debugging('', DEBUG_DEVELOPER)) {
$message .= "\n".format_backtrace(get_exception_info($exception)->backtrace, true);
}
// Switch to response... | php | public function handle($exception) {
$message = $exception->getMessage();
// Add the exception backtrace for developers.
if (debugging('', DEBUG_DEVELOPER)) {
$message .= "\n".format_backtrace(get_exception_info($exception)->backtrace, true);
}
// Switch to response... | [
"public",
"function",
"handle",
"(",
"$",
"exception",
")",
"{",
"$",
"message",
"=",
"$",
"exception",
"->",
"getMessage",
"(",
")",
";",
"// Add the exception backtrace for developers.",
"if",
"(",
"debugging",
"(",
"''",
",",
"DEBUG_DEVELOPER",
")",
")",
"{... | Echo an exception message encapsulated in XML.
@param \Exception|\Throwable $exception The exception that was thrown | [
"Echo",
"an",
"exception",
"message",
"encapsulated",
"in",
"XML",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/service_exception_handler.php#L99-L121 |
217,862 | moodle/moodle | backup/util/helper/backup_helper.class.php | backup_helper.clear_backup_dir | static public function clear_backup_dir($backupid, \core\progress\base $progress = null) {
$backupiddir = make_backup_temp_directory($backupid, false);
if (!self::delete_dir_contents($backupiddir, '', $progress)) {
throw new backup_helper_exception('cannot_empty_backup_temp_dir');
}
... | php | static public function clear_backup_dir($backupid, \core\progress\base $progress = null) {
$backupiddir = make_backup_temp_directory($backupid, false);
if (!self::delete_dir_contents($backupiddir, '', $progress)) {
throw new backup_helper_exception('cannot_empty_backup_temp_dir');
}
... | [
"static",
"public",
"function",
"clear_backup_dir",
"(",
"$",
"backupid",
",",
"\\",
"core",
"\\",
"progress",
"\\",
"base",
"$",
"progress",
"=",
"null",
")",
"{",
"$",
"backupiddir",
"=",
"make_backup_temp_directory",
"(",
"$",
"backupid",
",",
"false",
")... | Given one backupid, ensure its temp dir is completely empty
If supplied, progress object should be ready to receive indeterminate
progress reports.
@param string $backupid Backup id
@param \core\progress\base $progress Optional progress reporting object | [
"Given",
"one",
"backupid",
"ensure",
"its",
"temp",
"dir",
"is",
"completely",
"empty"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/backup_helper.class.php#L51-L57 |
217,863 | moodle/moodle | backup/util/helper/backup_helper.class.php | backup_helper.delete_backup_dir | static public function delete_backup_dir($backupid, \core\progress\base $progress = null) {
$backupiddir = make_backup_temp_directory($backupid, false);
self::clear_backup_dir($backupid, $progress);
return rmdir($backupiddir);
} | php | static public function delete_backup_dir($backupid, \core\progress\base $progress = null) {
$backupiddir = make_backup_temp_directory($backupid, false);
self::clear_backup_dir($backupid, $progress);
return rmdir($backupiddir);
} | [
"static",
"public",
"function",
"delete_backup_dir",
"(",
"$",
"backupid",
",",
"\\",
"core",
"\\",
"progress",
"\\",
"base",
"$",
"progress",
"=",
"null",
")",
"{",
"$",
"backupiddir",
"=",
"make_backup_temp_directory",
"(",
"$",
"backupid",
",",
"false",
"... | Given one backupid, delete completely its temp dir
If supplied, progress object should be ready to receive indeterminate
progress reports.
@param string $backupid Backup id
@param \core\progress\base $progress Optional progress reporting object | [
"Given",
"one",
"backupid",
"delete",
"completely",
"its",
"temp",
"dir"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/backup_helper.class.php#L68-L72 |
217,864 | moodle/moodle | backup/util/helper/backup_helper.class.php | backup_helper.delete_old_backup_dirs | static public function delete_old_backup_dirs($deletefrom, \core\progress\base $progress = null) {
$status = true;
// Get files and directories in the backup temp dir without descend.
$backuptempdir = make_backup_temp_directory('');
$list = get_directory_list($backuptempdir, '', false, t... | php | static public function delete_old_backup_dirs($deletefrom, \core\progress\base $progress = null) {
$status = true;
// Get files and directories in the backup temp dir without descend.
$backuptempdir = make_backup_temp_directory('');
$list = get_directory_list($backuptempdir, '', false, t... | [
"static",
"public",
"function",
"delete_old_backup_dirs",
"(",
"$",
"deletefrom",
",",
"\\",
"core",
"\\",
"progress",
"\\",
"base",
"$",
"progress",
"=",
"null",
")",
"{",
"$",
"status",
"=",
"true",
";",
"// Get files and directories in the backup temp dir without... | Delete all the temp dirs older than the time specified.
If supplied, progress object should be ready to receive indeterminate
progress reports.
@param int $deletefrom Time to delete from
@param \core\progress\base $progress Optional progress reporting object | [
"Delete",
"all",
"the",
"temp",
"dirs",
"older",
"than",
"the",
"time",
"specified",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/helper/backup_helper.class.php#L159-L181 |
217,865 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/Context.php | HTMLPurifier_Context.destroy | public function destroy($name)
{
if (!array_key_exists($name, $this->_storage)) {
trigger_error(
"Attempted to destroy non-existent variable $name",
E_USER_ERROR
);
return;
}
unset($this->_storage[$name]);
} | php | public function destroy($name)
{
if (!array_key_exists($name, $this->_storage)) {
trigger_error(
"Attempted to destroy non-existent variable $name",
E_USER_ERROR
);
return;
}
unset($this->_storage[$name]);
} | [
"public",
"function",
"destroy",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"_storage",
")",
")",
"{",
"trigger_error",
"(",
"\"Attempted to destroy non-existent variable $name\"",
",",
"E_USER_ERROR... | Destroys a variable in the context.
@param string $name String name | [
"Destroys",
"a",
"variable",
"in",
"the",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Context.php#L61-L71 |
217,866 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/Context.php | HTMLPurifier_Context.loadArray | public function loadArray($context_array)
{
foreach ($context_array as $key => $discard) {
$this->register($key, $context_array[$key]);
}
} | php | public function loadArray($context_array)
{
foreach ($context_array as $key => $discard) {
$this->register($key, $context_array[$key]);
}
} | [
"public",
"function",
"loadArray",
"(",
"$",
"context_array",
")",
"{",
"foreach",
"(",
"$",
"context_array",
"as",
"$",
"key",
"=>",
"$",
"discard",
")",
"{",
"$",
"this",
"->",
"register",
"(",
"$",
"key",
",",
"$",
"context_array",
"[",
"$",
"key",
... | Loads a series of variables from an associative array
@param array $context_array Assoc array of variables to load | [
"Loads",
"a",
"series",
"of",
"variables",
"from",
"an",
"associative",
"array"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Context.php#L87-L92 |
217,867 | moodle/moodle | backup/controller/base_controller.class.php | base_controller.add_logger | public function add_logger(base_logger $logger) {
$existing = $this->logger;
while ($existing->get_next()) {
$existing = $existing->get_next();
}
$existing->set_next($logger);
} | php | public function add_logger(base_logger $logger) {
$existing = $this->logger;
while ($existing->get_next()) {
$existing = $existing->get_next();
}
$existing->set_next($logger);
} | [
"public",
"function",
"add_logger",
"(",
"base_logger",
"$",
"logger",
")",
"{",
"$",
"existing",
"=",
"$",
"this",
"->",
"logger",
";",
"while",
"(",
"$",
"existing",
"->",
"get_next",
"(",
")",
")",
"{",
"$",
"existing",
"=",
"$",
"existing",
"->",
... | Inserts a new logger at end of logging chain.
@param base_logger $logger New logger to add | [
"Inserts",
"a",
"new",
"logger",
"at",
"end",
"of",
"logging",
"chain",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/controller/base_controller.class.php#L69-L75 |
217,868 | moodle/moodle | backup/moodle2/backup_xml_transformer.class.php | backup_xml_transformer.register_link_encoders | private function register_link_encoders() {
global $LINKS_ENCODERS_CACHE;
// If encoder is linked, then return cached encoder.
if (!empty($LINKS_ENCODERS_CACHE)) {
return $LINKS_ENCODERS_CACHE;
}
$encoders = array();
// Add the course encoder
$encode... | php | private function register_link_encoders() {
global $LINKS_ENCODERS_CACHE;
// If encoder is linked, then return cached encoder.
if (!empty($LINKS_ENCODERS_CACHE)) {
return $LINKS_ENCODERS_CACHE;
}
$encoders = array();
// Add the course encoder
$encode... | [
"private",
"function",
"register_link_encoders",
"(",
")",
"{",
"global",
"$",
"LINKS_ENCODERS_CACHE",
";",
"// If encoder is linked, then return cached encoder.",
"if",
"(",
"!",
"empty",
"(",
"$",
"LINKS_ENCODERS_CACHE",
")",
")",
"{",
"return",
"$",
"LINKS_ENCODERS_C... | Register all available content link encoders
@return array encoder
@todo MDL-25290 replace LINKS_ENCODERS_CACHE global with MUC code | [
"Register",
"all",
"available",
"content",
"link",
"encoders"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/backup_xml_transformer.class.php#L147-L184 |
217,869 | moodle/moodle | user/classes/search/user.php | user.get_document_recordset | public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
global $DB;
// Prepare query conditions.
$where = 'timemodified >= ? AND deleted = ? AND confirmed = ?';
$params = [$modifiedfrom, 0, 1];
// Handle context types.
if (!$context) {
... | php | public function get_document_recordset($modifiedfrom = 0, \context $context = null) {
global $DB;
// Prepare query conditions.
$where = 'timemodified >= ? AND deleted = ? AND confirmed = ?';
$params = [$modifiedfrom, 0, 1];
// Handle context types.
if (!$context) {
... | [
"public",
"function",
"get_document_recordset",
"(",
"$",
"modifiedfrom",
"=",
"0",
",",
"\\",
"context",
"$",
"context",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"// Prepare query conditions.",
"$",
"where",
"=",
"'timemodified >= ? AND deleted = ? AND conf... | Returns recordset containing required data attributes for indexing.
@param number $modifiedfrom
@param \context|null $context Optional context to restrict scope of returned results
@return \moodle_recordset|null Recordset (or null if no results) | [
"Returns",
"recordset",
"containing",
"required",
"data",
"attributes",
"for",
"indexing",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/search/user.php#L47-L80 |
217,870 | moodle/moodle | user/classes/search/user.php | user.get_document | public function get_document($record, $options = array()) {
$context = \context_system::instance();
// Prepare associative array with data from DB.
$doc = \core_search\document_factory::instance($record->id, $this->componentname, $this->areaname);
// Include all alternate names in titl... | php | public function get_document($record, $options = array()) {
$context = \context_system::instance();
// Prepare associative array with data from DB.
$doc = \core_search\document_factory::instance($record->id, $this->componentname, $this->areaname);
// Include all alternate names in titl... | [
"public",
"function",
"get_document",
"(",
"$",
"record",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"context",
"=",
"\\",
"context_system",
"::",
"instance",
"(",
")",
";",
"// Prepare associative array with data from DB.",
"$",
"doc",
"=",
... | Returns document instances for each record in the recordset.
@param \stdClass $record
@param array $options
@return \core_search\document | [
"Returns",
"document",
"instances",
"for",
"each",
"record",
"in",
"the",
"recordset",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/search/user.php#L89-L117 |
217,871 | moodle/moodle | user/classes/search/user.php | user.get_document_display_title | public function get_document_display_title(\core_search\document $doc) {
$user = \core_user::get_user($doc->get('itemid'));
return fullname($user);
} | php | public function get_document_display_title(\core_search\document $doc) {
$user = \core_user::get_user($doc->get('itemid'));
return fullname($user);
} | [
"public",
"function",
"get_document_display_title",
"(",
"\\",
"core_search",
"\\",
"document",
"$",
"doc",
")",
"{",
"$",
"user",
"=",
"\\",
"core_user",
"::",
"get_user",
"(",
"$",
"doc",
"->",
"get",
"(",
"'itemid'",
")",
")",
";",
"return",
"fullname",... | Returns the user fullname to display as document title
@param \core_search\document $doc
@return string User fullname | [
"Returns",
"the",
"user",
"fullname",
"to",
"display",
"as",
"document",
"title"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/search/user.php#L125-L129 |
217,872 | moodle/moodle | user/classes/search/user.php | user.check_access | public function check_access($id) {
global $DB, $USER;
$user = $DB->get_record('user', array('id' => $id));
if (!$user || $user->deleted) {
return \core_search\manager::ACCESS_DELETED;
}
if (user_can_view_profile($user)) {
return \core_search\manager::AC... | php | public function check_access($id) {
global $DB, $USER;
$user = $DB->get_record('user', array('id' => $id));
if (!$user || $user->deleted) {
return \core_search\manager::ACCESS_DELETED;
}
if (user_can_view_profile($user)) {
return \core_search\manager::AC... | [
"public",
"function",
"check_access",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"user",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'user'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"id",
")",
")",
";",
"if",
"(",
"!... | Checking whether I can access a document
@param int $id user id
@return int | [
"Checking",
"whether",
"I",
"can",
"access",
"a",
"document"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/search/user.php#L137-L150 |
217,873 | moodle/moodle | lib/dml/pgsql_native_moodle_database.php | pgsql_native_moodle_database.fetch_from_cursor | public function fetch_from_cursor($cursorname) {
$count = $this->get_fetch_buffer_size();
$sql = 'FETCH ' . $count . ' FROM ' . $cursorname;
$this->query_start($sql, [], SQL_QUERY_AUX);
$result = pg_query($this->pgsql, $sql);
$last = pg_num_rows($result) !== $count;
$t... | php | public function fetch_from_cursor($cursorname) {
$count = $this->get_fetch_buffer_size();
$sql = 'FETCH ' . $count . ' FROM ' . $cursorname;
$this->query_start($sql, [], SQL_QUERY_AUX);
$result = pg_query($this->pgsql, $sql);
$last = pg_num_rows($result) !== $count;
$t... | [
"public",
"function",
"fetch_from_cursor",
"(",
"$",
"cursorname",
")",
"{",
"$",
"count",
"=",
"$",
"this",
"->",
"get_fetch_buffer_size",
"(",
")",
";",
"$",
"sql",
"=",
"'FETCH '",
".",
"$",
"count",
".",
"' FROM '",
".",
"$",
"cursorname",
";",
"$",
... | Retrieves data from cursor. For use by recordset only; do not call directly.
Return value contains the next batch of Postgres data, and a boolean indicating if this is
definitely the last batch (if false, there may be more)
@param string $cursorname Name of cursor to read from
@return array Array with 2 elements (nex... | [
"Retrieves",
"data",
"from",
"cursor",
".",
"For",
"use",
"by",
"recordset",
"only",
";",
"do",
"not",
"call",
"directly",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/pgsql_native_moodle_database.php#L798-L810 |
217,874 | moodle/moodle | lib/dml/pgsql_native_moodle_database.php | pgsql_native_moodle_database.close_cursor | public function close_cursor($cursorname) {
// If the transaction got cancelled, then ignore this request.
$sql = 'CLOSE ' . $cursorname;
$this->query_start($sql, [], SQL_QUERY_AUX);
$result = pg_query($this->pgsql, $sql);
$this->query_end($result);
if ($result) {
... | php | public function close_cursor($cursorname) {
// If the transaction got cancelled, then ignore this request.
$sql = 'CLOSE ' . $cursorname;
$this->query_start($sql, [], SQL_QUERY_AUX);
$result = pg_query($this->pgsql, $sql);
$this->query_end($result);
if ($result) {
... | [
"public",
"function",
"close_cursor",
"(",
"$",
"cursorname",
")",
"{",
"// If the transaction got cancelled, then ignore this request.",
"$",
"sql",
"=",
"'CLOSE '",
".",
"$",
"cursorname",
";",
"$",
"this",
"->",
"query_start",
"(",
"$",
"sql",
",",
"[",
"]",
... | Closes a cursor. For use by recordset only; do not call directly.
@param string $cursorname Name of cursor to close
@return bool True if we actually closed one, false if the transaction was cancelled | [
"Closes",
"a",
"cursor",
".",
"For",
"use",
"by",
"recordset",
"only",
";",
"do",
"not",
"call",
"directly",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/pgsql_native_moodle_database.php#L818-L828 |
217,875 | moodle/moodle | lib/dml/pgsql_native_moodle_database.php | pgsql_native_moodle_database.insert_chunk | protected function insert_chunk($table, array $chunk, array $columns) {
$i = 1;
$params = array();
$values = array();
foreach ($chunk as $dataobject) {
$vals = array();
foreach ($columns as $field => $column) {
$params[] = $this->normalise_value($c... | php | protected function insert_chunk($table, array $chunk, array $columns) {
$i = 1;
$params = array();
$values = array();
foreach ($chunk as $dataobject) {
$vals = array();
foreach ($columns as $field => $column) {
$params[] = $this->normalise_value($c... | [
"protected",
"function",
"insert_chunk",
"(",
"$",
"table",
",",
"array",
"$",
"chunk",
",",
"array",
"$",
"columns",
")",
"{",
"$",
"i",
"=",
"1",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"values",
"=",
"array",
"(",
")",
";",
"fore... | Insert records in chunks, strict param types...
Note: can be used only from insert_records().
@param string $table
@param array $chunk
@param database_column_info[] $columns | [
"Insert",
"records",
"in",
"chunks",
"strict",
"param",
"types",
"..."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/pgsql_native_moodle_database.php#L1092-L1113 |
217,876 | moodle/moodle | lib/dml/pgsql_native_moodle_database.php | pgsql_native_moodle_database.delete_records_select | public function delete_records_select($table, $select, array $params=null) {
if ($select) {
$select = "WHERE $select";
}
$sql = "DELETE FROM {$this->prefix}$table $select";
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
$this->query_start($sql, $... | php | public function delete_records_select($table, $select, array $params=null) {
if ($select) {
$select = "WHERE $select";
}
$sql = "DELETE FROM {$this->prefix}$table $select";
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
$this->query_start($sql, $... | [
"public",
"function",
"delete_records_select",
"(",
"$",
"table",
",",
"$",
"select",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"select",
")",
"{",
"$",
"select",
"=",
"\"WHERE $select\"",
";",
"}",
"$",
"sql",
"=",
"\"DELETE ... | Delete one or more records from a table which match a particular WHERE clause, lobs not supported.
@param string $table The database table to be checked against.
@param string $select A fragment of SQL to be used in a where clause in the SQL call (used to define the selection criteria).
@param array $params array of s... | [
"Delete",
"one",
"or",
"more",
"records",
"from",
"a",
"table",
"which",
"match",
"a",
"particular",
"WHERE",
"clause",
"lobs",
"not",
"supported",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/pgsql_native_moodle_database.php#L1266-L1281 |
217,877 | moodle/moodle | mod/assign/feedback/editpdf/fpdi/pdf_context.php | pdf_context.getPos | public function getPos()
{
if ($this->_mode == 0) {
if (feof($this->file)) {
$stat = fstat($this->file);
fseek($this->file, $stat['size']);
}
$pos = ftell($this->file);
return $pos;
} else {
ret... | php | public function getPos()
{
if ($this->_mode == 0) {
if (feof($this->file)) {
$stat = fstat($this->file);
fseek($this->file, $stat['size']);
}
$pos = ftell($this->file);
return $pos;
} else {
ret... | [
"public",
"function",
"getPos",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_mode",
"==",
"0",
")",
"{",
"if",
"(",
"feof",
"(",
"$",
"this",
"->",
"file",
")",
")",
"{",
"$",
"stat",
"=",
"fstat",
"(",
"$",
"this",
"->",
"file",
")",
";",
... | Get the position in the file stream
@return int | [
"Get",
"the",
"position",
"in",
"the",
"file",
"stream"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/fpdi/pdf_context.php#L67-L81 |
217,878 | moodle/moodle | mod/assign/feedback/editpdf/fpdi/pdf_context.php | pdf_context.reset | public function reset($pos = null, $l = 100)
{
if ($this->_mode == 0) {
if (!is_null($pos)) {
fseek($this->file, $pos);
}
$this->buffer = $l > 0 ? fread($this->file, $l) : '';
$this->length = strlen($this->buffer);
if ($th... | php | public function reset($pos = null, $l = 100)
{
if ($this->_mode == 0) {
if (!is_null($pos)) {
fseek($this->file, $pos);
}
$this->buffer = $l > 0 ? fread($this->file, $l) : '';
$this->length = strlen($this->buffer);
if ($th... | [
"public",
"function",
"reset",
"(",
"$",
"pos",
"=",
"null",
",",
"$",
"l",
"=",
"100",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_mode",
"==",
"0",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"pos",
")",
")",
"{",
"fseek",
"(",
"$",
"thi... | Reset the position in the file stream.
Optionally move the file pointer to a new location and reset the buffered data.
@param null $pos
@param int $l | [
"Reset",
"the",
"position",
"in",
"the",
"file",
"stream",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/fpdi/pdf_context.php#L91-L108 |
217,879 | moodle/moodle | mod/forum/classes/potential_subscriber_selector.php | mod_forum_potential_subscriber_selector.find_users | public function find_users($search) {
global $DB;
$whereconditions = array();
list($wherecondition, $params) = $this->search_sql($search, 'u');
if ($wherecondition) {
$whereconditions[] = $wherecondition;
}
if (!$this->forcesubscribed) {
$existin... | php | public function find_users($search) {
global $DB;
$whereconditions = array();
list($wherecondition, $params) = $this->search_sql($search, 'u');
if ($wherecondition) {
$whereconditions[] = $wherecondition;
}
if (!$this->forcesubscribed) {
$existin... | [
"public",
"function",
"find_users",
"(",
"$",
"search",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"whereconditions",
"=",
"array",
"(",
")",
";",
"list",
"(",
"$",
"wherecondition",
",",
"$",
"params",
")",
"=",
"$",
"this",
"->",
"search_sql",
"(",
"... | Finds all potential users
Potential subscribers are all enroled users who are not already subscribed.
@param string $search
@return array | [
"Finds",
"all",
"potential",
"users"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/potential_subscriber_selector.php#L79-L143 |
217,880 | moodle/moodle | lib/classes/grades_external.php | core_grades_external.get_grade_item | private static function get_grade_item($courseid, $itemtype, $itemmodule = null, $iteminstance = null, $itemnumber = null) {
$gradeiteminstance = null;
if ($itemtype == 'course') {
$gradeiteminstance = grade_item::fetch(array('courseid' => $courseid, 'itemtype' => $itemtype));
} else... | php | private static function get_grade_item($courseid, $itemtype, $itemmodule = null, $iteminstance = null, $itemnumber = null) {
$gradeiteminstance = null;
if ($itemtype == 'course') {
$gradeiteminstance = grade_item::fetch(array('courseid' => $courseid, 'itemtype' => $itemtype));
} else... | [
"private",
"static",
"function",
"get_grade_item",
"(",
"$",
"courseid",
",",
"$",
"itemtype",
",",
"$",
"itemmodule",
"=",
"null",
",",
"$",
"iteminstance",
"=",
"null",
",",
"$",
"itemnumber",
"=",
"null",
")",
"{",
"$",
"gradeiteminstance",
"=",
"null",... | Get a grade item
@param int $courseid Course id
@param string $itemtype Item type
@param string $itemmodule Item module
@param int $iteminstance Item instance
@param int $itemnumber Item number
@return grade_item A grade_item instance
@deprecated Moodle 3.2 MDL-51373 - Please do not ... | [
"Get",
"a",
"grade",
"item"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/grades_external.php#L303-L313 |
217,881 | moodle/moodle | lib/classes/grades_external.php | core_grades_external.update_grades | public static function update_grades($source, $courseid, $component, $activityid,
$itemnumber, $grades = array(), $itemdetails = array()) {
global $CFG;
$params = self::validate_parameters(
self::update_grades_parameters(),
array(
'source' => $source,
... | php | public static function update_grades($source, $courseid, $component, $activityid,
$itemnumber, $grades = array(), $itemdetails = array()) {
global $CFG;
$params = self::validate_parameters(
self::update_grades_parameters(),
array(
'source' => $source,
... | [
"public",
"static",
"function",
"update_grades",
"(",
"$",
"source",
",",
"$",
"courseid",
",",
"$",
"component",
",",
"$",
"activityid",
",",
"$",
"itemnumber",
",",
"$",
"grades",
"=",
"array",
"(",
")",
",",
"$",
"itemdetails",
"=",
"array",
"(",
")... | Update a grade item and, optionally, student grades
@param string $source The source of the grade update
@param int $courseid The course id
@param string $component Component name
@param int $activityid The activity id
@param int $itemnumber The item number
@param array $grades Ar... | [
"Update",
"a",
"grade",
"item",
"and",
"optionally",
"student",
"grades"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/grades_external.php#L490-L558 |
217,882 | moodle/moodle | lib/pear/HTML/QuickForm/Rule/Compare.php | HTML_QuickForm_Rule_Compare._findOperator | function _findOperator($name)
{
if (empty($name)) {
return '==';
} elseif (isset($this->_operators[$name])) {
return $this->_operators[$name];
} elseif (in_array($name, $this->_operators)) {
return $name;
} else {
return '==';
}... | php | function _findOperator($name)
{
if (empty($name)) {
return '==';
} elseif (isset($this->_operators[$name])) {
return $this->_operators[$name];
} elseif (in_array($name, $this->_operators)) {
return $name;
} else {
return '==';
}... | [
"function",
"_findOperator",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"return",
"'=='",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"this",
"->",
"_operators",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return"... | Returns the operator to use for comparing the values
@access private
@param string operator name
@return string operator to use for validation | [
"Returns",
"the",
"operator",
"to",
"use",
"for",
"comparing",
"the",
"values"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/Rule/Compare.php#L57-L68 |
217,883 | moodle/moodle | repository/nextcloud/classes/issuer_management.php | issuer_management.is_valid_issuer | public static function is_valid_issuer(\core\oauth2\issuer $issuer) {
$endpointwebdav = false;
$endpointocs = false;
$endpointtoken = false;
$endpointauth = false;
$endpointuserinfo = false;
$endpoints = \core\oauth2\api::get_endpoints($issuer);
foreach ($endpoint... | php | public static function is_valid_issuer(\core\oauth2\issuer $issuer) {
$endpointwebdav = false;
$endpointocs = false;
$endpointtoken = false;
$endpointauth = false;
$endpointuserinfo = false;
$endpoints = \core\oauth2\api::get_endpoints($issuer);
foreach ($endpoint... | [
"public",
"static",
"function",
"is_valid_issuer",
"(",
"\\",
"core",
"\\",
"oauth2",
"\\",
"issuer",
"$",
"issuer",
")",
"{",
"$",
"endpointwebdav",
"=",
"false",
";",
"$",
"endpointocs",
"=",
"false",
";",
"$",
"endpointtoken",
"=",
"false",
";",
"$",
... | Check if an issuer provides all endpoints that are required by repository_nextcloud.
@param \core\oauth2\issuer $issuer An issuer.
@return bool True, if all endpoints exist; false otherwise. | [
"Check",
"if",
"an",
"issuer",
"provides",
"all",
"endpoints",
"that",
"are",
"required",
"by",
"repository_nextcloud",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/classes/issuer_management.php#L43-L71 |
217,884 | moodle/moodle | repository/nextcloud/classes/issuer_management.php | issuer_management.parse_endpoint_url | public static function parse_endpoint_url(string $endpointname, \core\oauth2\issuer $issuer) : array {
$url = $issuer->get_endpoint_url($endpointname);
if (empty($url)) {
throw new configuration_exception(get_string('endpointnotdefined', 'repository_nextcloud', $endpointname));
}
... | php | public static function parse_endpoint_url(string $endpointname, \core\oauth2\issuer $issuer) : array {
$url = $issuer->get_endpoint_url($endpointname);
if (empty($url)) {
throw new configuration_exception(get_string('endpointnotdefined', 'repository_nextcloud', $endpointname));
}
... | [
"public",
"static",
"function",
"parse_endpoint_url",
"(",
"string",
"$",
"endpointname",
",",
"\\",
"core",
"\\",
"oauth2",
"\\",
"issuer",
"$",
"issuer",
")",
":",
"array",
"{",
"$",
"url",
"=",
"$",
"issuer",
"->",
"get_endpoint_url",
"(",
"$",
"endpoin... | Returns the parsed url parts of an endpoint of an issuer.
@param string $endpointname
@param \core\oauth2\issuer $issuer
@return array parseurl [scheme => https/http, host=>'hostname', port=>443, path=>'path']
@throws configuration_exception if an endpoint is undefined | [
"Returns",
"the",
"parsed",
"url",
"parts",
"of",
"an",
"endpoint",
"of",
"an",
"issuer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/classes/issuer_management.php#L80-L86 |
217,885 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/Injector.php | HTMLPurifier_Injector.allowsElement | public function allowsElement($name)
{
if (!empty($this->currentNesting)) {
$parent_token = array_pop($this->currentNesting);
$this->currentNesting[] = $parent_token;
$parent = $this->htmlDefinition->info[$parent_token->name];
} else {
$parent = $this-... | php | public function allowsElement($name)
{
if (!empty($this->currentNesting)) {
$parent_token = array_pop($this->currentNesting);
$this->currentNesting[] = $parent_token;
$parent = $this->htmlDefinition->info[$parent_token->name];
} else {
$parent = $this-... | [
"public",
"function",
"allowsElement",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"currentNesting",
")",
")",
"{",
"$",
"parent_token",
"=",
"array_pop",
"(",
"$",
"this",
"->",
"currentNesting",
")",
";",
"$",
"this",... | Tests if the context node allows a certain element
@param string $name Name of element to test for
@return bool True if element is allowed, false if it is not | [
"Tests",
"if",
"the",
"context",
"node",
"allows",
"a",
"certain",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Injector.php#L147-L168 |
217,886 | moodle/moodle | lib/lessphp/Cache.php | Less_Cache.Regen | public static function Regen( $less_files, $parser_options = array(), $modify_vars = array() ){
$parser_options['use_cache'] = false;
return self::Get( $less_files, $parser_options, $modify_vars );
} | php | public static function Regen( $less_files, $parser_options = array(), $modify_vars = array() ){
$parser_options['use_cache'] = false;
return self::Get( $less_files, $parser_options, $modify_vars );
} | [
"public",
"static",
"function",
"Regen",
"(",
"$",
"less_files",
",",
"$",
"parser_options",
"=",
"array",
"(",
")",
",",
"$",
"modify_vars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"parser_options",
"[",
"'use_cache'",
"]",
"=",
"false",
";",
"return",
... | Force the compiler to regenerate the cached css file
@param array $less_files Array of .less files to compile
@param array $parser_options Array of compiler options
@param array $modify_vars Array of variables
@return string Name of the css file | [
"Force",
"the",
"compiler",
"to",
"regenerate",
"the",
"cached",
"css",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Cache.php#L140-L143 |
217,887 | moodle/moodle | lib/lessphp/Cache.php | Less_Cache.ListFiles | static function ListFiles($list_file, &$list, &$css_file_name ){
$list = explode("\n",file_get_contents($list_file));
//pop the cached name that should match $compiled_name
$css_file_name = array_pop($list);
if( !preg_match('/^' . Less_Cache::$prefix . '[a-f0-9]+\.css$/',$css_file_name) ){
$list[] = $css_... | php | static function ListFiles($list_file, &$list, &$css_file_name ){
$list = explode("\n",file_get_contents($list_file));
//pop the cached name that should match $compiled_name
$css_file_name = array_pop($list);
if( !preg_match('/^' . Less_Cache::$prefix . '[a-f0-9]+\.css$/',$css_file_name) ){
$list[] = $css_... | [
"static",
"function",
"ListFiles",
"(",
"$",
"list_file",
",",
"&",
"$",
"list",
",",
"&",
"$",
"css_file_name",
")",
"{",
"$",
"list",
"=",
"explode",
"(",
"\"\\n\"",
",",
"file_get_contents",
"(",
"$",
"list_file",
")",
")",
";",
"//pop the cached name t... | Get the list of less files and generated css file from a list file | [
"Get",
"the",
"list",
"of",
"less",
"files",
"and",
"generated",
"css",
"file",
"from",
"a",
"list",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Cache.php#L301-L313 |
217,888 | moodle/moodle | privacy/classes/local/request/contextlist_base.php | contextlist_base.get_contexts | public function get_contexts() : array {
$contexts = [];
foreach ($this->contextids as $contextid) {
// It is possible that this context has been deleted and we now have subsequent calls being made with this
// contextlist. Exceptions here will stop the further processing of this... | php | public function get_contexts() : array {
$contexts = [];
foreach ($this->contextids as $contextid) {
// It is possible that this context has been deleted and we now have subsequent calls being made with this
// contextlist. Exceptions here will stop the further processing of this... | [
"public",
"function",
"get_contexts",
"(",
")",
":",
"array",
"{",
"$",
"contexts",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"contextids",
"as",
"$",
"contextid",
")",
"{",
"// It is possible that this context has been deleted and we now have subsequen... | Get the complete list of context objects that relate to this
request.
@return \context[] | [
"Get",
"the",
"complete",
"list",
"of",
"context",
"objects",
"that",
"relate",
"to",
"this",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/local/request/contextlist_base.php#L84-L99 |
217,889 | moodle/moodle | privacy/classes/local/request/contextlist_base.php | contextlist_base.current | public function current() {
// It is possible that this context has been deleted and we now have subsequent calls being made with this
// contextlist. Exceptions here will stop the further processing of this component and that is why we are
// doing a try catch.
try {
$contex... | php | public function current() {
// It is possible that this context has been deleted and we now have subsequent calls being made with this
// contextlist. Exceptions here will stop the further processing of this component and that is why we are
// doing a try catch.
try {
$contex... | [
"public",
"function",
"current",
"(",
")",
"{",
"// It is possible that this context has been deleted and we now have subsequent calls being made with this",
"// contextlist. Exceptions here will stop the further processing of this component and that is why we are",
"// doing a try catch.",
"try",... | Return the current context.
@return \context | [
"Return",
"the",
"current",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/local/request/contextlist_base.php#L124-L144 |
217,890 | moodle/moodle | mod/quiz/classes/repaginate.php | repaginate.get_this_slot | protected function get_this_slot($slots, $slotnumber) {
foreach ($slots as $key => $slot) {
if ($slot->slot == $slotnumber) {
return $slot;
}
}
return null;
} | php | protected function get_this_slot($slots, $slotnumber) {
foreach ($slots as $key => $slot) {
if ($slot->slot == $slotnumber) {
return $slot;
}
}
return null;
} | [
"protected",
"function",
"get_this_slot",
"(",
"$",
"slots",
",",
"$",
"slotnumber",
")",
"{",
"foreach",
"(",
"$",
"slots",
"as",
"$",
"key",
"=>",
"$",
"slot",
")",
"{",
"if",
"(",
"$",
"slot",
"->",
"slot",
"==",
"$",
"slotnumber",
")",
"{",
"re... | Return current slot object.
@param array $slots
@param int $slotnumber
@return stdClass $slot | [
"Return",
"current",
"slot",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/repaginate.php#L85-L92 |
217,891 | moodle/moodle | mod/quiz/classes/repaginate.php | repaginate.get_slots_by_slot_number | protected function get_slots_by_slot_number($slots) {
if (!$slots) {
return array();
}
$newslots = array();
foreach ($slots as $slot) {
$newslots[$slot->slot] = $slot;
}
return $newslots;
} | php | protected function get_slots_by_slot_number($slots) {
if (!$slots) {
return array();
}
$newslots = array();
foreach ($slots as $slot) {
$newslots[$slot->slot] = $slot;
}
return $newslots;
} | [
"protected",
"function",
"get_slots_by_slot_number",
"(",
"$",
"slots",
")",
"{",
"if",
"(",
"!",
"$",
"slots",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"newslots",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"slots",
"as",
"$",
... | Return array of slots with slot number as key
@param stdClass[] $slots
@return stdClass[] | [
"Return",
"array",
"of",
"slots",
"with",
"slot",
"number",
"as",
"key"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/repaginate.php#L99-L108 |
217,892 | moodle/moodle | mod/quiz/classes/repaginate.php | repaginate.get_slots_by_slotid | protected function get_slots_by_slotid($slots) {
if (!$slots) {
return array();
}
$newslots = array();
foreach ($slots as $slot) {
$newslots[$slot->id] = $slot;
}
return $newslots;
} | php | protected function get_slots_by_slotid($slots) {
if (!$slots) {
return array();
}
$newslots = array();
foreach ($slots as $slot) {
$newslots[$slot->id] = $slot;
}
return $newslots;
} | [
"protected",
"function",
"get_slots_by_slotid",
"(",
"$",
"slots",
")",
"{",
"if",
"(",
"!",
"$",
"slots",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"newslots",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"slots",
"as",
"$",
"slot... | Return array of slots with slot id as key
@param stdClass[] $slots
@return stdClass[] | [
"Return",
"array",
"of",
"slots",
"with",
"slot",
"id",
"as",
"key"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/repaginate.php#L115-L124 |
217,893 | moodle/moodle | mod/quiz/classes/repaginate.php | repaginate.repaginate_slots | public function repaginate_slots($nextslotnumber, $type) {
global $DB;
$this->slots = $DB->get_records('quiz_slots', array('quizid' => $this->quizid), 'slot');
$nextslot = null;
$newslots = array();
foreach ($this->slots as $slot) {
if ($slot->slot < $nextslotnumber) ... | php | public function repaginate_slots($nextslotnumber, $type) {
global $DB;
$this->slots = $DB->get_records('quiz_slots', array('quizid' => $this->quizid), 'slot');
$nextslot = null;
$newslots = array();
foreach ($this->slots as $slot) {
if ($slot->slot < $nextslotnumber) ... | [
"public",
"function",
"repaginate_slots",
"(",
"$",
"nextslotnumber",
",",
"$",
"type",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"slots",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"'quiz_slots'",
",",
"array",
"(",
"'quizid'",
"=>",
"$",
... | Repaginate, update DB and slots object
@param int $nextslotnumber
@param int $type repaginate::LINK or repaginate::UNLINK. | [
"Repaginate",
"update",
"DB",
"and",
"slots",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/repaginate.php#L131-L153 |
217,894 | moodle/moodle | mod/quiz/classes/repaginate.php | repaginate.repaginate_next_slot | public function repaginate_next_slot($nextslotnumber, $type) {
$currentslotnumber = $nextslotnumber - 1;
if (!($currentslotnumber && $nextslotnumber)) {
return null;
}
$currentslot = $this->get_this_slot($this->slots, $currentslotnumber);
$nextslot = $this->get_this_s... | php | public function repaginate_next_slot($nextslotnumber, $type) {
$currentslotnumber = $nextslotnumber - 1;
if (!($currentslotnumber && $nextslotnumber)) {
return null;
}
$currentslot = $this->get_this_slot($this->slots, $currentslotnumber);
$nextslot = $this->get_this_s... | [
"public",
"function",
"repaginate_next_slot",
"(",
"$",
"nextslotnumber",
",",
"$",
"type",
")",
"{",
"$",
"currentslotnumber",
"=",
"$",
"nextslotnumber",
"-",
"1",
";",
"if",
"(",
"!",
"(",
"$",
"currentslotnumber",
"&&",
"$",
"nextslotnumber",
")",
")",
... | Repaginate next slot and return the modified slot object
@param int $nextslotnumber
@param int $type repaginate::LINK or repaginate::UNLINK.
@return stdClass|null | [
"Repaginate",
"next",
"slot",
"and",
"return",
"the",
"modified",
"slot",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/repaginate.php#L161-L175 |
217,895 | moodle/moodle | mod/quiz/classes/repaginate.php | repaginate.repaginate_n_question_per_page | public function repaginate_n_question_per_page($slots, $number) {
$slots = $this->get_slots_by_slot_number($slots);
$newslots = array();
$count = 0;
$page = 1;
foreach ($slots as $key => $slot) {
for ($page + $count; $page < ($number + $count + 1); $page++) {
... | php | public function repaginate_n_question_per_page($slots, $number) {
$slots = $this->get_slots_by_slot_number($slots);
$newslots = array();
$count = 0;
$page = 1;
foreach ($slots as $key => $slot) {
for ($page + $count; $page < ($number + $count + 1); $page++) {
... | [
"public",
"function",
"repaginate_n_question_per_page",
"(",
"$",
"slots",
",",
"$",
"number",
")",
"{",
"$",
"slots",
"=",
"$",
"this",
"->",
"get_slots_by_slot_number",
"(",
"$",
"slots",
")",
";",
"$",
"newslots",
"=",
"array",
"(",
")",
";",
"$",
"co... | Return the slots with the new pagination, regardless of current pagination.
@param stdClass[] $slots the slots to repaginate.
@param int $number number of question per page
@return stdClass[] the updated slots. | [
"Return",
"the",
"slots",
"with",
"the",
"new",
"pagination",
"regardless",
"of",
"current",
"pagination",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/repaginate.php#L183-L198 |
217,896 | moodle/moodle | mod/quiz/classes/repaginate.php | repaginate.repaginate_the_rest | public function repaginate_the_rest($quizslots, $slotfrom, $type, $dbupdate = true) {
global $DB;
if (!$quizslots) {
return null;
}
$newslots = array();
foreach ($quizslots as $slot) {
if ($type == self::LINK) {
if ($slot->slot <= $slotfrom... | php | public function repaginate_the_rest($quizslots, $slotfrom, $type, $dbupdate = true) {
global $DB;
if (!$quizslots) {
return null;
}
$newslots = array();
foreach ($quizslots as $slot) {
if ($type == self::LINK) {
if ($slot->slot <= $slotfrom... | [
"public",
"function",
"repaginate_the_rest",
"(",
"$",
"quizslots",
",",
"$",
"slotfrom",
",",
"$",
"type",
",",
"$",
"dbupdate",
"=",
"true",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"$",
"quizslots",
")",
"{",
"return",
"null",
";",
"}",... | Repaginate the rest.
@param stdClass[] $quizslots
@param int $slotfrom
@param int $type
@param bool $dbupdate
@return stdClass[] | [
"Repaginate",
"the",
"rest",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/repaginate.php#L208-L233 |
217,897 | moodle/moodle | mod/assign/feedback/comments/classes/privacy/provider.php | provider.delete_feedback_for_grade | public static function delete_feedback_for_grade(assign_plugin_request_data $requestdata) {
global $DB;
$fs = new \file_storage();
$fs->delete_area_files($requestdata->get_context()->id, ASSIGNFEEDBACK_COMMENTS_COMPONENT,
ASSIGNFEEDBACK_COMMENTS_FILEAREA, $requestdata->get_pluginobj... | php | public static function delete_feedback_for_grade(assign_plugin_request_data $requestdata) {
global $DB;
$fs = new \file_storage();
$fs->delete_area_files($requestdata->get_context()->id, ASSIGNFEEDBACK_COMMENTS_COMPONENT,
ASSIGNFEEDBACK_COMMENTS_FILEAREA, $requestdata->get_pluginobj... | [
"public",
"static",
"function",
"delete_feedback_for_grade",
"(",
"assign_plugin_request_data",
"$",
"requestdata",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"fs",
"=",
"new",
"\\",
"file_storage",
"(",
")",
";",
"$",
"fs",
"->",
"delete_area_files",
"(",
"$",
... | Calling this function should delete all user data associated with this grade entry.
@param assign_plugin_request_data $requestdata Data useful for deleting user data. | [
"Calling",
"this",
"function",
"should",
"delete",
"all",
"user",
"data",
"associated",
"with",
"this",
"grade",
"entry",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/comments/classes/privacy/provider.php#L153-L162 |
217,898 | moodle/moodle | lib/portfolio/forms.php | portfolio_export_form.validation | public function validation($data, $files) {
$errors = array();
if (array_key_exists('plugin', $this->_customdata) && is_object($this->_customdata['plugin'])) {
$pluginerrors = $this->_customdata['plugin']->export_config_validation($data);
if (is_array($pluginerrors)) {
... | php | public function validation($data, $files) {
$errors = array();
if (array_key_exists('plugin', $this->_customdata) && is_object($this->_customdata['plugin'])) {
$pluginerrors = $this->_customdata['plugin']->export_config_validation($data);
if (is_array($pluginerrors)) {
... | [
"public",
"function",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"'plugin'",
",",
"$",
"this",
"->",
"_customdata",
")",
"&&",
"is_object",
"(",
"$",
"t... | Validate portfolio export form
@param stdClass $data portfolio information from form data
@return array | [
"Validate",
"portfolio",
"export",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/forms.php#L110-L127 |
217,899 | moodle/moodle | lib/portfolio/forms.php | portfolio_admin_form.validation | public function validation($data, $files) {
global $DB;
$errors = array();
if ($DB->count_records('portfolio_instance', array('name' => $data['name'], 'plugin' => $data['plugin'])) > 1) {
$errors = array('name' => get_string('err_uniquename', 'portfolio'));
}
$plugi... | php | public function validation($data, $files) {
global $DB;
$errors = array();
if ($DB->count_records('portfolio_instance', array('name' => $data['name'], 'plugin' => $data['plugin'])) > 1) {
$errors = array('name' => get_string('err_uniquename', 'portfolio'));
}
$plugi... | [
"public",
"function",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"DB",
"->",
"count_records",
"(",
"'portfolio_instance'",
",",
"array",
"(",
"'na... | Validate admin config form
@param stdObject $data form data
@return array | [
"Validate",
"admin",
"config",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/forms.php#L229-L243 |
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.