Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezgroupeventtype.php
Go to the documentation of this file.
1 <?
3 //
4 // Definition of eZGroupEventType class
5 //
6 // Adam Fallert <FallertA@umsystem.edu>
7 // Created on: <3-Oct-2001 14:36:00>
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version 2
12 // of the License, or (at your option) any later version.
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 the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
22 //
23
26
34 //include_once( "classes/ezdb.php" );
35
36 class eZGroupEventType
37 {
44 function __construct( $id=-1, $fetch=true )
45 {
46 $this->IsConnected = false;
47
48 if ( $id != -1 )
49 {
50 $this->ID = $id;
51 $this->get( $this->ID );
52 $this->State_ = "Coherent";
53 }
54 else
55 {
56 $this->State_ = "New";
57 }
58 }
59
63 function store()
64 {
65 $this->dbInit();
66
67 if ( !isset( $this->ID ) )
68 {
69 $this->Database->query( "INSERT INTO eZGroupEventCalendar_EventType SET
70 Name='$this->Name',
71 Description='$this->Description',
72 ParentID='$this->ParentID'" );
73 $this->ID = mysql_insert_id();
74 }
75 else
76 {
77 $this->Database->query( "UPDATE eZGroupEventCalendar_EventType SET
78 Name='$this->Name',
79 Description='$this->Description',
80 ParentID='$this->ParentID' WHERE ID='$this->ID'" );
81 }
82
83 return true;
84 }
85
90 function delete()
91 {
92 $this->dbInit();
93
94 if ( isset( $this->ID ) )
95 {
96 $this->Database->query( "DELETE FROM eZGroupEventCalendar_EventType WHERE ID='$this->ID'" );
97 }
98
99 return true;
100 }
101
105 function get( $id=-1 )
106 {
107 $this->dbInit();
108
109 if ( $id != "" )
110 {
111 $this->Database->array_query( $EventType_array, "SELECT * FROM eZGroupEventCalendar_EventType WHERE ID='$id'" );
112 if ( count( $EventType_array ) > 1 )
113 {
114 die( "Error: EventType's with the same ID was found in the database. This shouldent happen." );
115 }
116 else if( count( $EventType_array ) == 1 )
117 {
118 $this->ID = $EventType_array[0][ "ID" ];
119 $this->Name = $EventType_array[0][ "Name" ];
120 $this->Description = $EventType_array[0][ "Description" ];
121 $this->ParentID = $EventType_array[0][ "ParentID" ];
122 $this->ExcludeFromSearch = $EventType_array[0][ "ExcludeFromSearch" ];
123 }
124
125 $this->State_ = "Coherent";
126 }
127 else
128 {
129 $this->State_ = "Dirty";
130 }
131 }
132
138 function &getAll()
139 {
140 $this->dbInit();
141
142 $return_array = array();
143 $EventType_array = array();
144
145 $this->Database->array_query( $EventType_array, "SELECT ID FROM eZGroupEventCalendar_EventType ORDER BY Name" );
146
147 for ( $i=0; $i<count($EventType_array); $i++ )
148 {
149 $return_array[$i] = new eZGroupEventType( $EventType_array[$i]["ID"], 0 );
150 }
151
152 return $return_array;
153 }
154
163 function &getByParent( $parent, $showAll=false, $sortby="name" )
164 {
165 if ( is_a( $parent, "eZGroupEventType" ) )
166 {
167 $this->dbInit();
168
169 $return_array = array();
170 $eventtype_array = array();
171
172 $parentID = $parent->id();
173
174
175 if ( $showAll == true )
176 {
177 $this->Database->array_query( $eventtype_array, "SELECT ID, Name FROM eZGroupEventCalendar_EventType
178 WHERE ParentID='$parentID'
179 ORDER BY Name" );
180 }
181 else
182 {
183 $this->Database->array_query( $eventtype_array, "SELECT ID, Name FROM eZGroupEventCalendar_EventType
184 WHERE ParentID='$parentID' AND ExcludeFromSearch='false'
185 ORDER BY Name" );
186 }
187
188 for ( $i=0; $i<count($eventtype_array); $i++ )
189 {
190 $return_array[$i] = new eZGroupEventType( $eventtype_array[$i]["ID"], 0 );
191 }
192
193 return $return_array;
194 }
195 else
196 {
197 return 0;
198 }
199 }
200
208 function path( $EventTypeID=0 )
209 {
210 if ( $EventTypeID == 0 )
211 {
212 $EventTypeID = $this->ID;
213 }
214
215 $EventType = new eZGroupEventType( $EventTypeID );
216
217 $path = array();
218
219 $parent = $EventType->parent();
220
221 if ( $parent != 0 )
222 {
223 $path = array_merge( $path, $this->path( $parent->id() ) );
224 }
225 else
226 {
227 // array_push( $path, $EventType->name() );
228 }
229
230 if ( $EventTypeID != 0 )
231 array_push( $path, array( $EventType->id(), $EventType->name() ) );
232
233 return $path;
234 }
235
239 function &getTree( $parentID=0, $level=0 )
240 {
241
242 $EventType = new eZGroupEventType( $parentID );
243
244 $EventTypeList =& $EventType->getByParent( $EventType, true );
245
246 $tree = array();
247 $level++;
248 foreach ( $EventTypeList as $EventType )
249 {
250 array_push( $tree, array( $return_array[] = new eZGroupEventType( $EventType->id() ), $level ) );
251
252 if ( $EventType != 0 )
253 {
254 $tree = array_merge( $tree, $this->getTree( $EventType->id(), $level ) );
255 }
256 }
257
258 return $tree;
259 }
260
264 function id()
265 {
266 return $this->ID;
267 }
268
272 function name( $htmlchars=true )
273 {
274 if ( $htmlchars == true && !is_null( $this->Name ) )
275 {
276 return htmlspecialchars( $this->Name );
277 }
278 else
279 {
280 return $this->Name;
281 }
282 }
283
287 function description( $htmlchars=true )
288 {
289 if ( $htmlchars == true )
290 {
291 return htmlspecialchars( $this->Description );
292 }
293 else
294 {
295 return $this->Description;
296 }
297 }
298
302 function parentID()
303 {
304 return $this->ParentID;
305 }
306
310 function parent()
311 {
312 if ( $this->ParentID != 0 )
313 {
314 return new eZGroupEventType( $this->ParentID );
315 }
316 else
317 {
318 return 0;
319 }
320 }
321
325 function setName( $value )
326 {
327 if ( $this->State_ == "Dirty" )
328 $this->get( $this->ID );
329
330 $this->Name = $value;
331 }
332
336 function setDescription( $value )
337 {
338 $this->Description = $value;
339 }
340
344 function setParent( $value )
345 {
346 if ( get_class( $value ) == "ezgroupeventtype" )
347 {
348 $this->ParentID = $value->id();
349 }
350 }
351
356 function dbInit()
357 {
358 if ( $this->IsConnected == false )
359 {
360 $this->Database = eZDB::globalDatabase();
361 $this->IsConnected = true;
362 }
363 }
364
365 var $ID;
366 var $Name;
367 var $ParentID;
368 var $Description;
369
371 var $Database;
372
374 var $State_;
376 var $IsConnected;
377 var $ExcludeFromSearch;
378 }
379
380 ?>
$i
$i
Definition: admin/adlist.php:91
$level
$level
Definition: admin/message.php:106
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZGroupEventType
Definition: ezgroupeventtype.php:37
eZGroupEventType\setDescription
setDescription( $value)
Definition: ezgroupeventtype.php:336
eZGroupEventType\id
id()
Definition: ezgroupeventtype.php:264
eZGroupEventType\name
name( $htmlchars=true)
Definition: ezgroupeventtype.php:272
eZGroupEventType\setParent
setParent( $value)
Definition: ezgroupeventtype.php:344
eZGroupEventType\store
store()
Definition: ezgroupeventtype.php:63
eZGroupEventType\$ID
$ID
Definition: ezgroupeventtype.php:365
eZGroupEventType\setName
setName( $value)
Definition: ezgroupeventtype.php:325
eZGroupEventType\$ExcludeFromSearch
$ExcludeFromSearch
Definition: ezgroupeventtype.php:377
eZGroupEventType\$ParentID
$ParentID
Definition: ezgroupeventtype.php:367
eZGroupEventType\$State_
$State_
Indicates the state of the object. In regard to database information.
Definition: ezgroupeventtype.php:374
eZGroupEventType\path
path( $EventTypeID=0)
Definition: ezgroupeventtype.php:208
eZGroupEventType\__construct
__construct( $id=-1, $fetch=true)
Definition: ezgroupeventtype.php:44
eZGroupEventType\$Name
$Name
Definition: ezgroupeventtype.php:366
eZGroupEventType\description
description( $htmlchars=true)
Definition: ezgroupeventtype.php:287
eZGroupEventType\getAll
& getAll()
Definition: ezgroupeventtype.php:138
eZGroupEventType\$Description
$Description
Definition: ezgroupeventtype.php:368
eZGroupEventType\$IsConnected
$IsConnected
Is true if the object has database connection, false if not.
Definition: ezgroupeventtype.php:376
eZGroupEventType\getTree
& getTree( $parentID=0, $level=0)
Definition: ezgroupeventtype.php:239
eZGroupEventType\dbInit
dbInit()
Definition: ezgroupeventtype.php:356
eZGroupEventType\parentID
parentID()
Definition: ezgroupeventtype.php:302
eZGroupEventType\$Database
$Database
Variable for keeping the database connection.
Definition: ezgroupeventtype.php:371
eZGroupEventType\getByParent
& getByParent( $parent, $showAll=false, $sortby="name")
Definition: ezgroupeventtype.php:163
eZGroupEventType\parent
parent()
Definition: ezgroupeventtype.php:310
$id
$id
Definition: companytypelist.php:193
$tree
$tree
Definition: ezad/admin/categoryedit.php:172
Name
if($user) if(isset( $next) && $next)<?=isset($all_fields_error) &&$all_fields_error ?><?=isset($password_error) &&$password_error ?></p ><? endif;?>< form method="post">< table border="0" cellspacing="2" cellpadding="2" class="boxtext" style="font-size=13;">< tr >< td style="color:<?= isset( $error['first_name'] ) ?> First Name
Definition: step1.php:127
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.