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); }
protected function _postDelete() { parent::_postDelete(); $model = new Yntour_Model_DbTable_Touritems(); $select = $model->select()->where('tour_id=?', $this->getIdentity()); foreach ($model->fetchAll($select) as $row) { $row->delete(); } }
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.'))); } }
public function loadTour($path, $mode) { $model = new Yntour_Model_DbTable_Tours(); $select = $model->select()->where('path=?', urldecode($path)); $setting = Engine_Api::_()->getApi('settings', 'core')->getSetting('yntourmode', 'disable'); if ($setting == 'disabled') { $select->where('enabled=?', 1); } $tour = $model->fetchRow($select); if (!is_object($tour)) { return array('id' => 0, 'total' => 0, 'rows' => array(), 'autoplay' => 0, 'autoclose' => 0, 'autoclose_time_delay' => 0, 'hash' => '', 'view_rule' => 'all'); } $model = new Yntour_Model_DbTable_Touritems(); $select = $model->select()->where('tour_id=?', $tour->getIdentity())->order('priority'); $rows = $model->fetchAll($select)->toArray(); $result = array('hash' => $tour->hash, 'total' => count($rows), 'id' => $tour->getIdentity(), 'rows' => $rows, 'autoplay' => $tour->autoplay, 'autoclose' => $tour->autoclose, 'autoclose_time_delay' => $tour->autoclose_time_delay, 'hash' => $tour->hash, 'view_rule' => $tour->view_rule); return $result; }
public function editStepAction() { $form = $this->view->form = new Yntour_Form_Touritem_Create(); //https://jira.younetco.com/browse/CHECKDEMO-134 left & top doesn't have means when create new step $form->removeElement("left_position"); $form->removeElement("top_position"); $model = new Yntour_Model_DbTable_Touritems(); $id = $this->_getParam('touritem_id', 0); $request = $this->getRequest(); $language_select = $this->view->translate()->getLocale(); if ($request->isGet()) { $x = $this->_getParam('x'); $y = $this->_getParam('y'); $form->populate(array('left_position' => $x, 'top_position' => $y)); return; } if ($request->isPost() && $form->isValid($request->getPost())) { $data = $form->getValues(); $item = $model->fetchNew(); $item->creation_date = date('Y-m-d H:i:s'); $item->setFromArray($data); $item->tour_id = $request->getParam('tour_id'); $item->dompath = str_replace('.is_active', '', urldecode($request->getParam('dompath'))); $item->save(); $model_language = new Yntour_Model_DbTable_Itemlanguages(); $model_language->updateLanguage($item->touritem_id, $data['body'], $language_select); $this->_forward('success', 'utility', 'core', array('smoothboxClose' => 10, 'parentRefresh' => 10, 'messages' => array('Successful.'))); } }