X-Git-Url: https://git.llucax.com/mecon/meconlib.git/blobdiff_plain/71acf4950362871b3ad6bc168d08db422edf0509..68e567775ffff90eadcc4169f946a083f1f8b44b:/lib/MECON/HTML/QuickForm/Renderer/Tabla.php
diff --git a/lib/MECON/HTML/QuickForm/Renderer/Tabla.php b/lib/MECON/HTML/QuickForm/Renderer/Tabla.php
index c192e78..6b96831 100644
--- a/lib/MECON/HTML/QuickForm/Renderer/Tabla.php
+++ b/lib/MECON/HTML/QuickForm/Renderer/Tabla.php
@@ -88,14 +88,20 @@ class MECON_HTML_QuickForm_Renderer_Tabla extends HTML_QuickForm_Renderer {
/**
* Constructor.
*
- * @param mixed $style Estilo de la tabla.
+ * @param mixed $param Array o sting con el estilo de la tabla u objeto
+ * tabla alternativo para usar.
*
* @access public
*/
- function MECON_HTML_QuickForm_Renderer_Tabla($style = array())
+ function MECON_HTML_QuickForm_Renderer_Tabla($param = array())
{
$this->HTML_QuickForm_Renderer();
- $this->_tabla =& new Tabla($style);
+ if (is_a($param, 'Tabla')) {
+ $this->setTable($param);
+ }
+ else {
+ $this->_tabla =& new MECON_HTML_Tabla($param);
+ }
} // end constructor
/**
@@ -123,7 +129,7 @@ class MECON_HTML_QuickForm_Renderer_Tabla extends HTML_QuickForm_Renderer {
# FIXME - deberia sacarlo del QuickForm
#$this->_prepend = $form->getFormStart();
$attrs = $form->getAttributesString();
- $this->_prepend = "\n
\n";
+ $this->_append = "\n\n";
} // end func finishForm
/**
@@ -184,11 +190,11 @@ class MECON_HTML_QuickForm_Renderer_Tabla extends HTML_QuickForm_Renderer {
if (!$this->_inGroup) {
$id = $this->_tabla->addRow(
array(
- $element->getLabel() . ($required ? '*' : ''),
- $element->toHtml() . ($error ? "
$error" : ''),
+ $element->getLabel() . ($required ? '*' : ''),
+ $element->toHtml() . ($error ? "
$error" : ''),
)
);
- $this->_tabla->updateCellAttributes($id, 0, array('titulo' => true, 'align' => 'left', 'nowrap' => true));
+ $this->_tabla->updateCellAttributes($id, 0, array('titulo' => true, 'align' => 'left'));
$this->_tabla->updateCellAttributes($id, 1, array('align' => 'left'));
} else {
$this->_groupElements[] = ($element->getLabel() ? ($element->getLabel().' ') : '') . $element->toHtml();
@@ -260,10 +266,51 @@ class MECON_HTML_QuickForm_Renderer_Tabla extends HTML_QuickForm_Renderer {
array($group->getLabel(), join($sep, $this->_groupElements)),
array('valign' => 'middle', 'align' => 'left')
);
- $this->_tabla->updateCellAttributes($id, 0, array('titulo' => true, 'align' => 'left', 'nowrap' => true));
+ $this->_tabla->updateCellAttributes($id, 0, array('titulo' => true, 'align' => 'left'));
}
$this->_inGroup = false;
} // end func finishGroup
+
+ /**
+ *
+ *
+ * @param mixed $attrs Html attributes
+ * @access public
+ * @return void
+ */
+ function updateAttributes($attrs) {
+ $this->_tabla->updateAttributes($attrs);
+ }
+ /**
+ *
+ *
+ * @param mixed $attrs Html attributes
+ * @access public
+ * @return void
+ */
+ function setAttributes($attrs) {
+ $this->_tabla->setAttributes($attrs);
+ }
+ /**
+ *
+ *
+ * @access public
+ * @return mixed
+ */
+ function getAttributes() {
+ return $this->_tabla->getAttributes();
+ }
+
+ /**
+ *
+ *
+ * @param Tabla $param Objeto tabla alternativo para utilizar
+ *
+ * @access public
+ */
+ function setTable($param) {
+ $this->_tabla =& $param;
+ }
} // end class HTML_QuickForm_Renderer_Default