Ejemplo n.º 1
0
 public function executeAddMaster(\Library\HttpRequest $rq)
 {
     // Init result
     $result = $this->InitResponseWS();
     $files = $this->files();
     if ($this->dataPost["title"] == "" or is_null($this->dataPost["title"])) {
         $this->dataPost["title"] = $files["file"]["name"];
     }
     $form = \Applications\PMTool\Helpers\FormHelper::PrepareMasterFormObject($this->dataPost());
     $result["dataIn"] = $form;
     $manager = $this->managers->getManagerOf("MasterForm");
     $manager->setRootDirectory($this->app()->config()->get(\Library\Enums\AppSettingKeys::RootDocumentUpload));
     $manager->setWebDirectory($this->app()->config()->get(\Library\Enums\AppSettingKeys::BaseUrl) . $this->app()->config()->get(\Library\Enums\AppSettingKeys::RootUploadsFolderPath));
     $result["dataOut"] = $manager->addWithFile($form, $files['file']);
     $this->SendResponseWS($result, array("resx_file" => \Applications\PMTool\Resources\Enums\ResxFileNameKeys::Form, "resx_key" => $this->action(), "step" => intval($result["dataOut"]) > 0 ? "success" : "error"));
 }