diff --git a/admin/courseformats.php b/admin/courseformats.php deleted file mode 100644 index a8377dec7a7af..0000000000000 --- a/admin/courseformats.php +++ /dev/null @@ -1,131 +0,0 @@ -. - -/** - * Allows the admin to enable, disable and uninstall course formats - * - * @package core_admin - * @copyright 2012 Marina Glancy - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -require_once('../config.php'); -require_once($CFG->libdir.'/adminlib.php'); -require_once($CFG->libdir.'/pluginlib.php'); - -$action = required_param('action', PARAM_ALPHANUMEXT); -$formatname = required_param('format', PARAM_PLUGIN); -$confirm = optional_param('confirm', 0, PARAM_BOOL); - -$syscontext = context_system::instance(); -$PAGE->set_url('/admin/courseformats.php'); -$PAGE->set_context($syscontext); - -require_login(); -require_capability('moodle/site:config', $syscontext); -require_sesskey(); - -$return = new moodle_url('/admin/settings.php', array('section' => 'manageformats')); - -$allplugins = plugin_manager::instance()->get_plugins(); -$formatplugins = $allplugins['format']; -$sortorder = array_flip(array_keys($formatplugins)); - -if (!isset($formatplugins[$formatname])) { - print_error('courseformatnotfound', 'error', $return, $formatname); -} - -switch ($action) { - case 'disable': - if ($formatplugins[$formatname]->is_enabled()) { - if (get_config('moodlecourse', 'format') === $formatname) { - print_error('cannotdisableformat', 'error', $return); - } - set_config('disabled', 1, 'format_'. $formatname); - } - break; - case 'enable': - if (!$formatplugins[$formatname]->is_enabled()) { - unset_config('disabled', 'format_'. $formatname); - } - break; - case 'up': - if ($sortorder[$formatname]) { - $currentindex = $sortorder[$formatname]; - $seq = array_keys($formatplugins); - $seq[$currentindex] = $seq[$currentindex-1]; - $seq[$currentindex-1] = $formatname; - set_config('format_plugins_sortorder', implode(',', $seq)); - } - break; - case 'down': - if ($sortorder[$formatname] < count($sortorder)-1) { - $currentindex = $sortorder[$formatname]; - $seq = array_keys($formatplugins); - $seq[$currentindex] = $seq[$currentindex+1]; - $seq[$currentindex+1] = $formatname; - set_config('format_plugins_sortorder', implode(',', $seq)); - } - break; - case 'uninstall': - echo $OUTPUT->header(); - echo $OUTPUT->heading(get_string('courseformats', 'moodle')); - - $coursecount = $DB->count_records('course', array('format' => $formatname)); - if ($coursecount) { - // Check that default format is set. It will be used to convert courses - // using this format - $defaultformat = get_config('moodlecourse', 'format'); - $defaultformat = $formatplugins[get_config('moodlecourse', 'format')]; - if (!$defaultformat) { - echo $OUTPUT->error_text(get_string('defaultformatnotset', 'admin')); - echo $OUTPUT->footer(); - exit; - } - } - - $format = $formatplugins[$formatname]; - $deleteurl = $format->get_uninstall_url(); - if (!$deleteurl) { - // somebody was trying to cheat and type non-existing link - echo $OUTPUT->error_text(get_string('cannotuninstall', 'admin', $format->displayname)); - echo $OUTPUT->footer(); - exit; - } - - if (!$confirm) { - if ($coursecount) { - $message = get_string('formatuninstallwithcourses', 'admin', - (object)array('count' => $coursecount, 'format' => $format->displayname, - 'defaultformat' => $defaultformat->displayname)); - } else { - $message = get_string('formatuninstallconfirm', 'admin', $format->displayname); - } - $deleteurl->param('confirm', 1); - echo $OUTPUT->confirm($message, $deleteurl, $return); - } else { - $a = new stdClass(); - $a->plugin = $format->displayname; - $a->directory = $format->rootdir; - uninstall_plugin('format', $formatname); - echo $OUTPUT->notification(get_string('formatuninstalled', 'admin', $a), 'notifysuccess'); - echo $OUTPUT->continue_button($return); - } - - echo $OUTPUT->footer(); - exit; -} -redirect($return); diff --git a/admin/settings/courses.php b/admin/settings/courses.php index b68a10a1f84d1..363bfb11743c8 100644 --- a/admin/settings/courses.php +++ b/admin/settings/courses.php @@ -15,10 +15,9 @@ /// NOTE: these settings must be applied after all other settings because they depend on them ///main course settings $temp = new admin_settingpage('coursesettings', new lang_string('coursesettings')); - require_once($CFG->dirroot.'/course/lib.php'); - $courseformats = get_sorted_course_formats(true); + $courseformats = get_plugin_list('format'); $formcourseformats = array(); - foreach ($courseformats as $courseformat) { + foreach ($courseformats as $courseformat => $courseformatdir) { $formcourseformats[$courseformat] = new lang_string('pluginname', "format_$courseformat"); } $temp->add(new admin_setting_configselect('moodlecourse/format', new lang_string('format'), new lang_string('coursehelpformat'), 'weeks',$formcourseformats)); diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index bae770ab950aa..29d0665dd3f87 100644 --- a/admin/settings/plugins.php +++ b/admin/settings/plugins.php @@ -20,15 +20,6 @@ // hidden script for converting journals to online assignments (or something like that) linked from elsewhere $ADMIN->add('modsettings', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true)); - // course formats - $ADMIN->add('modules', new admin_category('formatsettings', new lang_string('courseformats'))); - $temp = new admin_settingpage('manageformats', new lang_string('manageformats', 'core_admin')); - $temp->add(new admin_setting_manageformats()); - $ADMIN->add('formatsettings', $temp); - foreach ($allplugins['format'] as $format) { - $format->load_settings($ADMIN, 'formatsettings', $hassiteconfig); - } - // blocks $ADMIN->add('modules', new admin_category('blocksettings', new lang_string('blocks'))); $ADMIN->add('blocksettings', new admin_page_manageblocks()); diff --git a/course/edit_form.php b/course/edit_form.php index 34dbe12fa2791..70b709a997886 100644 --- a/course/edit_form.php +++ b/course/edit_form.php @@ -113,20 +113,11 @@ function definition() { $mform->hardFreeze('summary_editor'); } - $courseformats = get_sorted_course_formats(true); + $courseformats = get_plugin_list('format'); $formcourseformats = array(); - foreach ($courseformats as $courseformat) { + foreach ($courseformats as $courseformat => $formatdir) { $formcourseformats[$courseformat] = get_string('pluginname', "format_$courseformat"); } - if (isset($course->format)) { - $course->format = course_get_format($course)->get_format(); // replace with default if not found - if (!in_array($course->format, $courseformats)) { - // this format is disabled. Still display it in the dropdown - $formcourseformats[$course->format] = get_string('withdisablednote', 'moodle', - get_string('pluginname', 'format_'.$course->format)); - } - } - $mform->addElement('select', 'format', get_string('format'), $formcourseformats); $mform->addHelpButton('format', 'format'); $mform->setDefault('format', $courseconfig->format); diff --git a/course/format/formatlegacy.php b/course/format/formatlegacy.php index 41ead8368b3d3..e6141a3bd7e3f 100644 --- a/course/format/formatlegacy.php +++ b/course/format/formatlegacy.php @@ -329,21 +329,9 @@ public function update_course_format_options($data, $oldcourse = null) { if ($oldcourse !== null) { $data = (array)$data; $oldcourse = (array)$oldcourse; - $options = $this->course_format_options(); - foreach ($options as $key => $unused) { - if (!array_key_exists($key, $data)) { - if (array_key_exists($key, $oldcourse)) { - $data[$key] = $oldcourse[$key]; - } else if ($key === 'numsections') { - // If previous format does not have the field 'numsections' and this one does, - // and $data['numsections'] is not set fill it with the maximum section number from the DB - $maxsection = $DB->get_field_sql('SELECT max(section) from {course_sections} - WHERE course = ?', array($this->courseid)); - if ($maxsection) { - // If there are no sections, or just default 0-section, 'numsections' will be set to default - $data['numsections'] = $maxsection; - } - } + foreach ($this->course_format_options() as $key => $unused) { + if (array_key_exists($key, $oldcourse) && !array_key_exists($key, $data)) { + $data[$key] = $oldcourse[$key]; } } } diff --git a/course/format/lib.php b/course/format/lib.php index 7268400925e88..d0ad3d7e87658 100644 --- a/course/format/lib.php +++ b/course/format/lib.php @@ -97,21 +97,13 @@ protected static final function get_format_or_default($format) { if ($format === 'site') { return $format; } - $plugins = get_sorted_course_formats(); - if (in_array($format, $plugins)) { + $plugins = get_plugin_list('format'); // TODO MDL-35260 filter only enabled + if (isset($plugins[$format])) { return $format; } // Else return default format - $defaultformat = get_config('moodlecourse', 'format'); - if (!in_array($defaultformat, $plugins)) { - // when default format is not set correctly, use the first available format - $defaultformat = reset($plugins); - } - static $warningprinted = array(); - if (empty($warningprinted[$format])) { - debugging('Format plugin format_'.$format.' is not found. Using default format_'.$defaultformat, DEBUG_DEVELOPER); - $warningprinted[$format] = true; - } + $defaultformat = reset($plugins); // TODO MDL-35260 get default format from config + debugging('Format plugin format_'.$format.' is not found or is not enabled. Using default format_'.$defaultformat, DEBUG_DEVELOPER); return $defaultformat; } diff --git a/course/format/upgrade.txt b/course/format/upgrade.txt index f14a8912052cc..6beb68bb834f6 100644 --- a/course/format/upgrade.txt +++ b/course/format/upgrade.txt @@ -12,7 +12,6 @@ format. functions callback_XXXX_request_key() are no longer used (where XXXX is the course format name) * functions get_generic_section_name(), get_all_sections(), add_mod_to_section(), get_all_mods() are deprecated. See their phpdocs in lib/deprecatedlib.php on how to replace them -* Course formats may now have their settings.php file as the most of other plugin types === 2.3 === diff --git a/course/lib.php b/course/lib.php index 332248284d0bf..5f5535b121873 100644 --- a/course/lib.php +++ b/course/lib.php @@ -4511,35 +4511,6 @@ function include_course_ajax($course, $usedmodules = array(), $enabledmodules = return true; } -/** - * Returns the sorted list of available course formats, filtered by enabled if necessary - * - * @param bool $enabledonly return only formats that are enabled - * @return array array of sorted format names - */ -function get_sorted_course_formats($enabledonly = false) { - global $CFG; - $formats = get_plugin_list('format'); - - $sortorderstr = ''; - if (isset($CFG->format_plugins_sortorder)) { - $sortorderstr = $CFG->format_plugins_sortorder; - } - $order = explode(',', $sortorderstr); - $order = array_merge(array_intersect($order, array_keys($formats)), - array_diff(array_keys($formats), $order)); - if ($sortorderstr !== join(',', $order)) { - set_config('format_plugins_sortorder', join(',', $order)); - } - $sortedformats = array(); - foreach ($order as $formatname) { - if (!$enabledonly || !get_config('format_'.$formatname, 'disabled')) { - $sortedformats[] = $formatname; - } - } - return $sortedformats; -} - /** * The URL to use for the specified course (with section) * diff --git a/lang/en/admin.php b/lang/en/admin.php index 10a2fd2d2cf3c..2498fef162af3 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -95,7 +95,6 @@ $string['calendarsettings'] = 'Calendar'; $string['calendar_weekend'] = 'Weekend days'; $string['cannotdeletemodfilter'] = 'You cannot uninstall the \'{$a->filter}\' because it is part of the \'{$a->module}\' module.'; -$string['cannotuninstall'] = '{$a} can not be uninstalled.'; $string['cfgwwwrootslashwarning'] = 'You have defined $CFG->wwwroot incorrectly in your config.php file. You have included a \'/\' character at the end. Please remove it, or you will experience strange bugs like MDL-11061.'; $string['cfgwwwrootwarning'] = 'You have defined $CFG->wwwroot incorrectly in your config.php file. It does not match the URL you are using to access this page. Please correct it, or you will experience strange bugs like MDL-11061.'; $string['clamfailureonupload'] = 'On clam AV failure'; @@ -417,7 +416,6 @@ $string['debugvalidators'] = 'Show validator links'; $string['defaultcity'] = 'Default city'; $string['defaultcity_help'] = 'A city entered here will be the default city when creating new user accounts.'; -$string['defaultformatnotset'] = 'Error determining default course format. Please check site settings.'; $string['defaulthomepage'] = 'Default home page for users'; $string['defaultrequestcategory'] = 'Default category for course requests'; $string['defaultsettinginfo'] = 'Default: {$a}'; @@ -534,9 +532,6 @@ $string['forceloginforprofileimage_help'] = 'If enabled, users must login in order to view user profile pictures and the default user picture will be used in all notification emails.'; $string['forceloginforprofiles'] = 'Force users to login for profiles'; $string['forcetimezone'] = 'Force default timezone'; -$string['formatuninstallwithcourses'] = 'There are {$a->count} courses using {$a->format}. Their format will be changed to {$a->defaultformat} (default format for this site). Some format-specific data may be lost. Are you sure you want to proceed?'; -$string['formatuninstallconfirm'] = '{$a} will be uninstalled. No courses currently use it. Continue?'; -$string['formatuninstalled'] = 'All data associated with the format plugin \'{$a->plugin}\' has been deleted from the database. To complete the deletion (and prevent the plugin re-installing itself), you should now delete this directory from your server: {$a->directory}'; $string['frontpage'] = 'Front page'; $string['frontpagebackup'] = 'Front page backup'; $string['frontpagedefaultrole'] = 'Default frontpage role'; @@ -645,8 +640,6 @@ $string['maintenancemode'] = 'In maintenance mode'; $string['maintfileopenerror'] = 'Error opening maintenance files!'; $string['maintinprogress'] = 'Maintenance is in progress...'; -$string['manageformats'] = 'Manage course formats'; -$string['manageformatsgotosettings'] = 'Default format can be changed in {$a}'; $string['managelang'] = 'Manage'; $string['managelicenses'] = 'Manage licences'; $string['manageqbehaviours'] = 'Manage question behaviours'; diff --git a/lang/en/error.php b/lang/en/error.php index e3b9f80d96a1f..b9e57071480cb 100644 --- a/lang/en/error.php +++ b/lang/en/error.php @@ -65,7 +65,6 @@ $string['cannotdeleterole'] = 'It cannot be deleted, because {$a}'; $string['cannotdeleterolewithid'] = 'Could not delete role with ID {$a}'; $string['cannotdeletethisrole'] = 'You cannot delete this role because it is used by the system, or because it is the last role with administrator capabilities.'; -$string['cannotdisableformat'] = 'You can not disable the default format'; $string['cannotdownloadcomponents'] = 'Cannot download components'; $string['cannotdownloadlanguageupdatelist'] = 'Cannot download list of language updates from download.moodle.org'; $string['cannotdownloadzipfile'] = 'Cannot download ZIP file'; @@ -543,4 +542,4 @@ $string['xmldberror'] = 'XMLDB error!'; $string['alreadyloggedin'] = 'You are already logged in as {$a}, you need to log out before logging in as different user.'; $string['youcannotdeletecategory'] = 'You cannot delete category \'{$a}\' because you can neither delete the contents, nor move them elsewhere.'; -$string['protected_cc_not_supported'] = 'Protected cartridges not supported.'; \ No newline at end of file +$string['protected_cc_not_supported'] = 'Protected cartridges not supported.'; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index e5c189306045d..118b4344b9856 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -297,7 +297,7 @@ $string['coursecreators'] = 'Course creator'; $string['coursecreatorsdescription'] = 'Course creators can create new courses.'; $string['coursedisplay'] = 'Course layout'; -$string['coursedisplay_help'] = 'This setting determines whether the whole course is displayed on one page or split over several pages.'; +$string['coursedisplay_help'] = 'This setting determines whether the whole course is displayed on one page or split over several pages. The setting has no affect on certain course formats, such as SCORM format.'; $string['coursedisplay_single'] = 'Show all sections on one page'; $string['coursedisplay_multi'] = 'Show one section per page'; $string['coursedeleted'] = 'Deleted course {$a}'; @@ -1802,7 +1802,6 @@ $string['whattodo'] = 'What to do'; $string['windowclosing'] = 'This window should close automatically. If not, please close it now.'; $string['withchosenfiles'] = 'With chosen files'; -$string['withdisablednote'] = '{$a} (disabled)'; $string['withoutuserdata'] = 'without user data'; $string['withselectedusers'] = 'With selected users...'; $string['withselectedusers_help'] = '* Send message - For sending a message to one or more participants diff --git a/lib/adminlib.php b/lib/adminlib.php index 06a9c9814ee15..0bf564999e4e2 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -266,16 +266,6 @@ function uninstall_plugin($type, $name) { // Delete block $DB->delete_records('block', array('id'=>$block->id)); } - } else if ($type === 'format') { - if (($defaultformat = get_config('moodlecourse', 'format')) && $defaultformat !== $name) { - $courses = $DB->get_records('course', array('format' => $name), 'id'); - $data = (object)array('id' => null, 'format' => $defaultformat); - foreach ($courses as $record) { - $data->id = $record->id; - update_course($data); - } - } - $DB->delete_records('course_format_options', array('format' => $name)); } // perform clean-up task common for all the plugin/subplugin types @@ -5898,147 +5888,6 @@ public function output_html($data, $query='') { } } -/** - * Course formats manager. Allows to enable/disable formats and jump to settings - */ -class admin_setting_manageformats extends admin_setting { - - /** - * Calls parent::__construct with specific arguments - */ - public function __construct() { - $this->nosave = true; - parent::__construct('formatsui', new lang_string('manageformats', 'core_admin'), '', ''); - } - - /** - * Always returns true - * - * @return true - */ - public function get_setting() { - return true; - } - - /** - * Always returns true - * - * @return true - */ - public function get_defaultsetting() { - return true; - } - - /** - * Always returns '' and doesn't write anything - * - * @param mixed $data string or array, must not be NULL - * @return string Always returns '' - */ - public function write_setting($data) { - // do not write any setting - return ''; - } - - /** - * Search to find if Query is related to format plugin - * - * @param string $query The string to search for - * @return bool true for related false for not - */ - public function is_related($query) { - if (parent::is_related($query)) { - return true; - } - $allplugins = plugin_manager::instance()->get_plugins(); - $formats = $allplugins['format']; - foreach ($formats as $format) { - if (strpos($format->component, $query) !== false || - strpos(textlib::strtolower($format->displayname), $query) !== false) { - return true; - } - } - return false; - } - - /** - * Return XHTML to display control - * - * @param mixed $data Unused - * @param string $query - * @return string highlight - */ - public function output_html($data, $query='') { - global $CFG, $OUTPUT; - $return = ''; - $return = $OUTPUT->heading(new lang_string('courseformats'), 3, 'main'); - $return .= $OUTPUT->box_start('generalbox formatsui'); - - $allplugins = plugin_manager::instance()->get_plugins(); - $formats = $allplugins['format']; - - // display strings - $txt = get_strings(array('settings', 'name', 'enable', 'disable', 'up', 'down', 'default', 'delete')); - $txt->updown = "$txt->up/$txt->down"; - - $table = new html_table(); - $table->head = array($txt->name, $txt->enable, $txt->updown, $txt->delete, $txt->settings); - $table->align = array('left', 'center', 'center', 'center', 'center'); - $table->width = '90%'; - $table->attributes['class'] = 'manageformattable generaltable'; - $table->data = array(); - - $cnt = 0; - $defaultformat = get_config('moodlecourse', 'format'); - $spacer = $OUTPUT->pix_icon('spacer', '', 'moodle', array('class' => 'icon')); - foreach ($formats as $format) { - $url = new moodle_url('/admin/courseformats.php', - array('sesskey' => sesskey(), 'format' => $format->name)); - $isdefault = ''; - if ($format->is_enabled()) { - $strformatname = html_writer::tag('span', $format->displayname); - if ($defaultformat === $format->name) { - $hideshow = $txt->default; - } else { - $hideshow = html_writer::link($url->out(false, array('action' => 'disable')), - $OUTPUT->pix_icon('i/hide', $txt->disable, 'moodle', array('class' => 'icon'))); - } - } else { - $strformatname = html_writer::tag('span', $format->displayname, array('class' => 'dimmed_text')); - $hideshow = html_writer::link($url->out(false, array('action' => 'enable')), - $OUTPUT->pix_icon('i/show', $txt->enable, 'moodle', array('class' => 'icon'))); - } - $updown = ''; - if ($cnt) { - $updown .= html_writer::link($url->out(false, array('action' => 'up')), - $OUTPUT->pix_icon('t/up', $txt->up, 'moodle')). ' '; - } else { - $updown .= $spacer; - } - if ($cnt < count($formats) - 1) { - $updown .= ' '.html_writer::link($url->out(false, array('action' => 'down')), - $OUTPUT->pix_icon('t/down', $txt->down, 'moodle')); - } else { - $updown .= $spacer; - } - $cnt++; - $settings = ''; - if ($format->get_settings_url()) { - $settings = html_writer::link($format->get_settings_url(), $txt->settings); - } - $uninstall = ''; - if ($defaultformat !== $format->name) { - $uninstall = html_writer::link($format->get_uninstall_url(), $txt->delete); - } - $table->data[] =array($strformatname, $hideshow, $updown, $uninstall, $settings); - } - $return .= html_writer::table($table); - $link = html_writer::link(new moodle_url('/admin/settings.php', array('section' => 'coursesettings')), new lang_string('coursesettings')); - $return .= html_writer::tag('p', get_string('manageformatsgotosettings', 'admin', $link)); - $return .= $OUTPUT->box_end(); - return highlight($query, $return); - } -} /** * Special class for filter administration. diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 52b3118f4e711..4f8914f7c29ac 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -4572,8 +4572,7 @@ function delete_course($courseorid, $showfeedback = true) { // which should know about this updated property, as this event is meant to pass the full course record $course->timemodified = time(); - $DB->delete_records("course", array("id" => $courseid)); - $DB->delete_records("course_format_options", array("courseid" => $courseid)); + $DB->delete_records("course", array("id"=>$courseid)); //trigger events $course->context = $context; // you can not fetch context in the event because it was already deleted diff --git a/lib/pluginlib.php b/lib/pluginlib.php index 1d4131e468758..cb35acab04be9 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -2841,61 +2841,3 @@ public function get_uninstall_url() { array('sesskey' => sesskey(), 'action' => 'uninstall', 'webservice' => $this->name)); } } - -/** - * Class for course formats - */ -class plugininfo_format extends plugininfo_base { - - /** - * Gathers and returns the information about all plugins of the given type - * - * @param string $type the name of the plugintype, eg. mod, auth or workshopform - * @param string $typerootdir full path to the location of the plugin dir - * @param string $typeclass the name of the actually called class - * @return array of plugintype classes, indexed by the plugin name - */ - public static function get_plugins($type, $typerootdir, $typeclass) { - global $CFG; - $formats = parent::get_plugins($type, $typerootdir, $typeclass); - require_once($CFG->dirroot.'/course/lib.php'); - $order = get_sorted_course_formats(); - $sortedformats = array(); - foreach ($order as $formatname) { - $sortedformats[$formatname] = $formats[$formatname]; - } - return $sortedformats; - } - - public function get_settings_section_name() { - return 'formatsetting' . $this->name; - } - - public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) { - global $CFG, $USER, $DB, $OUTPUT, $PAGE; // in case settings.php wants to refer to them - $ADMIN = $adminroot; // also may be used in settings.php - $section = $this->get_settings_section_name(); - - $settings = null; - if ($hassiteconfig && file_exists($this->full_path('settings.php'))) { - $settings = new admin_settingpage($section, $this->displayname, - 'moodle/site:config', $this->is_enabled() === false); - include($this->full_path('settings.php')); // this may also set $settings to null - } - if ($settings) { - $ADMIN->add($parentnodename, $settings); - } - } - - public function is_enabled() { - return !get_config($this->component, 'disabled'); - } - - public function get_uninstall_url() { - if ($this->name !== get_config('moodlecourse', 'format') && $this->name !== 'site') { - return new moodle_url('/admin/courseformats.php', - array('sesskey' => sesskey(), 'action' => 'uninstall', 'format' => $this->name)); - } - return parent::get_uninstall_url(); - } -}