Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezbugpriority.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezbugpriority.php 6409 2001-08-09 14:17:42Z jhe $
5 //
6 // Definition of eZBugPriority class
7 //
8 // Created on: <28-Nov-2000 20:30:36 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 eZBugPriority
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->escapeString( $this->Name );
78 if ( !isset( $this->ID ) )
79 {
80 $db->lock( "eZBug_Priority", "ID" );
81 $this->ID = $db->nextID( "eZBug_Priority", "ID" );
82 $res = $db->query( "INSERT INTO eZBug_Priority (ID, Name)
83 VALUES ('$this->ID', '$name')" );
84 $db->unlock();
85 }
86 else
87 {
88 $res = $db->query( "UPDATE eZBug_Priority SET
89 Name='$name' WHERE ID='$this->ID'" );
90 }
91 if ( $res == false )
92 $db->rollback();
93 else
94 $db->commit();
95
96 return true;
97 }
98
103 function delete()
104 {
105 $db =& eZDB::globalDatabase();
106 $db->begin();
107 if ( isset( $this->ID ) )
108 {
109 // remove all bugs from the database that have this priority.
110 $res[] = $db->query( "DELETE FROM eZBug_Bug WHERE PriorityID='$this->ID'" );
111 // remove the priority itself.
112 $res[] = $db->query( "DELETE FROM eZBug_Priority WHERE ID='$this->ID'" );
113 }
114 eZDB::finish( $res, $db );
115 return true;
116 }
117
121 function get( $id=-1 )
122 {
123 $db =& eZDB::globalDatabase();
124
125 if ( $id != "" )
126 {
127 $db->array_query( $priority_array, "SELECT * FROM eZBug_Priority WHERE ID='$id'" );
128 if ( count( $priority_array ) > 1 )
129 {
130 die( "Error: Priority's with the same ID was found in the database. This shouldent happen." );
131 }
132 else if ( count( $priority_array ) == 1 )
133 {
134 $this->ID = $priority_array[0][ $db->fieldName( "ID" ) ];
135 $this->Name = $priority_array[0][ $db->fieldName( "Name" ) ];
136 }
137 }
138 }
139
145 function getAll()
146 {
147 $db =& eZDB::globalDatabase();
148
149 $return_array = array();
150 $priority_array = array();
151
152 $db->array_query( $priority_array, "SELECT ID FROM eZBug_Priority ORDER BY Name" );
153
154 for ( $i = 0; $i < count( $priority_array ); $i++ )
155 {
156 $return_array[$i] = new eZBugPriority( $priority_array[$i][ $db->fieldName( "ID" ) ], 0 );
157 }
158 return $return_array;
159 }
160
164 function id()
165 {
166 return $this->ID;
167 }
168
169
173 function name( $html = true )
174 {
175 if ( $html )
176 return htmlspecialchars( $this->Name );
177 else
178 return $this->Name;
179 }
180
184 function setName( $value )
185 {
186 $this->Name = $value;
187 }
188
189 var $ID;
190 var $Name;
191
192 }
193
194 ?>
$i
$i
Definition: admin/adlist.php:91
eZBugPriority
Definition: ezbugpriority.php:54
eZBugPriority\store
store()
Definition: ezbugpriority.php:73
eZBugPriority\setName
setName( $value)
Definition: ezbugpriority.php:184
eZBugPriority\__construct
__construct( $id=-1)
Definition: ezbugpriority.php:61
eZBugPriority\$Name
$Name
Definition: ezbugpriority.php:190
eZBugPriority\name
name( $html=true)
Definition: ezbugpriority.php:173
eZBugPriority\$ID
$ID
Definition: ezbugpriority.php:189
eZBugPriority\id
id()
Definition: ezbugpriority.php:164
eZBugPriority\getAll
getAll()
Definition: ezbugpriority.php:145
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
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
$priority_array
$priority_array
Definition: todoedit.php:624
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.