2006-11-10 03:04:34 +00:00
|
|
|
<?php
|
2009-12-10 03:11:18 +00:00
|
|
|
|
|
|
|
// This file is part of Moodle - http://moodle.org/
|
|
|
|
//
|
|
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @package mod-forum
|
|
|
|
* @copyright Jamie Pratt <me@jamiep.org>
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
|
*/
|
|
|
|
|
2007-06-10 23:20:45 +00:00
|
|
|
require_once ($CFG->dirroot.'/course/moodleform_mod.php');
|
2006-11-24 06:39:15 +00:00
|
|
|
|
2006-12-28 09:32:45 +00:00
|
|
|
class mod_forum_mod_form extends moodleform_mod {
|
2006-11-10 03:04:34 +00:00
|
|
|
|
2007-05-08 16:11:58 +00:00
|
|
|
function definition() {
|
2008-06-01 21:36:11 +00:00
|
|
|
global $CFG, $COURSE, $DB;
|
2006-11-10 03:04:34 +00:00
|
|
|
|
2007-05-08 16:11:58 +00:00
|
|
|
$mform =& $this->_form;
|
2006-11-10 03:04:34 +00:00
|
|
|
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
$mform->addElement('header', 'general', get_string('general', 'form'));
|
|
|
|
|
2007-01-11 19:47:08 +00:00
|
|
|
$mform->addElement('text', 'name', get_string('forumname', 'forum'), array('size'=>'64'));
|
2008-07-26 15:15:25 +00:00
|
|
|
if (!empty($CFG->formatstringstriptags)) {
|
2008-07-28 12:31:29 +00:00
|
|
|
$mform->setType('name', PARAM_TEXT);
|
2008-07-26 15:15:25 +00:00
|
|
|
} else {
|
|
|
|
$mform->setType('name', PARAM_CLEAN);
|
|
|
|
}
|
2007-05-08 16:11:58 +00:00
|
|
|
$mform->addRule('name', null, 'required', null, 'client');
|
2008-07-18 13:19:55 +00:00
|
|
|
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
2006-11-10 03:04:34 +00:00
|
|
|
|
2008-02-13 17:03:25 +00:00
|
|
|
$forum_types = forum_get_forum_types();
|
|
|
|
|
|
|
|
asort($forum_types);
|
|
|
|
$mform->addElement('select', 'type', get_string('forumtype', 'forum'), $forum_types);
|
MDL-21695 Forum module now uses new help strings
AMOS BEGIN
HLP forum/assessaggregate.html,[aggregatetype_help,mod_forum]
HLP forum/attachment2.html,[attachment_help,mod_forum]
HLP forum/displayperiod.html,[displaystart_help,mod_forum]
HLP forum/displayperiod.html,[displayend_help,mod_forum]
HLP forum/forumtype.html,[forumtype_help,mod_forum]
HLP forum/forumtypenews.html,[namenews_help,mod_forum]
HLP forum/manageposts.html,[blockperiod_help,mod_forum]
HLP forum/manageposts.html,[blockafter_help,mod_forum]
HLP forum/manageposts.html,[warnafter_help,mod_forum]
HLP forum/maxattachments.html,[maxattachments_help,mod_forum]
HLP forum/maxattachmentsize.html,[maxattachmentsize_help,mod_forum]
HLP forum/mods.html,[modulename_help,mod_forum]
HLP forum/ratings.html,[separatedandconnectedinfo,core]
HLP forum/rssarticles.html,[rssarticles_help,mod_forum]
HLP forum/rsstype.html,[rsstype_help,mod_forum]
HLP forum/subscription2.html,[subscriptionmode_help,mod_forum]
HLP forum/subscription.html,[subscription_help,mod_forum]
HLP forum/trackingtype.html,[trackingtype_help,mod_forum]
AMOS END
2010-04-30 16:35:55 +00:00
|
|
|
$mform->addHelpButton('type', 'forumtype', 'forum');
|
2007-05-08 16:11:58 +00:00
|
|
|
$mform->setDefault('type', 'general');
|
2006-11-10 03:04:34 +00:00
|
|
|
|
2009-04-22 04:46:04 +00:00
|
|
|
$this->add_intro_editor(true, get_string('forumintro', 'forum'));
|
2008-09-15 15:55:11 +00:00
|
|
|
|
2006-11-10 03:04:34 +00:00
|
|
|
$options = array();
|
2010-04-21 08:05:03 +00:00
|
|
|
$options[FORUM_CHOOSESUBSCRIBE] = get_string('subscriptionoptional', 'forum');
|
|
|
|
$options[FORUM_FORCESUBSCRIBE] = get_string('subscriptionforced', 'forum');
|
|
|
|
$options[FORUM_INITIALSUBSCRIBE] = get_string('subscriptionauto', 'forum');
|
|
|
|
$options[FORUM_DISALLOWSUBSCRIBE] = get_string('subscriptiondisabled','forum');
|
|
|
|
$mform->addElement('select', 'forcesubscribe', get_string('subscriptionmode', 'forum'), $options);
|
MDL-21695 Forum module now uses new help strings
AMOS BEGIN
HLP forum/assessaggregate.html,[aggregatetype_help,mod_forum]
HLP forum/attachment2.html,[attachment_help,mod_forum]
HLP forum/displayperiod.html,[displaystart_help,mod_forum]
HLP forum/displayperiod.html,[displayend_help,mod_forum]
HLP forum/forumtype.html,[forumtype_help,mod_forum]
HLP forum/forumtypenews.html,[namenews_help,mod_forum]
HLP forum/manageposts.html,[blockperiod_help,mod_forum]
HLP forum/manageposts.html,[blockafter_help,mod_forum]
HLP forum/manageposts.html,[warnafter_help,mod_forum]
HLP forum/maxattachments.html,[maxattachments_help,mod_forum]
HLP forum/maxattachmentsize.html,[maxattachmentsize_help,mod_forum]
HLP forum/mods.html,[modulename_help,mod_forum]
HLP forum/ratings.html,[separatedandconnectedinfo,core]
HLP forum/rssarticles.html,[rssarticles_help,mod_forum]
HLP forum/rsstype.html,[rsstype_help,mod_forum]
HLP forum/subscription2.html,[subscriptionmode_help,mod_forum]
HLP forum/subscription.html,[subscription_help,mod_forum]
HLP forum/trackingtype.html,[trackingtype_help,mod_forum]
AMOS END
2010-04-30 16:35:55 +00:00
|
|
|
$mform->addHelpButton('forcesubscribe', 'subscriptionmode', 'forum');
|
2006-11-10 03:04:34 +00:00
|
|
|
|
|
|
|
$options = array();
|
|
|
|
$options[FORUM_TRACKING_OPTIONAL] = get_string('trackingoptional', 'forum');
|
|
|
|
$options[FORUM_TRACKING_OFF] = get_string('trackingoff', 'forum');
|
|
|
|
$options[FORUM_TRACKING_ON] = get_string('trackingon', 'forum');
|
|
|
|
$mform->addElement('select', 'trackingtype', get_string('trackingtype', 'forum'), $options);
|
MDL-21695 Forum module now uses new help strings
AMOS BEGIN
HLP forum/assessaggregate.html,[aggregatetype_help,mod_forum]
HLP forum/attachment2.html,[attachment_help,mod_forum]
HLP forum/displayperiod.html,[displaystart_help,mod_forum]
HLP forum/displayperiod.html,[displayend_help,mod_forum]
HLP forum/forumtype.html,[forumtype_help,mod_forum]
HLP forum/forumtypenews.html,[namenews_help,mod_forum]
HLP forum/manageposts.html,[blockperiod_help,mod_forum]
HLP forum/manageposts.html,[blockafter_help,mod_forum]
HLP forum/manageposts.html,[warnafter_help,mod_forum]
HLP forum/maxattachments.html,[maxattachments_help,mod_forum]
HLP forum/maxattachmentsize.html,[maxattachmentsize_help,mod_forum]
HLP forum/mods.html,[modulename_help,mod_forum]
HLP forum/ratings.html,[separatedandconnectedinfo,core]
HLP forum/rssarticles.html,[rssarticles_help,mod_forum]
HLP forum/rsstype.html,[rsstype_help,mod_forum]
HLP forum/subscription2.html,[subscriptionmode_help,mod_forum]
HLP forum/subscription.html,[subscription_help,mod_forum]
HLP forum/trackingtype.html,[trackingtype_help,mod_forum]
AMOS END
2010-04-30 16:35:55 +00:00
|
|
|
$mform->addHelpButton('trackingtype', 'trackingtype', 'forum');
|
2006-11-10 03:04:34 +00:00
|
|
|
|
2006-11-13 07:52:01 +00:00
|
|
|
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
|
2006-11-10 03:04:34 +00:00
|
|
|
$choices[1] = get_string('uploadnotallowed');
|
2006-11-13 07:52:01 +00:00
|
|
|
$choices[0] = get_string('courseuploadlimit') . ' ('.display_size($COURSE->maxbytes).')';
|
2006-11-10 03:04:34 +00:00
|
|
|
$mform->addElement('select', 'maxbytes', get_string('maxattachmentsize', 'forum'), $choices);
|
MDL-21695 Forum module now uses new help strings
AMOS BEGIN
HLP forum/assessaggregate.html,[aggregatetype_help,mod_forum]
HLP forum/attachment2.html,[attachment_help,mod_forum]
HLP forum/displayperiod.html,[displaystart_help,mod_forum]
HLP forum/displayperiod.html,[displayend_help,mod_forum]
HLP forum/forumtype.html,[forumtype_help,mod_forum]
HLP forum/forumtypenews.html,[namenews_help,mod_forum]
HLP forum/manageposts.html,[blockperiod_help,mod_forum]
HLP forum/manageposts.html,[blockafter_help,mod_forum]
HLP forum/manageposts.html,[warnafter_help,mod_forum]
HLP forum/maxattachments.html,[maxattachments_help,mod_forum]
HLP forum/maxattachmentsize.html,[maxattachmentsize_help,mod_forum]
HLP forum/mods.html,[modulename_help,mod_forum]
HLP forum/ratings.html,[separatedandconnectedinfo,core]
HLP forum/rssarticles.html,[rssarticles_help,mod_forum]
HLP forum/rsstype.html,[rsstype_help,mod_forum]
HLP forum/subscription2.html,[subscriptionmode_help,mod_forum]
HLP forum/subscription.html,[subscription_help,mod_forum]
HLP forum/trackingtype.html,[trackingtype_help,mod_forum]
AMOS END
2010-04-30 16:35:55 +00:00
|
|
|
$mform->addHelpButton('maxbytes', 'maxattachmentsize', 'forum');
|
2007-05-08 16:11:58 +00:00
|
|
|
$mform->setDefault('maxbytes', $CFG->forum_maxbytes);
|
2006-11-10 03:04:34 +00:00
|
|
|
|
2008-09-08 05:46:42 +00:00
|
|
|
$choices = array(0,1,2,3,4,5,6,7,8,9);
|
|
|
|
$mform->addElement('select', 'maxattachments', get_string('maxattachments', 'forum'), $choices);
|
MDL-21695 Forum module now uses new help strings
AMOS BEGIN
HLP forum/assessaggregate.html,[aggregatetype_help,mod_forum]
HLP forum/attachment2.html,[attachment_help,mod_forum]
HLP forum/displayperiod.html,[displaystart_help,mod_forum]
HLP forum/displayperiod.html,[displayend_help,mod_forum]
HLP forum/forumtype.html,[forumtype_help,mod_forum]
HLP forum/forumtypenews.html,[namenews_help,mod_forum]
HLP forum/manageposts.html,[blockperiod_help,mod_forum]
HLP forum/manageposts.html,[blockafter_help,mod_forum]
HLP forum/manageposts.html,[warnafter_help,mod_forum]
HLP forum/maxattachments.html,[maxattachments_help,mod_forum]
HLP forum/maxattachmentsize.html,[maxattachmentsize_help,mod_forum]
HLP forum/mods.html,[modulename_help,mod_forum]
HLP forum/ratings.html,[separatedandconnectedinfo,core]
HLP forum/rssarticles.html,[rssarticles_help,mod_forum]
HLP forum/rsstype.html,[rsstype_help,mod_forum]
HLP forum/subscription2.html,[subscriptionmode_help,mod_forum]
HLP forum/subscription.html,[subscription_help,mod_forum]
HLP forum/trackingtype.html,[trackingtype_help,mod_forum]
AMOS END
2010-04-30 16:35:55 +00:00
|
|
|
$mform->addHelpButton('maxattachments', 'maxattachments', 'forum');
|
2008-09-08 05:46:42 +00:00
|
|
|
$mform->setDefault('maxattachments', $CFG->forum_maxattachments);
|
|
|
|
|
2006-11-10 03:04:34 +00:00
|
|
|
if ($CFG->enablerssfeeds && isset($CFG->forum_enablerssfeeds) && $CFG->forum_enablerssfeeds) {
|
2006-11-13 07:52:01 +00:00
|
|
|
//-------------------------------------------------------------------------------
|
2006-11-10 03:04:34 +00:00
|
|
|
$mform->addElement('header', '', get_string('rss'));
|
|
|
|
$choices = array();
|
|
|
|
$choices[0] = get_string('none');
|
|
|
|
$choices[1] = get_string('discussions', 'forum');
|
|
|
|
$choices[2] = get_string('posts', 'forum');
|
|
|
|
$mform->addElement('select', 'rsstype', get_string('rsstype'), $choices);
|
MDL-21695 Forum module now uses new help strings
AMOS BEGIN
HLP forum/assessaggregate.html,[aggregatetype_help,mod_forum]
HLP forum/attachment2.html,[attachment_help,mod_forum]
HLP forum/displayperiod.html,[displaystart_help,mod_forum]
HLP forum/displayperiod.html,[displayend_help,mod_forum]
HLP forum/forumtype.html,[forumtype_help,mod_forum]
HLP forum/forumtypenews.html,[namenews_help,mod_forum]
HLP forum/manageposts.html,[blockperiod_help,mod_forum]
HLP forum/manageposts.html,[blockafter_help,mod_forum]
HLP forum/manageposts.html,[warnafter_help,mod_forum]
HLP forum/maxattachments.html,[maxattachments_help,mod_forum]
HLP forum/maxattachmentsize.html,[maxattachmentsize_help,mod_forum]
HLP forum/mods.html,[modulename_help,mod_forum]
HLP forum/ratings.html,[separatedandconnectedinfo,core]
HLP forum/rssarticles.html,[rssarticles_help,mod_forum]
HLP forum/rsstype.html,[rsstype_help,mod_forum]
HLP forum/subscription2.html,[subscriptionmode_help,mod_forum]
HLP forum/subscription.html,[subscription_help,mod_forum]
HLP forum/trackingtype.html,[trackingtype_help,mod_forum]
AMOS END
2010-04-30 16:35:55 +00:00
|
|
|
$mform->addHelpButton('rsstype', 'rsstype', 'forum');
|
2006-11-10 03:04:34 +00:00
|
|
|
|
|
|
|
$choices = array();
|
|
|
|
$choices[0] = '0';
|
|
|
|
$choices[1] = '1';
|
|
|
|
$choices[2] = '2';
|
|
|
|
$choices[3] = '3';
|
|
|
|
$choices[4] = '4';
|
|
|
|
$choices[5] = '5';
|
|
|
|
$choices[10] = '10';
|
|
|
|
$choices[15] = '15';
|
|
|
|
$choices[20] = '20';
|
|
|
|
$choices[25] = '25';
|
|
|
|
$choices[30] = '30';
|
|
|
|
$choices[40] = '40';
|
|
|
|
$choices[50] = '50';
|
|
|
|
$mform->addElement('select', 'rssarticles', get_string('rssarticles'), $choices);
|
MDL-21695 Forum module now uses new help strings
AMOS BEGIN
HLP forum/assessaggregate.html,[aggregatetype_help,mod_forum]
HLP forum/attachment2.html,[attachment_help,mod_forum]
HLP forum/displayperiod.html,[displaystart_help,mod_forum]
HLP forum/displayperiod.html,[displayend_help,mod_forum]
HLP forum/forumtype.html,[forumtype_help,mod_forum]
HLP forum/forumtypenews.html,[namenews_help,mod_forum]
HLP forum/manageposts.html,[blockperiod_help,mod_forum]
HLP forum/manageposts.html,[blockafter_help,mod_forum]
HLP forum/manageposts.html,[warnafter_help,mod_forum]
HLP forum/maxattachments.html,[maxattachments_help,mod_forum]
HLP forum/maxattachmentsize.html,[maxattachmentsize_help,mod_forum]
HLP forum/mods.html,[modulename_help,mod_forum]
HLP forum/ratings.html,[separatedandconnectedinfo,core]
HLP forum/rssarticles.html,[rssarticles_help,mod_forum]
HLP forum/rsstype.html,[rsstype_help,mod_forum]
HLP forum/subscription2.html,[subscriptionmode_help,mod_forum]
HLP forum/subscription.html,[subscription_help,mod_forum]
HLP forum/trackingtype.html,[trackingtype_help,mod_forum]
AMOS END
2010-04-30 16:35:55 +00:00
|
|
|
$mform->addHelpButton('rssarticles', 'rssarticles', 'forum');
|
2006-11-10 03:04:34 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 07:52:01 +00:00
|
|
|
//-------------------------------------------------------------------------------
|
2006-11-10 03:04:34 +00:00
|
|
|
$mform->addElement('header', '', get_string('blockafter', 'forum'));
|
2007-05-08 16:11:58 +00:00
|
|
|
$options = array();
|
2006-11-10 03:04:34 +00:00
|
|
|
$options[0] = get_string('blockperioddisabled','forum');
|
|
|
|
$options[60*60*24] = '1 '.get_string('day');
|
|
|
|
$options[60*60*24*2] = '2 '.get_string('days');
|
|
|
|
$options[60*60*24*3] = '3 '.get_string('days');
|
|
|
|
$options[60*60*24*4] = '4 '.get_string('days');
|
|
|
|
$options[60*60*24*5] = '5 '.get_string('days');
|
|
|
|
$options[60*60*24*6] = '6 '.get_string('days');
|
|
|
|
$options[60*60*24*7] = '1 '.get_string('week');
|
MDL-21695 Forum module now uses new help strings
AMOS BEGIN
HLP forum/assessaggregate.html,[aggregatetype_help,mod_forum]
HLP forum/attachment2.html,[attachment_help,mod_forum]
HLP forum/displayperiod.html,[displaystart_help,mod_forum]
HLP forum/displayperiod.html,[displayend_help,mod_forum]
HLP forum/forumtype.html,[forumtype_help,mod_forum]
HLP forum/forumtypenews.html,[namenews_help,mod_forum]
HLP forum/manageposts.html,[blockperiod_help,mod_forum]
HLP forum/manageposts.html,[blockafter_help,mod_forum]
HLP forum/manageposts.html,[warnafter_help,mod_forum]
HLP forum/maxattachments.html,[maxattachments_help,mod_forum]
HLP forum/maxattachmentsize.html,[maxattachmentsize_help,mod_forum]
HLP forum/mods.html,[modulename_help,mod_forum]
HLP forum/ratings.html,[separatedandconnectedinfo,core]
HLP forum/rssarticles.html,[rssarticles_help,mod_forum]
HLP forum/rsstype.html,[rsstype_help,mod_forum]
HLP forum/subscription2.html,[subscriptionmode_help,mod_forum]
HLP forum/subscription.html,[subscription_help,mod_forum]
HLP forum/trackingtype.html,[trackingtype_help,mod_forum]
AMOS END
2010-04-30 16:35:55 +00:00
|
|
|
$mform->addElement('select', 'blockperiod', get_string('blockperiod', 'forum'), $options);
|
|
|
|
$mform->addHelpButton('blockperiod', 'blockperiod', 'forum');
|
2006-11-10 03:04:34 +00:00
|
|
|
|
2007-05-08 16:11:58 +00:00
|
|
|
$mform->addElement('text', 'blockafter', get_string('blockafter', 'forum'));
|
|
|
|
$mform->setType('blockafter', PARAM_INT);
|
|
|
|
$mform->setDefault('blockafter', '0');
|
|
|
|
$mform->addRule('blockafter', null, 'numeric', null, 'client');
|
MDL-21695 Forum module now uses new help strings
AMOS BEGIN
HLP forum/assessaggregate.html,[aggregatetype_help,mod_forum]
HLP forum/attachment2.html,[attachment_help,mod_forum]
HLP forum/displayperiod.html,[displaystart_help,mod_forum]
HLP forum/displayperiod.html,[displayend_help,mod_forum]
HLP forum/forumtype.html,[forumtype_help,mod_forum]
HLP forum/forumtypenews.html,[namenews_help,mod_forum]
HLP forum/manageposts.html,[blockperiod_help,mod_forum]
HLP forum/manageposts.html,[blockafter_help,mod_forum]
HLP forum/manageposts.html,[warnafter_help,mod_forum]
HLP forum/maxattachments.html,[maxattachments_help,mod_forum]
HLP forum/maxattachmentsize.html,[maxattachmentsize_help,mod_forum]
HLP forum/mods.html,[modulename_help,mod_forum]
HLP forum/ratings.html,[separatedandconnectedinfo,core]
HLP forum/rssarticles.html,[rssarticles_help,mod_forum]
HLP forum/rsstype.html,[rsstype_help,mod_forum]
HLP forum/subscription2.html,[subscriptionmode_help,mod_forum]
HLP forum/subscription.html,[subscription_help,mod_forum]
HLP forum/trackingtype.html,[trackingtype_help,mod_forum]
AMOS END
2010-04-30 16:35:55 +00:00
|
|
|
$mform->addHelpButton('blockafter', 'blockafter', 'forum');
|
2007-05-08 16:11:58 +00:00
|
|
|
$mform->disabledIf('blockafter', 'blockperiod', 'eq', 0);
|
2006-11-21 11:02:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
$mform->addElement('text', 'warnafter', get_string('warnafter', 'forum'));
|
2007-05-08 16:11:58 +00:00
|
|
|
$mform->setType('warnafter', PARAM_INT);
|
|
|
|
$mform->setDefault('warnafter', '0');
|
|
|
|
$mform->addRule('warnafter', null, 'numeric', null, 'client');
|
MDL-21695 Forum module now uses new help strings
AMOS BEGIN
HLP forum/assessaggregate.html,[aggregatetype_help,mod_forum]
HLP forum/attachment2.html,[attachment_help,mod_forum]
HLP forum/displayperiod.html,[displaystart_help,mod_forum]
HLP forum/displayperiod.html,[displayend_help,mod_forum]
HLP forum/forumtype.html,[forumtype_help,mod_forum]
HLP forum/forumtypenews.html,[namenews_help,mod_forum]
HLP forum/manageposts.html,[blockperiod_help,mod_forum]
HLP forum/manageposts.html,[blockafter_help,mod_forum]
HLP forum/manageposts.html,[warnafter_help,mod_forum]
HLP forum/maxattachments.html,[maxattachments_help,mod_forum]
HLP forum/maxattachmentsize.html,[maxattachmentsize_help,mod_forum]
HLP forum/mods.html,[modulename_help,mod_forum]
HLP forum/ratings.html,[separatedandconnectedinfo,core]
HLP forum/rssarticles.html,[rssarticles_help,mod_forum]
HLP forum/rsstype.html,[rsstype_help,mod_forum]
HLP forum/subscription2.html,[subscriptionmode_help,mod_forum]
HLP forum/subscription.html,[subscription_help,mod_forum]
HLP forum/trackingtype.html,[trackingtype_help,mod_forum]
AMOS END
2010-04-30 16:35:55 +00:00
|
|
|
$mform->addHelpButton('warnafter', 'warnafter', 'forum');
|
2007-05-08 16:11:58 +00:00
|
|
|
$mform->disabledIf('warnafter', 'blockperiod', 'eq', 0);
|
2006-11-21 11:02:13 +00:00
|
|
|
|
2006-11-13 07:52:01 +00:00
|
|
|
//-------------------------------------------------------------------------------
|
2009-04-21 08:57:20 +00:00
|
|
|
$this->standard_coursemodule_elements();
|
2006-12-19 07:03:08 +00:00
|
|
|
//-------------------------------------------------------------------------------
|
2007-05-08 16:11:58 +00:00
|
|
|
// buttons
|
2006-12-19 07:03:08 +00:00
|
|
|
$this->add_action_buttons();
|
2006-11-10 03:04:34 +00:00
|
|
|
|
2007-05-08 16:11:58 +00:00
|
|
|
}
|
2006-11-10 03:04:34 +00:00
|
|
|
|
2009-04-22 04:46:04 +00:00
|
|
|
function definition_after_data() {
|
2007-11-17 16:53:39 +00:00
|
|
|
parent::definition_after_data();
|
|
|
|
$mform =& $this->_form;
|
|
|
|
$type =& $mform->getElement('type');
|
|
|
|
$typevalue = $mform->getElementValue('type');
|
|
|
|
|
2006-11-12 11:07:12 +00:00
|
|
|
//we don't want to have these appear as possible selections in the form but
|
|
|
|
//we want the form to display them if they are set.
|
2009-04-22 04:46:04 +00:00
|
|
|
if ($typevalue[0]=='news') {
|
2006-11-12 11:07:12 +00:00
|
|
|
$type->addOption(get_string('namenews', 'forum'), 'news');
|
MDL-21695 Forum module now uses new help strings
AMOS BEGIN
HLP forum/assessaggregate.html,[aggregatetype_help,mod_forum]
HLP forum/attachment2.html,[attachment_help,mod_forum]
HLP forum/displayperiod.html,[displaystart_help,mod_forum]
HLP forum/displayperiod.html,[displayend_help,mod_forum]
HLP forum/forumtype.html,[forumtype_help,mod_forum]
HLP forum/forumtypenews.html,[namenews_help,mod_forum]
HLP forum/manageposts.html,[blockperiod_help,mod_forum]
HLP forum/manageposts.html,[blockafter_help,mod_forum]
HLP forum/manageposts.html,[warnafter_help,mod_forum]
HLP forum/maxattachments.html,[maxattachments_help,mod_forum]
HLP forum/maxattachmentsize.html,[maxattachmentsize_help,mod_forum]
HLP forum/mods.html,[modulename_help,mod_forum]
HLP forum/ratings.html,[separatedandconnectedinfo,core]
HLP forum/rssarticles.html,[rssarticles_help,mod_forum]
HLP forum/rsstype.html,[rsstype_help,mod_forum]
HLP forum/subscription2.html,[subscriptionmode_help,mod_forum]
HLP forum/subscription.html,[subscription_help,mod_forum]
HLP forum/trackingtype.html,[trackingtype_help,mod_forum]
AMOS END
2010-04-30 16:35:55 +00:00
|
|
|
$mform->addHelpButton('type', 'namenews', 'forum');
|
2006-11-12 11:07:12 +00:00
|
|
|
$type->freeze();
|
|
|
|
$type->setPersistantFreeze(true);
|
|
|
|
}
|
2009-04-22 04:46:04 +00:00
|
|
|
if ($typevalue[0]=='social') {
|
2006-11-12 11:07:12 +00:00
|
|
|
$type->addOption(get_string('namesocial', 'forum'), 'social');
|
2006-11-10 03:04:34 +00:00
|
|
|
$type->freeze();
|
|
|
|
$type->setPersistantFreeze(true);
|
|
|
|
}
|
2006-11-23 09:38:33 +00:00
|
|
|
|
2007-05-08 16:11:58 +00:00
|
|
|
}
|
2006-11-10 03:04:34 +00:00
|
|
|
|
2009-04-22 04:46:04 +00:00
|
|
|
function data_preprocessing(&$default_values) {
|
2008-07-28 12:31:29 +00:00
|
|
|
// Set up the completion checkboxes which aren't part of standard data.
|
|
|
|
// We also make the default value (if you turn on the checkbox) for those
|
|
|
|
// numbers to be 1, this will not apply unless checkbox is ticked.
|
|
|
|
$default_values['completiondiscussionsenabled']=
|
|
|
|
!empty($default_values['completiondiscussions']) ? 1 : 0;
|
2009-04-22 04:46:04 +00:00
|
|
|
if (empty($default_values['completiondiscussions'])) {
|
2008-07-28 12:31:29 +00:00
|
|
|
$default_values['completiondiscussions']=1;
|
|
|
|
}
|
|
|
|
$default_values['completionrepliesenabled']=
|
|
|
|
!empty($default_values['completionreplies']) ? 1 : 0;
|
2009-04-22 04:46:04 +00:00
|
|
|
if (empty($default_values['completionreplies'])) {
|
2008-07-28 12:31:29 +00:00
|
|
|
$default_values['completionreplies']=1;
|
|
|
|
}
|
|
|
|
$default_values['completionpostsenabled']=
|
|
|
|
!empty($default_values['completionposts']) ? 1 : 0;
|
2009-04-22 04:46:04 +00:00
|
|
|
if (empty($default_values['completionposts'])) {
|
2008-07-28 12:31:29 +00:00
|
|
|
$default_values['completionposts']=1;
|
|
|
|
}
|
2007-05-08 16:11:58 +00:00
|
|
|
}
|
2006-11-24 06:39:15 +00:00
|
|
|
|
2009-12-16 22:14:17 +00:00
|
|
|
function add_completion_rules() {
|
2008-07-28 12:31:29 +00:00
|
|
|
$mform =& $this->_form;
|
|
|
|
|
|
|
|
$group=array();
|
|
|
|
$group[] =& $mform->createElement('checkbox', 'completionpostsenabled', '', get_string('completionposts','forum'));
|
|
|
|
$group[] =& $mform->createElement('text', 'completionposts', '', array('size'=>3));
|
|
|
|
$mform->setType('completionposts',PARAM_INT);
|
|
|
|
$mform->addGroup($group, 'completionpostsgroup', get_string('completionpostsgroup','forum'), array(' '), false);
|
|
|
|
$mform->disabledIf('completionposts','completionpostsenabled','notchecked');
|
|
|
|
|
|
|
|
$group=array();
|
|
|
|
$group[] =& $mform->createElement('checkbox', 'completiondiscussionsenabled', '', get_string('completiondiscussions','forum'));
|
|
|
|
$group[] =& $mform->createElement('text', 'completiondiscussions', '', array('size'=>3));
|
|
|
|
$mform->setType('completiondiscussions',PARAM_INT);
|
|
|
|
$mform->addGroup($group, 'completiondiscussionsgroup', get_string('completiondiscussionsgroup','forum'), array(' '), false);
|
|
|
|
$mform->disabledIf('completiondiscussions','completiondiscussionsenabled','notchecked');
|
|
|
|
|
|
|
|
$group=array();
|
|
|
|
$group[] =& $mform->createElement('checkbox', 'completionrepliesenabled', '', get_string('completionreplies','forum'));
|
|
|
|
$group[] =& $mform->createElement('text', 'completionreplies', '', array('size'=>3));
|
|
|
|
$mform->setType('completionreplies',PARAM_INT);
|
|
|
|
$mform->addGroup($group, 'completionrepliesgroup', get_string('completionrepliesgroup','forum'), array(' '), false);
|
|
|
|
$mform->disabledIf('completionreplies','completionrepliesenabled','notchecked');
|
|
|
|
|
|
|
|
return array('completiondiscussionsgroup','completionrepliesgroup','completionpostsgroup');
|
|
|
|
}
|
|
|
|
|
|
|
|
function completion_rule_enabled($data) {
|
|
|
|
return (!empty($data['completiondiscussionsenabled']) && $data['completiondiscussions']!=0) ||
|
|
|
|
(!empty($data['completionrepliesenabled']) && $data['completionreplies']!=0) ||
|
|
|
|
(!empty($data['completionpostsenabled']) && $data['completionposts']!=0);
|
|
|
|
}
|
|
|
|
|
2008-07-28 15:58:50 +00:00
|
|
|
function get_data() {
|
2009-04-22 04:46:04 +00:00
|
|
|
$data = parent::get_data();
|
|
|
|
if (!$data) {
|
2008-07-28 12:31:29 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// Turn off completion settings if the checkboxes aren't ticked
|
2009-04-22 04:46:04 +00:00
|
|
|
$autocompletion = !empty($data->completion) && $data->completion==COMPLETION_TRACKING_AUTOMATIC;
|
|
|
|
if (empty($data->completiondiscussionsenabled) || !$autocompletion) {
|
|
|
|
$data->completiondiscussions = 0;
|
2008-07-28 12:31:29 +00:00
|
|
|
}
|
2009-04-22 04:46:04 +00:00
|
|
|
if (empty($data->completionrepliesenabled) || !$autocompletion) {
|
|
|
|
$data->completionreplies = 0;
|
2008-07-28 12:31:29 +00:00
|
|
|
}
|
2009-04-22 04:46:04 +00:00
|
|
|
if (empty($data->completionpostsenabled) || !$autocompletion) {
|
|
|
|
$data->completionposts = 0;
|
2008-07-28 12:31:29 +00:00
|
|
|
}
|
|
|
|
return $data;
|
|
|
|
}
|
2006-11-10 03:04:34 +00:00
|
|
|
}
|
2009-11-01 14:55:15 +00:00
|
|
|
|