From a8062d13dba65c5ab5e56e54cc41649d4aecbd09 Mon Sep 17 00:00:00 2001 From: skeeter Date: Sun, 7 Jan 2001 04:02:06 +0000 Subject: [PATCH] new utility - will put into template --- .../inc/phpgw_utilities_portalbox.inc.php | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100755 phpgwapi/inc/phpgw_utilities_portalbox.inc.php diff --git a/phpgwapi/inc/phpgw_utilities_portalbox.inc.php b/phpgwapi/inc/phpgw_utilities_portalbox.inc.php new file mode 100755 index 0000000000..5ccfaf7646 --- /dev/null +++ b/phpgwapi/inc/phpgw_utilities_portalbox.inc.php @@ -0,0 +1,128 @@ +$var = $value; +// echo $var." = ".$this->$var."
\n"; + } + + function getvar($var="") { + if ($var=="" || !isset($this->$var)) { + global $phpgw; + echo 'Programming Error: '.$this->classname().'->getvar('.$var.')!
\n'; + $phpgw->common->phpgw_exit(); + } +//echo "Var = ".$var."
\n"; +//echo $var." = ".$this->$var."
\n"; + return $this->$var; + } + + /* + This is the constructor for the object. + */ + function baseportalbox($title="", $primary="", $secondary="", $tertiary="") { + $this->setvar("title",$title); +// echo "After SetVar Title = ".$this->getvar("title")."
\n"; + $this->setvar("outerwidth",220); + $this->setvar("innerwidth",220); + $this->setvar("outerborderwidth",1); + $this->setvar("titlebgcolor",$primary); + $this->setvar("innerbgcolor",$secondary); + $this->setvar("outerbordercolor",$tertiary); + } + // Methods +} + +class linkbox extends baseportalbox { + /* + Set up the Object. You will notice, we have not reserved + memory space for variables. In this circumstance it is not necessary. + */ + + /* + This is the constructor for the linkbox. The only thing this does + is to call the constructor of the parent class. Why? Well, whilst + PHP manages a certain part of OO, one of the bits it falls down on + (at the moment) is constructors within sub-classes. So, to + be sure that the sub-class is instantiated with the constructor of + the parent class, I simply call the parent constructor. Of course, + if I then wanted to override any of the values, I could easily do so. + */ + function linkbox($title="", $primary="", $secondary="", $tertiary="") { + $this->baseportalbox($title, $primary, $secondary, $tertiary); + } + /* + This is the only method within the class. Quite simply, as you can see + it draws the table(s), placing the required data in the appropriate place. + */ + function draw() { + global $phpgw, $phpgw_info; + + echo ''; + echo ''; + echo ''; + echo '
'.$this->getvar("title").'
'; + echo ''; + echo ''; + echo '
'; + echo '
'; + } +} + +class resultbox extends baseportalbox { + /* + Set up the Object. You will notice, we have not reserved memory + space for variables. In this circumstance it is not necessary. + */ + + //constructor + function resultbox($title="", $primary="", $secondary="", $tertiary="") { + $this->baseportalbox($title, $primary, $secondary, $tertiary); + } + /* + This is the only method within the class. Quite simply, as you can see + it draws the table(s), placing the required data in the appropriate place. + */ + function draw() { + echo ''; + echo ''; + echo ''; + echo '
'.$this->getvar("title").'
'; + echo ''; + for ($x = 0; $x < count($this->data); $x++) { + echo ''; + echo ''; + echo ''; + echo ''; + } + echo '
'.$this->data[$x][0].''.$this->data[$x][1].'
'; + echo '
'; + } +} +?>