id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
214,100 | moodle/moodle | auth/oauth2/classes/auth.php | auth.is_ready_for_login_page | private function is_ready_for_login_page(\core\oauth2\issuer $issuer) {
return $issuer->get('enabled') &&
$issuer->is_configured() &&
!empty($issuer->get('showonloginpage'));
} | php | private function is_ready_for_login_page(\core\oauth2\issuer $issuer) {
return $issuer->get('enabled') &&
$issuer->is_configured() &&
!empty($issuer->get('showonloginpage'));
} | [
"private",
"function",
"is_ready_for_login_page",
"(",
"\\",
"core",
"\\",
"oauth2",
"\\",
"issuer",
"$",
"issuer",
")",
"{",
"return",
"$",
"issuer",
"->",
"get",
"(",
"'enabled'",
")",
"&&",
"$",
"issuer",
"->",
"is_configured",
"(",
")",
"&&",
"!",
"e... | Do some checks on the identity provider before showing it on the login page.
@param core\oauth2\issuer $issuer
@return boolean | [
"Do",
"some",
"checks",
"on",
"the",
"identity",
"provider",
"before",
"showing",
"it",
"on",
"the",
"login",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/auth.php#L173-L177 |
214,101 | moodle/moodle | auth/oauth2/classes/auth.php | auth.update_picture | private function update_picture($user) {
global $CFG, $DB, $USER;
require_once($CFG->libdir . '/filelib.php');
require_once($CFG->libdir . '/gdlib.php');
require_once($CFG->dirroot . '/user/lib.php');
$fs = get_file_storage();
$userid = $user->id;
if (!empty($us... | php | private function update_picture($user) {
global $CFG, $DB, $USER;
require_once($CFG->libdir . '/filelib.php');
require_once($CFG->libdir . '/gdlib.php');
require_once($CFG->dirroot . '/user/lib.php');
$fs = get_file_storage();
$userid = $user->id;
if (!empty($us... | [
"private",
"function",
"update_picture",
"(",
"$",
"user",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
",",
"$",
"USER",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/filelib.php'",
")",
";",
"require_once",
"(",
"$",
"CFG",
"->",
... | If this user has no picture - but we got one from oauth - set it.
@param stdClass $user
@return boolean True if the image was updated. | [
"If",
"this",
"user",
"has",
"no",
"picture",
"-",
"but",
"we",
"got",
"one",
"from",
"oauth",
"-",
"set",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/auth.php#L239-L302 |
214,102 | moodle/moodle | auth/oauth2/classes/auth.php | auth.update_user | private function update_user(array $externaldata, $userdata) {
$user = (object) [
'id' => $userdata->id,
];
// We can only update if the default authentication type of the user is set to OAuth2 as well. Otherwise, we might mess
// up the user data of other users that use dif... | php | private function update_user(array $externaldata, $userdata) {
$user = (object) [
'id' => $userdata->id,
];
// We can only update if the default authentication type of the user is set to OAuth2 as well. Otherwise, we might mess
// up the user data of other users that use dif... | [
"private",
"function",
"update_user",
"(",
"array",
"$",
"externaldata",
",",
"$",
"userdata",
")",
"{",
"$",
"user",
"=",
"(",
"object",
")",
"[",
"'id'",
"=>",
"$",
"userdata",
"->",
"id",
",",
"]",
";",
"// We can only update if the default authentication t... | Update user data according to data sent by authorization server.
@param array $externaldata data from authorization server
@param stdClass $userdata Current data of the user to be updated
@return stdClass The updated user record, or the existing one if there's nothing to be updated. | [
"Update",
"user",
"data",
"according",
"to",
"data",
"sent",
"by",
"authorization",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/auth.php#L311-L358 |
214,103 | moodle/moodle | auth/oauth2/classes/auth.php | auth.print_confirm_required | public function print_confirm_required($title, $message) {
global $PAGE, $OUTPUT, $CFG;
$PAGE->navbar->add($title);
$PAGE->set_title($title);
$PAGE->set_heading($PAGE->course->fullname);
echo $OUTPUT->header();
notice($message, "$CFG->wwwroot/index.php");
} | php | public function print_confirm_required($title, $message) {
global $PAGE, $OUTPUT, $CFG;
$PAGE->navbar->add($title);
$PAGE->set_title($title);
$PAGE->set_heading($PAGE->course->fullname);
echo $OUTPUT->header();
notice($message, "$CFG->wwwroot/index.php");
} | [
"public",
"function",
"print_confirm_required",
"(",
"$",
"title",
",",
"$",
"message",
")",
"{",
"global",
"$",
"PAGE",
",",
"$",
"OUTPUT",
",",
"$",
"CFG",
";",
"$",
"PAGE",
"->",
"navbar",
"->",
"add",
"(",
"$",
"title",
")",
";",
"$",
"PAGE",
"... | Print a page showing that a confirm email was sent with instructions.
@param string $title
@param string $message | [
"Print",
"a",
"page",
"showing",
"that",
"a",
"confirm",
"email",
"was",
"sent",
"with",
"instructions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/auth.php#L392-L400 |
214,104 | moodle/moodle | auth/cas/CAS/CAS/CookieJar.php | CAS_CookieJar.parseCookieHeader | protected function parseCookieHeader ($line, $defaultDomain)
{
if (!$defaultDomain) {
throw new CAS_InvalidArgumentException(
'$defaultDomain was not provided.'
);
}
// Set our default values
$cookie = array(
'domain' => $defaultDo... | php | protected function parseCookieHeader ($line, $defaultDomain)
{
if (!$defaultDomain) {
throw new CAS_InvalidArgumentException(
'$defaultDomain was not provided.'
);
}
// Set our default values
$cookie = array(
'domain' => $defaultDo... | [
"protected",
"function",
"parseCookieHeader",
"(",
"$",
"line",
",",
"$",
"defaultDomain",
")",
"{",
"if",
"(",
"!",
"$",
"defaultDomain",
")",
"{",
"throw",
"new",
"CAS_InvalidArgumentException",
"(",
"'$defaultDomain was not provided.'",
")",
";",
"}",
"// Set o... | Parse a single cookie header line.
Based on RFC2965 http://www.ietf.org/rfc/rfc2965.txt
@param string $line The header line.
@param string $defaultDomain The domain to use if none is specified in
the cookie.
@return array | [
"Parse",
"a",
"single",
"cookie",
"header",
"line",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/CookieJar.php#L161-L244 |
214,105 | moodle/moodle | auth/cas/CAS/CAS/CookieJar.php | CAS_CookieJar.discardCookie | protected function discardCookie ($cookie)
{
if (!isset($cookie['domain'])
|| !isset($cookie['path'])
|| !isset($cookie['path'])
) {
throw new CAS_InvalidArgumentException('Invalid Cookie array passed.');
}
foreach ($this->_cookies as $key => $old... | php | protected function discardCookie ($cookie)
{
if (!isset($cookie['domain'])
|| !isset($cookie['path'])
|| !isset($cookie['path'])
) {
throw new CAS_InvalidArgumentException('Invalid Cookie array passed.');
}
foreach ($this->_cookies as $key => $old... | [
"protected",
"function",
"discardCookie",
"(",
"$",
"cookie",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"cookie",
"[",
"'domain'",
"]",
")",
"||",
"!",
"isset",
"(",
"$",
"cookie",
"[",
"'path'",
"]",
")",
"||",
"!",
"isset",
"(",
"$",
"cookie",... | Discard an existing cookie
@param array $cookie An cookie
@return void
@access protected | [
"Discard",
"an",
"existing",
"cookie"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/CookieJar.php#L272-L289 |
214,106 | moodle/moodle | auth/cas/CAS/CAS/CookieJar.php | CAS_CookieJar.expireCookies | protected function expireCookies ()
{
foreach ($this->_cookies as $key => $cookie) {
if (isset($cookie['expires']) && $cookie['expires'] < time()) {
unset($this->_cookies[$key]);
}
}
} | php | protected function expireCookies ()
{
foreach ($this->_cookies as $key => $cookie) {
if (isset($cookie['expires']) && $cookie['expires'] < time()) {
unset($this->_cookies[$key]);
}
}
} | [
"protected",
"function",
"expireCookies",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_cookies",
"as",
"$",
"key",
"=>",
"$",
"cookie",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"cookie",
"[",
"'expires'",
"]",
")",
"&&",
"$",
"cookie",
"[",
"... | Go through our stored cookies and remove any that are expired.
@return void
@access protected | [
"Go",
"through",
"our",
"stored",
"cookies",
"and",
"remove",
"any",
"that",
"are",
"expired",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/CookieJar.php#L298-L305 |
214,107 | moodle/moodle | auth/cas/CAS/CAS/CookieJar.php | CAS_CookieJar.cookieMatchesTarget | protected function cookieMatchesTarget ($cookie, $target)
{
if (!is_array($target)) {
throw new CAS_InvalidArgumentException(
'$target must be an array of URL attributes as generated by parse_url().'
);
}
if (!isset($target['host'])) {
thro... | php | protected function cookieMatchesTarget ($cookie, $target)
{
if (!is_array($target)) {
throw new CAS_InvalidArgumentException(
'$target must be an array of URL attributes as generated by parse_url().'
);
}
if (!isset($target['host'])) {
thro... | [
"protected",
"function",
"cookieMatchesTarget",
"(",
"$",
"cookie",
",",
"$",
"target",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"target",
")",
")",
"{",
"throw",
"new",
"CAS_InvalidArgumentException",
"(",
"'$target must be an array of URL attributes as gene... | Answer true if cookie is applicable to a target.
@param array $cookie An array of cookie attributes.
@param array $target An array of URL attributes as generated by parse_url().
@return bool
@access private | [
"Answer",
"true",
"if",
"cookie",
"is",
"applicable",
"to",
"a",
"target",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/CookieJar.php#L317-L381 |
214,108 | moodle/moodle | competency/classes/privacy/provider.php | provider.delete_user_evidence_of_prior_learning | protected static function delete_user_evidence_of_prior_learning($userid) {
global $DB;
$usercontext = context_user::instance($userid);
$ueids = $DB->get_fieldset_select(user_evidence::TABLE, 'id', 'userid = :userid', ['userid' => $userid]);
if (empty($ueids)) {
return;
... | php | protected static function delete_user_evidence_of_prior_learning($userid) {
global $DB;
$usercontext = context_user::instance($userid);
$ueids = $DB->get_fieldset_select(user_evidence::TABLE, 'id', 'userid = :userid', ['userid' => $userid]);
if (empty($ueids)) {
return;
... | [
"protected",
"static",
"function",
"delete_user_evidence_of_prior_learning",
"(",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"usercontext",
"=",
"context_user",
"::",
"instance",
"(",
"$",
"userid",
")",
";",
"$",
"ueids",
"=",
"$",
"DB",
"->",
... | Delete evidence of prior learning.
@param int $userid The user ID.
@return void | [
"Delete",
"evidence",
"of",
"prior",
"learning",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L718-L737 |
214,109 | moodle/moodle | competency/classes/privacy/provider.php | provider.delete_user_plans | protected static function delete_user_plans($userid) {
global $DB;
$usercontext = context_user::instance($userid);
// Remove all the comments made on plans.
\core_comment\privacy\provider::delete_comments_for_all_users($usercontext, 'competency', 'plan');
// Find the user plan ... | php | protected static function delete_user_plans($userid) {
global $DB;
$usercontext = context_user::instance($userid);
// Remove all the comments made on plans.
\core_comment\privacy\provider::delete_comments_for_all_users($usercontext, 'competency', 'plan');
// Find the user plan ... | [
"protected",
"static",
"function",
"delete_user_plans",
"(",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"usercontext",
"=",
"context_user",
"::",
"instance",
"(",
"$",
"userid",
")",
";",
"// Remove all the comments made on plans.",
"\\",
"core_commen... | User plans.
@param int $userid The user ID.
@return void | [
"User",
"plans",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L745-L767 |
214,110 | moodle/moodle | competency/classes/privacy/provider.php | provider.delete_user_competencies | protected static function delete_user_competencies($userid) {
global $DB;
$usercontext = context_user::instance($userid);
// Remove all the comments made on user competencies.
\core_comment\privacy\provider::delete_comments_for_all_users($usercontext, 'competency', 'user_competency');
... | php | protected static function delete_user_competencies($userid) {
global $DB;
$usercontext = context_user::instance($userid);
// Remove all the comments made on user competencies.
\core_comment\privacy\provider::delete_comments_for_all_users($usercontext, 'competency', 'user_competency');
... | [
"protected",
"static",
"function",
"delete_user_competencies",
"(",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"usercontext",
"=",
"context_user",
"::",
"instance",
"(",
"$",
"userid",
")",
";",
"// Remove all the comments made on user competencies.",
"... | Delete user competency data.
@param int $userid The user ID.
@return void | [
"Delete",
"user",
"competency",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L775-L794 |
214,111 | moodle/moodle | competency/classes/privacy/provider.php | provider.export_user_data_in_user_contexts | protected static function export_user_data_in_user_contexts($userid, array $contexts) {
global $DB;
$mycontext = context_user::instance($userid);
$contextids = array_map(function($context) {
return $context->id;
}, $contexts);
$exportowncontext = in_array($mycontext-... | php | protected static function export_user_data_in_user_contexts($userid, array $contexts) {
global $DB;
$mycontext = context_user::instance($userid);
$contextids = array_map(function($context) {
return $context->id;
}, $contexts);
$exportowncontext = in_array($mycontext-... | [
"protected",
"static",
"function",
"export_user_data_in_user_contexts",
"(",
"$",
"userid",
",",
"array",
"$",
"contexts",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"mycontext",
"=",
"context_user",
"::",
"instance",
"(",
"$",
"userid",
")",
";",
"$",
"contex... | Export the user data in user context.
@param int $userid The user ID.
@param array $contexts The contexts.
@return void | [
"Export",
"the",
"user",
"data",
"in",
"user",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L826-L849 |
214,112 | moodle/moodle | competency/classes/privacy/provider.php | provider.export_user_data_in_system_context | protected static function export_user_data_in_system_context($userid) {
static::export_user_data_frameworks_in_context($userid, context_system::instance());
static::export_user_data_templates_in_context($userid, context_system::instance());
} | php | protected static function export_user_data_in_system_context($userid) {
static::export_user_data_frameworks_in_context($userid, context_system::instance());
static::export_user_data_templates_in_context($userid, context_system::instance());
} | [
"protected",
"static",
"function",
"export_user_data_in_system_context",
"(",
"$",
"userid",
")",
"{",
"static",
"::",
"export_user_data_frameworks_in_context",
"(",
"$",
"userid",
",",
"context_system",
"::",
"instance",
"(",
")",
")",
";",
"static",
"::",
"export_... | Export the user data in systen context.
@param int $userid The user ID.
@return void | [
"Export",
"the",
"user",
"data",
"in",
"systen",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L857-L860 |
214,113 | moodle/moodle | competency/classes/privacy/provider.php | provider.export_user_data_in_category_contexts | protected static function export_user_data_in_category_contexts($userid, array $contexts) {
$contexts = array_filter($contexts, function($context) {
return $context->contextlevel == CONTEXT_COURSECAT;
});
if (empty($contexts)) {
return;
}
foreach ($contex... | php | protected static function export_user_data_in_category_contexts($userid, array $contexts) {
$contexts = array_filter($contexts, function($context) {
return $context->contextlevel == CONTEXT_COURSECAT;
});
if (empty($contexts)) {
return;
}
foreach ($contex... | [
"protected",
"static",
"function",
"export_user_data_in_category_contexts",
"(",
"$",
"userid",
",",
"array",
"$",
"contexts",
")",
"{",
"$",
"contexts",
"=",
"array_filter",
"(",
"$",
"contexts",
",",
"function",
"(",
"$",
"context",
")",
"{",
"return",
"$",
... | Export the user data in category contexts.
@param int $userid The user ID.
@param array $contexts The contexts.
@return void | [
"Export",
"the",
"user",
"data",
"in",
"category",
"contexts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L869-L881 |
214,114 | moodle/moodle | competency/classes/privacy/provider.php | provider.export_user_data_in_course_contexts_rated_by_me | protected static function export_user_data_in_course_contexts_rated_by_me($userid, $courseids, $path,
performance_helper $helper) {
global $DB;
// Fetch all the records of competency proficiency in the course.
$ffields = competency_framework::get_sql_fields('f', 'f_');
$comp... | php | protected static function export_user_data_in_course_contexts_rated_by_me($userid, $courseids, $path,
performance_helper $helper) {
global $DB;
// Fetch all the records of competency proficiency in the course.
$ffields = competency_framework::get_sql_fields('f', 'f_');
$comp... | [
"protected",
"static",
"function",
"export_user_data_in_course_contexts_rated_by_me",
"(",
"$",
"userid",
",",
"$",
"courseids",
",",
"$",
"path",
",",
"performance_helper",
"$",
"helper",
")",
"{",
"global",
"$",
"DB",
";",
"// Fetch all the records of competency profi... | Export the ratings given in a course.
@param int $userid The user ID.
@param array $courseids The course IDs.
@param array $path The root path.
@param performance_helper $helper The performance helper.
@return void | [
"Export",
"the",
"ratings",
"given",
"in",
"a",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L965-L1016 |
214,115 | moodle/moodle | competency/classes/privacy/provider.php | provider.export_user_data_in_course_contexts_associations | protected static function export_user_data_in_course_contexts_associations($userid, $courseids, $path) {
global $DB;
// Fetch all the courses with associations we created or modified.
$compfields = competency::get_sql_fields('c', 'c_');
$ccfields = course_competency::get_sql_fields('cc'... | php | protected static function export_user_data_in_course_contexts_associations($userid, $courseids, $path) {
global $DB;
// Fetch all the courses with associations we created or modified.
$compfields = competency::get_sql_fields('c', 'c_');
$ccfields = course_competency::get_sql_fields('cc'... | [
"protected",
"static",
"function",
"export_user_data_in_course_contexts_associations",
"(",
"$",
"userid",
",",
"$",
"courseids",
",",
"$",
"path",
")",
"{",
"global",
"$",
"DB",
";",
"// Fetch all the courses with associations we created or modified.",
"$",
"compfields",
... | Export user data in course contexts related to linked competencies.
@param int $userid The user ID.
@param array $courseids The course IDs.
@param array $path The root path to export at.
@return void | [
"Export",
"user",
"data",
"in",
"course",
"contexts",
"related",
"to",
"linked",
"competencies",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L1026-L1064 |
214,116 | moodle/moodle | competency/classes/privacy/provider.php | provider.export_user_data_in_course_contexts_settings | protected static function export_user_data_in_course_contexts_settings($userid, $courseids, $path) {
global $DB;
// Fetch all the courses with associations we created or modified.
$ccsfields = course_competency_settings::get_sql_fields('ccs', 'ccs_');
list($insql, $inparams) = $DB->get_... | php | protected static function export_user_data_in_course_contexts_settings($userid, $courseids, $path) {
global $DB;
// Fetch all the courses with associations we created or modified.
$ccsfields = course_competency_settings::get_sql_fields('ccs', 'ccs_');
list($insql, $inparams) = $DB->get_... | [
"protected",
"static",
"function",
"export_user_data_in_course_contexts_settings",
"(",
"$",
"userid",
",",
"$",
"courseids",
",",
"$",
"path",
")",
"{",
"global",
"$",
"DB",
";",
"// Fetch all the courses with associations we created or modified.",
"$",
"ccsfields",
"=",... | Export user data in course contexts related to course settings.
@param int $userid The user ID.
@param array $courseids The course IDs.
@param array $path The root path to export at.
@return void | [
"Export",
"user",
"data",
"in",
"course",
"contexts",
"related",
"to",
"course",
"settings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L1074-L1100 |
214,117 | moodle/moodle | competency/classes/privacy/provider.php | provider.export_user_data_in_module_contexts | protected static function export_user_data_in_module_contexts($userid, array $contexts) {
global $DB;
$contexts = array_filter($contexts, function($context) {
return $context->contextlevel == CONTEXT_MODULE;
});
if (empty($contexts)) {
return;
}
... | php | protected static function export_user_data_in_module_contexts($userid, array $contexts) {
global $DB;
$contexts = array_filter($contexts, function($context) {
return $context->contextlevel == CONTEXT_MODULE;
});
if (empty($contexts)) {
return;
}
... | [
"protected",
"static",
"function",
"export_user_data_in_module_contexts",
"(",
"$",
"userid",
",",
"array",
"$",
"contexts",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"contexts",
"=",
"array_filter",
"(",
"$",
"contexts",
",",
"function",
"(",
"$",
"context",
... | Export the user data in module contexts.
@param int $userid The user whose data we're exporting.
@param array $contexts A list of contexts.
@return void | [
"Export",
"the",
"user",
"data",
"in",
"module",
"contexts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L1109-L1160 |
214,118 | moodle/moodle | competency/classes/privacy/provider.php | provider.export_user_data_competencies | protected static function export_user_data_competencies(context_user $context) {
global $DB;
$userid = $context->instanceid;
$path = [get_string('competencies', 'core_competency'), get_string('competencies', 'core_competency')];
$helper = new performance_helper();
$cfields = com... | php | protected static function export_user_data_competencies(context_user $context) {
global $DB;
$userid = $context->instanceid;
$path = [get_string('competencies', 'core_competency'), get_string('competencies', 'core_competency')];
$helper = new performance_helper();
$cfields = com... | [
"protected",
"static",
"function",
"export_user_data_competencies",
"(",
"context_user",
"$",
"context",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"userid",
"=",
"$",
"context",
"->",
"instanceid",
";",
"$",
"path",
"=",
"[",
"get_string",
"(",
"'competencies'"... | Export a user's competencies.
@param context_user $context The context of the user requesting the export.
@return void | [
"Export",
"a",
"user",
"s",
"competencies",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L1168-L1220 |
214,119 | moodle/moodle | competency/classes/privacy/provider.php | provider.export_user_data_user_evidence | protected static function export_user_data_user_evidence(context_user $context) {
global $DB;
$userid = $context->instanceid;
$path = [get_string('competencies', 'core_competency'), get_string('privacy:path:userevidence', 'core_competency')];
$uefields = user_evidence::get_sql_fields('u... | php | protected static function export_user_data_user_evidence(context_user $context) {
global $DB;
$userid = $context->instanceid;
$path = [get_string('competencies', 'core_competency'), get_string('privacy:path:userevidence', 'core_competency')];
$uefields = user_evidence::get_sql_fields('u... | [
"protected",
"static",
"function",
"export_user_data_user_evidence",
"(",
"context_user",
"$",
"context",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"userid",
"=",
"$",
"context",
"->",
"instanceid",
";",
"$",
"path",
"=",
"[",
"get_string",
"(",
"'competencies'... | Export the evidence of prior learning of a user.
@param context_user $context The context of the user we're exporting for.
@return void | [
"Export",
"the",
"evidence",
"of",
"prior",
"learning",
"of",
"a",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L1708-L1745 |
214,120 | moodle/moodle | competency/classes/privacy/provider.php | provider.transform_competency_brief | protected static function transform_competency_brief(competency $competency) {
global $OUTPUT;
$exporter = new \core_competency\external\competency_exporter($competency, ['context' => $competency->get_context()]);
$data = $exporter->export($OUTPUT);
return [
'idnumber' => $da... | php | protected static function transform_competency_brief(competency $competency) {
global $OUTPUT;
$exporter = new \core_competency\external\competency_exporter($competency, ['context' => $competency->get_context()]);
$data = $exporter->export($OUTPUT);
return [
'idnumber' => $da... | [
"protected",
"static",
"function",
"transform_competency_brief",
"(",
"competency",
"$",
"competency",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"exporter",
"=",
"new",
"\\",
"core_competency",
"\\",
"external",
"\\",
"competency_exporter",
"(",
"$",
"competenc... | Transform a competency into a brief description.
@param competency $competency The competency.
@return array | [
"Transform",
"a",
"competency",
"into",
"a",
"brief",
"description",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L2010-L2019 |
214,121 | moodle/moodle | competency/classes/privacy/provider.php | provider.transform_competency_grade | protected static function transform_competency_grade(competency $competency, $grade, performance_helper $helper) {
if ($grade === null) {
return '-';
}
$scale = $helper->get_scale_from_competency($competency);
return $scale->scale_items[$grade - 1];
} | php | protected static function transform_competency_grade(competency $competency, $grade, performance_helper $helper) {
if ($grade === null) {
return '-';
}
$scale = $helper->get_scale_from_competency($competency);
return $scale->scale_items[$grade - 1];
} | [
"protected",
"static",
"function",
"transform_competency_grade",
"(",
"competency",
"$",
"competency",
",",
"$",
"grade",
",",
"performance_helper",
"$",
"helper",
")",
"{",
"if",
"(",
"$",
"grade",
"===",
"null",
")",
"{",
"return",
"'-'",
";",
"}",
"$",
... | Transform a competency rating.
@param competency $competency The competency.
@param int $grade The grade.
@param performance_helper $helper The performance helper.
@return string | [
"Transform",
"a",
"competency",
"rating",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L2029-L2035 |
214,122 | moodle/moodle | competency/classes/privacy/provider.php | provider.transform_evidence | protected static function transform_evidence($userid, evidence $evidence, competency $competency, performance_helper $helper) {
$action = $evidence->get('action');
$actiontxt = '?';
if ($action == evidence::ACTION_LOG) {
$actiontxt = get_string('privacy:evidence:action:log', 'core_co... | php | protected static function transform_evidence($userid, evidence $evidence, competency $competency, performance_helper $helper) {
$action = $evidence->get('action');
$actiontxt = '?';
if ($action == evidence::ACTION_LOG) {
$actiontxt = get_string('privacy:evidence:action:log', 'core_co... | [
"protected",
"static",
"function",
"transform_evidence",
"(",
"$",
"userid",
",",
"evidence",
"$",
"evidence",
",",
"competency",
"$",
"competency",
",",
"performance_helper",
"$",
"helper",
")",
"{",
"$",
"action",
"=",
"$",
"evidence",
"->",
"get",
"(",
"'... | Transform an evidence.
@param int $userid The user ID we are exporting for.
@param evidence $evidence The evidence.
@param competency $competency The associated competency.
@param performance_helper $helper The performance helper.
@return array | [
"Transform",
"an",
"evidence",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L2046-L2071 |
214,123 | moodle/moodle | competency/classes/privacy/provider.php | provider.transform_framework_brief | protected static function transform_framework_brief(competency_framework $framework) {
global $OUTPUT;
$exporter = new \core_competency\external\competency_framework_exporter($framework);
$data = $exporter->export($OUTPUT);
return [
'name' => $data->shortname,
'id... | php | protected static function transform_framework_brief(competency_framework $framework) {
global $OUTPUT;
$exporter = new \core_competency\external\competency_framework_exporter($framework);
$data = $exporter->export($OUTPUT);
return [
'name' => $data->shortname,
'id... | [
"protected",
"static",
"function",
"transform_framework_brief",
"(",
"competency_framework",
"$",
"framework",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"exporter",
"=",
"new",
"\\",
"core_competency",
"\\",
"external",
"\\",
"competency_framework_exporter",
"(",
... | Transform a framework into a brief description.
@param competency_framework $framework The framework.
@return array | [
"Transform",
"a",
"framework",
"into",
"a",
"brief",
"description",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L2079-L2088 |
214,124 | moodle/moodle | competency/classes/privacy/provider.php | provider.transform_template_brief | protected static function transform_template_brief(template $template) {
global $OUTPUT;
$exporter = new \core_competency\external\template_exporter($template);
$data = $exporter->export($OUTPUT);
return [
'name' => $data->shortname,
'description' => $data->descri... | php | protected static function transform_template_brief(template $template) {
global $OUTPUT;
$exporter = new \core_competency\external\template_exporter($template);
$data = $exporter->export($OUTPUT);
return [
'name' => $data->shortname,
'description' => $data->descri... | [
"protected",
"static",
"function",
"transform_template_brief",
"(",
"template",
"$",
"template",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"exporter",
"=",
"new",
"\\",
"core_competency",
"\\",
"external",
"\\",
"template_exporter",
"(",
"$",
"template",
")",... | Transform a template into a brief description.
@param template $template The Template.
@return array | [
"Transform",
"a",
"template",
"into",
"a",
"brief",
"description",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L2096-L2104 |
214,125 | moodle/moodle | competency/classes/privacy/provider.php | provider.transform_user_competency | protected static function transform_user_competency($userid, $uc, competency $competency, performance_helper $helper) {
$data = [
'proficient' => static::transform_proficiency($uc->get('proficiency')),
'rating' => static::transform_competency_grade($competency, $uc->get('grade'), $helper... | php | protected static function transform_user_competency($userid, $uc, competency $competency, performance_helper $helper) {
$data = [
'proficient' => static::transform_proficiency($uc->get('proficiency')),
'rating' => static::transform_competency_grade($competency, $uc->get('grade'), $helper... | [
"protected",
"static",
"function",
"transform_user_competency",
"(",
"$",
"userid",
",",
"$",
"uc",
",",
"competency",
"$",
"competency",
",",
"performance_helper",
"$",
"helper",
")",
"{",
"$",
"data",
"=",
"[",
"'proficient'",
"=>",
"static",
"::",
"transfor... | Transform user competency.
@param int $userid The user ID we are exporting for.
@param user_competency|user_competency_plan|user_competency_course $uc The user competency.
@param competency $competency The associated competency.
@param performance_helper $helper The performance helper.
@return array | [
"Transform",
"user",
"competency",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L2125-L2142 |
214,126 | moodle/moodle | competency/classes/privacy/provider.php | provider.transform_user_evidence | protected static function transform_user_evidence($userid, user_evidence $ue) {
$options = ['context' => $ue->get_context()];
return [
'name' => format_string($ue->get('name'), true, $options),
'description' => format_text($ue->get('description'), $ue->get('descriptionformat'), $... | php | protected static function transform_user_evidence($userid, user_evidence $ue) {
$options = ['context' => $ue->get_context()];
return [
'name' => format_string($ue->get('name'), true, $options),
'description' => format_text($ue->get('description'), $ue->get('descriptionformat'), $... | [
"protected",
"static",
"function",
"transform_user_evidence",
"(",
"$",
"userid",
",",
"user_evidence",
"$",
"ue",
")",
"{",
"$",
"options",
"=",
"[",
"'context'",
"=>",
"$",
"ue",
"->",
"get_context",
"(",
")",
"]",
";",
"return",
"[",
"'name'",
"=>",
"... | Transform a user evidence.
@param int $userid The user we are exporting for.
@param user_evidence $ue The evidence of prior learning.
@return array | [
"Transform",
"a",
"user",
"evidence",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L2151-L2162 |
214,127 | moodle/moodle | competency/classes/privacy/provider.php | provider.recordset_loop_and_export | protected static function recordset_loop_and_export(moodle_recordset $recordset, $splitkey, $initial,
callable $reducer, callable $export) {
$data = $initial;
$lastid = null;
foreach ($recordset as $record) {
if ($lastid && $record->{$splitkey} != $lastid) {
... | php | protected static function recordset_loop_and_export(moodle_recordset $recordset, $splitkey, $initial,
callable $reducer, callable $export) {
$data = $initial;
$lastid = null;
foreach ($recordset as $record) {
if ($lastid && $record->{$splitkey} != $lastid) {
... | [
"protected",
"static",
"function",
"recordset_loop_and_export",
"(",
"moodle_recordset",
"$",
"recordset",
",",
"$",
"splitkey",
",",
"$",
"initial",
",",
"callable",
"$",
"reducer",
",",
"callable",
"$",
"export",
")",
"{",
"$",
"data",
"=",
"$",
"initial",
... | Loop and export from a recordset.
@param moodle_recordset $recordset The recordset.
@param string $splitkey The record key to determine when to export.
@param mixed $initial The initial data to reduce from.
@param callable $reducer The function to return the dataset, receives current dataset, and the current record.
@... | [
"Loop",
"and",
"export",
"from",
"a",
"recordset",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/privacy/provider.php#L2174-L2193 |
214,128 | moodle/moodle | lib/form/filepicker.php | MoodleQuickForm_filepicker.exportValue | function exportValue(&$submitValues, $assoc = false) {
global $USER;
$draftitemid = $this->_findValue($submitValues);
if (null === $draftitemid) {
$draftitemid = $this->getValue();
}
// make sure max one file is present and it is not too big
if (!is_null($dr... | php | function exportValue(&$submitValues, $assoc = false) {
global $USER;
$draftitemid = $this->_findValue($submitValues);
if (null === $draftitemid) {
$draftitemid = $this->getValue();
}
// make sure max one file is present and it is not too big
if (!is_null($dr... | [
"function",
"exportValue",
"(",
"&",
"$",
"submitValues",
",",
"$",
"assoc",
"=",
"false",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"draftitemid",
"=",
"$",
"this",
"->",
"_findValue",
"(",
"$",
"submitValues",
")",
";",
"if",
"(",
"null",
"===",
"... | export uploaded file
@param array $submitValues values submitted.
@param bool $assoc specifies if returned array is associative
@return array | [
"export",
"uploaded",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/filepicker.php#L205-L234 |
214,129 | moodle/moodle | lib/searchlib.php | search_parser.inquotedstring | function inquotedstring($content){
if (strlen($content) < 2) { // State exit or missing parameter.
return true;
}
// Strip off the opening quote and add the reminder to the parsed token array.
$this->tokens[] = new search_token(TOKEN_STRING,substr($content,1));
return... | php | function inquotedstring($content){
if (strlen($content) < 2) { // State exit or missing parameter.
return true;
}
// Strip off the opening quote and add the reminder to the parsed token array.
$this->tokens[] = new search_token(TOKEN_STRING,substr($content,1));
return... | [
"function",
"inquotedstring",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"content",
")",
"<",
"2",
")",
"{",
"// State exit or missing parameter.",
"return",
"true",
";",
"}",
"// Strip off the opening quote and add the reminder to the parsed token ar... | State entered when we've seen a quoted string. Potentially emits a token. | [
"State",
"entered",
"when",
"we",
"ve",
"seen",
"a",
"quoted",
"string",
".",
"Potentially",
"emits",
"a",
"token",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/searchlib.php#L363-L370 |
214,130 | moodle/moodle | admin/tool/log/store/database/classes/log/store.php | store.init | protected function init() {
if (isset($this->extdb)) {
return !empty($this->extdb);
}
$dbdriver = $this->get_config('dbdriver');
if (empty($dbdriver)) {
$this->extdb = false;
return false;
}
list($dblibrary, $dbtype) = explode('/', $db... | php | protected function init() {
if (isset($this->extdb)) {
return !empty($this->extdb);
}
$dbdriver = $this->get_config('dbdriver');
if (empty($dbdriver)) {
$this->extdb = false;
return false;
}
list($dblibrary, $dbtype) = explode('/', $db... | [
"protected",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"extdb",
")",
")",
"{",
"return",
"!",
"empty",
"(",
"$",
"this",
"->",
"extdb",
")",
";",
"}",
"$",
"dbdriver",
"=",
"$",
"this",
"->",
"get_config",
"("... | Setup the Database.
@return bool | [
"Setup",
"the",
"Database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/store/database/classes/log/store.php#L70-L112 |
214,131 | moodle/moodle | admin/tool/log/store/database/classes/log/store.php | store.insert_event_entries | protected function insert_event_entries($evententries) {
if (!$this->init()) {
return;
}
if (!$dbtable = $this->get_config('dbtable')) {
return;
}
try {
$this->extdb->insert_records($dbtable, $evententries);
} catch (\moodle_exception $... | php | protected function insert_event_entries($evententries) {
if (!$this->init()) {
return;
}
if (!$dbtable = $this->get_config('dbtable')) {
return;
}
try {
$this->extdb->insert_records($dbtable, $evententries);
} catch (\moodle_exception $... | [
"protected",
"function",
"insert_event_entries",
"(",
"$",
"evententries",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"init",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"$",
"dbtable",
"=",
"$",
"this",
"->",
"get_config",
"(",
"'dbtab... | Insert events in bulk to the database.
@param array $evententries raw event data | [
"Insert",
"events",
"in",
"bulk",
"to",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/store/database/classes/log/store.php#L140-L152 |
214,132 | moodle/moodle | admin/tool/log/store/database/classes/log/store.php | store.get_events_select | public function get_events_select($selectwhere, array $params, $sort, $limitfrom, $limitnum) {
if (!$this->init()) {
return array();
}
if (!$dbtable = $this->get_config('dbtable')) {
return array();
}
$sort = self::tweak_sort_by_id($sort);
$even... | php | public function get_events_select($selectwhere, array $params, $sort, $limitfrom, $limitnum) {
if (!$this->init()) {
return array();
}
if (!$dbtable = $this->get_config('dbtable')) {
return array();
}
$sort = self::tweak_sort_by_id($sort);
$even... | [
"public",
"function",
"get_events_select",
"(",
"$",
"selectwhere",
",",
"array",
"$",
"params",
",",
"$",
"sort",
",",
"$",
"limitfrom",
",",
"$",
"limitnum",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"init",
"(",
")",
")",
"{",
"return",
"array"... | Get an array of events based on the passed on params.
@param string $selectwhere select conditions.
@param array $params params.
@param string $sort sortorder.
@param int $limitfrom limit constraints.
@param int $limitnum limit constraints.
@return array|\core\event\base[] array of events. | [
"Get",
"an",
"array",
"of",
"events",
"based",
"on",
"the",
"passed",
"on",
"params",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/store/database/classes/log/store.php#L165-L186 |
214,133 | moodle/moodle | admin/tool/log/store/database/classes/log/store.php | store.get_events_select_count | public function get_events_select_count($selectwhere, array $params) {
if (!$this->init()) {
return 0;
}
if (!$dbtable = $this->get_config('dbtable')) {
return 0;
}
return $this->extdb->count_records_select($dbtable, $selectwhere, $params);
} | php | public function get_events_select_count($selectwhere, array $params) {
if (!$this->init()) {
return 0;
}
if (!$dbtable = $this->get_config('dbtable')) {
return 0;
}
return $this->extdb->count_records_select($dbtable, $selectwhere, $params);
} | [
"public",
"function",
"get_events_select_count",
"(",
"$",
"selectwhere",
",",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"init",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"!",
"$",
"dbtable",
"=",
"$",
"this... | Get number of events present for the given select clause.
@param string $selectwhere select conditions.
@param array $params params.
@return int Number of events available for the given conditions | [
"Get",
"number",
"of",
"events",
"present",
"for",
"the",
"given",
"select",
"clause",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/store/database/classes/log/store.php#L253-L263 |
214,134 | moodle/moodle | admin/tool/log/store/database/classes/log/store.php | store.dispose | public function dispose() {
$this->helper_dispose();
if ($this->extdb) {
$this->extdb->dispose();
}
$this->extdb = null;
} | php | public function dispose() {
$this->helper_dispose();
if ($this->extdb) {
$this->extdb->dispose();
}
$this->extdb = null;
} | [
"public",
"function",
"dispose",
"(",
")",
"{",
"$",
"this",
"->",
"helper_dispose",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"extdb",
")",
"{",
"$",
"this",
"->",
"extdb",
"->",
"dispose",
"(",
")",
";",
"}",
"$",
"this",
"->",
"extdb",
"=",... | Dispose off database connection after pushing any buffered events to the database. | [
"Dispose",
"off",
"database",
"connection",
"after",
"pushing",
"any",
"buffered",
"events",
"to",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/store/database/classes/log/store.php#L304-L310 |
214,135 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.process_stage | public function process_stage($stage, $alreadystolen=false) {
$this->set('stage', $stage);
if ($alreadystolen) {
$this->alreadystolen[$stage] = true;
} else {
if (!array_key_exists($stage, $this->alreadystolen)) {
$this->alreadystolen[$stage] = false;
... | php | public function process_stage($stage, $alreadystolen=false) {
$this->set('stage', $stage);
if ($alreadystolen) {
$this->alreadystolen[$stage] = true;
} else {
if (!array_key_exists($stage, $this->alreadystolen)) {
$this->alreadystolen[$stage] = false;
... | [
"public",
"function",
"process_stage",
"(",
"$",
"stage",
",",
"$",
"alreadystolen",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"'stage'",
",",
"$",
"stage",
")",
";",
"if",
"(",
"$",
"alreadystolen",
")",
"{",
"$",
"this",
"->",
"already... | Process the given stage calling whatever functions are necessary
@param int $stage (see PORTFOLIO_STAGE_* constants)
@param bool $alreadystolen used to avoid letting plugins steal control twice.
@return bool whether or not to process the next stage. this is important as the function is called recursively. | [
"Process",
"the",
"given",
"stage",
"calling",
"whatever",
"functions",
"are",
"necessary"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L195-L249 |
214,136 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.process_stage_queueorwait | public function process_stage_queueorwait() {
global $DB;
$wait = $this->instance->get_export_config('wait');
if (empty($wait)) {
$DB->set_field('portfolio_tempdata', 'queued', 1, array('id' => $this->id));
$this->queued = true;
return $this->process_stage_fi... | php | public function process_stage_queueorwait() {
global $DB;
$wait = $this->instance->get_export_config('wait');
if (empty($wait)) {
$DB->set_field('portfolio_tempdata', 'queued', 1, array('id' => $this->id));
$this->queued = true;
return $this->process_stage_fi... | [
"public",
"function",
"process_stage_queueorwait",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"wait",
"=",
"$",
"this",
"->",
"instance",
"->",
"get_export_config",
"(",
"'wait'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"wait",
")",
")",
"{",
"$",
... | Processes the 'queueornext' stage of the export
@return bool whether or not to process the next stage. this is important as the control function is called recursively. | [
"Processes",
"the",
"queueornext",
"stage",
"of",
"the",
"export"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L436-L446 |
214,137 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.process_stage_package | public function process_stage_package() {
// now we've agreed on a format,
// the caller is given control to package it up however it wants
// and then the portfolio plugin is given control to do whatever it wants.
try {
$this->caller->prepare_package();
} catch (port... | php | public function process_stage_package() {
// now we've agreed on a format,
// the caller is given control to package it up however it wants
// and then the portfolio plugin is given control to do whatever it wants.
try {
$this->caller->prepare_package();
} catch (port... | [
"public",
"function",
"process_stage_package",
"(",
")",
"{",
"// now we've agreed on a format,",
"// the caller is given control to package it up however it wants",
"// and then the portfolio plugin is given control to do whatever it wants.",
"try",
"{",
"$",
"this",
"->",
"caller",
"... | Processes the 'package' stage of the export
@return bool whether or not to process the next stage. this is important as the control function is called recursively.
@throws portfolio_export_exception | [
"Processes",
"the",
"package",
"stage",
"of",
"the",
"export"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L454-L476 |
214,138 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.process_stage_cleanup | public function process_stage_cleanup($pullok=false) {
global $CFG, $DB;
if (!$pullok && $this->get('instance') && !$this->get('instance')->is_push()) {
return true;
}
if ($this->get('instance')) {
// might not be set - before export really starts
$th... | php | public function process_stage_cleanup($pullok=false) {
global $CFG, $DB;
if (!$pullok && $this->get('instance') && !$this->get('instance')->is_push()) {
return true;
}
if ($this->get('instance')) {
// might not be set - before export really starts
$th... | [
"public",
"function",
"process_stage_cleanup",
"(",
"$",
"pullok",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"if",
"(",
"!",
"$",
"pullok",
"&&",
"$",
"this",
"->",
"get",
"(",
"'instance'",
")",
"&&",
"!",
"$",
"this",
"->... | Processes the 'cleanup' stage of the export
@param bool $pullok normally cleanup is deferred for pull plugins until after the file is requested from portfolio/file.php
if you want to clean up earlier, pass true here (defaults to false)
@return bool whether or not to process the next stage. this is important as the con... | [
"Processes",
"the",
"cleanup",
"stage",
"of",
"the",
"export"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L485-L500 |
214,139 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.process_stage_send | public function process_stage_send() {
// send the file
try {
$this->instance->send_package();
}
catch (portfolio_plugin_exception $e) {
// not catching anything more general here. plugins with dependencies on other libraries that throw exceptions should catch and... | php | public function process_stage_send() {
// send the file
try {
$this->instance->send_package();
}
catch (portfolio_plugin_exception $e) {
// not catching anything more general here. plugins with dependencies on other libraries that throw exceptions should catch and... | [
"public",
"function",
"process_stage_send",
"(",
")",
"{",
"// send the file",
"try",
"{",
"$",
"this",
"->",
"instance",
"->",
"send_package",
"(",
")",
";",
"}",
"catch",
"(",
"portfolio_plugin_exception",
"$",
"e",
")",
"{",
"// not catching anything more gener... | Processes the 'send' stage of the export
@return bool whether or not to process the next stage. this is important as the control function is called recursively. | [
"Processes",
"the",
"send",
"stage",
"of",
"the",
"export"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L507-L522 |
214,140 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.log_transfer | public function log_transfer() {
global $DB;
$l = array(
'userid' => $this->user->id,
'portfolio' => $this->instance->get('id'),
'caller_file'=> '',
'caller_component' => $this->callercomponent,
'caller_sha1' => $this->caller->get_sha1(),
... | php | public function log_transfer() {
global $DB;
$l = array(
'userid' => $this->user->id,
'portfolio' => $this->instance->get('id'),
'caller_file'=> '',
'caller_component' => $this->callercomponent,
'caller_sha1' => $this->caller->get_sha1(),
... | [
"public",
"function",
"log_transfer",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"l",
"=",
"array",
"(",
"'userid'",
"=>",
"$",
"this",
"->",
"user",
"->",
"id",
",",
"'portfolio'",
"=>",
"$",
"this",
"->",
"instance",
"->",
"get",
"(",
"'id'",
... | Log the transfer
this should only be called after the file has been sent
either via push, or sent from a pull request. | [
"Log",
"the",
"transfer"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L530-L545 |
214,141 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.process_stage_finished | public function process_stage_finished($queued=false) {
global $OUTPUT;
$returnurl = $this->caller->get_return_url();
$continueurl = $this->instance->get_interactive_continue_url();
$extras = $this->instance->get_extra_finish_options();
$key = 'exportcomplete';
if ($queu... | php | public function process_stage_finished($queued=false) {
global $OUTPUT;
$returnurl = $this->caller->get_return_url();
$continueurl = $this->instance->get_interactive_continue_url();
$extras = $this->instance->get_extra_finish_options();
$key = 'exportcomplete';
if ($queu... | [
"public",
"function",
"process_stage_finished",
"(",
"$",
"queued",
"=",
"false",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"returnurl",
"=",
"$",
"this",
"->",
"caller",
"->",
"get_return_url",
"(",
")",
";",
"$",
"continueurl",
"=",
"$",
"this",
"->... | Processes the 'finish' stage of the export
@param bool $queued let the process to be queued
@return bool whether or not to process the next stage. this is important as the control function is called recursively. | [
"Processes",
"the",
"finish",
"stage",
"of",
"the",
"export"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L564-L581 |
214,142 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.print_header | public function print_header($headingstr, $summary=true) {
global $OUTPUT, $PAGE;
$titlestr = get_string('exporting', 'portfolio');
$headerstr = get_string('exporting', 'portfolio');
$PAGE->set_title($titlestr);
$PAGE->set_heading($headerstr);
echo $OUTPUT->header();
... | php | public function print_header($headingstr, $summary=true) {
global $OUTPUT, $PAGE;
$titlestr = get_string('exporting', 'portfolio');
$headerstr = get_string('exporting', 'portfolio');
$PAGE->set_title($titlestr);
$PAGE->set_heading($headerstr);
echo $OUTPUT->header();
... | [
"public",
"function",
"print_header",
"(",
"$",
"headingstr",
",",
"$",
"summary",
"=",
"true",
")",
"{",
"global",
"$",
"OUTPUT",
",",
"$",
"PAGE",
";",
"$",
"titlestr",
"=",
"get_string",
"(",
"'exporting'",
",",
"'portfolio'",
")",
";",
"$",
"headerst... | Local print header function to be reused across the export
@param string $headingstr full language string
@param bool $summary (optional) to print summary, default is set to true
@return void | [
"Local",
"print",
"header",
"function",
"to",
"be",
"reused",
"across",
"the",
"export"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L591-L615 |
214,143 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.cancel_request | public function cancel_request($logreturn=false) {
global $CFG;
if (!isset($this)) {
return;
}
$this->process_stage_cleanup(true);
if ($logreturn) {
redirect($CFG->wwwroot . '/user/portfoliologs.php');
}
redirect($this->caller->get_return_u... | php | public function cancel_request($logreturn=false) {
global $CFG;
if (!isset($this)) {
return;
}
$this->process_stage_cleanup(true);
if ($logreturn) {
redirect($CFG->wwwroot . '/user/portfoliologs.php');
}
redirect($this->caller->get_return_u... | [
"public",
"function",
"cancel_request",
"(",
"$",
"logreturn",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"process_stage_cleanup",
"(",
"true",
"... | Cancels a potfolio request and cleans up the tempdata
and redirects the user back to where they started
@param bool $logreturn options to return to porfolio log or caller return page
@return void
@uses exit | [
"Cancels",
"a",
"potfolio",
"request",
"and",
"cleans",
"up",
"the",
"tempdata",
"and",
"redirects",
"the",
"user",
"back",
"to",
"where",
"they",
"started"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L625-L636 |
214,144 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.save | public function save() {
global $DB;
if (empty($this->id)) {
$r = (object)array(
'data' => base64_encode(serialize($this)),
'expirytime' => time() + (60*60*24),
'userid' => $this->user->id,
'instance' => (empty($this->instance))... | php | public function save() {
global $DB;
if (empty($this->id)) {
$r = (object)array(
'data' => base64_encode(serialize($this)),
'expirytime' => time() + (60*60*24),
'userid' => $this->user->id,
'instance' => (empty($this->instance))... | [
"public",
"function",
"save",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"id",
")",
")",
"{",
"$",
"r",
"=",
"(",
"object",
")",
"array",
"(",
"'data'",
"=>",
"base64_encode",
"(",
"serialize",
"(",
"$",
... | Writes out the contents of this object and all its data to the portfolio_tempdata table and sets the 'id' field.
@return void | [
"Writes",
"out",
"the",
"contents",
"of",
"this",
"object",
"and",
"all",
"its",
"data",
"to",
"the",
"portfolio_tempdata",
"table",
"and",
"sets",
"the",
"id",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L643-L666 |
214,145 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.rewaken_object | public static function rewaken_object($id) {
global $DB, $CFG;
require_once($CFG->libdir . '/filelib.php');
require_once($CFG->libdir . '/portfolio/exporter.php');
require_once($CFG->libdir . '/portfolio/caller.php');
require_once($CFG->libdir . '/portfolio/plugin.php');
... | php | public static function rewaken_object($id) {
global $DB, $CFG;
require_once($CFG->libdir . '/filelib.php');
require_once($CFG->libdir . '/portfolio/exporter.php');
require_once($CFG->libdir . '/portfolio/caller.php');
require_once($CFG->libdir . '/portfolio/plugin.php');
... | [
"public",
"static",
"function",
"rewaken_object",
"(",
"$",
"id",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/filelib.php'",
")",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".... | Rewakens the data from the database given the id.
Makes sure to load the required files with the class definitions
@param int $id id of data
@return portfolio_exporter | [
"Rewakens",
"the",
"data",
"from",
"the",
"database",
"given",
"the",
"id",
".",
"Makes",
"sure",
"to",
"load",
"the",
"required",
"files",
"with",
"the",
"class",
"definitions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L675-L710 |
214,146 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.verify_rewaken | public function verify_rewaken($readonly=false) {
global $USER, $CFG;
if ($this->get('user')->id != $USER->id) { // make sure it belongs to the right user
throw new portfolio_exception('notyours', 'portfolio');
}
if (!$readonly && $this->get('instance') && !$this->get('instan... | php | public function verify_rewaken($readonly=false) {
global $USER, $CFG;
if ($this->get('user')->id != $USER->id) { // make sure it belongs to the right user
throw new portfolio_exception('notyours', 'portfolio');
}
if (!$readonly && $this->get('instance') && !$this->get('instan... | [
"public",
"function",
"verify_rewaken",
"(",
"$",
"readonly",
"=",
"false",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"CFG",
";",
"if",
"(",
"$",
"this",
"->",
"get",
"(",
"'user'",
")",
"->",
"id",
"!=",
"$",
"USER",
"->",
"id",
")",
"{",
"// m... | Verifies a rewoken object.
Checks to make sure it belongs to the same user and session as is currently in use.
@param bool $readonly if we're reawakening this for a user to just display in the log view, don't verify the sessionkey
@throws portfolio_exception | [
"Verifies",
"a",
"rewoken",
"object",
".",
"Checks",
"to",
"make",
"sure",
"it",
"belongs",
"to",
"the",
"same",
"user",
"and",
"session",
"as",
"is",
"currently",
"in",
"use",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L736-L757 |
214,147 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.copy_existing_file | public function copy_existing_file($oldfile) {
if (array_key_exists($oldfile->get_contenthash(), $this->newfilehashes)) {
return $this->newfilehashes[$oldfile->get_contenthash()];
}
$fs = get_file_storage();
$file_record = $this->new_file_record_base($oldfile->get_filename())... | php | public function copy_existing_file($oldfile) {
if (array_key_exists($oldfile->get_contenthash(), $this->newfilehashes)) {
return $this->newfilehashes[$oldfile->get_contenthash()];
}
$fs = get_file_storage();
$file_record = $this->new_file_record_base($oldfile->get_filename())... | [
"public",
"function",
"copy_existing_file",
"(",
"$",
"oldfile",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"oldfile",
"->",
"get_contenthash",
"(",
")",
",",
"$",
"this",
"->",
"newfilehashes",
")",
")",
"{",
"return",
"$",
"this",
"->",
"newfileh... | Copies a file from somewhere else in moodle
to the portfolio temporary working directory
associated with this export
@param stored_file $oldfile existing stored file object
@return stored_file|bool new file object | [
"Copies",
"a",
"file",
"from",
"somewhere",
"else",
"in",
"moodle",
"to",
"the",
"portfolio",
"temporary",
"working",
"directory",
"associated",
"with",
"this",
"export"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L766-L782 |
214,148 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.write_new_file | public function write_new_file($content, $name, $manifest=true) {
$fs = get_file_storage();
$file_record = $this->new_file_record_base($name);
if (empty($manifest) && ($dir = $this->get('format')->get_file_directory())) {
$file_record->filepath = '/' . $dir . '/';
}
r... | php | public function write_new_file($content, $name, $manifest=true) {
$fs = get_file_storage();
$file_record = $this->new_file_record_base($name);
if (empty($manifest) && ($dir = $this->get('format')->get_file_directory())) {
$file_record->filepath = '/' . $dir . '/';
}
r... | [
"public",
"function",
"write_new_file",
"(",
"$",
"content",
",",
"$",
"name",
",",
"$",
"manifest",
"=",
"true",
")",
"{",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"$",
"file_record",
"=",
"$",
"this",
"->",
"new_file_record_base",
"(",
"$",
... | Writes out some content to a file
in the portfolio temporary working directory
associated with this export.
@param string $content content to write
@param string $name filename to use
@param bool $manifest whether this is the main file or an secondary file (eg attachment)
@return stored_file | [
"Writes",
"out",
"some",
"content",
"to",
"a",
"file",
"in",
"the",
"portfolio",
"temporary",
"working",
"directory",
"associated",
"with",
"this",
"export",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L794-L801 |
214,149 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.zip_tempfiles | public function zip_tempfiles($filename='portfolio-export.zip', $filepath='/final/') {
$zipper = new zip_packer();
list ($contextid, $component, $filearea, $itemid) = array_values($this->get_base_filearea());
if ($newfile = $zipper->archive_to_storage($this->get_tempfiles(), $contextid, $compon... | php | public function zip_tempfiles($filename='portfolio-export.zip', $filepath='/final/') {
$zipper = new zip_packer();
list ($contextid, $component, $filearea, $itemid) = array_values($this->get_base_filearea());
if ($newfile = $zipper->archive_to_storage($this->get_tempfiles(), $contextid, $compon... | [
"public",
"function",
"zip_tempfiles",
"(",
"$",
"filename",
"=",
"'portfolio-export.zip'",
",",
"$",
"filepath",
"=",
"'/final/'",
")",
"{",
"$",
"zipper",
"=",
"new",
"zip_packer",
"(",
")",
";",
"list",
"(",
"$",
"contextid",
",",
"$",
"component",
",",... | Zips all files in the temporary directory
@param string $filename name of resulting zipfile (optional, defaults to portfolio-export.zip)
@param string $filepath subpath in the filearea (optional, defaults to final)
@return stored_file|bool resulting stored_file object, or false | [
"Zips",
"all",
"files",
"in",
"the",
"temporary",
"directory"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L810-L819 |
214,150 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.get_tempfiles | public function get_tempfiles($skipfile='portfolio-export.zip') {
$fs = get_file_storage();
$files = $fs->get_area_files(SYSCONTEXTID, 'portfolio', 'exporter', $this->id, 'sortorder, itemid, filepath, filename', false);
if (empty($files)) {
return array();
}
$returnfi... | php | public function get_tempfiles($skipfile='portfolio-export.zip') {
$fs = get_file_storage();
$files = $fs->get_area_files(SYSCONTEXTID, 'portfolio', 'exporter', $this->id, 'sortorder, itemid, filepath, filename', false);
if (empty($files)) {
return array();
}
$returnfi... | [
"public",
"function",
"get_tempfiles",
"(",
"$",
"skipfile",
"=",
"'portfolio-export.zip'",
")",
"{",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"$",
"files",
"=",
"$",
"fs",
"->",
"get_area_files",
"(",
"SYSCONTEXTID",
",",
"'portfolio'",
",",
"'exp... | Returns an arary of files in the temporary working directory
for this export.
Always use this instead of the files api directly
@param string $skipfile name of the file to be skipped
@return array of stored_file objects keyed by name | [
"Returns",
"an",
"arary",
"of",
"files",
"in",
"the",
"temporary",
"working",
"directory",
"for",
"this",
"export",
".",
"Always",
"use",
"this",
"instead",
"of",
"the",
"files",
"api",
"directly"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L829-L843 |
214,151 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.print_expired_export | public static function print_expired_export() {
global $CFG, $OUTPUT, $PAGE;
$title = get_string('exportexpired', 'portfolio');
$PAGE->navbar->add(get_string('exportexpired', 'portfolio'));
$PAGE->set_title($title);
$PAGE->set_heading($title);
echo $OUTPUT->header();
... | php | public static function print_expired_export() {
global $CFG, $OUTPUT, $PAGE;
$title = get_string('exportexpired', 'portfolio');
$PAGE->navbar->add(get_string('exportexpired', 'portfolio'));
$PAGE->set_title($title);
$PAGE->set_heading($title);
echo $OUTPUT->header();
... | [
"public",
"static",
"function",
"print_expired_export",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"OUTPUT",
",",
"$",
"PAGE",
";",
"$",
"title",
"=",
"get_string",
"(",
"'exportexpired'",
",",
"'portfolio'",
")",
";",
"$",
"PAGE",
"->",
"navbar",
"-... | Wrapper function to print a friendly error to users
This is generally caused by them hitting an expired transfer
through the usage of the backbutton
@uses exit | [
"Wrapper",
"function",
"to",
"print",
"a",
"friendly",
"error",
"to",
"users",
"This",
"is",
"generally",
"caused",
"by",
"them",
"hitting",
"an",
"expired",
"transfer",
"through",
"the",
"usage",
"of",
"the",
"backbutton"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L870-L881 |
214,152 | moodle/moodle | lib/portfolio/exporter.php | portfolio_exporter.print_cleaned_export | public static function print_cleaned_export($log, $instance=null) {
global $CFG, $OUTPUT, $PAGE;
if (empty($instance) || !$instance instanceof portfolio_plugin_base) {
$instance = portfolio_instance($log->portfolio);
}
$title = get_string('exportalreadyfinished', 'portfolio')... | php | public static function print_cleaned_export($log, $instance=null) {
global $CFG, $OUTPUT, $PAGE;
if (empty($instance) || !$instance instanceof portfolio_plugin_base) {
$instance = portfolio_instance($log->portfolio);
}
$title = get_string('exportalreadyfinished', 'portfolio')... | [
"public",
"static",
"function",
"print_cleaned_export",
"(",
"$",
"log",
",",
"$",
"instance",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"OUTPUT",
",",
"$",
"PAGE",
";",
"if",
"(",
"empty",
"(",
"$",
"instance",
")",
"||",
"!",
"$",
"i... | Wrapper function to print a friendly error to users
@param stdClass $log portfolio_log object
@param portfolio_plugin_base $instance portfolio instance
@uses exit | [
"Wrapper",
"function",
"to",
"print",
"a",
"friendly",
"error",
"to",
"users"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/exporter.php#L890-L905 |
214,153 | moodle/moodle | grade/report/overview/classes/external.php | gradereport_overview_external.get_course_grades | public static function get_course_grades($userid = 0) {
global $USER;
$warnings = array();
// Validate the parameter.
$params = self::validate_parameters(self::get_course_grades_parameters(),
array(
'userid' => $userid
)
);
$user... | php | public static function get_course_grades($userid = 0) {
global $USER;
$warnings = array();
// Validate the parameter.
$params = self::validate_parameters(self::get_course_grades_parameters(),
array(
'userid' => $userid
)
);
$user... | [
"public",
"static",
"function",
"get_course_grades",
"(",
"$",
"userid",
"=",
"0",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"warnings",
"=",
"array",
"(",
")",
";",
"// Validate the parameter.",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",... | Get the given user courses final grades
@param int $userid get grades for this user (optional, default current)
@return array the grades tables
@since Moodle 3.2 | [
"Get",
"the",
"given",
"user",
"courses",
"final",
"grades"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/overview/classes/external.php#L64-L120 |
214,154 | moodle/moodle | grade/report/overview/classes/external.php | gradereport_overview_external.get_course_grades_returns | public static function get_course_grades_returns() {
return new external_single_structure(
array(
'grades' => new external_multiple_structure(
new external_single_structure(
array(
'courseid' => new external_valu... | php | public static function get_course_grades_returns() {
return new external_single_structure(
array(
'grades' => new external_multiple_structure(
new external_single_structure(
array(
'courseid' => new external_valu... | [
"public",
"static",
"function",
"get_course_grades_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'grades'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'courseid'",... | Describes the get_course_grades return value.
@return external_single_structure
@since Moodle 3.2 | [
"Describes",
"the",
"get_course_grades",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/overview/classes/external.php#L128-L144 |
214,155 | moodle/moodle | lib/behat/form_field/behat_form_select.php | behat_form_select.matches | public function matches($expectedvalue) {
$multiple = $this->field->hasAttribute('multiple');
// Same implementation as the parent if it is a single select.
if (!$multiple) {
$cleanexpectedvalue = trim($expectedvalue);
$selectedtext = trim($this->get_selected_options())... | php | public function matches($expectedvalue) {
$multiple = $this->field->hasAttribute('multiple');
// Same implementation as the parent if it is a single select.
if (!$multiple) {
$cleanexpectedvalue = trim($expectedvalue);
$selectedtext = trim($this->get_selected_options())... | [
"public",
"function",
"matches",
"(",
"$",
"expectedvalue",
")",
"{",
"$",
"multiple",
"=",
"$",
"this",
"->",
"field",
"->",
"hasAttribute",
"(",
"'multiple'",
")",
";",
"// Same implementation as the parent if it is a single select.",
"if",
"(",
"!",
"$",
"multi... | Returns whether the provided argument matches the current value.
@param mixed $expectedvalue
@return bool | [
"Returns",
"whether",
"the",
"provided",
"argument",
"matches",
"the",
"current",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_select.php#L116-L151 |
214,156 | moodle/moodle | lib/behat/form_field/behat_form_select.php | behat_form_select.get_unescaped_options | protected function get_unescaped_options($value) {
// Can be multiple comma separated, with valuable commas escaped with backslash.
$optionsarray = array_map(
'trim',
preg_replace('/\\\,/', ',',
preg_split('/(?<!\\\),/', $value)
)
);
/... | php | protected function get_unescaped_options($value) {
// Can be multiple comma separated, with valuable commas escaped with backslash.
$optionsarray = array_map(
'trim',
preg_replace('/\\\,/', ',',
preg_split('/(?<!\\\),/', $value)
)
);
/... | [
"protected",
"function",
"get_unescaped_options",
"(",
"$",
"value",
")",
"{",
"// Can be multiple comma separated, with valuable commas escaped with backslash.",
"$",
"optionsarray",
"=",
"array_map",
"(",
"'trim'",
",",
"preg_replace",
"(",
"'/\\\\\\,/'",
",",
"','",
",",... | Cleans the list of options and returns it as a string separating options with |||.
@param string $value The string containing the escaped options.
@return string The options | [
"Cleans",
"the",
"list",
"of",
"options",
"and",
"returns",
"it",
"as",
"a",
"string",
"separating",
"options",
"with",
"|||",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_select.php#L159-L174 |
214,157 | moodle/moodle | lib/behat/form_field/behat_form_select.php | behat_form_select.get_selected_options | protected function get_selected_options($returntexts = true) {
$method = 'getHtml';
if ($returntexts === false) {
$method = 'getValue';
}
// Is the select multiple?
$multiple = $this->field->hasAttribute('multiple');
$selectedoptions = array(); // To accumu... | php | protected function get_selected_options($returntexts = true) {
$method = 'getHtml';
if ($returntexts === false) {
$method = 'getValue';
}
// Is the select multiple?
$multiple = $this->field->hasAttribute('multiple');
$selectedoptions = array(); // To accumu... | [
"protected",
"function",
"get_selected_options",
"(",
"$",
"returntexts",
"=",
"true",
")",
"{",
"$",
"method",
"=",
"'getHtml'",
";",
"if",
"(",
"$",
"returntexts",
"===",
"false",
")",
"{",
"$",
"method",
"=",
"'getValue'",
";",
"}",
"// Is the select mult... | Returns the field selected values.
Externalized from the common behat_form_field API method get_value() as
matches() needs to check against both values and texts.
@param bool $returntexts Returns the options texts or the options values.
@return string | [
"Returns",
"the",
"field",
"selected",
"values",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_select.php#L185-L219 |
214,158 | moodle/moodle | question/classes/statistics/questions/calculator.php | calculator.initial_steps_walker | protected function initial_steps_walker($step, $stats, $summarks, $positionstat = true, $dovariantalso = true) {
$stats->s++;
$stats->totalmarks += $step->mark;
$stats->markarray[] = $step->mark;
if ($positionstat) {
$stats->totalothermarks += $summarks[$step->questionusagei... | php | protected function initial_steps_walker($step, $stats, $summarks, $positionstat = true, $dovariantalso = true) {
$stats->s++;
$stats->totalmarks += $step->mark;
$stats->markarray[] = $step->mark;
if ($positionstat) {
$stats->totalothermarks += $summarks[$step->questionusagei... | [
"protected",
"function",
"initial_steps_walker",
"(",
"$",
"step",
",",
"$",
"stats",
",",
"$",
"summarks",
",",
"$",
"positionstat",
"=",
"true",
",",
"$",
"dovariantalso",
"=",
"true",
")",
"{",
"$",
"stats",
"->",
"s",
"++",
";",
"$",
"stats",
"->",... | Calculating the stats is a four step process.
We loop through all 'last step' data first.
Update $stats->totalmarks, $stats->markarray, $stats->totalothermarks
and $stats->othermarksarray to include another state.
@param object $step the state to add to the statistics.
@param calculated $stats the... | [
"Calculating",
"the",
"stats",
"is",
"a",
"four",
"step",
"process",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/calculator.php#L322-L338 |
214,159 | moodle/moodle | question/classes/statistics/questions/calculator.php | calculator.initial_question_walker | protected function initial_question_walker($stats) {
$stats->markaverage = $stats->totalmarks / $stats->s;
if ($stats->maxmark != 0) {
$stats->facility = $stats->markaverage / $stats->maxmark;
} else {
$stats->facility = null;
}
$stats->othermarkaverage ... | php | protected function initial_question_walker($stats) {
$stats->markaverage = $stats->totalmarks / $stats->s;
if ($stats->maxmark != 0) {
$stats->facility = $stats->markaverage / $stats->maxmark;
} else {
$stats->facility = null;
}
$stats->othermarkaverage ... | [
"protected",
"function",
"initial_question_walker",
"(",
"$",
"stats",
")",
"{",
"$",
"stats",
"->",
"markaverage",
"=",
"$",
"stats",
"->",
"totalmarks",
"/",
"$",
"stats",
"->",
"s",
";",
"if",
"(",
"$",
"stats",
"->",
"maxmark",
"!=",
"0",
")",
"{",... | Then loop through all questions for the first time.
Perform some computations on the per-question statistics calculations after
we have been through all the step data.
@param calculated $stats question stats to update. | [
"Then",
"loop",
"through",
"all",
"questions",
"for",
"the",
"first",
"time",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/calculator.php#L348-L373 |
214,160 | moodle/moodle | question/classes/statistics/questions/calculator.php | calculator.secondary_steps_walker | protected function secondary_steps_walker($step, $stats, $summarks) {
$markdifference = $step->mark - $stats->markaverage;
if ($stats->subquestion) {
$othermarkdifference = $summarks[$step->questionusageid] - $stats->othermarkaverage;
} else {
$othermarkdifference = $summ... | php | protected function secondary_steps_walker($step, $stats, $summarks) {
$markdifference = $step->mark - $stats->markaverage;
if ($stats->subquestion) {
$othermarkdifference = $summarks[$step->questionusageid] - $stats->othermarkaverage;
} else {
$othermarkdifference = $summ... | [
"protected",
"function",
"secondary_steps_walker",
"(",
"$",
"step",
",",
"$",
"stats",
",",
"$",
"summarks",
")",
"{",
"$",
"markdifference",
"=",
"$",
"step",
"->",
"mark",
"-",
"$",
"stats",
"->",
"markaverage",
";",
"if",
"(",
"$",
"stats",
"->",
"... | Loop through all last step data again.
Now we know the averages, accumulate the date needed to compute the higher
moments of the question scores.
@param object $step the state to add to the statistics.
@param calculated $stats the question statistics we are accumulating.
@param float[] $summarks of t... | [
"Loop",
"through",
"all",
"last",
"step",
"data",
"again",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/calculator.php#L385-L406 |
214,161 | moodle/moodle | question/classes/statistics/questions/calculator.php | calculator.secondary_question_walker | protected function secondary_question_walker($stats) {
if ($stats->s > 1) {
$stats->markvariance = $stats->markvariancesum / ($stats->s - 1);
$stats->othermarkvariance = $stats->othermarkvariancesum / ($stats->s - 1);
$stats->covariance = $stats->covariancesum / ($stats->s - ... | php | protected function secondary_question_walker($stats) {
if ($stats->s > 1) {
$stats->markvariance = $stats->markvariancesum / ($stats->s - 1);
$stats->othermarkvariance = $stats->othermarkvariancesum / ($stats->s - 1);
$stats->covariance = $stats->covariancesum / ($stats->s - ... | [
"protected",
"function",
"secondary_question_walker",
"(",
"$",
"stats",
")",
"{",
"if",
"(",
"$",
"stats",
"->",
"s",
">",
"1",
")",
"{",
"$",
"stats",
"->",
"markvariance",
"=",
"$",
"stats",
"->",
"markvariancesum",
"/",
"(",
"$",
"stats",
"->",
"s"... | And finally loop through all the questions again.
Perform more per-question statistics calculations.
@param calculated $stats question stats to update. | [
"And",
"finally",
"loop",
"through",
"all",
"the",
"questions",
"again",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/calculator.php#L415-L457 |
214,162 | moodle/moodle | lib/classes/session/database.php | database.handler_close | public function handler_close() {
if ($this->recordid) {
try {
$this->database->release_session_lock($this->recordid);
} catch (\Exception $ex) {
// Ignore any problems.
}
}
$this->recordid = null;
$this->lasthash = null... | php | public function handler_close() {
if ($this->recordid) {
try {
$this->database->release_session_lock($this->recordid);
} catch (\Exception $ex) {
// Ignore any problems.
}
}
$this->recordid = null;
$this->lasthash = null... | [
"public",
"function",
"handler_close",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"recordid",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"database",
"->",
"release_session_lock",
"(",
"$",
"this",
"->",
"recordid",
")",
";",
"}",
"catch",
"(",
"\\",
... | Close session handler.
{@see http://php.net/manual/en/function.session-set-save-handler.php}
@return bool success | [
"Close",
"session",
"handler",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/database.php#L136-L147 |
214,163 | moodle/moodle | lib/classes/session/database.php | database.handler_read | public function handler_read($sid) {
try {
if (!$record = $this->database->get_record('sessions', array('sid'=>$sid), 'id')) {
// Let's cheat and skip locking if this is the first access,
// do not create the record here, let the manager do it after session init.
... | php | public function handler_read($sid) {
try {
if (!$record = $this->database->get_record('sessions', array('sid'=>$sid), 'id')) {
// Let's cheat and skip locking if this is the first access,
// do not create the record here, let the manager do it after session init.
... | [
"public",
"function",
"handler_read",
"(",
"$",
"sid",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"$",
"record",
"=",
"$",
"this",
"->",
"database",
"->",
"get_record",
"(",
"'sessions'",
",",
"array",
"(",
"'sid'",
"=>",
"$",
"sid",
")",
",",
"'id'",
"... | Read session handler.
{@see http://php.net/manual/en/function.session-set-save-handler.php}
@param string $sid
@return string | [
"Read",
"session",
"handler",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/database.php#L157-L212 |
214,164 | moodle/moodle | lib/classes/session/database.php | database.handler_write | public function handler_write($sid, $session_data) {
if ($this->failed) {
// Do not write anything back - we failed to start the session properly.
return false;
}
$sessdata = base64_encode($session_data); // There might be some binary mess :-(
$hash = sha1($sessd... | php | public function handler_write($sid, $session_data) {
if ($this->failed) {
// Do not write anything back - we failed to start the session properly.
return false;
}
$sessdata = base64_encode($session_data); // There might be some binary mess :-(
$hash = sha1($sessd... | [
"public",
"function",
"handler_write",
"(",
"$",
"sid",
",",
"$",
"session_data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"failed",
")",
"{",
"// Do not write anything back - we failed to start the session properly.",
"return",
"false",
";",
"}",
"$",
"sessdata",
... | Write session handler.
{@see http://php.net/manual/en/function.session-set-save-handler.php}
NOTE: Do not write to output or throw any exceptions!
Hopefully the next page is going to display nice error or it recovers...
@param string $sid
@param string $session_data
@return bool success | [
"Write",
"session",
"handler",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/database.php#L226-L252 |
214,165 | moodle/moodle | lib/classes/session/database.php | database.handler_destroy | public function handler_destroy($sid) {
if (!$session = $this->database->get_record('sessions', array('sid'=>$sid), 'id, sid')) {
if ($sid == session_id()) {
$this->recordid = null;
$this->lasthash = null;
}
return true;
}
if (... | php | public function handler_destroy($sid) {
if (!$session = $this->database->get_record('sessions', array('sid'=>$sid), 'id, sid')) {
if ($sid == session_id()) {
$this->recordid = null;
$this->lasthash = null;
}
return true;
}
if (... | [
"public",
"function",
"handler_destroy",
"(",
"$",
"sid",
")",
"{",
"if",
"(",
"!",
"$",
"session",
"=",
"$",
"this",
"->",
"database",
"->",
"get_record",
"(",
"'sessions'",
",",
"array",
"(",
"'sid'",
"=>",
"$",
"sid",
")",
",",
"'id, sid'",
")",
"... | Destroy session handler.
{@see http://php.net/manual/en/function.session-set-save-handler.php}
@param string $sid
@return bool success | [
"Destroy",
"session",
"handler",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/database.php#L262-L284 |
214,166 | moodle/moodle | lib/classes/session/database.php | database.handler_gc | public function handler_gc($ignored_maxlifetime) {
// This should do something only if cron is not running properly...
if (!$stalelifetime = ini_get('session.gc_maxlifetime')) {
return true;
}
$params = array('purgebefore' => (time() - $stalelifetime));
$this->databas... | php | public function handler_gc($ignored_maxlifetime) {
// This should do something only if cron is not running properly...
if (!$stalelifetime = ini_get('session.gc_maxlifetime')) {
return true;
}
$params = array('purgebefore' => (time() - $stalelifetime));
$this->databas... | [
"public",
"function",
"handler_gc",
"(",
"$",
"ignored_maxlifetime",
")",
"{",
"// This should do something only if cron is not running properly...",
"if",
"(",
"!",
"$",
"stalelifetime",
"=",
"ini_get",
"(",
"'session.gc_maxlifetime'",
")",
")",
"{",
"return",
"true",
... | GC session handler.
{@see http://php.net/manual/en/function.session-set-save-handler.php}
@param int $ignored_maxlifetime moodle uses special timeout rules
@return bool success | [
"GC",
"session",
"handler",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/database.php#L294-L302 |
214,167 | moodle/moodle | mod/data/field/checkbox/field.class.php | data_field_checkbox.notemptyfield | function notemptyfield($value, $name) {
$found = false;
foreach ($value as $checkboxitem) {
if (strval($checkboxitem) !== '') {
$found = true;
break;
}
}
return $found;
} | php | function notemptyfield($value, $name) {
$found = false;
foreach ($value as $checkboxitem) {
if (strval($checkboxitem) !== '') {
$found = true;
break;
}
}
return $found;
} | [
"function",
"notemptyfield",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"$",
"found",
"=",
"false",
";",
"foreach",
"(",
"$",
"value",
"as",
"$",
"checkboxitem",
")",
"{",
"if",
"(",
"strval",
"(",
"$",
"checkboxitem",
")",
"!==",
"''",
")",
"{... | Check whether any boxes in the checkbox where checked.
@param mixed $value The submitted values
@param mixed $name
@return bool | [
"Check",
"whether",
"any",
"boxes",
"in",
"the",
"checkbox",
"where",
"checked",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/field/checkbox/field.class.php#L248-L257 |
214,168 | moodle/moodle | mod/data/field/checkbox/field.class.php | data_field_checkbox.get_content_value | public static function get_content_value($content) {
$arr = explode('##', $content->content);
$strvalue = '';
foreach ($arr as $a) {
$strvalue .= $a . ' ';
}
return trim($strvalue, "\r\n ");
} | php | public static function get_content_value($content) {
$arr = explode('##', $content->content);
$strvalue = '';
foreach ($arr as $a) {
$strvalue .= $a . ' ';
}
return trim($strvalue, "\r\n ");
} | [
"public",
"static",
"function",
"get_content_value",
"(",
"$",
"content",
")",
"{",
"$",
"arr",
"=",
"explode",
"(",
"'##'",
",",
"$",
"content",
"->",
"content",
")",
";",
"$",
"strvalue",
"=",
"''",
";",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"a",
... | Returns the presentable string value for a field content.
The returned string should be plain text.
@param stdClass $content
@return string | [
"Returns",
"the",
"presentable",
"string",
"value",
"for",
"a",
"field",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/field/checkbox/field.class.php#L267-L276 |
214,169 | moodle/moodle | lib/ltiprovider/src/ToolProvider/OAuthDataStore.php | OAuthDataStore.lookup_consumer | function lookup_consumer($consumerKey)
{
return new OAuth\OAuthConsumer($this->toolProvider->consumer->getKey(),
$this->toolProvider->consumer->secret);
} | php | function lookup_consumer($consumerKey)
{
return new OAuth\OAuthConsumer($this->toolProvider->consumer->getKey(),
$this->toolProvider->consumer->secret);
} | [
"function",
"lookup_consumer",
"(",
"$",
"consumerKey",
")",
"{",
"return",
"new",
"OAuth",
"\\",
"OAuthConsumer",
"(",
"$",
"this",
"->",
"toolProvider",
"->",
"consumer",
"->",
"getKey",
"(",
")",
",",
"$",
"this",
"->",
"toolProvider",
"->",
"consumer",
... | Create an OAuthConsumer object for the tool consumer.
@param string $consumerKey Consumer key value
@return OAuthConsumer OAuthConsumer object | [
"Create",
"an",
"OAuthConsumer",
"object",
"for",
"the",
"tool",
"consumer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ltiprovider/src/ToolProvider/OAuthDataStore.php#L45-L51 |
214,170 | moodle/moodle | question/classes/statistics/responses/analysis_for_question.php | analysis_for_question.initialise_stats_for_variant | protected function initialise_stats_for_variant($variantno) {
$this->subparts[$variantno] = array();
foreach ($this->possibleresponses as $subpartid => $classes) {
$this->subparts[$variantno][$subpartid] = new analysis_for_subpart($classes);
}
} | php | protected function initialise_stats_for_variant($variantno) {
$this->subparts[$variantno] = array();
foreach ($this->possibleresponses as $subpartid => $classes) {
$this->subparts[$variantno][$subpartid] = new analysis_for_subpart($classes);
}
} | [
"protected",
"function",
"initialise_stats_for_variant",
"(",
"$",
"variantno",
")",
"{",
"$",
"this",
"->",
"subparts",
"[",
"$",
"variantno",
"]",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"possibleresponses",
"as",
"$",
"subpartid",
... | Initialise data structure for response analysis of one variant.
@param int $variantno | [
"Initialise",
"data",
"structure",
"for",
"response",
"analysis",
"of",
"one",
"variant",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/responses/analysis_for_question.php#L91-L96 |
214,171 | moodle/moodle | lib/scssphp/Formatter.php | Formatter.blockLines | protected function blockLines(OutputBlock $block)
{
$inner = $this->indentStr();
$glue = $this->break . $inner;
$this->write($inner . implode($glue, $block->lines));
if (! empty($block->children)) {
$this->write($this->break);
}
} | php | protected function blockLines(OutputBlock $block)
{
$inner = $this->indentStr();
$glue = $this->break . $inner;
$this->write($inner . implode($glue, $block->lines));
if (! empty($block->children)) {
$this->write($this->break);
}
} | [
"protected",
"function",
"blockLines",
"(",
"OutputBlock",
"$",
"block",
")",
"{",
"$",
"inner",
"=",
"$",
"this",
"->",
"indentStr",
"(",
")",
";",
"$",
"glue",
"=",
"$",
"this",
"->",
"break",
".",
"$",
"inner",
";",
"$",
"this",
"->",
"write",
"... | Output lines inside a block
@param \Leafo\ScssPhp\Formatter\OutputBlock $block | [
"Output",
"lines",
"inside",
"a",
"block"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Formatter.php#L141-L152 |
214,172 | moodle/moodle | lib/scssphp/Formatter.php | Formatter.blockSelectors | protected function blockSelectors(OutputBlock $block)
{
$inner = $this->indentStr();
$this->write($inner
. implode($this->tagSeparator, $block->selectors)
. $this->open . $this->break);
} | php | protected function blockSelectors(OutputBlock $block)
{
$inner = $this->indentStr();
$this->write($inner
. implode($this->tagSeparator, $block->selectors)
. $this->open . $this->break);
} | [
"protected",
"function",
"blockSelectors",
"(",
"OutputBlock",
"$",
"block",
")",
"{",
"$",
"inner",
"=",
"$",
"this",
"->",
"indentStr",
"(",
")",
";",
"$",
"this",
"->",
"write",
"(",
"$",
"inner",
".",
"implode",
"(",
"$",
"this",
"->",
"tagSeparato... | Output block selectors
@param \Leafo\ScssPhp\Formatter\OutputBlock $block | [
"Output",
"block",
"selectors"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Formatter.php#L159-L166 |
214,173 | moodle/moodle | lib/scssphp/Formatter.php | Formatter.blockChildren | protected function blockChildren(OutputBlock $block)
{
foreach ($block->children as $child) {
$this->block($child);
}
} | php | protected function blockChildren(OutputBlock $block)
{
foreach ($block->children as $child) {
$this->block($child);
}
} | [
"protected",
"function",
"blockChildren",
"(",
"OutputBlock",
"$",
"block",
")",
"{",
"foreach",
"(",
"$",
"block",
"->",
"children",
"as",
"$",
"child",
")",
"{",
"$",
"this",
"->",
"block",
"(",
"$",
"child",
")",
";",
"}",
"}"
] | Output block children
@param \Leafo\ScssPhp\Formatter\OutputBlock $block | [
"Output",
"block",
"children"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Formatter.php#L173-L178 |
214,174 | moodle/moodle | lib/scssphp/Formatter.php | Formatter.block | protected function block(OutputBlock $block)
{
if (empty($block->lines) && empty($block->children)) {
return;
}
$this->currentBlock = $block;
$pre = $this->indentStr();
if (! empty($block->selectors)) {
$this->blockSelectors($block);
$t... | php | protected function block(OutputBlock $block)
{
if (empty($block->lines) && empty($block->children)) {
return;
}
$this->currentBlock = $block;
$pre = $this->indentStr();
if (! empty($block->selectors)) {
$this->blockSelectors($block);
$t... | [
"protected",
"function",
"block",
"(",
"OutputBlock",
"$",
"block",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"block",
"->",
"lines",
")",
"&&",
"empty",
"(",
"$",
"block",
"->",
"children",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"curr... | Output non-empty block
@param \Leafo\ScssPhp\Formatter\OutputBlock $block | [
"Output",
"non",
"-",
"empty",
"block"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Formatter.php#L185-L218 |
214,175 | moodle/moodle | lib/scssphp/Formatter.php | Formatter.format | public function format(OutputBlock $block, SourceMapGenerator $sourceMapGenerator = null)
{
$this->sourceMapGenerator = null;
if ($sourceMapGenerator) {
$this->currentLine = 1;
$this->currentColumn = 0;
$this->sourceMapGenerator = $sourceMapGenerator;
}
... | php | public function format(OutputBlock $block, SourceMapGenerator $sourceMapGenerator = null)
{
$this->sourceMapGenerator = null;
if ($sourceMapGenerator) {
$this->currentLine = 1;
$this->currentColumn = 0;
$this->sourceMapGenerator = $sourceMapGenerator;
}
... | [
"public",
"function",
"format",
"(",
"OutputBlock",
"$",
"block",
",",
"SourceMapGenerator",
"$",
"sourceMapGenerator",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"sourceMapGenerator",
"=",
"null",
";",
"if",
"(",
"$",
"sourceMapGenerator",
")",
"{",
"$",
"th... | Entry point to formatting a block
@api
@param \Leafo\ScssPhp\Formatter\OutputBlock $block An abstract syntax tree
@param \Leafo\ScssPhp\SourceMap\SourceMapGenerator|null $sourceMapGenerator Optional source map generator
@return string | [
"Entry",
"point",
"to",
"formatting",
"a",
"block"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Formatter.php#L230-L247 |
214,176 | moodle/moodle | mod/forum/classes/local/entities/discussion.php | discussion.toggle_locked_state | public function toggle_locked_state(int $timestamp) {
// Check the current value against what we want the value to be i.e. '$timestamp'.
$this->timelocked = ($this->timelocked && $timestamp ? $this->timelocked : $timestamp);
} | php | public function toggle_locked_state(int $timestamp) {
// Check the current value against what we want the value to be i.e. '$timestamp'.
$this->timelocked = ($this->timelocked && $timestamp ? $this->timelocked : $timestamp);
} | [
"public",
"function",
"toggle_locked_state",
"(",
"int",
"$",
"timestamp",
")",
"{",
"// Check the current value against what we want the value to be i.e. '$timestamp'.",
"$",
"this",
"->",
"timelocked",
"=",
"(",
"$",
"this",
"->",
"timelocked",
"&&",
"$",
"timestamp",
... | Set the locked timestamp
@param int $timestamp The value we want to store into 'locked' | [
"Set",
"the",
"locked",
"timestamp"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/entities/discussion.php#L259-L262 |
214,177 | moodle/moodle | mod/forum/classes/local/entities/discussion.php | discussion.set_pinned | public function set_pinned(int $targetstate): void {
if ($targetstate != $this->pinned) {
$this->pinned = $targetstate;
}
} | php | public function set_pinned(int $targetstate): void {
if ($targetstate != $this->pinned) {
$this->pinned = $targetstate;
}
} | [
"public",
"function",
"set_pinned",
"(",
"int",
"$",
"targetstate",
")",
":",
"void",
"{",
"if",
"(",
"$",
"targetstate",
"!=",
"$",
"this",
"->",
"pinned",
")",
"{",
"$",
"this",
"->",
"pinned",
"=",
"$",
"targetstate",
";",
"}",
"}"
] | Set the pinned value for this entity
@param int $targetstate The state to change the pin to
@return bool | [
"Set",
"the",
"pinned",
"value",
"for",
"this",
"entity"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/entities/discussion.php#L309-L313 |
214,178 | moodle/moodle | mod/forum/classes/local/entities/discussion.php | discussion.is_timed_discussion | public function is_timed_discussion() : bool {
global $CFG;
return !empty($CFG->forum_enabletimedposts) &&
($this->get_time_start() || $this->get_time_end());
} | php | public function is_timed_discussion() : bool {
global $CFG;
return !empty($CFG->forum_enabletimedposts) &&
($this->get_time_start() || $this->get_time_end());
} | [
"public",
"function",
"is_timed_discussion",
"(",
")",
":",
"bool",
"{",
"global",
"$",
"CFG",
";",
"return",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"forum_enabletimedposts",
")",
"&&",
"(",
"$",
"this",
"->",
"get_time_start",
"(",
")",
"||",
"$",
"this",... | Check if the discussion is timed.
@return bool | [
"Check",
"if",
"the",
"discussion",
"is",
"timed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/entities/discussion.php#L320-L325 |
214,179 | moodle/moodle | mod/forum/classes/local/container.php | container.get_renderer_factory | public static function get_renderer_factory() : renderer_factory {
global $PAGE;
return new renderer_factory(
self::get_legacy_data_mapper_factory(),
self::get_exporter_factory(),
self::get_vault_factory(),
self::get_manager_factory(),
self::g... | php | public static function get_renderer_factory() : renderer_factory {
global $PAGE;
return new renderer_factory(
self::get_legacy_data_mapper_factory(),
self::get_exporter_factory(),
self::get_vault_factory(),
self::get_manager_factory(),
self::g... | [
"public",
"static",
"function",
"get_renderer_factory",
"(",
")",
":",
"renderer_factory",
"{",
"global",
"$",
"PAGE",
";",
"return",
"new",
"renderer_factory",
"(",
"self",
"::",
"get_legacy_data_mapper_factory",
"(",
")",
",",
"self",
"::",
"get_exporter_factory",... | Create the renderer factory.
@return renderer_factory | [
"Create",
"the",
"renderer",
"factory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/container.php#L53-L66 |
214,180 | moodle/moodle | mod/forum/classes/local/container.php | container.get_exporter_factory | public static function get_exporter_factory() : exporter_factory {
return new exporter_factory(
self::get_legacy_data_mapper_factory(),
self::get_manager_factory(),
self::get_url_factory(),
self::get_vault_factory()
);
} | php | public static function get_exporter_factory() : exporter_factory {
return new exporter_factory(
self::get_legacy_data_mapper_factory(),
self::get_manager_factory(),
self::get_url_factory(),
self::get_vault_factory()
);
} | [
"public",
"static",
"function",
"get_exporter_factory",
"(",
")",
":",
"exporter_factory",
"{",
"return",
"new",
"exporter_factory",
"(",
"self",
"::",
"get_legacy_data_mapper_factory",
"(",
")",
",",
"self",
"::",
"get_manager_factory",
"(",
")",
",",
"self",
"::... | Create the exporter factory.
@return exporter_factory | [
"Create",
"the",
"exporter",
"factory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/container.php#L82-L89 |
214,181 | moodle/moodle | mod/forum/classes/local/container.php | container.get_vault_factory | public static function get_vault_factory() : vault_factory {
global $DB;
return new vault_factory(
$DB,
self::get_entity_factory(),
get_file_storage(),
self::get_legacy_data_mapper_factory()
);
} | php | public static function get_vault_factory() : vault_factory {
global $DB;
return new vault_factory(
$DB,
self::get_entity_factory(),
get_file_storage(),
self::get_legacy_data_mapper_factory()
);
} | [
"public",
"static",
"function",
"get_vault_factory",
"(",
")",
":",
"vault_factory",
"{",
"global",
"$",
"DB",
";",
"return",
"new",
"vault_factory",
"(",
"$",
"DB",
",",
"self",
"::",
"get_entity_factory",
"(",
")",
",",
"get_file_storage",
"(",
")",
",",
... | Create the vault factory.
@return vault_factory | [
"Create",
"the",
"vault",
"factory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/container.php#L96-L105 |
214,182 | moodle/moodle | mod/forum/classes/local/container.php | container.get_builder_factory | public static function get_builder_factory() : builder_factory {
global $PAGE;
return new builder_factory(
self::get_legacy_data_mapper_factory(),
self::get_exporter_factory(),
self::get_vault_factory(),
self::get_manager_factory(),
$PAGE->get... | php | public static function get_builder_factory() : builder_factory {
global $PAGE;
return new builder_factory(
self::get_legacy_data_mapper_factory(),
self::get_exporter_factory(),
self::get_vault_factory(),
self::get_manager_factory(),
$PAGE->get... | [
"public",
"static",
"function",
"get_builder_factory",
"(",
")",
":",
"builder_factory",
"{",
"global",
"$",
"PAGE",
";",
"return",
"new",
"builder_factory",
"(",
"self",
"::",
"get_legacy_data_mapper_factory",
"(",
")",
",",
"self",
"::",
"get_exporter_factory",
... | Create the builder factory.
@return builder_factory | [
"Create",
"the",
"builder",
"factory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/container.php#L132-L142 |
214,183 | moodle/moodle | lib/phpexcel/PHPExcel/ReferenceHelper.php | PHPExcel_ReferenceHelper.columnSort | public static function columnSort($a, $b)
{
return strcasecmp(strlen($a) . $a, strlen($b) . $b);
} | php | public static function columnSort($a, $b)
{
return strcasecmp(strlen($a) . $a, strlen($b) . $b);
} | [
"public",
"static",
"function",
"columnSort",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"return",
"strcasecmp",
"(",
"strlen",
"(",
"$",
"a",
")",
".",
"$",
"a",
",",
"strlen",
"(",
"$",
"b",
")",
".",
"$",
"b",
")",
";",
"}"
] | Compare two column addresses
Intended for use as a Callback function for sorting column addresses by column
@param string $a First column to test (e.g. 'AA')
@param string $b Second column to test (e.g. 'Z')
@return integer | [
"Compare",
"two",
"column",
"addresses",
"Intended",
"for",
"use",
"as",
"a",
"Callback",
"function",
"for",
"sorting",
"column",
"addresses",
"by",
"column"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/ReferenceHelper.php#L73-L76 |
214,184 | moodle/moodle | lib/phpexcel/PHPExcel/ReferenceHelper.php | PHPExcel_ReferenceHelper.columnReverseSort | public static function columnReverseSort($a, $b)
{
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
} | php | public static function columnReverseSort($a, $b)
{
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
} | [
"public",
"static",
"function",
"columnReverseSort",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"return",
"1",
"-",
"strcasecmp",
"(",
"strlen",
"(",
"$",
"a",
")",
".",
"$",
"a",
",",
"strlen",
"(",
"$",
"b",
")",
".",
"$",
"b",
")",
";",
"}"
] | Compare two column addresses
Intended for use as a Callback function for reverse sorting column addresses by column
@param string $a First column to test (e.g. 'AA')
@param string $b Second column to test (e.g. 'Z')
@return integer | [
"Compare",
"two",
"column",
"addresses",
"Intended",
"for",
"use",
"as",
"a",
"Callback",
"function",
"for",
"reverse",
"sorting",
"column",
"addresses",
"by",
"column"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/ReferenceHelper.php#L86-L89 |
214,185 | moodle/moodle | lib/phpexcel/PHPExcel/ReferenceHelper.php | PHPExcel_ReferenceHelper.cellSort | public static function cellSort($a, $b)
{
sscanf($a, '%[A-Z]%d', $ac, $ar);
sscanf($b, '%[A-Z]%d', $bc, $br);
if ($ar == $br) {
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
}
return ($ar < $br) ? -1 : 1;
} | php | public static function cellSort($a, $b)
{
sscanf($a, '%[A-Z]%d', $ac, $ar);
sscanf($b, '%[A-Z]%d', $bc, $br);
if ($ar == $br) {
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
}
return ($ar < $br) ? -1 : 1;
} | [
"public",
"static",
"function",
"cellSort",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"sscanf",
"(",
"$",
"a",
",",
"'%[A-Z]%d'",
",",
"$",
"ac",
",",
"$",
"ar",
")",
";",
"sscanf",
"(",
"$",
"b",
",",
"'%[A-Z]%d'",
",",
"$",
"bc",
",",
"$",
"b... | Compare two cell addresses
Intended for use as a Callback function for sorting cell addresses by column and row
@param string $a First cell to test (e.g. 'AA1')
@param string $b Second cell to test (e.g. 'Z1')
@return integer | [
"Compare",
"two",
"cell",
"addresses",
"Intended",
"for",
"use",
"as",
"a",
"Callback",
"function",
"for",
"sorting",
"cell",
"addresses",
"by",
"column",
"and",
"row"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/ReferenceHelper.php#L99-L108 |
214,186 | moodle/moodle | lib/phpexcel/PHPExcel/ReferenceHelper.php | PHPExcel_ReferenceHelper.updateSingleCellReference | private function updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
// Get coordinates of $pBefore
list($beforeColumn, $beforeRow) = PHPExcel_Cell::... | php | private function updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
// Get coordinates of $pBefore
list($beforeColumn, $beforeRow) = PHPExcel_Cell::... | [
"private",
"function",
"updateSingleCellReference",
"(",
"$",
"pCellReference",
"=",
"'A1'",
",",
"$",
"pBefore",
"=",
"'A1'",
",",
"$",
"pNumCols",
"=",
"0",
",",
"$",
"pNumRows",
"=",
"0",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"pCellReference",
",",... | Update single cell reference
@param string $pCellReference Single cell reference
@param int $pBefore Insert before this one
@param int $pNumCols Number of columns to increment
@param int $pNumRows Number of rows to increment
@return string ... | [
"Update",
"single",
"cell",
"reference"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/ReferenceHelper.php#L874-L902 |
214,187 | moodle/moodle | lib/classes/oauth2/api.php | api.create_endpoints_for_google | private static function create_endpoints_for_google($issuer) {
$record = (object) [
'issuerid' => $issuer->get('id'),
'name' => 'discovery_endpoint',
'url' => 'https://accounts.google.com/.well-known/openid-configuration'
];
$endpoint = new endpoint(0, $recor... | php | private static function create_endpoints_for_google($issuer) {
$record = (object) [
'issuerid' => $issuer->get('id'),
'name' => 'discovery_endpoint',
'url' => 'https://accounts.google.com/.well-known/openid-configuration'
];
$endpoint = new endpoint(0, $recor... | [
"private",
"static",
"function",
"create_endpoints_for_google",
"(",
"$",
"issuer",
")",
"{",
"$",
"record",
"=",
"(",
"object",
")",
"[",
"'issuerid'",
"=>",
"$",
"issuer",
"->",
"get",
"(",
"'id'",
")",
",",
"'name'",
"=>",
"'discovery_endpoint'",
",",
"... | Create endpoints for google issuers.
@param issuer $issuer issuer the endpoints should be created for.
@return mixed
@throws \coding_exception
@throws \core\invalid_persistent_exception | [
"Create",
"endpoints",
"for",
"google",
"issuers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L69-L79 |
214,188 | moodle/moodle | lib/classes/oauth2/api.php | api.create_endpoints_for_facebook | private static function create_endpoints_for_facebook($issuer) {
// The Facebook API version.
$apiversion = '2.12';
// The Graph API URL.
$graphurl = 'https://graph.facebook.com/v' . $apiversion;
// User information fields that we want to fetch.
$infofields = [
... | php | private static function create_endpoints_for_facebook($issuer) {
// The Facebook API version.
$apiversion = '2.12';
// The Graph API URL.
$graphurl = 'https://graph.facebook.com/v' . $apiversion;
// User information fields that we want to fetch.
$infofields = [
... | [
"private",
"static",
"function",
"create_endpoints_for_facebook",
"(",
"$",
"issuer",
")",
"{",
"// The Facebook API version.",
"$",
"apiversion",
"=",
"'2.12'",
";",
"// The Graph API URL.",
"$",
"graphurl",
"=",
"'https://graph.facebook.com/v'",
".",
"$",
"apiversion",
... | Create endpoints for facebook issuers.
@param issuer $issuer issuer the endpoints should be created for.
@return mixed
@throws \coding_exception
@throws \core\invalid_persistent_exception | [
"Create",
"endpoints",
"for",
"facebook",
"issuers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L107-L157 |
214,189 | moodle/moodle | lib/classes/oauth2/api.php | api.create_endpoints_for_microsoft | private static function create_endpoints_for_microsoft($issuer) {
$endpoints = [
'authorization_endpoint' => 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
'token_endpoint' => 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
'userinfo_endpoint... | php | private static function create_endpoints_for_microsoft($issuer) {
$endpoints = [
'authorization_endpoint' => 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
'token_endpoint' => 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
'userinfo_endpoint... | [
"private",
"static",
"function",
"create_endpoints_for_microsoft",
"(",
"$",
"issuer",
")",
"{",
"$",
"endpoints",
"=",
"[",
"'authorization_endpoint'",
"=>",
"'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'",
",",
"'token_endpoint'",
"=>",
"'https://login.micr... | Create endpoints for microsoft issuers.
@param issuer $issuer issuer the endpoints should be created for.
@return mixed
@throws \coding_exception
@throws \core\invalid_persistent_exception | [
"Create",
"endpoints",
"for",
"microsoft",
"issuers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L185-L224 |
214,190 | moodle/moodle | lib/classes/oauth2/api.php | api.create_endpoints_for_nextcloud | private static function create_endpoints_for_nextcloud($issuer) {
$baseurl = $issuer->get('baseurl');
// Add trailing slash to baseurl, if needed.
if (substr($baseurl, -1) !== '/') {
$baseurl .= '/';
}
$endpoints = [
// Baseurl will be prepended later.
... | php | private static function create_endpoints_for_nextcloud($issuer) {
$baseurl = $issuer->get('baseurl');
// Add trailing slash to baseurl, if needed.
if (substr($baseurl, -1) !== '/') {
$baseurl .= '/';
}
$endpoints = [
// Baseurl will be prepended later.
... | [
"private",
"static",
"function",
"create_endpoints_for_nextcloud",
"(",
"$",
"issuer",
")",
"{",
"$",
"baseurl",
"=",
"$",
"issuer",
"->",
"get",
"(",
"'baseurl'",
")",
";",
"// Add trailing slash to baseurl, if needed.",
"if",
"(",
"substr",
"(",
"$",
"baseurl",
... | Create endpoints for nextcloud issuers.
@param issuer $issuer issuer the endpoints should be created for.
@return mixed
@throws \coding_exception
@throws \core\invalid_persistent_exception | [
"Create",
"endpoints",
"for",
"nextcloud",
"issuers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L250-L290 |
214,191 | moodle/moodle | lib/classes/oauth2/api.php | api.init_standard_issuer | public static function init_standard_issuer($type) {
require_capability('moodle/site:config', context_system::instance());
if ($type == 'google') {
return self::init_google();
} else if ($type == 'microsoft') {
return self::init_microsoft();
} else if ($type == 'f... | php | public static function init_standard_issuer($type) {
require_capability('moodle/site:config', context_system::instance());
if ($type == 'google') {
return self::init_google();
} else if ($type == 'microsoft') {
return self::init_microsoft();
} else if ($type == 'f... | [
"public",
"static",
"function",
"init_standard_issuer",
"(",
"$",
"type",
")",
"{",
"require_capability",
"(",
"'moodle/site:config'",
",",
"context_system",
"::",
"instance",
"(",
")",
")",
";",
"if",
"(",
"$",
"type",
"==",
"'google'",
")",
"{",
"return",
... | Initializes a record for one of the standard issuers to be displayed in the settings.
The issuer is not yet created in the database.
@param string $type One of google, facebook, microsoft, nextcloud
@return \core\oauth2\issuer | [
"Initializes",
"a",
"record",
"for",
"one",
"of",
"the",
"standard",
"issuers",
"to",
"be",
"displayed",
"in",
"the",
"settings",
".",
"The",
"issuer",
"is",
"not",
"yet",
"created",
"in",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L298-L311 |
214,192 | moodle/moodle | lib/classes/oauth2/api.php | api.create_endpoints_for_standard_issuer | public static function create_endpoints_for_standard_issuer($type, $issuer) {
require_capability('moodle/site:config', context_system::instance());
if ($type == 'google') {
$issuer = self::create_endpoints_for_google($issuer);
self::discover_endpoints($issuer);
return... | php | public static function create_endpoints_for_standard_issuer($type, $issuer) {
require_capability('moodle/site:config', context_system::instance());
if ($type == 'google') {
$issuer = self::create_endpoints_for_google($issuer);
self::discover_endpoints($issuer);
return... | [
"public",
"static",
"function",
"create_endpoints_for_standard_issuer",
"(",
"$",
"type",
",",
"$",
"issuer",
")",
"{",
"require_capability",
"(",
"'moodle/site:config'",
",",
"context_system",
"::",
"instance",
"(",
")",
")",
";",
"if",
"(",
"$",
"type",
"==",
... | Create endpoints for standard issuers, based on the issuer created from submitted data.
@param string $type One of google, facebook, microsoft, nextcloud
@param issuer $issuer issuer the endpoints should be created for.
@return \core\oauth2\issuer | [
"Create",
"endpoints",
"for",
"standard",
"issuers",
"based",
"on",
"the",
"issuer",
"created",
"from",
"submitted",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L319-L334 |
214,193 | moodle/moodle | lib/classes/oauth2/api.php | api.create_standard_issuer | public static function create_standard_issuer($type, $baseurl = false) {
require_capability('moodle/site:config', context_system::instance());
if ($type == 'google') {
$issuer = self::init_google();
$issuer->create();
return self::create_endpoints_for_google($issuer);... | php | public static function create_standard_issuer($type, $baseurl = false) {
require_capability('moodle/site:config', context_system::instance());
if ($type == 'google') {
$issuer = self::init_google();
$issuer->create();
return self::create_endpoints_for_google($issuer);... | [
"public",
"static",
"function",
"create_standard_issuer",
"(",
"$",
"type",
",",
"$",
"baseurl",
"=",
"false",
")",
"{",
"require_capability",
"(",
"'moodle/site:config'",
",",
"context_system",
"::",
"instance",
"(",
")",
")",
";",
"if",
"(",
"$",
"type",
"... | Create one of the standard issuers.
@param string $type One of google, facebook, microsoft, or nextcloud
@param string|false $baseurl Baseurl (only required for nextcloud)
@return \core\oauth2\issuer | [
"Create",
"one",
"of",
"the",
"standard",
"issuers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L342-L367 |
214,194 | moodle/moodle | lib/classes/oauth2/api.php | api.get_system_scopes_for_issuer | public static function get_system_scopes_for_issuer($issuer) {
$scopes = $issuer->get('loginscopesoffline');
$pluginsfunction = get_plugins_with_function('oauth2_system_scopes', 'lib.php');
foreach ($pluginsfunction as $plugintype => $plugins) {
foreach ($plugins as $pluginfunction)... | php | public static function get_system_scopes_for_issuer($issuer) {
$scopes = $issuer->get('loginscopesoffline');
$pluginsfunction = get_plugins_with_function('oauth2_system_scopes', 'lib.php');
foreach ($pluginsfunction as $plugintype => $plugins) {
foreach ($plugins as $pluginfunction)... | [
"public",
"static",
"function",
"get_system_scopes_for_issuer",
"(",
"$",
"issuer",
")",
"{",
"$",
"scopes",
"=",
"$",
"issuer",
"->",
"get",
"(",
"'loginscopesoffline'",
")",
";",
"$",
"pluginsfunction",
"=",
"get_plugins_with_function",
"(",
"'oauth2_system_scopes... | Get the full list of system scopes required by an oauth issuer.
This includes the list required for login as well as any scopes injected by the oauth2_system_scopes callback in plugins.
@param \core\oauth2\issuer $issuer
@return string | [
"Get",
"the",
"full",
"list",
"of",
"system",
"scopes",
"required",
"by",
"an",
"oauth",
"issuer",
".",
"This",
"includes",
"the",
"list",
"required",
"for",
"login",
"as",
"well",
"as",
"any",
"scopes",
"injected",
"by",
"the",
"oauth2_system_scopes",
"call... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L426-L452 |
214,195 | moodle/moodle | lib/classes/oauth2/api.php | api.get_system_oauth_client | public static function get_system_oauth_client(issuer $issuer) {
$systemaccount = self::get_system_account($issuer);
if (empty($systemaccount)) {
return false;
}
// Get all the scopes!
$scopes = self::get_system_scopes_for_issuer($issuer);
$client = new \core... | php | public static function get_system_oauth_client(issuer $issuer) {
$systemaccount = self::get_system_account($issuer);
if (empty($systemaccount)) {
return false;
}
// Get all the scopes!
$scopes = self::get_system_scopes_for_issuer($issuer);
$client = new \core... | [
"public",
"static",
"function",
"get_system_oauth_client",
"(",
"issuer",
"$",
"issuer",
")",
"{",
"$",
"systemaccount",
"=",
"self",
"::",
"get_system_account",
"(",
"$",
"issuer",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"systemaccount",
")",
")",
"{",
"r... | Get an authenticated oauth2 client using the system account.
This call uses the refresh token to get an access token.
@param \core\oauth2\issuer $issuer
@return \core\oauth2\client|false An authenticated client (or false if the token could not be upgraded)
@throws moodle_exception Request for token upgrade failed for ... | [
"Get",
"an",
"authenticated",
"oauth2",
"client",
"using",
"the",
"system",
"account",
".",
"This",
"call",
"uses",
"the",
"refresh",
"token",
"to",
"get",
"an",
"access",
"token",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L462-L478 |
214,196 | moodle/moodle | lib/classes/oauth2/api.php | api.get_user_oauth_client | public static function get_user_oauth_client(issuer $issuer, moodle_url $currenturl, $additionalscopes = '') {
$client = new \core\oauth2\client($issuer, $currenturl, $additionalscopes);
return $client;
} | php | public static function get_user_oauth_client(issuer $issuer, moodle_url $currenturl, $additionalscopes = '') {
$client = new \core\oauth2\client($issuer, $currenturl, $additionalscopes);
return $client;
} | [
"public",
"static",
"function",
"get_user_oauth_client",
"(",
"issuer",
"$",
"issuer",
",",
"moodle_url",
"$",
"currenturl",
",",
"$",
"additionalscopes",
"=",
"''",
")",
"{",
"$",
"client",
"=",
"new",
"\\",
"core",
"\\",
"oauth2",
"\\",
"client",
"(",
"$... | Get an authenticated oauth2 client using the current user account.
This call does the redirect dance back to the current page after authentication.
@param \core\oauth2\issuer $issuer The desired OAuth issuer
@param moodle_url $currenturl The url to the current page.
@param string $additionalscopes The additional scope... | [
"Get",
"an",
"authenticated",
"oauth2",
"client",
"using",
"the",
"current",
"user",
"account",
".",
"This",
"call",
"does",
"the",
"redirect",
"dance",
"back",
"to",
"the",
"current",
"page",
"after",
"authentication",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L489-L493 |
214,197 | moodle/moodle | lib/classes/oauth2/api.php | api.guess_image | protected static function guess_image($issuer) {
if (empty($issuer->get('image')) && !empty($issuer->get('baseurl'))) {
$baseurl = parse_url($issuer->get('baseurl'));
$imageurl = $baseurl['scheme'] . '://' . $baseurl['host'] . '/favicon.ico';
$issuer->set('image', $imageurl);... | php | protected static function guess_image($issuer) {
if (empty($issuer->get('image')) && !empty($issuer->get('baseurl'))) {
$baseurl = parse_url($issuer->get('baseurl'));
$imageurl = $baseurl['scheme'] . '://' . $baseurl['host'] . '/favicon.ico';
$issuer->set('image', $imageurl);... | [
"protected",
"static",
"function",
"guess_image",
"(",
"$",
"issuer",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"issuer",
"->",
"get",
"(",
"'image'",
")",
")",
"&&",
"!",
"empty",
"(",
"$",
"issuer",
"->",
"get",
"(",
"'baseurl'",
")",
")",
")",
"{"... | Guess an image from the discovery URL.
@param \core\oauth2\issuer $issuer The desired OAuth issuer | [
"Guess",
"an",
"image",
"from",
"the",
"discovery",
"URL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L520-L527 |
214,198 | moodle/moodle | lib/classes/oauth2/api.php | api.discover_endpoints | protected static function discover_endpoints($issuer) {
$curl = new curl();
if (empty($issuer->get('baseurl'))) {
return 0;
}
$url = $issuer->get_endpoint_url('discovery');
if (!$url) {
$url = $issuer->get('baseurl') . '/.well-known/openid-configuration'... | php | protected static function discover_endpoints($issuer) {
$curl = new curl();
if (empty($issuer->get('baseurl'))) {
return 0;
}
$url = $issuer->get_endpoint_url('discovery');
if (!$url) {
$url = $issuer->get('baseurl') . '/.well-known/openid-configuration'... | [
"protected",
"static",
"function",
"discover_endpoints",
"(",
"$",
"issuer",
")",
"{",
"$",
"curl",
"=",
"new",
"curl",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"issuer",
"->",
"get",
"(",
"'baseurl'",
")",
")",
")",
"{",
"return",
"0",
";",
"}... | If the discovery endpoint exists for this issuer, try and determine the list of valid endpoints.
@param issuer $issuer
@return int The number of discovered services. | [
"If",
"the",
"discovery",
"endpoint",
"exists",
"for",
"this",
"issuer",
"try",
"and",
"determine",
"the",
"list",
"of",
"valid",
"endpoints",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L535-L614 |
214,199 | moodle/moodle | lib/classes/oauth2/api.php | api.update_issuer | public static function update_issuer($data) {
require_capability('moodle/site:config', context_system::instance());
$issuer = new issuer(0, $data);
// Will throw exceptions on validation failures.
$issuer->update();
// Perform service discovery.
self::discover_endpoints... | php | public static function update_issuer($data) {
require_capability('moodle/site:config', context_system::instance());
$issuer = new issuer(0, $data);
// Will throw exceptions on validation failures.
$issuer->update();
// Perform service discovery.
self::discover_endpoints... | [
"public",
"static",
"function",
"update_issuer",
"(",
"$",
"data",
")",
"{",
"require_capability",
"(",
"'moodle/site:config'",
",",
"context_system",
"::",
"instance",
"(",
")",
")",
";",
"$",
"issuer",
"=",
"new",
"issuer",
"(",
"0",
",",
"$",
"data",
")... | Take the data from the mform and update the issuer.
@param stdClass $data
@return \core\oauth2\issuer | [
"Take",
"the",
"data",
"from",
"the",
"mform",
"and",
"update",
"the",
"issuer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/api.php#L622-L633 |
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.