Beispiel #1
0
 function renderLayout()
 {
     if ($this->config['module_mode'] !== 'normal') {
         $this->render_portal_mode($this->config['module_mode']);
     } else {
         $renderer = new NSP_GK4_Layout_Parts();
         // detecting mode - com_content or K2
         $k2_mode = false;
         $rs_mode = false;
         $vm_mode = false;
         $producthelper = '';
         $redhelper = '';
         //check the source
         if ($this->config["data_source"] == 'k2_categories' || $this->config["data_source"] == 'k2_articles' || $this->config["data_source"] == 'all_k2_articles' || $this->config["data_source"] == 'k2_tags') {
             if ($this->config['k2_categories'] != -1) {
                 $k2_mode = true;
             } else {
                 // exception when K2 is not installed
                 $this->content = array("ID" => array(), "alias" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "author" => array(), "cat_name" => array(), "cat_alias" => array(), "hits" => array(), "news_amount" => 0, "rating_sum" => 0, "rating_count" => 0, "plugins" => '');
             }
         } else {
             if ($this->config["data_source"] == 'redshop_categories' || $this->config["data_source"] == 'redshop_products' || $this->config["data_source"] == 'all_redshop_products') {
                 if ($this->config['redshop_categories'] != -1 && file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_redshop')) {
                     $rs_mode = true;
                     $producthelper = new producthelper();
                     $redhelper = new redhelper();
                 } else {
                     // exception when RedSHOP is not installed
                     $this->content = array("ID" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "price" => array(), "discount_price" => array(), "discount_start" => array(), "discount_end" => array(), "tax" => array(), "cat_name" => array(), "manufacturer" => array(), "manufacturer_id" => array(), "product_image" => array(), "news_amount" => array());
                 }
             } elseif ($this->config["data_source"] == 'vm_categories' || $this->config["data_source"] == 'vm_products') {
                 if ($this->config['vm_categories'] != -1) {
                     $vm_mode = true;
                 } else {
                     // exception when VirtueMart is not installed
                     $this->content = array("ID" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "price" => array(), "price_currency" => array(), "discount_amount" => array(), "discount_is_percent" => array(), "discount_start" => array(), "discount_end" => array(), "tax" => array(), "cat_name" => array(), "manufacturer" => array(), "manufacturer_id" => array(), "product_image" => array(), "news_amount" => 0);
                 }
             }
         }
         // tables which will be used in generated content
         $news_list_tab = array();
         $news_html_tab = array();
         // Generating content
         $uri =& JURI::getInstance();
         $li_counter = 0;
         $news_k2_store = '';
         $news_header = '';
         $news_image = '';
         $news_readmore = '';
         $news_textt = '';
         $news_infoo = '';
         $news_infoo2 = '';
         //
         for ($i = 0; $i < count($this->content["ID"]); $i++) {
             if ($i < $this->config['news_column'] * $this->config['news_rows'] * $this->config['news_full_pages']) {
                 // GENERATING NEWS CONTENT
                 if ($k2_mode == FALSE && $rs_mode == FALSE && $vm_mode == FALSE) {
                     // GENERATING HEADER
                     if ($this->config['news_header_enabled'] == 1) {
                         $news_header = $renderer->header($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i]);
                     }
                     // GENERATING IMAGE
                     if ($this->config['news_image_enabled'] == 1) {
                         $news_image = $renderer->image($this->config, $uri, $this->content['ID'][$i], $this->content['IID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $this->content['title'][$i], $this->content['images'][$i]);
                     }
                     // GENERATING READMORE
                     if ($this->config['news_readmore_enabled'] == 1) {
                         $news_readmore = $renderer->readMore($this->config, $this->content['ID'][$i], $this->content['CID'][$i]);
                     }
                     // GENERATING TEXT
                     if ($this->config['news_text_enabled'] == 1) {
                         $news_textt = $renderer->text($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $news_readmore);
                     }
                     // GENERATE NEWS INFO
                     if ($this->config['news_info_enabled'] == 1) {
                         $news_infoo = $renderer->info($this->config, $this->content['catname'][$i], $this->content['CID'][$i], $this->content['author'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['rating_count'][$i], $this->content['rating_sum'][$i]);
                     }
                     // GENERATE NEWS INFO2
                     if ($this->config['news_info2_enabled'] == 1) {
                         $news_infoo2 = $renderer->info($this->config, $this->content['catname'][$i], $this->content['CID'][$i], $this->content['author'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['rating_count'][$i], $this->content['rating_sum'][$i], 2);
                     }
                 } else {
                     if ($rs_mode == FALSE && $vm_mode == FALSE && $k2_mode == TRUE) {
                         // GENERATING HEADER
                         if ($this->config['news_header_enabled'] == 1) {
                             $news_header = $renderer->header_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['title'][$i]);
                         }
                         // GENERATING IMAGE
                         if ($this->config['news_image_enabled'] == 1) {
                             $news_image = $renderer->image_k2($this->config, $uri, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['text'][$i], $this->content['title'][$i]);
                         }
                         // GENERATING READMORE
                         if ($this->config['news_readmore_enabled'] == 1) {
                             $news_readmore = $renderer->readMore_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i]);
                         }
                         // GENERATING TEXT
                         if ($this->config['news_text_enabled'] == 1) {
                             $news_textt = $renderer->text_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['text'][$i], $news_readmore);
                         }
                         // GENERATE NEWS INFO
                         if ($this->config['news_info_enabled'] == 1) {
                             $news_infoo = $renderer->info_k2($this->config, $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['author'][$i], $this->content['author_id'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['alias'][$i], $this->content['comments'], $this->content['rating_count'][$i], $this->content['rating_sum'][$i]);
                         }
                         // GENERATE NEWS INFO2
                         if ($this->config['news_info2_enabled'] == 1) {
                             $news_infoo2 = $renderer->info_k2($this->config, $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['author'][$i], $this->content['author_id'][$i], $this->content['email'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['hits'][$i], $this->content['ID'][$i], $this->content['alias'][$i], $this->content['comments'], $this->content['rating_count'][$i], $this->content['rating_sum'][$i], 2);
                         }
                         // GENERATE STORE BLOCK
                         $news_k2_store = $renderer->store_k2($this->config, $this->content['ID'][$i], $this->content['plugins'][$i], $this->k2store_params);
                     } else {
                         if ($rs_mode == TRUE && $vm_mode == FALSE && $k2_mode == FALSE) {
                             $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $this->content['ID'][$i]);
                             $id = $this->content['ID'][$i];
                             $cid = $producthelper->getCategoryProduct($this->content['ID'][$i]);
                             $Itemid = $redhelper->getItemid($this->content['ID'][$i]);
                             $product = $producthelper->getProductById($this->content['ID'][$i]);
                             // GENERATING HEADER
                             if ($this->config['news_header_enabled'] == 1) {
                                 $news_header = $renderer->header_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i], $Itemid);
                             }
                             // GENERATING IMAGE
                             if ($this->config['news_image_enabled'] == 1) {
                                 $news_image = $renderer->image_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['product_image'][$i], $this->content['title'][$i], $Itemid);
                             }
                             // GENERATING READMORE
                             if ($this->config['news_readmore_enabled'] == 1) {
                                 $news_readmore = $renderer->readMore_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $Itemid);
                             }
                             // GENERATING TEXT
                             if ($this->config['news_text_enabled'] == 1) {
                                 $news_textt = $renderer->text_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $news_readmore, $Itemid);
                             }
                             // GENERATE NEWS INFO
                             if ($this->config['news_info_enabled'] == 1) {
                                 $news_infoo = $renderer->info_rs($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $Itemid, $this->content['manufacturer_id'][$i], 1);
                             }
                             // GENERATE NEWS INFO2
                             if ($this->config['news_info2_enabled'] == 1) {
                                 $news_infoo2 = $renderer->info_rs($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $Itemid, $this->content['manufacturer_id'][$i], 2);
                             }
                             // COMPUTE PRICE DEPENDS OF USER ID
                             $user =& JFactory::getUser();
                             $price = $producthelper->getProductPrice($this->content['ID'][$i], $this->config['rs_price_with_vat'], $user->id);
                             $price = $producthelper->getProductFormattedPrice($price, true);
                             if ($this->config['rs_add_to_cart'] == 1) {
                                 $addToCart = $producthelper->replaceCartTemplate($this->content['ID'][$i], 0, 0, 0, "", false, array(), 0, 0, 0);
                                 $addToCart = str_replace('&', '&amp;', $addToCart);
                                 if ($this->config['rs_show_default_cart_button'] == 0) {
                                     $btnCode = '<a class=\'nspAddToCart\' onclick="if(displayAddtocartForm(\'addtocart_prd_' . $this->content['ID'][$i];
                                     $btnCode .= '\',\'' . $id . '\',\'0\',\'0\', \'user_fields_form\'))';
                                     $btnCode .= '{checkAddtocartValidation(\'addtocart_prd_' . $id . '\',\'' . $id . '\',\'0\',\'0\', \'user_fields_form\',\'0\',\'0\',\'0\');}"><span style=\'cursor: pointer;\' id=\'pdaddtocartprd' . $id . '\' title=\'\' class=\'\'>' . JText::_('MOD_NEWS_PRO_GK4_ADD_TO_CART') . '</span></a>';
                                     $addToCart = preg_replace('/\\<img.*?\\>/i', $btnCode, $addToCart);
                                 }
                             }
                             // GET THE CURRENCY
                             $bool = preg_match('/[^0-9]/u', $price, $currency);
                             $currency = $currency[0];
                             $bool = preg_match('/[0-9]+/u', $price, $price);
                             $price = $price[0];
                             // GENERATE RedSHOP STORE INFO
                             $news_rs_store = $renderer->store_rs($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $price, $this->content['discount_start'][$i], $this->content['discount_end'][$i], $this->content['tax'][$i], $this->content['discount_price'][$i], $currency, $Itemid, $addToCart);
                         } else {
                             if ($vm_mode == TRUE) {
                                 // GENERATING HEADER
                                 if ($this->config['news_header_enabled'] == 1) {
                                     $news_header = $renderer->header_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i]);
                                 }
                                 // GENERATING IMAGE
                                 if ($this->config['news_image_enabled'] == 1) {
                                     $news_image = $renderer->image_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['product_image'][$i], $this->content['title'][$i]);
                                 }
                                 // GENERATING READMORE
                                 if ($this->config['news_readmore_enabled'] == 1) {
                                     $news_readmore = $renderer->readMore_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i]);
                                 }
                                 // GENERATING TEXT
                                 if ($this->config['news_text_enabled'] == 1) {
                                     $news_textt = $renderer->text_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['text'][$i], $news_readmore);
                                 }
                                 // GENERATE NEWS INFO
                                 if ($this->config['news_info_enabled'] == 1) {
                                     $news_infoo = $renderer->info_vm($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['comments']);
                                 }
                                 // GENERATE NEWS INFO2
                                 if ($this->config['news_info2_enabled'] == 1) {
                                     $news_infoo2 = $renderer->info_vm($this->config, $this->content['ID'][$i], $this->content['cat_name'][$i], $this->content['CID'][$i], $this->content['manufacturer'][$i], $this->config['date_publish'] == TRUE ? $this->content['date_publish'][$i] : $this->content['date'][$i], $this->content['comments'], 2);
                                 }
                                 $news_vm_store = $renderer->store_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['price'][$i], $this->content['price_currency'][$i], $this->content['discount_amount'][$i], true, $this->content['discount_start'][$i], $this->content['discount_end'][$i], $this->content['tax'][$i], $this->content['manufacturer_id'][$i]);
                             }
                         }
                     }
                 }
                 // PARSING PLUGINS
                 if ($this->config['parse_plugins'] == TRUE) {
                     $news_textt = JHtml::_('content.prepare', $news_textt);
                 }
                 // CLEANING PLUGINS
                 if ($this->config['clean_plugins'] == TRUE) {
                     $news_textt = preg_replace("/(\\{.+?\\}.+?\\{.+?})|(\\{.+?\\})/", "", $news_textt);
                 }
                 // GENERATE CONTENT FOR TAB
                 $news_generated_content = '';
                 // initialize variable
                 //
                 for ($j = 1; $j < 7; $j++) {
                     if ($this->config['wrapContent'] == 1 && $this->config['news_image_order'] == 1) {
                         if ($j == 2) {
                             $news_generated_content .= '<div class="gkArtContentWrap">';
                         }
                     }
                     if ($this->config['news_header_order'] == $j) {
                         $news_generated_content .= $news_header;
                     }
                     if ($this->config['news_image_order'] == $j) {
                         $news_generated_content .= $news_image;
                     }
                     if ($this->config['news_text_order'] == $j) {
                         $news_generated_content .= $news_textt;
                     }
                     if ($this->config['news_info_order'] == $j) {
                         $news_generated_content .= $news_infoo;
                     }
                     if ($this->config['news_info2_order'] == $j) {
                         $news_generated_content .= $news_infoo2;
                     }
                     if ($this->config['news_rs_store_enabled'] != 'disabled') {
                         if ($rs_mode != FALSE && $this->config['news_rs_store_order'] == $j) {
                             $news_generated_content .= $news_rs_store;
                         }
                         if ($vm_mode != FALSE && $this->config['news_rs_store_order'] == $j) {
                             $news_generated_content .= $news_vm_store;
                         }
                         if ($k2_mode != FALSE && $this->config['news_rs_store_order'] == $j) {
                             $news_generated_content .= $news_k2_store;
                         }
                     }
                 }
                 //
                 if ($this->config['news_content_readmore_pos'] != 'after') {
                     $news_generated_content .= $news_readmore;
                 }
                 if ($this->config['wrapContent'] == 1 && $this->config['news_image_order'] == 1) {
                     $news_generated_content .= '</div>';
                 }
                 // creating table with news content
                 array_push($news_html_tab, $news_generated_content);
             } else {
                 if ($k2_mode == FALSE && $vm_mode == FALSE) {
                     array_push($news_list_tab, $renderer->lists($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2, $li_counter));
                 } elseif ($k2_mode == TRUE) {
                     array_push($news_list_tab, $renderer->lists_k2($this->config, $this->content['ID'][$i], $this->content['alias'][$i], $this->content['CID'][$i], $this->content['cat_alias'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2, $li_counter));
                 } else {
                     array_push($news_list_tab, $renderer->lists_vm($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2, $li_counter));
                 }
                 //
                 $li_counter++;
             }
         }
         /** GENERATING FINAL XHTML CODE START **/
         // create instances of basic Joomla! classes
         $document = JFactory::getDocument();
         $uri = JURI::getInstance();
         // add stylesheets to document header
         if ($this->config["useCSS"] == 1) {
             $document->addStyleSheet($uri->root() . 'modules/mod_news_pro_gk4/interface/css/style.css', 'text/css');
         }
         // add script to the document header
         if ($this->config['useScript'] == 1) {
             $document->addScript($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.js');
         }
         // init $headData variable
         $headData = false;
         // add scripts with automatic mode to document header
         if ($this->config['useScript'] == 2) {
             // getting module head section datas
             unset($headData);
             $headData = $document->getHeadData();
             // generate keys of script section
             $headData_keys = array_keys($headData["scripts"]);
             // set variable for false
             $engine_founded = false;
             // searching phrase mootools in scripts paths
             if (array_search($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.js', $headData_keys) > 0) {
                 $engine_founded = true;
             }
             // if engine doesn't exists in the head section
             if (!$engine_founded) {
                 // add new script tag connected with mootools from module
                 $document->addScript($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.js');
             }
         }
         //
         require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'content');
         require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'default');
     }
 }
 function output()
 {
     $renderer = new NSP_GK4_Layout_Parts();
     // detecting mode - com_content or K2
     $k2_mode = false;
     $vm_mode = false;
     //check the source
     if ($this->parent->config["data_source"] == 'k2_categories' || $this->parent->config["data_source"] == 'k2_articles' || $this->parent->config["data_source"] == 'all_k2_articles' || $this->parent->config["data_source"] == 'k2_tags') {
         if ($this->parent->config['k2_categories'] != -1) {
             $k2_mode = true;
         } else {
             // exception when K2 is not installed
             $this->parent->content = array("ID" => array(), "alias" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "author" => array(), "cat_name" => array(), "cat_alias" => array(), "hits" => array(), "news_amount" => 0, "rating_sum" => 0, "rating_count" => 0, "plugins" => '');
         }
     }
     // tables which will be used in generated content
     $news_image_tab = array();
     $news_title_tab = array();
     // Generating content
     $uri =& JURI::getInstance();
     //
     $config = $this->parent->config;
     //
     $config['news_header_enabled'] = 1;
     $config['news_image_enabled'] = 1;
     $config['news_content_header_pos'] = '';
     $config['news_content_image_pos'] = '';
     $config['create_thumbs'] = 1;
     $config['img_width'] = 272;
     $config['img_height'] = 272;
     $config['img_link'] = 1;
     $config['img_keep_aspect_ratio'] = 0;
     //
     for ($i = 0; $i < count($this->parent->content["ID"]); $i++) {
         //
         $news_image = '';
         $news_header = '';
         // GENERATING NEWS CONTENT
         if ($k2_mode == FALSE && $vm_mode == FALSE) {
             $news_header = $renderer->header($config, $this->parent->content['ID'][$i], $this->parent->content['CID'][$i], $this->parent->content['title'][$i]);
             // GENERATING IMAGE
             $news_image = $renderer->image($config, $uri, $this->parent->content['ID'][$i], $this->parent->content['IID'][$i], $this->parent->content['CID'][$i], $this->parent->content['text'][$i], $this->parent->content['title'][$i], $this->parent->content['images'][$i]);
         } else {
             if ($vm_mode == FALSE) {
                 // GENERATING HEADER
                 $news_header = $renderer->header_k2($config, $this->parent->content['ID'][$i], $this->parent->content['alias'][$i], $this->parent->content['CID'][$i], $this->parent->content['cat_alias'][$i], $this->parent->content['title'][$i]);
                 // GENERATING IMAGE
                 $news_image = $renderer->image_k2($config, $uri, $this->parent->content['ID'][$i], $this->parent->content['alias'][$i], $this->parent->content['CID'][$i], $this->parent->content['cat_alias'][$i], $this->parent->content['text'][$i], $this->parent->content['title'][$i]);
             }
         }
         // GENERATE CONTENT
         if ($news_image !== '') {
             array_push($news_image_tab, $news_image);
             array_push($news_title_tab, $news_header);
         }
     }
     /** GENERATING FINAL XHTML CODE START **/
     // create instances of basic Joomla! classes
     $document = JFactory::getDocument();
     $uri = JURI::getInstance();
     // add stylesheets to document header
     if ($this->parent->config["useCSS"] == 1) {
         $document->addStyleSheet($uri->root() . 'modules/mod_news_pro_gk4/interface/css/style.portal.mode.6.css', 'text/css');
     }
     // init $headData variable
     $headData = false;
     // add scripts with automatic mode to document header
     if ($this->parent->config['useScript'] == 2) {
         // getting module head section datas
         unset($headData);
         $headData = $document->getHeadData();
         // generate keys of script section
         $headData_keys = array_keys($headData["scripts"]);
         // set variable for false
         $engine_founded = false;
         // searching phrase mootools in scripts paths
         if (array_search($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.portal_mode_6.js', $headData_keys) > 0) {
             $engine_founded = true;
         }
         // if mootools file doesn't exists in document head section
         if (!$engine_founded) {
             // add new script tag connected with mootools from module
             $document->addScript($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.portal.mode.6.js');
         }
     }
     //
     require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'content.portal.mode.6');
     require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'default.portal.mode.6');
 }
 function output()
 {
     $renderer = new NSP_GK4_Layout_Parts();
     // detecting mode - com_content or K2
     $k2_mode = false;
     $vm_mode = false;
     //check the source
     if ($this->parent->config["data_source"] == 'k2_categories' || $this->parent->config["data_source"] == 'k2_articles' || $this->parent->config["data_source"] == 'all_k2_articles' || $this->parent->config["data_source"] == 'k2_tags') {
         if ($this->parent->config['k2_categories'] != -1) {
             $k2_mode = true;
         } else {
             // exception when K2 is not installed
             $this->parent->content = array("ID" => array(), "alias" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "author" => array(), "cat_name" => array(), "cat_alias" => array(), "hits" => array(), "news_amount" => 0, "rating_sum" => 0, "rating_count" => 0, "plugins" => '');
         }
     } elseif ($this->parent->config["data_source"] == 'vm_categories' || $this->parent->config["data_source"] == 'vm_products') {
         if ($this->parent->config['vm_categories'] != -1) {
             $vm_mode = true;
         } else {
             // exception when VirtueMart is not installed
             $this->parent->content = array("ID" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "price" => array(), "price_currency" => array(), "discount_amount" => array(), "discount_is_percent" => array(), "discount_start" => array(), "discount_end" => array(), "tax" => array(), "cat_name" => array(), "manufacturer" => array(), "manufacturer_id" => array(), "product_image" => array(), "news_amount" => 0);
         }
     }
     // tables which will be used in generated content
     $news_content_tab = array();
     $news_title_tab = array();
     // Generating content
     $uri = JURI::getInstance();
     //
     for ($i = 0; $i < count($this->parent->content["ID"]); $i++) {
         // GENERATING NEWS CONTENT
         if ($k2_mode == FALSE) {
             // GENERATING HEADER
             $news_header = $renderer->header($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['CID'][$i], $this->parent->content['title'][$i]);
             // GENERATING IMAGE
             $news_image = $renderer->image($this->parent->config, $uri, $this->parent->content['ID'][$i], $this->parent->content['IID'][$i], $this->parent->content['CID'][$i], $this->parent->content['text'][$i], $this->parent->content['title'][$i], $this->parent->content['images'][$i]);
             // GENERATE NEWS INFO
             $news_date = JHTML::_('date', $this->parent->config['date_publish'] == TRUE ? $this->parent->content['date_publish'][$i] : $this->parent->content['date'][$i], $this->parent->config['date_format']);
             // GENERATE NEWS CATEGORY
             $news_category = $this->parent->config['category_link'] == 1 ? '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($this->parent->content['CID'][$i])) . '" >' . $this->parent->content['catname'][$i] . '</a>' : $this->parent->content['catname'][$i];
             // GENERATING READMORE
             $news_readmore = $renderer->readMore($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['CID'][$i]);
             // GENERATING TEXT
             $news_textt = $renderer->text($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['CID'][$i], $this->parent->content['text'][$i], $news_readmore);
         } else {
             // GENERATING HEADER
             $news_header = $renderer->header_k2($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['alias'][$i], $this->parent->content['CID'][$i], $this->parent->content['cat_alias'][$i], $this->parent->content['title'][$i]);
             // GENERATING IMAGE
             $news_image = $renderer->image_k2($this->parent->config, $uri, $this->parent->content['ID'][$i], $this->parent->content['alias'][$i], $this->parent->content['CID'][$i], $this->parent->content['cat_alias'][$i], $this->parent->content['text'][$i], $this->parent->content['title'][$i]);
             // GENERATE NEWS INFO
             $news_date = JHTML::_('date', $this->parent->config['date_publish'] == TRUE ? $this->parent->content['date_publish'][$i] : $this->parent->content['date'][$i], $this->parent->config['date_format']);
             // GENERATE NEWS CATEGORY
             $news_category = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($this->parent->content['CID'][$i])));
             $news_readmore = $renderer->readMore_k2($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['alias'][$i], $this->parent->content['CID'][$i], $this->parent->content['cat_alias'][$i]);
             // GENERATING TEXT
             $news_textt = $renderer->text_k2($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['alias'][$i], $this->parent->content['CID'][$i], $this->parent->content['cat_alias'][$i], $this->parent->content['text'][$i], $news_readmore);
         }
         /*else {
                     // GENERATING HEADER
         			$news_header = $renderer->header_vm($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['CID'][$i], $this->parent->content['title'][$i]);
         			// GENERATING IMAGE
         			$news_image = $renderer->image_vm($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['CID'][$i], $this->parent->content['product_image'][$i], $this->parent->content['title'][$i]);
         			// GENERATE NEWS INFO
         			$news_date = JHTML::_('date', ($this->parent->config['date_publish'] == TRUE) ? $this->parent->content['date_publish'][$i] : $this->parent->content['date'][$i], $this->parent->config['date_format']);
         			// GENERATE NEWS CATEGORY
         			$news_category = ($this->parent->config['category_link'] == 1) ? '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($this->parent->content['CID'][$i], $this->parent->content['SID'][$i])).'" >'.$this->parent->content['catname'][$i].'</a>' : $this->parent->content['catname'][$i];
         			// GENERATING READMORE
         			$news_readmore = $renderer->readMore_vm($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['CID'][$i]);
         			// GENERATING TEXT
         			$news_textt = $renderer->text_vm($this->config, $this->parent->content['ID'][$i], $this->parent->content['CID'][$i], $this->parent->content['text'][$i], $news_readmore);
         		}		*/
         // PARSING PLUGINS
         if ($this->parent->config['parse_plugins'] == TRUE) {
             $news_textt = JHTML::_('content.prepare', $news_textt);
         }
         // CLEANING PLUGINS
         if ($this->parent->config['clean_plugins'] == TRUE) {
             $news_textt = preg_replace("/\\{.+?\\}/", "", $news_textt);
         }
         // GENERATE CONTENT FOR TAB
         $news_title_content = '<div class="nspTitleTab"><div class="nspDate">' . $news_date . '</div><div class="nspTitle">' . $this->parent->content['title'][$i] . '</div></div>';
         $news_generated_content = '';
         // initialize variable
         //
         for ($j = 1; $j < 7; $j++) {
             if ($this->parent->config['news_image_order'] == $j) {
                 $news_generated_content .= $news_image;
             }
             if ($this->parent->config['news_text_order'] == $j) {
                 $news_generated_content .= $news_textt;
             }
         }
         //
         if ($this->parent->config['news_content_readmore_pos'] != 'after') {
             $news_generated_content .= $news_readmore;
         }
         $news_generated_content = '<div class="nspArtMore unvisible"><div class="nspArtMain">' . $news_generated_content . '</div></div>';
         // creating table with news content
         array_push($news_content_tab, $news_generated_content);
         array_push($news_title_tab, $news_title_content);
     }
     /** GENERATING FINAL XHTML CODE START **/
     // create instances of basic Joomla! classes
     $document = JFactory::getDocument();
     $uri = JURI::getInstance();
     // add stylesheets to document header
     if ($this->parent->config["useCSS"] == 1) {
         $document->addStyleSheet($uri->root() . 'modules/mod_news_pro_gk4/interface/css/style.portal.mode.3.css', 'text/css');
     }
     // init $headData variable
     $headData = false;
     // add scripts with automatic mode to document header
     if ($this->parent->config['useScript'] == 2) {
         // getting module head section datas
         unset($headData);
         $headData = $document->getHeadData();
         // generate keys of script section
         $headData_keys = array_keys($headData["scripts"]);
         // set variable for false
         $engine_founded = false;
         // searching phrase mootools in scripts paths
         if (array_search($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.portal_mode_3.js', $headData_keys) > 0) {
             $engine_founded = true;
         }
         // if mootools file doesn't exists in document head section
         if (!$engine_founded) {
             // add new script tag connected with mootools from module
             $headData["scripts"][$uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.portal.mode.3.js'] = "text/javascript";
             $document->setHeadData($headData);
         }
     }
     /*
     		if($this->parent->config['k2store_support'] == 1) {
     			// getting module head section datas
     			$headData = $document->getHeadData();
     			$headData_keys = array_keys($headData["scripts"]);
     			$k2store_founded = false;
     			// searching phrase mootools in scripts paths
     			if(array_search($uri->root().'components/com_k2store/js/k2store.js', $headData_keys) > 0) $k2store_founded = true;
     			// if mootools file doesn't exists in document head section
     			if(!$k2store_founded){ 
     				// add new script tag connected with mootools from module
     				$headData["scripts"][$uri->root().'components/com_k2store/js/k2store.js'] = "text/javascript";
     				$document->setHeadData($headData);
     			}
     		}
     */
     //
     require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'content.portal.mode.3');
     require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'default.portal.mode.3');
 }
