/** * Quick add project category * * @param void * @return null */ function quick_add_category() { if ($this->request->isSubmitted() && $this->request->isAsyncCall()) { $this->active_category = new Category(); $this->active_category->setAttributes($this->request->post('category')); $this->active_category->setModule($this->active_module); $this->active_category->setController($this); $this->active_category->setProjectId($this->active_project->getId()); $this->active_category->setCreatedBy($this->logged_user); $this->active_category->setState(STATE_VISIBLE); $this->active_category->setVisibility(VISIBILITY_NORMAL); $save = $this->active_category->save(); if ($save && !is_error($save)) { print $this->active_category->getId(); die; } else { $this->serveData($save); } // if } else { $this->httpError(HTTP_ERR_BAD_REQUEST); } // if }