Model/Vendor.php

Go to the documentation of this file.
00001 <?php
00003 // {{{ license
00004 
00005 // +----------------------------------------------------------------------+
00006 // | FastFrame Application Framework                                      |
00007 // +----------------------------------------------------------------------+
00008 // | Copyright (c) 2002-2006 The Codejanitor Group                        |
00009 // +----------------------------------------------------------------------+
00010 // | This source file is subject to the GNU Lesser Public License (LGPL), |
00011 // | that is bundled with this package in the file LICENSE, and is        |
00012 // | available at through the world-wide-web at                           |
00013 // | http://www.fsf.org/copyleft/lesser.html                              |
00014 // | If you did not receive a copy of the LGPL and are unable to          |
00015 // | obtain it through the world-wide-web, you can get it by writing the  |
00016 // | Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
00017 // | MA 02111-1307, USA.                                                  |
00018 // +----------------------------------------------------------------------+
00019 // | Authors: Jason Rust <jrust@codejanitor.com>                          |
00020 // +----------------------------------------------------------------------+
00021 
00022 // }}}
00023 // {{{ requires
00024 
00025 require_once FASTFRAME_ROOT . 'lib/FastFrame/Model.php';
00026 
00027 // }}}
00028 // {{{ class FF_Model_Vendor
00029 
00042 // }}}
00043 class FF_Model_Vendor extends FF_Model {
00044     // {{{ properties
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     // {{{ reset()
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     // {{{ importFromArray()
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     // {{{ exportToArray()
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     // {{{ getLogEntryDescription()
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     // {{{ getName()
00189 
00190     function getName()
00191     {
00192         return $this->name;
00193     }
00194 
00195     // }}}
00196     // {{{ setName()
00197 
00198     function setName($in_value)
00199     {
00200         $this->name = $in_value;
00201     }
00202 
00203     // }}}
00204     // {{{ getAddress()
00205 
00206     function getAddress()
00207     {
00208         return $this->address;
00209     }
00210 
00211     // }}}
00212     // {{{ setAddress()
00213 
00214     function setAddress($in_value)
00215     {
00216         $this->address = $in_value;
00217     }
00218 
00219     // }}}
00220     // {{{ getCity()
00221 
00222     function getCity()
00223     {
00224         return $this->city;
00225     }
00226 
00227     // }}}
00228     // {{{ setCity()
00229 
00230     function setCity($in_value)
00231     {
00232         $this->city = $in_value;
00233     }
00234 
00235     // }}}
00236     // {{{ getState()
00237 
00238     function getState()
00239     {
00240         return $this->state;
00241     }
00242 
00243     // }}}
00244     // {{{ setState()
00245 
00246     function setState($in_value)
00247     {
00248         $this->state = $in_value;
00249     }
00250 
00251     // }}}
00252     // {{{ getZipCode()
00253 
00254     function getZipCode()
00255     {
00256         return $this->zipCode;
00257     }
00258 
00259     // }}}
00260     // {{{ setZipCode()
00261 
00262     function setZipCode($in_value)
00263     {
00264         $this->zipCode = $in_value;
00265     }
00266 
00267     // }}}
00268     // {{{ getContactName()
00269 
00270     function getContactName()
00271     {
00272         return $this->contactName;
00273     }
00274 
00275     // }}}
00276     // {{{ setContactName()
00277 
00278     function setContactName($in_value)
00279     {
00280         $this->contactName = $in_value;
00281     }
00282 
00283     // }}}
00284     // {{{ getFormattedContactNumber()
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     // {{{ getContactNumber()
00304 
00305     function getContactNumber()
00306     {
00307         return $this->contactNumber;
00308     }
00309 
00310     // }}}
00311     // {{{ setContactNumber()
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     // {{{ getContactEmail()
00321 
00322     function getContactEmail()
00323     {
00324         return $this->contactEmail;
00325     }
00326 
00327     // }}}
00328     // {{{ setContactEmail()
00329 
00330     function setContactEmail($in_value)
00331     {
00332         $this->contactEmail = $in_value;
00333     }
00334 
00335     // }}}
00336     // {{{ _initDataAccess()
00337 
00344     function _initDataAccess()
00345     {
00346         $this->o_dataAccess =& FF_DataAccess::factory('Vendor');
00347     }
00348 
00349     // }}}
00350 }
00351 ?>

Generated on Fri Jun 23 11:38:18 2006 for FastFrame by  doxygen 1.4.4