Extending MidgardGroup

Wrapper Class for MidgardGroup

This is a preliminary version of the CGroup Wrapper class. It is not complete yet, since it isn't synchronized with the latest changes from the CArticle Development cycle. The class currently does not support the Attachment support functins.

Code

<?php

class CGroup extends MidgardGroup {

    function
CGroup ($id = -1) {
        if (
$id != -1) {
            
$group = mgd_get_group($id);

            if (!
$group) {
                
$this = false;
                return
false;
            }
        } else {
            
$group = mgd_get_group();
        }

        
// Copy the Data from the MidgardGroup object to the new class instance
        
$this->_copyGroupData($group);
    }

    function
_copyGroupData ($group) {
        
$this->__table__ = $group->__table__;
        
$this->id = $group->id;
        
$this->name = $group->name;
        
$this->official = $group->official;
        
$this->sitegroup = $group->sitegroup;
        
$this->street = $group->street;
        
$this->postcode = $group->postcode;
        
$this->city = $group->city;
        
$this->address = $group->address;
        
$this->email = $group->email;
        
$this->homepage = $group->homepage;
        
$this->emaillink = $group->emaillink;
        
$this->homepagelink = $group->homepagelink;
        
$this->extra = $group->extra;
        
$this->owner = $group->owner;
    }

    function
create() {
        
$newid = MidgardGroup::create();
        
$newGroup = mgd_get_group($newid);
        
$this->_copyGroupData($newGroup);
    }

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

?>