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);