Example #1
0
 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;
         }
         $model->setId($cid);
         $this->departure = $model->getdeparture();
         $this->SetViewTitle('', $this->departure->departure_name);
         $this->addStandardEditViewCommands();
     } else {
         $model_product = tmsModel::getModel('product');
         $model_tour_class = tmsModel::getModel('tourclass');
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmdeparture.php';
         $this->list_tour = tsmDeparture::get_list_tour_jont_group();
         $this->list_tour_class = $model_tour_class->getItemList();
         $this->SetViewTitle();
         $this->addStandardDefaultViewCommandsDeparture();
         $this->addStandardDefaultViewLists($model, 0, 'ASC');
         $this->list_departure = $model->getItemList(vRequest::getCmd('search'));
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
Example #2
0
 public function ajax_get_list_departure_by_tour_id()
 {
     $input = JFactory::getApplication()->input;
     $tsmart_product_id = $input->getInt('tsmart_product_id');
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmdeparture.php';
     $list_departure = tsmDeparture::get_list_departure_by_tour_id($tsmart_product_id);
     echo json_encode($list_departure);
     die;
 }
Example #3
0
 public function create_children_departure($tsmart_departure_id)
 {
     $query = $this->_db->getQuery(true);
     $query->delete('#__tsmart_departure')->where('tsmart_departure_parent_id=' . (int) $tsmart_departure_id);
     $this->_db->setQuery($query);
     $ok = $this->_db->execute();
     if (!$ok) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $table_departure = $this->getTable();
     $table_departure->load($tsmart_departure_id);
     $date_type = $table_departure->date_type;
     if ($date_type == 'day_select') {
         $days_seleted = explode(',', $table_departure->days_seleted);
     } else {
         $sale_period_from = $table_departure->sale_period_from;
         $sale_period_to = $table_departure->sale_period_to;
         $days_seleted = TSMUtility::dateRange($sale_period_from, $sale_period_to);
         $weekly = $table_departure->weekly;
         $weekly = explode(',', $weekly);
         foreach ($days_seleted as $key => $day) {
             $day_of_week = strtolower(date('D', strtotime($day)));
             if (!in_array($day_of_week, $weekly)) {
                 unset($days_seleted[$key]);
             }
         }
     }
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmdeparture.php';
     foreach ($days_seleted as $day) {
         $table_departure->departure_date = $day;
         $day = JFactory::getDate($day);
         $table_departure->tsmart_departure_id = 0;
         $table_departure->departure_code = tsmDeparture::get_format_departure_code($tsmart_departure_id, $day);
         $table_departure->tsmart_departure_parent_id = $tsmart_departure_id;
         $ok = $table_departure->store();
         if (!$ok) {
             $this->setError($table_departure->getErrors());
             return false;
         }
     }
     return true;
 }
Example #4
0
    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;
    }