id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
214,400 | moodle/moodle | lib/adodb/adodb-pager.inc.php | ADODB_Pager.RenderNav | function RenderNav()
{
ob_start();
if (!$this->rs->AtFirstPage()) {
$this->Render_First();
$this->Render_Prev();
} else {
$this->Render_First(false);
$this->Render_Prev(false);
}
if ($this->showPageLinks){
$this->Render_PageLinks();
}
if (!$this->rs->AtLastPage()) {
... | php | function RenderNav()
{
ob_start();
if (!$this->rs->AtFirstPage()) {
$this->Render_First();
$this->Render_Prev();
} else {
$this->Render_First(false);
$this->Render_Prev(false);
}
if ($this->showPageLinks){
$this->Render_PageLinks();
}
if (!$this->rs->AtLastPage()) {
... | [
"function",
"RenderNav",
"(",
")",
"{",
"ob_start",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"rs",
"->",
"AtFirstPage",
"(",
")",
")",
"{",
"$",
"this",
"->",
"Render_First",
"(",
")",
";",
"$",
"this",
"->",
"Render_Prev",
"(",
")",
";"... | we use output buffering to keep the code easy to read. | [
"we",
"use",
"output",
"buffering",
"to",
"keep",
"the",
"code",
"easy",
"to",
"read",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-pager.inc.php#L203-L226 |
214,401 | moodle/moodle | lib/adodb/adodb-pager.inc.php | ADODB_Pager.RenderPageCount | function RenderPageCount()
{
if (!$this->db->pageExecuteCountRows) return '';
$lastPage = $this->rs->LastPageNo();
if ($lastPage == -1) $lastPage = 1; // check for empty rs.
if ($this->curr_page > $lastPage) $this->curr_page = 1;
return "<font size=-1>$this->page ".$this->curr_page."/".$lastPage."</font>";
... | php | function RenderPageCount()
{
if (!$this->db->pageExecuteCountRows) return '';
$lastPage = $this->rs->LastPageNo();
if ($lastPage == -1) $lastPage = 1; // check for empty rs.
if ($this->curr_page > $lastPage) $this->curr_page = 1;
return "<font size=-1>$this->page ".$this->curr_page."/".$lastPage."</font>";
... | [
"function",
"RenderPageCount",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"db",
"->",
"pageExecuteCountRows",
")",
"return",
"''",
";",
"$",
"lastPage",
"=",
"$",
"this",
"->",
"rs",
"->",
"LastPageNo",
"(",
")",
";",
"if",
"(",
"$",
"lastPage... | This is the footer | [
"This",
"is",
"the",
"footer"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-pager.inc.php#L230-L237 |
214,402 | moodle/moodle | lib/adodb/adodb-pager.inc.php | ADODB_Pager.Render | function Render($rows=10)
{
global $ADODB_COUNTRECS;
$this->rows = $rows;
if ($this->db->dataProvider == 'informix') $this->db->cursorType = IFX_SCROLL;
$savec = $ADODB_COUNTRECS;
if ($this->db->pageExecuteCountRows) $ADODB_COUNTRECS = true;
if ($this->cache)
$rs = $this->db->CachePageExecute($this->c... | php | function Render($rows=10)
{
global $ADODB_COUNTRECS;
$this->rows = $rows;
if ($this->db->dataProvider == 'informix') $this->db->cursorType = IFX_SCROLL;
$savec = $ADODB_COUNTRECS;
if ($this->db->pageExecuteCountRows) $ADODB_COUNTRECS = true;
if ($this->cache)
$rs = $this->db->CachePageExecute($this->c... | [
"function",
"Render",
"(",
"$",
"rows",
"=",
"10",
")",
"{",
"global",
"$",
"ADODB_COUNTRECS",
";",
"$",
"this",
"->",
"rows",
"=",
"$",
"rows",
";",
"if",
"(",
"$",
"this",
"->",
"db",
"->",
"dataProvider",
"==",
"'informix'",
")",
"$",
"this",
"-... | Call this class to draw everything. | [
"Call",
"this",
"class",
"to",
"draw",
"everything",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-pager.inc.php#L241-L275 |
214,403 | moodle/moodle | lib/classes/dml/recordset_walk.php | recordset_walk.current | public function current() {
if (!$this->recordset->valid()) {
return false;
}
if (!$record = $this->recordset->current()) {
return false;
}
// Apply callback and return.
if (!is_null($this->callbackextra)) {
return call_user_func($th... | php | public function current() {
if (!$this->recordset->valid()) {
return false;
}
if (!$record = $this->recordset->current()) {
return false;
}
// Apply callback and return.
if (!is_null($this->callbackextra)) {
return call_user_func($th... | [
"public",
"function",
"current",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"recordset",
"->",
"valid",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"record",
"=",
"$",
"this",
"->",
"recordset",
"->",
"current",
"... | Returns the current element after applying the callback.
@return mixed|bool The returned value type will depend on the callback. | [
"Returns",
"the",
"current",
"element",
"after",
"applying",
"the",
"callback",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/dml/recordset_walk.php#L91-L107 |
214,404 | moodle/moodle | lib/lessphp/Output.php | Less_Output.add | public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null){
$this->strs[] = $chunk;
} | php | public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null){
$this->strs[] = $chunk;
} | [
"public",
"function",
"add",
"(",
"$",
"chunk",
",",
"$",
"fileInfo",
"=",
"null",
",",
"$",
"index",
"=",
"0",
",",
"$",
"mapLines",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"strs",
"[",
"]",
"=",
"$",
"chunk",
";",
"}"
] | Adds a chunk to the stack
@param string $chunk The chunk to output
@param Less_FileInfo $fileInfo The file information
@param integer $index The index
@param mixed $mapLines | [
"Adds",
"a",
"chunk",
"to",
"the",
"stack"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Output.php#L26-L28 |
214,405 | moodle/moodle | question/behaviour/adaptive/renderer.php | qbehaviour_adaptive_renderer.render_adaptive_marks | public function render_adaptive_marks(qbehaviour_adaptive_mark_details $details, question_display_options $options) {
if ($details->state == question_state::$todo || $options->marks < question_display_options::MARK_AND_MAX) {
// No grades yet.
return '';
}
// Display the... | php | public function render_adaptive_marks(qbehaviour_adaptive_mark_details $details, question_display_options $options) {
if ($details->state == question_state::$todo || $options->marks < question_display_options::MARK_AND_MAX) {
// No grades yet.
return '';
}
// Display the... | [
"public",
"function",
"render_adaptive_marks",
"(",
"qbehaviour_adaptive_mark_details",
"$",
"details",
",",
"question_display_options",
"$",
"options",
")",
"{",
"if",
"(",
"$",
"details",
"->",
"state",
"==",
"question_state",
"::",
"$",
"todo",
"||",
"$",
"opti... | Display the scoring information about an adaptive attempt.
@param qbehaviour_adaptive_mark_details contains all the score details we need.
@param question_display_options $options display options. | [
"Display",
"the",
"scoring",
"information",
"about",
"an",
"adaptive",
"attempt",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/behaviour/adaptive/renderer.php#L62-L74 |
214,406 | moodle/moodle | question/behaviour/adaptive/renderer.php | qbehaviour_adaptive_renderer.grading_details | protected function grading_details(qbehaviour_adaptive_mark_details $details, question_display_options $options) {
$mark = $details->get_formatted_marks($options->markdp);
if ($details->currentpenalty == 0 && $details->totalpenalty == 0) {
return get_string('gradingdetails', 'qbehaviour_ad... | php | protected function grading_details(qbehaviour_adaptive_mark_details $details, question_display_options $options) {
$mark = $details->get_formatted_marks($options->markdp);
if ($details->currentpenalty == 0 && $details->totalpenalty == 0) {
return get_string('gradingdetails', 'qbehaviour_ad... | [
"protected",
"function",
"grading_details",
"(",
"qbehaviour_adaptive_mark_details",
"$",
"details",
",",
"question_display_options",
"$",
"options",
")",
"{",
"$",
"mark",
"=",
"$",
"details",
"->",
"get_formatted_marks",
"(",
"$",
"options",
"->",
"markdp",
")",
... | Display the information about the penalty calculations.
@param qbehaviour_adaptive_mark_details contains all the score details we need.
@param question_display_options $options display options.
@return string html fragment | [
"Display",
"the",
"information",
"about",
"the",
"penalty",
"calculations",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/behaviour/adaptive/renderer.php#L82-L113 |
214,407 | moodle/moodle | mod/lti/classes/external.php | mod_lti_external.tool_type_return_structure | private static function tool_type_return_structure() {
return new external_single_structure(
array(
'id' => new external_value(PARAM_INT, 'Tool type id'),
'name' => new external_value(PARAM_NOTAGS, 'Tool type name'),
'description' => new external_value... | php | private static function tool_type_return_structure() {
return new external_single_structure(
array(
'id' => new external_value(PARAM_INT, 'Tool type id'),
'name' => new external_value(PARAM_NOTAGS, 'Tool type name'),
'description' => new external_value... | [
"private",
"static",
"function",
"tool_type_return_structure",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'id'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'Tool type id'",
")",
",",
"'name'",
"=>",
"new",
"externa... | Returns structure be used for returning a tool type from a web service.
@return external_function_parameters
@since Moodle 3.1 | [
"Returns",
"structure",
"be",
"used",
"for",
"returning",
"a",
"tool",
"type",
"from",
"a",
"web",
"service",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/external.php#L50-L85 |
214,408 | moodle/moodle | mod/lti/classes/external.php | mod_lti_external.tool_proxy_return_structure | private static function tool_proxy_return_structure() {
return new external_function_parameters(
array(
'id' => new external_value(PARAM_INT, 'Tool proxy id'),
'name' => new external_value(PARAM_TEXT, 'Tool proxy name'),
'regurl' => new external_value(... | php | private static function tool_proxy_return_structure() {
return new external_function_parameters(
array(
'id' => new external_value(PARAM_INT, 'Tool proxy id'),
'name' => new external_value(PARAM_TEXT, 'Tool proxy name'),
'regurl' => new external_value(... | [
"private",
"static",
"function",
"tool_proxy_return_structure",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'id'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'Tool proxy id'",
")",
",",
"'name'",
"=>",
"new",
"ex... | Returns description of a tool proxy
@return external_function_parameters
@since Moodle 3.1 | [
"Returns",
"description",
"of",
"a",
"tool",
"proxy"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/external.php#L93-L110 |
214,409 | moodle/moodle | mod/lti/classes/external.php | mod_lti_external.get_tool_launch_data | public static function get_tool_launch_data($toolid) {
global $DB, $CFG;
require_once($CFG->dirroot . '/mod/lti/lib.php');
$params = self::validate_parameters(self::get_tool_launch_data_parameters(),
array(
... | php | public static function get_tool_launch_data($toolid) {
global $DB, $CFG;
require_once($CFG->dirroot . '/mod/lti/lib.php');
$params = self::validate_parameters(self::get_tool_launch_data_parameters(),
array(
... | [
"public",
"static",
"function",
"get_tool_launch_data",
"(",
"$",
"toolid",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/mod/lti/lib.php'",
")",
";",
"$",
"params",
"=",
"self",
"::",
"val... | Return the launch data for a given external tool.
@param int $toolid the external tool instance id
@return array of warnings and launch data
@since Moodle 3.0
@throws moodle_exception | [
"Return",
"the",
"launch",
"data",
"for",
"a",
"given",
"external",
"tool",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/external.php#L187-L222 |
214,410 | moodle/moodle | mod/lti/classes/external.php | mod_lti_external.get_ltis_by_courses | public static function get_ltis_by_courses($courseids = array()) {
global $CFG;
$returnedltis = array();
$warnings = array();
$params = self::validate_parameters(self::get_ltis_by_courses_parameters(), array('courseids' => $courseids));
$mycourses = array();
if (empty(... | php | public static function get_ltis_by_courses($courseids = array()) {
global $CFG;
$returnedltis = array();
$warnings = array();
$params = self::validate_parameters(self::get_ltis_by_courses_parameters(), array('courseids' => $courseids));
$mycourses = array();
if (empty(... | [
"public",
"static",
"function",
"get_ltis_by_courses",
"(",
"$",
"courseids",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"returnedltis",
"=",
"array",
"(",
")",
";",
"$",
"warnings",
"=",
"array",
"(",
")",
";",
"$",
"params",
... | Returns a list of external tools in a provided list of courses,
if no list is provided all external tools that the user can view will be returned.
@param array $courseids the course ids
@return array the lti details
@since Moodle 3.0 | [
"Returns",
"a",
"list",
"of",
"external",
"tools",
"in",
"a",
"provided",
"list",
"of",
"courses",
"if",
"no",
"list",
"is",
"provided",
"all",
"external",
"tools",
"that",
"the",
"user",
"can",
"view",
"will",
"be",
"returned",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/external.php#L271-L339 |
214,411 | moodle/moodle | mod/lti/classes/external.php | mod_lti_external.get_ltis_by_courses_returns | public static function get_ltis_by_courses_returns() {
return new external_single_structure(
array(
'ltis' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_value(PAR... | php | public static function get_ltis_by_courses_returns() {
return new external_single_structure(
array(
'ltis' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_value(PAR... | [
"public",
"static",
"function",
"get_ltis_by_courses_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'ltis'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'id'",
"=>... | Describes the get_ltis_by_courses return value.
@return external_single_structure
@since Moodle 3.0 | [
"Describes",
"the",
"get_ltis_by_courses",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/external.php#L347-L398 |
214,412 | moodle/moodle | mod/lti/classes/external.php | mod_lti_external.create_tool_proxy | public static function create_tool_proxy($name, $registrationurl, $capabilityoffered, $serviceoffered) {
$params = self::validate_parameters(self::create_tool_proxy_parameters(),
array(
'name' => $name,
... | php | public static function create_tool_proxy($name, $registrationurl, $capabilityoffered, $serviceoffered) {
$params = self::validate_parameters(self::create_tool_proxy_parameters(),
array(
'name' => $name,
... | [
"public",
"static",
"function",
"create_tool_proxy",
"(",
"$",
"name",
",",
"$",
"registrationurl",
",",
"$",
"capabilityoffered",
",",
"$",
"serviceoffered",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"create_tool_prox... | Creates a new tool proxy
@param string $name Tool proxy name
@param string $registrationurl Registration url
@param string[] $capabilityoffered List of capabilities this tool proxy should be offered
@param string[] $serviceoffered List of services this tool proxy should be offered
@return object The new tool proxy
@si... | [
"Creates",
"a",
"new",
"tool",
"proxy"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/external.php#L497-L544 |
214,413 | moodle/moodle | mod/lti/classes/external.php | mod_lti_external.get_tool_proxy_registration_request | public static function get_tool_proxy_registration_request($id) {
$params = self::validate_parameters(self::get_tool_proxy_registration_request_parameters(),
array(
'id' => $id,
... | php | public static function get_tool_proxy_registration_request($id) {
$params = self::validate_parameters(self::get_tool_proxy_registration_request_parameters(),
array(
'id' => $id,
... | [
"public",
"static",
"function",
"get_tool_proxy_registration_request",
"(",
"$",
"id",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_tool_proxy_registration_request_parameters",
"(",
")",
",",
"array",
"(",
"'id'",
"=>",
... | Returns the registration request for a tool proxy.
@param int $id the lti instance id
@return array of registration parameters
@since Moodle 3.1
@throws moodle_exception | [
"Returns",
"the",
"registration",
"request",
"for",
"a",
"tool",
"proxy",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/external.php#L628-L641 |
214,414 | moodle/moodle | mod/lti/classes/external.php | mod_lti_external.create_tool_type | public static function create_tool_type($cartridgeurl, $key, $secret) {
$params = self::validate_parameters(self::create_tool_type_parameters(),
array(
'cartridgeurl' => $cartridgeurl,
... | php | public static function create_tool_type($cartridgeurl, $key, $secret) {
$params = self::validate_parameters(self::create_tool_type_parameters(),
array(
'cartridgeurl' => $cartridgeurl,
... | [
"public",
"static",
"function",
"create_tool_type",
"(",
"$",
"cartridgeurl",
",",
"$",
"key",
",",
"$",
"secret",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"create_tool_type_parameters",
"(",
")",
",",
"array",
"(... | Creates a tool type.
@param string $cartridgeurl Url of the xml cartridge representing the LTI tool
@param string $key The consumer key to identify this consumer
@param string $secret The secret
@return array created tool type
@since Moodle 3.1
@throws moodle_exception If the tool type could not be created | [
"Creates",
"a",
"tool",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/external.php#L746-L795 |
214,415 | moodle/moodle | mod/lti/classes/external.php | mod_lti_external.update_tool_type | public static function update_tool_type($id, $name, $description, $state) {
$params = self::validate_parameters(self::update_tool_type_parameters(),
array(
'id' => $id,
'na... | php | public static function update_tool_type($id, $name, $description, $state) {
$params = self::validate_parameters(self::update_tool_type_parameters(),
array(
'id' => $id,
'na... | [
"public",
"static",
"function",
"update_tool_type",
"(",
"$",
"id",
",",
"$",
"name",
",",
"$",
"description",
",",
"$",
"state",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"update_tool_type_parameters",
"(",
")",
... | Update a tool type.
@param int $id The id of the tool type to update
@param string $name The name of the tool type
@param string $description The name of the tool type
@param int $state The state of the tool type
@return array updated tool type
@since Moodle 3.1
@throws moodle_exception | [
"Update",
"a",
"tool",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/external.php#L835-L878 |
214,416 | moodle/moodle | mod/lti/classes/external.php | mod_lti_external.delete_tool_type | public static function delete_tool_type($id) {
$params = self::validate_parameters(self::delete_tool_type_parameters(),
array(
'id' => $id,
));
$id = $params['id'];
... | php | public static function delete_tool_type($id) {
$params = self::validate_parameters(self::delete_tool_type_parameters(),
array(
'id' => $id,
));
$id = $params['id'];
... | [
"public",
"static",
"function",
"delete_tool_type",
"(",
"$",
"id",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"delete_tool_type_parameters",
"(",
")",
",",
"array",
"(",
"'id'",
"=>",
"$",
"id",
",",
")",
")",
... | Delete a tool type.
@param int $id The id of the tool type to be deleted
@return array deleted tool type
@since Moodle 3.1
@throws moodle_exception | [
"Delete",
"a",
"tool",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/external.php#L912-L937 |
214,417 | moodle/moodle | mod/lti/classes/external.php | mod_lti_external.is_cartridge | public static function is_cartridge($url) {
$params = self::validate_parameters(self::is_cartridge_parameters(),
array(
'url' => $url,
));
$url = $params['url'];
... | php | public static function is_cartridge($url) {
$params = self::validate_parameters(self::is_cartridge_parameters(),
array(
'url' => $url,
));
$url = $params['url'];
... | [
"public",
"static",
"function",
"is_cartridge",
"(",
"$",
"url",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"is_cartridge_parameters",
"(",
")",
",",
"array",
"(",
"'url'",
"=>",
"$",
"url",
",",
")",
")",
";",
... | Determine if the url to a tool is for a cartridge.
@param string $url Url that may or may not be an xml cartridge
@return bool True if the url is for a cartridge.
@since Moodle 3.1
@throws moodle_exception | [
"Determine",
"if",
"the",
"url",
"to",
"a",
"tool",
"is",
"for",
"a",
"cartridge",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/classes/external.php#L975-L989 |
214,418 | moodle/moodle | grade/grading/pick_form.php | grading_search_template_form.definition | public function definition() {
$mform = $this->_form;
$mform->addElement('header', 'searchheader', get_string('searchtemplate', 'core_grading'));
$mform->addHelpButton('searchheader', 'searchtemplate', 'core_grading');
$mform->addGroup(array(
$mform->createElement('checkbox',... | php | public function definition() {
$mform = $this->_form;
$mform->addElement('header', 'searchheader', get_string('searchtemplate', 'core_grading'));
$mform->addHelpButton('searchheader', 'searchtemplate', 'core_grading');
$mform->addGroup(array(
$mform->createElement('checkbox',... | [
"public",
"function",
"definition",
"(",
")",
"{",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"$",
"mform",
"->",
"addElement",
"(",
"'header'",
",",
"'searchheader'",
",",
"get_string",
"(",
"'searchtemplate'",
",",
"'core_grading'",
")",
")",
";... | Pretty simple search box | [
"Pretty",
"simple",
"search",
"box"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/pick_form.php#L41-L52 |
214,419 | moodle/moodle | user/classes/output/myprofile/renderer.php | renderer.render_category | public function render_category(category $category) {
$classes = $category->classes;
if (empty($classes)) {
$return = \html_writer::start_tag('section', array('class' => 'node_category'));
} else {
$return = \html_writer::start_tag('section', array('class' => 'node_catego... | php | public function render_category(category $category) {
$classes = $category->classes;
if (empty($classes)) {
$return = \html_writer::start_tag('section', array('class' => 'node_category'));
} else {
$return = \html_writer::start_tag('section', array('class' => 'node_catego... | [
"public",
"function",
"render_category",
"(",
"category",
"$",
"category",
")",
"{",
"$",
"classes",
"=",
"$",
"category",
"->",
"classes",
";",
"if",
"(",
"empty",
"(",
"$",
"classes",
")",
")",
"{",
"$",
"return",
"=",
"\\",
"html_writer",
"::",
"sta... | Render a category.
@param category $category
@return string | [
"Render",
"a",
"category",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/output/myprofile/renderer.php#L60-L80 |
214,420 | moodle/moodle | user/classes/output/myprofile/renderer.php | renderer.render_node | public function render_node(node $node) {
$return = '';
if (is_object($node->url)) {
$header = \html_writer::link($node->url, $node->title);
} else {
$header = $node->title;
}
$icon = $node->icon;
if (!empty($icon)) {
$header .= $this->... | php | public function render_node(node $node) {
$return = '';
if (is_object($node->url)) {
$header = \html_writer::link($node->url, $node->title);
} else {
$header = $node->title;
}
$icon = $node->icon;
if (!empty($icon)) {
$header .= $this->... | [
"public",
"function",
"render_node",
"(",
"node",
"$",
"node",
")",
"{",
"$",
"return",
"=",
"''",
";",
"if",
"(",
"is_object",
"(",
"$",
"node",
"->",
"url",
")",
")",
"{",
"$",
"header",
"=",
"\\",
"html_writer",
"::",
"link",
"(",
"$",
"node",
... | Render a node.
@param node $node
@return string | [
"Render",
"a",
"node",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/output/myprofile/renderer.php#L89-L123 |
214,421 | moodle/moodle | admin/tool/messageinbound/renderer.php | tool_messageinbound_renderer.messageinbound_handlers_table | public function messageinbound_handlers_table(array $handlers) {
global $CFG;
$table = new html_table();
$handlername = new html_table_cell(get_string('name', 'tool_messageinbound') . "\n" .
html_writer::tag('span', get_string('classname', 'tool_messageinbound'), array('class' =... | php | public function messageinbound_handlers_table(array $handlers) {
global $CFG;
$table = new html_table();
$handlername = new html_table_cell(get_string('name', 'tool_messageinbound') . "\n" .
html_writer::tag('span', get_string('classname', 'tool_messageinbound'), array('class' =... | [
"public",
"function",
"messageinbound_handlers_table",
"(",
"array",
"$",
"handlers",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"table",
"=",
"new",
"html_table",
"(",
")",
";",
"$",
"handlername",
"=",
"new",
"html_table_cell",
"(",
"get_string",
"(",
"'nam... | Render a table listing all of the Inbound Message handlers.
@param array $handlers - list of all messageinbound handlers.
@return string HTML to output. | [
"Render",
"a",
"table",
"listing",
"all",
"of",
"the",
"Inbound",
"Message",
"handlers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/messageinbound/renderer.php#L41-L107 |
214,422 | moodle/moodle | comment/lib.php | comment.init | public static function init(moodle_page $page = null) {
global $PAGE;
if (empty($page)) {
$page = $PAGE;
}
// setup variables for non-js interface
self::$nonjs = optional_param('nonjscomment', '', PARAM_ALPHANUM);
self::$comment_itemid = optional_param('comme... | php | public static function init(moodle_page $page = null) {
global $PAGE;
if (empty($page)) {
$page = $PAGE;
}
// setup variables for non-js interface
self::$nonjs = optional_param('nonjscomment', '', PARAM_ALPHANUM);
self::$comment_itemid = optional_param('comme... | [
"public",
"static",
"function",
"init",
"(",
"moodle_page",
"$",
"page",
"=",
"null",
")",
"{",
"global",
"$",
"PAGE",
";",
"if",
"(",
"empty",
"(",
"$",
"page",
")",
")",
"{",
"$",
"page",
"=",
"$",
"PAGE",
";",
"}",
"// setup variables for non-js int... | Receive nonjs comment parameters
@param moodle_page $page The page object to initialise comments within
If not provided the global $PAGE is used | [
"Receive",
"nonjs",
"comment",
"parameters"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/lib.php#L247-L270 |
214,423 | moodle/moodle | comment/lib.php | comment.set_component | public function set_component($component) {
if (!empty($this->component) && $this->component !== $component) {
throw new coding_exception('You cannot change the component of a comment once it has been set');
}
$this->component = $component;
list($this->plugintype, $this->plug... | php | public function set_component($component) {
if (!empty($this->component) && $this->component !== $component) {
throw new coding_exception('You cannot change the component of a comment once it has been set');
}
$this->component = $component;
list($this->plugintype, $this->plug... | [
"public",
"function",
"set_component",
"(",
"$",
"component",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"component",
")",
"&&",
"$",
"this",
"->",
"component",
"!==",
"$",
"component",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
... | Sets the component.
This method shouldn't be public, changing the component once it has been set potentially
invalidates permission checks.
A coding_error is now thrown if code attempts to change the component.
@throws coding_exception if you try to change the component after it has been set.
@param string $component | [
"Sets",
"the",
"component",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/lib.php#L282-L288 |
214,424 | moodle/moodle | comment/lib.php | comment.get_nojslink | public function get_nojslink(moodle_page $page = null) {
if ($page === null) {
global $PAGE;
$page = $PAGE;
}
$link = new moodle_url($page->url, array(
'nonjscomment' => true,
'comment_itemid' => $this->itemid,
'comment_context' =>... | php | public function get_nojslink(moodle_page $page = null) {
if ($page === null) {
global $PAGE;
$page = $PAGE;
}
$link = new moodle_url($page->url, array(
'nonjscomment' => true,
'comment_itemid' => $this->itemid,
'comment_context' =>... | [
"public",
"function",
"get_nojslink",
"(",
"moodle_page",
"$",
"page",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"page",
"===",
"null",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"page",
"=",
"$",
"PAGE",
";",
"}",
"$",
"link",
"=",
"new",
"moodle_url... | Gets a link for this page that will work with JS disabled.
@global moodle_page $PAGE
@param moodle_page $page
@return moodle_url | [
"Gets",
"a",
"link",
"for",
"this",
"page",
"that",
"will",
"work",
"with",
"JS",
"disabled",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/lib.php#L331-L346 |
214,425 | moodle/moodle | comment/lib.php | comment.initialise_javascript | public function initialise_javascript(moodle_page $page) {
$options = new stdClass;
$options->client_id = $this->cid;
$options->commentarea = $this->commentarea;
$options->itemid = $this->itemid;
$options->page = 0;
$options->courseid = $this->courseid;
... | php | public function initialise_javascript(moodle_page $page) {
$options = new stdClass;
$options->client_id = $this->cid;
$options->commentarea = $this->commentarea;
$options->itemid = $this->itemid;
$options->page = 0;
$options->courseid = $this->courseid;
... | [
"public",
"function",
"initialise_javascript",
"(",
"moodle_page",
"$",
"page",
")",
"{",
"$",
"options",
"=",
"new",
"stdClass",
";",
"$",
"options",
"->",
"client_id",
"=",
"$",
"this",
"->",
"cid",
";",
"$",
"options",
"->",
"commentarea",
"=",
"$",
"... | Initialises the JavaScript that enchances the comment API.
@param moodle_page $page The moodle page object that the JavaScript should be
initialised for. | [
"Initialises",
"the",
"JavaScript",
"that",
"enchances",
"the",
"comment",
"API",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/lib.php#L402-L418 |
214,426 | moodle/moodle | comment/lib.php | comment.get_component_select_sql | protected function get_component_select_sql($alias = '') {
$component = $this->get_component();
if ($alias) {
$alias = $alias.'.';
}
if (empty($component)) {
$componentwhere = "{$alias}component IS NULL";
$component = null;
} else {
... | php | protected function get_component_select_sql($alias = '') {
$component = $this->get_component();
if ($alias) {
$alias = $alias.'.';
}
if (empty($component)) {
$componentwhere = "{$alias}component IS NULL";
$component = null;
} else {
... | [
"protected",
"function",
"get_component_select_sql",
"(",
"$",
"alias",
"=",
"''",
")",
"{",
"$",
"component",
"=",
"$",
"this",
"->",
"get_component",
"(",
")",
";",
"if",
"(",
"$",
"alias",
")",
"{",
"$",
"alias",
"=",
"$",
"alias",
".",
"'.'",
";"... | Returns an SQL fragment and param for selecting on component.
@param string $alias
@return array | [
"Returns",
"an",
"SQL",
"fragment",
"and",
"param",
"for",
"selecting",
"on",
"component",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/lib.php#L611-L623 |
214,427 | moodle/moodle | comment/lib.php | comment.count | public function count() {
global $DB;
if ($this->totalcommentcount === null) {
list($where, $component) = $this->get_component_select_sql();
$where .= ' AND itemid = :itemid AND commentarea = :commentarea AND contextid = :contextid';
$params = array(
'... | php | public function count() {
global $DB;
if ($this->totalcommentcount === null) {
list($where, $component) = $this->get_component_select_sql();
$where .= ' AND itemid = :itemid AND commentarea = :commentarea AND contextid = :contextid';
$params = array(
'... | [
"public",
"function",
"count",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"totalcommentcount",
"===",
"null",
")",
"{",
"list",
"(",
"$",
"where",
",",
"$",
"component",
")",
"=",
"$",
"this",
"->",
"get_component_select_sql... | Returns the number of comments associated with the details of this object
@global moodle_database $DB
@return int | [
"Returns",
"the",
"number",
"of",
"comments",
"associated",
"with",
"the",
"details",
"of",
"this",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/lib.php#L631-L648 |
214,428 | moodle/moodle | comment/lib.php | comment.get_pagination | public function get_pagination($page = 0) {
global $CFG, $OUTPUT;
$count = $this->count();
$perpage = (!empty($CFG->commentsperpage))?$CFG->commentsperpage:15;
$pages = (int)ceil($count/$perpage);
if ($pages == 1 || $pages == 0) {
return html_writer::tag('div', '', ar... | php | public function get_pagination($page = 0) {
global $CFG, $OUTPUT;
$count = $this->count();
$perpage = (!empty($CFG->commentsperpage))?$CFG->commentsperpage:15;
$pages = (int)ceil($count/$perpage);
if ($pages == 1 || $pages == 0) {
return html_writer::tag('div', '', ar... | [
"public",
"function",
"get_pagination",
"(",
"$",
"page",
"=",
"0",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"OUTPUT",
";",
"$",
"count",
"=",
"$",
"this",
"->",
"count",
"(",
")",
";",
"$",
"perpage",
"=",
"(",
"!",
"empty",
"(",
"$",
"CFG",
... | Returns HTML to display a pagination bar
@global stdClass $CFG
@global core_renderer $OUTPUT
@param int $page
@return string | [
"Returns",
"HTML",
"to",
"display",
"a",
"pagination",
"bar"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/lib.php#L658-L684 |
214,429 | moodle/moodle | comment/lib.php | comment.delete_comments | public static function delete_comments($param) {
global $DB;
$param = (array)$param;
if (empty($param['contextid'])) {
return false;
}
$DB->delete_records('comments', $param);
return true;
} | php | public static function delete_comments($param) {
global $DB;
$param = (array)$param;
if (empty($param['contextid'])) {
return false;
}
$DB->delete_records('comments', $param);
return true;
} | [
"public",
"static",
"function",
"delete_comments",
"(",
"$",
"param",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"param",
"=",
"(",
"array",
")",
"$",
"param",
";",
"if",
"(",
"empty",
"(",
"$",
"param",
"[",
"'contextid'",
"]",
")",
")",
"{",
"retur... | delete by context, commentarea and itemid
@param stdClass|array $param {
contextid => int the context in which the comments exist [required]
commentarea => string the comment area [optional]
itemid => int comment itemid [optional]
}
@return boolean | [
"delete",
"by",
"context",
"commentarea",
"and",
"itemid"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/lib.php#L771-L779 |
214,430 | moodle/moodle | comment/lib.php | comment.reset_course_page_comments | public static function reset_course_page_comments($context) {
global $DB;
$contexts = array();
$contexts[] = $context->id;
$children = $context->get_child_contexts();
foreach ($children as $c) {
$contexts[] = $c->id;
}
list($ids, $params) = $DB->get_in... | php | public static function reset_course_page_comments($context) {
global $DB;
$contexts = array();
$contexts[] = $context->id;
$children = $context->get_child_contexts();
foreach ($children as $c) {
$contexts[] = $c->id;
}
list($ids, $params) = $DB->get_in... | [
"public",
"static",
"function",
"reset_course_page_comments",
"(",
"$",
"context",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"contexts",
"=",
"array",
"(",
")",
";",
"$",
"contexts",
"[",
"]",
"=",
"$",
"context",
"->",
"id",
";",
"$",
"children",
"=",
... | Delete page_comments in whole course, used by course reset
@param stdClass $context course context | [
"Delete",
"page_comments",
"in",
"whole",
"course",
"used",
"by",
"course",
"reset"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/lib.php#L786-L796 |
214,431 | moodle/moodle | comment/lib.php | comment.print_comment | public function print_comment($cmt, $nonjs = true) {
global $OUTPUT;
$patterns = array();
$replacements = array();
if (!empty($cmt->delete) && empty($nonjs)) {
$strdelete = get_string('deletecommentbyon', 'moodle', (object)['user' => $cmt->fullname, 'time' => $cmt->time]);
... | php | public function print_comment($cmt, $nonjs = true) {
global $OUTPUT;
$patterns = array();
$replacements = array();
if (!empty($cmt->delete) && empty($nonjs)) {
$strdelete = get_string('deletecommentbyon', 'moodle', (object)['user' => $cmt->fullname, 'time' => $cmt->time]);
... | [
"public",
"function",
"print_comment",
"(",
"$",
"cmt",
",",
"$",
"nonjs",
"=",
"true",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"patterns",
"=",
"array",
"(",
")",
";",
"$",
"replacements",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",... | Returns an array containing comments in HTML format.
@global core_renderer $OUTPUT
@param stdClass $cmt {
id => int comment id
content => string comment content
format => int comment text format
timecreated => int comment's timecreated
profileurl => string link to user profile
fullname => comment author's full na... | [
"Returns",
"an",
"array",
"containing",
"comments",
"in",
"HTML",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/lib.php#L914-L941 |
214,432 | moodle/moodle | comment/lib.php | comment.validate | protected function validate($params=array()) {
foreach ($params as $key=>$value) {
$this->comment_param->$key = $value;
}
$validation = plugin_callback($this->plugintype, $this->pluginname, 'comment', 'validate', array($this->comment_param), false);
if (!$validation) {
... | php | protected function validate($params=array()) {
foreach ($params as $key=>$value) {
$this->comment_param->$key = $value;
}
$validation = plugin_callback($this->plugintype, $this->pluginname, 'comment', 'validate', array($this->comment_param), false);
if (!$validation) {
... | [
"protected",
"function",
"validate",
"(",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"comment_param",
"->",
"$",
"key",
"=",
"$",
"value",
";",
... | Revoke validate callbacks
@param stdClass $params addtionall parameters need to add to callbacks | [
"Revoke",
"validate",
"callbacks"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/comment/lib.php#L948-L956 |
214,433 | moodle/moodle | lib/phpmailer/src/PHPMailer.php | PHPMailer.smtpSend | protected function smtpSend($header, $body)
{
$bad_rcpt = [];
if (!$this->smtpConnect($this->SMTPOptions)) {
throw new Exception($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
}
//Sender already validated in preSend()
if ('' == $this->Sender) {
... | php | protected function smtpSend($header, $body)
{
$bad_rcpt = [];
if (!$this->smtpConnect($this->SMTPOptions)) {
throw new Exception($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
}
//Sender already validated in preSend()
if ('' == $this->Sender) {
... | [
"protected",
"function",
"smtpSend",
"(",
"$",
"header",
",",
"$",
"body",
")",
"{",
"$",
"bad_rcpt",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"smtpConnect",
"(",
"$",
"this",
"->",
"SMTPOptions",
")",
")",
"{",
"throw",
"new",
"Excep... | Send mail via SMTP.
Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
@see PHPMailer::setSMTPInstance() to use a different class.
@uses \PHPMailer\PHPMailer\SMTP
@param string $header The message headers
@param string $body The message body
@throws Exception
@return bool | [
"Send",
"mail",
"via",
"SMTP",
".",
"Returns",
"false",
"if",
"there",
"is",
"a",
"bad",
"MAIL",
"FROM",
"RCPT",
"or",
"DATA",
"input",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpmailer/src/PHPMailer.php#L1706-L1779 |
214,434 | moodle/moodle | lib/phpmailer/src/PHPMailer.php | PHPMailer.getBoundary | protected function getBoundary($boundary, $charSet, $contentType, $encoding)
{
$result = '';
if ('' == $charSet) {
$charSet = $this->CharSet;
}
if ('' == $contentType) {
$contentType = $this->ContentType;
}
if ('' == $encoding) {
$e... | php | protected function getBoundary($boundary, $charSet, $contentType, $encoding)
{
$result = '';
if ('' == $charSet) {
$charSet = $this->CharSet;
}
if ('' == $contentType) {
$contentType = $this->ContentType;
}
if ('' == $encoding) {
$e... | [
"protected",
"function",
"getBoundary",
"(",
"$",
"boundary",
",",
"$",
"charSet",
",",
"$",
"contentType",
",",
"$",
"encoding",
")",
"{",
"$",
"result",
"=",
"''",
";",
"if",
"(",
"''",
"==",
"$",
"charSet",
")",
"{",
"$",
"charSet",
"=",
"$",
"t... | Return the start of a message boundary.
@param string $boundary
@param string $charSet
@param string $contentType
@param string $encoding
@return string | [
"Return",
"the",
"start",
"of",
"a",
"message",
"boundary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpmailer/src/PHPMailer.php#L2642-L2664 |
214,435 | moodle/moodle | lib/phpmailer/src/PHPMailer.php | PHPMailer.DKIM_BodyC | public function DKIM_BodyC($body)
{
if (empty($body)) {
return static::$LE;
}
// Normalize line endings
$body = static::normalizeBreaks($body);
//Reduce multiple trailing line breaks to a single one
return rtrim($body, "\r\n") . static::$LE;
} | php | public function DKIM_BodyC($body)
{
if (empty($body)) {
return static::$LE;
}
// Normalize line endings
$body = static::normalizeBreaks($body);
//Reduce multiple trailing line breaks to a single one
return rtrim($body, "\r\n") . static::$LE;
} | [
"public",
"function",
"DKIM_BodyC",
"(",
"$",
"body",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"body",
")",
")",
"{",
"return",
"static",
"::",
"$",
"LE",
";",
"}",
"// Normalize line endings",
"$",
"body",
"=",
"static",
"::",
"normalizeBreaks",
"(",
"... | Generate a DKIM canonicalization body.
Uses the 'simple' algorithm from RFC6376 section 3.4.3.
@see https://tools.ietf.org/html/rfc6376#section-3.4.3
@param string $body Message Body
@return string | [
"Generate",
"a",
"DKIM",
"canonicalization",
"body",
".",
"Uses",
"the",
"simple",
"algorithm",
"from",
"RFC6376",
"section",
"3",
".",
"4",
".",
"3",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpmailer/src/PHPMailer.php#L4187-L4197 |
214,436 | moodle/moodle | lib/classes/output/mustache_string_helper.php | mustache_string_helper.str | public function str($text, Mustache_LambdaHelper $helper) {
// Split the text into an array of variables.
$key = strtok($text, ",");
$key = trim($key);
$component = strtok(",");
$component = trim($component);
if (!$component) {
$component = '';
}
... | php | public function str($text, Mustache_LambdaHelper $helper) {
// Split the text into an array of variables.
$key = strtok($text, ",");
$key = trim($key);
$component = strtok(",");
$component = trim($component);
if (!$component) {
$component = '';
}
... | [
"public",
"function",
"str",
"(",
"$",
"text",
",",
"Mustache_LambdaHelper",
"$",
"helper",
")",
"{",
"// Split the text into an array of variables.",
"$",
"key",
"=",
"strtok",
"(",
"$",
"text",
",",
"\",\"",
")",
";",
"$",
"key",
"=",
"trim",
"(",
"$",
"... | Read a lang string from a template and get it from get_string.
Some examples for calling this from a template are:
{{#str}}activity{{/str}}
{{#str}}actionchoice, core, {{#str}}delete{{/str}}{{/str}} (Nested)
{{#str}}addinganewto, core, {"what":"This", "to":"That"}{{/str}} (Complex $a)
The args are comma separated an... | [
"Read",
"a",
"lang",
"string",
"from",
"a",
"template",
"and",
"get",
"it",
"from",
"get_string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/output/mustache_string_helper.php#L56-L77 |
214,437 | moodle/moodle | mod/quiz/report/statistics/classes/calculated.php | calculated.cache | public function cache($qubaids) {
global $DB;
$toinsert = new \stdClass();
foreach ($this->fieldsindb as $field) {
$toinsert->{$field} = $this->{$field};
}
$toinsert->hashcode = $qubaids->get_hash_code();
$toinsert->timemodified = time();
// Fix up... | php | public function cache($qubaids) {
global $DB;
$toinsert = new \stdClass();
foreach ($this->fieldsindb as $field) {
$toinsert->{$field} = $this->{$field};
}
$toinsert->hashcode = $qubaids->get_hash_code();
$toinsert->timemodified = time();
// Fix up... | [
"public",
"function",
"cache",
"(",
"$",
"qubaids",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"toinsert",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"fieldsindb",
"as",
"$",
"field",
")",
"{",
"$",
"toinsert",
"-... | Cache the stats contained in this class.
@param $qubaids \qubaid_condition | [
"Cache",
"the",
"stats",
"contained",
"in",
"this",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/statistics/classes/calculated.php#L208-L231 |
214,438 | moodle/moodle | question/type/multianswer/renderer.php | qtype_multianswer_subq_renderer_base.feedback_popup | protected function feedback_popup(question_graded_automatically $subq,
$fraction, $feedbacktext, $rightanswer, question_display_options $options) {
$feedback = array();
if ($options->correctness) {
if (is_null($fraction)) {
$state = question_state::$gaveup;
... | php | protected function feedback_popup(question_graded_automatically $subq,
$fraction, $feedbacktext, $rightanswer, question_display_options $options) {
$feedback = array();
if ($options->correctness) {
if (is_null($fraction)) {
$state = question_state::$gaveup;
... | [
"protected",
"function",
"feedback_popup",
"(",
"question_graded_automatically",
"$",
"subq",
",",
"$",
"fraction",
",",
"$",
"feedbacktext",
",",
"$",
"rightanswer",
",",
"question_display_options",
"$",
"options",
")",
"{",
"$",
"feedback",
"=",
"array",
"(",
... | Render the feedback pop-up contents.
@param question_graded_automatically $subq the subquestion.
@param float $fraction the mark the student got. null if this subq was not answered.
@param string $feedbacktext the feedback text, already processed with format_text etc.
@param string $rightanswer the right answer, alrea... | [
"Render",
"the",
"feedback",
"pop",
"-",
"up",
"contents",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/multianswer/renderer.php#L138-L174 |
214,439 | moodle/moodle | mod/quiz/report/grading/renderer.php | quiz_grading_renderer.render_display_index_heading | public function render_display_index_heading($linktext, $listquestionurl) {
$output = '';
$output .= $this->heading(get_string('questionsthatneedgrading', 'quiz_grading'), 3);
$output .= html_writer::tag('p', html_writer::link($listquestionurl, $linktext), ['class' => 'toggleincludeauto']);
... | php | public function render_display_index_heading($linktext, $listquestionurl) {
$output = '';
$output .= $this->heading(get_string('questionsthatneedgrading', 'quiz_grading'), 3);
$output .= html_writer::tag('p', html_writer::link($listquestionurl, $linktext), ['class' => 'toggleincludeauto']);
... | [
"public",
"function",
"render_display_index_heading",
"(",
"$",
"linktext",
",",
"$",
"listquestionurl",
")",
"{",
"$",
"output",
"=",
"''",
";",
"$",
"output",
".=",
"$",
"this",
"->",
"heading",
"(",
"get_string",
"(",
"'questionsthatneedgrading'",
",",
"'qu... | Render index display.
@param string $linktext The text of the link.
@param moodle_url $listquestionurl Url of the page that list all questions.
@return string The HTML for the display heading.
@throws coding_exception | [
"Render",
"index",
"display",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/grading/renderer.php#L64-L71 |
214,440 | moodle/moodle | mod/quiz/report/grading/renderer.php | quiz_grading_renderer.render_questions_table | public function render_questions_table($includeauto, $data, $header) {
if (empty($data)) {
return $this->render_quiz_no_grade_question_notification();
}
$output = '';
$table = new html_table();
$table->class = 'generaltable';
$table->id = 'questionstograde';
... | php | public function render_questions_table($includeauto, $data, $header) {
if (empty($data)) {
return $this->render_quiz_no_grade_question_notification();
}
$output = '';
$table = new html_table();
$table->class = 'generaltable';
$table->id = 'questionstograde';
... | [
"public",
"function",
"render_questions_table",
"(",
"$",
"includeauto",
",",
"$",
"data",
",",
"$",
"header",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"this",
"->",
"render_quiz_no_grade_question_notification",
"(",
")",... | Render questions list table.
@param bool $includeauto True to show automatically graded questions.
@param array $data List of questions.
@param array $header List of table headers.
@return string The HTML for the question table.
@throws coding_exception | [
"Render",
"questions",
"list",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/grading/renderer.php#L82-L97 |
214,441 | moodle/moodle | mod/quiz/report/grading/renderer.php | quiz_grading_renderer.render_grade_link | public function render_grade_link($counts, $type, $gradestring, $gradequestionurl) {
$output = '';
if ($counts->$type > 0) {
$output .= ' ' . html_writer::link(
$gradequestionurl,
get_string($gradestring, 'quiz_grading'),
... | php | public function render_grade_link($counts, $type, $gradestring, $gradequestionurl) {
$output = '';
if ($counts->$type > 0) {
$output .= ' ' . html_writer::link(
$gradequestionurl,
get_string($gradestring, 'quiz_grading'),
... | [
"public",
"function",
"render_grade_link",
"(",
"$",
"counts",
",",
"$",
"type",
",",
"$",
"gradestring",
",",
"$",
"gradequestionurl",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"$",
"counts",
"->",
"$",
"type",
">",
"0",
")",
"{",
"$",
"... | Render grade link for question.
@param object $counts
@param string $type Type of grade.
@param string $gradestring Lang string.
@param moodle_url $gradequestionurl Url to grade question.
@return string The HTML for the question grade link.
@throws coding_exception | [
"Render",
"grade",
"link",
"for",
"question",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/grading/renderer.php#L109-L118 |
214,442 | moodle/moodle | mod/quiz/report/grading/renderer.php | quiz_grading_renderer.render_grading_interface | public function render_grading_interface($questioninfo, $listquestionsurl, $filterform, $paginginfo, $pagingbar, $formaction,
$hiddeninputs, $gradequestioncontent) {
$output = '';
$output .= question_engine::initialise_js();
$output .= $this->heading(get_string('gradingquestionx', ... | php | public function render_grading_interface($questioninfo, $listquestionsurl, $filterform, $paginginfo, $pagingbar, $formaction,
$hiddeninputs, $gradequestioncontent) {
$output = '';
$output .= question_engine::initialise_js();
$output .= $this->heading(get_string('gradingquestionx', ... | [
"public",
"function",
"render_grading_interface",
"(",
"$",
"questioninfo",
",",
"$",
"listquestionsurl",
",",
"$",
"filterform",
",",
"$",
"paginginfo",
",",
"$",
"pagingbar",
",",
"$",
"formaction",
",",
"$",
"hiddeninputs",
",",
"$",
"gradequestioncontent",
"... | Render grading page.
@param object $questioninfo Information of a question.
@param moodle_url $listquestionsurl Url of the page that list all questions.
@param quiz_grading_settings_form $filterform Question filter form.
@param object $paginginfo Pagination information.
@param object $pagingbar Pagination bar informat... | [
"Render",
"grading",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/grading/renderer.php#L135-L174 |
214,443 | moodle/moodle | mod/quiz/report/grading/renderer.php | quiz_grading_renderer.render_grade_question | public function render_grade_question($questionusage, $slot, $displayoptions, $questionnumber, $heading) {
$output = '';
if ($heading) {
$output .= $this->heading($heading, 4);
}
$output .= $questionusage->render_question($slot, $displayoptions, $questionnumber);
r... | php | public function render_grade_question($questionusage, $slot, $displayoptions, $questionnumber, $heading) {
$output = '';
if ($heading) {
$output .= $this->heading($heading, 4);
}
$output .= $questionusage->render_question($slot, $displayoptions, $questionnumber);
r... | [
"public",
"function",
"render_grade_question",
"(",
"$",
"questionusage",
",",
"$",
"slot",
",",
"$",
"displayoptions",
",",
"$",
"questionnumber",
",",
"$",
"heading",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"$",
"heading",
")",
"{",
"$",
... | Render grade question content.
@param question_usage_by_activity $questionusage The question usage that need to grade.
@param int $slot the number used to identify this question within this usage.
@param question_display_options $displayoptions the display options to use.
@param int $questionnumber the number of the q... | [
"Render",
"grade",
"question",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/grading/renderer.php#L186-L196 |
214,444 | moodle/moodle | rss/renderer.php | core_rss_renderer.user_reset_rss_token_confirmation | public function user_reset_rss_token_confirmation() {
global $OUTPUT, $CFG;
$managetokenurl = $CFG->wwwroot."/user/managetoken.php?sesskey=" . sesskey();
$optionsyes = array('action' => 'resetrsstoken', 'confirm' => 1, 'sesskey' => sesskey());
$optionsno = array('section' => 'webservice... | php | public function user_reset_rss_token_confirmation() {
global $OUTPUT, $CFG;
$managetokenurl = $CFG->wwwroot."/user/managetoken.php?sesskey=" . sesskey();
$optionsyes = array('action' => 'resetrsstoken', 'confirm' => 1, 'sesskey' => sesskey());
$optionsno = array('section' => 'webservice... | [
"public",
"function",
"user_reset_rss_token_confirmation",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
",",
"$",
"CFG",
";",
"$",
"managetokenurl",
"=",
"$",
"CFG",
"->",
"wwwroot",
".",
"\"/user/managetoken.php?sesskey=\"",
".",
"sesskey",
"(",
")",
";",
"$",
"op... | Returns the html for the token reset confirmation box
@return string html | [
"Returns",
"the",
"html",
"for",
"the",
"token",
"reset",
"confirmation",
"box"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rss/renderer.php#L37-L46 |
214,445 | moodle/moodle | rss/renderer.php | core_rss_renderer.user_rss_token_box | public function user_rss_token_box($token) {
global $OUTPUT, $CFG;
// Display strings.
$stroperation = get_string('operation', 'webservice');
$strtoken = get_string('key', 'webservice');
$return = $OUTPUT->heading(get_string('rss', 'rss'), 3, 'main', true);
$return .= $... | php | public function user_rss_token_box($token) {
global $OUTPUT, $CFG;
// Display strings.
$stroperation = get_string('operation', 'webservice');
$strtoken = get_string('key', 'webservice');
$return = $OUTPUT->heading(get_string('rss', 'rss'), 3, 'main', true);
$return .= $... | [
"public",
"function",
"user_rss_token_box",
"(",
"$",
"token",
")",
"{",
"global",
"$",
"OUTPUT",
",",
"$",
"CFG",
";",
"// Display strings.",
"$",
"stroperation",
"=",
"get_string",
"(",
"'operation'",
",",
"'webservice'",
")",
";",
"$",
"strtoken",
"=",
"g... | Display a user token with buttons to reset it
@param string $token The token to be displayed
@return string html code | [
"Display",
"a",
"user",
"token",
"with",
"buttons",
"to",
"reset",
"it"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rss/renderer.php#L53-L84 |
214,446 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer.php | HTMLPurifier_DefinitionCache_Serializer.generateFilePath | public function generateFilePath($config)
{
$key = $this->generateKey($config);
return $this->generateDirectoryPath($config) . '/' . $key . '.ser';
} | php | public function generateFilePath($config)
{
$key = $this->generateKey($config);
return $this->generateDirectoryPath($config) . '/' . $key . '.ser';
} | [
"public",
"function",
"generateFilePath",
"(",
"$",
"config",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"generateKey",
"(",
"$",
"config",
")",
";",
"return",
"$",
"this",
"->",
"generateDirectoryPath",
"(",
"$",
"config",
")",
".",
"'/'",
".",
"$"... | Generates the file path to the serial file corresponding to
the configuration and definition name
@param HTMLPurifier_Config $config
@return string
@todo Make protected | [
"Generates",
"the",
"file",
"path",
"to",
"the",
"serial",
"file",
"corresponding",
"to",
"the",
"configuration",
"and",
"definition",
"name"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer.php#L157-L161 |
214,447 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer.php | HTMLPurifier_DefinitionCache_Serializer.generateBaseDirectoryPath | public function generateBaseDirectoryPath($config)
{
$base = $config->get('Cache.SerializerPath');
$base = is_null($base) ? HTMLPURIFIER_PREFIX . '/HTMLPurifier/DefinitionCache/Serializer' : $base;
return $base;
} | php | public function generateBaseDirectoryPath($config)
{
$base = $config->get('Cache.SerializerPath');
$base = is_null($base) ? HTMLPURIFIER_PREFIX . '/HTMLPurifier/DefinitionCache/Serializer' : $base;
return $base;
} | [
"public",
"function",
"generateBaseDirectoryPath",
"(",
"$",
"config",
")",
"{",
"$",
"base",
"=",
"$",
"config",
"->",
"get",
"(",
"'Cache.SerializerPath'",
")",
";",
"$",
"base",
"=",
"is_null",
"(",
"$",
"base",
")",
"?",
"HTMLPURIFIER_PREFIX",
".",
"'/... | Generates path to base directory that contains all definition type
serials
@param HTMLPurifier_Config $config
@return mixed|string
@todo Make protected | [
"Generates",
"path",
"to",
"base",
"directory",
"that",
"contains",
"all",
"definition",
"type",
"serials"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer.php#L183-L188 |
214,448 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer.php | HTMLPurifier_DefinitionCache_Serializer._write | private function _write($file, $data, $config)
{
$result = file_put_contents($file, $data);
if ($result !== false) {
// set permissions of the new file (no execute)
$chmod = $config->get('Cache.SerializerPermissions');
if ($chmod !== null) {
chmod(... | php | private function _write($file, $data, $config)
{
$result = file_put_contents($file, $data);
if ($result !== false) {
// set permissions of the new file (no execute)
$chmod = $config->get('Cache.SerializerPermissions');
if ($chmod !== null) {
chmod(... | [
"private",
"function",
"_write",
"(",
"$",
"file",
",",
"$",
"data",
",",
"$",
"config",
")",
"{",
"$",
"result",
"=",
"file_put_contents",
"(",
"$",
"file",
",",
"$",
"data",
")",
";",
"if",
"(",
"$",
"result",
"!==",
"false",
")",
"{",
"// set pe... | Convenience wrapper function for file_put_contents
@param string $file File name to write to
@param string $data Data to write into file
@param HTMLPurifier_Config $config
@return int|bool Number of bytes written if success, or false if failure. | [
"Convenience",
"wrapper",
"function",
"for",
"file_put_contents"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer.php#L197-L208 |
214,449 | moodle/moodle | mod/assign/submission/onlinetext/locallib.php | assign_submission_onlinetext.remove | public function remove(stdClass $submission) {
global $DB;
$submissionid = $submission ? $submission->id : 0;
if ($submissionid) {
$DB->delete_records('assignsubmission_onlinetext', array('submission' => $submissionid));
}
return true;
} | php | public function remove(stdClass $submission) {
global $DB;
$submissionid = $submission ? $submission->id : 0;
if ($submissionid) {
$DB->delete_records('assignsubmission_onlinetext', array('submission' => $submissionid));
}
return true;
} | [
"public",
"function",
"remove",
"(",
"stdClass",
"$",
"submission",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"submissionid",
"=",
"$",
"submission",
"?",
"$",
"submission",
"->",
"id",
":",
"0",
";",
"if",
"(",
"$",
"submissionid",
")",
"{",
"$",
"DB... | Remove a submission.
@param stdClass $submission The submission
@return boolean | [
"Remove",
"a",
"submission",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/onlinetext/locallib.php#L67-L75 |
214,450 | moodle/moodle | mod/assign/submission/onlinetext/locallib.php | assign_submission_onlinetext.get_settings | public function get_settings(MoodleQuickForm $mform) {
global $CFG, $COURSE;
$defaultwordlimit = $this->get_config('wordlimit') == 0 ? '' : $this->get_config('wordlimit');
$defaultwordlimitenabled = $this->get_config('wordlimitenabled');
$options = array('size' => '6', 'maxlength' => '... | php | public function get_settings(MoodleQuickForm $mform) {
global $CFG, $COURSE;
$defaultwordlimit = $this->get_config('wordlimit') == 0 ? '' : $this->get_config('wordlimit');
$defaultwordlimitenabled = $this->get_config('wordlimitenabled');
$options = array('size' => '6', 'maxlength' => '... | [
"public",
"function",
"get_settings",
"(",
"MoodleQuickForm",
"$",
"mform",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"COURSE",
";",
"$",
"defaultwordlimit",
"=",
"$",
"this",
"->",
"get_config",
"(",
"'wordlimit'",
")",
"==",
"0",
"?",
"''",
":",
"$",
... | Get the settings for onlinetext submission plugin
@param MoodleQuickForm $mform The form to add elements to
@return void | [
"Get",
"the",
"settings",
"for",
"onlinetext",
"submission",
"plugin"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/onlinetext/locallib.php#L83-L120 |
214,451 | moodle/moodle | mod/assign/submission/onlinetext/locallib.php | assign_submission_onlinetext.save_settings | public function save_settings(stdClass $data) {
if (empty($data->assignsubmission_onlinetext_wordlimit) || empty($data->assignsubmission_onlinetext_wordlimit_enabled)) {
$wordlimit = 0;
$wordlimitenabled = 0;
} else {
$wordlimit = $data->assignsubmission_onlinetext_wo... | php | public function save_settings(stdClass $data) {
if (empty($data->assignsubmission_onlinetext_wordlimit) || empty($data->assignsubmission_onlinetext_wordlimit_enabled)) {
$wordlimit = 0;
$wordlimitenabled = 0;
} else {
$wordlimit = $data->assignsubmission_onlinetext_wo... | [
"public",
"function",
"save_settings",
"(",
"stdClass",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
"->",
"assignsubmission_onlinetext_wordlimit",
")",
"||",
"empty",
"(",
"$",
"data",
"->",
"assignsubmission_onlinetext_wordlimit_enabled",
")",
")... | Save the settings for onlinetext submission plugin
@param stdClass $data
@return bool | [
"Save",
"the",
"settings",
"for",
"onlinetext",
"submission",
"plugin"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/onlinetext/locallib.php#L128-L141 |
214,452 | moodle/moodle | mod/assign/submission/onlinetext/locallib.php | assign_submission_onlinetext.get_form_elements | public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data) {
$elements = array();
$editoroptions = $this->get_edit_options();
$submissionid = $submission ? $submission->id : 0;
if (!isset($data->onlinetext)) {
$data->onlinetext = '';
}
... | php | public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data) {
$elements = array();
$editoroptions = $this->get_edit_options();
$submissionid = $submission ? $submission->id : 0;
if (!isset($data->onlinetext)) {
$data->onlinetext = '';
}
... | [
"public",
"function",
"get_form_elements",
"(",
"$",
"submission",
",",
"MoodleQuickForm",
"$",
"mform",
",",
"stdClass",
"$",
"data",
")",
"{",
"$",
"elements",
"=",
"array",
"(",
")",
";",
"$",
"editoroptions",
"=",
"$",
"this",
"->",
"get_edit_options",
... | Add form elements for settings
@param mixed $submission can be null
@param MoodleQuickForm $mform
@param stdClass $data
@return true if elements were added to the form | [
"Add",
"form",
"elements",
"for",
"settings"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/onlinetext/locallib.php#L151-L183 |
214,453 | moodle/moodle | mod/assign/submission/onlinetext/locallib.php | assign_submission_onlinetext.get_edit_options | private function get_edit_options() {
$editoroptions = array(
'noclean' => false,
'maxfiles' => EDITOR_UNLIMITED_FILES,
'maxbytes' => $this->assignment->get_course()->maxbytes,
'context' => $this->assignment->get_context(),
'return_types' => (FILE_INTE... | php | private function get_edit_options() {
$editoroptions = array(
'noclean' => false,
'maxfiles' => EDITOR_UNLIMITED_FILES,
'maxbytes' => $this->assignment->get_course()->maxbytes,
'context' => $this->assignment->get_context(),
'return_types' => (FILE_INTE... | [
"private",
"function",
"get_edit_options",
"(",
")",
"{",
"$",
"editoroptions",
"=",
"array",
"(",
"'noclean'",
"=>",
"false",
",",
"'maxfiles'",
"=>",
"EDITOR_UNLIMITED_FILES",
",",
"'maxbytes'",
"=>",
"$",
"this",
"->",
"assignment",
"->",
"get_course",
"(",
... | Editor format options
@return array | [
"Editor",
"format",
"options"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/onlinetext/locallib.php#L190-L200 |
214,454 | moodle/moodle | mod/assign/submission/onlinetext/locallib.php | assign_submission_onlinetext.get_editor_text | public function get_editor_text($name, $submissionid) {
if ($name == 'onlinetext') {
$onlinetextsubmission = $this->get_onlinetext_submission($submissionid);
if ($onlinetextsubmission) {
return $onlinetextsubmission->onlinetext;
}
}
return '';... | php | public function get_editor_text($name, $submissionid) {
if ($name == 'onlinetext') {
$onlinetextsubmission = $this->get_onlinetext_submission($submissionid);
if ($onlinetextsubmission) {
return $onlinetextsubmission->onlinetext;
}
}
return '';... | [
"public",
"function",
"get_editor_text",
"(",
"$",
"name",
",",
"$",
"submissionid",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"'onlinetext'",
")",
"{",
"$",
"onlinetextsubmission",
"=",
"$",
"this",
"->",
"get_onlinetext_submission",
"(",
"$",
"submissionid",
... | Get the saved text content from the editor
@param string $name
@param int $submissionid
@return string | [
"Get",
"the",
"saved",
"text",
"content",
"from",
"the",
"editor"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/onlinetext/locallib.php#L327-L336 |
214,455 | moodle/moodle | mod/assign/submission/onlinetext/locallib.php | assign_submission_onlinetext.get_editor_format | public function get_editor_format($name, $submissionid) {
if ($name == 'onlinetext') {
$onlinetextsubmission = $this->get_onlinetext_submission($submissionid);
if ($onlinetextsubmission) {
return $onlinetextsubmission->onlineformat;
}
}
return... | php | public function get_editor_format($name, $submissionid) {
if ($name == 'onlinetext') {
$onlinetextsubmission = $this->get_onlinetext_submission($submissionid);
if ($onlinetextsubmission) {
return $onlinetextsubmission->onlineformat;
}
}
return... | [
"public",
"function",
"get_editor_format",
"(",
"$",
"name",
",",
"$",
"submissionid",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"'onlinetext'",
")",
"{",
"$",
"onlinetextsubmission",
"=",
"$",
"this",
"->",
"get_onlinetext_submission",
"(",
"$",
"submissionid",... | Get the content format for the editor
@param string $name
@param int $submissionid
@return int | [
"Get",
"the",
"content",
"format",
"for",
"the",
"editor"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/onlinetext/locallib.php#L345-L354 |
214,456 | moodle/moodle | mod/assign/submission/onlinetext/locallib.php | assign_submission_onlinetext.view_summary | public function view_summary(stdClass $submission, & $showviewlink) {
global $CFG;
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
// Always show the view link.
$showviewlink = true;
if ($onlinetextsubmission) {
// This contains the shorte... | php | public function view_summary(stdClass $submission, & $showviewlink) {
global $CFG;
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
// Always show the view link.
$showviewlink = true;
if ($onlinetextsubmission) {
// This contains the shorte... | [
"public",
"function",
"view_summary",
"(",
"stdClass",
"$",
"submission",
",",
"&",
"$",
"showviewlink",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"onlinetextsubmission",
"=",
"$",
"this",
"->",
"get_onlinetext_submission",
"(",
"$",
"submission",
"->",
"id",
... | Display onlinetext word count in the submission status table
@param stdClass $submission
@param bool $showviewlink - If the summary has been truncated set this to true
@return string | [
"Display",
"onlinetext",
"word",
"count",
"in",
"the",
"submission",
"status",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/onlinetext/locallib.php#L364-L405 |
214,457 | moodle/moodle | mod/assign/submission/onlinetext/locallib.php | assign_submission_onlinetext.get_files | public function get_files(stdClass $submission, stdClass $user) {
global $DB;
$files = array();
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
// Note that this check is the same logic as the result from the is_empty function but we do
// not call it... | php | public function get_files(stdClass $submission, stdClass $user) {
global $DB;
$files = array();
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
// Note that this check is the same logic as the result from the is_empty function but we do
// not call it... | [
"public",
"function",
"get_files",
"(",
"stdClass",
"$",
"submission",
",",
"stdClass",
"$",
"user",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"files",
"=",
"array",
"(",
")",
";",
"$",
"onlinetextsubmission",
"=",
"$",
"this",
"->",
"get_onlinetext_submiss... | Produce a list of files suitable for export that represent this submission.
@param stdClass $submission - For this is the submission data
@param stdClass $user - This is the user record for this submission
@return array - return an array of files indexed by filename | [
"Produce",
"a",
"list",
"of",
"files",
"suitable",
"for",
"export",
"that",
"represent",
"this",
"submission",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/onlinetext/locallib.php#L414-L447 |
214,458 | moodle/moodle | mod/assign/submission/onlinetext/locallib.php | assign_submission_onlinetext.view | public function view(stdClass $submission) {
global $CFG;
$result = '';
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
if ($onlinetextsubmission) {
// Render for portfolio API.
$result .= $this->assignment->render_editor_content(ASSI... | php | public function view(stdClass $submission) {
global $CFG;
$result = '';
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
if ($onlinetextsubmission) {
// Render for portfolio API.
$result .= $this->assignment->render_editor_content(ASSI... | [
"public",
"function",
"view",
"(",
"stdClass",
"$",
"submission",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"result",
"=",
"''",
";",
"$",
"onlinetextsubmission",
"=",
"$",
"this",
"->",
"get_onlinetext_submission",
"(",
"$",
"submission",
"->",
"id",
")",... | Display the saved text content from the editor in the view table
@param stdClass $submission
@return string | [
"Display",
"the",
"saved",
"text",
"content",
"from",
"the",
"editor",
"in",
"the",
"view",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/onlinetext/locallib.php#L455-L484 |
214,459 | moodle/moodle | mod/assign/submission/onlinetext/locallib.php | assign_submission_onlinetext.is_empty | public function is_empty(stdClass $submission) {
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
$wordcount = 0;
if (isset($onlinetextsubmission->onlinetext)) {
$wordcount = count_words(trim($onlinetextsubmission->onlinetext));
}
return $w... | php | public function is_empty(stdClass $submission) {
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
$wordcount = 0;
if (isset($onlinetextsubmission->onlinetext)) {
$wordcount = count_words(trim($onlinetextsubmission->onlinetext));
}
return $w... | [
"public",
"function",
"is_empty",
"(",
"stdClass",
"$",
"submission",
")",
"{",
"$",
"onlinetextsubmission",
"=",
"$",
"this",
"->",
"get_onlinetext_submission",
"(",
"$",
"submission",
"->",
"id",
")",
";",
"$",
"wordcount",
"=",
"0",
";",
"if",
"(",
"iss... | No text is set for this plugin
@param stdClass $submission
@return bool | [
"No",
"text",
"is",
"set",
"for",
"this",
"plugin"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/onlinetext/locallib.php#L599-L608 |
214,460 | moodle/moodle | mod/assign/submission/onlinetext/locallib.php | assign_submission_onlinetext.check_word_count | public function check_word_count($submissiontext) {
global $OUTPUT;
$wordlimitenabled = $this->get_config('wordlimitenabled');
$wordlimit = $this->get_config('wordlimit');
if ($wordlimitenabled == 0) {
return null;
}
// Count words and compare to limit.
... | php | public function check_word_count($submissiontext) {
global $OUTPUT;
$wordlimitenabled = $this->get_config('wordlimitenabled');
$wordlimit = $this->get_config('wordlimit');
if ($wordlimitenabled == 0) {
return null;
}
// Count words and compare to limit.
... | [
"public",
"function",
"check_word_count",
"(",
"$",
"submissiontext",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"wordlimitenabled",
"=",
"$",
"this",
"->",
"get_config",
"(",
"'wordlimitenabled'",
")",
";",
"$",
"wordlimit",
"=",
"$",
"this",
"->",
"get_c... | Compare word count of onlinetext submission to word limit, and return result.
@param string $submissiontext Onlinetext submission text from editor
@return string Error message if limit is enabled and exceeded, otherwise null | [
"Compare",
"word",
"count",
"of",
"onlinetext",
"submission",
"to",
"word",
"limit",
"and",
"return",
"result",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/onlinetext/locallib.php#L688-L707 |
214,461 | moodle/moodle | lib/dml/pdo_moodle_database.php | pdo_moodle_database.get_fieldset_sql | public function get_fieldset_sql($sql, array $params=null) {
$rs = $this->get_recordset_sql($sql, $params);
if (!$rs->valid()) {
$rs->close(); // Not going to iterate (but exit), close rs
return false;
}
$result = array();
foreach($rs as $value) {
... | php | public function get_fieldset_sql($sql, array $params=null) {
$rs = $this->get_recordset_sql($sql, $params);
if (!$rs->valid()) {
$rs->close(); // Not going to iterate (but exit), close rs
return false;
}
$result = array();
foreach($rs as $value) {
... | [
"public",
"function",
"get_fieldset_sql",
"(",
"$",
"sql",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"rs",
"=",
"$",
"this",
"->",
"get_recordset_sql",
"(",
"$",
"sql",
",",
"$",
"params",
")",
";",
"if",
"(",
"!",
"$",
"rs",
"->",
... | Selects rows and return values of first column as array.
@param string $sql The SQL query
@param array $params array of sql parameters
@return array of values | [
"Selects",
"rows",
"and",
"return",
"values",
"of",
"first",
"column",
"as",
"array",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/pdo_moodle_database.php#L295-L307 |
214,462 | moodle/moodle | lib/dml/pdo_moodle_database.php | pdo_moodle_database.get_records_sql | public function get_records_sql($sql, array $params=null, $limitfrom=0, $limitnum=0) {
global $CFG;
$rs = $this->get_recordset_sql($sql, $params, $limitfrom, $limitnum);
if (!$rs->valid()) {
$rs->close(); // Not going to iterate (but exit), close rs
return false;
... | php | public function get_records_sql($sql, array $params=null, $limitfrom=0, $limitnum=0) {
global $CFG;
$rs = $this->get_recordset_sql($sql, $params, $limitfrom, $limitnum);
if (!$rs->valid()) {
$rs->close(); // Not going to iterate (but exit), close rs
return false;
... | [
"public",
"function",
"get_records_sql",
"(",
"$",
"sql",
",",
"array",
"$",
"params",
"=",
"null",
",",
"$",
"limitfrom",
"=",
"0",
",",
"$",
"limitnum",
"=",
"0",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"rs",
"=",
"$",
"this",
"->",
"get_record... | Get a number of records as an array of objects.
Return value is like:
@see function get_records.
@param string $sql the SQL select query to execute. The first column of this SELECT statement
must be a unique value (usually the 'id' field), as it will be used as the key of the
returned array.
@param array $params arra... | [
"Get",
"a",
"number",
"of",
"records",
"as",
"an",
"array",
"of",
"objects",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/pdo_moodle_database.php#L323-L341 |
214,463 | moodle/moodle | lib/dml/pdo_moodle_database.php | pdo_moodle_database.set_field_select | public function set_field_select($table, $newfield, $newvalue, $select, array $params=null) {
if ($select) {
$select = "WHERE $select";
}
if (is_null($params)) {
$params = array();
}
list($select, $params, $type) = $this->fix_sql_params($select, $params);
... | php | public function set_field_select($table, $newfield, $newvalue, $select, array $params=null) {
if ($select) {
$select = "WHERE $select";
}
if (is_null($params)) {
$params = array();
}
list($select, $params, $type) = $this->fix_sql_params($select, $params);
... | [
"public",
"function",
"set_field_select",
"(",
"$",
"table",
",",
"$",
"newfield",
",",
"$",
"newvalue",
",",
"$",
"select",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"select",
")",
"{",
"$",
"select",
"=",
"\"WHERE $select\""... | Set a single field in every table row where the select statement evaluates to true.
@param string $table The database table to be checked against.
@param string $newfield the field to set.
@param string $newvalue the value to set the field to.
@param string $select A fragment of SQL to be used in a where clause in the... | [
"Set",
"a",
"single",
"field",
"in",
"every",
"table",
"row",
"where",
"the",
"select",
"statement",
"evaluates",
"to",
"true",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/pdo_moodle_database.php#L502-L535 |
214,464 | moodle/moodle | lib/dml/pdo_moodle_database.php | pdo_moodle_database.import_record | public function import_record($table, $dataobject) {
$dataobject = (object)$dataobject;
$columns = $this->get_columns($table);
$cleaned = array();
foreach ($dataobject as $field=>$value) {
if (!isset($columns[$field])) {
continue;
}
$c... | php | public function import_record($table, $dataobject) {
$dataobject = (object)$dataobject;
$columns = $this->get_columns($table);
$cleaned = array();
foreach ($dataobject as $field=>$value) {
if (!isset($columns[$field])) {
continue;
}
$c... | [
"public",
"function",
"import_record",
"(",
"$",
"table",
",",
"$",
"dataobject",
")",
"{",
"$",
"dataobject",
"=",
"(",
"object",
")",
"$",
"dataobject",
";",
"$",
"columns",
"=",
"$",
"this",
"->",
"get_columns",
"(",
"$",
"table",
")",
";",
"$",
"... | Import a record into a table, id field is required.
Basic safety checks only. Lobs are supported.
@param string $table name of database table to be inserted into
@param mixed $dataobject object or array with fields in the record
@return bool success | [
"Import",
"a",
"record",
"into",
"a",
"table",
"id",
"field",
"is",
"required",
".",
"Basic",
"safety",
"checks",
"only",
".",
"Lobs",
"are",
"supported",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/pdo_moodle_database.php#L584-L597 |
214,465 | moodle/moodle | backup/cc/cc_lib/cc_manifest.php | cc_manifest.register_namespaces_for_xpath | public function register_namespaces_for_xpath() {
$scnam = $this->activemanifest->get_cc_namespaces();
foreach ($scnam as $key => $value) {
$this->registerNS($key, $value);
}
} | php | public function register_namespaces_for_xpath() {
$scnam = $this->activemanifest->get_cc_namespaces();
foreach ($scnam as $key => $value) {
$this->registerNS($key, $value);
}
} | [
"public",
"function",
"register_namespaces_for_xpath",
"(",
")",
"{",
"$",
"scnam",
"=",
"$",
"this",
"->",
"activemanifest",
"->",
"get_cc_namespaces",
"(",
")",
";",
"foreach",
"(",
"$",
"scnam",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"th... | Register Namespace for use XPATH | [
"Register",
"Namespace",
"for",
"use",
"XPATH"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/cc/cc_lib/cc_manifest.php#L69-L74 |
214,466 | moodle/moodle | backup/cc/cc_lib/cc_manifest.php | cc_manifest.add_metadata_manifest | public function add_metadata_manifest(cc_i_metadata_manifest $met) {
$metanode = $this->node("//imscc:manifest[@identifier='".
$this->activemanifest->manifestID().
"']/imscc:metadata");
$nmeta = $this->activemanifest->create_metadata_node($... | php | public function add_metadata_manifest(cc_i_metadata_manifest $met) {
$metanode = $this->node("//imscc:manifest[@identifier='".
$this->activemanifest->manifestID().
"']/imscc:metadata");
$nmeta = $this->activemanifest->create_metadata_node($... | [
"public",
"function",
"add_metadata_manifest",
"(",
"cc_i_metadata_manifest",
"$",
"met",
")",
"{",
"$",
"metanode",
"=",
"$",
"this",
"->",
"node",
"(",
"\"//imscc:manifest[@identifier='\"",
".",
"$",
"this",
"->",
"activemanifest",
"->",
"manifestID",
"(",
")",
... | Add Metadata For Manifest
@param cc_i_metadata_manifest $met | [
"Add",
"Metadata",
"For",
"Manifest"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/cc/cc_lib/cc_manifest.php#L89-L95 |
214,467 | moodle/moodle | backup/cc/cc_lib/cc_manifest.php | cc_manifest.add_metadata_resource | public function add_metadata_resource(cc_i_metadata_resource $met, $identifier) {
$metanode = $this->node("//imscc:resource".
"[@identifier='".
$identifier.
"']");
$metanode2 = $this->node("//imscc:resource".
"[@identifier='".
$identifier.
... | php | public function add_metadata_resource(cc_i_metadata_resource $met, $identifier) {
$metanode = $this->node("//imscc:resource".
"[@identifier='".
$identifier.
"']");
$metanode2 = $this->node("//imscc:resource".
"[@identifier='".
$identifier.
... | [
"public",
"function",
"add_metadata_resource",
"(",
"cc_i_metadata_resource",
"$",
"met",
",",
"$",
"identifier",
")",
"{",
"$",
"metanode",
"=",
"$",
"this",
"->",
"node",
"(",
"\"//imscc:resource\"",
".",
"\"[@identifier='\"",
".",
"$",
"identifier",
".",
"\"'... | Add Metadata For Resource
@param cc_i_metadata_resource $met
@param string $identifier | [
"Add",
"Metadata",
"For",
"Resource"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/cc/cc_lib/cc_manifest.php#L104-L116 |
214,468 | moodle/moodle | backup/cc/cc_lib/cc_manifest.php | cc_manifest.add_metadata_file | public function add_metadata_file(cc_i_metadata_file $met, $identifier, $filename) {
if (empty($met) || empty($identifier) || empty($filename)) {
throw new Exception('Try to add a metadata file with nulls values given!');
}
$metanode = $this->node("//imscc:resource".
"[... | php | public function add_metadata_file(cc_i_metadata_file $met, $identifier, $filename) {
if (empty($met) || empty($identifier) || empty($filename)) {
throw new Exception('Try to add a metadata file with nulls values given!');
}
$metanode = $this->node("//imscc:resource".
"[... | [
"public",
"function",
"add_metadata_file",
"(",
"cc_i_metadata_file",
"$",
"met",
",",
"$",
"identifier",
",",
"$",
"filename",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"met",
")",
"||",
"empty",
"(",
"$",
"identifier",
")",
"||",
"empty",
"(",
"$",
"fi... | Add Metadata For File
@param cc_i_metadata_file $met
@param string $identifier
@param string $filename | [
"Add",
"Metadata",
"For",
"File"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/cc/cc_lib/cc_manifest.php#L126-L146 |
214,469 | moodle/moodle | backup/cc/cc_lib/cc_manifest.php | cc_manifest.add_new_organization | public function add_new_organization(cc_i_organization &$org) {
$norg = $this->activemanifest->create_organization_node($org, $this->doc);
$orgnode = $this->node("//imscc:manifest[@identifier='".
$this->activemanifest->manifestID().
"']/imscc:organizations");
$orgnode-... | php | public function add_new_organization(cc_i_organization &$org) {
$norg = $this->activemanifest->create_organization_node($org, $this->doc);
$orgnode = $this->node("//imscc:manifest[@identifier='".
$this->activemanifest->manifestID().
"']/imscc:organizations");
$orgnode-... | [
"public",
"function",
"add_new_organization",
"(",
"cc_i_organization",
"&",
"$",
"org",
")",
"{",
"$",
"norg",
"=",
"$",
"this",
"->",
"activemanifest",
"->",
"create_organization_node",
"(",
"$",
"org",
",",
"$",
"this",
"->",
"doc",
")",
";",
"$",
"orgn... | Add a new organization
@param cc_i_organization $org | [
"Add",
"a",
"new",
"organization"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/cc/cc_lib/cc_manifest.php#L182-L188 |
214,470 | moodle/moodle | backup/cc/cc_lib/cc_manifest.php | cc_manifest.add_resource | public function add_resource(cc_i_resource $res, $identifier = null, $type = 'webcontent') {
if (!$this->ccobj->valid($type)) {
throw new Exception("Type invalid...");
}
if ($res == null) {
throw new Exception('Invalid Resource or dont give it');
}
$rst ... | php | public function add_resource(cc_i_resource $res, $identifier = null, $type = 'webcontent') {
if (!$this->ccobj->valid($type)) {
throw new Exception("Type invalid...");
}
if ($res == null) {
throw new Exception('Invalid Resource or dont give it');
}
$rst ... | [
"public",
"function",
"add_resource",
"(",
"cc_i_resource",
"$",
"res",
",",
"$",
"identifier",
"=",
"null",
",",
"$",
"type",
"=",
"'webcontent'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"ccobj",
"->",
"valid",
"(",
"$",
"type",
")",
")",
"{",
... | Add a resource to the manifest
@param cc_i_resource $res
@param string $identifier
@param string $type
@return array | [
"Add",
"a",
"resource",
"to",
"the",
"manifest"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/cc/cc_lib/cc_manifest.php#L232-L271 |
214,471 | moodle/moodle | backup/cc/cc_lib/cc_manifest.php | cc_manifest.put_nodes | public function put_nodes() {
$resnodestr = "//imscc:manifest[@identifier='".$this->activemanifest->manifestID().
"']/imscc:resources";
$resnode = $this->node($resnodestr);
foreach ($this->activemanifest->resources as $k => $v) {
($k);
$depen = $this->che... | php | public function put_nodes() {
$resnodestr = "//imscc:manifest[@identifier='".$this->activemanifest->manifestID().
"']/imscc:resources";
$resnode = $this->node($resnodestr);
foreach ($this->activemanifest->resources as $k => $v) {
($k);
$depen = $this->che... | [
"public",
"function",
"put_nodes",
"(",
")",
"{",
"$",
"resnodestr",
"=",
"\"//imscc:manifest[@identifier='\"",
".",
"$",
"this",
"->",
"activemanifest",
"->",
"manifestID",
"(",
")",
".",
"\"']/imscc:resources\"",
";",
"$",
"resnode",
"=",
"$",
"this",
"->",
... | Append the resources nodes in the Manifest
@return DOMNode | [
"Append",
"the",
"resources",
"nodes",
"in",
"the",
"Manifest"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/cc/cc_lib/cc_manifest.php#L325-L353 |
214,472 | moodle/moodle | lib/spout/src/Spout/Writer/Common/Helper/AbstractStyleHelper.php | AbstractStyleHelper.applyWrapTextIfCellContainsNewLine | protected function applyWrapTextIfCellContainsNewLine($style, $dataRow)
{
// if the "wrap text" option is already set, no-op
if ($style->hasSetWrapText()) {
return $style;
}
foreach ($dataRow as $cell) {
if (is_string($cell) && strpos($cell, "\n") !== false) ... | php | protected function applyWrapTextIfCellContainsNewLine($style, $dataRow)
{
// if the "wrap text" option is already set, no-op
if ($style->hasSetWrapText()) {
return $style;
}
foreach ($dataRow as $cell) {
if (is_string($cell) && strpos($cell, "\n") !== false) ... | [
"protected",
"function",
"applyWrapTextIfCellContainsNewLine",
"(",
"$",
"style",
",",
"$",
"dataRow",
")",
"{",
"// if the \"wrap text\" option is already set, no-op",
"if",
"(",
"$",
"style",
"->",
"hasSetWrapText",
"(",
")",
")",
"{",
"return",
"$",
"style",
";",... | Set the "wrap text" option if a cell of the given row contains a new line.
@NOTE: There is a bug on the Mac version of Excel (2011 and below) where new lines
are ignored even when the "wrap text" option is set. This only occurs with
inline strings (shared strings do work fine).
A workaround would be to encode "\n" as ... | [
"Set",
"the",
"wrap",
"text",
"option",
"if",
"a",
"cell",
"of",
"the",
"given",
"row",
"contains",
"a",
"new",
"line",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/Common/Helper/AbstractStyleHelper.php#L122-L137 |
214,473 | moodle/moodle | cache/stores/mongodb/MongoDB/Client.php | Client.listDatabases | public function listDatabases(array $options = [])
{
$operation = new ListDatabases($options);
$server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
return $operation->execute($server);
} | php | public function listDatabases(array $options = [])
{
$operation = new ListDatabases($options);
$server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
return $operation->execute($server);
} | [
"public",
"function",
"listDatabases",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"operation",
"=",
"new",
"ListDatabases",
"(",
"$",
"options",
")",
";",
"$",
"server",
"=",
"$",
"this",
"->",
"manager",
"->",
"selectServer",
"(",
"ne... | List databases.
@see ListDatabases::__construct() for supported options
@return DatabaseInfoIterator
@throws UnexpectedValueException if the command response was malformed
@throws InvalidArgumentException for parameter/option parsing errors
@throws DriverRuntimeException for other driver errors (e.g. connection errors... | [
"List",
"databases",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/Client.php#L225-L231 |
214,474 | moodle/moodle | cache/stores/mongodb/MongoDB/Client.php | Client.selectCollection | public function selectCollection($databaseName, $collectionName, array $options = [])
{
$options += ['typeMap' => $this->typeMap];
return new Collection($this->manager, $databaseName, $collectionName, $options);
} | php | public function selectCollection($databaseName, $collectionName, array $options = [])
{
$options += ['typeMap' => $this->typeMap];
return new Collection($this->manager, $databaseName, $collectionName, $options);
} | [
"public",
"function",
"selectCollection",
"(",
"$",
"databaseName",
",",
"$",
"collectionName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'typeMap'",
"=>",
"$",
"this",
"->",
"typeMap",
"]",
";",
"return",
"new",
... | Select a collection.
@see Collection::__construct() for supported options
@param string $databaseName Name of the database containing the collection
@param string $collectionName Name of the collection to select
@param array $options Collection constructor options
@return Collection
@throws InvalidArgumentEx... | [
"Select",
"a",
"collection",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/Client.php#L243-L248 |
214,475 | moodle/moodle | mod/lesson/locallib.php | lesson_add_page_form_base.definition | public final function definition() {
global $CFG;
$mform = $this->_form;
$editoroptions = $this->_customdata['editoroptions'];
if ($this->qtypestring != 'selectaqtype') {
if ($this->_customdata['edit']) {
$mform->addElement('header', 'qtypeheading', get_strin... | php | public final function definition() {
global $CFG;
$mform = $this->_form;
$editoroptions = $this->_customdata['editoroptions'];
if ($this->qtypestring != 'selectaqtype') {
if ($this->_customdata['edit']) {
$mform->addElement('header', 'qtypeheading', get_strin... | [
"public",
"final",
"function",
"definition",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"$",
"editoroptions",
"=",
"$",
"this",
"->",
"_customdata",
"[",
"'editoroptions'",
"]",
";",
"if",
"(",
"$",
... | Add the required basic elements to the form.
This method adds the basic elements to the form including title and contents
and then calls custom_definition(); | [
"Add",
"the",
"required",
"basic",
"elements",
"to",
"the",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L1312-L1365 |
214,476 | moodle/moodle | mod/lesson/locallib.php | lesson.load | public static function load($lessonid) {
global $DB;
if (!$lesson = $DB->get_record('lesson', array('id' => $lessonid))) {
print_error('invalidcoursemodule');
}
return new lesson($lesson);
} | php | public static function load($lessonid) {
global $DB;
if (!$lesson = $DB->get_record('lesson', array('id' => $lessonid))) {
print_error('invalidcoursemodule');
}
return new lesson($lesson);
} | [
"public",
"static",
"function",
"load",
"(",
"$",
"lessonid",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"$",
"lesson",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'lesson'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"lessonid",
")",
")",
")",
... | Generates a lesson object from the database given its id
@static
@param int $lessonid
@return lesson | [
"Generates",
"a",
"lesson",
"object",
"from",
"the",
"database",
"given",
"its",
"id"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L1626-L1633 |
214,477 | moodle/moodle | mod/lesson/locallib.php | lesson.delete | public function delete() {
global $CFG, $DB;
require_once($CFG->libdir.'/gradelib.php');
require_once($CFG->dirroot.'/calendar/lib.php');
$cm = get_coursemodule_from_instance('lesson', $this->properties->id, $this->properties->course);
$context = context_module::instance($cm->id... | php | public function delete() {
global $CFG, $DB;
require_once($CFG->libdir.'/gradelib.php');
require_once($CFG->dirroot.'/calendar/lib.php');
$cm = get_coursemodule_from_instance('lesson', $this->properties->id, $this->properties->course);
$context = context_module::instance($cm->id... | [
"public",
"function",
"delete",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/gradelib.php'",
")",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/calendar/lib.php'",
")"... | Deletes this lesson from the database | [
"Deletes",
"this",
"lesson",
"from",
"the",
"database"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L1638-L1672 |
214,478 | moodle/moodle | mod/lesson/locallib.php | lesson.delete_override | public function delete_override($overrideid) {
global $CFG, $DB;
require_once($CFG->dirroot . '/calendar/lib.php');
$cm = get_coursemodule_from_instance('lesson', $this->properties->id, $this->properties->course);
$override = $DB->get_record('lesson_overrides', array('id' => $override... | php | public function delete_override($overrideid) {
global $CFG, $DB;
require_once($CFG->dirroot . '/calendar/lib.php');
$cm = get_coursemodule_from_instance('lesson', $this->properties->id, $this->properties->course);
$override = $DB->get_record('lesson_overrides', array('id' => $override... | [
"public",
"function",
"delete_override",
"(",
"$",
"overrideid",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/calendar/lib.php'",
")",
";",
"$",
"cm",
"=",
"get_coursemodule_from_instance",
"(... | Deletes a lesson override from the database and clears any corresponding calendar events
@param int $overrideid The id of the override being deleted
@return bool true on success | [
"Deletes",
"a",
"lesson",
"override",
"from",
"the",
"database",
"and",
"clears",
"any",
"corresponding",
"calendar",
"events"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L1680-L1727 |
214,479 | moodle/moodle | mod/lesson/locallib.php | lesson.delete_all_overrides | public function delete_all_overrides() {
global $DB;
$overrides = $DB->get_records('lesson_overrides', array('lessonid' => $this->properties->id), 'id');
foreach ($overrides as $override) {
$this->delete_override($override->id);
}
} | php | public function delete_all_overrides() {
global $DB;
$overrides = $DB->get_records('lesson_overrides', array('lessonid' => $this->properties->id), 'id');
foreach ($overrides as $override) {
$this->delete_override($override->id);
}
} | [
"public",
"function",
"delete_all_overrides",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"overrides",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"'lesson_overrides'",
",",
"array",
"(",
"'lessonid'",
"=>",
"$",
"this",
"->",
"properties",
"->",
"id",
")"... | Deletes all lesson overrides from the database and clears any corresponding calendar events | [
"Deletes",
"all",
"lesson",
"overrides",
"from",
"the",
"database",
"and",
"clears",
"any",
"corresponding",
"calendar",
"events"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L1732-L1739 |
214,480 | moodle/moodle | mod/lesson/locallib.php | lesson.get_messages | protected function get_messages() {
global $SESSION;
$messages = array();
if (!empty($SESSION->lesson_messages) && is_array($SESSION->lesson_messages) && array_key_exists($this->properties->id, $SESSION->lesson_messages)) {
$messages = $SESSION->lesson_messages[$this->properties->id... | php | protected function get_messages() {
global $SESSION;
$messages = array();
if (!empty($SESSION->lesson_messages) && is_array($SESSION->lesson_messages) && array_key_exists($this->properties->id, $SESSION->lesson_messages)) {
$messages = $SESSION->lesson_messages[$this->properties->id... | [
"protected",
"function",
"get_messages",
"(",
")",
"{",
"global",
"$",
"SESSION",
";",
"$",
"messages",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"SESSION",
"->",
"lesson_messages",
")",
"&&",
"is_array",
"(",
"$",
"SESSION",
"->"... | Fetches messages from the session that may have been set in previous page
actions.
<code>
// Do not call this method directly instead use
$lesson->messages;
</code>
@return array | [
"Fetches",
"messages",
"from",
"the",
"session",
"that",
"may",
"have",
"been",
"set",
"in",
"previous",
"page",
"actions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L1902-L1912 |
214,481 | moodle/moodle | mod/lesson/locallib.php | lesson.get_attempts | public function get_attempts($retries, $correct=false, $pageid=null, $userid=null) {
global $USER, $DB;
$params = array("lessonid"=>$this->properties->id, "userid"=>$userid, "retry"=>$retries);
if ($correct) {
$params['correct'] = 1;
}
if ($pageid !== null) {
... | php | public function get_attempts($retries, $correct=false, $pageid=null, $userid=null) {
global $USER, $DB;
$params = array("lessonid"=>$this->properties->id, "userid"=>$userid, "retry"=>$retries);
if ($correct) {
$params['correct'] = 1;
}
if ($pageid !== null) {
... | [
"public",
"function",
"get_attempts",
"(",
"$",
"retries",
",",
"$",
"correct",
"=",
"false",
",",
"$",
"pageid",
"=",
"null",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"DB",
";",
"$",
"params",
"=",
"array",
"(",
... | Get all of the attempts for the current user.
@param int $retries
@param bool $correct Optional: only fetch correct attempts
@param int $pageid Optional: only fetch attempts at the given page
@param int $userid Optional: defaults to the current user if not set
@return array|false | [
"Get",
"all",
"of",
"the",
"attempts",
"for",
"the",
"current",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L1923-L1936 |
214,482 | moodle/moodle | mod/lesson/locallib.php | lesson.get_firstpage | protected function get_firstpage() {
$pages = $this->load_all_pages();
if (count($pages) > 0) {
foreach ($pages as $page) {
if ((int)$page->prevpageid === 0) {
return $page;
}
}
}
return false;
} | php | protected function get_firstpage() {
$pages = $this->load_all_pages();
if (count($pages) > 0) {
foreach ($pages as $page) {
if ((int)$page->prevpageid === 0) {
return $page;
}
}
}
return false;
} | [
"protected",
"function",
"get_firstpage",
"(",
")",
"{",
"$",
"pages",
"=",
"$",
"this",
"->",
"load_all_pages",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"pages",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"pages",
"as",
"$",
"page",
")",
... | Returns the first page for the lesson or false if there isn't one.
This method should be called via the magic method __get();
<code>
$firstpage = $lesson->firstpage;
</code>
@return lesson_page|bool Returns the lesson_page specialised object or false | [
"Returns",
"the",
"first",
"page",
"for",
"the",
"lesson",
"or",
"false",
"if",
"there",
"isn",
"t",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L1969-L1979 |
214,483 | moodle/moodle | mod/lesson/locallib.php | lesson.get_lastpage | protected function get_lastpage() {
$pages = $this->load_all_pages();
if (count($pages) > 0) {
foreach ($pages as $page) {
if ((int)$page->nextpageid === 0) {
return $page;
}
}
}
return false;
} | php | protected function get_lastpage() {
$pages = $this->load_all_pages();
if (count($pages) > 0) {
foreach ($pages as $page) {
if ((int)$page->nextpageid === 0) {
return $page;
}
}
}
return false;
} | [
"protected",
"function",
"get_lastpage",
"(",
")",
"{",
"$",
"pages",
"=",
"$",
"this",
"->",
"load_all_pages",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"pages",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"pages",
"as",
"$",
"page",
")",
"... | Returns the last page for the lesson or false if there isn't one.
This method should be called via the magic method __get();
<code>
$lastpage = $lesson->lastpage;
</code>
@return lesson_page|bool Returns the lesson_page specialised object or false | [
"Returns",
"the",
"last",
"page",
"for",
"the",
"lesson",
"or",
"false",
"if",
"there",
"isn",
"t",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L1991-L2001 |
214,484 | moodle/moodle | mod/lesson/locallib.php | lesson.get_next_page | public function get_next_page($nextpageid) {
global $USER, $DB;
$allpages = $this->load_all_pages();
if ($this->properties->nextpagedefault) {
// in Flash Card mode...first get number of retakes
$nretakes = $DB->count_records("lesson_grades", array("lessonid" => $this->pr... | php | public function get_next_page($nextpageid) {
global $USER, $DB;
$allpages = $this->load_all_pages();
if ($this->properties->nextpagedefault) {
// in Flash Card mode...first get number of retakes
$nretakes = $DB->count_records("lesson_grades", array("lessonid" => $this->pr... | [
"public",
"function",
"get_next_page",
"(",
"$",
"nextpageid",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"DB",
";",
"$",
"allpages",
"=",
"$",
"this",
"->",
"load_all_pages",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"properties",
"->",
"nextpagede... | Gets the next page id to display after the one that is provided.
@param int $nextpageid
@return bool | [
"Gets",
"the",
"next",
"page",
"id",
"to",
"display",
"after",
"the",
"one",
"that",
"is",
"provided",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2051-L2091 |
214,485 | moodle/moodle | mod/lesson/locallib.php | lesson.add_message | public function add_message($message, $class="notifyproblem", $align='center') {
global $SESSION;
if (empty($SESSION->lesson_messages) || !is_array($SESSION->lesson_messages)) {
$SESSION->lesson_messages = array();
$SESSION->lesson_messages[$this->properties->id] = array();
... | php | public function add_message($message, $class="notifyproblem", $align='center') {
global $SESSION;
if (empty($SESSION->lesson_messages) || !is_array($SESSION->lesson_messages)) {
$SESSION->lesson_messages = array();
$SESSION->lesson_messages[$this->properties->id] = array();
... | [
"public",
"function",
"add_message",
"(",
"$",
"message",
",",
"$",
"class",
"=",
"\"notifyproblem\"",
",",
"$",
"align",
"=",
"'center'",
")",
"{",
"global",
"$",
"SESSION",
";",
"if",
"(",
"empty",
"(",
"$",
"SESSION",
"->",
"lesson_messages",
")",
"||... | Sets a message against the session for this lesson that will displayed next
time the lesson processes messages
@param string $message
@param string $class
@param string $align
@return bool | [
"Sets",
"a",
"message",
"against",
"the",
"session",
"for",
"this",
"lesson",
"that",
"will",
"displayed",
"next",
"time",
"the",
"lesson",
"processes",
"messages"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2102-L2115 |
214,486 | moodle/moodle | mod/lesson/locallib.php | lesson.is_accessible | public function is_accessible() {
$available = $this->properties->available;
$deadline = $this->properties->deadline;
return (($available == 0 || time() >= $available) && ($deadline == 0 || time() < $deadline));
} | php | public function is_accessible() {
$available = $this->properties->available;
$deadline = $this->properties->deadline;
return (($available == 0 || time() >= $available) && ($deadline == 0 || time() < $deadline));
} | [
"public",
"function",
"is_accessible",
"(",
")",
"{",
"$",
"available",
"=",
"$",
"this",
"->",
"properties",
"->",
"available",
";",
"$",
"deadline",
"=",
"$",
"this",
"->",
"properties",
"->",
"deadline",
";",
"return",
"(",
"(",
"$",
"available",
"=="... | Check if the lesson is accessible at the present time
@return bool True if the lesson is accessible, false otherwise | [
"Check",
"if",
"the",
"lesson",
"is",
"accessible",
"at",
"the",
"present",
"time"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2121-L2125 |
214,487 | moodle/moodle | mod/lesson/locallib.php | lesson.start_timer | public function start_timer() {
global $USER, $DB;
$cm = get_coursemodule_from_instance('lesson', $this->properties()->id, $this->properties()->course,
false, MUST_EXIST);
// Trigger lesson started event.
$event = \mod_lesson\event\lesson_started::create(array(
... | php | public function start_timer() {
global $USER, $DB;
$cm = get_coursemodule_from_instance('lesson', $this->properties()->id, $this->properties()->course,
false, MUST_EXIST);
// Trigger lesson started event.
$event = \mod_lesson\event\lesson_started::create(array(
... | [
"public",
"function",
"start_timer",
"(",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"DB",
";",
"$",
"cm",
"=",
"get_coursemodule_from_instance",
"(",
"'lesson'",
",",
"$",
"this",
"->",
"properties",
"(",
")",
"->",
"id",
",",
"$",
"this",
"->",
"prop... | Starts the lesson time for the current user
@return bool Returns true | [
"Starts",
"the",
"lesson",
"time",
"for",
"the",
"current",
"user"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2131-L2161 |
214,488 | moodle/moodle | mod/lesson/locallib.php | lesson.update_timer | public function update_timer($restart=false, $continue=false, $endreached =false) {
global $USER, $DB;
$cm = get_coursemodule_from_instance('lesson', $this->properties->id, $this->properties->course);
// clock code
// get time information for this user
if (!$timer = $this->get_... | php | public function update_timer($restart=false, $continue=false, $endreached =false) {
global $USER, $DB;
$cm = get_coursemodule_from_instance('lesson', $this->properties->id, $this->properties->course);
// clock code
// get time information for this user
if (!$timer = $this->get_... | [
"public",
"function",
"update_timer",
"(",
"$",
"restart",
"=",
"false",
",",
"$",
"continue",
"=",
"false",
",",
"$",
"endreached",
"=",
"false",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"DB",
";",
"$",
"cm",
"=",
"get_coursemodule_from_instance",
"("... | Updates the timer to the current time and returns the new timer object
@param bool $restart If set to true the timer is restarted
@param bool $continue If set to true AND $restart=true then the timer
will continue from a previous attempt
@return stdClass The new timer | [
"Updates",
"the",
"timer",
"to",
"the",
"current",
"time",
"and",
"returns",
"the",
"new",
"timer",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2170-L2228 |
214,489 | moodle/moodle | mod/lesson/locallib.php | lesson.stop_timer | public function stop_timer() {
global $USER, $DB;
unset($USER->startlesson[$this->properties->id]);
$cm = get_coursemodule_from_instance('lesson', $this->properties()->id, $this->properties()->course,
false, MUST_EXIST);
// Trigger lesson ended event.
$event = \mod_... | php | public function stop_timer() {
global $USER, $DB;
unset($USER->startlesson[$this->properties->id]);
$cm = get_coursemodule_from_instance('lesson', $this->properties()->id, $this->properties()->course,
false, MUST_EXIST);
// Trigger lesson ended event.
$event = \mod_... | [
"public",
"function",
"stop_timer",
"(",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"DB",
";",
"unset",
"(",
"$",
"USER",
"->",
"startlesson",
"[",
"$",
"this",
"->",
"properties",
"->",
"id",
"]",
")",
";",
"$",
"cm",
"=",
"get_coursemodule_from_insta... | Updates the timer to the current time then stops it by unsetting the user var
@return bool Returns true | [
"Updates",
"the",
"timer",
"to",
"the",
"current",
"time",
"then",
"stops",
"it",
"by",
"unsetting",
"the",
"user",
"var"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2234-L2250 |
214,490 | moodle/moodle | mod/lesson/locallib.php | lesson.link_for_activitylink | public function link_for_activitylink() {
global $DB;
$module = $DB->get_record('course_modules', array('id' => $this->properties->activitylink));
if ($module) {
$modname = $DB->get_field('modules', 'name', array('id' => $module->module));
if ($modname) {
... | php | public function link_for_activitylink() {
global $DB;
$module = $DB->get_record('course_modules', array('id' => $this->properties->activitylink));
if ($module) {
$modname = $DB->get_field('modules', 'name', array('id' => $module->module));
if ($modname) {
... | [
"public",
"function",
"link_for_activitylink",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"module",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'course_modules'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"this",
"->",
"properties",
"->",
"activitylink",
")",... | Returns the link for the related activity
@return string | [
"Returns",
"the",
"link",
"for",
"the",
"related",
"activity"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2265-L2280 |
214,491 | moodle/moodle | mod/lesson/locallib.php | lesson.load_page | public function load_page($pageid) {
if (!array_key_exists($pageid, $this->pages)) {
$manager = lesson_page_type_manager::get($this);
$this->pages[$pageid] = $manager->load_page($pageid, $this);
}
return $this->pages[$pageid];
} | php | public function load_page($pageid) {
if (!array_key_exists($pageid, $this->pages)) {
$manager = lesson_page_type_manager::get($this);
$this->pages[$pageid] = $manager->load_page($pageid, $this);
}
return $this->pages[$pageid];
} | [
"public",
"function",
"load_page",
"(",
"$",
"pageid",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"pageid",
",",
"$",
"this",
"->",
"pages",
")",
")",
"{",
"$",
"manager",
"=",
"lesson_page_type_manager",
"::",
"get",
"(",
"$",
"this",
")"... | Loads the requested page.
This function will return the requested page id as either a specialised
lesson_page object OR as a generic lesson_page.
If the page has been loaded previously it will be returned from the pages
array, otherwise it will be loaded from the database first
@param int $pageid
@return lesson_page ... | [
"Loads",
"the",
"requested",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2293-L2299 |
214,492 | moodle/moodle | mod/lesson/locallib.php | lesson.load_all_pages | public function load_all_pages() {
if (!$this->loadedallpages) {
$manager = lesson_page_type_manager::get($this);
$this->pages = $manager->load_all_pages($this);
$this->loadedallpages = true;
}
return $this->pages;
} | php | public function load_all_pages() {
if (!$this->loadedallpages) {
$manager = lesson_page_type_manager::get($this);
$this->pages = $manager->load_all_pages($this);
$this->loadedallpages = true;
}
return $this->pages;
} | [
"public",
"function",
"load_all_pages",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"loadedallpages",
")",
"{",
"$",
"manager",
"=",
"lesson_page_type_manager",
"::",
"get",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"pages",
"=",
"$",
"manag... | Loads ALL of the pages for this lesson
@return array An array containing all pages from this lesson | [
"Loads",
"ALL",
"of",
"the",
"pages",
"for",
"this",
"lesson"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2306-L2313 |
214,493 | moodle/moodle | mod/lesson/locallib.php | lesson.duplicate_page | public function duplicate_page($pageid) {
global $PAGE;
$cm = get_coursemodule_from_instance('lesson', $this->properties->id, $this->properties->course);
$context = context_module::instance($cm->id);
// Load the page.
$page = $this->load_page($pageid);
$properties = $page... | php | public function duplicate_page($pageid) {
global $PAGE;
$cm = get_coursemodule_from_instance('lesson', $this->properties->id, $this->properties->course);
$context = context_module::instance($cm->id);
// Load the page.
$page = $this->load_page($pageid);
$properties = $page... | [
"public",
"function",
"duplicate_page",
"(",
"$",
"pageid",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"cm",
"=",
"get_coursemodule_from_instance",
"(",
"'lesson'",
",",
"$",
"this",
"->",
"properties",
"->",
"id",
",",
"$",
"this",
"->",
"properties",
"->... | Duplicate the lesson page.
@param int $pageid Page ID of the page to duplicate.
@return void. | [
"Duplicate",
"the",
"lesson",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2321-L2382 |
214,494 | moodle/moodle | mod/lesson/locallib.php | lesson.copy_page_files | protected function copy_page_files($filearea, $itemid, $newitemid, $contextid) {
$fs = get_file_storage();
$files = $fs->get_area_files($contextid, 'mod_lesson', $filearea, $itemid);
foreach ($files as $file) {
$fieldupdates = array('itemid' => $newitemid);
$fs->create_fi... | php | protected function copy_page_files($filearea, $itemid, $newitemid, $contextid) {
$fs = get_file_storage();
$files = $fs->get_area_files($contextid, 'mod_lesson', $filearea, $itemid);
foreach ($files as $file) {
$fieldupdates = array('itemid' => $newitemid);
$fs->create_fi... | [
"protected",
"function",
"copy_page_files",
"(",
"$",
"filearea",
",",
"$",
"itemid",
",",
"$",
"newitemid",
",",
"$",
"contextid",
")",
"{",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"$",
"files",
"=",
"$",
"fs",
"->",
"get_area_files",
"(",
... | Copy the files from one page to another.
@param string $filearea Area that the files are stored.
@param int $itemid Item ID.
@param int $newitemid The item ID for the new page.
@param int $contextid Context ID for this page.
@return void. | [
"Copy",
"the",
"files",
"from",
"one",
"page",
"to",
"another",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2393-L2400 |
214,495 | moodle/moodle | mod/lesson/locallib.php | lesson.jumpto_is_correct | public function jumpto_is_correct($pageid, $jumpto) {
global $DB;
// first test the special values
if (!$jumpto) {
// same page
return false;
} elseif ($jumpto == LESSON_NEXTPAGE) {
return true;
} elseif ($jumpto == LESSON_UNSEENBRANCHPAGE) {
... | php | public function jumpto_is_correct($pageid, $jumpto) {
global $DB;
// first test the special values
if (!$jumpto) {
// same page
return false;
} elseif ($jumpto == LESSON_NEXTPAGE) {
return true;
} elseif ($jumpto == LESSON_UNSEENBRANCHPAGE) {
... | [
"public",
"function",
"jumpto_is_correct",
"(",
"$",
"pageid",
",",
"$",
"jumpto",
")",
"{",
"global",
"$",
"DB",
";",
"// first test the special values",
"if",
"(",
"!",
"$",
"jumpto",
")",
"{",
"// same page",
"return",
"false",
";",
"}",
"elseif",
"(",
... | Determines if a jumpto value is correct or not.
returns true if jumpto page is (logically) after the pageid page or
if the jumpto value is a special value. Returns false in all other cases.
@param int $pageid Id of the page from which you are jumping from.
@param int $jumpto The jumpto number.
@return boolean True o... | [
"Determines",
"if",
"a",
"jumpto",
"value",
"is",
"correct",
"or",
"not",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2412-L2440 |
214,496 | moodle/moodle | mod/lesson/locallib.php | lesson.time_remaining | public function time_remaining($starttime) {
$timeleft = $starttime + $this->properties->timelimit - time();
$hours = floor($timeleft/3600);
$timeleft = $timeleft - ($hours * 3600);
$minutes = floor($timeleft/60);
$secs = $timeleft - ($minutes * 60);
if ($minutes < 10) {... | php | public function time_remaining($starttime) {
$timeleft = $starttime + $this->properties->timelimit - time();
$hours = floor($timeleft/3600);
$timeleft = $timeleft - ($hours * 3600);
$minutes = floor($timeleft/60);
$secs = $timeleft - ($minutes * 60);
if ($minutes < 10) {... | [
"public",
"function",
"time_remaining",
"(",
"$",
"starttime",
")",
"{",
"$",
"timeleft",
"=",
"$",
"starttime",
"+",
"$",
"this",
"->",
"properties",
"->",
"timelimit",
"-",
"time",
"(",
")",
";",
"$",
"hours",
"=",
"floor",
"(",
"$",
"timeleft",
"/",... | Returns the time a user has remaining on this lesson
@param int $starttime Starttime timestamp
@return string | [
"Returns",
"the",
"time",
"a",
"user",
"has",
"remaining",
"on",
"this",
"lesson"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2447-L2466 |
214,497 | moodle/moodle | mod/lesson/locallib.php | lesson.resort_pages | public function resort_pages($pageid, $after) {
global $CFG;
$cm = get_coursemodule_from_instance('lesson', $this->properties->id, $this->properties->course);
$context = context_module::instance($cm->id);
$pages = $this->load_all_pages();
if (!array_key_exists($pageid, $pages)... | php | public function resort_pages($pageid, $after) {
global $CFG;
$cm = get_coursemodule_from_instance('lesson', $this->properties->id, $this->properties->course);
$context = context_module::instance($cm->id);
$pages = $this->load_all_pages();
if (!array_key_exists($pageid, $pages)... | [
"public",
"function",
"resort_pages",
"(",
"$",
"pageid",
",",
"$",
"after",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"cm",
"=",
"get_coursemodule_from_instance",
"(",
"'lesson'",
",",
"$",
"this",
"->",
"properties",
"->",
"id",
",",
"$",
"this",
"->",... | Move a page resorting all other pages.
@param int $pageid
@param int $after
@return void | [
"Move",
"a",
"page",
"resorting",
"all",
"other",
"pages",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2654-L2721 |
214,498 | moodle/moodle | mod/lesson/locallib.php | lesson.get_context | public function get_context() {
if ($this->context == null) {
$this->context = context_module::instance($this->get_cm()->id);
}
return $this->context;
} | php | public function get_context() {
if ($this->context == null) {
$this->context = context_module::instance($this->get_cm()->id);
}
return $this->context;
} | [
"public",
"function",
"get_context",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"context",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"context",
"=",
"context_module",
"::",
"instance",
"(",
"$",
"this",
"->",
"get_cm",
"(",
")",
"->",
"id",
")",
... | Return the lesson context object.
@return stdClass context
@since Moodle 3.3 | [
"Return",
"the",
"lesson",
"context",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2729-L2734 |
214,499 | moodle/moodle | mod/lesson/locallib.php | lesson.get_cm | public function get_cm() {
if ($this->cm == null) {
$this->cm = get_coursemodule_from_instance('lesson', $this->properties->id);
}
return $this->cm;
} | php | public function get_cm() {
if ($this->cm == null) {
$this->cm = get_coursemodule_from_instance('lesson', $this->properties->id);
}
return $this->cm;
} | [
"public",
"function",
"get_cm",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cm",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"cm",
"=",
"get_coursemodule_from_instance",
"(",
"'lesson'",
",",
"$",
"this",
"->",
"properties",
"->",
"id",
")",
";",
"}... | Return the lesson course module object.
@return stdClass course module
@since Moodle 3.3 | [
"Return",
"the",
"lesson",
"course",
"module",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/locallib.php#L2752-L2757 |
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.