*/
function _obtenerEstiloCelda($row, $col) {
$clase = $this->_tabla->getCellAttributes($row, $col);
- if (@$clase['cabecera']) {
- $estilo = $this->_config['celda_cabecera'];
- }
- elseif (@$clase['titulo']) {
- $estilo = $this->_config['celda_titulo'];
- }
- elseif (@$clase['oscura']) {
- $tmp = $this->_config['celda_comun'];
- $tmp['fillcolor'] = $this->_config['celda_cabecera']['fillcolor'];
- $tmp['fill'] = $this->_config['celda_cabecera']['fill'];
- $estilo = $tmp;
- }
- elseif (@$clase['clara']) {
- $tmp = $this->_config['celda_comun'];
- $tmp['fillcolor'] = $this->_config['celda_titulo']['fillcolor'];
- $tmp['fill'] = $this->_config['celda_titulo']['fill'];
- $estilo = $tmp;
- }
- else {
- $estilo = $this->_config['celda_comun'];
+
+ switch (@$clase['mlib_style'])
+ {
+ case 'cabecera':
+ $estilo = $this->_config['celda_cabecera'];
+ break;
+ case 'titulo':
+ $estilo = $this->_config['celda_titulo'];
+ break;
+ case 'oscura':
+ $tmp = $this->_config['celda_comun'];
+ $tmp['fillcolor'] = $this->_config['celda_cabecera']['fillcolor'];
+ $tmp['fill'] = $this->_config['celda_cabecera']['fill'];
+ $estilo = $tmp;
+ break;
+ case 'clara':
+ $tmp = $this->_config['celda_comun'];
+ $tmp['fillcolor'] = $this->_config['celda_titulo']['fillcolor'];
+ $tmp['fill'] = $this->_config['celda_titulo']['fill'];
+ $estilo = $tmp;
+ break;
+ case 'comun':
+ $estilo = $this->_config['celda_comun'];
+ break;
+ default:
+ //Si no encuentro el estilo seteado a mano, le asigno el estilo
+ //seteado por defecto.
+ if (@$this->_config[$clase['mlib_style']])
+ {
+ $estilo = $this->_config[$clase['mlib_style']];
+ }
+ else
+ {
+ $estilo = $this->_config['celda_comun'];
+ }
+ break;
}
if (@$clase['colspan']) {
$estilo['colspan'] = $clase['colspan'];
}
$this->_marco->espacioDisponible = $alto;
}
+
+ /**
+ * Funcion que agrega un estilo a los definidos
+ *
+ * @param &Object $ESTILO MLIB_HTML_Tabla_Estilo
+ *
+ * @return void
+ * @access public
+ */
+ function setStyle($ESTILO) {
+ $this->_config[$ESTILO->name] = $ESTILO->__toArray();
+ }
}
?>
\ No newline at end of file
--- /dev/null
+<?php /* vim: set binary expandtab tabstop=4 shiftwidth=4 textwidth=80:
+-------------------------------------------------------------------------------
+ mlib
+-------------------------------------------------------------------------------
+This file is part of mlib.
+
+mlib 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.
+
+mlib 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; if not,
+write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------------
+Creado: lun ago 22 21:42:32 UTC 2005
+Autor: Martin Marrese <marrese@gmail.com>
+-------------------------------------------------------------------------------
+$Id$
+-----------------------------------------------------------------------------*/
+
+/**
+ * Libreria que permite agregar crear un estilo para una tabla de un pdf.
+ */
+class MLIB_PDF_Tabla_Estilo {
+
+ /**
+ * Nombre del Estilo.
+ *
+ * @var string $name
+ * @access public;
+ */
+ var $name;
+
+ /**
+ * Alto de la fila.
+ *
+ * @var int $rowHeight
+ * @access public;
+ */
+ var $rowHeight = 10;
+
+ /**
+ * Fuente.
+ *
+ * @var string $font
+ * @access public;
+ */
+ var $font = 'Helvetica';
+
+ /**
+ * Alto de la fuente.
+ *
+ * @var int $fontHeight
+ * @access public;
+ */
+ var $fontHeight = 8;
+
+ /**
+ * Color de fondo de la celda.
+ *
+ * @var array $fillColor
+ * @access public;
+ */
+ var $fillColor = array (
+ 'red' => '0',
+ 'blue' => '0',
+ 'green' => '0'
+ );
+
+ /**
+ * Modo de escritura de la celda.
+ *
+ * @var string $fillMode
+ * @access public;
+ */
+ var $fillMode = 'fill+stroke';
+
+ /**
+ * Color de la fuente
+ *
+ * @var string $fillModeFillColor
+ * @access public;
+ */
+ var $fillModeFillColor = array (
+ 'red' => '1',
+ 'blue' => '1',
+ 'green' => '1'
+ );
+
+ /**
+ * Color de los bordes laterales y superior de la celda.
+ * Siempre gana el color de la celda de la izquierda para aquellos bordes
+ * compartidos. Siempre gana la celda inferior para los bordes compartidos.
+ *
+ * @var string $fillModeStrokeColor
+ * @access public;
+ */
+ var $fillModeStrokeColor = array (
+ 'red' => '0',
+ 'blue' => '0',
+ 'green' => '0'
+ );
+
+ /**
+ * Class Constructor
+ *
+ * @param string $name Nombre del estilo
+ *
+ * @return void
+ * @access public
+ */
+ function MLIB_PDF_Tabla_Estilo($name) {
+ $this->name = $name;
+ }
+
+ /**
+ * Funcion que devuelve el array de estilo armado para asignar a la tabla.
+ *
+ * @return array
+ * @access public
+ */
+ function __toArray() {
+ return array (
+ 'alto_linea' => $this->rowHeight,
+ 'font' => $this->font,
+ 'height' => $this->fontHeight,
+ 'fillcolor' => $this->fillColor,
+ 'fill' =>
+ array (
+ 'mode' => $this->fillMode,
+ 'fillcolor' => $this->fillModeFillColor,
+ 'strokecolor' => $this->fillModeStrokeColor
+ ),
+ );
+ }
+}
+?>
\ No newline at end of file