Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezbulkmail/admin/userlist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: userlist.php 8088 2001-10-29 19:10:11Z fh $
5 //
6 // Created on: <28-Aug-2001 15:02:02 fh>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "classes/INIFile.php" );
28 // include_once( "classes/eztemplate.php" );
29 // include_once( "classes/ezhttptool.php" );
30
31 // include_once( "ezbulkmail/classes/ezbulkmailsubscriptionaddress.php" );
32 // include_once( "ezbulkmail/classes/ezbulkmailcategory.php" );
33
34 $ini =& eZINI::instance( 'site.ini' );
35 $Language = $ini->variable( "eZBulkMailMain", "Language" );
36
37 $t = new eZTemplate( "kernel/ezbulkmail/admin/" . $ini->variable( "eZBulkMailMain", "AdminTemplateDir" ),
38 "kernel/ezbulkmail/admin/intl/", $Language, "userlist.php" );
39
40 $t->setAllStrings();
41
42 $t->set_file( array(
43 "user_list_page_tpl" => "userlist.tpl"
44 ) );
45
46 $t->set_block( "user_list_page_tpl", "category_item_tpl", "category_item" );
47 $t->set_var( "category_item", "" );
48
49 $t->set_block( "user_list_page_tpl", "address_tpl", "address" );
50 $t->set_block( "address_tpl", "address_item_tpl", "address_item" );
51 $t->set_var( "address", "" );
52
53 $t->set_block( "user_list_page_tpl", "user_address_tpl", "user_address" );
54 $t->set_block( "user_address_tpl", "user_address_item_tpl", "user_address_item" );
55 $t->set_var( "user_address", "" );
56
57
58 $t->set_block( "user_list_page_tpl", "address_group_tpl", "address_group" );
59 $t->set_block( "address_group_tpl", "address_item_group_tpl", "address_item_group" );
60 $t->set_var( "address_group", "" );
61
62 $t->set_block( "user_list_page_tpl", "no_subscribers_tpl", "no_subscribers" );
63 $t->set_var( "no_subscribers", "" );
64
65 // some logic to set the CategoryID right. (we can get it both from url and from the list)
66 if( isset( $ListID ) && is_numeric( $ListID ) )
67 $CategoryID = $ListID;
68
69 $categories = eZBulkMailCategory::getAll();
70 foreach( $categories as $category )
71 {
72 $t->set_var( "category_id", $category->id() );
73 $t->set_var( "category_name", $category->name() );
74 if( $CategoryID == $category->id() )
75 $t->set_var( "category_selected", "selected" );
76 else
77 $t->set_var( "category_selected", "" );
78
79 $t->parse( "category_item", "category_item_tpl", true );
80 }
81
82 if( $CategoryID != 0 )
83 {
84 // list normal subscribers..
85 $i = 0;
86 $addresses = eZBulkMailCategory::subscribers( true, $CategoryID );
87 $normal = 0;
88 $normalUser = 0;
89 if( count( $addresses ) > 0 )
90 {
91 foreach( $addresses as $address )
92 {
93 $t->set_var( "subscriber_address", $address->eMail() );
94 ( $i % 2 ) ? $t->set_var( "td_class", "bgdark" ) : $t->set_var( "td_class", "bglight" );
95 $t->parse( "address_item", "address_item_tpl", true );
96 $i++; $normal++;
97 }
98 }
99 // list eZUser subscribers.
100 $addresses = eZBulkMailCategory::subscribedUsers( $CategoryID );
101 if( count( $addresses ) > 0 )
102 {
103 foreach( $addresses as $address )
104 {
105 $t->set_var( "subscriber_address", $address->eMail() );
106 ( $i % 2 ) ? $t->set_var( "td_class", "bgdark" ) : $t->set_var( "td_class", "bglight" );
107 $t->parse( "user_address_item", "user_address_item_tpl", true );
108 $i++; $normalUser++;
109 }
110 }
111
112 // list users forced by group addition
113 $groups = eZBulkMailCategory::groupSubscriptions( true, $CategoryID );
114 foreach( $groups as $group )
115 $subscribers = array_merge( $subscribers, $group->users() );
116
117 $group = 0;
118 if( count( $subscribers ) > 0 )
119 {
120 foreach( $subscribers as $subscriber )
121 {
122 $t->set_var( "subscriber_address_group", $subscriber->eMail() );
123 ( $i % 2 ) ? $t->set_var( "td_class", "bgdark" ) : $t->set_var( "td_class", "bglight" );
124 $t->parse( "address_item_group", "address_item_group_tpl", true );
125 $i++; $group++;
126 }
127 }
128
129 if( $i > 0 )
130 {
131 if( $normal > 0 )
132 $t->parse( "address", "address_tpl", false );
133 if( $normalUser > 0 )
134 $t->parse( "user_address", "user_address_tpl", false );
135 if( $group > 0 )
136 $t->parse( "address_group", "address_group_tpl", false );
137 }
138 else
139 {
140 $t->parse( "no_subscribers", "no_subscribers_tpl", false );
141 }
142 }
143
144 $t->pparse( "output", "user_list_page_tpl" );
145
146 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$i
$i
Definition: admin/adlist.php:91
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$group
$group
Definition: admin/articleedit.php:799
$address
$address
Definition: checkout.php:588
eZTemplate
Definition: eztemplate.php:107
$groups
if( $CategoryID !=0) $groups
Definition: ezbulkmail/admin/categoryedit.php:108
$t
$t
Definition: ezbulkmail/admin/userlist.php:37
$Language
$Language
Definition: ezbulkmail/admin/userlist.php:35
$ini
$ini
Definition: ezbulkmail/admin/userlist.php:34
$categories
$categories
Definition: ezbulkmail/admin/userlist.php:69
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.