/** * Save an entry * * @return void */ public function saveTask() { // Check for request forgeries Request::checkToken(); //get category info $category = Request::getVar('category', array()); //set path $category['parent_id'] = 21; // root $category['level'] = 1; $category['path'] = isset($category['alias']) ? $category['alias'] : ''; $category['published'] = 1; $category['access'] = 1; $row = new Category($this->database); if (!$row->save($category)) { throw new Exception($row->getError(), 500); } //$row->updateOrder("section='$row->section'"); //if ($oldtitle = Request::getVar('oldtitle', null, 'post')) //{ // if ($oldtitle != $row->title) // { // $this->database->setQuery("UPDATE #__menu SET name='$row->title' WHERE name='$oldtitle' AND type='content_category'"); // $this->database->query(); // } //} //// Update Section Count //if ($row->section != 'com_weblinks') //{ // $this->database->setQuery("UPDATE #__sections SET count=count+1 WHERE id = '$row->section'"); //} //if (!$this->database->query()) //{ // throw new Exception($this->database->getErrorMsg(), 500); //} // Redirect App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false)); }