id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
212,400 | moodle/moodle | mod/workshop/form/accumulative/lib.php | workshop_accumulative_strategy.scale_used | public static function scale_used($scaleid, $workshopid=null) {
global $DB;
$conditions['grade'] = -$scaleid;
if (!is_null($workshopid)) {
$conditions['workshopid'] = $workshopid;
}
return $DB->record_exists('workshopform_accumulative', $conditions);
} | php | public static function scale_used($scaleid, $workshopid=null) {
global $DB;
$conditions['grade'] = -$scaleid;
if (!is_null($workshopid)) {
$conditions['workshopid'] = $workshopid;
}
return $DB->record_exists('workshopform_accumulative', $conditions);
} | [
"public",
"static",
"function",
"scale_used",
"(",
"$",
"scaleid",
",",
"$",
"workshopid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"conditions",
"[",
"'grade'",
"]",
"=",
"-",
"$",
"scaleid",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
... | Is a given scale used by the instance of workshop?
@param int $scaleid id of the scale to check
@param int|null $workshopid id of workshop instance to check, checks all in case of null
@return bool | [
"Is",
"a",
"given",
"scale",
"used",
"by",
"the",
"instance",
"of",
"workshop?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/form/accumulative/lib.php#L366-L374 |
212,401 | moodle/moodle | mod/workshop/form/accumulative/lib.php | workshop_accumulative_strategy.update_peer_grade | protected function update_peer_grade(stdclass $assessment) {
$grades = $this->get_current_assessment_data($assessment);
$suggested = $this->calculate_peer_grade($grades);
if (!is_null($suggested)) {
$this->workshop->set_peer_grade($assessment->id, $suggested);
}
... | php | protected function update_peer_grade(stdclass $assessment) {
$grades = $this->get_current_assessment_data($assessment);
$suggested = $this->calculate_peer_grade($grades);
if (!is_null($suggested)) {
$this->workshop->set_peer_grade($assessment->id, $suggested);
}
... | [
"protected",
"function",
"update_peer_grade",
"(",
"stdclass",
"$",
"assessment",
")",
"{",
"$",
"grades",
"=",
"$",
"this",
"->",
"get_current_assessment_data",
"(",
"$",
"assessment",
")",
";",
"$",
"suggested",
"=",
"$",
"this",
"->",
"calculate_peer_grade",
... | Aggregates the assessment form data and sets the grade for the submission given by the peer
@param stdClass $assessment Assessment record
@return float|null Raw grade (from 0.00000 to 100.00000) for submission as suggested by the peer | [
"Aggregates",
"the",
"assessment",
"form",
"data",
"and",
"sets",
"the",
"grade",
"for",
"the",
"submission",
"given",
"by",
"the",
"peer"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/form/accumulative/lib.php#L509-L516 |
212,402 | moodle/moodle | mod/workshop/form/accumulative/lib.php | workshop_accumulative_strategy.scale_to_grade | protected function scale_to_grade($scaleid, $item) {
global $DB;
/** @var cache of numbers of scale items */
static $numofscaleitems = array();
if (!isset($numofscaleitems[$scaleid])) {
$scale = $DB->get_field('scale', 'scale', array('id' => $scaleid), MUST_EXIST);
... | php | protected function scale_to_grade($scaleid, $item) {
global $DB;
/** @var cache of numbers of scale items */
static $numofscaleitems = array();
if (!isset($numofscaleitems[$scaleid])) {
$scale = $DB->get_field('scale', 'scale', array('id' => $scaleid), MUST_EXIST);
... | [
"protected",
"function",
"scale_to_grade",
"(",
"$",
"scaleid",
",",
"$",
"item",
")",
"{",
"global",
"$",
"DB",
";",
"/** @var cache of numbers of scale items */",
"static",
"$",
"numofscaleitems",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
... | Convert scale grade to numerical grades
In accumulative grading strategy, scales are considered as grades from 0 to M-1, where M is the number of scale items.
@throws coding_exception
@param string $scaleid Scale identifier
@param int $item Selected scale item number, numbered 1, 2, 3, ... M
@return float | [
"Convert",
"scale",
"grade",
"to",
"numerical",
"grades"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/form/accumulative/lib.php#L569-L592 |
212,403 | moodle/moodle | auth/mnet/classes/task/cron_task.php | cron_task.execute | public function execute() {
global $DB, $CFG;
require_once($CFG->dirroot . '/auth/mnet/auth.php');
$mnetplugin = new \auth_plugin_mnet();
$mnetplugin->keepalive_client();
$random100 = rand(0,100);
if ($random100 < 10) {
$longtime = time() - DAYSECS;
... | php | public function execute() {
global $DB, $CFG;
require_once($CFG->dirroot . '/auth/mnet/auth.php');
$mnetplugin = new \auth_plugin_mnet();
$mnetplugin->keepalive_client();
$random100 = rand(0,100);
if ($random100 < 10) {
$longtime = time() - DAYSECS;
... | [
"public",
"function",
"execute",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/auth/mnet/auth.php'",
")",
";",
"$",
"mnetplugin",
"=",
"new",
"\\",
"auth_plugin_mnet",
"(",
")",
";",
... | Run auth mnet cron. | [
"Run",
"auth",
"mnet",
"cron",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/mnet/classes/task/cron_task.php#L39-L51 |
212,404 | moodle/moodle | admin/tool/oauth2/classes/output/renderer.php | renderer.endpoints_table | public function endpoints_table($endpoints, $issuerid) {
global $CFG;
$table = new html_table();
$table->head = [
get_string('name'),
get_string('url'),
get_string('edit'),
];
$table->attributes['class'] = 'admintable generaltable';
$... | php | public function endpoints_table($endpoints, $issuerid) {
global $CFG;
$table = new html_table();
$table->head = [
get_string('name'),
get_string('url'),
get_string('edit'),
];
$table->attributes['class'] = 'admintable generaltable';
$... | [
"public",
"function",
"endpoints_table",
"(",
"$",
"endpoints",
",",
"$",
"issuerid",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"table",
"=",
"new",
"html_table",
"(",
")",
";",
"$",
"table",
"->",
"head",
"=",
"[",
"get_string",
"(",
"'name'",
")",
... | This function will render one beautiful table with all the endpoints.
@param \core\oauth2\endpoint[] $endpoints - list of all endpoints.
@param int $issuerid
@return string HTML to output. | [
"This",
"function",
"will",
"render",
"one",
"beautiful",
"table",
"with",
"all",
"the",
"endpoints",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/oauth2/classes/output/renderer.php#L210-L260 |
212,405 | moodle/moodle | admin/tool/oauth2/classes/output/renderer.php | renderer.user_field_mappings_table | public function user_field_mappings_table($userfieldmappings, $issuerid) {
global $CFG;
$table = new html_table();
$table->head = [
get_string('userfieldexternalfield', 'tool_oauth2'),
get_string('userfieldinternalfield', 'tool_oauth2'),
get_string('edit'),
... | php | public function user_field_mappings_table($userfieldmappings, $issuerid) {
global $CFG;
$table = new html_table();
$table->head = [
get_string('userfieldexternalfield', 'tool_oauth2'),
get_string('userfieldinternalfield', 'tool_oauth2'),
get_string('edit'),
... | [
"public",
"function",
"user_field_mappings_table",
"(",
"$",
"userfieldmappings",
",",
"$",
"issuerid",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"table",
"=",
"new",
"html_table",
"(",
")",
";",
"$",
"table",
"->",
"head",
"=",
"[",
"get_string",
"(",
"... | This function will render one beautiful table with all the user_field_mappings.
@param \core\oauth2\user_field_mapping[] $userfieldmappings - list of all user_field_mappings.
@param int $issuerid
@return string HTML to output. | [
"This",
"function",
"will",
"render",
"one",
"beautiful",
"table",
"with",
"all",
"the",
"user_field_mappings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/oauth2/classes/output/renderer.php#L269-L318 |
212,406 | moodle/moodle | grade/grading/form/lib.php | gradingform_controller.is_own_form | public function is_own_form($userid = null) {
global $USER;
if (!$this->is_form_defined()) {
return null;
}
if (is_null($userid)) {
$userid = $USER->id;
}
return ($this->definition->usercreated == $userid);
} | php | public function is_own_form($userid = null) {
global $USER;
if (!$this->is_form_defined()) {
return null;
}
if (is_null($userid)) {
$userid = $USER->id;
}
return ($this->definition->usercreated == $userid);
} | [
"public",
"function",
"is_own_form",
"(",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"USER",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"is_form_defined",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"useri... | Is the grading form owned by the given user?
The form owner is the user who created this instance of the form.
@param int $userid the user id to check, defaults to the current user
@return boolean|null null if the form not defined yet, boolean otherwise | [
"Is",
"the",
"grading",
"form",
"owned",
"by",
"the",
"given",
"user?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/lib.php#L177-L187 |
212,407 | moodle/moodle | grade/grading/form/lib.php | gradingform_controller.get_editor_url | public function get_editor_url(moodle_url $returnurl = null) {
$params = array('areaid' => $this->areaid);
if (!is_null($returnurl)) {
$params['returnurl'] = $returnurl->out(false);
}
return new moodle_url('/grade/grading/form/'.$this->get_method_name().'/edit.php', $param... | php | public function get_editor_url(moodle_url $returnurl = null) {
$params = array('areaid' => $this->areaid);
if (!is_null($returnurl)) {
$params['returnurl'] = $returnurl->out(false);
}
return new moodle_url('/grade/grading/form/'.$this->get_method_name().'/edit.php', $param... | [
"public",
"function",
"get_editor_url",
"(",
"moodle_url",
"$",
"returnurl",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'areaid'",
"=>",
"$",
"this",
"->",
"areaid",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"returnurl",
")",
")",
... | Returns URL of a page where the grading form can be defined and edited.
@param moodle_url $returnurl optional URL of a page where the user should be sent once they are finished with editing
@return moodle_url | [
"Returns",
"URL",
"of",
"a",
"page",
"where",
"the",
"grading",
"form",
"can",
"be",
"defined",
"and",
"edited",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/lib.php#L208-L217 |
212,408 | moodle/moodle | grade/grading/form/lib.php | gradingform_controller.get_definition | public function get_definition($force = false) {
if ($this->definition === false || $force) {
$this->load_definition();
}
return $this->definition;
} | php | public function get_definition($force = false) {
if ($this->definition === false || $force) {
$this->load_definition();
}
return $this->definition;
} | [
"public",
"function",
"get_definition",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"definition",
"===",
"false",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"load_definition",
"(",
")",
";",
"}",
"return",
"$",
"thi... | Returns the grading form definition structure
@param boolean $force whether to force loading from DB even if it was already loaded
@return stdClass|false definition data or false if the form is not defined yet | [
"Returns",
"the",
"grading",
"form",
"definition",
"structure"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/lib.php#L252-L257 |
212,409 | moodle/moodle | grade/grading/form/lib.php | gradingform_controller.update_definition | public function update_definition(stdClass $definition, $usermodified = null) {
global $DB, $USER;
if (is_null($usermodified)) {
$usermodified = $USER->id;
}
if (!empty($this->definition->id)) {
// prepare a record to be updated
$record = new stdClas... | php | public function update_definition(stdClass $definition, $usermodified = null) {
global $DB, $USER;
if (is_null($usermodified)) {
$usermodified = $USER->id;
}
if (!empty($this->definition->id)) {
// prepare a record to be updated
$record = new stdClas... | [
"public",
"function",
"update_definition",
"(",
"stdClass",
"$",
"definition",
",",
"$",
"usermodified",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"if",
"(",
"is_null",
"(",
"$",
"usermodified",
")",
")",
"{",
"$",
"usermodified"... | Saves the defintion data into the database
The implementation in this base class stores the common data into the record
into the {grading_definition} table. The plugins are likely to extend this
and save their data into own tables, too.
@param stdClass $definition data containing values for the {grading_definition} t... | [
"Saves",
"the",
"defintion",
"data",
"into",
"the",
"database"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/lib.php#L300-L366 |
212,410 | moodle/moodle | grade/grading/form/lib.php | gradingform_controller.has_active_instances | public function has_active_instances() {
global $DB;
if (empty($this->definition->id)) {
return false;
}
if ($this->hasactiveinstances === null) {
$conditions = array('definitionid' => $this->definition->id,
'status' => gradingform_instan... | php | public function has_active_instances() {
global $DB;
if (empty($this->definition->id)) {
return false;
}
if ($this->hasactiveinstances === null) {
$conditions = array('definitionid' => $this->definition->id,
'status' => gradingform_instan... | [
"public",
"function",
"has_active_instances",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"definition",
"->",
"id",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"hasactiveinstances",... | Returns true if there are already people who has been graded on this definition.
In this case plugins may restrict changes of the grading definition
@return boolean | [
"Returns",
"true",
"if",
"there",
"are",
"already",
"people",
"who",
"has",
"been",
"graded",
"on",
"this",
"definition",
".",
"In",
"this",
"case",
"plugins",
"may",
"restrict",
"changes",
"of",
"the",
"grading",
"definition"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/lib.php#L462-L473 |
212,411 | moodle/moodle | grade/grading/form/lib.php | gradingform_controller.get_or_create_instance | public function get_or_create_instance($instanceid, $raterid, $itemid) {
global $DB;
if ($instanceid &&
$instance = $DB->get_record('grading_instances', array('id' => $instanceid, 'raterid' => $raterid, 'itemid' => $itemid), '*', IGNORE_MISSING)) {
return $this->get_instance... | php | public function get_or_create_instance($instanceid, $raterid, $itemid) {
global $DB;
if ($instanceid &&
$instance = $DB->get_record('grading_instances', array('id' => $instanceid, 'raterid' => $raterid, 'itemid' => $itemid), '*', IGNORE_MISSING)) {
return $this->get_instance... | [
"public",
"function",
"get_or_create_instance",
"(",
"$",
"instanceid",
",",
"$",
"raterid",
",",
"$",
"itemid",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"instanceid",
"&&",
"$",
"instance",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'grading_i... | If instanceid is specified and grading instance exists and it is created by this rater for
this item, this instance is returned.
Otherwise new instance is created for the specified rater and itemid
@param int $instanceid
@param int $raterid
@param int $itemid
@return gradingform_instance | [
"If",
"instanceid",
"is",
"specified",
"and",
"grading",
"instance",
"exists",
"and",
"it",
"is",
"created",
"by",
"this",
"rater",
"for",
"this",
"item",
"this",
"instance",
"is",
"returned",
".",
"Otherwise",
"new",
"instance",
"is",
"created",
"for",
"the... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/lib.php#L525-L532 |
212,412 | moodle/moodle | grade/grading/form/lib.php | gradingform_controller.delete_definition | public function delete_definition() {
global $DB;
if (!$this->is_form_defined()) {
// nothing to do
return;
}
// firstly, let the plugin delete everything from their own tables
$this->delete_plugin_definition();
// then, delete all instances left... | php | public function delete_definition() {
global $DB;
if (!$this->is_form_defined()) {
// nothing to do
return;
}
// firstly, let the plugin delete everything from their own tables
$this->delete_plugin_definition();
// then, delete all instances left... | [
"public",
"function",
"delete_definition",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"is_form_defined",
"(",
")",
")",
"{",
"// nothing to do",
"return",
";",
"}",
"// firstly, let the plugin delete everything from their own tables"... | Deletes the form definition and all the associated data
@see delete_plugin_definition()
@return void | [
"Deletes",
"the",
"form",
"definition",
"and",
"all",
"the",
"associated",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/lib.php#L551-L567 |
212,413 | moodle/moodle | grade/grading/form/lib.php | gradingform_controller.load_definition | protected function load_definition() {
global $DB;
$this->definition = $DB->get_record('grading_definitions', array(
'areaid' => $this->areaid,
'method' => $this->get_method_name()), '*', IGNORE_MISSING);
} | php | protected function load_definition() {
global $DB;
$this->definition = $DB->get_record('grading_definitions', array(
'areaid' => $this->areaid,
'method' => $this->get_method_name()), '*', IGNORE_MISSING);
} | [
"protected",
"function",
"load_definition",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"definition",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'grading_definitions'",
",",
"array",
"(",
"'areaid'",
"=>",
"$",
"this",
"->",
"areaid",
",",
... | Loads the form definition if it exists
The default implementation just tries to load the record from the {grading_definitions}
table. The plugins are likely to override this with a more complex query that loads
all required data at once. | [
"Loads",
"the",
"form",
"definition",
"if",
"it",
"exists"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/lib.php#L606-L611 |
212,414 | moodle/moodle | grade/grading/form/lib.php | gradingform_controller.set_grade_range | public final function set_grade_range(array $graderange, $allowgradedecimals = false) {
$this->graderange = $graderange;
$this->allowgradedecimals = $allowgradedecimals;
} | php | public final function set_grade_range(array $graderange, $allowgradedecimals = false) {
$this->graderange = $graderange;
$this->allowgradedecimals = $allowgradedecimals;
} | [
"public",
"final",
"function",
"set_grade_range",
"(",
"array",
"$",
"graderange",
",",
"$",
"allowgradedecimals",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"graderange",
"=",
"$",
"graderange",
";",
"$",
"this",
"->",
"allowgradedecimals",
"=",
"$",
"allow... | Sets the range of grades used in this area. This is usually either range like 0-100
or the scale where keys start from 1.
Typically modules will call it:
$controller->set_grade_range(make_grades_menu($gradingtype), $gradingtype > 0);
Negative $gradingtype means that scale is used and the grade must be rounded
to the n... | [
"Sets",
"the",
"range",
"of",
"grades",
"used",
"in",
"this",
"area",
".",
"This",
"is",
"usually",
"either",
"range",
"like",
"0",
"-",
"100",
"or",
"the",
"scale",
"where",
"keys",
"start",
"from",
"1",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/lib.php#L664-L667 |
212,415 | moodle/moodle | grade/grading/form/lib.php | gradingform_instance.create_new | public static function create_new($definitionid, $raterid, $itemid) {
global $DB;
$instance = new stdClass();
$instance->definitionid = $definitionid;
$instance->raterid = $raterid;
$instance->itemid = $itemid;
$instance->status = self::INSTANCE_STATUS_INCOMPLETE;
... | php | public static function create_new($definitionid, $raterid, $itemid) {
global $DB;
$instance = new stdClass();
$instance->definitionid = $definitionid;
$instance->raterid = $raterid;
$instance->itemid = $itemid;
$instance->status = self::INSTANCE_STATUS_INCOMPLETE;
... | [
"public",
"static",
"function",
"create_new",
"(",
"$",
"definitionid",
",",
"$",
"raterid",
",",
"$",
"itemid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"instance",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"instance",
"->",
"definitionid",
"=",
"$"... | Creates a new empty instance in DB and mark its status as INCOMPLETE
@param int $definitionid
@param int $raterid
@param int $itemid
@return int id of the created instance | [
"Creates",
"a",
"new",
"empty",
"instance",
"in",
"DB",
"and",
"mark",
"its",
"status",
"as",
"INCOMPLETE"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/lib.php#L786-L797 |
212,416 | moodle/moodle | search/engine/solr/classes/schema.php | schema.can_setup_server | public function can_setup_server() {
$status = $this->engine->is_server_configured();
if ($status !== true) {
return $status;
}
// At this stage we know that the server is properly configured with a valid host:port and indexname.
// We're not too concerned about rep... | php | public function can_setup_server() {
$status = $this->engine->is_server_configured();
if ($status !== true) {
return $status;
}
// At this stage we know that the server is properly configured with a valid host:port and indexname.
// We're not too concerned about rep... | [
"public",
"function",
"can_setup_server",
"(",
")",
"{",
"$",
"status",
"=",
"$",
"this",
"->",
"engine",
"->",
"is_server_configured",
"(",
")",
";",
"if",
"(",
"$",
"status",
"!==",
"true",
")",
"{",
"return",
"$",
"status",
";",
"}",
"// At this stage... | Can setup be executed against the configured server.
@return true|string True or error message. | [
"Can",
"setup",
"be",
"executed",
"against",
"the",
"configured",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/engine/solr/classes/schema.php#L87-L103 |
212,417 | moodle/moodle | search/engine/solr/classes/schema.php | schema.setup | public function setup($checkexisting = true) {
$fields = \search_solr\document::get_default_fields_definition();
// Field id is already there.
unset($fields['id']);
$this->check_index();
$return = $this->add_fields($fields, $checkexisting);
// Tell the engine we are n... | php | public function setup($checkexisting = true) {
$fields = \search_solr\document::get_default_fields_definition();
// Field id is already there.
unset($fields['id']);
$this->check_index();
$return = $this->add_fields($fields, $checkexisting);
// Tell the engine we are n... | [
"public",
"function",
"setup",
"(",
"$",
"checkexisting",
"=",
"true",
")",
"{",
"$",
"fields",
"=",
"\\",
"search_solr",
"\\",
"document",
"::",
"get_default_fields_definition",
"(",
")",
";",
"// Field id is already there.",
"unset",
"(",
"$",
"fields",
"[",
... | Setup solr stuff required by moodle.
@param bool $checkexisting Whether to check if the fields already exist or not
@return bool | [
"Setup",
"solr",
"stuff",
"required",
"by",
"moodle",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/engine/solr/classes/schema.php#L111-L125 |
212,418 | moodle/moodle | search/engine/solr/classes/schema.php | schema.validate_setup | public function validate_setup() {
$fields = \search_solr\document::get_default_fields_definition();
// Field id is already there.
unset($fields['id']);
$this->check_index();
$this->validate_fields($fields, true);
} | php | public function validate_setup() {
$fields = \search_solr\document::get_default_fields_definition();
// Field id is already there.
unset($fields['id']);
$this->check_index();
$this->validate_fields($fields, true);
} | [
"public",
"function",
"validate_setup",
"(",
")",
"{",
"$",
"fields",
"=",
"\\",
"search_solr",
"\\",
"document",
"::",
"get_default_fields_definition",
"(",
")",
";",
"// Field id is already there.",
"unset",
"(",
"$",
"fields",
"[",
"'id'",
"]",
")",
";",
"$... | Checks the schema is properly set up.
@throws \moodle_exception
@return void | [
"Checks",
"the",
"schema",
"is",
"properly",
"set",
"up",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/engine/solr/classes/schema.php#L133-L141 |
212,419 | moodle/moodle | search/engine/solr/classes/schema.php | schema.check_index | protected function check_index() {
// Check that the server is available and the index exists.
$url = $this->engine->get_connection_url('/select?wt=json');
$result = $this->curl->get($url);
if ($this->curl->error) {
throw new \moodle_exception('connectionerror', 'search_solr... | php | protected function check_index() {
// Check that the server is available and the index exists.
$url = $this->engine->get_connection_url('/select?wt=json');
$result = $this->curl->get($url);
if ($this->curl->error) {
throw new \moodle_exception('connectionerror', 'search_solr... | [
"protected",
"function",
"check_index",
"(",
")",
"{",
"// Check that the server is available and the index exists.",
"$",
"url",
"=",
"$",
"this",
"->",
"engine",
"->",
"get_connection_url",
"(",
"'/select?wt=json'",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",... | Checks if the index is ready, triggers an exception otherwise.
@throws \moodle_exception
@return void | [
"Checks",
"if",
"the",
"index",
"is",
"ready",
"triggers",
"an",
"exception",
"otherwise",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/engine/solr/classes/schema.php#L149-L160 |
212,420 | moodle/moodle | search/engine/solr/classes/schema.php | schema.add_fields | protected function add_fields($fields, $checkexisting = true) {
if ($checkexisting) {
// Check that non of them exists.
$this->validate_fields($fields, false);
}
$url = $this->engine->get_connection_url('/schema');
// Add all fields.
foreach ($fields as... | php | protected function add_fields($fields, $checkexisting = true) {
if ($checkexisting) {
// Check that non of them exists.
$this->validate_fields($fields, false);
}
$url = $this->engine->get_connection_url('/schema');
// Add all fields.
foreach ($fields as... | [
"protected",
"function",
"add_fields",
"(",
"$",
"fields",
",",
"$",
"checkexisting",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"checkexisting",
")",
"{",
"// Check that non of them exists.",
"$",
"this",
"->",
"validate_fields",
"(",
"$",
"fields",
",",
"false",... | Adds the provided fields to Solr schema.
Intentionally separated from create(), it can be called to add extra fields.
fields separately.
@throws \coding_exception
@throws \moodle_exception
@param array $fields \core_search\document::$requiredfields format
@param bool $checkexisting Whether to check if the fields al... | [
"Adds",
"the",
"provided",
"fields",
"to",
"Solr",
"schema",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/engine/solr/classes/schema.php#L174-L213 |
212,421 | moodle/moodle | search/engine/solr/classes/schema.php | schema.validate_fields | protected function validate_fields(&$fields, $requireexisting = false) {
global $CFG;
foreach ($fields as $fieldname => $data) {
$url = $this->engine->get_connection_url('/schema/fields/' . $fieldname);
$results = $this->curl->get($url);
if ($this->curl->error) {
... | php | protected function validate_fields(&$fields, $requireexisting = false) {
global $CFG;
foreach ($fields as $fieldname => $data) {
$url = $this->engine->get_connection_url('/schema/fields/' . $fieldname);
$results = $this->curl->get($url);
if ($this->curl->error) {
... | [
"protected",
"function",
"validate_fields",
"(",
"&",
"$",
"fields",
",",
"$",
"requireexisting",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"fieldname",
"=>",
"$",
"data",
")",
"{",
"$",
"url",
"=",
... | Checks if the schema existing fields are properly set, triggers an exception otherwise.
@throws \moodle_exception
@param array $fields
@param bool $requireexisting Require the fields to exist, otherwise exception.
@return void | [
"Checks",
"if",
"the",
"schema",
"existing",
"fields",
"are",
"properly",
"set",
"triggers",
"an",
"exception",
"otherwise",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/engine/solr/classes/schema.php#L223-L276 |
212,422 | moodle/moodle | search/engine/solr/classes/schema.php | schema.validate_add_field_result | protected function validate_add_field_result($result) {
if (!$result) {
throw new \moodle_exception('errorcreatingschema', 'search_solr', '', get_string('nodatafromserver', 'search_solr'));
}
$results = json_decode($result);
if (!$results) {
if (is_scalar($resul... | php | protected function validate_add_field_result($result) {
if (!$result) {
throw new \moodle_exception('errorcreatingschema', 'search_solr', '', get_string('nodatafromserver', 'search_solr'));
}
$results = json_decode($result);
if (!$results) {
if (is_scalar($resul... | [
"protected",
"function",
"validate_add_field_result",
"(",
"$",
"result",
")",
"{",
"if",
"(",
"!",
"$",
"result",
")",
"{",
"throw",
"new",
"\\",
"moodle_exception",
"(",
"'errorcreatingschema'",
",",
"'search_solr'",
",",
"''",
",",
"get_string",
"(",
"'noda... | Checks that the field results do not contain errors.
@throws \moodle_exception
@param string $results curl response body
@return void | [
"Checks",
"that",
"the",
"field",
"results",
"do",
"not",
"contain",
"errors",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/engine/solr/classes/schema.php#L285-L317 |
212,423 | moodle/moodle | search/engine/solr/classes/schema.php | schema.doc_field_to_solr_field | private function doc_field_to_solr_field($datatype) {
$type = $datatype;
$solrversion = $this->engine->get_solr_major_version();
switch($datatype) {
case 'text':
$type = 'text_general';
break;
case 'int':
if ($solrversion ... | php | private function doc_field_to_solr_field($datatype) {
$type = $datatype;
$solrversion = $this->engine->get_solr_major_version();
switch($datatype) {
case 'text':
$type = 'text_general';
break;
case 'int':
if ($solrversion ... | [
"private",
"function",
"doc_field_to_solr_field",
"(",
"$",
"datatype",
")",
"{",
"$",
"type",
"=",
"$",
"datatype",
";",
"$",
"solrversion",
"=",
"$",
"this",
"->",
"engine",
"->",
"get_solr_major_version",
"(",
")",
";",
"switch",
"(",
"$",
"datatype",
"... | Returns the solr field type from the document field type string.
@param string $datatype
@return string | [
"Returns",
"the",
"solr",
"field",
"type",
"from",
"the",
"document",
"field",
"type",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/engine/solr/classes/schema.php#L325-L347 |
212,424 | moodle/moodle | lib/scssphp/Node/Number.php | Number.coerce | public function coerce($units)
{
if ($this->unitless()) {
return new Number($this->dimension, $units);
}
$dimension = $this->dimension;
foreach (static::$unitTable['in'] as $unit => $conv) {
$from = isset($this->units[$unit]) ? $this->units[$unit] : 0;... | php | public function coerce($units)
{
if ($this->unitless()) {
return new Number($this->dimension, $units);
}
$dimension = $this->dimension;
foreach (static::$unitTable['in'] as $unit => $conv) {
$from = isset($this->units[$unit]) ? $this->units[$unit] : 0;... | [
"public",
"function",
"coerce",
"(",
"$",
"units",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"unitless",
"(",
")",
")",
"{",
"return",
"new",
"Number",
"(",
"$",
"this",
"->",
"dimension",
",",
"$",
"units",
")",
";",
"}",
"$",
"dimension",
"=",
"$... | Coerce number to target units
@param array $units
@return \Leafo\ScssPhp\Node\Number | [
"Coerce",
"number",
"to",
"target",
"units"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Node/Number.php#L105-L121 |
212,425 | moodle/moodle | question/classes/statistics/responses/analysis_for_class.php | analysis_for_class.count_response | public function count_response($actualresponse, $fraction, $try) {
if (!isset($this->actualresponses[$actualresponse])) {
if ($fraction === null) {
$fraction = $this->fraction;
}
$this->add_response($actualresponse, $fraction);
}
$this->get_res... | php | public function count_response($actualresponse, $fraction, $try) {
if (!isset($this->actualresponses[$actualresponse])) {
if ($fraction === null) {
$fraction = $this->fraction;
}
$this->add_response($actualresponse, $fraction);
}
$this->get_res... | [
"public",
"function",
"count_response",
"(",
"$",
"actualresponse",
",",
"$",
"fraction",
",",
"$",
"try",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"actualresponses",
"[",
"$",
"actualresponse",
"]",
")",
")",
"{",
"if",
"(",
"$",
"... | Keep a count of a response to this question sub part that falls within this class.
@param string $actualresponse
@param float|null $fraction
@param int $try
@return \core_question\statistics\responses\analysis_for_actual_response | [
"Keep",
"a",
"count",
"of",
"a",
"response",
"to",
"this",
"question",
"sub",
"part",
"that",
"falls",
"within",
"this",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/responses/analysis_for_class.php#L88-L96 |
212,426 | moodle/moodle | question/classes/statistics/responses/analysis_for_class.php | analysis_for_class.has_actual_responses | public function has_actual_responses() {
$actualresponses = $this->get_responses();
if (count($actualresponses) > 1) {
return true;
} else if (count($actualresponses) === 1) {
$singleactualresponse = reset($actualresponses);
return (string)$singleactualrespons... | php | public function has_actual_responses() {
$actualresponses = $this->get_responses();
if (count($actualresponses) > 1) {
return true;
} else if (count($actualresponses) === 1) {
$singleactualresponse = reset($actualresponses);
return (string)$singleactualrespons... | [
"public",
"function",
"has_actual_responses",
"(",
")",
"{",
"$",
"actualresponses",
"=",
"$",
"this",
"->",
"get_responses",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"actualresponses",
")",
">",
"1",
")",
"{",
"return",
"true",
";",
"}",
"else",
"... | Are there actual responses to sub parts that where classified into this class?
@return bool whether this analysis has a response class with more than one
different actual response, or if the actual response is different from
the model response. | [
"Are",
"there",
"actual",
"responses",
"to",
"sub",
"parts",
"that",
"where",
"classified",
"into",
"this",
"class?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/responses/analysis_for_class.php#L142-L151 |
212,427 | moodle/moodle | question/classes/statistics/responses/analysis_for_class.php | analysis_for_class.data_for_question_response_table | public function data_for_question_response_table($responseclasscolumn, $partid) {
$return = array();
if (count($this->get_responses()) == 0) {
$rowdata = new \stdClass();
$rowdata->part = $partid;
$rowdata->responseclass = $this->modelresponse;
if (!$respo... | php | public function data_for_question_response_table($responseclasscolumn, $partid) {
$return = array();
if (count($this->get_responses()) == 0) {
$rowdata = new \stdClass();
$rowdata->part = $partid;
$rowdata->responseclass = $this->modelresponse;
if (!$respo... | [
"public",
"function",
"data_for_question_response_table",
"(",
"$",
"responseclasscolumn",
",",
"$",
"partid",
")",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"get_responses",
"(",
")",
")",
"==",
"0",
")... | Return the data to display in the response analysis table.
@param bool $responseclasscolumn
@param string $partid
@return object[] | [
"Return",
"the",
"data",
"to",
"display",
"in",
"the",
"response",
"analysis",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/responses/analysis_for_class.php#L160-L182 |
212,428 | moodle/moodle | question/classes/statistics/responses/analysis_for_class.php | analysis_for_class.get_maximum_tries | public function get_maximum_tries() {
$max = 1;
foreach ($this->get_responses() as $actualresponse) {
$max = max($max, $this->get_response($actualresponse)->get_maximum_tries());
}
return $max;
} | php | public function get_maximum_tries() {
$max = 1;
foreach ($this->get_responses() as $actualresponse) {
$max = max($max, $this->get_response($actualresponse)->get_maximum_tries());
}
return $max;
} | [
"public",
"function",
"get_maximum_tries",
"(",
")",
"{",
"$",
"max",
"=",
"1",
";",
"foreach",
"(",
"$",
"this",
"->",
"get_responses",
"(",
")",
"as",
"$",
"actualresponse",
")",
"{",
"$",
"max",
"=",
"max",
"(",
"$",
"max",
",",
"$",
"this",
"->... | What is the highest try number that an actual response of this response class has been seen?
@return int try number | [
"What",
"is",
"the",
"highest",
"try",
"number",
"that",
"an",
"actual",
"response",
"of",
"this",
"response",
"class",
"has",
"been",
"seen?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/responses/analysis_for_class.php#L189-L195 |
212,429 | moodle/moodle | lib/adodb/drivers/adodb-odbc_mssql.inc.php | ADODB_odbc_mssql.ServerInfo | function ServerInfo()
{
global $ADODB_FETCH_MODE;
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$row = $this->GetRow("execute sp_server_info 2");
$ADODB_FETCH_MODE = $save;
if (!is_array($row)) return false;
$arr['description'] = $row[2];
$arr['version'] = ADOConnection::_findvers($arr... | php | function ServerInfo()
{
global $ADODB_FETCH_MODE;
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$row = $this->GetRow("execute sp_server_info 2");
$ADODB_FETCH_MODE = $save;
if (!is_array($row)) return false;
$arr['description'] = $row[2];
$arr['version'] = ADOConnection::_findvers($arr... | [
"function",
"ServerInfo",
"(",
")",
"{",
"global",
"$",
"ADODB_FETCH_MODE",
";",
"$",
"save",
"=",
"$",
"ADODB_FETCH_MODE",
";",
"$",
"ADODB_FETCH_MODE",
"=",
"ADODB_FETCH_NUM",
";",
"$",
"row",
"=",
"$",
"this",
"->",
"GetRow",
"(",
"\"execute sp_server_info ... | crashes php... | [
"crashes",
"php",
"..."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-odbc_mssql.inc.php#L57-L68 |
212,430 | moodle/moodle | backup/moodle2/restore_settingslib.php | restore_course_defaultcustom_setting.get_normalized_value | public function get_normalized_value() {
$value = $this->get_value();
if ($value === false && $this->get_ui() instanceof backup_setting_ui_defaultcustom) {
$attributes = $this->get_ui()->get_attributes();
return $attributes['defaultvalue'];
}
return $value;
} | php | public function get_normalized_value() {
$value = $this->get_value();
if ($value === false && $this->get_ui() instanceof backup_setting_ui_defaultcustom) {
$attributes = $this->get_ui()->get_attributes();
return $attributes['defaultvalue'];
}
return $value;
} | [
"public",
"function",
"get_normalized_value",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"get_value",
"(",
")",
";",
"if",
"(",
"$",
"value",
"===",
"false",
"&&",
"$",
"this",
"->",
"get_ui",
"(",
")",
"instanceof",
"backup_setting_ui_defaultcus... | Special method for this element only. When value is "false" returns the default value.
@return mixed | [
"Special",
"method",
"for",
"this",
"element",
"only",
".",
"When",
"value",
"is",
"false",
"returns",
"the",
"default",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/restore_settingslib.php#L180-L187 |
212,431 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Exception.php | Horde_Imap_Client_Exception.messagePrintf | public function messagePrintf(array $args = array())
{
$this->raw_msg = vsprintf($this->raw_msg, $args);
$this->message = vsprintf($this->message, $args);
} | php | public function messagePrintf(array $args = array())
{
$this->raw_msg = vsprintf($this->raw_msg, $args);
$this->message = vsprintf($this->message, $args);
} | [
"public",
"function",
"messagePrintf",
"(",
"array",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"raw_msg",
"=",
"vsprintf",
"(",
"$",
"this",
"->",
"raw_msg",
",",
"$",
"args",
")",
";",
"$",
"this",
"->",
"message",
"=",
"vs... | Perform substitution of variables in the error message.
Needed to allow for correct translation of error message.
@since 2.22.0
@param array $args Arguments used for substitution. | [
"Perform",
"substitution",
"of",
"variables",
"in",
"the",
"error",
"message",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Exception.php#L297-L301 |
212,432 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.client | public static function client($server_version, $server_hostname,
$server_port, $server_uri, $changeSessionID = true
) {
phpCAS :: traceBegin();
if (is_object(self::$_PHPCAS_CLIENT)) {
phpCAS :: error(self::$_PHPCAS_INIT_CALL['method'] . '() has already been called (at ' . self::$... | php | public static function client($server_version, $server_hostname,
$server_port, $server_uri, $changeSessionID = true
) {
phpCAS :: traceBegin();
if (is_object(self::$_PHPCAS_CLIENT)) {
phpCAS :: error(self::$_PHPCAS_INIT_CALL['method'] . '() has already been called (at ' . self::$... | [
"public",
"static",
"function",
"client",
"(",
"$",
"server_version",
",",
"$",
"server_hostname",
",",
"$",
"server_port",
",",
"$",
"server_uri",
",",
"$",
"changeSessionID",
"=",
"true",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"if",
"(",
... | phpCAS client initializer.
@param string $server_version the version of the CAS server
@param string $server_hostname the hostname of the CAS server
@param string $server_port the port the CAS server is running on
@param string $server_uri the URI the CAS server is responding on
@param bool $changeSessionI... | [
"phpCAS",
"client",
"initializer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L338-L365 |
212,433 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.setVerbose | public static function setVerbose($verbose)
{
if ($verbose === true) {
self::$_PHPCAS_VERBOSE = true;
} else {
self::$_PHPCAS_VERBOSE = false;
}
} | php | public static function setVerbose($verbose)
{
if ($verbose === true) {
self::$_PHPCAS_VERBOSE = true;
} else {
self::$_PHPCAS_VERBOSE = false;
}
} | [
"public",
"static",
"function",
"setVerbose",
"(",
"$",
"verbose",
")",
"{",
"if",
"(",
"$",
"verbose",
"===",
"true",
")",
"{",
"self",
"::",
"$",
"_PHPCAS_VERBOSE",
"=",
"true",
";",
"}",
"else",
"{",
"self",
"::",
"$",
"_PHPCAS_VERBOSE",
"=",
"false... | Enable verbose errors messages in the website output
This is a security relevant since internal status info may leak an may
help an attacker. Default is therefore false
@param bool $verbose enable verbose output
@return void | [
"Enable",
"verbose",
"errors",
"messages",
"in",
"the",
"website",
"output",
"This",
"is",
"a",
"security",
"relevant",
"since",
"internal",
"status",
"info",
"may",
"leak",
"an",
"may",
"help",
"an",
"attacker",
".",
"Default",
"is",
"therefore",
"false"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L481-L488 |
212,434 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.log | public static function log($str)
{
$indent_str = ".";
if (!empty(self::$_PHPCAS_DEBUG['filename'])) {
// Check if file exists and modifiy file permissions to be only
// readable by the webserver
if (!file_exists(self::$_PHPCAS_DEBUG['filename'])) {
... | php | public static function log($str)
{
$indent_str = ".";
if (!empty(self::$_PHPCAS_DEBUG['filename'])) {
// Check if file exists and modifiy file permissions to be only
// readable by the webserver
if (!file_exists(self::$_PHPCAS_DEBUG['filename'])) {
... | [
"public",
"static",
"function",
"log",
"(",
"$",
"str",
")",
"{",
"$",
"indent_str",
"=",
"\".\"",
";",
"if",
"(",
"!",
"empty",
"(",
"self",
"::",
"$",
"_PHPCAS_DEBUG",
"[",
"'filename'",
"]",
")",
")",
"{",
"// Check if file exists and modifiy file permiss... | Logs a string in debug mode.
@param string $str the string to write
@return void
@private | [
"Logs",
"a",
"string",
"in",
"debug",
"mode",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L509-L532 |
212,435 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.error | public static function error($msg)
{
phpCAS :: traceBegin();
$dbg = debug_backtrace();
$function = '?';
$file = '?';
$line = '?';
if (is_array($dbg)) {
for ($i = 1; $i < sizeof($dbg); $i++) {
if (is_array($dbg[$i]) && isset($dbg[$i]['class'... | php | public static function error($msg)
{
phpCAS :: traceBegin();
$dbg = debug_backtrace();
$function = '?';
$file = '?';
$line = '?';
if (is_array($dbg)) {
for ($i = 1; $i < sizeof($dbg); $i++) {
if (is_array($dbg[$i]) && isset($dbg[$i]['class'... | [
"public",
"static",
"function",
"error",
"(",
"$",
"msg",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"$",
"dbg",
"=",
"debug_backtrace",
"(",
")",
";",
"$",
"function",
"=",
"'?'",
";",
"$",
"file",
"=",
"'?'",
";",
"$",
"line",
"=",
... | This method is used by interface methods to print an error and where the
function was originally called from.
@param string $msg the message to print
@return void
@private | [
"This",
"method",
"is",
"used",
"by",
"interface",
"methods",
"to",
"print",
"an",
"error",
"and",
"where",
"the",
"function",
"was",
"originally",
"called",
"from",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L543-L570 |
212,436 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.trace | public static function trace($str)
{
$dbg = debug_backtrace();
phpCAS :: log($str . ' [' . basename($dbg[0]['file']) . ':' . $dbg[0]['line'] . ']');
} | php | public static function trace($str)
{
$dbg = debug_backtrace();
phpCAS :: log($str . ' [' . basename($dbg[0]['file']) . ':' . $dbg[0]['line'] . ']');
} | [
"public",
"static",
"function",
"trace",
"(",
"$",
"str",
")",
"{",
"$",
"dbg",
"=",
"debug_backtrace",
"(",
")",
";",
"phpCAS",
"::",
"log",
"(",
"$",
"str",
".",
"' ['",
".",
"basename",
"(",
"$",
"dbg",
"[",
"0",
"]",
"[",
"'file'",
"]",
")",
... | This method is used to log something in debug mode.
@param string $str string to log
@return void | [
"This",
"method",
"is",
"used",
"to",
"log",
"something",
"in",
"debug",
"mode",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L579-L583 |
212,437 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.traceBegin | public static function traceBegin()
{
$dbg = debug_backtrace();
$str = '=> ';
if (!empty ($dbg[1]['class'])) {
$str .= $dbg[1]['class'] . '::';
}
$str .= $dbg[1]['function'] . '(';
if (is_array($dbg[1]['args'])) {
foreach ($dbg[1]['args'] as $i... | php | public static function traceBegin()
{
$dbg = debug_backtrace();
$str = '=> ';
if (!empty ($dbg[1]['class'])) {
$str .= $dbg[1]['class'] . '::';
}
$str .= $dbg[1]['function'] . '(';
if (is_array($dbg[1]['args'])) {
foreach ($dbg[1]['args'] as $i... | [
"public",
"static",
"function",
"traceBegin",
"(",
")",
"{",
"$",
"dbg",
"=",
"debug_backtrace",
"(",
")",
";",
"$",
"str",
"=",
"'=> '",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"dbg",
"[",
"1",
"]",
"[",
"'class'",
"]",
")",
")",
"{",
"$",
"st... | This method is used to indicate the start of the execution of a function
in debug mode.
@return void | [
"This",
"method",
"is",
"used",
"to",
"indicate",
"the",
"start",
"of",
"the",
"execution",
"of",
"a",
"function",
"in",
"debug",
"mode",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L591-L628 |
212,438 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.traceEnd | public static function traceEnd($res = '')
{
if (empty(self::$_PHPCAS_DEBUG['indent'])) {
self::$_PHPCAS_DEBUG['indent'] = 0;
} else {
self::$_PHPCAS_DEBUG['indent']--;
}
$dbg = debug_backtrace();
$str = '';
if (is_object($res)) {
$... | php | public static function traceEnd($res = '')
{
if (empty(self::$_PHPCAS_DEBUG['indent'])) {
self::$_PHPCAS_DEBUG['indent'] = 0;
} else {
self::$_PHPCAS_DEBUG['indent']--;
}
$dbg = debug_backtrace();
$str = '';
if (is_object($res)) {
$... | [
"public",
"static",
"function",
"traceEnd",
"(",
"$",
"res",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"_PHPCAS_DEBUG",
"[",
"'indent'",
"]",
")",
")",
"{",
"self",
"::",
"$",
"_PHPCAS_DEBUG",
"[",
"'indent'",
"]",
"=",
"0",
... | This method is used to indicate the end of the execution of a function in
debug mode.
@param string $res the result of the function
@return void | [
"This",
"method",
"is",
"used",
"to",
"indicate",
"the",
"end",
"of",
"the",
"execution",
"of",
"a",
"function",
"in",
"debug",
"mode",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L638-L654 |
212,439 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.setHTMLHeader | public static function setHTMLHeader($header)
{
phpCAS::_validateClientExists();
try {
self::$_PHPCAS_CLIENT->setHTMLHeader($header);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
}
} | php | public static function setHTMLHeader($header)
{
phpCAS::_validateClientExists();
try {
self::$_PHPCAS_CLIENT->setHTMLHeader($header);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
}
} | [
"public",
"static",
"function",
"setHTMLHeader",
"(",
"$",
"header",
")",
"{",
"phpCAS",
"::",
"_validateClientExists",
"(",
")",
";",
"try",
"{",
"self",
"::",
"$",
"_PHPCAS_CLIENT",
"->",
"setHTMLHeader",
"(",
"$",
"header",
")",
";",
"}",
"catch",
"(",
... | This method sets the HTML header used for all outputs.
@param string $header the HTML header.
@return void | [
"This",
"method",
"sets",
"the",
"HTML",
"header",
"used",
"for",
"all",
"outputs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L735-L744 |
212,440 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.setHTMLFooter | public static function setHTMLFooter($footer)
{
phpCAS::_validateClientExists();
try {
self::$_PHPCAS_CLIENT->setHTMLFooter($footer);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
}
} | php | public static function setHTMLFooter($footer)
{
phpCAS::_validateClientExists();
try {
self::$_PHPCAS_CLIENT->setHTMLFooter($footer);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
}
} | [
"public",
"static",
"function",
"setHTMLFooter",
"(",
"$",
"footer",
")",
"{",
"phpCAS",
"::",
"_validateClientExists",
"(",
")",
";",
"try",
"{",
"self",
"::",
"$",
"_PHPCAS_CLIENT",
"->",
"setHTMLFooter",
"(",
"$",
"footer",
")",
";",
"}",
"catch",
"(",
... | This method sets the HTML footer used for all outputs.
@param string $footer the HTML footer.
@return void | [
"This",
"method",
"sets",
"the",
"HTML",
"footer",
"used",
"for",
"all",
"outputs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L753-L762 |
212,441 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.hasAttribute | public static function hasAttribute($key)
{
phpCAS::_validateClientExists();
try {
return self::$_PHPCAS_CLIENT->hasAttribute($key);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
}
} | php | public static function hasAttribute($key)
{
phpCAS::_validateClientExists();
try {
return self::$_PHPCAS_CLIENT->hasAttribute($key);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
}
} | [
"public",
"static",
"function",
"hasAttribute",
"(",
"$",
"key",
")",
"{",
"phpCAS",
"::",
"_validateClientExists",
"(",
")",
";",
"try",
"{",
"return",
"self",
"::",
"$",
"_PHPCAS_CLIENT",
"->",
"hasAttribute",
"(",
"$",
"key",
")",
";",
"}",
"catch",
"... | Answer true if an attribute exists for the authenticated user.
@param string $key attribute name
@return bool
@warning should only be called after phpCAS::forceAuthentication()
or phpCAS::checkAuthentication(). | [
"Answer",
"true",
"if",
"an",
"attribute",
"exists",
"for",
"the",
"authenticated",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L1233-L1242 |
212,442 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.handleLogoutRequests | public static function handleLogoutRequests($check_client = true, $allowed_clients = false)
{
phpCAS::_validateClientExists();
return (self::$_PHPCAS_CLIENT->handleLogoutRequests($check_client, $allowed_clients));
} | php | public static function handleLogoutRequests($check_client = true, $allowed_clients = false)
{
phpCAS::_validateClientExists();
return (self::$_PHPCAS_CLIENT->handleLogoutRequests($check_client, $allowed_clients));
} | [
"public",
"static",
"function",
"handleLogoutRequests",
"(",
"$",
"check_client",
"=",
"true",
",",
"$",
"allowed_clients",
"=",
"false",
")",
"{",
"phpCAS",
"::",
"_validateClientExists",
"(",
")",
";",
"return",
"(",
"self",
"::",
"$",
"_PHPCAS_CLIENT",
"->"... | Handle logout requests.
@param bool $check_client additional safety check
@param array $allowed_clients array of allowed clients
@return void | [
"Handle",
"logout",
"requests",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L1272-L1277 |
212,443 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.setServerLoginURL | public static function setServerLoginURL($url = '')
{
phpCAS :: traceBegin();
phpCAS::_validateClientExists();
try {
self::$_PHPCAS_CLIENT->setServerLoginURL($url);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
}
... | php | public static function setServerLoginURL($url = '')
{
phpCAS :: traceBegin();
phpCAS::_validateClientExists();
try {
self::$_PHPCAS_CLIENT->setServerLoginURL($url);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
}
... | [
"public",
"static",
"function",
"setServerLoginURL",
"(",
"$",
"url",
"=",
"''",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"phpCAS",
"::",
"_validateClientExists",
"(",
")",
";",
"try",
"{",
"self",
"::",
"$",
"_PHPCAS_CLIENT",
"->",
"setServe... | Set the login URL of the CAS server.
@param string $url the login URL
@return void
@since 0.4.21 by Wyman Chan | [
"Set",
"the",
"login",
"URL",
"of",
"the",
"CAS",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L1300-L1312 |
212,444 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.setFixedCallbackURL | public static function setFixedCallbackURL($url = '')
{
phpCAS :: traceBegin();
phpCAS::_validateProxyExists();
try {
self::$_PHPCAS_CLIENT->setCallbackURL($url);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
}
... | php | public static function setFixedCallbackURL($url = '')
{
phpCAS :: traceBegin();
phpCAS::_validateProxyExists();
try {
self::$_PHPCAS_CLIENT->setCallbackURL($url);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
}
... | [
"public",
"static",
"function",
"setFixedCallbackURL",
"(",
"$",
"url",
"=",
"''",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"phpCAS",
"::",
"_validateProxyExists",
"(",
")",
";",
"try",
"{",
"self",
"::",
"$",
"_PHPCAS_CLIENT",
"->",
"setCall... | Set the fixed URL that will be used by the CAS server to transmit the
PGT. When this method is not called, a phpCAS script uses its own URL
for the callback.
@param string $url the URL
@return void | [
"Set",
"the",
"fixed",
"URL",
"that",
"will",
"be",
"used",
"by",
"the",
"CAS",
"server",
"to",
"transmit",
"the",
"PGT",
".",
"When",
"this",
"method",
"is",
"not",
"called",
"a",
"phpCAS",
"script",
"uses",
"its",
"own",
"URL",
"for",
"the",
"callbac... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L1544-L1556 |
212,445 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.setFixedServiceURL | public static function setFixedServiceURL($url)
{
phpCAS :: traceBegin();
phpCAS::_validateProxyExists();
try {
self::$_PHPCAS_CLIENT->setURL($url);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
}
phpCAS :... | php | public static function setFixedServiceURL($url)
{
phpCAS :: traceBegin();
phpCAS::_validateProxyExists();
try {
self::$_PHPCAS_CLIENT->setURL($url);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->getMessage());
}
phpCAS :... | [
"public",
"static",
"function",
"setFixedServiceURL",
"(",
"$",
"url",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"phpCAS",
"::",
"_validateProxyExists",
"(",
")",
";",
"try",
"{",
"self",
"::",
"$",
"_PHPCAS_CLIENT",
"->",
"setURL",
"(",
"$",
... | Set the fixed URL that will be set as the CAS service parameter. When this
method is not called, a phpCAS script uses its own URL.
@param string $url the URL
@return void | [
"Set",
"the",
"fixed",
"URL",
"that",
"will",
"be",
"set",
"as",
"the",
"CAS",
"service",
"parameter",
".",
"When",
"this",
"method",
"is",
"not",
"called",
"a",
"phpCAS",
"script",
"uses",
"its",
"own",
"URL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L1566-L1578 |
212,446 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.retrievePT | public static function retrievePT($target_service, & $err_code, & $err_msg)
{
phpCAS::_validateProxyExists();
try {
return (self::$_PHPCAS_CLIENT->retrievePT($target_service, $err_code, $err_msg));
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->g... | php | public static function retrievePT($target_service, & $err_code, & $err_msg)
{
phpCAS::_validateProxyExists();
try {
return (self::$_PHPCAS_CLIENT->retrievePT($target_service, $err_code, $err_msg));
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ' . $e->g... | [
"public",
"static",
"function",
"retrievePT",
"(",
"$",
"target_service",
",",
"&",
"$",
"err_code",
",",
"&",
"$",
"err_msg",
")",
"{",
"phpCAS",
"::",
"_validateProxyExists",
"(",
")",
";",
"try",
"{",
"return",
"(",
"self",
"::",
"$",
"_PHPCAS_CLIENT",
... | Retrieve a Proxy Ticket from the CAS server.
@param string $target_service Url string of service to proxy
@param string &$err_code error code
@param string &$err_msg error message
@return string Proxy Ticket | [
"Retrieve",
"a",
"Proxy",
"Ticket",
"from",
"the",
"CAS",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L1600-L1609 |
212,447 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.setCasServerCACert | public static function setCasServerCACert($cert, $validate_cn = true)
{
phpCAS :: traceBegin();
phpCAS::_validateClientExists();
try {
self::$_PHPCAS_CLIENT->setCasServerCACert($cert, $validate_cn);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ... | php | public static function setCasServerCACert($cert, $validate_cn = true)
{
phpCAS :: traceBegin();
phpCAS::_validateClientExists();
try {
self::$_PHPCAS_CLIENT->setCasServerCACert($cert, $validate_cn);
} catch (Exception $e) {
phpCAS :: error(get_class($e) . ': ... | [
"public",
"static",
"function",
"setCasServerCACert",
"(",
"$",
"cert",
",",
"$",
"validate_cn",
"=",
"true",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"phpCAS",
"::",
"_validateClientExists",
"(",
")",
";",
"try",
"{",
"self",
"::",
"$",
"_... | Set the certificate of the CAS server CA and if the CN should be properly
verified.
@param string $cert CA certificate file name
@param bool $validate_cn Validate CN in certificate (default true)
@return void | [
"Set",
"the",
"certificate",
"of",
"the",
"CAS",
"server",
"CA",
"and",
"if",
"the",
"CN",
"should",
"be",
"properly",
"verified",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L1620-L1632 |
212,448 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.setNoCasServerValidation | public static function setNoCasServerValidation()
{
phpCAS :: traceBegin();
phpCAS::_validateClientExists();
phpCAS :: trace('You have configured no validation of the legitimacy of the cas server. This is not recommended for production use.');
self::$_PHPCAS_CLIENT->setNoCasServerVa... | php | public static function setNoCasServerValidation()
{
phpCAS :: traceBegin();
phpCAS::_validateClientExists();
phpCAS :: trace('You have configured no validation of the legitimacy of the cas server. This is not recommended for production use.');
self::$_PHPCAS_CLIENT->setNoCasServerVa... | [
"public",
"static",
"function",
"setNoCasServerValidation",
"(",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"phpCAS",
"::",
"_validateClientExists",
"(",
")",
";",
"phpCAS",
"::",
"trace",
"(",
"'You have configured no validation of the legitimacy of the cas... | Set no SSL validation for the CAS server.
@return void | [
"Set",
"no",
"SSL",
"validation",
"for",
"the",
"CAS",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L1639-L1647 |
212,449 | moodle/moodle | auth/cas/CAS/CAS.php | phpCAS.setExtraCurlOption | public static function setExtraCurlOption($key, $value)
{
phpCAS :: traceBegin();
phpCAS::_validateClientExists();
self::$_PHPCAS_CLIENT->setExtraCurlOption($key, $value);
phpCAS :: traceEnd();
} | php | public static function setExtraCurlOption($key, $value)
{
phpCAS :: traceBegin();
phpCAS::_validateClientExists();
self::$_PHPCAS_CLIENT->setExtraCurlOption($key, $value);
phpCAS :: traceEnd();
} | [
"public",
"static",
"function",
"setExtraCurlOption",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"phpCAS",
"::",
"_validateClientExists",
"(",
")",
";",
"self",
"::",
"$",
"_PHPCAS_CLIENT",
"->",
"setExtraCurlO... | Change CURL options.
CURL is used to connect through HTTPS to CAS server
@param string $key the option key
@param string $value the value to set
@return void | [
"Change",
"CURL",
"options",
".",
"CURL",
"is",
"used",
"to",
"connect",
"through",
"HTTPS",
"to",
"CAS",
"server"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS.php#L1679-L1686 |
212,450 | moodle/moodle | badges/lib/bakerlib.php | PNG_MetaDataHandler.check_chunks | public function check_chunks($type, $check) {
if (array_key_exists($type, $this->_chunks)) {
foreach (array_keys($this->_chunks[$type]) as $typekey) {
list($key, $data) = explode("\0", $this->_chunks[$type][$typekey]);
if (strcmp($key, $check) == 0) {
... | php | public function check_chunks($type, $check) {
if (array_key_exists($type, $this->_chunks)) {
foreach (array_keys($this->_chunks[$type]) as $typekey) {
list($key, $data) = explode("\0", $this->_chunks[$type][$typekey]);
if (strcmp($key, $check) == 0) {
... | [
"public",
"function",
"check_chunks",
"(",
"$",
"type",
",",
"$",
"check",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"type",
",",
"$",
"this",
"->",
"_chunks",
")",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"_chunks",
"... | Checks if a key already exists in the chunk of said type.
We need to avoid writing same keyword into file chunks.
@param string $type Chunk type, like iTXt, tEXt, etc.
@param string $check Keyword that needs to be checked.
@return boolean (true|false) True if file is safe to write this keyword, false otherwise. | [
"Checks",
"if",
"a",
"key",
"already",
"exists",
"in",
"the",
"chunk",
"of",
"said",
"type",
".",
"We",
"need",
"to",
"avoid",
"writing",
"same",
"keyword",
"into",
"file",
"chunks",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/lib/bakerlib.php#L94-L106 |
212,451 | moodle/moodle | badges/lib/bakerlib.php | PNG_MetaDataHandler.add_chunks | public function add_chunks($type, $key, $value) {
if (strlen($key) > 79) {
debugging('Key is too big');
}
// tEXt Textual data.
// Keyword: 1-79 bytes (character string)
// Null separator: 1 byte
// Text: n bytes (character string)
$d... | php | public function add_chunks($type, $key, $value) {
if (strlen($key) > 79) {
debugging('Key is too big');
}
// tEXt Textual data.
// Keyword: 1-79 bytes (character string)
// Null separator: 1 byte
// Text: n bytes (character string)
$d... | [
"public",
"function",
"add_chunks",
"(",
"$",
"type",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"key",
")",
">",
"79",
")",
"{",
"debugging",
"(",
"'Key is too big'",
")",
";",
"}",
"// tEXt Textual data.",
"// Keywor... | Adds a chunk with keyword and data to the file content.
Chunk is added to the end of the file, before IEND image trailer.
@param string $type Chunk type, like iTXt, tEXt, etc.
@param string $key Keyword that needs to be added.
@param string $value Currently an assertion URL that is added to an image metadata.
@return... | [
"Adds",
"a",
"chunk",
"with",
"keyword",
"and",
"data",
"to",
"the",
"file",
"content",
".",
"Chunk",
"is",
"added",
"to",
"the",
"end",
"of",
"the",
"file",
"before",
"IEND",
"image",
"trailer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/badges/lib/bakerlib.php#L118-L140 |
212,452 | moodle/moodle | repository/local/lib.php | repository_local.get_non_empty_children | private function get_non_empty_children(file_info $fileinfo, $extensions) {
$nonemptychildren = $fileinfo->get_non_empty_children($extensions);
$list = array();
foreach ($nonemptychildren as $child) {
if ($this->can_skip($child, $extensions, $fileinfo)) {
$list = arra... | php | private function get_non_empty_children(file_info $fileinfo, $extensions) {
$nonemptychildren = $fileinfo->get_non_empty_children($extensions);
$list = array();
foreach ($nonemptychildren as $child) {
if ($this->can_skip($child, $extensions, $fileinfo)) {
$list = arra... | [
"private",
"function",
"get_non_empty_children",
"(",
"file_info",
"$",
"fileinfo",
",",
"$",
"extensions",
")",
"{",
"$",
"nonemptychildren",
"=",
"$",
"fileinfo",
"->",
"get_non_empty_children",
"(",
"$",
"extensions",
")",
";",
"$",
"list",
"=",
"array",
"(... | Returns all children elements that have one of the specified extensions
This function may skip subfolders and recursively add their children
{@link repository_local::can_skip()}
@param file_info $fileinfo
@param string|array $extensions, for example '*' or array('.gif','.jpg')
@return array array of file_info element... | [
"Returns",
"all",
"children",
"elements",
"that",
"have",
"one",
"of",
"the",
"specified",
"extensions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/local/lib.php#L139-L150 |
212,453 | moodle/moodle | repository/local/lib.php | repository_local.can_skip | private function can_skip(file_info $fileinfo, $extensions, $parent = -1) {
global $CFG;
if (!$fileinfo->is_directory()) {
// do not skip files
return false;
}
if ($fileinfo instanceof file_info_context_course ||
$fileinfo instanceof file_info_context_... | php | private function can_skip(file_info $fileinfo, $extensions, $parent = -1) {
global $CFG;
if (!$fileinfo->is_directory()) {
// do not skip files
return false;
}
if ($fileinfo instanceof file_info_context_course ||
$fileinfo instanceof file_info_context_... | [
"private",
"function",
"can_skip",
"(",
"file_info",
"$",
"fileinfo",
",",
"$",
"extensions",
",",
"$",
"parent",
"=",
"-",
"1",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"$",
"fileinfo",
"->",
"is_directory",
"(",
")",
")",
"{",
"// do no... | Whether this folder may be skipped in folder hierarchy
1. Skip the name of a single filearea in a module
2. Skip course categories for non-admins who do not have navshowmycoursecategories setting
@param file_info $fileinfo
@param string|array $extensions, for example '*' or array('.gif','.jpg')
@param file_info|int $... | [
"Whether",
"this",
"folder",
"may",
"be",
"skipped",
"in",
"folder",
"hierarchy"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/local/lib.php#L163-L198 |
212,454 | moodle/moodle | repository/local/lib.php | repository_local.get_node | private function get_node(file_info $fileinfo) {
global $OUTPUT;
$encodedpath = base64_encode(json_encode($fileinfo->get_params()));
$node = array(
'title' => $fileinfo->get_visible_name(),
'datemodified' => $fileinfo->get_timemodified(),
'datecreated' => $fil... | php | private function get_node(file_info $fileinfo) {
global $OUTPUT;
$encodedpath = base64_encode(json_encode($fileinfo->get_params()));
$node = array(
'title' => $fileinfo->get_visible_name(),
'datemodified' => $fileinfo->get_timemodified(),
'datecreated' => $fil... | [
"private",
"function",
"get_node",
"(",
"file_info",
"$",
"fileinfo",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"encodedpath",
"=",
"base64_encode",
"(",
"json_encode",
"(",
"$",
"fileinfo",
"->",
"get_params",
"(",
")",
")",
")",
";",
"$",
"node",
"=... | Converts file_info object to element of repository return list
@param file_info $fileinfo
@return array | [
"Converts",
"file_info",
"object",
"to",
"element",
"of",
"repository",
"return",
"list"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/local/lib.php#L206-L239 |
212,455 | moodle/moodle | repository/local/lib.php | repository_local.get_node_path | private function get_node_path(file_info $fileinfo) {
$encodedpath = base64_encode(json_encode($fileinfo->get_params()));
return array(
'path' => $encodedpath,
'name' => $fileinfo->get_visible_name()
);
} | php | private function get_node_path(file_info $fileinfo) {
$encodedpath = base64_encode(json_encode($fileinfo->get_params()));
return array(
'path' => $encodedpath,
'name' => $fileinfo->get_visible_name()
);
} | [
"private",
"function",
"get_node_path",
"(",
"file_info",
"$",
"fileinfo",
")",
"{",
"$",
"encodedpath",
"=",
"base64_encode",
"(",
"json_encode",
"(",
"$",
"fileinfo",
"->",
"get_params",
"(",
")",
")",
")",
";",
"return",
"array",
"(",
"'path'",
"=>",
"$... | Converts file_info object to element of repository return path
@param file_info $fileinfo
@return array | [
"Converts",
"file_info",
"object",
"to",
"element",
"of",
"repository",
"return",
"path"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/local/lib.php#L247-L253 |
212,456 | moodle/moodle | repository/local/lib.php | repository_local.search | public function search($q, $page = 1) {
global $DB, $SESSION;
// Because the repository API is weird, the first page is 0, but it should be 1.
if (!$page) {
$page = 1;
}
if (!isset($SESSION->repository_local_search)) {
$SESSION->repository_local_search =... | php | public function search($q, $page = 1) {
global $DB, $SESSION;
// Because the repository API is weird, the first page is 0, but it should be 1.
if (!$page) {
$page = 1;
}
if (!isset($SESSION->repository_local_search)) {
$SESSION->repository_local_search =... | [
"public",
"function",
"search",
"(",
"$",
"q",
",",
"$",
"page",
"=",
"1",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"SESSION",
";",
"// Because the repository API is weird, the first page is 0, but it should be 1.",
"if",
"(",
"!",
"$",
"page",
")",
"{",
"$",
... | Search through all the files.
This method will do a raw search through the database, then will try
to match with files that a user can access. A maximum of 50 files will be
returned at a time, excluding possible duplicates found along the way.
Queries are done in chunk of 100 files to prevent too many records to be f... | [
"Search",
"through",
"all",
"the",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/local/lib.php#L270-L351 |
212,457 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.fill_per_analysable_caches | public function fill_per_analysable_caches(\core_analytics\analysable $analysable) {
// Better to check it, we can not be 100% it will be a \core_analytics\course object.
if ($analysable instanceof \core_analytics\course) {
$this->fetch_student_grades($analysable);
}
} | php | public function fill_per_analysable_caches(\core_analytics\analysable $analysable) {
// Better to check it, we can not be 100% it will be a \core_analytics\course object.
if ($analysable instanceof \core_analytics\course) {
$this->fetch_student_grades($analysable);
}
} | [
"public",
"function",
"fill_per_analysable_caches",
"(",
"\\",
"core_analytics",
"\\",
"analysable",
"$",
"analysable",
")",
"{",
"// Better to check it, we can not be 100% it will be a \\core_analytics\\course object.",
"if",
"(",
"$",
"analysable",
"instanceof",
"\\",
"core_a... | Fetch the course grades of this activity type instances.
@param \core_analytics\analysable $analysable
@return void | [
"Fetch",
"the",
"course",
"grades",
"of",
"this",
"activity",
"type",
"instances",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L136-L142 |
212,458 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.get_activity_type | public final function get_activity_type() {
$class = get_class($this);
$package = stristr($class, "\\", true);
$type = str_replace("mod_", "", $package);
if ($type === $package) {
throw new \coding_exception("$class does not belong to any module specific namespace");
... | php | public final function get_activity_type() {
$class = get_class($this);
$package = stristr($class, "\\", true);
$type = str_replace("mod_", "", $package);
if ($type === $package) {
throw new \coding_exception("$class does not belong to any module specific namespace");
... | [
"public",
"final",
"function",
"get_activity_type",
"(",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"package",
"=",
"stristr",
"(",
"$",
"class",
",",
"\"\\\\\"",
",",
"true",
")",
";",
"$",
"type",
"=",
"str_replace",
... | Returns the activity type. No point in changing this class in children classes.
@var string The activity name (e.g. assign or quiz) | [
"Returns",
"the",
"activity",
"type",
".",
"No",
"point",
"in",
"changing",
"this",
"class",
"in",
"children",
"classes",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L149-L157 |
212,459 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.any_log | protected final function any_log($contextid, $user) {
if (empty($this->activitylogs[$contextid])) {
return false;
}
// Someone interacted with the activity if there is no user or the user interacted with the
// activity if there is a user.
if (empty($user) ||
... | php | protected final function any_log($contextid, $user) {
if (empty($this->activitylogs[$contextid])) {
return false;
}
// Someone interacted with the activity if there is no user or the user interacted with the
// activity if there is a user.
if (empty($user) ||
... | [
"protected",
"final",
"function",
"any_log",
"(",
"$",
"contextid",
",",
"$",
"user",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"activitylogs",
"[",
"$",
"contextid",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Someone interacted wit... | Do activity logs contain any log of user in this context?
If user is empty we look for any log in this context.
@param int $contextid
@param \stdClass|false $user
@return bool | [
"Do",
"activity",
"logs",
"contain",
"any",
"log",
"of",
"user",
"in",
"this",
"context?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L200-L213 |
212,460 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.any_write_log | protected final function any_write_log($contextid, $user) {
if (empty($this->activitylogs[$contextid])) {
return false;
}
// No specific user, we look at all activity logs.
$it = $this->activitylogs[$contextid];
if ($user) {
if (empty($this->activitylogs[... | php | protected final function any_write_log($contextid, $user) {
if (empty($this->activitylogs[$contextid])) {
return false;
}
// No specific user, we look at all activity logs.
$it = $this->activitylogs[$contextid];
if ($user) {
if (empty($this->activitylogs[... | [
"protected",
"final",
"function",
"any_write_log",
"(",
"$",
"contextid",
",",
"$",
"user",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"activitylogs",
"[",
"$",
"contextid",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"// No specific user... | Do activity logs contain any write log of user in this context?
If user is empty we look for any write log in this context.
@param int $contextid
@param \stdClass|false $user
@return bool | [
"Do",
"activity",
"logs",
"contain",
"any",
"write",
"log",
"of",
"user",
"in",
"this",
"context?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L224-L246 |
212,461 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.any_feedback | protected function any_feedback($action, \cm_info $cm, $contextid, $user) {
if (!in_array($action, ['submitted', 'replied', 'viewed'])) {
throw new \coding_exception('Provided action "' . $action . '" is not valid.');
}
if (empty($this->activitylogs[$contextid])) {
retu... | php | protected function any_feedback($action, \cm_info $cm, $contextid, $user) {
if (!in_array($action, ['submitted', 'replied', 'viewed'])) {
throw new \coding_exception('Provided action "' . $action . '" is not valid.');
}
if (empty($this->activitylogs[$contextid])) {
retu... | [
"protected",
"function",
"any_feedback",
"(",
"$",
"action",
",",
"\\",
"cm_info",
"$",
"cm",
",",
"$",
"contextid",
",",
"$",
"user",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"action",
",",
"[",
"'submitted'",
",",
"'replied'",
",",
"'viewed'",... | Is there any feedback activity log for this user in this context?
This method returns true if $user is empty and there is any feedback activity logs.
@param string $action
@param \cm_info $cm
@param int $contextid
@param \stdClass|false $user
@return bool | [
"Is",
"there",
"any",
"feedback",
"activity",
"log",
"for",
"this",
"user",
"in",
"this",
"context?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L259-L290 |
212,462 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.get_graded_date | protected function get_graded_date($contextid, $userid, $checkfeedback = false) {
if (empty($this->grades[$contextid][$userid])) {
return false;
}
foreach ($this->grades[$contextid][$userid] as $gradeitemid => $gradeitem) {
// We check that either feedback or the grade i... | php | protected function get_graded_date($contextid, $userid, $checkfeedback = false) {
if (empty($this->grades[$contextid][$userid])) {
return false;
}
foreach ($this->grades[$contextid][$userid] as $gradeitemid => $gradeitem) {
// We check that either feedback or the grade i... | [
"protected",
"function",
"get_graded_date",
"(",
"$",
"contextid",
",",
"$",
"userid",
",",
"$",
"checkfeedback",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"grades",
"[",
"$",
"contextid",
"]",
"[",
"$",
"userid",
"]",
")",
... | Returns the date a user was graded.
@param int $contextid
@param int $userid
@param bool $checkfeedback Check that the student was graded or check that feedback was given
@return int|false | [
"Returns",
"the",
"date",
"a",
"user",
"was",
"graded",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L423-L445 |
212,463 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.get_student_activities | protected function get_student_activities($sampleid, $tablename, $starttime, $endtime) {
// May not be available.
$user = $this->retrieve('user', $sampleid);
if ($this->course === null) {
// The indicator scope is a range, so all activities belong to the same course.
$t... | php | protected function get_student_activities($sampleid, $tablename, $starttime, $endtime) {
// May not be available.
$user = $this->retrieve('user', $sampleid);
if ($this->course === null) {
// The indicator scope is a range, so all activities belong to the same course.
$t... | [
"protected",
"function",
"get_student_activities",
"(",
"$",
"sampleid",
",",
"$",
"tablename",
",",
"$",
"starttime",
",",
"$",
"endtime",
")",
"{",
"// May not be available.",
"$",
"user",
"=",
"$",
"this",
"->",
"retrieve",
"(",
"'user'",
",",
"$",
"sampl... | Returns the activities the user had access to between a time period.
@param int $sampleid
@param string $tablename
@param int $starttime
@param int $endtime
@return array | [
"Returns",
"the",
"activities",
"the",
"user",
"had",
"access",
"to",
"between",
"a",
"time",
"period",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L456-L493 |
212,464 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.fetch_activity_logs | protected function fetch_activity_logs($activities, $starttime = false, $endtime = false) {
global $DB;
// Filter by context to use the db table index.
list($contextsql, $contextparams) = $DB->get_in_or_equal(array_keys($activities), SQL_PARAMS_NAMED);
$select = "contextid $contextsql A... | php | protected function fetch_activity_logs($activities, $starttime = false, $endtime = false) {
global $DB;
// Filter by context to use the db table index.
list($contextsql, $contextparams) = $DB->get_in_or_equal(array_keys($activities), SQL_PARAMS_NAMED);
$select = "contextid $contextsql A... | [
"protected",
"function",
"fetch_activity_logs",
"(",
"$",
"activities",
",",
"$",
"starttime",
"=",
"false",
",",
"$",
"endtime",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"// Filter by context to use the db table index.",
"list",
"(",
"$",
"contextsql",
... | Fetch acitivity logs from database
@param array $activities
@param int $starttime
@param int $endtime
@return array | [
"Fetch",
"acitivity",
"logs",
"from",
"database"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L503-L551 |
212,465 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.cognitive_calculate_sample | protected function cognitive_calculate_sample($sampleid, $tablename, $starttime = false, $endtime = false) {
// May not be available.
$user = $this->retrieve('user', $sampleid);
if (!$useractivities = $this->get_student_activities($sampleid, $tablename, $starttime, $endtime)) {
// ... | php | protected function cognitive_calculate_sample($sampleid, $tablename, $starttime = false, $endtime = false) {
// May not be available.
$user = $this->retrieve('user', $sampleid);
if (!$useractivities = $this->get_student_activities($sampleid, $tablename, $starttime, $endtime)) {
// ... | [
"protected",
"function",
"cognitive_calculate_sample",
"(",
"$",
"sampleid",
",",
"$",
"tablename",
",",
"$",
"starttime",
"=",
"false",
",",
"$",
"endtime",
"=",
"false",
")",
"{",
"// May not be available.",
"$",
"user",
"=",
"$",
"this",
"->",
"retrieve",
... | Calculates the cognitive depth of a sample.
@param int $sampleid
@param string $tablename
@param int $starttime
@param int $endtime
@return float|int|null
@throws \coding_exception | [
"Calculates",
"the",
"cognitive",
"depth",
"of",
"a",
"sample",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L572-L651 |
212,466 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.social_calculate_sample | protected function social_calculate_sample($sampleid, $tablename, $starttime = false, $endtime = false) {
// May not be available.
$user = $this->retrieve('user', $sampleid);
if (!$useractivities = $this->get_student_activities($sampleid, $tablename, $starttime, $endtime)) {
// Nul... | php | protected function social_calculate_sample($sampleid, $tablename, $starttime = false, $endtime = false) {
// May not be available.
$user = $this->retrieve('user', $sampleid);
if (!$useractivities = $this->get_student_activities($sampleid, $tablename, $starttime, $endtime)) {
// Nul... | [
"protected",
"function",
"social_calculate_sample",
"(",
"$",
"sampleid",
",",
"$",
"tablename",
",",
"$",
"starttime",
"=",
"false",
",",
"$",
"endtime",
"=",
"false",
")",
"{",
"// May not be available.",
"$",
"user",
"=",
"$",
"this",
"->",
"retrieve",
"(... | Calculates the social breadth of a sample.
@param int $sampleid
@param string $tablename
@param int $starttime
@param int $endtime
@return float|int|null | [
"Calculates",
"the",
"social",
"breadth",
"of",
"a",
"sample",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L662-L719 |
212,467 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.fetch_student_grades | protected function fetch_student_grades(\core_analytics\course $course) {
$courseactivities = $course->get_all_activities($this->get_activity_type());
$this->grades = $course->get_student_grades($courseactivities);
} | php | protected function fetch_student_grades(\core_analytics\course $course) {
$courseactivities = $course->get_all_activities($this->get_activity_type());
$this->grades = $course->get_student_grades($courseactivities);
} | [
"protected",
"function",
"fetch_student_grades",
"(",
"\\",
"core_analytics",
"\\",
"course",
"$",
"course",
")",
"{",
"$",
"courseactivities",
"=",
"$",
"course",
"->",
"get_all_activities",
"(",
"$",
"this",
"->",
"get_activity_type",
"(",
")",
")",
";",
"$"... | Gets the course student grades.
@param \core_analytics\course $course
@return void | [
"Gets",
"the",
"course",
"student",
"grades",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L746-L749 |
212,468 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.get_activities | protected function get_activities($starttime, $endtime, $student = false) {
$activitytype = $this->get_activity_type();
// Var $student may not be available, default to not calculating dynamic data.
$studentid = -1;
if ($student) {
$studentid = $student->id;
}
... | php | protected function get_activities($starttime, $endtime, $student = false) {
$activitytype = $this->get_activity_type();
// Var $student may not be available, default to not calculating dynamic data.
$studentid = -1;
if ($student) {
$studentid = $student->id;
}
... | [
"protected",
"function",
"get_activities",
"(",
"$",
"starttime",
",",
"$",
"endtime",
",",
"$",
"student",
"=",
"false",
")",
"{",
"$",
"activitytype",
"=",
"$",
"this",
"->",
"get_activity_type",
"(",
")",
";",
"// Var $student may not be available, default to n... | Guesses all activities that were available during a period of time.
@param int $starttime
@param int $endtime
@param \stdClass|false $student
@return array | [
"Guesses",
"all",
"activities",
"that",
"were",
"available",
"during",
"a",
"period",
"of",
"time",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L759-L782 |
212,469 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.activity_type_completed_by | protected function activity_type_completed_by(\cm_info $activity, $starttime, $endtime, $student = false) {
$fieldname = $this->get_timeclose_field();
if (!$fieldname) {
// This activity type do not have its own availability control.
return null;
}
$this->fill_i... | php | protected function activity_type_completed_by(\cm_info $activity, $starttime, $endtime, $student = false) {
$fieldname = $this->get_timeclose_field();
if (!$fieldname) {
// This activity type do not have its own availability control.
return null;
}
$this->fill_i... | [
"protected",
"function",
"activity_type_completed_by",
"(",
"\\",
"cm_info",
"$",
"activity",
",",
"$",
"starttime",
",",
"$",
"endtime",
",",
"$",
"student",
"=",
"false",
")",
"{",
"$",
"fieldname",
"=",
"$",
"this",
"->",
"get_timeclose_field",
"(",
")",
... | True if the activity is due or it has been closed during this period, false if during another period, null if no due time.
It can be overwritten by activities that allow teachers to set a due date or a time close separately
from Moodle availability system. Note that in most of the cases overwriting get_timeclose_field... | [
"True",
"if",
"the",
"activity",
"is",
"due",
"or",
"it",
"has",
"been",
"closed",
"during",
"this",
"period",
"false",
"if",
"during",
"another",
"period",
"null",
"if",
"no",
"due",
"time",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L908-L928 |
212,470 | moodle/moodle | analytics/classes/local/indicator/community_of_inquiry_activity.php | community_of_inquiry_activity.fill_instance_data | protected function fill_instance_data(\cm_info $cm) {
global $DB;
if (!isset($this->instancedata[$cm->instance])) {
$this->instancedata[$cm->instance] = $DB->get_record($this->get_activity_type(), array('id' => $cm->instance),
'*', MUST_EXIST);
}
} | php | protected function fill_instance_data(\cm_info $cm) {
global $DB;
if (!isset($this->instancedata[$cm->instance])) {
$this->instancedata[$cm->instance] = $DB->get_record($this->get_activity_type(), array('id' => $cm->instance),
'*', MUST_EXIST);
}
} | [
"protected",
"function",
"fill_instance_data",
"(",
"\\",
"cm_info",
"$",
"cm",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"instancedata",
"[",
"$",
"cm",
"->",
"instance",
"]",
")",
")",
"{",
"$",
"this",
... | Fills in activity instance data.
@param \cm_info $cm
@return void | [
"Fills",
"in",
"activity",
"instance",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/indicator/community_of_inquiry_activity.php#L986-L993 |
212,471 | moodle/moodle | rating/classes/phpunit/privacy_helper.php | privacy_helper.get_ratings_on_subcontext | protected function get_ratings_on_subcontext(\context $context, array $subcontext) {
$writer = \core_privacy\local\request\writer::with_context($context);
return $writer->get_related_data($subcontext, 'rating');
} | php | protected function get_ratings_on_subcontext(\context $context, array $subcontext) {
$writer = \core_privacy\local\request\writer::with_context($context);
return $writer->get_related_data($subcontext, 'rating');
} | [
"protected",
"function",
"get_ratings_on_subcontext",
"(",
"\\",
"context",
"$",
"context",
",",
"array",
"$",
"subcontext",
")",
"{",
"$",
"writer",
"=",
"\\",
"core_privacy",
"\\",
"local",
"\\",
"request",
"\\",
"writer",
"::",
"with_context",
"(",
"$",
"... | Fetch all ratings on a subcontext.
@param \context $context The context being stored.
@param array $subcontext The subcontext path to check.
@return array | [
"Fetch",
"all",
"ratings",
"on",
"a",
"subcontext",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/classes/phpunit/privacy_helper.php#L47-L50 |
212,472 | moodle/moodle | rating/classes/phpunit/privacy_helper.php | privacy_helper.assert_all_own_ratings_on_context | protected function assert_all_own_ratings_on_context(
int $userid,
\context $context,
array $subcontext,
$component,
$ratingarea,
$itemid
) {
$writer = \core_privacy\local\request\writer::with_context($context);
$rm = new \rating_manager();
$db... | php | protected function assert_all_own_ratings_on_context(
int $userid,
\context $context,
array $subcontext,
$component,
$ratingarea,
$itemid
) {
$writer = \core_privacy\local\request\writer::with_context($context);
$rm = new \rating_manager();
$db... | [
"protected",
"function",
"assert_all_own_ratings_on_context",
"(",
"int",
"$",
"userid",
",",
"\\",
"context",
"$",
"context",
",",
"array",
"$",
"subcontext",
",",
"$",
"component",
",",
"$",
"ratingarea",
",",
"$",
"itemid",
")",
"{",
"$",
"writer",
"=",
... | Check that all included ratings belong to the specified user.
@param int $userid The ID of the user being stored.
@param \context $context The context being stored.
@param array $subcontext The subcontext path to check.
@param string $component The ... | [
"Check",
"that",
"all",
"included",
"ratings",
"belong",
"to",
"the",
"specified",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/classes/phpunit/privacy_helper.php#L62-L92 |
212,473 | moodle/moodle | rating/classes/phpunit/privacy_helper.php | privacy_helper.assert_rating_matches | protected function assert_rating_matches($expected, $stored) {
$this->assertEquals($expected->rating, $stored->rating);
$this->assertEquals($expected->userid, $stored->author);
} | php | protected function assert_rating_matches($expected, $stored) {
$this->assertEquals($expected->rating, $stored->rating);
$this->assertEquals($expected->userid, $stored->author);
} | [
"protected",
"function",
"assert_rating_matches",
"(",
"$",
"expected",
",",
"$",
"stored",
")",
"{",
"$",
"this",
"->",
"assertEquals",
"(",
"$",
"expected",
"->",
"rating",
",",
"$",
"stored",
"->",
"rating",
")",
";",
"$",
"this",
"->",
"assertEquals",
... | Assert that the rating matches.
@param \stdClass $expected The expected rating structure
@param \stdClass $stored The actual rating structure | [
"Assert",
"that",
"the",
"rating",
"matches",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/classes/phpunit/privacy_helper.php#L131-L134 |
212,474 | moodle/moodle | admin/tool/log/classes/local/privacy/helper.php | helper.restore_event_from_standard_record | protected static function restore_event_from_standard_record($data) {
$extra = ['origin' => $data->origin, 'ip' => $data->ip, 'realuserid' => $data->realuserid];
$data = (array) $data;
$id = $data['id'];
$data['other'] = self::decode_other($data['other']);
if ($data['other'] === ... | php | protected static function restore_event_from_standard_record($data) {
$extra = ['origin' => $data->origin, 'ip' => $data->ip, 'realuserid' => $data->realuserid];
$data = (array) $data;
$id = $data['id'];
$data['other'] = self::decode_other($data['other']);
if ($data['other'] === ... | [
"protected",
"static",
"function",
"restore_event_from_standard_record",
"(",
"$",
"data",
")",
"{",
"$",
"extra",
"=",
"[",
"'origin'",
"=>",
"$",
"data",
"->",
"origin",
",",
"'ip'",
"=>",
"$",
"data",
"->",
"ip",
",",
"'realuserid'",
"=>",
"$",
"data",
... | Returns an event from a standard record.
@see \logstore_standard\log\store::get_log_event()
@param object $data Log data.
@return \core\event\base | [
"Returns",
"an",
"event",
"from",
"a",
"standard",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/local/privacy/helper.php#L49-L67 |
212,475 | moodle/moodle | admin/tool/log/classes/local/privacy/helper.php | helper.transform_standard_log_record_for_userid | public static function transform_standard_log_record_for_userid($record, $userid) {
// Restore the event to try to get the name, description and other field.
$restoredevent = static::restore_event_from_standard_record($record);
if ($restoredevent) {
$name = $restoredevent->get_name(... | php | public static function transform_standard_log_record_for_userid($record, $userid) {
// Restore the event to try to get the name, description and other field.
$restoredevent = static::restore_event_from_standard_record($record);
if ($restoredevent) {
$name = $restoredevent->get_name(... | [
"public",
"static",
"function",
"transform_standard_log_record_for_userid",
"(",
"$",
"record",
",",
"$",
"userid",
")",
"{",
"// Restore the event to try to get the name, description and other field.",
"$",
"restoredevent",
"=",
"static",
"::",
"restore_event_from_standard_recor... | Transform a standard log record for a user.
@param object $record The record.
@param int $userid The user ID.
@return array | [
"Transform",
"a",
"standard",
"log",
"record",
"for",
"a",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/local/privacy/helper.php#L76-L130 |
212,476 | moodle/moodle | lib/horde/framework/Horde/Mail/Transport/Smtpmx.php | Horde_Mail_Transport_Smtpmx._getMx | protected function _getMx($host)
{
$mx = array();
if ($this->params['netdns']) {
$this->_loadNetDns();
try {
$response = $this->_resolver->query($host, 'MX');
if (!$response) {
return false;
}
}... | php | protected function _getMx($host)
{
$mx = array();
if ($this->params['netdns']) {
$this->_loadNetDns();
try {
$response = $this->_resolver->query($host, 'MX');
if (!$response) {
return false;
}
}... | [
"protected",
"function",
"_getMx",
"(",
"$",
"host",
")",
"{",
"$",
"mx",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"params",
"[",
"'netdns'",
"]",
")",
"{",
"$",
"this",
"->",
"_loadNetDns",
"(",
")",
";",
"try",
"{",
"$",
"re... | Recieve MX records for a host.
@param string $host Mail host.
@return mixed Sorted MX list or false on error. | [
"Recieve",
"MX",
"records",
"for",
"a",
"host",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mail/Transport/Smtpmx.php#L284-L320 |
212,477 | moodle/moodle | lib/horde/framework/Horde/Mail/Transport/Smtpmx.php | Horde_Mail_Transport_Smtpmx._error | protected function _error($id, $info = array())
{
$msg = $this->_errorCode[$id]['msg'];
// include info to messages
if (!empty($info)) {
$replace = $search = array();
foreach ($info as $key => $value) {
$search[] = '{' . Horde_String::upper($key) . '... | php | protected function _error($id, $info = array())
{
$msg = $this->_errorCode[$id]['msg'];
// include info to messages
if (!empty($info)) {
$replace = $search = array();
foreach ($info as $key => $value) {
$search[] = '{' . Horde_String::upper($key) . '... | [
"protected",
"function",
"_error",
"(",
"$",
"id",
",",
"$",
"info",
"=",
"array",
"(",
")",
")",
"{",
"$",
"msg",
"=",
"$",
"this",
"->",
"_errorCode",
"[",
"$",
"id",
"]",
"[",
"'msg'",
"]",
";",
"// include info to messages",
"if",
"(",
"!",
"em... | Format error message.
@param string $id Maps error ids to codes and message.
@param array $info Optional information in associative array.
@throws Horde_Mail_Exception | [
"Format",
"error",
"message",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mail/Transport/Smtpmx.php#L343-L360 |
212,478 | moodle/moodle | admin/tool/policy/classes/form/accept_policy.php | accept_policy.validate_and_get_users | protected function validate_and_get_users($versionids, $userids, $action) {
global $DB;
$usernames = [];
list($sql, $params) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED);
$params['usercontextlevel'] = CONTEXT_USER;
$users = $DB->get_records_sql("SELECT u.id, " . get_all_us... | php | protected function validate_and_get_users($versionids, $userids, $action) {
global $DB;
$usernames = [];
list($sql, $params) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED);
$params['usercontextlevel'] = CONTEXT_USER;
$users = $DB->get_records_sql("SELECT u.id, " . get_all_us... | [
"protected",
"function",
"validate_and_get_users",
"(",
"$",
"versionids",
",",
"$",
"userids",
",",
"$",
"action",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"usernames",
"=",
"[",
"]",
";",
"list",
"(",
"$",
"sql",
",",
"$",
"params",
")",
"=",
"$",
... | Validate userids and return usernames
@param array $versionids int[] List of policy version ids to process.
@param array $userids
@param string $action accept|decline|revoke
@return array (userid=>username) | [
"Validate",
"userids",
"and",
"return",
"usernames"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/form/accept_policy.php#L125-L155 |
212,479 | moodle/moodle | admin/tool/policy/classes/form/accept_policy.php | accept_policy.validate_and_get_versions | protected function validate_and_get_versions($versionids) {
$versionnames = [];
$policies = api::list_policies();
foreach ($versionids as $versionid) {
$version = api::get_policy_version($versionid, $policies);
if ($version->audience == policy_version::AUDIENCE_GUESTS) {
... | php | protected function validate_and_get_versions($versionids) {
$versionnames = [];
$policies = api::list_policies();
foreach ($versionids as $versionid) {
$version = api::get_policy_version($versionid, $policies);
if ($version->audience == policy_version::AUDIENCE_GUESTS) {
... | [
"protected",
"function",
"validate_and_get_versions",
"(",
"$",
"versionids",
")",
"{",
"$",
"versionnames",
"=",
"[",
"]",
";",
"$",
"policies",
"=",
"api",
"::",
"list_policies",
"(",
")",
";",
"foreach",
"(",
"$",
"versionids",
"as",
"$",
"versionid",
"... | Validate versionids and return their names
@param array $versionids
@return array (versionid=>name) | [
"Validate",
"versionids",
"and",
"return",
"their",
"names"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/form/accept_policy.php#L163-L180 |
212,480 | moodle/moodle | admin/tool/policy/classes/form/accept_policy.php | accept_policy.process | public function process() {
if ($data = $this->get_data()) {
foreach ($data->userids as $userid) {
if ($data->action === 'revoke') {
foreach ($data->versionids as $versionid) {
\tool_policy\api::revoke_acceptance($versionid, $userid, $data-... | php | public function process() {
if ($data = $this->get_data()) {
foreach ($data->userids as $userid) {
if ($data->action === 'revoke') {
foreach ($data->versionids as $versionid) {
\tool_policy\api::revoke_acceptance($versionid, $userid, $data-... | [
"public",
"function",
"process",
"(",
")",
"{",
"if",
"(",
"$",
"data",
"=",
"$",
"this",
"->",
"get_data",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"data",
"->",
"userids",
"as",
"$",
"userid",
")",
"{",
"if",
"(",
"$",
"data",
"->",
"action",
... | Process form submission | [
"Process",
"form",
"submission"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/form/accept_policy.php#L185-L199 |
212,481 | moodle/moodle | mod/page/mod_form.php | mod_page_mod_form.data_preprocessing | public function data_preprocessing(&$defaultvalues) {
if ($this->current->instance) {
$draftitemid = file_get_submitted_draft_itemid('page');
$defaultvalues['page']['format'] = $defaultvalues['contentformat'];
$defaultvalues['page']['text'] = file_prepare_draft_area($drafti... | php | public function data_preprocessing(&$defaultvalues) {
if ($this->current->instance) {
$draftitemid = file_get_submitted_draft_itemid('page');
$defaultvalues['page']['format'] = $defaultvalues['contentformat'];
$defaultvalues['page']['text'] = file_prepare_draft_area($drafti... | [
"public",
"function",
"data_preprocessing",
"(",
"&",
"$",
"defaultvalues",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"current",
"->",
"instance",
")",
"{",
"$",
"draftitemid",
"=",
"file_get_submitted_draft_itemid",
"(",
"'page'",
")",
";",
"$",
"defaultvalues"... | Enforce defaults here.
@param array $defaultvalues Form defaults
@return void | [
"Enforce",
"defaults",
"here",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/page/mod_form.php#L124-L150 |
212,482 | moodle/moodle | lib/horde/framework/Horde/Mail/Rfc822/Object.php | Horde_Mail_Rfc822_Object.writeAddress | public function writeAddress($opts = array())
{
if ($opts === true) {
$opts = array(
'encode' => 'UTF-8',
'idn' => true
);
} elseif (!empty($opts['encode']) && ($opts['encode'] === true)) {
$opts['encode'] = 'UTF-8';
}
... | php | public function writeAddress($opts = array())
{
if ($opts === true) {
$opts = array(
'encode' => 'UTF-8',
'idn' => true
);
} elseif (!empty($opts['encode']) && ($opts['encode'] === true)) {
$opts['encode'] = 'UTF-8';
}
... | [
"public",
"function",
"writeAddress",
"(",
"$",
"opts",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"opts",
"===",
"true",
")",
"{",
"$",
"opts",
"=",
"array",
"(",
"'encode'",
"=>",
"'UTF-8'",
",",
"'idn'",
"=>",
"true",
")",
";",
"}",
"el... | Write an address given information in this part.
@param mixed $opts If boolean true, is equivalent to passing true for
both 'encode' and 'idn'. If an array, these
keys are supported:
- comment: (boolean) If true, include comment(s) in output?
@since 2.6.0
DEFAULT: false
- encode: (mixed) MIME encode the personal/grou... | [
"Write",
"an",
"address",
"given",
"information",
"in",
"this",
"part",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mail/Rfc822/Object.php#L56-L68 |
212,483 | moodle/moodle | course/classes/customfield/course_handler.php | course_handler.can_edit | public function can_edit(field_controller $field, int $instanceid = 0) : bool {
if ($instanceid) {
$context = $this->get_instance_context($instanceid);
return (!$field->get_configdata_property('locked') ||
has_capability('moodle/course:changelockedcustomfields', $cont... | php | public function can_edit(field_controller $field, int $instanceid = 0) : bool {
if ($instanceid) {
$context = $this->get_instance_context($instanceid);
return (!$field->get_configdata_property('locked') ||
has_capability('moodle/course:changelockedcustomfields', $cont... | [
"public",
"function",
"can_edit",
"(",
"field_controller",
"$",
"field",
",",
"int",
"$",
"instanceid",
"=",
"0",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"instanceid",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"get_instance_context",
"(",
"$",
"... | The current user can edit custom fields on the given course.
@param field_controller $field
@param int $instanceid id of the course to test edit permission
@return bool true if the current can edit custom fields, false otherwise | [
"The",
"current",
"user",
"can",
"edit",
"custom",
"fields",
"on",
"the",
"given",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/customfield/course_handler.php#L87-L97 |
212,484 | moodle/moodle | course/classes/customfield/course_handler.php | course_handler.can_view | public function can_view(field_controller $field, int $instanceid) : bool {
$visibility = $field->get_configdata_property('visibility');
if ($visibility == self::NOTVISIBLE) {
return false;
} else if ($visibility == self::VISIBLETOTEACHERS) {
return has_capability('moodle... | php | public function can_view(field_controller $field, int $instanceid) : bool {
$visibility = $field->get_configdata_property('visibility');
if ($visibility == self::NOTVISIBLE) {
return false;
} else if ($visibility == self::VISIBLETOTEACHERS) {
return has_capability('moodle... | [
"public",
"function",
"can_view",
"(",
"field_controller",
"$",
"field",
",",
"int",
"$",
"instanceid",
")",
":",
"bool",
"{",
"$",
"visibility",
"=",
"$",
"field",
"->",
"get_configdata_property",
"(",
"'visibility'",
")",
";",
"if",
"(",
"$",
"visibility",... | The current user can view custom fields on the given course.
@param field_controller $field
@param int $instanceid id of the course to test edit permission
@return bool true if the current can edit custom fields, false otherwise | [
"The",
"current",
"user",
"can",
"view",
"custom",
"fields",
"on",
"the",
"given",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/customfield/course_handler.php#L106-L115 |
212,485 | moodle/moodle | course/classes/customfield/course_handler.php | course_handler.get_parent_context | protected function get_parent_context() : \context {
global $PAGE;
if ($this->parentcontext) {
return $this->parentcontext;
} else if ($PAGE->context && $PAGE->context instanceof \context_coursecat) {
return $PAGE->context;
}
return \context_system::instan... | php | protected function get_parent_context() : \context {
global $PAGE;
if ($this->parentcontext) {
return $this->parentcontext;
} else if ($PAGE->context && $PAGE->context instanceof \context_coursecat) {
return $PAGE->context;
}
return \context_system::instan... | [
"protected",
"function",
"get_parent_context",
"(",
")",
":",
"\\",
"context",
"{",
"global",
"$",
"PAGE",
";",
"if",
"(",
"$",
"this",
"->",
"parentcontext",
")",
"{",
"return",
"$",
"this",
"->",
"parentcontext",
";",
"}",
"else",
"if",
"(",
"$",
"PA... | Returns the parent context for the course
@return \context | [
"Returns",
"the",
"parent",
"context",
"for",
"the",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/customfield/course_handler.php#L133-L141 |
212,486 | moodle/moodle | course/classes/customfield/course_handler.php | course_handler.get_instance_context | public function get_instance_context(int $instanceid = 0) : \context {
if ($instanceid > 0) {
return \context_course::instance($instanceid);
} else {
return \context_system::instance();
}
} | php | public function get_instance_context(int $instanceid = 0) : \context {
if ($instanceid > 0) {
return \context_course::instance($instanceid);
} else {
return \context_system::instance();
}
} | [
"public",
"function",
"get_instance_context",
"(",
"int",
"$",
"instanceid",
"=",
"0",
")",
":",
"\\",
"context",
"{",
"if",
"(",
"$",
"instanceid",
">",
"0",
")",
"{",
"return",
"\\",
"context_course",
"::",
"instance",
"(",
"$",
"instanceid",
")",
";",... | Returns the context for the data associated with the given instanceid.
@param int $instanceid id of the record to get the context for
@return \context the context for the given record | [
"Returns",
"the",
"context",
"for",
"the",
"data",
"associated",
"with",
"the",
"given",
"instanceid",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/customfield/course_handler.php#L167-L173 |
212,487 | moodle/moodle | course/classes/customfield/course_handler.php | course_handler.config_form_definition | public function config_form_definition(\MoodleQuickForm $mform) {
$mform->addElement('header', 'course_handler_header', get_string('customfieldsettings', 'core_course'));
$mform->setExpanded('course_handler_header', true);
// If field is locked.
$mform->addElement('selectyesno', 'config... | php | public function config_form_definition(\MoodleQuickForm $mform) {
$mform->addElement('header', 'course_handler_header', get_string('customfieldsettings', 'core_course'));
$mform->setExpanded('course_handler_header', true);
// If field is locked.
$mform->addElement('selectyesno', 'config... | [
"public",
"function",
"config_form_definition",
"(",
"\\",
"MoodleQuickForm",
"$",
"mform",
")",
"{",
"$",
"mform",
"->",
"addElement",
"(",
"'header'",
",",
"'course_handler_header'",
",",
"get_string",
"(",
"'customfieldsettings'",
",",
"'core_course'",
")",
")",
... | Allows to add custom controls to the field configuration form that will be saved in configdata
@param \MoodleQuickForm $mform | [
"Allows",
"to",
"add",
"custom",
"controls",
"to",
"the",
"field",
"configuration",
"form",
"that",
"will",
"be",
"saved",
"in",
"configdata"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/customfield/course_handler.php#L180-L195 |
212,488 | moodle/moodle | course/classes/customfield/course_handler.php | course_handler.restore_instance_data_from_backup | public function restore_instance_data_from_backup(\restore_task $task, array $data) {
$courseid = $task->get_courseid();
$context = $this->get_instance_context($courseid);
$editablefields = $this->get_editable_fields($courseid);
$records = api::get_instance_fields_data($editablefields, $... | php | public function restore_instance_data_from_backup(\restore_task $task, array $data) {
$courseid = $task->get_courseid();
$context = $this->get_instance_context($courseid);
$editablefields = $this->get_editable_fields($courseid);
$records = api::get_instance_fields_data($editablefields, $... | [
"public",
"function",
"restore_instance_data_from_backup",
"(",
"\\",
"restore_task",
"$",
"task",
",",
"array",
"$",
"data",
")",
"{",
"$",
"courseid",
"=",
"$",
"task",
"->",
"get_courseid",
"(",
")",
";",
"$",
"context",
"=",
"$",
"this",
"->",
"get_ins... | Creates or updates custom field data.
@param \restore_task $task
@param array $data | [
"Creates",
"or",
"updates",
"custom",
"field",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/customfield/course_handler.php#L203-L224 |
212,489 | moodle/moodle | lib/ltiprovider/src/ToolProvider/Service/Service.php | Service.send | public function send($method, $parameters = array(), $body = null)
{
$url = $this->endpoint;
if (!empty($parameters)) {
if (strpos($url, '?') === false) {
$sep = '?';
} else {
$sep = '&';
}
foreach ($parameters as $name... | php | public function send($method, $parameters = array(), $body = null)
{
$url = $this->endpoint;
if (!empty($parameters)) {
if (strpos($url, '?') === false) {
$sep = '?';
} else {
$sep = '&';
}
foreach ($parameters as $name... | [
"public",
"function",
"send",
"(",
"$",
"method",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"$",
"body",
"=",
"null",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"endpoint",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"parameters",
")",
... | Send a service request.
@param string $method The action type constant (optional, default is GET)
@param array $parameters Query parameters to add to endpoint (optional, default is none)
@param string $body Body of request (optional, default is null)
@return HTTPMessage HTTP object containing request... | [
"Send",
"a",
"service",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ltiprovider/src/ToolProvider/Service/Service.php#L71-L102 |
212,490 | moodle/moodle | lib/webdavlib.php | webdav_client.iso8601totime | function iso8601totime($iso8601) {
/*
date-time = full-date "T" full-time
full-date = date-fullyear "-" date-month "-" date-mday
full-time = partial-time time-offset
date-fullyear = 4DIGIT
date-month = 2DIGIT ; 01-12
date-mday ... | php | function iso8601totime($iso8601) {
/*
date-time = full-date "T" full-time
full-date = date-fullyear "-" date-month "-" date-mday
full-time = partial-time time-offset
date-fullyear = 4DIGIT
date-month = 2DIGIT ; 01-12
date-mday ... | [
"function",
"iso8601totime",
"(",
"$",
"iso8601",
")",
"{",
"/*\n\n date-time = full-date \"T\" full-time\n\n full-date = date-fullyear \"-\" date-month \"-\" date-mday\n full-time = partial-time time-offset\n\n date-fullyear = 4DIGIT\n date-... | Convert ISO 8601 Date and Time Profile used in RFC 2518 to an unix timestamp.
@access private
@param string iso8601
@return unixtimestamp on sucess. Otherwise false. | [
"Convert",
"ISO",
"8601",
"Date",
"and",
"Time",
"Profile",
"used",
"in",
"RFC",
"2518",
"to",
"an",
"unix",
"timestamp",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/webdavlib.php#L141-L172 |
212,491 | moodle/moodle | lib/webdavlib.php | webdav_client.open | function open() {
// let's try to open a socket
$this->_error_log('open a socket connection');
$this->sock = fsockopen($this->_socket . $this->_server, $this->_port, $this->_errno, $this->_errstr, $this->_socket_timeout);
core_php_time_limit::raise(30);
if (is_resource($this->soc... | php | function open() {
// let's try to open a socket
$this->_error_log('open a socket connection');
$this->sock = fsockopen($this->_socket . $this->_server, $this->_port, $this->_errno, $this->_errstr, $this->_socket_timeout);
core_php_time_limit::raise(30);
if (is_resource($this->soc... | [
"function",
"open",
"(",
")",
"{",
"// let's try to open a socket",
"$",
"this",
"->",
"_error_log",
"(",
"'open a socket connection'",
")",
";",
"$",
"this",
"->",
"sock",
"=",
"fsockopen",
"(",
"$",
"this",
"->",
"_socket",
".",
"$",
"this",
"->",
"_server... | Open's a socket to a webdav server
@return bool true on success. Otherwise false. | [
"Open",
"s",
"a",
"socket",
"to",
"a",
"webdav",
"server"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/webdavlib.php#L178-L192 |
212,492 | moodle/moodle | lib/webdavlib.php | webdav_client.close | function close() {
$this->_error_log('closing socket ' . $this->sock);
$this->_connection_closed = true;
fclose($this->sock);
} | php | function close() {
$this->_error_log('closing socket ' . $this->sock);
$this->_connection_closed = true;
fclose($this->sock);
} | [
"function",
"close",
"(",
")",
"{",
"$",
"this",
"->",
"_error_log",
"(",
"'closing socket '",
".",
"$",
"this",
"->",
"sock",
")",
";",
"$",
"this",
"->",
"_connection_closed",
"=",
"true",
";",
"fclose",
"(",
"$",
"this",
"->",
"sock",
")",
";",
"}... | Closes an open socket. | [
"Closes",
"an",
"open",
"socket",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/webdavlib.php#L197-L201 |
212,493 | moodle/moodle | lib/webdavlib.php | webdav_client.check_webdav | function check_webdav() {
$resp = $this->options();
if (!$resp) {
return false;
}
$this->_error_log($resp['header']['DAV']);
// check schema
if (preg_match('/1,2/', $resp['header']['DAV'])) {
return true;
}
// otherwise return false... | php | function check_webdav() {
$resp = $this->options();
if (!$resp) {
return false;
}
$this->_error_log($resp['header']['DAV']);
// check schema
if (preg_match('/1,2/', $resp['header']['DAV'])) {
return true;
}
// otherwise return false... | [
"function",
"check_webdav",
"(",
")",
"{",
"$",
"resp",
"=",
"$",
"this",
"->",
"options",
"(",
")",
";",
"if",
"(",
"!",
"$",
"resp",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"_error_log",
"(",
"$",
"resp",
"[",
"'header'",
"]",... | Check's if server is a webdav compliant server.
True if server returns a DAV Element in Header and when
schema 1,2 is supported.
@return bool true if server is webdav server. Otherwise false. | [
"Check",
"s",
"if",
"server",
"is",
"a",
"webdav",
"compliant",
"server",
".",
"True",
"if",
"server",
"returns",
"a",
"DAV",
"Element",
"in",
"Header",
"and",
"when",
"schema",
"1",
"2",
"is",
"supported",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/webdavlib.php#L209-L221 |
212,494 | moodle/moodle | lib/webdavlib.php | webdav_client.options | function options() {
$this->header_unset();
$this->create_basic_request('OPTIONS');
$this->send_request();
$this->get_respond();
$response = $this->process_respond();
// validate the response ...
// check http-version
if ($response['status']['http-version'... | php | function options() {
$this->header_unset();
$this->create_basic_request('OPTIONS');
$this->send_request();
$this->get_respond();
$response = $this->process_respond();
// validate the response ...
// check http-version
if ($response['status']['http-version'... | [
"function",
"options",
"(",
")",
"{",
"$",
"this",
"->",
"header_unset",
"(",
")",
";",
"$",
"this",
"->",
"create_basic_request",
"(",
"'OPTIONS'",
")",
";",
"$",
"this",
"->",
"send_request",
"(",
")",
";",
"$",
"this",
"->",
"get_respond",
"(",
")",... | Get options from webdav server.
@return array with all header fields returned from webdav server. false if server does not speak http. | [
"Get",
"options",
"from",
"webdav",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/webdavlib.php#L228-L243 |
212,495 | moodle/moodle | lib/webdavlib.php | webdav_client.mkcol | function mkcol($path) {
$this->_path = $this->translate_uri($path);
$this->header_unset();
$this->create_basic_request('MKCOL');
$this->send_request();
$this->get_respond();
$response = $this->process_respond();
// validate the response ...
// check http-v... | php | function mkcol($path) {
$this->_path = $this->translate_uri($path);
$this->header_unset();
$this->create_basic_request('MKCOL');
$this->send_request();
$this->get_respond();
$response = $this->process_respond();
// validate the response ...
// check http-v... | [
"function",
"mkcol",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"_path",
"=",
"$",
"this",
"->",
"translate_uri",
"(",
"$",
"path",
")",
";",
"$",
"this",
"->",
"header_unset",
"(",
")",
";",
"$",
"this",
"->",
"create_basic_request",
"(",
"'MKCO... | Public method mkcol
Creates a new collection/directory on a webdav server
@param string path
@return int status code received as response from webdav server (see rfc 2518) | [
"Public",
"method",
"mkcol"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/webdavlib.php#L252-L280 |
212,496 | moodle/moodle | lib/webdavlib.php | webdav_client.get | function get($path, &$buffer, $fp = null) {
$this->_path = $this->translate_uri($path);
$this->header_unset();
$this->create_basic_request('GET');
$this->send_request();
$this->get_respond($fp);
$response = $this->process_respond();
$http_version = $response['sta... | php | function get($path, &$buffer, $fp = null) {
$this->_path = $this->translate_uri($path);
$this->header_unset();
$this->create_basic_request('GET');
$this->send_request();
$this->get_respond($fp);
$response = $this->process_respond();
$http_version = $response['sta... | [
"function",
"get",
"(",
"$",
"path",
",",
"&",
"$",
"buffer",
",",
"$",
"fp",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_path",
"=",
"$",
"this",
"->",
"translate_uri",
"(",
"$",
"path",
")",
";",
"$",
"this",
"->",
"header_unset",
"(",
")",
"... | Public method get
Gets a file from a webdav collection.
@param string $path the path to the file on the webdav server
@param string &$buffer the buffer to store the data in
@param resource $fp optional if included, the data is written directly to this resource and not to the buffer
@return string|bool status code and ... | [
"Public",
"method",
"get"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/webdavlib.php#L291-L318 |
212,497 | moodle/moodle | lib/webdavlib.php | webdav_client.put | function put($path, $data ) {
$this->_path = $this->translate_uri($path);
$this->header_unset();
$this->create_basic_request('PUT');
// add more needed header information ...
$this->header_add('Content-length: ' . strlen($data));
$this->header_add('Content-type: applicati... | php | function put($path, $data ) {
$this->_path = $this->translate_uri($path);
$this->header_unset();
$this->create_basic_request('PUT');
// add more needed header information ...
$this->header_add('Content-length: ' . strlen($data));
$this->header_add('Content-type: applicati... | [
"function",
"put",
"(",
"$",
"path",
",",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"_path",
"=",
"$",
"this",
"->",
"translate_uri",
"(",
"$",
"path",
")",
";",
"$",
"this",
"->",
"header_unset",
"(",
")",
";",
"$",
"this",
"->",
"create_basic_req... | Public method put
Puts a file into a collection.
Data is putted as one chunk!
@param string path, string data
@return int status-code read from webdavserver. False on error. | [
"Public",
"method",
"put"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/webdavlib.php#L328-L354 |
212,498 | moodle/moodle | lib/webdavlib.php | webdav_client.put_file | function put_file($path, $filename) {
// try to open the file ...
$handle = @fopen ($filename, 'r');
if ($handle) {
// $this->sock = pfsockopen ($this->_server, $this->_port, $this->_errno, $this->_errstr, $this->_socket_timeout);
$this->_path = $this->translate_uri($p... | php | function put_file($path, $filename) {
// try to open the file ...
$handle = @fopen ($filename, 'r');
if ($handle) {
// $this->sock = pfsockopen ($this->_server, $this->_port, $this->_errno, $this->_errstr, $this->_socket_timeout);
$this->_path = $this->translate_uri($p... | [
"function",
"put_file",
"(",
"$",
"path",
",",
"$",
"filename",
")",
"{",
"// try to open the file ...",
"$",
"handle",
"=",
"@",
"fopen",
"(",
"$",
"filename",
",",
"'r'",
")",
";",
"if",
"(",
"$",
"handle",
")",
"{",
"// $this->sock = pfsockopen ($this->_s... | Public method put_file
Read a file as stream and puts it chunk by chunk into webdav server collection.
Look at php documenation for legal filenames with fopen();
The filename will be translated into utf-8 if not allready in utf-8.
@param string targetpath, string filename
@return int status code. False on error. | [
"Public",
"method",
"put_file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/webdavlib.php#L367-L407 |
212,499 | moodle/moodle | lib/webdavlib.php | webdav_client.get_file | function get_file($srcpath, $localpath) {
$localpath = $this->utf_decode_path($localpath);
$handle = fopen($localpath, 'wb');
if ($handle) {
$unused = '';
$ret = $this->get($srcpath, $unused, $handle);
fclose($handle);
if ($ret) {
... | php | function get_file($srcpath, $localpath) {
$localpath = $this->utf_decode_path($localpath);
$handle = fopen($localpath, 'wb');
if ($handle) {
$unused = '';
$ret = $this->get($srcpath, $unused, $handle);
fclose($handle);
if ($ret) {
... | [
"function",
"get_file",
"(",
"$",
"srcpath",
",",
"$",
"localpath",
")",
"{",
"$",
"localpath",
"=",
"$",
"this",
"->",
"utf_decode_path",
"(",
"$",
"localpath",
")",
";",
"$",
"handle",
"=",
"fopen",
"(",
"$",
"localpath",
",",
"'wb'",
")",
";",
"if... | Public method get_file
Gets a file from a collection into local filesystem.
fopen() is used.
@param string $srcpath
@param string $localpath
@return bool true on success. false on error. | [
"Public",
"method",
"get_file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/webdavlib.php#L419-L433 |
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.