public function setPriorityLast() { $model = new Yntour_Model_DbTable_Touritems(); $db = $model->getAdapter(); $table = $model->info('name'); $sql = 'select count(*) from ' . $table . ' where tour_id=' . (int) $this->tour_id; $this->priority = (int) $db->fetchOne($sql); }
public function itemDeleteAction() { $form = $this->view->form = new Yntour_Form_Admin_Touritem_Delete(); // In smoothbox $this->_helper->layout->setLayout('admin-simple'); $id = $this->_getParam('item_id'); $model = new Yntour_Model_DbTable_Touritems(); // Check post if ($this->getRequest()->isPost()) { $db = $model->getAdapter(); $db->beginTransaction(); try { $item = $model->find($id)->current(); // delete the blog entry into the database $item->delete(); $db->commit(); } catch (Exception $e) { $db->rollBack(); throw $e; } $this->_forward('success', 'utility', 'core', array('smoothboxClose' => 10, 'parentRefresh' => 10, 'messages' => array('Successful.'))); } }