Passed
Push — master ( 41940e...005d4f )
by Michael
36s queued 18s
created

class/TreeHandler.php (2 issues)

1
<?php
2
3
namespace XoopsModules\Pedigree;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*/
14
/**
15
 * Pedigree module for XOOPS
16
 *
17
 * @copyright       {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
18
 * @license         GPL 2.0 or later
19
 * @package         pedigree
20
 * @since           2.5.x
21
 * @author          XOOPS Module Dev Team (https://xoops.org)
22
 */
23
use XoopsModules\Pedigree;
24
25
defined('XOOPS_ROOT_PATH') || die('Restricted access');
26
27
/**
28
 * Class Pedigree\TreeHandler
29
 */
30
class TreeHandler extends \XoopsPersistableObjectHandler
31
{
32
    /**
33
     * @param null|object|\XoopsDatabase $db
34
     */
35
    public function __construct(\XoopsDatabase $db)
36
    {
37
        parent::__construct($db, 'pedigree_tree', Tree::class, 'id', 'naam');
38
    }
39
40
    /**
41
     * Get criteria for active animals
42
     *
43
     * @todo Refactor: Currently this routine returns all animals with `roft` = $roft
44
     * @param null $roft
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $roft is correct as it would always require null to be passed?
Loading history...
45
     * @return \CriteriaCompo
46
     */
47
    public function getActiveCriteria($roft = null)
48
    {
49
        //$grouppermHandler = xoops_getHandler('groupperm');
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
50
51
        //        $criteria = new \CriteriaCompo(new \Criteria('offline', false));
52
        //        $criteria->add(new \Criteria('published', 0, '>'));
53
        //        $criteria->add(new \Criteria('published', time(), '<='));
54
        //        $expiredCriteria = new \CriteriaCompo(new \Criteria('expired', 0));
55
        //        $expiredCriteria->add(new \Criteria('expired', time(), '>='), 'OR');
56
        //        $criteria->add($expiredCriteria);
57
58
        // add criteria for categories that the user has permissions for
59
        //        $groups                   = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
60
        //mb        $allowedDownCategoriesIds = $grouppermHandler->getItemIds('WFDownCatPerm', $groups, $this->wfdownloads->getModule()->mid());
61
        //mb        $criteria->add(new \Criteria('cid', '(' . implode(',', $allowedDownCategoriesIds) . ')', 'IN'));
62
63
        $criteria = new \CriteriaCompo();
64
        if (null !== $roft) {
65
            $criteria->add(new \Criteria('roft', $roft));
66
        }
67
        $criteria->setSort('naam ASC');
68
        $criteria->setOrder('ASC');
69
70
        return $criteria;
71
    }
72
}
73