Permalink
Browse files

MDL-17074 course settings - new defaults to be applied on interactive…

… course creation
  • Loading branch information...
stronk7
stronk7 committed Feb 11, 2009
1 parent d2aa927 commit 3ee21ffa01bb032f6c7a3f7c94c292532fba226c
Showing with 61 additions and 8 deletions.
  1. +37 −0 admin/settings/courses.php
  2. +14 −8 course/edit_form.php
  3. +10 −0 lang/en_utf8/moodle.php
View
@@ -13,6 +13,43 @@
$ADMIN->add('courses', new admin_enrolment_page());
+/// Course Default Settings Page
+/// NOTE: these settings must be applied after all other settings because they depend on them
+/// NOTE: these are a subset of the complete defaults available in 2.0
+ ///general course settings
+ $temp = new admin_settingpage('coursesettings', get_string('coursesettings'));
+ $temp->add(new admin_settings_coursecat_select('moodlecourse/category', get_string('category'), get_string('coursehelpcategory'), 1));
+ $courseformats = get_list_of_plugins('course/format');
+ $formcourseformats = array();
+ foreach ($courseformats as $courseformat) {
+ $formcourseformats["$courseformat"] = get_string("format$courseformat","format_$courseformat");
+ if ($formcourseformats["$courseformat"]=="[[format$courseformat]]") {
+ $formcourseformats["$courseformat"] = get_string("format$courseformat");
+ }
+ }
+ $temp->add(new admin_setting_configselect('moodlecourse/format', get_string('format'), get_string('coursehelpformat'), 'weeks',$formcourseformats));
+ for ($i=1; $i<=52; $i++) {
+ $sectionmenu[$i] = "$i";
+ }
+ $temp->add(new admin_setting_configselect('moodlecourse/numsections', get_string('numberweeks'), get_string('coursehelpnumberweeks'), 3,$sectionmenu));
+ $choices = array();
+ $choices['0'] = get_string('hiddensectionscollapsed');
+ $choices['1'] = get_string('hiddensectionsinvisible');
+ $temp->add(new admin_setting_configselect('moodlecourse/hiddensections', get_string('hiddensections'), get_string('coursehelphiddensections'), 0,$choices));
+ $options = range(0, 10);
+ $temp->add(new admin_setting_configselect('moodlecourse/newsitems', get_string('newsitemsnumber'), get_string('coursehelpnewsitemsnumber'), 5,$options));
+ $temp->add(new admin_setting_configselect('moodlecourse/showgrades', get_string('showgrades'), get_string('coursehelpshowgrades'), 1,array(0 => get_string('no'), 1 => get_string('yes'))));
+ $temp->add(new admin_setting_configselect('moodlecourse/showreports', get_string('showreports'), '', 0,array(0 => get_string('no'), 1 => get_string('yes'))));
+ if (isset($CFG->maxbytes)) {
+ $choices = get_max_upload_sizes($CFG->maxbytes);
+ } else {
+ $choices = get_max_upload_sizes();
+ }
+ $temp->add(new admin_setting_configselect('moodlecourse/maxbytes', get_string('maximumupload'), get_string('coursehelpmaximumupload'), key($choices), $choices));
+ $temp->add(new admin_setting_configselect('moodlecourse/metacourse', get_string('metacourse'), get_string('coursehelpmetacourse'), 0,array(0 => get_string('no'), 1 => get_string('yes'))));
+
+ $ADMIN->add('courses', $temp);
+
// "courserequests" settingpage
$temp = new admin_settingpage('courserequest', get_string('courserequest'));
$temp->add(new admin_setting_configcheckbox('enablecourserequests', get_string('enablecourserequests', 'admin'), get_string('configenablecourserequests', 'admin'), 0));
View
@@ -7,6 +7,7 @@ class course_edit_form extends moodleform {
function definition() {
global $USER, $CFG;
+ $courseconfig = get_config('moodlecourse');
$mform =& $this->_form;
$course = $this->_customdata['course'];
@@ -66,7 +67,11 @@ function definition() {
$mform->addElement('hidden', 'category', null);
}
$mform->setHelpButton('category', array('coursecategory', get_string('category')));
- $mform->setDefault('category', $category->id);
+ if (!empty($category->id)) {
+ $mform->setDefault('category', $category->id);
+ } else {
+ $mform->setDefault('category', $courseconfig->category);
+ }
$mform->setType('category', PARAM_INT);
$mform->addElement('text','fullname', get_string('fullname'),'maxlength="254" size="50"');
@@ -111,13 +116,13 @@ function definition() {
}
$mform->addElement('select', 'format', get_string('format'), $formcourseformats);
$mform->setHelpButton('format', array('courseformats', get_string('courseformats')), true);
- $mform->setDefault('format', 'weeks');
+ $mform->setDefault('format', $courseconfig->format);
for ($i=1; $i<=52; $i++) {
$sectionmenu[$i] = "$i";
}
$mform->addElement('select', 'numsections', get_string('numberweeks'), $sectionmenu);
- $mform->setDefault('numsections', 10);
+ $mform->setDefault('numsections', $courseconfig->numsections);
$mform->addElement('date_selector', 'startdate', get_string('startdate'));
$mform->setHelpButton('startdate', array('coursestartdate', get_string('startdate')), true);
@@ -128,24 +133,25 @@ function definition() {
$choices['1'] = get_string('hiddensectionsinvisible');
$mform->addElement('select', 'hiddensections', get_string('hiddensections'), $choices);
$mform->setHelpButton('hiddensections', array('coursehiddensections', get_string('hiddensections')), true);
- $mform->setDefault('hiddensections', 0);
+ $mform->setDefault('hiddensections', $courseconfig->hiddensections);
$options = range(0, 10);
$mform->addElement('select', 'newsitems', get_string('newsitemsnumber'), $options);
$mform->setHelpButton('newsitems', array('coursenewsitems', get_string('newsitemsnumber')), true);
- $mform->setDefault('newsitems', 5);
+ $mform->setDefault('newsitems', $courseconfig->newsitems);
$mform->addElement('selectyesno', 'showgrades', get_string('showgrades'));
$mform->setHelpButton('showgrades', array('coursegrades', get_string('grades')), true);
- $mform->setDefault('showgrades', 1);
+ $mform->setDefault('showgrades', $courseconfig->showgrades);
$mform->addElement('selectyesno', 'showreports', get_string('showreports'));
$mform->setHelpButton('showreports', array('coursereports', get_string('activityreport')), true);
- $mform->setDefault('showreports', 0);
+ $mform->setDefault('showreports', $courseconfig->showreports);
$choices = get_max_upload_sizes($CFG->maxbytes);
$mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices);
$mform->setHelpButton('maxbytes', array('courseuploadsize', get_string('maximumupload')), true);
+ $mform->setDefault('maxbytes', $courseconfig->maxbytes);
if (!empty($CFG->allowcoursethemes)) {
$themes=array();
@@ -160,7 +166,7 @@ function definition() {
if ($disable_meta === false) {
$mform->addElement('select', 'metacourse', get_string('managemeta'), $meta);
$mform->setHelpButton('metacourse', array('metacourse', get_string('metacourse')), true);
- $mform->setDefault('metacourse', 0);
+ $mform->setDefault('metacourse', $courseconfig->metacourse);
} else {
// no metacourse element - we do not want to change it anyway!
$mform->addElement('static', 'nometacourse', get_string('managemeta'),
View
@@ -278,6 +278,15 @@
$string['courseformatdata'] = 'Course format data';
$string['courseformats'] = 'Course formats';
$string['coursegrades'] = 'Course grades';
+$string['coursehelpcategory'] = 'Position the course on the course listing and may make it easier for students to find it.';
+$string['coursehelpformat'] = 'The course main page will be displayed in this format.';
+$string['coursehelpnumberweeks'] = 'Number of weeks/topics displayed on the course main page.';
+$string['coursehelphiddensections'] = 'How the hidden sections in the course are displayed to students.';
+$string['coursehelpnewsitemsnumber'] = 'Number of recent items appearing on the course home page, in a news box down the right-hand side <br/>(0 means the news box won\'t appear)
+.';
+$string['coursehelpshowgrades'] = 'Enable the display of the gradebook. It does not prevent grades from being displayed within the individual activities.';
+$string['coursehelpmaximumupload'] = 'Define the largest size of file that can be uploaded by students in this course, limited by the site wide setting.';
+$string['coursehelpmetacourse'] = 'Set the course a metacourse. A meta course takes enrolments (and other role assignments) from a \"child\" course or courses.';
$string['coursehidden'] = 'This course is currently unavailable to students';
$string['courseimportnotaught'] = 'You don\'t seem to be an editing teacher in any other courses, there are no courses for you to import from.';
$string['courseinfo'] = 'Course info';
@@ -306,6 +315,7 @@
$string['courserestore'] = 'Course restore';
$string['courses'] = 'Courses';
$string['coursescategory'] = 'Courses in the same category';
+$string['coursesettings'] = 'Course default settings';
$string['coursesmovedout'] = 'Courses moved out from $a';
$string['coursespending'] = 'Courses pending approval';
$string['coursestaught'] = 'Courses I have taught';

0 comments on commit 3ee21ff

Please sign in to comment.