Пример #1
0
                 } else {
                     add_error("An error occurred when attempting to update a logbook entry [" . $PROCESSED["lentry_id"] . "], an administrator has been informed, please try again later.");
                     application_log("error", "Error occurred when updating logbook entry, DB said: " . $db->ErrorMsg());
                 }
             } else {
                 if ($entry->fromArray($PROCESSED)->insert()) {
                     add_success("The entry has successfully been updated. You will be redirected to the logbook index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/logbook\">click here</a> if you do not wish to wait.");
                     add_statistic("encounter_tracking", "insert", "lentry_id", $db->Insert_ID(), $ENTRADA_USER->getID());
                 } else {
                     add_error("An error occurred when attempting to create a new logbook entry, an administrator has been informed, please try again later.");
                     application_log("error", "Error occurred when updating logbook entry, DB said: " . $db->ErrorMsg());
                 }
             }
         } else {
             $entry = new Models_Logbook_Entry();
             $entry->fromArray($PROCESSED);
             $STEP = 1;
         }
         break;
     default:
         break;
 }
 switch ($STEP) {
     case 2:
         if ($ERROR) {
             echo display_error();
             $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/logbook\\'', 5000)";
         }
         if ($SUCCESS) {
             echo display_success();
             $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/logbook\\'', 5000)";
Пример #2
0
             $objective_array["updated_by"] = $ENTRADA_USER->getID();
             $objective_array["objective_active"] = 1;
             $entry_objective = new Models_Logbook_Entry_Objective();
             $PROCESSED["objectives"][$objective_id] = $entry_objective->fromArray($objective_array);
         }
     }
 } else {
     add_error("Please select at least one objective");
 }
 if (!$ERROR) {
     $entry = new Models_Logbook_Entry();
     $PROCESSED["proxy_id"] = $ENTRADA_USER->getID();
     $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
     $PROCESSED["updated_date"] = time();
     if (isset($entry_id)) {
         if ($entry->fromArray($PROCESSED)->update()) {
             add_statistic("encounter_tracking", "update", "lentry_id", $PROCESSED["lentry_id"], $ENTRADA_USER->getID());
             echo json_encode(array("status" => "success", "data" => "Successfully updated entry."));
         } else {
             application_log("error", "Error occurred when updating logbook entry, DB said: " . $db->ErrorMsg());
             echo json_encode(array("status" => "error", "data" => array("An error occured while attemptin to update this entry.")));
         }
     } else {
         if ($entry->fromArray($PROCESSED)->insert()) {
             add_statistic("encounter_tracking", "insert", "lentry_id", $db->Insert_ID(), $ENTRADA_USER->getID());
             echo json_encode(array("status" => "success", "data" => array("The entry has been saved successfully.")));
         } else {
             application_log("error", "Error occurred when updating logbook entry, DB said: " . $db->ErrorMsg());
             echo json_encode(array("status" => "error", "data" => array("An error occurred when attempting to create a new logbook entry, an administrator has been informed, please try again later.")));
         }
     }