[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/admin/settings/ -> frontpage.php (source)

   1  <?php // $Id: frontpage.php,v 1.8.2.3 2007/10/30 10:49:25 tjhunt Exp $
   2  
   3  // This file defines everything related to frontpage
   4  
   5  if (get_site()) { //do not use during installation
   6      $frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
   7  
   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)) {
  21  
  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
  29          $temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'), get_string('sitesectionhelp','admin'), 1));
  30          $temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'), '', 3,
  31               array('0' => '0',
  32                     '1' => '1',
  33                     '2' => '2',
  34                     '3' => '3',
  35                     '4' => '4',
  36                     '5' => '5',
  37                     '6' => '6',
  38                     '7' => '7',
  39                     '8' => '8',
  40                     '9' => '9',
  41                     '10' => '10')));
  42          $temp->add(new admin_setting_configtext('coursesperpage', get_string('coursesperpage', 'admin'), get_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
  43          $temp->add(new admin_setting_configcheckbox('allowvisiblecoursesinhiddencategories', get_string('allowvisiblecoursesinhiddencategories', 'admin'), get_string('configvisiblecourses', 'admin'), 0));
  44  
  45          // front page default role
  46          $roleoptions = array(0=>get_string('none')); // roles to choose from
  47          if ($roles = get_all_roles()) {
  48              foreach ($roles as $role) {
  49                  $roleoptions[$role->id] = strip_tags(format_string($role->name, true));
  50              }
  51          }
  52          $temp->add(new admin_setting_configselect('defaultfrontpageroleid', get_string('frontpagedefaultrole', 'admin'), '', 0, $roleoptions));
  53  
  54          $ADMIN->add('frontpage', $temp);
  55  
  56          $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));
  57  
  58          $ADMIN->add('frontpage', new admin_externalpage('frontpagebackup', get_string('frontpagebackup', 'admin'), $CFG->wwwroot.'/backup/backup.php?id='.SITEID, 'moodle/site:backup', false, $frontpagecontext));
  59  
  60          $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));
  61  
  62          $questioncapabilites = array(
  63                  'moodle/question:add',
  64                  'moodle/question:editmine',
  65                  'moodle/question:editall',
  66                  'moodle/question:viewmine',
  67                  'moodle/question:viewall',
  68                  'moodle/question:movemine',
  69                  'moodle/question:moveall');
  70          $ADMIN->add('frontpage', new admin_externalpage('frontpagequestions', get_string('frontpagequestions', 'admin'), $CFG->wwwroot.'/question/edit.php?courseid='.SITEID, $questioncapabilites, false, $frontpagecontext));
  71  
  72          $ADMIN->add('frontpage', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID, 'moodle/course:managefiles', false, $frontpagecontext));
  73      }
  74  }
  75  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7