addChild(new BSPrinterLabelElement($label)); $tr->addChild(new BSPrinterLabelElement($value)); 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 BPrinterTableElement Table row element */ public static function RowText($label, $name, $value = null, $password = false) { $tr = new BSPrinterTableElement(); $tr->addChild(new BSPrinterLabelElement($label)); $tr->addChild(new BSPrinterBaseElement(($password ? 'password' : 'text'), $name, $value)); 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 BSPrinterTableElement Table row element */ public static function RowSubmit(Array $children = null, $save = ':submit:', $reset = ':reset:') { $build = ''; if (sizeof($children) > 0) { foreach ($children AS $child) { $build .= "\n\t\t\t" . $child->paint(); } } $save = ($save == ':submit:' ? _('Submit') : $save); $reset = ($reset == ':reset:' ? _('Reset') : $reset); $elm = new BSPrinterBaseElement('submit', '__submit__', " $save "); $build .= "\n\t\t\t" . $elm->paint(); $elm = new BSPrinterBaseElement('reset', '__reset__', " $reset "); $build .= "\n\t\t\t" . $elm->paint() . "\n\t\t"; $tr = new BSPrinterTableElement(); $tr->addChild(new BSPrinterLabelElement($build)); $tr->setCssClass('tfoot'); return $tr; } // ################################################################### /** * Factory method that creates a checkbox row * * @param string Label * @param string Element name * @param mixed Value * @param boolean Checked? * * @return BSPrinterTableElement A proper table element */ public static function RowCheckbox($label, $name, $value, $checked = false) { $tr = new BSPrinterTableElement(); $tr->addChild(new BSPrinterLabelElement($label)); $elm = new BSPrinterBaseElement('checkbox', $name, $value); $elm->setActive($checked); $tr->addChild($elm); 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 * * @return BSPrinterTableElement Upload form */ public static function RowUpload($label, $name) { $tr = new BSPrinterTableElement(); $tr->addChild(new BSPrinterLabelElement($label)); $tr->addChild(new BSPrinterBaseElement('upload', $name)); 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 BSPrinterTableElement Yes-No row */ public static function RowYesNo($label, $name, $yes) { $elm = new BSPrinterBaseElement('radio', $name, 1); $elm->setActive($yes); $build = $elm->paint() . ' ' . _('Yes') . ' '; $elm = new BSPrinterBaseElement('radio', $name, 0); $elm->setActive(!$yes); $build .= $elm->paint() . ' ' . _('No'); $tr = new BSPrinterTableElement(); $tr->addChild(new BSPrinterLabelElement($label)); $tr->addChild(new BSPrinterLabelElement($build)); return $tr; } // ################################################################### /** * 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 BSPrinterElement A child element */ public function addChild(BSPrinterElement $child) { $this->children[] = $child; } // ################################################################### /** * Sets the number of columns this row should have and pads the