Completed
Push — master ( 00e474...9d3fbd )
by Michael
04:26
created

blocks/oledrion_recent_lists.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   {@link http://xoops.org/ XOOPS Project}
16
 * @license     {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
17
 * @author      Hervé Thouzard (http://www.herve-thouzard.com/)
18
 */
19
/**
20
 * Affichage des dernières listes utilisateurs
21
 *
22
 * @param  array $options [0] = Nombre maximum de listes à voir, [1] = Type de listes (0 = les 2, 1 = liste cadeaux, 2 = produits recommandés)
23
 * @return array
24
 */
25 View Code Duplication
function b_oledrion_recent_lists_show($options)
26
{
27
    require XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php';
28
    Oledrion_utils::loadLanguageFile('main.php');
29
    $start    = 0;
30
    $limit    = (int)$options[0];
31
    $listType = (int)$options[1];
32
    $block    = array();
33
    $handlers = OledrionHandler::getInstance();
34
    $items    = array();
35
    //$items = $handlers->h_oledrion_lists->getRecentLists(new Oledrion_parameters(array('start' => $start, 'limit' => $limit, 'sort' => 'list_date', 'order' => 'DESC', 'idAsKey' => true, 'listType'  => $listType)));
36
    $items = $handlers->h_oledrion_lists->getRecentLists(new Oledrion_parameters(array(
0 ignored issues
show
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
37
                                                                                     'start'    => $start,
38
                                                                                     'limit'    => $limit,
39
                                                                                     'sort'     => 'list_date',
40
                                                                                     'order'    => 'DESC',
41
                                                                                     'idAsKey'  => true,
42
                                                                                     'listType' => OLEDRION_LISTS_ALL_PUBLIC
43
                                                                                 )));
44
    if (count($items) > 0) {
45
        foreach ($items as $item) {
46
            $block['recent_lists'][] = $item->toArray();
47
        }
48
    }
49
50
    return $block;
51
}
52
53
/**
54
 * Edition des paramètres du bloc
55
 *
56
 * @param  array $options [0] = Nombre maximum de listes à voir, [1] = Type de listes (0 = les 2, 1 = liste cadeaux, 2 = produits recommandés)
57
 * @return array
58
 */
59 View Code Duplication
function b_oledrion_recent_lists_edit($options)
60
{
61
    include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php';
62
    $form = '';
63
    $form .= "<table border='0'>";
64
    $form .= '<tr><td>' . _MB_OLEDRION_LISTS_COUNT . "</td><td><input type='text' name='options[]' id='options' value='" . (int)$options[0] . "' /></td></tr>";
65
    $listTypes      = Oledrion_lists::getTypesArray();
66
    $listTypeSelect = Oledrion_utils::htmlSelect('options[]', $listTypes, (int)$options[1], false);
67
    $form .= '<tr><td>' . _MB_OLEDRION_LISTS_TYPE . '</td><td>' . $listTypeSelect . '</td></tr>';
68
    $form .= '</table>';
69
70
    return $form;
71
}
72
73
/**
74
 * Bloc à la volée
75
 * @param $options
76
 */
77 View Code Duplication
function b_oledrion_recent_lists_duplicatable($options)
78
{
79
    $options = explode('|', $options);
80
    $block   = b_oledrion_recent_lists_show($options);
81
82
    $tpl = new XoopsTpl();
83
    $tpl->assign('block', $block);
84
    $tpl->display('db:oledrion_block_recent_lists.tpl');
85
}
86