Skip to content

Commit

Permalink
MDL-56208 mod_forum: Move Display period below Group
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Oct 17, 2016
1 parent d9520bc commit 608edec
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions mod/forum/classes/post_form.php
Expand Up @@ -147,23 +147,6 @@ function definition() {
$mform->addElement('checkbox', 'mailnow', get_string('mailnow', 'forum'));
}

if (!empty($CFG->forum_enabletimedposts) && !$post->parent && has_capability('mod/forum:viewhiddentimedposts', $coursecontext)) { // hack alert
$mform->addElement('header', 'displayperiod', get_string('displayperiod', 'forum'));

$mform->addElement('date_time_selector', 'timestart', get_string('displaystart', 'forum'), array('optional' => true));
$mform->addHelpButton('timestart', 'displaystart', 'forum');

$mform->addElement('date_time_selector', 'timeend', get_string('displayend', 'forum'), array('optional' => true));
$mform->addHelpButton('timeend', 'displayend', 'forum');

} else {
$mform->addElement('hidden', 'timestart');
$mform->setType('timestart', PARAM_INT);
$mform->addElement('hidden', 'timeend');
$mform->setType('timeend', PARAM_INT);
$mform->setConstants(array('timestart'=> 0, 'timeend'=>0));
}

if ($groupmode = groups_get_activity_groupmode($cm, $course)) {
$groupdata = groups_get_activity_allowed_groups($cm);

Expand Down Expand Up @@ -237,6 +220,24 @@ function definition() {
$mform->addElement('static', 'groupinfo', get_string('group'), $groupname);
}
}

if (!empty($CFG->forum_enabletimedposts) && !$post->parent && has_capability('mod/forum:viewhiddentimedposts', $coursecontext)) {
$mform->addElement('header', 'displayperiod', get_string('displayperiod', 'forum'));

$mform->addElement('date_time_selector', 'timestart', get_string('displaystart', 'forum'), array('optional' => true));
$mform->addHelpButton('timestart', 'displaystart', 'forum');

$mform->addElement('date_time_selector', 'timeend', get_string('displayend', 'forum'), array('optional' => true));
$mform->addHelpButton('timeend', 'displayend', 'forum');

} else {
$mform->addElement('hidden', 'timestart');
$mform->setType('timestart', PARAM_INT);
$mform->addElement('hidden', 'timeend');
$mform->setType('timeend', PARAM_INT);
$mform->setConstants(array('timestart' => 0, 'timeend' => 0));
}

//-------------------------------------------------------------------------------
// buttons
if (isset($post->edit)) { // hack alert
Expand Down

0 comments on commit 608edec

Please sign in to comment.