MDL-35603 - Backup - Course import selector notice
[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
2c49fb4c 11 $ADMIN->add('courses', new admin_externalpage('coursemgmt', new lang_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/manage.php',
8ed5dd63 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
e106013f 17 $temp = new admin_settingpage('coursesettings', new lang_string('coursesettings'));
3776335c
MG
18 require_once($CFG->dirroot.'/course/lib.php');
19 $courseformats = get_sorted_course_formats(true);
1caea91e 20 $formcourseformats = array();
3776335c 21 foreach ($courseformats as $courseformat) {
e106013f 22 $formcourseformats[$courseformat] = new lang_string('pluginname', "format_$courseformat");
1caea91e 23 }
e106013f 24 $temp->add(new admin_setting_configselect('moodlecourse/format', new lang_string('format'), new lang_string('coursehelpformat'), 'weeks',$formcourseformats));
c141b05f 25
e106013f 26 $temp->add(new admin_setting_configtext('moodlecourse/maxsections', new lang_string('maxnumberweeks'), new lang_string('maxnumberweeks_desc'), 52));
c141b05f 27
e106013f 28 $temp->add(new admin_settings_num_course_sections('moodlecourse/numsections', new lang_string('numberweeks'), new lang_string('coursehelpnumberweeks'), 10));
c141b05f 29
1caea91e 30 $choices = array();
e106013f
SH
31 $choices['0'] = new lang_string('hiddensectionscollapsed');
32 $choices['1'] = new lang_string('hiddensectionsinvisible');
33 $temp->add(new admin_setting_configselect('moodlecourse/hiddensections', new lang_string('hiddensections'), new lang_string('coursehelphiddensections'), 0,$choices));
1caea91e 34 $options = range(0, 10);
e106013f
SH
35 $temp->add(new admin_setting_configselect('moodlecourse/newsitems', new lang_string('newsitemsnumber'), new lang_string('coursehelpnewsitemsnumber'), 5,$options));
36 $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'))));
37 $temp->add(new admin_setting_configselect('moodlecourse/showreports', new lang_string('showreports'), '', 0,array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
c141b05f 38
732c25ad 39 $currentmaxbytes = get_config('moodlecourse', 'maxbytes');
1caea91e 40 if (isset($CFG->maxbytes)) {
732c25ad 41 $choices = get_max_upload_sizes($CFG->maxbytes, 0, 0, $currentmaxbytes);
1caea91e 42 } else {
732c25ad 43 $choices = get_max_upload_sizes(0, 0, 0, $currentmaxbytes);
1caea91e 44 }
e106013f 45 $temp->add(new admin_setting_configselect('moodlecourse/maxbytes', new lang_string('maximumupload'), new lang_string('coursehelpmaximumupload'), key($choices), $choices));
1caea91e 46
532a91d4 47 if (!empty($CFG->legacyfilesinnewcourses)) {
e106013f
SH
48 $choices = array('0'=>new lang_string('no'), '2'=>new lang_string('yes'));
49 $temp->add(new admin_setting_configselect('moodlecourse/legacyfiles', new lang_string('courselegacyfiles'), new lang_string('courselegacyfiles_help'), key($choices), $choices));
532a91d4 50 }
c00280a1 51
79e250db 52 $choices = array();
1f09018a
RL
53 $choices[COURSE_DISPLAY_SINGLEPAGE] = new lang_string('coursedisplay_single');
54 $choices[COURSE_DISPLAY_MULTIPAGE] = new lang_string('coursedisplay_multi');
479fa622
EL
55 $temp->add(new admin_setting_configselect('moodlecourse/coursedisplay', new lang_string('coursedisplay'), new lang_string('coursedisplay_help'), COURSE_DISPLAY_SINGLEPAGE, $choices));
56
e106013f 57 $temp->add(new admin_setting_heading('groups', new lang_string('groups', 'group'), ''));
1caea91e 58 $choices = array();
e106013f
SH
59 $choices[NOGROUPS] = new lang_string('groupsnone', 'group');
60 $choices[SEPARATEGROUPS] = new lang_string('groupsseparate', 'group');
61 $choices[VISIBLEGROUPS] = new lang_string('groupsvisible', 'group');
62 $temp->add(new admin_setting_configselect('moodlecourse/groupmode', new lang_string('groupmode'), '', key($choices),$choices));
63 $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'))));
1caea91e 64
65
e106013f 66 $temp->add(new admin_setting_heading('availability', new lang_string('availability'), ''));
1caea91e 67 $choices = array();
e106013f
SH
68 $choices['0'] = new lang_string('courseavailablenot');
69 $choices['1'] = new lang_string('courseavailable');
70 $temp->add(new admin_setting_configselect('moodlecourse/visible', new lang_string('visible'), '', 1,$choices));
1caea91e 71
72
e106013f 73 $temp->add(new admin_setting_heading('language', new lang_string('language'), ''));
1caea91e 74 $languages=array();
e106013f 75 $languages[''] = new lang_string('forceno');
1f96e907 76 $languages += get_string_manager()->get_list_of_translations();
e106013f 77 $temp->add(new admin_setting_configselect('moodlecourse/lang', new lang_string('forcelanguage'), '',key($languages),$languages));
1caea91e 78
e106013f
SH
79 $temp->add(new admin_setting_heading('progress', new lang_string('progress','completion'), ''));
80 $temp->add(new admin_setting_configselect('moodlecourse/enablecompletion', new lang_string('completion','completion'), '',
81 0, array(0 => new lang_string('completiondisabled','completion'), 1 => new lang_string('completionenabled','completion'))));
2be4d090 82
e106013f 83 $temp->add(new admin_setting_configcheckbox('moodlecourse/completionstartonenrol', new lang_string('completionstartonenrol','completion'), new lang_string('completionstartonenrolhelp', 'completion'), 0));
1caea91e 84 $ADMIN->add('courses', $temp);
eb1b9597 85
86/// "courserequests" settingpage
e106013f
SH
87 $temp = new admin_settingpage('courserequest', new lang_string('courserequest'));
88 $temp->add(new admin_setting_configcheckbox('enablecourserequests', new lang_string('enablecourserequests', 'admin'), new lang_string('configenablecourserequests', 'admin'), 0));
89 $temp->add(new admin_settings_coursecat_select('defaultrequestcategory', new lang_string('defaultrequestcategory', 'admin'), new lang_string('configdefaultrequestcategory', 'admin'), 1));
59b9a140 90 $temp->add(new admin_setting_configcheckbox('requestcategoryselection', new lang_string('requestcategoryselection', 'admin'), new lang_string('configrequestcategoryselection', 'admin'), 0));
e106013f 91 $temp->add(new admin_setting_users_with_capability('courserequestnotify', new lang_string('courserequestnotify', 'admin'), new lang_string('configcourserequestnotify2', 'admin'), array(), 'moodle/site:approvecourse'));
220a90c5 92 $ADMIN->add('courses', $temp);
93
77eddcd5 94/// Pending course requests.
95 if (!empty($CFG->enablecourserequests)) {
e106013f 96 $ADMIN->add('courses', new admin_externalpage('coursespending', new lang_string('pendingrequests'),
77eddcd5 97 $CFG->wwwroot . '/course/pending.php', array('moodle/site:approvecourse')));
98 }
99
61ebef8f 100 // Add a category for backups
e106013f 101 $ADMIN->add('courses', new admin_category('backups', new lang_string('backups','admin')));
61ebef8f 102
14e2704a 103 // Create a page for general backups configuration and defaults.
e106013f 104 $temp = new admin_settingpage('backupgeneralsettings', new lang_string('generalbackdefaults', 'backup'), 'moodle/backup:backupcourse');
14e2704a
EL
105
106 // General configuration section.
107 $temp->add(new admin_setting_configselect('backup/loglifetime', new lang_string('loglifetime', 'backup'), new lang_string('configloglifetime', 'backup'), 30, array(
108 1 => new lang_string('numdays', '', 1),
109 2 => new lang_string('numdays', '', 2),
110 3 => new lang_string('numdays', '', 3),
111 5 => new lang_string('numdays', '', 5),
112 7 => new lang_string('numdays', '', 7),
113 10 => new lang_string('numdays', '', 10),
114 14 => new lang_string('numdays', '', 14),
115 20 => new lang_string('numdays', '', 20),
116 30 => new lang_string('numdays', '', 30),
117 60 => new lang_string('numdays', '', 60),
118 90 => new lang_string('numdays', '', 90),
119 120 => new lang_string('numdays', '', 120),
120 180 => new lang_string('numdays', '', 180),
121 365 => new lang_string('numdays', '', 365)
122 )));
123
124 // General defaults section.
125 $temp->add(new admin_setting_heading('generalsettings', new lang_string('generalsettings', 'backup'), ''));
e106013f
SH
126 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_users', new lang_string('generalusers','backup'), new lang_string('configgeneralusers','backup'), array('value'=>1, 'locked'=>0)));
127 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_anonymize', new lang_string('generalanonymize','backup'), new lang_string('configgeneralanonymize','backup'), array('value'=>0, 'locked'=>0)));
128 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), array('value'=>1, 'locked'=>0)));
e106013f
SH
129 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), array('value'=>1, 'locked'=>0)));
130 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), array('value'=>1, 'locked'=>0)));
131 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), array('value'=>1, 'locked'=>0)));
132 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_comments', new lang_string('generalcomments','backup'), new lang_string('configgeneralcomments','backup'), array('value'=>1, 'locked'=>0)));
133 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_userscompletion', new lang_string('generaluserscompletion','backup'), new lang_string('configgeneraluserscompletion','backup'), array('value'=>1, 'locked'=>0)));
134 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_logs', new lang_string('generallogs','backup'), new lang_string('configgenerallogs','backup'), array('value'=>0, 'locked'=>0)));
135 $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_histories', new lang_string('generalhistories','backup'), new lang_string('configgeneralhistories','backup'), array('value'=>0, 'locked'=>0)));
61ebef8f
SH
136 $ADMIN->add('backups', $temp);
137
c4dbfb2c
RL
138 // Create a page for general import configuration and defaults.
139 $temp = new admin_settingpage('importgeneralsettings', new lang_string('importgeneralsettings', 'backup'), 'moodle/backup:backupcourse');
140 $temp->add(new admin_setting_configtext('backup/import_general_maxresults', new lang_string('importgeneralmaxresults', 'backup'), new lang_string('importgeneralmaxresults_desc', 'backup'), 10));
141 $ADMIN->add('backups', $temp);
142
14e2704a 143 // Create a page for automated backups configuration and defaults.
e106013f 144 $temp = new admin_settingpage('automated', new lang_string('automatedsetup','backup'), 'moodle/backup:backupcourse');
14e2704a
EL
145
146 // Automated configuration section.
e106013f
SH
147 $temp->add(new admin_setting_configselect('backup/backup_auto_active', new lang_string('active'), new lang_string('autoactivedescription', 'backup'), 0, array(
148 0 => new lang_string('autoactivedisabled', 'backup'),
149 1 => new lang_string('autoactiveenabled', 'backup'),
150 2 => new lang_string('autoactivemanual', 'backup')
081c914b 151 )));
bac233d3 152 $temp->add(new admin_setting_special_backupdays());
e106013f
SH
153 $temp->add(new admin_setting_configtime('backup/backup_auto_hour', 'backup_auto_minute', new lang_string('executeat'),
154 new lang_string('backupexecuteathelp'), array('h' => 0, 'm' => 0)));
bac233d3 155 $storageoptions = array(
e106013f
SH
156 0 => new lang_string('storagecourseonly', 'backup'),
157 1 => new lang_string('storageexternalonly', 'backup'),
158 2 => new lang_string('storagecourseandexternal', 'backup')
bac233d3 159 );
e106013f
SH
160 $temp->add(new admin_setting_configselect('backup/backup_auto_storage', new lang_string('automatedstorage', 'backup'), new lang_string('automatedstoragehelp', 'backup'), 0, $storageoptions));
161 $temp->add(new admin_setting_configdirectory('backup/backup_auto_destination', new lang_string('saveto'), new lang_string('backupsavetohelp'), ''));
f1953d38 162 $keepoptoins = array(
e106013f 163 0 => new lang_string('all'), 1 => '1',
f1953d38 164 2 => '2',
165 5 => '5',
166 10 => '10',
167 20 => '20',
168 30 => '30',
169 40 => '40',
170 50 => '50',
171 100 => '100',
172 200 => '200',
173 300 => '300',
174 400 => '400',
175 500 => '500');
e106013f 176 $temp->add(new admin_setting_configselect('backup/backup_auto_keep', new lang_string('keep'), new lang_string('backupkeephelp'), 1, $keepoptoins));
66150286 177 $temp->add(new admin_setting_configcheckbox('backup/backup_shortname', new lang_string('backup_shortname', 'admin'), new lang_string('backup_shortnamehelp', 'admin'), 0));
914442ae
JPG
178 $temp->add(new admin_setting_configcheckbox('backup/backup_auto_skip_hidden', new lang_string('skiphidden', 'backup'), new lang_string('skiphiddenhelp', 'backup'), 1));
179 $temp->add(new admin_setting_configselect('backup/backup_auto_skip_modif_days', new lang_string('skipmodifdays', 'backup'), new lang_string('skipmodifdayshelp', 'backup'), 30, array(
180 0 => new lang_string('never'),
181 1 => new lang_string('numdays', '', 1),
182 2 => new lang_string('numdays', '', 2),
183 3 => new lang_string('numdays', '', 3),
184 5 => new lang_string('numdays', '', 5),
185 7 => new lang_string('numdays', '', 7),
186 10 => new lang_string('numdays', '', 10),
187 14 => new lang_string('numdays', '', 14),
188 20 => new lang_string('numdays', '', 20),
189 30 => new lang_string('numdays', '', 30),
190 60 => new lang_string('numdays', '', 60),
191 90 => new lang_string('numdays', '', 90),
192 120 => new lang_string('numdays', '', 120),
193 180 => new lang_string('numdays', '', 180),
194 365 => new lang_string('numdays', '', 365)
195 )));
196 $temp->add(new admin_setting_configcheckbox('backup/backup_auto_skip_modif_prev', new lang_string('skipmodifprev', 'backup'), new lang_string('skipmodifprevhelp', 'backup'), 0));
6e9cd669 197
14e2704a 198 // Automated defaults section.
e106013f
SH
199 $temp->add(new admin_setting_heading('automatedsettings', new lang_string('automatedsettings','backup'), ''));
200 $temp->add(new admin_setting_configcheckbox('backup/backup_auto_users', new lang_string('generalusers', 'backup'), new lang_string('configgeneralusers', 'backup'), 1));
201 $temp->add(new admin_setting_configcheckbox('backup/backup_auto_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), 1));
e106013f
SH
202 $temp->add(new admin_setting_configcheckbox('backup/backup_auto_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), 1));
203 $temp->add(new admin_setting_configcheckbox('backup/backup_auto_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), 1));
204 $temp->add(new admin_setting_configcheckbox('backup/backup_auto_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), 1));
205 $temp->add(new admin_setting_configcheckbox('backup/backup_auto_comments', new lang_string('generalcomments','backup'), new lang_string('configgeneralcomments','backup'), 1));
206 $temp->add(new admin_setting_configcheckbox('backup/backup_auto_userscompletion', new lang_string('generaluserscompletion','backup'), new lang_string('configgeneraluserscompletion','backup'), 1));
207 $temp->add(new admin_setting_configcheckbox('backup/backup_auto_logs', new lang_string('generallogs', 'backup'), new lang_string('configgenerallogs', 'backup'), 0));
208 $temp->add(new admin_setting_configcheckbox('backup/backup_auto_histories', new lang_string('generalhistories','backup'), new lang_string('configgeneralhistories','backup'), 0));
6e9cd669
EL
209
210
e106013f
SH
211 //$temp->add(new admin_setting_configcheckbox('backup/backup_auto_messages', new lang_string('messages', 'message'), new lang_string('backupmessageshelp','message'), 0));
212 //$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blogs', new lang_string('blogs', 'blog'), new lang_string('backupblogshelp','blog'), 0));
7fb0303d 213
61ebef8f 214 $ADMIN->add('backups', $temp);
a7c72afc 215
a559f630 216} // end of speedup