topical media & game development

talk show tell print

professional-php-03-class.PhoneNumber.php / php



  <?php
    require_once('class.PropertyObject.php');
  
    class PhoneNumber extends PropertyObject {
     
      function __construct(phoneid) {
        arData = DataManager::getPhoneNumberData(phoneid);
  
        parent::__construct(arData);
  
        this->propertyTable['phoneid'] = 'phoneid';
        this->propertyTable['id'] = 'phoneid';
        this->propertyTable['entityid'] = 'entityid';
        this->propertyTable['number'] = 'snumber';
        this->propertyTable['extension'] = 'sextension';
        this->propertyTable['type'] = 'stype';
      }
     
      function validate() {
        if(!this->number) {
              this->errors['number'] = 'You must supply a phone number.';
        }
       
        if(sizeof(this->errors)) {
          return false;
        } else {
          return true;
        }
      }
     
      function __toString() {
        return this->number .
               (this->extension ? ' x' . this->extension : '');
      }
    }
  ?>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.