Beispiel #4
0
 function output()
 {
     $renderer = new NSP_GK4_Layout_Parts();
     // detecting mode - com_content or K2
     $k2_mode = false;
     $vm_mode = false;
     //check the source
     if ($this->parent->config["data_source"] == 'k2_categories' || $this->parent->config["data_source"] == 'k2_articles' || $this->parent->config["data_source"] == 'all_k2_articles' || $this->parent->config["data_source"] == 'k2_tags') {
         if ($this->parent->config['k2_categories'] != -1) {
             $k2_mode = true;
         } else {
             // exception when K2 is not installed
             $this->parent->content = array("ID" => array(), "alias" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "author" => array(), "cat_name" => array(), "cat_alias" => array(), "hits" => array(), "news_amount" => 0, "rating_sum" => 0, "rating_count" => 0, "plugins" => '');
         }
     } elseif ($this->parent->config["data_source"] == 'vm_categories' || $this->parent->config["data_source"] == 'vm_products') {
         if ($this->parent->config['vm_categories'] != -1) {
             $vm_mode = true;
         } else {
             // exception when VirtueMart is not installed
             $this->parent->content = array("ID" => array(), "CID" => array(), "title" => array(), "text" => array(), "date" => array(), "date_publish" => array(), "price" => array(), "price_currency" => array(), "discount_amount" => array(), "discount_is_percent" => array(), "discount_start" => array(), "discount_end" => array(), "tax" => array(), "cat_name" => array(), "manufacturer" => array(), "manufacturer_id" => array(), "product_image" => array(), "news_amount" => 0);
         }
     }
     // tables which will be used in generated content
     $news_image_tab = array();
     $news_title_tab = array();
     // Generating content
     $uri =& JURI::getInstance();
     //
     for ($i = 0; $i < count($this->parent->content["ID"]); $i++) {
         // GENERATING NEWS CONTENT
         if ($k2_mode == FALSE && $vm_mode == FALSE) {
             $news_header = $renderer->header($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['CID'][$i], $this->parent->content['title'][$i]);
             // GENERATING IMAGE
             $news_image = $renderer->image($this->parent->config, $uri, $this->parent->content['ID'][$i], $this->parent->content['IID'][$i], $this->parent->content['CID'][$i], $this->parent->content['text'][$i], $this->parent->content['title'][$i], $this->parent->content['images'][$i]);
         } else {
             if ($vm_mode == FALSE) {
                 // GENERATING HEADER
                 $news_header = $renderer->header_k2($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['alias'][$i], $this->parent->content['CID'][$i], $this->parent->content['cat_alias'][$i], $this->parent->content['title'][$i]);
                 // GENERATING IMAGE
                 $news_image = $renderer->image_k2($this->parent->config, $uri, $this->parent->content['ID'][$i], $this->parent->content['alias'][$i], $this->parent->content['CID'][$i], $this->parent->content['cat_alias'][$i], $this->parent->content['text'][$i], $this->parent->content['title'][$i]);
             } else {
                 // GENERATING HEADER
                 $news_header = $renderer->header_vm($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['CID'][$i], $this->parent->content['title'][$i]);
                 // GENERATING IMAGE
                 $news_image = $renderer->image_vm($this->parent->config, $this->parent->content['ID'][$i], $this->parent->content['CID'][$i], $this->parent->content['product_image'][$i], $this->parent->content['title'][$i]);
             }
         }
         // PARSING PLUGINS
         if ($this->parent->config['parse_plugins'] == TRUE) {
             $news_textt = JHTML::_('content.prepare', $news_textt);
         }
         // CLEANING PLUGINS
         if ($this->parent->config['clean_plugins'] == TRUE) {
             $news_textt = preg_replace("/\\{.+?\\}/", "", $news_textt);
         }
         // GENERATE CONTENT FOR TAB
         $news_image_content = '<div class="nspImageGallery">' . $news_image . '</div>';
         $news_generated_content = '<div class="nspHeadline">' . $news_header . '</div>';
         // creating table with news content
         if ($news_image !== '') {
             array_push($news_image_tab, $news_image_content);
             array_push($news_title_tab, $news_generated_content);
         }
     }
     /** GENERATING FINAL XHTML CODE START **/
     // create instances of basic Joomla! classes
     $document =& JFactory::getDocument();
     $uri =& JURI::getInstance();
     // add stylesheets to document header
     if ($this->parent->config["useCSS"] == 1) {
         $document->addStyleSheet($uri->root() . 'modules/mod_news_pro_gk4/interface/css/style.portal.mode.4.css', 'text/css');
     }
     // init $headData variable
     $headData = false;
     // add scripts with automatic mode to document header
     if ($this->parent->config['useScript'] == 2) {
         // getting module head section datas
         unset($headData);
         $headData = $document->getHeadData();
         // generate keys of script section
         $headData_keys = array_keys($headData["scripts"]);
         // set variable for false
         $engine_founded = false;
         // searching phrase mootools in scripts paths
         if (array_search($uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.portal_mode_4.js', $headData_keys) > 0) {
             $engine_founded = true;
         }
         // if mootools file doesn't exists in document head section
         if (!$engine_founded) {
             // add new script tag connected with mootools from module
             $headData["scripts"][$uri->root() . 'modules/mod_news_pro_gk4/interface/scripts/engine.portal.mode.4.js'] = "text/javascript";
             $document->setHeadData($headData);
         }
     }
     //
     require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'content.portal.mode.4');
     require JModuleHelper::getLayoutPath('mod_news_pro_gk4', 'default.portal.mode.4');
 }