Пример #1
0
         }
     }
 }
 //saving the items
 if ($savevalues and !$preservevalues) {
     //exists there any pagebreak, so there are values in the feedback_valuetmp
     $userid = $USER->id;
     //arb
     if ($feedback->anonymous == FEEDBACK_ANONYMOUS_NO) {
         $feedbackcompleted = feedback_get_current_completed($feedback->id, false, $courseid);
     } else {
         $feedbackcompleted = false;
     }
     $feedbackcompletedtmp = get_record('feedback_completedtmp', 'id', $completedid);
     //fake saving for switchrole
     $is_switchrole = feedback_check_is_switchrole();
     if ($is_switchrole) {
         $savereturn = 'saved';
         feedback_delete_completedtmp($completedid);
     } else {
         if ($new_completed_id = feedback_save_tmp_values($feedbackcompletedtmp, $feedbackcompleted, $userid)) {
             $savereturn = 'saved';
             if ($feedback->anonymous == FEEDBACK_ANONYMOUS_NO) {
                 add_to_log($course->id, 'feedback', 'submit', 'view.php?id=' . $cm->id, $feedback->id, $cm->id, $userid);
                 feedback_send_email($cm, $feedback, $course, $userid);
             } else {
                 feedback_send_email_anonym($cm, $feedback, $course, $userid);
             }
             //tracking the submit
             $multiple_count = null;
             $multiple_count->userid = $USER->id;
Пример #2
0
 /**
  * Saves the response
  *
  * The form data has already been stored in the temporary table in
  * {@link save_response_tmp()}. This function copies the values
  * from the temporary table to the completion table.
  * It is also responsible for sending email notifications when applicable.
  */
 public function save_response()
 {
     global $USER, $SESSION, $DB;
     $feedbackcompleted = $this->find_last_completed();
     $feedbackcompletedtmp = $this->get_current_completed_tmp();
     if (feedback_check_is_switchrole()) {
         // We do not actually save anything if the role is switched, just delete temporary values.
         $this->delete_completedtmp();
         return;
     }
     // Save values.
     $completedid = feedback_save_tmp_values($feedbackcompletedtmp, $feedbackcompleted);
     $this->completed = $DB->get_record('feedback_completed', array('id' => $completedid));
     // Send email.
     if ($this->feedback->anonymous == FEEDBACK_ANONYMOUS_NO) {
         feedback_send_email($this->cm, $this->feedback, $this->cm->get_course(), $USER);
     } else {
         feedback_send_email_anonym($this->cm, $this->feedback, $this->cm->get_course());
     }
     unset($SESSION->feedback->is_started);
     // Update completion state.
     $completion = new completion_info($this->cm->get_course());
     if (isloggedin() && !isguestuser() && $completion->is_enabled($this->cm) && $this->feedback->completionsubmit) {
         $completion->update_state($this->cm, COMPLETION_COMPLETE);
     }
 }