/** * Method that delete a project and returns the result of operation * * @param \Library\HttpRequest $rq * @return JSON */ public function executeDelete(\Library\HttpRequest $rq) { // Init result $result = $this->InitResponseWS(); $db_result = FALSE; $project_id = intval($this->dataPost["project_id"]); //Check if the project to be deleted if the Project manager's $project_selected = \Applications\PMTool\Helpers\ProjectHelper::GetAndStoreCurrentProject($this->app()->user(), $project_id); //Load interface to query the database if ($project_selected !== NULL) { $manager = $this->managers->getManagerOf($this->module()); $db_result = $manager->delete($project_selected, "project_id"); \Applications\PMTool\Helpers\ProjectHelper::UnsetUserSessionProject($this->app()->user(), $project_id); } $this->SendResponseWS($result, array("resx_file" => \Applications\PMTool\Resources\Enums\ResxFileNameKeys::Project, "resx_key" => $this->action(), "step" => $db_result !== FALSE ? "success" : "error")); }