$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); /** * Add the updated quiz authors to the quiz_contacts table. */ if (is_array($PROCESSED["associated_proxy_ids"]) && !empty($PROCESSED["associated_proxy_ids"])) { foreach ($PROCESSED["associated_proxy_ids"] as $proxy_id) { $contact = new Models_Quiz_Contact(array("quiz_id" => $RECORD_ID, "proxy_id" => $proxy_id, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getActiveID())); if (!$contact->insert()) { add_error("There was an error while trying to attach a <strong>Quiz Author</strong> to this quiz.<br /><br />The system administrator was informed of this error; please try again later."); application_log("error", "Unable to insert a new quiz_contact record while adding a new quiz. Database said: " . $db->ErrorMsg()); } } } add_success("The <strong>Quiz Information</strong> section has been successfully updated."); application_log("success", "Quiz information for quiz_id [" . $quiz_id . "] was updated."); } else {