/** * Delete specific project group * * @param void * @return null */ function delete() { if ($this->active_project_group->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_project_group->canDelete($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->request->isSubmitted()) { $delete = $this->active_project_group->delete(); if ($delete && !is_error($delete)) { if ($this->request->getFormat() == FORMAT_HTML) { flash_success("Project group ':name' has been deleted", array('name' => $this->active_project_group->getName())); $this->redirectTo('project_groups'); } else { $this->httpOk(); } // if } else { if ($this->request->getFormat() == FORMAT_HTML) { flash_error("Failed to delete ':name' group. Reason: :reason", array('name' => $this->active_project_group->getName(), 'reason' => $delete->getMessage())); $this->redirectTo('project_groups'); } else { $this->serveData($delete); } // if } // if } else { $this->httpError(HTTP_ERR_BAD_REQUEST); } // if }