Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

personlist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: personlist.php 9743 2002-11-21 08:52:13Z jhe $
5 //
6 // Created on: <23-Oct-2000 17:53:46 bf>
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 $ini =& eZINI::instance( 'site.ini' );
29 $Language = $ini->variable( "eZContactMain", "Language" );
30 $Max = $ini->variable( "eZContactMain", "MaxPersonList" );
31
32 if ( !is_numeric( $Max ) )
33 {
34 $Max = 10;
35 }
36
37 // include_once( "classes/eztemplate.php" );
38 // include_once( "classes/ezuritool.php" );
39 // include_once( "classes/ezlist.php" );
40
41 $t = new eZTemplate( "kernel/ezcontact/admin/" . $ini->variable( "eZContactMain", "AdminTemplateDir" ),
42 "kernel/ezcontact/admin/intl", $Language, "personedit.php" );
43 $t->setAllStrings();
44
45 // include_once( "ezcontact/classes/ezperson.php" );
46 // include_once( "ezcontact/classes/ezprojecttype.php" );
47 // include_once( "ezuser/classes/ezuser.php" );
48 // include_once( "ezuser/classes/ezusergroup.php" );
49 // include_once( "ezuser/classes/ezpermission.php" );
50
51 $user =& eZUser::currentUser();
52 if ( !is_a( $user, "eZUser" ) )
53 {
54 // include_once( "classes/ezhttptool.php" );
55 eZHTTPTool::header( "Location: /contact/nopermission/login" );
56 exit();
57 }
58
59 if ( !eZPermission::checkPermission( $user, "eZContact", "PersonList" ) )
60 {
61 // include_once( "classes/ezhttptool.php" );
62 eZHTTPTool::header( "Location: /contact/nopermission/person/list" );
63 exit();
64 }
65
66 $t->set_file( "person_page", "personlist.tpl" );
67 $t->set_block( "person_page", "no_persons_tpl", "no_persons" );
68
69 $t->set_block( "person_page", "person_table_tpl", "person_table" );
70
71 $t->set_block( "person_table_tpl", "person_item_tpl", "person_item" );
72
73 $t->set_block( "person_item_tpl", "person_state_tpl", "person_state" );
74 $t->set_block( "person_item_tpl", "no_person_state_tpl", "no_person_state" );
75 $t->set_block( "person_item_tpl", "image_item_tpl", "image_item" );
76 $t->set_block( "person_item_tpl", "person_view_button_tpl", "person_view_button" );
77 $t->set_block( "person_item_tpl", "no_person_view_button_tpl", "no_person_view_button" );
78 $t->set_block( "person_item_tpl", "person_buy_button_tpl", "person_buy_button" );
79 $t->set_block( "person_item_tpl", "person_folder_button_tpl", "person_folder_button" );
80 $t->set_block( "person_item_tpl", "person_consultation_button_tpl", "person_consultation_button" );
81 $t->set_block( "person_item_tpl", "person_edit_button_tpl", "person_edit_button" );
82 $t->set_block( "person_item_tpl", "person_delete_button_tpl", "person_delete_button" );
83 $t->set_block( "person_page", "person_new_button_tpl", "person_new_button" );
84
85 $t->set_block( "person_table_tpl", "person_list_tpl", "person_list" );
86
87 $t->set_block( "person_list_tpl", "person_list_previous_tpl", "person_list_previous" );
88 $t->set_block( "person_list_tpl", "person_list_item_list_tpl", "person_list_item_list" );
89 $t->set_block( "person_list_item_list_tpl", "person_list_item_tpl", "person_list_item" );
90 $t->set_block( "person_list_item_list_tpl", "person_list_inactive_item_tpl", "person_list_inactive_item" );
91 $t->set_block( "person_list_tpl", "person_list_next_tpl", "person_list_next" );
92 $t->set_block( "person_list_tpl", "person_list_previous_inactive_tpl", "person_list_previous_inactive" );
93 $t->set_block( "person_list_tpl", "person_list_next_inactive_tpl", "person_list_next_inactive" );
94
95 $t->set_var( "person_item", "" );
96 $t->set_var( "image_item", "" );
97
98 $session =& eZSession::globalSession();
99
100 if ( $session->fetch() != false )
101 {
102 if ( !isset( $LimitType ) )
103 {
104 if ( $session->variable( "PersonLimitType" ) == false )
105 $session->setVariable( "PersonLimitType", "all" );
106 $LimitType =& $session->variable( "PersonLimitType" );
107 }
108 else
109 {
110 $session->setVariable( "PersonLimitType", $LimitType );
111 }
112 }
113
114 $t->set_var( "is_all_selected", "" );
115 $t->set_var( "is_without_selected", "" );
116 $t->set_var( "is_with_selected", "" );
117 switch ( $LimitType )
118 {
119 case "all":
120 {
121 $t->set_var( "is_all_selected", "selected" );
122 break;
123 }
124 case "standalone":
125 default:
126 {
127 $t->set_var( "is_without_selected", "selected" );
128 break;
129 }
130 case "connected":
131 {
132 $t->set_var( "is_with_selected", "selected" );
133 break;
134 }
135 }
136
137 $person = new eZPerson();
138
139 if ( !isset( $Offset ) )
140 {
141 $Offset = 0;
142 }
143 else if ( !is_numeric( $Offset ) )
144 {
145 $Offset = 0;
146 }
147
148 $t->set_var( "action", $Action );
149
150 if ( !isset( $SearchText ) )
151 {
152 $total_persons = $person->getAllCount( "", $LimitType );
153 $persons = $person->getAll( "", $Offset, $Max, $LimitType );
154 $t->set_var( "search_form_text", "" );
155 $t->set_var( "search_text", "" );
156 }
157 else
158 {
159 $search_encoded = $SearchText;
160 $search_encoded = eZURITool::encode( $search_encoded );
161 $t->set_var( "search_form_text", $SearchText );
162 $t->set_var( "search_text", $search_encoded );
163 $total_persons = $person->getAllCount( $SearchText, $LimitType );
164 $persons = $person->getAll( $SearchText, $Offset, $Max, $LimitType );
165 }
166
167 $count = count( $persons );
168
169 $t->set_var( "person_table", "" );
170 $t->set_var( "no_persons", "" );
171
172 $t->set_var( "person_consultation_button", "" );
173 $t->set_var( "person_buy_button", "" );
174 $t->set_var( "person_edit_button", "" );
175 $t->set_var( "person_delete_button", "" );
176 $t->set_var( "person_view_button", "" );
177 $t->set_var( "no_person_view_button", "" );
178
179 $t->parse( "person_folder_button", "person_folder_button_tpl" );
180 if ( eZPermission::checkPermission( $user, "eZContact", "Buy" ) )
181 $t->parse( "person_buy_button", "person_buy_button_tpl" );
182 if ( eZPermission::checkPermission( $user, "eZContact", "Consultation" ) )
183 $t->parse( "person_consultation_button", "person_consultation_button_tpl" );
184 if ( eZPermission::checkPermission( $user, "eZContact", "PersonModify" ) )
185 $t->parse( "person_edit_button", "person_edit_button_tpl" );
186 if ( eZPermission::checkPermission( $user, "eZContact", "PersonDelete" ) )
187 $t->parse( "person_delete_button", "person_delete_button_tpl" );
188 if ( eZPermission::checkPermission( $user, "eZContact", "PersonView" ) )
189 {
190 $t->parse( "person_view_button", "person_view_button_tpl" );
191 }
192 else
193 {
194 $t->parse( "no_person_view_button", "no_person_view_button_tpl" );
195 }
196
197 if ( $count == 0 )
198 {
199 $t->parse( "no_persons", "no_persons_tpl" );
200 }
201 else
202 {
203 for ( $i = 0; $i < $count && $i < $Max; $i++ )
204 {
205 $t->set_var( "bg_color", ( $i % 2 ) == 0 ? "bglight" : "bgdark" );
206
207 $t->set_var( "person_id", $persons[$i]->id() );
208 $stateid = $persons[$i]->projectState();
209 $t->set_var( "state_id", $stateid );
210 $t->set_var( "person_state", "" );
211 $t->set_var( "no_person_state", "" );
212 if ( $stateid )
213 {
214 $state = new eZProjectType( $stateid );
215 $t->set_var( "person_state", $state->name() );
216 $t->parse( "person_state", "person_state_tpl" );
217 }
218 else
219 {
220 $t->parse( "no_person_state", "no_person_state_tpl" );
221 }
222 $t->set_var( "person_firstname", $persons[$i]->firstName() );
223 $t->set_var( "person_lastname", $persons[$i]->lastName() );
224
225 $image =& $persons[$i]->image();
226 if ( get_class( $image ) == "ezimage" && $image->id() != 0 )
227 {
228 $imageWidth =& $ini->variable( "eZContactMain", "PersonlistImageWidth" );
229 $imageHeight =& $ini->variable( "eZContactMain", "PersonlistImageHeight" );
230 $variation =& $image->requestImageVariation( $imageWidth, $imageHeight );
231 $imageURL = "/" . $variation->imagePath();
232 $imageWidth = $variation->width();
233 $imageHeight = $variation->height();
234 $imageCaption = $image->caption();
235 $t->set_var( "image_width", $imageWidth );
236 $t->set_var( "image_height", $imageHeight );
237 $t->set_var( "image_url", $imageURL );
238 $t->set_var( "image_caption", $imageCaption );
239 $t->parse( "image_item", "image_item_tpl" );
240 }
241 else
242 {
243 $t->parse( "image_item", "" );
244 }
245 $t->parse( "person_item", "person_item_tpl", true );
246 }
247
248 $t->parse( "person_table", "person_table_tpl" );
249 }
250
251 $t->set_var( "person_new_button", "" );
252 if ( eZPermission::checkPermission( $user, "eZContact", "PersonAdd" ) )
253 $t->parse( "person_new_button", "person_new_button_tpl" );
254
255 eZList::drawNavigator( $t, $total_persons, $Max, $Offset, false,
256 array( "type_list" => "person_list",
257 "next" => "person_list_next",
258 "next_inactive" => "person_list_next_inactive",
259 "next_index" => "item_next_index",
260 "previous" => "person_list_previous",
261 "previous_inactive" => "person_list_previous_inactive",
262 "previous_index" => "item_previous_index",
263 "item" => "person_list_item",
264 "item_inactive" => "person_list_inactive_item",
265 "item_index" => "item_index",
266 "item_list" => "person_list_item_list",
267 "item_name" => "item_name" ) );
268
269 $t->pparse( "output", "person_page" );
270
271 ?>
$i
$i
Definition: admin/adlist.php:91
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZList\drawNavigator
static drawNavigator(&$t, $total_types, $max_types, $index, $parent=false, $variables=false)
Definition: ezlist.php:401
eZPermission\checkPermission
static checkPermission( $user, $moduleName, $permissionName)
Definition: ezpermission.php:430
eZPerson
Definition: ezperson.php:43
eZProjectType
Definition: ezprojecttype.php:54
eZSession\globalSession
static & globalSession( $id="", $fetch=true)
Definition: kernel/ezsession/classes/ezsession.php:614
eZTemplate
Definition: eztemplate.php:107
eZURITool\encode
static & encode(&$text)
Definition: ezuritool.php:93
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$Action
$Action
Definition: companysearch.php:80
$SearchText
$SearchText
Definition: ezaddress/admin/typelist.php:143
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$variation
$variation
Definition: ezimagecatalogue/user/menubox.php:55
exit
exit
Definition: folder.php:81
$Max
$Max
Definition: personlist.php:30
$total_persons
$total_persons
Definition: personlist.php:163
$user
$user
Definition: personlist.php:51
$Language
$Language
Definition: personlist.php:29
$ini
$ini
Definition: personlist.php:28
$t
if(!is_numeric( $Max)) $t
Definition: personlist.php:41
$search_encoded
$search_encoded
Definition: personlist.php:160
$session
$session
Definition: personlist.php:98
$person
switch( $LimitType) $person
Definition: personlist.php:137
$count
$count
Definition: personlist.php:167
$persons
$persons
Definition: personlist.php:164
$image
$image
Definition: user/articlelist.php:242
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.