00001 <?php
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 require_once FASTFRAME_ROOT . 'lib/FastFrame/Model.php';
00026
00027
00028
00029
00042
00043 class FF_Model_Vendor extends FF_Model {
00044
00045
00050 var $name;
00051
00056 var $address;
00057
00062 var $city;
00063
00068 var $state;
00069
00074 var $zipCode;
00075
00080 var $contactName;
00081
00086 var $contactNumber;
00087
00092 var $contactEmail;
00093
00094
00095
00096
00103 function reset()
00104 {
00105 $this->id = null;
00106 $this->name = null;
00107 $this->address = null;
00108 $this->city = null;
00109 $this->state = null;
00110 $this->zipCode = null;
00111 $this->contactName = null;
00112 $this->contactNumber = null;
00113 $this->contactEmail = null;
00114 }
00115
00116
00117
00118
00127 function importFromArray($in_data)
00128 {
00129 $this->setId($in_data['id']);
00130 $this->setName($in_data['name']);
00131 $this->setAddress($in_data['address']);
00132 $this->setCity($in_data['city']);
00133 $this->setState($in_data['state']);
00134 $this->setZipCode($in_data['zipcode']);
00135 $this->setContactName($in_data['contact_name']);
00136 $this->setContactNumber($in_data['contact_number']);
00137 $this->setContactEmail($in_data['contact_email']);
00138 }
00139
00140
00141
00142
00151 function exportToArray()
00152 {
00153 $a_data = array();
00154 $a_data['id'] = $this->getId();
00155 $a_data['name'] = $this->getName();
00156 $a_data['address'] = $this->getAddress();
00157 $a_data['city'] = $this->getCity();
00158 $a_data['state'] = $this->getState();
00159 $a_data['zipcode'] = $this->getZipCode();
00160 $a_data['contact_name'] = $this->getContactName();
00161 $a_data['contact_number'] = $this->getContactNumber();
00162 $a_data['contact_email'] = $this->getContactEmail();
00163 return $a_data;
00164 }
00165
00166
00167
00168
00177 function getLogEntryDescription($in_id)
00178 {
00179 if ($this->fillById($in_id)) {
00180 return $this->name;
00181 }
00182 else {
00183 return false;
00184 }
00185 }
00186
00187
00188
00189
00190 function getName()
00191 {
00192 return $this->name;
00193 }
00194
00195
00196
00197
00198 function setName($in_value)
00199 {
00200 $this->name = $in_value;
00201 }
00202
00203
00204
00205
00206 function getAddress()
00207 {
00208 return $this->address;
00209 }
00210
00211
00212
00213
00214 function setAddress($in_value)
00215 {
00216 $this->address = $in_value;
00217 }
00218
00219
00220
00221
00222 function getCity()
00223 {
00224 return $this->city;
00225 }
00226
00227
00228
00229
00230 function setCity($in_value)
00231 {
00232 $this->city = $in_value;
00233 }
00234
00235
00236
00237
00238 function getState()
00239 {
00240 return $this->state;
00241 }
00242
00243
00244
00245
00246 function setState($in_value)
00247 {
00248 $this->state = $in_value;
00249 }
00250
00251
00252
00253
00254 function getZipCode()
00255 {
00256 return $this->zipCode;
00257 }
00258
00259
00260
00261
00262 function setZipCode($in_value)
00263 {
00264 $this->zipCode = $in_value;
00265 }
00266
00267
00268
00269
00270 function getContactName()
00271 {
00272 return $this->contactName;
00273 }
00274
00275
00276
00277
00278 function setContactName($in_value)
00279 {
00280 $this->contactName = $in_value;
00281 }
00282
00283
00284
00285
00292 function getFormattedContactNumber()
00293 {
00294 if (strlen($this->contactNumber) == 10) {
00295 return preg_replace('/(\d{3})(\d{3})(\d{4})/', '(\\1) \\2-\\3', $this->contactNumber);
00296 }
00297 else {
00298 return preg_replace('/(\d{3})(\d{4})/', '\\1-\\2', $this->contactNumber);
00299 }
00300 }
00301
00302
00303
00304
00305 function getContactNumber()
00306 {
00307 return $this->contactNumber;
00308 }
00309
00310
00311
00312
00313 function setContactNumber($in_value)
00314 {
00315 $in_value = preg_replace('/[[:punct:][:space:]]/', '', $in_value);
00316 $this->contactNumber = $in_value;
00317 }
00318
00319
00320
00321
00322 function getContactEmail()
00323 {
00324 return $this->contactEmail;
00325 }
00326
00327
00328
00329
00330 function setContactEmail($in_value)
00331 {
00332 $this->contactEmail = $in_value;
00333 }
00334
00335
00336
00337
00344 function _initDataAccess()
00345 {
00346 $this->o_dataAccess =& FF_DataAccess::factory('Vendor');
00347 }
00348
00349
00350 }
00351 ?>