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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
216,600 | moodle/moodle | analytics/classes/model.php | model.format_predictor_predictions | private function format_predictor_predictions($predictorresult) {
$predictions = array();
if (!empty($predictorresult->predictions)) {
foreach ($predictorresult->predictions as $sampleinfo) {
// We parse each prediction.
switch (count($sampleinfo)) {
... | php | private function format_predictor_predictions($predictorresult) {
$predictions = array();
if (!empty($predictorresult->predictions)) {
foreach ($predictorresult->predictions as $sampleinfo) {
// We parse each prediction.
switch (count($sampleinfo)) {
... | [
"private",
"function",
"format_predictor_predictions",
"(",
"$",
"predictorresult",
")",
"{",
"$",
"predictions",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"predictorresult",
"->",
"predictions",
")",
")",
"{",
"foreach",
"(",
"$",
"p... | Formats the predictor results.
@param array $predictorresult
@return array | [
"Formats",
"the",
"predictor",
"results",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L832-L863 |
216,601 | moodle/moodle | analytics/classes/model.php | model.execute_prediction_callbacks | protected function execute_prediction_callbacks(&$predictions, $indicatorcalculations) {
// Here we will store all predictions' contexts, this will be used to limit which users will see those predictions.
$samplecontexts = array();
$records = array();
foreach ($predictions as $uniquesa... | php | protected function execute_prediction_callbacks(&$predictions, $indicatorcalculations) {
// Here we will store all predictions' contexts, this will be used to limit which users will see those predictions.
$samplecontexts = array();
$records = array();
foreach ($predictions as $uniquesa... | [
"protected",
"function",
"execute_prediction_callbacks",
"(",
"&",
"$",
"predictions",
",",
"$",
"indicatorcalculations",
")",
"{",
"// Here we will store all predictions' contexts, this will be used to limit which users will see those predictions.",
"$",
"samplecontexts",
"=",
"arra... | Execute the prediction callbacks defined by the target.
@param \stdClass[] $predictions
@param array $indicatorcalculations
@return array | [
"Execute",
"the",
"prediction",
"callbacks",
"defined",
"by",
"the",
"target",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L872-L904 |
216,602 | moodle/moodle | analytics/classes/model.php | model.trigger_insights | protected function trigger_insights($samplecontexts, $predictionrecords) {
// Notify the target that all predictions have been processed.
if ($this->get_analyser()::one_sample_per_analysable()) {
// We need to do something unusual here. self::save_predictions uses the bulk-insert function ... | php | protected function trigger_insights($samplecontexts, $predictionrecords) {
// Notify the target that all predictions have been processed.
if ($this->get_analyser()::one_sample_per_analysable()) {
// We need to do something unusual here. self::save_predictions uses the bulk-insert function ... | [
"protected",
"function",
"trigger_insights",
"(",
"$",
"samplecontexts",
",",
"$",
"predictionrecords",
")",
"{",
"// Notify the target that all predictions have been processed.",
"if",
"(",
"$",
"this",
"->",
"get_analyser",
"(",
")",
"::",
"one_sample_per_analysable",
"... | Generates insights and updates the cache.
@param \context[] $samplecontexts
@param \stdClass[] $predictionrecords
@return void | [
"Generates",
"insights",
"and",
"updates",
"the",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L913-L951 |
216,603 | moodle/moodle | analytics/classes/model.php | model.prepare_prediction_record | protected function prepare_prediction_record($sampleid, $rangeindex, $prediction, $predictionscore, $calculations) {
$context = $this->get_analyser()->sample_access_context($sampleid);
$record = new \stdClass();
$record->modelid = $this->model->id;
$record->contextid = $context->id;
... | php | protected function prepare_prediction_record($sampleid, $rangeindex, $prediction, $predictionscore, $calculations) {
$context = $this->get_analyser()->sample_access_context($sampleid);
$record = new \stdClass();
$record->modelid = $this->model->id;
$record->contextid = $context->id;
... | [
"protected",
"function",
"prepare_prediction_record",
"(",
"$",
"sampleid",
",",
"$",
"rangeindex",
",",
"$",
"prediction",
",",
"$",
"predictionscore",
",",
"$",
"calculations",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"get_analyser",
"(",
")",
"->... | Stores the prediction in the database.
@param int $sampleid
@param int $rangeindex
@param int $prediction
@param float $predictionscore
@param string $calculations
@return \context | [
"Stores",
"the",
"prediction",
"in",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1064-L1087 |
216,604 | moodle/moodle | analytics/classes/model.php | model.enable | public function enable($timesplittingid = false) {
global $DB, $USER;
$now = time();
if ($timesplittingid && $timesplittingid !== $this->model->timesplitting) {
if (!\core_analytics\manager::is_valid($timesplittingid, '\core_analytics\local\time_splitting\base')) {
... | php | public function enable($timesplittingid = false) {
global $DB, $USER;
$now = time();
if ($timesplittingid && $timesplittingid !== $this->model->timesplitting) {
if (!\core_analytics\manager::is_valid($timesplittingid, '\core_analytics\local\time_splitting\base')) {
... | [
"public",
"function",
"enable",
"(",
"$",
"timesplittingid",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"now",
"=",
"time",
"(",
")",
";",
"if",
"(",
"$",
"timesplittingid",
"&&",
"$",
"timesplittingid",
"!==",
"$",
"thi... | Enabled the model using the provided time splitting method.
@param string|false $timesplittingid False to respect the current time splitting method.
@return void | [
"Enabled",
"the",
"model",
"using",
"the",
"provided",
"time",
"splitting",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1105-L1150 |
216,605 | moodle/moodle | analytics/classes/model.php | model.mark_as_trained | public function mark_as_trained() {
global $DB;
\core_analytics\manager::check_can_manage_models();
$this->model->trained = 1;
$DB->update_record('analytics_models', $this->model);
} | php | public function mark_as_trained() {
global $DB;
\core_analytics\manager::check_can_manage_models();
$this->model->trained = 1;
$DB->update_record('analytics_models', $this->model);
} | [
"public",
"function",
"mark_as_trained",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"\\",
"core_analytics",
"\\",
"manager",
"::",
"check_can_manage_models",
"(",
")",
";",
"$",
"this",
"->",
"model",
"->",
"trained",
"=",
"1",
";",
"$",
"DB",
"->",
"updat... | Marks the model as trained
@return void | [
"Marks",
"the",
"model",
"as",
"trained"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1188-L1195 |
216,606 | moodle/moodle | analytics/classes/model.php | model.get_predictions_contexts | public function get_predictions_contexts($skiphidden = true) {
global $DB, $USER;
$sql = "SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap
JOIN {context} ctx ON ctx.id = ap.contextid
WHERE ap.modelid = :modelid";
$params = array('modelid' => $this-... | php | public function get_predictions_contexts($skiphidden = true) {
global $DB, $USER;
$sql = "SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap
JOIN {context} ctx ON ctx.id = ap.contextid
WHERE ap.modelid = :modelid";
$params = array('modelid' => $this-... | [
"public",
"function",
"get_predictions_contexts",
"(",
"$",
"skiphidden",
"=",
"true",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"sql",
"=",
"\"SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap\n JOIN {context} ctx ON ctx.id = ap.c... | Get the contexts with predictions.
@param bool $skiphidden Skip hidden predictions
@return \stdClass[] | [
"Get",
"the",
"contexts",
"with",
"predictions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1203-L1223 |
216,607 | moodle/moodle | analytics/classes/model.php | model.any_prediction_obtained | public function any_prediction_obtained() {
global $DB;
return $DB->record_exists('analytics_predict_samples',
array('modelid' => $this->model->id, 'timesplitting' => $this->model->timesplitting));
} | php | public function any_prediction_obtained() {
global $DB;
return $DB->record_exists('analytics_predict_samples',
array('modelid' => $this->model->id, 'timesplitting' => $this->model->timesplitting));
} | [
"public",
"function",
"any_prediction_obtained",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"return",
"$",
"DB",
"->",
"record_exists",
"(",
"'analytics_predict_samples'",
",",
"array",
"(",
"'modelid'",
"=>",
"$",
"this",
"->",
"model",
"->",
"id",
",",
"'tim... | Has this model generated predictions?
We don't check analytics_predictions table because targets have the ability to
ignore some predicted values, if that is the case predictions are not even stored
in db.
@return bool | [
"Has",
"this",
"model",
"generated",
"predictions?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1234-L1238 |
216,608 | moodle/moodle | analytics/classes/model.php | model.predictions_exist | public function predictions_exist(\context $context) {
global $DB;
// Filters out previous predictions keeping only the last time range one.
$select = "modelid = :modelid AND contextid = :contextid";
$params = array('modelid' => $this->model->id, 'contextid' => $context->id);
re... | php | public function predictions_exist(\context $context) {
global $DB;
// Filters out previous predictions keeping only the last time range one.
$select = "modelid = :modelid AND contextid = :contextid";
$params = array('modelid' => $this->model->id, 'contextid' => $context->id);
re... | [
"public",
"function",
"predictions_exist",
"(",
"\\",
"context",
"$",
"context",
")",
"{",
"global",
"$",
"DB",
";",
"// Filters out previous predictions keeping only the last time range one.",
"$",
"select",
"=",
"\"modelid = :modelid AND contextid = :contextid\"",
";",
"$",... | Whether predictions exist for this context.
@param \context $context
@return bool | [
"Whether",
"predictions",
"exist",
"for",
"this",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1256-L1263 |
216,609 | moodle/moodle | analytics/classes/model.php | model.get_predictions | public function get_predictions(\context $context, $skiphidden = true, $page = false, $perpage = 100) {
global $DB, $USER;
\core_analytics\manager::check_can_list_insights($context);
// Filters out previous predictions keeping only the last time range one.
$sql = "SELECT ap.*
... | php | public function get_predictions(\context $context, $skiphidden = true, $page = false, $perpage = 100) {
global $DB, $USER;
\core_analytics\manager::check_can_list_insights($context);
// Filters out previous predictions keeping only the last time range one.
$sql = "SELECT ap.*
... | [
"public",
"function",
"get_predictions",
"(",
"\\",
"context",
"$",
"context",
",",
"$",
"skiphidden",
"=",
"true",
",",
"$",
"page",
"=",
"false",
",",
"$",
"perpage",
"=",
"100",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"\\",
"core_ana... | Gets the predictions for this context.
@param \context $context
@param bool $skiphidden Skip hidden predictions
@param int $page The page of results to fetch. False for all results.
@param int $perpage The max number of results to fetch. Ignored if $page is false.
@return array($total, \core_analytics\prediction[]) | [
"Gets",
"the",
"predictions",
"for",
"this",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1274-L1347 |
216,610 | moodle/moodle | analytics/classes/model.php | model.prediction_sample_data | public function prediction_sample_data($predictionobj) {
list($unused, $samplesdata) = $this->get_analyser()->get_samples(array($predictionobj->sampleid));
if (empty($samplesdata[$predictionobj->sampleid])) {
throw new \moodle_exception('errorsamplenotavailable', 'analytics');
}
... | php | public function prediction_sample_data($predictionobj) {
list($unused, $samplesdata) = $this->get_analyser()->get_samples(array($predictionobj->sampleid));
if (empty($samplesdata[$predictionobj->sampleid])) {
throw new \moodle_exception('errorsamplenotavailable', 'analytics');
}
... | [
"public",
"function",
"prediction_sample_data",
"(",
"$",
"predictionobj",
")",
"{",
"list",
"(",
"$",
"unused",
",",
"$",
"samplesdata",
")",
"=",
"$",
"this",
"->",
"get_analyser",
"(",
")",
"->",
"get_samples",
"(",
"array",
"(",
"$",
"predictionobj",
"... | Returns the sample data of a prediction.
@param \stdClass $predictionobj
@return array | [
"Returns",
"the",
"sample",
"data",
"of",
"a",
"prediction",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1355-L1364 |
216,611 | moodle/moodle | analytics/classes/model.php | model.prediction_sample_description | public function prediction_sample_description(\core_analytics\prediction $prediction) {
return $this->get_analyser()->sample_description($prediction->get_prediction_data()->sampleid,
$prediction->get_prediction_data()->contextid, $prediction->get_sample_data());
} | php | public function prediction_sample_description(\core_analytics\prediction $prediction) {
return $this->get_analyser()->sample_description($prediction->get_prediction_data()->sampleid,
$prediction->get_prediction_data()->contextid, $prediction->get_sample_data());
} | [
"public",
"function",
"prediction_sample_description",
"(",
"\\",
"core_analytics",
"\\",
"prediction",
"$",
"prediction",
")",
"{",
"return",
"$",
"this",
"->",
"get_analyser",
"(",
")",
"->",
"sample_description",
"(",
"$",
"prediction",
"->",
"get_prediction_data... | Returns the description of a sample
@param \core_analytics\prediction $prediction
@return array 2 elements: list(string, \renderable) | [
"Returns",
"the",
"description",
"of",
"a",
"sample"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1372-L1375 |
216,612 | moodle/moodle | analytics/classes/model.php | model.get_output_dir | public function get_output_dir($subdirs = array(), $onlymodelid = false) {
global $CFG;
$subdirstr = '';
foreach ($subdirs as $subdir) {
$subdirstr .= DIRECTORY_SEPARATOR . $subdir;
}
$outputdir = get_config('analytics', 'modeloutputdir');
if (empty($outputd... | php | public function get_output_dir($subdirs = array(), $onlymodelid = false) {
global $CFG;
$subdirstr = '';
foreach ($subdirs as $subdir) {
$subdirstr .= DIRECTORY_SEPARATOR . $subdir;
}
$outputdir = get_config('analytics', 'modeloutputdir');
if (empty($outputd... | [
"public",
"function",
"get_output_dir",
"(",
"$",
"subdirs",
"=",
"array",
"(",
")",
",",
"$",
"onlymodelid",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"subdirstr",
"=",
"''",
";",
"foreach",
"(",
"$",
"subdirs",
"as",
"$",
"subdir",
")... | Returns the output directory for prediction processors.
Directory structure as follows:
- Evaluation runs:
models/$model->id/$model->version/evaluation/$model->timesplitting
- Training & prediction runs:
models/$model->id/$model->version/execution
@param array $subdirs
@param bool $onlymodelid Preference over $subdi... | [
"Returns",
"the",
"output",
"directory",
"for",
"prediction",
"processors",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1390-L1414 |
216,613 | moodle/moodle | analytics/classes/model.php | model.get_unique_id | public function get_unique_id() {
global $CFG;
if (!is_null($this->uniqueid)) {
return $this->uniqueid;
}
// Generate a unique id for this site, this model and this time splitting method, considering the last time
// that the model target and indicators were updated... | php | public function get_unique_id() {
global $CFG;
if (!is_null($this->uniqueid)) {
return $this->uniqueid;
}
// Generate a unique id for this site, this model and this time splitting method, considering the last time
// that the model target and indicators were updated... | [
"public",
"function",
"get_unique_id",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"uniqueid",
")",
")",
"{",
"return",
"$",
"this",
"->",
"uniqueid",
";",
"}",
"// Generate a unique id for this site, this mod... | Returns a unique id for this model.
This id should be unique for this site.
@return string | [
"Returns",
"a",
"unique",
"id",
"for",
"this",
"model",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1423-L1436 |
216,614 | moodle/moodle | analytics/classes/model.php | model.export | public function export(\renderer_base $output) {
\core_analytics\manager::check_can_manage_models();
$data = clone $this->model;
$data->name = $this->inplace_editable_name()->export_for_template($output);
$data->target = $this->get_target()->get_name();
$data->targetclass = $t... | php | public function export(\renderer_base $output) {
\core_analytics\manager::check_can_manage_models();
$data = clone $this->model;
$data->name = $this->inplace_editable_name()->export_for_template($output);
$data->target = $this->get_target()->get_name();
$data->targetclass = $t... | [
"public",
"function",
"export",
"(",
"\\",
"renderer_base",
"$",
"output",
")",
"{",
"\\",
"core_analytics",
"\\",
"manager",
"::",
"check_can_manage_models",
"(",
")",
";",
"$",
"data",
"=",
"clone",
"$",
"this",
"->",
"model",
";",
"$",
"data",
"->",
"... | Exports the model data for displaying it in a template.
@param \renderer_base $output The renderer to use for exporting
@return \stdClass | [
"Exports",
"the",
"model",
"data",
"for",
"displaying",
"it",
"in",
"a",
"template",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1444-L1463 |
216,615 | moodle/moodle | analytics/classes/model.php | model.export_model | public function export_model(string $zipfilename, bool $includeweights = true) : string {
\core_analytics\manager::check_can_manage_models();
$modelconfig = new model_config($this);
return $modelconfig->export($zipfilename, $includeweights);
} | php | public function export_model(string $zipfilename, bool $includeweights = true) : string {
\core_analytics\manager::check_can_manage_models();
$modelconfig = new model_config($this);
return $modelconfig->export($zipfilename, $includeweights);
} | [
"public",
"function",
"export_model",
"(",
"string",
"$",
"zipfilename",
",",
"bool",
"$",
"includeweights",
"=",
"true",
")",
":",
"string",
"{",
"\\",
"core_analytics",
"\\",
"manager",
"::",
"check_can_manage_models",
"(",
")",
";",
"$",
"modelconfig",
"=",... | Exports the model data to a zip file.
@param string $zipfilename
@param bool $includeweights Include the model weights if available
@return string Zip file path | [
"Exports",
"the",
"model",
"data",
"to",
"a",
"zip",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1472-L1478 |
216,616 | moodle/moodle | analytics/classes/model.php | model.import_model | public static function import_model(string $zipfilepath) : \core_analytics\model {
\core_analytics\manager::check_can_manage_models();
$modelconfig = new \core_analytics\model_config();
return $modelconfig->import($zipfilepath);
} | php | public static function import_model(string $zipfilepath) : \core_analytics\model {
\core_analytics\manager::check_can_manage_models();
$modelconfig = new \core_analytics\model_config();
return $modelconfig->import($zipfilepath);
} | [
"public",
"static",
"function",
"import_model",
"(",
"string",
"$",
"zipfilepath",
")",
":",
"\\",
"core_analytics",
"\\",
"model",
"{",
"\\",
"core_analytics",
"\\",
"manager",
"::",
"check_can_manage_models",
"(",
")",
";",
"$",
"modelconfig",
"=",
"new",
"\... | Imports the provided model.
Note that this method assumes that model_config::check_dependencies has already been called.
@throws \moodle_exception
@param string $zipfilepath Zip file path
@return \core_analytics\model | [
"Imports",
"the",
"provided",
"model",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1489-L1495 |
216,617 | moodle/moodle | analytics/classes/model.php | model.can_export_configuration | public function can_export_configuration() : bool {
if (empty($this->model->timesplitting)) {
return false;
}
if (!$this->get_indicators()) {
return false;
}
if ($this->is_static()) {
return false;
}
return true;
} | php | public function can_export_configuration() : bool {
if (empty($this->model->timesplitting)) {
return false;
}
if (!$this->get_indicators()) {
return false;
}
if ($this->is_static()) {
return false;
}
return true;
} | [
"public",
"function",
"can_export_configuration",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"model",
"->",
"timesplitting",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"get_indicators",
"... | Can this model be exported?
@return bool | [
"Can",
"this",
"model",
"be",
"exported?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1502-L1516 |
216,618 | moodle/moodle | analytics/classes/model.php | model.get_logs | public function get_logs($limitfrom = 0, $limitnum = 0) {
global $DB;
\core_analytics\manager::check_can_manage_models();
return $DB->get_records('analytics_models_log', array('modelid' => $this->get_id()), 'timecreated DESC', '*',
$limitfrom, $limitnum);
} | php | public function get_logs($limitfrom = 0, $limitnum = 0) {
global $DB;
\core_analytics\manager::check_can_manage_models();
return $DB->get_records('analytics_models_log', array('modelid' => $this->get_id()), 'timecreated DESC', '*',
$limitfrom, $limitnum);
} | [
"public",
"function",
"get_logs",
"(",
"$",
"limitfrom",
"=",
"0",
",",
"$",
"limitnum",
"=",
"0",
")",
"{",
"global",
"$",
"DB",
";",
"\\",
"core_analytics",
"\\",
"manager",
"::",
"check_can_manage_models",
"(",
")",
";",
"return",
"$",
"DB",
"->",
"... | Returns the model logs data.
@param int $limitfrom
@param int $limitnum
@return \stdClass[] | [
"Returns",
"the",
"model",
"logs",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1525-L1532 |
216,619 | moodle/moodle | analytics/classes/model.php | model.get_training_data | public function get_training_data() {
\core_analytics\manager::check_can_manage_models();
$timesplittingid = $this->get_time_splitting()->get_id();
return \core_analytics\dataset_manager::export_training_data($this->get_id(), $timesplittingid);
} | php | public function get_training_data() {
\core_analytics\manager::check_can_manage_models();
$timesplittingid = $this->get_time_splitting()->get_id();
return \core_analytics\dataset_manager::export_training_data($this->get_id(), $timesplittingid);
} | [
"public",
"function",
"get_training_data",
"(",
")",
"{",
"\\",
"core_analytics",
"\\",
"manager",
"::",
"check_can_manage_models",
"(",
")",
";",
"$",
"timesplittingid",
"=",
"$",
"this",
"->",
"get_time_splitting",
"(",
")",
"->",
"get_id",
"(",
")",
";",
... | Merges all training data files into one and returns it.
@return \stored_file|false | [
"Merges",
"all",
"training",
"data",
"files",
"into",
"one",
"and",
"returns",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1539-L1545 |
216,620 | moodle/moodle | analytics/classes/model.php | model.trained_locally | public function trained_locally() : bool {
global $DB;
if (!$this->is_trained() || $this->is_static()) {
// Early exit.
return false;
}
if ($DB->record_exists('analytics_train_samples', ['modelid' => $this->model->id])) {
return true;
}
... | php | public function trained_locally() : bool {
global $DB;
if (!$this->is_trained() || $this->is_static()) {
// Early exit.
return false;
}
if ($DB->record_exists('analytics_train_samples', ['modelid' => $this->model->id])) {
return true;
}
... | [
"public",
"function",
"trained_locally",
"(",
")",
":",
"bool",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"is_trained",
"(",
")",
"||",
"$",
"this",
"->",
"is_static",
"(",
")",
")",
"{",
"// Early exit.",
"return",
"false",
"... | Has the model been trained using data from this site?
This method is useful to determine if a trained model can be evaluated as
we can not use the same data for training and for evaluation.
@return bool | [
"Has",
"the",
"model",
"been",
"trained",
"using",
"data",
"from",
"this",
"site?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1555-L1568 |
216,621 | moodle/moodle | analytics/classes/model.php | model.flag_file_as_used | protected function flag_file_as_used(\stored_file $file, $action) {
global $DB;
$usedfile = new \stdClass();
$usedfile->modelid = $this->model->id;
$usedfile->fileid = $file->get_id();
$usedfile->action = $action;
$usedfile->time = time();
$DB->insert_record('ana... | php | protected function flag_file_as_used(\stored_file $file, $action) {
global $DB;
$usedfile = new \stdClass();
$usedfile->modelid = $this->model->id;
$usedfile->fileid = $file->get_id();
$usedfile->action = $action;
$usedfile->time = time();
$DB->insert_record('ana... | [
"protected",
"function",
"flag_file_as_used",
"(",
"\\",
"stored_file",
"$",
"file",
",",
"$",
"action",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"usedfile",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"usedfile",
"->",
"modelid",
"=",
"$",
"this... | Flag the provided file as used for training or prediction.
@param \stored_file $file
@param string $action
@return void | [
"Flag",
"the",
"provided",
"file",
"as",
"used",
"for",
"training",
"or",
"prediction",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1577-L1586 |
216,622 | moodle/moodle | analytics/classes/model.php | model.log_result | protected function log_result($timesplittingid, $score, $dir = false, $info = false, $evaluationmode = 'configuration') {
global $DB, $USER;
$log = new \stdClass();
$log->modelid = $this->get_id();
$log->version = $this->model->version;
$log->evaluationmode = $evaluationmode;
... | php | protected function log_result($timesplittingid, $score, $dir = false, $info = false, $evaluationmode = 'configuration') {
global $DB, $USER;
$log = new \stdClass();
$log->modelid = $this->get_id();
$log->version = $this->model->version;
$log->evaluationmode = $evaluationmode;
... | [
"protected",
"function",
"log_result",
"(",
"$",
"timesplittingid",
",",
"$",
"score",
",",
"$",
"dir",
"=",
"false",
",",
"$",
"info",
"=",
"false",
",",
"$",
"evaluationmode",
"=",
"'configuration'",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
"... | Log the evaluation results in the database.
@param string $timesplittingid
@param float $score
@param string $dir
@param array $info
@param string $evaluationmode
@return int The inserted log id | [
"Log",
"the",
"evaluation",
"results",
"in",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1598-L1618 |
216,623 | moodle/moodle | analytics/classes/model.php | model.indicator_classes | private static function indicator_classes($indicators) {
// What we want to check and store are the indicator classes not the keys.
$indicatorclasses = array();
foreach ($indicators as $indicator) {
if (!\core_analytics\manager::is_valid($indicator, '\core_analytics\local\indicator\... | php | private static function indicator_classes($indicators) {
// What we want to check and store are the indicator classes not the keys.
$indicatorclasses = array();
foreach ($indicators as $indicator) {
if (!\core_analytics\manager::is_valid($indicator, '\core_analytics\local\indicator\... | [
"private",
"static",
"function",
"indicator_classes",
"(",
"$",
"indicators",
")",
"{",
"// What we want to check and store are the indicator classes not the keys.",
"$",
"indicatorclasses",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"indicators",
"as",
"$",
"ind... | Utility method to return indicator class names from a list of indicator objects
@param \core_analytics\local\indicator\base[] $indicators
@return string[] | [
"Utility",
"method",
"to",
"return",
"indicator",
"class",
"names",
"from",
"a",
"list",
"of",
"indicator",
"objects"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1626-L1643 |
216,624 | moodle/moodle | analytics/classes/model.php | model.clear | public function clear() {
global $DB, $USER;
\core_analytics\manager::check_can_manage_models();
// Delete current model version stored stuff.
$predictor = $this->get_predictions_processor(false);
if ($predictor->is_ready() !== true) {
$predictorname = \core_analyti... | php | public function clear() {
global $DB, $USER;
\core_analytics\manager::check_can_manage_models();
// Delete current model version stored stuff.
$predictor = $this->get_predictions_processor(false);
if ($predictor->is_ready() !== true) {
$predictorname = \core_analyti... | [
"public",
"function",
"clear",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"\\",
"core_analytics",
"\\",
"manager",
"::",
"check_can_manage_models",
"(",
")",
";",
"// Delete current model version stored stuff.",
"$",
"predictor",
"=",
"$",
"this"... | Clears the model training and prediction data.
Executed after updating model critical elements like the time splitting method
or the indicators.
@return void | [
"Clears",
"the",
"model",
"training",
"and",
"prediction",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1653-L1695 |
216,625 | moodle/moodle | analytics/classes/model.php | model.get_name | public function get_name() {
if (trim($this->model->name) === '') {
return $this->get_target()->get_name();
} else {
return $this->model->name;
}
} | php | public function get_name() {
if (trim($this->model->name) === '') {
return $this->get_target()->get_name();
} else {
return $this->model->name;
}
} | [
"public",
"function",
"get_name",
"(",
")",
"{",
"if",
"(",
"trim",
"(",
"$",
"this",
"->",
"model",
"->",
"name",
")",
"===",
"''",
")",
"{",
"return",
"$",
"this",
"->",
"get_target",
"(",
")",
"->",
"get_name",
"(",
")",
";",
"}",
"else",
"{",... | Returns the name of the model.
By default, models use their target's name as their own name. They can have their explicit name, too. In which
case, the explicit name is used instead of the default one.
@return string|lang_string | [
"Returns",
"the",
"name",
"of",
"the",
"model",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1705-L1713 |
216,626 | moodle/moodle | analytics/classes/model.php | model.rename | public function rename(string $name) {
global $DB, $USER;
$this->model->name = $name;
$this->model->timemodified = time();
$this->model->usermodified = $USER->id;
$DB->update_record('analytics_models', $this->model);
} | php | public function rename(string $name) {
global $DB, $USER;
$this->model->name = $name;
$this->model->timemodified = time();
$this->model->usermodified = $USER->id;
$DB->update_record('analytics_models', $this->model);
} | [
"public",
"function",
"rename",
"(",
"string",
"$",
"name",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"this",
"->",
"model",
"->",
"name",
"=",
"$",
"name",
";",
"$",
"this",
"->",
"model",
"->",
"timemodified",
"=",
"time",
"(",
... | Renames the model to the given name.
When given an empty string, the model falls back to using the associated target's name as its name.
@param string $name The new name for the model, empty string for using the default name. | [
"Renames",
"the",
"model",
"to",
"the",
"given",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1722-L1730 |
216,627 | moodle/moodle | analytics/classes/model.php | model.inplace_editable_name | public function inplace_editable_name() {
$displayname = format_string($this->get_name());
return new \core\output\inplace_editable('core_analytics', 'modelname', $this->model->id,
has_capability('moodle/analytics:managemodels', \context_system::instance()), $displayname, $this->model->nam... | php | public function inplace_editable_name() {
$displayname = format_string($this->get_name());
return new \core\output\inplace_editable('core_analytics', 'modelname', $this->model->id,
has_capability('moodle/analytics:managemodels', \context_system::instance()), $displayname, $this->model->nam... | [
"public",
"function",
"inplace_editable_name",
"(",
")",
"{",
"$",
"displayname",
"=",
"format_string",
"(",
"$",
"this",
"->",
"get_name",
"(",
")",
")",
";",
"return",
"new",
"\\",
"core",
"\\",
"output",
"\\",
"inplace_editable",
"(",
"'core_analytics'",
... | Returns an inplace editable element with the model's name.
@return \core\output\inplace_editable | [
"Returns",
"an",
"inplace",
"editable",
"element",
"with",
"the",
"model",
"s",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/model.php#L1737-L1743 |
216,628 | moodle/moodle | mod/scorm/mod_form.php | mod_scorm_mod_form.set_data | public function set_data($defaultvalues) {
$defaultvalues = (array)$defaultvalues;
if (isset($defaultvalues['scormtype']) and isset($defaultvalues['reference'])) {
switch ($defaultvalues['scormtype']) {
case SCORM_TYPE_LOCALSYNC :
case SCORM_TYPE_EXTERNAL:
... | php | public function set_data($defaultvalues) {
$defaultvalues = (array)$defaultvalues;
if (isset($defaultvalues['scormtype']) and isset($defaultvalues['reference'])) {
switch ($defaultvalues['scormtype']) {
case SCORM_TYPE_LOCALSYNC :
case SCORM_TYPE_EXTERNAL:
... | [
"public",
"function",
"set_data",
"(",
"$",
"defaultvalues",
")",
"{",
"$",
"defaultvalues",
"=",
"(",
"array",
")",
"$",
"defaultvalues",
";",
"if",
"(",
"isset",
"(",
"$",
"defaultvalues",
"[",
"'scormtype'",
"]",
")",
"and",
"isset",
"(",
"$",
"defaul... | Need to translate the "options" and "reference" field. | [
"Need",
"to",
"translate",
"the",
"options",
"and",
"reference",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/scorm/mod_form.php#L466-L490 |
216,629 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.setDatasource | function setDatasource(&$datasource, $defaultsFilter = null, $constantsFilter = null)
{
if (is_object($datasource)) {
$this->_datasource =& $datasource;
if (is_callable(array($datasource, 'defaultValues'))) {
$this->setDefaults($datasource->defaultValues($this), $defa... | php | function setDatasource(&$datasource, $defaultsFilter = null, $constantsFilter = null)
{
if (is_object($datasource)) {
$this->_datasource =& $datasource;
if (is_callable(array($datasource, 'defaultValues'))) {
$this->setDefaults($datasource->defaultValues($this), $defa... | [
"function",
"setDatasource",
"(",
"&",
"$",
"datasource",
",",
"$",
"defaultsFilter",
"=",
"null",
",",
"$",
"constantsFilter",
"=",
"null",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"datasource",
")",
")",
"{",
"$",
"this",
"->",
"_datasource",
"=",
... | Sets a datasource object for this form object
Datasource default and constant values will feed the QuickForm object if
the datasource implements defaultValues() and constantValues() methods.
@param object $datasource datasource object implementing the informal datasource protocol
@param mixed $d... | [
"Sets",
"a",
"datasource",
"object",
"for",
"this",
"form",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L404-L417 |
216,630 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.setDefaults | function setDefaults($defaultValues = null, $filter = null)
{
if (is_array($defaultValues)) {
if (isset($filter)) {
if (is_array($filter) && (2 != count($filter) || !is_callable($filter))) {
foreach ($filter as $val) {
if (!is_callable(... | php | function setDefaults($defaultValues = null, $filter = null)
{
if (is_array($defaultValues)) {
if (isset($filter)) {
if (is_array($filter) && (2 != count($filter) || !is_callable($filter))) {
foreach ($filter as $val) {
if (!is_callable(... | [
"function",
"setDefaults",
"(",
"$",
"defaultValues",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"defaultValues",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"filter",
")",
")",
"{",
"if",
"(",
"is_arr... | Initializes default form values
@param array $defaultValues values used to fill the form
@param mixed $filter (optional) filter(s) to apply to all default values
@since 1.0
@access public
@return void | [
"Initializes",
"default",
"form",
"values"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L431-L454 |
216,631 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.setConstants | function setConstants($constantValues = null, $filter = null)
{
if (is_array($constantValues)) {
if (isset($filter)) {
if (is_array($filter) && (2 != count($filter) || !is_callable($filter))) {
foreach ($filter as $val) {
if (!is_callab... | php | function setConstants($constantValues = null, $filter = null)
{
if (is_array($constantValues)) {
if (isset($filter)) {
if (is_array($filter) && (2 != count($filter) || !is_callable($filter))) {
foreach ($filter as $val) {
if (!is_callab... | [
"function",
"setConstants",
"(",
"$",
"constantValues",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"constantValues",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"filter",
")",
")",
"{",
"if",
"(",
"is_... | Initializes constant form values.
These values won't get overridden by POST or GET vars
@param array $constantValues values used to fill the form
@param mixed $filter (optional) filter(s) to apply to all default values
@since 2.0
@access public
@return void | [
"Initializes",
"constant",
"form",
"values",
".",
"These",
"values",
"won",
"t",
"get",
"overridden",
"by",
"POST",
"or",
"GET",
"vars"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L470-L493 |
216,632 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.setMaxFileSize | function setMaxFileSize($bytes = 0)
{
if ($bytes > 0) {
$this->_maxFileSize = $bytes;
}
if (!$this->elementExists('MAX_FILE_SIZE')) {
$this->addElement('hidden', 'MAX_FILE_SIZE', $this->_maxFileSize);
} else {
$el =& $this->getElement('MAX_FILE_SIZ... | php | function setMaxFileSize($bytes = 0)
{
if ($bytes > 0) {
$this->_maxFileSize = $bytes;
}
if (!$this->elementExists('MAX_FILE_SIZE')) {
$this->addElement('hidden', 'MAX_FILE_SIZE', $this->_maxFileSize);
} else {
$el =& $this->getElement('MAX_FILE_SIZ... | [
"function",
"setMaxFileSize",
"(",
"$",
"bytes",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"bytes",
">",
"0",
")",
"{",
"$",
"this",
"->",
"_maxFileSize",
"=",
"$",
"bytes",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"elementExists",
"(",
"'MAX_FILE_SI... | Sets the value of MAX_FILE_SIZE hidden element
@param int $bytes Size in bytes
@since 3.0
@access public
@return void | [
"Sets",
"the",
"value",
"of",
"MAX_FILE_SIZE",
"hidden",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L506-L517 |
216,633 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.& | function &createElement($elementType)
{
if (!isset($this) || !($this instanceof HTML_QuickForm)) {
// Several form elements in Moodle core before 3.2 were calling this method
// statically suppressing PHP notices. This debugging message should notify
// developers who cop... | php | function &createElement($elementType)
{
if (!isset($this) || !($this instanceof HTML_QuickForm)) {
// Several form elements in Moodle core before 3.2 were calling this method
// statically suppressing PHP notices. This debugging message should notify
// developers who cop... | [
"function",
"&",
"createElement",
"(",
"$",
"elementType",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
")",
"||",
"!",
"(",
"$",
"this",
"instanceof",
"HTML_QuickForm",
")",
")",
"{",
"// Several form elements in Moodle core before 3.2 were calling this m... | Creates a new form element of the given type.
This method accepts variable number of parameters, their
meaning and count depending on $elementType
@param string $elementType type of element to add (text, textarea, file...)
@since 1.0
@access public
@return object extended class of HTML_element
@t... | [
"Creates",
"a",
"new",
"form",
"element",
"of",
"the",
"given",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L549-L564 |
216,634 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.& | function &_loadElement($event, $type, $args)
{
$type = strtolower($type);
if (!self::isTypeRegistered($type)) {
$error = self::raiseError(null, QUICKFORM_UNREGISTERED_ELEMENT, null, E_USER_WARNING, "Element '$type' does not exist in HTML_QuickForm::_loadElement()", 'HTML_QuickForm_Error'... | php | function &_loadElement($event, $type, $args)
{
$type = strtolower($type);
if (!self::isTypeRegistered($type)) {
$error = self::raiseError(null, QUICKFORM_UNREGISTERED_ELEMENT, null, E_USER_WARNING, "Element '$type' does not exist in HTML_QuickForm::_loadElement()", 'HTML_QuickForm_Error'... | [
"function",
"&",
"_loadElement",
"(",
"$",
"event",
",",
"$",
"type",
",",
"$",
"args",
")",
"{",
"$",
"type",
"=",
"strtolower",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
"self",
"::",
"isTypeRegistered",
"(",
"$",
"type",
")",
")",
"{",
"$",
... | Returns a form element of the given type
@param string $event event to send to newly created element ('createElement' or 'addElement')
@param string $type element type
@param array $args arguments for event
@since 2.0
@access private
@return object a new element
@throws HTML_... | [
"Returns",
"a",
"form",
"element",
"of",
"the",
"given",
"type"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L580-L601 |
216,635 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.& | function &addElement($element)
{
if (is_object($element) && is_subclass_of($element, 'html_quickform_element')) {
$elementObject = &$element;
$elementObject->onQuickFormEvent('updateValue', null, $this);
} else {
$args = func_get_args();
$elementObject =... | php | function &addElement($element)
{
if (is_object($element) && is_subclass_of($element, 'html_quickform_element')) {
$elementObject = &$element;
$elementObject->onQuickFormEvent('updateValue', null, $this);
} else {
$args = func_get_args();
$elementObject =... | [
"function",
"&",
"addElement",
"(",
"$",
"element",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"element",
")",
"&&",
"is_subclass_of",
"(",
"$",
"element",
",",
"'html_quickform_element'",
")",
")",
"{",
"$",
"elementObject",
"=",
"&",
"$",
"element",
"... | Adds an element into the form
If $element is a string representing element type, then this
method accepts variable number of parameters, their meaning
and count depending on $element
@param mixed $element element object or type of element to add (text, textarea, file...)
@since 1.0
@return object ... | [
"Adds",
"an",
"element",
"into",
"the",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L619-L655 |
216,636 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.& | function &insertElementBefore(&$element, $nameAfter)
{
if (!empty($this->_duplicateIndex[$nameAfter])) {
$error = self::raiseError(null, QUICKFORM_INVALID_ELEMENT_NAME, null, E_USER_WARNING, 'Several elements named "' . $nameAfter . '" exist in HTML_QuickForm::insertElementBefore().', 'HTML_Quic... | php | function &insertElementBefore(&$element, $nameAfter)
{
if (!empty($this->_duplicateIndex[$nameAfter])) {
$error = self::raiseError(null, QUICKFORM_INVALID_ELEMENT_NAME, null, E_USER_WARNING, 'Several elements named "' . $nameAfter . '" exist in HTML_QuickForm::insertElementBefore().', 'HTML_Quic... | [
"function",
"&",
"insertElementBefore",
"(",
"&",
"$",
"element",
",",
"$",
"nameAfter",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_duplicateIndex",
"[",
"$",
"nameAfter",
"]",
")",
")",
"{",
"$",
"error",
"=",
"self",
"::",
"raiseE... | Inserts a new element right before the other element
Warning: it is not possible to check whether the $element is already
added to the form, therefore if you want to move the existing form
element to a new position, you'll have to use removeElement():
$form->insertElementBefore($form->removeElement('foo', false), 'bar... | [
"Inserts",
"a",
"new",
"element",
"right",
"before",
"the",
"other",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L675-L726 |
216,637 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.& | function &addGroup($elements, $name=null, $groupLabel='', $separator=null, $appendName = true)
{
static $anonGroups = 1;
if (0 == strlen($name)) {
$name = 'qf_group_' . $anonGroups++;
$appendName = false;
}
$group =& $this->addElement('group', $name, $g... | php | function &addGroup($elements, $name=null, $groupLabel='', $separator=null, $appendName = true)
{
static $anonGroups = 1;
if (0 == strlen($name)) {
$name = 'qf_group_' . $anonGroups++;
$appendName = false;
}
$group =& $this->addElement('group', $name, $g... | [
"function",
"&",
"addGroup",
"(",
"$",
"elements",
",",
"$",
"name",
"=",
"null",
",",
"$",
"groupLabel",
"=",
"''",
",",
"$",
"separator",
"=",
"null",
",",
"$",
"appendName",
"=",
"true",
")",
"{",
"static",
"$",
"anonGroups",
"=",
"1",
";",
"if"... | Adds an element group
@param array $elements array of elements composing the group
@param string $name (optional)group name
@param string $groupLabel (optional)group label
@param string $separator (optional)string to separate elements
@param string $appendNam... | [
"Adds",
"an",
"element",
"group"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L744-L754 |
216,638 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.& | function &getElement($element)
{
if (isset($this->_elementIndex[$element])) {
return $this->_elements[$this->_elementIndex[$element]];
} else {
$error = self::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$element' does not exist in HTML_QuickFo... | php | function &getElement($element)
{
if (isset($this->_elementIndex[$element])) {
return $this->_elements[$this->_elementIndex[$element]];
} else {
$error = self::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$element' does not exist in HTML_QuickFo... | [
"function",
"&",
"getElement",
"(",
"$",
"element",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_elementIndex",
"[",
"$",
"element",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_elements",
"[",
"$",
"this",
"->",
"_elementIndex",
"["... | Returns a reference to the element
@param string $element Element name
@since 2.0
@access public
@return object reference to element
@throws HTML_QuickForm_Error | [
"Returns",
"a",
"reference",
"to",
"the",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L768-L776 |
216,639 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.& | function &getElementValue($element)
{
if (!isset($this->_elementIndex[$element])) {
$error = self::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$element' does not exist in HTML_QuickForm::getElementValue()", 'HTML_QuickForm_Error', true);
return $error... | php | function &getElementValue($element)
{
if (!isset($this->_elementIndex[$element])) {
$error = self::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$element' does not exist in HTML_QuickForm::getElementValue()", 'HTML_QuickForm_Error', true);
return $error... | [
"function",
"&",
"getElementValue",
"(",
"$",
"element",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_elementIndex",
"[",
"$",
"element",
"]",
")",
")",
"{",
"$",
"error",
"=",
"self",
"::",
"raiseError",
"(",
"null",
",",
"QUICKFORM_... | Returns the element's raw value
This returns the value as submitted by the form (not filtered)
or set via setDefaults() or setConstants()
@param string $element Element name
@since 2.0
@access public
@return mixed element value
@throws HTML_QuickForm_Error | [
"Returns",
"the",
"element",
"s",
"raw",
"value"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L793-L812 |
216,640 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.setElementError | function setElementError($element, $message = null)
{
if (!empty($message)) {
$this->_errors[$element] = $message;
} else {
unset($this->_errors[$element]);
}
} | php | function setElementError($element, $message = null)
{
if (!empty($message)) {
$this->_errors[$element] = $message;
} else {
unset($this->_errors[$element]);
}
} | [
"function",
"setElementError",
"(",
"$",
"element",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"message",
")",
")",
"{",
"$",
"this",
"->",
"_errors",
"[",
"$",
"element",
"]",
"=",
"$",
"message",
";",
"}",
"e... | Set error message for a form element
@param string $element Name of form element to set error for
@param string $message Error message, if empty then removes the current error message
@since 1.0
@access public
@return void | [
"Set",
"error",
"message",
"for",
"a",
"form",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L938-L945 |
216,641 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.getElementType | function getElementType($element)
{
if (isset($this->_elementIndex[$element])) {
return $this->_elements[$this->_elementIndex[$element]]->getType();
}
return false;
} | php | function getElementType($element)
{
if (isset($this->_elementIndex[$element])) {
return $this->_elements[$this->_elementIndex[$element]]->getType();
}
return false;
} | [
"function",
"getElementType",
"(",
"$",
"element",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_elementIndex",
"[",
"$",
"element",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_elements",
"[",
"$",
"this",
"->",
"_elementIndex",
"[",
... | Returns the type of the given element
@param string $element Name of form element
@since 1.1
@access public
@return string Type of the element, false if the element is not found | [
"Returns",
"the",
"type",
"of",
"the",
"given",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L958-L964 |
216,642 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.updateElementAttr | function updateElementAttr($elements, $attrs)
{
if (is_string($elements)) {
$elements = preg_split('/[ ]?,[ ]?/', $elements);
}
foreach (array_keys($elements) as $key) {
if (is_object($elements[$key]) && is_a($elements[$key], 'HTML_QuickForm_element')) {
... | php | function updateElementAttr($elements, $attrs)
{
if (is_string($elements)) {
$elements = preg_split('/[ ]?,[ ]?/', $elements);
}
foreach (array_keys($elements) as $key) {
if (is_object($elements[$key]) && is_a($elements[$key], 'HTML_QuickForm_element')) {
... | [
"function",
"updateElementAttr",
"(",
"$",
"elements",
",",
"$",
"attrs",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"elements",
")",
")",
"{",
"$",
"elements",
"=",
"preg_split",
"(",
"'/[ ]?,[ ]?/'",
",",
"$",
"elements",
")",
";",
"}",
"foreach",
"... | Updates Attributes for one or more elements
@param mixed $elements Array of element names/objects or string of elements to be updated
@param mixed $attrs Array or sting of html attributes
@since 2.10
@access public
@return void | [
"Updates",
"Attributes",
"for",
"one",
"or",
"more",
"elements"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L978-L995 |
216,643 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.addFormRule | function addFormRule($rule)
{
if (!is_callable($rule)) {
return self::raiseError(null, QUICKFORM_INVALID_RULE, null, E_USER_WARNING, 'Callback function does not exist in HTML_QuickForm::addFormRule()', 'HTML_QuickForm_Error', true);
}
$this->_formRules[] = $rule;
} | php | function addFormRule($rule)
{
if (!is_callable($rule)) {
return self::raiseError(null, QUICKFORM_INVALID_RULE, null, E_USER_WARNING, 'Callback function does not exist in HTML_QuickForm::addFormRule()', 'HTML_QuickForm_Error', true);
}
$this->_formRules[] = $rule;
} | [
"function",
"addFormRule",
"(",
"$",
"rule",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"rule",
")",
")",
"{",
"return",
"self",
"::",
"raiseError",
"(",
"null",
",",
"QUICKFORM_INVALID_RULE",
",",
"null",
",",
"E_USER_WARNING",
",",
"'Callback fun... | Adds a global validation rule
This should be used when for a rule involving several fields or if
you want to use some completely custom validation for your form.
The rule function/method should return true in case of successful
validation and array('element name' => 'error') when there were errors.
@access public
@... | [
"Adds",
"a",
"global",
"validation",
"rule"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L1201-L1207 |
216,644 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm._recursiveFilter | function _recursiveFilter($filter, $value)
{
if (is_array($value)) {
$cleanValues = array();
foreach ($value as $k => $v) {
$cleanValues[$k] = $this->_recursiveFilter($filter, $v);
}
return $cleanValues;
} else {
return call... | php | function _recursiveFilter($filter, $value)
{
if (is_array($value)) {
$cleanValues = array();
foreach ($value as $k => $v) {
$cleanValues[$k] = $this->_recursiveFilter($filter, $v);
}
return $cleanValues;
} else {
return call... | [
"function",
"_recursiveFilter",
"(",
"$",
"filter",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"cleanValues",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"value",
"as",
"$",
"k",
"=>",
"$",
"v... | Recursively apply a filter function
@param string $filter filter to apply
@param mixed $value submitted values
@since 2.0
@access private
@return cleaned values | [
"Recursively",
"apply",
"a",
"filter",
"function"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L1257-L1268 |
216,645 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.isRuleRegistered | function isRuleRegistered($name, $autoRegister = false)
{
if (is_scalar($name) && isset($GLOBALS['_HTML_QuickForm_registered_rules'][$name])) {
return true;
} elseif (!$autoRegister) {
return false;
}
// automatically register the rule if requested
inc... | php | function isRuleRegistered($name, $autoRegister = false)
{
if (is_scalar($name) && isset($GLOBALS['_HTML_QuickForm_registered_rules'][$name])) {
return true;
} elseif (!$autoRegister) {
return false;
}
// automatically register the rule if requested
inc... | [
"function",
"isRuleRegistered",
"(",
"$",
"name",
",",
"$",
"autoRegister",
"=",
"false",
")",
"{",
"if",
"(",
"is_scalar",
"(",
"$",
"name",
")",
"&&",
"isset",
"(",
"$",
"GLOBALS",
"[",
"'_HTML_QuickForm_registered_rules'",
"]",
"[",
"$",
"name",
"]",
... | Returns whether or not the given rule is supported
@param string $name Validation rule name
@param bool Whether to automatically register subclasses of HTML_QuickForm_Rule
@since 1.0
@access public
@return mixed true if previously registered, false if not, new rule name if auto-registerin... | [
"Returns",
"whether",
"or",
"not",
"the",
"given",
"rule",
"is",
"supported"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L1349-L1375 |
216,646 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.isElementFrozen | function isElementFrozen($element)
{
if (isset($this->_elementIndex[$element])) {
return $this->_elements[$this->_elementIndex[$element]]->isFrozen();
}
return false;
} | php | function isElementFrozen($element)
{
if (isset($this->_elementIndex[$element])) {
return $this->_elements[$this->_elementIndex[$element]]->isFrozen();
}
return false;
} | [
"function",
"isElementFrozen",
"(",
"$",
"element",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_elementIndex",
"[",
"$",
"element",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_elements",
"[",
"$",
"this",
"->",
"_elementIndex",
"[",
... | Returns whether or not the form element is frozen
@param string $element Form element name
@since 1.0
@access public
@return boolean | [
"Returns",
"whether",
"or",
"not",
"the",
"form",
"element",
"is",
"frozen"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L1419-L1425 |
216,647 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.freeze | function freeze($elementList=null)
{
if (!isset($elementList)) {
$this->_freezeAll = true;
$elementList = array();
} else {
if (!is_array($elementList)) {
$elementList = preg_split('/[ ]*,[ ]*/', $elementList);
}
$elementLis... | php | function freeze($elementList=null)
{
if (!isset($elementList)) {
$this->_freezeAll = true;
$elementList = array();
} else {
if (!is_array($elementList)) {
$elementList = preg_split('/[ ]*,[ ]*/', $elementList);
}
$elementLis... | [
"function",
"freeze",
"(",
"$",
"elementList",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"elementList",
")",
")",
"{",
"$",
"this",
"->",
"_freezeAll",
"=",
"true",
";",
"$",
"elementList",
"=",
"array",
"(",
")",
";",
"}",
"else",
... | Displays elements without HTML input tags
@param mixed $elementList array or string of element(s) to be frozen
@since 1.0
@access public
@throws HTML_QuickForm_Error | [
"Displays",
"elements",
"without",
"HTML",
"input",
"tags"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L1572-L1596 |
216,648 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.process | function process($callback, $mergeFiles = true)
{
if (!is_callable($callback)) {
return self::raiseError(null, QUICKFORM_INVALID_PROCESS, null, E_USER_WARNING, "Callback function does not exist in QuickForm::process()", 'HTML_QuickForm_Error', true);
}
$values = ($mergeFiles === ... | php | function process($callback, $mergeFiles = true)
{
if (!is_callable($callback)) {
return self::raiseError(null, QUICKFORM_INVALID_PROCESS, null, E_USER_WARNING, "Callback function does not exist in QuickForm::process()", 'HTML_QuickForm_Error', true);
}
$values = ($mergeFiles === ... | [
"function",
"process",
"(",
"$",
"callback",
",",
"$",
"mergeFiles",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"return",
"self",
"::",
"raiseError",
"(",
"null",
",",
"QUICKFORM_INVALID_PROCESS",
",",
"nul... | Performs the form data processing
@param mixed $callback Callback, either function name or array(&$object, 'method')
@param bool $mergeFiles Whether uploaded files should be processed too
@since 1.0
@access public
@throws HTML_QuickForm_Error | [
"Performs",
"the",
"form",
"data",
"processing"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L1625-L1632 |
216,649 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.toHtml | function toHtml ($in_data = null)
{
if (!is_null($in_data)) {
$this->addElement('html', $in_data);
}
$renderer =& $this->defaultRenderer();
$this->accept($renderer);
return $renderer->toHtml();
} | php | function toHtml ($in_data = null)
{
if (!is_null($in_data)) {
$this->addElement('html', $in_data);
}
$renderer =& $this->defaultRenderer();
$this->accept($renderer);
return $renderer->toHtml();
} | [
"function",
"toHtml",
"(",
"$",
"in_data",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"in_data",
")",
")",
"{",
"$",
"this",
"->",
"addElement",
"(",
"'html'",
",",
"$",
"in_data",
")",
";",
"}",
"$",
"renderer",
"=",
"&",
"$",
... | Returns an HTML version of the form
@param string $in_data (optional) Any extra data to insert right
before form is rendered. Useful when using templates.
@return string Html version of the form
@since 1.0
@access public | [
"Returns",
"an",
"HTML",
"version",
"of",
"the",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L1690-L1698 |
216,650 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.getSubmitValues | function getSubmitValues($mergeFiles = false)
{
return $mergeFiles? HTML_QuickForm::arrayMerge($this->_submitValues, $this->_submitFiles): $this->_submitValues;
} | php | function getSubmitValues($mergeFiles = false)
{
return $mergeFiles? HTML_QuickForm::arrayMerge($this->_submitValues, $this->_submitFiles): $this->_submitValues;
} | [
"function",
"getSubmitValues",
"(",
"$",
"mergeFiles",
"=",
"false",
")",
"{",
"return",
"$",
"mergeFiles",
"?",
"HTML_QuickForm",
"::",
"arrayMerge",
"(",
"$",
"this",
"->",
"_submitValues",
",",
"$",
"this",
"->",
"_submitFiles",
")",
":",
"$",
"this",
"... | Returns the values submitted by the form
@since 2.0
@access public
@param bool Whether uploaded files should be returned too
@return array | [
"Returns",
"the",
"values",
"submitted",
"by",
"the",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L1808-L1811 |
216,651 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.toArray | function toArray($collectHidden = false)
{
include_once 'HTML/QuickForm/Renderer/Array.php';
$renderer = new HTML_QuickForm_Renderer_Array($collectHidden); //Moodle: PHP 5.3 compatibility
$this->accept($renderer);
return $renderer->toArray();
} | php | function toArray($collectHidden = false)
{
include_once 'HTML/QuickForm/Renderer/Array.php';
$renderer = new HTML_QuickForm_Renderer_Array($collectHidden); //Moodle: PHP 5.3 compatibility
$this->accept($renderer);
return $renderer->toArray();
} | [
"function",
"toArray",
"(",
"$",
"collectHidden",
"=",
"false",
")",
"{",
"include_once",
"'HTML/QuickForm/Renderer/Array.php'",
";",
"$",
"renderer",
"=",
"new",
"HTML_QuickForm_Renderer_Array",
"(",
"$",
"collectHidden",
")",
";",
"//Moodle: PHP 5.3 compatibility",
"$... | Returns the form's contents in an array.
The description of the array structure is in HTML_QuickForm_Renderer_Array docs
@since 2.0
@access public
@param bool Whether to collect hidden elements (passed to the Renderer's constructor)
@return array of form contents | [
"Returns",
"the",
"form",
"s",
"contents",
"in",
"an",
"array",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L1826-L1832 |
216,652 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.exportValues | function exportValues($elementList = null)
{
$values = array();
if (null === $elementList) {
// iterate over all elements, calling their exportValue() methods
foreach (array_keys($this->_elements) as $key) {
$value = $this->_elements[$key]->exportValue($this->... | php | function exportValues($elementList = null)
{
$values = array();
if (null === $elementList) {
// iterate over all elements, calling their exportValue() methods
foreach (array_keys($this->_elements) as $key) {
$value = $this->_elements[$key]->exportValue($this->... | [
"function",
"exportValues",
"(",
"$",
"elementList",
"=",
"null",
")",
"{",
"$",
"values",
"=",
"array",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"elementList",
")",
"{",
"// iterate over all elements, calling their exportValue() methods",
"foreach",
"(",
"... | Returns 'safe' elements' values
Unlike getSubmitValues(), this will return only the values
corresponding to the elements present in the form.
@param mixed Array/string of element names, whose values we want. If not set then return all elements.
@access public
@return array An assoc array of elements' values
@... | [
"Returns",
"safe",
"elements",
"values"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L1882-L1908 |
216,653 | moodle/moodle | lib/pear/HTML/QuickForm.php | HTML_QuickForm.errorMessage | static function errorMessage($value)
{
// make the variable static so that it only has to do the defining on the first call
static $errorMessages;
// define the varies error messages
if (!isset($errorMessages)) {
$errorMessages = array(
QUICKFORM_OK ... | php | static function errorMessage($value)
{
// make the variable static so that it only has to do the defining on the first call
static $errorMessages;
// define the varies error messages
if (!isset($errorMessages)) {
$errorMessages = array(
QUICKFORM_OK ... | [
"static",
"function",
"errorMessage",
"(",
"$",
"value",
")",
"{",
"// make the variable static so that it only has to do the defining on the first call",
"static",
"$",
"errorMessages",
";",
"// define the varies error messages",
"if",
"(",
"!",
"isset",
"(",
"$",
"errorMess... | Return a textual error message for an QuickForm error code
@access public
@param int error code
@return string error message | [
"Return",
"a",
"textual",
"error",
"message",
"for",
"an",
"QuickForm",
"error",
"code"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm.php#L1953-L1981 |
216,654 | moodle/moodle | question/type/calculated/questiontype.php | qtype_calculated.print_next_wizard_page | public function print_next_wizard_page($question, $form, $course) {
global $CFG, $SESSION, $COURSE;
// Catch invalid navigation & reloads.
if (empty($question->id) && empty($SESSION->calculated)) {
redirect('edit.php?courseid='.$COURSE->id, 'The page you are loading has expired.', 3... | php | public function print_next_wizard_page($question, $form, $course) {
global $CFG, $SESSION, $COURSE;
// Catch invalid navigation & reloads.
if (empty($question->id) && empty($SESSION->calculated)) {
redirect('edit.php?courseid='.$COURSE->id, 'The page you are loading has expired.', 3... | [
"public",
"function",
"print_next_wizard_page",
"(",
"$",
"question",
",",
"$",
"form",
",",
"$",
"course",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"SESSION",
",",
"$",
"COURSE",
";",
"// Catch invalid navigation & reloads.",
"if",
"(",
"empty",
"(",
"$",
... | This gets called by editquestion.php after the standard question is saved. | [
"This",
"gets",
"called",
"by",
"editquestion",
".",
"php",
"after",
"the",
"standard",
"question",
"is",
"saved",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/questiontype.php#L364-L385 |
216,655 | moodle/moodle | question/type/calculated/questiontype.php | qtype_calculated.& | public function &next_wizard_form($submiturl, $question, $wizardnow) {
global $CFG, $SESSION, $COURSE;
// Catch invalid navigation & reloads.
if (empty($question->id) && empty($SESSION->calculated)) {
redirect('edit.php?courseid=' . $COURSE->id,
'The page you are... | php | public function &next_wizard_form($submiturl, $question, $wizardnow) {
global $CFG, $SESSION, $COURSE;
// Catch invalid navigation & reloads.
if (empty($question->id) && empty($SESSION->calculated)) {
redirect('edit.php?courseid=' . $COURSE->id,
'The page you are... | [
"public",
"function",
"&",
"next_wizard_form",
"(",
"$",
"submiturl",
",",
"$",
"question",
",",
"$",
"wizardnow",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"SESSION",
",",
"$",
"COURSE",
";",
"// Catch invalid navigation & reloads.",
"if",
"(",
"empty",
"("... | This gets called by question2.php after the standard question is saved. | [
"This",
"gets",
"called",
"by",
"question2",
".",
"php",
"after",
"the",
"standard",
"question",
"is",
"saved",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/questiontype.php#L388-L419 |
216,656 | moodle/moodle | question/type/calculated/questiontype.php | qtype_calculated.validate_question_data | protected function validate_question_data($question) {
$this->validate_text($question->questiontext); // Yes, really no ['text'].
if (isset($question->generalfeedback['text'])) {
$this->validate_text($question->generalfeedback['text']);
} else if (isset($question->generalfeedback)) ... | php | protected function validate_question_data($question) {
$this->validate_text($question->questiontext); // Yes, really no ['text'].
if (isset($question->generalfeedback['text'])) {
$this->validate_text($question->generalfeedback['text']);
} else if (isset($question->generalfeedback)) ... | [
"protected",
"function",
"validate_question_data",
"(",
"$",
"question",
")",
"{",
"$",
"this",
"->",
"validate_text",
"(",
"$",
"question",
"->",
"questiontext",
")",
";",
"// Yes, really no ['text'].",
"if",
"(",
"isset",
"(",
"$",
"question",
"->",
"generalfe... | Validate data before save.
@param stdClass $question data from the form / import file. | [
"Validate",
"data",
"before",
"save",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/questiontype.php#L486-L499 |
216,657 | moodle/moodle | question/type/calculated/questiontype.php | qtype_calculated.get_database_dataset_items | public function get_database_dataset_items($definition) {
global $CFG, $DB;
$databasedataitems = $DB->get_records_sql(// Use number as key!!
" SELECT id , itemnumber, definition, value
FROM {question_dataset_items}
WHERE definition = $definition order by id DESC ", a... | php | public function get_database_dataset_items($definition) {
global $CFG, $DB;
$databasedataitems = $DB->get_records_sql(// Use number as key!!
" SELECT id , itemnumber, definition, value
FROM {question_dataset_items}
WHERE definition = $definition order by id DESC ", a... | [
"public",
"function",
"get_database_dataset_items",
"(",
"$",
"definition",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"databasedataitems",
"=",
"$",
"DB",
"->",
"get_records_sql",
"(",
"// Use number as key!!",
"\" SELECT id , itemnumber, definition, ... | This function get the dataset items using id as unique parameter and return an
array with itemnumber as index sorted ascendant
If the multiple records with the same itemnumber exist, only the newest one
i.e with the greatest id is used, the others are ignored but not deleted.
MDL-19210 | [
"This",
"function",
"get",
"the",
"dataset",
"items",
"using",
"id",
"as",
"unique",
"parameter",
"and",
"return",
"an",
"array",
"with",
"itemnumber",
"as",
"index",
"sorted",
"ascendant",
"If",
"the",
"multiple",
"records",
"with",
"the",
"same",
"itemnumber... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/questiontype.php#L860-L874 |
216,658 | moodle/moodle | question/type/calculated/questiontype.php | qtype_calculated.pick_question_dataset | public function pick_question_dataset($question, $datasetitem) {
// Select a dataset in the following format:
// an array indexed by the variable names (d.name) pointing to the value
// to be substituted.
global $CFG, $DB;
if (!$dataitems = $DB->get_records_sql(
"... | php | public function pick_question_dataset($question, $datasetitem) {
// Select a dataset in the following format:
// an array indexed by the variable names (d.name) pointing to the value
// to be substituted.
global $CFG, $DB;
if (!$dataitems = $DB->get_records_sql(
"... | [
"public",
"function",
"pick_question_dataset",
"(",
"$",
"question",
",",
"$",
"datasetitem",
")",
"{",
"// Select a dataset in the following format:",
"// an array indexed by the variable names (d.name) pointing to the value",
"// to be substituted.",
"global",
"$",
"CFG",
",",
... | Dataset functionality. | [
"Dataset",
"functionality",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/questiontype.php#L1460-L1487 |
216,659 | moodle/moodle | question/type/calculated/questiontype.php | qtype_calculated.find_dataset_names | public function find_dataset_names($text) {
preg_match_all(self::PLACEHODLER_REGEX, $text, $matches);
return array_combine($matches[1], $matches[1]);
} | php | public function find_dataset_names($text) {
preg_match_all(self::PLACEHODLER_REGEX, $text, $matches);
return array_combine($matches[1], $matches[1]);
} | [
"public",
"function",
"find_dataset_names",
"(",
"$",
"text",
")",
"{",
"preg_match_all",
"(",
"self",
"::",
"PLACEHODLER_REGEX",
",",
"$",
"text",
",",
"$",
"matches",
")",
";",
"return",
"array_combine",
"(",
"$",
"matches",
"[",
"1",
"]",
",",
"$",
"m... | Find the names of all datasets mentioned in a piece of question content like the question text.
@param $text the text to analyse.
@return array with dataset name for both key and value. | [
"Find",
"the",
"names",
"of",
"all",
"datasets",
"mentioned",
"in",
"a",
"piece",
"of",
"question",
"content",
"like",
"the",
"question",
"text",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/questiontype.php#L1552-L1555 |
216,660 | moodle/moodle | question/type/calculated/questiontype.php | qtype_calculated.find_formulas | public function find_formulas($text) {
preg_match_all(self::FORMULAS_IN_TEXT_REGEX, $text, $matches);
return array_combine($matches[1], $matches[1]);
} | php | public function find_formulas($text) {
preg_match_all(self::FORMULAS_IN_TEXT_REGEX, $text, $matches);
return array_combine($matches[1], $matches[1]);
} | [
"public",
"function",
"find_formulas",
"(",
"$",
"text",
")",
"{",
"preg_match_all",
"(",
"self",
"::",
"FORMULAS_IN_TEXT_REGEX",
",",
"$",
"text",
",",
"$",
"matches",
")",
";",
"return",
"array_combine",
"(",
"$",
"matches",
"[",
"1",
"]",
",",
"$",
"m... | Find all the formulas in a bit of text.
For example, called with "What is {a} plus {b}? (Hint, it is not {={a}*{b}}.)" this
returns ['{a}*{b}'].
@param $text text to analyse.
@return array where they keys an values are the formulas. | [
"Find",
"all",
"the",
"formulas",
"in",
"a",
"bit",
"of",
"text",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/questiontype.php#L1566-L1569 |
216,661 | moodle/moodle | question/type/calculated/questiontype.php | qtype_calculated.get_dataset_definitions_category | public function get_dataset_definitions_category($form) {
global $CFG, $DB;
$datasetdefs = array();
$lnamemax = 30;
if (!empty($form->category)) {
$sql = "SELECT i.*, d.*
FROM {question_datasets} d, {question_dataset_definitions} i
W... | php | public function get_dataset_definitions_category($form) {
global $CFG, $DB;
$datasetdefs = array();
$lnamemax = 30;
if (!empty($form->category)) {
$sql = "SELECT i.*, d.*
FROM {question_datasets} d, {question_dataset_definitions} i
W... | [
"public",
"function",
"get_dataset_definitions_category",
"(",
"$",
"form",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"datasetdefs",
"=",
"array",
"(",
")",
";",
"$",
"lnamemax",
"=",
"30",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"for... | This function retrieve the item count of the available category shareable
wild cards that is added as a comment displayed when a wild card with
the same name is displayed in datasetdefinitions_form.php | [
"This",
"function",
"retrieve",
"the",
"item",
"count",
"of",
"the",
"available",
"category",
"shareable",
"wild",
"cards",
"that",
"is",
"added",
"as",
"a",
"comment",
"displayed",
"when",
"a",
"wild",
"card",
"with",
"the",
"same",
"name",
"is",
"displayed... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/questiontype.php#L1576-L1593 |
216,662 | moodle/moodle | question/type/calculated/questiontype.php | qtype_calculated.get_short_question_name | public function get_short_question_name($stringtoshorten, $characterlimit)
{
if (!empty($stringtoshorten)) {
$returnstring = format_string($stringtoshorten);
if (strlen($returnstring) > $characterlimit) {
$returnstring = shorten_text($returnstring, $characterlimit, tr... | php | public function get_short_question_name($stringtoshorten, $characterlimit)
{
if (!empty($stringtoshorten)) {
$returnstring = format_string($stringtoshorten);
if (strlen($returnstring) > $characterlimit) {
$returnstring = shorten_text($returnstring, $characterlimit, tr... | [
"public",
"function",
"get_short_question_name",
"(",
"$",
"stringtoshorten",
",",
"$",
"characterlimit",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"stringtoshorten",
")",
")",
"{",
"$",
"returnstring",
"=",
"format_string",
"(",
"$",
"stringtoshorten",
")"... | This function shortens a question name if it exceeds the character limit.
@param string $stringtoshorten the string to be shortened.
@param int $characterlimit the character limit.
@return string | [
"This",
"function",
"shortens",
"a",
"question",
"name",
"if",
"it",
"exceeds",
"the",
"character",
"limit",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/questiontype.php#L1676-L1687 |
216,663 | moodle/moodle | mod/forum/classes/local/vaults/preprocessors/extract_context.php | extract_context.execute | public function execute(array $records) : array {
return array_map(function($record) {
$contextid = $record->ctxid;
context_helper::preload_from_record($record);
$context = context::instance_by_id($contextid);
return $context;
}, $records);
} | php | public function execute(array $records) : array {
return array_map(function($record) {
$contextid = $record->ctxid;
context_helper::preload_from_record($record);
$context = context::instance_by_id($contextid);
return $context;
}, $records);
} | [
"public",
"function",
"execute",
"(",
"array",
"$",
"records",
")",
":",
"array",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"record",
")",
"{",
"$",
"contextid",
"=",
"$",
"record",
"->",
"ctxid",
";",
"context_helper",
"::",
"preload_from_rec... | Extract the contexts from a list of records.
@param stdClass[] $records The list of records which have context properties
@return context[] List of contexts matching the records. | [
"Extract",
"the",
"contexts",
"from",
"a",
"list",
"of",
"records",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/vaults/preprocessors/extract_context.php#L45-L52 |
216,664 | moodle/moodle | report/loglive/classes/table_log.php | report_loglive_table_log.col_course | public function col_course($event) {
if (empty($event->courseid) || empty($this->courseshortnames[$event->courseid])) {
return '-';
} else {
return $this->courseshortnames[$event->courseid];
}
} | php | public function col_course($event) {
if (empty($event->courseid) || empty($this->courseshortnames[$event->courseid])) {
return '-';
} else {
return $this->courseshortnames[$event->courseid];
}
} | [
"public",
"function",
"col_course",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"event",
"->",
"courseid",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"courseshortnames",
"[",
"$",
"event",
"->",
"courseid",
"]",
")",
")",
"{",
"return... | Generate the course column.
@param stdClass $event event data.
@return string HTML for the course column. | [
"Generate",
"the",
"course",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/loglive/classes/table_log.php#L104-L110 |
216,665 | moodle/moodle | report/loglive/classes/table_log.php | report_loglive_table_log.col_eventname | public function col_eventname($event) {
// Event name.
if ($this->filterparams->logreader instanceof logstore_legacy\log\store) {
// Hack for support of logstore_legacy.
$eventname = $event->eventname;
} else {
$eventname = $event->get_name();
}
... | php | public function col_eventname($event) {
// Event name.
if ($this->filterparams->logreader instanceof logstore_legacy\log\store) {
// Hack for support of logstore_legacy.
$eventname = $event->eventname;
} else {
$eventname = $event->get_name();
}
... | [
"public",
"function",
"col_eventname",
"(",
"$",
"event",
")",
"{",
"// Event name.",
"if",
"(",
"$",
"this",
"->",
"filterparams",
"->",
"logreader",
"instanceof",
"logstore_legacy",
"\\",
"log",
"\\",
"store",
")",
"{",
"// Hack for support of logstore_legacy.",
... | Generate the event name column.
@param stdClass $event event data.
@return string HTML for the event name column | [
"Generate",
"the",
"event",
"name",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/loglive/classes/table_log.php#L232-L244 |
216,666 | moodle/moodle | admin/tool/httpsreplace/classes/url_finder.php | url_finder.domain_swap | protected function domain_swap($table, $column, $domain, $search) {
global $DB;
$renames = json_decode(get_config('tool_httpsreplace', 'renames'), true);
if (isset($renames[$domain])) {
$replace = preg_replace('|http://'.preg_quote($domain).'|i', 'https://' . $renames[$domain], $se... | php | protected function domain_swap($table, $column, $domain, $search) {
global $DB;
$renames = json_decode(get_config('tool_httpsreplace', 'renames'), true);
if (isset($renames[$domain])) {
$replace = preg_replace('|http://'.preg_quote($domain).'|i', 'https://' . $renames[$domain], $se... | [
"protected",
"function",
"domain_swap",
"(",
"$",
"table",
",",
"$",
"column",
",",
"$",
"domain",
",",
"$",
"search",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"renames",
"=",
"json_decode",
"(",
"get_config",
"(",
"'tool_httpsreplace'",
",",
"'renames'",
... | Replace http domains with https equivalent, with two types of exceptions
for less straightforward swaps.
@param string $table
@param database_column_info $column
@param string $domain
@param string $search search string that has prefix, protocol, domain name and one extra character,
example1: src="http://host.com/
exa... | [
"Replace",
"http",
"domains",
"with",
"https",
"equivalent",
"with",
"two",
"types",
"of",
"exceptions",
"for",
"less",
"straightforward",
"swaps",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/httpsreplace/classes/url_finder.php#L74-L87 |
216,667 | moodle/moodle | admin/tool/httpsreplace/classes/url_finder.php | url_finder.get_select_search_in_column | protected function get_select_search_in_column($columnname) {
global $DB;
if ($DB->sql_regex_supported()) {
// Database supports regex, use it for better match.
$select = $columnname . ' ' . $DB->sql_regex() . ' ?';
$params = ["(src|data)\ *=\ *[\\\"\']http://"];
... | php | protected function get_select_search_in_column($columnname) {
global $DB;
if ($DB->sql_regex_supported()) {
// Database supports regex, use it for better match.
$select = $columnname . ' ' . $DB->sql_regex() . ' ?';
$params = ["(src|data)\ *=\ *[\\\"\']http://"];
... | [
"protected",
"function",
"get_select_search_in_column",
"(",
"$",
"columnname",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"DB",
"->",
"sql_regex_supported",
"(",
")",
")",
"{",
"// Database supports regex, use it for better match.",
"$",
"select",
"=",
"... | Returns SQL to be used to match embedded http links in the given column
@param string $columnname name of the column (ready to be used in the SQL query)
@return array | [
"Returns",
"SQL",
"to",
"be",
"used",
"to",
"match",
"embedded",
"http",
"links",
"in",
"the",
"given",
"column"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/httpsreplace/classes/url_finder.php#L95-L110 |
216,668 | moodle/moodle | question/type/rendererbase.php | qtype_renderer.clear_wrong | public function clear_wrong(question_attempt $qa) {
$response = $qa->get_last_qt_data();
if (!$response) {
return '';
}
$cleanresponse = $qa->get_question()->clear_wrong_from_response($response);
$output = '';
foreach ($cleanresponse as $name => $value) {
... | php | public function clear_wrong(question_attempt $qa) {
$response = $qa->get_last_qt_data();
if (!$response) {
return '';
}
$cleanresponse = $qa->get_question()->clear_wrong_from_response($response);
$output = '';
foreach ($cleanresponse as $name => $value) {
... | [
"public",
"function",
"clear_wrong",
"(",
"question_attempt",
"$",
"qa",
")",
"{",
"$",
"response",
"=",
"$",
"qa",
"->",
"get_last_qt_data",
"(",
")",
";",
"if",
"(",
"!",
"$",
"response",
")",
"{",
"return",
"''",
";",
"}",
"$",
"cleanresponse",
"=",... | Output hidden form fields to clear any wrong parts of the student's response.
This method will only be called if the question is in read-only mode.
@param question_attempt $qa the question attempt to display.
@return string HTML fragment. | [
"Output",
"hidden",
"form",
"fields",
"to",
"clear",
"any",
"wrong",
"parts",
"of",
"the",
"student",
"s",
"response",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/rendererbase.php#L69-L85 |
216,669 | moodle/moodle | question/type/rendererbase.php | qtype_renderer.feedback | public function feedback(question_attempt $qa, question_display_options $options) {
$output = '';
$hint = null;
if ($options->feedback) {
$output .= html_writer::nonempty_tag('div', $this->specific_feedback($qa),
array('class' => 'specificfeedback'));
... | php | public function feedback(question_attempt $qa, question_display_options $options) {
$output = '';
$hint = null;
if ($options->feedback) {
$output .= html_writer::nonempty_tag('div', $this->specific_feedback($qa),
array('class' => 'specificfeedback'));
... | [
"public",
"function",
"feedback",
"(",
"question_attempt",
"$",
"qa",
",",
"question_display_options",
"$",
"options",
")",
"{",
"$",
"output",
"=",
"''",
";",
"$",
"hint",
"=",
"null",
";",
"if",
"(",
"$",
"options",
"->",
"feedback",
")",
"{",
"$",
"... | Generate the display of the outcome part of the question. This is the
area that contains the various forms of feedback. This function generates
the content of this area belonging to the question type.
Subclasses will normally want to override the more specific methods
{specific_feedback()}, {general_feedback()} and {c... | [
"Generate",
"the",
"display",
"of",
"the",
"outcome",
"part",
"of",
"the",
"question",
".",
"This",
"is",
"the",
"area",
"that",
"contains",
"the",
"various",
"forms",
"of",
"feedback",
".",
"This",
"function",
"generates",
"the",
"content",
"of",
"this",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/rendererbase.php#L100-L130 |
216,670 | moodle/moodle | question/type/rendererbase.php | qtype_renderer.num_parts_correct | protected function num_parts_correct(question_attempt $qa) {
$a = new stdClass();
list($a->num, $a->outof) = $qa->get_question()->get_num_parts_right(
$qa->get_last_qt_data());
if (is_null($a->outof)) {
return '';
} else {
return get_string('yougot... | php | protected function num_parts_correct(question_attempt $qa) {
$a = new stdClass();
list($a->num, $a->outof) = $qa->get_question()->get_num_parts_right(
$qa->get_last_qt_data());
if (is_null($a->outof)) {
return '';
} else {
return get_string('yougot... | [
"protected",
"function",
"num_parts_correct",
"(",
"question_attempt",
"$",
"qa",
")",
"{",
"$",
"a",
"=",
"new",
"stdClass",
"(",
")",
";",
"list",
"(",
"$",
"a",
"->",
"num",
",",
"$",
"a",
"->",
"outof",
")",
"=",
"$",
"qa",
"->",
"get_question",
... | Gereate a brief statement of how many sub-parts of this question the
student got right.
@param question_attempt $qa the question attempt to display.
@return string HTML fragment. | [
"Gereate",
"a",
"brief",
"statement",
"of",
"how",
"many",
"sub",
"-",
"parts",
"of",
"this",
"question",
"the",
"student",
"got",
"right",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/rendererbase.php#L148-L157 |
216,671 | moodle/moodle | question/type/rendererbase.php | qtype_renderer.hint | protected function hint(question_attempt $qa, question_hint $hint) {
return html_writer::nonempty_tag('div',
$qa->get_question()->format_hint($hint, $qa), array('class' => 'hint'));
} | php | protected function hint(question_attempt $qa, question_hint $hint) {
return html_writer::nonempty_tag('div',
$qa->get_question()->format_hint($hint, $qa), array('class' => 'hint'));
} | [
"protected",
"function",
"hint",
"(",
"question_attempt",
"$",
"qa",
",",
"question_hint",
"$",
"hint",
")",
"{",
"return",
"html_writer",
"::",
"nonempty_tag",
"(",
"'div'",
",",
"$",
"qa",
"->",
"get_question",
"(",
")",
"->",
"format_hint",
"(",
"$",
"h... | Gereate the specific feedback. This is feedback that varies according to
the response the student gave.
@param question_attempt $qa the question attempt to display.
@return string HTML fragment. | [
"Gereate",
"the",
"specific",
"feedback",
".",
"This",
"is",
"feedback",
"that",
"varies",
"according",
"to",
"the",
"response",
"the",
"student",
"gave",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/rendererbase.php#L165-L168 |
216,672 | moodle/moodle | lib/phpexcel/PHPExcel/Shared/JAMA/QRDecomposition.php | PHPExcel_Shared_JAMA_QRDecomposition.isFullRank | public function isFullRank()
{
for ($j = 0; $j < $this->n; ++$j) {
if ($this->Rdiag[$j] == 0) {
return false;
}
}
return true;
} | php | public function isFullRank()
{
for ($j = 0; $j < $this->n; ++$j) {
if ($this->Rdiag[$j] == 0) {
return false;
}
}
return true;
} | [
"public",
"function",
"isFullRank",
"(",
")",
"{",
"for",
"(",
"$",
"j",
"=",
"0",
";",
"$",
"j",
"<",
"$",
"this",
"->",
"n",
";",
"++",
"$",
"j",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Rdiag",
"[",
"$",
"j",
"]",
"==",
"0",
")",
"{",
... | Is the matrix full rank?
@return boolean true if R, and hence A, has full rank, else false. | [
"Is",
"the",
"matrix",
"full",
"rank?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/JAMA/QRDecomposition.php#L102-L110 |
216,673 | moodle/moodle | lib/phpexcel/PHPExcel/Shared/JAMA/QRDecomposition.php | PHPExcel_Shared_JAMA_QRDecomposition.getH | public function getH()
{
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
if ($i >= $j) {
$H[$i][$j] = $this->QR[$i][$j];
} else {
$H[$i][$j] = 0.0;
}
}
}
re... | php | public function getH()
{
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
if ($i >= $j) {
$H[$i][$j] = $this->QR[$i][$j];
} else {
$H[$i][$j] = 0.0;
}
}
}
re... | [
"public",
"function",
"getH",
"(",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"m",
";",
"++",
"$",
"i",
")",
"{",
"for",
"(",
"$",
"j",
"=",
"0",
";",
"$",
"j",
"<",
"$",
"this",
"->",
"n",
";",
"... | Return the Householder vectors
@return Matrix Lower trapezoidal matrix whose columns define the reflections | [
"Return",
"the",
"Householder",
"vectors"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/JAMA/QRDecomposition.php#L117-L129 |
216,674 | moodle/moodle | lib/phpexcel/PHPExcel/Shared/JAMA/QRDecomposition.php | PHPExcel_Shared_JAMA_QRDecomposition.getR | public function getR()
{
for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
if ($i < $j) {
$R[$i][$j] = $this->QR[$i][$j];
} elseif ($i == $j) {
$R[$i][$j] = $this->Rdiag[$i];
} else {
... | php | public function getR()
{
for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
if ($i < $j) {
$R[$i][$j] = $this->QR[$i][$j];
} elseif ($i == $j) {
$R[$i][$j] = $this->Rdiag[$i];
} else {
... | [
"public",
"function",
"getR",
"(",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"n",
";",
"++",
"$",
"i",
")",
"{",
"for",
"(",
"$",
"j",
"=",
"0",
";",
"$",
"j",
"<",
"$",
"this",
"->",
"n",
";",
"... | Return the upper triangular factor
@return Matrix upper triangular factor | [
"Return",
"the",
"upper",
"triangular",
"factor"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/JAMA/QRDecomposition.php#L136-L150 |
216,675 | moodle/moodle | completion/completion_criteria_completion.php | completion_criteria_completion.mark_complete | public function mark_complete() {
// Create record
$this->timecompleted = time();
// Save record
if ($this->id) {
$this->update();
} else {
$this->insert();
}
// Mark course completion record as started (if not already)
$cc = arra... | php | public function mark_complete() {
// Create record
$this->timecompleted = time();
// Save record
if ($this->id) {
$this->update();
} else {
$this->insert();
}
// Mark course completion record as started (if not already)
$cc = arra... | [
"public",
"function",
"mark_complete",
"(",
")",
"{",
"// Create record",
"$",
"this",
"->",
"timecompleted",
"=",
"time",
"(",
")",
";",
"// Save record",
"if",
"(",
"$",
"this",
"->",
"id",
")",
"{",
"$",
"this",
"->",
"update",
"(",
")",
";",
"}",
... | Mark this criteria complete for the associated user
This method creates a course_completion_crit_compl record | [
"Mark",
"this",
"criteria",
"complete",
"for",
"the",
"associated",
"user"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/completion_criteria_completion.php#L106-L124 |
216,676 | moodle/moodle | completion/completion_criteria_completion.php | completion_criteria_completion.get_criteria | public function get_criteria() {
if (!$this->_criteria) {
global $DB;
$params = array(
'id' => $this->criteriaid
);
$record = $DB->get_record('course_completion_criteria', $params);
$this->attach_criteria(completion_criteria::fac... | php | public function get_criteria() {
if (!$this->_criteria) {
global $DB;
$params = array(
'id' => $this->criteriaid
);
$record = $DB->get_record('course_completion_criteria', $params);
$this->attach_criteria(completion_criteria::fac... | [
"public",
"function",
"get_criteria",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_criteria",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
"=",
"array",
"(",
"'id'",
"=>",
"$",
"this",
"->",
"criteriaid",
")",
";",
"$",
"record",
"=",
... | Return the associated criteria with this completion
If nothing attached, load from the db
@return completion_criteria | [
"Return",
"the",
"associated",
"criteria",
"with",
"this",
"completion",
"If",
"nothing",
"attached",
"load",
"from",
"the",
"db"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/completion_criteria_completion.php#L141-L156 |
216,677 | moodle/moodle | lib/classes/output/external.php | external.load_template | public static function load_template($component, $template, $themename, $includecomments = false) {
global $DB, $CFG, $PAGE;
$params = self::validate_parameters(self::load_template_parameters(),
array('component' => $component,
... | php | public static function load_template($component, $template, $themename, $includecomments = false) {
global $DB, $CFG, $PAGE;
$params = self::validate_parameters(self::load_template_parameters(),
array('component' => $component,
... | [
"public",
"static",
"function",
"load_template",
"(",
"$",
"component",
",",
"$",
"template",
",",
"$",
"themename",
",",
"$",
"includecomments",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"$",
"params",
"=",
... | Return a mustache template, and all the strings it requires.
@param string $component The component that holds the template.
@param string $templatename The name of the template.
@param string $themename The name of the current theme.
@return string the template | [
"Return",
"a",
"mustache",
"template",
"and",
"all",
"the",
"strings",
"it",
"requires",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/output/external.php#L69-L86 |
216,678 | moodle/moodle | lib/classes/output/external.php | external.load_template_with_dependencies | public static function load_template_with_dependencies(
string $component,
string $template,
string $themename,
bool $includecomments = false,
string $lang = null
) {
global $DB, $CFG, $PAGE;
$params = self::validate_parameters(
self::load_templat... | php | public static function load_template_with_dependencies(
string $component,
string $template,
string $themename,
bool $includecomments = false,
string $lang = null
) {
global $DB, $CFG, $PAGE;
$params = self::validate_parameters(
self::load_templat... | [
"public",
"static",
"function",
"load_template_with_dependencies",
"(",
"string",
"$",
"component",
",",
"string",
"$",
"template",
",",
"string",
"$",
"themename",
",",
"bool",
"$",
"includecomments",
"=",
"false",
",",
"string",
"$",
"lang",
"=",
"null",
")"... | Return a mustache template, and all the child templates and strings it requires.
@param string $component The component that holds the template.
@param string $template The name of the template.
@param string $themename The name of the current theme.
@param bool $includecomments Whether to strip comments from the temp... | [
"Return",
"a",
"mustache",
"template",
"and",
"all",
"the",
"child",
"templates",
"and",
"strings",
"it",
"requires",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/output/external.php#L122-L173 |
216,679 | moodle/moodle | lib/classes/output/external.php | external.load_fontawesome_icon_map | public static function load_fontawesome_icon_map() {
$instance = icon_system::instance(icon_system::FONTAWESOME);
$map = $instance->get_icon_name_map();
$result = [];
foreach ($map as $from => $to) {
list($component, $pix) = explode(':', $from);
$one = [];
... | php | public static function load_fontawesome_icon_map() {
$instance = icon_system::instance(icon_system::FONTAWESOME);
$map = $instance->get_icon_name_map();
$result = [];
foreach ($map as $from => $to) {
list($component, $pix) = explode(':', $from);
$one = [];
... | [
"public",
"static",
"function",
"load_fontawesome_icon_map",
"(",
")",
"{",
"$",
"instance",
"=",
"icon_system",
"::",
"instance",
"(",
"icon_system",
"::",
"FONTAWESOME",
")",
";",
"$",
"map",
"=",
"$",
"instance",
"->",
"get_icon_name_map",
"(",
")",
";",
... | Return a mapping of icon names to icons.
@return array the mapping | [
"Return",
"a",
"mapping",
"of",
"icon",
"names",
"to",
"icons",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/output/external.php#L207-L223 |
216,680 | moodle/moodle | lib/adodb/drivers/adodb-sybase_ase.inc.php | ADODB_sybase_ase.MetaTables | function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
$false = false;
if ($this->metaTablesSQL) {
// complicated state saving by the need for backward compat
if ($ttype == 'VIEWS'){
$sql = str_replace('U', 'V', $this->metaTablesSQL);
}elseif (false === $ttype){
$sql = str_replace(... | php | function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
$false = false;
if ($this->metaTablesSQL) {
// complicated state saving by the need for backward compat
if ($ttype == 'VIEWS'){
$sql = str_replace('U', 'V', $this->metaTablesSQL);
}elseif (false === $ttype){
$sql = str_replace(... | [
"function",
"MetaTables",
"(",
"$",
"ttype",
"=",
"false",
",",
"$",
"showSchema",
"=",
"false",
",",
"$",
"mask",
"=",
"false",
")",
"{",
"$",
"false",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"metaTablesSQL",
")",
"{",
"// complicated state s... | split the Views, Tables and procedures. | [
"split",
"the",
"Views",
"Tables",
"and",
"procedures",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-sybase_ase.inc.php#L30-L57 |
216,681 | moodle/moodle | lib/adodb/drivers/adodb-sybase_ase.inc.php | ADODB_sybase_ase.MetaColumns | function MetaColumns($table,$upper=false)
{
$false = false;
if (!empty($this->metaColumnsSQL)) {
$rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
if ($rs === false) return $false;
$retarr = array();
while (!$rs->EOF) {
$fld = new ADOFieldObject();
$fld->name = $rs->Fields('field_n... | php | function MetaColumns($table,$upper=false)
{
$false = false;
if (!empty($this->metaColumnsSQL)) {
$rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
if ($rs === false) return $false;
$retarr = array();
while (!$rs->EOF) {
$fld = new ADOFieldObject();
$fld->name = $rs->Fields('field_n... | [
"function",
"MetaColumns",
"(",
"$",
"table",
",",
"$",
"upper",
"=",
"false",
")",
"{",
"$",
"false",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"metaColumnsSQL",
")",
")",
"{",
"$",
"rs",
"=",
"$",
"this",
"->",
"Execut... | fix a bug which prevent the metaColumns query to be executed for Sybase ASE | [
"fix",
"a",
"bug",
"which",
"prevent",
"the",
"metaColumns",
"query",
"to",
"be",
"executed",
"for",
"Sybase",
"ASE"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-sybase_ase.inc.php#L76-L97 |
216,682 | moodle/moodle | backup/controller/restore_controller.class.php | restore_controller.execute_precheck | public function execute_precheck($droptemptablesafter = false) {
if (is_array($this->precheck)) {
throw new restore_controller_exception('precheck_alredy_executed', $this->status);
}
if ($this->status != backup::STATUS_NEED_PRECHECK) {
throw new restore_controller_excepti... | php | public function execute_precheck($droptemptablesafter = false) {
if (is_array($this->precheck)) {
throw new restore_controller_exception('precheck_alredy_executed', $this->status);
}
if ($this->status != backup::STATUS_NEED_PRECHECK) {
throw new restore_controller_excepti... | [
"public",
"function",
"execute_precheck",
"(",
"$",
"droptemptablesafter",
"=",
"false",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"precheck",
")",
")",
"{",
"throw",
"new",
"restore_controller_exception",
"(",
"'precheck_alredy_executed'",
",",
"... | Execute the restore prechecks to detect any problem before proceed with restore
This function checks various parts of the restore (versions, users, roles...)
returning true if everything was ok or false if any warning/error was detected.
Any warning/error is returned by the get_precheck_results() method.
Note: if any ... | [
"Execute",
"the",
"restore",
"prechecks",
"to",
"detect",
"any",
"problem",
"before",
"proceed",
"with",
"restore"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/controller/restore_controller.class.php#L387-L405 |
216,683 | moodle/moodle | backup/controller/restore_controller.class.php | restore_controller.save_controller | public function save_controller($includeobj = true, $cleanobj = false) {
// Going to save controller to persistent storage, calculate checksum for later checks and save it
// TODO: flag the controller as NA. Any operation on it should be forbidden util loaded back
$this->log('saving controller t... | php | public function save_controller($includeobj = true, $cleanobj = false) {
// Going to save controller to persistent storage, calculate checksum for later checks and save it
// TODO: flag the controller as NA. Any operation on it should be forbidden util loaded back
$this->log('saving controller t... | [
"public",
"function",
"save_controller",
"(",
"$",
"includeobj",
"=",
"true",
",",
"$",
"cleanobj",
"=",
"false",
")",
"{",
"// Going to save controller to persistent storage, calculate checksum for later checks and save it",
"// TODO: flag the controller as NA. Any operation on it s... | Save controller information
@param bool $includeobj to decide if the object itself must be updated (true) or no (false)
@param bool $cleanobj to decide if the object itself must be cleaned (true) or no (false) | [
"Save",
"controller",
"information"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/controller/restore_controller.class.php#L432-L440 |
216,684 | moodle/moodle | backup/controller/restore_controller.class.php | restore_controller.apply_defaults | protected function apply_defaults() {
$this->log('applying restore defaults', backup::LOG_DEBUG);
restore_controller_dbops::apply_config_defaults($this);
$this->set_status(backup::STATUS_CONFIGURED);
} | php | protected function apply_defaults() {
$this->log('applying restore defaults', backup::LOG_DEBUG);
restore_controller_dbops::apply_config_defaults($this);
$this->set_status(backup::STATUS_CONFIGURED);
} | [
"protected",
"function",
"apply_defaults",
"(",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'applying restore defaults'",
",",
"backup",
"::",
"LOG_DEBUG",
")",
";",
"restore_controller_dbops",
"::",
"apply_config_defaults",
"(",
"$",
"this",
")",
";",
"$",
"this"... | Apply defaults from the global admin settings | [
"Apply",
"defaults",
"from",
"the",
"global",
"admin",
"settings"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/controller/restore_controller.class.php#L535-L539 |
216,685 | moodle/moodle | grade/report/singleview/classes/local/ui/range.php | range.determine_format | public function determine_format() {
$decimals = $this->item->get_decimals();
$min = format_float($this->item->grademin, $decimals);
$max = format_float($this->item->grademax, $decimals);
return new empty_element("$min - $max");
} | php | public function determine_format() {
$decimals = $this->item->get_decimals();
$min = format_float($this->item->grademin, $decimals);
$max = format_float($this->item->grademax, $decimals);
return new empty_element("$min - $max");
} | [
"public",
"function",
"determine_format",
"(",
")",
"{",
"$",
"decimals",
"=",
"$",
"this",
"->",
"item",
"->",
"get_decimals",
"(",
")",
";",
"$",
"min",
"=",
"format_float",
"(",
"$",
"this",
"->",
"item",
"->",
"grademin",
",",
"$",
"decimals",
")",... | Build this UI element.
@return element | [
"Build",
"this",
"UI",
"element",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/ui/range.php#L51-L58 |
216,686 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Interaction/Server.php | Horde_Imap_Client_Interaction_Server.create | public static function create(Horde_Imap_Client_Tokenize $t)
{
$t->rewind();
$tag = $t->next();
$t->next();
switch ($tag) {
case '+':
return new Horde_Imap_Client_Interaction_Server_Continuation($t);
case '*':
return new Horde_Imap_Client_Int... | php | public static function create(Horde_Imap_Client_Tokenize $t)
{
$t->rewind();
$tag = $t->next();
$t->next();
switch ($tag) {
case '+':
return new Horde_Imap_Client_Interaction_Server_Continuation($t);
case '*':
return new Horde_Imap_Client_Int... | [
"public",
"static",
"function",
"create",
"(",
"Horde_Imap_Client_Tokenize",
"$",
"t",
")",
"{",
"$",
"t",
"->",
"rewind",
"(",
")",
";",
"$",
"tag",
"=",
"$",
"t",
"->",
"next",
"(",
")",
";",
"$",
"t",
"->",
"next",
"(",
")",
";",
"switch",
"("... | Auto-scan an incoming line to determine the response type.
@param Horde_Imap_Client_Tokenize $t Tokenized data returned from the
server.
@return Horde_Imap_Client_Interaction_Server A server response object. | [
"Auto",
"-",
"scan",
"an",
"incoming",
"line",
"to",
"determine",
"the",
"response",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Interaction/Server.php#L73-L89 |
216,687 | moodle/moodle | lib/adodb/drivers/adodb-mssql.inc.php | ADODB_mssql.MetaPrimaryKeys | function MetaPrimaryKeys($table, $owner=false)
{
global $ADODB_FETCH_MODE;
$schema = '';
$this->_findschema($table,$schema);
if (!$schema) $schema = $this->database;
if ($schema) $schema = "and k.table_catalog like '$schema%'";
$sql = "select distinct k.column_name,ordinal_position from information_schema... | php | function MetaPrimaryKeys($table, $owner=false)
{
global $ADODB_FETCH_MODE;
$schema = '';
$this->_findschema($table,$schema);
if (!$schema) $schema = $this->database;
if ($schema) $schema = "and k.table_catalog like '$schema%'";
$sql = "select distinct k.column_name,ordinal_position from information_schema... | [
"function",
"MetaPrimaryKeys",
"(",
"$",
"table",
",",
"$",
"owner",
"=",
"false",
")",
"{",
"global",
"$",
"ADODB_FETCH_MODE",
";",
"$",
"schema",
"=",
"''",
";",
"$",
"this",
"->",
"_findschema",
"(",
"$",
"table",
",",
"$",
"schema",
")",
";",
"if... | tested with MSSQL 2000 | [
"tested",
"with",
"MSSQL",
"2000"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-mssql.inc.php#L540-L562 |
216,688 | moodle/moodle | lib/adodb/drivers/adodb-mssql.inc.php | ADODB_mssql._connect | function _connect($argHostname, $argUsername, $argPassword, $argDatabasename,$newconnect=false)
{
if (!function_exists('mssql_pconnect')) return null;
$this->_connectionID = mssql_connect($argHostname,$argUsername,$argPassword,$newconnect);
if ($this->_connectionID === false) return false;
if ($argDatabasename... | php | function _connect($argHostname, $argUsername, $argPassword, $argDatabasename,$newconnect=false)
{
if (!function_exists('mssql_pconnect')) return null;
$this->_connectionID = mssql_connect($argHostname,$argUsername,$argPassword,$newconnect);
if ($this->_connectionID === false) return false;
if ($argDatabasename... | [
"function",
"_connect",
"(",
"$",
"argHostname",
",",
"$",
"argUsername",
",",
"$",
"argPassword",
",",
"$",
"argDatabasename",
",",
"$",
"newconnect",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'mssql_pconnect'",
")",
")",
"return",
... | returns true or false, newconnect supported since php 5.1.0. | [
"returns",
"true",
"or",
"false",
"newconnect",
"supported",
"since",
"php",
"5",
".",
"1",
".",
"0",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-mssql.inc.php#L613-L620 |
216,689 | moodle/moodle | lib/classes/output/chooser.php | chooser.add_param | public function add_param($name, $value, $id = null) {
if (!$id) {
$id = $name;
}
$this->params[] = [
'name' => $name,
'value' => $value,
'id' => $id
];
} | php | public function add_param($name, $value, $id = null) {
if (!$id) {
$id = $name;
}
$this->params[] = [
'name' => $name,
'value' => $value,
'id' => $id
];
} | [
"public",
"function",
"add_param",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"$",
"name",
";",
"}",
"$",
"this",
"->",
"params",
"[",
"]",
"=",
"[",
"'na... | Add a parameter to submit with the form.
@param string $name The parameter name.
@param string $value The parameter value.
@param string $id The parameter ID. | [
"Add",
"a",
"parameter",
"to",
"submit",
"with",
"the",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/output/chooser.php#L81-L90 |
216,690 | moodle/moodle | admin/roles/classes/view_role_definition_table.php | core_role_view_role_definition_table.get_role_risks_info | protected function get_role_risks_info() {
global $OUTPUT;
if (empty($this->roleid)) {
return '';
}
$risks = array();
$allrisks = get_all_risks();
foreach ($this->capabilities as $capability) {
$perm = $this->permissions[$capability->name];
... | php | protected function get_role_risks_info() {
global $OUTPUT;
if (empty($this->roleid)) {
return '';
}
$risks = array();
$allrisks = get_all_risks();
foreach ($this->capabilities as $capability) {
$perm = $this->permissions[$capability->name];
... | [
"protected",
"function",
"get_role_risks_info",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"roleid",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"risks",
"=",
"array",
"(",
")",
";",
"$",
"allrisks",
... | Returns HTML risk icons.
@return string | [
"Returns",
"HTML",
"risk",
"icons",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/roles/classes/view_role_definition_table.php#L77-L105 |
216,691 | moodle/moodle | admin/roles/classes/view_role_definition_table.php | core_role_view_role_definition_table.skip_row | protected function skip_row($capability) {
$perm = $this->permissions[$capability->name];
if ($perm == CAP_INHERIT) {
// Do not print empty rows in role overview, admins need to know quickly what is allowed and prohibited,
// if they want to see the list of all capabilities they ... | php | protected function skip_row($capability) {
$perm = $this->permissions[$capability->name];
if ($perm == CAP_INHERIT) {
// Do not print empty rows in role overview, admins need to know quickly what is allowed and prohibited,
// if they want to see the list of all capabilities they ... | [
"protected",
"function",
"skip_row",
"(",
"$",
"capability",
")",
"{",
"$",
"perm",
"=",
"$",
"this",
"->",
"permissions",
"[",
"$",
"capability",
"->",
"name",
"]",
";",
"if",
"(",
"$",
"perm",
"==",
"CAP_INHERIT",
")",
"{",
"// Do not print empty rows in... | Returns true if the row should be skipped.
@param string $capability
@return bool | [
"Returns",
"true",
"if",
"the",
"row",
"should",
"be",
"skipped",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/roles/classes/view_role_definition_table.php#L113-L121 |
216,692 | moodle/moodle | backup/util/ui/base_moodleform.class.php | base_moodleform.definition | public function definition() {
$ui = $this->uistage->get_ui();
$mform = $this->_form;
$mform->setDisableShortforms();
$stage = $mform->addElement('hidden', 'stage', $this->uistage->get_stage());
$mform->setType('stage', PARAM_INT);
$stage = $mform->addElement('hidden', $u... | php | public function definition() {
$ui = $this->uistage->get_ui();
$mform = $this->_form;
$mform->setDisableShortforms();
$stage = $mform->addElement('hidden', 'stage', $this->uistage->get_stage());
$mform->setType('stage', PARAM_INT);
$stage = $mform->addElement('hidden', $u... | [
"public",
"function",
"definition",
"(",
")",
"{",
"$",
"ui",
"=",
"$",
"this",
"->",
"uistage",
"->",
"get_ui",
"(",
")",
";",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"$",
"mform",
"->",
"setDisableShortforms",
"(",
")",
";",
"$",
"sta... | The standard form definition... obviously not much here | [
"The",
"standard",
"form",
"definition",
"...",
"obviously",
"not",
"much",
"here"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/base_moodleform.class.php#L96-L122 |
216,693 | moodle/moodle | backup/util/ui/base_moodleform.class.php | base_moodleform.definition_after_data | public function definition_after_data() {
$buttonarray = array();
if (!$this->uistage->is_first_stage()) {
$buttonarray[] = $this->_form->createElement('submit', 'previous', get_string('previousstage', 'backup'));
} else if ($this->uistage instanceof backup_ui_stage) {
//... | php | public function definition_after_data() {
$buttonarray = array();
if (!$this->uistage->is_first_stage()) {
$buttonarray[] = $this->_form->createElement('submit', 'previous', get_string('previousstage', 'backup'));
} else if ($this->uistage instanceof backup_ui_stage) {
//... | [
"public",
"function",
"definition_after_data",
"(",
")",
"{",
"$",
"buttonarray",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"uistage",
"->",
"is_first_stage",
"(",
")",
")",
"{",
"$",
"buttonarray",
"[",
"]",
"=",
"$",
"this",
"... | Definition applied after the data is organised.. why's it here? because I want
to add elements on the fly.
@global moodle_page $PAGE | [
"Definition",
"applied",
"after",
"the",
"data",
"is",
"organised",
"..",
"why",
"s",
"it",
"here?",
"because",
"I",
"want",
"to",
"add",
"elements",
"on",
"the",
"fly",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/base_moodleform.class.php#L128-L148 |
216,694 | moodle/moodle | backup/util/ui/base_moodleform.class.php | base_moodleform.close_task_divs | public function close_task_divs() {
if ($this->activitydiv) {
$this->_form->addElement('html', html_writer::end_tag('div'));
$this->activitydiv = false;
}
if ($this->sectiondiv) {
$this->_form->addElement('html', html_writer::end_tag('div'));
$this... | php | public function close_task_divs() {
if ($this->activitydiv) {
$this->_form->addElement('html', html_writer::end_tag('div'));
$this->activitydiv = false;
}
if ($this->sectiondiv) {
$this->_form->addElement('html', html_writer::end_tag('div'));
$this... | [
"public",
"function",
"close_task_divs",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"activitydiv",
")",
"{",
"$",
"this",
"->",
"_form",
"->",
"addElement",
"(",
"'html'",
",",
"html_writer",
"::",
"end_tag",
"(",
"'div'",
")",
")",
";",
"$",
"this",... | Closes any open divs | [
"Closes",
"any",
"open",
"divs"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/base_moodleform.class.php#L153-L166 |
216,695 | moodle/moodle | backup/util/ui/base_moodleform.class.php | base_moodleform.add_setting | public function add_setting(backup_setting $setting, base_task $task = null) {
return $this->add_settings(array(array($setting, $task)));
} | php | public function add_setting(backup_setting $setting, base_task $task = null) {
return $this->add_settings(array(array($setting, $task)));
} | [
"public",
"function",
"add_setting",
"(",
"backup_setting",
"$",
"setting",
",",
"base_task",
"$",
"task",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"add_settings",
"(",
"array",
"(",
"array",
"(",
"$",
"setting",
",",
"$",
"task",
")",
")",
... | Adds the backup_setting as a element to the form
@param backup_setting $setting
@param base_task $task
@return bool | [
"Adds",
"the",
"backup_setting",
"as",
"a",
"element",
"to",
"the",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/base_moodleform.class.php#L174-L176 |
216,696 | moodle/moodle | backup/util/ui/base_moodleform.class.php | base_moodleform.add_settings | public function add_settings(array $settingstasks) {
global $OUTPUT;
// Determine highest setting level, which is displayed in this stage. This is relevant for considering only
// locks of dependency settings for parent settings, which are not displayed in this stage.
$highestlevel = ba... | php | public function add_settings(array $settingstasks) {
global $OUTPUT;
// Determine highest setting level, which is displayed in this stage. This is relevant for considering only
// locks of dependency settings for parent settings, which are not displayed in this stage.
$highestlevel = ba... | [
"public",
"function",
"add_settings",
"(",
"array",
"$",
"settingstasks",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"// Determine highest setting level, which is displayed in this stage. This is relevant for considering only",
"// locks of dependency settings for parent settings, which are... | Adds multiple backup_settings as elements to the form
@param array $settingstasks Consists of array($setting, $task) elements
@return bool | [
"Adds",
"multiple",
"backup_settings",
"as",
"elements",
"to",
"the",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/base_moodleform.class.php#L183-L221 |
216,697 | moodle/moodle | backup/util/ui/base_moodleform.class.php | base_moodleform.add_fixed_setting | public function add_fixed_setting(backup_setting $setting, base_task $task) {
global $OUTPUT;
$settingui = $setting->get_ui();
if ($setting->get_visibility() == backup_setting::VISIBLE) {
$this->add_html_formatting($setting);
switch ($setting->get_status()) {
... | php | public function add_fixed_setting(backup_setting $setting, base_task $task) {
global $OUTPUT;
$settingui = $setting->get_ui();
if ($setting->get_visibility() == backup_setting::VISIBLE) {
$this->add_html_formatting($setting);
switch ($setting->get_status()) {
... | [
"public",
"function",
"add_fixed_setting",
"(",
"backup_setting",
"$",
"setting",
",",
"base_task",
"$",
"task",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"settingui",
"=",
"$",
"setting",
"->",
"get_ui",
"(",
")",
";",
"if",
"(",
"$",
"setting",
"->"... | Adds a fixed or static setting to the form
@param backup_setting $setting
@param base_task $task | [
"Adds",
"a",
"fixed",
"or",
"static",
"setting",
"to",
"the",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/base_moodleform.class.php#L294-L327 |
216,698 | moodle/moodle | backup/util/ui/base_moodleform.class.php | base_moodleform.add_dependencies | public function add_dependencies(backup_setting $setting) {
$mform = $this->_form;
// Apply all dependencies for backup.
foreach ($setting->get_my_dependency_properties() as $key => $dependency) {
call_user_func_array(array($this->_form, 'disabledIf'), $dependency);
}
} | php | public function add_dependencies(backup_setting $setting) {
$mform = $this->_form;
// Apply all dependencies for backup.
foreach ($setting->get_my_dependency_properties() as $key => $dependency) {
call_user_func_array(array($this->_form, 'disabledIf'), $dependency);
}
} | [
"public",
"function",
"add_dependencies",
"(",
"backup_setting",
"$",
"setting",
")",
"{",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"// Apply all dependencies for backup.",
"foreach",
"(",
"$",
"setting",
"->",
"get_my_dependency_properties",
"(",
")",
... | Adds dependencies to the form recursively
@param backup_setting $setting | [
"Adds",
"dependencies",
"to",
"the",
"form",
"recursively"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/base_moodleform.class.php#L334-L340 |
216,699 | moodle/moodle | backup/util/ui/base_moodleform.class.php | base_moodleform.remove_element | public function remove_element($elementname) {
if ($this->_form->elementExists($elementname)) {
return $this->_form->removeElement($elementname);
} else {
return false;
}
} | php | public function remove_element($elementname) {
if ($this->_form->elementExists($elementname)) {
return $this->_form->removeElement($elementname);
} else {
return false;
}
} | [
"public",
"function",
"remove_element",
"(",
"$",
"elementname",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_form",
"->",
"elementExists",
"(",
"$",
"elementname",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_form",
"->",
"removeElement",
"(",
"$",
"eleme... | Removes an element from the form if it exists
@param string $elementname
@return bool | [
"Removes",
"an",
"element",
"from",
"the",
"form",
"if",
"it",
"exists"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/base_moodleform.class.php#L355-L361 |
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.