Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezconsultationtype.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezconsultationtype.php 6970 2001-09-05 11:57:07Z jhe $
5 //
6 // Definition of eZConsultationType 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 eZConsultationType
54 {
61 function __construct( $id = -1 )
62 {
63 if ( $id != -1 )
64 {
65 $this->ID = $id;
66 $this->get( $this->ID );
67 }
68 }
69
73 function store()
74 {
75 $db =& eZDB::globalDatabase();
76 $db->begin();
77 $name = $db->fieldName( $this->Name );
78 if ( !isset( $this->ID ) )
79 {
80 $db->query_single( $qry, "SELECT ListOrder from eZContact_ConsultationType ORDER BY ListOrder DESC", array( "Limit" => 1 ) );
81
82 if( is_array( $qry ) && count( $qry ) > 0 ) {
83 $listorder = $qry[$db->fieldName("ListOrder")] + 1;
84 $this->ListOrder = $listorder;
85 $db->lock("eZContact_ConsultationType");
86 $this->ID = $db->nextID("eZContact_ConsultationType", "ID");
87 $res[] = $db->query("INSERT INTO eZContact_ConsultationType
88 (ID, Name, ListOrder)
89 VALUES
90 ('$this->ID', '$name', '$listorder')");
91 }
92 $db->unlock();
93 }
94 else
95 {
96 $res[] = $db->query( "UPDATE eZContact_ConsultationType SET
97 Name='$name',
98 ListOrder='$this->ListOrder'
99 WHERE ID='$this->ID'" );
100 }
101 eZDB::finish( $res, $db );
102 return true;
103 }
104
108 function delete( $relations = false )
109 {
110 if ( isset( $this->ID ) )
111 {
112 $db =& eZDB::globalDatabase();
113 if ( $relations )
114 {
115 $user =& eZUser::currentUser();
116 $user_id = $user->id();
117 $db->array_query( $consultations, "SELECT A.ID FROM eZContact_Consultation AS A, eZContact_ConsultationPersonUserDict AS B
118 WHERE A.ID = B.ConsultationID AND B.UserID='$user_id' AND A.StateID='$this->ID'" );
119 foreach ( $consultations as $consultation )
120 {
121 eZConsultation::delete( $consultation[ $db->fieldName( "ID" ) ] );
122 }
123 }
124 $res[] = $db->query( "DELETE FROM eZContact_ConsultationType WHERE ID='$this->ID'" );
125 eZDB::finish( $res, $db );
126 }
127 return true;
128 }
129
133 function get( $id=-1 )
134 {
135 $ret = false;
136
137 if ( $id != "" )
138 {
139 $db =& eZDB::globalDatabase();
140 $db->query_single( $consulttype_array, "SELECT * FROM eZContact_ConsultationType WHERE ID='$id'" );
141 $this->ID = $consulttype_array[ $db->fieldName( "ID" ) ];
142 $this->Name = $consulttype_array[ $db->fieldName( "Name" ) ];
143 $this->ListOrder = $consulttype_array[ $db->fieldName( "ListOrder" ) ];
144
145 $ret = true;
146 }
147 return $ret;
148 }
149
153 function setName( $name )
154 {
155 $this->Name = $name;
156 }
157
161 function id()
162 {
163 return $this->ID;
164 }
165
169 function name()
170 {
171 return $this->Name;
172 }
173
177 function count()
178 {
179 $db =& eZDB::globalDatabase();
180 $db->query_single( $qry, "SELECT count( ID ) as Count FROM eZContact_Consultation WHERE StateID='$this->ID'" );
181 return $qry[ $db->fieldName( "Count" ) ];
182 }
183
187 function moveUp()
188 {
189 $db =& eZDB::globalDatabase();
190 $db->begin();
191 $db->query_single( $qry, "SELECT ID, ListOrder FROM eZContact_ConsultationType
192 WHERE ListOrder<'$this->ListOrder' ORDER BY ListOrder DESC",
193 array( "Limit" => 1 ) );
194 $listorder = $qry[ $db->fieldName( "ListOrder" ) ];
195 $listid = $qry[ $db->fieldName( "ID" ) ];
196 $res[] = $db->query( "UPDATE eZContact_ConsultationType SET ListOrder='$listorder' WHERE ID='$this->ID'" );
197 $res[] = $db->query( "UPDATE eZContact_ConsultationType SET ListOrder='$this->ListOrder' WHERE ID='$listid'" );
198 eZDB::finish( $res, $db );
199
200 }
201
205 function moveDown()
206 {
207 $db =& eZDB::globalDatabase();
208 $db->begin();
209 $db->query_single( $qry, "SELECT ID, ListOrder FROM eZContact_ConsultationType
210 WHERE ListOrder>'$this->ListOrder' ORDER BY ListOrder ASC",
211 array( "Limit" => 1 ) );
212 $listorder = $qry[ $db->fieldName( "ListOrder" ) ];
213 $listid = $qry[ $db->fieldName( "ID" ) ];
214 $res[] = $db->query( "UPDATE eZContact_ConsultationType SET ListOrder='$listorder' WHERE ID='$this->ID'" );
215 $res[] = $db->query( "UPDATE eZContact_ConsultationType SET ListOrder='$this->ListOrder' WHERE ID='$listid'" );
216 eZDB::finish( $ret, $db );
217 }
218
224 static public function findTypes()
225 {
226 $qry_array = array();
227 $db =& eZDB::globalDatabase();
228 $db->array_query( $qry_array, "SELECT ID FROM eZContact_ConsultationType ORDER BY ListOrder" );
229 $ret_array = array();
230 foreach ( $qry_array as $qry )
231 {
232 $ret_array[] = new eZConsultationType( $qry[ $db->fieldName( "ID" ) ] );
233 }
234 return $ret_array;
235 }
236
237 var $ID;
238 var $Name;
239 var $ListOrder;
240 }
241
242 ?>
eZConsultationType
Definition: ezconsultationtype.php:54
eZConsultationType\moveDown
moveDown()
Definition: ezconsultationtype.php:205
eZConsultationType\count
count()
Definition: ezconsultationtype.php:177
eZConsultationType\setName
setName( $name)
Definition: ezconsultationtype.php:153
eZConsultationType\findTypes
static findTypes()
Definition: ezconsultationtype.php:224
eZConsultationType\$Name
$Name
Definition: ezconsultationtype.php:238
eZConsultationType\moveUp
moveUp()
Definition: ezconsultationtype.php:187
eZConsultationType\name
name()
Definition: ezconsultationtype.php:169
eZConsultationType\store
store()
Definition: ezconsultationtype.php:73
eZConsultationType\$ID
$ID
Definition: ezconsultationtype.php:237
eZConsultationType\id
id()
Definition: ezconsultationtype.php:161
eZConsultationType\__construct
__construct( $id=-1)
Definition: ezconsultationtype.php:61
eZConsultationType\$ListOrder
$ListOrder
Definition: ezconsultationtype.php:239
eZConsultation\delete
delete( $id=false)
Definition: ezconsultation.php:122
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$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
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.