Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezprojecttype.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezprojecttype.php 9506 2002-05-06 13:39:53Z jhe $
5 //
6 // Definition of eZProjectType class
7 //
8 // Created on: <19-Mar-2001 16:51:20 amos>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
31
51 // include_once( "classes/ezdb.php" );
52
53 class eZProjectType
54 {
61 function __construct( $id = -1 )
62 {
63 $this->ExpiryTime = 0;
64 $this->WarningTime = 0;
65
66 if ( is_array( $id ) )
67 {
68 $this->fill( $id );
69 }
70 else if ( $id != -1 )
71 {
72 $this->ID = $id;
73 $this->get( $this->ID );
74 }
75 }
76
80 function store()
81 {
82 $db =& eZDB::globalDatabase();
83 $db->begin();
84 $name = $db->escapeString( $this->Name );
85 if ( !isset( $this->ID ) )
86 {
87 $db->query_single( $qry, "SELECT ListOrder from eZContact_ProjectType ORDER BY ListOrder DESC",
88 array( "Limit" => 1 ) );
89
90 if( is_array( $qry ) && count( $qry ) > 0 )
91 {
92 $listorder = $qry[$db->fieldName( "ListOrder" )] + 1;
93 $this->ListOrder = $listorder;
94
95 $db->lock( "eZContact_ProjectType" );
96 $this->ID = $db->nextID( "eZContact_ProjectType", "ID" );
97 $res[] = $db->query( "INSERT INTO eZContact_ProjectType
98 (ID, Name, ListOrder, ExpiryTime, WarningTime)
99 VALUES
100 ('$this->ID', '$name', '$listorder', '$this->ExpiryTime', '$this->WarningTime')" );
101 }
102 $db->unlock();
103 }
104 else
105 {
106 $res[] = $db->query( "UPDATE eZContact_ProjectType SET
107 Name='$name',
108 ListOrder='$this->ListOrder',
109 ExpiryTime='$this->ExpiryTime',
110 WarningTime='$this->WarningTime'
111 WHERE ID='$this->ID'" );
112 }
113 eZDB::finish( $res, $db );
114 return true;
115 }
116
120 function delete( $relations = false )
121 {
122 if ( isset( $this->ID ) )
123 {
124 $db =& eZDB::globalDatabase();
125 $db->begin();
126 $res[] = $db->query( "DELETE FROM eZContact_PersonProjectDict WHERE ProjectID='$this->ID'" );
127 $res[] = $db->query( "DELETE FROM eZContact_CompanyProjectDict WHERE ProjectID='$this->ID'" );
128 $res[] = $db->query( "DELETE FROM eZContact_ProjectType WHERE ID='$this->ID'" );
129 eZDB::finish( $res, $db );
130 }
131 return true;
132 }
133
137 function get( $id = -1 )
138 {
139 $ret = false;
140
141 if ( $id != "" )
142 {
143 $db =& eZDB::globalDatabase();
144 $db->query_single( $consulttype_array, "SELECT * FROM eZContact_ProjectType WHERE ID='$id'" );
145 $this->fill( $consulttype_array );
146
147 $ret = true;
148 }
149 return $ret;
150 }
151
155 function fill( &$consulttype_array )
156 {
157 $db =& eZDB::globalDatabase();
158 $this->ID = $consulttype_array[$db->fieldName( "ID" )];
159 $this->Name = $consulttype_array[$db->fieldName( "Name" )];
160 $this->ListOrder = $consulttype_array[$db->fieldName( "ListOrder" )];
161 $this->ExpiryTime = $consulttype_array[$db->fieldName( "ExpiryTime" )];
162 $this->WarningTime = $consulttype_array[$db->fieldName( "WarningTime" )];
163 }
164
168 function setName( $name )
169 {
170 $this->Name = $name;
171 }
172
173 function setExpiryTime( $value )
174 {
175 $this->ExpiryTime = $value;
176 }
177
178 function setWarningTime( $value )
179 {
180 $this->WarningTime = $value;
181 }
182
186 function id()
187 {
188 return $this->ID;
189 }
190
194 function name()
195 {
196 return $this->Name;
197 }
198
199 function expiryTime()
200 {
201 return $this->ExpiryTime;
202 }
203
204 function warningTime()
205 {
206 return $this->WarningTime;
207 }
208
212 function &count()
213 {
214 $db =& eZDB::globalDatabase();
215 $db->query_single( $person_qry, "SELECT count( PersonID ) as Count
216 FROM eZContact_PersonProjectDict
217 WHERE ProjectID='$this->ID'" );
218 $db->query_single( $company_qry, "SELECT count( CompanyID ) as Count
219 FROM eZContact_CompanyProjectDict
220 WHERE ProjectID='$this->ID'" );
221 return $person_qry[$db->fieldName( "Count" )] + $company_qry[$db->fieldName( "Count" )];
222 }
223
227 function moveUp()
228 {
229 $db =& eZDB::globalDatabase();
230 $db->begin();
231 $db->query_single( $qry, "SELECT ID, ListOrder FROM eZContact_ProjectType
232 WHERE ListOrder<'$this->ListOrder' ORDER BY ListOrder DESC",
233 array( "Limit" => 1 ) );
234 $listorder = $qry[$db->fieldName( "ListOrder" )];
235 $listid = $qry[$db->fieldName( "ID" )];
236 $res[] = $db->query( "UPDATE eZContact_ProjectType SET ListOrder='$listorder' WHERE ID='$this->ID'" );
237 $res[] = $db->query( "UPDATE eZContact_ProjectType SET ListOrder='$this->ListOrder' WHERE ID='$listid'" );
238 }
239
243 function moveDown()
244 {
245 $db =& eZDB::globalDatabase();
246 $db->begin();
247 $db->query_single( $qry, "SELECT ID, ListOrder FROM eZContact_ProjectType
248 WHERE ListOrder>'$this->ListOrder' ORDER BY ListOrder ASC",
249 array( "Limit" => 1 ) );
250 $listorder = $qry[$db->fieldName( "ListOrder" )];
251 $listid = $qry[ $db->fieldName( "ID" ) ];
252 $res[] = $db->query( "UPDATE eZContact_ProjectType SET ListOrder='$listorder' WHERE ID='$this->ID'" );
253 $res[] = $db->query( "UPDATE eZContact_ProjectType SET ListOrder='$this->ListOrder' WHERE ID='$listid'" );
254 eZDB::finish( $res, $db );
255 }
256
262 static public function &findTypes( $as_object = true )
263 {
264 $qry_array = array();
265 $db =& eZDB::globalDatabase();
266 if ( $as_object )
267 $select = "*";
268 else
269 $select = "ID";
270 $db->array_query( $qry_array, "SELECT $select FROM eZContact_ProjectType ORDER BY ListOrder" );
271 $ret_array = array();
272 if ( $as_object )
273 {
274 foreach ( $qry_array as $qry )
275 {
276 $ret_array[] = new eZProjectType( $qry );
277 }
278 }
279 else
280 {
281 foreach ( $qry_array as $qry )
282 {
283 $ret_array[] = $qry[$db->fieldName( "ID" )];
284 }
285 }
286 return $ret_array;
287 }
288
289 var $ID;
290 var $Name;
291 var $ListOrder;
292 var $ExpiryTime;
293 var $WarningTime;
294 }
295
296 ?>
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZProjectType
Definition: ezprojecttype.php:54
eZProjectType\$ID
$ID
Definition: ezprojecttype.php:289
eZProjectType\moveDown
moveDown()
Definition: ezprojecttype.php:243
eZProjectType\setName
setName( $name)
Definition: ezprojecttype.php:168
eZProjectType\findTypes
static & findTypes( $as_object=true)
Definition: ezprojecttype.php:262
eZProjectType\$ExpiryTime
$ExpiryTime
Definition: ezprojecttype.php:292
eZProjectType\name
name()
Definition: ezprojecttype.php:194
eZProjectType\$WarningTime
$WarningTime
Definition: ezprojecttype.php:293
eZProjectType\fill
fill(&$consulttype_array)
Definition: ezprojecttype.php:155
eZProjectType\$Name
$Name
Definition: ezprojecttype.php:290
eZProjectType\count
& count()
Definition: ezprojecttype.php:212
eZProjectType\id
id()
Definition: ezprojecttype.php:186
eZProjectType\setWarningTime
setWarningTime( $value)
Definition: ezprojecttype.php:178
eZProjectType\expiryTime
expiryTime()
Definition: ezprojecttype.php:199
eZProjectType\setExpiryTime
setExpiryTime( $value)
Definition: ezprojecttype.php:173
eZProjectType\moveUp
moveUp()
Definition: ezprojecttype.php:227
eZProjectType\__construct
__construct( $id=-1)
Definition: ezprojecttype.php:61
eZProjectType\$ListOrder
$ListOrder
Definition: ezprojecttype.php:291
eZProjectType\warningTime
warningTime()
Definition: ezprojecttype.php:204
eZProjectType\store
store()
Definition: ezprojecttype.php:80
$name
$name
Definition: companytypelist.php:194
$id
$id
Definition: companytypelist.php:193
$db
$db
Definition: ezarticle/user/authorlist.php:53
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
$res
$res
Definition: ezstats/admin/cron.php:45
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+.