MDL-24329 reverting previous patch, it should be imo better to not should discouraged...
[moodle.git] / admin / settings / courses.php
CommitLineData
11b749ca 1<?php
a7c72afc 2
3// This file defines settingpages and externalpages under the "courses" category
4
a559f630 5if ($hassiteconfig
d2940003 6 or has_capability('moodle/backup:backupcourse', $systemcontext)
8ed5dd63 7 or has_capability('moodle/category:manage', $systemcontext)
77eddcd5 8 or has_capability('moodle/course:create', $systemcontext)
9 or has_capability('moodle/site:approvecourse', $systemcontext)) { // speedup for non-admins, add all caps used on this page
a559f630 10
8ed5dd63 11 $ADMIN->add('courses', new admin_externalpage('coursemgmt', get_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/index.php?categoryedit=on',
12 array('moodle/category:manage', 'moodle/course:create')));
220a90c5 13
eb1b9597 14/// Course Default Settings Page
dfca83b7 15/// NOTE: these settings must be applied after all other settings because they depend on them
1caea91e 16 ///main course settings
17 $temp = new admin_settingpage('coursesettings', get_string('coursesettings'));
17da2e6f 18 $courseformats = get_plugin_list('format');
1caea91e 19 $formcourseformats = array();
17da2e6f 20 foreach ($courseformats as $courseformat => $courseformatdir) {
ff67afbd 21 $formcourseformats[$courseformat] = get_string('pluginname', "format_$courseformat");
1caea91e 22 }
23 $temp->add(new admin_setting_configselect('moodlecourse/format', get_string('format'), get_string('coursehelpformat'), 'weeks',$formcourseformats));
24 for ($i=1; $i<=52; $i++) {
25 $sectionmenu[$i] = "$i";
26 }
63e3b0d5 27 $temp->add(new admin_setting_configselect('moodlecourse/numsections', get_string('numberweeks'), get_string('coursehelpnumberweeks'), 10,$sectionmenu));
1caea91e 28 $choices = array();
29 $choices['0'] = get_string('hiddensectionscollapsed');
30 $choices['1'] = get_string('hiddensectionsinvisible');
31 $temp->add(new admin_setting_configselect('moodlecourse/hiddensections', get_string('hiddensections'), get_string('coursehelphiddensections'), 0,$choices));
32 $options = range(0, 10);
33 $temp->add(new admin_setting_configselect('moodlecourse/newsitems', get_string('newsitemsnumber'), get_string('coursehelpnewsitemsnumber'), 5,$options));
34 $temp->add(new admin_setting_configselect('moodlecourse/showgrades', get_string('showgrades'), get_string('coursehelpshowgrades'), 1,array(0 => get_string('no'), 1 => get_string('yes'))));
35 $temp->add(new admin_setting_configselect('moodlecourse/showreports', get_string('showreports'), '', 0,array(0 => get_string('no'), 1 => get_string('yes'))));
36 if (isset($CFG->maxbytes)) {
dfca83b7 37 $choices = get_max_upload_sizes($CFG->maxbytes);
1caea91e 38 } else {
39 $choices = get_max_upload_sizes();
40 }
c00280a1 41
1caea91e 42 $temp->add(new admin_setting_configselect('moodlecourse/maxbytes', get_string('maximumupload'), get_string('coursehelpmaximumupload'), key($choices), $choices));
1caea91e 43
c00280a1 44
532a91d4
PS
45 if (!empty($CFG->legacyfilesinnewcourses)) {
46 $choices = array('0'=>get_string('no'), '2'=>get_string('yes'));
47 $temp->add(new admin_setting_configselect('moodlecourse/legacyfiles', get_string('courselegacyfiles'), get_string('courselegacyfiles_help'), key($choices), $choices));
48 }
c00280a1 49
1caea91e 50 $temp->add(new admin_setting_heading('groups', get_string('groups', 'group'), ''));
51 $choices = array();
52 $choices[NOGROUPS] = get_string('groupsnone', 'group');
53 $choices[SEPARATEGROUPS] = get_string('groupsseparate', 'group');
54 $choices[VISIBLEGROUPS] = get_string('groupsvisible', 'group');
55 $temp->add(new admin_setting_configselect('moodlecourse/groupmode', get_string('groupmode'), '', key($choices),$choices));
56 $temp->add(new admin_setting_configselect('moodlecourse/groupmodeforce', get_string('force'), get_string('coursehelpforce'), 0,array(0 => get_string('no'), 1 => get_string('yes'))));
57
58
59 $temp->add(new admin_setting_heading('availability', get_string('availability'), ''));
60 $choices = array();
61 $choices['0'] = get_string('courseavailablenot');
62 $choices['1'] = get_string('courseavailable');
63 $temp->add(new admin_setting_configselect('moodlecourse/visible', get_string('visible'), '', 1,$choices));
1caea91e 64
65
66 $temp->add(new admin_setting_heading('language', get_string('language'), ''));
67 $languages=array();
68 $languages[''] = get_string('forceno');
1f96e907 69 $languages += get_string_manager()->get_list_of_translations();
1caea91e 70 $temp->add(new admin_setting_configselect('moodlecourse/lang', get_string('forcelanguage'), '',key($languages),$languages));
71
2be4d090
MD
72 $temp->add(new admin_setting_heading('progress', get_string('progress','completion'), ''));
73 $temp->add(new admin_setting_configselect('moodlecourse/enablecompletion', get_string('completion','completion'), '',
5da61210 74 0, array(0 => get_string('completiondisabled','completion'), 1 => get_string('completionenabled','completion'))));
2be4d090 75
5da61210 76 $temp->add(new admin_setting_configcheckbox('moodlecourse/completionstartonenrol', get_string('completionstartonenrol','completion'), get_string('completionstartonenrolhelp', 'completion'), 0));
1caea91e 77 $ADMIN->add('courses', $temp);
eb1b9597 78
79/// "courserequests" settingpage
220a90c5 80 $temp = new admin_settingpage('courserequest', get_string('courserequest'));
81 $temp->add(new admin_setting_configcheckbox('enablecourserequests', get_string('enablecourserequests', 'admin'), get_string('configenablecourserequests', 'admin'), 0));
82 $temp->add(new admin_settings_coursecat_select('defaultrequestcategory', get_string('defaultrequestcategory', 'admin'), get_string('configdefaultrequestcategory', 'admin'), 1));
4413941f 83 $temp->add(new admin_setting_users_with_capability('courserequestnotify', get_string('courserequestnotify', 'admin'), get_string('configcourserequestnotify2', 'admin'), array(), 'moodle/site:approvecourse'));
220a90c5 84 $ADMIN->add('courses', $temp);
85
77eddcd5 86/// Pending course requests.
87 if (!empty($CFG->enablecourserequests)) {
88 $ADMIN->add('courses', new admin_externalpage('coursespending', get_string('pendingrequests'),
89 $CFG->wwwroot . '/course/pending.php', array('moodle/site:approvecourse')));
90 }
91
61ebef8f
SH
92 // Add a category for backups
93 $ADMIN->add('courses', new admin_category('backups', get_string('backups','admin')));
94
95 // Create a page for general backup defaults
96 $temp = new admin_settingpage('backupgeneralsettings', get_string('generalbackdefaults', 'backup'), 'moodle/backup:backupcourse');
97 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_users', get_string('generalusers','backup'), get_string('configgeneralusers','backup'), array('value'=>1, 'locked'=>0)));
68949e5d 98 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_anonymize', get_string('generalanonymize','backup'), get_string('configgeneralanonymize','backup'), array('value'=>0, 'locked'=>0)));
61ebef8f
SH
99 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_role_assignments', get_string('generalroleassignments','backup'), get_string('configgeneralroleassignments','backup'), array('value'=>1, 'locked'=>0)));
100 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_user_files', get_string('generaluserfiles','backup'), get_string('configgeneraluserfiles','backup'), array('value'=>1, 'locked'=>0)));
101 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_activities', get_string('generalactivities','backup'), get_string('configgeneralactivities','backup'), array('value'=>1, 'locked'=>0)));
102 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_blocks', get_string('generalblocks','backup'), get_string('configgeneralblocks','backup'), array('value'=>1, 'locked'=>0)));
103 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_filters', get_string('generalfilters','backup'), get_string('configgeneralfilters','backup'), array('value'=>1, 'locked'=>0)));
104 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_comments', get_string('generalcomments','backup'), get_string('configgeneralcomments','backup'), array('value'=>1, 'locked'=>0)));
105 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_userscompletion', get_string('generaluserscompletion','backup'), get_string('configgeneraluserscompletion','backup'), array('value'=>1, 'locked'=>0)));
106 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_logs', get_string('generallogs','backup'), get_string('configgenerallogs','backup'), array('value'=>0, 'locked'=>0)));
107 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_histories', get_string('generalhistories','backup'), get_string('configgeneralhistories','backup'), array('value'=>0, 'locked'=>0)));
108 $ADMIN->add('backups', $temp);
109
eb1b9597 110/// "backups" settingpage
61ebef8f 111 $temp = new admin_settingpage('scheduled', get_string('scheduledsettings','backup'), 'moodle/backup:backupcourse');
f1953d38 112 $temp->add(new admin_setting_configcheckbox('backup/backup_sche_modules', get_string('includemodules'), get_string('backupincludemoduleshelp'), 0));
113 $temp->add(new admin_setting_configcheckbox('backup/backup_sche_withuserdata', get_string('includemoduleuserdata'), get_string('backupincludemoduleuserdatahelp'), 0));
f1953d38 114 $temp->add(new admin_setting_configselect('backup/backup_sche_users', get_string('users'), get_string('backupusershelp'),
115 0, array(0 => get_string('all'), 1 => get_string('course'))));
116 $temp->add(new admin_setting_configcheckbox('backup/backup_sche_logs', get_string('logs'), get_string('backuplogshelp'), 0));
117 $temp->add(new admin_setting_configcheckbox('backup/backup_sche_userfiles', get_string('userfiles'), get_string('backupuserfileshelp'), 0));
118 $temp->add(new admin_setting_configcheckbox('backup/backup_sche_coursefiles', get_string('coursefiles'), get_string('backupcoursefileshelp'), 0));
119 $temp->add(new admin_setting_configcheckbox('backup/backup_sche_sitefiles', get_string('sitefiles'), get_string('backupsitefileshelp'), 0));
120 $temp->add(new admin_setting_configcheckbox('backup_sche_gradebook_history', get_string('gradebookhistories', 'grades'), get_string('backupgradebookhistoryhelp'), 0));
121 $temp->add(new admin_setting_configcheckbox('backup/backup_sche_messages', get_string('messages', 'message'), get_string('backupmessageshelp','message'), 0));
122 $temp->add(new admin_setting_configcheckbox('backup/backup_sche_blogs', get_string('blogs', 'blog'), get_string('backupblogshelp','blog'), 0));
123
124 $keepoptoins = array(
125 0 => get_string('all'), 1 => '1',
126 2 => '2',
127 5 => '5',
128 10 => '10',
129 20 => '20',
130 30 => '30',
131 40 => '40',
132 50 => '50',
133 100 => '100',
134 200 => '200',
135 300 => '300',
136 400 => '400',
137 500 => '500');
138 $temp->add(new admin_setting_configselect('backup/backup_sche_keep', get_string('keep'),
139 get_string('backupkeephelp'), 1, $keepoptoins));
140 $temp->add(new admin_setting_configcheckbox('backup/backup_sche_active', get_string('active'), get_string('backupactivehelp'), 0));
141 $temp->add(new admin_setting_special_backupdays());
142 $temp->add(new admin_setting_configtime('backup/backup_sche_hour', 'backup_sche_minute', get_string('executeat'),
143 get_string('backupexecuteathelp'), array('h' => 0, 'm' => 0)));
144 $temp->add(new admin_setting_configdirectory('backup/backup_sche_destination', get_string('saveto'), get_string('backupsavetohelp'), ''));
7fb0303d 145
61ebef8f 146 $ADMIN->add('backups', $temp);
a7c72afc 147
a559f630 148} // end of speedup