File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -67,4 +67,25 @@ public function validate_dates(cm_info $cm, array $dates) {
6767 }
6868 return $ errors ;
6969 }
70+
71+ public function save_dates (cm_info $ cm , array $ dates ) {
72+ global $ DB , $ COURSE , $ CFG ;
73+ require_once ($ CFG ->dirroot .'/mod/forum/locallib.php ' );
74+
75+ $ forum = $ DB ->get_record ('forum ' , ['id ' => $ cm ->instance ]);
76+ $ forum ->id = $ cm ->instance ;
77+ $ forum ->duedate = $ dates ['duedate ' ];
78+ $ forum ->cutoffdate = $ dates ['cutoffdate ' ];
79+ if ($ forum ->assessed ) {
80+ $ forum ->assesstimestart = $ dates ['assesstimestart ' ];
81+ $ forum ->assesstimefinish = $ dates ['assesstimefinish ' ];
82+ }
83+
84+ $ result = $ DB ->update_record ('forum ' , $ forum );
85+ $ forum ->cmidnumber = $ cm ->id ;
86+
87+ // Update the calendar and grades.
88+ forum_update_calendar ($ forum , $ cm ->id );
89+ forum_grade_item_update ($ forum );
90+ }
7091}
You can’t perform that action at this time.
0 commit comments