From aec15827b5db3cdc8178556e46af23a3ea708b6e Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Wed, 17 Apr 2013 13:12:36 +0800 Subject: [PATCH 1/4] MDL-38415 course: Reformat edit form AMOS BEGIN MOV [availability_help,core],[visible_help,core] MOV [category_help,core],[coursecategory_help,core] AMOS END --- course/edit_form.php | 213 ++++++++++++++++++++----------------------- lang/en/moodle.php | 4 +- 2 files changed, 103 insertions(+), 114 deletions(-) diff --git a/course/edit_form.php b/course/edit_form.php index 7a8d7c9b23e..1cd5b0d818e 100644 --- a/course/edit_form.php +++ b/course/edit_form.php @@ -46,35 +46,6 @@ class course_edit_form extends moodleform { $mform->setType('returnto', PARAM_ALPHANUM); $mform->setConstant('returnto', $returnto); - // verify permissions to change course category or keep current - if (empty($course->id)) { - if (has_capability('moodle/course:create', $categorycontext)) { - $displaylist = coursecat::make_categories_list('moodle/course:create'); - $mform->addElement('select', 'category', get_string('category'), $displaylist); - $mform->addHelpButton('category', 'category'); - $mform->setDefault('category', $category->id); - } else { - $mform->addElement('hidden', 'category', null); - $mform->setType('category', PARAM_INT); - $mform->setConstant('category', $category->id); - } - } else { - if (has_capability('moodle/course:changecategory', $coursecontext)) { - $displaylist = coursecat::make_categories_list('moodle/course:create'); - if (!isset($displaylist[$course->category])) { - //always keep current - $displaylist[$course->category] = coursecat::get($course->category)->get_formatted_name(); - } - $mform->addElement('select', 'category', get_string('category'), $displaylist); - $mform->addHelpButton('category', 'category'); - } else { - //keep current - $mform->addElement('hidden', 'category', null); - $mform->setType('category', PARAM_INT); - $mform->setConstant('category', $course->category); - } - } - $mform->addElement('text','fullname', get_string('fullnamecourse'),'maxlength="254" size="50"'); $mform->addHelpButton('fullname', 'fullnamecourse'); $mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client'); @@ -93,15 +64,6 @@ class course_edit_form extends moodleform { $mform->setConstant('shortname', $course->shortname); } - $mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100" size="10"'); - $mform->addHelpButton('idnumber', 'idnumbercourse'); - $mform->setType('idnumber', PARAM_RAW); - if (!empty($course->id) and !has_capability('moodle/course:changeidnumber', $coursecontext)) { - $mform->hardFreeze('idnumber'); - $mform->setConstants('idnumber', $course->idnumber); - } - - $mform->addElement('editor','summary_editor', get_string('coursesummary'), null, $editoroptions); $mform->addHelpButton('summary_editor', 'coursesummary'); $mform->setType('summary_editor', PARAM_RAW); @@ -117,6 +79,84 @@ class course_edit_form extends moodleform { $mform->hardFreeze($summaryfields); } + // Verify permissions to change course category or keep current. + if (empty($course->id)) { + if (has_capability('moodle/course:create', $categorycontext)) { + $displaylist = coursecat::make_categories_list('moodle/course:create'); + $mform->addElement('select', 'category', get_string('coursecategory'), $displaylist); + $mform->addHelpButton('category', 'coursecategory'); + $mform->setDefault('category', $category->id); + } else { + $mform->addElement('hidden', 'category', null); + $mform->setType('category', PARAM_INT); + $mform->setConstant('category', $category->id); + } + } else { + if (has_capability('moodle/course:changecategory', $coursecontext)) { + $displaylist = coursecat::make_categories_list('moodle/course:create'); + if (!isset($displaylist[$course->category])) { + //always keep current + $displaylist[$course->category] = coursecat::get($course->category)->get_formatted_name(); + } + $mform->addElement('select', 'category', get_string('coursecategory'), $displaylist); + $mform->addHelpButton('category', 'coursecategory'); + } else { + //keep current + $mform->addElement('hidden', 'category', null); + $mform->setType('category', PARAM_INT); + $mform->setConstant('category', $course->category); + } + } + + $mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100" size="10"'); + $mform->addHelpButton('idnumber', 'idnumbercourse'); + $mform->setType('idnumber', PARAM_RAW); + if (!empty($course->id) and !has_capability('moodle/course:changeidnumber', $coursecontext)) { + $mform->hardFreeze('idnumber'); + $mform->setConstants('idnumber', $course->idnumber); + } + + $choices = array(); + $choices['0'] = get_string('hide'); + $choices['1'] = get_string('show'); + $mform->addElement('select', 'visible', get_string('visible'), $choices); + $mform->addHelpButton('visible', 'visible'); + $mform->setDefault('visible', $courseconfig->visible); + if (!has_capability('moodle/course:visibility', $context)) { + $mform->hardFreeze('visible'); + if (!empty($course->id)) { + $mform->setConstant('visible', $course->visible); + } else { + $mform->setConstant('visible', $courseconfig->visible); + } + } + + $mform->addElement('date_selector', 'startdate', get_string('startdate')); + $mform->addHelpButton('startdate', 'startdate'); + $mform->setDefault('startdate', time() + 3600 * 24); + + if (completion_info::is_enabled_for_site()) { + $mform->addElement('select', 'enablecompletion', get_string('completion', 'completion'), + array(0 => get_string('completiondisabled', 'completion'), 1 => get_string('completionenabled', 'completion'))); + $mform->setDefault('enablecompletion', $courseconfig->enablecompletion); + } else { + $mform->addElement('hidden', 'enablecompletion'); + $mform->setType('enablecompletion', PARAM_INT); + $mform->setDefault('enablecompletion',0); + } + + // Handle non-existing $course->maxbytes on course creation. + $coursemaxbytes = !isset($course->maxbytes) ? null : $course->maxbytes; + + // Let's prepare the maxbytes popup. + $choices = get_max_upload_sizes($CFG->maxbytes, 0, 0, $coursemaxbytes); + $mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices); + $mform->addHelpButton('maxbytes', 'maximumupload'); + $mform->setDefault('maxbytes', $courseconfig->maxbytes); + + // Appearance. + $mform->addElement('header', 'appearancehdr', get_string('appearance')); + $courseformats = get_sorted_course_formats(true); $formcourseformats = array(); foreach ($courseformats as $courseformat) { @@ -135,13 +175,31 @@ class course_edit_form extends moodleform { $mform->addHelpButton('format', 'format'); $mform->setDefault('format', $courseconfig->format); - // button to update format-specific options on format change (will be hidden by JavaScript) + // Button to update format-specific options on format change (will be hidden by JavaScript). $mform->registerNoSubmitButton('updatecourseformat'); $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate')); - $mform->addElement('date_selector', 'startdate', get_string('startdate')); - $mform->addHelpButton('startdate', 'startdate'); - $mform->setDefault('startdate', time() + 3600 * 24); + // Just a placeholder for the course format options. + $mform->addElement('hidden', 'addcourseformatoptionshere'); + $mform->setType('addcourseformatoptionshere', PARAM_BOOL); + + if (!empty($CFG->allowcoursethemes)) { + $themeobjects = get_list_of_themes(); + $themes=array(); + $themes[''] = get_string('forceno'); + foreach ($themeobjects as $key=>$theme) { + if (empty($theme->hidefromselector)) { + $themes[$key] = get_string('pluginname', 'theme_'.$theme->name); + } + } + $mform->addElement('select', 'theme', get_string('forcetheme'), $themes); + } + + $languages=array(); + $languages[''] = get_string('forceno'); + $languages += get_string_manager()->get_list_of_translations(); + $mform->addElement('select', 'lang', get_string('forcelanguage'), $languages); + $mform->setDefault('lang', $courseconfig->lang); $options = range(0, 10); $mform->addElement('select', 'newsitems', get_string('newsitemsnumber'), $options); @@ -156,15 +214,6 @@ class course_edit_form extends moodleform { $mform->addHelpButton('showreports', 'showreports'); $mform->setDefault('showreports', $courseconfig->showreports); - // Handle non-existing $course->maxbytes on course creation. - $coursemaxbytes = !isset($course->maxbytes) ? null : $course->maxbytes; - - // Let's prepare the maxbytes popup. - $choices = get_max_upload_sizes($CFG->maxbytes, 0, 0, $coursemaxbytes); - $mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices); - $mform->addHelpButton('maxbytes', 'maximumupload'); - $mform->setDefault('maxbytes', $courseconfig->maxbytes); - if (!empty($course->legacyfiles) or !empty($CFG->legacyfilesinnewcourses)) { if (empty($course->legacyfiles)) { //0 or missing means no legacy files ever used in this course - new course or nobody turned on legacy files yet @@ -181,23 +230,6 @@ class course_edit_form extends moodleform { $mform->setDefault('legacyfiles', $courseconfig->legacyfiles); } - if (!empty($CFG->allowcoursethemes)) { - $themeobjects = get_list_of_themes(); - $themes=array(); - $themes[''] = get_string('forceno'); - foreach ($themeobjects as $key=>$theme) { - if (empty($theme->hidefromselector)) { - $themes[$key] = get_string('pluginname', 'theme_'.$theme->name); - } - } - $mform->addElement('select', 'theme', get_string('forcetheme'), $themes); - } - -//-------------------------------------------------------------------------------- - // Just a placeholder.. - $mform->addElement('hidden', 'addcourseformatoptionshere'); - $mform->setType('addcourseformatoptionshere', PARAM_BOOL); - //-------------------------------------------------------------------------------- enrol_course_edit_form($mform, $course, $context); @@ -212,10 +244,7 @@ class course_edit_form extends moodleform { $mform->addHelpButton('groupmode', 'groupmode', 'group'); $mform->setDefault('groupmode', $courseconfig->groupmode); - $choices = array(); - $choices['0'] = get_string('no'); - $choices['1'] = get_string('yes'); - $mform->addElement('select', 'groupmodeforce', get_string('groupmodeforce', 'group'), $choices); + $mform->addElement('selectyesno', 'groupmodeforce', get_string('groupmodeforce', 'group')); $mform->addHelpButton('groupmodeforce', 'groupmodeforce', 'group'); $mform->setDefault('groupmodeforce', $courseconfig->groupmodeforce); @@ -225,43 +254,6 @@ class course_edit_form extends moodleform { $mform->addElement('select', 'defaultgroupingid', get_string('defaultgrouping', 'group'), $options); //-------------------------------------------------------------------------------- - $mform->addElement('header','availability', get_string('availability')); - - $choices = array(); - $choices['0'] = get_string('courseavailablenot'); - $choices['1'] = get_string('courseavailable'); - $mform->addElement('select', 'visible', get_string('availability'), $choices); - $mform->addHelpButton('visible', 'availability'); - $mform->setDefault('visible', $courseconfig->visible); - if (!has_capability('moodle/course:visibility', $context)) { - $mform->hardFreeze('visible'); - if (!empty($course->id)) { - $mform->setConstant('visible', $course->visible); - } else { - $mform->setConstant('visible', $courseconfig->visible); - } - } - -//-------------------------------------------------------------------------------- - $mform->addElement('header','language', get_string('language')); - - $languages=array(); - $languages[''] = get_string('forceno'); - $languages += get_string_manager()->get_list_of_translations(); - $mform->addElement('select', 'lang', get_string('forcelanguage'), $languages); - $mform->setDefault('lang', $courseconfig->lang); - -//-------------------------------------------------------------------------------- - if (completion_info::is_enabled_for_site()) { - $mform->addElement('header','progress', get_string('progress','completion')); - $mform->addElement('select', 'enablecompletion', get_string('completion','completion'), - array(0=>get_string('completiondisabled','completion'), 1=>get_string('completionenabled','completion'))); - $mform->setDefault('enablecompletion', $courseconfig->enablecompletion); - } else { - $mform->addElement('hidden', 'enablecompletion'); - $mform->setType('enablecompletion', PARAM_INT); - $mform->setDefault('enablecompletion',0); - } /// customizable role names in this course //-------------------------------------------------------------------------------- @@ -309,9 +301,6 @@ class course_edit_form extends moodleform { $formatvalue = $mform->getElementValue('format'); if (is_array($formatvalue) && !empty($formatvalue)) { $courseformat = course_get_format((object)array('format' => $formatvalue[0])); - $newel = $mform->createElement('header', 'courseformatoptions', get_string('courseformatoptions', 'moodle', - $courseformat->get_format_name())); - $mform->insertElementBefore($newel, 'addcourseformatoptionshere'); $elements = $courseformat->create_edit_form_elements($mform); for ($i = 0; $i < count($elements); $i++) { diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 7ad3e7fe98a..b77b8d57b73 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -156,7 +156,6 @@ $string['autosubscribe'] = 'Forum auto-subscribe'; $string['autosubscribeno'] = 'No: don\'t automatically subscribe me to forums'; $string['autosubscribeyes'] = 'Yes: when I post, subscribe me to that forum'; $string['availability'] = 'Availability'; -$string['availability_help'] = 'This setting determines whether the course appears in the list of courses. Apart from teachers and administrators, users are not allowed to enter the course.'; $string['availablecourses'] = 'Available courses'; $string['back'] = 'Back'; $string['backto'] = 'Back to {$a}'; @@ -215,7 +214,6 @@ $string['cancel'] = 'Cancel'; $string['cancelled'] = 'Cancelled'; $string['categories'] = 'Course categories'; $string['category'] = 'Category'; -$string['category_help'] = 'This setting determines the category in which the course will appear in the list of courses.'; $string['categoryadded'] = 'The category \'{$a}\' was added'; $string['categorycontents'] = 'Subcategories and courses'; $string['categorycurrentcontents'] = 'Contents of {$a}'; @@ -293,6 +291,7 @@ $string['courseavailablenot'] = 'This course is not available to students'; $string['coursebackup'] = 'Course backup'; $string['coursecategories'] = 'Course categories'; $string['coursecategory'] = 'Course category'; +$string['coursecategory_help'] = 'This setting determines the category in which the course will appear in the list of courses.'; $string['coursecategorydeleted'] = 'Deleted course category {$a}'; $string['coursecompletion'] = 'Course completion'; $string['coursecompletions'] = 'Course completions'; @@ -1798,6 +1797,7 @@ $string['virusfoundsubject'] = '{$a}: Virus found!'; $string['virusfounduser'] = 'The file you have uploaded, {$a->filename}, has been scanned by a virus checker and found to be infected! Your file upload was NOT successful.'; $string['virusplaceholder'] = 'This file that has been uploaded was found to contain a virus and has been moved or deleted and the user notified.'; $string['visible'] = 'Visible'; +$string['visible_help'] = 'This setting determines whether the course appears in the list of courses. Apart from teachers and administrators, users are not allowed to enter the course.'; $string['visibletostudents'] = 'Visible to {$a}'; $string['warning'] = 'Warning'; $string['warningdeleteresource'] = 'Warning: {$a} is referred in a resource. Would you like to update the resource?'; From 169a974df7d4a7e004ca210dfcca85336081e790 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Wed, 17 Apr 2013 15:11:58 +0800 Subject: [PATCH 2/4] MDL-38415 course: Heavy redesign of the course settings form --- course/edit_form.php | 94 ++++++++++++++++++++++++------------------ lang/en/completion.php | 1 + lang/en/moodle.php | 1 + 3 files changed, 56 insertions(+), 40 deletions(-) diff --git a/course/edit_form.php b/course/edit_form.php index 1cd5b0d818e..2fc377ddce4 100644 --- a/course/edit_form.php +++ b/course/edit_form.php @@ -64,21 +64,6 @@ class course_edit_form extends moodleform { $mform->setConstant('shortname', $course->shortname); } - $mform->addElement('editor','summary_editor', get_string('coursesummary'), null, $editoroptions); - $mform->addHelpButton('summary_editor', 'coursesummary'); - $mform->setType('summary_editor', PARAM_RAW); - $summaryfields = 'summary_editor'; - - if ($overviewfilesoptions = course_overviewfiles_options($course)) { - $mform->addElement('filemanager', 'overviewfiles_filemanager', get_string('courseoverviewfiles'), null, $overviewfilesoptions); - $mform->addHelpButton('overviewfiles_filemanager', 'courseoverviewfiles'); - $summaryfields .= ',overviewfiles_filemanager'; - } - - if (!empty($course->id) and !has_capability('moodle/course:changesummary', $coursecontext)) { - $mform->hardFreeze($summaryfields); - } - // Verify permissions to change course category or keep current. if (empty($course->id)) { if (has_capability('moodle/course:create', $categorycontext)) { @@ -108,14 +93,6 @@ class course_edit_form extends moodleform { } } - $mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100" size="10"'); - $mform->addHelpButton('idnumber', 'idnumbercourse'); - $mform->setType('idnumber', PARAM_RAW); - if (!empty($course->id) and !has_capability('moodle/course:changeidnumber', $coursecontext)) { - $mform->hardFreeze('idnumber'); - $mform->setConstants('idnumber', $course->idnumber); - } - $choices = array(); $choices['0'] = get_string('hide'); $choices['1'] = get_string('show'); @@ -135,27 +112,37 @@ class course_edit_form extends moodleform { $mform->addHelpButton('startdate', 'startdate'); $mform->setDefault('startdate', time() + 3600 * 24); - if (completion_info::is_enabled_for_site()) { - $mform->addElement('select', 'enablecompletion', get_string('completion', 'completion'), - array(0 => get_string('completiondisabled', 'completion'), 1 => get_string('completionenabled', 'completion'))); - $mform->setDefault('enablecompletion', $courseconfig->enablecompletion); - } else { - $mform->addElement('hidden', 'enablecompletion'); - $mform->setType('enablecompletion', PARAM_INT); - $mform->setDefault('enablecompletion',0); + $mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100" size="10"'); + $mform->addHelpButton('idnumber', 'idnumbercourse'); + $mform->setType('idnumber', PARAM_RAW); + if (!empty($course->id) and !has_capability('moodle/course:changeidnumber', $coursecontext)) { + $mform->hardFreeze('idnumber'); + $mform->setConstants('idnumber', $course->idnumber); } - // Handle non-existing $course->maxbytes on course creation. - $coursemaxbytes = !isset($course->maxbytes) ? null : $course->maxbytes; + // Description. + $mform->addElement('header', 'descriptionhdr', get_string('description')); + $mform->setExpanded('descriptionhdr'); - // Let's prepare the maxbytes popup. - $choices = get_max_upload_sizes($CFG->maxbytes, 0, 0, $coursemaxbytes); - $mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices); - $mform->addHelpButton('maxbytes', 'maximumupload'); - $mform->setDefault('maxbytes', $courseconfig->maxbytes); + $mform->addElement('editor','summary_editor', get_string('coursesummary'), null, $editoroptions); + $mform->addHelpButton('summary_editor', 'coursesummary'); + $mform->setType('summary_editor', PARAM_RAW); + $summaryfields = 'summary_editor'; - // Appearance. - $mform->addElement('header', 'appearancehdr', get_string('appearance')); + if ($overviewfilesoptions = course_overviewfiles_options($course)) { + $mform->addElement('filemanager', 'overviewfiles_filemanager', get_string('courseoverviewfiles'), null, $overviewfilesoptions); + $mform->addHelpButton('overviewfiles_filemanager', 'courseoverviewfiles'); + $summaryfields .= ',overviewfiles_filemanager'; + } + + if (!empty($course->id) and !has_capability('moodle/course:changesummary', $coursecontext)) { + // Remove the description header it does not contain anything any more. + $mform->removeElement('descriptionhdr'); + $mform->hardFreeze($summaryfields); + } + + // Course format. + $mform->addElement('header', 'courseformathdr', get_string('type_format', 'plugin')); $courseformats = get_sorted_course_formats(true); $formcourseformats = array(); @@ -183,6 +170,9 @@ class course_edit_form extends moodleform { $mform->addElement('hidden', 'addcourseformatoptionshere'); $mform->setType('addcourseformatoptionshere', PARAM_BOOL); + // Appearance. + $mform->addElement('header', 'appearancehdr', get_string('appearance')); + if (!empty($CFG->allowcoursethemes)) { $themeobjects = get_list_of_themes(); $themes=array(); @@ -214,6 +204,9 @@ class course_edit_form extends moodleform { $mform->addHelpButton('showreports', 'showreports'); $mform->setDefault('showreports', $courseconfig->showreports); + // Files and uploads. + $mform->addElement('header', 'filehdr', get_string('filesanduploads')); + if (!empty($course->legacyfiles) or !empty($CFG->legacyfilesinnewcourses)) { if (empty($course->legacyfiles)) { //0 or missing means no legacy files ever used in this course - new course or nobody turned on legacy files yet @@ -230,6 +223,27 @@ class course_edit_form extends moodleform { $mform->setDefault('legacyfiles', $courseconfig->legacyfiles); } + // Handle non-existing $course->maxbytes on course creation. + $coursemaxbytes = !isset($course->maxbytes) ? null : $course->maxbytes; + + // Let's prepare the maxbytes popup. + $choices = get_max_upload_sizes($CFG->maxbytes, 0, 0, $coursemaxbytes); + $mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices); + $mform->addHelpButton('maxbytes', 'maximumupload'); + $mform->setDefault('maxbytes', $courseconfig->maxbytes); + + // Completion tracking. + if (completion_info::is_enabled_for_site()) { + $mform->addElement('header', 'completionhdr', get_string('completion', 'completion')); + $mform->addElement('selectyesno', 'enablecompletion', get_string('enablecompletion', 'completion')); + $mform->setDefault('enablecompletion', $courseconfig->enablecompletion); + $mform->addHelpButton('enablecompletion', 'enablecompletion', 'completion'); + } else { + $mform->addElement('hidden', 'enablecompletion'); + $mform->setType('enablecompletion', PARAM_INT); + $mform->setDefault('enablecompletion', 0); + } + //-------------------------------------------------------------------------------- enrol_course_edit_form($mform, $course, $context); diff --git a/lang/en/completion.php b/lang/en/completion.php index 8979fa08540..8607b8ae2d1 100644 --- a/lang/en/completion.php +++ b/lang/en/completion.php @@ -72,6 +72,7 @@ $string['configenablecompletion'] = 'When enabled, this lets you turn on complet $string['csvdownload'] = 'Download in spreadsheet format (UTF-8 .csv)'; $string['deletecompletiondata'] = 'Delete completion data'; $string['enablecompletion'] = 'Enable completion tracking'; +$string['enablecompletion_help'] = 'Once enabled, the completion tracking settings are displayed in the completion tracking page, and in the activity settings.'; $string['err_noactivities'] = 'Completion information is not enabled for any activity, so none can be displayed. You can enable completion information by editing the settings for an activity.'; $string['err_nousers'] = 'There are no students on this course or group for whom completion information is displayed. (By default, completion information is displayed only for students, so if there are no students, you will see this error. Administrators can alter this option via the admin screens.)'; $string['err_system'] = 'An internal error occurred in the completion system. (System administrators can enable debugging information to see more detail.)'; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index b77b8d57b73..e9f601349ca 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -676,6 +676,7 @@ $string['fileexists'] = 'There is already a file called {$a}'; $string['filemissing'] = '{$a} is missing'; $string['filetoolarge'] = 'is too large to upload'; $string['files'] = 'Files'; +$string['filesanduploads'] = 'Files and uploads'; $string['filesfolders'] = 'Files/folders'; $string['fileuploadwithcontent'] = 'File uploads should not include the content parameter'; $string['filloutallfields'] = 'Please fill out all fields in this form'; From e1586141347cf2e793aab3ef66fa845cd58280b0 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Thu, 18 Apr 2013 08:29:51 +0800 Subject: [PATCH 3/4] MDL-38415 admin: Reorder default course settings --- admin/settings/courses.php | 105 +++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 38 deletions(-) diff --git a/admin/settings/courses.php b/admin/settings/courses.php index 9100567e015..e751525c193 100644 --- a/admin/settings/courses.php +++ b/admin/settings/courses.php @@ -11,30 +11,77 @@ if ($hassiteconfig $ADMIN->add('courses', new admin_externalpage('coursemgmt', new lang_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/manage.php', array('moodle/category:manage', 'moodle/course:create'))); -/// Course Default Settings Page -/// NOTE: these settings must be applied after all other settings because they depend on them - ///main course settings + // Course Default Settings Page. + // 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'); + + $choices = array(); + $choices['0'] = new lang_string('hide'); + $choices['1'] = new lang_string('show'); + $temp->add(new admin_setting_configselect('moodlecourse/visible', new lang_string('visible'), new lang_string('visible_help'), + 1, $choices)); + + + // Course format. + $temp->add(new admin_setting_heading('courseformathdr', new lang_string('type_format', 'plugin'), '')); + $courseformats = get_sorted_course_formats(true); $formcourseformats = array(); foreach ($courseformats as $courseformat) { $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)); + $temp->add(new admin_setting_configselect('moodlecourse/format', new lang_string('format'), new lang_string('coursehelpformat'), + 'weeks',$formcourseformats)); - $temp->add(new admin_setting_configtext('moodlecourse/maxsections', new lang_string('maxnumberweeks'), new lang_string('maxnumberweeks_desc'), 52)); + $temp->add(new admin_setting_configtext('moodlecourse/maxsections', new lang_string('maxnumberweeks'), + new lang_string('maxnumberweeks_desc'), 52)); - $temp->add(new admin_settings_num_course_sections('moodlecourse/numsections', new lang_string('numberweeks'), new lang_string('coursehelpnumberweeks'), 10)); + $temp->add(new admin_settings_num_course_sections('moodlecourse/numsections', new lang_string('numberweeks'), + new lang_string('coursehelpnumberweeks'), 10)); $choices = array(); $choices['0'] = new lang_string('hiddensectionscollapsed'); $choices['1'] = new lang_string('hiddensectionsinvisible'); - $temp->add(new admin_setting_configselect('moodlecourse/hiddensections', new lang_string('hiddensections'), new lang_string('coursehelphiddensections'), 0,$choices)); + $temp->add(new admin_setting_configselect('moodlecourse/hiddensections', new lang_string('hiddensections'), + new lang_string('coursehelphiddensections'), 0, $choices)); + + $choices = array(); + $choices[COURSE_DISPLAY_SINGLEPAGE] = new lang_string('coursedisplay_single'); + $choices[COURSE_DISPLAY_MULTIPAGE] = new lang_string('coursedisplay_multi'); + $temp->add(new admin_setting_configselect('moodlecourse/coursedisplay', new lang_string('coursedisplay'), + new lang_string('coursedisplay_help'), COURSE_DISPLAY_SINGLEPAGE, $choices)); + + + // Appearance. + $temp->add(new admin_setting_heading('appearancehdr', new lang_string('appearance'), '')); + + $languages = array(); + $languages[''] = new lang_string('forceno'); + $languages += get_string_manager()->get_list_of_translations(); + $temp->add(new admin_setting_configselect('moodlecourse/lang', new lang_string('forcelanguage'), '', key($languages), + $languages)); + $options = range(0, 10); - $temp->add(new admin_setting_configselect('moodlecourse/newsitems', new lang_string('newsitemsnumber'), new lang_string('coursehelpnewsitemsnumber'), 5,$options)); - $temp->add(new admin_setting_configselect('moodlecourse/showgrades', new lang_string('showgrades'), new lang_string('coursehelpshowgrades'), 1,array(0 => new lang_string('no'), 1 => new lang_string('yes')))); - $temp->add(new admin_setting_configselect('moodlecourse/showreports', new lang_string('showreports'), '', 0,array(0 => new lang_string('no'), 1 => new lang_string('yes')))); + $temp->add(new admin_setting_configselect('moodlecourse/newsitems', new lang_string('newsitemsnumber'), + new lang_string('coursehelpnewsitemsnumber'), 5, $options)); + $temp->add(new admin_setting_configselect('moodlecourse/showgrades', new lang_string('showgrades'), + new lang_string('coursehelpshowgrades'), 1, array(0 => new lang_string('no'), 1 => new lang_string('yes')))); + $temp->add(new admin_setting_configselect('moodlecourse/showreports', new lang_string('showreports'), '', 0, + array(0 => new lang_string('no'), 1 => new lang_string('yes')))); + + + // Files and uploads. + $temp->add(new admin_setting_heading('filesanduploadshdr', new lang_string('filesanduploads'), '')); + + if (!empty($CFG->legacyfilesinnewcourses)) { + $choices = array('0'=>new lang_string('no'), '2'=>new lang_string('yes')); + $temp->add(new admin_setting_configselect('moodlecourse/legacyfiles', new lang_string('courselegacyfiles'), + new lang_string('courselegacyfiles_help'), key($choices), $choices)); + } $currentmaxbytes = get_config('moodlecourse', 'maxbytes'); if (isset($CFG->maxbytes)) { @@ -42,18 +89,17 @@ if ($hassiteconfig } else { $choices = get_max_upload_sizes(0, 0, 0, $currentmaxbytes); } - $temp->add(new admin_setting_configselect('moodlecourse/maxbytes', new lang_string('maximumupload'), new lang_string('coursehelpmaximumupload'), key($choices), $choices)); + $temp->add(new admin_setting_configselect('moodlecourse/maxbytes', new lang_string('maximumupload'), + new lang_string('coursehelpmaximumupload'), key($choices), $choices)); - if (!empty($CFG->legacyfilesinnewcourses)) { - $choices = array('0'=>new lang_string('no'), '2'=>new lang_string('yes')); - $temp->add(new admin_setting_configselect('moodlecourse/legacyfiles', new lang_string('courselegacyfiles'), new lang_string('courselegacyfiles_help'), key($choices), $choices)); - } - $choices = array(); - $choices[COURSE_DISPLAY_SINGLEPAGE] = new lang_string('coursedisplay_single'); - $choices[COURSE_DISPLAY_MULTIPAGE] = new lang_string('coursedisplay_multi'); - $temp->add(new admin_setting_configselect('moodlecourse/coursedisplay', new lang_string('coursedisplay'), new lang_string('coursedisplay_help'), COURSE_DISPLAY_SINGLEPAGE, $choices)); + // Completion tracking. + $temp->add(new admin_setting_heading('progress', new lang_string('completion','completion'), '')); + $temp->add(new admin_setting_configselect('moodlecourse/enablecompletion', new lang_string('completion', 'completion'), + new lang_string('enablecompletion_help', 'completion'), 0, array(0 => new lang_string('no'), 1 => new lang_string('yes')))); + + // Groups. $temp->add(new admin_setting_heading('groups', new lang_string('groups', 'group'), '')); $choices = array(); $choices[NOGROUPS] = new lang_string('groupsnone', 'group'); @@ -62,27 +108,10 @@ if ($hassiteconfig $temp->add(new admin_setting_configselect('moodlecourse/groupmode', new lang_string('groupmode'), '', key($choices),$choices)); $temp->add(new admin_setting_configselect('moodlecourse/groupmodeforce', new lang_string('force'), new lang_string('coursehelpforce'), 0,array(0 => new lang_string('no'), 1 => new lang_string('yes')))); - - $temp->add(new admin_setting_heading('availability', new lang_string('availability'), '')); - $choices = array(); - $choices['0'] = new lang_string('courseavailablenot'); - $choices['1'] = new lang_string('courseavailable'); - $temp->add(new admin_setting_configselect('moodlecourse/visible', new lang_string('visible'), '', 1,$choices)); - - - $temp->add(new admin_setting_heading('language', new lang_string('language'), '')); - $languages=array(); - $languages[''] = new lang_string('forceno'); - $languages += get_string_manager()->get_list_of_translations(); - $temp->add(new admin_setting_configselect('moodlecourse/lang', new lang_string('forcelanguage'), '',key($languages),$languages)); - - $temp->add(new admin_setting_heading('progress', new lang_string('progress','completion'), '')); - $temp->add(new admin_setting_configselect('moodlecourse/enablecompletion', new lang_string('completion','completion'), '', - 0, array(0 => new lang_string('completiondisabled','completion'), 1 => new lang_string('completionenabled','completion')))); - $ADMIN->add('courses', $temp); -/// "courserequests" settingpage + + // "courserequests" settingpage. $temp = new admin_settingpage('courserequest', new lang_string('courserequest')); $temp->add(new admin_setting_configcheckbox('enablecourserequests', new lang_string('enablecourserequests', 'admin'), new lang_string('configenablecourserequests', 'admin'), 0)); $temp->add(new admin_settings_coursecat_select('defaultrequestcategory', new lang_string('defaultrequestcategory', 'admin'), new lang_string('configdefaultrequestcategory', 'admin'), 1)); From dfb38e43f784e2e5182a3b95eeddfc7c8f247807 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Tue, 23 Apr 2013 10:11:55 +0800 Subject: [PATCH 4/4] MDL-38415 course: Renaming course overview files to course summary files --- lang/en/moodle.php | 8 ++++---- lang/en/repository.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lang/en/moodle.php b/lang/en/moodle.php index e9f601349ca..66a9f00171f 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -321,10 +321,10 @@ $string['coursehelpnewsitemsnumber'] = 'Number of recent items appearing on the $string['coursehelpnumberweeks'] = 'Number of sections in the course (applies to certain course formats only).'; $string['coursehelpshowgrades'] = 'Enable the display of the gradebook. It does not prevent grades from being displayed within the individual activities.'; $string['coursehidden'] = 'This course is currently unavailable to students'; -$string['courseoverviewfiles'] = 'Course overview files'; -$string['courseoverviewfilesext'] = 'Course overview files extensions'; -$string['courseoverviewfileslimit'] = 'Course overview files limit'; -$string['courseoverviewfiles_help'] = 'Course overview files (usually images) are displayed in the list of courses together with summary'; +$string['courseoverviewfiles'] = 'Course summary files'; +$string['courseoverviewfilesext'] = 'Course summary files extensions'; +$string['courseoverviewfileslimit'] = 'Course summary files limit'; +$string['courseoverviewfiles_help'] = 'Course summary files (usually images) are displayed in the list of courses together with summary'; $string['courseinfo'] = 'Course info'; $string['coursemessage'] = 'Message course users'; $string['coursenotaccessible'] = 'This course does not allow public access'; diff --git a/lang/en/repository.php b/lang/en/repository.php index 443eece1b1c..a99a4c6dfba 100644 --- a/lang/en/repository.php +++ b/lang/en/repository.php @@ -38,7 +38,7 @@ $string['sectionbackup'] = 'Section backups'; $string['activitybackup'] = 'Activity backup'; $string['areacategoryintro'] = 'Category introduction'; $string['areacourseintro'] = 'Course introduction'; -$string['areacourseoverviewfiles'] = 'Course overview files'; +$string['areacourseoverviewfiles'] = 'Course summary files'; $string['arearoot'] = 'System'; $string['areauserdraft'] = 'Drafts'; $string['areauserbackup'] = 'User backup';