$k)) { continue; } $this->$k = explode(':', substr($this->$k,1,-1)); } $this->mayList = @implode("\n",$this->may); $this->mustList = @implode("\n",$this->must); return $r; } function setFrom($ar) { //print_R($ar); parent::setFrom($ar); if (isset($ar['mayList'])) { $this->may = ':'.implode(':',explode("\n",$ar['mayList'])) .':'; } if (isset($ar['mustList'])) { $this->must = ':'.implode(':',explode("\n",$ar['mustList'])).':'; } // print_r($this); } function toArray() { foreach(get_object_vars($this) as $k=>$v) { if ($k{0} == '_') { continue; } $ret[$k] = $v; } return $ret; } var $supObject= false; function getSup() { if (empty($this->sup)) { return; } $this->supObject = new DataObjects_ObjectClass; $this->supObject->get('cn',$this->sup); $this->supObject->getSup(); return $this->sup; } function loadSups() { $o = DB_DataObjecT::factory('objectclass'); $o->sup = $this->cn; $this->sups = array(); $o->find(); while ($o->fetch()) { $this->sups[] = clone($o); } } var $mustObjects = array(); var $mayObjects = array(); function getAttributes() { require_once 'DataObjects/Attribute.php'; if (!empty($this->must)) { asort($this->must); foreach($this->must as $m) { $this->mustObjects[$m] = new DataObjects_Attribute; $this->mustObjects[$m]->get('cn',$m); $this->mustObjects[$m]->getSup(); $this->mustObjects[$m]->getSyntax(); $this->mustObjects[$m]->getMatching(); $this->mustObjects[$m]->inheritedFrom = $this->cn; } } if (!empty($this->may)) { asort($this->may); foreach($this->may as $m) { $this->mayObjects[$m] =new DataObjects_Attribute; $this->mayObjects[$m]->get('cn',$m); $this->mayObjects[$m]->getSup(); $this->mayObjects[$m]->getSyntax(); $this->mayObjects[$m]->getMatching(); $this->mayObjects[$m]->inheritedFrom = $this->cn; } } if ($this->supObject) { $this->supObject->getAttributes(); } } var $mustInherited = array(); var $mayInherited = array(); var $allAttributes = array(); function flattenAttributes() { $this->allAttributes = array_merge($this->mustObjects,$this->mayObjects); if (empty($this->sup)) { return; } $sup = $this->supObject; while (1) { $this->mustInherited = array_merge($sup->mustObjects,$this->mustInherited); $this->mayInherited = array_merge($sup->mayObjects,$this->mayInherited); $this->allAttributes = array_merge($this->allAttributes ,$sup->mustObjects); $this->allAttributes = array_merge($this->allAttributes ,$sup->mayObjects); if (empty($sup->sup)) { ksort($this->allAttributes ); return; } $sup = $sup->supObject; } } function toBNC() { $sup = $this->sup ? "\nSUP {$this->sup}" : ''; $st = $this->structural ? "\nSTRUCTURAL" : ''; $ax = $this->auxiliary ? "\nAUXILARY" : ''; $may = $this->may[0] ? ("\nMAY ( ". implode(' $ ',$this->may) . ' )') : ''; $must = $this->must[0] ? ("\nMUST ( ". implode(' $ ',$this->must) . ' )') : ''; return "{$this->uid} NAME '{$this->cn}' {$sup} {$st} {$ax} {$may} {$must}"; } } ?>