public static function deleteByUrl($url) { $db = FrontController::getInstance()->getDbAdapter(); $navigationItem = new Navigation_Model_Item(); $query = "SELECT * FROM {$navigationItem->table} WHERE url = {$db->quote($url)}"; $rows = $db->fetchAll($query); $numRows = count($rows); for ($i = 0; $i < $numRows; $i++) { $navigationItem->setRow($rows[$i]); $navigationItem->delete(); } }
public function indexAction() { echo $this->getLinks(); echo 'this is the index'; $track = new Navigation_Model_Track(2); echo $track->getHtml('test-track'); // $track->save(); $item = new Navigation_Model_Item(); $item->setRow(array( 'trackId' => 1, 'title' => 'test item' )); // $item->save(); // show_array($item->errors); }
public function addItemAction() { $title = Redokes_Controller_Front::getInstance()->getParam('title', 'New') . ' Child'; $trackId = intval(Redokes_Controller_Front::getInstance()->getParam('trackId', 0)); $parentId = intval(Redokes_Controller_Front::getInstance()->getParam('parentId', 0)); $url = Redokes_Controller_Front::getInstance()->getParam('url', '#'); $item = new Navigation_Model_Item(); $item->setRow(array( 'title' => $title, 'trackId' => $trackId, 'parentId' => $parentId, 'url' => $url )); $item->save(); $this->setParam('itemId', $parentId); $this->setParam('trackId', $trackId); $track = new Navigation_Model_Track($trackId); $track->clearCache(); $this->addMessage($item->row['title'] . ' added'); }