Exemple #1
0
 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);
 }
Exemple #2
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = tmsModel::getModel();
     $input = JFactory::getApplication()->input;
     $task = $input->get('task');
     $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();
         //get list tour
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmhoteladdon.php';
         $this->item->list_tour_id = tsmHotelAddon::get_list_tour_id_by_hotel_addon_id($this->item->tsmart_hotel_addon_id);
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php';
         $list_tour = vmproduct::get_list_product();
         $this->assignRef('list_tour', $list_tour);
         //end get list tour
         $this->SetViewTitle('', $this->item->title);
         $this->addStandardEditViewCommandsPopup();
     } else {
         $this->SetViewTitle();
         JToolBarHelper::publishList();
         JToolBarHelper::unpublishList();
         JToolBarHelper::editList();
         JToolBarHelper::addNew('add_new_item');
         JToolBarHelper::deleteList();
         $this->addStandardDefaultViewLists($model, 0, 'ASC');
         $this->items = $model->getItemList();
         $this->pagination = $model->getPagination();
         $this->state = $model->getState();
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmcities.php';
         $this->list_cityarea = tsmcities::get_city_state_country();
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmhoteladdon.php';
         $this->list_hotel_addon_type = tsmHotelAddon::get_list_hotel_addon_type();
         $this->list_hotel_payment_type = tsmHotelAddon::get_list_hotel_payment_type();
         $this->list_hotel_addon_service_class = tsmHotelAddon::get_list_hotel_addon_service_class();
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmhotel.php';
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php';
         $list_tour = vmproduct::get_list_product();
         $this->assignRef('list_tour', $list_tour);
         $this->list_hotel = tsmHotel::get_list_hotel();
         if ($task == 'edit_item' || $task == 'add_new_item') {
             $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();
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmhoteladdon.php';
             $this->hotel = tsmHotelAddon::get_detail_hotel_by_hotel_id($this->item->tsmart_hotel_id);
             $this->tour_id_seletecd = tsmHotelAddon::get_list_tour_id_by_hotel_addon_id($this->item->tsmart_hotel_addon_id);
             //get list tour
             $this->item->list_tour_id = tsmHotelAddon::get_list_tour_id_by_hotel_addon_id($this->item->tsmart_hotel_addon_id);
             //end get list tour
         }
     }
     parent::display($tpl);
 }