function display($tpl = null) { // Load the helper(s) if (!class_exists('VmHTML')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php'; } $model = tmsModel::getModel(); $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; } $this->view_height = 1000; $model->setId($cid); $this->item = $model->getItem(); //get list tour require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmpayment.php'; $this->item->list_tour_id = vmPayment::get_list_tour_id_by_payment_id($this->item->tsmart_payment_id); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php'; $this->list_tour = vmproduct::get_list_product(); //end get list tour require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmcurrency.php'; $list_currency = tsmcurrency::get_list_currency(); $this->assignRef('list_currency', $list_currency); //get list payment method require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmpaymentmethod.php'; $list_payment_method = vmpaymentmethod::get_list_payment_method(); $this->assignRef('list_payment_method', $list_payment_method); $this->item->list_payment_method_id = vmpaymentmethod::get_list_payment_method_id_by_payment_id($this->item->tsmart_payment_id); //end get list payment method //get list mode payment require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmpaymentmethod.php'; $list_mode_payment = vmpaymentmethod::get_list_mode_payment(); $this->assignRef('list_mode_payment', $list_mode_payment); //end get list mode payment $this->SetViewTitle('', $this->item->title); $this->addStandardEditViewCommandsPopup(); } else { $this->SetViewTitle(); $this->addStandardDefaultViewCommands(); $this->addStandardDefaultViewLists($model, 0, 'ASC'); $this->items = $model->getItemList(vRequest::getCmd('search', false)); $this->pagination = $model->getPagination(); } parent::display($tpl); }
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); }
public static function select_trip_join_and_private($name, $coupon) { $doc = JFactory::getDocument(); $doc->addScript(JUri::root() . '/media/system/js/jquery.utility.js'); $doc->addScript(JUri::root() . '/media/system/js/select2-master/dist/js/select2.full.js'); $doc->addStyleSheet(JUri::root() . '/media/system/js/select2-master/dist/css/select2.css'); $doc->addScript(JUri::root() . '/administrator/components/com_tsmart/assets/js/controller/select_trip_join_and_private/select_trip_join_and_private.js'); $doc->addLessStyleSheet(JUri::root() . '/administrator/components/com_tsmart/assets/js/controller/select_trip_join_and_private/select_trip_join_and_private.less'); $input = JFactory::getApplication()->input; require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php'; $list_service_class = tsmserviceclass::get_list_tour_service_class(); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php'; $list_products = vmproduct::get_list_product(); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmdeparture.php'; $list_departure = tsmDeparture::get_list_departure(); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmtourtype.php'; $list_tour_type = tsmtourtype::get_list_tour_type(); $element_id = 'select_trip_join_and_private_' . $name; ob_start(); ?> <script type="text/javascript"> jQuery(document).ready(function ($) { $('#<?php echo $element_id; ?> ').select_trip_join_and_private({ list_tour:<?php echo json_encode($list_products); ?> }); }); </script> <?php $script_content = ob_get_clean(); $script_content = TSMUtility::remove_string_javascript($script_content); $doc->addScriptDeclaration($script_content); ob_start(); ?> <?php $span_left = 'span4'; $span_right = 'span6'; ?> <div id="<?php echo $element_id; ?> " class="select_trip_join_and_private"> <div class="row-fluid"> <div class="<?php echo $span_left; ?> "> <?php echo JText::_('Select tour type'); ?> </div> <div class="<?php echo $span_right; ?> "> <select name="private_or_joingroup" class="tour_type"> <option value=""><?php echo JText::_('Please select tour type'); ?> </option> <?php foreach ($list_tour_type as $tour_type) { ?> <option value="<?php echo $tour_type->tsmart_tour_type_id; ?> "><?php echo $tour_type->title; ?> </option> <?php } ?> </select> </div> </div> <div class="row-fluid"> <div class="<?php echo $span_left; ?> "> <?php echo JText::_('Select trip'); ?> </div> <div class="<?php echo $span_right; ?> "> <div class="list_tour"> <?php foreach ($list_products as $tour) { ?> <label class="checked" data-tsmart_product_id="<?php echo $tour->tsmart_product_id; ?> "><?php echo $tour->product_name; ?> <input name="tour[]" class="checkbox tsmart_product_id" type="checkbox" value="<?php echo $tour->tsmart_product_id; ?> "/></label> <?php } ?> </div> </div> </div> <div class="row-fluid air-service-class"> <div class="<?php echo $span_left; ?> "> <?php echo JText::_('Select service class'); ?> </div> <div class="<?php echo $span_right; ?> "> <div class="list_service_class"> <?php foreach ($list_service_class as $service_class) { ?> <label class="checked" data-tsmart_service_class_id="<?php echo $service_class->tsmart_service_class_id; ?> "><?php echo $service_class->service_class_name; ?> <input name="service_class[]" type="checkbox" value="<?php echo $service_class->tsmart_service_class_id; ?> "/></label> <?php } ?> </div> </div> </div> <div class="row-fluid air-departure"> <div class="<?php echo $span_left; ?> "> <?php echo JText::_('Select departure item'); ?> </div> <div class="<?php echo $span_right; ?> "> <div class="list_departure"> <?php foreach ($list_departure as $departure) { ?> <div class="row-fluid departure-item" data-tsmart_departure_id="<?php echo $departure->tsmart_departure_id; ?> "> <div class="span6"> <label>Departure:<?php echo JHtml::_('date', $departure->departure_date, tsmConfig::$date_format); ?> <input type="checkbox" value="<?php echo $departure->tsmart_departure_id; ?> " name="departure[]"></label></div> <div class="span2"></div> <div class="span4">Code:<?php echo $departure->departure_code; ?> </div> </div> <?php } ?> </div> </div> </div> </div> <?php $html = ob_get_clean(); return $html; }