formatting

This commit is contained in:
Miles Lott 2001-09-23 19:05:56 +00:00
parent 46f9c75630
commit e436c522c1
2 changed files with 94 additions and 89 deletions

View File

@ -24,65 +24,66 @@
/* $Id$ */
/* $Id$ */
CreateObject('phpgwapi.portalbox');
CreateObject('phpgwapi.portalbox');
class linkbox extends portalbox
{
/*
Set up the Object. You will notice, we have not reserved
memory space for variables. In this circumstance it is not necessary.
*/
class linkbox extends portalbox {
/*
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($param)
{
$title = $param[0];
$primary = $param[1];
$secondary =$param[2];
$tertiary = $param[3];
$this->portalbox($title, $primary, $secondary, $tertiary);
$this->setvar("outerwidth",300);
$this->setvar("innerwidth",300);
$this->setvar("width",300);
}
/*
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($param) {
$title = $param[0];
$primary = $param[1];
$secondary =$param[2];
$tertiary = $param[3];
$this->portalbox($title, $primary, $secondary, $tertiary);
$this->setvar("outerwidth",300);
$this->setvar("innerwidth",300);
$this->setvar("width",300);
}
/*
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;
/*
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()
{
$p = new Template($GLOBALS['phpgw']->common->get_tpl_dir('home'));
$p->set_file(array('portal_main' => 'portal_main.tpl',
'portal_linkbox_header' => 'portal_linkbox_header.tpl',
'portal_linkbox' => 'portal_linkbox.tpl',
'portal_linkbox_footer' => 'portal_linkbox_footer.tpl'));
$p->set_block('portal_main','portal_linkbox_header','portal_linkbox','portal_linkbox_footer');
$p = new Template($phpgw->common->get_tpl_dir('home'));
$p->set_file(array('portal_main' => 'portal_main.tpl',
'portal_linkbox_header' => 'portal_linkbox_header.tpl',
'portal_linkbox' => 'portal_linkbox.tpl',
'portal_linkbox_footer' => 'portal_linkbox_footer.tpl'));
$p->set_block('portal_main','portal_linkbox_header','portal_linkbox','portal_linkbox_footer');
$p->set_var('outer_border',$this->getvar('outerborderwidth'));
$p->set_var('outer_width',$this->getvar('width'));
$p->set_var('outer_bordercolor',$this->getvar('outerbordercolor'));
$p->set_var('outer_bgcolor',$this->getvar('titlebgcolor'));
$p->set_var('title',$this->getvar('title'));
$p->set_var('inner_width',$this->getvar('width'));
$p->set_var('inner_bgcolor',$this->getvar('innerbgcolor'));
$p->set_var('header_background_image',$this->getvar('header_background_image'));
$p->parse('output','portal_linkbox_header',True);
$p->set_var('outer_border',$this->getvar('outerborderwidth'));
$p->set_var('outer_width',$this->getvar('width'));
$p->set_var('outer_bordercolor',$this->getvar('outerbordercolor'));
$p->set_var('outer_bgcolor',$this->getvar('titlebgcolor'));
$p->set_var('title',$this->getvar('title'));
$p->set_var('inner_width',$this->getvar('width'));
$p->set_var('inner_bgcolor',$this->getvar('innerbgcolor'));
$p->set_var('header_background_image',$this->getvar('header_background_image'));
$p->parse('output','portal_linkbox_header',True);
for ($x = 0; $x < count($this->data); $x++) {
$p->set_var('link',$this->data[$x][1]);
$p->set_var('text',$this->data[$x][0]);
$p->parse('output','portal_linkbox',True);
}
$p->parse('output','portal_linkbox_footer',True);
return $p->parse('out','portal_main');
}
}
for ($x = 0; $x < count($this->data); $x++)
{
$p->set_var('link',$this->data[$x][1]);
$p->set_var('text',$this->data[$x][0]);
$p->parse('output','portal_linkbox',True);
}
$p->parse('output','portal_linkbox_footer',True);
return $p->parse('out','portal_main');
}
}

View File

@ -24,37 +24,41 @@
/* $Id$ */
CreateObject('phpgwapi.portalbox');
CreateObject('phpgwapi.portalbox');
class resultbox extends portalbox {
/*
Set up the Object. You will notice, we have not reserved memory
space for variables. In this circumstance it is not necessary.
*/
class resultbox extends portalbox
{
/*
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->portalbox($title, $primary, $secondary, $tertiary);
$this->setvar("outerwidth",400);
$this->setvar("innerwidth",400);
}
//constructor
function resultbox($title="", $primary="", $secondary="", $tertiary="") {
$this->portalbox($title, $primary, $secondary, $tertiary);
$this->setvar("outerwidth",400);
$this->setvar("innerwidth",400);
}
/*
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 '<table border="'.$this->getvar("outerborderwidth").'" cellpadding="0" cellspacing="0" width="'.$this->getvar("outerwidth").'" bordercolor="'.$this->getvar("outerbordercolor").'" bgcolor="'.$this->getvar("titlebgcolor").'">';
echo '<tr><td align="center">'.$this->getvar("title").'</td></tr>';
echo '<tr><td>';
echo '<table border="0" cellpadding="0" cellspacing="0" width="'.$this->getvar("innerwidth").'" bgcolor="'.$this->getvar("innerbgcolor").'">';
for ($x = 0; $x < count($this->data); $x++) {
echo '<tr>';
echo '<td width="50%">'.$this->data[$x][0].'</td>';
echo '<td width="50%">'.$this->data[$x][1].'</td>';
echo '</tr>';
}
echo '</table>';
echo '</td></tr>';
echo '</table>';
}
}
/*
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 '<table border="'.$this->getvar("outerborderwidth").'" cellpadding="0" cellspacing="0" width="'.$this->getvar("outerwidth").'" bordercolor="'.$this->getvar("outerbordercolor").'" bgcolor="'.$this->getvar("titlebgcolor").'">';
echo '<tr><td align="center">'.$this->getvar("title").'</td></tr>';
echo '<tr><td>';
echo '<table border="0" cellpadding="0" cellspacing="0" width="'.$this->getvar("innerwidth").'" bgcolor="'.$this->getvar("innerbgcolor").'">';
for ($x = 0; $x < count($this->data); $x++)
{
echo '<tr>';
echo '<td width="50%">'.$this->data[$x][0].'</td>';
echo '<td width="50%">'.$this->data[$x][1].'</td>';
echo '</tr>';
}
echo '</table>';
echo '</td></tr>';
echo '</table>';
}
}