Пример #1
0
 /**
  * Loads the template [View] object.
  */
 public function before()
 {
     parent::before();
     if ($this->auto_render === TRUE) {
         // Load the template
         $this->smarty_object = View::factory($this->template);
     }
 }
Пример #2
0
 public function action_transportCatalog()
 {
     $tplObj = \smarty\View::factory('catalog');
     $page = $this->request->post('page');
     $offset = $this->request->post('offset');
     $is_pagination = $this->request->post('is_pagination');
     $pagination = false;
     if ($is_pagination) {
         $data = \Model\TransportCompany::model()->count();
         $p_factory = \Pagination::factory(array('total_items' => $data));
         $tplObj->assign(['pagination' => $p_factory]);
         $pagination = $tplObj->fetch('catalog' . DS . 'pagination.tpl');
     }
     $offset = $this->per_page * ($page - 1);
     if (Request::current()->is_ajax()) {
         $criteria = new \DBCriteria();
         $criteria->limit = $this->per_page;
         $criteria->offset = $offset;
         $data = \Model\TransportCompany::model()->with(['companyAttacheds'])->findAll($criteria);
         $tplObj->assign(['data' => $data]);
         $this->response->body(json_encode(['pagination' => $pagination, 'content' => $tplObj->fetch('catalog' . DS . 'transport.tpl')]));
     }
 }
Пример #3
0
 public function action_getPlaceInfo()
 {
     $id_place = $this->request->post('id');
     if (Request::current()->is_ajax() && $id_place) {
         $criteria = new \DBCriteria();
         $criteria->condition = '';
         $data = \Model\PlacesInfo::model()->with(array('idplaces0' => array('select' => 'idplaces0.name', 'joinType' => 'INNER JOIN')))->findByAttributes(['idplaces' => $id_place]);
         $tplObj = \smarty\View::factory('places');
         $tplObj->assign(['data' => $data]);
         $this->response->body(json_encode(['content' => $tplObj->fetch('places' . DS . 'place_info.tpl')]));
     }
 }
Пример #4
0
 public function action_fullHistory()
 {
     if (Request::current()->is_ajax()) {
         $sender_id = \Registry::getCurrentUser()->id;
         $receiver_id = $this->request->post('receiver_id');
         $session = $this->request->post('session');
         $user_full_history = $this->userCustomHistory($sender_id, $receiver_id, $session);
         $tplObj = \smarty\View::factory('chat' . DS . 'history_ajax');
         $tplObj->assign(['full_history' => $user_full_history, 'sender_id' => $sender_id]);
         $this->response->body($tplObj);
         return true;
     }
 }