MDL-43656 mod_feedback: availablity date logic incorrect
[moodle.git] / mod / feedback / complete.php
CommitLineData
84973212 1<?php
9c5bc7a5
AG
2// This file is part of Moodle - http://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17/**
18 * prints the form so the user can fill out the feedback
19 *
20 * @author Andreas Grabs
21 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
9714baa1 22 * @package mod_feedback
9c5bc7a5
AG
23 */
24
25require_once("../../config.php");
26require_once("lib.php");
27require_once($CFG->libdir . '/completionlib.php');
28
29feedback_init_feedback_session();
30
31$id = required_param('id', PARAM_INT);
32$completedid = optional_param('completedid', false, PARAM_INT);
33$preservevalues = optional_param('preservevalues', 0, PARAM_INT);
34$courseid = optional_param('courseid', false, PARAM_INT);
35$gopage = optional_param('gopage', -1, PARAM_INT);
36$lastpage = optional_param('lastpage', false, PARAM_INT);
37$startitempos = optional_param('startitempos', 0, PARAM_INT);
38$lastitempos = optional_param('lastitempos', 0, PARAM_INT);
39$anonymous_response = optional_param('anonymous_response', 0, PARAM_INT); //arb
40
41$highlightrequired = false;
42
43if (($formdata = data_submitted()) AND !confirm_sesskey()) {
44 print_error('invalidsesskey');
45}
46
47//if the use hit enter into a textfield so the form should not submit
48if (isset($formdata->sesskey) AND
49 !isset($formdata->savevalues) AND
50 !isset($formdata->gonextpage) AND
51 !isset($formdata->gopreviouspage)) {
52
53 $gopage = $formdata->lastpage;
54}
55
56if (isset($formdata->savevalues)) {
57 $savevalues = true;
58} else {
59 $savevalues = false;
60}
61
62if ($gopage < 0 AND !$savevalues) {
63 if (isset($formdata->gonextpage)) {
64 $gopage = $lastpage + 1;
65 $gonextpage = true;
66 $gopreviouspage = false;
67 } else if (isset($formdata->gopreviouspage)) {
68 $gopage = $lastpage - 1;
69 $gonextpage = false;
70 $gopreviouspage = true;
73043833 71 } else {
9c5bc7a5 72 print_error('missingparameter');
84973212 73 }
9c5bc7a5
AG
74} else {
75 $gonextpage = $gopreviouspage = false;
76}
77
78if (! $cm = get_coursemodule_from_id('feedback', $id)) {
79 print_error('invalidcoursemodule');
80}
81
82if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
83 print_error('coursemisconf');
84}
85
86if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
87 print_error('invalidcoursemodule');
88}
89
2c979976 90$context = context_module::instance($cm->id);
9c5bc7a5
AG
91
92$feedback_complete_cap = false;
93
94if (has_capability('mod/feedback:complete', $context)) {
95 $feedback_complete_cap = true;
96}
97
98//check whether the feedback is located and! started from the mainsite
99if ($course->id == SITEID AND !$courseid) {
100 $courseid = SITEID;
101}
102
103//check whether the feedback is mapped to the given courseid
104if ($course->id == SITEID AND !has_capability('mod/feedback:edititems', $context)) {
105 if ($DB->get_records('feedback_sitecourse_map', array('feedbackid'=>$feedback->id))) {
106 $params = array('feedbackid'=>$feedback->id, 'courseid'=>$courseid);
107 if (!$DB->get_record('feedback_sitecourse_map', $params)) {
108 print_error('notavailable', 'feedback');
c70ad9f7 109 }
84973212 110 }
9c5bc7a5 111}
84973212 112
9c5bc7a5
AG
113if ($feedback->anonymous != FEEDBACK_ANONYMOUS_YES) {
114 if ($course->id == SITEID) {
cdbea7ee 115 require_login($course, true);
9c5bc7a5 116 } else {
cdbea7ee 117 require_login($course, true, $cm);
84973212 118 }
9c5bc7a5
AG
119} else {
120 if ($course->id == SITEID) {
121 require_course_login($course, true);
122 } else {
123 require_course_login($course, true, $cm);
84973212 124 }
9c5bc7a5 125}
c70ad9f7 126
9c5bc7a5
AG
127//check whether the given courseid exists
128if ($courseid AND $courseid != SITEID) {
129 if ($course2 = $DB->get_record('course', array('id'=>$courseid))) {
130 require_course_login($course2); //this overwrites the object $course :-(
131 $course = $DB->get_record("course", array("id"=>$cm->course)); // the workaround
132 } else {
133 print_error('invalidcourseid');
73043833 134 }
9c5bc7a5
AG
135}
136
137if (!$feedback_complete_cap) {
138 print_error('error');
139}
140
141// Mark activity viewed for completion-tracking
142$completion = new completion_info($course);
143$completion->set_module_viewed($cm);
144
145/// Print the page header
146$strfeedbacks = get_string("modulenameplural", "feedback");
147$strfeedback = get_string("modulename", "feedback");
148
149if ($course->id == SITEID) {
150 $PAGE->set_cm($cm, $course); // set's up global $COURSE
151 $PAGE->set_pagelayout('incourse');
152}
153
154$PAGE->navbar->add(get_string('feedback:complete', 'feedback'));
155$urlparams = array('id'=>$cm->id, 'gopage'=>$gopage, 'courseid'=>$course->id);
156$PAGE->set_url('/mod/feedback/complete.php', $urlparams);
8c6ca696
RW
157$PAGE->set_heading($course->fullname);
158$PAGE->set_title($feedback->name);
9c5bc7a5
AG
159echo $OUTPUT->header();
160
161//ishidden check.
162//feedback in courses
163if ((empty($cm->visible) AND
164 !has_capability('moodle/course:viewhiddenactivities', $context)) AND
165 $course->id != SITEID) {
166 notice(get_string("activityiscurrentlyhidden"));
167}
168
169//ishidden check.
170//feedback on mainsite
171if ((empty($cm->visible) AND
172 !has_capability('moodle/course:viewhiddenactivities', $context)) AND
173 $courseid == SITEID) {
174 notice(get_string("activityiscurrentlyhidden"));
175}
176
177//check, if the feedback is open (timeopen, timeclose)
178$checktime = time();
1298acc7
TM
179$feedback_is_closed = ($feedback->timeopen > $checktime) ||
180 ($feedback->timeclose < $checktime &&
9c5bc7a5
AG
181 $feedback->timeclose > 0);
182
183if ($feedback_is_closed) {
846cebe5 184 echo $OUTPUT->heading(format_string($feedback->name));
9c5bc7a5 185 echo $OUTPUT->box_start('generalbox boxaligncenter');
846cebe5
RW
186 echo $OUTPUT->notification(get_string('feedback_is_not_open', 'feedback'));
187 echo $OUTPUT->continue_button($CFG->wwwroot.'/course/view.php?id='.$course->id);
9c5bc7a5
AG
188 echo $OUTPUT->box_end();
189 echo $OUTPUT->footer();
190 exit;
191}
192
193//additional check for multiple-submit (prevent browsers back-button).
194//the main-check is in view.php
195$feedback_can_submit = true;
196if ($feedback->multiple_submit == 0 ) {
197 if (feedback_is_already_submitted($feedback->id, $courseid)) {
198 $feedback_can_submit = false;
5dee2210 199 }
9c5bc7a5
AG
200}
201if ($feedback_can_submit) {
202 //preserving the items
203 if ($preservevalues == 1) {
204 if (!isset($SESSION->feedback->is_started) OR !$SESSION->feedback->is_started == true) {
205 print_error('error', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
488b13ba 206 }
3f6fd941 207 // Check if all required items have a value.
9c5bc7a5
AG
208 if (feedback_check_values($startitempos, $lastitempos)) {
209 $userid = $USER->id; //arb
210 if ($completedid = feedback_save_values($USER->id, true)) {
9c5bc7a5 211 if (!$gonextpage AND !$gopreviouspage) {
3f6fd941 212 $preservevalues = false;// It can be stored.
9c5bc7a5
AG
213 }
214
215 } else {
216 $savereturn = 'failed';
217 if (isset($lastpage)) {
73043833 218 $gopage = $lastpage;
9c5bc7a5 219 } else {
73043833
AG
220 print_error('missingparameter');
221 }
c70ad9f7 222 }
9c5bc7a5
AG
223 } else {
224 $savereturn = 'missing';
225 $highlightrequired = true;
226 if (isset($lastpage)) {
227 $gopage = $lastpage;
228 } else {
229 print_error('missingparameter');
230 }
231
84973212 232 }
9c5bc7a5 233 }
d4b1d58c 234
9c5bc7a5
AG
235 //saving the items
236 if ($savevalues AND !$preservevalues) {
237 //exists there any pagebreak, so there are values in the feedback_valuetmp
238 $userid = $USER->id; //arb
29081d02 239
9c5bc7a5
AG
240 if ($feedback->anonymous == FEEDBACK_ANONYMOUS_NO) {
241 $feedbackcompleted = feedback_get_current_completed($feedback->id, false, $courseid);
242 } else {
243 $feedbackcompleted = false;
244 }
245 $params = array('id' => $completedid);
246 $feedbackcompletedtmp = $DB->get_record('feedback_completedtmp', $params);
247 //fake saving for switchrole
248 $is_switchrole = feedback_check_is_switchrole();
249 if ($is_switchrole) {
250 $savereturn = 'saved';
251 feedback_delete_completedtmp($completedid);
252 } else {
253 $new_completed_id = feedback_save_tmp_values($feedbackcompletedtmp,
254 $feedbackcompleted,
255 $userid);
256 if ($new_completed_id) {
73043833 257 $savereturn = 'saved';
9c5bc7a5 258 if ($feedback->anonymous == FEEDBACK_ANONYMOUS_NO) {
73043833 259 feedback_send_email($cm, $feedback, $course, $userid);
9c5bc7a5 260 } else {
73043833 261 feedback_send_email_anonym($cm, $feedback, $course, $userid);
8001d6e7 262 }
73043833 263 //tracking the submit
39790bd8 264 $tracking = new stdClass();
73043833
AG
265 $tracking->userid = $USER->id;
266 $tracking->feedback = $feedback->id;
267 $tracking->completed = $new_completed_id;
268 $DB->insert_record('feedback_tracking', $tracking);
269 unset($SESSION->feedback->is_started);
9c5bc7a5 270
8a41eb4f
AG
271 // Update completion state
272 $completion = new completion_info($course);
273 if ($completion->is_enabled($cm) && $feedback->completionsubmit) {
274 $completion->update_state($cm, COMPLETION_COMPLETE);
275 }
73043833 276
9c5bc7a5 277 } else {
73043833 278 $savereturn = 'failed';
c70ad9f7 279 }
84973212 280 }
73043833 281
9c5bc7a5 282 }
73043833 283
9c5bc7a5
AG
284
285 if ($allbreaks = feedback_get_all_break_positions($feedback->id)) {
286 if ($gopage <= 0) {
73043833 287 $startposition = 0;
9c5bc7a5
AG
288 } else {
289 if (!isset($allbreaks[$gopage - 1])) {
290 $gopage = count($allbreaks);
291 }
292 $startposition = $allbreaks[$gopage - 1];
84973212 293 }
9c5bc7a5
AG
294 $ispagebreak = true;
295 } else {
296 $startposition = 0;
297 $newpage = 0;
298 $ispagebreak = false;
299 }
84973212 300
9c5bc7a5
AG
301 //get the feedbackitems after the last shown pagebreak
302 $select = 'feedback = ? AND position > ?';
303 $params = array($feedback->id, $startposition);
304 $feedbackitems = $DB->get_records_select('feedback_item', $select, $params, 'position');
73043833 305
9c5bc7a5
AG
306 //get the first pagebreak
307 $params = array('feedback' => $feedback->id, 'typ' => 'pagebreak');
308 if ($pagebreaks = $DB->get_records('feedback_item', $params, 'position')) {
309 $pagebreaks = array_values($pagebreaks);
310 $firstpagebreak = $pagebreaks[0];
311 } else {
312 $firstpagebreak = false;
313 }
314 $maxitemcount = $DB->count_records('feedback_item', array('feedback'=>$feedback->id));
315
316 //get the values of completeds before done. Anonymous user can not get these values.
317 if ((!isset($SESSION->feedback->is_started)) AND
318 (!isset($savereturn)) AND
319 ($feedback->anonymous == FEEDBACK_ANONYMOUS_NO)) {
320
321 $feedbackcompletedtmp = feedback_get_current_completed($feedback->id, true, $courseid);
322 if (!$feedbackcompletedtmp) {
323 $feedbackcompleted = feedback_get_current_completed($feedback->id, false, $courseid);
324 if ($feedbackcompleted) {
325 //copy the values to feedback_valuetmp create a completedtmp
326 $feedbackcompletedtmp = feedback_set_tmp_values($feedbackcompleted);
73043833 327 }
84973212 328 }
9c5bc7a5
AG
329 } else {
330 $feedbackcompletedtmp = feedback_get_current_completed($feedback->id, true, $courseid);
331 }
d4b1d58c 332
9c5bc7a5
AG
333 /// Print the main part of the page
334 ///////////////////////////////////////////////////////////////////////////
335 ///////////////////////////////////////////////////////////////////////////
336 ///////////////////////////////////////////////////////////////////////////
337 $analysisurl = new moodle_url('/mod/feedback/analysis.php', array('id'=>$id));
338 if ($courseid > 0) {
339 $analysisurl->param('courseid', $courseid);
340 }
846cebe5 341 echo $OUTPUT->heading(format_string($feedback->name));
9c5bc7a5
AG
342
343 if ( (intval($feedback->publish_stats) == 1) AND
344 ( has_capability('mod/feedback:viewanalysepage', $context)) AND
345 !( has_capability('mod/feedback:viewreports', $context)) ) {
346
347 $params = array('userid' => $USER->id, 'feedback' => $feedback->id);
348 if ($multiple_count = $DB->count_records('feedback_tracking', $params)) {
349 echo $OUTPUT->box_start('mdl-align');
350 echo '<a href="'.$analysisurl->out().'">';
351 echo get_string('completed_feedbacks', 'feedback').'</a>';
352 echo $OUTPUT->box_end();
73043833 353 }
9c5bc7a5
AG
354 }
355
356 if (isset($savereturn) && $savereturn == 'saved') {
357 if ($feedback->page_after_submit) {
abd2899c
AG
358
359 require_once($CFG->libdir . '/filelib.php');
360
361 $page_after_submit_output = file_rewrite_pluginfile_urls($feedback->page_after_submit,
362 'pluginfile.php',
363 $context->id,
364 'mod_feedback',
365 'page_after_submit',
366 0);
367
9c5bc7a5 368 echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
abd2899c 369 echo format_text($page_after_submit_output,
9c5bc7a5
AG
370 $feedback->page_after_submitformat,
371 array('overflowdiv' => true));
372 echo $OUTPUT->box_end();
373 } else {
374 echo '<p align="center">';
375 echo '<b><font color="green">';
376 echo get_string('entries_saved', 'feedback');
377 echo '</font></b>';
378 echo '</p>';
379 if ( intval($feedback->publish_stats) == 1) {
380 echo '<p align="center"><a href="'.$analysisurl->out().'">';
73043833 381 echo get_string('completed_feedbacks', 'feedback').'</a>';
9c5bc7a5 382 echo '</p>';
84973212 383 }
73043833
AG
384 }
385
9c5bc7a5
AG
386 if ($feedback->site_after_submit) {
387 $url = feedback_encode_target_url($feedback->site_after_submit);
388 } else {
389 if ($courseid) {
390 if ($courseid == SITEID) {
391 $url = $CFG->wwwroot;
392 } else {
393 $url = $CFG->wwwroot.'/course/view.php?id='.$courseid;
394 }
73043833 395 } else {
9c5bc7a5
AG
396 if ($course->id == SITEID) {
397 $url = $CFG->wwwroot;
398 } else {
399 $url = $CFG->wwwroot.'/course/view.php?id='.$course->id;
73043833 400 }
c70ad9f7 401 }
9c5bc7a5
AG
402 }
403 echo $OUTPUT->continue_button($url);
404 } else {
405 if (isset($savereturn) && $savereturn == 'failed') {
406 echo $OUTPUT->box_start('mform error');
407 echo get_string('saving_failed', 'feedback');
408 echo $OUTPUT->box_end();
409 }
73043833 410
9c5bc7a5
AG
411 if (isset($savereturn) && $savereturn == 'missing') {
412 echo $OUTPUT->box_start('mform error');
413 echo get_string('saving_failed_because_missing_or_false_values', 'feedback');
414 echo $OUTPUT->box_end();
415 }
73043833 416
9c5bc7a5
AG
417 //print the items
418 if (is_array($feedbackitems)) {
419 echo $OUTPUT->box_start('feedback_form');
420 echo '<form action="complete.php" method="post" onsubmit=" ">';
9c5bc7a5
AG
421 echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
422 echo $OUTPUT->box_start('feedback_anonymousinfo');
423 switch ($feedback->anonymous) {
424 case FEEDBACK_ANONYMOUS_YES:
425 echo '<input type="hidden" name="anonymous" value="1" />';
426 $inputvalue = 'value="'.FEEDBACK_ANONYMOUS_YES.'"';
427 echo '<input type="hidden" name="anonymous_response" '.$inputvalue.' />';
428 echo get_string('mode', 'feedback').': '.get_string('anonymous', 'feedback');
429 break;
430 case FEEDBACK_ANONYMOUS_NO:
431 echo '<input type="hidden" name="anonymous" value="0" />';
432 $inputvalue = 'value="'.FEEDBACK_ANONYMOUS_NO.'"';
433 echo '<input type="hidden" name="anonymous_response" '.$inputvalue.' />';
434 echo get_string('mode', 'feedback').': ';
435 echo get_string('non_anonymous', 'feedback');
436 break;
73043833 437 }
9c5bc7a5
AG
438 echo $OUTPUT->box_end();
439 //check, if there exists required-elements
440 $params = array('feedback' => $feedback->id, 'required' => 1);
441 $countreq = $DB->count_records('feedback_item', $params);
442 if ($countreq > 0) {
443 echo '<span class="feedback_required_mark">(*)';
444 echo get_string('items_are_required', 'feedback');
445 echo '</span>';
446 }
447 echo $OUTPUT->box_start('feedback_items');
448
449 unset($startitem);
450 $select = 'feedback = ? AND hasvalue = 1 AND position < ?';
451 $params = array($feedback->id, $startposition);
452 $itemnr = $DB->count_records_select('feedback_item', $select, $params);
453 $lastbreakposition = 0;
454 $align = right_to_left() ? 'right' : 'left';
455
456 foreach ($feedbackitems as $feedbackitem) {
457 if (!isset($startitem)) {
458 //avoid showing double pagebreaks
459 if ($feedbackitem->typ == 'pagebreak') {
460 continue;
461 }
462 $startitem = $feedbackitem;
463 }
73043833 464
9c5bc7a5
AG
465 if ($feedbackitem->dependitem > 0) {
466 //chech if the conditions are ok
467 $fb_compare_value = feedback_compare_item_value($feedbackcompletedtmp->id,
468 $feedbackitem->dependitem,
469 $feedbackitem->dependvalue,
470 true);
471 if (!isset($feedbackcompletedtmp->id) OR !$fb_compare_value) {
472 $lastitem = $feedbackitem;
473 $lastbreakposition = $feedbackitem->position;
474 continue;
475 }
73043833 476 }
9c5bc7a5
AG
477
478 if ($feedbackitem->dependitem > 0) {
479 $dependstyle = ' feedback_complete_depend';
480 } else {
481 $dependstyle = '';
73043833 482 }
39790bd8 483
9c5bc7a5
AG
484 echo $OUTPUT->box_start('feedback_item_box_'.$align.$dependstyle);
485 $value = '';
486 //get the value
487 $frmvaluename = $feedbackitem->typ . '_'. $feedbackitem->id;
488 if (isset($savereturn)) {
e7fc2ff4
AG
489 $value = isset($formdata->{$frmvaluename}) ? $formdata->{$frmvaluename} : null;
490 $value = feedback_clean_input_value($feedbackitem, $value);
9c5bc7a5
AG
491 } else {
492 if (isset($feedbackcompletedtmp->id)) {
493 $value = feedback_get_item_value($feedbackcompletedtmp->id,
494 $feedbackitem->id,
495 true);
afdb1920 496 }
9c5bc7a5
AG
497 }
498 if ($feedbackitem->hasvalue == 1 AND $feedback->autonumbering) {
499 $itemnr++;
500 echo $OUTPUT->box_start('feedback_item_number_'.$align);
501 echo $itemnr;
73043833 502 echo $OUTPUT->box_end();
73043833 503 }
9c5bc7a5
AG
504 if ($feedbackitem->typ != 'pagebreak') {
505 echo $OUTPUT->box_start('box generalbox boxalign_'.$align);
506 feedback_print_item_complete($feedbackitem, $value, $highlightrequired);
507 echo $OUTPUT->box_end();
c70ad9f7 508 }
e7fc2ff4 509
9c5bc7a5 510 echo $OUTPUT->box_end();
d4b1d58c 511
9c5bc7a5
AG
512 $lastbreakposition = $feedbackitem->position; //last item-pos (item or pagebreak)
513 if ($feedbackitem->typ == 'pagebreak') {
514 break;
515 } else {
516 $lastitem = $feedbackitem;
73043833 517 }
9c5bc7a5
AG
518 }
519 echo $OUTPUT->box_end();
520 echo '<input type="hidden" name="id" value="'.$id.'" />';
521 echo '<input type="hidden" name="feedbackid" value="'.$feedback->id.'" />';
522 echo '<input type="hidden" name="lastpage" value="'.$gopage.'" />';
523 if (isset($feedbackcompletedtmp->id)) {
524 $inputvalue = 'value="'.$feedbackcompletedtmp->id.'"';
525 } else {
526 $inputvalue = 'value=""';
527 }
528 echo '<input type="hidden" name="completedid" '.$inputvalue.' />';
529 echo '<input type="hidden" name="courseid" value="'. $courseid . '" />';
530 echo '<input type="hidden" name="preservevalues" value="1" />';
531 if (isset($startitem)) {
532 echo '<input type="hidden" name="startitempos" value="'.$startitem->position.'" />';
533 echo '<input type="hidden" name="lastitempos" value="'.$lastitem->position.'" />';
534 }
d4b1d58c 535
9c5bc7a5
AG
536 if ( $ispagebreak AND $lastbreakposition > $firstpagebreak->position) {
537 $inputvalue = 'value="'.get_string('previous_page', 'feedback').'"';
538 echo '<input name="gopreviouspage" type="submit" '.$inputvalue.' />';
539 }
540 if ($lastbreakposition < $maxitemcount) {
541 $inputvalue = 'value="'.get_string('next_page', 'feedback').'"';
542 echo '<input name="gonextpage" type="submit" '.$inputvalue.' />';
543 }
544 if ($lastbreakposition >= $maxitemcount) { //last page
545 $inputvalue = 'value="'.get_string('save_entries', 'feedback').'"';
546 echo '<input name="savevalues" type="submit" '.$inputvalue.' />';
547 }
39790bd8 548
9c5bc7a5
AG
549 echo '</form>';
550 echo $OUTPUT->box_end();
551
552 echo $OUTPUT->box_start('feedback_complete_cancel');
553 if ($courseid) {
554 $action = 'action="'.$CFG->wwwroot.'/course/view.php?id='.$courseid.'"';
555 } else {
556 if ($course->id == SITEID) {
557 $action = 'action="'.$CFG->wwwroot.'"';
558 } else {
559 $action = 'action="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'"';
84973212 560 }
afdb1920 561 }
9c5bc7a5 562 echo '<form '.$action.' method="post" onsubmit=" ">';
9c5bc7a5
AG
563 echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
564 echo '<input type="hidden" name="courseid" value="'. $courseid . '" />';
565 echo '<button type="submit">'.get_string('cancel').'</button>';
9c5bc7a5
AG
566 echo '</form>';
567 echo $OUTPUT->box_end();
568 $SESSION->feedback->is_started = true;
c70ad9f7 569 }
c70ad9f7 570 }
9c5bc7a5 571} else {
846cebe5 572 echo $OUTPUT->heading(format_string($feedback->name));
9c5bc7a5 573 echo $OUTPUT->box_start('generalbox boxaligncenter');
846cebe5
RW
574 echo $OUTPUT->notification(get_string('this_feedback_is_already_submitted', 'feedback'));
575 echo $OUTPUT->continue_button($CFG->wwwroot.'/course/view.php?id='.$course->id);
9c5bc7a5
AG
576 echo $OUTPUT->box_end();
577}
578/// Finish the page
579///////////////////////////////////////////////////////////////////////////
580///////////////////////////////////////////////////////////////////////////
581///////////////////////////////////////////////////////////////////////////
582
583echo $OUTPUT->footer();