Example #1
0
     add_notice("You cannot remove yourself as a <strong>Quiz Author</strong>.");
 }
 /**
  * Get a list of all current quiz authors, and then check to see if
  * one quiz author is attempting to remove any other quiz authors. If
  * they are attempting to remove an existing quiz author, then we need
  * to check and see if that quiz author has already assigned this quiz
  * to any of their learning events. If they have, then they cannot be
  * removed because it will pose a data integrity problem.
  */
 $contacts = Models_Quiz_Contact::fetchAllRecords($RECORD_ID);
 if ($contacts) {
     foreach ($contacts as $contact) {
         $result = $contact->toArray();
         if (!in_array($result["proxy_id"], $PROCESSED["associated_proxy_ids"])) {
             $sresult = Models_Quiz_Attached::getCurrentContact($RECORD_ID, $result["proxy_id"]);
             if ($sresult) {
                 $PROCESSED["associated_proxy_ids"][] = $result["proxy_id"];
                 add_notice("Unable to remove <strong>" . html_encode(get_account_data("fullname", $result["proxy_id"])) . "</strong> from the <strong>Quiz Authors</strong> section because they have already attached this quiz to one or more events or communities.");
             }
         }
     }
 }
 if (!$ERROR) {
     $PROCESSED["updated_date"] = time();
     $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
     if ($quiz->fromArray($PROCESSED)->update()) {
         /**
          * Delete existing quiz contacts, so we can re-add them.
          */
         Models_Quiz_Contact::deleteContacts($RECORD_ID);
Example #2
0
 public function __construct($arr = NULL)
 {
     parent::__construct($arr);
 }
Example #3
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;
     }