MDL-21788 use session regeneration on all sites by default and improved string
[moodle.git] / admin / settings / frontpage.php
blob7376ce19a05334060a1a83383a1f8416c07b4fa7
1 <?php // $Id$
3 // This file defines everything related to frontpage
5 if (get_site()) { //do not use during installation
6 $frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
8 if ($hassiteconfig or has_any_capability(array(
9 'moodle/course:update',
10 'moodle/role:assign',
11 'moodle/site:restore',
12 'moodle/site:backup',
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)) {
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
30 $options = array();
31 $options[] = get_string('unlimited');
32 for ($i=1; $i<100; $i++) {
33 $options[$i] = $i;
35 $temp->add(new admin_setting_configselect('maxcategorydepth', get_string('configsitemaxcategorydepth','admin'), get_string('configsitemaxcategorydepthhelp','admin'), 0, $options));
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')));
50 $temp->add(new admin_setting_configtext('coursesperpage', get_string('coursesperpage', 'admin'), get_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
51 $temp->add(new admin_setting_configcheckbox('allowvisiblecoursesinhiddencategories', get_string('allowvisiblecoursesinhiddencategories', 'admin'), get_string('configvisiblecourses', 'admin'), 0));
53 // front page default role
54 $roleoptions = array(0=>get_string('none')); // roles to choose from
55 if ($roles = get_all_roles()) {
56 foreach ($roles as $role) {
57 $roleoptions[$role->id] = strip_tags(format_string($role->name, true));
60 $temp->add(new admin_setting_configselect('defaultfrontpageroleid', get_string('frontpagedefaultrole', 'admin'), '', 0, $roleoptions));
62 $ADMIN->add('frontpage', $temp);
64 $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 $ADMIN->add('frontpage', new admin_externalpage('frontpagebackup', get_string('frontpagebackup', 'admin'), $CFG->wwwroot.'/backup/backup.php?id='.SITEID, 'moodle/site:backup', false, $frontpagecontext));
68 $ADMIN->add('frontpage', new admin_externalpage('frontpagerestore', get_string('frontpagerestore', 'admin'), $CFG->wwwroot.'/files/index.php?id='.SITEID.'&amp;wdir=/backupdata', 'moodle/site:restore', false, $frontpagecontext));
70 $questioncapabilites = array(
71 'moodle/question:add',
72 'moodle/question:editmine',
73 'moodle/question:editall',
74 'moodle/question:viewmine',
75 'moodle/question:viewall',
76 'moodle/question:movemine',
77 'moodle/question:moveall');
78 $ADMIN->add('frontpage', new admin_externalpage('frontpagequestions', get_string('frontpagequestions', 'admin'), $CFG->wwwroot.'/question/edit.php?courseid='.SITEID, $questioncapabilites, false, $frontpagecontext));
80 $ADMIN->add('frontpage', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID, 'moodle/course:managefiles', false, $frontpagecontext));