Nooku Server is an open source project powered by Assembla

Assembla offers free public and private SVN/Git repositories and project hosting with bug/issue tracking and collaboration tools.

nooku-server

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
 * @version     $Id$
 * @category    Nooku
 * @package     Nooku_Server
 * @subpackage  Extensions
 * @copyright   Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Plugins Module Class
 *
 * @author      Stian Didriksen <http://nooku.assembla.com/profile/stiandidriksen>
 * @category    Nooku
 * @package     Nooku_Server
 * @subpackage  Extensions
 */
class ComExtensionsModelPlugins extends ComDefaultModelDefault
{
    public function __construct(KConfig $config)
    {
        parent::__construct($config);

        $this->getState()
             ->insert('sort'   , 'cmd', 'folder')
             ->insert('enabled', 'boolean')
             ->insert('type'   , 'cmd')
             ->insert('hidden' , 'boolean');
    }

    protected function _buildQueryJoin(KDatabaseQuerySelect $query)
    {
        $query->join(array('groups' => 'groups'), 'groups.id = tbl.access');

        parent::_buildQueryJoin($query);
    }

    protected function _buildQueryWhere(KDatabaseQuerySelect $query)
    {
        parent::_buildQueryWhere($query);
        $state = $this->getState();

        if($state->search) {
            $query->where('tbl.name LIKE :search')->bind(array('search' => '%'.$state->search.'%'));
        }

        if($state->type) {
            $query->where('tbl.folder = :type')->bind(array('type' => $state->type));
        }

        if(is_bool($state->enabled)) {
            $query->where('tbl.published = :enabled')->bind(array('enabled' => (int) $state->enabled));
        }

        if(is_bool($state->hidden)) {
            $query->where('tbl.iscore = :hidden')->bind(array('hidden' => (int) $state->hidden));
        }
    }
}
Ajax-loader Loading, please wait...