コード例 #1
0
ファイル: helper.php プロジェクト: shuramita/anhquanggffl
 function getDatas()
 {
     if ($this->config['module_mode'] != 'normal') {
         if (!class_exists('NSP_GK4_' . $this->config['module_mode'])) {
             require_once dirname(__FILE__) . DS . 'gk_classes' . DS . 'portal_modes' . DS . 'gk.' . strtolower($this->config['module_mode']) . '.php';
         }
         //
         $method_name = $this->config['module_mode'] . '_getData';
         $this->content = $method_name($this);
     } else {
         $db = JFactory::getDBO();
         if ($this->config["data_source"] == "com_categories" || $this->config["data_source"] == "com_articles" || $this->config["data_source"] == "com_all_articles") {
             // getting instance of Joomla! com_content source class
             $newsClass = new NSP_GK4_Joomla_Source();
             // Getting list of categories
             $categories = $this->config["data_source"] != "com_all_articles" ? $newsClass->getSources($this->config) : false;
             // getting content
             $amountOfArts = $this->config['news_column'] * $this->config['news_rows'] * $this->config['news_full_pages'] + $this->config['links_amount'] * $this->config['news_short_pages'] * $this->config['links_columns_amount'];
             $this->content = $newsClass->getArticles($categories, $this->config, $amountOfArts);
         } else {
             if ($this->config["data_source"] == "k2_categories" || $this->config["data_source"] == "k2_tags" || $this->config["data_source"] == "k2_articles" || $this->config["data_source"] == "all_k2_articles") {
                 // getting insance of K2 source class
                 $newsClass = new NSP_GK4_K2_Source();
                 // Getting list of categories
                 $categories = $this->config["data_source"] != "all_k2_articles" ? $newsClass->getSources($this->config) : false;
                 // getting content
                 $amountOfArts = $this->config['news_column'] * $this->config['news_rows'] * $this->config['news_full_pages'] + $this->config['links_amount'] * $this->config['news_short_pages'] * $this->config['links_columns_amount'];
                 $this->content = $newsClass->getArticles($categories, $this->config, $amountOfArts);
                 $this->content['comments'] = $newsClass->getComments($this->content, $this->config);
             } else {
                 if ($this->config["data_source"] == "redshop_categories" || $this->config["data_source"] == "redshop_products" || $this->config["data_source"] == "all_redshop_products") {
                     if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_redshop')) {
                         $newsClass = new NSP_GK4_Redshop_Source();
                         // get product helper
                         if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_redshop' . DS . 'helpers' . DS . 'product.php')) {
                             require_once JPATH_ROOT . DS . 'components' . DS . 'com_redshop' . DS . 'helpers' . DS . 'product.php';
                         }
                         if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_redshop' . DS . 'helpers' . DS . 'helper.php')) {
                             require_once JPATH_ROOT . DS . 'components' . DS . 'com_redshop' . DS . 'helpers' . DS . 'helper.php';
                         }
                         if (file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_redshop' . DS . 'helpers' . DS . 'category.php')) {
                             require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_redshop' . DS . 'helpers' . DS . 'category.php';
                         }
                         if ($this->config['rs_add_to_cart'] == 1) {
                             if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_redshop' . DS . 'helpers' . DS . 'redshop.js.php')) {
                                 require_once JPATH_ROOT . DS . 'components' . DS . 'com_redshop' . DS . 'helpers' . DS . 'redshop.js.php';
                             }
                         }
                         // include scripts
                         if (file_exists('components/com_redshop/assets/js/') && $this->config['rs_add_to_cart'] == 1) {
                             JHTML::Script('attribute.js', 'components/com_redshop/assets/js/', false);
                             JHTML::Script('common.js', 'components/com_redshop/assets/js/', false);
                             //JHTML::Script('jquery.tools.min.js', 'components/com_redshop/assets/js/',false);
                         }
                         require_once JPATH_ROOT . DS . 'components' . DS . 'com_redshop' . DS . 'helpers' . DS . 'redshop.js.php';
                         $doc =& JFactory::getDocument();
                         $tmpl = JRequest::getCmd('tmpl');
                         $view = JRequest::getCmd('view');
                         $layout = JRequest::getCmd('layout');
                         $for = JRequest::getWord("for", false);
                         if ($tmpl == 'component' && !$for) {
                             $doc->addStyleDeclaration('html { overflow:scroll; }');
                         }
                         // 	Getting the configuration
                         require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_redshop' . DS . 'helpers' . DS . 'redshop.cfg.php';
                         require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_redshop' . DS . 'helpers' . DS . 'configuration.php';
                         $Redconfiguration = new Redconfiguration();
                         $Redconfiguration->defineDynamicVars();
                         require_once JPATH_SITE . DS . 'components' . DS . 'com_redshop' . DS . 'helpers' . DS . 'currency.php';
                         $session = JFactory::getSession('product_currency');
                         $post = JRequest::get('POST');
                         $Itemid = JRequest::getVar('Itemid');
                         if (isset($post['product_currency'])) {
                             $session->set('product_currency', $post['product_currency']);
                         }
                         $currency_symbol = REDCURRENCY_SYMBOL;
                         $currency_convert = 1;
                         if ($session->get('product_currency')) {
                             $currency_symbol = $session->get('product_currency');
                             $convertPrice = new convertPrice();
                             $currency_convert = $convertPrice->convert(1);
                         }
                         $script = "window.site_url ='" . JURI::root() . "';\n\t\t\t\t\twindow.AJAX_CART_BOX ='" . AJAX_CART_BOX . "';\n\t\t\t\t\twindow.REDSHOP_VIEW ='" . $view . "';\n\t\t\t\t\twindow.REDSHOP_LAYOUT ='" . $layout . "';\n\t\t\t\t\twindow.AJAX_CART_URL ='" . JRoute::_('index.php?option=com_redshop&view=cart&Itemid=' . $Itemid, false) . "';\n\t\t\t\t\twindow.REDCURRENCY_SYMBOL ='" . REDCURRENCY_SYMBOL . "';\n\t\t\t\t\twindow.CURRENCY_SYMBOL_CONVERT ='" . $currency_symbol . "';\n\t\t\t\t\twindow.CURRENCY_CONVERT ='" . $currency_convert . "';\n\t\t\t\t\twindow.PRICE_SEPERATOR ='" . PRICE_SEPERATOR . "';\n\t\t\t\t\twindow.PRODUCT_OUTOFSTOCK_MESSAGE ='" . JText::_('PRODUCT_OUTOFSTOCK_MESSAGE') . "';\n\t\t\t\t\twindow.PREORDER_PRODUCT_OUTOFSTOCK_MESSAGE ='" . JText::_('PREORDER_PRODUCT_OUTOFSTOCK_MESSAGE') . "';\n\t\t\t\t\twindow.CURRENCY_SYMBOL_POSITION ='" . CURRENCY_SYMBOL_POSITION . "';\n\t\t\t\t\twindow.PRICE_DECIMAL ='" . PRICE_DECIMAL . "';\n\t\t\t\t\twindow.PASSWORD_MIN_CHARACTER_LIMIT ='" . JText::_('PASSWORD_MIN_CHARACTER_LIMIT') . "';\n\t\t\t\t\twindow.THOUSAND_SEPERATOR ='" . THOUSAND_SEPERATOR . "';\n\t\t\t\t\twindow.VIEW_CART ='" . JText::_('VIEW_CART') . "';\n\t\t\t\t\twindow.CONTINUE_SHOPPING ='" . JText::_('CONTINUE_SHOPPING') . "';\n\t\t\t\t\twindow.CART_SAVE ='" . JText::_('CART_SAVE') . "';\n\t\t\t\t\twindow.IS_REQUIRED ='" . JText::_('IS_REQUIRED') . "';\n\t\t\t\t\twindow.ENTER_NUMBER ='" . JText::_('ENTER_NUMBER') . "';\n\t\t\t\t\twindow.USE_STOCKROOM ='" . USE_STOCKROOM . "';\n\t\t\t\t\twindow.USE_AS_CATALOG ='" . USE_AS_CATALOG . "';\n\t\t\t\t\twindow.AJAX_CART_DISPLAY_TIME ='" . AJAX_CART_DISPLAY_TIME . "';\n\t\t\t\t\twindow.SHOW_PRICE ='" . SHOW_PRICE . "';\n\t\t\t\t\twindow.DEFAULT_QUOTATION_MODE ='" . DEFAULT_QUOTATION_MODE . "';\n\t\t\t\t\twindow.PRICE_REPLACE ='" . PRICE_REPLACE . "';\n\t\t\t\t\twindow.PRICE_REPLACE_URL ='" . PRICE_REPLACE_URL . "';\n\t\t\t\t\twindow.ZERO_PRICE_REPLACE ='" . ZERO_PRICE_REPLACE . "';\n\t\t\t\t\twindow.ZERO_PRICE_REPLACE_URL ='" . ZERO_PRICE_REPLACE_URL . "';\n\t\t\t\t\twindow.OPTIONAL_SHIPPING_ADDRESS ='" . OPTIONAL_SHIPPING_ADDRESS . "';\n\t\t\t\t\twindow.SHIPPING_METHOD_ENABLE ='" . SHIPPING_METHOD_ENABLE . "';\n\t\t\t\t\twindow.PRODUCT_ADDIMG_IS_LIGHTBOX ='" . PRODUCT_ADDIMG_IS_LIGHTBOX . "';\n\t\t\t\t\twindow.ALLOW_PRE_ORDER ='" . ALLOW_PRE_ORDER . "';\n\t\t\t\t\twindow.ATTRIBUTE_SCROLLER_THUMB_WIDTH ='" . ATTRIBUTE_SCROLLER_THUMB_WIDTH . "';\n\t\t\t\t\twindow.ATTRIBUTE_SCROLLER_THUMB_HEIGHT ='" . ATTRIBUTE_SCROLLER_THUMB_HEIGHT . "';\n\t\t\t\t\twindow.PRODUCT_DETAIL_IS_LIGHTBOX ='" . PRODUCT_DETAIL_IS_LIGHTBOX . "';\n\t\t\t\t\twindow.PLEASE_ENTER_COMPANY_NAME ='" . JText::_('PLEASE_ENTER_COMPANY_NAME', true) . "';\n\t\t\t\t\twindow.YOUR_MUST_PROVIDE_A_FIRSTNAME ='" . JText::_('YOUR_MUST_PROVIDE_A_FIRSTNAME', true) . "';\n\t\t\t\t\twindow.YOUR_MUST_PROVIDE_A_LASTNAME ='" . JText::_('YOUR_MUST_PROVIDE_A_LASTNAME', true) . "';\n\t\t\t\t\twindow.YOUR_MUST_PROVIDE_A_ADDRESS ='" . JText::_('YOUR_MUST_PROVIDE_A_ADDRESS', true) . "';\n\t\t\t\t\twindow.YOUR_MUST_PROVIDE_A_ZIP ='" . JText::_('YOUR_MUST_PROVIDE_A_ZIP', true) . "';\n\t\t\t\t\twindow.YOUR_MUST_PROVIDE_A_CITY ='" . JText::_('YOUR_MUST_PROVIDE_A_CITY', true) . "';\n\t\t\t\t\twindow.YOUR_MUST_PROVIDE_A_PHONE ='" . JText::_('YOUR_MUST_PROVIDE_A_PHONE', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_REQUIRED ='" . JText::_('THIS_FIELD_REQUIRED', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_REMOTE ='" . JText::_('THIS_FIELD_REMOTE', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_URL='" . JText::_('THIS_FIELD_URL', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_DATE='" . JText::_('THIS_FIELD_DATE', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_DATEISO='" . JText::_('THIS_FIELD_DATEISO', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_NUMBER='" . JText::_('THIS_FIELD_NUMBER', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_DIGITS='" . JText::_('THIS_FIELD_DIGITS', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_CREDITCARD='" . JText::_('THIS_FIELD_CREDITCARD', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_EQUALTO='" . JText::_('THIS_FIELD_EQUALTO', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_ACCEPT='" . JText::_('THIS_FIELD_ACCEPT', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_MAXLENGTH='" . JText::_('THIS_FIELD_MAXLENGTH', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_MINLENGTH='" . JText::_('THIS_FIELD_MINLENGTH', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_RANGELENGTH='" . JText::_('THIS_FIELD_RANGELENGTH', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_RANGE='" . JText::_('THIS_FIELD_RANGE', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_MAX='" . JText::_('THIS_FIELD_MAX', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_MIN='" . JText::_('THIS_FIELD_MIN', true) . "';\n\t\t\t\t\twindow.YOU_MUST_PROVIDE_LOGIN_NAME ='" . JText::_('YOU_MUST_PROVIDE_LOGIN_NAME', true) . "';\n\t\t\t\t\twindow.PROVIDE_EMAIL_ADDRESS ='" . JText::_('PROVIDE_EMAIL_ADDRESS', true) . "';\n\t\t\t\t\twindow.EMAIL_NOT_MATCH ='" . JText::_('EMAIL_NOT_MATCH', true) . "';\n\t\t\t\t\twindow.PASSWORD_NOT_MATCH ='" . JText::_('PASSWORD_NOT_MATCH', true) . "';\n\t\t\t\t\twindow.NOOF_SUBATTRIB_THUMB_FOR_SCROLLER ='" . NOOF_SUBATTRIB_THUMB_FOR_SCROLLER . "';\n\t\t\t\t\twindow.NOT_AVAILABLE ='" . JText::_('NOT_AVAILABLE', true) . "';\n\t\t\t\t\twindow.PLEASE_INSERT_HEIGHT ='" . JText::_('PLEASE_INSERT_HEIGHT', true) . "';\n\t\t\t\t\twindow.PLEASE_INSERT_WIDTH ='" . JText::_('PLEASE_INSERT_WIDTH', true) . "';\n\t\t\t\t\twindow.PLEASE_INSERT_DEPTH ='" . JText::_('PLEASE_INSERT_DEPTH', true) . "';\n\t\t\t\t\twindow.PLEASE_INSERT_RADIUS ='" . JText::_('PLEASE_INSERT_RADIUS', true) . "';\n\t\t\t\t\twindow.PLEASE_INSERT_UNIT ='" . JText::_('PLEASE_INSERT_UNIT', true) . "';\n\t\t\t\t\twindow.THIS_FIELD_IS_REQUIRED ='" . JText::_('THIS_FIELD_IS_REQUIRED', true) . "';\n\t\t\t\t\twindow.CREATE_ACCOUNT_CHECKBOX ='" . CREATE_ACCOUNT_CHECKBOX . "';\n\t\t\t\t\twindow.SHOW_QUOTATION_PRICE ='" . SHOW_QUOTATION_PRICE . "';";
                         $document = JFactory::getDocument();
                         $document->addScriptDeclaration($script);
                         // Getting list of categories
                         $categories = $newsClass->getSources($this->config);
                         // getting content
                         $amountOfProducts = $this->config['news_column'] * $this->config['news_rows'] * $this->config['news_full_pages'] + $this->config['links_amount'] * $this->config['news_short_pages'] * $this->config['links_columns_amount'];
                         $this->content = $newsClass->getArticles($categories, $this->config, $amountOfProducts);
                     }
                 } else {
                     // VM block
                     $newsClass = new NSP_GK4_VM_Source();
                     // Getting list of categories
                     $categories = $newsClass->getSources($this->config);
                     // getting content
                     $amountOfProducts = $this->config['news_column'] * $this->config['news_rows'] * $this->config['news_full_pages'] + $this->config['links_amount'] * $this->config['news_short_pages'] * $this->config['links_columns_amount'];
                     $this->content = $newsClass->getProducts($categories, $this->config, $amountOfProducts);
                     $this->content['comments'] = $newsClass->getComments($this->content, $this->config);
                 }
             }
         }
     }
 }
コード例 #2
0
function Portal_Mode_3_getData($parent)
{
    $db = JFactory::getDBO();
    $output = array();
    if ($parent->config["data_source"] == "com_categories" || $parent->config["data_source"] == "com_articles" || $parent->config["data_source"] == "com_all_articles") {
        // getting instance of Joomla! com_content source class
        $newsClass = new NSP_GK4_Joomla_Source();
        // Getting list of categories
        $categories = $parent->config["data_source"] != "com_all_articles" ? $newsClass->getSources($parent->config) : false;
        // getting content
        $amountOfArts = $parent->config['news_portal_mode_amount'];
        $output = $newsClass->getArticles($categories, $parent->config, $amountOfArts);
    } else {
        if ($parent->config["data_source"] == "k2_categories" || $parent->config["data_source"] == "k2_tags" || $parent->config["data_source"] == "k2_articles" || $parent->config["data_source"] == "all_k2_articles") {
            // getting instance of K2 source class
            $newsClass = new NSP_GK4_K2_Source();
            // Getting list of categories
            $categories = $parent->config["data_source"] != "all_k2_articles" ? $newsClass->getSources($parent->config) : false;
            // getting content
            $amountOfArts = $parent->config['news_portal_mode_amount'];
            $output = $newsClass->getArticles($categories, $parent->config, $amountOfArts);
        } else {
            // getting insance of K2 source class
            $newsClass = new NSP_GK4_VM_Source();
            // Getting list of categories
            $categories = $newsClass->getSources($parent->config);
            // getting content
            $amountOfProducts = $parent->config['news_portal_mode_amount'];
            $output = $newsClass->getProducts($categories, $parent->config, $amountOfProducts);
        }
    }
    return $output;
}