/** * Delete document category * * @param void * @return void */ function delete() { if ($this->active_document_category->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_document_category->canDelete($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->request->isSubmitted()) { db_begin_work(); $delete = $this->active_document_category->delete(); if ($delete && !is_error($delete)) { db_commit(); if ($this->request->isApiCall()) { $this->httpOk(); } else { flash_success('Document category ":name" has been deleted', array('name' => $this->active_document_category->getName())); $this->redirectTo('document_categories'); } // if } else { db_rollback(); if ($this->request->isAsyncCall()) { $this->serveData($delete); } else { flash_success('Failed to delete ":name" document category', array('name' => $this->active_document_category->getName())); $this->redirectTo('document_categories'); } // if } // if } else { $this->httpError(HTTP_ERR_BAD_REQUEST); } // if }
</option> <?php } ?> </select> </div> </td> </tr> <?php $id = Request::get("id"); if (is_numeric($id) && $id > 0) { $documentcategoryObj = new DocumentCategory(); $documentcategoryObj->set("id", $id); $result = $documentcategoryObj->getName(); if (count($result)) { $row = $result[0]; $id = $row['id']; $doc_type_id = $row['doc_type_id']; $name = $row['name']; $active = $row['active']; } } ?> <tr> <td><label class="control-label" for="selectError">type of Document Category</label></td> <td><div class="input-group" style="width: 50%"> <span class="input-group-addon"></span> <input type="text" name="name" class="form-control" placeholder="type of Document Category" required=""> </div>