MDL-26140 hide unfinished experimental DTL pages
[moodle.git] / admin / settings / frontpage.php
CommitLineData
11b749ca 1<?php
84c8ede0 2
3// This file defines everything related to frontpage
4
d628171f 5if (!during_initial_install()) { //do not use during installation
01e85af9 6 $frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
84c8ede0 7
3fc3ebf2 8 if ($hassiteconfig or has_any_capability(array(
9 'moodle/course:update',
10 'moodle/role:assign',
d2940003
EL
11 'moodle/restore:restorecourse',
12 'moodle/backup:backupcourse',
3fc3ebf2 13 'moodle/course:managefiles',
14 'moodle/question:add',
15 'moodle/question:editmine',
16 'moodle/question:editall',
17 'moodle/question:viewmine',
18 'moodle/question:viewall',
19 'moodle/question:movemine',
20 'moodle/question:moveall'), $frontpagecontext)) {
a559f630 21
8e5da17a 22 // "frontpage" settingpage
23 $temp = new admin_settingpage('frontpagesettings', get_string('frontpagesettings','admin'), 'moodle/course:update', false, $frontpagecontext);
24 $temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', NULL)); // no default
25 $temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', NULL)); // no default
26 $temp->add(new admin_setting_special_frontpagedesc());
27 $temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
28 $temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
11b749ca 29
6bfc7fd5 30 $options = array();
beeee4d2 31 $options[] = get_string('unlimited');
6bfc7fd5 32 for ($i=1; $i<100; $i++) {
33 $options[$i] = $i;
34 }
beeee4d2 35 $temp->add(new admin_setting_configselect('maxcategorydepth', get_string('configsitemaxcategorydepth','admin'), get_string('configsitemaxcategorydepthhelp','admin'), 0, $options));
11b749ca 36
8e5da17a 37 $temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'), get_string('sitesectionhelp','admin'), 1));
38 $temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'), '', 3,
39 array('0' => '0',
40 '1' => '1',
41 '2' => '2',
42 '3' => '3',
43 '4' => '4',
44 '5' => '5',
45 '6' => '6',
46 '7' => '7',
47 '8' => '8',
48 '9' => '9',
49 '10' => '10')));
cf456fbf
DC
50 $temp->add(new admin_setting_configtext('commentsperpage', get_string('commentsperpage', 'admin'), '', 15, PARAM_INT));
51
8e5da17a 52 $temp->add(new admin_setting_configtext('coursesperpage', get_string('coursesperpage', 'admin'), get_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
8e5da17a 53
54 // front page default role
55 $roleoptions = array(0=>get_string('none')); // roles to choose from
997436fa 56 if ($roles = get_all_roles()) {
8e5da17a 57 foreach ($roles as $role) {
c14c08de 58 $roleoptions[$role->id] = strip_tags(format_string($role->name, true));
8e5da17a 59 }
8e5da17a 60 }
0b7a9120 61 $temp->add(new admin_setting_configselect('defaultfrontpageroleid', get_string('frontpagedefaultrole', 'admin'), '', 0, $roleoptions));
8e5da17a 62
63 $ADMIN->add('frontpage', $temp);
64
65 $ADMIN->add('frontpage', new admin_externalpage('frontpageroles', get_string('frontpageroles', 'admin'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . $frontpagecontext->id, 'moodle/role:assign', false, $frontpagecontext));
66
0f74bb01 67 $ADMIN->add('frontpage', new admin_externalpage('frontpagefilters', get_string('frontpagefilters', 'admin'), "$CFG->wwwroot/filter/manage.php?contextid=" . $frontpagecontext->id, 'moodle/filter:manage', false, $frontpagecontext));
68
d2940003 69 $ADMIN->add('frontpage', new admin_externalpage('frontpagebackup', get_string('frontpagebackup', 'admin'), $CFG->wwwroot.'/backup/backup.php?id='.SITEID, 'moodle/backup:backupcourse', false, $frontpagecontext));
8e5da17a 70
d2940003 71 $ADMIN->add('frontpage', new admin_externalpage('frontpagerestore', get_string('frontpagerestore', 'admin'), $CFG->wwwroot.'/files/index.php?id='.SITEID.'&amp;wdir=/backupdata', 'moodle/restore:restorecourse', false, $frontpagecontext));
8e5da17a 72
eab8ed9f 73 $questioncapabilities = array(
60ff0c54 74 'moodle/question:add',
75 'moodle/question:editmine',
76 'moodle/question:editall',
77 'moodle/question:viewmine',
78 'moodle/question:viewall',
79 'moodle/question:movemine',
80 'moodle/question:moveall');
eab8ed9f 81 $ADMIN->add('frontpage', new admin_externalpage('frontpagequestions', get_string('frontpagequestions', 'admin'), $CFG->wwwroot.'/question/edit.php?courseid='.SITEID, $questioncapabilities, false, $frontpagecontext));
60ff0c54 82
69816a5c
PS
83 if (!empty($SITE->legacyfiles) and $SITE->legacyfiles === 2) {
84 $ADMIN->add('frontpage', new admin_externalpage('sitefiles', get_string('sitelegacyfiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID, 'moodle/course:managefiles', false, $frontpagecontext));
85 }
4e1fe7d1 86 }
87}