File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 4444$ string ['cannotunmap ' ] = 'Database problem, unable to unmap ' ;
4545$ string ['captcha ' ] = 'Captcha ' ;
4646$ string ['captchanotset ' ] = 'Captcha hasn \'t been set. ' ;
47+ $ string ['closebeforeopen ' ] = 'You have specified an end date before the start date. ' ;
4748$ string ['completed_feedbacks ' ] = 'Submitted answers ' ;
4849$ string ['complete_the_form ' ] = 'Answer the questions... ' ;
4950$ string ['completionsubmit ' ] = 'View as completed if the feedback is submitted ' ;
Original file line number Diff line number Diff line change @@ -179,8 +179,21 @@ public function get_data() {
179179 return $ data ;
180180 }
181181
182+ /**
183+ * Enforce validation rules here
184+ *
185+ * @param array $data array of ("fieldname"=>value) of submitted data
186+ * @param array $files array of uploaded files "element_name"=>tmp_file_path
187+ * @return array
188+ **/
182189 public function validation ($ data , $ files ) {
183190 $ errors = parent ::validation ($ data , $ files );
191+
192+ // Check open and close times are consistent.
193+ if ($ data ['timeopen ' ] && $ data ['timeclose ' ] &&
194+ $ data ['timeclose ' ] < $ data ['timeopen ' ]) {
195+ $ errors ['timeclose ' ] = get_string ('closebeforeopen ' , 'feedback ' );
196+ }
184197 return $ errors ;
185198 }
186199
You can’t perform that action at this time.
0 commit comments