Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezgroupeditor.php
Go to the documentation of this file.
1 <?
3 //
4 // Definition of eZGroupEditor 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
30 //include_once( "classes/ezdb.php" );
31
32 class eZGroupEditor
33 {
40 function __construct( $id=-1, $fetch=true )
41 {
42 $this->IsConnected = false;
43 if ( $id != -1 )
44 {
45 $this->ID = $id;
46 if ( $fetch == true )
47 {
48 $this->get( $this->ID );
49 }
50 else
51 {
52 $this->State_ = "Dirty";
53 }
54 }
55 else
56 {
57 $this->State_ = "New";
58 }
59 }
60
64 function store()
65 {
66 $this->dbInit();
67
68 if ( !isset( $this->ID ) )
69 {
70 $this->Database->query( "INSERT INTO eZGroupEventCalendar_GroupEditor SET
71 UserID = '$this->UserID',
72 GroupID = '$this->GroupID'" );
73
74 $this->ID = $this->Database->insertID();
75 }
76 else
77 {
78 $this->Database->query( "UPDATE eZGroupEventCalendar_GroupEditor SET
79 UserID = '$this->UserID',
80 GroupID = '$this->GroupID'
81 WHERE ID='$this->ID'" );
82 }
83
84 return true;
85 }
86
91 function delete()
92 {
93 $this->dbInit();
94
95 if ( isset( $this->ID ) )
96 {
97 $this->Database->query( "DELETE FROM eZGroupEventCalendar_GroupEditor WHERE ID='$this->ID'" );
98 }
99
100 return true;
101 }
102
106 function get( $id=-1 )
107 {
108 $this->dbInit();
109
110 if ( $id != "" )
111 {
112 $this->Database->array_query( $group_array, "SELECT * FROM eZGroupEventCalendar_GroupEditor WHERE ID='$id'" );
113
114 $this->ID =& $group_array[0][ "ID" ];
115 $this->UserID =& $group_array[0][ "UserID" ];
116 $this->GroupID =& $group_array[0][ "GroupID" ];
117
118 $this->State_ = "Coherent";
119
120 }
121 else
122 {
123 $this->State_ = "Dirty";
124 }
125 }
126
130 function getByGroup($groupID)
131 {
132 $this->dbInit();
133
134 $return_array = array();
135 $event_array = array();
136
137 $this->Database->array_query( $group_array, "SELECT ID FROM eZGroupEventCalendar_GroupEditor WHERE GroupID='$groupID'" );
138
139 if( count( $group_array ) > 0 )
140 {
141 for( $i=0; $i < count( $group_array ); $i++ )
142 {
143 $return_array[$i] = new eZGroupEditor( $group_array[$i]["ID"] );
144 }
145 }
146
147 if( count( $return_array ) > 0 )
148 return $return_array;
149 else
150 return false;
151 }
152
156 function getAll()
157 {
158 $this->dbInit();
159
160 $return_array = array();
161 $event_array = array();
162
163 $this->Database->array_query( $group_array, "SELECT * FROM eZGroupEventCalendar_GroupEditor" );
164
165 if( count( $group_array ) >= 0 )
166 {
167 for( $i=0; $i < count ( $group_array ); $i++ )
168 {
169 $return_array[$i] = new eZGroupEditor( $group_array[$i]["ID"] );
170 }
171 }
172
173 return $return_array;
174 }
175
176 function hasEditPermission( $user, $group )
177 {
178 $this->dbInit();
179
180 $this->Database->array_query( $group_array, "SELECT GroupID FROM eZGroupEventCalendar_GroupEditor WHERE UserID='$user'" );
181
182 if( count( $group_array ) > 0 && $group == 0 )
183 {
184 return true;
185 }
186 elseif( count( $group_array ) > 0 && $group != 0 )
187 {
188 for( $i=0; $i < count( $group_array ); $i++ )
189 {
190 if( $group_array[$i][ "GroupID" ] == $group )
191 return true;
192 }
193 }
194 else
195 return false;
196 }
197
198
203 function groupHasEditor( $group )
204 {
205 $this->dbInit();
206
207 $this->Database->array_query( $group_array, "SELECT * FROM eZGroupEventCalendar_GroupEditor WHERE GroupID='$group'" );
208
209 $ret = false;
210
211 if( count( $group_array ) > 0 && $group != 0 )
212 $ret = true;
213
214 return $ret;
215 }
216
220 function id()
221 {
222 return $this->ID;
223 }
224
228 function userID()
229 {
230 return $this->UserID;
231 }
232
236 function groupID()
237 {
238 return $this->GroupID;
239 }
240
244 function setUser( $user )
245 {
246 if ( $this->State_ == "Dirty" )
247 $this->get( $this->ID );
248
249 if ( get_class( $user ) == "ezuser" )
250 {
251 $this->UserID = $user->id();
252 }
253 }
254
258 function setGroup( $group )
259 {
260 if ( $this->State_ == "Dirty" )
261 $this->get( $this->ID );
262
263 if ( get_class( $group ) == "ezusergroup" )
264 {
265 $this->GroupID = $group->id();
266 }
267 }
268
269 function listGroups()
270 {
271 $this->dbInit();
272 $return_array = array();
273
274 $this->Database->array_query( $group_array, "SELECT ID FROM eZGroupEventCalendar_GroupEditor Group By GroupID" );
275
276 if( count( $group_array ) >= 0 )
277 {
278 for( $i=0; $i < count ( $group_array ); $i++ )
279 {
280 $return_array[$i] = new eZGroupEditor( $group_array[$i]["ID"] );
281 }
282 return $return_array;
283 }
284 else
285 return false;
286 }
287
288
292 function removeDeletedGroup( $groupID='-1' )
293 {
294 $this->dbInit();
295
296 $this->Database->array_query( $group_array, "SELECT ID FROM eZGroupEventCalendar_GroupEditor WHERE GroupID='$groupID'" );
297
298 if( count( $group_array ) >= 0 )
299 {
300 for( $i=0; $i < count ( $group_array ); $i++ )
301 {
302 $deleteGroup = new eZGroupEditor( $group_array[$i]["ID"] );
303 $deleteGroup->delete( );
304 }
305 }
306 }
307
312 function dbInit()
313 {
314 if ( $this->IsConnected == false )
315 {
316 $this->Database = eZDB::globalDatabase();
317 $this->IsConnected = true;
318 }
319 }
320
321 var $IsConnected;
322 var $ID;
323 var $UserID;
324 var $GroupID;
325 var $State_;
326 var $Database;
327 }
328
329 ?>
$i
$i
Definition: admin/adlist.php:91
$group
$group
Definition: admin/articleedit.php:799
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZGroupEditor
Definition: ezgroupeditor.php:33
eZGroupEditor\$Database
$Database
Definition: ezgroupeditor.php:326
eZGroupEditor\$State_
$State_
Definition: ezgroupeditor.php:325
eZGroupEditor\groupID
groupID()
Definition: ezgroupeditor.php:236
eZGroupEditor\userID
userID()
Definition: ezgroupeditor.php:228
eZGroupEditor\__construct
__construct( $id=-1, $fetch=true)
Definition: ezgroupeditor.php:40
eZGroupEditor\$IsConnected
$IsConnected
Definition: ezgroupeditor.php:321
eZGroupEditor\$GroupID
$GroupID
Definition: ezgroupeditor.php:324
eZGroupEditor\getByGroup
getByGroup($groupID)
Definition: ezgroupeditor.php:130
eZGroupEditor\groupHasEditor
groupHasEditor( $group)
Definition: ezgroupeditor.php:203
eZGroupEditor\$ID
$ID
Definition: ezgroupeditor.php:322
eZGroupEditor\removeDeletedGroup
removeDeletedGroup( $groupID='-1')
Definition: ezgroupeditor.php:292
eZGroupEditor\hasEditPermission
hasEditPermission( $user, $group)
Definition: ezgroupeditor.php:176
eZGroupEditor\dbInit
dbInit()
Definition: ezgroupeditor.php:312
eZGroupEditor\id
id()
Definition: ezgroupeditor.php:220
eZGroupEditor\setGroup
setGroup( $group)
Definition: ezgroupeditor.php:258
eZGroupEditor\listGroups
listGroups()
Definition: ezgroupeditor.php:269
eZGroupEditor\getAll
getAll()
Definition: ezgroupeditor.php:156
eZGroupEditor\setUser
setUser( $user)
Definition: ezgroupeditor.php:244
eZGroupEditor\$UserID
$UserID
Definition: ezgroupeditor.php:323
eZGroupEditor\store
store()
Definition: ezgroupeditor.php:64
$id
$id
Definition: companytypelist.php:193
$groupID
$groupID
Definition: ezgroupeventcalendar/user/dayview.php:90
$group_array
$group_array
Definition: ezgroupeventcalendar/user/dayview.php:836
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.