public function post() { $name = $this->request->getPost('name'); if (empty($name)) { return false; } $this->category->name = $name; $this->category->put(); return "/admin/categories/{$this->category->id}"; }
public function post() { include_once 'application/models/Categories.php'; $name = $this->request->getPost('name'); if (empty($name)) { return false; } $category = new Categories(); $category->name = $name; $category->put(); return "/admin/categories/{$category->id}"; }
} // new version of page overlay $overlay = Overlay::bind($_REQUEST['overlay_type']); } // when the page has been overlaid if (is_object($overlay)) { // allow for change detection $overlay->snapshot(); // update the overlay from form content $overlay->parse_fields($_REQUEST); // save content of the overlay in the category itself $_REQUEST['overlay'] = $overlay->save(); $_REQUEST['overlay_id'] = $overlay->get_id(); } // display the form on error if (($error = Categories::put($_REQUEST)) || is_object($overlay) && !$overlay->remember('update', $_REQUEST, 'category:' . $_REQUEST['id'])) { Logger::error($error); $item = $_REQUEST; $with_form = TRUE; // else display the updated page } else { // cascade changes on access rights if ($_REQUEST['active'] != $item['active']) { Anchors::cascade('category:' . $item['id'], $_REQUEST['active']); } // touch the related anchor if (is_object($anchor)) { $anchor->touch('category:update', $item['id'], isset($_REQUEST['silent']) && $_REQUEST['silent'] == 'Y'); } // clear cache Categories::clear($_REQUEST);