id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
214,800 | moodle/moodle | backup/util/factories/convert_factory.class.php | convert_factory.get_converter | public static function get_converter($name, $tempdir, $logger = null) {
global $CFG;
$name = clean_param($name, PARAM_SAFEDIR);
$classfile = "$CFG->dirroot/backup/converter/$name/lib.php";
$classname = "{$name}_converter";
if (!file_exists($classfile)) {
throw new ... | php | public static function get_converter($name, $tempdir, $logger = null) {
global $CFG;
$name = clean_param($name, PARAM_SAFEDIR);
$classfile = "$CFG->dirroot/backup/converter/$name/lib.php";
$classname = "{$name}_converter";
if (!file_exists($classfile)) {
throw new ... | [
"public",
"static",
"function",
"get_converter",
"(",
"$",
"name",
",",
"$",
"tempdir",
",",
"$",
"logger",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"name",
"=",
"clean_param",
"(",
"$",
"name",
",",
"PARAM_SAFEDIR",
")",
";",
"$",
"cla... | Instantinates the given converter operating on a given directory
@throws coding_exception
@param $name The converter name
@param $tempdir The temp directory to operate on
@param base_logger|null if the conversion should be logged, use this logger
@return base_converter | [
"Instantinates",
"the",
"given",
"converter",
"operating",
"on",
"a",
"given",
"directory"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/factories/convert_factory.class.php#L41-L59 |
214,801 | moodle/moodle | question/behaviour/rendererbase.php | qbehaviour_renderer.manual_comment | public function manual_comment(question_attempt $qa, question_display_options $options) {
if ($options->manualcomment == question_display_options::EDITABLE) {
return $this->manual_comment_fields($qa, $options);
} else if ($options->manualcomment == question_display_options::VISIBLE) {
... | php | public function manual_comment(question_attempt $qa, question_display_options $options) {
if ($options->manualcomment == question_display_options::EDITABLE) {
return $this->manual_comment_fields($qa, $options);
} else if ($options->manualcomment == question_display_options::VISIBLE) {
... | [
"public",
"function",
"manual_comment",
"(",
"question_attempt",
"$",
"qa",
",",
"question_display_options",
"$",
"options",
")",
"{",
"if",
"(",
"$",
"options",
"->",
"manualcomment",
"==",
"question_display_options",
"::",
"EDITABLE",
")",
"{",
"return",
"$",
... | Display the manual comment, and a link to edit it, if appropriate.
@param question_attempt $qa a question attempt.
@param question_display_options $options controls what should and should not be displayed.
@return string HTML fragment. | [
"Display",
"the",
"manual",
"comment",
"and",
"a",
"link",
"to",
"edit",
"it",
"if",
"appropriate",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/behaviour/rendererbase.php#L210-L220 |
214,802 | moodle/moodle | question/behaviour/rendererbase.php | qbehaviour_renderer.submit_button | protected function submit_button(question_attempt $qa, question_display_options $options) {
if (!$qa->get_state()->is_active()) {
return '';
}
$attributes = array(
'type' => 'submit',
'id' => $qa->get_behaviour_field_name('submit'),
'name' => $qa->... | php | protected function submit_button(question_attempt $qa, question_display_options $options) {
if (!$qa->get_state()->is_active()) {
return '';
}
$attributes = array(
'type' => 'submit',
'id' => $qa->get_behaviour_field_name('submit'),
'name' => $qa->... | [
"protected",
"function",
"submit_button",
"(",
"question_attempt",
"$",
"qa",
",",
"question_display_options",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"$",
"qa",
"->",
"get_state",
"(",
")",
"->",
"is_active",
"(",
")",
")",
"{",
"return",
"''",
";",
"... | Several behaviours need a submit button, so put the common code here.
The button is disabled if the question is displayed read-only.
@param question_display_options $options controls what should and should not be displayed.
@return string HTML fragment. | [
"Several",
"behaviours",
"need",
"a",
"submit",
"button",
"so",
"put",
"the",
"common",
"code",
"here",
".",
"The",
"button",
"is",
"disabled",
"if",
"the",
"question",
"is",
"displayed",
"read",
"-",
"only",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/behaviour/rendererbase.php#L228-L248 |
214,803 | moodle/moodle | auth/email/auth.php | auth_plugin_email.user_signup_with_confirmation | public function user_signup_with_confirmation($user, $notify=true, $confirmationurl = null) {
global $CFG, $DB, $SESSION;
require_once($CFG->dirroot.'/user/profile/lib.php');
require_once($CFG->dirroot.'/user/lib.php');
$plainpassword = $user->password;
$user->password = hash_in... | php | public function user_signup_with_confirmation($user, $notify=true, $confirmationurl = null) {
global $CFG, $DB, $SESSION;
require_once($CFG->dirroot.'/user/profile/lib.php');
require_once($CFG->dirroot.'/user/lib.php');
$plainpassword = $user->password;
$user->password = hash_in... | [
"public",
"function",
"user_signup_with_confirmation",
"(",
"$",
"user",
",",
"$",
"notify",
"=",
"true",
",",
"$",
"confirmationurl",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
",",
"$",
"SESSION",
";",
"require_once",
"(",
"$",
"CFG",... | Sign up a new user ready for confirmation.
Password is passed in plaintext.
A custom confirmationurl could be used.
@param object $user new user object
@param boolean $notify print notice with link and terminate
@param string $confirmationurl user confirmation URL
@return boolean true if everything well ok and $notif... | [
"Sign",
"up",
"a",
"new",
"user",
"ready",
"for",
"confirmation",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/email/auth.php#L115-L156 |
214,804 | moodle/moodle | favourites/classes/local/service/user_favourite_service.php | user_favourite_service.delete_favourite | public function delete_favourite(string $component, string $itemtype, int $itemid, \context $context) {
if (!in_array($component, \core_component::get_component_names())) {
throw new \moodle_exception("Invalid component name '$component'");
}
// Business logic: check the user owns t... | php | public function delete_favourite(string $component, string $itemtype, int $itemid, \context $context) {
if (!in_array($component, \core_component::get_component_names())) {
throw new \moodle_exception("Invalid component name '$component'");
}
// Business logic: check the user owns t... | [
"public",
"function",
"delete_favourite",
"(",
"string",
"$",
"component",
",",
"string",
"$",
"itemtype",
",",
"int",
"$",
"itemid",
",",
"\\",
"context",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"component",
",",
"\\",
"core_comp... | Delete a favourite item from an area and from within a context.
E.g. delete a favourite course from the area 'core_course', 'course' with itemid 3 and from within the CONTEXT_USER context.
@param string $component the frankenstyle component name.
@param string $itemtype the type of the favourited item.
@param int $it... | [
"Delete",
"a",
"favourite",
"item",
"from",
"an",
"area",
"and",
"from",
"within",
"a",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/service/user_favourite_service.php#L169-L182 |
214,805 | moodle/moodle | favourites/classes/local/service/user_favourite_service.php | user_favourite_service.favourite_exists | public function favourite_exists(string $component, string $itemtype, int $itemid, \context $context) : bool {
return $this->repo->exists_by(
[
'userid' => $this->userid,
'component' => $component,
'itemtype' => $itemtype,
'itemid' => $... | php | public function favourite_exists(string $component, string $itemtype, int $itemid, \context $context) : bool {
return $this->repo->exists_by(
[
'userid' => $this->userid,
'component' => $component,
'itemtype' => $itemtype,
'itemid' => $... | [
"public",
"function",
"favourite_exists",
"(",
"string",
"$",
"component",
",",
"string",
"$",
"itemtype",
",",
"int",
"$",
"itemid",
",",
"\\",
"context",
"$",
"context",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"repo",
"->",
"exists_by",
"("... | Check whether an item has been marked as a favourite in the respective area.
@param string $component the frankenstyle component name.
@param string $itemtype the type of the favourited item.
@param int $itemid the id of the item which was favourited (not the favourite's id).
@param \context $context the context of th... | [
"Check",
"whether",
"an",
"item",
"has",
"been",
"marked",
"as",
"a",
"favourite",
"in",
"the",
"respective",
"area",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/service/user_favourite_service.php#L193-L203 |
214,806 | moodle/moodle | favourites/classes/local/service/user_favourite_service.php | user_favourite_service.get_favourite | public function get_favourite(string $component, string $itemtype, int $itemid, \context $context) {
try {
return $this->repo->find_favourite(
$this->userid,
$component,
$itemtype,
$itemid,
$context->id
);
... | php | public function get_favourite(string $component, string $itemtype, int $itemid, \context $context) {
try {
return $this->repo->find_favourite(
$this->userid,
$component,
$itemtype,
$itemid,
$context->id
);
... | [
"public",
"function",
"get_favourite",
"(",
"string",
"$",
"component",
",",
"string",
"$",
"itemtype",
",",
"int",
"$",
"itemid",
",",
"\\",
"context",
"$",
"context",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"repo",
"->",
"find_favourite",
"(... | Get the favourite.
@param string $component the frankenstyle component name.
@param string $itemtype the type of the favourited item.
@param int $itemid the id of the item which was favourited (not the favourite's id).
@param \context $context the context of the item which was favourited.
@return favourite|null | [
"Get",
"the",
"favourite",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/service/user_favourite_service.php#L214-L226 |
214,807 | moodle/moodle | favourites/classes/local/service/user_favourite_service.php | user_favourite_service.count_favourites_by_type | public function count_favourites_by_type(string $component, string $itemtype, \context $context = null) {
$criteria = [
'userid' => $this->userid,
'component' => $component,
'itemtype' => $itemtype
];
if ($context) {
$criteria['contextid'] = $cont... | php | public function count_favourites_by_type(string $component, string $itemtype, \context $context = null) {
$criteria = [
'userid' => $this->userid,
'component' => $component,
'itemtype' => $itemtype
];
if ($context) {
$criteria['contextid'] = $cont... | [
"public",
"function",
"count_favourites_by_type",
"(",
"string",
"$",
"component",
",",
"string",
"$",
"itemtype",
",",
"\\",
"context",
"$",
"context",
"=",
"null",
")",
"{",
"$",
"criteria",
"=",
"[",
"'userid'",
"=>",
"$",
"this",
"->",
"userid",
",",
... | Count the favourite by item type.
@param string $component the frankenstyle component name.
@param string $itemtype the type of the favourited item.
@param \context|null $context the context of the item which was favourited.
@return int | [
"Count",
"the",
"favourite",
"by",
"item",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/service/user_favourite_service.php#L236-L248 |
214,808 | moodle/moodle | auth/cas/CAS/CAS/PGTStorage/File.php | CAS_PGTStorage_File.getPGTIouFilename | function getPGTIouFilename($pgt_iou)
{
phpCAS::traceBegin();
$filename = $this->getPath()."phpcas-".hash("sha256", $pgt_iou);
// $filename = $this->getPath().$pgt_iou.'.plain';
phpCAS::trace("Sha256 filename:" . $filename);
phpCAS::traceEnd();
return $filename;
} | php | function getPGTIouFilename($pgt_iou)
{
phpCAS::traceBegin();
$filename = $this->getPath()."phpcas-".hash("sha256", $pgt_iou);
// $filename = $this->getPath().$pgt_iou.'.plain';
phpCAS::trace("Sha256 filename:" . $filename);
phpCAS::traceEnd();
return $filename;
} | [
"function",
"getPGTIouFilename",
"(",
"$",
"pgt_iou",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"$",
"filename",
"=",
"$",
"this",
"->",
"getPath",
"(",
")",
".",
"\"phpcas-\"",
".",
"hash",
"(",
"\"sha256\"",
",",
"$",
"pgt_iou",
")",
";"... | This method returns the filename corresponding to a PGT Iou.
@param string $pgt_iou the PGT iou.
@return a filename
@private | [
"This",
"method",
"returns",
"the",
"filename",
"corresponding",
"to",
"a",
"PGT",
"Iou",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/PGTStorage/File.php#L180-L188 |
214,809 | moodle/moodle | auth/cas/CAS/CAS/PGTStorage/File.php | CAS_PGTStorage_File.write | function write($pgt,$pgt_iou)
{
phpCAS::traceBegin();
$fname = $this->getPGTIouFilename($pgt_iou);
if (!file_exists($fname)) {
touch($fname);
// Chmod will fail on windows
@chmod($fname, 0600);
if ($f=fopen($fname, "w")) {
if (f... | php | function write($pgt,$pgt_iou)
{
phpCAS::traceBegin();
$fname = $this->getPGTIouFilename($pgt_iou);
if (!file_exists($fname)) {
touch($fname);
// Chmod will fail on windows
@chmod($fname, 0600);
if ($f=fopen($fname, "w")) {
if (f... | [
"function",
"write",
"(",
"$",
"pgt",
",",
"$",
"pgt_iou",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"$",
"fname",
"=",
"$",
"this",
"->",
"getPGTIouFilename",
"(",
"$",
"pgt_iou",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fn... | This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
warning on error.
@param string $pgt the PGT
@param string $pgt_iou the PGT iou
@return void
@public | [
"This",
"method",
"stores",
"a",
"PGT",
"and",
"its",
"corresponding",
"PGT",
"Iou",
"into",
"a",
"file",
".",
"Echoes",
"a",
"warning",
"on",
"error",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/PGTStorage/File.php#L201-L222 |
214,810 | moodle/moodle | auth/cas/CAS/CAS/PGTStorage/File.php | CAS_PGTStorage_File.read | function read($pgt_iou)
{
phpCAS::traceBegin();
$pgt = false;
$fname = $this->getPGTIouFilename($pgt_iou);
if (file_exists($fname)) {
if (!($f=fopen($fname, "r"))) {
phpCAS::error('could not open `'.$fname.'\'');
} else {
if (($... | php | function read($pgt_iou)
{
phpCAS::traceBegin();
$pgt = false;
$fname = $this->getPGTIouFilename($pgt_iou);
if (file_exists($fname)) {
if (!($f=fopen($fname, "r"))) {
phpCAS::error('could not open `'.$fname.'\'');
} else {
if (($... | [
"function",
"read",
"(",
"$",
"pgt_iou",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"$",
"pgt",
"=",
"false",
";",
"$",
"fname",
"=",
"$",
"this",
"->",
"getPGTIouFilename",
"(",
"$",
"pgt_iou",
")",
";",
"if",
"(",
"file_exists",
"(",
... | This method reads a PGT corresponding to a PGT Iou and deletes the
corresponding file.
@param string $pgt_iou the PGT iou
@return the corresponding PGT, or FALSE on error
@public | [
"This",
"method",
"reads",
"a",
"PGT",
"corresponding",
"to",
"a",
"PGT",
"Iou",
"and",
"deletes",
"the",
"corresponding",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/PGTStorage/File.php#L234-L256 |
214,811 | moodle/moodle | lib/scssphp/SourceMap/SourceMapGenerator.php | SourceMapGenerator.generateJson | public function generateJson()
{
$sourceMap = array();
$mappings = $this->generateMappings();
// File version (always the first entry in the object) and must be a positive integer.
$sourceMap['version'] = self::VERSION;
// An optional name of the generated code that this s... | php | public function generateJson()
{
$sourceMap = array();
$mappings = $this->generateMappings();
// File version (always the first entry in the object) and must be a positive integer.
$sourceMap['version'] = self::VERSION;
// An optional name of the generated code that this s... | [
"public",
"function",
"generateJson",
"(",
")",
"{",
"$",
"sourceMap",
"=",
"array",
"(",
")",
";",
"$",
"mappings",
"=",
"$",
"this",
"->",
"generateMappings",
"(",
")",
";",
"// File version (always the first entry in the object) and must be a positive integer.",
"$... | Generates the JSON source map
@return string
@see https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit# | [
"Generates",
"the",
"JSON",
"source",
"map"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/SourceMap/SourceMapGenerator.php#L157-L206 |
214,812 | moodle/moodle | lib/scssphp/SourceMap/SourceMapGenerator.php | SourceMapGenerator.getSourcesContent | protected function getSourcesContent()
{
if (empty($this->sources)) {
return null;
}
$content = array();
foreach ($this->sources as $sourceFile) {
$content[] = file_get_contents($sourceFile);
}
return $content;
} | php | protected function getSourcesContent()
{
if (empty($this->sources)) {
return null;
}
$content = array();
foreach ($this->sources as $sourceFile) {
$content[] = file_get_contents($sourceFile);
}
return $content;
} | [
"protected",
"function",
"getSourcesContent",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"sources",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"content",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"sources",
... | Returns the sources contents
@return array|null | [
"Returns",
"the",
"sources",
"contents"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/SourceMap/SourceMapGenerator.php#L213-L226 |
214,813 | moodle/moodle | lib/classes/chart_series.php | chart_series.set_type | public function set_type($type) {
if (!in_array($type, [self::TYPE_DEFAULT, self::TYPE_LINE])) {
throw new coding_exception('Invalid serie type.');
}
$this->type = $type;
} | php | public function set_type($type) {
if (!in_array($type, [self::TYPE_DEFAULT, self::TYPE_LINE])) {
throw new coding_exception('Invalid serie type.');
}
$this->type = $type;
} | [
"public",
"function",
"set_type",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"type",
",",
"[",
"self",
"::",
"TYPE_DEFAULT",
",",
"self",
"::",
"TYPE_LINE",
"]",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Invalid s... | Set the type of the series.
@param string $type Constant value from self::TYPE_*. | [
"Set",
"the",
"type",
"of",
"the",
"series",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/chart_series.php#L236-L241 |
214,814 | moodle/moodle | grade/report/singleview/classes/local/ui/exclude.php | exclude.determine_format | public function determine_format() {
return new checkbox_attribute(
$this->get_name(),
$this->get_label(),
$this->is_checked(),
$this->is_disabled()
);
} | php | public function determine_format() {
return new checkbox_attribute(
$this->get_name(),
$this->get_label(),
$this->is_checked(),
$this->is_disabled()
);
} | [
"public",
"function",
"determine_format",
"(",
")",
"{",
"return",
"new",
"checkbox_attribute",
"(",
"$",
"this",
"->",
"get_name",
"(",
")",
",",
"$",
"this",
"->",
"get_label",
"(",
")",
",",
"$",
"this",
"->",
"is_checked",
"(",
")",
",",
"$",
"this... | Generate the element used to render the UI
@return element | [
"Generate",
"the",
"element",
"used",
"to",
"render",
"the",
"UI"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/ui/exclude.php#L69-L76 |
214,815 | moodle/moodle | grade/report/singleview/classes/local/ui/exclude.php | exclude.set | public function set($value) {
if (empty($this->grade->id)) {
if (empty($value)) {
return false;
}
$gradeitem = $this->grade->grade_item;
// Fill in arbitrary grade to be excluded.
$gradeitem->update_final_grade(
$this-... | php | public function set($value) {
if (empty($this->grade->id)) {
if (empty($value)) {
return false;
}
$gradeitem = $this->grade->grade_item;
// Fill in arbitrary grade to be excluded.
$gradeitem->update_final_grade(
$this-... | [
"public",
"function",
"set",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"grade",
"->",
"id",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"gradeitem",
"=",
... | Set the value that was changed in the form.
@param string $value The value to set.
@return mixed string|bool An error message or false. | [
"Set",
"the",
"value",
"that",
"was",
"changed",
"in",
"the",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/ui/exclude.php#L96-L124 |
214,816 | moodle/moodle | lib/lessphp/Tree/Ruleset.php | Less_Tree_Ruleset.EvalMixinCalls | private function EvalMixinCalls( $ruleset, $env, &$rsRuleCnt ){
for($i=0; $i < $rsRuleCnt; $i++){
$rule = $ruleset->rules[$i];
if( $rule instanceof Less_Tree_Mixin_Call ){
$rule = $rule->compile($env);
$temp = array();
foreach($rule as $r){
if( ($r instanceof Less_Tree_Rule) && $r->variable )... | php | private function EvalMixinCalls( $ruleset, $env, &$rsRuleCnt ){
for($i=0; $i < $rsRuleCnt; $i++){
$rule = $ruleset->rules[$i];
if( $rule instanceof Less_Tree_Mixin_Call ){
$rule = $rule->compile($env);
$temp = array();
foreach($rule as $r){
if( ($r instanceof Less_Tree_Rule) && $r->variable )... | [
"private",
"function",
"EvalMixinCalls",
"(",
"$",
"ruleset",
",",
"$",
"env",
",",
"&",
"$",
"rsRuleCnt",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"rsRuleCnt",
";",
"$",
"i",
"++",
")",
"{",
"$",
"rule",
"=",
"$",
"... | Compile Less_Tree_Mixin_Call objects
@param Less_Tree_Ruleset $ruleset
@param integer $rsRuleCnt | [
"Compile",
"Less_Tree_Mixin_Call",
"objects"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Tree/Ruleset.php#L142-L187 |
214,817 | moodle/moodle | lib/lessphp/Tree/Ruleset.php | Less_Tree_Ruleset.matchCondition | public function matchCondition( $args, $env ){
$lastSelector = end($this->selectors);
if( !$lastSelector->evaldCondition ){
return false;
}
if( $lastSelector->condition && !$lastSelector->condition->compile( $env->copyEvalEnv( $env->frames ) ) ){
return false;
}
return true;
} | php | public function matchCondition( $args, $env ){
$lastSelector = end($this->selectors);
if( !$lastSelector->evaldCondition ){
return false;
}
if( $lastSelector->condition && !$lastSelector->condition->compile( $env->copyEvalEnv( $env->frames ) ) ){
return false;
}
return true;
} | [
"public",
"function",
"matchCondition",
"(",
"$",
"args",
",",
"$",
"env",
")",
"{",
"$",
"lastSelector",
"=",
"end",
"(",
"$",
"this",
"->",
"selectors",
")",
";",
"if",
"(",
"!",
"$",
"lastSelector",
"->",
"evaldCondition",
")",
"{",
"return",
"false... | lets you call a css selector with a guard | [
"lets",
"you",
"call",
"a",
"css",
"selector",
"with",
"a",
"guard"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Tree/Ruleset.php#L282-L292 |
214,818 | moodle/moodle | mod/workshop/form/numerrors/lib.php | workshop_numerrors_strategy.prepare_form_fields | protected function prepare_form_fields(array $dims, array $maps) {
$formdata = new stdclass();
$key = 0;
foreach ($dims as $dimension) {
$formdata->{'dimensionid__idx_' . $key} = $dimension->id;
$formdata->{'description__idx_' . $key} = $dimension... | php | protected function prepare_form_fields(array $dims, array $maps) {
$formdata = new stdclass();
$key = 0;
foreach ($dims as $dimension) {
$formdata->{'dimensionid__idx_' . $key} = $dimension->id;
$formdata->{'description__idx_' . $key} = $dimension... | [
"protected",
"function",
"prepare_form_fields",
"(",
"array",
"$",
"dims",
",",
"array",
"$",
"maps",
")",
"{",
"$",
"formdata",
"=",
"new",
"stdclass",
"(",
")",
";",
"$",
"key",
"=",
"0",
";",
"foreach",
"(",
"$",
"dims",
"as",
"$",
"dimension",
")... | Prepares the database data to be used by the mform
@param array $dims Array of raw dimension records as returned by {@link load_fields()}
@param array $maps Array of raw mapping records as returned by {@link load_mappings()}
@return array Array of fields data to be used by the mform set_data | [
"Prepares",
"the",
"database",
"data",
"to",
"be",
"used",
"by",
"the",
"mform"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/form/numerrors/lib.php#L447-L466 |
214,819 | moodle/moodle | mod/workshop/form/numerrors/lib.php | workshop_numerrors_strategy.errors_to_grade | protected function errors_to_grade($numerrors) {
$grade = 100.00000;
for ($i = 1; $i <= $numerrors; $i++) {
if (isset($this->mappings[$i])) {
$grade = $this->mappings[$i]->grade;
}
}
if ($grade > 100.00000) {
$grade = 100.00000;
... | php | protected function errors_to_grade($numerrors) {
$grade = 100.00000;
for ($i = 1; $i <= $numerrors; $i++) {
if (isset($this->mappings[$i])) {
$grade = $this->mappings[$i]->grade;
}
}
if ($grade > 100.00000) {
$grade = 100.00000;
... | [
"protected",
"function",
"errors_to_grade",
"(",
"$",
"numerrors",
")",
"{",
"$",
"grade",
"=",
"100.00000",
";",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<=",
"$",
"numerrors",
";",
"$",
"i",
"++",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
... | Returns a grade 0.00000 to 100.00000 for the given number of errors
This is where we use the mapping table defined by the teacher. If a grade for the given
number of errors (negative assertions) is not defined, the most recently defined one is used.
Example of the defined mapping:
Number of errors | Grade
0 | 100% (a... | [
"Returns",
"a",
"grade",
"0",
".",
"00000",
"to",
"100",
".",
"00000",
"for",
"the",
"given",
"number",
"of",
"errors"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/form/numerrors/lib.php#L605-L619 |
214,820 | moodle/moodle | enrol/imsenterprise/lib.php | enrol_imsenterprise_plugin.full_tag_found_in_cache | protected function full_tag_found_in_cache($tagname, $latestline) {
// Return entire element if found. Otherwise return false.
if (strpos(strtolower($latestline), '</'.strtolower($tagname).'>') === false) {
return false;
} else if (preg_match('{(<'.$tagname.'\b.*?>.*?</'.$tagname.'>)... | php | protected function full_tag_found_in_cache($tagname, $latestline) {
// Return entire element if found. Otherwise return false.
if (strpos(strtolower($latestline), '</'.strtolower($tagname).'>') === false) {
return false;
} else if (preg_match('{(<'.$tagname.'\b.*?>.*?</'.$tagname.'>)... | [
"protected",
"function",
"full_tag_found_in_cache",
"(",
"$",
"tagname",
",",
"$",
"latestline",
")",
"{",
"// Return entire element if found. Otherwise return false.",
"if",
"(",
"strpos",
"(",
"strtolower",
"(",
"$",
"latestline",
")",
",",
"'</'",
".",
"strtolower"... | Check if a complete tag is found in the cached data, which usually happens
when the end of the tag has only just been loaded into the cache.
@param string $tagname Name of tag to look for
@param string $latestline The very last line in the cache (used for speeding up the match)
@return bool|string false, or the conten... | [
"Check",
"if",
"a",
"complete",
"tag",
"is",
"found",
"in",
"the",
"cached",
"data",
"which",
"usually",
"happens",
"when",
"the",
"end",
"of",
"the",
"tag",
"has",
"only",
"just",
"been",
"loaded",
"into",
"the",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/imsenterprise/lib.php#L256-L265 |
214,821 | moodle/moodle | enrol/imsenterprise/lib.php | enrol_imsenterprise_plugin.get_category_from_group | private function get_category_from_group($categories) {
global $DB;
if (empty($categories)) {
$catid = $this->get_default_category_id();
} else {
$createnewcategories = $this->get_config('createnewcategories');
$categoryseparator = trim($this->get_config('cat... | php | private function get_category_from_group($categories) {
global $DB;
if (empty($categories)) {
$catid = $this->get_default_category_id();
} else {
$createnewcategories = $this->get_config('createnewcategories');
$categoryseparator = trim($this->get_config('cat... | [
"private",
"function",
"get_category_from_group",
"(",
"$",
"categories",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"categories",
")",
")",
"{",
"$",
"catid",
"=",
"$",
"this",
"->",
"get_default_category_id",
"(",
")",
";",
"}",
... | Find the category using idnumber or name.
@param array $categories List of categories
@return int id of category found. | [
"Find",
"the",
"category",
"using",
"idnumber",
"or",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/imsenterprise/lib.php#L891-L971 |
214,822 | moodle/moodle | lib/simplepie/library/SimplePie/XML/Declaration/Parser.php | SimplePie_XML_Declaration_Parser.skip_whitespace | public function skip_whitespace()
{
$whitespace = strspn($this->data, "\x09\x0A\x0D\x20", $this->position);
$this->position += $whitespace;
return $whitespace;
} | php | public function skip_whitespace()
{
$whitespace = strspn($this->data, "\x09\x0A\x0D\x20", $this->position);
$this->position += $whitespace;
return $whitespace;
} | [
"public",
"function",
"skip_whitespace",
"(",
")",
"{",
"$",
"whitespace",
"=",
"strspn",
"(",
"$",
"this",
"->",
"data",
",",
"\"\\x09\\x0A\\x0D\\x20\"",
",",
"$",
"this",
"->",
"position",
")",
";",
"$",
"this",
"->",
"position",
"+=",
"$",
"whitespace",... | Advance past any whitespace
@return int Number of whitespace characters passed | [
"Advance",
"past",
"any",
"whitespace"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/XML/Declaration/Parser.php#L164-L169 |
214,823 | moodle/moodle | mod/workshop/form/rubric/edit_form.php | workshop_edit_rubric_strategy_form.validation_inner | protected function validation_inner($data, $files) {
$errors = array();
// Iterate over all submitted dimensions (criteria).
for ($i = 0; isset($data['dimensionid__idx_'.$i]); $i++) {
$dimgrades = array();
if (0 == strlen(trim($data['description__idx_'.$i.'_editor']['... | php | protected function validation_inner($data, $files) {
$errors = array();
// Iterate over all submitted dimensions (criteria).
for ($i = 0; isset($data['dimensionid__idx_'.$i]); $i++) {
$dimgrades = array();
if (0 == strlen(trim($data['description__idx_'.$i.'_editor']['... | [
"protected",
"function",
"validation_inner",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"// Iterate over all submitted dimensions (criteria).",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"isset",
"(",
"$",
"data",
... | Provide validation rules for the rubric editor form.
@param array $data
@param array $files
@return array | [
"Provide",
"validation",
"rules",
"for",
"the",
"rubric",
"editor",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/form/rubric/edit_form.php#L114-L154 |
214,824 | moodle/moodle | question/engine/questionattemptstep.php | question_attempt_step.set_qt_var | public function set_qt_var($name, $value) {
if ($name[0] != '_') {
throw new coding_exception('Cannot set question type data ' . $name .
' on an attempt step. You can only set variables with names begining with _.');
}
$this->data[$name] = $value;
} | php | public function set_qt_var($name, $value) {
if ($name[0] != '_') {
throw new coding_exception('Cannot set question type data ' . $name .
' on an attempt step. You can only set variables with names begining with _.');
}
$this->data[$name] = $value;
} | [
"public",
"function",
"set_qt_var",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"name",
"[",
"0",
"]",
"!=",
"'_'",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Cannot set question type data '",
".",
"$",
"name",
".",
"' on an ... | Set a cached question type variable.
@param string $name the name of the variable to set. Must match _[a-z][a-z0-9]*.
@param string $value the value to set. | [
"Set",
"a",
"cached",
"question",
"type",
"variable",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/questionattemptstep.php#L204-L210 |
214,825 | moodle/moodle | question/engine/questionattemptstep.php | question_attempt_step.prepare_response_files_draft_itemid | public function prepare_response_files_draft_itemid($name, $contextid) {
list($draftid, $notused) = $this->prepare_response_files_draft_itemid_with_text(
$name, $contextid, null);
return $draftid;
} | php | public function prepare_response_files_draft_itemid($name, $contextid) {
list($draftid, $notused) = $this->prepare_response_files_draft_itemid_with_text(
$name, $contextid, null);
return $draftid;
} | [
"public",
"function",
"prepare_response_files_draft_itemid",
"(",
"$",
"name",
",",
"$",
"contextid",
")",
"{",
"list",
"(",
"$",
"draftid",
",",
"$",
"notused",
")",
"=",
"$",
"this",
"->",
"prepare_response_files_draft_itemid_with_text",
"(",
"$",
"name",
",",... | Prepare a draft file are for the files belonging the a response variable
of this step.
@param string $name the variable name the files belong to.
@param int $contextid the id of the context the quba belongs to.
@return int the draft itemid. | [
"Prepare",
"a",
"draft",
"file",
"are",
"for",
"the",
"files",
"belonging",
"the",
"a",
"response",
"variable",
"of",
"this",
"step",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/questionattemptstep.php#L244-L248 |
214,826 | moodle/moodle | question/engine/questionattemptstep.php | question_attempt_step.prepare_response_files_draft_itemid_with_text | public function prepare_response_files_draft_itemid_with_text($name, $contextid, $text) {
$draftid = 0; // Will be filled in by file_prepare_draft_area.
$newtext = file_prepare_draft_area($draftid, $contextid, 'question',
'response_' . $name, $this->id, null, $text);
return array... | php | public function prepare_response_files_draft_itemid_with_text($name, $contextid, $text) {
$draftid = 0; // Will be filled in by file_prepare_draft_area.
$newtext = file_prepare_draft_area($draftid, $contextid, 'question',
'response_' . $name, $this->id, null, $text);
return array... | [
"public",
"function",
"prepare_response_files_draft_itemid_with_text",
"(",
"$",
"name",
",",
"$",
"contextid",
",",
"$",
"text",
")",
"{",
"$",
"draftid",
"=",
"0",
";",
"// Will be filled in by file_prepare_draft_area.",
"$",
"newtext",
"=",
"file_prepare_draft_area",... | Prepare a draft file are for the files belonging the a response variable
of this step, while rewriting the URLs in some text.
@param string $name the variable name the files belong to.
@param int $contextid the id of the context the quba belongs to.
@param string $text the text to update the URLs in.
@return array(int... | [
"Prepare",
"a",
"draft",
"file",
"are",
"for",
"the",
"files",
"belonging",
"the",
"a",
"response",
"variable",
"of",
"this",
"step",
"while",
"rewriting",
"the",
"URLs",
"in",
"some",
"text",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/questionattemptstep.php#L259-L264 |
214,827 | moodle/moodle | question/engine/questionattemptstep.php | question_attempt_step.get_qt_data | public function get_qt_data() {
$result = array();
foreach ($this->data as $name => $value) {
if ($name[0] != '-' && $name[0] != ':') {
$result[$name] = $value;
}
}
return $result;
} | php | public function get_qt_data() {
$result = array();
foreach ($this->data as $name => $value) {
if ($name[0] != '-' && $name[0] != ':') {
$result[$name] = $value;
}
}
return $result;
} | [
"public",
"function",
"get_qt_data",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"name",
"[",
"0",
"]",
"!=",
"'-'",
"&&"... | Get all the question type variables.
@param array name => value pairs. | [
"Get",
"all",
"the",
"question",
"type",
"variables",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/questionattemptstep.php#L287-L295 |
214,828 | moodle/moodle | question/engine/questionattemptstep.php | question_attempt_step.set_behaviour_var | public function set_behaviour_var($name, $value) {
if ($name[0] != '_') {
throw new coding_exception('Cannot set question type data ' . $name .
' on an attempt step. You can only set variables with names begining with _.');
}
return $this->data['-' . $name] = $val... | php | public function set_behaviour_var($name, $value) {
if ($name[0] != '_') {
throw new coding_exception('Cannot set question type data ' . $name .
' on an attempt step. You can only set variables with names begining with _.');
}
return $this->data['-' . $name] = $val... | [
"public",
"function",
"set_behaviour_var",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"name",
"[",
"0",
"]",
"!=",
"'_'",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Cannot set question type data '",
".",
"$",
"name",
".",
"'... | Set a cached behaviour variable.
@param string $name the name of the variable to set. Must match _[a-z][a-z0-9]*.
@param string $value the value to set. | [
"Set",
"a",
"cached",
"behaviour",
"variable",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/questionattemptstep.php#L321-L327 |
214,829 | moodle/moodle | question/engine/questionattemptstep.php | question_attempt_step.get_behaviour_data | public function get_behaviour_data() {
$result = array();
foreach ($this->data as $name => $value) {
if ($name[0] == '-') {
$result[substr($name, 1)] = $value;
}
}
return $result;
} | php | public function get_behaviour_data() {
$result = array();
foreach ($this->data as $name => $value) {
if ($name[0] == '-') {
$result[substr($name, 1)] = $value;
}
}
return $result;
} | [
"public",
"function",
"get_behaviour_data",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"name",
"[",
"0",
"]",
"==",
"'-'",... | Get all the behaviour variables.
@param array name => value pairs. | [
"Get",
"all",
"the",
"behaviour",
"variables",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/questionattemptstep.php#L333-L341 |
214,830 | moodle/moodle | question/engine/questionattemptstep.php | question_attempt_step_subquestion_adapter.add_prefix | public function add_prefix($field) {
if (substr($field, 0, 2) === '!_') {
return '-_' . $this->extraprefix . substr($field, 2);
} else if (substr($field, 0, 1) === '-') {
return '-' . $this->extraprefix . substr($field, 1);
} else if (substr($field, 0, 1) === '_') {
... | php | public function add_prefix($field) {
if (substr($field, 0, 2) === '!_') {
return '-_' . $this->extraprefix . substr($field, 2);
} else if (substr($field, 0, 1) === '-') {
return '-' . $this->extraprefix . substr($field, 1);
} else if (substr($field, 0, 1) === '_') {
... | [
"public",
"function",
"add_prefix",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"field",
",",
"0",
",",
"2",
")",
"===",
"'!_'",
")",
"{",
"return",
"'-_'",
".",
"$",
"this",
"->",
"extraprefix",
".",
"substr",
"(",
"$",
"field",
... | Add the extra prefix to a field name.
@param string $field the plain field name.
@return string the field name with the extra bit of prefix added. | [
"Add",
"the",
"extra",
"prefix",
"to",
"a",
"field",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/questionattemptstep.php#L624-L634 |
214,831 | moodle/moodle | question/engine/questionattemptstep.php | question_attempt_step_subquestion_adapter.remove_prefix | public function remove_prefix($field) {
if (preg_match('~^(-?_?)' . preg_quote($this->extraprefix, '~') . '(.*)$~', $field, $matches)) {
return $matches[1] . $matches[2];
} else {
return null;
}
} | php | public function remove_prefix($field) {
if (preg_match('~^(-?_?)' . preg_quote($this->extraprefix, '~') . '(.*)$~', $field, $matches)) {
return $matches[1] . $matches[2];
} else {
return null;
}
} | [
"public",
"function",
"remove_prefix",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'~^(-?_?)'",
".",
"preg_quote",
"(",
"$",
"this",
"->",
"extraprefix",
",",
"'~'",
")",
".",
"'(.*)$~'",
",",
"$",
"field",
",",
"$",
"matches",
")",
")"... | Remove the extra prefix from a field name if it is present.
@param string $field the extended field name.
@return string the field name with the extra bit of prefix removed, or
null if the extre prefix was not present. | [
"Remove",
"the",
"extra",
"prefix",
"from",
"a",
"field",
"name",
"if",
"it",
"is",
"present",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/questionattemptstep.php#L642-L648 |
214,832 | moodle/moodle | question/engine/questionattemptstep.php | question_attempt_step_subquestion_adapter.filter_array | public function filter_array($data) {
$result = array();
foreach ($data as $fullname => $value) {
if ($name = $this->remove_prefix($fullname)) {
$result[$name] = $value;
}
}
return $result;
} | php | public function filter_array($data) {
$result = array();
foreach ($data as $fullname => $value) {
if ($name = $this->remove_prefix($fullname)) {
$result[$name] = $value;
}
}
return $result;
} | [
"public",
"function",
"filter_array",
"(",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"fullname",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"name",
"=",
"$",
"this",
"->",
"remov... | Filter some data to keep only those entries where the key contains
extraprefix, and remove the extra prefix from the reutrned arrary.
@param array $data some of the data stored in this step.
@return array the data with the keys ajusted using {@link remove_prefix()}. | [
"Filter",
"some",
"data",
"to",
"keep",
"only",
"those",
"entries",
"where",
"the",
"key",
"contains",
"extraprefix",
"and",
"remove",
"the",
"extra",
"prefix",
"from",
"the",
"reutrned",
"arrary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/questionattemptstep.php#L656-L664 |
214,833 | moodle/moodle | repository/youtube/lib.php | repository_youtube.init_youtube_service | private function init_youtube_service() {
global $CFG;
if (!isset($this->service)) {
require_once($CFG->libdir . '/google/lib.php');
$this->client = get_google_client();
$this->client->setDeveloperKey($this->apikey);
$this->client->setScopes(array(Google_... | php | private function init_youtube_service() {
global $CFG;
if (!isset($this->service)) {
require_once($CFG->libdir . '/google/lib.php');
$this->client = get_google_client();
$this->client->setDeveloperKey($this->apikey);
$this->client->setScopes(array(Google_... | [
"private",
"function",
"init_youtube_service",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"service",
")",
")",
"{",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/google/lib.php'",
")",
";",
"$"... | Init all the youtube client service stuff.
Instead of instantiating the service in the constructor, we delay
it until really neeed because it's really memory hungry (2MB). That
way the editor or any other artifact requiring repository instantiation
can do it in a cheap way. Sort of lazy loading the plugin. | [
"Init",
"all",
"the",
"youtube",
"client",
"service",
"stuff",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/youtube/lib.php#L83-L93 |
214,834 | moodle/moodle | repository/youtube/lib.php | repository_youtube.set_option | public function set_option($options = array()) {
if (!empty($options['apikey'])) {
set_config('apikey', trim($options['apikey']), 'youtube');
}
unset($options['apikey']);
return parent::set_option($options);
} | php | public function set_option($options = array()) {
if (!empty($options['apikey'])) {
set_config('apikey', trim($options['apikey']), 'youtube');
}
unset($options['apikey']);
return parent::set_option($options);
} | [
"public",
"function",
"set_option",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"'apikey'",
"]",
")",
")",
"{",
"set_config",
"(",
"'apikey'",
",",
"trim",
"(",
"$",
"options",
"[",
"'ap... | Save apikey in config table.
@param array $options
@return boolean | [
"Save",
"apikey",
"in",
"config",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/youtube/lib.php#L100-L106 |
214,835 | moodle/moodle | repository/youtube/lib.php | repository_youtube.get_option | public function get_option($config = '') {
if ($config === 'apikey') {
return trim(get_config('youtube', 'apikey'));
} else {
$options['apikey'] = trim(get_config('youtube', 'apikey'));
}
return parent::get_option($config);
} | php | public function get_option($config = '') {
if ($config === 'apikey') {
return trim(get_config('youtube', 'apikey'));
} else {
$options['apikey'] = trim(get_config('youtube', 'apikey'));
}
return parent::get_option($config);
} | [
"public",
"function",
"get_option",
"(",
"$",
"config",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"config",
"===",
"'apikey'",
")",
"{",
"return",
"trim",
"(",
"get_config",
"(",
"'youtube'",
",",
"'apikey'",
")",
")",
";",
"}",
"else",
"{",
"$",
"options... | Get apikey from config table.
@param string $config
@return mixed | [
"Get",
"apikey",
"from",
"config",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/youtube/lib.php#L114-L121 |
214,836 | moodle/moodle | repository/youtube/lib.php | repository_youtube.search | public function search($search_text, $page = 0) {
global $SESSION;
$sort = optional_param('youtube_sort', '', PARAM_TEXT);
$sess_keyword = 'youtube_'.$this->id.'_keyword';
$sess_sort = 'youtube_'.$this->id.'_sort';
// This is the request of another page for the last search, retr... | php | public function search($search_text, $page = 0) {
global $SESSION;
$sort = optional_param('youtube_sort', '', PARAM_TEXT);
$sess_keyword = 'youtube_'.$this->id.'_keyword';
$sess_sort = 'youtube_'.$this->id.'_sort';
// This is the request of another page for the last search, retr... | [
"public",
"function",
"search",
"(",
"$",
"search_text",
",",
"$",
"page",
"=",
"0",
")",
"{",
"global",
"$",
"SESSION",
";",
"$",
"sort",
"=",
"optional_param",
"(",
"'youtube_sort'",
",",
"''",
",",
"PARAM_TEXT",
")",
";",
"$",
"sess_keyword",
"=",
"... | Return search results
@param string $search_text
@return array | [
"Return",
"search",
"results"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/youtube/lib.php#L132-L168 |
214,837 | moodle/moodle | repository/youtube/lib.php | repository_youtube._get_collection | private function _get_collection($keyword, $start, $max, $sort) {
global $SESSION;
// The new API doesn't use "page" numbers for browsing through results.
// It uses a prev and next token in each set that you need to use to
// request the next page of results.
$sesspagetoken = '... | php | private function _get_collection($keyword, $start, $max, $sort) {
global $SESSION;
// The new API doesn't use "page" numbers for browsing through results.
// It uses a prev and next token in each set that you need to use to
// request the next page of results.
$sesspagetoken = '... | [
"private",
"function",
"_get_collection",
"(",
"$",
"keyword",
",",
"$",
"start",
",",
"$",
"max",
",",
"$",
"sort",
")",
"{",
"global",
"$",
"SESSION",
";",
"// The new API doesn't use \"page\" numbers for browsing through results.",
"// It uses a prev and next token in ... | Private method to get youtube search results
@param string $keyword
@param int $start
@param int $max max results
@param string $sort
@throws moodle_exception If the google API returns an error.
@return array | [
"Private",
"method",
"to",
"get",
"youtube",
"search",
"results"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/youtube/lib.php#L179-L235 |
214,838 | moodle/moodle | repository/youtube/lib.php | repository_youtube.print_login | public function print_login($ajax = true) {
$ret = array();
$search = new stdClass();
$search->type = 'text';
$search->id = 'youtube_search';
$search->name = 's';
$search->label = get_string('search', 'repository_youtube').': ';
$sort = new stdClass();
$... | php | public function print_login($ajax = true) {
$ret = array();
$search = new stdClass();
$search->type = 'text';
$search->id = 'youtube_search';
$search->name = 's';
$search->label = get_string('search', 'repository_youtube').': ';
$sort = new stdClass();
$... | [
"public",
"function",
"print_login",
"(",
"$",
"ajax",
"=",
"true",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"$",
"search",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"search",
"->",
"type",
"=",
"'text'",
";",
"$",
"search",
"->",
"id... | Generate search form | [
"Generate",
"search",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/youtube/lib.php#L251-L286 |
214,839 | moodle/moodle | repository/youtube/lib.php | repository_youtube.type_config_form | public static function type_config_form($mform, $classname = 'repository') {
parent::type_config_form($mform, $classname);
$apikey = get_config('youtube', 'apikey');
if (empty($apikey)) {
$apikey = '';
}
$mform->addElement('text', 'apikey', get_string('apikey', 'repo... | php | public static function type_config_form($mform, $classname = 'repository') {
parent::type_config_form($mform, $classname);
$apikey = get_config('youtube', 'apikey');
if (empty($apikey)) {
$apikey = '';
}
$mform->addElement('text', 'apikey', get_string('apikey', 'repo... | [
"public",
"static",
"function",
"type_config_form",
"(",
"$",
"mform",
",",
"$",
"classname",
"=",
"'repository'",
")",
"{",
"parent",
"::",
"type_config_form",
"(",
"$",
"mform",
",",
"$",
"classname",
")",
";",
"$",
"apikey",
"=",
"get_config",
"(",
"'yo... | Add plugin settings input to Moodle form.
@param object $mform
@param string $classname | [
"Add",
"plugin",
"settings",
"input",
"to",
"Moodle",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/youtube/lib.php#L318-L330 |
214,840 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Socket/Pop3.php | Horde_Imap_Client_Socket_Pop3._pop3Cache | protected function _pop3Cache(
$type, $index = self::MBOX_CACHE, $data = null
)
{
if (isset($this->_temp['pop3cache'][$index][$type])) {
if ($type == 'msg') {
rewind($this->_temp['pop3cache'][$index][$type]);
}
return $this->_temp['pop3cache'][... | php | protected function _pop3Cache(
$type, $index = self::MBOX_CACHE, $data = null
)
{
if (isset($this->_temp['pop3cache'][$index][$type])) {
if ($type == 'msg') {
rewind($this->_temp['pop3cache'][$index][$type]);
}
return $this->_temp['pop3cache'][... | [
"protected",
"function",
"_pop3Cache",
"(",
"$",
"type",
",",
"$",
"index",
"=",
"self",
"::",
"MBOX_CACHE",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_temp",
"[",
"'pop3cache'",
"]",
"[",
"$",
"index",
"... | Retrieve locally cached message data.
@param string $type Either 'hdr', 'hdrob', 'msg', 'size', 'stat',
'top', or 'uidl'.
@param integer $index The message index.
@param mixed $data Additional information needed.
@return mixed The cached data. 'msg' returns a stream resource. All
other types return strings.
... | [
"Retrieve",
"locally",
"cached",
"message",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Socket/Pop3.php#L1043-L1119 |
214,841 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Socket/Pop3.php | Horde_Imap_Client_Socket_Pop3._processString | protected function _processString($str, $opts)
{
if (!empty($opts['length'])) {
return substr($str, empty($opts['start']) ? 0 : $opts['start'], $opts['length']);
} elseif (!empty($opts['start'])) {
return substr($str, $opts['start']);
}
return $str;
} | php | protected function _processString($str, $opts)
{
if (!empty($opts['length'])) {
return substr($str, empty($opts['start']) ? 0 : $opts['start'], $opts['length']);
} elseif (!empty($opts['start'])) {
return substr($str, $opts['start']);
}
return $str;
} | [
"protected",
"function",
"_processString",
"(",
"$",
"str",
",",
"$",
"opts",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"opts",
"[",
"'length'",
"]",
")",
")",
"{",
"return",
"substr",
"(",
"$",
"str",
",",
"empty",
"(",
"$",
"opts",
"[",
"'st... | Process a string response based on criteria options.
@param string $str The original string.
@param array $opts The criteria options.
@return string The requested string. | [
"Process",
"a",
"string",
"response",
"based",
"on",
"criteria",
"options",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Socket/Pop3.php#L1129-L1138 |
214,842 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Socket/Pop3.php | Horde_Imap_Client_Socket_Pop3._sendLine | protected function _sendLine($cmd, $options = array())
{
if (!empty($options['debug'])) {
$this->_debug->client($options['debug']);
}
if ($this->_debug->debug) {
$timer = new Horde_Support_Timer();
$timer->push();
}
try {
$thi... | php | protected function _sendLine($cmd, $options = array())
{
if (!empty($options['debug'])) {
$this->_debug->client($options['debug']);
}
if ($this->_debug->debug) {
$timer = new Horde_Support_Timer();
$timer->push();
}
try {
$thi... | [
"protected",
"function",
"_sendLine",
"(",
"$",
"cmd",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"'debug'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"_debug",
"->",
"client",
"(",
"$",... | Perform a command on the server. A connection to the server must have
already been made.
@param string $cmd The command to execute.
@param array $options Additional options:
<pre>
- debug: (string) When debugging, send this string instead of the
actual command/data sent.
DEFAULT: Raw data output to debug stream.
... | [
"Perform",
"a",
"command",
"on",
"the",
"server",
".",
"A",
"connection",
"to",
"the",
"server",
"must",
"have",
"already",
"been",
"made",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Socket/Pop3.php#L1332-L1361 |
214,843 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Socket/Pop3.php | Horde_Imap_Client_Socket_Pop3._getSeqIds | protected function _getSeqIds(Horde_Imap_Client_Ids $ids)
{
if (!count($ids)) {
$status = $this->status($this->_selected, Horde_Imap_Client::STATUS_MESSAGES);
return range(1, $status['messages']);
} elseif ($ids->sequence) {
return $ids->ids;
}
re... | php | protected function _getSeqIds(Horde_Imap_Client_Ids $ids)
{
if (!count($ids)) {
$status = $this->status($this->_selected, Horde_Imap_Client::STATUS_MESSAGES);
return range(1, $status['messages']);
} elseif ($ids->sequence) {
return $ids->ids;
}
re... | [
"protected",
"function",
"_getSeqIds",
"(",
"Horde_Imap_Client_Ids",
"$",
"ids",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"ids",
")",
")",
"{",
"$",
"status",
"=",
"$",
"this",
"->",
"status",
"(",
"$",
"this",
"->",
"_selected",
",",
"Horde_Imap_C... | Returns a list of sequence IDs.
@param Horde_Imap_Client_Ids $ids The ID list.
@return array A list of sequence IDs. | [
"Returns",
"a",
"list",
"of",
"sequence",
"IDs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Socket/Pop3.php#L1499-L1509 |
214,844 | moodle/moodle | mod/assign/feedback/editpdf/classes/event/observer.php | observer.queue_conversion | protected static function queue_conversion($event) {
global $DB;
$submissionid = $event->other['submissionid'];
$submissionattempt = $event->other['submissionattempt'];
$fields = array( 'submissionid' => $submissionid, 'submissionattempt' => $submissionattempt);
$record = (objec... | php | protected static function queue_conversion($event) {
global $DB;
$submissionid = $event->other['submissionid'];
$submissionattempt = $event->other['submissionattempt'];
$fields = array( 'submissionid' => $submissionid, 'submissionattempt' => $submissionattempt);
$record = (objec... | [
"protected",
"static",
"function",
"queue_conversion",
"(",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"submissionid",
"=",
"$",
"event",
"->",
"other",
"[",
"'submissionid'",
"]",
";",
"$",
"submissionattempt",
"=",
"$",
"event",
"->",
"other"... | Queue the submission for processing.
@param \mod_assign\event\base $event The submission created/updated event. | [
"Queue",
"the",
"submission",
"for",
"processing",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/classes/event/observer.php#L53-L69 |
214,845 | moodle/moodle | lib/tablelib.php | flexible_table.export_class_instance | function export_class_instance($exportclass = null) {
if (!is_null($exportclass)) {
$this->started_output = true;
$this->exportclass = $exportclass;
$this->exportclass->table = $this;
} else if (is_null($this->exportclass) && !empty($this->download)) {
$th... | php | function export_class_instance($exportclass = null) {
if (!is_null($exportclass)) {
$this->started_output = true;
$this->exportclass = $exportclass;
$this->exportclass->table = $this;
} else if (is_null($this->exportclass) && !empty($this->download)) {
$th... | [
"function",
"export_class_instance",
"(",
"$",
"exportclass",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"exportclass",
")",
")",
"{",
"$",
"this",
"->",
"started_output",
"=",
"true",
";",
"$",
"this",
"->",
"exportclass",
"=",
"$",
"... | Get, and optionally set, the export class.
@param $exportclass (optional) if passed, set the table to use this export class.
@return table_default_export_format_parent the export class in use (after any set). | [
"Get",
"and",
"optionally",
"set",
"the",
"export",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L186-L198 |
214,846 | moodle/moodle | lib/tablelib.php | flexible_table.is_downloadable | function is_downloadable($downloadable = null) {
if ($downloadable !== null) {
$this->downloadable = $downloadable;
}
return $this->downloadable;
} | php | function is_downloadable($downloadable = null) {
if ($downloadable !== null) {
$this->downloadable = $downloadable;
}
return $this->downloadable;
} | [
"function",
"is_downloadable",
"(",
"$",
"downloadable",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"downloadable",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"downloadable",
"=",
"$",
"downloadable",
";",
"}",
"return",
"$",
"this",
"->",
"downloadable",
"... | Probably don't need to call this directly. Calling is_downloading with a
param automatically sets table as downloadable.
@param bool $downloadable optional param to set whether data from
table is downloadable. If ommitted this function can be used to get
current state of table.
@return bool whether table data is set t... | [
"Probably",
"don",
"t",
"need",
"to",
"call",
"this",
"directly",
".",
"Calling",
"is_downloading",
"with",
"a",
"param",
"automatically",
"sets",
"table",
"as",
"downloadable",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L209-L214 |
214,847 | moodle/moodle | lib/tablelib.php | flexible_table.sortable | function sortable($bool, $defaultcolumn = NULL, $defaultorder = SORT_ASC) {
$this->is_sortable = $bool;
$this->sort_default_column = $defaultcolumn;
$this->sort_default_order = $defaultorder;
} | php | function sortable($bool, $defaultcolumn = NULL, $defaultorder = SORT_ASC) {
$this->is_sortable = $bool;
$this->sort_default_column = $defaultcolumn;
$this->sort_default_order = $defaultorder;
} | [
"function",
"sortable",
"(",
"$",
"bool",
",",
"$",
"defaultcolumn",
"=",
"NULL",
",",
"$",
"defaultorder",
"=",
"SORT_ASC",
")",
"{",
"$",
"this",
"->",
"is_sortable",
"=",
"$",
"bool",
";",
"$",
"this",
"->",
"sort_default_column",
"=",
"$",
"defaultco... | Sets the is_sortable variable to the given boolean, sort_default_column to
the given string, and the sort_default_order to the given integer.
@param bool $bool
@param string $defaultcolumn
@param int $defaultorder
@return void | [
"Sets",
"the",
"is_sortable",
"variable",
"to",
"the",
"given",
"boolean",
"sort_default_column",
"to",
"the",
"given",
"string",
"and",
"the",
"sort_default_order",
"to",
"the",
"given",
"integer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L248-L252 |
214,848 | moodle/moodle | lib/tablelib.php | flexible_table.is_sortable | function is_sortable($column = null) {
if (empty($column)) {
return $this->is_sortable;
}
if (!$this->is_sortable) {
return false;
}
return !in_array($column, $this->column_nosort);
} | php | function is_sortable($column = null) {
if (empty($column)) {
return $this->is_sortable;
}
if (!$this->is_sortable) {
return false;
}
return !in_array($column, $this->column_nosort);
} | [
"function",
"is_sortable",
"(",
"$",
"column",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"column",
")",
")",
"{",
"return",
"$",
"this",
"->",
"is_sortable",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"is_sortable",
")",
"{",
"return",... | Is the column sortable?
@param string column name, null means table
@return bool | [
"Is",
"the",
"column",
"sortable?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L277-L285 |
214,849 | moodle/moodle | lib/tablelib.php | flexible_table.pagesize | function pagesize($perpage, $total) {
$this->pagesize = $perpage;
$this->totalrows = $total;
$this->use_pages = true;
} | php | function pagesize($perpage, $total) {
$this->pagesize = $perpage;
$this->totalrows = $total;
$this->use_pages = true;
} | [
"function",
"pagesize",
"(",
"$",
"perpage",
",",
"$",
"total",
")",
"{",
"$",
"this",
"->",
"pagesize",
"=",
"$",
"perpage",
";",
"$",
"this",
"->",
"totalrows",
"=",
"$",
"total",
";",
"$",
"this",
"->",
"use_pages",
"=",
"true",
";",
"}"
] | Sets the pagesize variable to the given integer, the totalrows variable
to the given integer, and the use_pages variable to true.
@param int $perpage
@param int $total
@return void | [
"Sets",
"the",
"pagesize",
"variable",
"to",
"the",
"given",
"integer",
"the",
"totalrows",
"variable",
"to",
"the",
"given",
"integer",
"and",
"the",
"use_pages",
"variable",
"to",
"true",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L321-L325 |
214,850 | moodle/moodle | lib/tablelib.php | flexible_table.set_control_variables | function set_control_variables($variables) {
foreach ($variables as $what => $variable) {
if (isset($this->request[$what])) {
$this->request[$what] = $variable;
}
}
} | php | function set_control_variables($variables) {
foreach ($variables as $what => $variable) {
if (isset($this->request[$what])) {
$this->request[$what] = $variable;
}
}
} | [
"function",
"set_control_variables",
"(",
"$",
"variables",
")",
"{",
"foreach",
"(",
"$",
"variables",
"as",
"$",
"what",
"=>",
"$",
"variable",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"request",
"[",
"$",
"what",
"]",
")",
")",
"{",
... | Assigns each given variable in the array to the corresponding index
in the request class variable.
@param array $variables
@return void | [
"Assigns",
"each",
"given",
"variable",
"in",
"the",
"array",
"to",
"the",
"corresponding",
"index",
"in",
"the",
"request",
"class",
"variable",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L333-L339 |
214,851 | moodle/moodle | lib/tablelib.php | flexible_table.column_suppress | function column_suppress($column) {
if (isset($this->column_suppress[$column])) {
$this->column_suppress[$column] = true;
}
} | php | function column_suppress($column) {
if (isset($this->column_suppress[$column])) {
$this->column_suppress[$column] = true;
}
} | [
"function",
"column_suppress",
"(",
"$",
"column",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"column_suppress",
"[",
"$",
"column",
"]",
")",
")",
"{",
"$",
"this",
"->",
"column_suppress",
"[",
"$",
"column",
"]",
"=",
"true",
";",
"}",
... | What this method does is set the column so that if the same data appears in
consecutive rows, then it is not repeated.
For example, in the quiz overview report, the fullname column is set to be suppressed, so
that when one student has made multiple attempts, their name is only printed in the row
for their first attemp... | [
"What",
"this",
"method",
"does",
"is",
"set",
"the",
"column",
"so",
"that",
"if",
"the",
"same",
"data",
"appears",
"in",
"consecutive",
"rows",
"then",
"it",
"is",
"not",
"repeated",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L360-L364 |
214,852 | moodle/moodle | lib/tablelib.php | flexible_table.construct_order_by | public static function construct_order_by($cols, $textsortcols=array()) {
global $DB;
$bits = array();
foreach ($cols as $column => $order) {
if (in_array($column, $textsortcols)) {
$column = $DB->sql_order_by_text($column);
}
if ($order == SO... | php | public static function construct_order_by($cols, $textsortcols=array()) {
global $DB;
$bits = array();
foreach ($cols as $column => $order) {
if (in_array($column, $textsortcols)) {
$column = $DB->sql_order_by_text($column);
}
if ($order == SO... | [
"public",
"static",
"function",
"construct_order_by",
"(",
"$",
"cols",
",",
"$",
"textsortcols",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"bits",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"cols",
"as",
"$",
"column",
... | Prepare an an order by clause from the list of columns to be sorted.
@param array $cols column name => SORT_ASC or SORT_DESC
@return SQL fragment that can be used in an ORDER BY clause. | [
"Prepare",
"an",
"an",
"order",
"by",
"clause",
"from",
"the",
"list",
"of",
"columns",
"to",
"be",
"sorted",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L609-L625 |
214,853 | moodle/moodle | lib/tablelib.php | flexible_table.format_and_add_array_of_rows | public function format_and_add_array_of_rows($rowstoadd, $finish = true) {
foreach ($rowstoadd as $row) {
if (is_null($row)) {
$this->add_separator();
} else {
$this->add_data_keyed($this->format_row($row));
}
}
if ($finish) {
... | php | public function format_and_add_array_of_rows($rowstoadd, $finish = true) {
foreach ($rowstoadd as $row) {
if (is_null($row)) {
$this->add_separator();
} else {
$this->add_data_keyed($this->format_row($row));
}
}
if ($finish) {
... | [
"public",
"function",
"format_and_add_array_of_rows",
"(",
"$",
"rowstoadd",
",",
"$",
"finish",
"=",
"true",
")",
"{",
"foreach",
"(",
"$",
"rowstoadd",
"as",
"$",
"row",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"row",
")",
")",
"{",
"$",
"this",
"... | Add a number of rows to the table at once. And optionally finish output after they have been added.
@param (object|array|null)[] $rowstoadd Array of rows to add to table, a null value in array adds a separator row. Or a
object or array is added to table. We expect properties for the row array as would be
passed to add... | [
"Add",
"a",
"number",
"of",
"rows",
"to",
"the",
"table",
"at",
"once",
".",
"And",
"optionally",
"finish",
"output",
"after",
"they",
"have",
"been",
"added",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L734-L745 |
214,854 | moodle/moodle | lib/tablelib.php | flexible_table.add_data | function add_data($row, $classname = '') {
if (!$this->setup) {
return false;
}
if (!$this->started_output) {
$this->start_output();
}
if ($this->exportclass!==null) {
if ($row === null) {
$this->exportclass->add_seperator();
... | php | function add_data($row, $classname = '') {
if (!$this->setup) {
return false;
}
if (!$this->started_output) {
$this->start_output();
}
if ($this->exportclass!==null) {
if ($row === null) {
$this->exportclass->add_seperator();
... | [
"function",
"add_data",
"(",
"$",
"row",
",",
"$",
"classname",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"setup",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"started_output",
")",
"{",
"$",
"this",
... | This method actually directly echoes the row passed to it now or adds it
to the download. If this is the first row and start_output has not
already been called this method also calls start_output to open the table
or send headers for the downloaded.
Can be used as before. print_html now calls finish_html to close table... | [
"This",
"method",
"actually",
"directly",
"echoes",
"the",
"row",
"passed",
"to",
"it",
"now",
"or",
"adds",
"it",
"to",
"the",
"download",
".",
"If",
"this",
"is",
"the",
"first",
"row",
"and",
"start_output",
"has",
"not",
"already",
"been",
"called",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L768-L785 |
214,855 | moodle/moodle | lib/tablelib.php | flexible_table.finish_output | function finish_output($closeexportclassdoc = true) {
if ($this->exportclass!==null) {
$this->exportclass->finish_table();
if ($closeexportclassdoc) {
$this->exportclass->finish_document();
}
} else {
$this->finish_html();
}
} | php | function finish_output($closeexportclassdoc = true) {
if ($this->exportclass!==null) {
$this->exportclass->finish_table();
if ($closeexportclassdoc) {
$this->exportclass->finish_document();
}
} else {
$this->finish_html();
}
} | [
"function",
"finish_output",
"(",
"$",
"closeexportclassdoc",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exportclass",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"exportclass",
"->",
"finish_table",
"(",
")",
";",
"if",
"(",
"$",
"closeexport... | You should call this to finish outputting the table data after adding
data to the table with add_data or add_data_keyed. | [
"You",
"should",
"call",
"this",
"to",
"finish",
"outputting",
"the",
"table",
"data",
"after",
"adding",
"data",
"to",
"the",
"table",
"with",
"add_data",
"or",
"add_data_keyed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L792-L801 |
214,856 | moodle/moodle | lib/tablelib.php | flexible_table.download_buttons | public function download_buttons() {
global $OUTPUT;
if ($this->is_downloadable() && !$this->is_downloading()) {
return $OUTPUT->download_dataformat_selector(get_string('downloadas', 'table'),
$this->baseurl->out_omit_querystring(), 'download', $this->baseurl->params());... | php | public function download_buttons() {
global $OUTPUT;
if ($this->is_downloadable() && !$this->is_downloading()) {
return $OUTPUT->download_dataformat_selector(get_string('downloadas', 'table'),
$this->baseurl->out_omit_querystring(), 'download', $this->baseurl->params());... | [
"public",
"function",
"download_buttons",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"$",
"this",
"->",
"is_downloadable",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"is_downloading",
"(",
")",
")",
"{",
"return",
"$",
"OUTPUT",
"->",
"downlo... | Get the html for the download buttons
Usually only use internally | [
"Get",
"the",
"html",
"for",
"the",
"download",
"buttons"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L1049-L1058 |
214,857 | moodle/moodle | lib/tablelib.php | flexible_table.start_output | function start_output() {
$this->started_output = true;
if ($this->exportclass!==null) {
$this->exportclass->start_table($this->sheettitle);
$this->exportclass->output_headers($this->headers);
} else {
$this->start_html();
$this->print_headers();
... | php | function start_output() {
$this->started_output = true;
if ($this->exportclass!==null) {
$this->exportclass->start_table($this->sheettitle);
$this->exportclass->output_headers($this->headers);
} else {
$this->start_html();
$this->print_headers();
... | [
"function",
"start_output",
"(",
")",
"{",
"$",
"this",
"->",
"started_output",
"=",
"true",
";",
"if",
"(",
"$",
"this",
"->",
"exportclass",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"exportclass",
"->",
"start_table",
"(",
"$",
"this",
"->",
"shee... | This function is not part of the public api.
You don't normally need to call this. It is called automatically when
needed when you start adding data to the table. | [
"This",
"function",
"is",
"not",
"part",
"of",
"the",
"public",
"api",
".",
"You",
"don",
"t",
"normally",
"need",
"to",
"call",
"this",
".",
"It",
"is",
"called",
"automatically",
"when",
"needed",
"when",
"you",
"start",
"adding",
"data",
"to",
"the",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L1066-L1076 |
214,858 | moodle/moodle | lib/tablelib.php | flexible_table.get_row_html | public function get_row_html($row, $classname = '') {
static $suppress_lastrow = NULL;
$rowclasses = array();
if ($classname) {
$rowclasses[] = $classname;
}
$rowid = $this->uniqueid . '_r' . $this->currentrow;
$html = '';
$html .= html_writer::star... | php | public function get_row_html($row, $classname = '') {
static $suppress_lastrow = NULL;
$rowclasses = array();
if ($classname) {
$rowclasses[] = $classname;
}
$rowid = $this->uniqueid . '_r' . $this->currentrow;
$html = '';
$html .= html_writer::star... | [
"public",
"function",
"get_row_html",
"(",
"$",
"row",
",",
"$",
"classname",
"=",
"''",
")",
"{",
"static",
"$",
"suppress_lastrow",
"=",
"NULL",
";",
"$",
"rowclasses",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"classname",
")",
"{",
"$",
"rowcl... | Generate html code for the passed row.
@param array $row Row data.
@param string $classname classes to add.
@return string $html html code for the row passed. | [
"Generate",
"html",
"code",
"for",
"the",
"passed",
"row",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L1093-L1151 |
214,859 | moodle/moodle | lib/tablelib.php | flexible_table.render_reset_button | protected function render_reset_button() {
if (!$this->can_be_reset()) {
return '';
}
$url = $this->baseurl->out(false, array($this->request[TABLE_VAR_RESET] => 1));
$html = html_writer::start_div('resettable mdl-right');
$html .= html_writer::link($url, get_strin... | php | protected function render_reset_button() {
if (!$this->can_be_reset()) {
return '';
}
$url = $this->baseurl->out(false, array($this->request[TABLE_VAR_RESET] => 1));
$html = html_writer::start_div('resettable mdl-right');
$html .= html_writer::link($url, get_strin... | [
"protected",
"function",
"render_reset_button",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"can_be_reset",
"(",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"url",
"=",
"$",
"this",
"->",
"baseurl",
"->",
"out",
"(",
"false",
",",
"array",
... | Generate the HTML for the table preferences reset button.
@return string HTML fragment, empty string if no need to reset | [
"Generate",
"the",
"HTML",
"for",
"the",
"table",
"preferences",
"reset",
"button",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L1425-L1438 |
214,860 | moodle/moodle | lib/tablelib.php | flexible_table.can_be_reset | protected function can_be_reset() {
// Loop through preferences and make sure they are empty or set to the default value.
foreach ($this->prefs as $prefname => $prefval) {
if ($prefname === 'sortby' and !empty($this->sort_default_column)) {
// Check if the actual sorting di... | php | protected function can_be_reset() {
// Loop through preferences and make sure they are empty or set to the default value.
foreach ($this->prefs as $prefname => $prefval) {
if ($prefname === 'sortby' and !empty($this->sort_default_column)) {
// Check if the actual sorting di... | [
"protected",
"function",
"can_be_reset",
"(",
")",
"{",
"// Loop through preferences and make sure they are empty or set to the default value.",
"foreach",
"(",
"$",
"this",
"->",
"prefs",
"as",
"$",
"prefname",
"=>",
"$",
"prefval",
")",
"{",
"if",
"(",
"$",
"prefnam... | Are there some table preferences that can be reset?
If true, then the "reset table preferences" widget should be displayed.
@return bool | [
"Are",
"there",
"some",
"table",
"preferences",
"that",
"can",
"be",
"reset?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L1447-L1473 |
214,861 | moodle/moodle | lib/tablelib.php | table_sql.set_count_sql | function set_count_sql($sql, array $params = NULL) {
$this->countsql = $sql;
$this->countparams = $params;
} | php | function set_count_sql($sql, array $params = NULL) {
$this->countsql = $sql;
$this->countparams = $params;
} | [
"function",
"set_count_sql",
"(",
"$",
"sql",
",",
"array",
"$",
"params",
"=",
"NULL",
")",
"{",
"$",
"this",
"->",
"countsql",
"=",
"$",
"sql",
";",
"$",
"this",
"->",
"countparams",
"=",
"$",
"params",
";",
"}"
] | This is only needed if you want to use different sql to count rows.
Used for example when perhaps all db JOINS are not needed when counting
records. You don't need to call this function the count_sql
will be generated automatically.
We need to count rows returned by the db seperately to the query itself
as we need to ... | [
"This",
"is",
"only",
"needed",
"if",
"you",
"want",
"to",
"use",
"different",
"sql",
"to",
"count",
"rows",
".",
"Used",
"for",
"example",
"when",
"perhaps",
"all",
"db",
"JOINS",
"are",
"not",
"needed",
"when",
"counting",
"records",
".",
"You",
"don",... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L1568-L1571 |
214,862 | moodle/moodle | lib/tablelib.php | table_default_export_format_parent.format_text | function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL) {
//use some whitespace to indicate where there was some line spacing.
$text = str_replace(array('</p>', "\n", "\r"), ' ', $text);
return strip_tags($text);
} | php | function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL) {
//use some whitespace to indicate where there was some line spacing.
$text = str_replace(array('</p>', "\n", "\r"), ' ', $text);
return strip_tags($text);
} | [
"function",
"format_text",
"(",
"$",
"text",
",",
"$",
"format",
"=",
"FORMAT_MOODLE",
",",
"$",
"options",
"=",
"NULL",
",",
"$",
"courseid",
"=",
"NULL",
")",
"{",
"//use some whitespace to indicate where there was some line spacing.",
"$",
"text",
"=",
"str_rep... | Given text in a variety of format codings, this function returns
the text as safe HTML or as plain text dependent on what is appropriate
for the download format. The default removes all tags. | [
"Given",
"text",
"in",
"a",
"variety",
"of",
"format",
"codings",
"this",
"function",
"returns",
"the",
"text",
"as",
"safe",
"HTML",
"or",
"as",
"plain",
"text",
"dependent",
"on",
"what",
"is",
"appropriate",
"for",
"the",
"download",
"format",
".",
"The... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/tablelib.php#L1720-L1724 |
214,863 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Data/Thread.php | Horde_Imap_Client_Data_Thread.getThread | public function getThread($index)
{
foreach ($this->_thread as $v) {
if (isset($v[$index])) {
reset($v);
$ob = new stdClass;
$ob->base = (count($v) > 1) ? key($v) : null;
$ob->last = false;
$levels = $out = array()... | php | public function getThread($index)
{
foreach ($this->_thread as $v) {
if (isset($v[$index])) {
reset($v);
$ob = new stdClass;
$ob->base = (count($v) > 1) ? key($v) : null;
$ob->last = false;
$levels = $out = array()... | [
"public",
"function",
"getThread",
"(",
"$",
"index",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_thread",
"as",
"$",
"v",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"v",
"[",
"$",
"index",
"]",
")",
")",
"{",
"reset",
"(",
"$",
"v",
")",
";"... | Returns the list of messages in a thread.
@param integer $index An index contained in the thread.
@return array Keys are indices, values are objects with the following
properties:
- base: (integer) Base ID of the thread. If null, thread is a single
message.
- last: (boolean) If true, this is the last index in the s... | [
"Returns",
"the",
"list",
"of",
"messages",
"in",
"a",
"thread",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Data/Thread.php#L85-L121 |
214,864 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Data/Thread.php | Horde_Imap_Client_Data_Thread._getAllIndices | protected function _getAllIndices()
{
$out = array();
foreach ($this->_thread as $val) {
$out += $val;
}
return array_keys($out);
} | php | protected function _getAllIndices()
{
$out = array();
foreach ($this->_thread as $val) {
$out += $val;
}
return array_keys($out);
} | [
"protected",
"function",
"_getAllIndices",
"(",
")",
"{",
"$",
"out",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_thread",
"as",
"$",
"val",
")",
"{",
"$",
"out",
"+=",
"$",
"val",
";",
"}",
"return",
"array_keys",
"(",
"$",
... | Return all indices.
@return array An array of indices. | [
"Return",
"all",
"indices",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Data/Thread.php#L158-L167 |
214,865 | moodle/moodle | question/type/calculatedmulti/question.php | qtype_calculatedmulti_calculate_helper.calculate_all_expressions | public static function calculate_all_expressions(
qtype_calculated_question_with_expressions $question) {
$question->questiontext = $question->vs->replace_expressions_in_text(
$question->questiontext);
$question->generalfeedback = $question->vs->replace_expressions_in_text(
... | php | public static function calculate_all_expressions(
qtype_calculated_question_with_expressions $question) {
$question->questiontext = $question->vs->replace_expressions_in_text(
$question->questiontext);
$question->generalfeedback = $question->vs->replace_expressions_in_text(
... | [
"public",
"static",
"function",
"calculate_all_expressions",
"(",
"qtype_calculated_question_with_expressions",
"$",
"question",
")",
"{",
"$",
"question",
"->",
"questiontext",
"=",
"$",
"question",
"->",
"vs",
"->",
"replace_expressions_in_text",
"(",
"$",
"question",... | Calculate all the exressions in a qtype_calculatedmulti_single_question
or qtype_calculatedmulti_multi_question.
@param unknown_type $question | [
"Calculate",
"all",
"the",
"exressions",
"in",
"a",
"qtype_calculatedmulti_single_question",
"or",
"qtype_calculatedmulti_multi_question",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculatedmulti/question.php#L147-L162 |
214,866 | moodle/moodle | user/classes/output/status_field.php | status_field.set_status | public function set_status($status = self::STATUS_ACTIVE) {
$this->statusactive = $status == static::STATUS_ACTIVE;
$this->statussuspended = $status == static::STATUS_SUSPENDED;
$this->statusnotcurrent = $status == static::STATUS_NOT_CURRENT;
return $this;
} | php | public function set_status($status = self::STATUS_ACTIVE) {
$this->statusactive = $status == static::STATUS_ACTIVE;
$this->statussuspended = $status == static::STATUS_SUSPENDED;
$this->statusnotcurrent = $status == static::STATUS_NOT_CURRENT;
return $this;
} | [
"public",
"function",
"set_status",
"(",
"$",
"status",
"=",
"self",
"::",
"STATUS_ACTIVE",
")",
"{",
"$",
"this",
"->",
"statusactive",
"=",
"$",
"status",
"==",
"static",
"::",
"STATUS_ACTIVE",
";",
"$",
"this",
"->",
"statussuspended",
"=",
"$",
"status... | Status setter.
@param int $status The user enrolment status representing one of this class' STATUS_* constants.
@return status_field This class' instance. Useful for chaining. | [
"Status",
"setter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/output/status_field.php#L164-L170 |
214,867 | moodle/moodle | files/classes/conversion.php | conversion.define_properties | protected static function define_properties() {
return array(
'sourcefileid' => [
'type' => PARAM_INT,
],
'targetformat' => [
'type' => PARAM_ALPHANUMEXT,
],
'status' => [
'type' => PARAM_INT,
... | php | protected static function define_properties() {
return array(
'sourcefileid' => [
'type' => PARAM_INT,
],
'targetformat' => [
'type' => PARAM_ALPHANUMEXT,
],
'status' => [
'type' => PARAM_INT,
... | [
"protected",
"static",
"function",
"define_properties",
"(",
")",
"{",
"return",
"array",
"(",
"'sourcefileid'",
"=>",
"[",
"'type'",
"=>",
"PARAM_INT",
",",
"]",
",",
"'targetformat'",
"=>",
"[",
"'type'",
"=>",
"PARAM_ALPHANUMEXT",
",",
"]",
",",
"'status'",... | Define properties.
@return array | [
"Define",
"properties",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/files/classes/conversion.php#L69-L108 |
214,868 | moodle/moodle | files/classes/conversion.php | conversion.get_conversions_for_file | public static function get_conversions_for_file(stored_file $file, $format) {
global $DB;
$instances = [];
// Conversion records are intended for tracking a conversion in progress or recently completed.
// The record is removed periodically, but the destination file is not.
// W... | php | public static function get_conversions_for_file(stored_file $file, $format) {
global $DB;
$instances = [];
// Conversion records are intended for tracking a conversion in progress or recently completed.
// The record is removed periodically, but the destination file is not.
// W... | [
"public",
"static",
"function",
"get_conversions_for_file",
"(",
"stored_file",
"$",
"file",
",",
"$",
"format",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"instances",
"=",
"[",
"]",
";",
"// Conversion records are intended for tracking a conversion in progress or recent... | Fetch all conversions relating to the specified file.
Only conversions which have a valid file are returned.
@param stored_file $file The source file being converted
@param string $format The targetforamt to filter to
@return conversion[] | [
"Fetch",
"all",
"conversions",
"relating",
"to",
"the",
"specified",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/files/classes/conversion.php#L119-L189 |
214,869 | moodle/moodle | files/classes/conversion.php | conversion.remove_orphan_records | public static function remove_orphan_records() {
global $DB;
$sql = "
SELECT c.id
FROM {" . self::TABLE . "} c
LEFT JOIN {files} f
ON f.id = c.sourcefileid
WHERE f.id IS NULL";
$ids = $DB->get_fieldset_sql($sql, []);
if (e... | php | public static function remove_orphan_records() {
global $DB;
$sql = "
SELECT c.id
FROM {" . self::TABLE . "} c
LEFT JOIN {files} f
ON f.id = c.sourcefileid
WHERE f.id IS NULL";
$ids = $DB->get_fieldset_sql($sql, []);
if (e... | [
"public",
"static",
"function",
"remove_orphan_records",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"\n SELECT c.id\n FROM {\"",
".",
"self",
"::",
"TABLE",
".",
"\"} c\n LEFT JOIN {files} f\n ON f.id = c.sourcef... | Remove orphan records.
Records are considered orphans when their source file not longer exists.
In this scenario we do not want to keep the converted file any longer,
in particular to be compliant with privacy laws. | [
"Remove",
"orphan",
"records",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/files/classes/conversion.php#L209-L226 |
214,870 | moodle/moodle | files/classes/conversion.php | conversion.get_file_record | protected function get_file_record() {
$file = $this->get_sourcefile();
if (!$file) {
// If the source file was removed before we completed, we must return early.
return false;
}
return [
'contextid' => \context_system::instance()->id,
'c... | php | protected function get_file_record() {
$file = $this->get_sourcefile();
if (!$file) {
// If the source file was removed before we completed, we must return early.
return false;
}
return [
'contextid' => \context_system::instance()->id,
'c... | [
"protected",
"function",
"get_file_record",
"(",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"get_sourcefile",
"(",
")",
";",
"if",
"(",
"!",
"$",
"file",
")",
"{",
"// If the source file was removed before we completed, we must return early.",
"return",
"false",... | Return the file record base for use in the files table.
@return array|bool | [
"Return",
"the",
"file",
"record",
"base",
"for",
"use",
"in",
"the",
"files",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/files/classes/conversion.php#L374-L390 |
214,871 | moodle/moodle | mod/wiki/diff/difflib.php | ouwiki_line.get_as_strings | static function get_as_strings($lines) {
$strings=array();
foreach($lines as $key=>$value) {
$strings[$key]=$value->get_as_string();
}
return $strings;
} | php | static function get_as_strings($lines) {
$strings=array();
foreach($lines as $key=>$value) {
$strings[$key]=$value->get_as_string();
}
return $strings;
} | [
"static",
"function",
"get_as_strings",
"(",
"$",
"lines",
")",
"{",
"$",
"strings",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"strings",
"[",
"$",
"key",
"]",
"=",
"$",
"value... | Static function converts lines to strings.
@param array $lines Array of ouwiki_line
@return array Array of strings | [
"Static",
"function",
"converts",
"lines",
"to",
"strings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/diff/difflib.php#L353-L359 |
214,872 | moodle/moodle | mod/assign/feedback/editpdf/classes/privacy/provider.php | provider.delete_feedback_for_grade | public static function delete_feedback_for_grade(assign_plugin_request_data $requestdata) {
$requestdata->set_userids([$requestdata->get_user()->id]);
$requestdata->populate_submissions_and_grades();
self::delete_feedback_for_grades($requestdata);
} | php | public static function delete_feedback_for_grade(assign_plugin_request_data $requestdata) {
$requestdata->set_userids([$requestdata->get_user()->id]);
$requestdata->populate_submissions_and_grades();
self::delete_feedback_for_grades($requestdata);
} | [
"public",
"static",
"function",
"delete_feedback_for_grade",
"(",
"assign_plugin_request_data",
"$",
"requestdata",
")",
"{",
"$",
"requestdata",
"->",
"set_userids",
"(",
"[",
"$",
"requestdata",
"->",
"get_user",
"(",
")",
"->",
"id",
"]",
")",
";",
"$",
"re... | Calling this function should delete all user data associated with this grade.
@param assign_plugin_request_data $requestdata Data useful for deleting user data. | [
"Calling",
"this",
"function",
"should",
"delete",
"all",
"user",
"data",
"associated",
"with",
"this",
"grade",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/classes/privacy/provider.php#L141-L145 |
214,873 | moodle/moodle | lib/behat/classes/behat_selectors.php | behat_selectors.get_behat_selector | public static function get_behat_selector($selectortype, $element, Behat\Mink\Session $session) {
// CSS and XPath selectors locator is one single argument.
if ($selectortype == 'css_element' || $selectortype == 'xpath_element') {
$selector = str_replace('_element', '', $selectortype);
... | php | public static function get_behat_selector($selectortype, $element, Behat\Mink\Session $session) {
// CSS and XPath selectors locator is one single argument.
if ($selectortype == 'css_element' || $selectortype == 'xpath_element') {
$selector = str_replace('_element', '', $selectortype);
... | [
"public",
"static",
"function",
"get_behat_selector",
"(",
"$",
"selectortype",
",",
"$",
"element",
",",
"Behat",
"\\",
"Mink",
"\\",
"Session",
"$",
"session",
")",
"{",
"// CSS and XPath selectors locator is one single argument.",
"if",
"(",
"$",
"selectortype",
... | Returns the behat selector and locator for a given moodle selector and locator
@param string $selectortype The moodle selector type, which includes moodle selectors
@param string $element The locator we look for in that kind of selector
@param Session $session The Mink opened session
@return array Contains the selecto... | [
"Returns",
"the",
"behat",
"selector",
"and",
"locator",
"for",
"a",
"given",
"moodle",
"selector",
"and",
"locator"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/classes/behat_selectors.php#L49-L76 |
214,874 | moodle/moodle | mod/workshop/allocation/random/lib.php | workshop_random_allocator.available_numofreviews_list | public static function available_numofreviews_list() {
$options = array();
$options[30] = 30;
$options[20] = 20;
$options[15] = 15;
for ($i = 10; $i >= 0; $i--) {
$options[$i] = $i;
}
return $options;
} | php | public static function available_numofreviews_list() {
$options = array();
$options[30] = 30;
$options[20] = 20;
$options[15] = 15;
for ($i = 10; $i >= 0; $i--) {
$options[$i] = $i;
}
return $options;
} | [
"public",
"static",
"function",
"available_numofreviews_list",
"(",
")",
"{",
"$",
"options",
"=",
"array",
"(",
")",
";",
"$",
"options",
"[",
"30",
"]",
"=",
"30",
";",
"$",
"options",
"[",
"20",
"]",
"=",
"20",
";",
"$",
"options",
"[",
"15",
"]... | Return an array of possible numbers of reviews to be done
Should contain numbers 1, 2, 3, ... 10 and possibly others up to a reasonable value
@return array of integers | [
"Return",
"an",
"array",
"of",
"possible",
"numbers",
"of",
"reviews",
"to",
"be",
"done"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/allocation/random/lib.php#L265-L274 |
214,875 | moodle/moodle | mod/workshop/allocation/random/lib.php | workshop_random_allocator.self_allocation | protected function self_allocation($authors=array(), $reviewers=array(), $assessments=array()) {
if (!isset($authors[0]) || !isset($reviewers[0])) {
// no authors or no reviewers
return array();
}
$alreadyallocated = array();
foreach ($assessments as $assessment) ... | php | protected function self_allocation($authors=array(), $reviewers=array(), $assessments=array()) {
if (!isset($authors[0]) || !isset($reviewers[0])) {
// no authors or no reviewers
return array();
}
$alreadyallocated = array();
foreach ($assessments as $assessment) ... | [
"protected",
"function",
"self_allocation",
"(",
"$",
"authors",
"=",
"array",
"(",
")",
",",
"$",
"reviewers",
"=",
"array",
"(",
")",
",",
"$",
"assessments",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"authors",
"[",
"0... | Allocates submissions to their authors for review
If the submission has already been allocated, it is skipped. If the author is not found among
reviewers, the submission is not assigned.
@param array $authors grouped of {@see workshop::get_potential_authors()}
@param array $reviewers grouped by {@see workshop::get_po... | [
"Allocates",
"submissions",
"to",
"their",
"authors",
"for",
"review"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/allocation/random/lib.php#L287-L310 |
214,876 | moodle/moodle | mod/workshop/allocation/random/lib.php | workshop_random_allocator.add_new_allocations | protected function add_new_allocations(array $newallocations, array $dataauthors, array $datareviewers) {
global $DB;
$newallocations = $this->get_unique_allocations($newallocations);
$authorids = $this->get_author_ids($newallocations);
$submissions = $this->workshop->get_submis... | php | protected function add_new_allocations(array $newallocations, array $dataauthors, array $datareviewers) {
global $DB;
$newallocations = $this->get_unique_allocations($newallocations);
$authorids = $this->get_author_ids($newallocations);
$submissions = $this->workshop->get_submis... | [
"protected",
"function",
"add_new_allocations",
"(",
"array",
"$",
"newallocations",
",",
"array",
"$",
"dataauthors",
",",
"array",
"$",
"datareviewers",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"newallocations",
"=",
"$",
"this",
"->",
"get_unique_allocations"... | Creates new assessment records
@param array $newallocations pairs 'reviewerid' => 'authorid'
@param array $dataauthors authors by group, group [0] contains all authors
@param array $datareviewers reviewers by group, group [0] contains all reviewers
@return bool | [
"Creates",
"new",
"assessment",
"records"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/allocation/random/lib.php#L320-L339 |
214,877 | moodle/moodle | mod/workshop/allocation/random/lib.php | workshop_random_allocator.index_submissions_by_authors | protected function index_submissions_by_authors($submissions) {
$byauthor = array();
if (is_array($submissions)) {
foreach ($submissions as $submissionid => $submission) {
if (isset($byauthor[$submission->authorid])) {
throw new moodle_exception('moresubmi... | php | protected function index_submissions_by_authors($submissions) {
$byauthor = array();
if (is_array($submissions)) {
foreach ($submissions as $submissionid => $submission) {
if (isset($byauthor[$submission->authorid])) {
throw new moodle_exception('moresubmi... | [
"protected",
"function",
"index_submissions_by_authors",
"(",
"$",
"submissions",
")",
"{",
"$",
"byauthor",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"submissions",
")",
")",
"{",
"foreach",
"(",
"$",
"submissions",
"as",
"$",
"submiss... | Flips the structure of submission so it is indexed by authorid attribute
It is the caller's responsibility to make sure the submissions are not teacher
examples so no user is the author of more submissions.
@param string $submissions array indexed by submission id
@return array indexed by author id | [
"Flips",
"the",
"structure",
"of",
"submission",
"so",
"it",
"is",
"indexed",
"by",
"authorid",
"attribute"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/allocation/random/lib.php#L350-L361 |
214,878 | moodle/moodle | mod/workshop/allocation/random/lib.php | workshop_random_allocator.get_author_ids | protected function get_author_ids($newallocations) {
$authors = array();
foreach ($newallocations as $newallocation) {
$authorid = reset($newallocation);
if (!in_array($authorid, $authors)) {
$authors[] = $authorid;
}
}
return $authors;... | php | protected function get_author_ids($newallocations) {
$authors = array();
foreach ($newallocations as $newallocation) {
$authorid = reset($newallocation);
if (!in_array($authorid, $authors)) {
$authors[] = $authorid;
}
}
return $authors;... | [
"protected",
"function",
"get_author_ids",
"(",
"$",
"newallocations",
")",
"{",
"$",
"authors",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"newallocations",
"as",
"$",
"newallocation",
")",
"{",
"$",
"authorid",
"=",
"reset",
"(",
"$",
"newallocati... | Extracts unique list of authors' IDs from the structure of new allocations
@param array $newallocations of pairs 'reviewerid' => 'authorid'
@return array of authorids | [
"Extracts",
"unique",
"list",
"of",
"authors",
"IDs",
"from",
"the",
"structure",
"of",
"new",
"allocations"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/allocation/random/lib.php#L369-L378 |
214,879 | moodle/moodle | mod/workshop/allocation/random/lib.php | workshop_random_allocator.get_unkept_assessments | protected function get_unkept_assessments($assessments, $newallocations, $keepselfassessments) {
$keepids = array(); // keep these assessments
foreach ($assessments as $assessmentid => $assessment) {
$aaid = $assessment->authorid;
$arid = $assessment->reviewerid;
if (... | php | protected function get_unkept_assessments($assessments, $newallocations, $keepselfassessments) {
$keepids = array(); // keep these assessments
foreach ($assessments as $assessmentid => $assessment) {
$aaid = $assessment->authorid;
$arid = $assessment->reviewerid;
if (... | [
"protected",
"function",
"get_unkept_assessments",
"(",
"$",
"assessments",
",",
"$",
"newallocations",
",",
"$",
"keepselfassessments",
")",
"{",
"$",
"keepids",
"=",
"array",
"(",
")",
";",
"// keep these assessments",
"foreach",
"(",
"$",
"assessments",
"as",
... | Returns the list of assessments to remove
If user selects "removecurrentallocations", we should remove all current assessment records
and insert new ones. But this would needlessly waste table ids. Instead, let us find only those
assessments that have not been re-allocated in this run of allocation. So, the once-alloc... | [
"Returns",
"the",
"list",
"of",
"assessments",
"to",
"remove"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/allocation/random/lib.php#L403-L423 |
214,880 | moodle/moodle | mod/workshop/allocation/random/lib.php | workshop_random_allocator.convert_assessments_to_links | protected function convert_assessments_to_links($assessments) {
$authorlinks = array(); // [authorid] => array(reviewerid, reviewerid, ...)
$reviewerlinks = array(); // [reviewerid] => array(authorid, authorid, ...)
foreach ($assessments as $assessment) {
if (!isset($authorli... | php | protected function convert_assessments_to_links($assessments) {
$authorlinks = array(); // [authorid] => array(reviewerid, reviewerid, ...)
$reviewerlinks = array(); // [reviewerid] => array(authorid, authorid, ...)
foreach ($assessments as $assessment) {
if (!isset($authorli... | [
"protected",
"function",
"convert_assessments_to_links",
"(",
"$",
"assessments",
")",
"{",
"$",
"authorlinks",
"=",
"array",
"(",
")",
";",
"// [authorid] => array(reviewerid, reviewerid, ...)",
"$",
"reviewerlinks",
"=",
"array",
"(",
")",
";",
"// [reviewerid] =>... | Extracts the information about reviews from the authors' and reviewers' perspectives
@param array $assessments array of assessments as returned by {@link workshop::get_all_assessments()}
@return array of two arrays | [
"Extracts",
"the",
"information",
"about",
"reviews",
"from",
"the",
"authors",
"and",
"reviewers",
"perspectives"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/allocation/random/lib.php#L631-L645 |
214,881 | moodle/moodle | mod/workshop/allocation/random/lib.php | workshop_random_allocator.get_element_with_lowest_workload | protected function get_element_with_lowest_workload($workload) {
$precision = 10;
if (empty($workload)) {
return false;
}
$minload = round(min($workload), $precision);
$minkeys = array();
foreach ($workload as $key => $val) {
if (round($val, $prec... | php | protected function get_element_with_lowest_workload($workload) {
$precision = 10;
if (empty($workload)) {
return false;
}
$minload = round(min($workload), $precision);
$minkeys = array();
foreach ($workload as $key => $val) {
if (round($val, $prec... | [
"protected",
"function",
"get_element_with_lowest_workload",
"(",
"$",
"workload",
")",
"{",
"$",
"precision",
"=",
"10",
";",
"if",
"(",
"empty",
"(",
"$",
"workload",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"minload",
"=",
"round",
"(",
"min",... | Selects an element with the lowest workload
If there are more elements with the same workload, choose one of them randomly. This may be
used to select a group or user.
@param array $workload [groupid] => (int)workload
@return mixed int|bool id of the selected element or false if it is impossible to choose | [
"Selects",
"an",
"element",
"with",
"the",
"lowest",
"workload"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/allocation/random/lib.php#L656-L670 |
214,882 | moodle/moodle | mod/workshop/allocation/random/lib.php | workshop_random_allocator.shuffle_assoc | protected function shuffle_assoc(&$array) {
if (count($array) > 1) {
// $keys needs to be an array, no need to shuffle 1 item or empty arrays, anyway
$keys = array_keys($array);
shuffle($keys);
foreach($keys as $key) {
$new[$key] = $array[$key];
... | php | protected function shuffle_assoc(&$array) {
if (count($array) > 1) {
// $keys needs to be an array, no need to shuffle 1 item or empty arrays, anyway
$keys = array_keys($array);
shuffle($keys);
foreach($keys as $key) {
$new[$key] = $array[$key];
... | [
"protected",
"function",
"shuffle_assoc",
"(",
"&",
"$",
"array",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"array",
")",
">",
"1",
")",
"{",
"// $keys needs to be an array, no need to shuffle 1 item or empty arrays, anyway",
"$",
"keys",
"=",
"array_keys",
"(",
"$"... | Shuffle the order of array elements preserving the key=>values
@param array $array to be shuffled
@return true | [
"Shuffle",
"the",
"order",
"of",
"array",
"elements",
"preserving",
"the",
"key",
"=",
">",
"values"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/allocation/random/lib.php#L678-L689 |
214,883 | moodle/moodle | mod/workshop/allocation/random/lib.php | workshop_random_allocator.filter_current_assessments | protected function filter_current_assessments(&$newallocations, $assessments) {
foreach ($assessments as $assessment) {
$allocation = array($assessment->reviewerid => $assessment->authorid);
$foundat = array_keys($newallocations, $allocation);
$newallocations = arr... | php | protected function filter_current_assessments(&$newallocations, $assessments) {
foreach ($assessments as $assessment) {
$allocation = array($assessment->reviewerid => $assessment->authorid);
$foundat = array_keys($newallocations, $allocation);
$newallocations = arr... | [
"protected",
"function",
"filter_current_assessments",
"(",
"&",
"$",
"newallocations",
",",
"$",
"assessments",
")",
"{",
"foreach",
"(",
"$",
"assessments",
"as",
"$",
"assessment",
")",
"{",
"$",
"allocation",
"=",
"array",
"(",
"$",
"assessment",
"->",
"... | Filter new allocations so that they do not contain an already existing assessment
@param mixed $newallocations array of ('reviewerid' => 'authorid') tuples
@param array $assessments array of assessment records
@return void | [
"Filter",
"new",
"allocations",
"so",
"that",
"they",
"do",
"not",
"contain",
"an",
"already",
"existing",
"assessment"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/allocation/random/lib.php#L698-L704 |
214,884 | moodle/moodle | mod/workshop/allocation/random/lib.php | workshop_random_allocator_setting.instance_from_object | public static function instance_from_object(stdClass $data) {
$i = new self();
if (!isset($data->numofreviews)) {
throw new coding_exception('Missing value of the numofreviews property');
} else {
$i->numofreviews = (int)$data->numofreviews;
}
if (!isset... | php | public static function instance_from_object(stdClass $data) {
$i = new self();
if (!isset($data->numofreviews)) {
throw new coding_exception('Missing value of the numofreviews property');
} else {
$i->numofreviews = (int)$data->numofreviews;
}
if (!isset... | [
"public",
"static",
"function",
"instance_from_object",
"(",
"stdClass",
"$",
"data",
")",
"{",
"$",
"i",
"=",
"new",
"self",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"->",
"numofreviews",
")",
")",
"{",
"throw",
"new",
"coding_excepti... | Factory method making the instance from data in the passed object
@param stdClass $data an object holding the values for our public properties
@return workshop_random_allocator_setting | [
"Factory",
"method",
"making",
"the",
"instance",
"from",
"data",
"in",
"the",
"passed",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/allocation/random/lib.php#L743-L770 |
214,885 | moodle/moodle | message/output/popup/classes/api.php | api.get_popup_notifications | public static function get_popup_notifications($useridto = 0, $sort = 'DESC', $limit = 0, $offset = 0) {
global $DB, $USER;
$sort = strtoupper($sort);
if ($sort != 'DESC' && $sort != 'ASC') {
throw new \moodle_exception('invalid parameter: sort: must be "DESC" or "ASC"');
}
... | php | public static function get_popup_notifications($useridto = 0, $sort = 'DESC', $limit = 0, $offset = 0) {
global $DB, $USER;
$sort = strtoupper($sort);
if ($sort != 'DESC' && $sort != 'ASC') {
throw new \moodle_exception('invalid parameter: sort: must be "DESC" or "ASC"');
}
... | [
"public",
"static",
"function",
"get_popup_notifications",
"(",
"$",
"useridto",
"=",
"0",
",",
"$",
"sort",
"=",
"'DESC'",
",",
"$",
"limit",
"=",
"0",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"sort"... | Get popup notifications for the specified users. Nothing is returned if notifications are disabled.
@param int $useridto the user id who received the notification
@param string $sort the column name to order by including optionally direction
@param int $limit limit the number of result returned
@param int $offset offs... | [
"Get",
"popup",
"notifications",
"for",
"the",
"specified",
"users",
".",
"Nothing",
"is",
"returned",
"if",
"notifications",
"are",
"disabled",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/popup/classes/api.php#L47-L89 |
214,886 | moodle/moodle | message/output/popup/classes/api.php | api.count_unread_popup_notifications | public static function count_unread_popup_notifications($useridto = 0) {
global $USER, $DB;
if (empty($useridto)) {
$useridto = $USER->id;
}
return $DB->count_records_sql(
"SELECT count(id)
FROM {notifications}
WHERE id IN (SELECT no... | php | public static function count_unread_popup_notifications($useridto = 0) {
global $USER, $DB;
if (empty($useridto)) {
$useridto = $USER->id;
}
return $DB->count_records_sql(
"SELECT count(id)
FROM {notifications}
WHERE id IN (SELECT no... | [
"public",
"static",
"function",
"count_unread_popup_notifications",
"(",
"$",
"useridto",
"=",
"0",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"useridto",
")",
")",
"{",
"$",
"useridto",
"=",
"$",
"USER",
"->",
... | Count the unread notifications for a user.
@param int $useridto the user id who received the notification
@return int count of the unread notifications
@since 3.2 | [
"Count",
"the",
"unread",
"notifications",
"for",
"a",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/popup/classes/api.php#L98-L113 |
214,887 | moodle/moodle | lib/mustache/src/Mustache/Parser.php | Mustache_Parser.parse | public function parse(array $tokens = array())
{
$this->lineNum = -1;
$this->lineTokens = 0;
$this->pragmas = $this->defaultPragmas;
$this->pragmaFilters = isset($this->pragmas[Mustache_Engine::PRAGMA_FILTERS]);
$this->pragmaBlocks = isset($this->pragmas[Mustache_Engi... | php | public function parse(array $tokens = array())
{
$this->lineNum = -1;
$this->lineTokens = 0;
$this->pragmas = $this->defaultPragmas;
$this->pragmaFilters = isset($this->pragmas[Mustache_Engine::PRAGMA_FILTERS]);
$this->pragmaBlocks = isset($this->pragmas[Mustache_Engi... | [
"public",
"function",
"parse",
"(",
"array",
"$",
"tokens",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"lineNum",
"=",
"-",
"1",
";",
"$",
"this",
"->",
"lineTokens",
"=",
"0",
";",
"$",
"this",
"->",
"pragmas",
"=",
"$",
"this",
"->",
... | Process an array of Mustache tokens and convert them into a parse tree.
@param array $tokens Set of Mustache tokens
@return array Mustache token parse tree | [
"Process",
"an",
"array",
"of",
"Mustache",
"tokens",
"and",
"convert",
"them",
"into",
"a",
"parse",
"tree",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Parser.php#L34-L44 |
214,888 | moodle/moodle | lib/mustache/src/Mustache/Parser.php | Mustache_Parser.clearStandaloneLines | private function clearStandaloneLines(array &$nodes, array &$tokens)
{
if ($this->lineTokens > 1) {
// this is the third or later node on this line, so it can't be standalone
return;
}
$prev = null;
if ($this->lineTokens === 1) {
// this is the se... | php | private function clearStandaloneLines(array &$nodes, array &$tokens)
{
if ($this->lineTokens > 1) {
// this is the third or later node on this line, so it can't be standalone
return;
}
$prev = null;
if ($this->lineTokens === 1) {
// this is the se... | [
"private",
"function",
"clearStandaloneLines",
"(",
"array",
"&",
"$",
"nodes",
",",
"array",
"&",
"$",
"tokens",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"lineTokens",
">",
"1",
")",
"{",
"// this is the third or later node on this line, so it can't be standalone",
... | Clear standalone line tokens.
Returns a whitespace token for indenting partials, if applicable.
@param array $nodes Parsed nodes
@param array $tokens Tokens to be parsed
@return array|null Resulting indent token, if any | [
"Clear",
"standalone",
"line",
"tokens",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Parser.php#L203-L248 |
214,889 | moodle/moodle | lib/mustache/src/Mustache/Parser.php | Mustache_Parser.tokenIsWhitespace | private function tokenIsWhitespace(array $token)
{
if ($token[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_TEXT) {
return preg_match('/^\s*$/', $token[Mustache_Tokenizer::VALUE]);
}
return false;
} | php | private function tokenIsWhitespace(array $token)
{
if ($token[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_TEXT) {
return preg_match('/^\s*$/', $token[Mustache_Tokenizer::VALUE]);
}
return false;
} | [
"private",
"function",
"tokenIsWhitespace",
"(",
"array",
"$",
"token",
")",
"{",
"if",
"(",
"$",
"token",
"[",
"Mustache_Tokenizer",
"::",
"TYPE",
"]",
"===",
"Mustache_Tokenizer",
"::",
"T_TEXT",
")",
"{",
"return",
"preg_match",
"(",
"'/^\\s*$/'",
",",
"$... | Check whether token is a whitespace token.
True if token type is T_TEXT and value is all whitespace characters.
@param array $token
@return bool True if token is a whitespace token | [
"Check",
"whether",
"token",
"is",
"a",
"whitespace",
"token",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Parser.php#L259-L266 |
214,890 | moodle/moodle | lib/mustache/src/Mustache/Parser.php | Mustache_Parser.checkIfTokenIsAllowedInParent | private function checkIfTokenIsAllowedInParent($parent, array $token)
{
if ($parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) {
throw new Mustache_Exception_SyntaxException('Illegal content in < parent tag', $token);
}
} | php | private function checkIfTokenIsAllowedInParent($parent, array $token)
{
if ($parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) {
throw new Mustache_Exception_SyntaxException('Illegal content in < parent tag', $token);
}
} | [
"private",
"function",
"checkIfTokenIsAllowedInParent",
"(",
"$",
"parent",
",",
"array",
"$",
"token",
")",
"{",
"if",
"(",
"$",
"parent",
"[",
"Mustache_Tokenizer",
"::",
"TYPE",
"]",
"===",
"Mustache_Tokenizer",
"::",
"T_PARENT",
")",
"{",
"throw",
"new",
... | Check whether a token is allowed inside a parent tag.
@throws Mustache_Exception_SyntaxException if an invalid token is found inside a parent tag
@param array|null $parent
@param array $token | [
"Check",
"whether",
"a",
"token",
"is",
"allowed",
"inside",
"a",
"parent",
"tag",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Parser.php#L276-L281 |
214,891 | moodle/moodle | lib/mustache/src/Mustache/Parser.php | Mustache_Parser.getNameAndFilters | private function getNameAndFilters($name)
{
$filters = array_map('trim', explode('|', $name));
$name = array_shift($filters);
return array($name, $filters);
} | php | private function getNameAndFilters($name)
{
$filters = array_map('trim', explode('|', $name));
$name = array_shift($filters);
return array($name, $filters);
} | [
"private",
"function",
"getNameAndFilters",
"(",
"$",
"name",
")",
"{",
"$",
"filters",
"=",
"array_map",
"(",
"'trim'",
",",
"explode",
"(",
"'|'",
",",
"$",
"name",
")",
")",
";",
"$",
"name",
"=",
"array_shift",
"(",
"$",
"filters",
")",
";",
"ret... | Split a tag name into name and filters.
@param string $name
@return array [Tag name, Array of filters] | [
"Split",
"a",
"tag",
"name",
"into",
"name",
"and",
"filters",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Parser.php#L290-L296 |
214,892 | moodle/moodle | lib/mustache/src/Mustache/Parser.php | Mustache_Parser.enablePragma | private function enablePragma($name)
{
$this->pragmas[$name] = true;
switch ($name) {
case Mustache_Engine::PRAGMA_BLOCKS:
$this->pragmaBlocks = true;
break;
case Mustache_Engine::PRAGMA_FILTERS:
$this->pragmaFilters = true;
... | php | private function enablePragma($name)
{
$this->pragmas[$name] = true;
switch ($name) {
case Mustache_Engine::PRAGMA_BLOCKS:
$this->pragmaBlocks = true;
break;
case Mustache_Engine::PRAGMA_FILTERS:
$this->pragmaFilters = true;
... | [
"private",
"function",
"enablePragma",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"pragmas",
"[",
"$",
"name",
"]",
"=",
"true",
";",
"switch",
"(",
"$",
"name",
")",
"{",
"case",
"Mustache_Engine",
"::",
"PRAGMA_BLOCKS",
":",
"$",
"this",
"->",
... | Enable a pragma.
@param string $name | [
"Enable",
"a",
"pragma",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Parser.php#L303-L316 |
214,893 | moodle/moodle | lib/ltiprovider/src/ToolProvider/Service/ToolSettings.php | ToolSettings.get | public function get($mode = self::MODE_CURRENT_LEVEL) {
$parameter = array();
if ($mode === self::MODE_ALL_LEVELS) {
$parameter['bubble'] = 'all';
} else if ($mode === self::MODE_DISTINCT_NAMES) {
$parameter['bubble'] = 'distinct';
}
$http = $this->send('... | php | public function get($mode = self::MODE_CURRENT_LEVEL) {
$parameter = array();
if ($mode === self::MODE_ALL_LEVELS) {
$parameter['bubble'] = 'all';
} else if ($mode === self::MODE_DISTINCT_NAMES) {
$parameter['bubble'] = 'distinct';
}
$http = $this->send('... | [
"public",
"function",
"get",
"(",
"$",
"mode",
"=",
"self",
"::",
"MODE_CURRENT_LEVEL",
")",
"{",
"$",
"parameter",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"mode",
"===",
"self",
"::",
"MODE_ALL_LEVELS",
")",
"{",
"$",
"parameter",
"[",
"'bubble'"... | Get the tool settings.
@param int $mode Mode for request (optional, default is current level only)
@return mixed The array of settings if successful, otherwise false | [
"Get",
"the",
"tool",
"settings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ltiprovider/src/ToolProvider/Service/ToolSettings.php#L85-L109 |
214,894 | moodle/moodle | lib/ltiprovider/src/ToolProvider/Service/ToolSettings.php | ToolSettings.set | public function set($settings) {
if (!$this->simple) {
if (is_a($this->source, 'ToolConsumer')) {
$type = 'ToolProxy';
} else if (is_a($this->source, 'ToolConsumer')) {
$type = 'ToolProxyBinding';
} else {
$type = 'LtiLink';
... | php | public function set($settings) {
if (!$this->simple) {
if (is_a($this->source, 'ToolConsumer')) {
$type = 'ToolProxy';
} else if (is_a($this->source, 'ToolConsumer')) {
$type = 'ToolProxyBinding';
} else {
$type = 'LtiLink';
... | [
"public",
"function",
"set",
"(",
"$",
"settings",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"simple",
")",
"{",
"if",
"(",
"is_a",
"(",
"$",
"this",
"->",
"source",
",",
"'ToolConsumer'",
")",
")",
"{",
"$",
"type",
"=",
"'ToolProxy'",
";",
"... | Set the tool settings.
@param array $settings An associative array of settings (optional, default is null)
@return HTTPMessage HTTP object containing request and response details | [
"Set",
"the",
"tool",
"settings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ltiprovider/src/ToolProvider/Service/ToolSettings.php#L118-L145 |
214,895 | moodle/moodle | mod/forum/classes/local/factories/manager.php | manager.get_capability_manager | public function get_capability_manager(forum_entity $forum) {
return new capability_manager(
$forum,
$this->legacydatamapperfactory->get_forum_data_mapper(),
$this->legacydatamapperfactory->get_discussion_data_mapper(),
$this->legacydatamapperfactory->get_post_dat... | php | public function get_capability_manager(forum_entity $forum) {
return new capability_manager(
$forum,
$this->legacydatamapperfactory->get_forum_data_mapper(),
$this->legacydatamapperfactory->get_discussion_data_mapper(),
$this->legacydatamapperfactory->get_post_dat... | [
"public",
"function",
"get_capability_manager",
"(",
"forum_entity",
"$",
"forum",
")",
"{",
"return",
"new",
"capability_manager",
"(",
"$",
"forum",
",",
"$",
"this",
"->",
"legacydatamapperfactory",
"->",
"get_forum_data_mapper",
"(",
")",
",",
"$",
"this",
"... | Create a capability manager for the given forum.
@param forum_entity $forum The forum to manage capabilities for
@return capability_manager | [
"Create",
"a",
"capability",
"manager",
"for",
"the",
"given",
"forum",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/manager.php#L64-L71 |
214,896 | moodle/moodle | auth/ldap/classes/task/sync_roles.php | sync_roles.execute | public function execute() {
global $DB;
if (is_enabled_auth('ldap')) {
$auth = get_auth_plugin('ldap');
$users = $DB->get_records('user', array('auth' => 'ldap'));
foreach ($users as $user) {
$auth->sync_roles($user);
}
}
} | php | public function execute() {
global $DB;
if (is_enabled_auth('ldap')) {
$auth = get_auth_plugin('ldap');
$users = $DB->get_records('user', array('auth' => 'ldap'));
foreach ($users as $user) {
$auth->sync_roles($user);
}
}
} | [
"public",
"function",
"execute",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"is_enabled_auth",
"(",
"'ldap'",
")",
")",
"{",
"$",
"auth",
"=",
"get_auth_plugin",
"(",
"'ldap'",
")",
";",
"$",
"users",
"=",
"$",
"DB",
"->",
"get_records",
"("... | Synchronise role assignments from LDAP. | [
"Synchronise",
"role",
"assignments",
"from",
"LDAP",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/ldap/classes/task/sync_roles.php#L50-L59 |
214,897 | moodle/moodle | lib/horde/framework/Horde/Secret.php | Horde_Secret.write | public function write($key, $message)
{
$message = strval($message);
return (strlen($key) && strlen($message))
? $this->_getCipherOb($key)->encrypt($message)
: '';
} | php | public function write($key, $message)
{
$message = strval($message);
return (strlen($key) && strlen($message))
? $this->_getCipherOb($key)->encrypt($message)
: '';
} | [
"public",
"function",
"write",
"(",
"$",
"key",
",",
"$",
"message",
")",
"{",
"$",
"message",
"=",
"strval",
"(",
"$",
"message",
")",
";",
"return",
"(",
"strlen",
"(",
"$",
"key",
")",
"&&",
"strlen",
"(",
"$",
"message",
")",
")",
"?",
"$",
... | Take a small piece of data and encrypt it with a key.
@param string $key The key to use for encryption.
@param string $message The plaintext message.
@return string The ciphertext message.
@throws Horde_Secret_Exception | [
"Take",
"a",
"small",
"piece",
"of",
"data",
"and",
"encrypt",
"it",
"with",
"a",
"key",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Secret.php#L71-L77 |
214,898 | moodle/moodle | lib/horde/framework/Horde/Secret.php | Horde_Secret._getCipherOb | protected function _getCipherOb($key)
{
if (!is_string($key)) {
throw new Horde_Secret_Exception('Key must be a string', Horde_Secret_Exception::KEY_NOT_STRING);
}
if (!strlen($key)) {
throw new Horde_Secret_Exception('Key must be non-zero.', Horde_Secret_Exception::... | php | protected function _getCipherOb($key)
{
if (!is_string($key)) {
throw new Horde_Secret_Exception('Key must be a string', Horde_Secret_Exception::KEY_NOT_STRING);
}
if (!strlen($key)) {
throw new Horde_Secret_Exception('Key must be non-zero.', Horde_Secret_Exception::... | [
"protected",
"function",
"_getCipherOb",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"Horde_Secret_Exception",
"(",
"'Key must be a string'",
",",
"Horde_Secret_Exception",
"::",
"KEY_NOT_STRING",
")",
... | Returns the cached crypt object.
@param string $key The key to use for [de|en]cryption. Only the first
56 bytes of this string is used.
@return Horde_Crypt_Blowfish The crypt object.
@throws Horde_Secret_Exception | [
"Returns",
"the",
"cached",
"crypt",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Secret.php#L105-L123 |
214,899 | moodle/moodle | lib/horde/framework/Horde/Secret.php | Horde_Secret.getKey | public function getKey($keyname = self::DEFAULT_KEY)
{
if (!isset($this->_keyCache[$keyname])) {
if (isset($_COOKIE[$keyname . '_key'])) {
$key = $_COOKIE[$keyname . '_key'];
} else {
$key = session_id();
$this->_setCookie($keyname, $ke... | php | public function getKey($keyname = self::DEFAULT_KEY)
{
if (!isset($this->_keyCache[$keyname])) {
if (isset($_COOKIE[$keyname . '_key'])) {
$key = $_COOKIE[$keyname . '_key'];
} else {
$key = session_id();
$this->_setCookie($keyname, $ke... | [
"public",
"function",
"getKey",
"(",
"$",
"keyname",
"=",
"self",
"::",
"DEFAULT_KEY",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_keyCache",
"[",
"$",
"keyname",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_COOKIE",
"[",
... | Return a secret key, either from a cookie, or if the cookie
isn't there, assume we are using a munged version of a known
base value.
@param string $keyname The name of the key to get.
@return string The secret key. | [
"Return",
"a",
"secret",
"key",
"either",
"from",
"a",
"cookie",
"or",
"if",
"the",
"cookie",
"isn",
"t",
"there",
"assume",
"we",
"are",
"using",
"a",
"munged",
"version",
"of",
"a",
"known",
"base",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Secret.php#L165-L179 |
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.