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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
212,700 | moodle/moodle | enrol/locallib.php | course_enrolment_manager.remove_user_from_group | public function remove_user_from_group($user, $groupid) {
global $DB;
require_capability('moodle/course:managegroups', $this->context);
$group = $this->get_group($groupid);
if (!groups_remove_member_allowed($group, $user)) {
return false;
}
if (!$group) {
... | php | public function remove_user_from_group($user, $groupid) {
global $DB;
require_capability('moodle/course:managegroups', $this->context);
$group = $this->get_group($groupid);
if (!groups_remove_member_allowed($group, $user)) {
return false;
}
if (!$group) {
... | [
"public",
"function",
"remove_user_from_group",
"(",
"$",
"user",
",",
"$",
"groupid",
")",
"{",
"global",
"$",
"DB",
";",
"require_capability",
"(",
"'moodle/course:managegroups'",
",",
"$",
"this",
"->",
"context",
")",
";",
"$",
"group",
"=",
"$",
"this",... | Removes a user from a group
@global moodle_database $DB
@param StdClass $user
@param int $groupid
@return bool | [
"Removes",
"a",
"user",
"from",
"a",
"group"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L826-L837 |
212,701 | moodle/moodle | enrol/locallib.php | course_enrolment_manager.get_group | public function get_group($groupid) {
$groups = $this->get_all_groups();
if (!array_key_exists($groupid, $groups)) {
return false;
}
return $groups[$groupid];
} | php | public function get_group($groupid) {
$groups = $this->get_all_groups();
if (!array_key_exists($groupid, $groups)) {
return false;
}
return $groups[$groupid];
} | [
"public",
"function",
"get_group",
"(",
"$",
"groupid",
")",
"{",
"$",
"groups",
"=",
"$",
"this",
"->",
"get_all_groups",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"groupid",
",",
"$",
"groups",
")",
")",
"{",
"return",
"false",
"... | Gets the requested group
@param int $groupid
@return stdClass|int | [
"Gets",
"the",
"requested",
"group"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L845-L851 |
212,702 | moodle/moodle | enrol/locallib.php | course_enrolment_manager.edit_enrolment | public function edit_enrolment($userenrolment, $data) {
//Only allow editing if the user has the appropriate capability
//Already checked in /user/index.php but checking again in case this function is called from elsewhere
list($instance, $plugin) = $this->get_user_enrolment_components($userenro... | php | public function edit_enrolment($userenrolment, $data) {
//Only allow editing if the user has the appropriate capability
//Already checked in /user/index.php but checking again in case this function is called from elsewhere
list($instance, $plugin) = $this->get_user_enrolment_components($userenro... | [
"public",
"function",
"edit_enrolment",
"(",
"$",
"userenrolment",
",",
"$",
"data",
")",
"{",
"//Only allow editing if the user has the appropriate capability",
"//Already checked in /user/index.php but checking again in case this function is called from elsewhere",
"list",
"(",
"$",
... | Edits an enrolment
@param stdClass $userenrolment
@param stdClass $data
@return bool | [
"Edits",
"an",
"enrolment"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L860-L872 |
212,703 | moodle/moodle | enrol/locallib.php | course_enrolment_manager.get_user_roles | public function get_user_roles($userid) {
$roles = array();
$ras = get_user_roles($this->context, $userid, true, 'c.contextlevel DESC, r.sortorder ASC');
$plugins = $this->get_enrolment_plugins(false);
foreach ($ras as $ra) {
if ($ra->contextid != $this->context->id) {
... | php | public function get_user_roles($userid) {
$roles = array();
$ras = get_user_roles($this->context, $userid, true, 'c.contextlevel DESC, r.sortorder ASC');
$plugins = $this->get_enrolment_plugins(false);
foreach ($ras as $ra) {
if ($ra->contextid != $this->context->id) {
... | [
"public",
"function",
"get_user_roles",
"(",
"$",
"userid",
")",
"{",
"$",
"roles",
"=",
"array",
"(",
")",
";",
"$",
"ras",
"=",
"get_user_roles",
"(",
"$",
"this",
"->",
"context",
",",
"$",
"userid",
",",
"true",
",",
"'c.contextlevel DESC, r.sortorder ... | Gets the roles assigned to this user that are applicable for this course.
@param int $userid
@return array | [
"Gets",
"the",
"roles",
"assigned",
"to",
"this",
"user",
"that",
"are",
"applicable",
"for",
"this",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L888-L917 |
212,704 | moodle/moodle | enrol/locallib.php | course_enrolment_manager.get_user_enrolments | public function get_user_enrolments($userid) {
global $DB;
list($instancessql, $params, $filter) = $this->get_instance_sql();
$params['userid'] = $userid;
$userenrolments = $DB->get_records_select('user_enrolments', "enrolid $instancessql AND userid = :userid", $params);
$instanc... | php | public function get_user_enrolments($userid) {
global $DB;
list($instancessql, $params, $filter) = $this->get_instance_sql();
$params['userid'] = $userid;
$userenrolments = $DB->get_records_select('user_enrolments', "enrolid $instancessql AND userid = :userid", $params);
$instanc... | [
"public",
"function",
"get_user_enrolments",
"(",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"instancessql",
",",
"$",
"params",
",",
"$",
"filter",
")",
"=",
"$",
"this",
"->",
"get_instance_sql",
"(",
")",
";",
"$",
"params"... | Gets the enrolments this user has in the course - including all suspended plugins and instances.
@global moodle_database $DB
@param int $userid
@return array | [
"Gets",
"the",
"enrolments",
"this",
"user",
"has",
"in",
"the",
"course",
"-",
"including",
"all",
"suspended",
"plugins",
"and",
"instances",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L926-L940 |
212,705 | moodle/moodle | enrol/locallib.php | course_enrolment_manager.get_url_params | public function get_url_params() {
$args = array(
'id' => $this->course->id
);
if (!empty($this->instancefilter)) {
$args['ifilter'] = $this->instancefilter;
}
if (!empty($this->rolefilter)) {
$args['role'] = $this->rolefilter;
}
... | php | public function get_url_params() {
$args = array(
'id' => $this->course->id
);
if (!empty($this->instancefilter)) {
$args['ifilter'] = $this->instancefilter;
}
if (!empty($this->rolefilter)) {
$args['role'] = $this->rolefilter;
}
... | [
"public",
"function",
"get_url_params",
"(",
")",
"{",
"$",
"args",
"=",
"array",
"(",
"'id'",
"=>",
"$",
"this",
"->",
"course",
"->",
"id",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"instancefilter",
")",
")",
"{",
"$",
"args",
... | Retursn an array of params that would go into the URL to return to this
exact page.
@return array | [
"Retursn",
"an",
"array",
"of",
"params",
"that",
"would",
"go",
"into",
"the",
"URL",
"to",
"return",
"to",
"this",
"exact",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L958-L978 |
212,706 | moodle/moodle | enrol/locallib.php | course_enrolment_manager.get_other_users_for_display | public function get_other_users_for_display(core_enrol_renderer $renderer, moodle_url $pageurl, $sort, $direction, $page, $perpage) {
$userroles = $this->get_other_users($sort, $direction, $page, $perpage);
$roles = $this->get_all_roles();
$plugins = $this->get_enrolment_plugins(false);
... | php | public function get_other_users_for_display(core_enrol_renderer $renderer, moodle_url $pageurl, $sort, $direction, $page, $perpage) {
$userroles = $this->get_other_users($sort, $direction, $page, $perpage);
$roles = $this->get_all_roles();
$plugins = $this->get_enrolment_plugins(false);
... | [
"public",
"function",
"get_other_users_for_display",
"(",
"core_enrol_renderer",
"$",
"renderer",
",",
"moodle_url",
"$",
"pageurl",
",",
"$",
"sort",
",",
"$",
"direction",
",",
"$",
"page",
",",
"$",
"perpage",
")",
"{",
"$",
"userroles",
"=",
"$",
"this",... | Gets an array of other users in this course ready for display.
Other users are users who have been assigned or inherited roles within this
course but have not been enrolled.
@param core_enrol_renderer $renderer
@param moodle_url $pageurl
@param string $sort
@param string $direction ASC | DESC
@param int $page Startin... | [
"Gets",
"an",
"array",
"of",
"other",
"users",
"in",
"this",
"course",
"ready",
"for",
"display",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L1012-L1068 |
212,707 | moodle/moodle | enrol/locallib.php | course_enrolment_manager.prepare_user_for_display | private function prepare_user_for_display($user, $extrafields, $now) {
$details = array(
'userid' => $user->id,
'courseid' => $this->get_course()->id,
'picture' => new user_picture($user),
'userfullnamedisplay' => fullname($user... | php | private function prepare_user_for_display($user, $extrafields, $now) {
$details = array(
'userid' => $user->id,
'courseid' => $this->get_course()->id,
'picture' => new user_picture($user),
'userfullnamedisplay' => fullname($user... | [
"private",
"function",
"prepare_user_for_display",
"(",
"$",
"user",
",",
"$",
"extrafields",
",",
"$",
"now",
")",
"{",
"$",
"details",
"=",
"array",
"(",
"'userid'",
"=>",
"$",
"user",
"->",
"id",
",",
"'courseid'",
"=>",
"$",
"this",
"->",
"get_course... | Prepare a user record for display
This function is called by both {@link get_users_for_display} and {@link get_other_users_for_display} to correctly
prepare user fields for display
Please note that this function does not check capability for moodle/coures:viewhiddenuserfields
@param object $user The user record
@par... | [
"Prepare",
"a",
"user",
"record",
"for",
"display"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L1183-L1207 |
212,708 | moodle/moodle | enrol/locallib.php | course_enrolment_manager.get_filtered_enrolment_plugin | public function get_filtered_enrolment_plugin() {
$instances = $this->get_enrolment_instances();
$plugins = $this->get_enrolment_plugins(false);
if (empty($this->instancefilter) || !array_key_exists($this->instancefilter, $instances)) {
return false;
}
$instance = $... | php | public function get_filtered_enrolment_plugin() {
$instances = $this->get_enrolment_instances();
$plugins = $this->get_enrolment_plugins(false);
if (empty($this->instancefilter) || !array_key_exists($this->instancefilter, $instances)) {
return false;
}
$instance = $... | [
"public",
"function",
"get_filtered_enrolment_plugin",
"(",
")",
"{",
"$",
"instances",
"=",
"$",
"this",
"->",
"get_enrolment_instances",
"(",
")",
";",
"$",
"plugins",
"=",
"$",
"this",
"->",
"get_enrolment_plugins",
"(",
"false",
")",
";",
"if",
"(",
"emp... | Returns the enrolment plugin that the course manager was being filtered to.
If no filter was being applied then this function returns false.
@return enrol_plugin | [
"Returns",
"the",
"enrolment",
"plugin",
"that",
"the",
"course",
"manager",
"was",
"being",
"filtered",
"to",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L1240-L1250 |
212,709 | moodle/moodle | enrol/locallib.php | course_enrolment_manager.get_users_enrolments | public function get_users_enrolments(array $userids) {
global $DB;
$instances = $this->get_enrolment_instances();
$plugins = $this->get_enrolment_plugins(false);
if (!empty($this->instancefilter)) {
$instancesql = ' = :instanceid';
$instanceparams = array('inst... | php | public function get_users_enrolments(array $userids) {
global $DB;
$instances = $this->get_enrolment_instances();
$plugins = $this->get_enrolment_plugins(false);
if (!empty($this->instancefilter)) {
$instancesql = ' = :instanceid';
$instanceparams = array('inst... | [
"public",
"function",
"get_users_enrolments",
"(",
"array",
"$",
"userids",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"instances",
"=",
"$",
"this",
"->",
"get_enrolment_instances",
"(",
")",
";",
"$",
"plugins",
"=",
"$",
"this",
"->",
"get_enrolment_plugins... | Returns and array of users + enrolment details.
Given an array of user id's this function returns and array of user enrolments for those users
as well as enough user information to display the users name and picture for each enrolment.
@global moodle_database $DB
@param array $userids
@return array | [
"Returns",
"and",
"array",
"of",
"users",
"+",
"enrolment",
"details",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L1262-L1303 |
212,710 | moodle/moodle | enrol/locallib.php | enrol_user_button.require_yui_module | public function require_yui_module($modules, $function, array $arguments = null, $galleryversion = null, $ondomready = false) {
if ($galleryversion != null) {
debugging('The galleryversion parameter to yui_module has been deprecated since Moodle 2.3.', DEBUG_DEVELOPER);
}
$js = new ... | php | public function require_yui_module($modules, $function, array $arguments = null, $galleryversion = null, $ondomready = false) {
if ($galleryversion != null) {
debugging('The galleryversion parameter to yui_module has been deprecated since Moodle 2.3.', DEBUG_DEVELOPER);
}
$js = new ... | [
"public",
"function",
"require_yui_module",
"(",
"$",
"modules",
",",
"$",
"function",
",",
"array",
"$",
"arguments",
"=",
"null",
",",
"$",
"galleryversion",
"=",
"null",
",",
"$",
"ondomready",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"galleryversion",
... | Adds a YUI module call that will be added to the page when the button is used.
@param string|array $modules One or more modules to require
@param string $function The JS function to call
@param array $arguments An array of arguments to pass to the function
@param string $galleryversion Deprecated: The gallery version ... | [
"Adds",
"a",
"YUI",
"module",
"call",
"that",
"will",
"be",
"added",
"to",
"the",
"page",
"when",
"the",
"button",
"is",
"used",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L1357-L1368 |
212,711 | moodle/moodle | enrol/locallib.php | enrol_user_button.require_js_init_call | public function require_js_init_call($function, array $extraarguments = null, $ondomready = false, array $module = null) {
$js = new stdClass;
$js->function = $function;
$js->extraarguments = $extraarguments;
$js->ondomready = $ondomready;
$js->module = $module;
$this->js... | php | public function require_js_init_call($function, array $extraarguments = null, $ondomready = false, array $module = null) {
$js = new stdClass;
$js->function = $function;
$js->extraarguments = $extraarguments;
$js->ondomready = $ondomready;
$js->module = $module;
$this->js... | [
"public",
"function",
"require_js_init_call",
"(",
"$",
"function",
",",
"array",
"$",
"extraarguments",
"=",
"null",
",",
"$",
"ondomready",
"=",
"false",
",",
"array",
"$",
"module",
"=",
"null",
")",
"{",
"$",
"js",
"=",
"new",
"stdClass",
";",
"$",
... | Adds a JS initialisation call to the page when the button is used.
@param string $function The function to call
@param array $extraarguments An array of arguments to pass to the function
@param bool $ondomready If true the call is postponed until the DOM is finished loading
@param array $module A module definition | [
"Adds",
"a",
"JS",
"initialisation",
"call",
"to",
"the",
"page",
"when",
"the",
"button",
"is",
"used",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L1378-L1385 |
212,712 | moodle/moodle | enrol/locallib.php | enrol_user_button.strings_for_js | public function strings_for_js($identifiers, $component = 'moodle', $a = null) {
$string = new stdClass;
$string->identifiers = (array)$identifiers;
$string->component = $component;
$string->a = $a;
$this->jsstrings[] = $string;
} | php | public function strings_for_js($identifiers, $component = 'moodle', $a = null) {
$string = new stdClass;
$string->identifiers = (array)$identifiers;
$string->component = $component;
$string->a = $a;
$this->jsstrings[] = $string;
} | [
"public",
"function",
"strings_for_js",
"(",
"$",
"identifiers",
",",
"$",
"component",
"=",
"'moodle'",
",",
"$",
"a",
"=",
"null",
")",
"{",
"$",
"string",
"=",
"new",
"stdClass",
";",
"$",
"string",
"->",
"identifiers",
"=",
"(",
"array",
")",
"$",
... | Requires strings for JS that will be loaded when the button is used.
@param type $identifiers
@param string $component
@param mixed $a | [
"Requires",
"strings",
"for",
"JS",
"that",
"will",
"be",
"loaded",
"when",
"the",
"button",
"is",
"used",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L1394-L1400 |
212,713 | moodle/moodle | enrol/locallib.php | enrol_user_button.initialise_js | public function initialise_js(moodle_page $page) {
foreach ($this->jsyuimodules as $js) {
$page->requires->yui_module($js->modules, $js->function, $js->arguments, null, $js->ondomready);
}
foreach ($this->jsinitcalls as $js) {
$page->requires->js_init_call($js->function, ... | php | public function initialise_js(moodle_page $page) {
foreach ($this->jsyuimodules as $js) {
$page->requires->yui_module($js->modules, $js->function, $js->arguments, null, $js->ondomready);
}
foreach ($this->jsinitcalls as $js) {
$page->requires->js_init_call($js->function, ... | [
"public",
"function",
"initialise_js",
"(",
"moodle_page",
"$",
"page",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"jsyuimodules",
"as",
"$",
"js",
")",
"{",
"$",
"page",
"->",
"requires",
"->",
"yui_module",
"(",
"$",
"js",
"->",
"modules",
",",
"$"... | Initialises the JS that is required by this button
@param moodle_page $page | [
"Initialises",
"the",
"JS",
"that",
"is",
"required",
"by",
"this",
"button"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/locallib.php#L1407-L1417 |
212,714 | moodle/moodle | grade/grading/form/rubric/edit_form.php | gradingform_rubric_editrubric.need_confirm_regrading | public function need_confirm_regrading($controller) {
$data = $this->get_data();
if (isset($data->rubric['regrade'])) {
// we have already displayed the confirmation on the previous step
return false;
}
if (!isset($data->saverubric) || !$data->saverubric) {
... | php | public function need_confirm_regrading($controller) {
$data = $this->get_data();
if (isset($data->rubric['regrade'])) {
// we have already displayed the confirmation on the previous step
return false;
}
if (!isset($data->saverubric) || !$data->saverubric) {
... | [
"public",
"function",
"need_confirm_regrading",
"(",
"$",
"controller",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"get_data",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"->",
"rubric",
"[",
"'regrade'",
"]",
")",
")",
"{",
"// we have al... | Check if there are changes in the rubric and it is needed to ask user whether to
mark the current grades for re-grading. User may confirm re-grading and continue,
return to editing or cancel the changes
@param gradingform_rubric_controller $controller | [
"Check",
"if",
"there",
"are",
"changes",
"in",
"the",
"rubric",
"and",
"it",
"is",
"needed",
"to",
"ask",
"user",
"whether",
"to",
"mark",
"the",
"current",
"grades",
"for",
"re",
"-",
"grading",
".",
"User",
"may",
"confirm",
"re",
"-",
"grading",
"a... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/rubric/edit_form.php#L159-L198 |
212,715 | moodle/moodle | blocks/community/locallib.php | block_community_manager.block_community_add_course | public function block_community_add_course($course, $userid) {
global $DB;
$community = $this->block_community_get_course($course->url, $userid);
if (empty($community)) {
$community = new stdClass();
$community->userid = $userid;
$community->coursename = $co... | php | public function block_community_add_course($course, $userid) {
global $DB;
$community = $this->block_community_get_course($course->url, $userid);
if (empty($community)) {
$community = new stdClass();
$community->userid = $userid;
$community->coursename = $co... | [
"public",
"function",
"block_community_add_course",
"(",
"$",
"course",
",",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"community",
"=",
"$",
"this",
"->",
"block_community_get_course",
"(",
"$",
"course",
"->",
"url",
",",
"$",
"userid",
")"... | Add a community course
@param object $course
@param integer $userid
@return id of course or false if already added | [
"Add",
"a",
"community",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/community/locallib.php#L36-L52 |
212,716 | moodle/moodle | theme/boost/classes/autoprefixer.php | autoprefixer.manipulateRuleValues | protected function manipulateRuleValues(array $rules) {
$finalrules = [];
foreach ($rules as $rule) {
$property = $rule->getRule();
$value = $rule->getValue();
if ($property === 'position' && $value === 'sticky') {
$newrule = clone $rule;
... | php | protected function manipulateRuleValues(array $rules) {
$finalrules = [];
foreach ($rules as $rule) {
$property = $rule->getRule();
$value = $rule->getValue();
if ($property === 'position' && $value === 'sticky') {
$newrule = clone $rule;
... | [
"protected",
"function",
"manipulateRuleValues",
"(",
"array",
"$",
"rules",
")",
"{",
"$",
"finalrules",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"rules",
"as",
"$",
"rule",
")",
"{",
"$",
"property",
"=",
"$",
"rule",
"->",
"getRule",
"(",
")",
";"... | Manipulate an array of rules to adapt their values.
@param array $rules The rules.
@return New array of rules. | [
"Manipulate",
"an",
"array",
"of",
"rules",
"to",
"adapt",
"their",
"values",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/theme/boost/classes/autoprefixer.php#L121-L150 |
212,717 | moodle/moodle | theme/boost/classes/autoprefixer.php | autoprefixer.processBlock | protected function processBlock($block) {
foreach ($block->getContents() as $node) {
if ($node instanceof AtRule) {
$name = $node->atRuleName();
if (isset(self::$atrules[$name])) {
foreach (self::$atrules[$name] as $prefix) {
... | php | protected function processBlock($block) {
foreach ($block->getContents() as $node) {
if ($node instanceof AtRule) {
$name = $node->atRuleName();
if (isset(self::$atrules[$name])) {
foreach (self::$atrules[$name] as $prefix) {
... | [
"protected",
"function",
"processBlock",
"(",
"$",
"block",
")",
"{",
"foreach",
"(",
"$",
"block",
"->",
"getContents",
"(",
")",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"AtRule",
")",
"{",
"$",
"name",
"=",
"$",
"node",
... | Process block.
@param object $block A block.
@param object $parent The parent of the block. | [
"Process",
"block",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/theme/boost/classes/autoprefixer.php#L165-L193 |
212,718 | moodle/moodle | theme/boost/classes/autoprefixer.php | autoprefixer.processDeclaration | protected function processDeclaration($node, $parent) {
$rules = [];
foreach ($node->getRules() as $key => $rule) {
$name = $rule->getRule();
$seen[$name] = true;
if (!isset(self::$rules[$name])) {
$rules[] = $rule;
continue;
... | php | protected function processDeclaration($node, $parent) {
$rules = [];
foreach ($node->getRules() as $key => $rule) {
$name = $rule->getRule();
$seen[$name] = true;
if (!isset(self::$rules[$name])) {
$rules[] = $rule;
continue;
... | [
"protected",
"function",
"processDeclaration",
"(",
"$",
"node",
",",
"$",
"parent",
")",
"{",
"$",
"rules",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"node",
"->",
"getRules",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"rule",
")",
"{",
"$",
"name",
... | Process declaration.
@param object $node The declaration block.
@param object $parent The parent. | [
"Process",
"declaration",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/theme/boost/classes/autoprefixer.php#L201-L249 |
212,719 | moodle/moodle | enrol/renderer.php | core_enrol_renderer.render_enrol_user_button | protected function render_enrol_user_button(enrol_user_button $button) {
$attributes = array('type' => 'submit',
'value' => $button->label,
'disabled' => $button->disabled ? 'disabled' : null,
'title' => $button->toolt... | php | protected function render_enrol_user_button(enrol_user_button $button) {
$attributes = array('type' => 'submit',
'value' => $button->label,
'disabled' => $button->disabled ? 'disabled' : null,
'title' => $button->toolt... | [
"protected",
"function",
"render_enrol_user_button",
"(",
"enrol_user_button",
"$",
"button",
")",
"{",
"$",
"attributes",
"=",
"array",
"(",
"'type'",
"=>",
"'submit'",
",",
"'value'",
"=>",
"$",
"button",
"->",
"label",
",",
"'disabled'",
"=>",
"$",
"button"... | Renderers the enrol_user_button.
@param enrol_user_button $button
@return string XHTML | [
"Renderers",
"the",
"enrol_user_button",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L39-L86 |
212,720 | moodle/moodle | enrol/renderer.php | core_enrol_renderer.render_course_enrolment_other_users_table | protected function render_course_enrolment_other_users_table(course_enrolment_other_users_table $table) {
$table->initialise_javascript();
$content = '';
$searchbutton = $table->get_user_search_button();
if ($searchbutton) {
$content .= $this->output->render($searchbutton);... | php | protected function render_course_enrolment_other_users_table(course_enrolment_other_users_table $table) {
$table->initialise_javascript();
$content = '';
$searchbutton = $table->get_user_search_button();
if ($searchbutton) {
$content .= $this->output->render($searchbutton);... | [
"protected",
"function",
"render_course_enrolment_other_users_table",
"(",
"course_enrolment_other_users_table",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"initialise_javascript",
"(",
")",
";",
"$",
"content",
"=",
"''",
";",
"$",
"searchbutton",
"=",
"$",
"table... | Renders a course enrolment table
@param course_enrolment_table $table
@return string | [
"Renders",
"a",
"course",
"enrolment",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L94-L112 |
212,721 | moodle/moodle | enrol/renderer.php | core_enrol_renderer.user_roles_and_actions | public function user_roles_and_actions($userid, $roles, $assignableroles, $canassign, $pageurl) {
// Get list of roles.
$rolesoutput = '';
foreach ($roles as $roleid=>$role) {
if ($canassign and (is_siteadmin() or isset($assignableroles[$roleid])) and !$role['unchangeable']) {
... | php | public function user_roles_and_actions($userid, $roles, $assignableroles, $canassign, $pageurl) {
// Get list of roles.
$rolesoutput = '';
foreach ($roles as $roleid=>$role) {
if ($canassign and (is_siteadmin() or isset($assignableroles[$roleid])) and !$role['unchangeable']) {
... | [
"public",
"function",
"user_roles_and_actions",
"(",
"$",
"userid",
",",
"$",
"roles",
",",
"$",
"assignableroles",
",",
"$",
"canassign",
",",
"$",
"pageurl",
")",
"{",
"// Get list of roles.",
"$",
"rolesoutput",
"=",
"''",
";",
"foreach",
"(",
"$",
"roles... | Generates HTML to display the users roles and any available actions
@param int $userid
@param array $roles
@param array $assignableroles
@param moodle_url $pageurl
@return string | [
"Generates",
"HTML",
"to",
"display",
"the",
"users",
"roles",
"and",
"any",
"available",
"actions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L123-L156 |
212,722 | moodle/moodle | enrol/renderer.php | core_enrol_renderer.user_groups_and_actions | public function user_groups_and_actions($userid, $groups, $allgroups, $canmanagegroups, $pageurl) {
$groupicon = $this->output->pix_icon('i/group', get_string('addgroup', 'group'));
$groupoutput = '';
foreach($groups as $groupid=>$name) {
if ($canmanagegroups and groups_remove_membe... | php | public function user_groups_and_actions($userid, $groups, $allgroups, $canmanagegroups, $pageurl) {
$groupicon = $this->output->pix_icon('i/group', get_string('addgroup', 'group'));
$groupoutput = '';
foreach($groups as $groupid=>$name) {
if ($canmanagegroups and groups_remove_membe... | [
"public",
"function",
"user_groups_and_actions",
"(",
"$",
"userid",
",",
"$",
"groups",
",",
"$",
"allgroups",
",",
"$",
"canmanagegroups",
",",
"$",
"pageurl",
")",
"{",
"$",
"groupicon",
"=",
"$",
"this",
"->",
"output",
"->",
"pix_icon",
"(",
"'i/group... | Generates the HTML to view the users groups and available group actions
@param int $userid
@param array $groups
@param array $allgroups
@param bool $canmanagegroups
@param moodle_url $pageurl
@return string | [
"Generates",
"the",
"HTML",
"to",
"view",
"the",
"users",
"groups",
"and",
"available",
"group",
"actions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L168-L188 |
212,723 | moodle/moodle | enrol/renderer.php | core_enrol_renderer.user_enrolments_and_actions | public function user_enrolments_and_actions($enrolments) {
$output = '';
foreach ($enrolments as $ue) {
$enrolmentoutput = $ue['text'].' '.$ue['period'];
if ($ue['dimmed']) {
$enrolmentoutput = html_writer::tag('span', $enrolmentoutput, array('class'=>'dimmed_text... | php | public function user_enrolments_and_actions($enrolments) {
$output = '';
foreach ($enrolments as $ue) {
$enrolmentoutput = $ue['text'].' '.$ue['period'];
if ($ue['dimmed']) {
$enrolmentoutput = html_writer::tag('span', $enrolmentoutput, array('class'=>'dimmed_text... | [
"public",
"function",
"user_enrolments_and_actions",
"(",
"$",
"enrolments",
")",
"{",
"$",
"output",
"=",
"''",
";",
"foreach",
"(",
"$",
"enrolments",
"as",
"$",
"ue",
")",
"{",
"$",
"enrolmentoutput",
"=",
"$",
"ue",
"[",
"'text'",
"]",
".",
"' '",
... | Generates the HTML for the given enrolments + available actions
@param int $userid
@param array $enrolments
@param moodle_url $pageurl
@return string | [
"Generates",
"the",
"HTML",
"for",
"the",
"given",
"enrolments",
"+",
"available",
"actions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L198-L213 |
212,724 | moodle/moodle | enrol/renderer.php | core_enrol_renderer.render_user_enrolment_action | protected function render_user_enrolment_action(user_enrolment_action $icon) {
return html_writer::link($icon->get_url(), $this->output->render($icon->get_icon()), $icon->get_attributes());
} | php | protected function render_user_enrolment_action(user_enrolment_action $icon) {
return html_writer::link($icon->get_url(), $this->output->render($icon->get_icon()), $icon->get_attributes());
} | [
"protected",
"function",
"render_user_enrolment_action",
"(",
"user_enrolment_action",
"$",
"icon",
")",
"{",
"return",
"html_writer",
"::",
"link",
"(",
"$",
"icon",
"->",
"get_url",
"(",
")",
",",
"$",
"this",
"->",
"output",
"->",
"render",
"(",
"$",
"ico... | Renders a user enrolment action
@param user_enrolment_action $icon
@return string | [
"Renders",
"a",
"user",
"enrolment",
"action"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L220-L222 |
212,725 | moodle/moodle | enrol/renderer.php | course_enrolment_table.set_fields | public function set_fields($fields, $output) {
$this->fields = $fields;
$this->head = array();
$this->colclasses = array();
$this->align = array();
$url = $this->manager->get_moodlepage()->url;
if (!empty($this->bulkoperations)) {
// If there are bulk operati... | php | public function set_fields($fields, $output) {
$this->fields = $fields;
$this->head = array();
$this->colclasses = array();
$this->align = array();
$url = $this->manager->get_moodlepage()->url;
if (!empty($this->bulkoperations)) {
// If there are bulk operati... | [
"public",
"function",
"set_fields",
"(",
"$",
"fields",
",",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"fields",
"=",
"$",
"fields",
";",
"$",
"this",
"->",
"head",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"colclasses",
"=",
"array",
"(",
... | Sets the fields for this table. These get added to the tables head as well.
You can also use a multi dimensional array for this to have multiple fields
in a single column
@param array $fields An array of fields to set
@param string $output | [
"Sets",
"the",
"fields",
"for",
"this",
"table",
".",
"These",
"get",
"added",
"to",
"the",
"tables",
"head",
"as",
"well",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L425-L473 |
212,726 | moodle/moodle | enrol/renderer.php | course_enrolment_table.set_total_users | public function set_total_users($totalusers) {
$this->totalusers = $totalusers;
$this->pages = ceil($this->totalusers / $this->perpage);
if ($this->page > $this->pages) {
$this->page = $this->pages;
}
} | php | public function set_total_users($totalusers) {
$this->totalusers = $totalusers;
$this->pages = ceil($this->totalusers / $this->perpage);
if ($this->page > $this->pages) {
$this->page = $this->pages;
}
} | [
"public",
"function",
"set_total_users",
"(",
"$",
"totalusers",
")",
"{",
"$",
"this",
"->",
"totalusers",
"=",
"$",
"totalusers",
";",
"$",
"this",
"->",
"pages",
"=",
"ceil",
"(",
"$",
"this",
"->",
"totalusers",
"/",
"$",
"this",
"->",
"perpage",
"... | Sets the total number of users
@param int $totalusers | [
"Sets",
"the",
"total",
"number",
"of",
"users"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L479-L485 |
212,727 | moodle/moodle | enrol/renderer.php | course_enrolment_table.set_users | public function set_users(array $users) {
$this->users = $users;
$hasbulkops = !empty($this->bulkoperations);
foreach ($users as $userid=>$user) {
$user = (array)$user;
$row = new html_table_row();
$row->attributes = array('class' => 'userinforow');
... | php | public function set_users(array $users) {
$this->users = $users;
$hasbulkops = !empty($this->bulkoperations);
foreach ($users as $userid=>$user) {
$user = (array)$user;
$row = new html_table_row();
$row->attributes = array('class' => 'userinforow');
... | [
"public",
"function",
"set_users",
"(",
"array",
"$",
"users",
")",
"{",
"$",
"this",
"->",
"users",
"=",
"$",
"users",
";",
"$",
"hasbulkops",
"=",
"!",
"empty",
"(",
"$",
"this",
"->",
"bulkoperations",
")",
";",
"foreach",
"(",
"$",
"users",
"as",... | Sets the users for this table
@param array $users
@return void | [
"Sets",
"the",
"users",
"for",
"this",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L492-L527 |
212,728 | moodle/moodle | enrol/renderer.php | course_enrolment_table.get_paging_bar | public function get_paging_bar() {
if ($this->pagingbar == null) {
$this->pagingbar = new paging_bar($this->totalusers, $this->page, $this->perpage, $this->manager->get_moodlepage()->url, self::PAGEVAR);
}
return $this->pagingbar;
} | php | public function get_paging_bar() {
if ($this->pagingbar == null) {
$this->pagingbar = new paging_bar($this->totalusers, $this->page, $this->perpage, $this->manager->get_moodlepage()->url, self::PAGEVAR);
}
return $this->pagingbar;
} | [
"public",
"function",
"get_paging_bar",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"pagingbar",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"pagingbar",
"=",
"new",
"paging_bar",
"(",
"$",
"this",
"->",
"totalusers",
",",
"$",
"this",
"->",
"page",
... | Gets the paging bar instance for this table
@return paging_bar | [
"Gets",
"the",
"paging",
"bar",
"instance",
"for",
"this",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L554-L559 |
212,729 | moodle/moodle | enrol/renderer.php | course_enrolment_table.get_direction_icon | protected function get_direction_icon($output, $field) {
$direction = self::DEFAULTSORTDIRECTION;
if ($this->sort == $field) {
$direction = $this->sortdirection;
}
if ($direction === 'ASC') {
return $output->pix_icon('t/sort_asc', get_string('sort'));
} el... | php | protected function get_direction_icon($output, $field) {
$direction = self::DEFAULTSORTDIRECTION;
if ($this->sort == $field) {
$direction = $this->sortdirection;
}
if ($direction === 'ASC') {
return $output->pix_icon('t/sort_asc', get_string('sort'));
} el... | [
"protected",
"function",
"get_direction_icon",
"(",
"$",
"output",
",",
"$",
"field",
")",
"{",
"$",
"direction",
"=",
"self",
"::",
"DEFAULTSORTDIRECTION",
";",
"if",
"(",
"$",
"this",
"->",
"sort",
"==",
"$",
"field",
")",
"{",
"$",
"direction",
"=",
... | Gets the direction icon for the sortable field within this table
@param core_renderer $output
@param string $field
@return string | [
"Gets",
"the",
"direction",
"icon",
"for",
"the",
"sortable",
"field",
"within",
"this",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L568-L578 |
212,730 | moodle/moodle | enrol/renderer.php | course_enrolment_table.get_url_params | public function get_url_params() {
return array(
self::PAGEVAR => $this->page,
self::PERPAGEVAR => $this->perpage,
self::SORTVAR => $this->sort,
self::SORTDIRECTIONVAR => $this->sortdirection
);
} | php | public function get_url_params() {
return array(
self::PAGEVAR => $this->page,
self::PERPAGEVAR => $this->perpage,
self::SORTVAR => $this->sort,
self::SORTDIRECTIONVAR => $this->sortdirection
);
} | [
"public",
"function",
"get_url_params",
"(",
")",
"{",
"return",
"array",
"(",
"self",
"::",
"PAGEVAR",
"=>",
"$",
"this",
"->",
"page",
",",
"self",
"::",
"PERPAGEVAR",
"=>",
"$",
"this",
"->",
"perpage",
",",
"self",
"::",
"SORTVAR",
"=>",
"$",
"this... | Gets the params that will need to be added to the url in order to return to this page.
@return array | [
"Gets",
"the",
"params",
"that",
"will",
"need",
"to",
"be",
"added",
"to",
"the",
"url",
"in",
"order",
"to",
"return",
"to",
"this",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L585-L592 |
212,731 | moodle/moodle | enrol/renderer.php | course_enrolment_other_users_table.get_user_search_button | public function get_user_search_button() {
static $count = 0;
if (!has_capability('moodle/role:assign', $this->manager->get_context())) {
return false;
}
$count++;
$url = new moodle_url('/admin/roles/assign.php', array('contextid'=>$this->manager->get_context()->id, '... | php | public function get_user_search_button() {
static $count = 0;
if (!has_capability('moodle/role:assign', $this->manager->get_context())) {
return false;
}
$count++;
$url = new moodle_url('/admin/roles/assign.php', array('contextid'=>$this->manager->get_context()->id, '... | [
"public",
"function",
"get_user_search_button",
"(",
")",
"{",
"static",
"$",
"count",
"=",
"0",
";",
"if",
"(",
"!",
"has_capability",
"(",
"'moodle/role:assign'",
",",
"$",
"this",
"->",
"manager",
"->",
"get_context",
"(",
")",
")",
")",
"{",
"return",
... | Gets a button to search users and assign them roles in the course.
@staticvar int $count
@param int $page
@return single_button | [
"Gets",
"a",
"button",
"to",
"search",
"users",
"and",
"assign",
"them",
"roles",
"in",
"the",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/renderer.php#L671-L710 |
212,732 | moodle/moodle | backup/cc/validator.php | cc_validate_type.validate | public function validate($element) {
$this->last_error = null;
$celement = realpath($element);
$cvalidator = realpath($this->location.DIRECTORY_SEPARATOR.$this->type);
$result = (empty($celement) || empty($cvalidator));
if (!$result) {
$xml_error = new libxml_errors... | php | public function validate($element) {
$this->last_error = null;
$celement = realpath($element);
$cvalidator = realpath($this->location.DIRECTORY_SEPARATOR.$this->type);
$result = (empty($celement) || empty($cvalidator));
if (!$result) {
$xml_error = new libxml_errors... | [
"public",
"function",
"validate",
"(",
"$",
"element",
")",
"{",
"$",
"this",
"->",
"last_error",
"=",
"null",
";",
"$",
"celement",
"=",
"realpath",
"(",
"$",
"element",
")",
";",
"$",
"cvalidator",
"=",
"realpath",
"(",
"$",
"this",
"->",
"location",... | Validates the item
@param string $element - File path for the xml
@return boolean | [
"Validates",
"the",
"item"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/cc/validator.php#L212-L225 |
212,733 | moodle/moodle | lib/horde/framework/Horde/Mime/Headers/ContentParam/ContentType.php | Horde_Mime_Headers_ContentParam_ContentType.create | public static function create()
{
$ob = new stdClass;
$ob->value = self::DEFAULT_CONTENT_TYPE;
return new self(null, $ob);
} | php | public static function create()
{
$ob = new stdClass;
$ob->value = self::DEFAULT_CONTENT_TYPE;
return new self(null, $ob);
} | [
"public",
"static",
"function",
"create",
"(",
")",
"{",
"$",
"ob",
"=",
"new",
"stdClass",
";",
"$",
"ob",
"->",
"value",
"=",
"self",
"::",
"DEFAULT_CONTENT_TYPE",
";",
"return",
"new",
"self",
"(",
"null",
",",
"$",
"ob",
")",
";",
"}"
] | Creates a default Content-Type header, conforming to the MIME
specification as detailed in RFC 2045.
@return Horde_Mime_Headers_ContentParam_ContentType Content-Type
header object. | [
"Creates",
"a",
"default",
"Content",
"-",
"Type",
"header",
"conforming",
"to",
"the",
"MIME",
"specification",
"as",
"detailed",
"in",
"RFC",
"2045",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Headers/ContentParam/ContentType.php#L42-L48 |
212,734 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.add_field | public function add_field($field, $table, $alias = null) {
$field = self::resolve_field($field, $table);
if (!empty($alias)) {
$field .= ' AS ' . $alias;
}
$this->fields[] = $field;
} | php | public function add_field($field, $table, $alias = null) {
$field = self::resolve_field($field, $table);
if (!empty($alias)) {
$field .= ' AS ' . $alias;
}
$this->fields[] = $field;
} | [
"public",
"function",
"add_field",
"(",
"$",
"field",
",",
"$",
"table",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"$",
"field",
"=",
"self",
"::",
"resolve_field",
"(",
"$",
"field",
",",
"$",
"table",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$"... | Add a field to select.
@param string $field The field, or *.
@param string $table The table name, without the prefix 'glossary_'.
@param string $alias An alias for the field. | [
"Add",
"a",
"field",
"to",
"select",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L106-L112 |
212,735 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.build_query | protected function build_query($count = false) {
$sql = 'SELECT ';
if ($count) {
$sql .= 'COUNT(\'x\') ';
} else {
$sql .= implode(', ', $this->fields) . ' ';
}
$sql .= $this->from . ' ';
$sql .= implode(' ', $this->joins) . ' ';
if (!em... | php | protected function build_query($count = false) {
$sql = 'SELECT ';
if ($count) {
$sql .= 'COUNT(\'x\') ';
} else {
$sql .= implode(', ', $this->fields) . ' ';
}
$sql .= $this->from . ' ';
$sql .= implode(' ', $this->joins) . ' ';
if (!em... | [
"protected",
"function",
"build_query",
"(",
"$",
"count",
"=",
"false",
")",
"{",
"$",
"sql",
"=",
"'SELECT '",
";",
"if",
"(",
"$",
"count",
")",
"{",
"$",
"sql",
".=",
"'COUNT(\\'x\\') '",
";",
"}",
"else",
"{",
"$",
"sql",
".=",
"implode",
"(",
... | Internal method to build the query.
@param bool $count Query to count?
@return string The SQL statement. | [
"Internal",
"method",
"to",
"build",
"the",
"query",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L129-L150 |
212,736 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.filter_by_letter | protected function filter_by_letter($letter, $finalfield) {
global $DB;
$letter = core_text::strtoupper($letter);
$len = core_text::strlen($letter);
$sql = $DB->sql_substr(sprintf('upper(%s)', $finalfield), 1, $len);
$this->where[] = "$sql = :letter";
$this->params['let... | php | protected function filter_by_letter($letter, $finalfield) {
global $DB;
$letter = core_text::strtoupper($letter);
$len = core_text::strlen($letter);
$sql = $DB->sql_substr(sprintf('upper(%s)', $finalfield), 1, $len);
$this->where[] = "$sql = :letter";
$this->params['let... | [
"protected",
"function",
"filter_by_letter",
"(",
"$",
"letter",
",",
"$",
"finalfield",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"letter",
"=",
"core_text",
"::",
"strtoupper",
"(",
"$",
"letter",
")",
";",
"$",
"len",
"=",
"core_text",
"::",
"strlen",
... | Filter a field using a letter.
@param string $letter The letter.
@param string $finalfield The SQL statement representing the field. | [
"Filter",
"a",
"field",
"using",
"a",
"letter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L168-L177 |
212,737 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.filter_by_non_letter | protected function filter_by_non_letter($finalfield) {
global $DB;
$alphabet = explode(',', get_string('alphabet', 'langconfig'));
list($nia, $aparams) = $DB->get_in_or_equal($alphabet, SQL_PARAMS_NAMED, 'nonletter', false);
$sql = $DB->sql_substr(sprintf('upper(%s)', $finalfield), 1, ... | php | protected function filter_by_non_letter($finalfield) {
global $DB;
$alphabet = explode(',', get_string('alphabet', 'langconfig'));
list($nia, $aparams) = $DB->get_in_or_equal($alphabet, SQL_PARAMS_NAMED, 'nonletter', false);
$sql = $DB->sql_substr(sprintf('upper(%s)', $finalfield), 1, ... | [
"protected",
"function",
"filter_by_non_letter",
"(",
"$",
"finalfield",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"alphabet",
"=",
"explode",
"(",
"','",
",",
"get_string",
"(",
"'alphabet'",
",",
"'langconfig'",
")",
")",
";",
"list",
"(",
"$",
"nia",
"... | Filter a field by special characters.
@param string $finalfield The SQL statement representing the field. | [
"Filter",
"a",
"field",
"by",
"special",
"characters",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L184-L194 |
212,738 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.filter_by_author_letter | public function filter_by_author_letter($letter, $firstnamefirst = false) {
$field = self::get_fullname_field($firstnamefirst);
$this->filter_by_letter($letter, $field);
} | php | public function filter_by_author_letter($letter, $firstnamefirst = false) {
$field = self::get_fullname_field($firstnamefirst);
$this->filter_by_letter($letter, $field);
} | [
"public",
"function",
"filter_by_author_letter",
"(",
"$",
"letter",
",",
"$",
"firstnamefirst",
"=",
"false",
")",
"{",
"$",
"field",
"=",
"self",
"::",
"get_fullname_field",
"(",
"$",
"firstnamefirst",
")",
";",
"$",
"this",
"->",
"filter_by_letter",
"(",
... | Filter the author by letter.
@param string $letter The letter.
@param bool $firstnamefirst Whether or not the firstname is first in the author's name. | [
"Filter",
"the",
"author",
"by",
"letter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L202-L205 |
212,739 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.filter_by_author_non_letter | public function filter_by_author_non_letter($firstnamefirst = false) {
$field = self::get_fullname_field($firstnamefirst);
$this->filter_by_non_letter($field);
} | php | public function filter_by_author_non_letter($firstnamefirst = false) {
$field = self::get_fullname_field($firstnamefirst);
$this->filter_by_non_letter($field);
} | [
"public",
"function",
"filter_by_author_non_letter",
"(",
"$",
"firstnamefirst",
"=",
"false",
")",
"{",
"$",
"field",
"=",
"self",
"::",
"get_fullname_field",
"(",
"$",
"firstnamefirst",
")",
";",
"$",
"this",
"->",
"filter_by_non_letter",
"(",
"$",
"field",
... | Filter the author by special characters.
@param bool $firstnamefirst Whether or not the firstname is first in the author's name. | [
"Filter",
"the",
"author",
"by",
"special",
"characters",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L212-L215 |
212,740 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.filter_by_non_approved | public function filter_by_non_approved($constant, $userid = null) {
global $USER;
if (!$userid) {
$userid = $USER->id;
}
if ($constant === self::NON_APPROVED_ALL) {
// Nothing to do.
} else if ($constant === self::NON_APPROVED_SELF) {
$this->... | php | public function filter_by_non_approved($constant, $userid = null) {
global $USER;
if (!$userid) {
$userid = $USER->id;
}
if ($constant === self::NON_APPROVED_ALL) {
// Nothing to do.
} else if ($constant === self::NON_APPROVED_SELF) {
$this->... | [
"public",
"function",
"filter_by_non_approved",
"(",
"$",
"constant",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"USER",
";",
"if",
"(",
"!",
"$",
"userid",
")",
"{",
"$",
"userid",
"=",
"$",
"USER",
"->",
"id",
";",
"}",
"if",
"(",
... | Filter non approved entries.
@param string $constant One of the NON_APPROVED_* constants.
@param int $userid The user ID when relevant, otherwise current user. | [
"Filter",
"non",
"approved",
"entries",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L241-L264 |
212,741 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.filter_by_term | public function filter_by_term($term) {
$this->where[] = sprintf("(%s = :filterterma OR %s = :filtertermb)",
self::resolve_field('concept', 'entries'),
self::resolve_field('alias', 'alias'));
$this->params['filterterma'] = $term;
$this->params['filtertermb'] = $term;
... | php | public function filter_by_term($term) {
$this->where[] = sprintf("(%s = :filterterma OR %s = :filtertermb)",
self::resolve_field('concept', 'entries'),
self::resolve_field('alias', 'alias'));
$this->params['filterterma'] = $term;
$this->params['filtertermb'] = $term;
... | [
"public",
"function",
"filter_by_term",
"(",
"$",
"term",
")",
"{",
"$",
"this",
"->",
"where",
"[",
"]",
"=",
"sprintf",
"(",
"\"(%s = :filterterma OR %s = :filtertermb)\"",
",",
"self",
"::",
"resolve_field",
"(",
"'concept'",
",",
"'entries'",
")",
",",
"se... | Filter by concept or alias.
This requires the alias table to be joined in the query. See {@link self::join_alias()}.
@param string $term What the concept or aliases should be. | [
"Filter",
"by",
"concept",
"or",
"alias",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L273-L279 |
212,742 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.get_fullname_field | public static function get_fullname_field($firstnamefirst = false) {
global $DB;
if ($firstnamefirst) {
return $DB->sql_fullname(self::resolve_field('firstname', 'user'), self::resolve_field('lastname', 'user'));
}
return $DB->sql_fullname(self::resolve_field('lastname', 'use... | php | public static function get_fullname_field($firstnamefirst = false) {
global $DB;
if ($firstnamefirst) {
return $DB->sql_fullname(self::resolve_field('firstname', 'user'), self::resolve_field('lastname', 'user'));
}
return $DB->sql_fullname(self::resolve_field('lastname', 'use... | [
"public",
"static",
"function",
"get_fullname_field",
"(",
"$",
"firstnamefirst",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"firstnamefirst",
")",
"{",
"return",
"$",
"DB",
"->",
"sql_fullname",
"(",
"self",
"::",
"resolve_field",
"... | Convenience method to get get the SQL statement for the full name.
@param bool $firstnamefirst Whether or not the firstname is first in the author's name.
@return string The SQL statement. | [
"Convenience",
"method",
"to",
"get",
"get",
"the",
"SQL",
"statement",
"for",
"the",
"full",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L287-L293 |
212,743 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.get_records | public function get_records() {
global $DB;
return $DB->get_records_sql($this->build_query(), $this->params, $this->limitfrom, $this->limitnum);
} | php | public function get_records() {
global $DB;
return $DB->get_records_sql($this->build_query(), $this->params, $this->limitfrom, $this->limitnum);
} | [
"public",
"function",
"get_records",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"return",
"$",
"DB",
"->",
"get_records_sql",
"(",
"$",
"this",
"->",
"build_query",
"(",
")",
",",
"$",
"this",
"->",
"params",
",",
"$",
"this",
"->",
"limitfrom",
",",
"... | Get the records.
@return array | [
"Get",
"the",
"records",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L300-L303 |
212,744 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.get_recordset | public function get_recordset() {
global $DB;
return $DB->get_recordset_sql($this->build_query(), $this->params, $this->limitfrom, $this->limitnum);
} | php | public function get_recordset() {
global $DB;
return $DB->get_recordset_sql($this->build_query(), $this->params, $this->limitfrom, $this->limitnum);
} | [
"public",
"function",
"get_recordset",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"return",
"$",
"DB",
"->",
"get_recordset_sql",
"(",
"$",
"this",
"->",
"build_query",
"(",
")",
",",
"$",
"this",
"->",
"params",
",",
"$",
"this",
"->",
"limitfrom",
",",... | Get the recordset.
@return moodle_recordset | [
"Get",
"the",
"recordset",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L310-L313 |
212,745 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.join_alias | public function join_alias() {
$this->joins[] = sprintf('LEFT JOIN {glossary_alias} %s ON %s = %s',
self::ALIAS_ALIAS, self::resolve_field('id', 'entries'), self::resolve_field('entryid', 'alias'));
} | php | public function join_alias() {
$this->joins[] = sprintf('LEFT JOIN {glossary_alias} %s ON %s = %s',
self::ALIAS_ALIAS, self::resolve_field('id', 'entries'), self::resolve_field('entryid', 'alias'));
} | [
"public",
"function",
"join_alias",
"(",
")",
"{",
"$",
"this",
"->",
"joins",
"[",
"]",
"=",
"sprintf",
"(",
"'LEFT JOIN {glossary_alias} %s ON %s = %s'",
",",
"self",
"::",
"ALIAS_ALIAS",
",",
"self",
"::",
"resolve_field",
"(",
"'id'",
",",
"'entries'",
")"... | Join the alias table.
Note that this may cause the same entry to be returned more than once. You might want
to add a distinct on the entry id.
@return void | [
"Join",
"the",
"alias",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L335-L338 |
212,746 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.join_category | public function join_category($categoryid) {
if ($categoryid === GLOSSARY_SHOW_ALL_CATEGORIES) {
$this->joins[] = sprintf('JOIN {glossary_entries_categories} %s ON %s = %s',
self::ALIAS_ENTRIES_CATEGORIES, self::resolve_field('id', 'entries'),
self::resolve_field('en... | php | public function join_category($categoryid) {
if ($categoryid === GLOSSARY_SHOW_ALL_CATEGORIES) {
$this->joins[] = sprintf('JOIN {glossary_entries_categories} %s ON %s = %s',
self::ALIAS_ENTRIES_CATEGORIES, self::resolve_field('id', 'entries'),
self::resolve_field('en... | [
"public",
"function",
"join_category",
"(",
"$",
"categoryid",
")",
"{",
"if",
"(",
"$",
"categoryid",
"===",
"GLOSSARY_SHOW_ALL_CATEGORIES",
")",
"{",
"$",
"this",
"->",
"joins",
"[",
"]",
"=",
"sprintf",
"(",
"'JOIN {glossary_entries_categories} %s ON %s = %s'",
... | Join on the category tables.
Depending on the category passed the joins will be different. This is due to the display
logic that assumes that when displaying all categories the non categorised entries should
not be returned, etc...
@param int $categoryid The category ID, or GLOSSARY_SHOW_* constant. | [
"Join",
"on",
"the",
"category",
"tables",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L349-L373 |
212,747 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.join_user | public function join_user($strict = false) {
$join = $strict ? 'JOIN' : 'LEFT JOIN';
$this->joins[] = sprintf("$join {user} %s ON %s = %s",
self::ALIAS_USER, self::resolve_field('id', 'user'), self::resolve_field('userid', 'entries'));
} | php | public function join_user($strict = false) {
$join = $strict ? 'JOIN' : 'LEFT JOIN';
$this->joins[] = sprintf("$join {user} %s ON %s = %s",
self::ALIAS_USER, self::resolve_field('id', 'user'), self::resolve_field('userid', 'entries'));
} | [
"public",
"function",
"join_user",
"(",
"$",
"strict",
"=",
"false",
")",
"{",
"$",
"join",
"=",
"$",
"strict",
"?",
"'JOIN'",
":",
"'LEFT JOIN'",
";",
"$",
"this",
"->",
"joins",
"[",
"]",
"=",
"sprintf",
"(",
"\"$join {user} %s ON %s = %s\"",
",",
"sel... | Join the user table.
@param bool $strict When strict uses a JOIN rather than a LEFT JOIN. | [
"Join",
"the",
"user",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L380-L384 |
212,748 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.order_by_author | public function order_by_author($firstnamefirst = false, $direction = '') {
$field = self::get_fullname_field($firstnamefirst);
$direction = self::normalize_direction($direction);
$this->order[] = $field . ' ' . $direction;
} | php | public function order_by_author($firstnamefirst = false, $direction = '') {
$field = self::get_fullname_field($firstnamefirst);
$direction = self::normalize_direction($direction);
$this->order[] = $field . ' ' . $direction;
} | [
"public",
"function",
"order_by_author",
"(",
"$",
"firstnamefirst",
"=",
"false",
",",
"$",
"direction",
"=",
"''",
")",
"{",
"$",
"field",
"=",
"self",
"::",
"get_fullname_field",
"(",
"$",
"firstnamefirst",
")",
";",
"$",
"direction",
"=",
"self",
"::",... | Order by author name.
@param bool $firstnamefirst Whether or not the firstname is first in the author's name.
@param string $direction ASC, or DESC. | [
"Order",
"by",
"author",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L430-L434 |
212,749 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.resolve_field | protected static function resolve_field($field, $table) {
$prefix = constant(__CLASS__ . '::ALIAS_' . core_text::strtoupper($table));
return sprintf('%s.%s', $prefix, $field);
} | php | protected static function resolve_field($field, $table) {
$prefix = constant(__CLASS__ . '::ALIAS_' . core_text::strtoupper($table));
return sprintf('%s.%s', $prefix, $field);
} | [
"protected",
"static",
"function",
"resolve_field",
"(",
"$",
"field",
",",
"$",
"table",
")",
"{",
"$",
"prefix",
"=",
"constant",
"(",
"__CLASS__",
".",
"'::ALIAS_'",
".",
"core_text",
"::",
"strtoupper",
"(",
"$",
"table",
")",
")",
";",
"return",
"sp... | Convenience method to transform a field into SQL statement.
@param string $field The field, or *.
@param string $table The table name, without the prefix 'glossary_'.
@return string SQL statement. | [
"Convenience",
"method",
"to",
"transform",
"a",
"field",
"into",
"SQL",
"statement",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L443-L446 |
212,750 | moodle/moodle | mod/glossary/classes/entry_query_builder.php | mod_glossary_entry_query_builder.where | public function where($field, $table, $value) {
static $i = 0;
$sql = self::resolve_field($field, $table) . ' ';
if ($value === null) {
$sql .= 'IS NULL';
} else {
$param = 'where' . $i++;
$sql .= " = :$param";
$this->params[$param] = $va... | php | public function where($field, $table, $value) {
static $i = 0;
$sql = self::resolve_field($field, $table) . ' ';
if ($value === null) {
$sql .= 'IS NULL';
} else {
$param = 'where' . $i++;
$sql .= " = :$param";
$this->params[$param] = $va... | [
"public",
"function",
"where",
"(",
"$",
"field",
",",
"$",
"table",
",",
"$",
"value",
")",
"{",
"static",
"$",
"i",
"=",
"0",
";",
"$",
"sql",
"=",
"self",
"::",
"resolve_field",
"(",
"$",
"field",
",",
"$",
"table",
")",
".",
"' '",
";",
"if... | Simple where conditions.
@param string $field The field, or *.
@param string $table The table name, without the prefix 'glossary_'.
@param mixed $value The value to be equal to. | [
"Simple",
"where",
"conditions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/classes/entry_query_builder.php#L455-L469 |
212,751 | moodle/moodle | blocks/section_links/renderer.php | block_section_links_renderer.render_section_links | public function render_section_links(stdClass $course, array $sections, $jumptosection = false) {
$html = html_writer::start_tag('ol', array('class' => 'inline-list'));
foreach ($sections as $section) {
$attributes = array();
if (!$section->visible) {
$attributes[... | php | public function render_section_links(stdClass $course, array $sections, $jumptosection = false) {
$html = html_writer::start_tag('ol', array('class' => 'inline-list'));
foreach ($sections as $section) {
$attributes = array();
if (!$section->visible) {
$attributes[... | [
"public",
"function",
"render_section_links",
"(",
"stdClass",
"$",
"course",
",",
"array",
"$",
"sections",
",",
"$",
"jumptosection",
"=",
"false",
")",
"{",
"$",
"html",
"=",
"html_writer",
"::",
"start_tag",
"(",
"'ol'",
",",
"array",
"(",
"'class'",
"... | Render a series of section links.
@param stdClass $course The course we are rendering for.
@param array $sections An array of section objects to render.
@param bool|int The section to provide a jump to link for.
@return string The HTML to display. | [
"Render",
"a",
"series",
"of",
"section",
"links",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/section_links/renderer.php#L43-L75 |
212,752 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.is_subscribed | public static function is_subscribed($userid, $forum, $discussionid = null, $cm = null) {
// If forum is force subscribed and has allowforcesubscribe, then user is subscribed.
if (self::is_forcesubscribed($forum)) {
if (!$cm) {
$cm = get_fast_modinfo($forum->course)->instance... | php | public static function is_subscribed($userid, $forum, $discussionid = null, $cm = null) {
// If forum is force subscribed and has allowforcesubscribe, then user is subscribed.
if (self::is_forcesubscribed($forum)) {
if (!$cm) {
$cm = get_fast_modinfo($forum->course)->instance... | [
"public",
"static",
"function",
"is_subscribed",
"(",
"$",
"userid",
",",
"$",
"forum",
",",
"$",
"discussionid",
"=",
"null",
",",
"$",
"cm",
"=",
"null",
")",
"{",
"// If forum is force subscribed and has allowforcesubscribe, then user is subscribed.",
"if",
"(",
... | Whether a user is subscribed to this forum, or a discussion within
the forum.
If a discussion is specified, then report whether the user is
subscribed to posts to this particular discussion, taking into
account the forum preference.
If it is not specified then only the forum preference is considered.
@param int $use... | [
"Whether",
"a",
"user",
"is",
"subscribed",
"to",
"this",
"forum",
"or",
"a",
"discussion",
"within",
"the",
"forum",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L103-L126 |
212,753 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.is_subscribable | public static function is_subscribable($forum) {
return (isloggedin() && !isguestuser() &&
!\mod_forum\subscriptions::is_forcesubscribed($forum) &&
!\mod_forum\subscriptions::subscription_disabled($forum));
} | php | public static function is_subscribable($forum) {
return (isloggedin() && !isguestuser() &&
!\mod_forum\subscriptions::is_forcesubscribed($forum) &&
!\mod_forum\subscriptions::subscription_disabled($forum));
} | [
"public",
"static",
"function",
"is_subscribable",
"(",
"$",
"forum",
")",
"{",
"return",
"(",
"isloggedin",
"(",
")",
"&&",
"!",
"isguestuser",
"(",
")",
"&&",
"!",
"\\",
"mod_forum",
"\\",
"subscriptions",
"::",
"is_forcesubscribed",
"(",
"$",
"forum",
"... | Helper to determine whether the specified forum can be subscribed to.
@param \stdClass $forum The record of the forum to test
@return bool | [
"Helper",
"to",
"determine",
"whether",
"the",
"specified",
"forum",
"can",
"be",
"subscribed",
"to",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L166-L170 |
212,754 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.get_unsubscribable_forums | public static function get_unsubscribable_forums() {
global $USER, $DB;
// Get courses that $USER is enrolled in and can see.
$courses = enrol_get_my_courses();
if (empty($courses)) {
return array();
}
$courseids = array();
foreach($courses as $cours... | php | public static function get_unsubscribable_forums() {
global $USER, $DB;
// Get courses that $USER is enrolled in and can see.
$courses = enrol_get_my_courses();
if (empty($courses)) {
return array();
}
$courseids = array();
foreach($courses as $cours... | [
"public",
"static",
"function",
"get_unsubscribable_forums",
"(",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"DB",
";",
"// Get courses that $USER is enrolled in and can see.",
"$",
"courses",
"=",
"enrol_get_my_courses",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$... | Returns an array of forums that the current user is subscribed to and is allowed to unsubscribe from
@return array An array of unsubscribable forums | [
"Returns",
"an",
"array",
"of",
"forums",
"that",
"the",
"current",
"user",
"is",
"subscribed",
"to",
"and",
"is",
"allowed",
"to",
"unsubscribe",
"from"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L201-L251 |
212,755 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.get_potential_subscribers | public static function get_potential_subscribers($context, $groupid, $fields, $sort = '') {
global $DB;
// Only active enrolled users or everybody on the frontpage.
list($esql, $params) = get_enrolled_sql($context, 'mod/forum:allowforcesubscribe', $groupid, true);
if (!$sort) {
... | php | public static function get_potential_subscribers($context, $groupid, $fields, $sort = '') {
global $DB;
// Only active enrolled users or everybody on the frontpage.
list($esql, $params) = get_enrolled_sql($context, 'mod/forum:allowforcesubscribe', $groupid, true);
if (!$sort) {
... | [
"public",
"static",
"function",
"get_potential_subscribers",
"(",
"$",
"context",
",",
"$",
"groupid",
",",
"$",
"fields",
",",
"$",
"sort",
"=",
"''",
")",
"{",
"global",
"$",
"DB",
";",
"// Only active enrolled users or everybody on the frontpage.",
"list",
"(",... | Get the list of potential subscribers to a forum.
@param context_module $context the forum context.
@param integer $groupid the id of a group, or 0 for all groups.
@param string $fields the list of fields to return for each user. As for get_users_by_capability.
@param string $sort sort order. As for get_users_by_capab... | [
"Get",
"the",
"list",
"of",
"potential",
"subscribers",
"to",
"a",
"forum",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L262-L278 |
212,756 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.fetch_subscription_cache | public static function fetch_subscription_cache($forumid, $userid) {
if (isset(self::$forumcache[$userid]) && isset(self::$forumcache[$userid][$forumid])) {
return self::$forumcache[$userid][$forumid];
}
self::fill_subscription_cache($forumid, $userid);
if (!isset(self::$for... | php | public static function fetch_subscription_cache($forumid, $userid) {
if (isset(self::$forumcache[$userid]) && isset(self::$forumcache[$userid][$forumid])) {
return self::$forumcache[$userid][$forumid];
}
self::fill_subscription_cache($forumid, $userid);
if (!isset(self::$for... | [
"public",
"static",
"function",
"fetch_subscription_cache",
"(",
"$",
"forumid",
",",
"$",
"userid",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"forumcache",
"[",
"$",
"userid",
"]",
")",
"&&",
"isset",
"(",
"self",
"::",
"$",
"forumcache",
... | Fetch the forum subscription data for the specified userid and forum.
@param int $forumid The forum to retrieve a cache for
@param int $userid The user ID
@return boolean | [
"Fetch",
"the",
"forum",
"subscription",
"data",
"for",
"the",
"specified",
"userid",
"and",
"forum",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L287-L298 |
212,757 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.fill_subscription_cache | public static function fill_subscription_cache($forumid, $userid = null) {
global $DB;
if (!isset(self::$fetchedforums[$forumid])) {
// This forum has not been fetched as a whole.
if (isset($userid)) {
if (!isset(self::$forumcache[$userid])) {
... | php | public static function fill_subscription_cache($forumid, $userid = null) {
global $DB;
if (!isset(self::$fetchedforums[$forumid])) {
// This forum has not been fetched as a whole.
if (isset($userid)) {
if (!isset(self::$forumcache[$userid])) {
... | [
"public",
"static",
"function",
"fill_subscription_cache",
"(",
"$",
"forumid",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"fetchedforums",
"[",
"$",
"forumid",
"]",
")",
")",
... | Fill the forum subscription data for the specified userid and forum.
If the userid is not specified, then all subscription data for that forum is fetched in a single query and used
for subsequent lookups without requiring further database queries.
@param int $forumid The forum to retrieve a cache for
@param int $user... | [
"Fill",
"the",
"forum",
"subscription",
"data",
"for",
"the",
"specified",
"userid",
"and",
"forum",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L310-L344 |
212,758 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.fill_subscription_cache_for_course | public static function fill_subscription_cache_for_course($courseid, $userid) {
global $DB;
if (!isset(self::$forumcache[$userid])) {
self::$forumcache[$userid] = array();
}
$sql = "SELECT
f.id AS forumid,
s.id AS subscriptionid
... | php | public static function fill_subscription_cache_for_course($courseid, $userid) {
global $DB;
if (!isset(self::$forumcache[$userid])) {
self::$forumcache[$userid] = array();
}
$sql = "SELECT
f.id AS forumid,
s.id AS subscriptionid
... | [
"public",
"static",
"function",
"fill_subscription_cache_for_course",
"(",
"$",
"courseid",
",",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"forumcache",
"[",
"$",
"userid",
"]",
")",
")",
"{",
"... | Fill the forum subscription data for all forums that the specified userid can subscribe to in the specified course.
@param int $courseid The course to retrieve a cache for
@param int $userid The user ID
@return void | [
"Fill",
"the",
"forum",
"subscription",
"data",
"for",
"all",
"forums",
"that",
"the",
"specified",
"userid",
"can",
"subscribe",
"to",
"in",
"the",
"specified",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L353-L378 |
212,759 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.fetch_subscribed_users | public static function fetch_subscribed_users($forum, $groupid = 0, $context = null, $fields = null,
$includediscussionsubscriptions = false) {
global $CFG, $DB;
if (empty($fields)) {
$allnames = get_all_user_name_fields(true, 'u');
$fields ="u.id,
... | php | public static function fetch_subscribed_users($forum, $groupid = 0, $context = null, $fields = null,
$includediscussionsubscriptions = false) {
global $CFG, $DB;
if (empty($fields)) {
$allnames = get_all_user_name_fields(true, 'u');
$fields ="u.id,
... | [
"public",
"static",
"function",
"fetch_subscribed_users",
"(",
"$",
"forum",
",",
"$",
"groupid",
"=",
"0",
",",
"$",
"context",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"includediscussionsubscriptions",
"=",
"false",
")",
"{",
"global",
"$"... | Returns a list of user objects who are subscribed to this forum.
@param stdClass $forum The forum record.
@param int $groupid The group id if restricting subscriptions to a group of users, or 0 for all.
@param context_module $context the forum context, to save re-fetching it where possible.
@param string $fields reque... | [
"Returns",
"a",
"list",
"of",
"user",
"objects",
"who",
"are",
"subscribed",
"to",
"this",
"forum",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L390-L469 |
212,760 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.fetch_discussion_subscription | public static function fetch_discussion_subscription($forumid, $userid = null) {
self::fill_discussion_subscription_cache($forumid, $userid);
if (!isset(self::$forumdiscussioncache[$userid]) || !isset(self::$forumdiscussioncache[$userid][$forumid])) {
return array();
}
retu... | php | public static function fetch_discussion_subscription($forumid, $userid = null) {
self::fill_discussion_subscription_cache($forumid, $userid);
if (!isset(self::$forumdiscussioncache[$userid]) || !isset(self::$forumdiscussioncache[$userid][$forumid])) {
return array();
}
retu... | [
"public",
"static",
"function",
"fetch_discussion_subscription",
"(",
"$",
"forumid",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"self",
"::",
"fill_discussion_subscription_cache",
"(",
"$",
"forumid",
",",
"$",
"userid",
")",
";",
"if",
"(",
"!",
"isset",
"... | Retrieve the discussion subscription data for the specified userid and forum.
This is returned as an array of discussions for that forum which contain the preference in a stdClass.
@param int $forumid The forum to retrieve a cache for
@param int $userid The user ID
@return array of stdClass objects with one per discu... | [
"Retrieve",
"the",
"discussion",
"subscription",
"data",
"for",
"the",
"specified",
"userid",
"and",
"forum",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L480-L488 |
212,761 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.fill_discussion_subscription_cache | public static function fill_discussion_subscription_cache($forumid, $userid = null) {
global $DB;
if (!isset(self::$discussionfetchedforums[$forumid])) {
// This forum hasn't been fetched as a whole yet.
if (isset($userid)) {
if (!isset(self::$forumdiscussioncach... | php | public static function fill_discussion_subscription_cache($forumid, $userid = null) {
global $DB;
if (!isset(self::$discussionfetchedforums[$forumid])) {
// This forum hasn't been fetched as a whole yet.
if (isset($userid)) {
if (!isset(self::$forumdiscussioncach... | [
"public",
"static",
"function",
"fill_discussion_subscription_cache",
"(",
"$",
"forumid",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"discussionfetchedforums",
"[",
"$",
"forumid",
... | Fill the discussion subscription data for the specified userid and forum.
If the userid is not specified, then all discussion subscription data for that forum is fetched in a single query
and used for subsequent lookups without requiring further database queries.
@param int $forumid The forum to retrieve a cache for
... | [
"Fill",
"the",
"discussion",
"subscription",
"data",
"for",
"the",
"specified",
"userid",
"and",
"forum",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L500-L531 |
212,762 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.add_to_discussion_cache | protected static function add_to_discussion_cache($forumid, $userid, $discussion, $preference) {
if (!isset(self::$forumdiscussioncache[$userid])) {
self::$forumdiscussioncache[$userid] = array();
}
if (!isset(self::$forumdiscussioncache[$userid][$forumid])) {
self::$for... | php | protected static function add_to_discussion_cache($forumid, $userid, $discussion, $preference) {
if (!isset(self::$forumdiscussioncache[$userid])) {
self::$forumdiscussioncache[$userid] = array();
}
if (!isset(self::$forumdiscussioncache[$userid][$forumid])) {
self::$for... | [
"protected",
"static",
"function",
"add_to_discussion_cache",
"(",
"$",
"forumid",
",",
"$",
"userid",
",",
"$",
"discussion",
",",
"$",
"preference",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"forumdiscussioncache",
"[",
"$",
"userid",
"]... | Add the specified discussion and user preference to the discussion
subscription cache.
@param int $forumid The ID of the forum that this preference belongs to
@param int $userid The ID of the user that this preference belongs to
@param int $discussion The ID of the discussion that this preference relates to
@param int... | [
"Add",
"the",
"specified",
"discussion",
"and",
"user",
"preference",
"to",
"the",
"discussion",
"subscription",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L542-L552 |
212,763 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.subscribe_user | public static function subscribe_user($userid, $forum, $context = null, $userrequest = false) {
global $DB;
if (self::is_subscribed($userid, $forum)) {
return true;
}
$sub = new \stdClass();
$sub->userid = $userid;
$sub->forum = $forum->id;
$result... | php | public static function subscribe_user($userid, $forum, $context = null, $userrequest = false) {
global $DB;
if (self::is_subscribed($userid, $forum)) {
return true;
}
$sub = new \stdClass();
$sub->userid = $userid;
$sub->forum = $forum->id;
$result... | [
"public",
"static",
"function",
"subscribe_user",
"(",
"$",
"userid",
",",
"$",
"forum",
",",
"$",
"context",
"=",
"null",
",",
"$",
"userrequest",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"self",
"::",
"is_subscribed",
"(",
"$",
... | Adds user to the subscriber list.
@param int $userid The ID of the user to subscribe
@param \stdClass $forum The forum record for this forum.
@param \context_module|null $context Module context, may be omitted if not known or if called for the current
module set in page.
@param boolean $userrequest Whether the user re... | [
"Adds",
"user",
"to",
"the",
"subscriber",
"list",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L588-L642 |
212,764 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.unsubscribe_user | public static function unsubscribe_user($userid, $forum, $context = null, $userrequest = false) {
global $DB;
$sqlparams = array(
'userid' => $userid,
'forum' => $forum->id,
);
$DB->delete_records('forum_digests', $sqlparams);
if ($forumsubscription = $D... | php | public static function unsubscribe_user($userid, $forum, $context = null, $userrequest = false) {
global $DB;
$sqlparams = array(
'userid' => $userid,
'forum' => $forum->id,
);
$DB->delete_records('forum_digests', $sqlparams);
if ($forumsubscription = $D... | [
"public",
"static",
"function",
"unsubscribe_user",
"(",
"$",
"userid",
",",
"$",
"forum",
",",
"$",
"context",
"=",
"null",
",",
"$",
"userrequest",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sqlparams",
"=",
"array",
"(",
"'userid'",
"=>... | Removes user from the subscriber list
@param int $userid The ID of the user to unsubscribe
@param \stdClass $forum The forum record for this forum.
@param \context_module|null $context Module context, may be omitted if not known or if called for the current
module set in page.
@param boolean $userrequest Whether the u... | [
"Removes",
"user",
"from",
"the",
"subscriber",
"list"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L655-L701 |
212,765 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.subscribe_user_to_discussion | public static function subscribe_user_to_discussion($userid, $discussion, $context = null) {
global $DB;
// First check whether the user is subscribed to the discussion already.
$subscription = $DB->get_record('forum_discussion_subs', array('userid' => $userid, 'discussion' => $discussion->id))... | php | public static function subscribe_user_to_discussion($userid, $discussion, $context = null) {
global $DB;
// First check whether the user is subscribed to the discussion already.
$subscription = $DB->get_record('forum_discussion_subs', array('userid' => $userid, 'discussion' => $discussion->id))... | [
"public",
"static",
"function",
"subscribe_user_to_discussion",
"(",
"$",
"userid",
",",
"$",
"discussion",
",",
"$",
"context",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"// First check whether the user is subscribed to the discussion already.",
"$",
"subscripti... | Subscribes the user to the specified discussion.
@param int $userid The userid of the user being subscribed
@param \stdClass $discussion The discussion to subscribe to
@param \context_module|null $context Module context, may be omitted if not known or if called for the current
module set in page.
@return boolean Wheth... | [
"Subscribes",
"the",
"user",
"to",
"the",
"specified",
"discussion",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L712-L764 |
212,766 | moodle/moodle | mod/forum/classes/subscriptions.php | subscriptions.get_user_default_subscription | public static function get_user_default_subscription($forum, $context, $cm, ?int $discussionid) {
global $USER;
$manageactivities = has_capability('moodle/course:manageactivities', $context);
if (\mod_forum\subscriptions::subscription_disabled($forum) && !$manageactivities) {
// User... | php | public static function get_user_default_subscription($forum, $context, $cm, ?int $discussionid) {
global $USER;
$manageactivities = has_capability('moodle/course:manageactivities', $context);
if (\mod_forum\subscriptions::subscription_disabled($forum) && !$manageactivities) {
// User... | [
"public",
"static",
"function",
"get_user_default_subscription",
"(",
"$",
"forum",
",",
"$",
"context",
",",
"$",
"cm",
",",
"?",
"int",
"$",
"discussionid",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"manageactivities",
"=",
"has_capability",
"(",
"'moodle... | Gets the default subscription value for the logged in user.
@param \stdClass $forum The forum record
@param \context $context The course context
@param \cm_info $cm cm_info
@param int|null $discussionid The discussion we are checking against
@return bool Default subscription
@throws coding_exception | [
"Gets",
"the",
"default",
"subscription",
"value",
"for",
"the",
"logged",
"in",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/subscriptions.php#L838-L861 |
212,767 | moodle/moodle | lib/form/autocomplete.php | MoodleQuickForm_autocomplete.optionExists | function optionExists($value) {
foreach ($this->_options as $option) {
if (isset($option['attr']['value']) && ($option['attr']['value'] == $value)) {
return true;
}
}
return false;
} | php | function optionExists($value) {
foreach ($this->_options as $option) {
if (isset($option['attr']['value']) && ($option['attr']['value'] == $value)) {
return true;
}
}
return false;
} | [
"function",
"optionExists",
"(",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_options",
"as",
"$",
"option",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"option",
"[",
"'attr'",
"]",
"[",
"'value'",
"]",
")",
"&&",
"(",
"$",
"option",
... | Search the current list of options to see if there are any options with this value.
@param string $value to search
@return boolean | [
"Search",
"the",
"current",
"list",
"of",
"options",
"to",
"see",
"if",
"there",
"are",
"any",
"options",
"with",
"this",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/autocomplete.php#L160-L167 |
212,768 | moodle/moodle | course/format/weeks/lib.php | format_weeks.get_default_section_name | public function get_default_section_name($section) {
if ($section->section == 0) {
// Return the general section.
return get_string('section0name', 'format_weeks');
} else {
$dates = $this->get_section_dates($section);
// We subtract 24 hours for display ... | php | public function get_default_section_name($section) {
if ($section->section == 0) {
// Return the general section.
return get_string('section0name', 'format_weeks');
} else {
$dates = $this->get_section_dates($section);
// We subtract 24 hours for display ... | [
"public",
"function",
"get_default_section_name",
"(",
"$",
"section",
")",
"{",
"if",
"(",
"$",
"section",
"->",
"section",
"==",
"0",
")",
"{",
"// Return the general section.",
"return",
"get_string",
"(",
"'section0name'",
",",
"'format_weeks'",
")",
";",
"}... | Returns the default section name for the weekly course format.
If the section number is 0, it will use the string with key = section0name from the course format's lang file.
Otherwise, the default format of "[start date] - [end date]" will be returned.
@param stdClass $section Section object from database or just fie... | [
"Returns",
"the",
"default",
"section",
"name",
"for",
"the",
"weekly",
"course",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/weeks/lib.php#L72-L87 |
212,769 | moodle/moodle | course/format/weeks/lib.php | format_weeks.get_section_dates | public function get_section_dates($section, $startdate = false) {
if ($startdate === false) {
$course = $this->get_course();
$startdate = $course->startdate;
}
if (is_object($section)) {
$sectionnum = $section->section;
} else {
$sectionn... | php | public function get_section_dates($section, $startdate = false) {
if ($startdate === false) {
$course = $this->get_course();
$startdate = $course->startdate;
}
if (is_object($section)) {
$sectionnum = $section->section;
} else {
$sectionn... | [
"public",
"function",
"get_section_dates",
"(",
"$",
"section",
",",
"$",
"startdate",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"startdate",
"===",
"false",
")",
"{",
"$",
"course",
"=",
"$",
"this",
"->",
"get_course",
"(",
")",
";",
"$",
"startdate",
... | Return the start and end date of the passed section
@param int|stdClass|section_info $section section to get the dates for
@param int $startdate Force course start date, useful when the course is not yet created
@return stdClass property start for startdate, property end for enddate | [
"Return",
"the",
"start",
"and",
"end",
"date",
"of",
"the",
"passed",
"section"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/weeks/lib.php#L365-L387 |
212,770 | moodle/moodle | course/format/weeks/lib.php | format_weeks.is_section_current | public function is_section_current($section) {
if (is_object($section)) {
$sectionnum = $section->section;
} else {
$sectionnum = $section;
}
if ($sectionnum < 1) {
return false;
}
$timenow = time();
$dates = $this->get_section_... | php | public function is_section_current($section) {
if (is_object($section)) {
$sectionnum = $section->section;
} else {
$sectionnum = $section;
}
if ($sectionnum < 1) {
return false;
}
$timenow = time();
$dates = $this->get_section_... | [
"public",
"function",
"is_section_current",
"(",
"$",
"section",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"section",
")",
")",
"{",
"$",
"sectionnum",
"=",
"$",
"section",
"->",
"section",
";",
"}",
"else",
"{",
"$",
"sectionnum",
"=",
"$",
"section... | Returns true if the specified week is current
@param int|stdClass|section_info $section
@return bool | [
"Returns",
"true",
"if",
"the",
"specified",
"week",
"is",
"current"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/weeks/lib.php#L395-L407 |
212,771 | moodle/moodle | course/format/weeks/lib.php | format_weeks.get_default_course_enddate | public function get_default_course_enddate($mform, $fieldnames = array()) {
if (empty($fieldnames['startdate'])) {
$fieldnames['startdate'] = 'startdate';
}
if (empty($fieldnames['numsections'])) {
$fieldnames['numsections'] = 'numsections';
}
$startdat... | php | public function get_default_course_enddate($mform, $fieldnames = array()) {
if (empty($fieldnames['startdate'])) {
$fieldnames['startdate'] = 'startdate';
}
if (empty($fieldnames['numsections'])) {
$fieldnames['numsections'] = 'numsections';
}
$startdat... | [
"public",
"function",
"get_default_course_enddate",
"(",
"$",
"mform",
",",
"$",
"fieldnames",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"fieldnames",
"[",
"'startdate'",
"]",
")",
")",
"{",
"$",
"fieldnames",
"[",
"'startdate'",
"]... | Returns the default end date for weeks course format.
@param moodleform $mform
@param array $fieldnames The form - field names mapping.
@return int | [
"Returns",
"the",
"default",
"end",
"date",
"for",
"weeks",
"course",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/weeks/lib.php#L450-L475 |
212,772 | moodle/moodle | course/format/weeks/lib.php | format_weeks.update_end_date | public static function update_end_date($courseid) {
global $DB, $COURSE;
// Use one DB query to retrieve necessary fields in course, value for automaticenddate and number of the last
// section. This query will also validate that the course is indeed in 'weeks' format.
$insql = "SELECT ... | php | public static function update_end_date($courseid) {
global $DB, $COURSE;
// Use one DB query to retrieve necessary fields in course, value for automaticenddate and number of the last
// section. This query will also validate that the course is indeed in 'weeks' format.
$insql = "SELECT ... | [
"public",
"static",
"function",
"update_end_date",
"(",
"$",
"courseid",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"COURSE",
";",
"// Use one DB query to retrieve necessary fields in course, value for automaticenddate and number of the last",
"// section. This query will also valida... | Updates the end date for a course in weeks format if option automaticenddate is set.
This method is called from event observers and it can not use any modinfo or format caches because
events are triggered before the caches are reset.
@param int $courseid | [
"Updates",
"the",
"end",
"date",
"for",
"a",
"course",
"in",
"weeks",
"format",
"if",
"option",
"automaticenddate",
"is",
"set",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/weeks/lib.php#L517-L567 |
212,773 | moodle/moodle | mod/folder/classes/external.php | mod_folder_external.get_folders_by_courses | public static function get_folders_by_courses($courseids = array()) {
$warnings = array();
$returnedfolders = array();
$params = array(
'courseids' => $courseids,
);
$params = self::validate_parameters(self::get_folders_by_courses_parameters(), $params);
$m... | php | public static function get_folders_by_courses($courseids = array()) {
$warnings = array();
$returnedfolders = array();
$params = array(
'courseids' => $courseids,
);
$params = self::validate_parameters(self::get_folders_by_courses_parameters(), $params);
$m... | [
"public",
"static",
"function",
"get_folders_by_courses",
"(",
"$",
"courseids",
"=",
"array",
"(",
")",
")",
"{",
"$",
"warnings",
"=",
"array",
"(",
")",
";",
"$",
"returnedfolders",
"=",
"array",
"(",
")",
";",
"$",
"params",
"=",
"array",
"(",
"'co... | Returns a list of folders in a provided list of courses.
If no list is provided all folders that the user can view will be returned.
@param array $courseids course ids
@return array of warnings and folders
@since Moodle 3.3 | [
"Returns",
"a",
"list",
"of",
"folders",
"in",
"a",
"provided",
"list",
"of",
"courses",
".",
"If",
"no",
"list",
"is",
"provided",
"all",
"folders",
"that",
"the",
"user",
"can",
"view",
"will",
"be",
"returned",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/folder/classes/external.php#L131-L173 |
212,774 | moodle/moodle | mod/folder/classes/external.php | mod_folder_external.get_folders_by_courses_returns | public static function get_folders_by_courses_returns() {
return new external_single_structure(
array(
'folders' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_valu... | php | public static function get_folders_by_courses_returns() {
return new external_single_structure(
array(
'folders' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_valu... | [
"public",
"static",
"function",
"get_folders_by_courses_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'folders'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'id'",... | Describes the get_folders_by_courses return value.
@return external_single_structure
@since Moodle 3.3 | [
"Describes",
"the",
"get_folders_by_courses",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/folder/classes/external.php#L181-L209 |
212,775 | moodle/moodle | admin/tool/policy/classes/output/page_viewdoc.php | page_viewdoc.prepare_policy | protected function prepare_policy($policyid, $versionid) {
if ($versionid) {
$this->policy = api::get_policy_version($versionid);
} else {
$this->policy = array_reduce(api::list_current_versions(), function ($carry, $current) use ($policyid) {
if ($current->poli... | php | protected function prepare_policy($policyid, $versionid) {
if ($versionid) {
$this->policy = api::get_policy_version($versionid);
} else {
$this->policy = array_reduce(api::list_current_versions(), function ($carry, $current) use ($policyid) {
if ($current->poli... | [
"protected",
"function",
"prepare_policy",
"(",
"$",
"policyid",
",",
"$",
"versionid",
")",
"{",
"if",
"(",
"$",
"versionid",
")",
"{",
"$",
"this",
"->",
"policy",
"=",
"api",
"::",
"get_policy_version",
"(",
"$",
"versionid",
")",
";",
"}",
"else",
... | Loads the policy version to display on the page.
@param int $policyid The policy id for this page.
@param int $versionid The version id to show. Empty tries to load the current one. | [
"Loads",
"the",
"policy",
"version",
"to",
"display",
"on",
"the",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/output/page_viewdoc.php#L87-L104 |
212,776 | moodle/moodle | completion/criteria/completion_criteria_activity.php | completion_criteria_activity.get_mod_name | public static function get_mod_name($type) {
static $types;
if (!is_array($types)) {
global $DB;
$types = $DB->get_records('modules');
}
return $types[$type]->name;
} | php | public static function get_mod_name($type) {
static $types;
if (!is_array($types)) {
global $DB;
$types = $DB->get_records('modules');
}
return $types[$type]->name;
} | [
"public",
"static",
"function",
"get_mod_name",
"(",
"$",
"type",
")",
"{",
"static",
"$",
"types",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"types",
")",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"types",
"=",
"$",
"DB",
"->",
"get_records",
"(",... | Get module instance module type
@param int $type Module type id
@return string | [
"Get",
"module",
"instance",
"module",
"type"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/criteria/completion_criteria_activity.php#L108-L117 |
212,777 | moodle/moodle | completion/criteria/completion_criteria_activity.php | completion_criteria_activity.cron | public function cron() {
global $DB;
// Get all users who meet this criteria
$sql = '
SELECT DISTINCT
c.id AS course,
cr.id AS criteriaid,
ra.userid AS userid,
mc.timemodified AS timecompleted
FROM
... | php | public function cron() {
global $DB;
// Get all users who meet this criteria
$sql = '
SELECT DISTINCT
c.id AS course,
cr.id AS criteriaid,
ra.userid AS userid,
mc.timemodified AS timecompleted
FROM
... | [
"public",
"function",
"cron",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"// Get all users who meet this criteria",
"$",
"sql",
"=",
"'\n SELECT DISTINCT\n c.id AS course,\n cr.id AS criteriaid,\n ra.userid AS userid,\n ... | Find users who have completed this criteria and mark them accordingly | [
"Find",
"users",
"who",
"have",
"completed",
"this",
"criteria",
"and",
"mark",
"them",
"accordingly"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/criteria/completion_criteria_activity.php#L205-L253 |
212,778 | moodle/moodle | admin/tool/lp/classes/form/framework_autocomplete.php | framework_autocomplete.setValue | public function setValue($value) {
global $DB;
$values = (array) $value;
$ids = array();
foreach ($values as $onevalue) {
if (!empty($onevalue) && (!$this->optionExists($onevalue)) &&
($onevalue !== '_qf__force_multiselect_submission')) {
... | php | public function setValue($value) {
global $DB;
$values = (array) $value;
$ids = array();
foreach ($values as $onevalue) {
if (!empty($onevalue) && (!$this->optionExists($onevalue)) &&
($onevalue !== '_qf__force_multiselect_submission')) {
... | [
"public",
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"values",
"=",
"(",
"array",
")",
"$",
"value",
";",
"$",
"ids",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"onevalue",
")",... | Set the value of this element.
@param string|array $value The value to set.
@return boolean | [
"Set",
"the",
"value",
"of",
"this",
"element",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/lp/classes/form/framework_autocomplete.php#L88-L120 |
212,779 | moodle/moodle | competency/classes/user_competency_course.php | user_competency_course.create_relation | public static function create_relation($userid, $competencyid, $courseid) {
$data = new \stdClass();
$data->userid = $userid;
$data->competencyid = $competencyid;
$data->courseid = $courseid;
$relation = new user_competency_course(0, $data);
return $relation;
} | php | public static function create_relation($userid, $competencyid, $courseid) {
$data = new \stdClass();
$data->userid = $userid;
$data->competencyid = $competencyid;
$data->courseid = $courseid;
$relation = new user_competency_course(0, $data);
return $relation;
} | [
"public",
"static",
"function",
"create_relation",
"(",
"$",
"userid",
",",
"$",
"competencyid",
",",
"$",
"courseid",
")",
"{",
"$",
"data",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"data",
"->",
"userid",
"=",
"$",
"userid",
";",
"$",
"dat... | Create a new user_competency_course object.
Note, this is intended to be used to create a blank relation, for instance when
the record was not found in the database. This does not save the model.
@param int $userid The user ID.
@param int $competencyid The competency ID.
@param int $courseid The course ID.
@return... | [
"Create",
"a",
"new",
"user_competency_course",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/user_competency_course.php#L100-L108 |
212,780 | moodle/moodle | competency/classes/user_competency_course.php | user_competency_course.validate_proficiency | protected function validate_proficiency($value) {
$grade = $this->get('grade');
if ($grade !== null && $value === null) {
// We must set a proficiency when we set a grade.
return new lang_string('invaliddata', 'error');
} else if ($grade === null && $value !== null) {
... | php | protected function validate_proficiency($value) {
$grade = $this->get('grade');
if ($grade !== null && $value === null) {
// We must set a proficiency when we set a grade.
return new lang_string('invaliddata', 'error');
} else if ($grade === null && $value !== null) {
... | [
"protected",
"function",
"validate_proficiency",
"(",
"$",
"value",
")",
"{",
"$",
"grade",
"=",
"$",
"this",
"->",
"get",
"(",
"'grade'",
")",
";",
"if",
"(",
"$",
"grade",
"!==",
"null",
"&&",
"$",
"value",
"===",
"null",
")",
"{",
"// We must set a ... | Validate the proficiency.
@param int $value The value.
@return true|lang_string | [
"Validate",
"the",
"proficiency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/user_competency_course.php#L160-L173 |
212,781 | moodle/moodle | competency/classes/user_competency_course.php | user_competency_course.count_proficient_competencies | public static function count_proficient_competencies($courseid, $userid) {
global $DB;
$sql = 'SELECT COUNT(comp.id)
FROM {' . self::TABLE . '} usercoursecomp
JOIN {' . course_competency::TABLE . '} cc
ON usercoursecomp.competencyid = cc.competenc... | php | public static function count_proficient_competencies($courseid, $userid) {
global $DB;
$sql = 'SELECT COUNT(comp.id)
FROM {' . self::TABLE . '} usercoursecomp
JOIN {' . course_competency::TABLE . '} cc
ON usercoursecomp.competencyid = cc.competenc... | [
"public",
"static",
"function",
"count_proficient_competencies",
"(",
"$",
"courseid",
",",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"'SELECT COUNT(comp.id)\n FROM {'",
".",
"self",
"::",
"TABLE",
".",
"'} usercoursecomp\n... | Count the proficient competencies in this course for one user.
@param int $courseid The course id
@param int $userid The user id
@return int | [
"Count",
"the",
"proficient",
"competencies",
"in",
"this",
"course",
"for",
"one",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/user_competency_course.php#L241-L256 |
212,782 | moodle/moodle | competency/classes/user_competency_course.php | user_competency_course.get_least_proficient_competencies_for_course | public static function get_least_proficient_competencies_for_course($courseid, $skip = 0, $limit = 0) {
global $DB;
$fields = competency::get_sql_fields('c', 'c_');
$params = array('courseid' => $courseid);
$sql = 'SELECT ' . $fields . '
FROM (SELECT cc.competencyid, S... | php | public static function get_least_proficient_competencies_for_course($courseid, $skip = 0, $limit = 0) {
global $DB;
$fields = competency::get_sql_fields('c', 'c_');
$params = array('courseid' => $courseid);
$sql = 'SELECT ' . $fields . '
FROM (SELECT cc.competencyid, S... | [
"public",
"static",
"function",
"get_least_proficient_competencies_for_course",
"(",
"$",
"courseid",
",",
"$",
"skip",
"=",
"0",
",",
"$",
"limit",
"=",
"0",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"fields",
"=",
"competency",
"::",
"get_sql_fields",
"(",
... | Get the list of competencies that were completed the least times in a course.
@param int $courseid
@param int $skip The number of competencies to skip
@param int $limit The max number of competencies to return
@return competency[] | [
"Get",
"the",
"list",
"of",
"competencies",
"that",
"were",
"completed",
"the",
"least",
"times",
"in",
"a",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/user_competency_course.php#L266-L292 |
212,783 | moodle/moodle | admin/tool/monitor/classes/subscription.php | subscription.get_instance_name | public function get_instance_name() {
if ($this->plugin === 'core') {
$string = get_string('allevents', 'tool_monitor');
} else {
if ($this->cmid == 0) {
$string = get_string('allmodules', 'tool_monitor');
} else {
$cms = get_fast_modin... | php | public function get_instance_name() {
if ($this->plugin === 'core') {
$string = get_string('allevents', 'tool_monitor');
} else {
if ($this->cmid == 0) {
$string = get_string('allmodules', 'tool_monitor');
} else {
$cms = get_fast_modin... | [
"public",
"function",
"get_instance_name",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"plugin",
"===",
"'core'",
")",
"{",
"$",
"string",
"=",
"get_string",
"(",
"'allevents'",
",",
"'tool_monitor'",
")",
";",
"}",
"else",
"{",
"if",
"(",
"$",
"this"... | Get a human readable name for instances associated with this subscription.
@return string
@throws \coding_exception | [
"Get",
"a",
"human",
"readable",
"name",
"for",
"instances",
"associated",
"with",
"this",
"subscription",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/subscription.php#L84-L103 |
212,784 | moodle/moodle | admin/tool/monitor/classes/subscription.php | subscription.get_filters_description | public function get_filters_description() {
$a = new \stdClass();
$a->freq = $this->frequency;
$mins = $this->timewindow / MINSECS; // Convert seconds to minutes.
$a->mins = $mins;
return get_string('freqdesc', 'tool_monitor', $a);
} | php | public function get_filters_description() {
$a = new \stdClass();
$a->freq = $this->frequency;
$mins = $this->timewindow / MINSECS; // Convert seconds to minutes.
$a->mins = $mins;
return get_string('freqdesc', 'tool_monitor', $a);
} | [
"public",
"function",
"get_filters_description",
"(",
")",
"{",
"$",
"a",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"a",
"->",
"freq",
"=",
"$",
"this",
"->",
"frequency",
";",
"$",
"mins",
"=",
"$",
"this",
"->",
"timewindow",
"/",
"MINSECS"... | Get filter description.
@return string | [
"Get",
"filter",
"description",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/subscription.php#L124-L130 |
212,785 | moodle/moodle | admin/tool/monitor/classes/subscription.php | subscription.get_plugin_name | public function get_plugin_name() {
if ($this->plugin === 'core') {
$string = get_string('core', 'tool_monitor');
} else if (get_string_manager()->string_exists('pluginname', $this->plugin)) {
$string = get_string('pluginname', $this->plugin);
} else {
$string... | php | public function get_plugin_name() {
if ($this->plugin === 'core') {
$string = get_string('core', 'tool_monitor');
} else if (get_string_manager()->string_exists('pluginname', $this->plugin)) {
$string = get_string('pluginname', $this->plugin);
} else {
$string... | [
"public",
"function",
"get_plugin_name",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"plugin",
"===",
"'core'",
")",
"{",
"$",
"string",
"=",
"get_string",
"(",
"'core'",
",",
"'tool_monitor'",
")",
";",
"}",
"else",
"if",
"(",
"get_string_manager",
"("... | Get name of the plugin associated with this rule
@return string Plugin name. | [
"Get",
"name",
"of",
"the",
"plugin",
"associated",
"with",
"this",
"rule"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/subscription.php#L157-L166 |
212,786 | moodle/moodle | admin/tool/monitor/classes/subscription.php | subscription.get_course_name | public function get_course_name(\context $context) {
$courseid = $this->courseid;
if (empty($courseid)) {
return get_string('site');
} else {
try {
$course = get_course($courseid);
return format_string($course->fullname, true, array('contex... | php | public function get_course_name(\context $context) {
$courseid = $this->courseid;
if (empty($courseid)) {
return get_string('site');
} else {
try {
$course = get_course($courseid);
return format_string($course->fullname, true, array('contex... | [
"public",
"function",
"get_course_name",
"(",
"\\",
"context",
"$",
"context",
")",
"{",
"$",
"courseid",
"=",
"$",
"this",
"->",
"courseid",
";",
"if",
"(",
"empty",
"(",
"$",
"courseid",
")",
")",
"{",
"return",
"get_string",
"(",
"'site'",
")",
";",... | Get properly formatted name of the course associated.
@param \context $context context where this name would be displayed.
@return string Formatted name of the rule. | [
"Get",
"properly",
"formatted",
"name",
"of",
"the",
"course",
"associated",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/subscription.php#L174-L186 |
212,787 | moodle/moodle | admin/tool/monitor/classes/subscription.php | subscription.can_manage_rule | public function can_manage_rule() {
$courseid = $this->rulecourseid;
$context = empty($courseid) ? \context_system::instance() : \context_course::instance($courseid);
return has_capability('tool/monitor:managerules', $context);
} | php | public function can_manage_rule() {
$courseid = $this->rulecourseid;
$context = empty($courseid) ? \context_system::instance() : \context_course::instance($courseid);
return has_capability('tool/monitor:managerules', $context);
} | [
"public",
"function",
"can_manage_rule",
"(",
")",
"{",
"$",
"courseid",
"=",
"$",
"this",
"->",
"rulecourseid",
";",
"$",
"context",
"=",
"empty",
"(",
"$",
"courseid",
")",
"?",
"\\",
"context_system",
"::",
"instance",
"(",
")",
":",
"\\",
"context_co... | Can the current user manage the rule associate with this subscription?
@return bool true if the current user can manage this rule, else false. | [
"Can",
"the",
"current",
"user",
"manage",
"the",
"rule",
"associate",
"with",
"this",
"subscription?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/subscription.php#L193-L197 |
212,788 | moodle/moodle | privacy/classes/local/request/userlist.php | userlist.add_from_sql | public function add_from_sql(string $fieldname, string $sql, array $params) : userlist {
global $DB;
// Able to guess a field name.
$wrapper = "
SELECT DISTINCT u.id
FROM {user} u
JOIN ({$sql}) target ON u.id = target.{$fieldname}";
$users = $DB->get... | php | public function add_from_sql(string $fieldname, string $sql, array $params) : userlist {
global $DB;
// Able to guess a field name.
$wrapper = "
SELECT DISTINCT u.id
FROM {user} u
JOIN ({$sql}) target ON u.id = target.{$fieldname}";
$users = $DB->get... | [
"public",
"function",
"add_from_sql",
"(",
"string",
"$",
"fieldname",
",",
"string",
"$",
"sql",
",",
"array",
"$",
"params",
")",
":",
"userlist",
"{",
"global",
"$",
"DB",
";",
"// Able to guess a field name.",
"$",
"wrapper",
"=",
"\"\n SELECT DIS... | Add a set of users from SQL.
The SQL should only return a list of user IDs.
@param string $fieldname The name of the field which holds the user id
@param string $sql The SQL which will fetch the list of * user IDs
@param array $params The set of SQL parameters
@return $this | [
"Add",
"a",
"set",
"of",
"users",
"from",
"SQL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/local/request/userlist.php#L47-L60 |
212,789 | moodle/moodle | privacy/classes/local/request/userlist.php | userlist.add_users | public function add_users(array $userids) : userlist {
global $DB;
if (!empty($userids)) {
list($useridsql, $useridparams) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED);
$sql = "SELECT DISTINCT u.id
FROM {user} u
WHERE u.id {$useri... | php | public function add_users(array $userids) : userlist {
global $DB;
if (!empty($userids)) {
list($useridsql, $useridparams) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED);
$sql = "SELECT DISTINCT u.id
FROM {user} u
WHERE u.id {$useri... | [
"public",
"function",
"add_users",
"(",
"array",
"$",
"userids",
")",
":",
"userlist",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"userids",
")",
")",
"{",
"list",
"(",
"$",
"useridsql",
",",
"$",
"useridparams",
")",
"=",
"$... | Adds the user users for given users.
@param int[] $userids
@return $this | [
"Adds",
"the",
"user",
"users",
"for",
"given",
"users",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/local/request/userlist.php#L80-L91 |
212,790 | moodle/moodle | mod/glossary/locallib.php | glossary_full_portfolio_caller.expected_time | public function expected_time() {
$filetime = portfolio_expected_time_file($this->multifiles);
$dbtime = portfolio_expected_time_db(count($this->exportdata['entries']));
return ($filetime > $dbtime) ? $filetime : $dbtime;
} | php | public function expected_time() {
$filetime = portfolio_expected_time_file($this->multifiles);
$dbtime = portfolio_expected_time_db(count($this->exportdata['entries']));
return ($filetime > $dbtime) ? $filetime : $dbtime;
} | [
"public",
"function",
"expected_time",
"(",
")",
"{",
"$",
"filetime",
"=",
"portfolio_expected_time_file",
"(",
"$",
"this",
"->",
"multifiles",
")",
";",
"$",
"dbtime",
"=",
"portfolio_expected_time_db",
"(",
"count",
"(",
"$",
"this",
"->",
"exportdata",
"[... | how long might we expect this export to take
@return constant one of PORTFOLIO_TIME_XX | [
"how",
"long",
"might",
"we",
"expect",
"this",
"export",
"to",
"take"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/locallib.php#L91-L95 |
212,791 | moodle/moodle | mod/glossary/locallib.php | glossary_entry_portfolio_caller.check_permissions | public function check_permissions() {
$context = context_module::instance($this->cm->id);
return has_capability('mod/glossary:exportentry', $context)
|| ($this->entry->userid == $this->user->id && has_capability('mod/glossary:exportownentry', $context));
} | php | public function check_permissions() {
$context = context_module::instance($this->cm->id);
return has_capability('mod/glossary:exportentry', $context)
|| ($this->entry->userid == $this->user->id && has_capability('mod/glossary:exportownentry', $context));
} | [
"public",
"function",
"check_permissions",
"(",
")",
"{",
"$",
"context",
"=",
"context_module",
"::",
"instance",
"(",
"$",
"this",
"->",
"cm",
"->",
"id",
")",
";",
"return",
"has_capability",
"(",
"'mod/glossary:exportentry'",
",",
"$",
"context",
")",
"|... | make sure that the current user is allowed to do this
@return boolean | [
"make",
"sure",
"that",
"the",
"current",
"user",
"is",
"allowed",
"to",
"do",
"this"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/locallib.php#L291-L295 |
212,792 | moodle/moodle | mod/glossary/locallib.php | glossary_entry_portfolio_caller.entry_content | public static function entry_content($course, $cm, $glossary, $entry, $aliases, $format) {
global $OUTPUT, $DB;
$entry = clone $entry;
$context = context_module::instance($cm->id);
$options = portfolio_format_text_options();
$options->trusted = $entry->definitiontrust;
$o... | php | public static function entry_content($course, $cm, $glossary, $entry, $aliases, $format) {
global $OUTPUT, $DB;
$entry = clone $entry;
$context = context_module::instance($cm->id);
$options = portfolio_format_text_options();
$options->trusted = $entry->definitiontrust;
$o... | [
"public",
"static",
"function",
"entry_content",
"(",
"$",
"course",
",",
"$",
"cm",
",",
"$",
"glossary",
",",
"$",
"entry",
",",
"$",
"aliases",
",",
"$",
"format",
")",
"{",
"global",
"$",
"OUTPUT",
",",
"$",
"DB",
";",
"$",
"entry",
"=",
"clone... | helper function to get the html content of an entry
for both this class and the full glossary exporter
this is a very simplified version of the dictionary format output,
but with its 500 levels of indirection removed
and file rewriting handled by the portfolio export format.
@param stdclass $course
@param stdclass $cm... | [
"helper",
"function",
"to",
"get",
"the",
"html",
"content",
"of",
"an",
"entry",
"for",
"both",
"this",
"class",
"and",
"the",
"full",
"glossary",
"exporter",
"this",
"is",
"a",
"very",
"simplified",
"version",
"of",
"the",
"dictionary",
"format",
"output",... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/glossary/locallib.php#L395-L454 |
212,793 | moodle/moodle | lib/weblib.php | moodle_url.params | public function params(array $params = null) {
$params = (array)$params;
foreach ($params as $key => $value) {
if (is_int($key)) {
throw new coding_exception('Url parameters can not have numeric keys!');
}
if (!is_string($value)) {
if ... | php | public function params(array $params = null) {
$params = (array)$params;
foreach ($params as $key => $value) {
if (is_int($key)) {
throw new coding_exception('Url parameters can not have numeric keys!');
}
if (!is_string($value)) {
if ... | [
"public",
"function",
"params",
"(",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"(",
"array",
")",
"$",
"params",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_int",
"("... | Add an array of params to the params for this url.
The added params override existing ones if they have the same name.
@param array $params Defaults to null. If null then returns all params.
@return array Array of Params for url.
@throws coding_exception | [
"Add",
"an",
"array",
"of",
"params",
"to",
"the",
"params",
"for",
"this",
"url",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/weblib.php#L396-L414 |
212,794 | moodle/moodle | lib/weblib.php | moodle_url.remove_params | public function remove_params($params = null) {
if (!is_array($params)) {
$params = func_get_args();
}
foreach ($params as $param) {
unset($this->params[$param]);
}
return $this->params;
} | php | public function remove_params($params = null) {
if (!is_array($params)) {
$params = func_get_args();
}
foreach ($params as $param) {
unset($this->params[$param]);
}
return $this->params;
} | [
"public",
"function",
"remove_params",
"(",
"$",
"params",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"func_get_args",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"params",
"as",
"$",
"par... | Remove all params if no arguments passed.
Remove selected params if arguments are passed.
Can be called as either remove_params('param1', 'param2')
or remove_params(array('param1', 'param2')).
@param string[]|string $params,... either an array of param names, or 1..n string params to remove as args.
@return array url... | [
"Remove",
"all",
"params",
"if",
"no",
"arguments",
"passed",
".",
"Remove",
"selected",
"params",
"if",
"arguments",
"are",
"passed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/weblib.php#L426-L434 |
212,795 | moodle/moodle | lib/weblib.php | moodle_url.param | public function param($paramname, $newvalue = '') {
if (func_num_args() > 1) {
// Set new value.
$this->params(array($paramname => $newvalue));
}
if (isset($this->params[$paramname])) {
return $this->params[$paramname];
} else {
return null... | php | public function param($paramname, $newvalue = '') {
if (func_num_args() > 1) {
// Set new value.
$this->params(array($paramname => $newvalue));
}
if (isset($this->params[$paramname])) {
return $this->params[$paramname];
} else {
return null... | [
"public",
"function",
"param",
"(",
"$",
"paramname",
",",
"$",
"newvalue",
"=",
"''",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
">",
"1",
")",
"{",
"// Set new value.",
"$",
"this",
"->",
"params",
"(",
"array",
"(",
"$",
"paramname",
"=>",
"$... | Add a param to the params for this url.
The added param overrides existing one if they have the same name.
@param string $paramname name
@param string $newvalue Param value. If new value specified current value is overriden or parameter is added
@return mixed string parameter value, null if parameter does not exist | [
"Add",
"a",
"param",
"to",
"the",
"params",
"for",
"this",
"url",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/weblib.php#L457-L467 |
212,796 | moodle/moodle | lib/weblib.php | moodle_url.merge_overrideparams | protected function merge_overrideparams(array $overrideparams = null) {
$overrideparams = (array)$overrideparams;
$params = $this->params;
foreach ($overrideparams as $key => $value) {
if (is_int($key)) {
throw new coding_exception('Overridden parameters can not have ... | php | protected function merge_overrideparams(array $overrideparams = null) {
$overrideparams = (array)$overrideparams;
$params = $this->params;
foreach ($overrideparams as $key => $value) {
if (is_int($key)) {
throw new coding_exception('Overridden parameters can not have ... | [
"protected",
"function",
"merge_overrideparams",
"(",
"array",
"$",
"overrideparams",
"=",
"null",
")",
"{",
"$",
"overrideparams",
"=",
"(",
"array",
")",
"$",
"overrideparams",
";",
"$",
"params",
"=",
"$",
"this",
"->",
"params",
";",
"foreach",
"(",
"$... | Merges parameters and validates them
@param array $overrideparams
@return array merged parameters
@throws coding_exception | [
"Merges",
"parameters",
"and",
"validates",
"them"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/weblib.php#L476-L492 |
212,797 | moodle/moodle | lib/weblib.php | moodle_url.get_query_string | public function get_query_string($escaped = true, array $overrideparams = null) {
$arr = array();
if ($overrideparams !== null) {
$params = $this->merge_overrideparams($overrideparams);
} else {
$params = $this->params;
}
foreach ($params as $key => $val) ... | php | public function get_query_string($escaped = true, array $overrideparams = null) {
$arr = array();
if ($overrideparams !== null) {
$params = $this->merge_overrideparams($overrideparams);
} else {
$params = $this->params;
}
foreach ($params as $key => $val) ... | [
"public",
"function",
"get_query_string",
"(",
"$",
"escaped",
"=",
"true",
",",
"array",
"$",
"overrideparams",
"=",
"null",
")",
"{",
"$",
"arr",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"overrideparams",
"!==",
"null",
")",
"{",
"$",
"params",
... | Get the params as as a query string.
This method should not be used outside of this method.
@param bool $escaped Use & as params separator instead of plain &
@param array $overrideparams params to add to the output params, these
override existing ones with the same name.
@return string query string that can be ad... | [
"Get",
"the",
"params",
"as",
"as",
"a",
"query",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/weblib.php#L504-L529 |
212,798 | moodle/moodle | lib/weblib.php | moodle_url.out | public function out($escaped = true, array $overrideparams = null) {
global $CFG;
if (!is_bool($escaped)) {
debugging('Escape parameter must be of type boolean, '.gettype($escaped).' given instead.');
}
$url = $this;
// Allow url's to be rewritten by a plugin.
... | php | public function out($escaped = true, array $overrideparams = null) {
global $CFG;
if (!is_bool($escaped)) {
debugging('Escape parameter must be of type boolean, '.gettype($escaped).' given instead.');
}
$url = $this;
// Allow url's to be rewritten by a plugin.
... | [
"public",
"function",
"out",
"(",
"$",
"escaped",
"=",
"true",
",",
"array",
"$",
"overrideparams",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"escaped",
")",
")",
"{",
"debugging",
"(",
"'Escape parameter mu... | Output url.
If you use the returned URL in HTML code, you want the escaped ampersands. If you use
the returned URL in HTTP headers, you want $escaped=false.
@param bool $escaped Use & as params separator instead of plain &
@param array $overrideparams params to add to the output url, these override existing ones ... | [
"Output",
"url",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/weblib.php#L550-L571 |
212,799 | moodle/moodle | lib/weblib.php | moodle_url.raw_out | public function raw_out($escaped = true, array $overrideparams = null) {
if (!is_bool($escaped)) {
debugging('Escape parameter must be of type boolean, '.gettype($escaped).' given instead.');
}
$uri = $this->out_omit_querystring().$this->slashargument;
$querystring = $this-... | php | public function raw_out($escaped = true, array $overrideparams = null) {
if (!is_bool($escaped)) {
debugging('Escape parameter must be of type boolean, '.gettype($escaped).' given instead.');
}
$uri = $this->out_omit_querystring().$this->slashargument;
$querystring = $this-... | [
"public",
"function",
"raw_out",
"(",
"$",
"escaped",
"=",
"true",
",",
"array",
"$",
"overrideparams",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"escaped",
")",
")",
"{",
"debugging",
"(",
"'Escape parameter must be of type boolean, '",
".... | Output url without any rewrites
This is identical in signature and use to out() but doesn't call the rewrite handler.
@param bool $escaped Use & as params separator instead of plain &
@param array $overrideparams params to add to the output url, these override existing ones with the same name.
@return string Resu... | [
"Output",
"url",
"without",
"any",
"rewrites"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/weblib.php#L582-L598 |
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.