示例#1
0
 public function get_detail_hotel()
 {
     $input = JFactory::getApplication()->input;
     $tsmart_hotel_id = $input->getInt('tsmart_hotel_id', 0);
     $db = JFactory::getDbo();
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmhoteladdon.php';
     $hotel = tsmHotelAddon::get_detail_hotel_by_hotel_id($tsmart_hotel_id);
     echo json_encode($hotel);
     die;
 }
示例#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);
 }