示例#1
0
 public function display($tpl = null)
 {
     $view = vRequest::getCmd('view', vRequest::getCmd('controller', 'virtuemart'));
     if ($view == 'virtuemart' or $view == 'about' or $this->canDo->get('core.admin') or $this->canDo->get('vm.' . $view)) {
         //Super administrators always have access
         if (JFactory::getApplication()->isSite()) {
             $unoverridable = array('category', 'manufacturer', 'user');
             //This views have the same name and must not be overridable
             if (!in_array($view, $unoverridable)) {
                 if (!class_exists('VmTemplate')) {
                     require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
                 }
                 $template = VmTemplate::getDefaultTemplate();
                 $this->addTemplatePath(VMPATH_ROOT . DS . 'templates' . DS . $template['template'] . DS . 'html' . DS . 'com_virtuemart' . DS . $this->_name);
             }
         }
         $result = $this->loadTemplate($tpl);
         if ($result instanceof Exception) {
             return $result;
         }
         echo $result;
         if ($this->writeJs) {
             vmJsApi::keepAlive();
             echo vmJsApi::writeJS();
         }
         return true;
     } else {
         JFactory::getApplication()->redirect('index.php?option=com_virtuemart', vmText::_('JERROR_ALERTNOAUTHOR'), 'error');
     }
 }
示例#2
0
 public function withKeepAlive()
 {
     if (!class_exists('VirtueMartCart')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
     }
     $cart = VirtueMartCart::getCart();
     if (!empty($cart->cartProductsData)) {
         vmJsApi::keepAlive(1, 4);
     }
 }
示例#3
0
    public function display($tpl = null)
    {
        $view = vRequest::getCmd('view', vRequest::getCmd('controller', 'tsmart'));
        $doc = JFactory::getDocument();
        $input = JFactory::getApplication()->input;
        $this->add_new_popup = $input->get('add_new_popup', 0, 'string');
        $this->close_window_children = $input->get('close_window_children', 0, 'int');
        $this->show_in_parent_window = $input->get('show_in_parent_window', 0, 'int');
        $dialog_element_id = $input->get('dialog_element_id', '', 'string');
        $close_ui_dialog_id = $input->get('ui_dialog_id', '', 'string');
        $parent_ui_dialog_id = $input->get('ui_dialog_id', '', 'string');
        $link_reload = $input->get('link_redirect', base64_encode('index.php?option=com_tsmart&view=' . $view), 'string');
        $parent_iframe_id = $input->get('iframe_id', '', 'string');
        $reload_iframe_id = $input->get('reload_iframe_id', '', 'string');
        $remove_ui_dialog = $input->get('remove_ui_dialog', false, 'boolean');
        $small_form = $input->get('small_form', 0, 'int');
        if ($this->show_in_parent_window == 1) {
            $doc->addScript(JUri::root() . '/administrator/components/com_tsmart/assets/js/asianventure_edit_from.js');
            $doc->addScript(JUri::root() . '/media/system/js/base64.js');
            $doc->addLessStyleSheet(JUri::root() . '/administrator/components/com_tsmart/assets/less/view_component.less');
            $js_content = '';
            ob_start();
            ?>
            <script type="text/javascript">
                jQuery(document).ready(function ($) {
                    $('.admin.com_tsmart.view-<?php 
            echo $view;
            ?>
').asianventure_edit_from({
                        show_in_parent_window:<?php 
            echo $this->show_in_parent_window == 1 ? 1 : 0;
            ?>
,
                        view_height:<?php 
            echo $this->view_height ? $this->view_height : 0;
            ?>
,
                        close_window_children:<?php 
            echo $this->close_window_children;
            ?>
,
                        dialog_element_id:'<?php 
            echo $dialog_element_id;
            ?>
',
                        link_reload:'<?php 
            echo $link_reload;
            ?>
',
                        parent_iframe_id:'<?php 
            echo $parent_iframe_id;
            ?>
',
                        parent_ui_dialog_id:'<?php 
            echo $parent_ui_dialog_id;
            ?>
',
                        close_ui_dialog_id:'<?php 
            echo $close_ui_dialog_id;
            ?>
',
                        reload_iframe_id:'<?php 
            echo $reload_iframe_id;
            ?>
',
                        remove_ui_dialog:'<?php 
            echo json_encode($remove_ui_dialog);
            ?>
',
                        small_form:<?php 
            echo $small_form;
            ?>
                    });
                });
            </script>
            <?php 
            $js_content = ob_get_clean();
            require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/utility.php';
            $js_content = TSMUtility::remove_string_javascript($js_content);
            $doc->addScriptDeclaration($js_content);
        }
        if ($view == 'tsmart' or $view == 'about' or $this->manager($view)) {
            //or $this->canDo->get('core.admin')
            //or $this->canDo->get('vm.'.$view) ) { //Super administrators always have access
            if (JFactory::getApplication()->isSite()) {
                $unoverridable = array('category', 'manufacturer', 'user');
                //This views have the same name and must not be overridable
                if (!in_array($view, $unoverridable)) {
                    if (!class_exists('VmTemplate')) {
                        require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
                    }
                    $template = VmTemplate::getDefaultTemplate();
                    $this->addTemplatePath(VMPATH_ROOT . DS . 'templates' . DS . $template['template'] . DS . 'html' . DS . 'com_tsmart' . DS . $this->_name);
                }
            }
            $result = $this->loadTemplate($tpl);
            if ($result instanceof Exception) {
                return $result;
            }
            echo $result;
            if ($this->writeJs) {
                vmJsApi::keepAlive();
                echo vmJsApi::writeJS();
            }
            return true;
        } else {
            JFactory::getApplication()->redirect('index.php?option=com_tsmart', tsmText::_('JERROR_ALERTNOAUTHOR'), 'error');
        }
    }