예제 #1
0
파일: Touritem.php 프로젝트: hoalangoc/ftf
 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);
 }
예제 #2
0
 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.')));
     }
 }