Ejemplo n.º 1
0
	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();
		}
	}
Ejemplo n.º 2
0
	public function delete($doAudit = true) {
		// get top level items and delete them, which will delete all children
		$itemTable = new Navigation_Model_Db_Item();
		$select = $itemTable->select()->where('trackId = ?', $this->row->trackId)->where('parentId = 0');
		$rows = $itemTable->fetchAll($select);
		$numRows = count($rows);
		if ($numRows) {
			for ($i = 0; $i < $numRows; $i++) {
				$item = new Navigation_Model_Item();
				$item->row = $rows[$i];
				$item->delete($doAudit);
			}
		}
		parent::delete($doAudit);
	}
Ejemplo n.º 3
0
	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);
	}
Ejemplo n.º 4
0
	public function deleteItemAction() {
		$items = Redokes_Controller_Front::getInstance()->getParam('items', '[]');
		$items = json_decode($items, true);
		for ($i = 0; $i < count($items); $i++) {
			$itemId = intval($items[$i]['itemId']);
			$trackId = intval($items[$i]['trackId']);
			if ($trackId) {
				if ($itemId) {
					// deleting an item
					$item = new Navigation_Model_Item($itemId);
					$item->delete();
					$track = new Navigation_Model_Track($item->row->trackId);
					$track->clearCache();
				}
				else {
					// deleting an entire track
					$track = new Navigation_Model_Track($trackId);
					$track->clearCache();
					$track->delete();
				}
			}
		}
	}