Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezbugstatus.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezbugstatus.php 6409 2001-08-09 14:17:42Z jhe $
5 //
6 // Definition of eZBugStatus class
7 //
8 // Created on: <28-Nov-2000 20:55:02 bf>
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
50 // include_once( "classes/ezdb.php" );
51
52
53 class eZBugStatus
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
77 $name = $db->escapeString( $this->Name );
78 if ( !isset( $this->ID ) )
79 {
80 $db->lock( "eZBug_Status", "ID" );
81 $this->ID = $db->nextID( "eZBug_Status", "ID" );
82 $res = $db->query( "INSERT INTO eZBug_Status (ID, Name)
83 VALUES ('$this->ID', '$name')" );
84 $db->unlock();
85 }
86 else
87 {
88 $res = $db->query( "UPDATE eZBug_Status SET
89 Name='$name' WHERE ID='$this->ID'" );
90 }
91
92 if ( $res == false )
93 $db->rollback();
94 else
95 $db->commit();
96
97 return true;
98 }
99
104 function delete()
105 {
106 $db =& eZDB::globalDatabase();
107
108 if ( isset( $this->ID ) )
109 {
110 $db->begin();
111 // remove all bugs that have this status
112 $res[] = $db->query( "DELETE FROM eZBug_Bug WHERE StatusID='$this->ID'" );
113 // remove the actual status
114 $res[] = $db->query( "DELETE FROM eZBug_Status WHERE ID='$this->ID'" );
115 if ( in_array( false, $res ) )
116 $db->rollback();
117 else
118 $db->commit();
119 }
120 return true;
121 }
122
126 function get( $id=-1 )
127 {
128 $db =& eZDB::globalDatabase();
129
130 if ( $id != "" )
131 {
132 $db->array_query( $status_array, "SELECT * FROM eZBug_Status WHERE ID='$id'" );
133 if ( count( $status_array ) > 1 )
134 {
135 die( "Error: Status's with the same ID was found in the database. This shouldent happen." );
136 }
137 else if ( count( $status_array ) == 1 )
138 {
139 $this->ID = $status_array[0][ $db->fieldName( "ID" ) ];
140 $this->Name = $status_array[0][ $db->fieldName( "Name" ) ];
141 }
142 }
143 }
144
150 function getAll()
151 {
152 $db =& eZDB::globalDatabase();
153
154 $return_array = array();
155 $status_array = array();
156
157 $db->array_query( $status_array, "SELECT ID FROM eZBug_Status ORDER BY Name" );
158
159 for ( $i = 0; $i < count( $status_array ); $i++ )
160 {
161 $return_array[$i] = new eZBugStatus( $status_array[$i][$db->fieldName( "ID" )], 0 );
162 }
163
164 return $return_array;
165 }
166
170 function id()
171 {
172 return $this->ID;
173 }
174
175
179 function name( $html = true )
180 {
181 if ( $html )
182 return htmlspecialchars( $this->Name );
183 else
184 return $this->Name;
185 }
186
190 function setName( $value )
191 {
192 $this->Name = $value;
193 }
194
195 var $ID;
196 var $Name;
197
198 }
199
200 ?>
$i
$i
Definition: admin/adlist.php:91
eZBugStatus
Definition: ezbugstatus.php:54
eZBugStatus\$ID
$ID
Definition: ezbugstatus.php:195
eZBugStatus\setName
setName( $value)
Definition: ezbugstatus.php:190
eZBugStatus\__construct
__construct( $id=-1)
Definition: ezbugstatus.php:61
eZBugStatus\name
name( $html=true)
Definition: ezbugstatus.php:179
eZBugStatus\$Name
$Name
Definition: ezbugstatus.php:196
eZBugStatus\id
id()
Definition: ezbugstatus.php:170
eZBugStatus\getAll
getAll()
Definition: ezbugstatus.php:150
eZBugStatus\store
store()
Definition: ezbugstatus.php:73
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
$name
$name
Definition: companytypelist.php:194
$id
$id
Definition: companytypelist.php:193
$db
$db
Definition: ezarticle/user/authorlist.php:53
$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
$status_array
$status_array
Definition: todoedit.php:645
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.