/**
  * Returns the user form record
  * This method could accept a template object
  * or simply a user form ID. Both of this is
  * passed through the variable $template.
  *
  * The flag $for_id decides what is passed
  */
 public static function GetFormFromDocumentID($caller, $document_id)
 {
     $documentformDAO = new \Applications\PMTool\Models\Dao\Document();
     $documentformDAO->setDocument_id($document_id);
     $dal = $caller->managers()->getManagerOf("Task");
     return $dal->selectMany($documentformDAO, "document_id");
 }
 public function executeRemove(\Library\HttpRequest $rq)
 {
     $result = $this->InitResponseWS();
     $dataPost = $this->dataPost();
     $manager = $this->managers()->getManagerOf("Document");
     $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));
     $directory = str_replace("_id", "", $dataPost['itemCategory']);
     $manager->setObjectDirectory($directory);
     $document = new \Applications\PMTool\Models\Dao\Document();
     $document->setDocument_id($dataPost['document_id']);
     $document = $manager->selectOne($document);
     $result['dataOut'] = -1;
     if ($document !== NULL) {
         $result['dataOut'] = $manager->deleteWithFile($document, 'document_id');
     }
     $this->SendResponseWS($result, array("directory" => "common", "resx_file" => \Library\Enums\ResourceKeys\ResxFileNameKeys::File, "resx_key" => $this->action(), "step" => $result["dataOut"] === true ? "success" : "error"));
 }