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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
220,100 | moodle/moodle | tag/classes/area.php | core_tag_area.create | protected static function create($record) {
global $DB;
if (empty($record->tagcollid)) {
$record->tagcollid = core_tag_collection::get_default();
}
$DB->insert_record('tag_area', array('component' => $record->component,
'itemtype' => $record->itemtype,
... | php | protected static function create($record) {
global $DB;
if (empty($record->tagcollid)) {
$record->tagcollid = core_tag_collection::get_default();
}
$DB->insert_record('tag_area', array('component' => $record->component,
'itemtype' => $record->itemtype,
... | [
"protected",
"static",
"function",
"create",
"(",
"$",
"record",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"record",
"->",
"tagcollid",
")",
")",
"{",
"$",
"record",
"->",
"tagcollid",
"=",
"core_tag_collection",
"::",
"get_defaul... | Create a new tag area
@param stdClass $record | [
"Create",
"a",
"new",
"tag",
"area"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/area.php#L236-L251 |
220,101 | moodle/moodle | tag/classes/area.php | core_tag_area.update | public static function update($existing, $data) {
global $DB;
$data = array_intersect_key((array)$data,
array('enabled' => 1, 'tagcollid' => 1,
'callback' => 1, 'callbackfile' => 1, 'showstandard' => 1,
'multiplecontexts' => 1));
foreach ($... | php | public static function update($existing, $data) {
global $DB;
$data = array_intersect_key((array)$data,
array('enabled' => 1, 'tagcollid' => 1,
'callback' => 1, 'callbackfile' => 1, 'showstandard' => 1,
'multiplecontexts' => 1));
foreach ($... | [
"public",
"static",
"function",
"update",
"(",
"$",
"existing",
",",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"array_intersect_key",
"(",
"(",
"array",
")",
"$",
"data",
",",
"array",
"(",
"'enabled'",
"=>",
"1",
",",
"'tagc... | Update the tag area
@param stdClass $existing current record from DB table tag_area
@param array|stdClass $data fields that need updating | [
"Update",
"the",
"tag",
"area"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/area.php#L259-L283 |
220,102 | moodle/moodle | tag/classes/area.php | core_tag_area.uninstall | public static function uninstall($pluginname) {
global $DB;
list($a, $b) = core_component::normalize_component($pluginname);
if (empty($b) || $a === 'core') {
throw new coding_exception('Core component can not be uninstalled');
}
$component = $a . '_' . $b;
... | php | public static function uninstall($pluginname) {
global $DB;
list($a, $b) = core_component::normalize_component($pluginname);
if (empty($b) || $a === 'core') {
throw new coding_exception('Core component can not be uninstalled');
}
$component = $a . '_' . $b;
... | [
"public",
"static",
"function",
"uninstall",
"(",
"$",
"pluginname",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"core_component",
"::",
"normalize_component",
"(",
"$",
"pluginname",
")",
";",
"if",
"(",
"empty"... | Deletes all tag areas, collections and instances associated with the plugin.
@param string $pluginname | [
"Deletes",
"all",
"tag",
"areas",
"collections",
"and",
"instances",
"associated",
"with",
"the",
"plugin",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/area.php#L386-L400 |
220,103 | moodle/moodle | lib/simplepie/library/SimplePie/Misc.php | SimplePie_Misc.change_encoding | public static function change_encoding($data, $input, $output)
{
$input = SimplePie_Misc::encoding($input);
$output = SimplePie_Misc::encoding($output);
// We fail to fail on non US-ASCII bytes
if ($input === 'US-ASCII')
{
static $non_ascii_octects = '';
if (!$non_ascii_octects)
{
for ($i = 0x8... | php | public static function change_encoding($data, $input, $output)
{
$input = SimplePie_Misc::encoding($input);
$output = SimplePie_Misc::encoding($output);
// We fail to fail on non US-ASCII bytes
if ($input === 'US-ASCII')
{
static $non_ascii_octects = '';
if (!$non_ascii_octects)
{
for ($i = 0x8... | [
"public",
"static",
"function",
"change_encoding",
"(",
"$",
"data",
",",
"$",
"input",
",",
"$",
"output",
")",
"{",
"$",
"input",
"=",
"SimplePie_Misc",
"::",
"encoding",
"(",
"$",
"input",
")",
";",
"$",
"output",
"=",
"SimplePie_Misc",
"::",
"encodin... | Change a string from one encoding to another
@param string $data Raw data in $input encoding
@param string $input Encoding of $data
@param string $output Encoding you want
@return string|boolean False if we can't convert it | [
"Change",
"a",
"string",
"from",
"one",
"encoding",
"to",
"another"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Misc.php#L307-L351 |
220,104 | moodle/moodle | lib/simplepie/library/SimplePie/Misc.php | SimplePie_Misc.strip_comments | public static function strip_comments($data)
{
$output = '';
while (($start = strpos($data, '<!--')) !== false)
{
$output .= substr($data, 0, $start);
if (($end = strpos($data, '-->', $start)) !== false)
{
$data = substr_replace($data, '', 0, $end + 3);
}
else
{
$data = '';
}
}
r... | php | public static function strip_comments($data)
{
$output = '';
while (($start = strpos($data, '<!--')) !== false)
{
$output .= substr($data, 0, $start);
if (($end = strpos($data, '-->', $start)) !== false)
{
$data = substr_replace($data, '', 0, $end + 3);
}
else
{
$data = '';
}
}
r... | [
"public",
"static",
"function",
"strip_comments",
"(",
"$",
"data",
")",
"{",
"$",
"output",
"=",
"''",
";",
"while",
"(",
"(",
"$",
"start",
"=",
"strpos",
"(",
"$",
"data",
",",
"'<!--'",
")",
")",
"!==",
"false",
")",
"{",
"$",
"output",
".=",
... | Strip HTML comments
@param string $data Data to strip comments from
@return string Comment stripped string | [
"Strip",
"HTML",
"comments"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Misc.php#L1758-L1774 |
220,105 | moodle/moodle | lib/simplepie/library/SimplePie/Misc.php | SimplePie_Misc.uncomment_rfc822 | public static function uncomment_rfc822($string)
{
$string = (string) $string;
$position = 0;
$length = strlen($string);
$depth = 0;
$output = '';
while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
{
$output .= substr($string, $position, $pos - $position);
$position... | php | public static function uncomment_rfc822($string)
{
$string = (string) $string;
$position = 0;
$length = strlen($string);
$depth = 0;
$output = '';
while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
{
$output .= substr($string, $position, $pos - $position);
$position... | [
"public",
"static",
"function",
"uncomment_rfc822",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"(",
"string",
")",
"$",
"string",
";",
"$",
"position",
"=",
"0",
";",
"$",
"length",
"=",
"strlen",
"(",
"$",
"string",
")",
";",
"$",
"depth",
... | Remove RFC822 comments
@param string $data Data to strip comments from
@return string Comment stripped string | [
"Remove",
"RFC822",
"comments"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Misc.php#L1801-L1853 |
220,106 | moodle/moodle | lib/simplepie/library/SimplePie/Misc.php | SimplePie_Misc.codepoint_to_utf8 | public static function codepoint_to_utf8($codepoint)
{
$codepoint = (int) $codepoint;
if ($codepoint < 0)
{
return false;
}
else if ($codepoint <= 0x7f)
{
return chr($codepoint);
}
else if ($codepoint <= 0x7ff)
{
return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
}
e... | php | public static function codepoint_to_utf8($codepoint)
{
$codepoint = (int) $codepoint;
if ($codepoint < 0)
{
return false;
}
else if ($codepoint <= 0x7f)
{
return chr($codepoint);
}
else if ($codepoint <= 0x7ff)
{
return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
}
e... | [
"public",
"static",
"function",
"codepoint_to_utf8",
"(",
"$",
"codepoint",
")",
"{",
"$",
"codepoint",
"=",
"(",
"int",
")",
"$",
"codepoint",
";",
"if",
"(",
"$",
"codepoint",
"<",
"0",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"$",... | Converts a unicode codepoint to a UTF-8 character
@static
@param int $codepoint Unicode codepoint
@return string UTF-8 character | [
"Converts",
"a",
"unicode",
"codepoint",
"to",
"a",
"UTF",
"-",
"8",
"character"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Misc.php#L1987-L2015 |
220,107 | moodle/moodle | lib/simplepie/library/SimplePie/Misc.php | SimplePie_Misc.debug | public static function debug(&$sp)
{
$info = 'SimplePie ' . SIMPLEPIE_VERSION . ' Build ' . SIMPLEPIE_BUILD . "\n";
$info .= 'PHP ' . PHP_VERSION . "\n";
if ($sp->error() !== null)
{
$info .= 'Error occurred: ' . $sp->error() . "\n";
}
else
{
$info .= "No error found.\n";
}
$info .= "Extensions... | php | public static function debug(&$sp)
{
$info = 'SimplePie ' . SIMPLEPIE_VERSION . ' Build ' . SIMPLEPIE_BUILD . "\n";
$info .= 'PHP ' . PHP_VERSION . "\n";
if ($sp->error() !== null)
{
$info .= 'Error occurred: ' . $sp->error() . "\n";
}
else
{
$info .= "No error found.\n";
}
$info .= "Extensions... | [
"public",
"static",
"function",
"debug",
"(",
"&",
"$",
"sp",
")",
"{",
"$",
"info",
"=",
"'SimplePie '",
".",
"SIMPLEPIE_VERSION",
".",
"' Build '",
".",
"SIMPLEPIE_BUILD",
".",
"\"\\n\"",
";",
"$",
"info",
".=",
"'PHP '",
".",
"PHP_VERSION",
".",
"\"\\n\... | Format debugging information | [
"Format",
"debugging",
"information"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Misc.php#L2227-L2272 |
220,108 | moodle/moodle | blocks/activity_results/block_activity_results.php | block_activity_results.get_owning_activity | public function get_owning_activity() {
global $DB;
// Set some defaults.
$result = new stdClass();
$result->id = 0;
if (empty($this->instance->parentcontextid)) {
return $result;
}
$parentcontext = context::instance_by_id($this->instance->parentcont... | php | public function get_owning_activity() {
global $DB;
// Set some defaults.
$result = new stdClass();
$result->id = 0;
if (empty($this->instance->parentcontextid)) {
return $result;
}
$parentcontext = context::instance_by_id($this->instance->parentcont... | [
"public",
"function",
"get_owning_activity",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"// Set some defaults.",
"$",
"result",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"result",
"->",
"id",
"=",
"0",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
... | If this block belongs to a activity context, then return that activity's id.
Otherwise, return 0.
@return stdclass the activity record. | [
"If",
"this",
"block",
"belongs",
"to",
"a",
"activity",
"context",
"then",
"return",
"that",
"activity",
"s",
"id",
".",
"Otherwise",
"return",
"0",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/activity_results/block_activity_results.php#L81-L109 |
220,109 | moodle/moodle | blocks/activity_results/block_activity_results.php | block_activity_results.instance_config_save | public function instance_config_save($data, $nolongerused = false) {
global $DB;
if (empty($data->activitygradeitemid)) {
// Figure out info about parent module.
$info = $this->get_owning_activity();
$data->activitygradeitemid = $info->id;
if ($info->id < ... | php | public function instance_config_save($data, $nolongerused = false) {
global $DB;
if (empty($data->activitygradeitemid)) {
// Figure out info about parent module.
$info = $this->get_owning_activity();
$data->activitygradeitemid = $info->id;
if ($info->id < ... | [
"public",
"function",
"instance_config_save",
"(",
"$",
"data",
",",
"$",
"nolongerused",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"data",
"->",
"activitygradeitemid",
")",
")",
"{",
"// Figure out info about parent modul... | Used to save the form config data
@param stdclass $data
@param bool $nolongerused | [
"Used",
"to",
"save",
"the",
"form",
"config",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/activity_results/block_activity_results.php#L116-L137 |
220,110 | moodle/moodle | blocks/activity_results/block_activity_results.php | block_activity_results.activity_format_grade | private function activity_format_grade($grade) {
if (is_null($grade)) {
return get_string('notyetgraded', 'block_activity_results');
}
return format_float($grade, $this->config->decimalpoints);
} | php | private function activity_format_grade($grade) {
if (is_null($grade)) {
return get_string('notyetgraded', 'block_activity_results');
}
return format_float($grade, $this->config->decimalpoints);
} | [
"private",
"function",
"activity_format_grade",
"(",
"$",
"grade",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"grade",
")",
")",
"{",
"return",
"get_string",
"(",
"'notyetgraded'",
",",
"'block_activity_results'",
")",
";",
"}",
"return",
"format_float",
"(",
... | Formats the grade to the specified decimal points
@param float $grade
@return string | [
"Formats",
"the",
"grade",
"to",
"the",
"specified",
"decimal",
"points"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/activity_results/block_activity_results.php#L673-L678 |
220,111 | moodle/moodle | blocks/activity_results/block_activity_results.php | block_activity_results.activity_link | private function activity_link($activity, $cm) {
$o = html_writer::start_tag('h3');
$o .= html_writer::link(new moodle_url('/mod/'.$activity->itemmodule.'/view.php',
array('id' => $cm->id)), format_string(($activity->itemname), true, ['context' => context_module::instance($cm->id)]));
$... | php | private function activity_link($activity, $cm) {
$o = html_writer::start_tag('h3');
$o .= html_writer::link(new moodle_url('/mod/'.$activity->itemmodule.'/view.php',
array('id' => $cm->id)), format_string(($activity->itemname), true, ['context' => context_module::instance($cm->id)]));
$... | [
"private",
"function",
"activity_link",
"(",
"$",
"activity",
",",
"$",
"cm",
")",
"{",
"$",
"o",
"=",
"html_writer",
"::",
"start_tag",
"(",
"'h3'",
")",
";",
"$",
"o",
".=",
"html_writer",
"::",
"link",
"(",
"new",
"moodle_url",
"(",
"'/mod/'",
".",
... | Generates the Link to the activity module when displaed outside of the module
@param stdclass $activity
@param stdclass $cm
@return string | [
"Generates",
"the",
"Link",
"to",
"the",
"activity",
"module",
"when",
"displaed",
"outside",
"of",
"the",
"module"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/activity_results/block_activity_results.php#L686-L693 |
220,112 | moodle/moodle | blocks/activity_results/block_activity_results.php | block_activity_results.get_scale | private function get_scale($scaleid) {
global $DB;
$scaletext = $DB->get_field('scale', 'scale', array('id' => $scaleid), IGNORE_MISSING);
$scale = explode ( ',', $scaletext);
return $scale;
} | php | private function get_scale($scaleid) {
global $DB;
$scaletext = $DB->get_field('scale', 'scale', array('id' => $scaleid), IGNORE_MISSING);
$scale = explode ( ',', $scaletext);
return $scale;
} | [
"private",
"function",
"get_scale",
"(",
"$",
"scaleid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"scaletext",
"=",
"$",
"DB",
"->",
"get_field",
"(",
"'scale'",
",",
"'scale'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"scaleid",
")",
",",
"IGNORE_MISSING... | Generates a numeric array of scale entries
@param int $scaleid
@return array | [
"Generates",
"a",
"numeric",
"array",
"of",
"scale",
"entries"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/activity_results/block_activity_results.php#L700-L706 |
220,113 | moodle/moodle | lib/ltiprovider/src/ToolProvider/ResourceLink.php | ResourceLink.doSettingService | public function doSettingService($action, $value = null)
{
$response = false;
$this->extResponse = null;
switch ($action) {
case self::EXT_READ:
$do = 'basic-lti-loadsetting';
break;
case self::EXT_WRITE:
$do = 'basic-l... | php | public function doSettingService($action, $value = null)
{
$response = false;
$this->extResponse = null;
switch ($action) {
case self::EXT_READ:
$do = 'basic-lti-loadsetting';
break;
case self::EXT_WRITE:
$do = 'basic-l... | [
"public",
"function",
"doSettingService",
"(",
"$",
"action",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"false",
";",
"$",
"this",
"->",
"extResponse",
"=",
"null",
";",
"switch",
"(",
"$",
"action",
")",
"{",
"case",
"self",
":... | Perform a Setting service request.
@param int $action The action type constant
@param string $value The setting value (optional, default is null)
@return mixed The setting value for a read action, true if a write or delete action was successful, otherwise false | [
"Perform",
"a",
"Setting",
"service",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ltiprovider/src/ToolProvider/ResourceLink.php#L791-L841 |
220,114 | moodle/moodle | lib/ltiprovider/src/ToolProvider/ResourceLink.php | ResourceLink.hasMembershipService | public function hasMembershipService()
{
$has = !empty($this->contextId);
if ($has) {
$has = !empty($this->getContext()->getSetting('custom_context_memberships_url'));
}
return $has;
} | php | public function hasMembershipService()
{
$has = !empty($this->contextId);
if ($has) {
$has = !empty($this->getContext()->getSetting('custom_context_memberships_url'));
}
return $has;
} | [
"public",
"function",
"hasMembershipService",
"(",
")",
"{",
"$",
"has",
"=",
"!",
"empty",
"(",
"$",
"this",
"->",
"contextId",
")",
";",
"if",
"(",
"$",
"has",
")",
"{",
"$",
"has",
"=",
"!",
"empty",
"(",
"$",
"this",
"->",
"getContext",
"(",
... | Check if the Membership service is supported.
@return boolean True if this resource link supports the Membership service | [
"Check",
"if",
"the",
"Membership",
"service",
"is",
"supported",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ltiprovider/src/ToolProvider/ResourceLink.php#L899-L909 |
220,115 | moodle/moodle | lib/ltiprovider/src/ToolProvider/ResourceLink.php | ResourceLink.fromContext | public static function fromContext($context, $ltiResourceLinkId, $tempId = null)
{
$resourceLink = new ResourceLink();
$resourceLink->setContextId($context->getRecordId());
$resourceLink->context = $context;
$resourceLink->dataConnector = $context->getDataConnector();
$resou... | php | public static function fromContext($context, $ltiResourceLinkId, $tempId = null)
{
$resourceLink = new ResourceLink();
$resourceLink->setContextId($context->getRecordId());
$resourceLink->context = $context;
$resourceLink->dataConnector = $context->getDataConnector();
$resou... | [
"public",
"static",
"function",
"fromContext",
"(",
"$",
"context",
",",
"$",
"ltiResourceLinkId",
",",
"$",
"tempId",
"=",
"null",
")",
"{",
"$",
"resourceLink",
"=",
"new",
"ResourceLink",
"(",
")",
";",
"$",
"resourceLink",
"->",
"setContextId",
"(",
"$... | Class constructor from context.
@param Context $context Context object
@param string $ltiResourceLinkId Resource link ID value
@param string $tempId Temporary Resource link ID value (optional, default is null)
@return ResourceLink | [
"Class",
"constructor",
"from",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ltiprovider/src/ToolProvider/ResourceLink.php#L998-L1017 |
220,116 | moodle/moodle | analytics/classes/site.php | site.get_start | public function get_start() {
if (!empty($this->start)) {
return $this->start;
}
// Much faster than reading the first log in the site.
$admins = get_admins();
$this->start = 9999999999;
foreach ($admins as $admin) {
if ($admin->firstaccess < $thi... | php | public function get_start() {
if (!empty($this->start)) {
return $this->start;
}
// Much faster than reading the first log in the site.
$admins = get_admins();
$this->start = 9999999999;
foreach ($admins as $admin) {
if ($admin->firstaccess < $thi... | [
"public",
"function",
"get_start",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"start",
")",
")",
"{",
"return",
"$",
"this",
"->",
"start",
";",
"}",
"// Much faster than reading the first log in the site.",
"$",
"admins",
"=",
"get_admi... | Analysable start timestamp.
@return int | [
"Analysable",
"start",
"timestamp",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/site.php#L80-L94 |
220,117 | moodle/moodle | analytics/classes/site.php | site.get_end | public function get_end() {
if (!empty($this->end)) {
return $this->end;
}
$this->end = time();
return $this->end;
} | php | public function get_end() {
if (!empty($this->end)) {
return $this->end;
}
$this->end = time();
return $this->end;
} | [
"public",
"function",
"get_end",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"end",
")",
")",
"{",
"return",
"$",
"this",
"->",
"end",
";",
"}",
"$",
"this",
"->",
"end",
"=",
"time",
"(",
")",
";",
"return",
"$",
"this",
... | Analysable end timestamp.
@return int | [
"Analysable",
"end",
"timestamp",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/site.php#L101-L108 |
220,118 | moodle/moodle | lib/adodb/drivers/adodb-oci8po.inc.php | ADORecordset_oci8po._FetchField | function _FetchField($fieldOffset = -1)
{
$fld = new ADOFieldObject;
$fieldOffset += 1;
$fld->name = OCIcolumnname($this->_queryID, $fieldOffset);
if (ADODB_ASSOC_CASE == ADODB_ASSOC_CASE_LOWER) {
$fld->name = strtolower($fld->name);
}
$fld->type = OCIcolumntype($this->_queryID, $fieldOffset);
$fld->m... | php | function _FetchField($fieldOffset = -1)
{
$fld = new ADOFieldObject;
$fieldOffset += 1;
$fld->name = OCIcolumnname($this->_queryID, $fieldOffset);
if (ADODB_ASSOC_CASE == ADODB_ASSOC_CASE_LOWER) {
$fld->name = strtolower($fld->name);
}
$fld->type = OCIcolumntype($this->_queryID, $fieldOffset);
$fld->m... | [
"function",
"_FetchField",
"(",
"$",
"fieldOffset",
"=",
"-",
"1",
")",
"{",
"$",
"fld",
"=",
"new",
"ADOFieldObject",
";",
"$",
"fieldOffset",
"+=",
"1",
";",
"$",
"fld",
"->",
"name",
"=",
"OCIcolumnname",
"(",
"$",
"this",
"->",
"_queryID",
",",
"... | lowercase field names... | [
"lowercase",
"field",
"names",
"..."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-oci8po.inc.php#L137-L154 |
220,119 | moodle/moodle | search/classes/base.php | base.get_visible_name | public function get_visible_name($lazyload = false) {
$component = $this->componentname;
// Core subsystem strings go to lang/XX/search.php.
if ($this->componenttype === 'core') {
$component = 'search';
}
return get_string('search:' . $this->areaname, $component, nu... | php | public function get_visible_name($lazyload = false) {
$component = $this->componentname;
// Core subsystem strings go to lang/XX/search.php.
if ($this->componenttype === 'core') {
$component = 'search';
}
return get_string('search:' . $this->areaname, $component, nu... | [
"public",
"function",
"get_visible_name",
"(",
"$",
"lazyload",
"=",
"false",
")",
"{",
"$",
"component",
"=",
"$",
"this",
"->",
"componentname",
";",
"// Core subsystem strings go to lang/XX/search.php.",
"if",
"(",
"$",
"this",
"->",
"componenttype",
"===",
"'c... | Returns the area visible name.
@param bool $lazyload Usually false, unless when in admin settings.
@return string | [
"Returns",
"the",
"area",
"visible",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/base.php#L138-L147 |
220,120 | moodle/moodle | search/classes/base.php | base.get_config_var_name | public function get_config_var_name() {
if ($this->componenttype === 'core') {
// Core subsystems config in core_search and setting name using only [a-zA-Z0-9_]+.
$parts = \core_search\manager::extract_areaid_parts($this->areaid);
return array('core_search', $parts[0] . '_' ... | php | public function get_config_var_name() {
if ($this->componenttype === 'core') {
// Core subsystems config in core_search and setting name using only [a-zA-Z0-9_]+.
$parts = \core_search\manager::extract_areaid_parts($this->areaid);
return array('core_search', $parts[0] . '_' ... | [
"public",
"function",
"get_config_var_name",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"componenttype",
"===",
"'core'",
")",
"{",
"// Core subsystems config in core_search and setting name using only [a-zA-Z0-9_]+.",
"$",
"parts",
"=",
"\\",
"core_search",
"\\",
"ma... | Returns the config var name.
It depends on whether it is a moodle subsystem or a plugin as plugin-related config should remain in their own scope.
@access private
@return string Config var path including the plugin (or component) and the varname | [
"Returns",
"the",
"config",
"var",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/base.php#L157-L167 |
220,121 | moodle/moodle | search/classes/base.php | base.get_config | public function get_config() {
list($componentname, $varname) = $this->get_config_var_name();
$config = [];
$settingnames = self::get_settingnames();
foreach ($settingnames as $name) {
$config[$varname . $name] = get_config($componentname, $varname . $name);
}
... | php | public function get_config() {
list($componentname, $varname) = $this->get_config_var_name();
$config = [];
$settingnames = self::get_settingnames();
foreach ($settingnames as $name) {
$config[$varname . $name] = get_config($componentname, $varname . $name);
}
... | [
"public",
"function",
"get_config",
"(",
")",
"{",
"list",
"(",
"$",
"componentname",
",",
"$",
"varname",
")",
"=",
"$",
"this",
"->",
"get_config_var_name",
"(",
")",
";",
"$",
"config",
"=",
"[",
"]",
";",
"$",
"settingnames",
"=",
"self",
"::",
"... | Returns all the search area configuration.
@return array | [
"Returns",
"all",
"the",
"search",
"area",
"configuration",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/base.php#L174-L188 |
220,122 | moodle/moodle | search/classes/base.php | base.is_enabled | public function is_enabled() {
list($componentname, $varname) = $this->get_config_var_name();
$value = get_config($componentname, $varname . '_enabled');
// Search areas are enabled by default.
if ($value === false) {
$value = 1;
}
return (bool)$value;
} | php | public function is_enabled() {
list($componentname, $varname) = $this->get_config_var_name();
$value = get_config($componentname, $varname . '_enabled');
// Search areas are enabled by default.
if ($value === false) {
$value = 1;
}
return (bool)$value;
} | [
"public",
"function",
"is_enabled",
"(",
")",
"{",
"list",
"(",
"$",
"componentname",
",",
"$",
"varname",
")",
"=",
"$",
"this",
"->",
"get_config_var_name",
"(",
")",
";",
"$",
"value",
"=",
"get_config",
"(",
"$",
"componentname",
",",
"$",
"varname",... | Is the search component enabled by the system administrator?
@return bool | [
"Is",
"the",
"search",
"component",
"enabled",
"by",
"the",
"system",
"administrator?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/base.php#L205-L215 |
220,123 | moodle/moodle | search/classes/base.php | base.get_recordset_by_timestamp | public function get_recordset_by_timestamp($modifiedfrom = 0) {
$result = $this->get_document_recordset($modifiedfrom);
if ($result === false) {
throw new \coding_exception(
'Search area must implement get_document_recordset or get_recordset_by_timestamp');
}
... | php | public function get_recordset_by_timestamp($modifiedfrom = 0) {
$result = $this->get_document_recordset($modifiedfrom);
if ($result === false) {
throw new \coding_exception(
'Search area must implement get_document_recordset or get_recordset_by_timestamp');
}
... | [
"public",
"function",
"get_recordset_by_timestamp",
"(",
"$",
"modifiedfrom",
"=",
"0",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"get_document_recordset",
"(",
"$",
"modifiedfrom",
")",
";",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"thro... | Returns a recordset ordered by modification date ASC.
Each record can include any data self::get_document might need but it must:
- Include an 'id' field: Unique identifier (in this area's scope) of a document to index in the search engine
If the indexed content field can contain embedded files, the 'id' value should ... | [
"Returns",
"a",
"recordset",
"ordered",
"by",
"modification",
"date",
"ASC",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/base.php#L265-L272 |
220,124 | moodle/moodle | search/classes/base.php | base.get_course_level_context_restriction_sql | protected function get_course_level_context_restriction_sql(\context $context = null,
$coursetable, $paramtype = SQL_PARAMS_QM) {
global $DB;
if (!$context) {
return ['', []];
}
switch ($paramtype) {
case SQL_PARAMS_QM:
$param1 = '?';... | php | protected function get_course_level_context_restriction_sql(\context $context = null,
$coursetable, $paramtype = SQL_PARAMS_QM) {
global $DB;
if (!$context) {
return ['', []];
}
switch ($paramtype) {
case SQL_PARAMS_QM:
$param1 = '?';... | [
"protected",
"function",
"get_course_level_context_restriction_sql",
"(",
"\\",
"context",
"$",
"context",
"=",
"null",
",",
"$",
"coursetable",
",",
"$",
"paramtype",
"=",
"SQL_PARAMS_QM",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"$",
"context",
... | Helper function that gets SQL useful for restricting a search query given a passed-in
context, for data stored at course level.
The SQL returned will be zero or more JOIN statements, surrounded by whitespace, which act
as restrictions on the query based on the rows in a module table.
You can pass in a null or system ... | [
"Helper",
"function",
"that",
"gets",
"SQL",
"useful",
"for",
"restricting",
"a",
"search",
"query",
"given",
"a",
"passed",
"-",
"in",
"context",
"for",
"data",
"stored",
"at",
"course",
"level",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/search/classes/base.php#L455-L519 |
220,125 | moodle/moodle | question/classes/privacy/provider.php | provider.export_question_usage | public static function export_question_usage(
int $userid,
\context $context,
array $usagecontext,
int $usage,
\question_display_options $options,
bool $isowner
) {
// Determine the questions in this usage.
$quba = \question... | php | public static function export_question_usage(
int $userid,
\context $context,
array $usagecontext,
int $usage,
\question_display_options $options,
bool $isowner
) {
// Determine the questions in this usage.
$quba = \question... | [
"public",
"static",
"function",
"export_question_usage",
"(",
"int",
"$",
"userid",
",",
"\\",
"context",
"$",
"context",
",",
"array",
"$",
"usagecontext",
",",
"int",
"$",
"usage",
",",
"\\",
"question_display_options",
"$",
"options",
",",
"bool",
"$",
"i... | Export the data for all question attempts on this question usage.
Where a user is the owner of the usage, then the full detail of that usage will be included.
Where a user has been involved in the usage, but it is not their own usage, then only their specific
involvement will be exported.
@param int $us... | [
"Export",
"the",
"data",
"for",
"all",
"question",
"attempts",
"on",
"this",
"question",
"usage",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/privacy/provider.php#L151-L225 |
220,126 | moodle/moodle | question/classes/privacy/provider.php | provider.export_question_attempt_steps | public static function export_question_attempt_steps(
int $userid,
\context $context,
array $questionnocontext,
\question_attempt $qa,
\question_display_options $options,
$isowner
) {
$attemptdata = (object) [
'steps... | php | public static function export_question_attempt_steps(
int $userid,
\context $context,
array $questionnocontext,
\question_attempt $qa,
\question_display_options $options,
$isowner
) {
$attemptdata = (object) [
'steps... | [
"public",
"static",
"function",
"export_question_attempt_steps",
"(",
"int",
"$",
"userid",
",",
"\\",
"context",
"$",
"context",
",",
"array",
"$",
"questionnocontext",
",",
"\\",
"question_attempt",
"$",
"qa",
",",
"\\",
"question_display_options",
"$",
"options... | Export the data for each step transition for each question in each question attempt.
Where a user is the owner of the usage, then all steps in the question usage will be exported.
Where a user is not the owner, but has been involved in the usage, then only their specific
involvement will be exported.
@param int ... | [
"Export",
"the",
"data",
"for",
"each",
"step",
"transition",
"for",
"each",
"question",
"in",
"each",
"question",
"attempt",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/privacy/provider.php#L241-L325 |
220,127 | moodle/moodle | question/classes/privacy/provider.php | provider.get_related_question_usages_for_user | public static function get_related_question_usages_for_user(string $prefix, string $component, string $joinfield, int $userid) : \qubaid_join {
return new \qubaid_join("
JOIN {question_usages} {$prefix}_qu ON {$prefix}_qu.id = {$joinfield}
AND {$prefix}_qu.component = :{$prefix}... | php | public static function get_related_question_usages_for_user(string $prefix, string $component, string $joinfield, int $userid) : \qubaid_join {
return new \qubaid_join("
JOIN {question_usages} {$prefix}_qu ON {$prefix}_qu.id = {$joinfield}
AND {$prefix}_qu.component = :{$prefix}... | [
"public",
"static",
"function",
"get_related_question_usages_for_user",
"(",
"string",
"$",
"prefix",
",",
"string",
"$",
"component",
",",
"string",
"$",
"joinfield",
",",
"int",
"$",
"userid",
")",
":",
"\\",
"qubaid_join",
"{",
"return",
"new",
"\\",
"qubai... | Determine related question usages for a user.
@param string $prefix A unique prefix to add to the table alias
@param string $component The name of the component to fetch usages for.
@param string $joinfield The SQL field name to use in the JOIN ON - e.g. q.usageid
@param int ... | [
"Determine",
"related",
"question",
"usages",
"for",
"a",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/privacy/provider.php#L389-L401 |
220,128 | moodle/moodle | lib/adodb/adodb-datadict.inc.php | ADODB_DataDict.ExecuteSQLArray | function ExecuteSQLArray($sql, $continueOnError = true)
{
$rez = 2;
$conn = $this->connection;
$saved = $conn->debug;
foreach($sql as $line) {
if ($this->debug) $conn->debug = true;
$ok = $conn->Execute($line);
$conn->debug = $saved;
if (!$ok) {
if ($this->debug) ADOConnection::outp($conn->Err... | php | function ExecuteSQLArray($sql, $continueOnError = true)
{
$rez = 2;
$conn = $this->connection;
$saved = $conn->debug;
foreach($sql as $line) {
if ($this->debug) $conn->debug = true;
$ok = $conn->Execute($line);
$conn->debug = $saved;
if (!$ok) {
if ($this->debug) ADOConnection::outp($conn->Err... | [
"function",
"ExecuteSQLArray",
"(",
"$",
"sql",
",",
"$",
"continueOnError",
"=",
"true",
")",
"{",
"$",
"rez",
"=",
"2",
";",
"$",
"conn",
"=",
"$",
"this",
"->",
"connection",
";",
"$",
"saved",
"=",
"$",
"conn",
"->",
"debug",
";",
"foreach",
"(... | Executes the sql array returned by GetTableSQL and GetIndexSQL | [
"Executes",
"the",
"sql",
"array",
"returned",
"by",
"GetTableSQL",
"and",
"GetIndexSQL"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-datadict.inc.php#L372-L389 |
220,129 | moodle/moodle | lib/adodb/adodb-datadict.inc.php | ADODB_DataDict.AlterColumnSQL | function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
{
$tabname = $this->TableName ($tabname);
$sql = array();
list($lines,$pkey,$idxs) = $this->_GenFields($flds);
// genfields can return FALSE at times
if ($lines == null) $lines = array();
$alter = 'ALTER TABLE ' . $tabname . $this->al... | php | function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
{
$tabname = $this->TableName ($tabname);
$sql = array();
list($lines,$pkey,$idxs) = $this->_GenFields($flds);
// genfields can return FALSE at times
if ($lines == null) $lines = array();
$alter = 'ALTER TABLE ' . $tabname . $this->al... | [
"function",
"AlterColumnSQL",
"(",
"$",
"tabname",
",",
"$",
"flds",
",",
"$",
"tableflds",
"=",
"''",
",",
"$",
"tableoptions",
"=",
"''",
")",
"{",
"$",
"tabname",
"=",
"$",
"this",
"->",
"TableName",
"(",
"$",
"tabname",
")",
";",
"$",
"sql",
"=... | Change the definition of one column
As some DBM's can't do that on there own, you need to supply the complete defintion of the new table,
to allow, recreating the table and copying the content over to the new table
@param string $tabname table-name
@param string $flds column-name and type for the changed column
@param... | [
"Change",
"the",
"definition",
"of",
"one",
"column"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-datadict.inc.php#L485-L504 |
220,130 | moodle/moodle | lib/adodb/adodb-datadict.inc.php | ADODB_DataDict.RenameColumnSQL | function RenameColumnSQL($tabname,$oldcolumn,$newcolumn,$flds='')
{
$tabname = $this->TableName ($tabname);
if ($flds) {
list($lines,$pkey,$idxs) = $this->_GenFields($flds);
// genfields can return FALSE at times
if ($lines == null) $lines = array();
$first = current($lines);
list(,$column_def) = p... | php | function RenameColumnSQL($tabname,$oldcolumn,$newcolumn,$flds='')
{
$tabname = $this->TableName ($tabname);
if ($flds) {
list($lines,$pkey,$idxs) = $this->_GenFields($flds);
// genfields can return FALSE at times
if ($lines == null) $lines = array();
$first = current($lines);
list(,$column_def) = p... | [
"function",
"RenameColumnSQL",
"(",
"$",
"tabname",
",",
"$",
"oldcolumn",
",",
"$",
"newcolumn",
",",
"$",
"flds",
"=",
"''",
")",
"{",
"$",
"tabname",
"=",
"$",
"this",
"->",
"TableName",
"(",
"$",
"tabname",
")",
";",
"if",
"(",
"$",
"flds",
")"... | Rename one column
Some DBM's can only do this together with changeing the type of the column (even if that stays the same, eg. mysql)
@param string $tabname table-name
@param string $oldcolumn column-name to be renamed
@param string $newcolumn new column-name
@param string $flds='' complete column-defintion-string lik... | [
"Rename",
"one",
"column"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-datadict.inc.php#L516-L527 |
220,131 | moodle/moodle | lib/adodb/adodb-datadict.inc.php | ADODB_DataDict.CreateTableSQL | function CreateTableSQL($tabname, $flds, $tableoptions=array())
{
list($lines,$pkey,$idxs) = $this->_GenFields($flds, true);
// genfields can return FALSE at times
if ($lines == null) $lines = array();
$taboptions = $this->_Options($tableoptions);
$tabname = $this->TableName ($tabname);
$sql = $this->_Tab... | php | function CreateTableSQL($tabname, $flds, $tableoptions=array())
{
list($lines,$pkey,$idxs) = $this->_GenFields($flds, true);
// genfields can return FALSE at times
if ($lines == null) $lines = array();
$taboptions = $this->_Options($tableoptions);
$tabname = $this->TableName ($tabname);
$sql = $this->_Tab... | [
"function",
"CreateTableSQL",
"(",
"$",
"tabname",
",",
"$",
"flds",
",",
"$",
"tableoptions",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"lines",
",",
"$",
"pkey",
",",
"$",
"idxs",
")",
"=",
"$",
"this",
"->",
"_GenFields",
"(",
"$",
"... | Generate the SQL to create table. Returns an array of sql strings. | [
"Generate",
"the",
"SQL",
"to",
"create",
"table",
".",
"Returns",
"an",
"array",
"of",
"sql",
"strings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-datadict.inc.php#L565-L593 |
220,132 | moodle/moodle | lib/adodb/adodb-datadict.inc.php | ADODB_DataDict._Options | function _Options($opts)
{
if (!is_array($opts)) return array();
$newopts = array();
foreach($opts as $k => $v) {
if (is_numeric($k)) $newopts[strtoupper($v)] = $v;
else $newopts[strtoupper($k)] = $v;
}
return $newopts;
} | php | function _Options($opts)
{
if (!is_array($opts)) return array();
$newopts = array();
foreach($opts as $k => $v) {
if (is_numeric($k)) $newopts[strtoupper($v)] = $v;
else $newopts[strtoupper($k)] = $v;
}
return $newopts;
} | [
"function",
"_Options",
"(",
"$",
"opts",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"opts",
")",
")",
"return",
"array",
"(",
")",
";",
"$",
"newopts",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"opts",
"as",
"$",
"k",
"=>",
"$",
... | Sanitize options, so that array elements with no keys are promoted to keys | [
"Sanitize",
"options",
"so",
"that",
"array",
"elements",
"with",
"no",
"keys",
"are",
"promoted",
"to",
"keys"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-datadict.inc.php#L909-L918 |
220,133 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/Math/Set.php | Set.cartesian | public static function cartesian(Set $a, Set $b) : array
{
$cartesian = [];
foreach ($a as $multiplier) {
foreach ($b as $multiplicand) {
$cartesian[] = new self(array_merge([$multiplicand], [$multiplier]));
}
}
return $cartesian;
} | php | public static function cartesian(Set $a, Set $b) : array
{
$cartesian = [];
foreach ($a as $multiplier) {
foreach ($b as $multiplicand) {
$cartesian[] = new self(array_merge([$multiplicand], [$multiplier]));
}
}
return $cartesian;
} | [
"public",
"static",
"function",
"cartesian",
"(",
"Set",
"$",
"a",
",",
"Set",
"$",
"b",
")",
":",
"array",
"{",
"$",
"cartesian",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"a",
"as",
"$",
"multiplier",
")",
"{",
"foreach",
"(",
"$",
"b",
"as",
... | Creates the Cartesian product of A and B.
@param Set $a
@param Set $b
@return Set[] | [
"Creates",
"the",
"Cartesian",
"product",
"of",
"A",
"and",
"B",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Math/Set.php#L69-L80 |
220,134 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/Math/Set.php | Set.power | public static function power(Set $a) : array
{
$power = [new self()];
foreach ($a as $multiplicand) {
foreach ($power as $multiplier) {
$power[] = new self(array_merge([$multiplicand], $multiplier->toArray()));
}
}
return $power;
} | php | public static function power(Set $a) : array
{
$power = [new self()];
foreach ($a as $multiplicand) {
foreach ($power as $multiplier) {
$power[] = new self(array_merge([$multiplicand], $multiplier->toArray()));
}
}
return $power;
} | [
"public",
"static",
"function",
"power",
"(",
"Set",
"$",
"a",
")",
":",
"array",
"{",
"$",
"power",
"=",
"[",
"new",
"self",
"(",
")",
"]",
";",
"foreach",
"(",
"$",
"a",
"as",
"$",
"multiplicand",
")",
"{",
"foreach",
"(",
"$",
"power",
"as",
... | Creates the power set of A.
@param Set $a
@return Set[] | [
"Creates",
"the",
"power",
"set",
"of",
"A",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Math/Set.php#L89-L100 |
220,135 | moodle/moodle | lib/phpexcel/PHPExcel/Writer/Excel2007/Theme.php | PHPExcel_Writer_Excel2007_Theme.writeFonts | private function writeFonts($objWriter, $latinFont, $fontSet)
{
// a:latin
$objWriter->startElement('a:latin');
$objWriter->writeAttribute('typeface', $latinFont);
$objWriter->endElement();
// a:ea
$objWriter->startElement('a:ea');
$objWriter->writeAttribute(... | php | private function writeFonts($objWriter, $latinFont, $fontSet)
{
// a:latin
$objWriter->startElement('a:latin');
$objWriter->writeAttribute('typeface', $latinFont);
$objWriter->endElement();
// a:ea
$objWriter->startElement('a:ea');
$objWriter->writeAttribute(... | [
"private",
"function",
"writeFonts",
"(",
"$",
"objWriter",
",",
"$",
"latinFont",
",",
"$",
"fontSet",
")",
"{",
"// a:latin",
"$",
"objWriter",
"->",
"startElement",
"(",
"'a:latin'",
")",
";",
"$",
"objWriter",
"->",
"writeAttribute",
"(",
"'typeface'",
"... | Write fonts to XML format
@param PHPExcel_Shared_XMLWriter $objWriter
@param string $latinFont
@param array of string $fontSet
@return string XML Output
@throws PHPExcel_Writer_Exception | [
"Write",
"fonts",
"to",
"XML",
"format"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Writer/Excel2007/Theme.php#L825-L848 |
220,136 | moodle/moodle | rating/lib.php | rating.update_rating | public function update_rating($rating) {
global $DB;
$time = time();
$data = new stdClass;
$data->rating = $rating;
$data->timemodified = $time;
$item = new stdclass();
$item->id = $this->itemid;
$items = array($item);
$ratingoptions = ne... | php | public function update_rating($rating) {
global $DB;
$time = time();
$data = new stdClass;
$data->rating = $rating;
$data->timemodified = $time;
$item = new stdclass();
$item->id = $this->itemid;
$items = array($item);
$ratingoptions = ne... | [
"public",
"function",
"update_rating",
"(",
"$",
"rating",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"time",
"=",
"time",
"(",
")",
";",
"$",
"data",
"=",
"new",
"stdClass",
";",
"$",
"data",
"->",
"rating",
"=",
"$",
"rating",
";",
"$",
"data",
"... | Update this rating in the database
@param int $rating the integer value of this rating | [
"Update",
"this",
"rating",
"in",
"the",
"database"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L161-L204 |
220,137 | moodle/moodle | rating/lib.php | rating.get_aggregate_string | public function get_aggregate_string() {
$aggregate = $this->aggregate;
$method = $this->settings->aggregationmethod;
// Only display aggregate if aggregation method isn't COUNT.
$aggregatestr = '';
if (is_numeric($aggregate) && $method != RATING_AGGREGATE_COUNT) {
... | php | public function get_aggregate_string() {
$aggregate = $this->aggregate;
$method = $this->settings->aggregationmethod;
// Only display aggregate if aggregation method isn't COUNT.
$aggregatestr = '';
if (is_numeric($aggregate) && $method != RATING_AGGREGATE_COUNT) {
... | [
"public",
"function",
"get_aggregate_string",
"(",
")",
"{",
"$",
"aggregate",
"=",
"$",
"this",
"->",
"aggregate",
";",
"$",
"method",
"=",
"$",
"this",
"->",
"settings",
"->",
"aggregationmethod",
";",
"// Only display aggregate if aggregation method isn't COUNT.",
... | Returns this ratings aggregate value as a string.
@return string ratings aggregate value | [
"Returns",
"this",
"ratings",
"aggregate",
"value",
"as",
"a",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L220-L238 |
220,138 | moodle/moodle | rating/lib.php | rating.user_can_rate | public function user_can_rate($userid = null) {
if (empty($userid)) {
global $USER;
$userid = $USER->id;
}
// You can't rate your item.
if ($this->itemuserid == $userid) {
return false;
}
// You can't rate if you don't have the system c... | php | public function user_can_rate($userid = null) {
if (empty($userid)) {
global $USER;
$userid = $USER->id;
}
// You can't rate your item.
if ($this->itemuserid == $userid) {
return false;
}
// You can't rate if you don't have the system c... | [
"public",
"function",
"user_can_rate",
"(",
"$",
"userid",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"userid",
")",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"userid",
"=",
"$",
"USER",
"->",
"id",
";",
"}",
"// You can't rate your item.",
... | Returns true if the user is able to rate this rating object
@param int $userid Current user assumed if left empty
@return bool true if the user is able to rate this rating object | [
"Returns",
"true",
"if",
"the",
"user",
"is",
"able",
"to",
"rate",
"this",
"rating",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L246-L272 |
220,139 | moodle/moodle | rating/lib.php | rating.user_can_view_aggregate | public function user_can_view_aggregate($userid = null) {
if (empty($userid)) {
global $USER;
$userid = $USER->id;
}
// If the item doesnt belong to anyone or its another user's items and they can see the aggregate on items they don't own.
// Note that viewany do... | php | public function user_can_view_aggregate($userid = null) {
if (empty($userid)) {
global $USER;
$userid = $USER->id;
}
// If the item doesnt belong to anyone or its another user's items and they can see the aggregate on items they don't own.
// Note that viewany do... | [
"public",
"function",
"user_can_view_aggregate",
"(",
"$",
"userid",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"userid",
")",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"userid",
"=",
"$",
"USER",
"->",
"id",
";",
"}",
"// If the item doesnt... | Returns true if the user is able to view the aggregate for this rating object.
@param int|null $userid If left empty the current user is assumed.
@return bool true if the user is able to view the aggregate for this rating object | [
"Returns",
"true",
"if",
"the",
"user",
"is",
"able",
"to",
"view",
"the",
"aggregate",
"for",
"this",
"rating",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L280-L304 |
220,140 | moodle/moodle | rating/lib.php | rating.get_view_ratings_url | public function get_view_ratings_url($popup = false) {
$attributes = array(
'contextid' => $this->context->id,
'component' => $this->component,
'ratingarea' => $this->ratingarea,
'itemid' => $this->itemid,
'scaleid' => $this->settings->scale->... | php | public function get_view_ratings_url($popup = false) {
$attributes = array(
'contextid' => $this->context->id,
'component' => $this->component,
'ratingarea' => $this->ratingarea,
'itemid' => $this->itemid,
'scaleid' => $this->settings->scale->... | [
"public",
"function",
"get_view_ratings_url",
"(",
"$",
"popup",
"=",
"false",
")",
"{",
"$",
"attributes",
"=",
"array",
"(",
"'contextid'",
"=>",
"$",
"this",
"->",
"context",
"->",
"id",
",",
"'component'",
"=>",
"$",
"this",
"->",
"component",
",",
"... | Returns a URL to view all of the ratings for the item this rating is for.
If this is a rating of a post then this URL will take the user to a page that shows all of the ratings for the post
(this one included).
@param bool $popup whether of not the URL should be loaded in a popup
@return moodle_url URL to view all of... | [
"Returns",
"a",
"URL",
"to",
"view",
"all",
"of",
"the",
"ratings",
"for",
"the",
"item",
"this",
"rating",
"is",
"for",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L315-L327 |
220,141 | moodle/moodle | rating/lib.php | rating.get_rate_url | public function get_rate_url($rating = null, $returnurl = null) {
if (empty($returnurl)) {
if (!empty($this->settings->returnurl)) {
$returnurl = $this->settings->returnurl;
} else {
global $PAGE;
$returnurl = $PAGE->url;
}
... | php | public function get_rate_url($rating = null, $returnurl = null) {
if (empty($returnurl)) {
if (!empty($this->settings->returnurl)) {
$returnurl = $this->settings->returnurl;
} else {
global $PAGE;
$returnurl = $PAGE->url;
}
... | [
"public",
"function",
"get_rate_url",
"(",
"$",
"rating",
"=",
"null",
",",
"$",
"returnurl",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"returnurl",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"settings",
"->",
"retur... | Returns a URL that can be used to rate the associated item.
@param int|null $rating The rating to give the item, if null then no rating param is added.
@param moodle_url|string $returnurl The URL to return to.
@return moodle_url can be used to rate the associated item. | [
"Returns",
"a",
"URL",
"that",
"can",
"be",
"used",
"to",
"rate",
"the",
"associated",
"item",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L336-L361 |
220,142 | moodle/moodle | rating/lib.php | rating_manager.delete_ratings | public function delete_ratings($options) {
global $DB;
if (empty($options->contextid)) {
throw new coding_exception('The context option is a required option when deleting ratings.');
}
$conditions = array('contextid' => $options->contextid);
$possibleconditions = ar... | php | public function delete_ratings($options) {
global $DB;
if (empty($options->contextid)) {
throw new coding_exception('The context option is a required option when deleting ratings.');
}
$conditions = array('contextid' => $options->contextid);
$possibleconditions = ar... | [
"public",
"function",
"delete_ratings",
"(",
"$",
"options",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"options",
"->",
"contextid",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'The context option is a required option when de... | Delete one or more ratings. Specify either a rating id, an item id or just the context id.
@global moodle_database $DB
@param stdClass $options {
contextid => int the context in which the ratings exist [required]
ratingid => int the id of an individual rating to delete [optional]
userid => int delete the ratings submi... | [
"Delete",
"one",
"or",
"more",
"ratings",
".",
"Specify",
"either",
"a",
"rating",
"id",
"an",
"item",
"id",
"or",
"just",
"the",
"context",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L394-L415 |
220,143 | moodle/moodle | rating/lib.php | rating_manager.generate_rating_settings_object | protected function generate_rating_settings_object($options) {
if (!isset($options->context)) {
throw new coding_exception('The context option is a required option when generating a rating settings object.');
}
if (!isset($options->component)) {
throw new coding_exceptio... | php | protected function generate_rating_settings_object($options) {
if (!isset($options->context)) {
throw new coding_exception('The context option is a required option when generating a rating settings object.');
}
if (!isset($options->component)) {
throw new coding_exceptio... | [
"protected",
"function",
"generate_rating_settings_object",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"->",
"context",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'The context option is a required option when generating ... | Generates a rating settings object based upon the options it is provided.
@param stdClass $options {
context => context the context in which the ratings exists [required]
component => string The component the items belong to [required]
ratingarea => string The ratingarea the items belong to [r... | [
"Generates",
"a",
"rating",
"settings",
"object",
"based",
"upon",
"the",
"options",
"it",
"is",
"provided",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L638-L697 |
220,144 | moodle/moodle | rating/lib.php | rating_manager.generate_rating_scale_object | protected function generate_rating_scale_object($scaleid) {
global $DB;
if (!array_key_exists('s'.$scaleid, $this->scales)) {
$scale = new stdClass;
$scale->id = $scaleid;
$scale->name = null;
$scale->courseid = null;
$scale->scaleitems = array... | php | protected function generate_rating_scale_object($scaleid) {
global $DB;
if (!array_key_exists('s'.$scaleid, $this->scales)) {
$scale = new stdClass;
$scale->id = $scaleid;
$scale->name = null;
$scale->courseid = null;
$scale->scaleitems = array... | [
"protected",
"function",
"generate_rating_scale_object",
"(",
"$",
"scaleid",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"'s'",
".",
"$",
"scaleid",
",",
"$",
"this",
"->",
"scales",
")",
")",
"{",
"$",
"scale",
"=",
"... | Generates a scale object that can be returned
@global moodle_database $DB moodle database object
@param int $scaleid scale-type identifier
@return stdClass scale for ratings | [
"Generates",
"a",
"scale",
"object",
"that",
"can",
"be",
"returned"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L706-L743 |
220,145 | moodle/moodle | rating/lib.php | rating_manager.get_item_time_created | protected function get_item_time_created($item) {
if (!empty($item->created)) {
return $item->created; // The forum_posts table has created instead of timecreated.
} else if (!empty($item->timecreated)) {
return $item->timecreated;
} else {
return null;
... | php | protected function get_item_time_created($item) {
if (!empty($item->created)) {
return $item->created; // The forum_posts table has created instead of timecreated.
} else if (!empty($item->timecreated)) {
return $item->timecreated;
} else {
return null;
... | [
"protected",
"function",
"get_item_time_created",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"item",
"->",
"created",
")",
")",
"{",
"return",
"$",
"item",
"->",
"created",
";",
"// The forum_posts table has created instead of timecreated.",
... | Gets the time the given item was created
TODO: MDL-31511 - Find a better solution for this, its not ideal to test for fields really we should be
asking the component the item belongs to what field to look for or even the value we
are looking for.
@param stdClass $item
@return int|null return null if the created time ... | [
"Gets",
"the",
"time",
"the",
"given",
"item",
"was",
"created"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L755-L763 |
220,146 | moodle/moodle | rating/lib.php | rating_manager.get_aggregate_types | public function get_aggregate_types() {
return array (RATING_AGGREGATE_NONE => get_string('aggregatenone', 'rating'),
RATING_AGGREGATE_AVERAGE => get_string('aggregateavg', 'rating'),
RATING_AGGREGATE_COUNT => get_string('aggregatecount', 'rating'),
... | php | public function get_aggregate_types() {
return array (RATING_AGGREGATE_NONE => get_string('aggregatenone', 'rating'),
RATING_AGGREGATE_AVERAGE => get_string('aggregateavg', 'rating'),
RATING_AGGREGATE_COUNT => get_string('aggregatecount', 'rating'),
... | [
"public",
"function",
"get_aggregate_types",
"(",
")",
"{",
"return",
"array",
"(",
"RATING_AGGREGATE_NONE",
"=>",
"get_string",
"(",
"'aggregatenone'",
",",
"'rating'",
")",
",",
"RATING_AGGREGATE_AVERAGE",
"=>",
"get_string",
"(",
"'aggregateavg'",
",",
"'rating'",
... | Returns array of aggregate types. Used by ratings.
@return array aggregate types | [
"Returns",
"array",
"of",
"aggregate",
"types",
".",
"Used",
"by",
"ratings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L889-L896 |
220,147 | moodle/moodle | rating/lib.php | rating_manager.get_aggregation_method | public function get_aggregation_method($aggregate) {
$aggregatestr = null;
switch($aggregate){
case RATING_AGGREGATE_AVERAGE:
$aggregatestr = 'AVG';
break;
case RATING_AGGREGATE_COUNT:
$aggregatestr = 'COUNT';
break;... | php | public function get_aggregation_method($aggregate) {
$aggregatestr = null;
switch($aggregate){
case RATING_AGGREGATE_AVERAGE:
$aggregatestr = 'AVG';
break;
case RATING_AGGREGATE_COUNT:
$aggregatestr = 'COUNT';
break;... | [
"public",
"function",
"get_aggregation_method",
"(",
"$",
"aggregate",
")",
"{",
"$",
"aggregatestr",
"=",
"null",
";",
"switch",
"(",
"$",
"aggregate",
")",
"{",
"case",
"RATING_AGGREGATE_AVERAGE",
":",
"$",
"aggregatestr",
"=",
"'AVG'",
";",
"break",
";",
... | Converts an aggregation method constant into something that can be included in SQL
@param int $aggregate An aggregation constant. For example, RATING_AGGREGATE_AVERAGE.
@return string an SQL aggregation method | [
"Converts",
"an",
"aggregation",
"method",
"constant",
"into",
"something",
"that",
"can",
"be",
"included",
"in",
"SQL"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L904-L927 |
220,148 | moodle/moodle | rating/lib.php | rating_manager.check_rating_is_valid | public function check_rating_is_valid($params) {
if (!isset($params['context'])) {
throw new coding_exception('The context option is a required option when checking rating validity.');
}
if (!isset($params['component'])) {
throw new coding_exception('The component option... | php | public function check_rating_is_valid($params) {
if (!isset($params['context'])) {
throw new coding_exception('The context option is a required option when checking rating validity.');
}
if (!isset($params['component'])) {
throw new coding_exception('The component option... | [
"public",
"function",
"check_rating_is_valid",
"(",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'context'",
"]",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'The context option is a required option when checking rating va... | Validates a submitted rating
@param array $params submitted data
context => object the context in which the rated items exists [required]
component => The component the rating belongs to [required]
ratingarea => The ratingarea the rating is associated with [required]
itemid => int the ID of the object being rated [req... | [
"Validates",
"a",
"submitted",
"rating"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L969-L1002 |
220,149 | moodle/moodle | rating/lib.php | rating_manager.initialise_rating_javascript | public function initialise_rating_javascript(moodle_page $page) {
global $CFG;
// Only needs to be initialized once.
static $done = false;
if ($done) {
return true;
}
$page->requires->js_init_call('M.core_rating.init');
$done = true;
return ... | php | public function initialise_rating_javascript(moodle_page $page) {
global $CFG;
// Only needs to be initialized once.
static $done = false;
if ($done) {
return true;
}
$page->requires->js_init_call('M.core_rating.init');
$done = true;
return ... | [
"public",
"function",
"initialise_rating_javascript",
"(",
"moodle_page",
"$",
"page",
")",
"{",
"global",
"$",
"CFG",
";",
"// Only needs to be initialized once.",
"static",
"$",
"done",
"=",
"false",
";",
"if",
"(",
"$",
"done",
")",
"{",
"return",
"true",
"... | Initialises JavaScript to enable AJAX ratings on the provided page
@param moodle_page $page
@return true always returns true | [
"Initialises",
"JavaScript",
"to",
"enable",
"AJAX",
"ratings",
"on",
"the",
"provided",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L1010-L1023 |
220,150 | moodle/moodle | rating/lib.php | rating_manager.get_aggregate_label | public function get_aggregate_label($aggregationmethod) {
$aggregatelabel = '';
switch ($aggregationmethod) {
case RATING_AGGREGATE_AVERAGE :
$aggregatelabel .= get_string("aggregateavg", "rating");
break;
case RATING_AGGREGATE_COUNT :
... | php | public function get_aggregate_label($aggregationmethod) {
$aggregatelabel = '';
switch ($aggregationmethod) {
case RATING_AGGREGATE_AVERAGE :
$aggregatelabel .= get_string("aggregateavg", "rating");
break;
case RATING_AGGREGATE_COUNT :
... | [
"public",
"function",
"get_aggregate_label",
"(",
"$",
"aggregationmethod",
")",
"{",
"$",
"aggregatelabel",
"=",
"''",
";",
"switch",
"(",
"$",
"aggregationmethod",
")",
"{",
"case",
"RATING_AGGREGATE_AVERAGE",
":",
"$",
"aggregatelabel",
".=",
"get_string",
"(",... | Returns a string that describes the aggregation method that was provided.
@param string $aggregationmethod
@return string describes the aggregation method that was provided | [
"Returns",
"a",
"string",
"that",
"describes",
"the",
"aggregation",
"method",
"that",
"was",
"provided",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L1031-L1052 |
220,151 | moodle/moodle | rating/lib.php | rating_manager.get_component_ratings_since | public function get_component_ratings_since($context, $component, $since) {
global $DB, $USER;
$ratingssince = array();
$where = 'contextid = ? AND component = ? AND (timecreated > ? OR timemodified > ?)';
$ratings = $DB->get_records_select('rating', $where, array($context->id, $compone... | php | public function get_component_ratings_since($context, $component, $since) {
global $DB, $USER;
$ratingssince = array();
$where = 'contextid = ? AND component = ? AND (timecreated > ? OR timemodified > ?)';
$ratings = $DB->get_records_select('rating', $where, array($context->id, $compone... | [
"public",
"function",
"get_component_ratings_since",
"(",
"$",
"context",
",",
"$",
"component",
",",
"$",
"since",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"$",
"ratingssince",
"=",
"array",
"(",
")",
";",
"$",
"where",
"=",
"'contextid = ?... | Get ratings created since a given time.
@param stdClass $context context object
@param string $component component name
@param int $since the time to check
@return array list of ratings db records since the given timelimit
@since Moodle 3.2 | [
"Get",
"ratings",
"created",
"since",
"a",
"given",
"time",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/lib.php#L1187-L1210 |
220,152 | moodle/moodle | admin/tool/lp/classes/output/template_plans_table.php | template_plans_table.col_name | protected function col_name($row) {
return html_writer::link(new moodle_url('/admin/tool/lp/plan.php', array('id' => $row->id)),
format_string($row->name, true, array('context' => $this->context)));
} | php | protected function col_name($row) {
return html_writer::link(new moodle_url('/admin/tool/lp/plan.php', array('id' => $row->id)),
format_string($row->name, true, array('context' => $this->context)));
} | [
"protected",
"function",
"col_name",
"(",
"$",
"row",
")",
"{",
"return",
"html_writer",
"::",
"link",
"(",
"new",
"moodle_url",
"(",
"'/admin/tool/lp/plan.php'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"row",
"->",
"id",
")",
")",
",",
"format_string",
"(",... | Format column name.
@param stdClass $row
@return string | [
"Format",
"column",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/lp/classes/output/template_plans_table.php#L86-L89 |
220,153 | moodle/moodle | lib/classes/analytics/analyser/courses.php | courses.get_all_samples | public function get_all_samples(\core_analytics\analysable $course) {
$context = \context_course::instance($course->get_id());
// Just 1 sample per analysable.
return array(
array($course->get_id() => $course->get_id()),
array($course->get_id() => array('course' => $cou... | php | public function get_all_samples(\core_analytics\analysable $course) {
$context = \context_course::instance($course->get_id());
// Just 1 sample per analysable.
return array(
array($course->get_id() => $course->get_id()),
array($course->get_id() => array('course' => $cou... | [
"public",
"function",
"get_all_samples",
"(",
"\\",
"core_analytics",
"\\",
"analysable",
"$",
"course",
")",
"{",
"$",
"context",
"=",
"\\",
"context_course",
"::",
"instance",
"(",
"$",
"course",
"->",
"get_id",
"(",
")",
")",
";",
"// Just 1 sample per anal... | This will return just one course as we analyse 'by_course'.
@param \core_analytics\analysable $course
@return array | [
"This",
"will",
"return",
"just",
"one",
"course",
"as",
"we",
"analyse",
"by_course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/analytics/analyser/courses.php#L91-L100 |
220,154 | moodle/moodle | repository/flickr_public/lib.php | repository_flickr_public.print_login | public function print_login() {
if ($this->options['ajax']) {
$ret = array();
$fulltext = new stdClass();
$fulltext->label = get_string('fulltext', 'repository_flickr_public').': ';
$fulltext->id = 'el_fulltext';
$fulltext->type = 'text';
... | php | public function print_login() {
if ($this->options['ajax']) {
$ret = array();
$fulltext = new stdClass();
$fulltext->label = get_string('fulltext', 'repository_flickr_public').': ';
$fulltext->id = 'el_fulltext';
$fulltext->type = 'text';
... | [
"public",
"function",
"print_login",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"options",
"[",
"'ajax'",
"]",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"$",
"fulltext",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"fulltext",
"->",
"la... | construct login form
@param boolean $ajax
@return array | [
"construct",
"login",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/flickr_public/lib.php#L141-L204 |
220,155 | moodle/moodle | repository/flickr_public/lib.php | repository_flickr_public.get_listing | public function get_listing($path = '', $page = 1) {
$people = $this->flickr->people_findByEmail($this->flickr_account);
$this->nsid = $people['nsid'];
$photos = $this->flickr->people_getPublicPhotos($people['nsid'], 'original_format', 24, $page);
$ret = array();
return $this->b... | php | public function get_listing($path = '', $page = 1) {
$people = $this->flickr->people_findByEmail($this->flickr_account);
$this->nsid = $people['nsid'];
$photos = $this->flickr->people_getPublicPhotos($people['nsid'], 'original_format', 24, $page);
$ret = array();
return $this->b... | [
"public",
"function",
"get_listing",
"(",
"$",
"path",
"=",
"''",
",",
"$",
"page",
"=",
"1",
")",
"{",
"$",
"people",
"=",
"$",
"this",
"->",
"flickr",
"->",
"people_findByEmail",
"(",
"$",
"this",
"->",
"flickr_account",
")",
";",
"$",
"this",
"->"... | return an image list
@param string $path
@param int $page
@return array | [
"return",
"an",
"image",
"list"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/flickr_public/lib.php#L326-L333 |
220,156 | moodle/moodle | repository/flickr_public/lib.php | repository_flickr_public.build_list | private function build_list($photos, $page = 1, &$ret) {
if (!empty($this->nsid)) {
$photos_url = $this->flickr->urls_getUserPhotos($this->nsid);
$ret['manage'] = $photos_url;
}
$ret['list'] = array();
$ret['nosearch'] = true;
$ret['norefresh'] = true;
... | php | private function build_list($photos, $page = 1, &$ret) {
if (!empty($this->nsid)) {
$photos_url = $this->flickr->urls_getUserPhotos($this->nsid);
$ret['manage'] = $photos_url;
}
$ret['list'] = array();
$ret['nosearch'] = true;
$ret['norefresh'] = true;
... | [
"private",
"function",
"build_list",
"(",
"$",
"photos",
",",
"$",
"page",
"=",
"1",
",",
"&",
"$",
"ret",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"nsid",
")",
")",
"{",
"$",
"photos_url",
"=",
"$",
"this",
"->",
"flickr",
"-... | build an image list
@param array $photos
@param int $page
@return array | [
"build",
"an",
"image",
"list"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/flickr_public/lib.php#L342-L388 |
220,157 | moodle/moodle | repository/flickr_public/lib.php | repository_flickr_public.print_search | public function print_search() {
$str = '';
$str .= '<input type="hidden" name="repo_id" value="'.$this->id.'" />';
$str .= '<input type="hidden" name="ctx_id" value="'.$this->context->id.'" />';
$str .= '<input type="hidden" name="seekey" value="'.sesskey().'" />';
$str .= '<lab... | php | public function print_search() {
$str = '';
$str .= '<input type="hidden" name="repo_id" value="'.$this->id.'" />';
$str .= '<input type="hidden" name="ctx_id" value="'.$this->context->id.'" />';
$str .= '<input type="hidden" name="seekey" value="'.sesskey().'" />';
$str .= '<lab... | [
"public",
"function",
"print_search",
"(",
")",
"{",
"$",
"str",
"=",
"''",
";",
"$",
"str",
".=",
"'<input type=\"hidden\" name=\"repo_id\" value=\"'",
".",
"$",
"this",
"->",
"id",
".",
"'\" />'",
";",
"$",
"str",
".=",
"'<input type=\"hidden\" name=\"ctx_id\" v... | Print a search form
@return string | [
"Print",
"a",
"search",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/flickr_public/lib.php#L395-L403 |
220,158 | moodle/moodle | repository/flickr_public/lib.php | repository_flickr_public.build_photo_url | private function build_photo_url($photoid) {
$bestsize = $this->get_best_size($photoid);
if (!isset($bestsize['source'])) {
throw new repository_exception('cannotdownload', 'repository');
}
return $bestsize['source'];
} | php | private function build_photo_url($photoid) {
$bestsize = $this->get_best_size($photoid);
if (!isset($bestsize['source'])) {
throw new repository_exception('cannotdownload', 'repository');
}
return $bestsize['source'];
} | [
"private",
"function",
"build_photo_url",
"(",
"$",
"photoid",
")",
"{",
"$",
"bestsize",
"=",
"$",
"this",
"->",
"get_best_size",
"(",
"$",
"photoid",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"bestsize",
"[",
"'source'",
"]",
")",
")",
"{",
"thr... | Return photo url by given photo id
@param string $photoid
@return string | [
"Return",
"photo",
"url",
"by",
"given",
"photo",
"id"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/flickr_public/lib.php#L410-L416 |
220,159 | moodle/moodle | repository/flickr_public/lib.php | repository_flickr_public.get_best_size | protected function get_best_size($photoid) {
if (!isset(self::$sizes[$photoid])) {
// Sizes are returned from smallest to greatest.
self::$sizes[$photoid] = $this->flickr->photos_getSizes($photoid);
}
$sizes = self::$sizes[$photoid];
$bestsize = array();
i... | php | protected function get_best_size($photoid) {
if (!isset(self::$sizes[$photoid])) {
// Sizes are returned from smallest to greatest.
self::$sizes[$photoid] = $this->flickr->photos_getSizes($photoid);
}
$sizes = self::$sizes[$photoid];
$bestsize = array();
i... | [
"protected",
"function",
"get_best_size",
"(",
"$",
"photoid",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"sizes",
"[",
"$",
"photoid",
"]",
")",
")",
"{",
"// Sizes are returned from smallest to greatest.",
"self",
"::",
"$",
"sizes",
"[",
... | Returns the best size for a photo
@param string $photoid the photo identifier
@return array of information provided by the API | [
"Returns",
"the",
"best",
"size",
"for",
"a",
"photo"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/flickr_public/lib.php#L424-L440 |
220,160 | moodle/moodle | repository/flickr_public/lib.php | repository_flickr_public.plugin_init | public static function plugin_init() {
//here we create a default instance for this type
$id = repository::static_function('flickr_public','create', 'flickr_public', 0, context_system::instance(), array('name'=>'', 'email_address' => null, 'usewatermarks' => false), 0);
if (empty($id)) {
... | php | public static function plugin_init() {
//here we create a default instance for this type
$id = repository::static_function('flickr_public','create', 'flickr_public', 0, context_system::instance(), array('name'=>'', 'email_address' => null, 'usewatermarks' => false), 0);
if (empty($id)) {
... | [
"public",
"static",
"function",
"plugin_init",
"(",
")",
"{",
"//here we create a default instance for this type",
"$",
"id",
"=",
"repository",
"::",
"static_function",
"(",
"'flickr_public'",
",",
"'create'",
",",
"'flickr_public'",
",",
"0",
",",
"context_system",
... | is run when moodle administrator add the plugin | [
"is",
"run",
"when",
"moodle",
"administrator",
"add",
"the",
"plugin"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/flickr_public/lib.php#L529-L538 |
220,161 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/LanguageFactory.php | HTMLPurifier_LanguageFactory.instance | public static function instance($prototype = null)
{
static $instance = null;
if ($prototype !== null) {
$instance = $prototype;
} elseif ($instance === null || $prototype == true) {
$instance = new HTMLPurifier_LanguageFactory();
$instance->setup();
... | php | public static function instance($prototype = null)
{
static $instance = null;
if ($prototype !== null) {
$instance = $prototype;
} elseif ($instance === null || $prototype == true) {
$instance = new HTMLPurifier_LanguageFactory();
$instance->setup();
... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"prototype",
"=",
"null",
")",
"{",
"static",
"$",
"instance",
"=",
"null",
";",
"if",
"(",
"$",
"prototype",
"!==",
"null",
")",
"{",
"$",
"instance",
"=",
"$",
"prototype",
";",
"}",
"elseif",
"... | Retrieve sole instance of the factory.
@param HTMLPurifier_LanguageFactory $prototype Optional prototype to overload sole instance with,
or bool true to reset to default factory.
@return HTMLPurifier_LanguageFactory | [
"Retrieve",
"sole",
"instance",
"of",
"the",
"factory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/LanguageFactory.php#L59-L69 |
220,162 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/LanguageFactory.php | HTMLPurifier_LanguageFactory.create | public function create($config, $context, $code = false)
{
// validate language code
if ($code === false) {
$code = $this->validator->validate(
$config->get('Core.Language'),
$config,
$context
);
} else {
$co... | php | public function create($config, $context, $code = false)
{
// validate language code
if ($code === false) {
$code = $this->validator->validate(
$config->get('Core.Language'),
$config,
$context
);
} else {
$co... | [
"public",
"function",
"create",
"(",
"$",
"config",
",",
"$",
"context",
",",
"$",
"code",
"=",
"false",
")",
"{",
"// validate language code",
"if",
"(",
"$",
"code",
"===",
"false",
")",
"{",
"$",
"code",
"=",
"$",
"this",
"->",
"validator",
"->",
... | Creates a language object, handles class fallbacks
@param HTMLPurifier_Config $config
@param HTMLPurifier_Context $context
@param bool|string $code Code to override configuration with. Private parameter.
@return HTMLPurifier_Language | [
"Creates",
"a",
"language",
"object",
"handles",
"class",
"fallbacks"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/LanguageFactory.php#L88-L128 |
220,163 | moodle/moodle | lib/graphlib.php | graph.find_range | function find_range($data, $min, $max, $resolution) {
if (sizeof($data) == 0 ) return array('min' => 0, 'max' => 0);
foreach ($data as $key => $value) {
if ($value=='none') continue;
if ($value > $max) $max = $value;
if ($value < $min) $min = $value;
}
if ($max == 0) {
... | php | function find_range($data, $min, $max, $resolution) {
if (sizeof($data) == 0 ) return array('min' => 0, 'max' => 0);
foreach ($data as $key => $value) {
if ($value=='none') continue;
if ($value > $max) $max = $value;
if ($value < $min) $min = $value;
}
if ($max == 0) {
... | [
"function",
"find_range",
"(",
"$",
"data",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"resolution",
")",
"{",
"if",
"(",
"sizeof",
"(",
"$",
"data",
")",
"==",
"0",
")",
"return",
"array",
"(",
"'min'",
"=>",
"0",
",",
"'max'",
"=>",
"0",
")"... | find max and min values for a data array given the resolution. | [
"find",
"max",
"and",
"min",
"values",
"for",
"a",
"data",
"array",
"given",
"the",
"resolution",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/graphlib.php#L1150-L1174 |
220,164 | moodle/moodle | lib/graphlib.php | graph.update_boundaryBox | function update_boundaryBox(&$boundaryBox, $coords) {
$width = $boundaryBox['width'];
$height = $boundaryBox['height'];
$x = $coords['x'];
$y = $coords['y'];
$reference = $coords['reference'];
switch ($reference) {
case 'top-left':
case 'le... | php | function update_boundaryBox(&$boundaryBox, $coords) {
$width = $boundaryBox['width'];
$height = $boundaryBox['height'];
$x = $coords['x'];
$y = $coords['y'];
$reference = $coords['reference'];
switch ($reference) {
case 'top-left':
case 'le... | [
"function",
"update_boundaryBox",
"(",
"&",
"$",
"boundaryBox",
",",
"$",
"coords",
")",
"{",
"$",
"width",
"=",
"$",
"boundaryBox",
"[",
"'width'",
"]",
";",
"$",
"height",
"=",
"$",
"boundaryBox",
"[",
"'height'",
"]",
";",
"$",
"x",
"=",
"$",
"coo... | move boundaryBox to coordinates specified | [
"move",
"boundaryBox",
"to",
"coordinates",
"specified"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/graphlib.php#L1282-L1349 |
220,165 | moodle/moodle | lib/graphlib.php | graph.draw_brush_line | function draw_brush_line($x0, $y0, $x1, $y1, $size, $type, $colour) {
//$this->dbug("line: $x0, $y0, $x1, $y1");
$dy = $y1 - $y0;
$dx = $x1 - $x0;
$t = 0;
$watchdog = 1024; // precaution to prevent infinite loops.
$this->draw_brush($x0, $y0, $size, $type, $colour);
if (abs($dx... | php | function draw_brush_line($x0, $y0, $x1, $y1, $size, $type, $colour) {
//$this->dbug("line: $x0, $y0, $x1, $y1");
$dy = $y1 - $y0;
$dx = $x1 - $x0;
$t = 0;
$watchdog = 1024; // precaution to prevent infinite loops.
$this->draw_brush($x0, $y0, $size, $type, $colour);
if (abs($dx... | [
"function",
"draw_brush_line",
"(",
"$",
"x0",
",",
"$",
"y0",
",",
"$",
"x1",
",",
"$",
"y1",
",",
"$",
"size",
",",
"$",
"type",
",",
"$",
"colour",
")",
"{",
"//$this->dbug(\"line: $x0, $y0, $x1, $y1\");",
"$",
"dy",
"=",
"$",
"y1",
"-",
"$",
"y0"... | function to draw line. would prefer to use gdBrush but this is not supported yet. | [
"function",
"to",
"draw",
"line",
".",
"would",
"prefer",
"to",
"use",
"gdBrush",
"but",
"this",
"is",
"not",
"supported",
"yet",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/graphlib.php#L1719-L1758 |
220,166 | moodle/moodle | course/format/singleactivity/lib.php | format_singleactivity.navigation_add_activity | protected function navigation_add_activity(navigation_node $node, $cm) {
if (!$cm->uservisible) {
return null;
}
$action = $cm->url;
if (!$action) {
// Do not add to navigation activity without url (i.e. labels).
return null;
}
$activit... | php | protected function navigation_add_activity(navigation_node $node, $cm) {
if (!$cm->uservisible) {
return null;
}
$action = $cm->url;
if (!$action) {
// Do not add to navigation activity without url (i.e. labels).
return null;
}
$activit... | [
"protected",
"function",
"navigation_add_activity",
"(",
"navigation_node",
"$",
"node",
",",
"$",
"cm",
")",
"{",
"if",
"(",
"!",
"$",
"cm",
"->",
"uservisible",
")",
"{",
"return",
"null",
";",
"}",
"$",
"action",
"=",
"$",
"cm",
"->",
"url",
";",
... | Adds a course module to the navigation node
This is basically copied from function global_navigation::load_section_activities()
because it is not accessible from outside.
@param navigation_node $node
@param cm_info $cm
@return null|navigation_node | [
"Adds",
"a",
"course",
"module",
"to",
"the",
"navigation",
"node"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/singleactivity/lib.php#L100-L122 |
220,167 | moodle/moodle | course/format/singleactivity/lib.php | format_singleactivity.reorder_activities | public function reorder_activities() {
course_create_sections_if_missing($this->courseid, array(0, 1));
foreach ($this->get_sections() as $sectionnum => $section) {
if (($sectionnum && $section->visible) ||
(!$sectionnum && !$section->visible)) {
// Make s... | php | public function reorder_activities() {
course_create_sections_if_missing($this->courseid, array(0, 1));
foreach ($this->get_sections() as $sectionnum => $section) {
if (($sectionnum && $section->visible) ||
(!$sectionnum && !$section->visible)) {
// Make s... | [
"public",
"function",
"reorder_activities",
"(",
")",
"{",
"course_create_sections_if_missing",
"(",
"$",
"this",
"->",
"courseid",
",",
"array",
"(",
"0",
",",
"1",
")",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"get_sections",
"(",
")",
"as",
"$",
"... | Make sure that current active activity is in section 0
All other activities are moved to section 1 that will be displayed as 'Orphaned'.
It may be needed after the course format was changed or activitytype in
course settings has been changed.
@return null|cm_info current activity | [
"Make",
"sure",
"that",
"current",
"active",
"activity",
"is",
"in",
"section",
"0"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/singleactivity/lib.php#L207-L273 |
220,168 | moodle/moodle | course/format/singleactivity/lib.php | format_singleactivity.get_activitytype | protected function get_activitytype() {
$options = $this->get_format_options();
$availabletypes = $this->get_supported_activities();
if (!empty($options['activitytype']) &&
array_key_exists($options['activitytype'], $availabletypes)) {
return $options['activitytype'];... | php | protected function get_activitytype() {
$options = $this->get_format_options();
$availabletypes = $this->get_supported_activities();
if (!empty($options['activitytype']) &&
array_key_exists($options['activitytype'], $availabletypes)) {
return $options['activitytype'];... | [
"protected",
"function",
"get_activitytype",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"get_format_options",
"(",
")",
";",
"$",
"availabletypes",
"=",
"$",
"this",
"->",
"get_supported_activities",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",... | Returns the name of activity type used for this course
@return string|null | [
"Returns",
"the",
"name",
"of",
"activity",
"type",
"used",
"for",
"this",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/singleactivity/lib.php#L280-L289 |
220,169 | moodle/moodle | course/format/singleactivity/lib.php | format_singleactivity.get_activity | protected function get_activity() {
if ($this->activity === false) {
$this->activity = $this->reorder_activities();
}
return $this->activity;
} | php | protected function get_activity() {
if ($this->activity === false) {
$this->activity = $this->reorder_activities();
}
return $this->activity;
} | [
"protected",
"function",
"get_activity",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"activity",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"activity",
"=",
"$",
"this",
"->",
"reorder_activities",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
... | Returns the current activity if exists
@return null|cm_info | [
"Returns",
"the",
"current",
"activity",
"if",
"exists"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/singleactivity/lib.php#L296-L301 |
220,170 | moodle/moodle | course/format/singleactivity/lib.php | format_singleactivity.get_supported_activities | public static function get_supported_activities() {
$availabletypes = get_module_types_names();
foreach ($availabletypes as $module => $name) {
if (plugin_supports('mod', $module, FEATURE_NO_VIEW_LINK, false)) {
unset($availabletypes[$module]);
}
}
... | php | public static function get_supported_activities() {
$availabletypes = get_module_types_names();
foreach ($availabletypes as $module => $name) {
if (plugin_supports('mod', $module, FEATURE_NO_VIEW_LINK, false)) {
unset($availabletypes[$module]);
}
}
... | [
"public",
"static",
"function",
"get_supported_activities",
"(",
")",
"{",
"$",
"availabletypes",
"=",
"get_module_types_names",
"(",
")",
";",
"foreach",
"(",
"$",
"availabletypes",
"as",
"$",
"module",
"=>",
"$",
"name",
")",
"{",
"if",
"(",
"plugin_supports... | Get the activities supported by the format.
Here we ignore the modules that do not have a page of their own, like the label.
@return array array($module => $name of the module). | [
"Get",
"the",
"activities",
"supported",
"by",
"the",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/singleactivity/lib.php#L310-L318 |
220,171 | moodle/moodle | course/format/singleactivity/lib.php | format_singleactivity.can_add_activity | protected function can_add_activity() {
global $CFG;
if (!($modname = $this->get_activitytype())) {
return false;
}
if (!has_capability('moodle/course:manageactivities', context_course::instance($this->courseid))) {
return false;
}
if (!course_allo... | php | protected function can_add_activity() {
global $CFG;
if (!($modname = $this->get_activitytype())) {
return false;
}
if (!has_capability('moodle/course:manageactivities', context_course::instance($this->courseid))) {
return false;
}
if (!course_allo... | [
"protected",
"function",
"can_add_activity",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"(",
"$",
"modname",
"=",
"$",
"this",
"->",
"get_activitytype",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"has_capabil... | Checks if the current user can add the activity of the specified type to this course.
@return bool | [
"Checks",
"if",
"the",
"current",
"user",
"can",
"add",
"the",
"activity",
"of",
"the",
"specified",
"type",
"to",
"this",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/singleactivity/lib.php#L325-L341 |
220,172 | moodle/moodle | customfield/field/select/classes/field_controller.php | field_controller.config_form_definition | public function config_form_definition(\MoodleQuickForm $mform) {
$mform->addElement('header', 'header_specificsettings', get_string('specificsettings', 'customfield_select'));
$mform->setExpanded('header_specificsettings', true);
$mform->addElement('textarea', 'configdata[options]', get_string... | php | public function config_form_definition(\MoodleQuickForm $mform) {
$mform->addElement('header', 'header_specificsettings', get_string('specificsettings', 'customfield_select'));
$mform->setExpanded('header_specificsettings', true);
$mform->addElement('textarea', 'configdata[options]', get_string... | [
"public",
"function",
"config_form_definition",
"(",
"\\",
"MoodleQuickForm",
"$",
"mform",
")",
"{",
"$",
"mform",
"->",
"addElement",
"(",
"'header'",
",",
"'header_specificsettings'",
",",
"get_string",
"(",
"'specificsettings'",
",",
"'customfield_select'",
")",
... | Add fields for editing a select field.
@param \MoodleQuickForm $mform | [
"Add",
"fields",
"for",
"editing",
"a",
"select",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/field/select/classes/field_controller.php#L47-L56 |
220,173 | moodle/moodle | customfield/field/select/classes/field_controller.php | field_controller.get_options_array | public static function get_options_array(\core_customfield\field_controller $field) : array {
if ($field->get_configdata_property('options')) {
$options = preg_split("/\s*\n\s*/", trim($field->get_configdata_property('options')));
} else {
$options = array();
}
re... | php | public static function get_options_array(\core_customfield\field_controller $field) : array {
if ($field->get_configdata_property('options')) {
$options = preg_split("/\s*\n\s*/", trim($field->get_configdata_property('options')));
} else {
$options = array();
}
re... | [
"public",
"static",
"function",
"get_options_array",
"(",
"\\",
"core_customfield",
"\\",
"field_controller",
"$",
"field",
")",
":",
"array",
"{",
"if",
"(",
"$",
"field",
"->",
"get_configdata_property",
"(",
"'options'",
")",
")",
"{",
"$",
"options",
"=",
... | Returns the options available as an array.
@param \core_customfield\field_controller $field
@return array | [
"Returns",
"the",
"options",
"available",
"as",
"an",
"array",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/field/select/classes/field_controller.php#L64-L71 |
220,174 | moodle/moodle | customfield/field/select/classes/field_controller.php | field_controller.config_form_validation | public function config_form_validation(array $data, $files = array()) : array {
$options = preg_split("/\s*\n\s*/", trim($data['configdata']['options']));
$errors = [];
if (!$options || count($options) < 2) {
$errors['configdata[options]'] = get_string('errornotenoughoptions', 'custo... | php | public function config_form_validation(array $data, $files = array()) : array {
$options = preg_split("/\s*\n\s*/", trim($data['configdata']['options']));
$errors = [];
if (!$options || count($options) < 2) {
$errors['configdata[options]'] = get_string('errornotenoughoptions', 'custo... | [
"public",
"function",
"config_form_validation",
"(",
"array",
"$",
"data",
",",
"$",
"files",
"=",
"array",
"(",
")",
")",
":",
"array",
"{",
"$",
"options",
"=",
"preg_split",
"(",
"\"/\\s*\\n\\s*/\"",
",",
"trim",
"(",
"$",
"data",
"[",
"'configdata'",
... | Validate the data from the config form.
Sub classes must reimplement it.
@param array $data from the add/edit profile field form
@param array $files
@return array associative array of error messages | [
"Validate",
"the",
"data",
"from",
"the",
"config",
"form",
".",
"Sub",
"classes",
"must",
"reimplement",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/field/select/classes/field_controller.php#L81-L93 |
220,175 | moodle/moodle | mod/quiz/report/statistics/statistics_question_table.php | quiz_statistics_question_table.question_setup | public function question_setup($reporturl, $questiondata, $s, $responseanalysis) {
$this->questiondata = $questiondata;
$this->s = $s;
$this->define_baseurl($reporturl->out());
$this->collapsible(false);
$this->set_attribute('class', 'generaltable generalbox boxaligncenter quizr... | php | public function question_setup($reporturl, $questiondata, $s, $responseanalysis) {
$this->questiondata = $questiondata;
$this->s = $s;
$this->define_baseurl($reporturl->out());
$this->collapsible(false);
$this->set_attribute('class', 'generaltable generalbox boxaligncenter quizr... | [
"public",
"function",
"question_setup",
"(",
"$",
"reporturl",
",",
"$",
"questiondata",
",",
"$",
"s",
",",
"$",
"responseanalysis",
")",
"{",
"$",
"this",
"->",
"questiondata",
"=",
"$",
"questiondata",
";",
"$",
"this",
"->",
"s",
"=",
"$",
"s",
";"... | Set up columns and column names and other table settings.
@param moodle_url $reporturl
@param object $questiondata
@param integer $s number of attempts on this question.
@param \core_question\statistics\responses\analysis_for_question $responseanalysis | [
"Set",
"up",
"columns",
"and",
"column",
"names",
"and",
"other",
"table",
"settings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/statistics/statistics_question_table.php#L67-L127 |
220,176 | moodle/moodle | mod/quiz/report/statistics/statistics_question_table.php | quiz_statistics_question_table.col_frequency | protected function col_frequency($response) {
if (!$this->s) {
return '';
}
return $this->format_percentage($response->totalcount / $this->s);
} | php | protected function col_frequency($response) {
if (!$this->s) {
return '';
}
return $this->format_percentage($response->totalcount / $this->s);
} | [
"protected",
"function",
"col_frequency",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"s",
")",
"{",
"return",
"''",
";",
"}",
"return",
"$",
"this",
"->",
"format_percentage",
"(",
"$",
"response",
"->",
"totalcount",
"/",
"$",
... | The frequency with which this response was given.
@param object $response contains the data to display.
@return string contents of this table cell. | [
"The",
"frequency",
"with",
"which",
"this",
"response",
"was",
"given",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/statistics/statistics_question_table.php#L157-L162 |
220,177 | moodle/moodle | lib/classes/session/memcached.php | memcached.connection_string_to_memcache_servers | protected static function connection_string_to_memcache_servers(string $str) : array {
$servers = [];
$parts = explode(',', $str);
foreach ($parts as $part) {
$part = trim($part);
$pos = strrpos($part, ':');
if ($pos !== false) {
$host = sub... | php | protected static function connection_string_to_memcache_servers(string $str) : array {
$servers = [];
$parts = explode(',', $str);
foreach ($parts as $part) {
$part = trim($part);
$pos = strrpos($part, ':');
if ($pos !== false) {
$host = sub... | [
"protected",
"static",
"function",
"connection_string_to_memcache_servers",
"(",
"string",
"$",
"str",
")",
":",
"array",
"{",
"$",
"servers",
"=",
"[",
"]",
";",
"$",
"parts",
"=",
"explode",
"(",
"','",
",",
"$",
"str",
")",
";",
"foreach",
"(",
"$",
... | Convert a connection string to an array of servers.
"abc:123, xyz:789" to
[
['abc', '123'],
['xyz', '789'],
]
@param string $str save_path value containing memcached connection string
@return array[] | [
"Convert",
"a",
"connection",
"string",
"to",
"an",
"array",
"of",
"servers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/session/memcached.php#L283-L299 |
220,178 | moodle/moodle | lib/pear/HTML/QuickForm/Rule/Callback.php | HTML_QuickForm_Rule_Callback.validate | function validate($value, $options = null)
{
if (isset($this->_data[$this->name])) {
$callback = $this->_data[$this->name];
if (isset($callback[1])) {
return call_user_func(array($callback[1], $callback[0]), $value, $options);
} elseif ($this->_BCMode[$thi... | php | function validate($value, $options = null)
{
if (isset($this->_data[$this->name])) {
$callback = $this->_data[$this->name];
if (isset($callback[1])) {
return call_user_func(array($callback[1], $callback[0]), $value, $options);
} elseif ($this->_BCMode[$thi... | [
"function",
"validate",
"(",
"$",
"value",
",",
"$",
"options",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"$",
"this",
"->",
"name",
"]",
")",
")",
"{",
"$",
"callback",
"=",
"$",
"this",
"->",
"_data",
"[... | Validates a value using a callback
@param string $value Value to be checked
@param mixed $options Options for callback
@access public
@return boolean true if value is valid | [
"Validates",
"a",
"value",
"using",
"a",
"callback"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/Rule/Callback.php#L61-L77 |
220,179 | moodle/moodle | lib/pear/HTML/QuickForm/Rule/Callback.php | HTML_QuickForm_Rule_Callback.addData | function addData($name, $callback, $class = null, $BCMode = false)
{
if (!empty($class)) {
$this->_data[$name] = array($callback, $class);
} else {
$this->_data[$name] = array($callback);
}
$this->_BCMode[$name] = $BCMode;
} | php | function addData($name, $callback, $class = null, $BCMode = false)
{
if (!empty($class)) {
$this->_data[$name] = array($callback, $class);
} else {
$this->_data[$name] = array($callback);
}
$this->_BCMode[$name] = $BCMode;
} | [
"function",
"addData",
"(",
"$",
"name",
",",
"$",
"callback",
",",
"$",
"class",
"=",
"null",
",",
"$",
"BCMode",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"class",
")",
")",
"{",
"$",
"this",
"->",
"_data",
"[",
"$",
"name",
... | Adds new callbacks to the callbacks list
@param string $name Name of rule
@param string $callback Name of function or method
@param string $class Name of class containing the method
@param bool $BCMode Backwards compatibility mode
@access public | [
"Adds",
"new",
"callbacks",
"to",
"the",
"callbacks",
"list"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/Rule/Callback.php#L88-L96 |
220,180 | moodle/moodle | blog/external_blog_edit_form.php | blog_edit_external_form.validation | public function validation($data, $files) {
global $CFG;
$errors = parent::validation($data, $files);
require_once($CFG->libdir . '/simplepie/moodle_simplepie.php');
$rss = new moodle_simplepie();
$rssfile = $rss->registry->create('File', array($data['url']));
$filetes... | php | public function validation($data, $files) {
global $CFG;
$errors = parent::validation($data, $files);
require_once($CFG->libdir . '/simplepie/moodle_simplepie.php');
$rss = new moodle_simplepie();
$rssfile = $rss->registry->create('File', array($data['url']));
$filetes... | [
"public",
"function",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"errors",
"=",
"parent",
"::",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"l... | Additional validation includes checking URL and tags | [
"Additional",
"validation",
"includes",
"checking",
"URL",
"and",
"tags"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blog/external_blog_edit_form.php#L74-L95 |
220,181 | moodle/moodle | mod/assign/feedback/editpdf/fpdi/fpdi_bridge.php | fpdi_bridge._getxobjectdict | protected function _getxobjectdict()
{
$out = parent::_getxobjectdict();
foreach ($this->_tpls as $tplIdx => $tpl) {
$out .= sprintf('%s%d %d 0 R', $this->tplPrefix, $tplIdx, $tpl['n']);
}
return $out;
} | php | protected function _getxobjectdict()
{
$out = parent::_getxobjectdict();
foreach ($this->_tpls as $tplIdx => $tpl) {
$out .= sprintf('%s%d %d 0 R', $this->tplPrefix, $tplIdx, $tpl['n']);
}
return $out;
} | [
"protected",
"function",
"_getxobjectdict",
"(",
")",
"{",
"$",
"out",
"=",
"parent",
"::",
"_getxobjectdict",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_tpls",
"as",
"$",
"tplIdx",
"=>",
"$",
"tpl",
")",
"{",
"$",
"out",
".=",
"sprintf",
"(... | Return XObjects Dictionary.
Overwritten to add additional XObjects to the resources dictionary of TCPDF
@return string | [
"Return",
"XObjects",
"Dictionary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/fpdi/fpdi_bridge.php#L54-L62 |
220,182 | moodle/moodle | mod/assign/feedback/editpdf/fpdi/fpdi_bridge.php | fpdi_bridge._prepareValue | protected function _prepareValue(&$value)
{
switch ($value[0]) {
case pdf_parser::TYPE_STRING:
if ($this->encrypted) {
$value[1] = $this->_unescape($value[1]);
$value[1] = $this->_encrypt_data($this->_currentObjId, $... | php | protected function _prepareValue(&$value)
{
switch ($value[0]) {
case pdf_parser::TYPE_STRING:
if ($this->encrypted) {
$value[1] = $this->_unescape($value[1]);
$value[1] = $this->_encrypt_data($this->_currentObjId, $... | [
"protected",
"function",
"_prepareValue",
"(",
"&",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"value",
"[",
"0",
"]",
")",
"{",
"case",
"pdf_parser",
"::",
"TYPE_STRING",
":",
"if",
"(",
"$",
"this",
"->",
"encrypted",
")",
"{",
"$",
"value",
"[",
... | Writes a PDF value to the resulting document.
Prepares the value for encryption of imported data by FPDI
@param array $value | [
"Writes",
"a",
"PDF",
"value",
"to",
"the",
"resulting",
"document",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/fpdi/fpdi_bridge.php#L71-L102 |
220,183 | moodle/moodle | mod/assign/feedback/editpdf/fpdi/fpdi_bridge.php | fpdi_bridge._unescape | protected function _unescape($s)
{
$out = '';
for ($count = 0, $n = strlen($s); $count < $n; $count++) {
if ($s[$count] != '\\' || $count == $n-1) {
$out .= $s[$count];
} else {
switch ($s[++$count]) {
... | php | protected function _unescape($s)
{
$out = '';
for ($count = 0, $n = strlen($s); $count < $n; $count++) {
if ($s[$count] != '\\' || $count == $n-1) {
$out .= $s[$count];
} else {
switch ($s[++$count]) {
... | [
"protected",
"function",
"_unescape",
"(",
"$",
"s",
")",
"{",
"$",
"out",
"=",
"''",
";",
"for",
"(",
"$",
"count",
"=",
"0",
",",
"$",
"n",
"=",
"strlen",
"(",
"$",
"s",
")",
";",
"$",
"count",
"<",
"$",
"n",
";",
"$",
"count",
"++",
")",... | Un-escapes a PDF string
@param string $s
@return string | [
"Un",
"-",
"escapes",
"a",
"PDF",
"string"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/fpdi/fpdi_bridge.php#L110-L168 |
220,184 | moodle/moodle | mod/assign/feedback/editpdf/fpdi/fpdi_bridge.php | fpdi_bridge.hex2str | public function hex2str($data)
{
$data = preg_replace('/[^0-9A-Fa-f]/', '', rtrim($data, '>'));
if ((strlen($data) % 2) == 1) {
$data .= '0';
}
return pack('H*', $data);
} | php | public function hex2str($data)
{
$data = preg_replace('/[^0-9A-Fa-f]/', '', rtrim($data, '>'));
if ((strlen($data) % 2) == 1) {
$data .= '0';
}
return pack('H*', $data);
} | [
"public",
"function",
"hex2str",
"(",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"preg_replace",
"(",
"'/[^0-9A-Fa-f]/'",
",",
"''",
",",
"rtrim",
"(",
"$",
"data",
",",
"'>'",
")",
")",
";",
"if",
"(",
"(",
"strlen",
"(",
"$",
"data",
")",
"%",
"2... | Hexadecimal to string
@param string $data
@return string | [
"Hexadecimal",
"to",
"string"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/editpdf/fpdi/fpdi_bridge.php#L176-L184 |
220,185 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_forum_view_url_from_forum | public function get_forum_view_url_from_forum(forum_entity $forum, ?int $pageno = null,
?int $sortorder = null) : moodle_url {
return $this->get_forum_view_url_from_course_module_id($forum->get_course_module_record()->id, $pageno, $sortorder);
} | php | public function get_forum_view_url_from_forum(forum_entity $forum, ?int $pageno = null,
?int $sortorder = null) : moodle_url {
return $this->get_forum_view_url_from_course_module_id($forum->get_course_module_record()->id, $pageno, $sortorder);
} | [
"public",
"function",
"get_forum_view_url_from_forum",
"(",
"forum_entity",
"$",
"forum",
",",
"?",
"int",
"$",
"pageno",
"=",
"null",
",",
"?",
"int",
"$",
"sortorder",
"=",
"null",
")",
":",
"moodle_url",
"{",
"return",
"$",
"this",
"->",
"get_forum_view_u... | Get the view forum url for the given forum and optionally a page number.
@param forum_entity $forum The forum entity
@param int|null $pageno The page number
@param int|null $sortorder The sorting order
@return moodle_url | [
"Get",
"the",
"view",
"forum",
"url",
"for",
"the",
"given",
"forum",
"and",
"optionally",
"a",
"page",
"number",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L101-L105 |
220,186 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_forum_view_url_from_course_module_id | public function get_forum_view_url_from_course_module_id(int $coursemoduleid, ?int $pageno = null,
?int $sortorder = null) : moodle_url {
$url = new moodle_url('/mod/forum/view.php', [
'id' => $coursemoduleid,
]);
if (null !== $pageno) {
$url->param('p', $pa... | php | public function get_forum_view_url_from_course_module_id(int $coursemoduleid, ?int $pageno = null,
?int $sortorder = null) : moodle_url {
$url = new moodle_url('/mod/forum/view.php', [
'id' => $coursemoduleid,
]);
if (null !== $pageno) {
$url->param('p', $pa... | [
"public",
"function",
"get_forum_view_url_from_course_module_id",
"(",
"int",
"$",
"coursemoduleid",
",",
"?",
"int",
"$",
"pageno",
"=",
"null",
",",
"?",
"int",
"$",
"sortorder",
"=",
"null",
")",
":",
"moodle_url",
"{",
"$",
"url",
"=",
"new",
"moodle_url... | Get the view forum url for the given course module id and optionally a page number.
@param int $coursemoduleid The course module id
@param int|null $pageno The page number
@param int|null $sortorder The sorting order
@return moodle_url | [
"Get",
"the",
"view",
"forum",
"url",
"for",
"the",
"given",
"course",
"module",
"id",
"and",
"optionally",
"a",
"page",
"number",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L115-L131 |
220,187 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_discussion_view_first_unread_post_url_from_discussion | public function get_discussion_view_first_unread_post_url_from_discussion(discussion_entity $discussion) {
$viewurl = $this->get_discussion_view_url_from_discussion_id($discussion->get_id());
$viewurl->set_anchor('unread');
return $viewurl;
} | php | public function get_discussion_view_first_unread_post_url_from_discussion(discussion_entity $discussion) {
$viewurl = $this->get_discussion_view_url_from_discussion_id($discussion->get_id());
$viewurl->set_anchor('unread');
return $viewurl;
} | [
"public",
"function",
"get_discussion_view_first_unread_post_url_from_discussion",
"(",
"discussion_entity",
"$",
"discussion",
")",
"{",
"$",
"viewurl",
"=",
"$",
"this",
"->",
"get_discussion_view_url_from_discussion_id",
"(",
"$",
"discussion",
"->",
"get_id",
"(",
")"... | Get the url to view the first unread post in a discussion.
@param discussion_entity $discussion The discussion
@return moodle_url | [
"Get",
"the",
"url",
"to",
"view",
"the",
"first",
"unread",
"post",
"in",
"a",
"discussion",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L161-L166 |
220,188 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_view_post_url_from_post_id | public function get_view_post_url_from_post_id(int $discussionid, int $postid) : moodle_url {
$url = $this->get_discussion_view_url_from_discussion_id($discussionid);
$url->set_anchor('p' . $postid);
return $url;
} | php | public function get_view_post_url_from_post_id(int $discussionid, int $postid) : moodle_url {
$url = $this->get_discussion_view_url_from_discussion_id($discussionid);
$url->set_anchor('p' . $postid);
return $url;
} | [
"public",
"function",
"get_view_post_url_from_post_id",
"(",
"int",
"$",
"discussionid",
",",
"int",
"$",
"postid",
")",
":",
"moodle_url",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"get_discussion_view_url_from_discussion_id",
"(",
"$",
"discussionid",
")",
";",
... | Get the url to view a discussion from a discussion id and post id.
@param int $discussionid The discussion id
@param int $postid The post id
@return moodle_url | [
"Get",
"the",
"url",
"to",
"view",
"a",
"discussion",
"from",
"a",
"discussion",
"id",
"and",
"post",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L201-L205 |
220,189 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_view_post_url_from_post | public function get_view_post_url_from_post(post_entity $post) : moodle_url {
return $this->get_view_post_url_from_post_id($post->get_discussion_id(), $post->get_id());
} | php | public function get_view_post_url_from_post(post_entity $post) : moodle_url {
return $this->get_view_post_url_from_post_id($post->get_discussion_id(), $post->get_id());
} | [
"public",
"function",
"get_view_post_url_from_post",
"(",
"post_entity",
"$",
"post",
")",
":",
"moodle_url",
"{",
"return",
"$",
"this",
"->",
"get_view_post_url_from_post_id",
"(",
"$",
"post",
"->",
"get_discussion_id",
"(",
")",
",",
"$",
"post",
"->",
"get_... | Get the url to view a post in the context of the rest of the discussion.
@param post_entity $post The post
@return moodle_url | [
"Get",
"the",
"url",
"to",
"view",
"a",
"post",
"in",
"the",
"context",
"of",
"the",
"rest",
"of",
"the",
"discussion",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L213-L215 |
220,190 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_edit_post_url_from_post | public function get_edit_post_url_from_post(forum_entity $forum, post_entity $post) : moodle_url {
if ($forum->get_type() == 'single') {
return new moodle_url('/course/modedit.php', [
'update' => $forum->get_course_module_record()->id,
'sesskey' => sesskey(),
... | php | public function get_edit_post_url_from_post(forum_entity $forum, post_entity $post) : moodle_url {
if ($forum->get_type() == 'single') {
return new moodle_url('/course/modedit.php', [
'update' => $forum->get_course_module_record()->id,
'sesskey' => sesskey(),
... | [
"public",
"function",
"get_edit_post_url_from_post",
"(",
"forum_entity",
"$",
"forum",
",",
"post_entity",
"$",
"post",
")",
":",
"moodle_url",
"{",
"if",
"(",
"$",
"forum",
"->",
"get_type",
"(",
")",
"==",
"'single'",
")",
"{",
"return",
"new",
"moodle_ur... | Get the url to edit a post.
@param forum_entity $forum The forum the post belongs to
@param post_entity $post The post
@return moodle_url | [
"Get",
"the",
"url",
"to",
"edit",
"a",
"post",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L249-L261 |
220,191 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_mark_post_as_read_url_from_post | public function get_mark_post_as_read_url_from_post(post_entity $post, int $displaymode = FORUM_MODE_THREADED) : moodle_url {
$params = [
'd' => $post->get_discussion_id(),
'postid' => $post->get_id(),
'mark' => 'read'
];
$url = new moodle_url('/mod/forum/dis... | php | public function get_mark_post_as_read_url_from_post(post_entity $post, int $displaymode = FORUM_MODE_THREADED) : moodle_url {
$params = [
'd' => $post->get_discussion_id(),
'postid' => $post->get_id(),
'mark' => 'read'
];
$url = new moodle_url('/mod/forum/dis... | [
"public",
"function",
"get_mark_post_as_read_url_from_post",
"(",
"post_entity",
"$",
"post",
",",
"int",
"$",
"displaymode",
"=",
"FORUM_MODE_THREADED",
")",
":",
"moodle_url",
"{",
"$",
"params",
"=",
"[",
"'d'",
"=>",
"$",
"post",
"->",
"get_discussion_id",
"... | Get the url to mark a post as read.
@param post_entity $post The post
@param int $displaymode The display mode to show the forum in after marking as read
@return moodle_url | [
"Get",
"the",
"url",
"to",
"mark",
"a",
"post",
"as",
"read",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L328-L344 |
220,192 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_export_attachment_url_from_post_and_attachment | public function get_export_attachment_url_from_post_and_attachment(post_entity $post, stored_file $attachment) : ?moodle_url {
global $CFG;
require_once($CFG->libdir . '/portfoliolib.php');
$button = new \portfolio_add_button();
$button->set_callback_options(
'forum_portfoli... | php | public function get_export_attachment_url_from_post_and_attachment(post_entity $post, stored_file $attachment) : ?moodle_url {
global $CFG;
require_once($CFG->libdir . '/portfoliolib.php');
$button = new \portfolio_add_button();
$button->set_callback_options(
'forum_portfoli... | [
"public",
"function",
"get_export_attachment_url_from_post_and_attachment",
"(",
"post_entity",
"$",
"post",
",",
"stored_file",
"$",
"attachment",
")",
":",
"?",
"moodle_url",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
... | Get the url to export attachments for a post.
@param post_entity $post The post
@param stored_file $attachment
@return moodle_url|null | [
"Get",
"the",
"url",
"to",
"export",
"attachments",
"for",
"a",
"post",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L378-L391 |
220,193 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_author_profile_image_url | public function get_author_profile_image_url(author_entity $author, int $authorcontextid = null) : moodle_url {
global $PAGE;
$datamapper = $this->legacydatamapperfactory->get_author_data_mapper();
$record = $datamapper->to_legacy_object($author);
$record->contextid = $authorcontextid;
... | php | public function get_author_profile_image_url(author_entity $author, int $authorcontextid = null) : moodle_url {
global $PAGE;
$datamapper = $this->legacydatamapperfactory->get_author_data_mapper();
$record = $datamapper->to_legacy_object($author);
$record->contextid = $authorcontextid;
... | [
"public",
"function",
"get_author_profile_image_url",
"(",
"author_entity",
"$",
"author",
",",
"int",
"$",
"authorcontextid",
"=",
"null",
")",
":",
"moodle_url",
"{",
"global",
"$",
"PAGE",
";",
"$",
"datamapper",
"=",
"$",
"this",
"->",
"legacydatamapperfacto... | Get the url to view the author's profile image. The author's context id should be
provided to prevent the code from needing to load it.
@param author_entity $author The author
@param int|null $authorcontextid The author context id
@return moodle_url | [
"Get",
"the",
"url",
"to",
"view",
"the",
"author",
"s",
"profile",
"image",
".",
"The",
"author",
"s",
"context",
"id",
"should",
"be",
"provided",
"to",
"prevent",
"the",
"code",
"from",
"needing",
"to",
"load",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L413-L423 |
220,194 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_mark_discussion_as_read_url_from_discussion | public function get_mark_discussion_as_read_url_from_discussion(
forum_entity $forum,
discussion_entity $discussion
) : moodle_url {
return new moodle_url('/mod/forum/markposts.php', [
'f' => $discussion->get_forum_id(),
'd' => $discussion->get_id(),
'mark... | php | public function get_mark_discussion_as_read_url_from_discussion(
forum_entity $forum,
discussion_entity $discussion
) : moodle_url {
return new moodle_url('/mod/forum/markposts.php', [
'f' => $discussion->get_forum_id(),
'd' => $discussion->get_id(),
'mark... | [
"public",
"function",
"get_mark_discussion_as_read_url_from_discussion",
"(",
"forum_entity",
"$",
"forum",
",",
"discussion_entity",
"$",
"discussion",
")",
":",
"moodle_url",
"{",
"return",
"new",
"moodle_url",
"(",
"'/mod/forum/markposts.php'",
",",
"[",
"'f'",
"=>",... | Get the url to mark a discussion as read.
@param forum_entity $forum The forum that the discussion belongs to
@param discussion_entity $discussion The discussion
@return moodle_url | [
"Get",
"the",
"url",
"to",
"mark",
"a",
"discussion",
"as",
"read",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L432-L443 |
220,195 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_mark_all_discussions_as_read_url | public function get_mark_all_discussions_as_read_url(forum_entity $forum) : moodle_url {
return new moodle_url('/mod/forum/markposts.php', [
'f' => $forum->get_id(),
'mark' => 'read',
'sesskey' => sesskey(),
'return' => $this->get_forum_view_url_from_forum($forum)... | php | public function get_mark_all_discussions_as_read_url(forum_entity $forum) : moodle_url {
return new moodle_url('/mod/forum/markposts.php', [
'f' => $forum->get_id(),
'mark' => 'read',
'sesskey' => sesskey(),
'return' => $this->get_forum_view_url_from_forum($forum)... | [
"public",
"function",
"get_mark_all_discussions_as_read_url",
"(",
"forum_entity",
"$",
"forum",
")",
":",
"moodle_url",
"{",
"return",
"new",
"moodle_url",
"(",
"'/mod/forum/markposts.php'",
",",
"[",
"'f'",
"=>",
"$",
"forum",
"->",
"get_id",
"(",
")",
",",
"'... | Get the url to mark all discussions as read.
@param forum_entity $forum The forum that the discussions belong to
@return moodle_url | [
"Get",
"the",
"url",
"to",
"mark",
"all",
"discussions",
"as",
"read",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L451-L458 |
220,196 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_discussion_subscribe_url | public function get_discussion_subscribe_url(discussion_entity $discussion) : moodle_url {
return new moodle_url('/mod/forum/subscribe.php', [
'sesskey' => sesskey(),
'id' => $discussion->get_forum_id(),
'd' => $discussion->get_id()
]);
} | php | public function get_discussion_subscribe_url(discussion_entity $discussion) : moodle_url {
return new moodle_url('/mod/forum/subscribe.php', [
'sesskey' => sesskey(),
'id' => $discussion->get_forum_id(),
'd' => $discussion->get_id()
]);
} | [
"public",
"function",
"get_discussion_subscribe_url",
"(",
"discussion_entity",
"$",
"discussion",
")",
":",
"moodle_url",
"{",
"return",
"new",
"moodle_url",
"(",
"'/mod/forum/subscribe.php'",
",",
"[",
"'sesskey'",
"=>",
"sesskey",
"(",
")",
",",
"'id'",
"=>",
"... | Get the url to subscribe to a discussion.
@param discussion_entity $discussion The discussion
@return moodle_url | [
"Get",
"the",
"url",
"to",
"subscribe",
"to",
"a",
"discussion",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L466-L472 |
220,197 | moodle/moodle | mod/forum/classes/local/factories/url.php | url.get_pin_discussion_url_from_discussion | public function get_pin_discussion_url_from_discussion(discussion_entity $discussion) : moodle_url {
return new moodle_url('discuss.php', [
'sesskey' => sesskey(),
'd' => $discussion->get_id(),
'pin' => $discussion->is_pinned() ? FORUM_DISCUSSION_UNPINNED : FORUM_DISCUSSION_P... | php | public function get_pin_discussion_url_from_discussion(discussion_entity $discussion) : moodle_url {
return new moodle_url('discuss.php', [
'sesskey' => sesskey(),
'd' => $discussion->get_id(),
'pin' => $discussion->is_pinned() ? FORUM_DISCUSSION_UNPINNED : FORUM_DISCUSSION_P... | [
"public",
"function",
"get_pin_discussion_url_from_discussion",
"(",
"discussion_entity",
"$",
"discussion",
")",
":",
"moodle_url",
"{",
"return",
"new",
"moodle_url",
"(",
"'discuss.php'",
",",
"[",
"'sesskey'",
"=>",
"sesskey",
"(",
")",
",",
"'d'",
"=>",
"$",
... | Generate the pinned discussion link
@param discussion_entity $discussion
@return moodle_url
@throws \moodle_exception | [
"Generate",
"the",
"pinned",
"discussion",
"link"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/url.php#L481-L487 |
220,198 | moodle/moodle | admin/tool/uploadcourse/classes/tracker.php | tool_uploadcourse_tracker.finish | public function finish() {
if ($this->outputmode == self::NO_OUTPUT) {
return;
}
if ($this->outputmode == self::OUTPUT_HTML) {
echo html_writer::end_tag('table');
}
} | php | public function finish() {
if ($this->outputmode == self::NO_OUTPUT) {
return;
}
if ($this->outputmode == self::OUTPUT_HTML) {
echo html_writer::end_tag('table');
}
} | [
"public",
"function",
"finish",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"outputmode",
"==",
"self",
"::",
"NO_OUTPUT",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"outputmode",
"==",
"self",
"::",
"OUTPUT_HTML",
")",
"{",
"echo",... | Finish the output.
@return void | [
"Finish",
"the",
"output",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/uploadcourse/classes/tracker.php#L89-L97 |
220,199 | moodle/moodle | admin/tool/uploadcourse/classes/tracker.php | tool_uploadcourse_tracker.results | public function results($total, $created, $updated, $deleted, $errors) {
if ($this->outputmode == self::NO_OUTPUT) {
return;
}
$message = array(
get_string('coursestotal', 'tool_uploadcourse', $total),
get_string('coursescreated', 'tool_uploadcourse', $create... | php | public function results($total, $created, $updated, $deleted, $errors) {
if ($this->outputmode == self::NO_OUTPUT) {
return;
}
$message = array(
get_string('coursestotal', 'tool_uploadcourse', $total),
get_string('coursescreated', 'tool_uploadcourse', $create... | [
"public",
"function",
"results",
"(",
"$",
"total",
",",
"$",
"created",
",",
"$",
"updated",
",",
"$",
"deleted",
",",
"$",
"errors",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"outputmode",
"==",
"self",
"::",
"NO_OUTPUT",
")",
"{",
"return",
";",
"... | Output the results.
@param int $total total courses.
@param int $created count of courses created.
@param int $updated count of courses updated.
@param int $deleted count of courses deleted.
@param int $errors count of errors.
@return void | [
"Output",
"the",
"results",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/uploadcourse/classes/tracker.php#L109-L133 |
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.