Ejemplo n.º 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;
         }
         $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);
 }
Ejemplo n.º 2
0
    public static function select_currency($list_currency = array(), $name, $default = '0', $attrib = "onchange='submit();'", $zero = true, $chosenDropDowns = true, $tranlsate = true)
    {
        $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_currency/html_select_currency.js');
        $doc->addLessStyleSheet(JUri::root() . 'administrator/components/com_tsmart/assets/js/controller/select_currency/html_select_currency.less');
        $input = JFactory::getApplication()->input;
        if (empty($list_currency)) {
            require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmcurrency.php';
            $list_currency = tsmcurrency::get_list_currency();
        }
        $id_element = 'html_select_service_class_' . $name;
        ob_start();
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function ($) {
                $('#<?php 
        echo $id_element;
        ?>
').html_select_currency({
                    list_tour:<?php 
        echo json_encode($list_currency);
        ?>
,
                    select_name: "<?php 
        echo $name;
        ?>
",
                    tsmart_language_id:<?php 
        echo $default ? $default : 0;
        ?>
                });
            });
        </script>
        <?php 
        $script_content = ob_get_clean();
        $script_content = TSMUtility::remove_string_javascript($script_content);
        $doc->addScriptDeclaration($script_content);
        ob_start();
        ?>
        <div id="<?php 
        echo $id_element;
        ?>
">
            <select disable_chosen="true" id="<?php 
        echo $name;
        ?>
" name="<?php 
        echo $name;
        ?>
">
                <option value=""><?php 
        echo JText::_('please select currency');
        ?>
</option>
                <?php 
        foreach ($list_currency as $currency) {
            ?>
                    <option <?php 
            echo $currency->tsmart_currency_id == $default ? ' selected ' : '';
            ?>
                        value="<?php 
            echo $currency->tsmart_currency_id;
            ?>
"><?php 
            echo $currency->currency_name;
            ?>
</option>
                <?php 
        }
        ?>
            </select>
        </div>
        <?php 
        $html = ob_get_clean();
        return $html;
    }