/** * Displays the list view * @param string $tpl */ public function display($tpl = null) { $tour_model = new BookProModelTours(); $this->state = $this->get('State'); $input = JFactory::getApplication()->input; $this->tours = $tour_model->getItemByIds(); $tour_id = $this->state->get('filter.tour_id'); if (empty($tour_id)) { $this->state->set('filter.tour_id', $this->tours[0]->id); } $from_date = $this->state->get('filter.from_date'); if (empty($from_date)) { $this->state->set('filter.from_date', JHtml::date('now', 'Y-m-d')); } $to_date = $this->state->get('filter.to_date'); if (empty($to_date)) { $this->state->set('filter.to_date', JHtml::date('now', 'Y-m-d')); } $this->state->set('filter.order_status', 'CONFIRMED'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->total_order = $this->get('TotalBooking'); $this->total_pass = $this->get('Total'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); parent::display($tpl); }
public function display($tpl = null) { if (!$this->is_admin) { $model = new BookproModelpassengers(); $this->setModel($model, true); } $this->state = $this->get('State'); $tour_model = new BookProModelTours(); $this->tours = $tour_model->getItemByIds(); $tour_id = $this->state->get('filter.tour_id'); if (empty($tour_id)) { $this->state->set('filter.tour_id', $this->tours[0]->id); } $from_date = $this->state->get('filter.from_date'); if (empty($from_date)) { $this->state->set('filter.from_date', JHtml::date('now', 'Y-m-d')); } $to_date = $this->state->get('filter.to_date'); if (empty($to_date)) { $this->state->set('filter.to_date', JHtml::date('now', 'Y-m-d')); } $this->state->set('filter.order_status', 'CONFIRMED'); $this->state->set('list.limit', null); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->total_order = $this->get('TotalBooking'); $this->total_pass = $this->get('Total'); $this->agent = JBFactory::getAccount(); $this->authorise = $this->agent->authorise; if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } JHtml::_('formbehavior.chosen', 'select'); parent::display($tpl); }