Exemplo n.º 1
0
 /**
  * Methode zum Anzeigen des Contents.
  *
  * @return String Content der Applikation.
  */
 public function Display()
 {
     $view = new GenericView("import");
     if (count($this->params) > 0) {
         if ($this->params[0] == "upload") {
             $fileType = FileHelper::getInstance()->getFileTypeUploadedFile('importfile');
             $filePath = $_SERVER['DOCUMENT_ROOT'] . "/import/" . uniqid() . "." . $fileType;
             $resp = FileHelper::getInstance()->saveUploadedFile('importfile', $filePath);
             if ($resp !== true) {
                 LogHelper::getInstance()->logError(FileHelper::getInstance()->evaluateFailure($resp));
             } else {
                 $resp = DatabaseService::getInstance()->importDatabase($filePath);
                 if ($resp == true) {
                     LogHelper::getInstance()->logUserInfo(LocaleService::getInstance()->getResources()->getKey("SUCCESS_GENERAL"));
                 } else {
                     LogHelper::getInstance()->logError(DatabaseService::getInstance()->evaluateError($resp));
                 }
             }
         }
     }
     return $this->returnView($view);
 }
Exemplo n.º 2
0
 public function create(BaseDatabaseModel $model)
 {
     $table = $this->getTableName($model);
     if ($table != null) {
         $arr = $table->getPreparedValuesFromObject(parent::getDatabaseDriver(), $model);
         $arr["ChangeDateTime"] = FormatHelper::getInstance()->dateTimeFromString("now");
         $arr["CreateDateTime"] = FormatHelper::getInstance()->dateTimeFromString("now");
         $arr["ChangedById"] = AuthenticationService::getInstance()->getUser()->getId();
         $arr["CreatedById"] = AuthenticationService::getInstance()->getUser()->getId();
         $arr = $this->cleanUpGenericArray($arr);
         if (isset($arr["Id"])) {
             unset($arr["Id"]);
         }
         $resp = $this->insertInternal($table, $arr);
         if ($resp !== false) {
             $model->setId($resp);
             return true;
         }
     }
     return false;
 }