Example #1
0
 if (isset($viewable_date["finish"]) && (int) $viewable_date["finish"]) {
     $PROCESSED["release_until"] = (int) $viewable_date["finish"];
 } else {
     $PROCESSED["release_until"] = 0;
 }
 if (!$ERROR) {
     $PROCESSED["updated_date"] = time();
     $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
     /**
      * Adding this quiz to each of the selected events.
      */
     foreach ($PROCESSED["event_ids"] as $event_id) {
         $PROCESSED["content_id"] = $event_id;
         $PROCESSED["content_type"] = "event";
         $attached_quiz = new Models_Quiz_Attached($PROCESSED);
         if ($attached_quiz->insert()) {
             add_success("You have successfully attached <strong>" . html_encode($quiz_record["quiz_title"]) . "</strong> as <strong>" . html_encode($PROCESSED["quiz_title"]) . "</strong> to <strong>" . html_encode($selected_learning_events[$PROCESSED["event_id"]]["event_title"]) . "</strong>.");
             application_log("success", "Quiz [" . $RECORD_ID . "] was successfully attached to Event [" . $PROCESSED["event_id"] . "].");
         } else {
             add_error("There was a problem attaching this quiz to <strong>" . html_encode($selected_learning_events[$PROCESSED["event_id"]]["event_title"]) . "</strong>. The system administrator was informed of this error; please try again later.");
             application_log("error", "There was an error attaching quiz [" . $RECORD_ID . "] to event [" . $PROCESSED["event_id"] . "]. Database said: " . $db->ErrorMsg());
         }
     }
     if ($SUCCESS) {
         $url = ENTRADA_URL . "/admin/" . $MODULE . "?section=edit&id=" . $RECORD_ID;
         $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
         $SUCCESSSTR[count($SUCCESSSTR) - 1] .= "<br /><br />You will now be redirected back to the quiz page; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
     } elseif ($ERROR) {
         $STEP = 2;
     }
 } else {