Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezmodule.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezmodule.php 9537 2002-05-15 16:02:04Z bf $
5 //
6 // Definition of eZModule class
7 //
8 // Created on: <27-Sep-2000 08:00:43 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
53 class eZModule
54 {
61 function __construct( $id="" )
62 {
63 if ( $id != "" )
64 {
65 $this->ID = $id;
66 $this->get( $this->ID );
67 }
68 }
69
75 function store()
76 {
77 $db =& eZDB::globalDatabase();
78
79 $dbError = false;
80 $db->begin( );
81
82 $name = $db->escapeString( $this->Name );
83
84 if ( !isset( $this->ID ) )
85 {
86 $db->lock( "eZUser_Module" );
87
88 $nextID = $db->nextID( "eZUser_Module", "ID" );
89
90 $res = $db->query( "INSERT INTO eZUser_Module
91 ( ID, Name )
92 VALUES
93 ( '$nextID', '$name' )" );
94
95 $this->ID = $nextID;
96 }
97 else
98 {
99 $res = $this->Database->query( "UPDATE eZUser_Module SET
100 Name='$name'
101 WHERE ID='$this->ID'" );
102 }
103
104
105 $db->unlock();
106
107 if ( $res == false )
108 $dbError = true;
109
110 if ( $dbError == true )
111 $db->rollback( );
112 else
113 $db->commit();
114
115 return true;
116 }
117
122 function delete()
123 {
124 $db =& eZDB::globalDatabase();
125
126 $db->begin( );
127
128 if ( isset( $this->ID ) )
129 {
130 $res = $db->query( "DELETE FROM eZUser_Module WHERE ID='$this->ID'" );
131 }
132
133 if ( $res == false )
134 $db->rollback( );
135 else
136 $db->commit();
137
138
139 return true;
140 }
141
145 function get( $id=-1 )
146 {
147 $db =& eZDB::globalDatabase();
148
149 $ret = false;
150 if ( $id != "" )
151 {
152 $query = "SELECT * FROM eZUser_Module WHERE ID='$id'";
153 $db->array_query( $module_array, $query );
154
155 if ( count( $module_array ) > 1 )
156 {
157 die( "Error: Module's with the same ID was found in the database. This shouldent happen." );
158 }
159 else if( count( $module_array ) == 1 )
160 {
161 $this->ID = $module_array[0][$db->fieldName("ID")];
162 $this->Name = $module_array[0][$db->fieldName("Name")];
163 $ret = true;
164 }
165 }
166
167 return $ret;
168 }
169
173 function getAll( $returnOnlyActive=false)
174 {
175 $db =& eZDB::globalDatabase();
176
177 $return_array = array();
178 $module_array = array();
179
180 if ( $returnOnlyActive == true )
181 {
182 $modules = array();
183 $ini = eZINI::instance( 'site.ini' );
184 $moduleList = explode( ';', $ini->variable( "site", "EnabledModules" ) );
185
186 foreach ( $moduleList as $mod)
187 {
188 $modules[] = "'" . $db->escapeString( $mod ) . "'";
189 }
190
191 $allModules = join(',', $modules);
192 $query = "SELECT ID,Name FROM eZUser_Module WHERE Name IN ($allModules) ORDER BY Name";
193
194 $db->array_query( $module_array, $query );
195 }
196 else
197 {
198 $db->array_query( $module_array, "SELECT ID,Name FROM eZUser_Module ORDER By Name" );
199
200 }
201 for ( $i=0; $i<count ( $module_array ); $i++ )
202 {
203 $return_array[$i] = new eZModule( (int) $module_array[$i][$db->fieldName("ID")], 0 );
204 }
205
206 return $return_array;
207 }
208
214 function exists( $name )
215 {
216 $db =& eZDB::globalDatabase();
217
218 $ret = false;
219
220 $db->array_query( $user_array, "SELECT * FROM eZUser_Module
221 WHERE Name='$name'" );
222
223 if ( count( $user_array ) == 1 )
224 {
225 $ret = new eZModule( $user_array[0][$db->fieldName("ID")] );
226 }
227
228 return $ret;
229 }
230
234 function id()
235 {
236 return $this->ID;
237 }
238
242 function name()
243 {
244 return $this->Name;
245
246 }
247
251 function setName( $value )
252 {
253 $this->Name = $value;
254 }
255
256 var $ID;
257 var $Name;
258 static $useExceptions;
259 }
260
261 ?>
$i
$i
Definition: admin/adlist.php:91
$moduleList
foreach( $pathArray as $path) $moduleList
Definition: admin/buglist.php:87
$modules
foreach( $categories as $category) $modules
Definition: bugedit.php:496
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZModule
Definition: ezmodule.php:54
eZModule\id
id()
Definition: ezmodule.php:234
eZModule\getAll
getAll( $returnOnlyActive=false)
Definition: ezmodule.php:173
eZModule\$Name
$Name
Definition: ezmodule.php:257
eZModule\store
store()
Definition: ezmodule.php:75
eZModule\$ID
$ID
Definition: ezmodule.php:256
eZModule\$useExceptions
static $useExceptions
Definition: ezmodule.php:258
eZModule\__construct
__construct( $id="")
Definition: ezmodule.php:61
eZModule\setName
setName( $value)
Definition: ezmodule.php:251
eZModule\exists
exists( $name)
Definition: ezmodule.php:214
eZModule\name
name()
Definition: ezmodule.php:242
$ini
$ini
Definition: classes/admin/linklist.php:64
$name
$name
Definition: companytypelist.php:194
$id
$id
Definition: companytypelist.php:193
$query
if(isset( $Year) &&!is_numeric( $Year)||isset( $Month) &&!is_numeric( $Month)) $query
Definition: entryexitpages.php:65
$db
$db
Definition: ezarticle/user/authorlist.php:53
$user_array
while( $tmpTime->isGreater( $stopTime)) $user_array
Definition: ezcalendar/user/dayview.php:495
$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+.