Ejemplo n.º 1
0
 if (!in_array($ENTRADA_USER->getActiveId(), $PROCESSED["associated_proxy_ids"])) {
     array_unshift($PROCESSED["associated_proxy_ids"], $ENTRADA_USER->getActiveId());
     add_notice("You cannot remove yourself as a <strong>Draft Author</strong>.");
 }
 if (!$ERROR) {
     if ($draft->fromArray(array("name" => $PROCESSED["name"], "description" => $PROCESSED["description"]))->update()) {
         /**
          * Delete existing draft contacts, so we can re-add them.
          */
         if ($draft->deleteCreators()) {
             /**
              * Add the updated draft authors to the draft_contacts table.
              */
             if (is_array($PROCESSED["associated_proxy_ids"]) && !empty($PROCESSED["associated_proxy_ids"])) {
                 foreach ($PROCESSED["associated_proxy_ids"] as $proxy_id) {
                     $creator = new Models_Event_Draft_Creator(array("draft_id" => $draft_id, "proxy_id" => $proxy_id));
                     if (!$creator->insert()) {
                         add_error("There was an error while trying to attach a <strong>Draft Author</strong> to this draft.<br /><br />The system administrator was informed of this error; please try again later.");
                         application_log("error", "Unable to insert a new draft_contact record while adding a new draft. Database said: " . $db->ErrorMsg());
                     }
                 }
             }
         }
         if ($draft->deleteOptions()) {
             if ($PROCESSED["options"]) {
                 foreach ($PROCESSED["options"] as $option) {
                     $option["draft_id"] = $draft_id;
                     $new_draft_option = new Models_Event_Draft_Option($option);
                     if (!$new_draft_option->insert()) {
                         application_log("error", "Error when saving draft [" . $draft_id . "] options, DB said: " . $db->ErrorMsg());
                     }
Ejemplo n.º 2
0
                 $csv_success = $csv_importer->getSuccess();
                 add_success("Entrada is in demo mode therefore the Entrada demo csv file was used for this import instead of <strong>" . html_encode($_FILES["csv_file"]["name"]) . "</strong>.<br /><br />You will now be redirected to the edit draft page; this will happen automatically in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/events/drafts?section=edit&draft_id=" . $draft_id . "\">click here</a> to continue.");
                 echo display_success();
                 $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/events/drafts?section=edit&draft_id=" . $draft_id . "\\'', 5000)";
                 application_log("success", "Proxy_id [" . $ENTRADA_USER->getActiveId() . "] successfully imported " . count($csv_success) . " events into draft_id [" . $draft_id . "].");
             }
         }
     } else {
         application_log("error", "Unable to find expected file [" . CACHE_DIRECTORY . "/" . $PROCESSED["csv_filename"] . "]");
         add_error("An error ocurred while attempting to upload the CSV file. An administrator has been informed, please try again later.");
     }
     break;
 case 1:
 default:
     $draft = Models_Event_Draft::fetchRowByID($draft_id);
     $draft_creator = Models_Event_Draft_Creator::fetchRowByDraftIDProxyID($draft_id, $proxy_id);
     if ($draft && $draft->getStatus() == "open" && $draft_creator) {
         $unmapped_fields = $csv_headings;
         if (isset($_FILES["csv_file"])) {
             switch ($_FILES["csv_file"]["error"]) {
                 case 1:
                 case 2:
                 case 3:
                     add_error("The file that uploaded did not complete the upload process or was interupted. Please <a href=\"" . ENTRADA_RELATIVE . "/admin/events/drafts?section=edit&draft_id=" . $draft_id . "\">click here</a> and try your CSV again.");
                     break;
                 case 4:
                     add_error("You did not select a file on your computer to upload. Please <a href=\"" . ENTRADA_RELATIVE . "/admin/events/drafts?section=edit&draft_id=" . $draft_id . "\">click here</a> and try your CSV import again.");
                     break;
                 case 6:
                 case 7:
                     add_error("Unable to store the new file on the server, please <a href=\"" . ENTRADA_RELATIVE . "/admin/events/drafts?section=edit&draft_id=" . $draft_id . "\">click here</a> and try again.");