<?php
require_once 'Piragibe/PGBPropertyBag.php';
/**
* A set of definitions for rendering fields on the screen.
*
* This is a special kind of property bag, aimed at storing properties useful for rendering.
* The possible values are:
*
* - Caption -> a caption to be rendered next to the field; this caption is rendered on a title
* row, if you're using a tabular renderer, or to the left of the value, if a form
* style renderer is being used.
* - Renderer -> name of PGBRenderer method to use when rendering a field. Can be one of the
* following:
* . hiddentext -> an HTML hidden field
* . textbox -> an ordinary, single line, HTML text box
* . textarea -> a multiline HTML text area
* . plaintext (DEFAULT) -> a readonly text
* . radiogroup -> a discrete set of radio buttons
* . checkbox -> a checkbox, that can have only two values
* . combobox -> an HTML combo, fed by a query
* - Row -> if each row of your table is made of several visual rows, the row that should be
* used to render the field; defaults to 1 (the 1st row)
* - StyleClass -> the CSS class to apply to the table cell that contains a field (fields are
* always rendered in HTML tables).
* - ExtraDefs -> a {@link PGBPropertyBag} specifying extra properties for specific renderers; possible properties are:
* - COMMON EXTRA DEFS (for any field)
* - Converter -> name of a PHP function to be applied to the rendered field's value.
* - DecChar -> the character to be used as a decimal point (defaults to the value returned
* by the getDecimalsSeparator() method of the current PGBNlsAgent).
* - Decimals -> number of decimal places, for "fixed" numbers
* - Format -> a formatter - can be
* . money -> format field's values as amounts of money, with a currency sign
* . fixed -> format field's values as fixed point numbers
* . asis -> (default) don't do any special formatting
* - GroupChar -> the character used to separate thousands in fixed numbers (defaults to
* the value returned by the getThousandsSeparator() method of the current
* PGBNlsAgent).
* - MaxLength -> maximum number of characters that can be typed by the user when entering
* values for a field.
* - PostChange -> a SQL query aimed at recovering values for dependent fields; should have a
* question mark, that will be replaced by the field's value before the query
* execution, and/or :field_name: placemarks, that will be replaced accordingly.
* For instance: SELECT descricaoSubgrupo de_subgrupo FROM sgrpt001 WHERE
* codigoGrupo=':CD_GRUPO:' AND codigoSubgrupo='?' would feed the field DE_SUBGRUPO
* from the FIRST RECORD returned by the query.
* - ReadOnly -> if set to true, the field will be rendered disabled, allowing no input.
*
* - FOR PLAINTEXT FIELDS
* - Translations -> an array containing a set of "actual value" => "shown string" pairs; the "shown string"
* corresponding to each "actual value" will be rendered
*
* - FOR CHECKBOX FIELDS
* - ValueOn -> the field value that corresponds to the checked state.
* - ValueOff-> the field value that corresponds to the unchecked state.
*
* - FOR COMBOBOX FIELDS FED FROM A RECORDSET
* - CapField -> name of the RowSource field to be used as caption in the combo
* (i.e. the values that will be shown to the user).
* - RowSource -> a PGBRecordSet containing records to feed the combo.
* - ValField -> name of the RowSource field to be used as value in the combo.
*
* - FOR COMBOBOX FIELDS FED FROM A DISCRETE SET OF VALUES
* - RowSource -> an array containing a set of 'value' => 'caption' pairs
*
* - FOR RADIOGROUP FIELDS
* - Buttons -> an array containing buttons to be rendered, as a set of 'value' => 'caption'
* pairs.
*
* - FOR TEXTAREA FIELDS
* - Columns -> number of columns that should be rendered.
* - Rows -> number of rows that should be rendered.
*
* - FOR TEXTBOX FIELDS
* - Size -> textbox size, in characters.
*
* @package Piragibe
* @author Francisco Piragibe
* @version 1.07
* @subpackage PGBPropertyBag
* @copyright Copyright © 2006, Francisco Piragibe
* This file is part of The PIRAGIBE Framework.
*
* The PIRAGIBE Framework is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The PIRAGIBE Framework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with The PIRAGIBE Framework; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class PGBRenderDefs extends PGBPropertyBag {
/**
* Standard constructor.
* @param array $pDefs the set of definitions
*/
function PGBRenderDefs( $pDefs ) {
parent::PGBPropertyBag( $pDefs );
if ( is_null( $this->get('StyleClass') ) ) {
$this->set( 'StyleClass', 'dados' );
}
if ( is_null( $this->get('Renderer') ) ) {
$this->set( 'Renderer', 'plaintext' );
}
}
}
?>