\*=====================================================================*/
/**
-* Printer Table Element (PrinterElementTable.php)
-*
-* @package ISSO
-*/
+ * Printer Table Element (PrinterElementTable.php)
+ *
+ * @package ISSO
+ */
require_once(ISSO . '/PrinterRootTable.php');
require_once(ISSO . '/PrinterElement.php');
/**
-* Printer Table Element
-*
-* This represents a table row that holds elements.
-*
-* @author Blue Static
-* @copyright Copyright (c)2005 - 2008, Blue Static
-* @package ISSO
-*
-*/
+ * Printer Table Element
+ *
+ * This represents a table row that holds elements.
+ *
+ * @author Blue Static
+ * @copyright Copyright (c)2005 - 2008, Blue Static
+ * @package ISSO
+ *
+ */
class BSPrinterElementTable extends BSPrinterAbstract
{
/**
- * Array of child nodes
- * @var array
- */
+ * Array of child nodes
+ * @var array
+ */
private $children = array();
/**
- * Number of columns to span
- * @var integer
- */
+ * Number of columns to span
+ * @var integer
+ */
private $colspan = 0;
- // ###################################################################
/**
- * Creates a table element; takes a variable number of arguments which
- * are added as children in the order passed
- *
- * @param BSPrinterElementTable... Variable number (or no) children
- */
+ * Creates a table element; takes a variable number of arguments which
+ * are added as children in the order passed
+ *
+ * @param BSPrinterElementTable... Variable number (or no) children
+ */
public function __construct()
{
$childs = func_get_args();
return $obj->newInstanceArgs($args);
}
- // ###################################################################
/**
- * Prints a simple row of text and text
- *
- * @param string Label (left side)
- * @param string Value (right side)
- *
- * @return BSPrinterElementTable Table row element
- */
+ * Prints a simple row of text and text
+ *
+ * @param string Label (left side)
+ * @param string Value (right side)
+ *
+ * @return BSPrinterElementTable Table row element
+ */
public static function row_label($label, $value)
{
$tr = new BSPrinterElementTable();
return $tr;
}
- // ###################################################################
/**
- * Creates an input[text/password] field row
- *
- * @param string Label
- * @param string Field name
- * @param mixed Default value
- * @param bool A password field?
- *
- * @return BPrinterElementTable Table row element
- */
+ * Creates an input[text/password] field row
+ *
+ * @param string Label
+ * @param string Field name
+ * @param mixed Default value
+ * @param bool A password field?
+ *
+ * @return BPrinterElementTable Table row element
+ */
public static function row_text($label, $name, $value = null, $password = false)
{
$tr = new BSPrinterElementTable();
return $tr;
}
- // ###################################################################
/**
- * Creates a submit row
- *
- * @param array Child elements to add before the buttons
- * @param string Save button text
- * @param string Reset button text
- *
- * @return BSPrinterElementTable Table row element
- */
+ * Creates a submit row
+ *
+ * @param array Child elements to add before the buttons
+ * @param string Save button text
+ * @param string Reset button text
+ *
+ * @return BSPrinterElementTable Table row element
+ */
public static function row_submit(Array $children = null, $save = ':submit:', $reset = ':reset:')
{
$build = '';
return $tr;
}
- // ###################################################################
/**
- * Constructs a <select> row from an array of BSPrinterElement's
- *
- * @param string Label
- * @param string Name
- * @param array Array of BSPrinterElement[option]'s
- *
- * @return BSPrinterElementTable Table row
- */
+ * Constructs a <select> row from an array of BSPrinterElement's
+ *
+ * @param string Label
+ * @param string Name
+ * @param array Array of BSPrinterElement[option]'s
+ *
+ * @return BSPrinterElementTable Table row
+ */
public static function row_list($label, $name, Array $options)
{
$build = '';
return $tr;
}
- // ###################################################################
/**
- * Constructs a row from an array of BSPrinterElement's of checkboxes
- *
- * @param string Label
- * @param string Name
- * @param array Array of BSPrinterElement[checkbox]'s that follow array(box label => BSPrinterElement)
- *
- * @return BSPrinterElementTable Table row
- */
+ * Constructs a row from an array of BSPrinterElement's of checkboxes
+ *
+ * @param string Label
+ * @param string Name
+ * @param array Array of BSPrinterElement[checkbox]'s that follow array(box label => BSPrinterElement)
+ *
+ * @return BSPrinterElementTable Table row
+ */
public static function row_checkbox($label, $name, Array $boxes)
{
$build = '';
return $tr;
}
- // ###################################################################
/**
- * Factory method to create an upload form element; requires that the
- * form this is attached to have the upload flag set
- *
- * @param string Label for the element
- * @param string Name of the <input>
- *
- * @return BSPrinterElementTable Upload form
- */
+ * Factory method to create an upload form element; requires that the
+ * form this is attached to have the upload flag set
+ *
+ * @param string Label for the element
+ * @param string Name of the <input>
+ *
+ * @return BSPrinterElementTable Upload form
+ */
public static function row_upload($label, $name)
{
$tr = new BSPrinterElementTable();
return $tr;
}
- // ###################################################################
/**
- * Creates a row with a radio select option for yes/no
- *
- * @param string Row label
- * @param string Name of the radio buttons
- * @param bool Yes is selected? (if false, No is selected)
- *
- * @return BSPrinterElementTable Yes-No row
- */
+ * Creates a row with a radio select option for yes/no
+ *
+ * @param string Row label
+ * @param string Name of the radio buttons
+ * @param bool Yes is selected? (if false, No is selected)
+ *
+ * @return BSPrinterElementTable Yes-No row
+ */
public static function row_yes_no($label, $name, $yes)
{
$elm = new BSPrinterElement('radio', $name, 1);
return $tr;
}
- // ###################################################################
/**
- * Prints a row with a textarea
- *
- * @param string Label
- * @param string Textarea name
- * @param string Value to fill with
- *
- * @return BSPrinterElementTable Table row
- */
+ * Prints a row with a textarea
+ *
+ * @param string Label
+ * @param string Textarea name
+ * @param string Value to fill with
+ *
+ * @return BSPrinterElementTable Table row
+ */
public static function row_textarea($label, $name, $value = null)
{
$tr = new BSPrinterElementTable();
return $tr;
}
- // ###################################################################
/**
- * Returns the number of columns in this element
- *
- * @return integer Column count
- */
+ * Returns the number of columns in this element
+ *
+ * @return integer Column count
+ */
public function numberOfColumns()
{
return sizeof($this->children);
}
- // ###################################################################
/**
- * Adds a child node to the element
- *
- * @param BSPrinterAbstract A child element
- *
- * @return fluent interface
- */
+ * Adds a child node to the element
+ *
+ * @param BSPrinterAbstract A child element
+ *
+ * @return fluent interface
+ */
public function addChild(BSPrinterAbstract $child)
{
$this->children[] = $child;
return $this;
}
- // ###################################################################
/**
- * Sets the number of columns this row should have and pads the <td>
- * elements accordingly
- *
- * @param integer Column count
- *
- * @return fluent interface
- */
+ * Sets the number of columns this row should have and pads the <td>
+ * elements accordingly
+ *
+ * @param integer Column count
+ *
+ * @return fluent interface
+ */
public function setColumnNumber($cols)
{
if ($cols < $this->numberOfColumns())
return $this;
}
- // ###################################################################
/**
- * Returns the HTML for all printed children elements
- *
- * @return string Printed HTML
- */
+ * Returns the HTML for all printed children elements
+ *
+ * @return string Printed HTML
+ */
protected function _paintChildren()
{
$builder = '';
return $builder;
}
- // ###################################################################
/**
- * Paints the entire table row
- *
- * @return string Table row HTML
- */
+ * Paints the entire table row
+ *
+ * @return string Table row HTML
+ */
public function paint()
{
return "\t<tr" . $this->_prepareStyle() . ">" . $this->_paintChildren() . "\n\t</tr>";