function display($tpl = null) { // Load the helper(s) $app = JFactory::getApplication(); if (!class_exists('VmHTML')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php'; } $task = $app->input->getString('task', ''); $tsmart_product_id = $app->input->getInt('tsmart_product_id', 0); $model = tmsModel::getModel(); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php'; $this->tsmart_product_id = $app->input->get('tsmart_product_id', 0, 'int'); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmhotel.php'; $this->list_hotel = tsmHotel::get_list_hotel(); $this->list_hotel = JArrayHelper::pivot($this->list_hotel, 'tsmart_hotel_id'); $config = JFactory::getConfig(); $layoutName = vRequest::getCmd('layout', 'default'); if ($layoutName == 'edit') { $cid = vRequest::getInt('cid'); $task = vRequest::getCmd('task', 'add'); if ($task != 'add' && !empty($cid) && !empty($cid[0])) { $cid = (int) $cid[0]; } else { $cid = 0; } $model->setId($cid); $this->item = $model->getItem(); $this->SetViewTitle('', $this->item->title); $this->addStandardEditViewCommandsPopup(); } else { $this->item = $model->getItem(); $this->SetViewTitle(); $this->addStandardDefaultViewCommands(); $this->addStandardDefaultViewLists($model, 0, 'ASC'); $this->items = $model->getItemList(vRequest::getCmd('search', false)); $this->pagination = $model->getPagination(); if ($task == 'edit_item' || $task == 'add_new_item') { $app = JFactory::getApplication(); $input = $app->input; $tsmart_itinerary_id = $input->getInt('tsmart_itinerary_id', 0); $tsmart_product_id = $input->getInt('tsmart_product_id', 0); $cid = vRequest::getInt('cid'); $tsmart_accommodation_id = $cid[0]; require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php'; $this->list_service_class = tsmserviceclass::get_list_service_class_by_tour_id($tsmart_product_id); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmaccommodation.php'; $this->list_hotel_selected_by_service_class_id_and_itinerary_id = tsmaccommodation::get_list_hotel_selected_by_service_class_id_and_itinerary_id_accommodation_id($this->list_service_class, $tsmart_itinerary_id, $tsmart_accommodation_id); } } parent::display($tpl); }
<?php $k = 0; for ($i = 0, $n = count($this->items); $i < $n; $i++) { $row = $this->items[$i]; $checked = JHtml::_('grid.id', $i, $row->tsmart_tour_type_id); $published = $this->gridPublished($row, $i); $editlink = JROUTE::_('index.php?option=com_tsmart&view=accommodation&task=' . ($row->tsmart_accommodation_id ? 'add_new_item' : 'edit_item') . '&cid[]=' . $row->tsmart_accommodation_id . '&tsmart_product_id=' . $row->tsmart_product_id . '&tsmart_itinerary_id=' . $row->tsmart_itinerary_id); $edit = $this->gridEdit($row, $i, 'tsmart_tour_type_id', $editlink); $delete = $this->grid_delete_in_line($row, $i, 'tsmart_tour_type_id'); $tsmart_accommodation_id = $row->tsmart_accommodation_id; $tsmart_itinerary_id = $row->tsmart_itinerary_id; require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php'; $list_service_class = tsmserviceclass::get_list_service_class_by_tour_id($this->tsmart_product_id); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmhotel.php'; require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmaccommodation.php'; $list_hotel_selected_by_service_class_id_and_itinerary_id = tsmaccommodation::get_list_hotel_selected_by_service_class_id_and_itinerary_id_accommodation_id($list_service_class, $tsmart_itinerary_id, $tsmart_accommodation_id); $rowspan = 0; foreach ($list_hotel_selected_by_service_class_id_and_itinerary_id as $service_class) { $rowspan += count($service_class->list_hotel) + 1; } $rowspan = $rowspan + 1; ?> <tr class="row<?php echo $k; ?> "> <td class="admin-checkbox" rowspan="<?php echo $rowspan; ?> ">