Skip to content

Commit

Permalink
forum update calendar fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Syxton committed Aug 31, 2021
1 parent 2c47928 commit 7eac42a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions mod/forumdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,25 @@ public function validate_dates(cm_info $cm, array $dates) {
}
return $errors;
}

public function save_dates(cm_info $cm, array $dates) {
global $DB, $COURSE, $CFG;
require_once($CFG->dirroot.'/mod/forum/locallib.php');

$forum = $DB->get_record('forum', ['id' => $cm->instance]);
$forum->id = $cm->instance;
$forum->duedate = $dates['duedate'];
$forum->cutoffdate = $dates['cutoffdate'];
if ($forum->assessed) {
$forum->assesstimestart = $dates['assesstimestart'];
$forum->assesstimefinish = $dates['assesstimefinish'];
}

$result = $DB->update_record('forum', $forum);
$forum->cmidnumber = $cm->id;

// Update the calendar and grades.
forum_update_calendar($forum, $cm->id);
forum_grade_item_update($forum);
}
}

0 comments on commit 7eac42a

Please sign in to comment.