Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/admin/settings/frontpage.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file defines everything related to frontpage
00004 
00005 if (!during_initial_install()) { //do not use during installation
00006     $frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
00007 
00008     if ($hassiteconfig or has_any_capability(array(
00009             'moodle/course:update',
00010             'moodle/role:assign',
00011             'moodle/restore:restorecourse',
00012             'moodle/backup:backupcourse',
00013             'moodle/course:managefiles',
00014             'moodle/question:add',
00015             'moodle/question:editmine',
00016             'moodle/question:editall',
00017             'moodle/question:viewmine',
00018             'moodle/question:viewall',
00019             'moodle/question:movemine',
00020             'moodle/question:moveall'), $frontpagecontext)) {
00021 
00022         // "frontpage" settingpage
00023         $temp = new admin_settingpage('frontpagesettings', get_string('frontpagesettings','admin'), 'moodle/course:update', false, $frontpagecontext);
00024         $temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', NULL)); // no default
00025         $temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', NULL)); // no default
00026         $temp->add(new admin_setting_special_frontpagedesc());
00027         $temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
00028         $temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
00029 
00030         $options = array();
00031         $options[] = get_string('unlimited');
00032         for ($i=1; $i<100; $i++) {
00033             $options[$i] = $i;
00034         }
00035         $temp->add(new admin_setting_configselect('maxcategorydepth', get_string('configsitemaxcategorydepth','admin'), get_string('configsitemaxcategorydepthhelp','admin'), 0, $options));
00036 
00037         $temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'), get_string('sitesectionhelp','admin'), 1));
00038         $temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'), '', 3,
00039              array('0' => '0',
00040                    '1' => '1',
00041                    '2' => '2',
00042                    '3' => '3',
00043                    '4' => '4',
00044                    '5' => '5',
00045                    '6' => '6',
00046                    '7' => '7',
00047                    '8' => '8',
00048                    '9' => '9',
00049                    '10' => '10')));
00050         $temp->add(new admin_setting_configtext('commentsperpage', get_string('commentsperpage', 'admin'), '', 15, PARAM_INT));
00051 
00052         $temp->add(new admin_setting_configtext('coursesperpage', get_string('coursesperpage', 'admin'), get_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
00053 
00054         // front page default role
00055         $options = array(0=>get_string('none')); // roles to choose from
00056         $defaultfrontpageroleid = 0;
00057         foreach (get_all_roles() as $role) {
00058             if (empty($role->archetype) or $role->archetype === 'guest' or $role->archetype === 'frontpage' or $role->archetype === 'student') {
00059                 $options[$role->id] = strip_tags(format_string($role->name)) . ' ('. $role->shortname . ')';
00060                 if ($role->archetype === 'frontpage') {
00061                     $defaultfrontpageroleid = $role->id;
00062                 }
00063             }
00064         }
00065         if ($defaultfrontpageroleid and (!isset($CFG->defaultfrontpageroleid) or $CFG->defaultfrontpageroleid)) {
00066             //frotpage role may not exist in old upgraded sites
00067             unset($options[0]);
00068         }
00069         $temp->add(new admin_setting_configselect('defaultfrontpageroleid', get_string('frontpagedefaultrole', 'admin'), '', $defaultfrontpageroleid, $options));
00070 
00071 
00072         $ADMIN->add('frontpage', $temp);
00073 
00074         $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));
00075 
00076         $ADMIN->add('frontpage', new admin_externalpage('frontpagefilters', get_string('frontpagefilters', 'admin'), "$CFG->wwwroot/filter/manage.php?contextid=" . $frontpagecontext->id, 'moodle/filter:manage', false, $frontpagecontext));
00077 
00078         $ADMIN->add('frontpage', new admin_externalpage('frontpagebackup', get_string('frontpagebackup', 'admin'), $CFG->wwwroot.'/backup/backup.php?id='.SITEID, 'moodle/backup:backupcourse', false, $frontpagecontext));
00079 
00080         $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));
00081 
00082         $questioncapabilities = array(
00083                 'moodle/question:add',
00084                 'moodle/question:editmine',
00085                 'moodle/question:editall',
00086                 'moodle/question:viewmine',
00087                 'moodle/question:viewall',
00088                 'moodle/question:movemine',
00089                 'moodle/question:moveall');
00090         $ADMIN->add('frontpage', new admin_externalpage('frontpagequestions', get_string('frontpagequestions', 'admin'), $CFG->wwwroot.'/question/edit.php?courseid='.SITEID, $questioncapabilities, false, $frontpagecontext));
00091 
00092         if (!empty($SITE->legacyfiles) and $SITE->legacyfiles === 2) {
00093             $ADMIN->add('frontpage', new admin_externalpage('sitefiles', get_string('sitelegacyfiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID, 'moodle/course:managefiles', false, $frontpagecontext));
00094         }
00095     }
00096 }
 All Data Structures Namespaces Files Functions Variables Enumerations