Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezcategory.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezcategory.php 7992 2001-10-22 09:22:31Z $
5 //
6 // Definition of eZCategory class
7 //
8 // Created on: <26-Jun-2001 16:53:12 ce>
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
35 class eZCategory
36 {
40 function __construct( $id = -1 )
41 {
42 if ( $id != -1 )
43 {
44 $this->ID = $id;
45 $this->get( $this->ID );
46 }
47 }
48
53 function store()
54 {
55 $db =& eZDB::globalDatabase();
56 $db->begin();
57 $name = $db->escapeString( $this->Name );
58 $description = $db->escapeString( $this->Description );
59 if ( !isset( $this->ID ) )
60 {
61 $db->lock( "eZTodo_Category" );
62 $this->ID = $db->nextID( "eZTodo_Category" );
63 $res[] = $db->query( "INSERT INTO eZTodo_Category
64 (ID, Name, Description)
65 VALUES
66 ('$this->ID', '$name','$description')" );
67 $db->unlock();
68 }
69 else
70 {
71 $res[] = $db->query( "UPDATE eZTodo_Category SET
72 ID='$this->ID',
73 Name='$name',
74 Description='$description'
75 WHERE ID='$this->ID' ");
76 }
77 eZDB::finish( $res, $db );
78 return true;
79 }
80
81
85 function delete()
86 {
87 $db =& eZDB::globalDatabase();
88 $db->begin();
89 $res[] = $db->query( "DELETE FROM eZTodo_Category WHERE ID='$this->ID'" );
90 eZDB::finish( $res, $db );
91 return true;
92 }
93
97 function get( $id )
98 {
99 $db =& eZDB::globalDatabase();
100 $ret = false;
101
102 if ( $id != "" )
103 {
104 $db->array_query( $category_array, "SELECT * FROM eZTodo_Category WHERE ID='$id'" );
105 if ( count( $category_array ) > 1 )
106 {
107 die( "Error: Category's with the same ID was found in the database. This shouldent happen." );
108 }
109 else if ( count( $category_array ) == 1 )
110 {
111 $this->ID = $category_array[0][$db->fieldName( "ID" )];
112 $this->Name = $category_array[0][$db->fieldName( "Name" )];
113 $this->Description = $category_array[0][$db->fieldName( "Description" )];
114 $ret = true;
115 }
116 }
117 return $ret;
118 }
119
124 function getAll()
125 {
126 $db =& eZDB::globalDatabase();
127
128 $category_array = 0;
129
130 $return_array = array();
131 $category_array = array();
132
133 $db->array_query( $category_array, "SELECT ID FROM eZTodo_Category ORDER by Name" );
134
135 for ( $i = 0; $i < count( $category_array ); $i++ )
136 {
137 $return_array[$i] = new eZCategory( $category_array[$i][$db->fieldName( "ID" )], 0 );
138 }
139 return $return_array;
140 }
141
146 function name()
147 {
148 return htmlspecialchars( $this->Name );
149 }
150
155 function setName( $value )
156 {
157 $this->Name = $value;
158 }
159
164 function description()
165 {
166 return htmlspecialchars( $this->Description );
167 }
168
173 function setDescription( $value )
174 {
175 $this->Description = $value;
176 }
177
182 function id()
183 {
184 return $this->ID;
185 }
186
187 var $ID;
188 var $Name;
189 var $Description;
190
191 }
192
193 ?>
$i
$i
Definition: admin/adlist.php:91
eZCategory
Definition: ezcategory.php:36
eZCategory\getAll
getAll()
Definition: ezcategory.php:124
eZCategory\setDescription
setDescription( $value)
Definition: ezcategory.php:173
eZCategory\$Description
$Description
Definition: ezcategory.php:189
eZCategory\description
description()
Definition: ezcategory.php:164
eZCategory\name
name()
Definition: ezcategory.php:146
eZCategory\$Name
$Name
Definition: ezcategory.php:188
eZCategory\$ID
$ID
Definition: ezcategory.php:187
eZCategory\store
store()
Definition: ezcategory.php:53
eZCategory\id
id()
Definition: ezcategory.php:182
eZCategory\__construct
__construct( $id=-1)
Definition: ezcategory.php:40
eZCategory\setName
setName( $value)
Definition: ezcategory.php:155
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
$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
$category_array
$category_array
Definition: todoedit.php:604
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.