/** * Pin project * * @param void * @return null */ function pin() { if ($this->active_project->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if ($this->request->isSubmitted()) { $pin = PinnedProjects::pinProject($this->active_project, $this->logged_user); if ($pin && !is_error($pin)) { if ($this->request->isAsyncCall()) { die($this->active_project->getUnpinUrl()); } else { flash_success("Project ':name' has been marked as favorite", array('name' => $this->active_project->getName())); } //if } else { if ($this->request->isAsyncCall()) { $this->httpError(HTTP_ERR_OPERATION_FAILED); } else { flash_error("Failed to mark ':name' project as favorite", array('name' => $this->active_project->getName())); } // if } // if $this->redirectToReferer(assemble_url('dashboard')); } else { $this->httpError(HTTP_ERR_BAD_REQUEST); } // if }