Subversion Repositories novennotification

[/] [modules/] [novennotification/] [list.php] - Blame information for rev 1

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1 acidre
<?php
2
 
3
//
4
// ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
5
// SOFTWARE NAME: Noven notification
6
// SOFTWARE RELEASE: 1.0.0
7
// COPYRIGHT NOTICE: Copyright (C) 2009 - Jean-Luc Nguyen, Noven.
8
// SOFTWARE LICENSE: GNU General Public License v2.0
9
// NOTICE: >
10
//   This program is free software; you can redistribute it and/or
11
//   modify it under the terms of version 2.0  of the GNU General
12
//   Public License as published by the Free Software Foundation.
13
//
14
//   This program is distributed in the hope that it will be useful,
15
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
16
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
//   GNU General Public License for more details.
18
//
19
//   You should have received a copy of version 2.0 of the GNU General
20
//   Public License along with this program; if not, write to the Free
21
//   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
//   MA 02110-1301, USA.
23
//
24
//
25
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
26
//
27
 
28
include_once( "kernel/common/template.php" );
29
 
30
$Module =& $Params["Module"];
31
$Result = array();
32
$tpl = templateInit();
33
$http = eZHTTPTool::instance();
34
 
35
$notiINI = eZINI::instance('novennotification.ini');
36
 
37
// Autorized groups to display
38
$groupNodeIDs = $notiINI->variable('GroupSettings', 'UserGroupNodeIDs');
39
$tpl->setVariable( 'groupNodeIDs', $groupNodeIDs );
40
 
41
// Offset for pagination
42
if ( $Params['Offset'] )
43
{
44
    $offset = (int) $Params['Offset'];
45
}
46
else
47
{
48
    $offset = 0;
49
}
50
 
51
if ( $Params['Group'] )
52
{
53
    $selectedGroup = $Params['Group'];
54
}
55
else
56
{
57
    $selectedGroup = $groupNodeIDs[0];
58
}
59
 
60
$limit = (int) $notiINI->variable( 'GroupSettings', 'Limit' );
61
 
62
// Get users list
63
$users = eZFunctionHandler::execute( 'content', 'list', array(  'parent_node_id'    => $selectedGroup,
64
                                                                'depth'             => '1',
65
                                                                    'offset'            => $offset,
66
                                                                'limit'             => $limit,
67
                                                                'sort_by'           => array( 'name', true ) ) );
68
 
69
$totalUsers = eZFunctionHandler::execute( 'content', 'list_count', array(   'parent_node_id'    => $selectedGroup,
70
                                                                            'depth'             => '1' ) );
71
 
72
$tpl->setVariable( 'totalUsers', $totalUsers );
73
$tpl->setVariable( 'limit', $limit );
74
$tpl->setVariable( 'users', $users );
75
 
76
$currentURI = '/'.$Module->currentModule().'/'.$Module->currentView().'/(group)/'.$selectedGroup.'/';
77
$tpl->setVariable('uri', $currentURI);
78
$tpl->setVariable( 'selectedGroup', $selectedGroup );
79
 
80
$Result['content'] = $tpl->fetch( "design:novennotification/list.tpl" );
81
$Result['path'] = array(
82
                        array(  'url'   => false,
83
                                'text'  => ezi18n( 'extension/novennotification', 'Users notification settings' ) ) );
84