mirror of
https://github.com/moodle/moodle.git
synced 2025-02-25 20:43:33 +01:00
MDL-56370 mod_feedback: allow to restore values from last attempt
This commit is contained in:
parent
bd99cb9021
commit
d6f77a435f
@ -457,6 +457,21 @@ class mod_feedback_completion extends mod_feedback_structure {
|
||||
return $this->completedtmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* If user has already completed the feedback, create the temproray values from last completed attempt
|
||||
*
|
||||
* @return stdClass record from feedback_completedtmp or false if not found
|
||||
*/
|
||||
public function create_completed_tmp_from_last_completed() {
|
||||
if (!$this->get_current_completed_tmp()) {
|
||||
$lastcompleted = $this->find_last_completed();
|
||||
if ($lastcompleted) {
|
||||
$this->completedtmp = feedback_set_tmp_values($lastcompleted);
|
||||
}
|
||||
}
|
||||
return $this->completedtmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves unfinished response to the temporary table
|
||||
*
|
||||
@ -683,6 +698,7 @@ class mod_feedback_completion extends mod_feedback_structure {
|
||||
$urltogo = null;
|
||||
|
||||
// Save the form for later during the request.
|
||||
$this->create_completed_tmp_from_last_completed();
|
||||
$this->form = new mod_feedback_complete_form(mod_feedback_complete_form::MODE_COMPLETE,
|
||||
$this, 'feedback_complete_form', array('gopage' => $gopage));
|
||||
|
||||
|
@ -1924,8 +1924,6 @@ function feedback_print_item_show_value($item, $value = false) {
|
||||
*/
|
||||
function feedback_set_tmp_values($feedbackcompleted) {
|
||||
global $DB;
|
||||
debugging('Function feedback_set_tmp_values() is deprecated and since it is '
|
||||
. 'no longer used in mod_feedback', DEBUG_DEVELOPER);
|
||||
|
||||
//first we create a completedtmp
|
||||
$tmpcpl = new stdClass();
|
||||
|
Loading…
x
Reference in New Issue
Block a user