Extending MidgardPerson

Alpha Version of MidgardPerson WrapperClass.

This is a preliminary version of the CPerson Wrapper class. It is not complete yet, since it isn't synchronized with the latest changes from the CArticle Development cycle. The class is currently awaiting code cleanup; missing features:

Code

<?php
class CPerson extends MidgardPerson {

  function
CPerson ($id = -1) {

    if (
$id != -1) {
      
$user = mgd_get_person ($id);

      if (!
$user) {
        
$this = false;
        return
false;
      }
    } else {
      
$user = mgd_get_person();
    }

    
// Copy the Data from the Person object to the new class
    
$this->_copyPersonData($user);
  }

  function
_copyPersonData ($user) {
    
$this->__table__ = $user->__table__;
    
$this->id = $user->id;
    
$this->username = $user->username;
    
$this->password = $user->password;
    
$this->department = $user->department;
    
$this->sitegroup = $user->sitegroup;
    
$this->firstname = $user->firstname;
    
$this->lastname = $user->lastname;
    
$this->street = $user->street;
    
$this->postcode = $user->postcode;
    
$this->city = $user->city;
    
$this->homephone = $user->homephone;
    
$this->workphone = $user->workphone;
    
$this->handphone = $user->handphone;
    
$this->email = $user->email;
    
$this->homepage = $user->homepage;
    
$this->extra = $user->extra;
    
$this->pgpkey = $user->pgpkey;
    
$this->img = $user->img;
    
$this->birthdate = $user->birthdate;
    
$this->topic = $user->topic;
    
$this->office = $user->office;
  }

  function
create() {
    
$newid = MidgardPerson::create();
    
$newperson = mgd_get_person ($newid);
    
$this->_copyPersonData($newperson);
  }

  function
delete() {
    
$list = $this->listparameters();
    while(
$list->fetch()) {
      
$list2 = $this->listparameters($list->domain);
      while(
$list2->fetch())
        
$this->parameter($list->domain, $list2->name, "");
    }
    
    return
MidgardPerson::delete();
  }
}
?>