<?php
/*-------1---------2---------3---------4---------5---------6---------7---------8---*/
// +----------------------------------------------------------------------+
// | PHP version 4, 5 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The YHA (Yono Hendro Arie) Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | hide@address.com so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Symbio Form Maker extended Class |
// | Generate a HTML form and layout it into table |
// +----------------------------------------------------------------------+
// | Authors: Arie Nugraha <hide@address.com> |
// +----------------------------------------------------------------------+
//
// $Id$
require_once 'GUI_form_maker.inc.php';
class GUI_form_table extends GUI_form_maker{
var $form_table_attr = "cellpadding='5' border='1'";
var $header_cell_attr = "valign='top' bgcolor='#CCCCCC'";
var $element_cell_attr = "valign='top' bgcolor='#FFFFFF'";
# class constructor
function GUI_form_table()
{
GUI_form_maker::GUI_form_maker();
}
# method to set form element header cell attribute
function setFormTableAttr($str_attr)
{
$this->form_table_attr = $str_attr;
}
# method to set form element header cell attribute
function setHeaderCellAttr($str_attr)
{
$this->header_cell_attr = $str_attr;
}
# method to set form element cell attribute
function setElementCellAttr($str_attr)
{
$this->element_cell_attr = $str_attr;
}
# final method to print out the form table
function printOut()
{
$printOut = "<table ".$this->form_table_attr .">\n";
$printOut .= "<form name='".$this->form_name."' "
."method='".$this->form_method."' "
."action='".$this->form_action."'>";
foreach ($this->elements as $row) {
$printOut .= "<tr>\n";
$printOut .= "<td width='25%' ".$this->header_cell_attr.">";
$printOut .= $row['label']."</td>\n";
$printOut .= "<td width='1%' ".$this->header_cell_attr.">:</td>\n";
$printOut .= "<td width='74%' ".$this->element_cell_attr.">";
$printOut .= $row['element']."</td>\n";
$printOut .= "</tr>\n";
}
$printOut .= "<tr>\n";
$printOut .= "<td colspan='2' ".$this->header_cell_attr."> </td>\n";
$printOut .= "<td>\n";
// extract all hidden elements here
foreach ($this->hidden_elements as $hidden) {
$printOut .= $hidden;
}
$printOut .= "<input type='submit' value='Save Data'> ";
$printOut .= "<input type='reset'> \n";
$printOut .= "</td>\n";
$printOut .= "</tr>\n";
$printOut .= "</form>\n";
$printOut .= "</table>\n";
return $printOut;
}
}
# End of GUI_form_table class declaration
?>