[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/forum/ -> settings.php (source)

   1  <?php
   2  
   3  // This file is part of Moodle - http://moodle.org/
   4  //
   5  // Moodle is free software: you can redistribute it and/or modify
   6  // it under the terms of the GNU General Public License as published by
   7  // the Free Software Foundation, either version 3 of the License, or
   8  // (at your option) any later version.
   9  //
  10  // Moodle is distributed in the hope that it will be useful,
  11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  // GNU General Public License for more details.
  14  //
  15  // You should have received a copy of the GNU General Public License
  16  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  17  
  18  /**
  19   * @package   mod_forum
  20   * @copyright  2009 Petr Skoda (http://skodak.org)
  21   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  22   */
  23  
  24  defined('MOODLE_INTERNAL') || die;
  25  
  26  if ($ADMIN->fulltree) {
  27      require_once($CFG->dirroot.'/mod/forum/lib.php');
  28  
  29      $settings->add(new admin_setting_configselect('forum_displaymode', get_string('displaymode', 'forum'),
  30                         get_string('configdisplaymode', 'forum'), FORUM_MODE_NESTED, forum_get_layout_modes()));
  31  
  32      $settings->add(new admin_setting_configcheckbox('forum_replytouser', get_string('replytouser', 'forum'),
  33                         get_string('configreplytouser', 'forum'), 1));
  34  
  35      // Less non-HTML characters than this is short
  36      $settings->add(new admin_setting_configtext('forum_shortpost', get_string('shortpost', 'forum'),
  37                         get_string('configshortpost', 'forum'), 300, PARAM_INT));
  38  
  39      // More non-HTML characters than this is long
  40      $settings->add(new admin_setting_configtext('forum_longpost', get_string('longpost', 'forum'),
  41                         get_string('configlongpost', 'forum'), 600, PARAM_INT));
  42  
  43      // Number of discussions on a page
  44      $settings->add(new admin_setting_configtext('forum_manydiscussions', get_string('manydiscussions', 'forum'),
  45                         get_string('configmanydiscussions', 'forum'), 100, PARAM_INT));
  46  
  47      if (isset($CFG->maxbytes)) {
  48          $maxbytes = 0;
  49          if (isset($CFG->forum_maxbytes)) {
  50              $maxbytes = $CFG->forum_maxbytes;
  51          }
  52          $settings->add(new admin_setting_configselect('forum_maxbytes', get_string('maxattachmentsize', 'forum'),
  53                             get_string('configmaxbytes', 'forum'), 512000, get_max_upload_sizes($CFG->maxbytes, 0, 0, $maxbytes)));
  54      }
  55  
  56      // Default number of attachments allowed per post in all forums
  57      $settings->add(new admin_setting_configtext('forum_maxattachments', get_string('maxattachments', 'forum'),
  58                         get_string('configmaxattachments', 'forum'), 9, PARAM_INT));
  59  
  60      // Default Read Tracking setting.
  61      $options = array();
  62      $options[FORUM_TRACKING_OPTIONAL] = get_string('trackingoptional', 'forum');
  63      $options[FORUM_TRACKING_OFF] = get_string('trackingoff', 'forum');
  64      $options[FORUM_TRACKING_FORCED] = get_string('trackingon', 'forum');
  65      $settings->add(new admin_setting_configselect('forum_trackingtype', get_string('trackingtype', 'forum'),
  66                         get_string('configtrackingtype', 'forum'), FORUM_TRACKING_OPTIONAL, $options));
  67  
  68      // Default whether user needs to mark a post as read
  69      $settings->add(new admin_setting_configcheckbox('forum_trackreadposts', get_string('trackforum', 'forum'),
  70                         get_string('configtrackreadposts', 'forum'), 1));
  71  
  72      // Default whether user needs to mark a post as read.
  73      $settings->add(new admin_setting_configcheckbox('forum_allowforcedreadtracking', get_string('forcedreadtracking', 'forum'),
  74                         get_string('forcedreadtracking_desc', 'forum'), 0));
  75  
  76      // Default number of days that a post is considered old
  77      $settings->add(new admin_setting_configtext('forum_oldpostdays', get_string('oldpostdays', 'forum'),
  78                         get_string('configoldpostdays', 'forum'), 14, PARAM_INT));
  79  
  80      // Default whether user needs to mark a post as read
  81      $settings->add(new admin_setting_configcheckbox('forum_usermarksread', get_string('usermarksread', 'forum'),
  82                         get_string('configusermarksread', 'forum'), 0));
  83  
  84      $options = array();
  85      for ($i = 0; $i < 24; $i++) {
  86          $options[$i] = sprintf("%02d",$i);
  87      }
  88      // Default time (hour) to execute 'clean_read_records' cron
  89      $settings->add(new admin_setting_configselect('forum_cleanreadtime', get_string('cleanreadtime', 'forum'),
  90                         get_string('configcleanreadtime', 'forum'), 2, $options));
  91  
  92      // Default time (hour) to send digest email
  93      $settings->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'forum'),
  94                         get_string('configdigestmailtime', 'forum'), 17, $options));
  95  
  96      if (empty($CFG->enablerssfeeds)) {
  97          $options = array(0 => get_string('rssglobaldisabled', 'admin'));
  98          $str = get_string('configenablerssfeeds', 'forum').'<br />'.get_string('configenablerssfeedsdisabled2', 'admin');
  99  
 100      } else {
 101          $options = array(0=>get_string('no'), 1=>get_string('yes'));
 102          $str = get_string('configenablerssfeeds', 'forum');
 103      }
 104      $settings->add(new admin_setting_configselect('forum_enablerssfeeds', get_string('enablerssfeeds', 'admin'),
 105                         $str, 0, $options));
 106  
 107      if (!empty($CFG->enablerssfeeds)) {
 108          $options = array(
 109              0 => get_string('none'),
 110              1 => get_string('discussions', 'forum'),
 111              2 => get_string('posts', 'forum')
 112          );
 113          $settings->add(new admin_setting_configselect('forum_rsstype', get_string('rsstypedefault', 'forum'),
 114                  get_string('configrsstypedefault', 'forum'), 0, $options));
 115  
 116          $options = array(
 117              0  => '0',
 118              1  => '1',
 119              2  => '2',
 120              3  => '3',
 121              4  => '4',
 122              5  => '5',
 123              10 => '10',
 124              15 => '15',
 125              20 => '20',
 126              25 => '25',
 127              30 => '30',
 128              40 => '40',
 129              50 => '50'
 130          );
 131          $settings->add(new admin_setting_configselect('forum_rssarticles', get_string('rssarticles', 'forum'),
 132                  get_string('configrssarticlesdefault', 'forum'), 0, $options));
 133      }
 134  
 135      $settings->add(new admin_setting_configcheckbox('forum_enabletimedposts', get_string('timedposts', 'forum'),
 136                         get_string('configenabletimedposts', 'forum'), 1));
 137  }
 138  


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1