Completed
Push — master ( aef742...00e474 )
by Michael
05:09
created

recommended.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * oledrion
14
 *
15
 * @copyright   The XOOPS Project http://sourceforge.net/projects/xoops/
16
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
17
 * @author      Hervé Thouzard (http://www.herve-thouzard.com/)
18
 * @version     $Id: recommended.php 12290 2014-02-07 11:05:17Z beckmi $
19
 */
20
21
/**
22
 * Affiche la liste des produits recommandés
23
 */
24
require 'header.php';
25
$GLOBALS['current_category'] = -1;
26
$xoopsOption['template_main'] = 'oledrion_recommended.tpl';
27
require_once XOOPS_ROOT_PATH . '/header.php';
28
require_once OLEDRION_PATH . 'class/registryfile.php';
29
require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
30
31
// Initialisations
32
$tbl_products = $tbl_categories = $tbl_vendors = $tbl_users = $tbl_tmp_user = $tbl_tmp_categ = $tbl_tmp_lang = $tbl_tmp_vat = $tbl_vat = array();
33
$tbl_products_id = $tbl_auteurs = $tbl_infos_auteurs = $tbl_tmp_auteurs = array();
34
$tbl_tmp_related = $tbl_related = $tbl_info_related_products = array();
35
$tbl_related_products = array();
36
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
37
$limit = oledrion_utils::getModuleOption('perpage');
38
$baseurl = OLEDRION_URL . basename(__FILE__); // URL de ce script (sans son nom)
39
$oledrion_Currency = oledrion_Currency::getInstance();
40
41
$registry = new oledrion_registryfile();
42
43
// Lecture des TVA ********************************************************************************
44
$vatArray = array();
45
$vatArray = $h_oledrion_vat->getAllVats(new oledrion_parameters());
46
47
// Quelques options pour le template
48
$xoopsTpl->assign('nostock_msg', oledrion_utils::getModuleOption('nostock_msg'));
49
$xoopsTpl->assign('mod_pref', $mod_pref); // Préférences du module
50
$xoopsTpl->assign('columnsCount', oledrion_utils::getModuleOption('catagory_colums'));
51
$xoopsTpl->assign('welcome_msg', nl2br($registry->getfile(OLEDRION_TEXTFILE3)));
52
53
// Récupération du nombre total de produits publiés dans la base
54
$itemsCount = $h_oledrion_products->getRecommendedCount();
55
if ($itemsCount > $limit) {
56
    $pagenav = new XoopsPageNav($itemsCount, $limit, $start);
57
    $xoopsTpl->assign('pagenav', $pagenav->renderNav());
58
}
59
60
if ($limit > 0) {
61
    // Récupération de la liste des produits récents
62
    $oledrion_shelf_parameters->resetDefaultValues()->setProductsType('recommended')->setStart($start)->setLimit($limit)->setSort('product_recommended')->setOrder('DESC')->setCategory(0)->setWithXoopsUser(true)->setWithRelatedProducts(true);
63
    $products = $oledrion_shelf->getProducts($oledrion_shelf_parameters);
64 View Code Duplication
    if (isset($products['lastTitle'])) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
65
        $lastTitle = strip_tags($products['lastTitle']);
66
        unset($products['lastTitle']);
67
    }
68
    $xoopsTpl->assign('products', $products);
69
}
70
$xoopsTpl->assign('global_advert', oledrion_utils::getModuleOption('advertisement'));
71
$xoopsTpl->assign('breadcrumb', oledrion_utils::breadcrumb(array(OLEDRION_URL . basename(__FILE__) => _OLEDRION_RECOMMENDED)));
72
73
oledrion_utils::setCSS();
74
oledrion_utils::setLocalCSS($xoopsConfig['language']);
75
oledrion_utils::setMetas(_OLEDRION_RECOMMENDED . ' - ' . oledrion_utils::getModuleName(), oledrion_utils::getModuleName());
76
require_once(XOOPS_ROOT_PATH . '/footer.php');
77