00001 <?
00002 abstract class MComponent
00003 {
00004 var $manager;
00005 var $page;
00006 var $owner;
00007 var $components;
00008 var $componentCount;
00009 var $name;
00010 var $className;
00011
00012 function __construct($name = NULL)
00013 {
00014 global $MIOLO;
00015
00016 $this->manager = $MIOLO;
00017 $this->page = $this->manager->page;
00018 $this->className = strtolower(get_class($this));
00019 $this->name = $name;
00020 $this->owner = $this;
00021 $this->components = array();
00022 $this->componentCount = 0;
00023 }
00024
00025 function SetName($name)
00026 {
00027 $this->name = $name;
00028 }
00029
00030 function GetName()
00031 {
00032 return $this->name;
00033 }
00034
00035 private function Add($component, $pos)
00036 {
00037 $this->components[$pos] = $component;
00038 $component->owner = $this;
00039 $this->componentCount++;
00040 }
00041
00042 function AddComponent($component)
00043 {
00044 $this->Add($component, $this->componentCount);
00045 }
00046
00047 function InsertComponent($component, $pos = 0)
00048 {
00049 if ($pos < $this->componentCount)
00050 {
00051 for ($i = $this->componentCount; $i >= $pos; $i--)
00052 $this->components[$i + 1] = $this->components[$i];
00053 }
00054 else
00055 {
00056 $pos = $this->componentCount + 1;
00057 }
00058
00059 $this->Add($component, $pos);
00060 }
00061
00062 function SetComponent($component, $pos)
00063 {
00064 if ($pos < $this->componentCount)
00065 {
00066 $this->component[$pos] = $component;
00067 $component->owner = self;
00068 }
00069 }
00070
00071 function SetComponents($components)
00072 {
00073 $this->components = $components;
00074 }
00075
00076 function GetComponents()
00077 {
00078 return $this->components;
00079 }
00080
00081 function GetComponent($pos)
00082 {
00083 return $this->components[$pos];
00084 }
00085
00086 function ClearComponents()
00087 {
00088 $this->components = array
00089 (
00090 );
00091
00092 $this->componentCount = 0;
00093 }
00094 }
00095 ?>