Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezphone.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezphone.php 6204 2001-07-19 12:06:56Z jakobn $
5 //
6 // Definition of eZAddressType class
7 //
8 // Created on: <26-Jun-2001 13:40:19 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 // include_once( "classes/ezdb.php" );
36 // include_once( "ezaddress/classes/ezphonetype.php" );
37
38 class eZPhone
39 {
40 /*
41
42 */
43 function __construct( $id = "" )
44 {
45 if ( !empty( $id ) )
46 {
47 $this->ID = $id;
48 $this->get( $this->ID );
49 }
50 }
51
52 /*
53 Lagrer et telefonnummer link i databasen.
54 */
55 function store()
56 {
57 $db =& eZDB::globalDatabase();
58 $db->begin();
59
60 $ret = false;
61 if ( !isset( $this->ID ) )
62 {
63 $db->lock( "eZAddress_Phone" );
64 $this->ID = $db->nextID( "eZAddress_Phone", "ID" );
65 $res[] = $db->query( "INSERT INTO eZAddress_Phone
66 (ID, Number, PhoneTypeID)
67 VALUES
68 ('$this->ID',
69 '$this->Number',
70 '$this->PhoneTypeID')" );
71 $db->unlock();
72 $ret = true;
73 }
74 else
75 {
76 $res[] = $db->query( "UPDATE eZAddress_Phone set Number='$this->Number', PhoneTypeID='$this->PhoneTypeID' WHERE ID='$this->ID' " );
77
78 $ret = true;
79 }
80 eZDB::finish( $res, $db );
81 return $ret;
82 }
83
84 /*
85 Sletter.
86 */
87 function delete( $id = false )
88 {
89 if ( !$id )
90 $id = $this->ID;
91 $db =& eZDB::globalDatabase();
92 $res[] = $db->query( "DELETE FROM eZAddress_Phone WHERE ID='$id' " );
93 eZDB::finish( $res, $db );
94 }
95
96 /*
97 Henter ut telefonnummer med ID == $id
98 */
99 function get( $id )
100 {
101 $db =& eZDB::globalDatabase();
102 if ( $id != "" )
103 {
104 $db->array_query( $phone_array, "SELECT * FROM eZAddress_Phone WHERE ID='$id'" );
105 if ( count( $phone_array ) > 1 )
106 {
107 die( "Feil: Flere telefonnummer med samme ID funnet i database, dette skal ikke v�re mulig. " );
108 }
109 else if ( count( $phone_array ) == 1 )
110 {
111 $this->ID = $phone_array[ 0 ][ $db->fieldName( "ID" ) ];
112 $this->Number = $phone_array[ 0 ][ $db->fieldName( "Number" ) ];
113 $this->PhoneTypeID = $phone_array[ 0 ][ $db->fieldName( "PhoneTypeID" ) ];
114 }
115 }
116 }
117
118 function setNumber( $value )
119 {
120 $this->Number = $value;
121 }
122
123 function setPhoneTypeID( $value )
124 {
125 if( is_numeric( $value ) )
126 {
127 $this->PhoneTypeID = $value;
128 }
129
130 if( is_a( $value, "eZPhoneType" ) )
131 {
132 $this->PhoneTypeID = $value->id();
133 }
134 }
135
136 function setPhoneType( $value )
137 {
138 if( is_numeric( $value ) )
139 {
140 $this->PhoneTypeID = $value;
141 }
142
143 if( is_a( $value, "eZPhoneType" ) )
144 {
145 $this->PhoneTypeID = $value->id();
146 }
147 }
148
149 function setID( $value )
150 {
151 $this->ID = $value;
152 }
153
154 function number( )
155 {
156 return $this->Number;
157 }
158
159 function phoneTypeID( )
160 {
161 return $this->PhoneTypeID;
162 }
163
164 function phoneType( )
165 {
166 $phoneType = new eZPhoneType( $this->PhoneTypeID );
167 return $phoneType;
168 }
169
170 function id( )
171 {
172 return $this->ID;
173 }
174
175 var $ID;
176 var $Number;
177 var $PhoneTypeID;
178 }
179
180 ?>
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZPhoneType
Definition: ezphonetype.php:46
eZPhone
Definition: ezphone.php:39
eZPhone\number
number()
Definition: ezphone.php:154
eZPhone\phoneTypeID
phoneTypeID()
Definition: ezphone.php:159
eZPhone\store
store()
Definition: ezphone.php:55
eZPhone\setNumber
setNumber( $value)
Definition: ezphone.php:118
eZPhone\phoneType
phoneType()
Definition: ezphone.php:164
eZPhone\__construct
__construct( $id="")
Definition: ezphone.php:43
eZPhone\$ID
$ID
Definition: ezphone.php:175
eZPhone\setID
setID( $value)
Definition: ezphone.php:149
eZPhone\$PhoneTypeID
$PhoneTypeID
Definition: ezphone.php:177
eZPhone\id
id()
Definition: ezphone.php:170
eZPhone\setPhoneType
setPhoneType( $value)
Definition: ezphone.php:136
eZPhone\$Number
$Number
Definition: ezphone.php:176
eZPhone\setPhoneTypeID
setPhoneTypeID( $value)
Definition: ezphone.php:123
$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
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.