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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
219,100 | moodle/moodle | admin/renderer.php | core_admin_renderer.upgrade_confirm_abort_install_page | public function upgrade_confirm_abort_install_page(array $abortable, moodle_url $continue) {
$pluginman = core_plugin_manager::instance();
if (empty($abortable)) {
// The UI should not allow this.
throw new moodle_exception('err_no_plugin_install_abortable', 'core_plugin');
... | php | public function upgrade_confirm_abort_install_page(array $abortable, moodle_url $continue) {
$pluginman = core_plugin_manager::instance();
if (empty($abortable)) {
// The UI should not allow this.
throw new moodle_exception('err_no_plugin_install_abortable', 'core_plugin');
... | [
"public",
"function",
"upgrade_confirm_abort_install_page",
"(",
"array",
"$",
"abortable",
",",
"moodle_url",
"$",
"continue",
")",
"{",
"$",
"pluginman",
"=",
"core_plugin_manager",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"abortable",
... | Display a page to confirm plugin installation cancelation.
@param array $abortable list of \core\update\plugininfo
@param moodle_url $continue
@return string | [
"Display",
"a",
"page",
"to",
"confirm",
"plugin",
"installation",
"cancelation",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L238-L264 |
219,101 | moodle/moodle | admin/renderer.php | core_admin_renderer.check_for_updates_button | public function check_for_updates_button(\core\update\checker $checker, $reloadurl) {
$output = '';
if ($checker->enabled()) {
$output .= $this->container_start('checkforupdates');
$output .= $this->single_button(
new moodle_url($reloadurl, array('fetchupdates' ... | php | public function check_for_updates_button(\core\update\checker $checker, $reloadurl) {
$output = '';
if ($checker->enabled()) {
$output .= $this->container_start('checkforupdates');
$output .= $this->single_button(
new moodle_url($reloadurl, array('fetchupdates' ... | [
"public",
"function",
"check_for_updates_button",
"(",
"\\",
"core",
"\\",
"update",
"\\",
"checker",
"$",
"checker",
",",
"$",
"reloadurl",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"$",
"checker",
"->",
"enabled",
"(",
")",
")",
"{",
"$",
... | Renders a button to fetch for available updates.
@param \core\update\checker $checker
@param moodle_url $reloadurl
@return string HTML | [
"Renders",
"a",
"button",
"to",
"fetch",
"for",
"available",
"updates",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L359-L377 |
219,102 | moodle/moodle | admin/renderer.php | core_admin_renderer.plugin_uninstall_confirm_page | public function plugin_uninstall_confirm_page(core_plugin_manager $pluginman, \core\plugininfo\base $pluginfo, moodle_url $continueurl, moodle_url $cancelurl) {
$output = '';
$pluginname = $pluginman->plugin_name($pluginfo->component);
$confirm = '<p>' . get_string('uninstallconfirm', 'core_pl... | php | public function plugin_uninstall_confirm_page(core_plugin_manager $pluginman, \core\plugininfo\base $pluginfo, moodle_url $continueurl, moodle_url $cancelurl) {
$output = '';
$pluginname = $pluginman->plugin_name($pluginfo->component);
$confirm = '<p>' . get_string('uninstallconfirm', 'core_pl... | [
"public",
"function",
"plugin_uninstall_confirm_page",
"(",
"core_plugin_manager",
"$",
"pluginman",
",",
"\\",
"core",
"\\",
"plugininfo",
"\\",
"base",
"$",
"pluginfo",
",",
"moodle_url",
"$",
"continueurl",
",",
"moodle_url",
"$",
"cancelurl",
")",
"{",
"$",
... | Display a page to confirm the plugin uninstallation.
@param core_plugin_manager $pluginman
@param \core\plugininfo\base $pluginfo
@param moodle_url $continueurl URL to continue after confirmation
@param moodle_url $cancelurl URL to to go if cancelled
@return string | [
"Display",
"a",
"page",
"to",
"confirm",
"the",
"plugin",
"uninstallation",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L388-L404 |
219,103 | moodle/moodle | admin/renderer.php | core_admin_renderer.plugin_uninstall_results_removable_page | public function plugin_uninstall_results_removable_page(core_plugin_manager $pluginman, \core\plugininfo\base $pluginfo,
progress_trace_buffer $progress, moodle_url $continueurl) {
$output = '';
$pluginname = $pluginman->plugin_name($pluginfo-... | php | public function plugin_uninstall_results_removable_page(core_plugin_manager $pluginman, \core\plugininfo\base $pluginfo,
progress_trace_buffer $progress, moodle_url $continueurl) {
$output = '';
$pluginname = $pluginman->plugin_name($pluginfo-... | [
"public",
"function",
"plugin_uninstall_results_removable_page",
"(",
"core_plugin_manager",
"$",
"pluginman",
",",
"\\",
"core",
"\\",
"plugininfo",
"\\",
"base",
"$",
"pluginfo",
",",
"progress_trace_buffer",
"$",
"progress",
",",
"moodle_url",
"$",
"continueurl",
"... | Display a page with results of plugin uninstallation and offer removal of plugin files.
@param core_plugin_manager $pluginman
@param \core\plugininfo\base $pluginfo
@param progress_trace_buffer $progress
@param moodle_url $continueurl URL to continue to remove the plugin folder
@return string | [
"Display",
"a",
"page",
"with",
"results",
"of",
"plugin",
"uninstallation",
"and",
"offer",
"removal",
"of",
"plugin",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L415-L443 |
219,104 | moodle/moodle | admin/renderer.php | core_admin_renderer.plugin_uninstall_results_page | public function plugin_uninstall_results_page(core_plugin_manager $pluginman, \core\plugininfo\base $pluginfo, progress_trace_buffer $progress) {
$output = '';
$pluginname = $pluginfo->component;
$output .= $this->output->header();
$output .= $this->output->heading(get_string('uninstal... | php | public function plugin_uninstall_results_page(core_plugin_manager $pluginman, \core\plugininfo\base $pluginfo, progress_trace_buffer $progress) {
$output = '';
$pluginname = $pluginfo->component;
$output .= $this->output->header();
$output .= $this->output->heading(get_string('uninstal... | [
"public",
"function",
"plugin_uninstall_results_page",
"(",
"core_plugin_manager",
"$",
"pluginman",
",",
"\\",
"core",
"\\",
"plugininfo",
"\\",
"base",
"$",
"pluginfo",
",",
"progress_trace_buffer",
"$",
"progress",
")",
"{",
"$",
"output",
"=",
"''",
";",
"$"... | Display a page with results of plugin uninstallation and inform about the need to remove plugin files manually.
@param core_plugin_manager $pluginman
@param \core\plugininfo\base $pluginfo
@param progress_trace_buffer $progress
@return string | [
"Display",
"a",
"page",
"with",
"results",
"of",
"plugin",
"uninstallation",
"and",
"inform",
"about",
"the",
"need",
"to",
"remove",
"plugin",
"files",
"manually",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L453-L469 |
219,105 | moodle/moodle | admin/renderer.php | core_admin_renderer.insecure_dataroot_warning | protected function insecure_dataroot_warning($insecuredataroot) {
global $CFG;
if ($insecuredataroot == INSECURE_DATAROOT_WARNING) {
return $this->warning(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot));
} else if ($insecuredataroot == INSECURE_DATAROOT_ERROR) {
... | php | protected function insecure_dataroot_warning($insecuredataroot) {
global $CFG;
if ($insecuredataroot == INSECURE_DATAROOT_WARNING) {
return $this->warning(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot));
} else if ($insecuredataroot == INSECURE_DATAROOT_ERROR) {
... | [
"protected",
"function",
"insecure_dataroot_warning",
"(",
"$",
"insecuredataroot",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"$",
"insecuredataroot",
"==",
"INSECURE_DATAROOT_WARNING",
")",
"{",
"return",
"$",
"this",
"->",
"warning",
"(",
"get_string",
"... | Render an appropriate message if dataroot is insecure.
@param bool $insecuredataroot
@return string HTML to output. | [
"Render",
"an",
"appropriate",
"message",
"if",
"dataroot",
"is",
"insecure",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L522-L534 |
219,106 | moodle/moodle | admin/renderer.php | core_admin_renderer.development_libs_directories_warning | protected function development_libs_directories_warning($devlibdir) {
if ($devlibdir) {
$moreinfo = new moodle_url('/report/security/index.php');
$warning = get_string('devlibdirpresent', 'core_admin', ['moreinfourl' => $moreinfo->out()]);
return $this->warning($warning, 'er... | php | protected function development_libs_directories_warning($devlibdir) {
if ($devlibdir) {
$moreinfo = new moodle_url('/report/security/index.php');
$warning = get_string('devlibdirpresent', 'core_admin', ['moreinfourl' => $moreinfo->out()]);
return $this->warning($warning, 'er... | [
"protected",
"function",
"development_libs_directories_warning",
"(",
"$",
"devlibdir",
")",
"{",
"if",
"(",
"$",
"devlibdir",
")",
"{",
"$",
"moreinfo",
"=",
"new",
"moodle_url",
"(",
"'/report/security/index.php'",
")",
";",
"$",
"warning",
"=",
"get_string",
... | Render a warning that a directory with development libs is present.
@param bool $devlibdir True if the warning should be displayed.
@return string | [
"Render",
"a",
"warning",
"that",
"a",
"directory",
"with",
"development",
"libs",
"is",
"present",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L542-L552 |
219,107 | moodle/moodle | admin/renderer.php | core_admin_renderer.cron_overdue_warning | public function cron_overdue_warning($cronoverdue) {
global $CFG;
if (!$cronoverdue) {
return '';
}
if (empty($CFG->cronclionly)) {
$url = new moodle_url('/admin/cron.php');
if (!empty($CFG->cronremotepassword)) {
$url = new moodle_url... | php | public function cron_overdue_warning($cronoverdue) {
global $CFG;
if (!$cronoverdue) {
return '';
}
if (empty($CFG->cronclionly)) {
$url = new moodle_url('/admin/cron.php');
if (!empty($CFG->cronremotepassword)) {
$url = new moodle_url... | [
"public",
"function",
"cron_overdue_warning",
"(",
"$",
"cronoverdue",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"$",
"cronoverdue",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"cronclionly",
")",
")",
"{... | Render an appropriate message if cron has not been run recently.
@param bool $cronoverdue
@return string HTML to output. | [
"Render",
"an",
"appropriate",
"message",
"if",
"cron",
"has",
"not",
"been",
"run",
"recently",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L598-L617 |
219,108 | moodle/moodle | admin/renderer.php | core_admin_renderer.events_handlers | public function events_handlers($eventshandlers) {
if ($eventshandlers) {
$components = '';
foreach ($eventshandlers as $eventhandler) {
$components .= $eventhandler->component . ', ';
}
$components = rtrim($components, ', ');
return $t... | php | public function events_handlers($eventshandlers) {
if ($eventshandlers) {
$components = '';
foreach ($eventshandlers as $eventhandler) {
$components .= $eventhandler->component . ', ';
}
$components = rtrim($components, ', ');
return $t... | [
"public",
"function",
"events_handlers",
"(",
"$",
"eventshandlers",
")",
"{",
"if",
"(",
"$",
"eventshandlers",
")",
"{",
"$",
"components",
"=",
"''",
";",
"foreach",
"(",
"$",
"eventshandlers",
"as",
"$",
"eventhandler",
")",
"{",
"$",
"components",
".=... | Renders events 1 API handlers warning.
@param array $eventshandlers
@return string | [
"Renders",
"events",
"1",
"API",
"handlers",
"warning",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L669-L678 |
219,109 | moodle/moodle | admin/renderer.php | core_admin_renderer.maintenance_mode_warning | public function maintenance_mode_warning($maintenancemode) {
if (!$maintenancemode) {
return '';
}
$url = new moodle_url('/admin/settings.php', array('section' => 'maintenancemode'));
$url = $url->out(); // get_string() does not support objects in params
return $thi... | php | public function maintenance_mode_warning($maintenancemode) {
if (!$maintenancemode) {
return '';
}
$url = new moodle_url('/admin/settings.php', array('section' => 'maintenancemode'));
$url = $url->out(); // get_string() does not support objects in params
return $thi... | [
"public",
"function",
"maintenance_mode_warning",
"(",
"$",
"maintenancemode",
")",
"{",
"if",
"(",
"!",
"$",
"maintenancemode",
")",
"{",
"return",
"''",
";",
"}",
"$",
"url",
"=",
"new",
"moodle_url",
"(",
"'/admin/settings.php'",
",",
"array",
"(",
"'sect... | Render an appropriate message if the site in in maintenance mode.
@param bool $maintenancemode
@return string HTML to output. | [
"Render",
"an",
"appropriate",
"message",
"if",
"the",
"site",
"in",
"in",
"maintenance",
"mode",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L685-L694 |
219,110 | moodle/moodle | admin/renderer.php | core_admin_renderer.moodle_copyright | protected function moodle_copyright() {
global $CFG;
//////////////////////////////////////////////////////////////////////////////////////////////////
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
$copyrighttext = '<a href="http://mo... | php | protected function moodle_copyright() {
global $CFG;
//////////////////////////////////////////////////////////////////////////////////////////////////
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
$copyrighttext = '<a href="http://mo... | [
"protected",
"function",
"moodle_copyright",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"//////////////////////////////////////////////////////////////////////////////////////////////////",
"//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///",
"... | Output the copyright notice.
@return string HTML to output. | [
"Output",
"the",
"copyright",
"notice",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L747-L760 |
219,111 | moodle/moodle | admin/renderer.php | core_admin_renderer.available_updates | protected function available_updates($updates, $fetch) {
$updateinfo = '';
$someupdateavailable = false;
if (is_array($updates)) {
if (is_array($updates['core'])) {
$someupdateavailable = true;
$updateinfo .= $this->heading(get_string('updateavailable... | php | protected function available_updates($updates, $fetch) {
$updateinfo = '';
$someupdateavailable = false;
if (is_array($updates)) {
if (is_array($updates['core'])) {
$someupdateavailable = true;
$updateinfo .= $this->heading(get_string('updateavailable... | [
"protected",
"function",
"available_updates",
"(",
"$",
"updates",
",",
"$",
"fetch",
")",
"{",
"$",
"updateinfo",
"=",
"''",
";",
"$",
"someupdateavailable",
"=",
"false",
";",
"if",
"(",
"is_array",
"(",
"$",
"updates",
")",
")",
"{",
"if",
"(",
"is_... | Displays the info about available Moodle core and plugin updates
The structure of the $updates param has changed since 2.4. It contains not only updates
for the core itself, but also for all other installed plugins.
@param array|null $updates array of (string)component => array of \core\update\info objects or null
@p... | [
"Displays",
"the",
"info",
"about",
"available",
"Moodle",
"core",
"and",
"plugin",
"updates"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L794-L836 |
219,112 | moodle/moodle | admin/renderer.php | core_admin_renderer.registration_warning | protected function registration_warning($registered) {
if (!$registered && site_is_public()) {
if (has_capability('moodle/site:config', context_system::instance())) {
$registerbutton = $this->single_button(new moodle_url('/admin/registration/index.php'),
get_stri... | php | protected function registration_warning($registered) {
if (!$registered && site_is_public()) {
if (has_capability('moodle/site:config', context_system::instance())) {
$registerbutton = $this->single_button(new moodle_url('/admin/registration/index.php'),
get_stri... | [
"protected",
"function",
"registration_warning",
"(",
"$",
"registered",
")",
"{",
"if",
"(",
"!",
"$",
"registered",
"&&",
"site_is_public",
"(",
")",
")",
"{",
"if",
"(",
"has_capability",
"(",
"'moodle/site:config'",
",",
"context_system",
"::",
"instance",
... | Display a warning about not being registered on Moodle.org if necesary.
@param boolean $registered true if the site is registered on Moodle.org
@return string HTML to output. | [
"Display",
"a",
"warning",
"about",
"not",
"being",
"registered",
"on",
"Moodle",
".",
"org",
"if",
"necesary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L844-L862 |
219,113 | moodle/moodle | admin/renderer.php | core_admin_renderer.mobile_configuration_warning | protected function mobile_configuration_warning($mobileconfigured) {
$output = '';
if (!$mobileconfigured) {
$settingslink = new moodle_url('/admin/settings.php', ['section' => 'mobilesettings']);
$configurebutton = $this->single_button($settingslink, get_string('enablemobilewebs... | php | protected function mobile_configuration_warning($mobileconfigured) {
$output = '';
if (!$mobileconfigured) {
$settingslink = new moodle_url('/admin/settings.php', ['section' => 'mobilesettings']);
$configurebutton = $this->single_button($settingslink, get_string('enablemobilewebs... | [
"protected",
"function",
"mobile_configuration_warning",
"(",
"$",
"mobileconfigured",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"!",
"$",
"mobileconfigured",
")",
"{",
"$",
"settingslink",
"=",
"new",
"moodle_url",
"(",
"'/admin/settings.php'",
",",
... | Display a warning about the Mobile Web Services being disabled.
@param boolean $mobileconfigured true if mobile web services are enabled
@return string HTML to output. | [
"Display",
"a",
"warning",
"about",
"the",
"Mobile",
"Web",
"Services",
"being",
"disabled",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L879-L888 |
219,114 | moodle/moodle | admin/renderer.php | core_admin_renderer.forgotten_password_url_warning | protected function forgotten_password_url_warning($invalidforgottenpasswordurl) {
$output = '';
if ($invalidforgottenpasswordurl) {
$settingslink = new moodle_url('/admin/settings.php', ['section' => 'manageauths']);
$configurebutton = $this->single_button($settingslink, get_stri... | php | protected function forgotten_password_url_warning($invalidforgottenpasswordurl) {
$output = '';
if ($invalidforgottenpasswordurl) {
$settingslink = new moodle_url('/admin/settings.php', ['section' => 'manageauths']);
$configurebutton = $this->single_button($settingslink, get_stri... | [
"protected",
"function",
"forgotten_password_url_warning",
"(",
"$",
"invalidforgottenpasswordurl",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"$",
"invalidforgottenpasswordurl",
")",
"{",
"$",
"settingslink",
"=",
"new",
"moodle_url",
"(",
"'/admin/setting... | Display a warning about the forgotten password URL not linking to a valid URL.
@param boolean $invalidforgottenpasswordurl true if the forgotten password URL is not valid
@return string HTML to output. | [
"Display",
"a",
"warning",
"about",
"the",
"forgotten",
"password",
"URL",
"not",
"linking",
"to",
"a",
"valid",
"URL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L896-L906 |
219,115 | moodle/moodle | admin/renderer.php | core_admin_renderer.moodle_available_update_info | protected function moodle_available_update_info(\core\update\info $updateinfo) {
$boxclasses = 'moodleupdateinfo';
$info = array();
if (isset($updateinfo->release)) {
$info[] = html_writer::tag('span', get_string('updateavailable_release', 'core_admin', $updateinfo->release),
... | php | protected function moodle_available_update_info(\core\update\info $updateinfo) {
$boxclasses = 'moodleupdateinfo';
$info = array();
if (isset($updateinfo->release)) {
$info[] = html_writer::tag('span', get_string('updateavailable_release', 'core_admin', $updateinfo->release),
... | [
"protected",
"function",
"moodle_available_update_info",
"(",
"\\",
"core",
"\\",
"update",
"\\",
"info",
"$",
"updateinfo",
")",
"{",
"$",
"boxclasses",
"=",
"'moodleupdateinfo'",
";",
"$",
"info",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$"... | Helper method to render the information about the available Moodle update
@param \core\update\info $updateinfo information about the available Moodle core update | [
"Helper",
"method",
"to",
"render",
"the",
"information",
"about",
"the",
"available",
"Moodle",
"update"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L913-L948 |
219,116 | moodle/moodle | admin/renderer.php | core_admin_renderer.plugin_available_update_info | protected function plugin_available_update_info(core_plugin_manager $pluginman, \core\update\info $updateinfo) {
$boxclasses = 'pluginupdateinfo';
$info = array();
if (isset($updateinfo->release)) {
$info[] = html_writer::div(
get_string('updateavailable_release', '... | php | protected function plugin_available_update_info(core_plugin_manager $pluginman, \core\update\info $updateinfo) {
$boxclasses = 'pluginupdateinfo';
$info = array();
if (isset($updateinfo->release)) {
$info[] = html_writer::div(
get_string('updateavailable_release', '... | [
"protected",
"function",
"plugin_available_update_info",
"(",
"core_plugin_manager",
"$",
"pluginman",
",",
"\\",
"core",
"\\",
"update",
"\\",
"info",
"$",
"updateinfo",
")",
"{",
"$",
"boxclasses",
"=",
"'pluginupdateinfo'",
";",
"$",
"info",
"=",
"array",
"("... | Helper method to render the information about the available plugin update
@param core_plugin_manager $pluginman plugin manager instance
@param \core\update\info $updateinfo information about the available update for the plugin | [
"Helper",
"method",
"to",
"render",
"the",
"information",
"about",
"the",
"available",
"plugin",
"update"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L1819-L1880 |
219,117 | moodle/moodle | admin/renderer.php | core_admin_renderer.upgradekey_form_page | public function upgradekey_form_page($url) {
$output = '';
$output .= $this->header();
$output .= $this->container_start('upgradekeyreq');
$output .= $this->heading(get_string('upgradekeyreq', 'core_admin'));
$output .= html_writer::start_tag('form', array('method' => 'POST', 'a... | php | public function upgradekey_form_page($url) {
$output = '';
$output .= $this->header();
$output .= $this->container_start('upgradekeyreq');
$output .= $this->heading(get_string('upgradekeyreq', 'core_admin'));
$output .= html_writer::start_tag('form', array('method' => 'POST', 'a... | [
"public",
"function",
"upgradekey_form_page",
"(",
"$",
"url",
")",
"{",
"$",
"output",
"=",
"''",
";",
"$",
"output",
".=",
"$",
"this",
"->",
"header",
"(",
")",
";",
"$",
"output",
".=",
"$",
"this",
"->",
"container_start",
"(",
"'upgradekeyreq'",
... | Render a simple page for providing the upgrade key.
@param moodle_url|string $url
@return string | [
"Render",
"a",
"simple",
"page",
"for",
"providing",
"the",
"upgrade",
"key",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L2076-L2090 |
219,118 | moodle/moodle | admin/renderer.php | core_admin_renderer.legacy_log_store_writing_error | protected function legacy_log_store_writing_error() {
$enabled = get_config('logstore_legacy', 'loglegacy');
$plugins = explode(',', get_config('tool_log', 'enabled_stores'));
$enabled = $enabled && in_array('logstore_legacy', $plugins);
if ($enabled) {
return $this->warning... | php | protected function legacy_log_store_writing_error() {
$enabled = get_config('logstore_legacy', 'loglegacy');
$plugins = explode(',', get_config('tool_log', 'enabled_stores'));
$enabled = $enabled && in_array('logstore_legacy', $plugins);
if ($enabled) {
return $this->warning... | [
"protected",
"function",
"legacy_log_store_writing_error",
"(",
")",
"{",
"$",
"enabled",
"=",
"get_config",
"(",
"'logstore_legacy'",
",",
"'loglegacy'",
")",
";",
"$",
"plugins",
"=",
"explode",
"(",
"','",
",",
"get_config",
"(",
"'tool_log'",
",",
"'enabled_... | Check to see if writing to the deprecated legacy log store is enabled.
@return string An error message if writing to the legacy log store is enabled. | [
"Check",
"to",
"see",
"if",
"writing",
"to",
"the",
"deprecated",
"legacy",
"log",
"store",
"is",
"enabled",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/renderer.php#L2097-L2105 |
219,119 | moodle/moodle | admin/tool/monitor/classes/output/managesubs/rules.php | rules.col_select | public function col_select(\tool_monitor\rule $rule) {
global $OUTPUT;
$options = $rule->get_subscribe_options($this->courseid);
$text = get_string('subscribeto', 'tool_monitor', $rule->get_name($this->context));
if ($options instanceof \single_select) {
$options->set_label... | php | public function col_select(\tool_monitor\rule $rule) {
global $OUTPUT;
$options = $rule->get_subscribe_options($this->courseid);
$text = get_string('subscribeto', 'tool_monitor', $rule->get_name($this->context));
if ($options instanceof \single_select) {
$options->set_label... | [
"public",
"function",
"col_select",
"(",
"\\",
"tool_monitor",
"\\",
"rule",
"$",
"rule",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"options",
"=",
"$",
"rule",
"->",
"get_subscribe_options",
"(",
"$",
"this",
"->",
"courseid",
")",
";",
"$",
"text",
... | Generate content for select column.
@param \tool_monitor\rule $rule rule object
@return string html used to display the select field. | [
"Generate",
"content",
"for",
"select",
"column",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/output/managesubs/rules.php#L165-L182 |
219,120 | moodle/moodle | admin/tool/monitor/classes/output/managesubs/rules.php | rules.get_user_courses_select | public function get_user_courses_select($choose = false) {
$options = tool_monitor_get_user_courses();
// If we have no options then don't create a select element.
if (!$options) {
return false;
}
$selected = $this->courseid;
$nothing = array();
if ($c... | php | public function get_user_courses_select($choose = false) {
$options = tool_monitor_get_user_courses();
// If we have no options then don't create a select element.
if (!$options) {
return false;
}
$selected = $this->courseid;
$nothing = array();
if ($c... | [
"public",
"function",
"get_user_courses_select",
"(",
"$",
"choose",
"=",
"false",
")",
"{",
"$",
"options",
"=",
"tool_monitor_get_user_courses",
"(",
")",
";",
"// If we have no options then don't create a select element.",
"if",
"(",
"!",
"$",
"options",
")",
"{",
... | Gets a list of courses where the current user can subscribe to rules as a dropdown.
@param bool $choose A flag for whether to show the 'choose...' option in the select box.
@return \single_select|bool returns the list of courses, or false if the select box
should not be displayed. | [
"Gets",
"a",
"list",
"of",
"courses",
"where",
"the",
"current",
"user",
"can",
"subscribe",
"to",
"rules",
"as",
"a",
"dropdown",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/output/managesubs/rules.php#L210-L226 |
219,121 | moodle/moodle | admin/tool/usertours/classes/configuration.php | configuration.get_placement_options | public static function get_placement_options($default = null) {
$values = [
'top' => get_string('above', 'tool_usertours'),
'bottom' => get_string('below', 'tool_usertours'),
'left' => get_string('left', 'tool_usertours'),
'right' => get_string('right... | php | public static function get_placement_options($default = null) {
$values = [
'top' => get_string('above', 'tool_usertours'),
'bottom' => get_string('below', 'tool_usertours'),
'left' => get_string('left', 'tool_usertours'),
'right' => get_string('right... | [
"public",
"static",
"function",
"get_placement_options",
"(",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"values",
"=",
"[",
"'top'",
"=>",
"get_string",
"(",
"'above'",
",",
"'tool_usertours'",
")",
",",
"'bottom'",
"=>",
"get_string",
"(",
"'below'",
",",... | Get the list of possible placement options.
@param string $default The default option.
@return array | [
"Get",
"the",
"list",
"of",
"possible",
"placement",
"options",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/configuration.php#L95-L116 |
219,122 | moodle/moodle | lib/pear/HTML/QuickForm/element.php | HTML_QuickForm_element._generateId | function _generateId() {
if ($this->getAttribute('id')) {
return;
}
$id = $this->getName();
$id = 'id_' . str_replace(array('qf_', '[', ']'), array('', '_', ''), $id);
$id = clean_param($id, PARAM_ALPHANUMEXT);
$this->updateAttributes(array('id' => $id));
... | php | function _generateId() {
if ($this->getAttribute('id')) {
return;
}
$id = $this->getName();
$id = 'id_' . str_replace(array('qf_', '[', ']'), array('', '_', ''), $id);
$id = clean_param($id, PARAM_ALPHANUMEXT);
$this->updateAttributes(array('id' => $id));
... | [
"function",
"_generateId",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getAttribute",
"(",
"'id'",
")",
")",
"{",
"return",
";",
"}",
"$",
"id",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"$",
"id",
"=",
"'id_'",
".",
"str_replace",
"(",... | Automatically generates and assigns an 'id' attribute for the element.
Currently used to ensure that labels work on radio buttons and
checkboxes. Per idea of Alexander Radivanovich.
@access private
@return void | [
"Automatically",
"generates",
"and",
"assigns",
"an",
"id",
"attribute",
"for",
"the",
"element",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/element.php#L445-L454 |
219,123 | moodle/moodle | lib/dtl/database_mover.php | database_mover.begin_database_export | public function begin_database_export($version, $release, $timestamp, $description) {
$this->feedback->output(get_string('copyingtables', 'core_dbtransfer'));
$this->importer->begin_database_import($version, $timestamp, $description);
} | php | public function begin_database_export($version, $release, $timestamp, $description) {
$this->feedback->output(get_string('copyingtables', 'core_dbtransfer'));
$this->importer->begin_database_import($version, $timestamp, $description);
} | [
"public",
"function",
"begin_database_export",
"(",
"$",
"version",
",",
"$",
"release",
",",
"$",
"timestamp",
",",
"$",
"description",
")",
"{",
"$",
"this",
"->",
"feedback",
"->",
"output",
"(",
"get_string",
"(",
"'copyingtables'",
",",
"'core_dbtransfer'... | Callback function. Calls importer's begin_database_import callback method.
@param float $version the version of the system which generating the data
@param string $release moodle release info
@param string $timestamp the timestamp of the data (in ISO 8601) format.
@param string $description a user description of the d... | [
"Callback",
"function",
".",
"Calls",
"importer",
"s",
"begin_database_import",
"callback",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dtl/database_mover.php#L77-L80 |
219,124 | moodle/moodle | lib/dtl/database_mover.php | database_mover.begin_table_export | public function begin_table_export(xmldb_table $table) {
$this->feedback->output(get_string('copyingtable', 'core_dbtransfer', $table->getName()), 1);
$this->importer->begin_table_import($table->getName(), $table->getHash());
} | php | public function begin_table_export(xmldb_table $table) {
$this->feedback->output(get_string('copyingtable', 'core_dbtransfer', $table->getName()), 1);
$this->importer->begin_table_import($table->getName(), $table->getHash());
} | [
"public",
"function",
"begin_table_export",
"(",
"xmldb_table",
"$",
"table",
")",
"{",
"$",
"this",
"->",
"feedback",
"->",
"output",
"(",
"get_string",
"(",
"'copyingtable'",
",",
"'core_dbtransfer'",
",",
"$",
"table",
"->",
"getName",
"(",
")",
")",
",",... | Callback function. Calls importer's begin_table_import callback method.
@param xmldb_table $table - XMLDB object for the exported table
@return void | [
"Callback",
"function",
".",
"Calls",
"importer",
"s",
"begin_table_import",
"callback",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dtl/database_mover.php#L88-L91 |
219,125 | moodle/moodle | lib/dtl/database_mover.php | database_mover.export_table_data | public function export_table_data(xmldb_table $table, $data) {
$this->importer->import_table_data($table->getName(), $data);
} | php | public function export_table_data(xmldb_table $table, $data) {
$this->importer->import_table_data($table->getName(), $data);
} | [
"public",
"function",
"export_table_data",
"(",
"xmldb_table",
"$",
"table",
",",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"importer",
"->",
"import_table_data",
"(",
"$",
"table",
"->",
"getName",
"(",
")",
",",
"$",
"data",
")",
";",
"}"
] | Callback function. Calls importer's import_table_data callback method.
@param xmldb_table $table - XMLDB object of the table from which data
was retrieved
@param object $data - data object (fields and values from record)
@return void | [
"Callback",
"function",
".",
"Calls",
"importer",
"s",
"import_table_data",
"callback",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dtl/database_mover.php#L101-L103 |
219,126 | moodle/moodle | lib/dtl/database_mover.php | database_mover.finish_table_export | public function finish_table_export(xmldb_table $table) {
$this->feedback->output(get_string('done', 'core_dbtransfer', $table->getName()), 2);
$this->importer->finish_table_import($table->getName());
} | php | public function finish_table_export(xmldb_table $table) {
$this->feedback->output(get_string('done', 'core_dbtransfer', $table->getName()), 2);
$this->importer->finish_table_import($table->getName());
} | [
"public",
"function",
"finish_table_export",
"(",
"xmldb_table",
"$",
"table",
")",
"{",
"$",
"this",
"->",
"feedback",
"->",
"output",
"(",
"get_string",
"(",
"'done'",
",",
"'core_dbtransfer'",
",",
"$",
"table",
"->",
"getName",
"(",
")",
")",
",",
"2",... | Callback function. Calls importer's finish_table_import callback method.
@param xmldb_table $table - XMLDB object for the exported table
@return void | [
"Callback",
"function",
".",
"Calls",
"importer",
"s",
"finish_table_import",
"callback",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dtl/database_mover.php#L110-L113 |
219,127 | moodle/moodle | question/type/multianswer/backup/moodle2/restore_qtype_multianswer_plugin.class.php | restore_qtype_multianswer_plugin.recode_legacy_state_answer | public function recode_legacy_state_answer($state) {
global $DB;
$answer = $state->answer;
$resultarr = array();
// Get sequence of questions.
$sequence = $DB->get_field('question_multianswer', 'sequence',
array('question' => $state->question));
$sequencea... | php | public function recode_legacy_state_answer($state) {
global $DB;
$answer = $state->answer;
$resultarr = array();
// Get sequence of questions.
$sequence = $DB->get_field('question_multianswer', 'sequence',
array('question' => $state->question));
$sequencea... | [
"public",
"function",
"recode_legacy_state_answer",
"(",
"$",
"state",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"answer",
"=",
"$",
"state",
"->",
"answer",
";",
"$",
"resultarr",
"=",
"array",
"(",
")",
";",
"// Get sequence of questions.",
"$",
"sequence",... | Given one question_states record, return the answer
recoded pointing to all the restored stuff for multianswer questions
answer is one comma separated list of hypen separated pairs
containing sequence (pointing to questions sequence in question_multianswer)
and mixed answers. We'll delegate
the recoding of answers to ... | [
"Given",
"one",
"question_states",
"record",
"return",
"the",
"answer",
"recoded",
"pointing",
"to",
"all",
"the",
"restored",
"stuff",
"for",
"multianswer",
"questions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/multianswer/backup/moodle2/restore_qtype_multianswer_plugin.class.php#L174-L200 |
219,128 | moodle/moodle | lib/classes/upgrade/util.php | util.can_use_tls12 | public static function can_use_tls12(array $curlinfo, $uname) {
// Do not compare the cURL version, e.g. $curlinfo['version_number'], with v7.34.0 (467456):
// some Linux distros backport security issues and keep lower version numbers.
if (!defined('CURL_SSLVERSION_TLSv1_2')) {
retur... | php | public static function can_use_tls12(array $curlinfo, $uname) {
// Do not compare the cURL version, e.g. $curlinfo['version_number'], with v7.34.0 (467456):
// some Linux distros backport security issues and keep lower version numbers.
if (!defined('CURL_SSLVERSION_TLSv1_2')) {
retur... | [
"public",
"static",
"function",
"can_use_tls12",
"(",
"array",
"$",
"curlinfo",
",",
"$",
"uname",
")",
"{",
"// Do not compare the cURL version, e.g. $curlinfo['version_number'], with v7.34.0 (467456):",
"// some Linux distros backport security issues and keep lower version numbers.",
... | Tests if the system is capable of using TLS 1.2 for requests.
@param array $curlinfo array of cURL information as returned by curl_version()
@param string $uname server uname
@return bool | [
"Tests",
"if",
"the",
"system",
"is",
"capable",
"of",
"using",
"TLS",
"1",
".",
"2",
"for",
"requests",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/upgrade/util.php#L88-L116 |
219,129 | moodle/moodle | lib/google/src/Google/Auth/AssertionCredentials.php | Google_Auth_AssertionCredentials.getCacheKey | public function getCacheKey()
{
if (!$this->useCache) {
return false;
}
$h = $this->sub;
$h .= $this->assertionType;
$h .= $this->privateKey;
$h .= $this->scopes;
$h .= $this->serviceAccountName;
return md5($h);
} | php | public function getCacheKey()
{
if (!$this->useCache) {
return false;
}
$h = $this->sub;
$h .= $this->assertionType;
$h .= $this->privateKey;
$h .= $this->scopes;
$h .= $this->serviceAccountName;
return md5($h);
} | [
"public",
"function",
"getCacheKey",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"useCache",
")",
"{",
"return",
"false",
";",
"}",
"$",
"h",
"=",
"$",
"this",
"->",
"sub",
";",
"$",
"h",
".=",
"$",
"this",
"->",
"assertionType",
";",
"$",
... | Generate a unique key to represent this credential.
@return string | [
"Generate",
"a",
"unique",
"key",
"to",
"represent",
"this",
"credential",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Auth/AssertionCredentials.php#L76-L87 |
219,130 | moodle/moodle | lib/adodb/adodb-xmlschema.inc.php | dbTable._tag_cdata | function _tag_cdata( &$parser, $cdata ) {
switch( $this->currentElement ) {
// Table constraint
case 'CONSTRAINT':
if( isset( $this->current_field ) ) {
$this->addFieldOpt( $this->current_field, $this->currentElement, $cdata );
} else {
$this->addTableOpt( $cdata );
}
break;
// Tabl... | php | function _tag_cdata( &$parser, $cdata ) {
switch( $this->currentElement ) {
// Table constraint
case 'CONSTRAINT':
if( isset( $this->current_field ) ) {
$this->addFieldOpt( $this->current_field, $this->currentElement, $cdata );
} else {
$this->addTableOpt( $cdata );
}
break;
// Tabl... | [
"function",
"_tag_cdata",
"(",
"&",
"$",
"parser",
",",
"$",
"cdata",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"currentElement",
")",
"{",
"// Table constraint",
"case",
"'CONSTRAINT'",
":",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"current_field",
... | XML Callback to process CDATA elements
@access private | [
"XML",
"Callback",
"to",
"process",
"CDATA",
"elements"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/adodb-xmlschema.inc.php#L320-L337 |
219,131 | moodle/moodle | backup/externallib.php | core_backup_external.get_async_backup_progress | public static function get_async_backup_progress($backupids, $contextid) {
global $CFG;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
// Parameter validation.
self::validate_... | php | public static function get_async_backup_progress($backupids, $contextid) {
global $CFG;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
// Parameter validation.
self::validate_... | [
"public",
"static",
"function",
"get_async_backup_progress",
"(",
"$",
"backupids",
",",
"$",
"contextid",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/backup/util/includes/backup_includes.php'",
")",
";",
"require... | Get asynchronous backup progress.
@param string $backupids The ids of the backup to get progress for.
@param int $contextid The context the backup relates to.
@return array $results The array of results.
@since Moodle 3.7 | [
"Get",
"asynchronous",
"backup",
"progress",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/externallib.php#L69-L100 |
219,132 | moodle/moodle | backup/externallib.php | core_backup_external.get_async_backup_links_backup | public static function get_async_backup_links_backup($filename, $contextid) {
// Parameter validation.
self::validate_parameters(
self::get_async_backup_links_backup_parameters(),
array(
'filename' => $filename,
'context... | php | public static function get_async_backup_links_backup($filename, $contextid) {
// Parameter validation.
self::validate_parameters(
self::get_async_backup_links_backup_parameters(),
array(
'filename' => $filename,
'context... | [
"public",
"static",
"function",
"get_async_backup_links_backup",
"(",
"$",
"filename",
",",
"$",
"contextid",
")",
"{",
"// Parameter validation.",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_async_backup_links_backup_parameters",
"(",
")",
",",
"array"... | Get the data to be used when generating the table row for an asynchronous backup,
the table row updates via ajax when backup is complete.
@param string $filename The file name of the backup file.
@param int $contextid The context the backup relates to.
@since Moodle 3.7 | [
"Get",
"the",
"data",
"to",
"be",
"used",
"when",
"generating",
"the",
"table",
"row",
"for",
"an",
"asynchronous",
"backup",
"the",
"table",
"row",
"updates",
"via",
"ajax",
"when",
"backup",
"is",
"complete",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/externallib.php#L144-L168 |
219,133 | moodle/moodle | backup/externallib.php | core_backup_external.get_async_backup_links_restore | public static function get_async_backup_links_restore($backupid, $contextid) {
// Parameter validation.
self::validate_parameters(
self::get_async_backup_links_restore_parameters(),
array(
'backupid' => $backupid,
'conte... | php | public static function get_async_backup_links_restore($backupid, $contextid) {
// Parameter validation.
self::validate_parameters(
self::get_async_backup_links_restore_parameters(),
array(
'backupid' => $backupid,
'conte... | [
"public",
"static",
"function",
"get_async_backup_links_restore",
"(",
"$",
"backupid",
",",
"$",
"contextid",
")",
"{",
"// Parameter validation.",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_async_backup_links_restore_parameters",
"(",
")",
",",
"arra... | Get the data to be used when generating the table row for an asynchronous restore,
the table row updates via ajax when restore is complete.
@param string $backupid The id of the backup record.
@param int $contextid The context the restore relates to.
@return array $results The array of results.
@since Moodle 3.7 | [
"Get",
"the",
"data",
"to",
"be",
"used",
"when",
"generating",
"the",
"table",
"row",
"for",
"an",
"asynchronous",
"restore",
"the",
"table",
"row",
"updates",
"via",
"ajax",
"when",
"restore",
"is",
"complete",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/externallib.php#L208-L226 |
219,134 | moodle/moodle | course/format/weeks/classes/observer.php | format_weeks_observer.course_updated | public static function course_updated(\core\event\course_updated $event) {
if (class_exists('format_weeks', false)) {
// If class format_weeks was never loaded, this is definitely not a course in 'weeks' format.
// Course may still be in another format but format_weeks::update_end_date()... | php | public static function course_updated(\core\event\course_updated $event) {
if (class_exists('format_weeks', false)) {
// If class format_weeks was never loaded, this is definitely not a course in 'weeks' format.
// Course may still be in another format but format_weeks::update_end_date()... | [
"public",
"static",
"function",
"course_updated",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"course_updated",
"$",
"event",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'format_weeks'",
",",
"false",
")",
")",
"{",
"// If class format_weeks was never loaded, this is def... | Triggered via \core\event\course_updated event.
@param \core\event\course_updated $event | [
"Triggered",
"via",
"\\",
"core",
"\\",
"event",
"\\",
"course_updated",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/weeks/classes/observer.php#L41-L47 |
219,135 | moodle/moodle | course/format/weeks/classes/observer.php | format_weeks_observer.course_section_created | public static function course_section_created(\core\event\course_section_created $event) {
if (class_exists('format_weeks', false)) {
// If class format_weeks was never loaded, this is definitely not a course in 'weeks' format.
// Course may still be in another format but format_weeks::u... | php | public static function course_section_created(\core\event\course_section_created $event) {
if (class_exists('format_weeks', false)) {
// If class format_weeks was never loaded, this is definitely not a course in 'weeks' format.
// Course may still be in another format but format_weeks::u... | [
"public",
"static",
"function",
"course_section_created",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"course_section_created",
"$",
"event",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'format_weeks'",
",",
"false",
")",
")",
"{",
"// If class format_weeks was never loa... | Triggered via \core\event\course_section_created event.
@param \core\event\course_section_created $event | [
"Triggered",
"via",
"\\",
"core",
"\\",
"event",
"\\",
"course_section_created",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/weeks/classes/observer.php#L54-L60 |
219,136 | moodle/moodle | course/format/weeks/classes/observer.php | format_weeks_observer.course_section_deleted | public static function course_section_deleted(\core\event\course_section_deleted $event) {
if (class_exists('format_weeks', false)) {
// If class format_weeks was never loaded, this is definitely not a course in 'weeks' format.
// Course may still be in another format but format_weeks::u... | php | public static function course_section_deleted(\core\event\course_section_deleted $event) {
if (class_exists('format_weeks', false)) {
// If class format_weeks was never loaded, this is definitely not a course in 'weeks' format.
// Course may still be in another format but format_weeks::u... | [
"public",
"static",
"function",
"course_section_deleted",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"course_section_deleted",
"$",
"event",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'format_weeks'",
",",
"false",
")",
")",
"{",
"// If class format_weeks was never loa... | Triggered via \core\event\course_section_deleted event.
@param \core\event\course_section_deleted $event | [
"Triggered",
"via",
"\\",
"core",
"\\",
"event",
"\\",
"course_section_deleted",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/format/weeks/classes/observer.php#L67-L73 |
219,137 | moodle/moodle | lib/classes/update/validator.php | validator.execute | public function execute() {
$this->result = (
$this->validate_files_layout()
and $this->validate_version_php()
and $this->validate_language_pack()
and $this->validate_target_location()
);
return $this->result;
} | php | public function execute() {
$this->result = (
$this->validate_files_layout()
and $this->validate_version_php()
and $this->validate_language_pack()
and $this->validate_target_location()
);
return $this->result;
} | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"this",
"->",
"result",
"=",
"(",
"$",
"this",
"->",
"validate_files_layout",
"(",
")",
"and",
"$",
"this",
"->",
"validate_version_php",
"(",
")",
"and",
"$",
"this",
"->",
"validate_language_pack",
"("... | Execute the validation process against all explicit and implicit requirements
Returns true if the validation passes (all explicit and implicit requirements
pass) and the plugin can be installed. Returns false if the validation fails
(some explicit or implicit requirement fails) and the plugin must not be
installed.
@... | [
"Execute",
"the",
"validation",
"process",
"against",
"all",
"explicit",
"and",
"implicit",
"requirements"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/validator.php#L127-L137 |
219,138 | moodle/moodle | lib/classes/update/validator.php | validator.message_code_name | public function message_code_name($msgcode) {
$stringman = get_string_manager();
if ($stringman->string_exists('validationmsg_'.$msgcode, 'core_plugin')) {
return get_string('validationmsg_'.$msgcode, 'core_plugin');
}
return $msgcode;
} | php | public function message_code_name($msgcode) {
$stringman = get_string_manager();
if ($stringman->string_exists('validationmsg_'.$msgcode, 'core_plugin')) {
return get_string('validationmsg_'.$msgcode, 'core_plugin');
}
return $msgcode;
} | [
"public",
"function",
"message_code_name",
"(",
"$",
"msgcode",
")",
"{",
"$",
"stringman",
"=",
"get_string_manager",
"(",
")",
";",
"if",
"(",
"$",
"stringman",
"->",
"string_exists",
"(",
"'validationmsg_'",
".",
"$",
"msgcode",
",",
"'core_plugin'",
")",
... | If defined, returns human readable validation code.
Otherwise, it simply returns the code itself as a fallback.
@param string $msgcode
@return string | [
"If",
"defined",
"returns",
"human",
"readable",
"validation",
"code",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/validator.php#L182-L191 |
219,139 | moodle/moodle | lib/classes/update/validator.php | validator.message_help_icon | public function message_help_icon($msgcode) {
$stringman = get_string_manager();
if ($stringman->string_exists('validationmsg_'.$msgcode.'_help', 'core_plugin')) {
return new help_icon('validationmsg_'.$msgcode, 'core_plugin');
}
return false;
} | php | public function message_help_icon($msgcode) {
$stringman = get_string_manager();
if ($stringman->string_exists('validationmsg_'.$msgcode.'_help', 'core_plugin')) {
return new help_icon('validationmsg_'.$msgcode, 'core_plugin');
}
return false;
} | [
"public",
"function",
"message_help_icon",
"(",
"$",
"msgcode",
")",
"{",
"$",
"stringman",
"=",
"get_string_manager",
"(",
")",
";",
"if",
"(",
"$",
"stringman",
"->",
"string_exists",
"(",
"'validationmsg_'",
".",
"$",
"msgcode",
".",
"'_help'",
",",
"'cor... | Returns help icon for the message code if defined.
@param string $msgcode
@return \help_icon|false | [
"Returns",
"help",
"icon",
"for",
"the",
"message",
"code",
"if",
"defined",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/validator.php#L199-L208 |
219,140 | moodle/moodle | lib/classes/update/validator.php | validator.message_code_info | public function message_code_info($msgcode, $addinfo) {
$stringman = get_string_manager();
if ($addinfo !== null and $stringman->string_exists('validationmsg_'.$msgcode.'_info', 'core_plugin')) {
return get_string('validationmsg_'.$msgcode.'_info', 'core_plugin', $addinfo);
}
... | php | public function message_code_info($msgcode, $addinfo) {
$stringman = get_string_manager();
if ($addinfo !== null and $stringman->string_exists('validationmsg_'.$msgcode.'_info', 'core_plugin')) {
return get_string('validationmsg_'.$msgcode.'_info', 'core_plugin', $addinfo);
}
... | [
"public",
"function",
"message_code_info",
"(",
"$",
"msgcode",
",",
"$",
"addinfo",
")",
"{",
"$",
"stringman",
"=",
"get_string_manager",
"(",
")",
";",
"if",
"(",
"$",
"addinfo",
"!==",
"null",
"and",
"$",
"stringman",
"->",
"string_exists",
"(",
"'vali... | Localizes the message additional info if it exists.
@param string $msgcode
@param array|string|null $addinfo value for the $a placeholder in the string
@return string | [
"Localizes",
"the",
"message",
"additional",
"info",
"if",
"it",
"exists",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/validator.php#L217-L226 |
219,141 | moodle/moodle | lib/classes/update/validator.php | validator.validate_files_layout | protected function validate_files_layout() {
if (!is_array($this->extractfiles) or count($this->extractfiles) < 4) {
// We need the English language pack with the name of the plugin at least.
$this->add_message(self::ERROR, 'filesnumber');
return false;
}
fo... | php | protected function validate_files_layout() {
if (!is_array($this->extractfiles) or count($this->extractfiles) < 4) {
// We need the English language pack with the name of the plugin at least.
$this->add_message(self::ERROR, 'filesnumber');
return false;
}
fo... | [
"protected",
"function",
"validate_files_layout",
"(",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"extractfiles",
")",
"or",
"count",
"(",
"$",
"this",
"->",
"extractfiles",
")",
"<",
"4",
")",
"{",
"// We need the English language pack with... | Returns false if files in the ZIP do not have required layout.
@return bool | [
"Returns",
"false",
"if",
"files",
"in",
"the",
"ZIP",
"do",
"not",
"have",
"required",
"layout",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/validator.php#L283-L323 |
219,142 | moodle/moodle | lib/classes/update/validator.php | validator.validate_language_pack | protected function validate_language_pack() {
if (!isset($this->assertions['plugintype'])) {
throw new coding_exception('Required plugin type must be set before calling this');
}
if (!isset($this->extractfiles[$this->rootdir.'/lang/en/'])
or $this->extractfiles[$thi... | php | protected function validate_language_pack() {
if (!isset($this->assertions['plugintype'])) {
throw new coding_exception('Required plugin type must be set before calling this');
}
if (!isset($this->extractfiles[$this->rootdir.'/lang/en/'])
or $this->extractfiles[$thi... | [
"protected",
"function",
"validate_language_pack",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"assertions",
"[",
"'plugintype'",
"]",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Required plugin type must be set before calling this'... | Returns false if the English language pack is not provided correctly.
@return bool | [
"Returns",
"false",
"if",
"the",
"English",
"language",
"pack",
"is",
"not",
"provided",
"correctly",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/validator.php#L419-L464 |
219,143 | moodle/moodle | lib/classes/update/validator.php | validator.validate_target_location | public function validate_target_location() {
if (!isset($this->assertions['plugintype'])) {
throw new coding_exception('Required plugin type must be set before calling this');
}
$plugintypepath = $this->get_plugintype_location($this->assertions['plugintype']);
if (is_null(... | php | public function validate_target_location() {
if (!isset($this->assertions['plugintype'])) {
throw new coding_exception('Required plugin type must be set before calling this');
}
$plugintypepath = $this->get_plugintype_location($this->assertions['plugintype']);
if (is_null(... | [
"public",
"function",
"validate_target_location",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"assertions",
"[",
"'plugintype'",
"]",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Required plugin type must be set before calling this'"... | Returns false of the given add-on can't be installed into its location.
@return bool | [
"Returns",
"false",
"of",
"the",
"given",
"add",
"-",
"on",
"can",
"t",
"be",
"installed",
"into",
"its",
"location",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/validator.php#L471-L516 |
219,144 | moodle/moodle | lib/classes/update/validator.php | validator.parse_version_php | protected function parse_version_php($fullpath) {
$content = $this->get_stripped_file_contents($fullpath);
preg_match_all('#\$((plugin|module)\->(version|maturity|release|requires))=()(\d+(\.\d+)?);#m', $content, $matches1);
preg_match_all('#\$((plugin|module)\->(maturity))=()(MATURITY_\w+);#m... | php | protected function parse_version_php($fullpath) {
$content = $this->get_stripped_file_contents($fullpath);
preg_match_all('#\$((plugin|module)\->(version|maturity|release|requires))=()(\d+(\.\d+)?);#m', $content, $matches1);
preg_match_all('#\$((plugin|module)\->(maturity))=()(MATURITY_\w+);#m... | [
"protected",
"function",
"parse_version_php",
"(",
"$",
"fullpath",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"get_stripped_file_contents",
"(",
"$",
"fullpath",
")",
";",
"preg_match_all",
"(",
"'#\\$((plugin|module)\\->(version|maturity|release|requires))=()(\\d... | Get as much information from existing version.php as possible
@param string $fullpath full path to the version.php file
@return array of found meta-info declarations | [
"Get",
"as",
"much",
"information",
"from",
"existing",
"version",
".",
"php",
"as",
"possible"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/validator.php#L526-L546 |
219,145 | moodle/moodle | lib/classes/update/validator.php | validator.add_message | protected function add_message($level, $msgcode, $a = null) {
$msg = (object)array(
'level' => $level,
'msgcode' => $msgcode,
'addinfo' => $a,
);
$this->messages[] = $msg;
} | php | protected function add_message($level, $msgcode, $a = null) {
$msg = (object)array(
'level' => $level,
'msgcode' => $msgcode,
'addinfo' => $a,
);
$this->messages[] = $msg;
} | [
"protected",
"function",
"add_message",
"(",
"$",
"level",
",",
"$",
"msgcode",
",",
"$",
"a",
"=",
"null",
")",
"{",
"$",
"msg",
"=",
"(",
"object",
")",
"array",
"(",
"'level'",
"=>",
"$",
"level",
",",
"'msgcode'",
"=>",
"$",
"msgcode",
",",
"'a... | Append the given message to the messages log
@param string $level e.g. self::ERROR
@param string $msgcode may form a string
@param string|array|object $a optional additional info suitable for {@link get_string()} | [
"Append",
"the",
"given",
"message",
"to",
"the",
"messages",
"log"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/validator.php#L555-L562 |
219,146 | moodle/moodle | lib/classes/update/validator.php | validator.get_stripped_file_contents | protected function get_stripped_file_contents($fullpath) {
$source = file_get_contents($fullpath);
$tokens = token_get_all($source);
$output = '';
$doprocess = false;
foreach ($tokens as $token) {
if (is_string($token)) {
// Simple one character token... | php | protected function get_stripped_file_contents($fullpath) {
$source = file_get_contents($fullpath);
$tokens = token_get_all($source);
$output = '';
$doprocess = false;
foreach ($tokens as $token) {
if (is_string($token)) {
// Simple one character token... | [
"protected",
"function",
"get_stripped_file_contents",
"(",
"$",
"fullpath",
")",
"{",
"$",
"source",
"=",
"file_get_contents",
"(",
"$",
"fullpath",
")",
";",
"$",
"tokens",
"=",
"token_get_all",
"(",
"$",
"source",
")",
";",
"$",
"output",
"=",
"''",
";"... | Returns bare PHP code from the given file
Returns contents without PHP opening and closing tags, text outside php code,
comments and extra whitespaces.
@param string $fullpath full path to the file
@return string | [
"Returns",
"bare",
"PHP",
"code",
"from",
"the",
"given",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/update/validator.php#L573-L617 |
219,147 | moodle/moodle | user/profile/field/checkbox/field.class.php | profile_field_checkbox.edit_field_add | public function edit_field_add($mform) {
// Create the form field.
$checkbox = $mform->addElement('advcheckbox', $this->inputname, format_string($this->field->name));
if ($this->data == '1') {
$checkbox->setChecked(true);
}
$mform->setType($this->inputname, PARAM_BOOL... | php | public function edit_field_add($mform) {
// Create the form field.
$checkbox = $mform->addElement('advcheckbox', $this->inputname, format_string($this->field->name));
if ($this->data == '1') {
$checkbox->setChecked(true);
}
$mform->setType($this->inputname, PARAM_BOOL... | [
"public",
"function",
"edit_field_add",
"(",
"$",
"mform",
")",
"{",
"// Create the form field.",
"$",
"checkbox",
"=",
"$",
"mform",
"->",
"addElement",
"(",
"'advcheckbox'",
",",
"$",
"this",
"->",
"inputname",
",",
"format_string",
"(",
"$",
"this",
"->",
... | Add elements for editing the profile field value.
@param moodleform $mform | [
"Add",
"elements",
"for",
"editing",
"the",
"profile",
"field",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/field/checkbox/field.class.php#L37-L47 |
219,148 | moodle/moodle | user/profile/lib.php | profile_field_base.edit_field | public function edit_field($mform) {
if (!$this->is_editable()) {
return false;
}
$this->edit_field_add($mform);
$this->edit_field_set_default($mform);
$this->edit_field_set_required($mform);
return true;
} | php | public function edit_field($mform) {
if (!$this->is_editable()) {
return false;
}
$this->edit_field_add($mform);
$this->edit_field_set_default($mform);
$this->edit_field_set_required($mform);
return true;
} | [
"public",
"function",
"edit_field",
"(",
"$",
"mform",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_editable",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"edit_field_add",
"(",
"$",
"mform",
")",
";",
"$",
"this",
"->",... | Print out the form field in the edit profile page
@param moodleform $mform instance of the moodleform class
@return bool | [
"Print",
"out",
"the",
"form",
"field",
"in",
"the",
"edit",
"profile",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/lib.php#L147-L156 |
219,149 | moodle/moodle | user/profile/lib.php | profile_field_base.edit_validate_field | public function edit_validate_field($usernew) {
global $DB;
$errors = array();
// Get input value.
if (isset($usernew->{$this->inputname})) {
if (is_array($usernew->{$this->inputname}) && isset($usernew->{$this->inputname}['text'])) {
$value = $usernew->{$thi... | php | public function edit_validate_field($usernew) {
global $DB;
$errors = array();
// Get input value.
if (isset($usernew->{$this->inputname})) {
if (is_array($usernew->{$this->inputname}) && isset($usernew->{$this->inputname}['text'])) {
$value = $usernew->{$thi... | [
"public",
"function",
"edit_validate_field",
"(",
"$",
"usernew",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"// Get input value.",
"if",
"(",
"isset",
"(",
"$",
"usernew",
"->",
"{",
"$",
"this",
"->",
"inputname",
... | Validate the form field from profile page
@param stdClass $usernew
@return string contains error message otherwise null | [
"Validate",
"the",
"form",
"field",
"from",
"profile",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/lib.php#L211-L248 |
219,150 | moodle/moodle | user/profile/lib.php | profile_field_base.edit_field_set_default | public function edit_field_set_default($mform) {
if (!empty($this->field->defaultdata)) {
$mform->setDefault($this->inputname, $this->field->defaultdata);
}
} | php | public function edit_field_set_default($mform) {
if (!empty($this->field->defaultdata)) {
$mform->setDefault($this->inputname, $this->field->defaultdata);
}
} | [
"public",
"function",
"edit_field_set_default",
"(",
"$",
"mform",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"field",
"->",
"defaultdata",
")",
")",
"{",
"$",
"mform",
"->",
"setDefault",
"(",
"$",
"this",
"->",
"inputname",
",",
"$",
... | Sets the default data for the field in the form object
@param moodleform $mform instance of the moodleform class | [
"Sets",
"the",
"default",
"data",
"for",
"the",
"field",
"in",
"the",
"form",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/lib.php#L254-L258 |
219,151 | moodle/moodle | user/profile/lib.php | profile_field_base.edit_field_set_required | public function edit_field_set_required($mform) {
global $USER;
if ($this->is_required() && ($this->userid == $USER->id || isguestuser())) {
$mform->addRule($this->inputname, get_string('required'), 'required', null, 'client');
}
} | php | public function edit_field_set_required($mform) {
global $USER;
if ($this->is_required() && ($this->userid == $USER->id || isguestuser())) {
$mform->addRule($this->inputname, get_string('required'), 'required', null, 'client');
}
} | [
"public",
"function",
"edit_field_set_required",
"(",
"$",
"mform",
")",
"{",
"global",
"$",
"USER",
";",
"if",
"(",
"$",
"this",
"->",
"is_required",
"(",
")",
"&&",
"(",
"$",
"this",
"->",
"userid",
"==",
"$",
"USER",
"->",
"id",
"||",
"isguestuser",... | Sets the required flag for the field in the form object
@param moodleform $mform instance of the moodleform class | [
"Sets",
"the",
"required",
"flag",
"for",
"the",
"field",
"in",
"the",
"form",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/lib.php#L265-L270 |
219,152 | moodle/moodle | user/profile/lib.php | profile_field_base.edit_load_user_data | public function edit_load_user_data($user) {
if ($this->data !== null) {
$user->{$this->inputname} = $this->data;
}
} | php | public function edit_load_user_data($user) {
if ($this->data !== null) {
$user->{$this->inputname} = $this->data;
}
} | [
"public",
"function",
"edit_load_user_data",
"(",
"$",
"user",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"data",
"!==",
"null",
")",
"{",
"$",
"user",
"->",
"{",
"$",
"this",
"->",
"inputname",
"}",
"=",
"$",
"this",
"->",
"data",
";",
"}",
"}"
] | Loads a user object with data for this field ready for the edit profile
form
@param stdClass $user a user object | [
"Loads",
"a",
"user",
"object",
"with",
"data",
"for",
"this",
"field",
"ready",
"for",
"the",
"edit",
"profile",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/lib.php#L301-L305 |
219,153 | moodle/moodle | user/profile/lib.php | profile_field_base.get_category_name | public function get_category_name() {
global $DB;
if ($this->categoryname === null) {
$this->categoryname = $DB->get_field('user_info_category', 'name', ['id' => $this->field->categoryid]);
}
return $this->categoryname;
} | php | public function get_category_name() {
global $DB;
if ($this->categoryname === null) {
$this->categoryname = $DB->get_field('user_info_category', 'name', ['id' => $this->field->categoryid]);
}
return $this->categoryname;
} | [
"public",
"function",
"get_category_name",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"categoryname",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"categoryname",
"=",
"$",
"DB",
"->",
"get_field",
"(",
"'user_info_category'",
... | Returns the name of the profile category where this field is
@return string | [
"Returns",
"the",
"name",
"of",
"the",
"profile",
"category",
"where",
"this",
"field",
"is"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/lib.php#L390-L396 |
219,154 | moodle/moodle | user/profile/lib.php | profile_field_base.is_visible | public function is_visible() {
global $USER;
$context = ($this->userid > 0) ? context_user::instance($this->userid) : context_system::instance();
switch ($this->field->visible) {
case PROFILE_VISIBLE_ALL:
return true;
case PROFILE_VISIBLE_PRIVATE:
... | php | public function is_visible() {
global $USER;
$context = ($this->userid > 0) ? context_user::instance($this->userid) : context_system::instance();
switch ($this->field->visible) {
case PROFILE_VISIBLE_ALL:
return true;
case PROFILE_VISIBLE_PRIVATE:
... | [
"public",
"function",
"is_visible",
"(",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"context",
"=",
"(",
"$",
"this",
"->",
"userid",
">",
"0",
")",
"?",
"context_user",
"::",
"instance",
"(",
"$",
"this",
"->",
"userid",
")",
":",
"context_system",
... | Check if the field data is visible to the current user
@internal This method should not generally be overwritten by child classes.
@return bool | [
"Check",
"if",
"the",
"field",
"data",
"is",
"visible",
"to",
"the",
"current",
"user"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/lib.php#L430-L449 |
219,155 | moodle/moodle | user/profile/lib.php | profile_field_base.is_editable | public function is_editable() {
global $USER;
if (!$this->is_visible()) {
return false;
}
if ($this->is_signup_field() && (empty($this->userid) || isguestuser($this->userid))) {
// Allow editing the field on the signup page.
return true;
}
... | php | public function is_editable() {
global $USER;
if (!$this->is_visible()) {
return false;
}
if ($this->is_signup_field() && (empty($this->userid) || isguestuser($this->userid))) {
// Allow editing the field on the signup page.
return true;
}
... | [
"public",
"function",
"is_editable",
"(",
")",
"{",
"global",
"$",
"USER",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"is_visible",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"is_signup_field",
"(",
")",
"&&",
"(",
... | Check if the field data is editable for the current user
This method should not generally be overwritten by child classes.
@return bool | [
"Check",
"if",
"the",
"field",
"data",
"is",
"editable",
"for",
"the",
"current",
"user",
"This",
"method",
"should",
"not",
"generally",
"be",
"overwritten",
"by",
"child",
"classes",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/lib.php#L456-L479 |
219,156 | moodle/moodle | repository/lib.php | repository_type.get_contextvisibility | public function get_contextvisibility($context) {
global $USER;
if ($context->contextlevel == CONTEXT_COURSE) {
return $this->_options['enablecourseinstances'];
}
if ($context->contextlevel == CONTEXT_USER) {
return $this->_options['enableuserinstances'];
... | php | public function get_contextvisibility($context) {
global $USER;
if ($context->contextlevel == CONTEXT_COURSE) {
return $this->_options['enablecourseinstances'];
}
if ($context->contextlevel == CONTEXT_USER) {
return $this->_options['enableuserinstances'];
... | [
"public",
"function",
"get_contextvisibility",
"(",
"$",
"context",
")",
"{",
"global",
"$",
"USER",
";",
"if",
"(",
"$",
"context",
"->",
"contextlevel",
"==",
"CONTEXT_COURSE",
")",
"{",
"return",
"$",
"this",
"->",
"_options",
"[",
"'enablecourseinstances'"... | Return if the instance is visible in a context
@todo check if the context visibility has been overwritten by the plugin creator
(need to create special functions to be overvwritten in repository class)
@param stdClass $context context
@return bool | [
"Return",
"if",
"the",
"instance",
"is",
"visible",
"in",
"a",
"context"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L101-L114 |
219,157 | moodle/moodle | repository/lib.php | repository_type.update_options | public function update_options($options = null) {
global $DB;
$classname = 'repository_' . $this->_typename;
$instanceoptions = repository::static_function($this->_typename, 'get_instance_option_names');
if (empty($instanceoptions)) {
// update repository instance name if thi... | php | public function update_options($options = null) {
global $DB;
$classname = 'repository_' . $this->_typename;
$instanceoptions = repository::static_function($this->_typename, 'get_instance_option_names');
if (empty($instanceoptions)) {
// update repository instance name if thi... | [
"public",
"function",
"update_options",
"(",
"$",
"options",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"classname",
"=",
"'repository_'",
".",
"$",
"this",
"->",
"_typename",
";",
"$",
"instanceoptions",
"=",
"repository",
"::",
"static_function"... | Update plugin options into the config_plugin table
@param array $options
@return bool | [
"Update",
"plugin",
"options",
"into",
"the",
"config_plugin",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L290-L316 |
219,158 | moodle/moodle | repository/lib.php | repository_type.update_visibility | public function update_visibility($visible = null) {
if (is_bool($visible)) {
$this->_visible = $visible;
} else {
$this->_visible = !$this->_visible;
}
return $this->update_visible();
} | php | public function update_visibility($visible = null) {
if (is_bool($visible)) {
$this->_visible = $visible;
} else {
$this->_visible = !$this->_visible;
}
return $this->update_visible();
} | [
"public",
"function",
"update_visibility",
"(",
"$",
"visible",
"=",
"null",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"visible",
")",
")",
"{",
"$",
"this",
"->",
"_visible",
"=",
"$",
"visible",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"_visible",... | 1. Change visibility to the value chosen
2. Update the type
@param bool $visible
@return bool | [
"1",
".",
"Change",
"visibility",
"to",
"the",
"value",
"chosen",
"2",
".",
"Update",
"the",
"type"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L419-L426 |
219,159 | moodle/moodle | repository/lib.php | repository.get_repository_by_id | public static function get_repository_by_id($repositoryid, $context, $options = array()) {
global $CFG, $DB;
$cache = cache::make('core', 'repositories');
if (!is_object($context)) {
$context = context::instance_by_id($context);
}
$cachekey = 'rep:'. $repositoryid. ':... | php | public static function get_repository_by_id($repositoryid, $context, $options = array()) {
global $CFG, $DB;
$cache = cache::make('core', 'repositories');
if (!is_object($context)) {
$context = context::instance_by_id($context);
}
$cachekey = 'rep:'. $repositoryid. ':... | [
"public",
"static",
"function",
"get_repository_by_id",
"(",
"$",
"repositoryid",
",",
"$",
"context",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"cache",
"=",
"cache",
"::",
"make",
"(",
"'... | Get repository instance using repository id
Note that this function does not check permission to access repository contents
@throws repository_exception
@param int $repositoryid repository instance ID
@param context|int $context context instance or context ID where this repository will be used
@param array $options ... | [
"Get",
"repository",
"instance",
"using",
"repository",
"id"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L587-L629 |
219,160 | moodle/moodle | repository/lib.php | repository.get_typename | public function get_typename() {
if (empty($this->typename)) {
$matches = array();
if (!preg_match("/^repository_(.*)$/", get_class($this), $matches)) {
throw new coding_exception('The class name of a repository should be repository_<typeofrepository>, '.
... | php | public function get_typename() {
if (empty($this->typename)) {
$matches = array();
if (!preg_match("/^repository_(.*)$/", get_class($this), $matches)) {
throw new coding_exception('The class name of a repository should be repository_<typeofrepository>, '.
... | [
"public",
"function",
"get_typename",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"typename",
")",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"preg_match",
"(",
"\"/^repository_(.*)$/\"",
",",
"get_class",
"("... | Returns the type name of the repository.
@return string type name of the repository.
@since Moodle 2.5 | [
"Returns",
"the",
"type",
"name",
"of",
"the",
"repository",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L637-L647 |
219,161 | moodle/moodle | repository/lib.php | repository.get_type_by_typename | public static function get_type_by_typename($typename) {
global $DB;
$cache = cache::make('core', 'repositories');
if (($repositorytype = $cache->get('typename:'. $typename)) === false) {
$repositorytype = null;
if ($record = $DB->get_record('repository', array('type' => ... | php | public static function get_type_by_typename($typename) {
global $DB;
$cache = cache::make('core', 'repositories');
if (($repositorytype = $cache->get('typename:'. $typename)) === false) {
$repositorytype = null;
if ($record = $DB->get_record('repository', array('type' => ... | [
"public",
"static",
"function",
"get_type_by_typename",
"(",
"$",
"typename",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"cache",
"=",
"cache",
"::",
"make",
"(",
"'core'",
",",
"'repositories'",
")",
";",
"if",
"(",
"(",
"$",
"repositorytype",
"=",
"$",
... | Get a repository type object by a given type name.
@static
@param string $typename the repository type name
@return repository_type|bool | [
"Get",
"a",
"repository",
"type",
"object",
"by",
"a",
"given",
"type",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L656-L668 |
219,162 | moodle/moodle | repository/lib.php | repository.check_capability | public final function check_capability() {
global $USER;
// The context we are on.
$currentcontext = $this->context;
// Ensure that the user can view the repository in the current context.
$can = has_capability('repository/'.$this->get_typename().':view', $currentcontext);
... | php | public final function check_capability() {
global $USER;
// The context we are on.
$currentcontext = $this->context;
// Ensure that the user can view the repository in the current context.
$can = has_capability('repository/'.$this->get_typename().':view', $currentcontext);
... | [
"public",
"final",
"function",
"check_capability",
"(",
")",
"{",
"global",
"$",
"USER",
";",
"// The context we are on.",
"$",
"currentcontext",
"=",
"$",
"this",
"->",
"context",
";",
"// Ensure that the user can view the repository in the current context.",
"$",
"can",... | Checks if user has a capability to view the current repository.
@return bool true when the user can, otherwise throws an exception.
@throws repository_exception when the user does not meet the requirements. | [
"Checks",
"if",
"user",
"has",
"a",
"capability",
"to",
"view",
"the",
"current",
"repository",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L746-L796 |
219,163 | moodle/moodle | repository/lib.php | repository.draftfile_exists | public static function draftfile_exists($itemid, $filepath, $filename) {
global $USER;
$fs = get_file_storage();
$usercontext = context_user::instance($USER->id);
return $fs->file_exists($usercontext->id, 'user', 'draft', $itemid, $filepath, $filename);
} | php | public static function draftfile_exists($itemid, $filepath, $filename) {
global $USER;
$fs = get_file_storage();
$usercontext = context_user::instance($USER->id);
return $fs->file_exists($usercontext->id, 'user', 'draft', $itemid, $filepath, $filename);
} | [
"public",
"static",
"function",
"draftfile_exists",
"(",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"$",
"usercontext",
"=",
"context_user",
"::",
"i... | Check if file already exists in draft area.
@static
@param int $itemid of the draft area.
@param string $filepath path to the file.
@param string $filename file name.
@return bool | [
"Check",
"if",
"file",
"already",
"exists",
"in",
"draft",
"area",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L807-L812 |
219,164 | moodle/moodle | repository/lib.php | repository.get_moodle_file | public static function get_moodle_file($reference) {
$params = file_storage::unpack_reference($reference, true);
$fs = get_file_storage();
return $fs->get_file($params['contextid'], $params['component'], $params['filearea'],
$params['itemid'], $params['filepath'], $params['fi... | php | public static function get_moodle_file($reference) {
$params = file_storage::unpack_reference($reference, true);
$fs = get_file_storage();
return $fs->get_file($params['contextid'], $params['component'], $params['filearea'],
$params['itemid'], $params['filepath'], $params['fi... | [
"public",
"static",
"function",
"get_moodle_file",
"(",
"$",
"reference",
")",
"{",
"$",
"params",
"=",
"file_storage",
"::",
"unpack_reference",
"(",
"$",
"reference",
",",
"true",
")",
";",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"return",
"$"... | Parses the moodle file reference and returns an instance of stored_file
@param string $reference reference to the moodle internal file as retruned by
{@link repository::get_file_reference()} or {@link file_storage::pack_reference()}
@return stored_file|null | [
"Parses",
"the",
"moodle",
"file",
"reference",
"and",
"returns",
"an",
"instance",
"of",
"stored_file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L821-L826 |
219,165 | moodle/moodle | repository/lib.php | repository.get_unused_filename | public static function get_unused_filename($itemid, $filepath, $filename) {
global $USER;
$contextid = context_user::instance($USER->id)->id;
$fs = get_file_storage();
return $fs->get_unused_filename($contextid, 'user', 'draft', $itemid, $filepath, $filename);
} | php | public static function get_unused_filename($itemid, $filepath, $filename) {
global $USER;
$contextid = context_user::instance($USER->id)->id;
$fs = get_file_storage();
return $fs->get_unused_filename($contextid, 'user', 'draft', $itemid, $filepath, $filename);
} | [
"public",
"static",
"function",
"get_unused_filename",
"(",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"contextid",
"=",
"context_user",
"::",
"instance",
"(",
"$",
"USER",
"->",
"id",
")",
"->",... | Get an unused filename from the current draft area.
Will check if the file ends with ([0-9]) and increase the number.
@static
@param int $itemid draft item ID.
@param string $filepath path to the file.
@param string $filename name of the file.
@return string an unused file name. | [
"Get",
"an",
"unused",
"filename",
"from",
"the",
"current",
"draft",
"area",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L942-L947 |
219,166 | moodle/moodle | repository/lib.php | repository.append_suffix | public static function append_suffix($filename) {
debugging('The function repository::append_suffix() has been deprecated. Use repository::get_unused_filename() instead.',
DEBUG_DEVELOPER);
$pathinfo = pathinfo($filename);
if (empty($pathinfo['extension'])) {
return $file... | php | public static function append_suffix($filename) {
debugging('The function repository::append_suffix() has been deprecated. Use repository::get_unused_filename() instead.',
DEBUG_DEVELOPER);
$pathinfo = pathinfo($filename);
if (empty($pathinfo['extension'])) {
return $file... | [
"public",
"static",
"function",
"append_suffix",
"(",
"$",
"filename",
")",
"{",
"debugging",
"(",
"'The function repository::append_suffix() has been deprecated. Use repository::get_unused_filename() instead.'",
",",
"DEBUG_DEVELOPER",
")",
";",
"$",
"pathinfo",
"=",
"pathinfo... | Append a suffix to filename.
@static
@param string $filename
@return string
@deprecated since 2.5 | [
"Append",
"a",
"suffix",
"to",
"filename",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L957-L966 |
219,167 | moodle/moodle | repository/lib.php | repository.static_function | public static function static_function($plugin, $function) {
global $CFG;
//check that the plugin exists
$typedirectory = $CFG->dirroot . '/repository/'. $plugin . '/lib.php';
if (!file_exists($typedirectory)) {
//throw new repository_exception('invalidplugin', 'repository')... | php | public static function static_function($plugin, $function) {
global $CFG;
//check that the plugin exists
$typedirectory = $CFG->dirroot . '/repository/'. $plugin . '/lib.php';
if (!file_exists($typedirectory)) {
//throw new repository_exception('invalidplugin', 'repository')... | [
"public",
"static",
"function",
"static_function",
"(",
"$",
"plugin",
",",
"$",
"function",
")",
"{",
"global",
"$",
"CFG",
";",
"//check that the plugin exists",
"$",
"typedirectory",
"=",
"$",
"CFG",
"->",
"dirroot",
".",
"'/repository/'",
".",
"$",
"plugin... | Call a static function. Any additional arguments than plugin and function will be passed through.
@static
@param string $plugin repository plugin name
@param string $function function name
@return mixed | [
"Call",
"a",
"static",
"function",
".",
"Any",
"additional",
"arguments",
"than",
"plugin",
"and",
"function",
"will",
"be",
"passed",
"through",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L1163-L1183 |
219,168 | moodle/moodle | repository/lib.php | repository.antivir_scan_file | public static function antivir_scan_file($thefile, $filename, $deleteinfected) {
debugging('Please upgrade your code to use \core\antivirus\manager::scan_file instead', DEBUG_DEVELOPER);
\core\antivirus\manager::scan_file($thefile, $filename, $deleteinfected);
} | php | public static function antivir_scan_file($thefile, $filename, $deleteinfected) {
debugging('Please upgrade your code to use \core\antivirus\manager::scan_file instead', DEBUG_DEVELOPER);
\core\antivirus\manager::scan_file($thefile, $filename, $deleteinfected);
} | [
"public",
"static",
"function",
"antivir_scan_file",
"(",
"$",
"thefile",
",",
"$",
"filename",
",",
"$",
"deleteinfected",
")",
"{",
"debugging",
"(",
"'Please upgrade your code to use \\core\\antivirus\\manager::scan_file instead'",
",",
"DEBUG_DEVELOPER",
")",
";",
"\\... | Scan file, throws exception in case of infected file.
Please note that the scanning engine must be able to access the file,
permissions of the file are not modified here!
@static
@deprecated since Moodle 3.0
@param string $thefile
@param string $filename name of the file
@param bool $deleteinfected | [
"Scan",
"file",
"throws",
"exception",
"in",
"case",
"of",
"infected",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L1197-L1200 |
219,169 | moodle/moodle | repository/lib.php | repository.move_to_filepool | public static function move_to_filepool($thefile, $record) {
global $DB, $CFG, $USER, $OUTPUT;
// scan for viruses if possible, throws exception if problem found
// TODO: MDL-28637 this repository_no_delete is a bloody hack!
\core\antivirus\manager::scan_file($thefile, $record->filename... | php | public static function move_to_filepool($thefile, $record) {
global $DB, $CFG, $USER, $OUTPUT;
// scan for viruses if possible, throws exception if problem found
// TODO: MDL-28637 this repository_no_delete is a bloody hack!
\core\antivirus\manager::scan_file($thefile, $record->filename... | [
"public",
"static",
"function",
"move_to_filepool",
"(",
"$",
"thefile",
",",
"$",
"record",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
",",
"$",
"USER",
",",
"$",
"OUTPUT",
";",
"// scan for viruses if possible, throws exception if problem found",
"// TODO: ... | Move file from download folder to file pool using FILE API
@todo MDL-28637
@static
@param string $thefile file path in download folder
@param stdClass $record
@return array containing the following keys:
icon
file
id
url | [
"Move",
"file",
"from",
"download",
"folder",
"to",
"file",
"pool",
"using",
"FILE",
"API"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L1344-L1387 |
219,170 | moodle/moodle | repository/lib.php | repository.get_file | public function get_file($url, $filename = '') {
global $CFG;
$path = $this->prepare_file($filename);
$c = new curl;
$result = $c->download_one($url, null, array('filepath' => $path, 'timeout' => $CFG->repositorygetfiletimeout));
if ($result !== true) {
throw new mo... | php | public function get_file($url, $filename = '') {
global $CFG;
$path = $this->prepare_file($filename);
$c = new curl;
$result = $c->download_one($url, null, array('filepath' => $path, 'timeout' => $CFG->repositorygetfiletimeout));
if ($result !== true) {
throw new mo... | [
"public",
"function",
"get_file",
"(",
"$",
"url",
",",
"$",
"filename",
"=",
"''",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"prepare_file",
"(",
"$",
"filename",
")",
";",
"$",
"c",
"=",
"new",
"curl",
";",
"$",
... | Downloads a file from external repository and saves it in temp dir
Function get_file() must be implemented by repositories that support returntypes
FILE_INTERNAL or FILE_REFERENCE. It is invoked to pick up the file and copy it
to moodle. This function is not called for moodle repositories, the function
{@link reposito... | [
"Downloads",
"a",
"file",
"from",
"external",
"repository",
"and",
"saves",
"it",
"in",
"temp",
"dir"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L1693-L1704 |
219,171 | moodle/moodle | repository/lib.php | repository.get_file_size | public function get_file_size($source) {
// TODO MDL-33297 remove this function completely?
$browser = get_file_browser();
$params = unserialize(base64_decode($source));
$contextid = clean_param($params['contextid'], PARAM_INT);
$fileitemid = clean_param($params['itemid']... | php | public function get_file_size($source) {
// TODO MDL-33297 remove this function completely?
$browser = get_file_browser();
$params = unserialize(base64_decode($source));
$contextid = clean_param($params['contextid'], PARAM_INT);
$fileitemid = clean_param($params['itemid']... | [
"public",
"function",
"get_file_size",
"(",
"$",
"source",
")",
"{",
"// TODO MDL-33297 remove this function completely?",
"$",
"browser",
"=",
"get_file_browser",
"(",
")",
";",
"$",
"params",
"=",
"unserialize",
"(",
"base64_decode",
"(",
"$",
"source",
")",
")"... | Return size of a file in bytes.
@param string $source encoded and serialized data of file
@return int file size in bytes | [
"Return",
"size",
"of",
"a",
"file",
"in",
"bytes",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L1782-L1800 |
219,172 | moodle/moodle | repository/lib.php | repository.can_be_edited_by_user | public final function can_be_edited_by_user() {
global $USER;
// We need to be able to explore the repository.
try {
$this->check_capability();
} catch (repository_exception $e) {
return false;
}
$repocontext = context::instance_by_id($this->inst... | php | public final function can_be_edited_by_user() {
global $USER;
// We need to be able to explore the repository.
try {
$this->check_capability();
} catch (repository_exception $e) {
return false;
}
$repocontext = context::instance_by_id($this->inst... | [
"public",
"final",
"function",
"can_be_edited_by_user",
"(",
")",
"{",
"global",
"$",
"USER",
";",
"// We need to be able to explore the repository.",
"try",
"{",
"$",
"this",
"->",
"check_capability",
"(",
")",
";",
"}",
"catch",
"(",
"repository_exception",
"$",
... | Can the instance be edited by the current user?
The property $readonly must not be used within this method because
it only controls if the options from self::get_instance_option_names()
can be edited.
@return bool true if the user can edit the instance.
@since Moodle 2.5 | [
"Can",
"the",
"instance",
"be",
"edited",
"by",
"the",
"current",
"user?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L1832-L1855 |
219,173 | moodle/moodle | repository/lib.php | repository.get_meta | final public function get_meta() {
global $CFG, $OUTPUT;
$meta = new stdClass();
$meta->id = $this->id;
$meta->name = format_string($this->get_name());
$meta->type = $this->get_typename();
$meta->icon = $OUTPUT->image_url('icon', 'repository_'.$meta->type)->out(false);
... | php | final public function get_meta() {
global $CFG, $OUTPUT;
$meta = new stdClass();
$meta->id = $this->id;
$meta->name = format_string($this->get_name());
$meta->type = $this->get_typename();
$meta->icon = $OUTPUT->image_url('icon', 'repository_'.$meta->type)->out(false);
... | [
"final",
"public",
"function",
"get_meta",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"OUTPUT",
";",
"$",
"meta",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"meta",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"meta",
"->",
"name",
... | Provide repository instance information for Ajax
@return stdClass | [
"Provide",
"repository",
"instance",
"information",
"for",
"Ajax"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L1931-L1943 |
219,174 | moodle/moodle | repository/lib.php | repository.delete | final public function delete($downloadcontents = false) {
global $DB;
if ($downloadcontents) {
$this->convert_references_to_local();
} else {
$this->remove_files();
}
cache::make('core', 'repositories')->purge();
try {
$DB->delete_recor... | php | final public function delete($downloadcontents = false) {
global $DB;
if ($downloadcontents) {
$this->convert_references_to_local();
} else {
$this->remove_files();
}
cache::make('core', 'repositories')->purge();
try {
$DB->delete_recor... | [
"final",
"public",
"function",
"delete",
"(",
"$",
"downloadcontents",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"downloadcontents",
")",
"{",
"$",
"this",
"->",
"convert_references_to_local",
"(",
")",
";",
"}",
"else",
"{",
"$",... | delete a repository instance
@param bool $downloadcontents
@return bool | [
"delete",
"a",
"repository",
"instance"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2003-L2018 |
219,175 | moodle/moodle | repository/lib.php | repository.delete_all_for_context | final public static function delete_all_for_context($contextid, $downloadcontents = true) {
global $DB;
$repoids = $DB->get_fieldset_select('repository_instances', 'id', 'contextid = :contextid', array('contextid' => $contextid));
if ($downloadcontents) {
foreach ($repoids as $repoid... | php | final public static function delete_all_for_context($contextid, $downloadcontents = true) {
global $DB;
$repoids = $DB->get_fieldset_select('repository_instances', 'id', 'contextid = :contextid', array('contextid' => $contextid));
if ($downloadcontents) {
foreach ($repoids as $repoid... | [
"final",
"public",
"static",
"function",
"delete_all_for_context",
"(",
"$",
"contextid",
",",
"$",
"downloadcontents",
"=",
"true",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"repoids",
"=",
"$",
"DB",
"->",
"get_fieldset_select",
"(",
"'repository_instances'",
... | Delete all the instances associated to a context.
This method is intended to be a callback when deleting
a course or a user to delete all the instances associated
to their context. The usual way to delete a single instance
is to use {@link self::delete()}.
@param int $contextid context ID.
@param boolean $downloadcon... | [
"Delete",
"all",
"the",
"instances",
"associated",
"to",
"a",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2032-L2044 |
219,176 | moodle/moodle | repository/lib.php | repository.get_option | public function get_option($config = '') {
global $DB;
$cache = cache::make('core', 'repositories');
if (($entries = $cache->get('ops:'. $this->id)) === false) {
$entries = $DB->get_records('repository_instance_config', array('instanceid' => $this->id));
$cache->set('ops:... | php | public function get_option($config = '') {
global $DB;
$cache = cache::make('core', 'repositories');
if (($entries = $cache->get('ops:'. $this->id)) === false) {
$entries = $DB->get_records('repository_instance_config', array('instanceid' => $this->id));
$cache->set('ops:... | [
"public",
"function",
"get_option",
"(",
"$",
"config",
"=",
"''",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"cache",
"=",
"cache",
"::",
"make",
"(",
"'core'",
",",
"'repositories'",
")",
";",
"if",
"(",
"(",
"$",
"entries",
"=",
"$",
"cache",
"->"... | Get settings for repository instance.
@param string $config a specific option to get.
@return mixed returns an array of options. If $config is not empty, then it returns that option,
or null if the option does not exist. | [
"Get",
"settings",
"for",
"repository",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2112-L2134 |
219,177 | moodle/moodle | repository/lib.php | repository.filter | public function filter(&$value) {
$accepted_types = optional_param_array('accepted_types', '', PARAM_RAW);
if (isset($value['children'])) {
if (!empty($value['children'])) {
$value['children'] = array_filter($value['children'], array($this, 'filter'));
}
... | php | public function filter(&$value) {
$accepted_types = optional_param_array('accepted_types', '', PARAM_RAW);
if (isset($value['children'])) {
if (!empty($value['children'])) {
$value['children'] = array_filter($value['children'], array($this, 'filter'));
}
... | [
"public",
"function",
"filter",
"(",
"&",
"$",
"value",
")",
"{",
"$",
"accepted_types",
"=",
"optional_param_array",
"(",
"'accepted_types'",
",",
"''",
",",
"PARAM_RAW",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"value",
"[",
"'children'",
"]",
")",
")",... | Filter file listing to display specific types
@param array $value
@return bool | [
"Filter",
"file",
"listing",
"to",
"display",
"specific",
"types"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2142-L2162 |
219,178 | moodle/moodle | repository/lib.php | repository.prepare_breadcrumb | protected static function prepare_breadcrumb($breadcrumb) {
global $OUTPUT;
$foldericon = $OUTPUT->image_url(file_folder_icon(24))->out(false);
$len = count($breadcrumb);
for ($i = 0; $i < $len; $i++) {
if (is_array($breadcrumb[$i]) && !isset($breadcrumb[$i]['icon'])) {
... | php | protected static function prepare_breadcrumb($breadcrumb) {
global $OUTPUT;
$foldericon = $OUTPUT->image_url(file_folder_icon(24))->out(false);
$len = count($breadcrumb);
for ($i = 0; $i < $len; $i++) {
if (is_array($breadcrumb[$i]) && !isset($breadcrumb[$i]['icon'])) {
... | [
"protected",
"static",
"function",
"prepare_breadcrumb",
"(",
"$",
"breadcrumb",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"foldericon",
"=",
"$",
"OUTPUT",
"->",
"image_url",
"(",
"file_folder_icon",
"(",
"24",
")",
")",
"->",
"out",
"(",
"false",
")",... | Prepare the breadcrumb.
@param array $breadcrumb contains each element of the breadcrumb.
@return array of breadcrumb elements.
@since Moodle 2.3.3 | [
"Prepare",
"the",
"breadcrumb",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2197-L2209 |
219,179 | moodle/moodle | repository/lib.php | repository.prepare_listing | public static function prepare_listing($listing) {
$wasobject = false;
if (is_object($listing)) {
$listing = (array) $listing;
$wasobject = true;
}
// Prepare the breadcrumb, passed as 'path'.
if (isset($listing['path']) && is_array($listing['path'])) {
... | php | public static function prepare_listing($listing) {
$wasobject = false;
if (is_object($listing)) {
$listing = (array) $listing;
$wasobject = true;
}
// Prepare the breadcrumb, passed as 'path'.
if (isset($listing['path']) && is_array($listing['path'])) {
... | [
"public",
"static",
"function",
"prepare_listing",
"(",
"$",
"listing",
")",
"{",
"$",
"wasobject",
"=",
"false",
";",
"if",
"(",
"is_object",
"(",
"$",
"listing",
")",
")",
"{",
"$",
"listing",
"=",
"(",
"array",
")",
"$",
"listing",
";",
"$",
"waso... | Prepares list of files before passing it to AJAX, makes sure data is in the correct
format and stores formatted values.
@param array|stdClass $listing result of get_listing() or search() or file_get_drafarea_files()
@return array | [
"Prepares",
"list",
"of",
"files",
"before",
"passing",
"it",
"to",
"AJAX",
"makes",
"sure",
"data",
"is",
"in",
"the",
"correct",
"format",
"and",
"stores",
"formatted",
"values",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2304-L2326 |
219,180 | moodle/moodle | repository/lib.php | repository.get_short_filename | public function get_short_filename($str, $maxlength) {
if (core_text::strlen($str) >= $maxlength) {
return trim(core_text::substr($str, 0, $maxlength)).'...';
} else {
return $str;
}
} | php | public function get_short_filename($str, $maxlength) {
if (core_text::strlen($str) >= $maxlength) {
return trim(core_text::substr($str, 0, $maxlength)).'...';
} else {
return $str;
}
} | [
"public",
"function",
"get_short_filename",
"(",
"$",
"str",
",",
"$",
"maxlength",
")",
"{",
"if",
"(",
"core_text",
"::",
"strlen",
"(",
"$",
"str",
")",
">=",
"$",
"maxlength",
")",
"{",
"return",
"trim",
"(",
"core_text",
"::",
"substr",
"(",
"$",
... | Create a shorten filename
@param string $str filename
@param int $maxlength max file name length
@return string short filename | [
"Create",
"a",
"shorten",
"filename"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2496-L2502 |
219,181 | moodle/moodle | repository/lib.php | repository.overwrite_existing_draftfile | public static function overwrite_existing_draftfile($itemid, $filepath, $filename, $newfilepath, $newfilename) {
global $USER;
$fs = get_file_storage();
$user_context = context_user::instance($USER->id);
if ($file = $fs->get_file($user_context->id, 'user', 'draft', $itemid, $filepath, $f... | php | public static function overwrite_existing_draftfile($itemid, $filepath, $filename, $newfilepath, $newfilename) {
global $USER;
$fs = get_file_storage();
$user_context = context_user::instance($USER->id);
if ($file = $fs->get_file($user_context->id, 'user', 'draft', $itemid, $filepath, $f... | [
"public",
"static",
"function",
"overwrite_existing_draftfile",
"(",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
",",
"$",
"newfilepath",
",",
"$",
"newfilename",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"fs",
"=",
"get_file_storage",
"(",
... | Overwrite an existing file
@param int $itemid
@param string $filepath
@param string $filename
@param string $newfilepath
@param string $newfilename
@return bool | [
"Overwrite",
"an",
"existing",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2514-L2549 |
219,182 | moodle/moodle | repository/lib.php | repository.delete_tempfile_from_draft | public static function delete_tempfile_from_draft($draftitemid, $filepath, $filename) {
global $USER;
$fs = get_file_storage();
$user_context = context_user::instance($USER->id);
if ($file = $fs->get_file($user_context->id, 'user', 'draft', $draftitemid, $filepath, $filename)) {
... | php | public static function delete_tempfile_from_draft($draftitemid, $filepath, $filename) {
global $USER;
$fs = get_file_storage();
$user_context = context_user::instance($USER->id);
if ($file = $fs->get_file($user_context->id, 'user', 'draft', $draftitemid, $filepath, $filename)) {
... | [
"public",
"static",
"function",
"delete_tempfile_from_draft",
"(",
"$",
"draftitemid",
",",
"$",
"filepath",
",",
"$",
"filename",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"$",
"user_context",
"=",
"context_use... | Delete a temp file from draft area
@param int $draftitemid
@param string $filepath
@param string $filename
@return bool | [
"Delete",
"a",
"temp",
"file",
"from",
"draft",
"area"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2655-L2665 |
219,183 | moodle/moodle | repository/lib.php | repository.convert_references_to_local | public function convert_references_to_local() {
$fs = get_file_storage();
$files = $fs->get_external_files($this->id);
foreach ($files as $storedfile) {
$fs->import_external_file($storedfile);
}
} | php | public function convert_references_to_local() {
$fs = get_file_storage();
$files = $fs->get_external_files($this->id);
foreach ($files as $storedfile) {
$fs->import_external_file($storedfile);
}
} | [
"public",
"function",
"convert_references_to_local",
"(",
")",
"{",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"$",
"files",
"=",
"$",
"fs",
"->",
"get_external_files",
"(",
"$",
"this",
"->",
"id",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
... | Find all external files in this repo and import them | [
"Find",
"all",
"external",
"files",
"in",
"this",
"repo",
"and",
"import",
"them"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2670-L2676 |
219,184 | moodle/moodle | repository/lib.php | repository.remove_files | public function remove_files() {
$fs = get_file_storage();
$files = $fs->get_external_files($this->id);
foreach ($files as $storedfile) {
$storedfile->delete();
}
} | php | public function remove_files() {
$fs = get_file_storage();
$files = $fs->get_external_files($this->id);
foreach ($files as $storedfile) {
$storedfile->delete();
}
} | [
"public",
"function",
"remove_files",
"(",
")",
"{",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"$",
"files",
"=",
"$",
"fs",
"->",
"get_external_files",
"(",
"$",
"this",
"->",
"id",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"stored... | Find all external files linked to this repository and delete them. | [
"Find",
"all",
"external",
"files",
"linked",
"to",
"this",
"repository",
"and",
"delete",
"them",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2681-L2687 |
219,185 | moodle/moodle | repository/lib.php | repository.prepare_to_cache | public function prepare_to_cache() {
return array(
'class' => get_class($this),
'id' => $this->id,
'ctxid' => $this->context->id,
'options' => $this->options,
'readonly' => $this->readonly
);
} | php | public function prepare_to_cache() {
return array(
'class' => get_class($this),
'id' => $this->id,
'ctxid' => $this->context->id,
'options' => $this->options,
'readonly' => $this->readonly
);
} | [
"public",
"function",
"prepare_to_cache",
"(",
")",
"{",
"return",
"array",
"(",
"'class'",
"=>",
"get_class",
"(",
"$",
"this",
")",
",",
"'id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'ctxid'",
"=>",
"$",
"this",
"->",
"context",
"->",
"id",
",",
"'o... | Prepares the repository to be cached. Implements method from cacheable_object interface.
@return array | [
"Prepares",
"the",
"repository",
"to",
"be",
"cached",
".",
"Implements",
"method",
"from",
"cacheable_object",
"interface",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2790-L2798 |
219,186 | moodle/moodle | repository/lib.php | repository.get_secret_key | final static public function get_secret_key() {
global $CFG;
if (!isset($CFG->reposecretkey)) {
set_config('reposecretkey', time() . random_string(32));
}
return $CFG->reposecretkey;
} | php | final static public function get_secret_key() {
global $CFG;
if (!isset($CFG->reposecretkey)) {
set_config('reposecretkey', time() . random_string(32));
}
return $CFG->reposecretkey;
} | [
"final",
"static",
"public",
"function",
"get_secret_key",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"CFG",
"->",
"reposecretkey",
")",
")",
"{",
"set_config",
"(",
"'reposecretkey'",
",",
"time",
"(",
")",
".",
"rand... | Generate a secret key to be used for passing sensitive information around.
@return string repository secret key. | [
"Generate",
"a",
"secret",
"key",
"to",
"be",
"used",
"for",
"passing",
"sensitive",
"information",
"around",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2851-L2858 |
219,187 | moodle/moodle | repository/lib.php | repository_instance_form.add_defaults | protected function add_defaults() {
$mform =& $this->_form;
$strrequired = get_string('required');
$mform->addElement('hidden', 'edit', ($this->instance) ? $this->instance->id : 0);
$mform->setType('edit', PARAM_INT);
$mform->addElement('hidden', 'new', $this->plugin);
... | php | protected function add_defaults() {
$mform =& $this->_form;
$strrequired = get_string('required');
$mform->addElement('hidden', 'edit', ($this->instance) ? $this->instance->id : 0);
$mform->setType('edit', PARAM_INT);
$mform->addElement('hidden', 'new', $this->plugin);
... | [
"protected",
"function",
"add_defaults",
"(",
")",
"{",
"$",
"mform",
"=",
"&",
"$",
"this",
"->",
"_form",
";",
"$",
"strrequired",
"=",
"get_string",
"(",
"'required'",
")",
";",
"$",
"mform",
"->",
"addElement",
"(",
"'hidden'",
",",
"'edit'",
",",
... | Added defaults to moodle form | [
"Added",
"defaults",
"to",
"moodle",
"form"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2889-L2907 |
219,188 | moodle/moodle | repository/lib.php | repository_instance_form.definition | public function definition() {
global $CFG;
// type of plugin, string
$this->plugin = $this->_customdata['plugin'];
$this->typeid = $this->_customdata['typeid'];
$this->contextid = $this->_customdata['contextid'];
$this->instance = (isset($this->_customdata['instance'])
... | php | public function definition() {
global $CFG;
// type of plugin, string
$this->plugin = $this->_customdata['plugin'];
$this->typeid = $this->_customdata['typeid'];
$this->contextid = $this->_customdata['contextid'];
$this->instance = (isset($this->_customdata['instance'])
... | [
"public",
"function",
"definition",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// type of plugin, string",
"$",
"this",
"->",
"plugin",
"=",
"$",
"this",
"->",
"_customdata",
"[",
"'plugin'",
"]",
";",
"$",
"this",
"->",
"typeid",
"=",
"$",
"this",
"->",... | Define moodle form elements | [
"Define",
"moodle",
"form",
"elements"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/lib.php#L2912-L2953 |
219,189 | moodle/moodle | report/outline/classes/filter_form.php | filter_form.definition_after_data | public function definition_after_data() {
$mform = $this->_form;
$filterstartdate = $mform->getElement('filterstartdate')->getValue();
$filterenddate = $mform->getElement('filterenddate')->getValue();
if (!empty($filterstartdate['enabled']) || !empty($filterenddate['enabled'])) {
... | php | public function definition_after_data() {
$mform = $this->_form;
$filterstartdate = $mform->getElement('filterstartdate')->getValue();
$filterenddate = $mform->getElement('filterenddate')->getValue();
if (!empty($filterstartdate['enabled']) || !empty($filterenddate['enabled'])) {
... | [
"public",
"function",
"definition_after_data",
"(",
")",
"{",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"$",
"filterstartdate",
"=",
"$",
"mform",
"->",
"getElement",
"(",
"'filterstartdate'",
")",
"->",
"getValue",
"(",
")",
";",
"$",
"filterend... | Expand the form contents if the filter is in use.
@throws \HTML_QuickForm_Error | [
"Expand",
"the",
"form",
"contents",
"if",
"the",
"filter",
"is",
"in",
"use",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/outline/classes/filter_form.php#L66-L73 |
219,190 | moodle/moodle | lib/pear/HTML/QuickForm/checkbox.php | HTML_QuickForm_checkbox.toHtml | function toHtml()
{
$this->_generateId(); // Seems to be necessary when this is used in a group.
if (0 == strlen($this->_text)) {
$label = '';
} elseif ($this->_flagFrozen) {
$label = $this->_text;
} else {
$label = '<label for="' . $this->getAttri... | php | function toHtml()
{
$this->_generateId(); // Seems to be necessary when this is used in a group.
if (0 == strlen($this->_text)) {
$label = '';
} elseif ($this->_flagFrozen) {
$label = $this->_text;
} else {
$label = '<label for="' . $this->getAttri... | [
"function",
"toHtml",
"(",
")",
"{",
"$",
"this",
"->",
"_generateId",
"(",
")",
";",
"// Seems to be necessary when this is used in a group.",
"if",
"(",
"0",
"==",
"strlen",
"(",
"$",
"this",
"->",
"_text",
")",
")",
"{",
"$",
"label",
"=",
"''",
";",
... | Returns the checkbox element in HTML
@since 1.0
@access public
@return string | [
"Returns",
"the",
"checkbox",
"element",
"in",
"HTML"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/checkbox.php#L123-L134 |
219,191 | moodle/moodle | repository/s3/lib.php | repository_s3.explode_path | protected function explode_path($path) {
$parts = explode('/', $path, 2);
if (isset($parts[1]) && $parts[1] !== '') {
list($bucket, $uri) = $parts;
} else {
$bucket = $parts[0];
$uri = '';
}
return array($bucket, $uri);
} | php | protected function explode_path($path) {
$parts = explode('/', $path, 2);
if (isset($parts[1]) && $parts[1] !== '') {
list($bucket, $uri) = $parts;
} else {
$bucket = $parts[0];
$uri = '';
}
return array($bucket, $uri);
} | [
"protected",
"function",
"explode_path",
"(",
"$",
"path",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'/'",
",",
"$",
"path",
",",
"2",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"parts",
"[",
"1",
"]",
")",
"&&",
"$",
"parts",
"[",
"1",
"]",
... | Extracts the Bucket and URI from the path
@param string $path path in this format 'bucket/path/to/folder/and/file'
@return array including bucket and uri | [
"Extracts",
"the",
"Bucket",
"and",
"URI",
"from",
"the",
"path"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/s3/lib.php#L89-L98 |
219,192 | moodle/moodle | repository/s3/lib.php | repository_s3.get_file | public function get_file($filepath, $file = '') {
list($bucket, $uri) = $this->explode_path($filepath);
$path = $this->prepare_file($file);
try {
$this->s->getObject($bucket, $uri, $path);
} catch (S3Exception $e) {
throw new moodle_exception(
'err... | php | public function get_file($filepath, $file = '') {
list($bucket, $uri) = $this->explode_path($filepath);
$path = $this->prepare_file($file);
try {
$this->s->getObject($bucket, $uri, $path);
} catch (S3Exception $e) {
throw new moodle_exception(
'err... | [
"public",
"function",
"get_file",
"(",
"$",
"filepath",
",",
"$",
"file",
"=",
"''",
")",
"{",
"list",
"(",
"$",
"bucket",
",",
"$",
"uri",
")",
"=",
"$",
"this",
"->",
"explode_path",
"(",
"$",
"filepath",
")",
";",
"$",
"path",
"=",
"$",
"this"... | Download S3 files to moodle
@param string $filepath
@param string $file The file path in moodle
@return array The local stored path | [
"Download",
"S3",
"files",
"to",
"moodle"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/s3/lib.php#L234-L249 |
219,193 | moodle/moodle | portfolio/googledocs/lib.php | portfolio_plugin_googledocs.get_access_token | private function get_access_token() {
global $SESSION;
if (isset($SESSION->{self::SESSIONKEY}) && $SESSION->{self::SESSIONKEY}) {
$this->client->setAccessToken($SESSION->{self::SESSIONKEY});
return $SESSION->{self::SESSIONKEY};
}
return null;
} | php | private function get_access_token() {
global $SESSION;
if (isset($SESSION->{self::SESSIONKEY}) && $SESSION->{self::SESSIONKEY}) {
$this->client->setAccessToken($SESSION->{self::SESSIONKEY});
return $SESSION->{self::SESSIONKEY};
}
return null;
} | [
"private",
"function",
"get_access_token",
"(",
")",
"{",
"global",
"$",
"SESSION",
";",
"if",
"(",
"isset",
"(",
"$",
"SESSION",
"->",
"{",
"self",
"::",
"SESSIONKEY",
"}",
")",
"&&",
"$",
"SESSION",
"->",
"{",
"self",
"::",
"SESSIONKEY",
"}",
")",
... | Gets the access token from session and sets it to client.
@return null|string null or token. | [
"Gets",
"the",
"access",
"token",
"from",
"session",
"and",
"sets",
"it",
"to",
"client",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/portfolio/googledocs/lib.php#L101-L108 |
219,194 | moodle/moodle | lib/editor/atto/classes/privacy/provider.php | provider.export_autosaves | protected static function export_autosaves(\stdClass $user, \moodle_recordset $autosaves) {
foreach ($autosaves as $autosave) {
$context = \context::instance_by_id($autosave->contextid);
$subcontext = [
get_string('autosaves', 'editor_atto'),
$autosave->id... | php | protected static function export_autosaves(\stdClass $user, \moodle_recordset $autosaves) {
foreach ($autosaves as $autosave) {
$context = \context::instance_by_id($autosave->contextid);
$subcontext = [
get_string('autosaves', 'editor_atto'),
$autosave->id... | [
"protected",
"static",
"function",
"export_autosaves",
"(",
"\\",
"stdClass",
"$",
"user",
",",
"\\",
"moodle_recordset",
"$",
"autosaves",
")",
"{",
"foreach",
"(",
"$",
"autosaves",
"as",
"$",
"autosave",
")",
"{",
"$",
"context",
"=",
"\\",
"context",
"... | Export all autosave records in the recordset, and close the recordset when finished.
@param \stdClass $user The user whose data is to be exported
@param \moodle_recordset $autosaves The recordset containing the data to export | [
"Export",
"all",
"autosave",
"records",
"in",
"the",
"recordset",
"and",
"close",
"the",
"recordset",
"when",
"finished",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/editor/atto/classes/privacy/provider.php#L155-L180 |
219,195 | moodle/moodle | lib/classes/task/manager.php | manager.get_queued_adhoc_task_record | protected static function get_queued_adhoc_task_record($task) {
global $DB;
$record = self::record_from_adhoc_task($task);
$params = [$record->classname, $record->component, $record->customdata];
$sql = 'classname = ? AND component = ? AND ' .
$DB->sql_compare_text('customda... | php | protected static function get_queued_adhoc_task_record($task) {
global $DB;
$record = self::record_from_adhoc_task($task);
$params = [$record->classname, $record->component, $record->customdata];
$sql = 'classname = ? AND component = ? AND ' .
$DB->sql_compare_text('customda... | [
"protected",
"static",
"function",
"get_queued_adhoc_task_record",
"(",
"$",
"task",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"record",
"=",
"self",
"::",
"record_from_adhoc_task",
"(",
"$",
"task",
")",
";",
"$",
"params",
"=",
"[",
"$",
"record",
"->",
... | Checks if the task with the same classname, component and customdata is already scheduled
@param adhoc_task $task
@return bool | [
"Checks",
"if",
"the",
"task",
"with",
"the",
"same",
"classname",
"component",
"and",
"customdata",
"is",
"already",
"scheduled"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/manager.php#L141-L154 |
219,196 | moodle/moodle | lib/classes/task/manager.php | manager.reschedule_or_queue_adhoc_task | public static function reschedule_or_queue_adhoc_task(adhoc_task $task) : void {
global $DB;
if ($existingrecord = self::get_queued_adhoc_task_record($task)) {
// Only update the next run time if it is explicitly set on the task.
$nextruntime = $task->get_next_run_time();
... | php | public static function reschedule_or_queue_adhoc_task(adhoc_task $task) : void {
global $DB;
if ($existingrecord = self::get_queued_adhoc_task_record($task)) {
// Only update the next run time if it is explicitly set on the task.
$nextruntime = $task->get_next_run_time();
... | [
"public",
"static",
"function",
"reschedule_or_queue_adhoc_task",
"(",
"adhoc_task",
"$",
"task",
")",
":",
"void",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"existingrecord",
"=",
"self",
"::",
"get_queued_adhoc_task_record",
"(",
"$",
"task",
")",
")",
... | Schedule a new task, or reschedule an existing adhoc task which has matching data.
Only a task matching the same user, classname, component, and customdata will be rescheduled.
If these values do not match exactly then a new task is scheduled.
@param \core\task\adhoc_task $task - The new adhoc task information to sto... | [
"Schedule",
"a",
"new",
"task",
"or",
"reschedule",
"an",
"existing",
"adhoc",
"task",
"which",
"has",
"matching",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/manager.php#L165-L178 |
219,197 | moodle/moodle | lib/classes/task/manager.php | manager.queue_adhoc_task | public static function queue_adhoc_task(adhoc_task $task, $checkforexisting = false) {
global $DB;
if ($userid = $task->get_userid()) {
// User found. Check that they are suitable.
\core_user::require_active_user(\core_user::get_user($userid, '*', MUST_EXIST), true, true);
... | php | public static function queue_adhoc_task(adhoc_task $task, $checkforexisting = false) {
global $DB;
if ($userid = $task->get_userid()) {
// User found. Check that they are suitable.
\core_user::require_active_user(\core_user::get_user($userid, '*', MUST_EXIST), true, true);
... | [
"public",
"static",
"function",
"queue_adhoc_task",
"(",
"adhoc_task",
"$",
"task",
",",
"$",
"checkforexisting",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"userid",
"=",
"$",
"task",
"->",
"get_userid",
"(",
")",
")",
"{",
"// ... | Queue an adhoc task to run in the background.
@param \core\task\adhoc_task $task - The new adhoc task information to store.
@param bool $checkforexisting - If set to true and the task with the same user, classname, component and customdata
is already scheduled then it will not schedule a new task. Can be used only for... | [
"Queue",
"an",
"adhoc",
"task",
"to",
"run",
"in",
"the",
"background",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/manager.php#L188-L211 |
219,198 | moodle/moodle | lib/classes/task/manager.php | manager.record_from_scheduled_task | public static function record_from_scheduled_task($task) {
$record = new \stdClass();
$record->classname = self::get_canonical_class_name($task);
$record->component = $task->get_component();
$record->blocking = $task->is_blocking();
$record->customised = $task->is_customised();
... | php | public static function record_from_scheduled_task($task) {
$record = new \stdClass();
$record->classname = self::get_canonical_class_name($task);
$record->component = $task->get_component();
$record->blocking = $task->is_blocking();
$record->customised = $task->is_customised();
... | [
"public",
"static",
"function",
"record_from_scheduled_task",
"(",
"$",
"task",
")",
"{",
"$",
"record",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"record",
"->",
"classname",
"=",
"self",
"::",
"get_canonical_class_name",
"(",
"$",
"task",
")",
";... | Utility method to create a DB record from a scheduled task.
@param \core\task\scheduled_task $task
@return \stdClass | [
"Utility",
"method",
"to",
"create",
"a",
"DB",
"record",
"from",
"a",
"scheduled",
"task",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/manager.php#L241-L258 |
219,199 | moodle/moodle | lib/classes/task/manager.php | manager.record_from_adhoc_task | public static function record_from_adhoc_task($task) {
$record = new \stdClass();
$record->classname = self::get_canonical_class_name($task);
$record->id = $task->get_id();
$record->component = $task->get_component();
$record->blocking = $task->is_blocking();
$record->nex... | php | public static function record_from_adhoc_task($task) {
$record = new \stdClass();
$record->classname = self::get_canonical_class_name($task);
$record->id = $task->get_id();
$record->component = $task->get_component();
$record->blocking = $task->is_blocking();
$record->nex... | [
"public",
"static",
"function",
"record_from_adhoc_task",
"(",
"$",
"task",
")",
"{",
"$",
"record",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"record",
"->",
"classname",
"=",
"self",
"::",
"get_canonical_class_name",
"(",
"$",
"task",
")",
";",
... | Utility method to create a DB record from an adhoc task.
@param \core\task\adhoc_task $task
@return \stdClass | [
"Utility",
"method",
"to",
"create",
"a",
"DB",
"record",
"from",
"an",
"adhoc",
"task",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/manager.php#L266-L278 |
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.