From 0f0e41a6f47093189c050a7beeac79144ed8c0d6 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Tue, 21 Oct 2003 23:23:07 +0000 Subject: [PATCH 01/16] =?utf8?q?Se=20corrige=20peque=C3=B1o=20bug=20a=20Li?= =?utf8?q?nk.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/MECON/HTML/Link.php | 10 +--- lib/MECON/HTML/TablaDB.php | 112 ++++++++++++++++++++++++++++++++----- 2 files changed, 101 insertions(+), 21 deletions(-) diff --git a/lib/MECON/HTML/Link.php b/lib/MECON/HTML/Link.php index 4d97b34..b1835c1 100644 --- a/lib/MECON/HTML/Link.php +++ b/lib/MECON/HTML/Link.php @@ -170,18 +170,14 @@ class MECON_HTML_Link extends HTML_Common { * Set a GET variable. * * @param string $key Key for the GET variable. - * @param mixed &$value Value for the variable. + * @param mixed $value Value for the variable. * * @return void * @access public */ - function setGetVar($key, &$value) // ~X2C + function setGetVar($key, $value) // ~X2C { - if (is_object($value)) { - $this->_getVars[$key] =& $value; - } else { - $this->_getVars[$key] = $value; - } + $this->_getVars[$key] = $value; } // -X2C diff --git a/lib/MECON/HTML/TablaDB.php b/lib/MECON/HTML/TablaDB.php index 0b8e90e..6876e94 100644 --- a/lib/MECON/HTML/TablaDB.php +++ b/lib/MECON/HTML/TablaDB.php @@ -56,6 +56,11 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { */ var $_appendRowsData = array(); + /** + * Prefijo a usar para las variables GET que genera la tabla. + */ + var $_getVarPrefix = 'tabladb_'; + /** * Constructor. * Puede recibir como parametro un string con los atributos que se @@ -76,6 +81,20 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { parent::MECON_HTML_Tabla($attrs, $estilo); } + /** + * Establece el prefijo usado para las variables de GET que genera la tabla. + */ + function setGetVarPrefix($prefix) { + $this->_getVarPrefix = $prefix; + } + + /** + * Obtiene el prefijo usado para las variables de GET que genera la tabla. + */ + function getGetVarPrefix() { + return $this->_getVarPrefix; + } + /** * Agrega un páginador a la tabla, basado en un resultado de una base de datos. * Ejemplo: @@ -109,15 +128,17 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { * GET) o un string. * @param int $limit Parámetro usado para crear el MECON_DB_Pager. * @param int $maxpages Parámetro usado para crear el MECON_DB_Pager. + * @param string $getvar Nombre de la variable GET a usar para indicar el número + * de página actual (se le pone el \ref setGetPrefix prefijo) * * @return MECON_DB_Pager Pager que se puede usar para realizar los fetch de * los resultados de la página actual. * * @see MECON_DB_Pager. */ - function addPager($result, $tipo = null, $link = null, $limit = 10, $maxpages = 21) { + function addPager($result, $tipo = null, $link = null, $limit = 10, $maxpages = 21, $getvar = 'from') { // Creo el pager con el resultado. - $pager = new MECON_DB_Pager($result, @$_GET['pager_from'], $limit, $maxpages); + $pager = new MECON_DB_Pager($result, @$_GET[$this->_getVarPrefix.$getvar], $limit, $maxpages); // Obtengo un link válido. if (!$link) { $link = @$_SERVER['PHP_SELF']; @@ -139,22 +160,22 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { } // Me fijo si tiene cada uno de los elementos y los agrego. if (in_array('anterior', $tipo) and $pager->numRows() and $pager->currentpage != 1) { - $link->setGetVar('pager_from', $pager->prev); + $link->setGetVar($this->_getVarPrefix.$getvar, $pager->prev); $this->addLink('anterior', $link); } if (in_array('siguiente', $tipo) and $pager->numRows() and $pager->currentpage != $pager->numpages) { - $link->setGetVar('pager_from', $pager->next); + $link->setGetVar($this->_getVarPrefix.$getvar, $pager->next); $this->addLink('siguiente', $link); } if (in_array('paginas', $tipo) and $pager->numRows() and $pager->numpages > 1) { - $from = @$_GET['pager_from']; + $from = @$_GET[$this->_getVarPrefix.$getvar]; $pags = ''; $lnk = $link->getContents(); foreach ($pager->pages as $page => $start_row) { if ($start_row == $from) { $pags .= $page; } else { - $link->setGetVar('pager_from', $start_row); + $link->setGetVar($this->_getVarPrefix.$getvar, $start_row); $link->setContents($page); $pags .= $link->toHtml(); } @@ -255,24 +276,27 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { } } - function prependRowsData($format, $campos = array()) { + function addRowsData($format, $campos = array(), $lugar = 'append') { if (!is_array($campos)) { $campos = array($campos); } - $this->_prependRowsData[] = array($format, $campos); - } - - function appendRowsData($format, $campos = array()) { - if (!is_array($campos)) { - $campos = array($campos); + switch (strtolower($lugar)) { + case 'prepend': + $this->_prependRowsData[] = array($format, $campos); + break; + case 'append': + $this->_appendRowsData[] = array($format, $campos); + break; + default: + $this->raiseError('Lugar incorrecto. Lugares soportados: append, prepend.'); } - $this->_appendRowsData[] = array($format, $campos); } function _buildRowsData($datos, $row, $array) { if ($array) { foreach ($array as $data) { list($format, $fields) = $data; + // Si tiene formatos y argumentos. if ($fields) { $args = array($format); foreach ($fields as $field) { @@ -283,7 +307,19 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { } } $datos[] = call_user_func_array('sprintf', $args); + // Si tiene solo formato. } else { + #echo "TAG: $format
"; + // Si es un link, traduce las variables GET. + if (is_a($format, 'mecon_html_link')) { + $vars = $format->getGetVars(); + foreach ($vars as $var => $val) { + if (preg_match("/^{$this->_getVarPrefix}(.+)$/", $var, $m) + and ($val === null)) { + $format->setGetVar($var, $row[$m[1]]); + } + } + } $datos[] = $format; } } @@ -291,6 +327,54 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { return $datos; } + function addRowsIcon($id, $campos = array(), $link = null, $lugar = 'append') { + if (is_string($campos)) { + $campos = array($campos); + } + if (!$link) { + $link = @$_SERVER['PHP_SELF']; + } + if (is_string($link)) { + $link = new MECON_HTML_Link($link, ''); + } + switch ($id) { + case 'modificar': + $img = new MECON_HTML_Image('/MECON/images/general_modificar', '(M)'); + $link->addContents($img); + foreach ($campos as $campo) { + $link->setGetVar($this->_getVarPrefix.$campo, null); + } + $this->addRowsData($link, array(), $lugar); + break; + case 'no_modificar': + $img = new MECON_HTML_Image('/MECON/images/general_modificar_des', '(-)'); + $this->addRowsData($img, array(), $lugar); + break; + case 'borrar': + $img = new MECON_HTML_Image('/MECON/images/general_eliminar', '(B)'); + $link->addContents($img); + foreach ($campos as $campo) { + $link->setGetVar($this->_getVarPrefix.$campo, null); + } + $this->addRowsData($link, array(), $lugar); + break; + case 'no_borrar': + $img = new MECON_HTML_Image('/MECON/images/general_eliminar_des', '(-)'); + $this->addRowsData($img, array(), $lugar); + break; + case 'ir': + $img = new MECON_HTML_Image('/MECON/images/general_ir4', '->'); + $link->addContents($img); + foreach ($campos as $campo) { + $link->setGetVar($this->_getVarPrefix.$campo, null); + } + $this->addRowsData($link, array(), $lugar); + break; + default: + $this->raiseError("No hay un ícono predefinido llamado '$id'."); + } + } + } ?> -- 2.43.0 From 5bef6cb12aa86876a8cffe8efc6a1623eb03ba1f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mart=C3=ADn=20Marrese?= Date: Wed, 22 Oct 2003 21:16:46 +0000 Subject: [PATCH 02/16] Marco ahora tiene la posibilidad de cambiar el copete segun tenga o no ayuda. --- doc/HTML/html.xmi | 36 ++-- doc/Marco/uml/Marco.xmi | 318 ++++++++++++++++-------------- lib/MECON/Marco.php | 15 ++ lib/MECON/Marco/Copete.php | 41 +++- lib/MECON/Marco/MenuPrincipal.php | 2 +- 5 files changed, 238 insertions(+), 174 deletions(-) diff --git a/doc/HTML/html.xmi b/doc/HTML/html.xmi index 05fd016..60fb31c 100644 --- a/doc/HTML/html.xmi +++ b/doc/HTML/html.xmi @@ -52,7 +52,7 @@ This is done in toHtml() method. Object are stored as references." name="MECON_H - + - - - + - - - - + + + + - - - - - + + + + + - - - - - + + + + + @@ -146,9 +144,9 @@ x2c:get set" name="getVars" static="0" scope="202" /> - + diff --git a/doc/Marco/uml/Marco.xmi b/doc/Marco/uml/Marco.xmi index cb5f7f7..0d9965d 100644 --- a/doc/Marco/uml/Marco.xmi +++ b/doc/Marco/uml/Marco.xmi @@ -10,7 +10,7 @@ - + @@ -51,6 +51,9 @@ Si es un objeto debe tener un metodo toHtml y opcionalmente puede tener un getCS + + + @@ -59,9 +62,11 @@ Si es un objeto debe tener un metodo toHtml y opcionalmente puede tener un getCS + + @@ -211,239 +216,246 @@ x2c:include: HTML/Page.php" name="HTML_Page" static="0" scope="200" /> - - - - - - - - - - - - - - + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - + - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + - + + + + + + + + - - - - - - - - + + + + + + + + - - - - + + + + + + + + - - - - + + + + + + + + - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - + + + + + + + + - - - - + + + + + + + + - + - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - + - - - - + + + + - - - - + + + + - + - - - - - - - - - + + + + + + + + + @@ -467,12 +479,14 @@ x2c:include: HTML/Page.php" name="HTML_Page" static="0" scope="200" /> + - + + @@ -566,9 +580,9 @@ x2c:include: HTML/Page.php" name="HTML_Page" static="0" scope="200" /> - + diff --git a/lib/MECON/Marco.php b/lib/MECON/Marco.php index 3ac404d..b18d48b 100644 --- a/lib/MECON/Marco.php +++ b/lib/MECON/Marco.php @@ -333,6 +333,21 @@ Si es un objeto debe tener un metodo toHtml y opcionalmente puede tener un getCS } // -X2C + // +X2C Operation 243 + /** + * Permite hacer que en el copete aparezca un icono de ayuda, en un lugar predefinido. Sobreescribe lo seteado anteriormente por cualquier metodo. + * + * @param mixed $ayuda Objeto MECON_HTML_Link o string para utilizar en el map. + * + * @return void + * @access public + */ + function setAyuda($ayuda) // ~X2C + { + $this->_configuracion['ayuda'] = $ayuda; + } + // -X2C + } // -X2C Class :MECON_Marco ?> \ No newline at end of file diff --git a/lib/MECON/Marco/Copete.php b/lib/MECON/Marco/Copete.php index fb1a8fe..87ec1cd 100644 --- a/lib/MECON/Marco/Copete.php +++ b/lib/MECON/Marco/Copete.php @@ -43,6 +43,14 @@ class MECON_Marco_Copete { */ var $_directorio = ''; + /** + * String con la referencia y los getvars de la ayuda + * + * @var string $ayuda + * @access private + */ + var $_ayuda = null; + // ~X2C // +X2C Operation 34 @@ -50,13 +58,34 @@ class MECON_Marco_Copete { * Recibe el nombre del directorio en donde se encuentra instalado el sistema. El directorio es case sensitive. * * @param string $directorio Nombre del directorio en donde se encuentra el sistema. + * @param mixed $ayuda Objeto MECON_HTML_Link o string para armar el map de la ayuda. * * @return void * @access public */ - function MECON_Marco_Copete($directorio) // ~X2C + function MECON_Marco_Copete($directorio, $ayuda = null) // ~X2C { $this->_directorio = $directorio; + if (@$ayuda) { + if (is_object($ayuda)) { + $val = $ayuda->getHref(); + foreach ($ayuda->getGetVars() as $var => $v) { + if (is_object($v) and method_exists($v, 'tostring')) { + $v = $v->tostring(); + } elseif (is_object($v) or is_array($v)) { + $v = serialize($v); + } + $vars[] = urlencode($var) . '=' . urlencode($v); + } + if ($vars) { + $val .= '?' . join('&', $vars); + } + $this->_ayuda = $val; + } + else { + $this->_ayuda = $ayuda; + } + } } // -X2C @@ -70,7 +99,15 @@ class MECON_Marco_Copete { function toHtml() // ~X2C { if (!is_null($this->_directorio)) { - return ''; + if (@$this->_ayuda) { + return ''; + } + else { + return ''; + } } else { return ''; diff --git a/lib/MECON/Marco/MenuPrincipal.php b/lib/MECON/Marco/MenuPrincipal.php index 3b19a79..d46c9f3 100644 --- a/lib/MECON/Marco/MenuPrincipal.php +++ b/lib/MECON/Marco/MenuPrincipal.php @@ -86,7 +86,7 @@ class MECON_Marco_MenuPrincipal extends MECON_Marco_MenuHorizontal { $colspan = count($this->_componentes); //Agrego el copete {{{ - $copete = new MECON_Marco_Copete ($this->_configuracion['directorios']['imagenes']); + $copete = new MECON_Marco_Copete ($this->_configuracion['directorios']['imagenes'], @$this->_configuracion['ayuda']); $row[] = $copete->toHtml(); $this->_tabla->addRow($row,'align="center" bgcolor="#FFFFFF"'); //}}} -- 2.43.0 From 5e0dff970fc4e06b4a642b7e84ed8083a76bd00a Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Thu, 23 Oct 2003 19:46:19 +0000 Subject: [PATCH 03/16] =?utf8?q?Se=20termina=20TablaDB=20con=20documentaci?= =?utf8?q?=C3=B3n=20y=20todo.=20Falta=20probar=20mejor=20y=20dar=20m=C3=A1?= =?utf8?q?s=20ejemplos.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/MECON/HTML/TablaDB.php | 245 ++++++++++++++++++++++++++++++------- 1 file changed, 199 insertions(+), 46 deletions(-) diff --git a/lib/MECON/HTML/TablaDB.php b/lib/MECON/HTML/TablaDB.php index 6876e94..62dcb64 100644 --- a/lib/MECON/HTML/TablaDB.php +++ b/lib/MECON/HTML/TablaDB.php @@ -104,9 +104,13 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { * if (DB::isError($result)) { * die('Error'); * } + * // Agrega el paginador por defecto y lo guarda para mostrar solo los + * // resultados paginados después. * $pager = $tabla->addPager($result); + * // Agrega cabecera con los nombres de las columnas. * $tabla->addRow(array('Nombre', 'Apellido'), 'cabecera'); - * $tabla->addRows($result, array('nombre', 'apellido')); + * // Agrega los resultados paginados de la DB. + * $tabla->addRows($pager, array('nombre', 'apellido')); * $tabla->display(); * @endcode * @@ -134,7 +138,7 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { * @return MECON_DB_Pager Pager que se puede usar para realizar los fetch de * los resultados de la página actual. * - * @see MECON_DB_Pager. + * @see MECON_DB_Pager, addRows(). */ function addPager($result, $tipo = null, $link = null, $limit = 10, $maxpages = 21, $getvar = 'from') { // Creo el pager con el resultado. @@ -201,16 +205,13 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { * Si no hay resultados, muestra un mensaje. Dependiendo de si es se pasa * un objeto a usar o no, llama a addRowsObject() o addRowsResult() * respectivamente. - * Ejemplo: - * @code - * @endcode * * @param DB_Result $result Resultados de una consulta. * @param array $campos Propiedades del objeto a mostrar. * @param mixed $obj Objeto a usar. Puede ser un objeto instanciado o un * string con el nombre de la clase. * - * @see Ejemplo en addPager(); + * @see addRowsData(), addRowsIcon(), ejemplo en addPager(). */ function addRows($result, $campos, $obj = null) { if ($result->numRows()) { @@ -233,17 +234,17 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { */ function addRowsResult($result, $campos) { while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) { - $datos = array(); - if ($this->_prependRowsData) { - $datos = $this->_buildRowsData($datos, $row, $this->_prependRowsData); + $columnas = array(); + foreach ($this->_prependRowsData as $data) { + $columnas[] = $this->_buildCustomColumn($data, $row); } foreach ($campos as $campo) { - $datos[] = $row[$campo]; + $columnas[] = $row[$campo]; } - if ($this->_appendRowsData) { - $datos = $this->_buildRowsData($datos, $row, $this->_appendRowsData); + foreach ($this->_appendRowsData as $data) { + $columnas[] = $this->_buildCustomColumn($data, $row); } - $this->addRow($datos); + $this->addRow($columnas); } } @@ -268,14 +269,67 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { $this->raiseError('La clase ' . get_class($obj) . ' no tiene un metodo cargar().'); } while ($obj->cargar($result)) { - $datos = array(); + foreach ($this->_prependRowsData as $data) { + $columnas[] = $this->_buildCustomColumn($data, $row); + } foreach ($campos as $campo) { - $datos[] = $obj->$campo; + $columnas[] = $obj->$campo; + } + foreach ($this->_appendRowsData as $data) { + $columnas[] = $this->_buildCustomColumn($data, $row); } - $this->addRow($datos); + $this->addRow($columnas); } } + /** + * Agrega una columna arbitraria a la tabla basado en valores de una fila. + * Ejemplo: + * @code + * $tabla = new MECON_HTML_TablaDB('personas', array('width' => '100%')); + * $result = $db->query('SELECT nombre, apellido, activo FROM tabla'); + * if (DB::isError($result)) { + * die('Error'); + * } + * $tabla->addRow(array('Col1', 'Nombre', 'Apellido', 'Activo'), 'cabecera'); + * // Agrega una columna con una leyenda 'El nombre es: {nombre}' al principio. + * $tabla->addRowsData('Me llamo %s.', 'nombre', 'prepend'); + * // Agrega una columna al final con checkbox para seleccionar filas. El + * // segundo elemento será procesado por la callback checked_callback(). + * $tabla->addRowsData('', + * array('nombre', array('activo', 'checked_callback'))); + * // Agrega resultados de la tabla. + * $tabla->addRows($result, array('nombre', 'apellido')); + * $tabla->display(); + * @endcode + * + * @param mixed $format Si es un string, especifica el formato a usar al + * estilo de sprintf. Si es un MECON_HTML_Link, se + * traduce cada variable por GET que empiece con el + * \ref getGetVarPrefix "prefijo" y cuyo valor sea null + * al campo correspondiente de la DB. Si e valor en vez + * de ser null es un string, se fija si existe una + * función con ese nombre para llamar con el campo de + * la DB como argumento para formatearlo. Si no existe + * la función, se toma el string como formato para + * sprintf para darle formato. + * @param mixed $campos Campos de la DB a usar como argumentos del sprintf. + * Puede ser un string para pasar un solo campo sin + * formato. Si es un array, cada elemento es un campo + * que puede ser un string representando el nombre de + * un campo a usar sin agumento o un array cuyo primer + * elemento es el nombre del campo a usar y el segundo + * argumento es una funcion callback a llamar con el + * valor del campo como argumento para darle formato. + * @code $tabla->addRowsData('%s', array('campo1', 'campo2', array('campo3', 'callback_campo3')))); @endcode + * @param string $lugar Indica donde hay que agregar la columna. Puede ser: + * prepend o append. + * + * @warning Este método debe ser llamado antes de llamar a addRows(). + * @note Las funciones callback toman todas un solo argumento (el valor del + * campo a formatear) y deben devolver un string con el campo + * formateado. + */ function addRowsData($format, $campos = array(), $lugar = 'append') { if (!is_array($campos)) { $campos = array($campos); @@ -292,41 +346,136 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { } } - function _buildRowsData($datos, $row, $array) { - if ($array) { - foreach ($array as $data) { - list($format, $fields) = $data; - // Si tiene formatos y argumentos. - if ($fields) { - $args = array($format); - foreach ($fields as $field) { - if (is_array($row)) { - $args[] = $row[$field]; - } else { - $args[] = $row->$field; - } - } - $datos[] = call_user_func_array('sprintf', $args); - // Si tiene solo formato. + /** + * Contruye una columna personalizada. + * + * @param array $data Datos sobre la columna, en el formato especificado + * para un elemento del array usado en _prependRowsData. + * @param mixed $row Fila de un resultado de una base de dotos. Puede ser un + * array asociativo o un objeto (en cuyo caso cada campo + * debe ser un atributo del mismo). + * + * @return mixed Columna formateada para agregar a la tabla. + * + * @protected + */ + function _buildCustomColumn($data, $row) { + list($format, $campos) = $data; + // Si tiene formatos y argumentos. + if ($campos) { + // Si el formato es un MECON_HTML_Link, uso como formato a + // su contenido. + if (is_a($format, 'mecon_html_link')) { + $args = array($format->getContents()); + } else { + $args = array($format); + } + // Proceso cada agumento. + foreach ($campos as $campo) { + // Si el agumento es un array, usa una callback para + // darle formato. + if (is_array($campo)) { + list($campo, $callback) = $campo; + } + if (is_array($row)) { + $campo = $row[$campo]; // Es un campo de un array. } else { - #echo "TAG: $format
"; - // Si es un link, traduce las variables GET. - if (is_a($format, 'mecon_html_link')) { - $vars = $format->getGetVars(); - foreach ($vars as $var => $val) { - if (preg_match("/^{$this->_getVarPrefix}(.+)$/", $var, $m) - and ($val === null)) { - $format->setGetVar($var, $row[$m[1]]); - } - } - } - $datos[] = $format; + $campo = $row->$campo; // Es un atributo de un objeto. } + // Si usa callback, cambio el campo por el resultado del + // llamado a su callback. + if (isset($callback) and function_exists($callback)) { + $campo = $callback($campo); + } + // Agrego argumento procesado a la lista de argumentos. + $args[] = $campo; + } + // Si es un link, le seteo los contenidos procesados. + if (is_a($format, 'mecon_html_link')) { + $format->setContents(call_user_func_array('sprintf', $args)); + // Si no formateo la cadena con los argumentos procesados. + } else { + $format = call_user_func_array('sprintf', $args); } } - return $datos; + // Si es un link, traduce las variables GET. + if (is_a($format, 'mecon_html_link')) { + $format = $this->_translateGetVars($format, $row); + } + // devuelve la columna. + return $format; } + /** + * Traduce las variables GET de un link. + * Puede formatearlas con printf() o llamando una callback. + * + * @param MECON_HTML_Link $link Link con las variables GET a formatear. + * @param mixed $row Fila de un resultado de una base de dotos. Puede ser un + * array asociativo o un objeto (en cuyo caso cada campo + * debe ser un atributo del mismo). + * + * @return MECON_HTML_Link Link con las variables GET traducidas. + * + * @protected + */ + function _translateGetVars($link, $row) { + $vars = $link->getGetVars(); + foreach ($vars as $var => $val) { + if (preg_match("/^{$this->_getVarPrefix}(.+)$/", $var, $m)) { + $campo = $m[1]; + $campo = is_array($row) ? $row[$campo] : $row->$campo; + // Si no tiene valor, se lo reemplaza por el + // valor del campo. + if ($val === null) { + $link->setGetVar($var, $campo); + // Si existe una funcion, se la usa para obtener + // el formato. + } elseif (function_exists($val)) { + $link->setGetVar($var, $val($campo)); + // Si no es ni null ni link, lo toma como + // formato para el sprintf + } else { + $link->setGetVar($var, sprintf($val, $campo)); + } + } + } + return $link; + } + + /** + * Agrega un ícono predefinido a la tabla. + * + * @param string $id Identificador del tipo de ícono a agregar. Puede ser: + *
    + *
  • 'modificar': Ícono de modificar.
  • + *
  • 'no_modificar': Ícono de modificar desactivado.
  • + *
  • 'borrar': Ícono de borrar.
  • + *
  • 'no_borrar': Ícono de borrar desactivado.
  • + *
  • 'ir': Flecha hacia la derecha.
  • + *
+ * @param mixed $campos Campos de la DB a usar para generar el link. Estos + * campos serán pasados por GET a la página destino. + * Cada campo es pasado como la variable GET compuesta + * por el @ref getGetVarPrefix "prefijo" más el nombre + * del campo (ver parámetro $campos de addRowsData() + * para conocer de que formas se puede formatear un + * campo). + * @param mixed $link Si es un string, se usa como URL del link a generar. + * Si es un MECON_HTML_Link, se usa como base para el + * link a generar y se le va agregando las variables de + * GET generadas por el parámetro $campos (el link es + * procesado de la misma forma en que es procesado el + * parámetro $formato en addRowsData() con la excepción + * de que el contenido del Link no es tomado en cuenta). + * @param string $lugar Indica donde hay que agregar la columna. Puede ser: + * prepend o append. + * + * @warning Este método debe ser llamado antes de llamar a addRows(). + * @note Las funciones callback toman todas un solo argumento (el valor del + * campo a formatear) y deben devolver un string con el campo + * formateado. + */ function addRowsIcon($id, $campos = array(), $link = null, $lugar = 'append') { if (is_string($campos)) { $campos = array($campos); @@ -342,7 +491,11 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { $img = new MECON_HTML_Image('/MECON/images/general_modificar', '(M)'); $link->addContents($img); foreach ($campos as $campo) { - $link->setGetVar($this->_getVarPrefix.$campo, null); + $format = null; + if (is_array($campo)) { + list($campo, $format) = $campo; + } + $link->setGetVar($this->_getVarPrefix.$campo, $format); } $this->addRowsData($link, array(), $lugar); break; -- 2.43.0 From 7636dc991c32ffc9990d112acf989ccab9789a90 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Thu, 23 Oct 2003 23:07:36 +0000 Subject: [PATCH 04/16] Se completa documentacion y se arreglan bugs. --- lib/MECON/HTML/TablaDB.php | 98 +++++++++++++++++++++++++++++++------- 1 file changed, 82 insertions(+), 16 deletions(-) diff --git a/lib/MECON/HTML/TablaDB.php b/lib/MECON/HTML/TablaDB.php index 62dcb64..b518832 100644 --- a/lib/MECON/HTML/TablaDB.php +++ b/lib/MECON/HTML/TablaDB.php @@ -59,7 +59,7 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { /** * Prefijo a usar para las variables GET que genera la tabla. */ - var $_getVarPrefix = 'tabladb_'; + var $_getVarPrefix = '_'; /** * Constructor. @@ -291,13 +291,27 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { * if (DB::isError($result)) { * die('Error'); * } - * $tabla->addRow(array('Col1', 'Nombre', 'Apellido', 'Activo'), 'cabecera'); + * $tabla->addRow( + * array('Col1', 'Nombre', 'Apellido', 'Activo', 'PopUp1', 'PopUp2'), + * 'cabecera'); * // Agrega una columna con una leyenda 'El nombre es: {nombre}' al principio. * $tabla->addRowsData('Me llamo %s.', 'nombre', 'prepend'); * // Agrega una columna al final con checkbox para seleccionar filas. El * // segundo elemento será procesado por la callback checked_callback(). * $tabla->addRowsData('', * array('nombre', array('activo', 'checked_callback'))); + * // Agrega el nombre con un link a un popup (sin javascript). + * $tabla->addRowsData( + * new MECON_HTML_Link('popup.php', '%s', array('nombre' => null), + * array('target' => '_blank')), + * 'nombre', + * 'prepend'); + * // Agrega el nombre con un link a un popup (con javascript). + * $tabla->addRowsData('%s', + * array('nombre', 'nombre', 'apellido')); * // Agrega resultados de la tabla. * $tabla->addRows($result, array('nombre', 'apellido')); * $tabla->display(); @@ -307,23 +321,48 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { * estilo de sprintf. Si es un MECON_HTML_Link, se * traduce cada variable por GET que empiece con el * \ref getGetVarPrefix "prefijo" y cuyo valor sea null - * al campo correspondiente de la DB. Si e valor en vez - * de ser null es un string, se fija si existe una - * función con ese nombre para llamar con el campo de - * la DB como argumento para formatearlo. Si no existe - * la función, se toma el string como formato para - * sprintf para darle formato. + * al campo correspondiente de la DB: + * @code $tabla->addRowsData(new MECON_HTML_Link('abm.php', 'Ver %s', + * array($tabla->getGetVarPrefix().'id' => null), 'nombre'); @endcode + * Si el valor en vez de ser null es un string, se + * fija si existe una función con ese nombre para llamar + * con el campo de la DB como argumento para + * formatearlo: + * @code $tabla->addRowsData(new MECON_HTML_Link('print.php', 'Mostrar', + * array($tabla->getGetVarPrefix().'campo1' => 'callback_campo1')); + * function callback_campo1($campo1) { + * return 'El campo1 es '.strtoupper($campo3); + * } @endcode + * Si no existe la función, se toma el string como + * formato para sprintf para darle formato: + * @code $tabla->addRowsData(new MECON_HTML_Link('print.php', 'Ver', + * array($tabla->getGetVarPrefix().'campo1' => 'campo1: %s')); @endcode * @param mixed $campos Campos de la DB a usar como argumentos del sprintf. * Puede ser un string para pasar un solo campo sin - * formato. Si es un array, cada elemento es un campo + * formato: + * @code $tabla->addRowsData('%s', 'campo1'); @endcode + * Si es un array, cada elemento es un campo * que puede ser un string representando el nombre de - * un campo a usar sin agumento o un array cuyo primer - * elemento es el nombre del campo a usar y el segundo - * argumento es una funcion callback a llamar con el - * valor del campo como argumento para darle formato. - * @code $tabla->addRowsData('%s', array('campo1', 'campo2', array('campo3', 'callback_campo3')))); @endcode + * un campo a usar: + * @code $tabla->addRowsData('%s', + * array('campo1', 'campo2'); @endcode + * o un array cuyo primer elemento es el nombre del + * campo a usar y el segundo argumento es una funcion + * callback a llamar con el valor del campo como + * argumento para darle formato: + * @code $tabla->addRowsData('%s', + * array('campo1', 'campo2', array('campo3', 'callback_campo3')))); + * function callback_campo3($campo3) { + * return strtoupper($campo3); + * } @endcode + * Si no se encuentra la funcion callback, se toma como + * un string para formatear el campo con sprintf(): + * @code $tabla->addRowsData('%s', array('campo1', + * array('campo2', 'campo2 = %s')); @endcode * @param string $lugar Indica donde hay que agregar la columna. Puede ser: - * prepend o append. + * 'prepend' o 'append': + * @code $tabla->addRowsData('Hola %s!', 'nombre', + * 'prepend'); @endcode * * @warning Este método debe ser llamado antes de llamar a addRows(). * @note Las funciones callback toman todas un solo argumento (el valor del @@ -445,6 +484,25 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { /** * Agrega un ícono predefinido a la tabla. + * Ejemplo: + * @code + * $tabla = new MECON_HTML_TablaDB('personas', array('width' => '100%')); + * $result = $db->query('SELECT nombre, apellido FROM tabla'); + * if (DB::isError($result)) { + * die('Error'); + * } + * $tabla->addRow(array('Col1', 'Nombre', 'Apellido', 'Modificar', 'Borrar', + * 'Agregar'), 'cabecera'); + * // Agrega ícono de modificar que apunta a modificar.php y pasa el 'id'. + * $tabla->addRowsIcon('modificar', 'id', 'modificar.php'); + * // Agrega ícono de borrar desactivado. + * $tabla->addRowsIcon('no_borrar'); + * // Agrega ícono con una flecha que apunta a agregar.php y no pasa nada. + * $tabla->addRowsIcon('ir', null, 'modificar.php'); + * // Agrega resultados de la tabla. + * $tabla->addRows($result, array('nombre', 'apellido')); + * $tabla->display(); + * @endcode * * @param string $id Identificador del tipo de ícono a agregar. Puede ser: *
    @@ -469,7 +527,7 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { * parámetro $formato en addRowsData() con la excepción * de que el contenido del Link no es tomado en cuenta). * @param string $lugar Indica donde hay que agregar la columna. Puede ser: - * prepend o append. + * 'prepend' o 'append'. * * @warning Este método debe ser llamado antes de llamar a addRows(). * @note Las funciones callback toman todas un solo argumento (el valor del @@ -477,6 +535,9 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { * formateado. */ function addRowsIcon($id, $campos = array(), $link = null, $lugar = 'append') { + if (!$campos) { + $campos = array(); + } if (is_string($campos)) { $campos = array($campos); } @@ -489,6 +550,7 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { switch ($id) { case 'modificar': $img = new MECON_HTML_Image('/MECON/images/general_modificar', '(M)'); + $img->updateAttributes(array('title' => 'Modificar')); $link->addContents($img); foreach ($campos as $campo) { $format = null; @@ -501,10 +563,12 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { break; case 'no_modificar': $img = new MECON_HTML_Image('/MECON/images/general_modificar_des', '(-)'); + $img->updateAttributes(array('title' => 'Modificar')); $this->addRowsData($img, array(), $lugar); break; case 'borrar': $img = new MECON_HTML_Image('/MECON/images/general_eliminar', '(B)'); + $img->updateAttributes(array('title' => 'Borrar')); $link->addContents($img); foreach ($campos as $campo) { $link->setGetVar($this->_getVarPrefix.$campo, null); @@ -513,10 +577,12 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { break; case 'no_borrar': $img = new MECON_HTML_Image('/MECON/images/general_eliminar_des', '(-)'); + $img->updateAttributes(array('title' => 'Borrar')); $this->addRowsData($img, array(), $lugar); break; case 'ir': $img = new MECON_HTML_Image('/MECON/images/general_ir4', '->'); + $img->updateAttributes(array('title' => 'Ir')); $link->addContents($img); foreach ($campos as $campo) { $link->setGetVar($this->_getVarPrefix.$campo, null); -- 2.43.0 From 6566b23c65083bf1d6d1207510d7cdbe2b072620 Mon Sep 17 00:00:00 2001 From: Manuel Nazar Anchorena Date: Fri, 24 Oct 2003 19:12:48 +0000 Subject: [PATCH 05/16] Se agrega la callback que faltaba al ejemplo. --- lib/MECON/HTML/TablaDB.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/MECON/HTML/TablaDB.php b/lib/MECON/HTML/TablaDB.php index b518832..c45a3d8 100644 --- a/lib/MECON/HTML/TablaDB.php +++ b/lib/MECON/HTML/TablaDB.php @@ -315,6 +315,13 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { * // Agrega resultados de la tabla. * $tabla->addRows($result, array('nombre', 'apellido')); * $tabla->display(); + * + * // Funcion callback para darle formato al campo 'activo'. + * // En este caso devuelve 'checked' para indicar que el checkbox está + * // activado si activo es true. + * function checked_callback($activo) { + * return $activo ? 'checked' : ''; + * } * @endcode * * @param mixed $format Si es un string, especifica el formato a usar al -- 2.43.0 From 099ede8532611662141d15172b5e9d947e49474a Mon Sep 17 00:00:00 2001 From: Manuel Nazar Anchorena Date: Fri, 24 Oct 2003 19:18:12 +0000 Subject: [PATCH 06/16] Se corrige un bug. --- lib/MECON/HTML/TablaDB.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/MECON/HTML/TablaDB.php b/lib/MECON/HTML/TablaDB.php index c45a3d8..fb13bf6 100644 --- a/lib/MECON/HTML/TablaDB.php +++ b/lib/MECON/HTML/TablaDB.php @@ -221,8 +221,12 @@ class MECON_HTML_TablaDB extends MECON_HTML_Tabla { $this->addRowsResult($result, $campos, $obj); } } else { - $id = $this->addRow(array(new MECON_HTML_Error("No se encontraron {$this->_desc}."))); - $this->updateCellAttributes($id, 0, array('colspan' => count($campos))); + $id = $this->addRow(array( + new MECON_HTML_Error("No se encontraron {$this->_desc}."))); + $this->updateCellAttributes($id, 0, + array('colspan' => count($campos) + + count($this->_prependRowsData) + + count($this->_appendRowsData))); } } -- 2.43.0 From d942f04e0f9c142a0a75da12787b06adf310f250 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mart=C3=ADn=20Marrese?= Date: Fri, 24 Oct 2003 20:03:59 +0000 Subject: [PATCH 07/16] Se agrego la funcion getConf a MECON_Marco --- doc/Marco/uml/Marco.xmi | 114 +++++++++++++++++++++------------------- lib/MECON/Marco.php | 20 +++++++ 2 files changed, 79 insertions(+), 55 deletions(-) diff --git a/doc/Marco/uml/Marco.xmi b/doc/Marco/uml/Marco.xmi index 0d9965d..b85b109 100644 --- a/doc/Marco/uml/Marco.xmi +++ b/doc/Marco/uml/Marco.xmi @@ -10,7 +10,7 @@ - + @@ -54,6 +54,9 @@ Si es un objeto debe tener un metodo toHtml y opcionalmente puede tener un getCS + + + @@ -221,7 +224,7 @@ x2c:include: HTML/Page.php" name="HTML_Page" static="0" scope="200" /> - + @@ -237,42 +240,42 @@ x2c:include: HTML/Page.php" name="HTML_Page" static="0" scope="200" /> - + - - - - - - - + + + + + + + - + - + - + - + - - - - - - - + + + + + + + @@ -292,12 +295,12 @@ x2c:include: HTML/Page.php" name="HTML_Page" static="0" scope="200" /> - - + + - + - + @@ -331,26 +334,26 @@ x2c:include: HTML/Page.php" name="HTML_Page" static="0" scope="200" /> - - - - - - - + + + + + + + - - - - - - - + + + + + + + @@ -370,13 +373,13 @@ x2c:include: HTML/Page.php" name="HTML_Page" static="0" scope="200" /> - - - - - - - + + + + + + + @@ -430,7 +433,7 @@ x2c:include: HTML/Page.php" name="HTML_Page" static="0" scope="200" /> - + @@ -445,16 +448,16 @@ x2c:include: HTML/Page.php" name="HTML_Page" static="0" scope="200" /> - + - + - - - - - - + + + + + + @@ -477,6 +480,7 @@ x2c:include: HTML/Page.php" name="HTML_Page" static="0" scope="200" /> + diff --git a/lib/MECON/Marco.php b/lib/MECON/Marco.php index b18d48b..bfbb231 100644 --- a/lib/MECON/Marco.php +++ b/lib/MECON/Marco.php @@ -348,6 +348,26 @@ Si es un objeto debe tener un metodo toHtml y opcionalmente puede tener un getCS } // -X2C + // +X2C Operation 277 + /** + * Permite obtener el array de configuracion completo. En caso de recibir una clave como parametro devuelve su valor. Solo se tienen en cuenta las claves del primer nivel. + * + * @param string $clave Clave del array de configuracion a obtener. + * + * @return mixed + * @access public + */ + function getConf($clave = null) // ~X2C + { + if ($clave) { + return @$this->_configuracion[$clave]; + } + else { + return $this->_configuracion + } + } + // -X2C + } // -X2C Class :MECON_Marco ?> \ No newline at end of file -- 2.43.0 From 358b117f798a3872f31486c84ae863c80c36abd6 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Fri, 24 Oct 2003 20:31:25 +0000 Subject: [PATCH 08/16] Se arregla bug. --- lib/MECON/Marco.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/MECON/Marco.php b/lib/MECON/Marco.php index bfbb231..9797f2b 100644 --- a/lib/MECON/Marco.php +++ b/lib/MECON/Marco.php @@ -363,7 +363,7 @@ Si es un objeto debe tener un metodo toHtml y opcionalmente puede tener un getCS return @$this->_configuracion[$clave]; } else { - return $this->_configuracion + return $this->_configuracion; } } // -X2C -- 2.43.0 From 9bdca7437f1241ae541d870f3e3fe0550d078492 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C3=ADas=20Sklar?= Date: Fri, 24 Oct 2003 22:46:35 +0000 Subject: [PATCH 09/16] - Imagen para mails --- www/images/general_mail.gif | Bin 0 -> 128 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 www/images/general_mail.gif diff --git a/www/images/general_mail.gif b/www/images/general_mail.gif new file mode 100644 index 0000000000000000000000000000000000000000..a23aba71031947f6ceb48f817e85f157aa6fdce3 GIT binary patch literal 128 zcmZ?wbhEHblwgoxn8?8J|Ns9@2QM-hrvVv?KUr8s7?>G!7=QpI&%hKor+?+?xBQFe zeCh1oeC$;lf7?S=6{mu(SDI5iX04KcBUh+%Z)@Y@&pV`lRP9s{Y-5_`uwDA{kIAml g-t&7>w|IFj>opgaVL0|=)65vp)z{xRGcs5M0Nv&`RsaA1 literal 0 HcmV?d00001 -- 2.43.0 From 45b46e38b2dc4c363652de641b4fa8020c25d110 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C3=ADas=20Sklar?= Date: Mon, 27 Oct 2003 17:36:01 +0000 Subject: [PATCH 10/16] =?utf8?q?-=20Agrego=20algunas=20imagenes=20generale?= =?utf8?q?s=20para=20el=20men=C3=BA=20horizontal.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- www/images/general_buscador.gif | Bin 0 -> 509 bytes www/images/general_buscador_f2.gif | Bin 0 -> 520 bytes www/images/general_buscador_f3.gif | Bin 0 -> 535 bytes www/images/general_vista_gral.gif | Bin 0 -> 600 bytes www/images/general_vista_gral_f2.gif | Bin 0 -> 600 bytes www/images/general_vista_gral_f3.gif | Bin 0 -> 626 bytes 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 www/images/general_buscador.gif create mode 100644 www/images/general_buscador_f2.gif create mode 100644 www/images/general_buscador_f3.gif create mode 100644 www/images/general_vista_gral.gif create mode 100644 www/images/general_vista_gral_f2.gif create mode 100644 www/images/general_vista_gral_f3.gif diff --git a/www/images/general_buscador.gif b/www/images/general_buscador.gif new file mode 100644 index 0000000000000000000000000000000000000000..a12c7d30b2c13bdcae5db10ac1d4bda166fa21fa GIT binary patch literal 509 zcmZ?wbhEHbtYDB}IKsg2|Ns9VKYl!Y`t=$tRv%hb5wea-v-2No1~=t$KwGixSfTg^9N^<-EZ zwSLKQk<)LlZBbrT?i1JOn)F)fP@loEKIfYyYD-r4vNKJbVX{Y%qgb`HJb<@ei9?Wu zja#{sGlx@|M^K=Mg`I!;OjbTY-bSTtfhHF2N%`Te5gkgb{Po?+V!fiAoT6U5!W=xJ ztgNCu9K0e*f>i=yO?x@HMVkcoEe~58&MS6XY&XjmrETmYQ@mJ2o^c+U(z}iAgpx?p zizQKlZz67ltyh|MzvrQg#fpH3j*Lv(ygD{H92B!)S}gRhIivULw46>RJD(Lx&d*Nh zlKIJ1k#MMEqC#Mm4Ra-gZ!B-xVZ0#Z>TejX3*C)yE}kZ)a!TKh=7vY~5YS q(s!@6DmETzWVL4Imh;)M;o;#9VePmxH$Jd*Rx5kYdt=7JU=09Z^uCt> literal 0 HcmV?d00001 diff --git a/www/images/general_buscador_f2.gif b/www/images/general_buscador_f2.gif new file mode 100644 index 0000000000000000000000000000000000000000..8879a3e843ca2b7134ed19127d0aa5e23649f29f GIT binary patch literal 520 zcmZ?wbhEHbtYDB}IKsg2|NsAwA3vTsb7uYe^)qMA?C$PvZf>rrsVOclPD@LRi;D{j z3-j^uadvjLwzf7lHda$pQ&3Qlk&zJ=7UtySWME+U$H)XEaRJ4jEUY37VhlPU1t2>a zSpP3j=u63*m$7PH&g*>zI_FFFGBvJ!zsE*o2}7cXj#U4NB}FH5tmdC`;q+P?wLW5L z@~pR2`|s&;`smG`{OID$1r0kCyGu6~PB6Z_$nmIv4Gm zo+44QdO;?KBbWQyqTTKZ8m$hj3KhyXUN=N!x9-s^dR5f3aC^Z;hhFdN6OQhxczfsU x>Fqr87;BlQcRDZyoj=?mtQ~h|$HvFUCn$TT=`3{WKRv@Z``($In>z&=$tRv8+B#z`(EPITzIyPpzBb z%fjC`+fQt+CIJ}JC`U6izpX6j}Nn8r-0a`a~zzalLXIiFWOtoBlbq@H1iSP zV{F1p&M*sq=eWFN?lIPzA3RUFzi!-CS9j^;&#Om7Z2UgWGFcJukg<{R*n$(A3=T%v zs*4Q>KD%kxd$#W3E7=}lzA-NntO#x&=ReQa}P2GXj>==9K7q2#&&Dk+`n!ikPXRh)-JUp4>t=$tRv%hb5wea-v-2No1~=t$KwGixSfTg^9N^<-EZ zwSLKQk<)LlZBbrT?i1JO`bfgX(#wR8FN86$PgiVd3BWwa58 zh%%cfD_aE%yMSOjo1kC`3(uT(HC{n}&UxH|0`oXHmhiJGam<*?#>t;Of1y&BaaE0h z$UNRC4nZXm9u8sd*>hQVg*iCSs9szr*3Ki$$thaGd-8M?yD0bRb`CL~itAV2E;8D0 z!jmAxWiEjf0;aISyX))g8=JH5pWD0pE2s9%Zh3#X3JwNq07G!vSpWb4 literal 0 HcmV?d00001 diff --git a/www/images/general_vista_gral_f2.gif b/www/images/general_vista_gral_f2.gif new file mode 100644 index 0000000000000000000000000000000000000000..cf3d0a64b4889eb6ba459f3b64cf48abedf66989 GIT binary patch literal 600 zcmZ?wbhEHbtYDB}IKsg2|NsAwA3vTsb7uYe^)qMA?C$PvZf>rrsVOclPD@J*3k&n{ z@o{!`wzjr5Ha1pMQ&Uh-kdcuQ78d5@npDe5*45AD=AT=O68Cd@> zQ0Pm^oR_g`UC!%$1v=+T_A)iDeZR*>WC=r}hmKVLi6uoRbFAi{a^dt^8?`^5cm5q}(XZ}LxuG*eZp?TcAEFApK zLR=hzoU`Y$a0_y9o^iXlPNbdd45x4@_sP>o*oBu1wsVMZ)nC6-xi_quDT3<=i%`ok z=ckkREaJ%JFcENdaXQfWo#|dvn*aQjifnSa%1i|uP8Fd~5<6X925wAd5%O5@pdnzr zx3cP00U4*p4ka#wM7h^X-#hxukndcuWP#8vFD7 z3z4Y~_Op(+IT=;0e|c$nKvUd8H^s1X9xWmou?p;2`#9~Tdz!Tc!Wh}xH?;LU_%dT( zZT{zfJikwOu`J!>P`3EP0^TOhBVz6ovY+Vr?+KGW(6aT)izd#V&y75sRYryz{EsMY zQaX{e^lEI#;WnY%h^sfdk3CrT$*u9`-F+p@@_aSt86KS|bXG|8UibO=g~i_U{r2wq a`ufIZ|9*#s?cd)&INUAof6s-3!5RRjjo&Z; literal 0 HcmV?d00001 diff --git a/www/images/general_vista_gral_f3.gif b/www/images/general_vista_gral_f3.gif new file mode 100644 index 0000000000000000000000000000000000000000..83c853dadba2fd2048da2b7c74473394cbd56098 GIT binary patch literal 626 zcmV-&0*(DgNk%w1VR!%-0K@BVhtPBqW2N6vZ3I`GisjCAF z5(fy|P~f~4l?oCF2o-`1*xJ(u6$#pv2Nnv3=HvXZV48_hFm1pDN!6Ov3#AO!0X+jA z0K5iKqCtoWrbz>4?ZGf6+MGOWVsTkOO<_Lo5kSx>;eZ4aEI^R7tW?Yi69-sug2{qU zpVpQojPTPZHET_5TEO`&rxt-?AY^QG)DtNP5Sm_7pvR=bUjrIc0@Z}TFQL{TAaJ6` zr9rM*y?TKfW}F4E2|r0vkd?uo0TmEd$f<+W;E28mK&XWFrG&25+yu`Sa-0t6$H)z5Dm*0|2l=zrOwZ M`19-Ek0JyBJE Date: Mon, 27 Oct 2003 23:02:41 +0000 Subject: [PATCH 11/16] Se acepta en addSubtitle() un MECON_HTML_Link para poner caminito. --- lib/MECON/Marco.php | 9 ++++++++- www/css/marco.css | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/MECON/Marco.php b/lib/MECON/Marco.php index 9797f2b..6c35e69 100644 --- a/lib/MECON/Marco.php +++ b/lib/MECON/Marco.php @@ -297,7 +297,14 @@ Si es un objeto debe tener un metodo toHtml y opcionalmente puede tener un getCS */ function addSubTitle($subtitulo) // ~X2C { - $this->_configuracion['subtitulo'].= ' - '.$subtitulo; + if (is_a($subtitulo, 'mecon_html_link')) { + $subtitulo->updateAttributes( + array('class' => 'mecon_marco_subtitle')); + } + if (method_exists($subtitulo, 'tohtml')) { + $subtitulo = $subtitulo->toHtml(); + } + $this->_configuracion['subtitulo'] .= ' - ' . $subtitulo; } // -X2C diff --git a/www/css/marco.css b/www/css/marco.css index b095736..64ebe33 100644 --- a/www/css/marco.css +++ b/www/css/marco.css @@ -36,6 +36,12 @@ IMG vertical-align: middle; } +A.mecon_marco_subtitle { + font-family: Arial, Helvetica, sans-serif; + font-size: 12pt; + color: #336699; +} + /* ESTOS ESTILOS ESTAN DEPRECATED .body_general { -- 2.43.0 From 5fc4d2c060a308c91604bfec802ef67cbcd862e3 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 27 Oct 2003 23:03:38 +0000 Subject: [PATCH 12/16] Se agrega nuevo id a addLink(): buscar. --- lib/MECON/HTML/Tabla.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/MECON/HTML/Tabla.php b/lib/MECON/HTML/Tabla.php index 4c8ab0a..b4a7551 100644 --- a/lib/MECON/HTML/Tabla.php +++ b/lib/MECON/HTML/Tabla.php @@ -397,7 +397,7 @@ class MECON_HTML_Tabla extends HTML_Table { * @endcode * * @param string $id Identificador del link predefinido. Puede ser 'volver', - * 'nuevo', 'nuevos', 'anterior' y 'siguiente'. + * 'nuevo', 'nuevos', 'buscar', 'anterior' y 'siguiente'. * @param MECON_HTML_Link $link Link a usar. Si no tiene contenidos, se pone * uno por defecto. Si es null, se pone como * link la página actual. @@ -429,6 +429,15 @@ class MECON_HTML_Tabla extends HTML_Table { $link->addContents($img); $this->updateCabecera($link, 'derecha'); break; + case 'buscar': + $img = new MECON_HTML_Image('/MECON/images/general_lupa', 'Q'); + // Si no tiene titulo, le pone titulo por defecto. + if (!$link->getContents()) { + $link->setContents('Buscar'); + } + $link->addContents($img); + $this->updateCabecera($link, 'derecha'); + break; case 'siguiente': $img = new MECON_HTML_Image('/MECON/images/general_posterior', '-<'); // Si no tiene titulo, le pone titulo por defecto. -- 2.43.0 From 53dea79e14a592c07d0211cb7a7d93949c231fe1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mart=C3=ADn=20Marrese?= Date: Tue, 28 Oct 2003 22:33:40 +0000 Subject: [PATCH 13/16] MECON_PDF en proceso de desarrollo --- lib/MECON/PDF.php | 260 ++++ lib/MECON/PDF/Marco.php | 314 ++++ lib/MECON/PDF/Marco/medidas.php | 112 ++ lib/MECON/PDF/Tabla.php | 48 + lib/MECON/PDF/external/chart.class.php | 130 ++ lib/MECON/PDF/external/phppdflib.class.php | 1517 ++++++++++++++++++++ lib/MECON/PDF/external/strlen.inc.php | 290 ++++ lib/MECON/PDF/external/template.class.php | 222 +++ test/PDF/downs/down | 2 + test/PDF/downs/prueba_pdf.pdf | Bin 0 -> 3241 bytes test/PDF/prueba_pdf.php | 21 + www/images/pdf_logo.gif | Bin 0 -> 3214 bytes www/images/pdf_logo.jpg | Bin 0 -> 1815 bytes www/images/pdf_logo.png | Bin 0 -> 2429 bytes 14 files changed, 2916 insertions(+) create mode 100644 lib/MECON/PDF.php create mode 100644 lib/MECON/PDF/Marco.php create mode 100644 lib/MECON/PDF/Marco/medidas.php create mode 100644 lib/MECON/PDF/Tabla.php create mode 100755 lib/MECON/PDF/external/chart.class.php create mode 100755 lib/MECON/PDF/external/phppdflib.class.php create mode 100755 lib/MECON/PDF/external/strlen.inc.php create mode 100755 lib/MECON/PDF/external/template.class.php create mode 100755 test/PDF/downs/down create mode 100644 test/PDF/downs/prueba_pdf.pdf create mode 100755 test/PDF/prueba_pdf.php create mode 100644 www/images/pdf_logo.gif create mode 100644 www/images/pdf_logo.jpg create mode 100644 www/images/pdf_logo.png diff --git a/lib/MECON/PDF.php b/lib/MECON/PDF.php new file mode 100644 index 0000000..08250ec --- /dev/null +++ b/lib/MECON/PDF.php @@ -0,0 +1,260 @@ + +------------------------------------------------------------------------------- +$Id$ +-----------------------------------------------------------------------------*/ + +require_once 'MECON/PDF/external/phppdflib.class.php'; + +/** + * Liberia base para el manejo de pdf's. + */ +class MECON_PDF { + + /** + * Libreria externa. + * @var int $pdf + * @access private + */ + var $_pdf; + + /** + * Identificacion de la pagina actual + * @var int $pagina_actual + * @access private + */ + var $_pagina_actual; + + /** + * Array de paginas. + * @var array $paginas + * @access private + */ + var $_paginas; + + /** + * Class constructor. + * + * @return void + * @access public + */ + function MECON_PDF() + { + $this->_pdf = new pdffile; + } + + /** + * Permite agregar nuevas paginas al pdf que se esta armando. + * + * @param string $pagina Tipo de pagina que se va a utilizar. + * + * @return void + * @access public + */ + function newPage($pagina = "a4") + { + $this->_pagina_actual = $this->_pdf->new_page($pagina); + $this->_paginas[] = $this->_pagina_actual; + } + + /** + * Funcion que genera el archivo y prepara los headers para que se envie. + * + * @return void + * @access public + */ + function display() + { + header("Content-Disposition: filename=Doc.pdf"); + header("Content-Type: application/pdf"); + $temp = $this->toPDF(); + header('Content-Length: ' . strlen($temp)); + echo $temp; + } + + /** + * Funcion que devuelve el PDF. + * + * @return string + * @access public + */ + function toPDF() { + return $this->_pdf->generate(); + } + + /** + * Funcion que permite agregar texto a una pagina. + * + * @param int $X $X + * @param int $Y $Y + * @param string $texto $texto + * @param int $estilo $estilo + * @param int $pag Numero de pagina virtual. + * + * @return void + * @access public + */ + function addText($X, $Y, $texto, $estilo = '', $pag = null) + { + $this->_pdf->draw_text($X, $Y, $texto, $this->refPage($pag), $estilo); + } + + /** + * Funcion que permite agregar un rectangulo a una pagina. + * + * @param int $Xi $Xi + * @param int $Yi $Yi + * @param int $Xf $Xf + * @param int $Yf $Yf + * @param long $estilo $estilo + * @param int $pag Numero de pagina virtual. + * + * @return void + * @access public + */ + function addRectangle($Xi, $Yi, $Xf, $Yf, $estilo = '', $pag = null) + { + $this->_pdf->draw_rectangle($Xi, $Yi, $Xf, $Yf, $this->refPage($pag), $estilo); + } + + /** + * Funcion que permite agregar una linea a una pagina. + * + * @param int $Xi $Xi + * @param int $Yi $Yi + * @param int $Xf $Xf + * @param int $Yf $Yf + * @param int $estilo $estilo + * @param int $pag Numero de pagina virtual. + * + * @return void + * @access public + */ + function addLine($Xi, $Yi, $Xf, $Yf, $estilo = '', $pag = null) + { + $this->_pdf->draw_line(array($Xi,$Xf),array($Yi,$Yf), + $this->refPage($pag),$estilo); + } + + /** + * Funcion que permite agregar una imagen JPG a una pagina. + * + * @param string $archivo Path completo del archivo imagen. + * @param int $X Posicion Horizontal. + * @param int $Y Posixion vertical. + * @param int $pag Numero de pagina virtual. + * @param string $formato Formato del archivo (Extension). + * + * @return void + * @access public + */ + function addImage($archivo, $X, $Y, $pag = null, $formato = null) { + $formato = strtolower($formato); + switch ($formato) { + case 'jpg': + $fh = fopen($archivo, "r"); + $filedata = fread($fh, filesize($archivo)); + fclose($fh); + $image = $this->_pdf->jfif_embed($filedata); + $this->_pdf->image_place($image, $Y, $X, + $this->refPage($pag)); + break; + } + } + + /** + * Funcion que wrappea una linea. + * + * @param strgin $texto Texto que quiere wrappearse. + * @param int $l_max Largo maximo del texto. + * @param array $attr Atributos del texto. + * + * @return string + * @access public + */ + function wrapLine($texto, $l_max, $attr) { + return $this->_pdf->wrap_line ($texto, $l_max, $attr); + } + + /** + * Funcion que calcula cuanto va a ocupar cierto texto segun su formato en + * una pagina. + * + * @param strgin $texto Texto que quiere medirse. + * @param array $attr Atributos del texto. + * + * @return int + * @access public + */ + function strlen($texto, $attr = '') { + return $this->_pdf->strlen($texto, $attr); + } + + /** + * Funcion que devuelve la cantidad de paginas que contiene el documento. + * + * @return int + * @access public + */ + function countPages() { + return count($this->_paginas); + } + + /** + * Funcion que devuelve el numero de la pagina actual. + * + * @param mixed $id Identificador de la pagina. + * + * @return int + * @access public + */ + function numPage($id = null) { + $id = ($id) ? $id : $this->_pagina_actual; + return (array_search($id, $this->_paginas)) + 1; + } + + /** + * Funcion que devuelve la referencia de una pagina vitual. Si no se pasa + * nada utilizo la actual. + * + * @param int $pag Numero de pagina. + * + * @return int + * @access public + */ + function refPage($pag = null) { + return $pag ? $this->_paginas[$pag - 1] : + $this->_pagina_actual; + } + + /** + * Funcion que devuelve el array de paginas + * + * @return array + * @access public + */ + function getPages() { + return $this->_paginas; + } +} +?> \ No newline at end of file diff --git a/lib/MECON/PDF/Marco.php b/lib/MECON/PDF/Marco.php new file mode 100644 index 0000000..8d70976 --- /dev/null +++ b/lib/MECON/PDF/Marco.php @@ -0,0 +1,314 @@ + +------------------------------------------------------------------------------- +$Id$ +-----------------------------------------------------------------------------*/ + +require_once 'MECON/PDF.php'; +require_once 'MECON/HTML/Tabla.php'; + +/** + * Libreria que crea un marco estandar para los pdfs. + */ +class MECON_PDF_Marco extends MECON_HTML_Tabla { + + /** + * Objeto MECON_PDF + * @var Object MECON_PDF + * @access protected + */ + var $_pdf; + + /** + * Archivo de configuracion de medidas + * @var array $conf + * @access protected + */ + var $_conf = array (); + + /** + * Tamanio de las paginas. + * @var string $tamanio + * @access protected + */ + var $_tamanio = "a4"; + + /** + * Orientacion (portrait o landscape). + * @var sting $orientacion + * @access protected + */ + var $_orientacion = "portrait"; + + /** + * Logo. + * @var string $logo + * @access public + */ + var $logo = '/home/mmarrese/public_html/meconlib/www/images/pdf_logo.jpg'; + //@FIXME Ponener el path del logo por defecto + + /** + * Paginador. + * @var bool $paginador + * @access public + */ + var $paginador = true; + + /** + * Fecha. Si es true se pone la fecha del servidor, si es false no se pone + * nada, en caso contrario se pone lo que haya en esta variable. + * @var mixed $fecha + * @access public + */ + var $fecha = true; + + /** + * Seccion. + * @var string $seccion + * @access public + */ + var $seccion = ''; + + /** + * SubSeccion. + * @var string $subseccion + * @access public + */ + var $subseccion = 'Ministerio de Economia'; + + /** + * Titulo. + * @var string $string + * @access public + */ + var $titulo = true; + + /** + * SubTitulo. + * @var string $subtitulo + * @access public + */ + var $subtitulo = true; + + /** + * Class constructor. + * + * @param string $tam Tamanio de las hojas. + * @param string $ori Orientacion de las hojaz (portrait o landscape). + * + * @return void + * @access public + */ + function MECON_PDF_Marco($tam = "a4", $ori = "portrait") { + $this->_pdf =& new MECON_PDF; + $this->_tamanio = $tam; + $this->_orientacion = $ori; + $this->_conf = include 'MECON/PDF/Marco/medidas.php' ; + $this->_conf = $this->_conf[$tam][$ori]; + } + + /** + * Funcion que agrega el logo al encabezado de una pagina. + * + * @return void + * @access protected + */ + function _addLogo() { + $conf = $this->_conf['encabezado']; + if ($this->logo) { + $this->_pdf->addImage($this->logo, $conf['logo']['X'], + $conf['logo']['Y'], null, 'jpg'); + } + } + + /** + * Funcion que agrega la seccion al encabezado de una pagina. + * + * @return void + * @access protected + */ + function _addSeccion() { + $conf = $this->_conf['encabezado']; + if ($this->seccion) { + $tmp = $this->_pdf->strlen($this->seccion, $conf['seccion']); + $tmp2 = $conf['linea2']['Xi'] - $conf['linea1']['Xi']; + if ($tmp >= $tmp2) { + $this->seccion = $this->_pdf->wrapLine ($this->seccion, $tmp2, + $conf['seccion']); + $tmp = $this->_pdf->strlen($this->seccion, $conf['seccion']); + } + $init = $conf['linea1']['Xi'] + ( $conf['linea2']['Xi'] + - $conf['linea1']['Xi'] - $tmp) / 2; + $this->_pdf->addText($init, $conf['seccion']['Y'], $this->seccion, $conf['seccion']); + } + } + + /** + * Funcion que agrega la subseccion al encabezado de una pagina. + * + * @return void + * @access protected + */ + function _addSubSeccion() { + $conf = $this->_conf['encabezado']; + if ($this->subseccion) { + $tmp = $this->_pdf->strlen($this->subseccion, $conf['subseccion']); + $tmp2 = $conf['linea2']['Xi'] - $conf['linea1']['Xi']; + if ($tmp >= $tmp2) { + $this->subseccion = $this->_pdf->wrapLine ($this->subseccion, $tmp2, + $conf['subseccion']); + $tmp = $this->_pdf->strlen($this->subseccion, $conf['subseccion']); + } + $init = $conf['linea1']['Xi'] + ( $conf['linea2']['Xi'] + - $conf['linea1']['Xi'] - $tmp) / 2; + $this->_pdf->addText($init, $conf['subseccion']['Y'], $this->subseccion, + $conf['subseccion']); + } + } + + /** + * Funcion que agrega el paginador al encabezado de una pagina. + * + * @return void + * @access protected + */ + function _addPager() { + $conf = $this->_conf['encabezado']; + if ($this->paginador) { + $txt = 'Pagina '.$this->_pdf->numPage().' de '. + $this->_pdf->countPages(); + $tmp = $this->_pdf->strlen($txt, $conf['paginador']); + $init = $conf['linea2']['Xi'] + ( $conf['Xf'] + - $conf['linea2']['Xi'] - $tmp) / 2; + $this->_pdf->addText($init, $conf['paginador']['Y'], $txt, + $conf['paginador']); + } + } + + /** + * Funcion que permite agregar la fecha al encabezado de una pagina. + * + * @return void + * @access protected + */ + function _addDate() { + $conf = $this->_conf['encabezado']; + if ($this->fecha) { + if ($this->fecha === true) { + $this->fecha = date("d/m/Y"); + } + $tmp = $this->_pdf->strlen($this->fecha, $conf['fecha']); + $init = $conf['linea2']['Xi'] + ( $conf['Xf'] + - $conf['linea2']['Xi'] - $tmp) / 2; + $this->_pdf->addText($init, $conf['fecha']['Y'], $this->fecha, + $conf['fecha']); + } + } + + /** + * Funcion que arma el recuadro del encabezado de las paginas. + * + * @return void + * @access protected + */ + function _addHeaderRectangle() { + $conf = $this->_conf['encabezado']; + //Armo el recuadro + $this->_pdf->addRectangle ($conf['Yi'], $conf['Xi'], $conf['Yf'], + $conf['Xf']); + $this->_pdf->addLine($conf['linea1']['Xi'], $conf['linea1']['Yi'], + $conf['linea1']['Xf'], $conf['linea1']['Yf']); + $this->_pdf->addLine($conf['linea2']['Xi'], $conf['linea2']['Yi'], + $conf['linea2']['Xf'], $conf['linea2']['Yf']); + } + + /** + * Funcion que permite agregar el titulo a una pagina. + * + * @return void + * @access protected + */ + function _addTitle() { + $conf = $this->_conf['titulo']; + if ($this->titulo) { + $tmp = $this->_pdf->strlen($this->titulo, $conf); + $tmp2 = $this->_conf['Xf'] + abs($this->_conf['Xi']); + if ($tmp >= $tmp2) { + $this->titulo = $this->_pdf->wrapLine ($this->titulo, $tmp2, + $conf); + $tmp = $this->_pdf->strlen($this->titulo, $conf); + } + $init = $this->_conf['Xi'] + ($tmp2 - $tmp) / 2; + $this->_pdf->addText($init, $conf['Y'], $this->titulo, + $conf); + } + } + + /** + * Funcion que permite agregar el subtitulo a una pagina. + * + * @return void + * @access protected + */ + function _addSubTitle() { + $conf = $this->_conf['subtitulo']; + if ($this->subtitulo) { + $tmp = $this->_pdf->strlen($this->subtitulo, $conf); + $tmp2 = $this->_conf['Xf'] + abs($this->_conf['Xi']); + if ($tmp >= $tmp2) { + $this->subtitulo = $this->_pdf->wrapLine ($this->subtitulo, $tmp2, + $conf); + $tmp = $this->_pdf->strlen($this->subtitulo, $conf); + } + $init = $this->_conf['Xi'] + ($tmp2 - $tmp) / 2; + $this->_pdf->addText($init, $conf['Y'], $this->subtitulo, + $conf); + } + } + + /** + * Funcion que agrega la informacion del marco a la pagina actual. + * + * @param bool $title Muetra o no el titulo. + * @param bool $subtitle Muestra o no el subtitulo. + * + * @return void + * @access public + */ + function buildPage($title = true, $subtitle = true) { + $this->_addLogo(); + $this->_addSeccion(); + $this->_addSubseccion(); + $this->_addPager(); + $this->_addDate(); + $this->_addHeaderRectangle(); + if ($title) { + $this->_addTitle(); + } + if ($subtitle) { + $this->_addSubTitle(); + } + } +} +?> \ No newline at end of file diff --git a/lib/MECON/PDF/Marco/medidas.php b/lib/MECON/PDF/Marco/medidas.php new file mode 100644 index 0000000..1dbb57c --- /dev/null +++ b/lib/MECON/PDF/Marco/medidas.php @@ -0,0 +1,112 @@ + +------------------------------------------------------------------------------- +$Id$ +-----------------------------------------------------------------------------*/ + +/** + * Medidas para cada formato de pagina. + */ + +return array ( + // A4 {{{ + 'a4' => array ( + //Portrait {{{ + 'portrait' => array ( + 'Xi' => -40, //Esquina inferior izquierda + 'Xf' => 490, //Esquina inferior derecha + 'Yi' => -110, //Esquina inferior izquierda + 'Yf' => 700, //Esquina superior izquierda + //Encabezado {{{ + 'encabezado' => array ( //Encabezado de cada pagina + 'Xi' => -40, + 'Xf' => 490, + 'Yi' => 657, + 'Yf' => 700, + 'logo' => array ( + 'X' => -33, + 'Y' => 665, + ), + 'linea1' => array ( + 'Xi' => 110, + 'Xf' => 110, + 'Yi' => 657, + 'Yf' => 700, + ), + 'linea2' => array ( + 'Xi' => 404, + 'Xf' => 404, + 'Yi' => 657, + 'Yf' => 700, + ), + 'linea3' => array ( + 'Xi' => -40, + 'Xf' => 110, + 'Yi' => 657, + 'Yf' => 666, + ), + 'seccion' => array ( + 'Y' => 685, + 'font' => 'Helvetica-Bold', + 'height' => 12, + ), + 'subseccion' => array ( + 'Y' => 664, + 'font' => 'Helvetica', + 'height' => 12, + ), + 'paginador' => array ( + 'Y' => 685, + 'font' => 'Helvetica', + 'height' => 9, + ), + 'fecha' => array ( + 'Y' => 664, + 'font' => 'Helvetica', + 'height' => 9, + ), + ), + //}}} + //Titulos {{{ + 'titulo' => array ( + 'Y' => 630, + 'font' => 'Helvetica-Bold', + 'height' => 16, + ), + 'subtitulo' => array ( + 'Y' => 615, + 'font' => 'Helvetica', + 'height' => 13 + ), + //}}} + ), + //}}} + //LandScape {{{ + 'landscape' => array ( + ), + //}}} + ), + //}}} + ); + +?> diff --git a/lib/MECON/PDF/Tabla.php b/lib/MECON/PDF/Tabla.php new file mode 100644 index 0000000..cd1d7d4 --- /dev/null +++ b/lib/MECON/PDF/Tabla.php @@ -0,0 +1,48 @@ + +------------------------------------------------------------------------------- +$Id$ +-----------------------------------------------------------------------------*/ + +require_once 'MECON/PDF/Marco.php'; + +/** + * Libreria que permite agregar una tabla a un pdf. + */ +class MECON_PDF_Tabla extends MECON_PDF_Marco { + + /** + * Funcion que envia el archivo a pantalla (para que el usuario haga un + * download) + * + * @return string + * @access public + */ + function display() { + $this->_pdf->newPage($this->_tamanio); + $this->buildPage(); + $this->_pdf->display(); + } + +} +?> \ No newline at end of file diff --git a/lib/MECON/PDF/external/chart.class.php b/lib/MECON/PDF/external/chart.class.php new file mode 100755 index 0000000..f867bf5 --- /dev/null +++ b/lib/MECON/PDF/external/chart.class.php @@ -0,0 +1,130 @@ +clearchart(); + } + + function clearchart() + { + // Default colors + unset($this->colors); + // This oughta make things more readible + $white['red'] = $white['green'] = $white['blue'] = 1; + $black['red'] = $black['green'] = $black['blue'] = 0; + $this->colors['background'] = $white; + $this->colors['border'] = $black; + $this->colors['hlabel'] = $black; + $this->colors['vlabel'] = $black; + $this->colors['vgrade'] = $black; + $this->colors['hgrade'] = $black; + unset($this->series); + } + + /* Set up default colors to use globally on the chart + */ + function setcolor($name, $red, $green, $blue) + { + $this->colors[$name]['red'] = $red; + $this->colors[$name]['green'] = $green; + $this->colors[$name]['blue'] = $blue; + } + + function add_series($name, $points, $color = 'black', $width = 1, $style = 'default') + { + $t['points'] = $points; + $t['color'] = $color; + $t['width'] = $width; + $t['style'] = $style; + $this->series[$name] = $t; + } + + function place_chart($page, $left, $bottom, $width, $height, $type = 'line') + { + switch (strtolower($type)) { + case 'pie' : + case '3dpie' : + case 'bar' : + case '3dbar' : + case '3dline' : + case 'line' : + default : + $this->_place_line_chart($page, $left, $bottom, $width, $height); + } + } + + function _place_line_chart($page, $left, $bottom, $width, $height) + { + // First a filled rectangle to set background color + $this->_fill_background($page, $left, $bottom, $width, $height); + // caclulate a scale + $low = $high = $numx = 0; + foreach($this->series as $data) { + foreach($data['points'] as $value) { + if ($value < $low) $low = $value; + if ($value > $high) $high = $value; + } + if (count($data['points']) > $numx) $numx = count($data); + } + if (($high - $low) <= 0) return false; + $xscale = $width / $numx; + $yscale = $height / ($high - $low); + foreach($this->series as $data) { + $a['strokecolor'] = $this->pdf->get_color($data['color']); + $a['width'] = $data['width']; + $c = 0; + unset($x); + unset($y); + foreach ($data['points'] as $value) { + $x[$c] = ($c * $xscale) + $left; + //echo $x[$c] . " "; + $y[$c] = (($value - $low) * $yscale) + $bottom; + //echo $y[$c] . "
    \n"; + $c++; + } + $this->pdf->draw_line($x, $y, $page, $a); + } + } + + function _fill_background($page, $left, $bottom, $width, $height) + { + $a['fillcolor'] = $this->colors['background']; + $a['mode'] = 'fill'; + $this->pdf->draw_rectangle($bottom + $height, + $left, + $bottom, + $left + $width, + $page, + $a); + } +} + +?> diff --git a/lib/MECON/PDF/external/phppdflib.class.php b/lib/MECON/PDF/external/phppdflib.class.php new file mode 100755 index 0000000..3b4f360 --- /dev/null +++ b/lib/MECON/PDF/external/phppdflib.class.php @@ -0,0 +1,1517 @@ +generate() + * is called. + * The layout of ->objects does not directly + * mimic the pdf format, although it is similar. + * nextoid always holds the next available oid ( oid is short for object id ) + */ + var $objects, $nextoid; + + /* xreftable is an array containing data to + * create the xref section (PDF calls it a referance table) + */ + var $xreftable, $nextobj; + + /* These arrays allow quick translation between + * pdflib OIDs and the final PDF OIDs (OID stands for object ids) + */ + var $libtopdf, $pdftolib; + + // Errors + var $ermsg = array(), $erno = array(); + + var $builddata; // Various data required during the pdf build + var $nextpage; // Tracks the next page number + var $widths, $needsset; // Store the font width arrays here + var $default; // Default values for objects + var $x, $chart, $template; // extension class is instantiated here if requested + /* Constructor function: is automatically called when the + * object is created. Used to set up the environment + */ + function pdffile() + { + /* Per spec, obj 0 should always have a generation + * number of 65535 and is always free + */ + $this->xreftable[0]["gennum"] = 65535; + $this->xreftable[0]["offset"] = 0; + $this->xreftable[0]["free"] = "f"; + + // Object #1 will always be the Document Catalog + $this->xreftable[1]["gennum"] = 0; + $this->xreftable[1]["free"] = "n"; + + // Object #2 will always be the root pagenode + $this->xreftable[2]["gennum"] = 0; + $this->xreftable[2]["free"] = "n"; + $this->pdftolib[2] = 1; + $this->libtopdf[1] = 2; + + // Object #3 is always the resource library + $this->xreftable[3]["gennum"] = 0; + $this->xreftable[3]["free"] = "n"; + + /* nextoid starts at 2 because all + * drawing functions return either the + * object ID or FALSE on error, so we can't + * return an OID of 0, because it equates + * to false and error checking would think + * the procedure failed + */ + $this->nextoid = 2; + $this->nextobj = 3; + + // Pages start at 0 + $this->nextpage = 0; + + // Font width tables are not set unless they are needed + $this->needsset = true; + + // Set all the default values + $t['pagesize'] = 'letter'; + $t['font'] = 'Helvetica'; + $t['height'] = 12; + $t['align'] = 'left'; + $t['width'] = 1; + $t['rotation'] = 0; + $t['scale'] = 1; + $t['strokecolor'] = $this->get_color('black'); + $t['fillcolor'] = $this->get_color('black'); + $t['margin-left'] = $t['margin-right'] = $t['margin-top'] = $t['margin-bottom'] =72; + $t['tmode'] = 0; // Text: fill + $t['smode'] = 1; // Shapes: stroke + $this->default = $t; + } + +/****************************************************** + * These functions are the public ones, they are the * + * way that the user will actually enter the data * + * that will become the pdf * + ******************************************************/ + + function set_default($setting, $value) + { + switch ($setting) { + case 'margin' : + $this->default['margin-left'] = $value; + $this->default['margin-right'] = $value; + $this->default['margin-top'] = $value; + $this->default['margin-bottom'] = $value; + break; + + case 'mode' : + $this->default['tmode'] = $this->default['smode'] = $value; + break; + + default : + $this->default[$setting] = $value; + } + return true; + } + + function draw_rectangle($top, $left, $bottom, $right, $parent, $attrib = array()) + { + if ($this->objects[$parent]["type"] != "page") { + $this->_push_std_error(6001); + return false; + } + $o = $this->_addnewoid(); + $attrib = $this->_resolve_param($attrib, false); + $this->_resolve_colors($n, $attrib); + $this->objects[$o] = $n; + $this->objects[$o]["width"] = $attrib["width"]; + $this->objects[$o]["type"] = "rectangle"; + $this->_adjust_margin($left, $top, $parent); + $this->_adjust_margin($right, $bottom, $parent); + $this->objects[$o]["top"] = $top; + $this->objects[$o]["left"] = $left; + $this->objects[$o]["bottom"] = $bottom; + $this->objects[$o]["right"] = $right; + $this->objects[$o]["parent"] = $parent; + $this->objects[$o]["mode"] = $this->_resolve_mode($attrib, 'smode'); + return $o; + } + + function draw_circle($x, $y, $r, $parent, $attrib = array()) + { + if ($this->objects[$parent]["type"] != "page") { + $this->_push_std_error(6001); + return false; + } + $o = $this->_addnewoid(); + $attrib = $this->_resolve_param($attrib, false); + $this->_resolve_colors($n, $attrib); + $n['width'] = $attrib['width']; + $this->_adjust_margin($x, $y, $parent); + $n['x'] = $x; + $n['y'] = $y; + $n['radius'] = $r; + $n['type'] = 'circle'; + $n['parent'] = $parent; + $n['mode'] = $this->_resolve_mode($attrib, 'smode'); + $this->objects[$o] = $n; + return $o; + } + + function draw_line($x, $y, $parent, $attrib = array()) + { + if ($this->objects[$parent]["type"] != "page") { + $this->_push_std_error(6001); + return false; + } + if (count($x) != count($y)) { + $this->_push_error(6002, "X & Y variables must have equal number of elements"); + return false; + } + $o = $this->_addnewoid(); + $attrib = $this->_resolve_param($attrib, false); + $this->_resolve_colors($n, $attrib); + $this->objects[$o] = $n; + @$this->objects[$o]["width"] = $attrib["width"]; + $this->objects[$o]['mode'] = $this->_resolve_mode($attrib, 'smode'); + $this->objects[$o]["type"] = "line"; + foreach ($x as $key => $value) { + if (isset($x[$key]) && isset($y[$key])) { + $this->_adjust_margin($x[$key], $y[$key], $parent); + } + } + $this->objects[$o]["x"] = $x; + $this->objects[$o]["y"] = $y; + $this->objects[$o]["parent"] = $parent; + return $o; + } + + // draw text + function draw_text($left, $bottom, $text, $parent, $attrib = array()) + { + if ($this->objects[$parent]["type"] != "page") { + $this->_push_std_error(6001); + return false; + } + $attrib = $this->_resolve_param($attrib); + // Validate the font + if (!($n["font"] = $this->_use_font($attrib))) { + // Couldn't find/add the font + $this->_push_error(6003, "Font was not found"); + return false; + } + if (isset($attrib["rotation"])) { + $n["rotation"] = $attrib["rotation"]; + } + $n['mode'] = $this->_resolve_mode($attrib, 'tmode'); + if (isset($attrib["height"]) && $attrib["height"] > 0) { + $n["height"] = $attrib["height"]; + } + $this->_resolve_colors($n, $attrib); + $n["type"] = "texts"; + $this->_adjust_margin($left, $bottom, $parent); + $n["left"] = $left; + $n["bottom"] = $bottom; + $n["text"] = $text; + $n["parent"] = $parent; + + $o = $this->_addnewoid(); + $this->objects[$o] = $n; + return $o; + } + + function new_page($size = null) + { + if (is_null($size)) { + $size = $this->default['pagesize']; + } + switch ($size) { + case "letter" : + $o = $this->_addnewoid(); + $this->objects[$o]["height"] = 792; + $this->objects[$o]["width"] = 612; + break; + + case "legal" : + $o = $this->_addnewoid(); + $this->objects[$o]["height"] = 1008; + $this->objects[$o]["width"] = 612; + break; + + case "executive" : + $o = $this->_addnewoid(); + $this->objects[$o]["height"] = 720; + $this->objects[$o]["width"] = 540; + break; + + case "tabloid" : + $o = $this->_addnewoid(); + $this->objects[$o]["height"] = 1224; + $this->objects[$o]["width"] = 792; + break; + + case "a3" : + $o = $this->_addnewoid(); + $this->objects[$o]["height"] = 1188; + $this->objects[$o]["width"] = 842; + break; + + case "a4" : + $o = $this->_addnewoid(); + $this->objects[$o]["height"] = 842; + $this->objects[$o]["width"] = 595; + break; + + case "a5" : + $o = $this->_addnewoid(); + $this->objects[$o]["height"] = 598; + $this->objects[$o]["width"] = 418; + break; + + default : + if (preg_match("/in/",$size)) { + $o = $this->_addnewoid(); + $size = substr($size, 0, strlen($size) - 2); + $dims = split("x",$size); + $this->objects[$o]["height"] = ($dims[1] * 72); + $this->objects[$o]["width"] = ($dims[0] * 72); + } else { + if (preg_match("/cm/",$size)) { + $o = $this->_addnewoid(); + $size = substr($size, 0, strlen($size) - 2); + $dims = split("x",$size); + $this->objects[$o]["height"] = ($dims[1] * 28.346); + $this->objects[$o]["width"] = ($dims[0] * 28.346); + } else { + $this->_push_error(6004, "Could not deciper page size description: $size"); + return false; + } + + } + } + $this->objects[$o]['type'] = 'page'; + $this->objects[$o]['parent'] = 1; + $this->objects[$o]['number'] = $this->nextpage; + $this->nextpage ++; + foreach (array('margin-left', 'margin-right', 'margin-top', 'margin-bottom') as $margin) { + $this->objects[$o][$margin] = $this->default[$margin]; + } + return $o; + } + + function swap_pages($p1, $p2) + { + if ($this->objects[$p1]["type"] != "page" || + $this->objects[$p2]["type"] != "page") { + $this->_push_std_error(6001); + return false; + } + $temp = $this->objects[$p1]["number"]; + $this->objects[$p1]["number"] = $this->objects[$p2]["number"]; + $this->objects[$p2]["number"] = $temp; + return true; + } + + function move_page_before($page, $infrontof) + { + if ($this->objects[$page]["type"] != "page" || + $this->objects[$infrontof]["type"] != "page") { + $this->_push_std_error(6001); + return false; + } + if ($page == $infrontof) { + $this->_push_error(6005, "You're trying to swap a page with itself"); + return false; + } + $target = $this->objects[$infrontof]["number"]; + $leaving = $this->objects[$page]["number"]; + foreach ($this->objects as $id => $o) { + if ($o["type"] == "page") { + if ($target < $leaving) { + if ($o["number"] >= $target && $o["number"] < $leaving) { + $this->objects[$id]["number"]++; + } + } else { + if ($o["number"] < $target && $o["number"] > $leaving) { + $this->objects[$id]["number"]--; + } + } + } + } + if ($target < $leaving) { + $this->objects[$page]["number"] = $target; + } else { + $this->objects[$page]["number"] = $target - 1; + } + return true; + } + + function new_font($identifier) + { + $n["type"] = "font"; + + switch ($identifier) { + /* The "standard" Type 1 fonts + * These are "guaranteed" to be available + * to the viewer application and don't + * need embedded + */ + case "Courier": + case "Courier-Bold": + case "Courier-Oblique": + case "Courier-BoldOblique": + case "Helvetica": + case "Helvetica-Bold": + case "Helvetica-Oblique": + case "Helvetica-BoldOblique": + case "Times-Roman": + case "Times-Bold": + case "Times-Italic": + case "Times-BoldItalic": + case "Symbol": + case "ZapfDingbats": + $o = $this->_addnewoid(); + $this->builddata["fonts"][$o] = $identifier; + $n["subtype"] = "Type1"; + $n["basefont"] = $identifier; + break; + + default: + if ($this->objects[$identifier]["type"] != "fontembed") { + $this->_push_error(6006, "Object must be of type 'fontembed'"); + return false; + } else { + // Not ready yet + $this->_push_error(6007, "Feature not implemented yet"); + return false; + } + } + $this->objects[$o] = $n; + return $o; + } + + function generate($clevel = 9) + { + // Validate the compression level + if (!$clevel) { + $this->builddata["compress"] = false; + } else { + if ($clevel < 10) { + $this->builddata["compress"] = $clevel; + } else { + $this->builddata["compress"] = 9; + } + } + /* Preprocess objects to see if they can + * be combined into a single stream + * We scan through each page, and create + * a multistream object out of all viable + * child objects + */ + $temparray = $this->objects; + foreach ($this->objects as $oid => $def) { + if ( $def["type"] == "page" ) { + unset($temp); + $temp['data'] = ""; + reset($temparray); + while ( list ($liboid, $obj) = each($temparray) ) { + if (isset($obj["parent"]) && $obj["parent"] == $oid) { + switch ($obj["type"]) { + case "texts" : + $temp["data"] .= $this->_make_text($liboid); + $this->objects[$liboid]["type"] = "null"; + $this->objects[$liboid]["parent"] = -1; + break; + + case "rectangle" : + $temp["data"] .= $this->_make_rect($liboid); + $this->objects[$liboid]["type"] = "null"; + $this->objects[$liboid]["parent"] = -1; + break; + + case "iplace" : + $temp["data"] .= $this->_place_raw_image($liboid); + $this->objects[$liboid]["type"] = "null"; + $this->objects[$liboid]["parent"] = -1; + break; + + case "line" : + $temp["data"] .= $this->_make_line($liboid); + $this->objects[$liboid]["type"] = "null"; + $this->objects[$liboid]["parent"] = -1; + break; + + case "circle" : + $temp["data"] .= $this->_make_circle($liboid); + $this->objects[$liboid]["type"] = "null"; + $this->objects[$liboid]["parent"] = -1; + break; + } + } + } + if (strlen($temp["data"]) > 0) { + // this line takes the next available oid + $o = $this->_addnewoid(); + $temp["type"] = "mstream"; + $temp["parent"] = $oid; + $this->objects[$o] = $temp; + } + } + } + unset($temparray); + + // Generate a list of PDF object IDs to + // use and map them to phppdflib IDs + foreach ( $this->objects as $oid => $properties ) { + if ( $this->_becomes_object( $properties["type"] ) ) { + $o = $this->_addtoxreftable(0,0); + $this->libtopdf[$oid] = $o; + $this->pdftolib[$o] = $oid; + } + } + + /* First characters represent the version + * of the PDF spec to conform to. + * The PDF spec recommends that the next + * four bytes be a comment containing four + * non-ASCII characters, to convince + * (for example) ftp programs that this is + * a binary file + */ + $os = "%PDF-1.3%\xe2\xe3\xcf\xd3\x0a"; + + // Create the Document Catalog + $carray["Type"] = "/Catalog"; + $carray["Pages"] = "2 0 R"; + $temp = $this->_makedictionary($carray); + $temp = "1 0 obj" . $temp . "endobj\x0a"; + $this->xreftable[1]["offset"] = strlen($os); + $os .= $temp; + + // Create the root page node + unset($carray); + $kids = $this->_order_pages(2); + $this->xreftable[2]["offset"] = strlen($os); + $os .= "2 0 " . $this->_makepagenode($kids, "" ) . "\x0a"; + + /* Create a resource dictionary for the entire + * PDF file. This may not be the most efficient + * way to store it, but it makes the code simple. + * At some point, we should analyze performance + * and see if it's worth splitting the resource + * dictionary up + */ + unset($temp); + unset($carray); + if (isset($this->builddata["fonts"]) && count($this->builddata["fonts"]) > 0) { + foreach ($this->builddata["fonts"] as $id => $base) { + $ta["F$id"] = $this->libtopdf[$id] . " 0 R"; + } + $temp["Font"] = $this->_makedictionary($ta); + } + reset($this->objects); + while (list($id, $obj) = each($this->objects)) { + if ($obj["type"] == "image") { + $xol["Img$id"] = $this->libtopdf[$id] . " 0 R"; + } + } + if ( isset($xol) && count($xol) > 0 ) { + $temp["XObject"] = $this->_makedictionary($xol); + } + $this->xreftable[3]["offset"] = strlen($os); + $os .= "3 0 obj"; + if (isset($temp)) { + $os .= $this->_makedictionary($temp); + } else { + $os .= '<<>>'; + } + $os .= " endobj\x0a"; + + // Go through and add the rest of the objects + foreach ( $this->pdftolib as $pdfoid => $liboid ) { + if ($pdfoid < 4) { + continue; + } + // Set the location of the start + $this->xreftable[$pdfoid]["offset"] = strlen($os); + switch ( $this->objects[$liboid]["type"] ) { + case "page": + $kids = $this->_get_kids($pdfoid); + $os .= $pdfoid . " 0 "; + $os .= $this->_makepage($this->objects[$liboid]["parent"], + $kids, $liboid); + break; + + case "rectangle": + $os .= $pdfoid . " 0 obj"; + $os .= $this->_streamify($this->_make_rect($liboid)); + $os .= " endobj"; + break; + + case "line": + $os .= $pdfoid . " 0 obj"; + $os .= $this->_streamify($this->_make_line($liboid)); + $os .= " endobj"; + break; + + case "circle": + $os .= $pdfoid . " 0 obj"; + $os .= $this->_streamify($this->_make_circle($liboid)); + $os .= " endobj"; + break; + + case "texts": + $os .= $pdfoid . " 0 obj"; + $temp = $this->_make_text($liboid); + $os .= $this->_streamify($temp) . " endobj"; + break; + + case "mstream": + $os .= $pdfoid . " 0 obj" . + $this->_streamify(trim($this->objects[$liboid]["data"])) . + " endobj"; + break; + + case "image": + $os .= $pdfoid . " 0 obj"; + $os .= $this->_make_raw_image($liboid); + $os .= " endobj"; + break; + + case "iplace": + $os .= $pdfoid . " 0 obj"; + $os .= $this->_streamify($this->_place_raw_image($liboid)); + $os .= " endobj"; + break; + + case "font" : + $os .= $pdfoid . " 0 obj"; + unset ( $temp ); + $temp["Type"] = "/Font"; + $temp["Subtype"] = "/" . $this->objects[$liboid]["subtype"]; + $temp["BaseFont"] = "/" . $this->objects[$liboid]["basefont"]; + $temp["Encoding"] = "/WinAnsiEncoding"; + $temp["Name"] = "/F$liboid"; + $os .= $this->_makedictionary($temp); + $os .= " endobj"; + break; + } + $os .= "\x0a"; + } + + // Create an Info entry + $info = $this->_addtoxreftable(0,0); + $this->xreftable[$info]["offset"] = strlen($os); + unset($temp); + $temp["Producer"] = + $this->_stringify("phppdflib http://www.potentialtech.com/ppl.php"); + $os .= $info . " 0 obj" . $this->_makedictionary($temp) . " endobj\x0a"; + + // Create the xref table + $this->builddata["startxref"] = strlen($os); + $os .= "xref\x0a0 " . (string)($this->nextobj + 1) . "\x0a"; + for ( $i = 0; $i <= $this->nextobj; $i ++ ) { + $os .= sprintf("%010u %05u %s \x0a", $this->xreftable[$i]["offset"], + $this->xreftable[$i]["gennum"], + $this->xreftable[$i]["free"]); + } + + // Create document trailer + $os .= "trailer\x0a"; + unset($temp); + $temp["Size"] = $this->nextobj + 1; + $temp["Root"] = "1 0 R"; + $temp["Info"] = $info . " 0 R"; + $os .= $this->_makedictionary($temp); + $os .= "\x0astartxref\x0a"; + $os .= $this->builddata["startxref"] . "\x0a"; + + // Required end of file marker + $os .= "%%EOF\x0a"; + + return $os; + } + + function png_embed($data) + { + // Sanity, make sure this is a png + if (substr($data, 0, 8) != "\137PNG\x0d\x0a\x1a\x0d") { + $this->_push_std_error(6011); + return false; + } + + } + + function jfif_embed($data) + { + /* Sanity check: Check magic numbers to see if + * this is really a JFIF stream + */ + if ( substr($data, 0, 4) != "\xff\xd8\xff\xe0" || + substr($data, 6, 4) != "JFIF" ) { + // This is not in JFIF format + $this->_push_std_error(6008); + return false; + } + + /* Now we'll scan through all the markers in the + * JFIF and extract whatever data we need from them + * We're not being terribly anal about validating + * the structure of the JFIF, so a corrupt stream + * could have very unpredictable results + */ + // Default values + $pos = 0; + $size = strlen($data); + + while ( $pos < $size ) { + $marker = substr($data, $pos + 1, 1); + // Just skip these markers + if ($marker == "\xd8" || $marker == "\xd9" || $marker == "\x01") { + $pos += 2; + continue; + } + if ($marker == "\xff") { + $pos ++; + continue; + } + + switch ($marker) { + // Start of frame + // Baseline + case "\xc0": + // Extended sequential + case "\xc1": + // Differential sequential + case "\xc5": + // Progressive + case "\xc2": + // differential progressive + case "\xc6": + // Lossless + case "\xc3": + // differential lossless + case "\xc7": + // Arithmetic encoded + case "\xc9": + case "\xca": + case "\xcb": + case "\xcd": + case "\xce": + case "\xcf": + $precision = $this->_int_val(substr($data, $pos + 4, 1)); + $height = $this->_int_val(substr($data, $pos + 5, 2)); + $width = $this->_int_val(substr($data, $pos + 7, 2)); + $numcomp = $this->_int_val(substr($data, $pos + 9, 1)); + if ( $numcomp != 3 && $numcomp != 1 ) { + // Abort if we aren't encoded as B&W or YCbCr + $this->_push_std_error(6008); + return false; + } + $pos += 2 + $this->_int_val(substr($data, $pos + 2, 2)); + break 2; + } + + /* All marker identifications continue the + * loop, thus if we got here, we need to skip + * this marker as we don't understand it. + */ + $pos += 2 + $this->_int_val(substr($data, $pos + 2, 2)); + } + $cspace = $numcomp == 1 ? "/DeviceGray" : "/DeviceRGB"; + return $this->image_raw_embed($data, + $cspace, + $precision, + $height, + $width, + "/DCTDecode"); + } + + function image_raw_embed($data, $cspace, $bpc, $height, $width, $filter = "") + { + $o = $this->_addnewoid(); + $t["data"] = $data; + $t["colorspace"] = $cspace; + $t["bpc"] = $bpc; + $t["type"] = "image"; + $t["height"] = $height; + $t["width"] = $width; + $t["filter"] = $filter; + $this->objects[$o] = $t; + return $o; + } + + function get_image_size($id) + { + if ($this->objects[$id]['type'] != 'image') { + $this->_push_std_error(6009); + return false; + } + $r['width'] = $this->objects[$id]['width']; + $r['height'] = $this->objects[$id]['height']; + return $r; + } + + function image_place($oid, $bottom, $left, $parent, $param = array()) + { + if ($this->objects[$oid]["type"] != "image") { + $this->_push_std_error(6009); + return false; + } + if ($this->objects[$parent]["type"] != "page") { + $this->_push_std_error(6001); + return false; + } + + $o = $this->_addnewoid(); + $param = $this->_resolve_param($param, false); + $t["type"] = "iplace"; + $this->_adjust_margin($left, $bottom, $parent); + $t["bottom"] = $bottom; + $t["left"] = $left; + $t["parent"] = $parent; + // find out what the image size should be + $width = $this->objects[$oid]["width"]; + $height = $this->objects[$oid]["height"]; + $scale = $param['scale']; + if (is_array($scale)) { + $t["xscale"] = $scale["x"] * $width; + $t["yscale"] = $scale["y"] * $height; + } else { + $t["xscale"] = $scale * $width; + $t["yscale"] = $scale * $height; + } + $t["rotation"] = $param['rotation']; + $t["image"] = $oid; + $this->objects[$o] = $t; + return $o; + } + + function strlen($string , $params = false, $tabwidth = 4) + { + if ($this->needsset) { + require_once(dirname(__FILE__) . '/strlen.inc.php'); + } + if (empty($params["font"])) { + $font = $this->default['font']; + } else { + $font = $params["font"]; + switch ($font) { + case "Times-Roman" : + $font = "Times"; + break; + case "Helvetica-Oblique" : + $font = "Helvetica"; + break; + case "Helvetica-BoldOblique" : + $font = "Helvetica-Bold"; + break; + case "ZapfDingbats" : + $font = "Dingbats"; + break; + } + } + if ($params["height"] == 0) { + $size = $this->default['height']; + } else { + $size = $params["height"]; + } + $tab = ''; + for ($i = 0; $i < $tabwidth; $i++) { + $tab .= ' '; + } + $string = str_replace(chr(9), $tab, $string); + if (substr($font, 0, 7) == "Courier") { + // Courier is a fixed-width font + $width = strlen($string) * 600; + } else { + $width = 0; + $len = strlen($string); + for ($i = 0; $i < $len; $i++) { + $width += $this->widths[$font][ord($string{$i})]; + } + } + // We now have the string width in font units + return $width * $size / 1000; + } + + function wrap_line(&$text, $width, $param = array()) + { + $maxchars = (int)(1.1 * $width / $this->strlen("i", $param)); + $words = explode(" ", substr($text, 0, $maxchars)); + if ($this->strlen($words[0]) >= $width) { + $this->_push_error(3001, "Single token too long for allowed space"); + $final = $words[0]; + } else { + $space = $this->strlen(" ", $param); + $len = 0; + $word = 0; + $final = ""; + while ($len < $width) { + if ($word >= count($words)) { + break; + } + $temp = $this->strlen($words[$word], $param); + if ( ($len + $temp) <= $width) { + $final .= $words[$word] . " "; + $word ++; + } + $len += $space + $temp; + } + } + $text = substr($text, strlen($final)); + return $final; + } + + function word_wrap($words, $width, $param = array()) + { + // break $words into an array separated by manual paragraph break character + $paragraph = explode("\n", $words); + // find the width of 1 space in this font + $swidth = $this->strlen( " " , $param ); + // uses each element of $paragraph array and splits it at spaces + for ($lc = 0; $lc < count($paragraph); $lc++){ + while (strlen($paragraph[$lc]) > 0) { + $returnarray[] = $this->wrap_line($paragraph[$lc], $width, $param); + } + } + return $returnarray; + } + + function draw_one_paragraph($top, $left, $bottom, $right, $text, $page, $param = array()) + { + $param = $this->_resolve_param($param); + $height = 1.1 * $param['height']; + $width = $right - $left; + while ($top > $bottom) { + if (strlen($text) < 1) { + break; + } + $top -= $height; + if ($top >= $bottom) { + $line = $this->wrap_line($text, $width, $param); + switch ($param['align']) { + case 'right' : + $line = trim($line); + $l = $right - $this->strlen($line, $param); + break; + + case 'center' : + $line = trim($line); + $l = $left + (($width - $this->strlen($line, $param)) / 2); + break; + + default : + $l = $left; + } + $this->draw_text($l, $top, $line, $page, $param); + } else { + $top += $height; + break; + } + } + if (strlen($text) > 0) { + return $text; + } else { + return $top; + } + } + + function draw_paragraph($top, $left, $bottom, $right, $text, $page, $param = array()) + { + $paras = split("\n", $text); + for ($i = 0; $i < count($paras); $i++) { + $over = $this->draw_one_paragraph($top, + $left, + $bottom, + $right, + $paras[$i], + $page, + $param); + if (is_string($over)) { + break; + } + $top = $over; + } + $rv = $over; + if ($i < count($paras)) { + for ($x = $i + 1; $x < count($paras); $x++) { + $rv .= "\n" . $paras[$x]; + } + } + return $rv; + } + + function error_array() + { + $rv = array(); + while (count($this->ermsg) > 0) { + $this->pop_error($num, $msg); + $rv[] = "Error $num: $msg"; + } + return $rv; + } + + function pop_error(&$num, &$msg) + { + $num = array_pop($this->erno); + $msg = array_pop($this->ermsg); + if (is_null($num)) { + return false; + } else { + return $num; + } + } + + function enable($name) + { + $name = strtolower($name); + @include_once(dirname(__FILE__) . "/${name}.class.php"); + $this->x[$name] = new $name; + $this->x[$name]->pdf = &$this; + switch ($name) { + case 'chart' : + case 'template' : + $this->$name = &$this->x[$name]; + break; + } + } + + function get_color($desc) + { + + $r = array(); + switch (strtolower($desc)) { + case 'black' : + $r['red'] = $r['blue'] = $r['green'] = 0; + break; + + case 'white' : + $r['red'] = $r['blue'] = $r['green'] = 1; + break; + + case 'red' : + $r['red'] = 1; + $r['blue'] = $r['green'] = 0; + break; + + case 'blue' : + $r['blue'] = 1; + $r['red'] = $r['green'] = 0; + break; + + case 'green' : + $r['green'] = 1; + $r['blue'] = $r['red'] = 0; + break; + + default : + if (substr($desc, 0, 1) == '#') { + // Parse out a hex triplet + $v = substr($desc, 1, 2); + $r['red'] = eval("return ord(\"\\x$v\");") / 255; + $v = substr($desc, 3, 2); + $r['green'] = eval("return ord(\"\\x$v\");") / 255; + $v = substr($desc, 5, 2); + $r['blue'] = eval("return ord(\"\\x$v\");") / 255; + } else { + // Error condition? + $this->_push_error(6012, "Unparsable color identifier: $desc"); + $r = false; + } + } + return $r; + } + +/****************************************************** + * These functions are internally used by the library * + * and shouldn't really be called by a user of * + * phppdflib * + ******************************************************/ + + function _resolve_mode($attrib, $mode) + { + $rmode = $attrib[$mode]; + if ($rmode != 0) { + $r = $rmode; + } else { + switch ($rmode) { + case "fill": + $r = 0; + break; + + case "stroke": + $r = 1; + break; + + case "fill+stroke": + $r = 2; + break; + } + } + return $r; + } + + function _adjust_margin(&$x, &$y, $page) + { + $x += $this->objects[$page]['margin-left']; + $y += $this->objects[$page]['margin-bottom']; + } + + function _resolve_param($param, $text = true) + { + $rv = $this->default; + if (is_array($param)) { + if (isset($param['mode'])) { + $param['tmode'] = $param['smode'] = $param['mode']; + } + foreach ($param as $key => $value) { + $rv[$key] = $value; + } + } + return $rv; + } + + function _push_error($num, $msg) + { + array_push($this->erno, $num); + array_push($this->ermsg, $msg); + } + + function _push_std_error($num) + { + switch ($num) { + case 6001 : $m = "Object must be of type 'page'"; break; + case 6008 : $m = "Data stream not recognized as JFIF"; break; + case 6009 : $m = "Object must be of type 'image'"; break; + case 6011 : $m = "Data stream not recognized as PNG"; break; + default : $m = "_push_std_error() called with invalid error number: $num"; break; + } + $this->_push_error($num, $m); + } + + function _resolve_colors(&$n, $attrib) + { + $temp = array('red','green','blue'); + foreach ($temp as $colcomp) { + if (isset($attrib['fillcolor'][$colcomp])) { + $n['fillcolor'][$colcomp] = $attrib['fillcolor'][$colcomp]; + } + if (isset($attrib['strokecolor'][$colcomp])) { + $n['strokecolor'][$colcomp] = $attrib['strokecolor'][$colcomp]; + } + } + } + + /* Check to see if a requested font is already in the + * list, if not add it. Either way, return the libid + * of the font + */ + function _use_font($id) + { + if (!isset($id['font'])) { + $id['font'] = $this->default['font']; + } + if ( isset($this->builddata["fonts"]) && count($this->builddata["fonts"]) > 0 ) { + foreach ($this->builddata["fonts"] as $libid => $name) { + if ($name == $id['font']) { + return $libid; + } + } + } + /* The font isn't in the table, so we add it + * and return it's ID + */ + return $this->new_font($id['font']); + } + + /* Convert a big-endian byte stream into an integer */ + function _int_val($string) + { + $r = 0; + for ($i = 0; $i < strlen($string); $i ++ ) { + $r += ord($string{$i}) * pow(256, strlen($string) - $i -1); + } + return $r; + } + + function _make_raw_image($liboid) + { + $s["Type"] = "/XObject"; + $s["Subtype"] = "/Image"; + $s["Width"] = $this->objects[$liboid]["width"]; + $s["Height"] = $this->objects[$liboid]["height"]; + $s["ColorSpace"] = $this->objects[$liboid]["colorspace"]; + $s["BitsPerComponent"] = $this->objects[$liboid]["bpc"]; + if (strlen($this->objects[$liboid]["filter"]) > 0) { + $s["Filter"] = $this->objects[$liboid]["filter"]; + } + return $this->_streamify($this->objects[$liboid]["data"], $s); + } + + function _place_raw_image($liboid) + { + $xscale = $this->objects[$liboid]["xscale"]; + $yscale = $this->objects[$liboid]["yscale"]; + $angle = $this->objects[$liboid]["rotation"]; + $temp = "q 1 0 0 1 " . + $this->objects[$liboid]["left"] . " " . + $this->objects[$liboid]["bottom"] . " cm "; + if ($angle != 0) { + $temp .= $this->_rotate($angle) . " cm "; + } + if ($xscale != 1 || $yscale != 1) { + $temp .= "$xscale 0 0 $yscale 0 0 cm "; + } + $temp .= "/Img" . $this->objects[$liboid]["image"] . + " Do Q\x0a"; + return $temp; + } + + function _rotate($angle) + { + $a = deg2rad($angle); + $cos = cos($a); + $sin = sin($a); + $r = sprintf("%1\$01.6f %2\$01.6f %3\$01.6f %1\$01.6f 0 0", $cos, $sin, -$sin); + return $r; + } + + function _get_operator($liboid) + { + switch ($this->objects[$liboid]['mode']) { + case 0 : return "f"; break; + case 1 : return "S"; break; + case 2 : return "b"; break; + } + } + + function _make_line($liboid) + { + $gstate = ""; + if ( $colortest = $this->_colorset($liboid) ) { + $gstate .= $colortest . " "; + } + if ( isset($this->objects[$liboid]["width"]) && $this->objects[$liboid]["width"] != 1 ) { + $gstate .= $this->objects[$liboid]["width"] . " w "; + } + $firstpoint = true; + $temp = ""; + foreach ($this->objects[$liboid]["x"] as $pointid => $x) { + $y = $this->objects[$liboid]["y"][$pointid]; + $temp .= $x . " " . $y . " "; + if ($firstpoint) { + $temp .= "m "; + $firstpoint = false; + } else { + $temp .= "l "; + } + } + $temp .= $this->_get_operator($liboid); + if ( strlen($gstate) > 0 ) { + $temp = "q " . $gstate . $temp . " Q"; + } + return $temp . "\x0a"; + } + + function _make_rect($liboid) + { + $gstate = ""; + if ( $colortest = $this->_colorset($liboid) ) { + $gstate .= $colortest . " "; + } + if ( isset($this->objects[$liboid]["width"]) && $this->objects[$liboid]["width"] != 1 ) { + $gstate .= $this->objects[$liboid]["width"] . " w "; + } + $temp = $this->objects[$liboid]["left"] . " "; + $temp .= $this->objects[$liboid]["bottom"]; + $temp .= " " . ( $this->objects[$liboid]["right"] + - $this->objects[$liboid]["left"] ); + $temp .= " " . ( $this->objects[$liboid]["top"] + - $this->objects[$liboid]["bottom"] ); + $temp .= ' re '; + $temp .= $this->_get_operator($liboid); + if ( strlen($gstate) > 0 ) { + $temp = "q " . $gstate . $temp . " Q"; + } + return $temp . "\x0a"; + } + + function _make_circle($liboid) + { + $gstate = ""; + if ( $colortest = $this->_colorset($liboid) ) { + $gstate .= $colortest . " "; + } + if ( isset($this->objects[$liboid]["width"]) && $this->objects[$liboid]["width"] != 1 ) { + $gstate .= $this->objects[$liboid]["width"] . " w "; + } + $r = $this->objects[$liboid]['radius']; + $x = $this->objects[$liboid]['x']; + $y = $this->objects[$liboid]['y']; + $ql = $x - $r; + $pt = $y + $r * 1.33333; + $qr = $x + $r; + $pb = $y - $r * 1.33333; + $temp = "$ql $y m "; + $temp .= "$ql $pt $qr $pt $qr $y c "; + $temp .= "$qr $pb $ql $pb $ql $y c "; + $temp .= $this->_get_operator($liboid); + if ( strlen($gstate) > 0 ) { + $temp = "q " . $gstate . $temp . " Q"; + } + return $temp . "\x0a"; + } + + function _make_text($liboid) + { + $statechange = ""; $locateinbt = true; + $statechange = $this->_colorset($liboid); + if (isset($this->objects[$liboid]["rotation"]) && $this->objects[$liboid]["rotation"] != 0) { + $statechange .= "1 0 0 1 " . + $this->objects[$liboid]["left"] . " " . + $this->objects[$liboid]["bottom"] . " cm " . + $this->_rotate($this->objects[$liboid]["rotation"]) . + " cm "; + $locateinbt = false; + } + $temp = "BT "; + if ($this->objects[$liboid]["mode"] != 0) { + $temp .= $this->objects[$liboid]["mode"] . + " Tr "; + // Adjust stroke width + $statechange .= $this->objects[$liboid]["height"] / 35 . " w "; + } + $temp .= "/F" . $this->objects[$liboid]["font"] . " "; + $temp .= $this->objects[$liboid]["height"]; + $temp .= " Tf "; + if ($locateinbt) { + $temp .= $this->objects[$liboid]["left"] . " " . + $this->objects[$liboid]["bottom"]; + } else { + $temp .= "0 0"; + } + $temp .= " Td "; + $temp .= $this->_stringify($this->objects[$liboid]["text"]); + $temp .= " Tj "; + $temp .= "ET"; + if (strlen($statechange) > 0) { + $temp = "q " . $statechange . $temp . " Q"; + } + return $temp . "\x0a"; + } + + function _colorset($libid) + { + $red = isset($this->objects[$libid]['fillcolor']["red"]) ? (float)$this->objects[$libid]['fillcolor']["red"] : 0; + $green = isset($this->objects[$libid]['fillcolor']["green"]) ? (float)$this->objects[$libid]['fillcolor']["green"] : 0; + $blue = isset($this->objects[$libid]['fillcolor']["blue"]) ? (float)$this->objects[$libid]['fillcolor']["blue"] : 0; + if (($red > 0) || ($green > 0) || ($blue > 0)) { + $r = $red . " " . $green . " " . $blue; + $r .= " rg "; + } else { + $r = ""; + } + $red = isset($this->objects[$libid]['strokecolor']["red"]) ? (float)$this->objects[$libid]['strokecolor']["red"] : 0; + $green = isset($this->objects[$libid]['strokecolor']["green"]) ? (float)$this->objects[$libid]['strokecolor']["green"] : 0; + $blue = isset($this->objects[$libid]['strokecolor']["blue"]) ? (float)$this->objects[$libid]['strokecolor']["blue"] : 0; + if (($red > 0) || ($green > 0) || ($blue > 0) ) { + $r .= $red . " " . $green . " " . $blue; + $r .= " RG "; + } + return $r; + } + + /* Used to determine what pdflib objects need converted + * to actual PDF objects. + */ + function _becomes_object($object) + { + if ($object == "null") { + return false; + } + return true; + } + + /* builds an array of child objects */ + function _get_kids($pdfid) + { + $libid = $this->pdftolib[$pdfid]; + foreach( $this->objects as $obid => $object ) { + if (isset($object["parent"]) && $object["parent"] == $libid) { + $kids[] = $this->libtopdf[$obid] . " 0 R"; + } + } + return $kids; + } + + /* builds an array of pages, in order */ + function _order_pages($pdfid) + { + $libid = $this->pdftolib[$pdfid]; + foreach( $this->objects as $obid => $object ) { + if (isset($object["parent"]) && $object["parent"] == $libid) { + $kids[$object["number"]] = $this->libtopdf[$obid] . " 0 R"; + } + } + ksort($kids); + return $kids; + } + + /* simple helper function to return the current oid + * and increment it by one + */ + function _addnewoid() + { + $o = $this->nextoid; + $this->nextoid++; + return $o; + } + + /* The xreftable will contain a list of all the + * objects in the pdf file and the number of bytes + * from the beginning of the file that the object + * occurs. Each time we add an object, we call this + * to record it's location, then call ->_genxreftable() + * to generate the table from array + */ + function _addtoxreftable($offset, $gennum) + { + $this->nextobj ++; + $this->xreftable[$this->nextobj]["offset"] = $offset; + $this->xreftable[$this->nextobj]["gennum"] = $gennum; + $this->xreftable[$this->nextobj]["free"] = "n"; + return $this->nextobj; + } + + /* Returns a properly formatted pdf dictionary + * containing entries specified by + * the array $entries + */ + function _makedictionary($entries) + { + $rs = "<<\x0a"; + if (isset($entries) && count($entries) > 0) { + foreach ($entries as $key => $value) { + $rs .= "/" . $key . " " . $value . "\x0a"; + } + } + $rs .= ">>"; + return $rs; + } + + /* returns a properly formatted pdf array */ + function _makearray($entries) + { + $rs = "["; + if ( is_array($entries) ) { + foreach ($entries as $entry) { + $rs .= $entry . " "; + } + } else { + $rs .= $entries; + } + $rs = rtrim($rs) . "]"; + return $rs; + } + + /* Returns a properly formatted string, with any + * special characters escaped + */ + function _stringify($string) + { + // Escape potentially problematic characters + $string = preg_replace("-\\\\-","\\\\\\\\",$string); + $bad = array ("-\(-", "-\)-" ); + $good = array ("\\(", "\\)" ); + $string = preg_replace($bad,$good,$string); + return "(" . rtrim($string) . ")"; + } + + function _streamify($data, $sarray = array()) + { + /* zlib compression is a compile time option + * for php, thus we need to make sure it's + * available before using it. + */ + if ( function_exists('gzcompress') && $this->builddata["compress"] ) { + // For now, we don't compress if already using a filter + if ( !isset($sarray["Filter"]) || strlen($sarray["Filter"]) == 0 ) { + $sarray["Filter"] = "/FlateDecode"; + } else { + $sarray['Filter'] = "[/FlateDecode " . $sarray['Filter'] . "]"; + } + $data = gzcompress($data, $this->builddata["compress"]); + } + $sarray["Length"] = strlen($data); + $os = $this->_makedictionary($sarray); + $os .= "stream\x0a" . $data . "\x0aendstream"; + return $os; + } + + /* Returns a properly formatted page node + * page nodes with 0 kids are not created + */ + function _makepagenode($kids, $addtlopts = false) + { + $parray["Type"] = "/Pages"; + if ( isset($kids) AND count($kids) > 0 ) { + // Array of child objects + $parray["Kids"] = $this->_makearray($kids); + // Number of pages + $parray["Count"] = count($kids); + } else { + // No kids is an error condition + $this->_push_error(600, "Pagenode has no children"); + return false; + } + if ( is_array($addtlopts) ) { + foreach ( $addtlopts as $key => $value ) { + $parray[$key] = $value; + } + } + + /* The resource dictionary is always object 3 + */ + $parray["Resources"] = "3 0 R"; + + $os = $this->_makedictionary($parray); + $os = "obj" . $os . "endobj"; + return $os; + } + + function _makepage($parent, $contents, $liboid) + { + $parray["Type"] = "/Page"; + $parray["Parent"] = $this->libtopdf[$parent] . " 0 R"; + $parray["Contents"] = $this->_makearray($contents); + $parray["MediaBox"] = "[0 0 " + . $this->objects[$liboid]["width"] . " " + . $this->objects[$liboid]["height"] . "]"; + $os = $this->_makedictionary($parray); + $os = "obj" . $os . "endobj"; + return $os; + } + +} +?> diff --git a/lib/MECON/PDF/external/strlen.inc.php b/lib/MECON/PDF/external/strlen.inc.php new file mode 100755 index 0000000..42b9393 --- /dev/null +++ b/lib/MECON/PDF/external/strlen.inc.php @@ -0,0 +1,290 @@ +needsset = false; +$this->widths['Symbol']= array ( 32 => 250, 33 => 333, 34 => 713, 35 => 500, 36 => 549, + 37 => 833, 38 => 778, 39 => 439, 40 => 333, 41 => 333, + 42 => 500, 43 => 549, 44 => 250, 45 => 549, 46 => 250, + 47 => 278, 48 => 500, 49 => 500, 50 => 500, 51 => 500, + 52 => 500, 53 => 500, 54 => 500, 55 => 500, 56 => 500, + 57 => 500, 58 => 278, 59 => 278, 60 => 549, 61 => 549, + 62 => 549, 63 => 444, 64 => 549, 65 => 722, 66 => 667, + 67 => 722, 68 => 612, 69 => 611, 70 => 763, 71 => 603, + 72 => 722, 73 => 333, 74 => 631, 75 => 722, 76 => 686, + 77 => 889, 78 => 722, 79 => 722, 80 => 768, 81 => 741, + 82 => 556, 83 => 592, 84 => 611, 85 => 690, 86 => 439, + 87 => 768, 88 => 645, 89 => 795, 90 => 611, 91 => 333, + 92 => 863, 93 => 333, 94 => 658, 95 => 500, 96 => 500, + 97 => 631, 98 => 549, 99 => 549, 100 => 494, 101 => 439, + 102 => 521, 103 => 411, 104 => 603, 105 => 329, 106 => 603, + 107 => 549, 108 => 549, 109 => 576, 110 => 521, 111 => 549, + 112 => 549, 113 => 521, 114 => 549, 115 => 603, 116 => 439, + 117 => 576, 118 => 713, 119 => 686, 120 => 493, 121 => 686, + 122 => 494, 123 => 480, 124 => 200, 125 => 480, 126 => 549, + 161 => 620, 162 => 247, 163 => 549, 164 => 167, 165 => 713, + 166 => 500, 167 => 753, 168 => 753, 169 => 753, 170 => 753, + 171 => 1042, 172 => 987, 173 => 603, 174 => 987, 175 => 603, + 176 => 400, 177 => 549, 178 => 411, 179 => 549, 180 => 549, + 181 => 713, 182 => 494, 183 => 460, 184 => 549, 185 => 549, + 186 => 549, 187 => 549, 188 => 1000, 189 => 603, 190 => 1000, + 191 => 658, 192 => 823, 193 => 686, 194 => 795, 195 => 987, + 196 => 768, 197 => 768, 198 => 823, 199 => 768, 200 => 768, + 201 => 713, 202 => 713, 203 => 713, 204 => 713, 205 => 713, + 206 => 713, 207 => 713, 208 => 768, 209 => 713, 210 => 790, + 211 => 790, 212 => 890, 213 => 823, 214 => 549, 215 => 250, + 216 => 713, 217 => 603, 218 => 603, 219 => 1042, 220 => 987, + 221 => 603, 222 => 987, 223 => 603, 224 => 494, 225 => 329, + 226 => 790, 227 => 790, 228 => 786, 229 => 713, 230 => 384, + 231 => 384, 232 => 384, 233 => 384, 234 => 384, 235 => 384, + 236 => 494, 237 => 494, 238 => 494, 239 => 494, 241 => 329, + 242 => 274, 243 => 686, 244 => 686, 245 => 686, 246 => 384, + 247 => 384, 248 => 384, 249 => 384, 250 => 384, 251 => 384, + 252 => 494, 253 => 494, 254 => 494 ); +$this->widths['Dingbats'] = array (32 => 278, 33 => 974, 34 => 961, 35 => 974, 36 => 980, + 37 => 719, 38 => 789, 39 => 790, 40 => 791, 41 => 690, + 42 => 960, 43 => 939, 44 => 549, 45 => 855, 46 => 911, + 47 => 933, 48 => 911, 49 => 945, 50 => 974, 51 => 755, + 52 => 846, 53 => 762, 54 => 761, 55 => 571, 56 => 677, + 57 => 763, 58 => 760, 59 => 759, 60 => 754, 61 => 494, + 62 => 552, 63 => 537, 64 => 577, 65 => 692, 66 => 786, + 67 => 788, 68 => 788, 69 => 790, 70 => 793, 71 => 794, + 72 => 816, 73 => 823, 74 => 789, 75 => 841, 76 => 823, + 77 => 833, 78 => 816, 79 => 831, 80 => 923, 81 => 744, + 82 => 723, 83 => 749, 84 => 790, 85 => 792, 86 => 695, + 87 => 776, 88 => 768, 89 => 792, 90 => 759, 91 => 707, + 92 => 708, 93 => 682, 94 => 701, 95 => 826, 96 => 815, + 97 => 789, 98 => 789, 99 => 707, 100 => 687, 101 => 696, + 102 => 689, 103 => 786, 104 => 787, 105 => 713, 106 => 791, + 107 => 785, 108 => 791, 109 => 873, 110 => 761, 111 => 762, + 112 => 762, 113 => 759, 114 => 759, 115 => 892, 116 => 892, + 117 => 788, 118 => 784, 119 => 438, 120 => 138, 121 => 277, + 122 => 415, 123 => 392, 124 => 392, 125 => 668, 126 => 668, + 161 => 732, 162 => 544, 163 => 544, 164 => 910, 165 => 667, + 166 => 760, 167 => 760, 168 => 776, 169 => 595, 170 => 694, + 171 => 626, 172 => 788, 173 => 788, 174 => 788, 175 => 788, + 176 => 788, 177 => 788, 178 => 788, 179 => 788, 180 => 788, + 181 => 788, 182 => 788, 183 => 788, 184 => 788, 185 => 788, + 186 => 788, 187 => 788, 188 => 788, 189 => 788, 190 => 788, + 191 => 788, 192 => 788, 193 => 788, 194 => 788, 195 => 788, + 196 => 788, 197 => 788, 198 => 788, 199 => 788, 200 => 788, + 201 => 788, 202 => 788, 203 => 788, 204 => 788, 205 => 788, + 206 => 788, 207 => 788, 208 => 788, 209 => 788, 210 => 788, + 211 => 788, 212 => 894, 213 => 838, 214 => 1016, 215 => 458, + 216 => 748, 217 => 924, 218 => 748, 219 => 918, 220 => 927, + 221 => 928, 222 => 928, 223 => 834, 224 => 873, 225 => 828, + 226 => 924, 227 => 924, 228 => 917, 229 => 930, 230 => 931, + 231 => 463, 232 => 883, 233 => 836, 234 => 836, 235 => 867, + 236 => 867, 237 => 696, 238 => 696, 239 => 874, 241 => 874, + 242 => 760, 243 => 946, 244 => 771, 245 => 865, 246 => 771, + 247 => 888, 248 => 967, 249 => 888, 250 => 831, 251 => 873, + 252 => 927, 253 => 970, 254 => 918); +$this->widths['Helvetica-Bold'] = array (32 => 278, 33 => 333, 34 => 474, 35 => 556, + 36 => 556, 37 => 889, 38 => 722, 39 => 278, + 40 => 333, 41 => 333, 42 => 389, 43 => 584, + 44 => 278, 45 => 333, 46 => 278, 47 => 278, + 48 => 556, 49 => 556, 50 => 556, 51 => 556, + 52 => 556, 53 => 556, 54 => 556, 55 => 556, + 56 => 556, 57 => 556, 58 => 333, 59 => 333, + 60 => 584, 61 => 584, 62 => 584, 63 => 611, + 64 => 975, 65 => 722, 66 => 722, 67 => 722, + 68 => 722, 69 => 667, 70 => 611, 71 => 778, + 72 => 722, 73 => 278, 74 => 556, 75 => 722, + 76 => 611, 77 => 833, 78 => 722, 79 => 778, + 80 => 667, 81 => 778, 82 => 722, 83 => 667, + 84 => 611, 85 => 722, 86 => 667, 87 => 944, + 88 => 667, 89 => 667, 90 => 611, 91 => 333, + 92 => 278, 93 => 333, 94 => 584, 95 => 556, + 96 => 278, 97 => 556, 98 => 611, 99 => 556, + 100 => 611, 101 => 556, 102 => 333, 103 => 611, + 104 => 611, 105 => 278, 106 => 278, 107 => 556, + 108 => 278, 109 => 889, 110 => 611, 111 => 611, + 112 => 611, 113 => 611, 114 => 389, 115 => 556, + 116 => 333, 117 => 611, 118 => 556, 119 => 778, + 120 => 556, 121 => 556, 122 => 500, 123 => 389, + 124 => 280, 125 => 389, 126 => 584, 161 => 333, + 162 => 556, 163 => 556, 164 => 167, 165 => 556, + 166 => 556, 167 => 556, 168 => 556, 169 => 238, + 170 => 500, 171 => 556, 172 => 333, 173 => 333, + 174 => 611, 175 => 611, 177 => 556, 178 => 556, + 179 => 556, 180 => 278, 182 => 556, 183 => 350, + 184 => 278, 185 => 500, 186 => 500, 187 => 556, + 188 => 1000, 189 => 1000, 191 => 611, 193 => 333, + 194 => 333, 195 => 333, 196 => 333, 197 => 333, + 198 => 333, 199 => 333, 200 => 333, 202 => 333, + 203 => 333, 205 => 333, 206 => 333, 207 => 333, + 208 => 1000, 225 => 1000, 227 => 370, 232 => 611, + 233 => 778, 234 => 1000, 235 => 365, 241 => 889, + 245 => 278, 248 => 278, 249 => 611, 250 => 944, + 251 => 611 ); +$this->widths['Helvetica'] = array (32 => 278, 33 => 278, 34 => 355, 35 => 556, 36 => 556, + 37 => 889, 38 => 667, 39 => 222, 40 => 333, 41 => 333, + 42 => 389, 43 => 584, 44 => 278, 45 => 333, 46 => 278, + 47 => 278, 48 => 556, 49 => 556, 50 => 556, 51 => 556, + 52 => 556, 53 => 556, 54 => 556, 55 => 556, 56 => 556, + 57 => 556, 58 => 278, 59 => 278, 60 => 584, 61 => 584, + 62 => 584, 63 => 556, 64 => 1015, 65 => 667, 66 => 667, + 67 => 722, 68 => 722, 69 => 667, 70 => 611, 71 => 778, + 72 => 722, 73 => 278, 74 => 500, 75 => 667, 76 => 556, + 77 => 833, 78 => 722, 79 => 778, 80 => 667, 81 => 778, + 82 => 722, 83 => 667, 84 => 611, 85 => 722, 86 => 667, + 87 => 944, 88 => 667, 89 => 667, 90 => 611, 91 => 278, + 92 => 278, 93 => 278, 94 => 469, 95 => 556, 96 => 222, + 97 => 556, 98 => 556, 99 => 500, 100 => 556, 101 => 556, + 102 => 278, 103 => 556, 104 => 556, 105 => 222, 106 => 222, + 107 => 500, 108 => 222, 109 => 833, 110 => 556, 111 => 556, + 112 => 556, 113 => 556, 114 => 333, 115 => 500, 116 => 278, + 117 => 556, 118 => 500, 119 => 722, 120 => 500, 121 => 500, + 122 => 500, 123 => 334, 124 => 260, 125 => 334, 126 => 584, + 161 => 333, 162 => 556, 163 => 556, 164 => 167, 165 => 556, + 166 => 556, 167 => 556, 168 => 556, 169 => 191, 170 => 333, + 171 => 556, 172 => 333, 173 => 333, 174 => 500, 175 => 500, + 177 => 556, 178 => 556, 179 => 556, 180 => 278, 182 => 537, + 183 => 350, 184 => 222, 185 => 333, 186 => 333, 187 => 556, + 188 => 1000, 189 => 1000, 191 => 611, 193 => 333, 194 => 333, + 195 => 333, 196 => 333, 197 => 333, 198 => 333, 199 => 333, + 200 => 333, 202 => 333, 203 => 333, 205 => 333, 206 => 333, + 207 => 333, 208 => 1000, 225 => 1000, 227 => 370, 232 => 556, + 233 => 778, 234 => 1000, 235 => 365, 241 => 889, 245 => 278, + 248 => 222, 249 => 611, 250 => 944, 251 => 611 ); +$this->widths['Times'] = array (32 => 250, 33 => 333, 34 => 408, 35 => 500, 36 => 500, + 37 => 833, 38 => 778, 39 => 333, 40 => 333, 41 => 333, + 42 => 500, 43 => 564, 44 => 250, 45 => 333, 46 => 250, + 47 => 278, 48 => 500, 49 => 500, 50 => 500, 51 => 500, + 52 => 500, 53 => 500, 54 => 500, 55 => 500, 56 => 500, + 57 => 500, 58 => 278, 59 => 278, 60 => 564, 61 => 564, + 62 => 564, 63 => 444, 64 => 921, 65 => 722, 66 => 667, + 67 => 667, 68 => 722, 69 => 611, 70 => 556, 71 => 722, + 72 => 722, 73 => 333, 74 => 389, 75 => 722, 76 => 611, + 77 => 889, 78 => 722, 79 => 722, 80 => 556, 81 => 722, + 82 => 667, 83 => 556, 84 => 611, 85 => 722, 86 => 722, + 87 => 944, 88 => 722, 89 => 722, 90 => 611, 91 => 333, + 92 => 278, 93 => 333, 94 => 469, 95 => 500, 96 => 333, + 97 => 444, 98 => 500, 99 => 444, 100 => 500, 101 => 444, + 102 => 333, 103 => 500, 104 => 500, 105 => 278, 106 => 278, + 107 => 500, 108 => 278, 109 => 778, 110 => 500, 111 => 500, + 112 => 500, 113 => 500, 114 => 333, 115 => 389, 116 => 278, + 117 => 500, 118 => 500, 119 => 722, 120 => 500, 121 => 500, + 122 => 444, 123 => 480, 124 => 200, 125 => 480, 126 => 541, + 161 => 333, 162 => 500, 163 => 500, 164 => 167, 165 => 500, + 166 => 500, 167 => 500, 168 => 500, 169 => 180, 170 => 444, + 171 => 500, 172 => 333, 173 => 333, 174 => 556, 175 => 556, + 177 => 500, 178 => 500, 179 => 500, 180 => 250, 182 => 453, + 183 => 350, 184 => 333, 185 => 444, 186 => 444, 187 => 500, + 188 => 1000, 189 => 1000, 191 => 444, 193 => 333, 194 => 333, + 195 => 333, 196 => 333, 197 => 333, 198 => 333, 199 => 333, + 200 => 333, 202 => 333, 203 => 333, 205 => 333, 206 => 333, + 207 => 333, 208 => 1000, 225 => 889, 227 => 276, 232 => 611, + 233 => 722, 234 => 889, 235 => 310, 241 => 667, 245 => 278, + 248 => 278, 249 => 500, 250 => 722, 251 => 500); +$this->widths['Times-Bold'] = array (32 => 250, 33 => 333, 34 => 555, 35 => 500, 36 => 500, + 37 => 1000, 38 => 833, 39 => 333, 40 => 333, 41 => 333, + 42 => 500, 43 => 570, 44 => 250, 45 => 333, 46 => 250, + 47 => 278, 48 => 500, 49 => 500, 50 => 500, 51 => 500, + 52 => 500, 53 => 500, 54 => 500, 55 => 500, 56 => 500, + 57 => 500, 58 => 333, 59 => 333, 60 => 570, 61 => 570, + 62 => 570, 63 => 500, 64 => 930, 65 => 722, 66 => 667, + 67 => 722, 68 => 722, 69 => 667, 70 => 611, 71 => 778, + 72 => 778, 73 => 389, 74 => 500, 75 => 778, 76 => 667, + 77 => 944, 78 => 722, 79 => 778, 80 => 611, 81 => 778, + 82 => 722, 83 => 556, 84 => 667, 85 => 722, 86 => 722, + 87 => 1000, 88 => 722, 89 => 722, 90 => 667, 91 => 333, + 92 => 278, 93 => 333, 94 => 581, 95 => 500, 96 => 333, + 97 => 500, 98 => 556, 99 => 444, 100 => 556, 101 => 444, + 102 => 333, 103 => 500, 104 => 556, 105 => 278, 106 => 333, + 107 => 556, 108 => 278, 109 => 833, 110 => 556, 111 => 500, + 112 => 556, 113 => 556, 114 => 444, 115 => 389, 116 => 333, + 117 => 556, 118 => 500, 119 => 722, 120 => 500, 121 => 500, + 122 => 444, 123 => 394, 124 => 220, 125 => 394, 126 => 520, + 161 => 333, 162 => 500, 163 => 500, 164 => 167, 165 => 500, + 166 => 500, 167 => 500, 168 => 500, 169 => 278, 170 => 500, + 171 => 500, 172 => 333, 173 => 333, 174 => 556, 175 => 556, + 177 => 500, 178 => 500, 179 => 500, 180 => 250, 182 => 540, + 183 => 350, 184 => 333, 185 => 500, 186 => 500, 187 => 500, + 188 => 1000, 189 => 1000, 191 => 500, 193 => 333, 194 => 333, + 195 => 333, 196 => 333, 197 => 333, 198 => 333, 199 => 333, + 200 => 333, 202 => 333, 203 => 333, 205 => 333, 206 => 333, + 207 => 333, 208 => 1000, 225 => 1000, 227 => 300, 232 => 667, + 233 => 778, 234 => 1000, 235 => 330, 241 => 722, 245 => 278, + 248 => 278, 249 => 500, 250 => 722, 251 => 556); +$this->widths['Times-Italic'] = array (32 => 250, 33 => 333, 34 => 420, 35 => 500, 36 => 500, + 37 => 833, 38 => 778, 39 => 333, 40 => 333, 41 => 333, + 42 => 500, 43 => 675, 44 => 250, 45 => 333, 46 => 250, + 47 => 278, 48 => 500, 49 => 500, 50 => 500, 51 => 500, + 52 => 500, 53 => 500, 54 => 500, 55 => 500, 56 => 500, + 57 => 500, 58 => 333, 59 => 333, 60 => 675, 61 => 675, + 62 => 675, 63 => 500, 64 => 920, 65 => 611, 66 => 611, + 67 => 667, 68 => 722, 69 => 611, 70 => 611, 71 => 722, + 72 => 722, 73 => 333, 74 => 444, 75 => 667, 76 => 556, + 77 => 833, 78 => 667, 79 => 722, 80 => 611, 81 => 722, + 82 => 611, 83 => 500, 84 => 556, 85 => 722, 86 => 611, + 87 => 833, 88 => 611, 89 => 556, 90 => 556, 91 => 389, + 92 => 278, 93 => 389, 94 => 422, 95 => 500, 96 => 333, + 97 => 500, 98 => 500, 99 => 444, 100 => 500, 101 => 444, + 102 => 278, 103 => 500, 104 => 500, 105 => 278, 106 => 278, + 107 => 444, 108 => 278, 109 => 722, 110 => 500, 111 => 500, + 112 => 500, 113 => 500, 114 => 389, 115 => 389, 116 => 278, + 117 => 500, 118 => 444, 119 => 667, 120 => 444, 121 => 444, + 122 => 389, 123 => 400, 124 => 275, 125 => 400, 126 => 541, + 161 => 389, 162 => 500, 163 => 500, 164 => 167, 165 => 500, + 166 => 500, 167 => 500, 168 => 500, 169 => 214, 170 => 556, + 171 => 500, 172 => 333, 173 => 333, 174 => 500, 175 => 500, + 177 => 500, 178 => 500, 179 => 500, 180 => 250, 182 => 523, + 183 => 350, 184 => 333, 185 => 556, 186 => 556, 187 => 500, + 188 => 889, 189 => 1000, 191 => 500, 193 => 333, 194 => 333, + 195 => 333, 196 => 333, 197 => 333, 198 => 333, 199 => 333, + 200 => 333, 202 => 333, 203 => 333, 205 => 333, 206 => 333, + 207 => 333, 208 => 889, 225 => 889, 227 => 276, 232 => 556, + 233 => 722, 234 => 944, 235 => 310, 241 => 667, 245 => 278, + 248 => 278, 249 => 500, 250 => 667, 251 => 500); +$this->widths['Times-BoldItalic'] = array (32 => 250, 33 => 389, 34 => 555, 35 => 500, 36 => 500, + 37 => 833, 38 => 778, 39 => 333, 40 => 333, 41 => 333, + 42 => 500, 43 => 570, 44 => 250, 45 => 333, 46 => 250, + 47 => 278, 48 => 500, 49 => 500, 50 => 500, 51 => 500, + 52 => 500, 53 => 500, 54 => 500, 55 => 500, 56 => 500, + 57 => 500, 58 => 333, 59 => 333, 60 => 570, 61 => 570, + 62 => 570, 63 => 500, 64 => 832, 65 => 667, 66 => 667, + 67 => 667, 68 => 722, 69 => 667, 70 => 667, 71 => 722, + 72 => 778, 73 => 389, 74 => 500, 75 => 667, 76 => 611, + 77 => 889, 78 => 722, 79 => 722, 80 => 611, 81 => 722, + 82 => 667, 83 => 556, 84 => 611, 85 => 722, 86 => 667, + 87 => 889, 88 => 667, 89 => 611, 90 => 611, 91 => 333, + 92 => 278, 93 => 333, 94 => 570, 95 => 500, 96 => 333, + 97 => 500, 98 => 500, 99 => 444, 100 => 500, 101 => 444, + 102 => 333, 103 => 500, 104 => 556, 105 => 278, 106 => 278, + 107 => 500, 108 => 278, 109 => 778, 110 => 556, 111 => 500, + 112 => 500, 113 => 500, 114 => 389, 115 => 389, 116 => 278, + 117 => 556, 118 => 444, 119 => 667, 120 => 500, 121 => 444, + 122 => 389, 123 => 348, 124 => 220, 125 => 348, 126 => 570, + 161 => 389, 162 => 500, 163 => 500, 164 => 167, 165 => 500, + 166 => 500, 167 => 500, 168 => 500, 169 => 278, 170 => 500, + 171 => 500, 172 => 333, 173 => 333, 174 => 556, 175 => 556, + 177 => 500, 178 => 500, 179 => 500, 180 => 250, 182 => 500, + 183 => 350, 184 => 333, 185 => 500, 186 => 500, 187 => 500, + 188 => 1000, 189 => 1000, 191 => 500, 193 => 333, 194 => 333, + 195 => 333, 196 => 333, 197 => 333, 198 => 333, 199 => 333, + 200 => 333, 202 => 333, 203 => 333, 205 => 333, 206 => 333, + 207 => 333, 208 => 1000, 225 => 944, 227 => 266, 232 => 611, + 233 => 722, 234 => 944, 235 => 300, 241 => 722, 245 => 278, + 248 => 278, 249 => 500, 250 => 722, 251 => 500); + +?> \ No newline at end of file diff --git a/lib/MECON/PDF/external/template.class.php b/lib/MECON/PDF/external/template.class.php new file mode 100755 index 0000000..539ddfe --- /dev/null +++ b/lib/MECON/PDF/external/template.class.php @@ -0,0 +1,222 @@ +tid = 0; + } + + function create() + { + $temp = $this->nexttid; + // Stores the next object ID within this template + $this->templ[$temp]['next'] = 0; + $this->nexttid ++; + return $temp; + } + + function size($tid, $width, $height) + { + $this->templ[$tid]["height"] = $height; + $this->templ[$tid]["width"] = $width; + return true; + } + + function rectangle($tid, $bottom, $left, $top, $right, $attrib = array()) + { + $temp = $this->pdf->_resolve_param($attrib); + $temp["type"] = "rectangle"; + $temp["top"] = $top; + $temp["left"] = $left; + $temp["bottom"] = $bottom; + $temp["right"] = $right; + return $this->_add_object($temp, $tid); + } + + function circle($tid, $cenx, $ceny, $radius, $attrib = array()) + { + $temp = $this->pdf->_resolve_param($attrib); + $temp["type"] = "circle"; + $temp["x"] = $cenx; + $temp["y"] = $ceny; + $temp["radius"] = $radius; + return $this->_add_object($temp, $tid); + } + + function line($tid, $x, $y, $attrib = array()) + { + $temp = $this->pdf->_resolve_param($attrib); + $temp["type"] = "line"; + $temp["x"] = $x; + $temp["y"] = $y; + return $this->_add_object($temp, $tid); + } + + function image($tid, $left, $bottom, $width, $height, $image, $attrib = array()) + { + $this->ifield($tid, $left, $bottom, $width, $height, false, $image, $attrib); + } + + function ifield($tid, $left, $bottom, $width, $height, $name, $default = false, $attrib = array()) + { + $temp = $this->pdf->_resolve_param($attrib); + $temp['type'] = "ifield"; + $temp['left'] = $left; + $temp['bottom'] = $bottom; + $temp['name'] = $name; + $temp['default'] = $default; + $temp['width'] = $width; + $temp['height'] = $height; + return $this->_add_object($temp, $tid); + } + + function text($tid, $left, $bottom, $text, $attrib = array()) + { + return $this->field($tid, $left, $bottom, false, $text, $attrib); + } + + function field($tid, $left, $bottom, $name, $default = '', $attrib = array()) + { + $temp = $this->pdf->_resolve_param($attrib); + $temp["type"] = "field"; + $temp["left"] = $left; + $temp["bottom"] = $bottom; + $temp["name"] = $name; + $temp["default"] = $default; + return $this->_add_object($temp, $tid); + } + + function paragraph($tid, $bottom, $left, $top, $right, $text, $attrib = array()) + { + return $this->pfield($tid, $bottom, $left, $top, $right, false, $text, $attrib); + } + + function pfield($tid, $bottom, $left, $top, $right, $name, $default = '', $attrib = array()) + { + $temp = $this->pdf->_resolve_param($attrib); + $temp['type'] = 'pfield'; + $temp['left'] = $left; + $temp['bottom'] = $bottom; + $temp['top'] = $top; + $temp['right'] = $right; + $temp['name'] = $name; + $temp['default'] = $default; + return $this->_add_object($temp, $tid); + } + + function place($tid, $page, $left, $bottom, $data = array()) + { + $ok = true; + foreach( $this->templ[$tid]["objects"] as $o ) { + switch ($o['type']) { + case 'rectangle' : + $ok = $ok && $this->pdf->draw_rectangle($bottom + $o["top"], + $left + $o["left"], + $bottom + $o["bottom"], + $left + $o["right"], + $page, + $o); + break; + + case 'circle' : + $ok = $ok && $this->pdf->draw_circle($left + $o['x'], + $bottom + $o['y'], + $o['radius'], + $page, + $o); + break; + + case 'line' : + foreach ($o['x'] as $key => $value) { + $o['x'][$key] += $left; + $o['y'][$key] += $bottom; + } + $ok = $ok && $this->pdf->draw_line($o['x'], + $o['y'], + $page, + $o); + break; + + case 'field' : + $temp = ($o['name'] === false) || !isset($data[$o['name']]) || !strlen($data[$o['name']]) ? $o['default'] : $data[$o['name']]; + $ok = $ok && $this->pdf->draw_text($left + $o['left'], + $bottom + $o['bottom'], + $temp, + $page, + $o); + break; + + case 'pfield' : + $temp = ($o['name'] === false) || !isset($data[$o['name']]) || !strlen($data[$o['name']]) ? $o['default'] : $data[$o['name']]; + $t = $this->pdf->draw_paragraph($bottom + $o['top'], + $left + $o['left'], + $bottom + $o['bottom'], + $left + $o['right'], + $temp, + $page, + $o); + if (is_string($t)) { + $ok = false; + $this->pdf->_push_error(6013, "Text overflowed available area: $t"); + } + break; + + case 'ifield' : + $temp = ($o['name'] === false) || empty($data[$o['name']]) ? $o['default'] : $data[$o['name']]; + if ($temp === false) { + break; + } + $id = $this->pdf->get_image_size($temp); + unset($o['scale']); + $o['scale']['x'] = $o['width'] / $id['width']; + $o['scale']['y'] = $o['height'] / $id['height']; + $ok = $ok && $this->pdf->image_place($temp, + $o['bottom'] + $bottom, + $o['left'] + $left, + $page, + $o); + break; + } + } + return $ok; + } + + /* Private methods + */ + + function _add_object($objarray, $tid) + { + $oid = $this->templ[$tid]["next"]; + $this->templ[$tid]["next"] ++; + $this->templ[$tid]["objects"][$oid] = $objarray; + return $oid; + } + +} +?> diff --git a/test/PDF/downs/down b/test/PDF/downs/down new file mode 100755 index 0000000..7bff19e --- /dev/null +++ b/test/PDF/downs/down @@ -0,0 +1,2 @@ +#!/bin/sh +wget http://bal747f.mecon.ar/~mmarrese/meconlib/test/PDF/prueba_pdf.php; mv -f prueba_pdf.php prueba_pdf.pdf;gv prueba_pdf.pdf diff --git a/test/PDF/downs/prueba_pdf.pdf b/test/PDF/downs/prueba_pdf.pdf new file mode 100644 index 0000000000000000000000000000000000000000..580d69a93dc739d0ddfbbb8bda502ee4c14485b9 GIT binary patch literal 3241 zcmbW4c|2768^>obrj8|RTtz1uYaBCUERnL7X~7UmV$2*2vzV=rx|X6_DK!YCavMbT zLrO&yp{|=mvTH$$w7AGpx$c?vy06#o^?Uukuk*)zpYL;?&+|NU&g*#}oQJckDc+2T z>mO*o2jD?-kP{qkX9qyu(UC9+IZ*{vCMOhtJgA{CA0!~>6u{mdX44TjK(hV8{i7EE ztzpplpudI0IRJp1I6}4n!~+lo=5vHR8WM;2V;sr$a~xL=;w#a2C4rV7y&zXB(CV{4 z0QtEGhr_f_E^e$)B1rmjWN#0CPD>*Eue2m3@L(kPry7u~*aBpWdoJ5~Ux)e$EAeyoAAmkL_|}A#DO6Uj|(e2I7g90JIurgoYua zR+2t2IXtgODh=tYGrW~SgIDpW(E#Mg5b!-Qd=T~6Mgej?efh1sDJ5o>}ak|JNggQ+YasvE6=eLgkYIr|8uM0Ry^MWKFtLI4J#vdYD@q}eHk7v74 zb0m>hpx(LJPdr177#MwQrli?4YfX&!>5#+5$17*Zi{9>S zAFPDBEC(h{M9<6?NK^K_8J!0Ow5jBfq_R{l zq^j?P2>bQUpue(jH%ZDVnO>pO8O4Vdg53gB0k9T^Eb?*vL+6`zv@0M+9!20zvj#i!_fLd$KX?QHyCFhOTm?tchn}g zk+AHNd8gx(uWT3GEz`fE+ajWS6kfPuF3ucXysDKcEbl%>zVhNed34Uh;(&?H_Yr~N z7po7fjr`@N+^_l-%B8hF!kxuibxQ+(3+Zghbzzkc+Ikd}_xjxG2Ny4yrfZM)j_kK; zx~$fnw57*aF47Pm&NEn{{-o!2#;L-&WU_<1uTuZA6MhZNnMZc$L2m$@)(P6C(O-7T zThS{C$CBswXB;YY58nEELCzh$lW^7it+5ZyMF3dfsdpJ!(omefMx&0bTwTkb;B_v(n_M+kS%g)f&_eL8KU)8H!J9V)77Vg}}_ty{Q-aURUrquJPeXv$y<5B$P za?c`K1C~3BDp+^Ns0dam{k0djm#&fDbhs*-DNfCC-?%)no!g?(#8z~qzk3<>2Fva) z)4LJ7aOlyi(`>a>Q620DIGuBNrza`wWM;rf_}l0A=Ps=gs`xo$78{%8Qr-Idhu8PS z=Qgy+5lmm`3wLnyuNRI->`fgj9W2DWj%d1^9yxUKG2nMEU|h4ESMese?rP`R#slL? z3xb_o$_4$n2A@vbNpD4)1+)LlkT zM^cyQ*ZQhrEmp9FZ)eET)unAc6?wzE`4pjjdftIp2O)9(+GNwckfn;yceb$hz(9rnN;)LoUB5BYzH=< z@x=f@>!~bcY`c<>3H?P*f-?V~-2b9v^_`N0Yd$M|#)4AURpIT|TeF>IDK}88?aosxZ`~|?-{X~a(&lR5P>j*DR zTGLp+SFe<_lI1^M*THZ>9T%JS8r+mClo-?WRm<2#xlj@@06y{Wrq)wQ>NbuEfU zS~CfKMh3BV3Job*ExJuX#m%DrMc(gX_Wt_`via6%4<3guq#@*H7#S8BNe^K%g26C> zAaWT5ZQHiZERrK(P6ic$J6f0-jl+T>BbjE1tI>D=TNDot0n9-PekDQCmR8eF!0Yd8>EUKZ3Ln@@^1WOv%n({@J}`p;a?gA zYwPdw6Y!`ECd>mQT<^t*fhDy;6b=XZDnMFC0U$Sa2nUq3QSxyC@C8(!;A0mEHkL#H KhjVdv1^xjo3n6a+ literal 0 HcmV?d00001 diff --git a/test/PDF/prueba_pdf.php b/test/PDF/prueba_pdf.php new file mode 100755 index 0000000..6b6c819 --- /dev/null +++ b/test/PDF/prueba_pdf.php @@ -0,0 +1,21 @@ +seccion = 'Dir. General de Despacho y Mesa de Entradas y esto eso todo oooooooooooooooooooooooooooooo'; +$pdf->seccion = 'Dir. General de Despacho y Mesa de Entradas'; +$pdf->titulo = 'Alberto Giordano'; +$pdf->subtitulo = 'Filosofo Estilista, guacho pulenta si los hay'; +//$pdf->paginador = false; +//$pdf->fecha = '2/10/2003'; + + +$pdf->display(); + +?> diff --git a/www/images/pdf_logo.gif b/www/images/pdf_logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..52359f3e3495bf41896b8218dbe3880a16b69867 GIT binary patch literal 3214 zcmV;93~}>ENk%w1VaNa|0QUd@000010RaL60s{jB1Ox;H1qB8M1_uWR2nYxX2?+`c z3JVJh3=9kn4Gj(s4i66x5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7 zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}? zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5( zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p zxVX5vxw*Q!y1To(yu7@dCU$jHda z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4 z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg= z{r&#_{{R2~EC2ui0LTC+000R70RIUbNU)&6g9sBUT*$DY!-o(fN}Nb>pg({7>dAvQ z4_`lj1^e;a2d~?-XV$*4+sCh8#g{N+%A844V7__h#Od6rbDTSR{L*m)W~!*sqo{m! zYge>N|^8}Y5E4{ zRfSV~9aeAPK3sh`%brcUw(Z-G33V$dPS|MDI=kIcZHknpNysNz0!8>1Q-S_+;hs*t zx^>ONEOxVH4R~-|sZsvL8a2qz<2``}T@uxGSG|b;y?Tp zV@fduQo~ANx4g)cE0!I?V^Oa>_m4c9P`1e~yS(#{KiIG-WNn_+vt*M^64}X=@Sw6v zcis(0SS;9FwGAMaH4N%yAuMnusDTPTx+A5ayp@~te zz(WvJAGTwos%b?nj77i_k zTxN+;z2GyDHOo#K86WQaV+|j~yho5V4mVazLfCZp2Q>mAq6aI}@FUPRdN8sLLhP^t zX=96&^N%}w^ukU-*)%8_DBc#-&MJ`7lF&OjOIFG-MOEY7HCuXx3~Aqd{K?aj6+%i; zrnP-n9~hN{LGV>K;z80GeSM<@v}glRI?93-{>((%>USf&N%7VBhYKx zN_|f@F7-1{J_C6(NMxua=8rhsa03qN`|M(**a(qbSt+U%1*oCE>_QkS-jL=@DyEde zcV(s;rH*T&^!@6~m}lOLDx8=S%;fxx;ut2bi1SZAu()ErE1%5w_|yW;W6d<^cw@Oc z#kdm6B7`&&N--|g)5v2{8^}F^v5M^3Vl1S9j3-*-4q2>D4}d7eJkBH~Jw(D4*boRY z&gTkL;0R+z`5j=20V=Q5q8VP|2{w9Hlu>+;GL#4*K};dNW;q6M_n-zK=Cp@kfaDmE z{*hH=)~AneI06uT=))g|wFf}ZO%Hrn+%EtqwS7E85j>=YOXTO6Kyc$9^e9_nGBG)3 zJVsNu3L$X1(Tc*TA{tiNPFE~pnM4@H7&ELP_5QJqi#;Y0Mq|dMgb11S#o~dQQG`H* zLB)T(!#t3=#CyQ;7)JMoGu)Y#y1|gEXfpO+5Z% zPH4=`qD=7%0!^cYMo~pKtfCB55M~s9l#Ed%HV_)pa(aJ@87?DZv~5_(F}`&F3@|CP z2T)8S9Y!+t!p=F`ap^)b772Ps0q*S`8S6n;diWlCXAQ=DQz1iD6HpYfM&w5==ns!UN- z;Uty(pOFb?;RY(O%z@U$gobLm;KW{y>bJS%b?(+iL| zLz#2cLqTIJ)TQmC6`CPZ^lqgwqrj0s;MfH;{-TY?9wmL15kygbdWRmwWuK?0>Ekh($q=+82Fp4dBOCWCe#VYYF3>_;Y2~(^>9t5c^ zbZyv}TXuH9`25E{PI2I%Nk*3caE2=#XNvHS_n@+MOd?R1k7!B;5Ega}FF>M33QcYAa9i~oXjOmK@5U~W5SYADOg$hn6WxW7XsnNOPBsc+Q(2rW$N&RWA=cF zW{kzP;;k!?g~|tCfCL`1c-kLM0kp?x!gJ_|EEK^E85Pyzv8Z^)l&P$fYM_QNl-Mz3 z1|f=7q{B7nolGpsQ4ZAo10JM?l#2!YSwX0*AL-DBHOO%cpCR~_;yV*Lvf+(#pm>4} z?kQ~d44Falvs)eoP^ZF}Z{EgUpxUsw2hN zXo2Wsqee+ZFjBb2VX)9Eq)0@mM1hNfXRcqAk;OSiPXF?et2!I!D8^*UaSmnh(s7m$ zN6CFLA3qRdhyRZ@Hh~ZTS1FtM6?;UXhmVq2?@9V(H6iK$Tjp{_sUy-Gr1^8JU&L8&X*z)j(1EU zm_ZMMc%xvKPrd3Vvj_ebL?6SjZ|9Fv3QW8_GJx1bH-5xPZuEWiz*qe%JWh~)kYnt# zKguf}@kGdQVjA=w$SzPH{OVgC5xg)pLiVwaV0qkP@rL0=&Gd1PYLvnglt{!N4B?1P zfC3lwU@k%MVUPOT|Ni*Tzy9~n|Ni^`{{R?(0yu#DhYxzO5cB{J-B1n1zzeic3%sxl z+t3Z<5Ksi+5AhHV+R$wB7Zo1(fgt#S{?HF3_z@v^f+(1RD!76y*n%#Y5CH)IJ2d_M A&Hw-a literal 0 HcmV?d00001 diff --git a/www/images/pdf_logo.jpg b/www/images/pdf_logo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b4f58b31dd1e4122ef9068c786149c3b5fb041c3 GIT binary patch literal 1815 zcmV+y2k7|!*#F=F5K2Z#MgRc;0Rb!lEC2xi+W5_|G)qX2ml)Z zhyei+0RO}Q9RL6U1Oov90000000000000031O*2I1_%KO|HJ@35C8!K0t5mC3JL%R z00000009C61O)~F2N59>6BRK*Q4|<5RaRk>l+n@%78fETLQ-*okux`Pb+f_Y|Jncu z0RaF2KLGkkKKAEKml6O4G1tmmjX@k^%1HgOUtf8g{jkq1nM-=4=IKFM;XwULAN7jX zZ{aiaDsU)P5HyZETuWo{$v~$BXFFMl{xR;Z0 zr9PyguM2IIC2J%Eq#jw^k}-wXo|&g;R^(EpUMQ0$I*J`JTV-iVfgq<|SlkeG#7B(Q zW_nWhyR-6QQ|;3>&9H6{tZ#H!m*70!OCRF!aq#KE`f(TIHJP52z3%M%m^@~)Gt!s6 z-Jg>OjMip)Qun*F@?i0r%+E?*_jZ0v9y3{)=}X@3&&h+vYcoA5d)?XjF)2~cT-&A5 zX*FpV8_0!J4w$ZTSUh~S@Gou+v^a5N{U`GQyS9{?g>2MeIVHBwzRxCg6Tbp}OBU2i4taV3Pm z8C16li@GRt5Zi!l{A>ISbEZ}Q0GalW`@B#2lZyh!ropRyC}+i~LSmx{RVtdCjU}+Q z*TRR?H3x3652%5MxqEcbvnIJB(UW9QskFH;q?qy{N78I{w%VLZx$4zQ@(ACrUG~`f zYhP-$zK%$FG%6iam2s*!1x^ZIO0{E;jDmMq*Muwd?Tl=?r4#I`^t&pSl^&%rHD(JD z`5dO0E7XLehj4&@Cb|)^!d7*DuXZA_Ux{Ye(V<0cw&Xidr?%Wy$l@R&B>7|=^xW`_ zH_f;d+J;`+R|{|`F=}!rKNaQM%$B362}(*qPgfA)I-gj^&zP5eBQNg?B^sY&TJjlw z3^!!EGMtAN;+B!APhxiN8=cN0pk=)lc6{G3lL{cGQ6tEm9t4*QQI@2XB`8|8`=|xY zd$!Z74y%-ibz3gv7Zgh-42C0_RM)N2%P;f6ABI9aq!g8Gd%tZHy>mrzGKRo+>bTkU0>@M?7HPHeo$Nz+(bpnwq>lk zg35K|l6FqLnra69V@}+8Co}EE6u+a7zQ`r5S^L0|q0pYKda+UFK4Kb!%9}Av47kpiewk2&62%&Y^0E#Pgy;K)^X7n&2A1tWcuuA?+0$$vm?WN z9O>ZgsBRQTc-L;;B_6FYL*rUH&p~le* zGA-&Rb$xNBz^U|WijecMCP7;Zq@)4r-@j!3z0u(1 z<^*R8fvXOhL~|q_+t-HKlYhm% zuNrM)G*{SWEJ(4`+q!WQ(m*6=dXAWtb2$?iHY@i;YFL>`tfj^!Qzn7<(bf~hf=0R> zQVyfLyHSYif~S`K86eRpb>mWbB`6gMh~!5n^CTfWO4G0tziu7EzAakDUec}WmX%d9 z=&6t(N~S)9rDfHXkm6R8uvZUPU^vvQT1=|V=|zbRhaP#!jR2ISod+1)_W{~*^##_D z`U)IER)f}+4MD^MnRRQr;+DDvJxWp3lN~#s>kr?yX%eCsuTvsBABTgMwo+5W-PMI@ zlsa`4q_+YLcxXy^LRe@cLEW}9ev<}MrN^Pib;H)Rw31KqMib~7Z=2%#6#OuB4L8m4 zeTse^ba^L$@opN0;Brun`vu}{MXK+}BR7ucuagP>`?Z;R|x@WIeD z-#5kfDfnRM8gHB8`xN{zbPYGn@qLPZ7&-=<=J>wFKMW|vDil`(jKg7-kIaUWll_5@ F|JmuxOFsYr literal 0 HcmV?d00001 diff --git a/www/images/pdf_logo.png b/www/images/pdf_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..1251f85aedd51e5a081b0a8a00b7965564fc7473 GIT binary patch literal 2429 zcmV-@34->CP)2TUs00009a7bBm001r{ z001r{0eGc9b^rhX33NqRbVF}#ZDnqB004<9jRpV!2^vX6K~#90%~|Y=i0mu3(&A1Q1JL zawWEdXZ_shxUzzMS~p2&hVcwS#!=fjS5+0JH#wB`WPxNN>V2ymK%oM(5y z4Y5J|KM9LnUgTo1IbpFu&cloqaELHAaC9}UEK*=tjBMP=m_ry$H?AXt%0pen&%GiD z(Z;Pp1v=u)_g|kgw#0lDz#?Zj*GZAb?VI!&C>^R7!xL3xh%7Nyj3`bQV+$BY5n=OS z5KI(xg1qS>l{{0WfK*=5vrviC+pR*S%S)aN3g=Uh^`H%eN^%EPl%t5I68bZQ5ur-& z^S41S=L%z`ke`c{(J%i)mrMprA6&wDF5U;t`^U7p&);`n3!jec{r#BuLA=1YDr7(a zJgKRN3EC<~$3o#5(909&VrE*y@;@O7xA*VnMosl8VvLAV5YMj#(m zHN-{Opl}YrEg+OzONoVG;)EV^$(RBo``D<*RaJr=Tg%BbCY*-^%7$!^=i5qj5Ra9K zXcikFF7bTP;*uaT0b$3GUyer_^3x?(N^q}>1+2ZfqekWz3{3r(1s zF+kvw^QRjUW>o?Tz|!$r|P#y+izVfs@W z{TdxEWX!%Cl`o0JdfCMdX^;>Pl8`LO6f*xrx{XwvN+xf22VU8XKV2lqMU-3;OKb>} zc|$(|^YwCi z_=d(T1LYfl*!7RGYtPPlX=q;uS)!>&h{z_jo_cgDUm1g23^@ zW=){wPD}EHKwzw?A21~~W2VbLK4O2YfY0Ym0}-LsfsKC7?~9RAKBXl{4aA9m6Yq6% zEkcoQje9^KcnD#Kc({TIY!t#3bBzjfEpU{18E)jv;B0=_k3=)Ki`aDNE$P-acoarE1IoWO}mrPO3(ma1D9eEAp z)C5U=z&}?&o@I!xe%>#sZ0MC<`s6yiZ72vfe7x&N`@dX%K4at2z3xfsTgqJ z-9Y9ADvSssie7{&>iuYRgiVTP_HKWd(~wI%ek5XfZ=zp!snr)GgP;^vY;TDwQ}nIygSp0F#OML1pUinu2H8&p@5t+M@;%Gy%r*M?kcAI@#M|w>!v%R zqs+YqXAj&cSfrFHw;M?n)VuLDdzrhjXX?Xbm%CC^&Z}|PF{QFKus+pz*POn%p>KX| zqFLV5OWb&XdO`EmSr+E8VW|q5JeKu);~Qh+zvPds#xH(?6_h@@M9VV~vB%)gPzn;q zm-xzOiobx77gy}eiAT=nV4R+|SWOJ$`pf6tQ_3HbbOg>;@t%5ofiG-o=SJ@(q|}X# z@CC&ExRPFDzWpjI5nQwpS=)hjjYr?Cwry7EP|;@Y6TCT-2F=5>5II}SCj!b?3Z_M$ zCA5ghhE2_-Bt>E+cO+=RT-UO@^WgueBZc3HNA6|fQjYv!zaYP`@ghP+riY9pSS8gKG zZP_F0sF?VjJg@qVYjBgfUGZrvMfF{^#r z%4FGV9*INxmZ`Mp;1y{fr;OG9pF}FpU{AX~J8mKpvus8onTc%CIzL*Og#GhcYfb0z z$Ws3b@pZDzv}Kwf5jne;fe3DlG4?|u-B`2ot`X_FP6Xz0q3y4?)$8*1sebadZuWXk zA30&$I{VE;UgCkB8jf@#wde4)8Gn_A*;IBS_K_4EybxKz*)A_aji>O1Ld0%a0uo8B zQmX2DdzHq#zVFkMRwZ919-C$kPpj;ih_DxD*7R%ak&39Em+P_6cDUL$Z{=*))pBjQO$4Q(=iKrMi#KS_yx)dv$eA|8~HLzWEy{m#5#umsw7` z+*4}(>{R^zyKu+dtP}oAqI}fvBgvhi>nysftcGt|kP+hl?P$1$FVb&_-@~C`V7Rw$ v_}zMFCn5V%hudqR=q3E_@=HEv{|fmFQ$|mO)&fXq00000NkvXXu0mjfo8N{@ literal 0 HcmV?d00001 -- 2.43.0 From 8c7295e6b1d27e3f563b27fde72ada98c6cf7ac8 Mon Sep 17 00:00:00 2001 From: Manuel Nazar Anchorena Date: Thu, 30 Oct 2003 20:37:55 +0000 Subject: [PATCH 14/16] Se hace que colspanee la primera columna si no hay una central. --- lib/MECON/HTML/Tabla.php | 49 ++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/lib/MECON/HTML/Tabla.php b/lib/MECON/HTML/Tabla.php index b4a7551..af155b9 100644 --- a/lib/MECON/HTML/Tabla.php +++ b/lib/MECON/HTML/Tabla.php @@ -140,15 +140,7 @@ class MECON_HTML_Tabla extends HTML_Table { $tabla_externa = new HTML_Table(array('width'=>'100%','border'=>0)); } // Si tiene cabecera, la agrega. - if ($this->_cabecera) { - $tabla_externa->addRow($this->_cabecera, array( - 'valign' => 'middle', - 'width' => '33%', - )); - $tabla_externa->updateCellAttributes(0, 0, array('align' => 'left')); - $tabla_externa->updateCellAttributes(0, 1, array('align' => 'center')); - $tabla_externa->updateCellAttributes(0, 2, array('align' => 'right')); - } + $this->_addSpecialRow($this->_cabecera, $tabla_externa); // Si tiene cabecera o pie, agrega la tabla original. if ($this->_cabecera or $this->_pie) { //$id = $tabla_externa->addRow($result); @@ -160,16 +152,35 @@ class MECON_HTML_Tabla extends HTML_Table { )); } // Si tiene pie, lo agrega. - if ($this->_pie) { - $id = $tabla_externa->addRow($this->_pie, array( + $this->_addSpecialRow($this->_pie, $tabla_externa); + return ($this->_cabecera or $this->_pie) ? $tabla_externa->toHtml() : $result; + } + + function _addSpecialRow($array, &$tabla) { + if ($array) { + $row = array(); + foreach ($array as $key => $val) { + $row[$key] = $val ? $val : ' '; + } + $id = $tabla->addRow($row, array( 'valign' => 'middle', - 'width' => '33%', + 'width' => '33%', )); - $tabla_externa->updateCellAttributes($id, 0, array('align' => 'left')); - $tabla_externa->updateCellAttributes($id, 1, array('align' => 'center')); - $tabla_externa->updateCellAttributes($id, 2, array('align' => 'right')); + // Si no hay celda central, hace colspan. + if ($array[0] and !$array[1]) { + $tabla->updateCellAttributes($id, 0, array( + 'colspan' => 2, + 'width' => '67%')); + /* } XXX se complica hacer el colspan para atras: + elseif ($array[2] and !$array[1]) { + $tabla->updateCellAttributes($id, 1, array( + 'colspan' => 2, + 'width' => '67%')); */ + } + $tabla->updateCellAttributes($id, 0, array('align' => 'left')); + $tabla->updateCellAttributes($id, 1, array('align' => 'center')); + $tabla->updateCellAttributes($id, 2, array('align' => 'right')); } - return ($this->_cabecera or $this->_pie) ? $tabla_externa->toHtml() : $result; } /** @@ -297,7 +308,7 @@ class MECON_HTML_Tabla extends HTML_Table { * Setea la cabecera. * Ejemplo: * @code - * $tabla->setCabecera(array('Hola', ' ', 'mundo!')); + * $tabla->setCabecera(array('Hola', '', 'mundo!')); * @endcode * * @param array $cabecera Array de 3 elementos, que son la celda izquierda, @@ -325,7 +336,7 @@ class MECON_HTML_Tabla extends HTML_Table { */ function updateCabecera($cabecera, $lugar) { if (!$this->_cabecera) { - $this->_cabecera = array(' ', ' ', ' '); + $this->_cabecera = array('', '', ''); } if ($lugar == 'izquierda') { $this->_cabecera[0] = $cabecera; @@ -365,7 +376,7 @@ class MECON_HTML_Tabla extends HTML_Table { */ function updatePie($pie, $lugar) { if (!$this->_pie) { - $this->_pie = array(' ', ' ', ' '); + $this->_pie = array('', '', ''); } if ($lugar == 'izquierda') { $this->_pie[0] = $pie; -- 2.43.0 From c3b42bba0c46c9510b6ca095dfab862ff97170e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mart=C3=ADn=20Marrese?= Date: Mon, 3 Nov 2003 23:15:42 +0000 Subject: [PATCH 15/16] PDF en camino --- lib/MECON/PDF.php | 14 ++++ lib/MECON/PDF/Marco.php | 51 +++++++++---- lib/MECON/PDF/Marco/medidas.php | 64 +++++++++++++++- lib/MECON/PDF/Tabla.php | 111 ++++++++++++++++++++++++++- test/PDF/downs/prueba_pdf.pdf | Bin 3241 -> 7858 bytes test/PDF/prueba_pdf.php | 129 +++++++++++++++++++++++++++++++- 6 files changed, 348 insertions(+), 21 deletions(-) diff --git a/lib/MECON/PDF.php b/lib/MECON/PDF.php index 08250ec..bbd2ed8 100644 --- a/lib/MECON/PDF.php +++ b/lib/MECON/PDF.php @@ -196,6 +196,20 @@ class MECON_PDF { return $this->_pdf->wrap_line ($texto, $l_max, $attr); } + /** + * Funcion que wrappea una linea. + * + * @param strgin $texto Texto que quiere wrappearse. + * @param int $l_max Largo maximo del texto. + * @param array $attr Atributos del texto. + * + * @return string + * @access public + */ + function wordWrap($texto, $l_max, $attr) { + return $this->_pdf->word_wrap ($texto, $l_max, $attr); + } + /** * Funcion que calcula cuanto va a ocupar cierto texto segun su formato en * una pagina. diff --git a/lib/MECON/PDF/Marco.php b/lib/MECON/PDF/Marco.php index 8d70976..397a5ae 100644 --- a/lib/MECON/PDF/Marco.php +++ b/lib/MECON/PDF/Marco.php @@ -44,7 +44,7 @@ class MECON_PDF_Marco extends MECON_HTML_Tabla { * @var array $conf * @access protected */ - var $_conf = array (); + var $_config = array (); /** * Tamanio de las paginas. @@ -124,8 +124,9 @@ class MECON_PDF_Marco extends MECON_HTML_Tabla { $this->_pdf =& new MECON_PDF; $this->_tamanio = $tam; $this->_orientacion = $ori; - $this->_conf = include 'MECON/PDF/Marco/medidas.php' ; - $this->_conf = $this->_conf[$tam][$ori]; + $this->_config = include 'MECON/PDF/Marco/medidas.php' ; + $this->_config = $this->_config[$tam][$ori]; + $this->MECON_HTML_Tabla(); } /** @@ -135,7 +136,7 @@ class MECON_PDF_Marco extends MECON_HTML_Tabla { * @access protected */ function _addLogo() { - $conf = $this->_conf['encabezado']; + $conf = $this->_config['encabezado']; if ($this->logo) { $this->_pdf->addImage($this->logo, $conf['logo']['X'], $conf['logo']['Y'], null, 'jpg'); @@ -149,7 +150,7 @@ class MECON_PDF_Marco extends MECON_HTML_Tabla { * @access protected */ function _addSeccion() { - $conf = $this->_conf['encabezado']; + $conf = $this->_config['encabezado']; if ($this->seccion) { $tmp = $this->_pdf->strlen($this->seccion, $conf['seccion']); $tmp2 = $conf['linea2']['Xi'] - $conf['linea1']['Xi']; @@ -171,7 +172,7 @@ class MECON_PDF_Marco extends MECON_HTML_Tabla { * @access protected */ function _addSubSeccion() { - $conf = $this->_conf['encabezado']; + $conf = $this->_config['encabezado']; if ($this->subseccion) { $tmp = $this->_pdf->strlen($this->subseccion, $conf['subseccion']); $tmp2 = $conf['linea2']['Xi'] - $conf['linea1']['Xi']; @@ -194,7 +195,7 @@ class MECON_PDF_Marco extends MECON_HTML_Tabla { * @access protected */ function _addPager() { - $conf = $this->_conf['encabezado']; + $conf = $this->_config['encabezado']; if ($this->paginador) { $txt = 'Pagina '.$this->_pdf->numPage().' de '. $this->_pdf->countPages(); @@ -213,7 +214,7 @@ class MECON_PDF_Marco extends MECON_HTML_Tabla { * @access protected */ function _addDate() { - $conf = $this->_conf['encabezado']; + $conf = $this->_config['encabezado']; if ($this->fecha) { if ($this->fecha === true) { $this->fecha = date("d/m/Y"); @@ -233,7 +234,7 @@ class MECON_PDF_Marco extends MECON_HTML_Tabla { * @access protected */ function _addHeaderRectangle() { - $conf = $this->_conf['encabezado']; + $conf = $this->_config['encabezado']; //Armo el recuadro $this->_pdf->addRectangle ($conf['Yi'], $conf['Xi'], $conf['Yf'], $conf['Xf']); @@ -250,16 +251,16 @@ class MECON_PDF_Marco extends MECON_HTML_Tabla { * @access protected */ function _addTitle() { - $conf = $this->_conf['titulo']; + $conf = $this->_config['titulo']; if ($this->titulo) { $tmp = $this->_pdf->strlen($this->titulo, $conf); - $tmp2 = $this->_conf['Xf'] + abs($this->_conf['Xi']); + $tmp2 = $this->_config['Xf'] + abs($this->_config['Xi']); if ($tmp >= $tmp2) { $this->titulo = $this->_pdf->wrapLine ($this->titulo, $tmp2, $conf); $tmp = $this->_pdf->strlen($this->titulo, $conf); } - $init = $this->_conf['Xi'] + ($tmp2 - $tmp) / 2; + $init = $this->_config['Xi'] + ($tmp2 - $tmp) / 2; $this->_pdf->addText($init, $conf['Y'], $this->titulo, $conf); } @@ -272,16 +273,16 @@ class MECON_PDF_Marco extends MECON_HTML_Tabla { * @access protected */ function _addSubTitle() { - $conf = $this->_conf['subtitulo']; + $conf = $this->_config['subtitulo']; if ($this->subtitulo) { $tmp = $this->_pdf->strlen($this->subtitulo, $conf); - $tmp2 = $this->_conf['Xf'] + abs($this->_conf['Xi']); + $tmp2 = $this->_config['Xf'] + abs($this->_config['Xi']); if ($tmp >= $tmp2) { $this->subtitulo = $this->_pdf->wrapLine ($this->subtitulo, $tmp2, $conf); $tmp = $this->_pdf->strlen($this->subtitulo, $conf); } - $init = $this->_conf['Xi'] + ($tmp2 - $tmp) / 2; + $init = $this->_config['Xi'] + ($tmp2 - $tmp) / 2; $this->_pdf->addText($init, $conf['Y'], $this->subtitulo, $conf); } @@ -309,6 +310,26 @@ class MECON_PDF_Marco extends MECON_HTML_Tabla { if ($subtitle) { $this->_addSubTitle(); } +// $this->_pdf->addLine($this->_config['Xi'], $this->_config['Yi'], +// $this->_config['Xf'], $this->_config['Yi']); } + + /** + * Funcion que devuelve el espacio dispobible en una pagina. + * + * @param int $pagina Numero de pagina. + * + * @return int + * @access protected + */ + function _getAvailableSpace($pagina) { + if ($pagina === 1) { + return $this->_config['contenido']['Y']; + } + else { + return $this->_config['titulo']['Y']; + } + } + } ?> \ No newline at end of file diff --git a/lib/MECON/PDF/Marco/medidas.php b/lib/MECON/PDF/Marco/medidas.php index 1dbb57c..ca4981a 100644 --- a/lib/MECON/PDF/Marco/medidas.php +++ b/lib/MECON/PDF/Marco/medidas.php @@ -27,7 +27,6 @@ $Id$ /** * Medidas para cada formato de pagina. */ - return array ( // A4 {{{ 'a4' => array ( @@ -35,7 +34,7 @@ return array ( 'portrait' => array ( 'Xi' => -40, //Esquina inferior izquierda 'Xf' => 490, //Esquina inferior derecha - 'Yi' => -110, //Esquina inferior izquierda + 'Yi' => -50, //Esquina inferior izquierda 'Yf' => 700, //Esquina superior izquierda //Encabezado {{{ 'encabezado' => array ( //Encabezado de cada pagina @@ -99,6 +98,67 @@ return array ( 'height' => 13 ), //}}} + //Contenido {{{ + 'contenido' => array ( + 'Y' => 580, + ), + 'celda_cabecera' => array ( + 'alto_linea' => 13, + 'font' => 'Helvetica-Bold', + 'height' => 11, + 'fillcolor' => array ( + 'red' => '1', + 'blue' => '1', + 'green' => '1', + ), + 'fill' => array ( + 'mode' => 'fill+stroke', + 'fillcolor' => array ( + 'red' => '.3', + 'blue' => '.3', + 'green' => '.3', + ), + 'strokecolor' => array ( + 'red' => '0', + 'blue' => '0', + 'green' => '0' + ), + ), + ), + 'celda_titulo' => array ( + 'alto_linea' => 13, + 'font' => 'Helvetica-Bold', + 'height' => 11, + 'fillcolor' => array ( + 'red' => '0', + 'blue' => '0', + 'green' => '0', + ), + 'fill' => array ( + 'mode' => 'fill+stroke', + 'fillcolor' => array ( + 'red' => '.7', + 'blue' => '.7', + 'green' => '.7', + ), + 'strokecolor' => array ( + 'red' => '0', + 'blue' => '0', + 'green' => '0' + ), + ), + ), + 'celda_comun' => array ( + 'alto_linea' => 10, + 'font' => 'Helvetica-Bold', + 'height' => 8, + 'fillcolor' => array ( + 'red' => '0', + 'blue' => '0', + 'green' => '0', + ), + ), + //}}} ), //}}} //LandScape {{{ diff --git a/lib/MECON/PDF/Tabla.php b/lib/MECON/PDF/Tabla.php index cd1d7d4..9a82158 100644 --- a/lib/MECON/PDF/Tabla.php +++ b/lib/MECON/PDF/Tabla.php @@ -39,10 +39,115 @@ class MECON_PDF_Tabla extends MECON_PDF_Marco { * @access public */ function display() { - $this->_pdf->newPage($this->_tamanio); - $this->buildPage(); + if ($this->getRowCount()) { + $this->_agregarContenido(); + } + else { + $this->_pdf->newPage($this->_tamanio); + $this->_pdf->addText($this->_config['Xi'], + $this->_config['contenido']['Y'], + 'No hay contenido para mostrar.', + $this->_config['contenido']); + $this->buildPage(); + } $this->_pdf->display(); } - + + /** + * Funcion que devuelve el estilo de la celda segun la configuracion. + * + * @param int $row Indicador de la fila + * @param int $col Indicador de la columna + * + * @return array + * @access protected + */ + function _obtenerEstiloCelda($row, $col) { + $clase = $this->getCellAttributes($row, $col); + switch ($clase['class']) { + case 'mecon_html_tabla_comun_cabecera': + $estilo = $this->_config['celda_cabecera']; + break; + case 'mecon_html_tabla_comun_titulo': + $estilo = $this->_config['celda_titulo']; + break; + default : + $estilo = $this->_config['celda_comun']; + break; + } + return $estilo; + } + + /** + * Funcion que agrega las filas y columnas a la pagina. + * + * @return void + * @access protected + */ + function _agregarContenido() { + //Calculo el ancho de la columnas basandome en el ancho que tienen las + //mismas en la primer fila {{{ + $ancho_pagina = abs($this->_config['Xf'] - + $this->_config['Xi']) ; + for ($i=0; $i<$this->getColCount(); $i++ ) { + $tmp = $this->getCellAttributes(0,$i); + if (is_null(@$tmp['width'])) { + die ('Todas las columnas deben tener asignado un ancho.'); + } + $attr[$i] = intval($tmp['width']); + } + $tmp = array_sum($attr); + $attr2[0] = $this->_config['Xi']; + for ($i=1; $i_config['Xf']; + ///}}} + + $this->_pdf->newPage($this->_tamanio); + + $alto = $this->_getAvailableSpace($this->_pdf->numPage()); + + for ($i = 0; $i < $this->getRowCount(); $i++) { + $max = 0; + for ($j = 0; $j < $this->getColCount(); $j++) { + $estilo = $this->_obtenerEstiloCelda($i, $j); + $txt = $this->_pdf->wordWrap($this->getCellContents($i,$j), + $attr2[$j+1] - $attr2[$j], $estilo); + $max = max($estilo['alto_linea'] * count($txt), $max); + + } + $alto -= $max; + + if ($alto < $this->_config['Yi']) { + $this->_pdf->newPage($this->_tamanio); + $alto = $this->_getAvailableSpace($this->_pdf->numPage()); + } + for ($j = 0; $j < $this->getColCount(); $j++) { + $estilo = $this->_obtenerEstiloCelda($i, $j); + + $this->_pdf->addRectangle($alto, $attr2[$j], + $alto+$max, + $attr2[$j+1], @$estilo['fill']); + + $txt = $this->_pdf->wordWrap($this->getCellContents($i,$j), + $attr2[$j+1] - $attr2[$j], $estilo); + $alto1 = $alto + $max; + foreach ($txt as $t) { + $alto1 -= $estilo['alto_linea']; + $this->_pdf->addText($attr2[$j] + 1, $alto1 + 1, + $t, $estilo); + } + } + } + $t = true; + foreach ($this->_pdf->getPages() as $page) { + $this->_pdf->_pagina_actual = $page; + $this->buildPage($t, $t); + $t = false; + } + } + } ?> \ No newline at end of file diff --git a/test/PDF/downs/prueba_pdf.pdf b/test/PDF/downs/prueba_pdf.pdf index 580d69a93dc739d0ddfbbb8bda502ee4c14485b9..7ea75be2130c1f9d93a9a5caf4f211c04ed71f47 100644 GIT binary patch delta 3166 zcmb`KX;2es9>z*;n z6_IOfR1Qf)L}5ljgb2)t$_gToj^aeYRSc&g9N~}vZjPE-OLl8&*X<8)z5RcG{XE~E z=WV|J4Tp2zt|HhFhy-tcoRteVCL)?(oyj5E0tAX`h_l*B1!#or>b;{Q&gvVF1DufH zXo9^x&T3EiAu3=)plU$X8)Z9zmU(x_QW7!ivnAWJbhW&70Gy*EAtd4;_W%cHlljDQ zDT$;!+p>gu(|pO(KP#bSTC}WkEt8c1?E{jgK2_$P}vb@Mv^YNKiN~UVKK} z&FuACllp3+HZA$7ALrNM=Gdrbv4ulBc>ETfb$=)Fml`eIARiI*esxfMZra7ml^Bo+ z2SkmpN_5KYGY=>j7I@!v>q;0q(&FJqwP=ZXH_;UQ^Pt!CjO6OYz);dQc7dDg;Lv4u zjU;j3H5fKzTTSDe@RA`}R3s&59*&pQ^yW7nPLknuXQZQNwGK4o7s4->Ji_bVJN4y2 zV1Z)!{iNpv*;MbwnEQ$v!T5udERUgcEDz=i8sz}Bujq5h@J~i9y{!kFW+Kl>d~O=F zwA~J{w_-N`Xj^ltvnjI;PdY1}48jocxU?2K0xzFA9O(Fbn)gsQ`9hs%dCj2*>z`n+ z-nL{sK7nV=g2!Oa_`9Mx>445IZvVRa&pW3jTZ*a1vkh}?1JeDj1zvKHvP-%0H(Y7o zI_vH#Bh9+gHH&G2RdL+9dUmJX>7McdL%PgW{>7CzvxM|cJH2||!1a@t*VX&Now`?Q z%o4oiYdV)*DNQq4=intwUiJzfvO?3)MCFvrJs(sd(^m`;#2m`yZRT}DR&;>Fmf&QYQ3eh4!M+h8O zQyMAAz!_6RDyhE#Iz^BgQb{fL8&W}rN!&-~ja)ubJU7$ZS zR08w0l~fFme+8`oVuYd-8p?~sMr@%WXAM=x-v(X+Vv017N{Wfpb%@lEN@@$}A2y_d z)Jlu}3{;Sd(vMTZ*8+7Y6du0_MFEOXbR0%g5kx5RWU&wfh~uoJK!{VuHwDiClp+l! z5@n-15u`%{aX1XtmmnCXhSXA-=w^VTg49a8S-OaU3Q{XA@n(AL#gKcj!0Q*f`eLwC$4*7y>G`B&C;>Rnz;)Wek)*Rr%@!#dM%Q`6i6 zM3=nwj~0)l3+w5TS_U%ntJ)p$fnNS8sN3z=`Hlg<_`aMN8^1oA3meNrcSN!_`o)#Y zPB*-G!R88}{AnzsPBJ&G5I73PBj-X*uEQP=t=p3vwxjNO~)xiT9dH9 z$2EzhOm<~%XT8=Uz$9xL`NIr8A#P``XRk{gORjkRR&0q|SZIsS4bR%`@5Ato_;xAl zHO~H&;VwpHL+~M{GjEVlE+Oc?T=Ejxz9ut$d>n}9g_w{lUZ2PvyJvwaLhsDDqg{l2xvW-W#jGQaB zd$YYQZg)^Zsd6u0J$P!6C)CBdb>eYX<(Y4JMfW6C&*bIJ5H*}C-VoPBHm524}JNzcZETRkSFvnlV$GG^Bu zCkJ!3B@8z{Czsdc? zo`_q)6TM{x`Gb~c-|tTmbM^8<^BVTv&*N@#s;9Ldq+#^)*af4&61iiQ0&C6bt&!!H z{}z|Q_9$@JKacnNj(*|aWTS;rUGPI*1i=R$Yh+AHow3sZ* zXt6n->lpjw&5VMRLm7j3O}Xss6jJk2@{_W-%qP1tT27YXQsqGsw3xg{T&>>7(hw+C zTvC*pn9EghD>vYD-XQ~lJ)cF3bC#NYRNgo@SzGQEl7{|nw{YI3F9zgr~N=Pugkz-`WU_w|pSZ|vRQR;jDos<|j?P304e z%+HQkgmJshM_@0MovF+ zXDwfrvcmFU_EABeed%8gCGZA$y}BhQ6y<5SaObQG(IHCFk6#`L@jCQr*Y?EZLoYUN zvistC>*sNsigV$gnwHeG?wS>K>!ADouMtNs@@Y!_ZMv(eUSq?1tXJxy(%FRd=O;gs z5BXKq#RUvhNO-}5*K)F;Y#5`#Ta|)Cj{4BMS=?h&m6D#U(|FnK`LNTsAgb`oWo1sS1V$T>3%z`M^X3Nj;u< kY55937XVX|ogG(kNn%k+MNw)RmyxBJF_)^UtG^o;0ROD&8vpseccion = 'Dir. General de Despacho y Mesa de Entradas y esto eso todo oooooooooooooooooooooooooooooo'; -$pdf->seccion = 'Dir. General de Despacho y Mesa de Entradas'; +$pdf->seccion = 'Prueba de la libreria de PDF\'s'; $pdf->titulo = 'Alberto Giordano'; $pdf->subtitulo = 'Filosofo Estilista, guacho pulenta si los hay'; //$pdf->paginador = false; //$pdf->fecha = '2/10/2003'; +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'cabecera'); +$pdf->addRow(array ('1erColumna', '2daColumna para que la corete', '3erColumna'), 'titulo'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna para gonzalo que lo mira por tv desde su casa en ayacucho 1593. Aunque ahora que lo pienso me estoy equivocando', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); +$pdf->addRow(array ('1erColumna', '2daColumna', '3erColumna'), 'comun'); + +$pdf->updateColAttributes(0,'width="50%"'); +$pdf->updateColAttributes(1,'width="25%"'); +$pdf->updateColAttributes(2,'width="35%"'); $pdf->display(); -- 2.43.0 From ec67d7b9c8a7dd7f3fb885ba2cd2013d96e3afa3 Mon Sep 17 00:00:00 2001 From: Manuel Nazar Anchorena Date: Tue, 4 Nov 2003 17:26:33 +0000 Subject: [PATCH 16/16] Le faltaba un reuiqre html_link a tabla --- lib/MECON/HTML/Tabla.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/MECON/HTML/Tabla.php b/lib/MECON/HTML/Tabla.php index af155b9..50eb620 100644 --- a/lib/MECON/HTML/Tabla.php +++ b/lib/MECON/HTML/Tabla.php @@ -26,6 +26,7 @@ $Id$ require_once 'HTML/Table.php'; require_once 'MECON/HTML/Image.php'; +require_once 'MECON/HTML/Link.php'; /** * Libreria para le manejo de las tablas de los sistemas de intranet. -- 2.43.0