Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

personsearch.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: personsearch.php 9805 2003-04-10 14:48:45Z br $
5 //
6 // Created on: <25-Jul-2001 12:43:04 jhe>
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 /*
28 Searches for companies.
29 */
30 // include_once( "classes/INIFile.php" );
31 // include_once( "classes/eztemplate.php" );
32 // include_once( "ezcontact/classes/ezperson.php" );
34 // include_once( "ezuser/classes/ezpermission.php" );
35
36 $ini =& eZINI::instance( 'site.ini' );
37 $Language = $ini->variable( "eZContactMain", "Language" );
38 $errorIni = new eZINI( "kernel/ezcontact/user/intl/" . $Language . "/personsearch.php.ini", false );
39
40 $t = new eZTemplate( "kernel/ezcontact/user/" . $ini->variable( "eZContactMain", "TemplateDir" ),
41 "kernel/ezcontact/user/intl/", $Language, "personsearch.php" );
42
43 $t->set_file( "search", "personsearch.tpl" );
44
45 $t->set_block( "search", "current_type_tpl", "current_type" );
46 $t->set_block( "search", "list_tpl", "list" );
47 $t->set_block( "search", "not_root_tpl", "not_root" );
48 $t->set_block( "search", "category_list_tpl", "category_list" );
49 $t->set_block( "search", "no_type_item_tpl", "no_type_item" );
50 $t->set_block( "search", "no_category_item_tpl", "no_category_item" );
51 $t->set_block( "search", "person_item_tpl", "person_item" );
52 $t->set_block( "search", "no_companies_tpl", "no_companies" );
53 $t->set_block( "search", "companies_table_tpl", "companies_table" );
54 $t->set_block( "search", "person_new_button_tpl", "person_new_button" );
55
56 $t->set_block( "companies_table_tpl", "person_stats_header_tpl", "person_stats_header" );
57
58 $t->set_block( "person_item_tpl", "person_view_button_tpl", "person_view_button" );
59 $t->set_block( "person_item_tpl", "no_person_view_button_tpl", "no_person_view_button" );
60 $t->set_block( "person_item_tpl", "person_consultation_button_tpl", "person_consultation_button" );
61 $t->set_block( "person_item_tpl", "person_edit_button_tpl", "person_edit_button" );
62 $t->set_block( "person_item_tpl", "person_delete_button_tpl", "person_delete_button" );
63 $t->set_block( "person_item_tpl", "person_stats_item_tpl", "person_stats_item" );
64
65 $t->set_var( "search_box", "" );
66 $t->set_var( "search_results", "" );
67 $t->set_var( "result_item", "" );
68 $t->set_var( "category_option", "" );
69 $t->set_var( "result_category", "" );
70 $t->set_var( "companies_table", "" );
71 $t->set_var( "command_type", "person" );
72
73 $t->set_var( "search_text", htmlspecialchars( $SearchText ) );
74 $t->set_var( "current_id", isset( $SearchCategory ) ? $SearchCategory : false );
75
76 $Action = "new";
77 $results = "false";
78
79 if ( isset( $SearchObject ) && $SearchObject == "person" )
80 {
81 $Action = "search";
82 }
83
84 if ( !empty( $SearchText ) )
85 {
86 $Action = "search";
87 }
88 $person = new eZPerson();
89 $result = false;
90 $personArray = array();
91 if ( $Action == "search" )
92 {
93 $personArray = $person->search( $SearchText );
94 $count = count( $personArray );
95 if ( $count > 0 )
96 {
97 $results = true;
98 }
99 }
100
101 if ( $results )
102 {
103 $count = count( $personArray );
104 $t->set_var( "results", $count );
105 $i = 0;
106
107 $can_view_stats = eZPermission::checkPermission( $user, "eZContact", "PersonStats" ) && isset( $ShowStats ) && $ShowStats;
108 $t->set_var( "person_stats_header", "" );
109 if ( $can_view_stats )
110 $t->parse( "person_stats_header", "person_stats_header_tpl" );
111 $t->set_var( "person_stats_item", "" );
112
113
114 $t->set_var( "person_consultation_button", "" );
115 $t->set_var( "person_edit_button", "" );
116 $t->set_var( "person_delete_button", "" );
117 $t->set_var( "person_view_button", "" );
118 $t->set_var( "no_person_view_button", "" );
119 if ( eZPermission::checkPermission( $user, "eZContact", "Consultation" ) )
120 $t->parse( "person_consultation_button", "person_consultation_button_tpl" );
121 if ( eZPermission::checkPermission( $user, "eZContact", "PersonModify" ) )
122 $t->parse( "person_edit_button", "person_edit_button_tpl" );
123 if ( eZPermission::checkPermission( $user, "eZContact", "PersonDelete" ) )
124 $t->parse( "person_delete_button", "person_delete_button_tpl" );
125 if ( eZPermission::checkPermission( $user, "eZContact", "PersonView" ) )
126 {
127 $t->parse( "person_view_button", "person_view_button_tpl" );
128 }
129 else
130 {
131 $t->parse( "no_person_view_button", "no_person_view_button_tpl" );
132 }
133
134 if ( !isset( $personList ) || isset( $personList ) && count( $personList ) == 0 )
135 {
136 $t->set_var( "person_item", "" );
137 $t->set_var( "companies_table", "" );
138 $t->parse( "no_companies", "no_companies_tpl" );
139 }
140 else
141 {
142 $can_view_stats = eZPermission::checkPermission( $user, "eZContact", "PersonStats" ) && isset( $ShowStats ) && $ShowStats;
143 $t->set_var( "person_stats_header", "" );
144 if ( $can_view_stats )
145 $t->parse( "person_stats_header", "person_stats_header_tpl" );
146 $t->set_var( "person_stats_item", "" );
147 $t->set_var( "no_companies", "" );
148 $t->parse( "companies_table", "companies_table_tpl" );
149 }
150
151 foreach ( $personArray as $person )
152 {
153 if ( $can_view_stats )
154 {
155 $count = $personList[$i]->totalViewCount();
156 $t->set_var( "person_views", $count );
157 $t->parse( "person_stats_item", "person_stats_item_tpl" );
158 }
159
160 unSet( $logoObj );
161
162 $t->set_var( "no_companies", "" );
163
164 if ( ( $i % 2 ) == 0 )
165 $t->set_var( "td_class", "bglight" );
166 else
167 $t->set_var( "td_class", "bgdark" );
168 $i++;
169 $t->set_var( "person_name", $person->name() );
170 $t->set_var( "person_id", $person->id() );
171 $t->set_var( "item_description", $person->comment() );
172 $t->set_var( "item_view_path", "/contact/person/view" );
173 $t->set_var( "item_delete_path", "/contact/person/delete" );
174 $t->set_var( "item_edit_path", "/contact/person/edit" );
175
176 $t->set_var( "result_category", "" );
177 $t->parse( "person_item", "person_item_tpl", true );
178
179 }
180
181 if ( $count > 0 )
182 {
183 $t->parse( "companies_table", "companies_table_tpl" );
184 }
185 }
186
187 $t->parse( "list", "list_tpl" );
188 $t->setAllStrings();
189
190 $t->pparse( "output", "search");
191
192 ?>
$i
$i
Definition: admin/adlist.php:91
eZINI
Reads and writes .ini style configuration files.
eZPermission\checkPermission
static checkPermission( $user, $moduleName, $permissionName)
Definition: ezpermission.php:430
eZPerson
Definition: ezperson.php:43
eZTemplate
Definition: eztemplate.php:107
$SearchText
$SearchText
Definition: ezaddress/admin/typelist.php:143
$personList
$personList
Definition: link.php:119
$count
$count
Definition: onlinetypelist.php:108
$result
$result
Definition: personsearch.php:89
$results
$results
Definition: personsearch.php:77
$t
$t
Definition: personsearch.php:40
$errorIni
$errorIni
Definition: personsearch.php:38
$Language
$Language
Definition: personsearch.php:37
$ini
$ini
Definition: personsearch.php:36
$person
if(isset( $SearchObject) && $SearchObject=="person") if(!empty( $SearchText)) $person
Definition: personsearch.php:88
$personArray
$personArray
Definition: personsearch.php:90
$Action
$Action
Definition: personsearch.php:76
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.