diff --git a/.envrc b/.envrc new file mode 100644 index 0000000000..3bcd04a502 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +export USER_ID=$(id -u) \ No newline at end of file diff --git a/.gitignore b/.gitignore index e12cb633e3..b1a12ba575 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ bin/arai-cli node_modules/ proyectos/toba_referencia/www/siu/ proyectos/toba_referencia/metadatos_compilados/ +/proyectos/toba_editor/www/js/ build/ .phpdoc -.php_cs.cache \ No newline at end of file +.php_cs.cache diff --git a/CHANGELOG.md b/CHANGELOG.md index d3590ca934..5cd9bc52f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,72 @@ [CURRENT](https://github.com/SIU-Toba/framework/compare/master...develop) +[3.4.0](https://github.com/SIU-Toba/framework/releases/tag/v3.4.0) (2023-12-06) +- Se incrementa el requerimiento de plataforma a PHP 8.1+ +- Se actualizan los siguientes paquetes + * guzzle/guzzle: v7.8.1 + * phpmailer/phpmailer: v6.8.1 + * phpoffice/phpspreadsheet: v1.29.0 + * rospdf/pdf-php: v0.12.67 + * vlucas/phpdotenv: v5.6.0 + * nikic/php-parser: v4.17.1 + * onelogin/php-saml: v4.1.0 + * laminas/escaper: v2.13.0 + * jpGraph/jpGraph: v4.4.1 + * firebase/php-jwt: v6.10.0 + * symfony/security-csrf: v5.4.27 + * symfony/yaml: v4.4.45 + * siu-toba/rest: v3.1.0 + * siu-toba/structures_graph: v1.2.0 + * siu/arai-json-migrator: v2.0.0 + * siu/interfaces-manejador-salida-toba: v1.4.0 + +- Se corrige error al intentar migrar la auditoria (relacionado con cambio para columnas `IDENTITY`) +- Se corrige error al intentar formatear valores nulos en exportaciones de `ei_cuadro` +- Se incluye mecanismo para configurar la versión de API a consumir en `cliente.ini` +- Se agrega soporte en DT para las columnas tipo `IDENTITY` +- Se mejora el soporte de auditoria para fuentes que no tienen asignado un schema en metadatos +- Se mejora el soporte a publicación de proyectos sin alias +- Se agrega un formato custom para la moneda en `toba_vista_excel` debido a modificaciones en Phpspreadsheet +- La clase `toba_vistar_jasperreports` cierra explicitamente la conexión a BD ante un problema (credits: lleonardis) +- Se corrige carga de claves en la instalación mediante archivo YAML (credits: tomasdelvechio) +- Se agrega validación de prefijos al `ef_cuit` y posibilidad de setear lista especifica por BC +- Se corrige la modificacion del perfil de datos al cambiar el perfil funcional (credits: lleonardis) +- ABM de usuarios puede conectarse a `Arai-Usuarios` en Api@v1 o Api@v2 según configuración +- Se corrige la decodificación en las notificaciones JS +- Se ajustan scripts del evento `post-install` de composer +- Se corrige validación `ef_fecha_hora` (credits: rdsmiranda) +- Se cambia el paquete que verificaba los tokens CSRF por el componente Symfony +- Se modifica el archivo `docker-compose.yml` para uso local en el framework +- Se eliminan archivos de templates que no se utilizaban. +- Se explicita el identificador de la fuente en consultas de toba_usuarios +- Se pasa a modo estricto las búsquedas en arreglos en el framework. +- Se eliminan parámetros nulos en los vinculos para que no falle el escapado de los mismos +- Se realizan modificaciones varias a toba_editor que incluyen la visualización de código y mecanismo de instalación +- Se corrige la selección del fin de semana en `ei_calendario` +- Se corrige problema con la propagación de la zona durante la exportación de un `ei_cuadro` +- Se contempla el uso de una env `JAVA_HOSTS` para utilizar `toba_vistar_jasperreports` contra un contenedor docker (credits: tomasdelvechio) +- Se corrige error en la instanciación de `toba_logger` +- Se modifican tipos de datos en las tablas de logs del framework y se agregan nuevas columnas en tabla de usuarios +- La auditoria ya no utiliza tablas temporales para obtener información del usuario (ATENCION: Requiere migración) + +[3.3.26](https://github.com/SIU-Toba/framework/releases/tag/v3.3.26) (2023-06-30) +- Cierra explicitamente la conexión JDBC en `toba_vistar_jasperreports` para prevenir proceso zombie +- Corrige uso del parametro `alias-nucleo` en el comando `instalar` +- Corrige lectura contenido de archivo al instalar usando la configuración por archivo yaml (credits tomasdelvechio) +- Corrige validacion de estado en `ef_fecha_hora` (credits: rdsmiranda) +- Se ajusta archivo `docker-compose.yml` para trabajo local y elimina templates sin uso +- Actualizacion de seguridad/funcionalidad de paquetes + * guzzlehttp/guzzle: v6.5.8 + * siu/manejador-salida-toba: v1.1.4 + +[3.3.25](https://github.com/SIU-Toba/framework/releases/tag/v3.3.25) (2022-06-13) +- Fix instanciacion de `toba_logger` en `toba_ei_formulario`, `toba_ei_filtro` y `toba_ei_formulario_ml` +- Actualizacion de seguridad de paquetes + * phpmailer/phpmailer: v6.5.4 + * phpoffice/phpspreadsheet: v1.23.0 + * guzzlehttp/guzzle: v6.5.7 + [3.3.24](https://github.com/SIU-Toba/framework/releases/tag/v3.3.24) (2022-04-25) - Fix eliminacion repetida de columnas en `toba_ei_cuadro` - Fix regresion en objeto JS que maneja la comunicacion con el server diff --git a/VERSION b/VERSION index 894c91583d..18091983f5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.3.24 +3.4.0 diff --git a/arai.json b/arai.json index 21ea672ed6..79d1717ca6 100644 --- a/arai.json +++ b/arai.json @@ -31,7 +31,7 @@ "provide" : [ { "name": "app:siu/toba_usuarios", - "version": ">=3.2.0" + "version": ">=3.4.0" } ] } diff --git a/bin/connection_test b/bin/connection_test index 904c28a192..bcb9d0d232 100755 --- a/bin/connection_test +++ b/bin/connection_test @@ -1,7 +1,7 @@ #!/usr/bin/env php getMessage(); } diff --git a/bin/launcher.php b/bin/launcher.php index 553b6f7aff..2602f13471 100755 --- a/bin/launcher.php +++ b/bin/launcher.php @@ -17,14 +17,14 @@ include(realpath($toba_dir . $path_autoload)); //Necesito cargar el autoload de composer antes, sino no funca nada $path_env = (stripos($toba_dir, DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR) !== false) ? realpath($toba_dir . '/../../../') : $toba_dir; if (file_exists($path_env. '/entorno_toba.env')) { - try { - $dotenv = Dotenv\Dotenv::create($path_env, 'entorno_toba.env'); - $dotenv->load(); - //Chequeo que existan las variables correspondientes... deberia pero bue nunca esta de mas. - $dotenv->required(['TOBA_INSTANCIA', 'TOBA_INSTALACION_DIR']); - } catch (Dotenv\Exception\ValidationException $e) { - echo 'Falta definir una variable de entorno que es requerida ' . PHP_EOL . $e->getMessage(); - } + try { + $dotenv = Dotenv\Dotenv::createMutable($path_env, 'entorno_toba.env'); + $dotenv->load(); + //Chequeo que existan las variables correspondientes... deberia pero bue nunca esta de mas. + $dotenv->required(['TOBA_INSTANCIA', 'TOBA_INSTALACION_DIR']); + } catch (Dotenv\Exception\ValidationException $e) { + echo 'Falta definir una variable de entorno que es requerida ' . PHP_EOL . $e->getMessage(); + } } } diff --git a/composer.json b/composer.json index 46127282bb..ea858af650 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "name": "siu-toba/framework", "description": "Framework de desarrollo web", + "version": "v3.4.0", "authors": [ { "name": "SIU", @@ -10,28 +11,30 @@ "require": { "php": ">=7.3", "ext-curl": "*", - "dapphp/securimage": "~3.6", + "dapphp/securimage": "dev-nextgen", "guiguiboy/php-cli-progress-bar": "dev-master", - "guzzlehttp/guzzle": "~6.5", + "guzzlehttp/psr7": "~2.4", + "guzzlehttp/guzzle": "~7.8", "ioncube/php-openssl-cryptor": "dev-master", - "nikic/php-parser": "~4.4", - "onelogin/php-saml": "~3.4", + "nikic/php-parser": "~4.0", + "onelogin/php-saml": "~4.0", "paragonie/random-lib": "~2.0", - "phpmailer/phpmailer": "~6.5.0", - "phpoffice/phpspreadsheet": "^1.0", - "psr/log": "~1.1", + "phpmailer/phpmailer": "~6.8.0", + "phpoffice/phpspreadsheet": "~1.29", + "psr/log": "~1.0|~2.0|~3.0", "rospdf/pdf-php": "~0.12", "siu-toba/numbers_words": "0.18.0.1", - "siu-toba/rest": "~2.0", + "siu-toba/rest": "~3.1", "siu-toba/services_json": "^1.0.3.3", "siu-toba/ssl-cert-utils": "~1.0", - "siu-toba/structures_graph": "^1.1.1.1", - "siu/arai-json-migrator": "~1.1", - "siu/manejador-salida-toba": "~1.1", - "siu/interfaces-manejador-salida-toba": "~1.2.0", - "siu/security-multitool": "~1.1", - "symfony/yaml": "~4.4", - "vlucas/phpdotenv": "~3.6" + "siu-toba/structures_graph": "~1.2", + "siu/arai-json-migrator": "~2.0", + "symfony/security-csrf": "^5.4", + "laminas/laminas-escaper": "~2.13.0", + "siu/manejador-salida-toba": "~1.2", + "siu/interfaces-manejador-salida-toba": "~1.4", + "symfony/yaml": "~4.4|~5.4|~6.0", + "vlucas/phpdotenv": "~5.6" }, "conflict": { "siu/arai-cli": "<3.0.0", @@ -40,12 +43,11 @@ "require-dev": { "greenlion/php-sql-parser": "@dev", "php-webdriver/webdriver": "~1.8", - "simpletest/simpletest": "~1.2", - "siu-toba/text_highlighter": "~0.8", + "simpletest/simpletest": "*", "siu/arai-cli": "*", "siu/arai-crypto": "*", "siu/arai-json-parser": "*", - "siu/manejador-salida-bootstrap": "~1.3" + "siu/manejador-salida-bootstrap": "~1.4" }, "suggest": { "simplesamlphp/simplesamlphp": "Permite conectarse a un IDP centralizado (see onelogin)", @@ -74,13 +76,15 @@ ], "scripts": { "post-install-cmd": [ - "yarn add ckeditor4@4.18 jquery@3.6 jquery-migrate@3.3 siu-js-app-launcher@1.0.6 --modules-folder www/js/packages/", + "@putenv COMPOSER=./proyectos/toba_editor/composer.json", + "composer run-script post-install-cmd ", + "yarn add ckeditor4@4.18 jquery@3.6 jquery-migrate@3.3 siu-js-app-launcher@1.0.6 --modules-folder www/js/packages/", "yarn ", - "php bin/instalar_assets.php" + "@php bin/instalar_assets.php" ], "post-update-cmd": [ "yarn --non-interactive --modules-folder www/js/packages/", - "php bin/instalar_assets.php" + "@php bin/instalar_assets.php" ] } } diff --git a/composer.lock b/composer.lock index eb143e77c4..f953c5812e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,56 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1758aeffa44ecad101d9ae6f67cc4ab6", + "content-hash": "2612c4da596eb39e2367a2d69eeef09f", "packages": [ - { - "name": "container-interop/container-interop", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/container-interop/container-interop.git", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "shasum": "" - }, - "require": { - "psr/container": "^1.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Interop\\Container\\": "src/Interop/Container/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "homepage": "https://github.com/container-interop/container-interop", - "support": { - "issues": "https://github.com/container-interop/container-interop/issues", - "source": "https://github.com/container-interop/container-interop/tree/master" - }, - "abandoned": "psr/container", - "time": "2017-02-14T19:40:03+00:00" - }, { "name": "dapphp/securimage", - "version": "3.6.8", + "version": "dev-nextgen", "source": { "type": "git", "url": "https://github.com/dapphp/securimage.git", - "reference": "5fc5953c4ffba1eb214cc83100672f238c184ca4" + "reference": "864ba7505e1bd36ee73f04d8471d86e1f821d754" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dapphp/securimage/zipball/5fc5953c4ffba1eb214cc83100672f238c184ca4", - "reference": "5fc5953c4ffba1eb214cc83100672f238c184ca4", + "url": "https://api.github.com/repos/dapphp/securimage/zipball/864ba7505e1bd36ee73f04d8471d86e1f821d754", + "reference": "864ba7505e1bd36ee73f04d8471d86e1f821d754", "shasum": "" }, "require": { @@ -67,6 +31,9 @@ }, "type": "library", "autoload": { + "psr-4": { + "Securimage\\": "./" + }, "classmap": [ "securimage.php" ] @@ -82,7 +49,7 @@ } ], "description": "PHP CAPTCHA Library", - "homepage": "https://www.phpcaptcha.org", + "homepage": "https://github.com/dapphp/securimage", "keywords": [ "Forms", "anti-spam", @@ -91,23 +58,23 @@ ], "support": { "issues": "https://github.com/dapphp/securimage/issues", - "source": "https://github.com/dapphp/securimage/tree/3.6.8" + "source": "https://github.com/dapphp/securimage/tree/nextgen" }, "abandoned": true, - "time": "2020-05-30T09:43:22+00:00" + "time": "2023-07-31T17:00:43+00:00" }, { "name": "doctrine/cache", - "version": "1.12.1", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "4cf401d14df219fa6f38b671f5493449151c9ad8" + "reference": "56cd022adb5514472cb144c087393c1821911d09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/4cf401d14df219fa6f38b671f5493449151c9ad8", - "reference": "4cf401d14df219fa6f38b671f5493449151c9ad8", + "url": "https://api.github.com/repos/doctrine/cache/zipball/56cd022adb5514472cb144c087393c1821911d09", + "reference": "56cd022adb5514472cb144c087393c1821911d09", "shasum": "" }, "require": { @@ -119,13 +86,13 @@ "require-dev": { "alcaeus/mongo-php-adapter": "^1.1", "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "mongodb/mongodb": "^1.1", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", "predis/predis": "~1.0", "psr/cache": "^1.0 || ^2.0 || ^3.0", - "symfony/cache": "^4.4 || ^5.2 || ^6.0@dev", - "symfony/var-exporter": "^4.4 || ^5.2 || ^6.0@dev" + "symfony/cache": "^4.4 || ^5.4 || ^6", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" }, "suggest": { "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" @@ -177,7 +144,7 @@ ], "support": { "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/1.12.1" + "source": "https://github.com/doctrine/cache/tree/1.13.0" }, "funding": [ { @@ -193,36 +160,43 @@ "type": "tidelift" } ], - "time": "2021-07-17T14:39:21+00:00" + "time": "2022-05-20T20:06:54+00:00" }, { "name": "ezyang/htmlpurifier", - "version": "v4.13.0", + "version": "v4.17.0", "source": { "type": "git", "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75" + "reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/08e27c97e4c6ed02f37c5b2b20488046c8d90d75", - "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/bbc513d79acf6691fa9cf10f192c90dd2957f18c", + "reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c", "shasum": "" }, "require": { - "php": ">=5.2" + "php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0" }, "require-dev": { - "simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd" + "cerdic/css-tidy": "^1.7 || ^2.0", + "simpletest/simpletest": "dev-master" + }, + "suggest": { + "cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.", + "ext-bcmath": "Used for unit conversion and imagecrash protection", + "ext-iconv": "Converts text to and from non-UTF-8 encodings", + "ext-tidy": "Used for pretty-printing HTML" }, "type": "library", "autoload": { - "psr-0": { - "HTMLPurifier": "library/" - }, "files": [ "library/HTMLPurifier.composer.php" ], + "psr-0": { + "HTMLPurifier": "library/" + }, "exclude-from-classmap": [ "/library/HTMLPurifier/Language/" ] @@ -245,31 +219,37 @@ ], "support": { "issues": "https://github.com/ezyang/htmlpurifier/issues", - "source": "https://github.com/ezyang/htmlpurifier/tree/master" + "source": "https://github.com/ezyang/htmlpurifier/tree/v4.17.0" }, - "time": "2020-06-29T00:56:53+00:00" + "time": "2023-11-17T15:01:25+00:00" }, { "name": "firebase/php-jwt", - "version": "v5.5.1", + "version": "v6.10.0", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "83b609028194aa042ea33b5af2d41a7427de80e6" + "reference": "a49db6f0a5033aef5143295342f1c95521b075ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/83b609028194aa042ea33b5af2d41a7427de80e6", - "reference": "83b609028194aa042ea33b5af2d41a7427de80e6", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/a49db6f0a5033aef5143295342f1c95521b075ff", + "reference": "a49db6f0a5033aef5143295342f1c95521b075ff", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.4||^8.0" }, "require-dev": { - "phpunit/phpunit": ">=4.8 <=9" + "guzzlehttp/guzzle": "^6.5||^7.4", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "psr/cache": "^1.0||^2.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0" }, "suggest": { + "ext-sodium": "Support EdDSA (Ed25519) signatures", "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" }, "type": "library", @@ -302,9 +282,71 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v5.5.1" + "source": "https://github.com/firebase/php-jwt/tree/v6.10.0" + }, + "time": "2023-12-01T16:26:39+00:00" + }, + { + "name": "graham-campbell/result-type", + "version": "v1.1.2", + "source": { + "type": "git", + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/fbd48bce38f73f8a4ec8583362e732e4095e5862", + "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "GrahamCampbell\\ResultType\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "An Implementation Of The Result Type", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Result Type", + "Result-Type", + "result" + ], + "support": { + "issues": "https://github.com/GrahamCampbell/Result-Type/issues", + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.2" }, - "time": "2021-11-08T20:18:51+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", + "type": "tidelift" + } + ], + "time": "2023-11-12T22:16:48+00:00" }, { "name": "guiguiboy/php-cli-progress-bar", @@ -353,112 +395,167 @@ "issues": "https://github.com/guiguiboy/PHP-CLI-Progress-Bar/issues", "source": "https://github.com/guiguiboy/PHP-CLI-Progress-Bar/tree/1.0.0" }, + "abandoned": true, "time": "2014-11-19T13:12:00+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "6.5.5", + "version": "7.8.1", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e" + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", - "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", - "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.17.0" + "guzzlehttp/promises": "^1.5.3 || ^2.0.1", + "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.1" + "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.36 || ^9.6.15", + "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "6.5-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", "keywords": [ "client", "curl", "framework", "http", "http client", + "psr-18", + "psr-7", "rest", "web service" ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/6.5" + "source": "https://github.com/guzzle/guzzle/tree/7.8.1" }, - "time": "2020-06-16T21:01:06+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2023-12-03T20:35:24+00:00" }, { "name": "guzzlehttp/promises", - "version": "1.5.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" + "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", - "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223", + "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223", "shasum": "" }, "require": { - "php": ">=5.5" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.36 || ^9.6.15" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.5-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { "psr-4": { "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -492,7 +589,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.1" + "source": "https://github.com/guzzle/promises/tree/2.0.2" }, "funding": [ { @@ -508,50 +605,51 @@ "type": "tidelift" } ], - "time": "2021-10-22T20:56:57+00:00" + "time": "2023-12-03T20:19:20+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.8.3", + "version": "2.6.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85" + "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/1afdd860a2566ed3c2b0b4a3de6e23434a79ec85", - "reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", + "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", "shasum": "" }, "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" }, "provide": { + "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.36 || ^9.6.15" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.7-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { "psr-4": { "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -587,6 +685,11 @@ "name": "Tobias Schultze", "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" } ], "description": "PSR-7 message implementation that also provides common utility methods", @@ -602,7 +705,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.8.3" + "source": "https://github.com/guzzle/psr7/tree/2.6.2" }, "funding": [ { @@ -618,7 +721,7 @@ "type": "tidelift" } ], - "time": "2021-10-05T13:56:00+00:00" + "time": "2023-12-03T20:05:35+00:00" }, { "name": "ioncube/php-openssl-cryptor", @@ -696,25 +799,25 @@ }, { "name": "justinrainbow/json-schema", - "version": "1.6.1", + "version": "v5.2.13", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "cc84765fb7317f6b07bd8ac78364747f95b86341" + "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/cc84765fb7317f6b07bd8ac78364747f95b86341", - "reference": "cc84765fb7317f6b07bd8ac78364747f95b86341", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/fbbe7e5d79f618997bc3332a6f49246036c45793", + "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793", "shasum": "" }, "require": { - "php": ">=5.3.29" + "php": ">=5.3.3" }, "require-dev": { - "json-schema/json-schema-test-suite": "1.1.0", - "phpdocumentor/phpdocumentor": "~2", - "phpunit/phpunit": "~3.7" + "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.35" }, "bin": [ "bin/validate-json" @@ -722,7 +825,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { @@ -732,7 +835,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { @@ -760,39 +863,39 @@ ], "support": { "issues": "https://github.com/justinrainbow/json-schema/issues", - "source": "https://github.com/justinrainbow/json-schema/tree/master" + "source": "https://github.com/justinrainbow/json-schema/tree/v5.2.13" }, - "time": "2016-01-25T15:43:01+00:00" + "time": "2023-09-26T02:20:38+00:00" }, { "name": "laminas/laminas-escaper", - "version": "2.9.0", + "version": "2.13.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-escaper.git", - "reference": "891ad70986729e20ed2e86355fcf93c9dc238a5f" + "reference": "af459883f4018d0f8a0c69c7a209daef3bf973ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/891ad70986729e20ed2e86355fcf93c9dc238a5f", - "reference": "891ad70986729e20ed2e86355fcf93c9dc238a5f", + "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/af459883f4018d0f8a0c69c7a209daef3bf973ba", + "reference": "af459883f4018d0f8a0c69c7a209daef3bf973ba", "shasum": "" }, "require": { - "php": "^7.3 || ~8.0.0 || ~8.1.0" + "ext-ctype": "*", + "ext-mbstring": "*", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" }, "conflict": { "zendframework/zend-escaper": "*" }, "require-dev": { - "laminas/laminas-coding-standard": "~2.3.0", - "phpunit/phpunit": "^9.3", - "psalm/plugin-phpunit": "^0.12.2", - "vimeo/psalm": "^3.16" - }, - "suggest": { - "ext-iconv": "*", - "ext-mbstring": "*" + "infection/infection": "^0.27.0", + "laminas/laminas-coding-standard": "~2.5.0", + "maglnet/composer-require-checker": "^3.8.0", + "phpunit/phpunit": "^9.6.7", + "psalm/plugin-phpunit": "^0.18.4", + "vimeo/psalm": "^5.9" }, "type": "library", "autoload": { @@ -824,426 +927,166 @@ "type": "community_bridge" } ], - "time": "2021-09-02T17:10:53+00:00" + "time": "2023-10-10T08:35:13+00:00" }, { - "name": "laminas/laminas-stdlib", - "version": "3.6.2", + "name": "maennchen/zipstream-php", + "version": "3.1.0", "source": { "type": "git", - "url": "https://github.com/laminas/laminas-stdlib.git", - "reference": "6fe0842909638ca6bea8401b7e8168fb154bffb5" + "url": "https://github.com/maennchen/ZipStream-PHP.git", + "reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/6fe0842909638ca6bea8401b7e8168fb154bffb5", - "reference": "6fe0842909638ca6bea8401b7e8168fb154bffb5", + "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b8174494eda667f7d13876b4a7bfef0f62a7c0d1", + "reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1", "shasum": "" }, "require": { - "php": "^7.3 || ~8.0.0 || ~8.1.0" - }, - "conflict": { - "zendframework/zend-stdlib": "*" + "ext-mbstring": "*", + "ext-zlib": "*", + "php-64bit": "^8.1" }, "require-dev": { - "laminas/laminas-coding-standard": "~2.3.0", - "phpbench/phpbench": "^0.17.1", - "phpunit/phpunit": "~9.3.7", - "psalm/plugin-phpunit": "^0.16.0", - "vimeo/psalm": "^4.7" + "ext-zip": "*", + "friendsofphp/php-cs-fixer": "^3.16", + "guzzlehttp/guzzle": "^7.5", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.5", + "phpunit/phpunit": "^10.0", + "vimeo/psalm": "^5.0" + }, + "suggest": { + "guzzlehttp/psr7": "^2.4", + "psr/http-message": "^2.0" }, "type": "library", "autoload": { "psr-4": { - "Laminas\\Stdlib\\": "src/" + "ZipStream\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], - "description": "SPL extensions, array utilities, error handlers, and more", - "homepage": "https://laminas.dev", + "authors": [ + { + "name": "Paul Duncan", + "email": "pabs@pablotron.org" + }, + { + "name": "Jonatan Männchen", + "email": "jonatan@maennchen.ch" + }, + { + "name": "Jesse Donat", + "email": "donatj@gmail.com" + }, + { + "name": "András Kolesár", + "email": "kolesar@kolesar.hu" + } + ], + "description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.", "keywords": [ - "laminas", - "stdlib" + "stream", + "zip" ], "support": { - "chat": "https://laminas.dev/chat", - "docs": "https://docs.laminas.dev/laminas-stdlib/", - "forum": "https://discourse.laminas.dev", - "issues": "https://github.com/laminas/laminas-stdlib/issues", - "rss": "https://github.com/laminas/laminas-stdlib/releases.atom", - "source": "https://github.com/laminas/laminas-stdlib" + "issues": "https://github.com/maennchen/ZipStream-PHP/issues", + "source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.0" }, "funding": [ { - "url": "https://funding.communitybridge.org/projects/laminas-project", - "type": "community_bridge" + "url": "https://github.com/maennchen", + "type": "github" + }, + { + "url": "https://opencollective.com/zipstream", + "type": "open_collective" } ], - "time": "2021-12-07T21:06:58+00:00" + "time": "2023-06-21T14:59:35+00:00" }, { - "name": "laminas/laminas-uri", - "version": "2.7.1", + "name": "markbaker/complex", + "version": "3.0.2", "source": { "type": "git", - "url": "https://github.com/laminas/laminas-uri.git", - "reference": "6be8ce19622f359b048ce4faebf1aa1bca73a7ff" + "url": "https://github.com/MarkBaker/PHPComplex.git", + "reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-uri/zipball/6be8ce19622f359b048ce4faebf1aa1bca73a7ff", - "reference": "6be8ce19622f359b048ce4faebf1aa1bca73a7ff", + "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9", + "reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9", "shasum": "" }, "require": { - "laminas/laminas-escaper": "^2.5", - "laminas/laminas-validator": "^2.10", - "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^5.6 || ^7.0" - }, - "replace": { - "zendframework/zend-uri": "self.version" + "php": "^7.2 || ^8.0" }, "require-dev": { - "laminas/laminas-coding-standard": "~1.0.0", - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4" + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "^9.3", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "squizlabs/php_codesniffer": "^3.7" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7.x-dev", - "dev-develop": "2.8.x-dev" - } - }, "autoload": { "psr-4": { - "Laminas\\Uri\\": "src/" + "Complex\\": "classes/src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], - "description": "A component that aids in manipulating and validating » Uniform Resource Identifiers (URIs)", - "homepage": "https://laminas.dev", + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with complex numbers", + "homepage": "https://github.com/MarkBaker/PHPComplex", "keywords": [ - "laminas", - "uri" + "complex", + "mathematics" ], "support": { - "chat": "https://laminas.dev/chat", - "docs": "https://docs.laminas.dev/laminas-uri/", - "forum": "https://discourse.laminas.dev", - "issues": "https://github.com/laminas/laminas-uri/issues", - "rss": "https://github.com/laminas/laminas-uri/releases.atom", - "source": "https://github.com/laminas/laminas-uri" + "issues": "https://github.com/MarkBaker/PHPComplex/issues", + "source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2" }, - "time": "2019-12-31T17:56:00+00:00" + "time": "2022-12-06T16:21:08+00:00" }, { - "name": "laminas/laminas-validator", - "version": "2.15.1", + "name": "markbaker/matrix", + "version": "3.0.1", "source": { "type": "git", - "url": "https://github.com/laminas/laminas-validator.git", - "reference": "fbd87f30c0a27aaeeee8adb2f934c14fb6046c80" + "url": "https://github.com/MarkBaker/PHPMatrix.git", + "reference": "728434227fe21be27ff6d86621a1b13107a2562c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/fbd87f30c0a27aaeeee8adb2f934c14fb6046c80", - "reference": "fbd87f30c0a27aaeeee8adb2f934c14fb6046c80", + "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c", + "reference": "728434227fe21be27ff6d86621a1b13107a2562c", "shasum": "" }, "require": { - "container-interop/container-interop": "^1.1", - "laminas/laminas-stdlib": "^3.6", - "php": "^7.3 || ~8.0.0 || ~8.1.0" - }, - "conflict": { - "zendframework/zend-validator": "*" + "php": "^7.1 || ^8.0" }, "require-dev": { - "laminas/laminas-cache": "^2.6.1", - "laminas/laminas-coding-standard": "~2.2.1", - "laminas/laminas-db": "^2.7", - "laminas/laminas-filter": "^2.6", - "laminas/laminas-http": "^2.14.2", - "laminas/laminas-i18n": "^2.6", - "laminas/laminas-math": "^2.6", - "laminas/laminas-servicemanager": "^2.7.11 || ^3.0.3", - "laminas/laminas-session": "^2.8", - "laminas/laminas-uri": "^2.7", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5.5", - "psalm/plugin-phpunit": "^0.15.0", - "psr/http-client": "^1.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "vimeo/psalm": "^4.3" - }, - "suggest": { - "laminas/laminas-db": "Laminas\\Db component, required by the (No)RecordExists validator", - "laminas/laminas-filter": "Laminas\\Filter component, required by the Digits validator", - "laminas/laminas-i18n": "Laminas\\I18n component to allow translation of validation error messages", - "laminas/laminas-i18n-resources": "Translations of validator messages", - "laminas/laminas-math": "Laminas\\Math component, required by the Csrf validator", - "laminas/laminas-servicemanager": "Laminas\\ServiceManager component to allow using the ValidatorPluginManager and validator chains", - "laminas/laminas-session": "Laminas\\Session component, ^2.8; required by the Csrf validator", - "laminas/laminas-uri": "Laminas\\Uri component, required by the Uri and Sitemap\\Loc validators", - "psr/http-message": "psr/http-message, required when validating PSR-7 UploadedFileInterface instances via the Upload and UploadFile validators" - }, - "type": "library", - "extra": { - "laminas": { - "component": "Laminas\\Validator", - "config-provider": "Laminas\\Validator\\ConfigProvider" - } - }, - "autoload": { - "psr-4": { - "Laminas\\Validator\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria", - "homepage": "https://laminas.dev", - "keywords": [ - "laminas", - "validator" - ], - "support": { - "chat": "https://laminas.dev/chat", - "docs": "https://docs.laminas.dev/laminas-validator/", - "forum": "https://discourse.laminas.dev", - "issues": "https://github.com/laminas/laminas-validator/issues", - "rss": "https://github.com/laminas/laminas-validator/releases.atom", - "source": "https://github.com/laminas/laminas-validator" - }, - "funding": [ - { - "url": "https://funding.communitybridge.org/projects/laminas-project", - "type": "community_bridge" - } - ], - "time": "2021-12-02T14:23:06+00:00" - }, - { - "name": "laminas/laminas-zendframework-bridge", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/laminas/laminas-zendframework-bridge.git", - "reference": "bf180a382393e7db5c1e8d0f2ec0c4af9c724baf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/bf180a382393e7db5c1e8d0f2ec0c4af9c724baf", - "reference": "bf180a382393e7db5c1e8d0f2ec0c4af9c724baf", - "shasum": "" - }, - "require": { - "php": "^7.3 || ~8.0.0 || ~8.1.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "psalm/plugin-phpunit": "^0.15.1", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.6" - }, - "type": "library", - "extra": { - "laminas": { - "module": "Laminas\\ZendFrameworkBridge" - } - }, - "autoload": { - "files": [ - "src/autoload.php" - ], - "psr-4": { - "Laminas\\ZendFrameworkBridge\\": "src//" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Alias legacy ZF class names to Laminas Project equivalents.", - "keywords": [ - "ZendFramework", - "autoloading", - "laminas", - "zf" - ], - "support": { - "forum": "https://discourse.laminas.dev/", - "issues": "https://github.com/laminas/laminas-zendframework-bridge/issues", - "rss": "https://github.com/laminas/laminas-zendframework-bridge/releases.atom", - "source": "https://github.com/laminas/laminas-zendframework-bridge" - }, - "funding": [ - { - "url": "https://funding.communitybridge.org/projects/laminas-project", - "type": "community_bridge" - } - ], - "time": "2021-09-03T17:53:30+00:00" - }, - { - "name": "maennchen/zipstream-php", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/maennchen/ZipStream-PHP.git", - "reference": "c4c5803cc1f93df3d2448478ef79394a5981cc58" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/c4c5803cc1f93df3d2448478ef79394a5981cc58", - "reference": "c4c5803cc1f93df3d2448478ef79394a5981cc58", - "shasum": "" - }, - "require": { - "myclabs/php-enum": "^1.5", - "php": ">= 7.1", - "psr/http-message": "^1.0", - "symfony/polyfill-mbstring": "^1.0" - }, - "require-dev": { - "ext-zip": "*", - "guzzlehttp/guzzle": ">= 6.3", - "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": ">= 7.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "ZipStream\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paul Duncan", - "email": "pabs@pablotron.org" - }, - { - "name": "Jonatan Männchen", - "email": "jonatan@maennchen.ch" - }, - { - "name": "Jesse Donat", - "email": "donatj@gmail.com" - }, - { - "name": "András Kolesár", - "email": "kolesar@kolesar.hu" - } - ], - "description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.", - "keywords": [ - "stream", - "zip" - ], - "support": { - "issues": "https://github.com/maennchen/ZipStream-PHP/issues", - "source": "https://github.com/maennchen/ZipStream-PHP/tree/master" - }, - "funding": [ - { - "url": "https://opencollective.com/zipstream", - "type": "open_collective" - } - ], - "time": "2020-05-30T13:11:16+00:00" - }, - { - "name": "markbaker/complex", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/MarkBaker/PHPComplex.git", - "reference": "ab8bc271e404909db09ff2d5ffa1e538085c0f22" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/ab8bc271e404909db09ff2d5ffa1e538085c0f22", - "reference": "ab8bc271e404909db09ff2d5ffa1e538085c0f22", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "phpcompatibility/php-compatibility": "^9.0", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.3", - "squizlabs/php_codesniffer": "^3.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Complex\\": "classes/src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mark Baker", - "email": "mark@lange.demon.co.uk" - } - ], - "description": "PHP Class for working with complex numbers", - "homepage": "https://github.com/MarkBaker/PHPComplex", - "keywords": [ - "complex", - "mathematics" - ], - "support": { - "issues": "https://github.com/MarkBaker/PHPComplex/issues", - "source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.1" - }, - "time": "2021-06-29T15:32:53+00:00" - }, - { - "name": "markbaker/matrix", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/MarkBaker/PHPMatrix.git", - "reference": "c66aefcafb4f6c269510e9ac46b82619a904c576" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/c66aefcafb4f6c269510e9ac46b82619a904c576", - "reference": "c66aefcafb4f6c269510e9ac46b82619a904c576", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "phpcompatibility/php-compatibility": "^9.0", - "phpdocumentor/phpdocumentor": "2.*", - "phploc/phploc": "^4.0", - "phpmd/phpmd": "2.*", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.3", - "sebastian/phpcpd": "^4.0", - "squizlabs/php_codesniffer": "^3.4" + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "^9.3", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "^4.0", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "sebastian/phpcpd": "^4.0", + "squizlabs/php_codesniffer": "^3.7" }, "type": "library", "autoload": { @@ -1270,193 +1113,22 @@ ], "support": { "issues": "https://github.com/MarkBaker/PHPMatrix/issues", - "source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.0" - }, - "time": "2021-07-01T19:01:15+00:00" - }, - { - "name": "michelf/php-markdown", - "version": "1.9.1", - "source": { - "type": "git", - "url": "https://github.com/michelf/php-markdown.git", - "reference": "5024d623c1a057dcd2d076d25b7d270a1d0d55f3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/michelf/php-markdown/zipball/5024d623c1a057dcd2d076d25b7d270a1d0d55f3", - "reference": "5024d623c1a057dcd2d076d25b7d270a1d0d55f3", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": ">=4.3 <5.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "Michelf\\": "Michelf/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Michel Fortin", - "email": "michel.fortin@michelf.ca", - "homepage": "https://michelf.ca/", - "role": "Developer" - }, - { - "name": "John Gruber", - "homepage": "https://daringfireball.net/" - } - ], - "description": "PHP Markdown", - "homepage": "https://michelf.ca/projects/php-markdown/", - "keywords": [ - "markdown" - ], - "support": { - "issues": "https://github.com/michelf/php-markdown/issues", - "source": "https://github.com/michelf/php-markdown/tree/1.9.1" - }, - "time": "2021-11-24T02:52:38+00:00" - }, - { - "name": "mjohnson/decoda", - "version": "6.12.0", - "source": { - "type": "git", - "url": "https://github.com/milesj/decoda.git", - "reference": "9817fd5abbd742384f59831d8a5953b01803b45d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/milesj/decoda/zipball/9817fd5abbd742384f59831d8a5953b01803b45d", - "reference": "9817fd5abbd742384f59831d8a5953b01803b45d", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.8|^7.5" - }, - "suggest": { - "ext-memcached": "Cache data using Memcache", - "ext-redis": "Cache data using Redis" - }, - "type": "library", - "autoload": { - "psr-0": { - "Decoda": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Miles Johnson", - "homepage": "http://milesj.me" - } - ], - "description": "A lightweight lexical string parser for BBCode styled markup.", - "homepage": "http://milesj.me/code/php/decoda", - "keywords": [ - "HOOK", - "bbcode", - "decoda", - "filter", - "lexer", - "markup", - "parser" - ], - "support": { - "issues": "https://github.com/milesj/decoda/issues", - "source": "https://github.com/milesj/decoda" - }, - "time": "2019-01-16T04:52:14+00:00" - }, - { - "name": "myclabs/php-enum", - "version": "1.8.3", - "source": { - "type": "git", - "url": "https://github.com/myclabs/php-enum.git", - "reference": "b942d263c641ddb5190929ff840c68f78713e937" + "source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/php-enum/zipball/b942d263c641ddb5190929ff840c68f78713e937", - "reference": "b942d263c641ddb5190929ff840c68f78713e937", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": "^7.3 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.5", - "squizlabs/php_codesniffer": "1.*", - "vimeo/psalm": "^4.6.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "MyCLabs\\Enum\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP Enum contributors", - "homepage": "https://github.com/myclabs/php-enum/graphs/contributors" - } - ], - "description": "PHP Enum implementation", - "homepage": "http://github.com/myclabs/php-enum", - "keywords": [ - "enum" - ], - "support": { - "issues": "https://github.com/myclabs/php-enum/issues", - "source": "https://github.com/myclabs/php-enum/tree/1.8.3" - }, - "funding": [ - { - "url": "https://github.com/mnapoli", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum", - "type": "tidelift" - } - ], - "time": "2021-07-05T08:18:36+00:00" + "time": "2022-12-02T22:17:43+00:00" }, { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.17.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "shasum": "" }, "require": { @@ -1497,40 +1169,41 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2023-08-13T19:53:39+00:00" }, { "name": "onelogin/php-saml", - "version": "3.6.1", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/onelogin/php-saml.git", - "reference": "a7328b11887660ad248ea10952dd67a5aa73ba3b" + "reference": "b22a57ebd13e838b90df5d3346090bc37056409d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/onelogin/php-saml/zipball/a7328b11887660ad248ea10952dd67a5aa73ba3b", - "reference": "a7328b11887660ad248ea10952dd67a5aa73ba3b", + "url": "https://api.github.com/repos/onelogin/php-saml/zipball/b22a57ebd13e838b90df5d3346090bc37056409d", + "reference": "b22a57ebd13e838b90df5d3346090bc37056409d", "shasum": "" }, "require": { - "php": ">=5.4", + "php": ">=7.3", "robrichards/xmlseclibs": ">=3.1.1" }, "require-dev": { - "pdepend/pdepend": "^2.5.0", - "php-coveralls/php-coveralls": "^1.0.2 || ^2.0", - "phploc/phploc": "^2.1 || ^3.0 || ^4.0", - "phpunit/phpunit": "<7.5.18", - "sebastian/phpcpd": "^2.0 || ^3.0 || ^4.0", - "squizlabs/php_codesniffer": "^3.1.1" + "pdepend/pdepend": "^2.8.0", + "php-coveralls/php-coveralls": "^2.0", + "phploc/phploc": "^4.0 || ^5.0 || ^6.0 || ^7.0", + "phpunit/phpunit": "^9.5", + "sebastian/phpcpd": "^4.0 || ^5.0 || ^6.0 ", + "squizlabs/php_codesniffer": "^3.5.8" }, "suggest": { "ext-curl": "Install curl lib to be able to use the IdPMetadataParser for parsing remote XMLs", - "ext-gettext": "Install gettext and php5-gettext libs to handle translations", - "ext-openssl": "Install openssl lib in order to handle with x509 certs (require to support sign and encryption)" + "ext-dom": "Install xml lib", + "ext-openssl": "Install openssl lib in order to handle with x509 certs (require to support sign and encryption)", + "ext-zlib": "Install zlib" }, "type": "library", "autoload": { @@ -1554,7 +1227,7 @@ "issues": "https://github.com/onelogin/php-saml/issues", "source": "https://github.com/onelogin/php-saml/" }, - "time": "2021-03-02T10:13:07+00:00" + "time": "2022-07-15T20:44:36+00:00" }, { "name": "paragonie/random-lib", @@ -1623,23 +1296,23 @@ }, { "name": "paragonie/random_compat", - "version": "v2.0.20", + "version": "v2.0.21", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "0f1f60250fccffeaf5dda91eea1c018aed1adc2a" + "reference": "96c132c7f2f7bc3230723b66e89f8f150b29d5ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/0f1f60250fccffeaf5dda91eea1c018aed1adc2a", - "reference": "0f1f60250fccffeaf5dda91eea1c018aed1adc2a", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/96c132c7f2f7bc3230723b66e89f8f150b29d5ae", + "reference": "96c132c7f2f7bc3230723b66e89f8f150b29d5ae", "shasum": "" }, "require": { "php": ">=5.2.0" }, "require-dev": { - "phpunit/phpunit": "4.*|5.*" + "phpunit/phpunit": "*" }, "suggest": { "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." @@ -1673,20 +1346,20 @@ "issues": "https://github.com/paragonie/random_compat/issues", "source": "https://github.com/paragonie/random_compat" }, - "time": "2021-04-17T09:33:01+00:00" + "time": "2022-02-16T17:07:03+00:00" }, { "name": "paragonie/sodium_compat", - "version": "v1.17.0", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/paragonie/sodium_compat.git", - "reference": "c59cac21abbcc0df06a3dd18076450ea4797b321" + "reference": "e592a3e06d1fa0d43988c7c7d9948ca836f644b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/c59cac21abbcc0df06a3dd18076450ea4797b321", - "reference": "c59cac21abbcc0df06a3dd18076450ea4797b321", + "url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/e592a3e06d1fa0d43988c7c7d9948ca836f644b6", + "reference": "e592a3e06d1fa0d43988c7c7d9948ca836f644b6", "shasum": "" }, "require": { @@ -1757,9 +1430,60 @@ ], "support": { "issues": "https://github.com/paragonie/sodium_compat/issues", - "source": "https://github.com/paragonie/sodium_compat/tree/v1.17.0" + "source": "https://github.com/paragonie/sodium_compat/tree/v1.20.0" + }, + "time": "2023-04-30T00:54:53+00:00" + }, + { + "name": "pear/console_getopt", + "version": "v1.4.3", + "source": { + "type": "git", + "url": "https://github.com/pear/Console_Getopt.git", + "reference": "a41f8d3e668987609178c7c4a9fe48fecac53fa0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Console_Getopt/zipball/a41f8d3e668987609178c7c4a9fe48fecac53fa0", + "reference": "a41f8d3e668987609178c7c4a9fe48fecac53fa0", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Console": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "./" + ], + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Andrei Zmievski", + "email": "andrei@php.net", + "role": "Lead" + }, + { + "name": "Stig Bakken", + "email": "stig@php.net", + "role": "Developer" + }, + { + "name": "Greg Beaver", + "email": "cellog@php.net", + "role": "Helper" + } + ], + "description": "More info available on: http://pear.php.net/package/Console_Getopt", + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Console_Getopt", + "source": "https://github.com/pear/Console_Getopt" }, - "time": "2021-08-10T02:43:50+00:00" + "time": "2019-11-20T18:27:48+00:00" }, { "name": "pear/math_biginteger", @@ -1814,6 +1538,55 @@ }, "time": "2016-04-12T05:46:52+00:00" }, + { + "name": "pear/pear-core-minimal", + "version": "v1.10.14", + "source": { + "type": "git", + "url": "https://github.com/pear/pear-core-minimal.git", + "reference": "a86fc145edb5caedbf96527214ce3cadc9de4a32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/a86fc145edb5caedbf96527214ce3cadc9de4a32", + "reference": "a86fc145edb5caedbf96527214ce3cadc9de4a32", + "shasum": "" + }, + "require": { + "pear/console_getopt": "~1.4", + "pear/pear_exception": "~1.0", + "php": ">=5.4" + }, + "replace": { + "rsky/pear-core-min": "self.version" + }, + "type": "library", + "autoload": { + "psr-0": { + "": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "src/" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@php.net", + "role": "Lead" + } + ], + "description": "Minimal set of PEAR core files to be used as composer dependency", + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR", + "source": "https://github.com/pear/pear-core-minimal" + }, + "time": "2023-11-26T16:15:38+00:00" + }, { "name": "pear/pear_exception", "version": "v1.0.2", @@ -1875,16 +1648,16 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.5.3", + "version": "v6.8.1", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "baeb7cde6b60b1286912690ab0693c7789a31e71" + "reference": "e88da8d679acc3824ff231fdc553565b802ac016" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/baeb7cde6b60b1286912690ab0693c7789a31e71", - "reference": "baeb7cde6b60b1286912690ab0693c7789a31e71", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e88da8d679acc3824ff231fdc553565b802ac016", + "reference": "e88da8d679acc3824ff231fdc553565b802ac016", "shasum": "" }, "require": { @@ -1894,22 +1667,24 @@ "php": ">=5.5.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "doctrine/annotations": "^1.2", - "php-parallel-lint/php-console-highlighter": "^0.5.0", - "php-parallel-lint/php-parallel-lint": "^1.3", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "doctrine/annotations": "^1.2.6 || ^1.13.3", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.6.0", - "yoast/phpunit-polyfills": "^1.0.0" + "squizlabs/php_codesniffer": "^3.7.2", + "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", + "ext-openssl": "Needed for secure SMTP sending and DKIM signing", + "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", "league/oauth2-google": "Needed for Google XOAUTH2 authentication", "psr/log": "For optional PSR-3 debug logging", - "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", - "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" + "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)", + "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication" }, "type": "library", "autoload": { @@ -1941,7 +1716,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.3" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.8.1" }, "funding": [ { @@ -1949,20 +1724,20 @@ "type": "github" } ], - "time": "2021-11-25T16:34:11+00:00" + "time": "2023-08-29T08:26:30+00:00" }, { "name": "phpoffice/phpspreadsheet", - "version": "1.20.0", + "version": "1.29.0", "source": { "type": "git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "44436f270bb134b4a94670f3d020a85dfa0a3c02" + "reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/44436f270bb134b4a94670f3d020a85dfa0a3c02", - "reference": "44436f270bb134b4a94670f3d020a85dfa0a3c02", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/fde2ccf55eaef7e86021ff1acce26479160a0fa0", + "reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0", "shasum": "" }, "require": { @@ -1979,33 +1754,34 @@ "ext-xmlwriter": "*", "ext-zip": "*", "ext-zlib": "*", - "ezyang/htmlpurifier": "^4.13", - "maennchen/zipstream-php": "^2.1", + "ezyang/htmlpurifier": "^4.15", + "maennchen/zipstream-php": "^2.1 || ^3.0", "markbaker/complex": "^3.0", "markbaker/matrix": "^3.0", - "php": "^7.3 || ^8.0", + "php": "^7.4 || ^8.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "psr/simple-cache": "^1.0" + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "dev-master", - "dompdf/dompdf": "^1.0", + "dealerdirect/phpcodesniffer-composer-installer": "dev-main", + "dompdf/dompdf": "^1.0 || ^2.0", "friendsofphp/php-cs-fixer": "^3.2", - "jpgraph/jpgraph": "^4.0", - "mpdf/mpdf": "^8.0", + "mitoteam/jpgraph": "^10.3", + "mpdf/mpdf": "^8.1.1", "phpcompatibility/php-compatibility": "^9.3", "phpstan/phpstan": "^1.1", "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^8.5 || ^9.0", - "squizlabs/php_codesniffer": "^3.6", - "tecnickcom/tcpdf": "^6.4" + "phpunit/phpunit": "^8.5 || ^9.0 || ^10.0", + "squizlabs/php_codesniffer": "^3.7", + "tecnickcom/tcpdf": "^6.5" }, "suggest": { - "dompdf/dompdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)", - "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", + "dompdf/dompdf": "Option for rendering PDF with PDF Writer", + "ext-intl": "PHP Internationalization Functions", + "mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", "mpdf/mpdf": "Option for rendering PDF with PDF Writer", - "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)" + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" }, "type": "library", "autoload": { @@ -2051,35 +1827,39 @@ ], "support": { "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", - "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.20.0" + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.0" }, - "time": "2021-11-23T15:23:42+00:00" + "time": "2023-06-14T22:48:31+00:00" }, { "name": "phpoption/phpoption", - "version": "1.8.1", + "version": "1.9.2", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" + "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", - "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/80735db690fe4fc5c76dfa7f9b770634285fa820", + "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820", "shasum": "" }, "require": { - "php": "^7.0 || ^8.0" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": true + }, "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -2112,7 +1892,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.8.1" + "source": "https://github.com/schmittjoh/php-option/tree/1.9.2" }, "funding": [ { @@ -2124,7 +1904,7 @@ "type": "tidelift" } ], - "time": "2021-12-04T23:24:31+00:00" + "time": "2023-11-12T21:59:55+00:00" }, { "name": "psr/container", @@ -2174,23 +1954,73 @@ }, "time": "2021-11-05T16:50:12+00:00" }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, { "name": "psr/http-client", - "version": "1.0.1", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", "shasum": "" }, "require": { "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -2210,7 +2040,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP clients", @@ -2222,27 +2052,27 @@ "psr-18" ], "support": { - "source": "https://github.com/php-fig/http-client/tree/master" + "source": "https://github.com/php-fig/http-client" }, - "time": "2020-06-29T06:28:15+00:00" + "time": "2023-09-23T14:17:50+00:00" }, { "name": "psr/http-factory", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + "reference": "e616d01114759c4c489f93b099585439f795fe35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", "shasum": "" }, "require": { "php": ">=7.0.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -2262,7 +2092,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interfaces for PSR-7 HTTP message factories", @@ -2277,31 +2107,31 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/master" + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" }, - "time": "2019-04-30T12:38:16+00:00" + "time": "2023-04-10T20:10:41+00:00" }, { "name": "psr/http-message", - "version": "1.0.1", + "version": "2.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -2316,7 +2146,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -2330,36 +2160,36 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/master" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2016-08-06T14:39:51+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { "name": "psr/log", - "version": "1.1.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -2380,31 +2210,31 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/3.0.0" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2021-07-14T16:46:02+00:00" }, { "name": "psr/simple-cache", - "version": "1.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -2419,7 +2249,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interfaces for simple caching", @@ -2431,9 +2261,9 @@ "simple-cache" ], "support": { - "source": "https://github.com/php-fig/simple-cache/tree/master" + "source": "https://github.com/php-fig/simple-cache/tree/3.0.0" }, - "time": "2017-10-23T01:57:42+00:00" + "time": "2021-10-29T13:26:27+00:00" }, { "name": "ralouphie/getallheaders", @@ -2523,24 +2353,25 @@ }, { "name": "rospdf/pdf-php", - "version": "0.12.63", + "version": "0.12.67", "source": { "type": "git", "url": "https://github.com/rospdf/pdf-php.git", - "reference": "f957e49ddfa6b7891de62c48b1de965a74db6c44" + "reference": "fce993f08f99305569bb238644c5c35c0db0f85a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rospdf/pdf-php/zipball/f957e49ddfa6b7891de62c48b1de965a74db6c44", - "reference": "f957e49ddfa6b7891de62c48b1de965a74db6c44", + "url": "https://api.github.com/repos/rospdf/pdf-php/zipball/fce993f08f99305569bb238644c5c35c0db0f85a", + "reference": "fce993f08f99305569bb238644c5c35c0db0f85a", "shasum": "" }, "require": { "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "3.7.38", - "squizlabs/php_codesniffer": "2.*" + "phpcompatibility/php-compatibility": "^9.3", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.7" }, "type": "library", "extra": { @@ -2590,29 +2421,30 @@ "homepage": "https://github.com/rospdf/pdf-php", "support": { "issues": "https://github.com/rospdf/pdf-php/issues", - "source": "https://github.com/rospdf/pdf-php/tree/0.12.63" + "source": "https://github.com/rospdf/pdf-php/tree/0.12.67" }, - "time": "2020-09-20T06:15:20+00:00" + "time": "2023-04-20T20:52:13+00:00" }, { "name": "seld/jsonlint", - "version": "1.8.3", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "9ad6ce79c342fbd44df10ea95511a1b24dee5b57" + "reference": "594fd6462aad8ecee0b45ca5045acea4776667f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9ad6ce79c342fbd44df10ea95511a1b24dee5b57", - "reference": "9ad6ce79c342fbd44df10ea95511a1b24dee5b57", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/594fd6462aad8ecee0b45ca5045acea4776667f1", + "reference": "594fd6462aad8ecee0b45ca5045acea4776667f1", "shasum": "" }, "require": { "php": "^5.3 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^8.5.13" }, "bin": [ "bin/jsonlint" @@ -2643,7 +2475,7 @@ ], "support": { "issues": "https://github.com/Seldaek/jsonlint/issues", - "source": "https://github.com/Seldaek/jsonlint/tree/1.8.3" + "source": "https://github.com/Seldaek/jsonlint/tree/1.10.0" }, "funding": [ { @@ -2655,28 +2487,28 @@ "type": "tidelift" } ], - "time": "2020-11-11T09:19:24+00:00" + "time": "2023-05-11T13:16:46+00:00" }, { "name": "siu-toba/jwt-util", - "version": "v1.0.3", + "version": "v1.0.5", "source": { "type": "git", "url": "https://github.com/SIU-Toba/jwt-util.git", - "reference": "4f2b619df2ea4c26d625462e9cafd489fe9d86da" + "reference": "15f7387de95505551047bd1a5945db1ea2c337b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/SIU-Toba/jwt-util/zipball/4f2b619df2ea4c26d625462e9cafd489fe9d86da", - "reference": "4f2b619df2ea4c26d625462e9cafd489fe9d86da", + "url": "https://api.github.com/repos/SIU-Toba/jwt-util/zipball/15f7387de95505551047bd1a5945db1ea2c337b0", + "reference": "15f7387de95505551047bd1a5945db1ea2c337b0", "shasum": "" }, "require": { - "firebase/php-jwt": "^5.0", - "php": ">=5.6.0" + "firebase/php-jwt": "~6.4", + "php": ">=7.1.0" }, "require-dev": { - "phpunit/phpunit": "5.7.*" + "phpunit/phpunit": "9.5.*" }, "type": "library", "autoload": { @@ -2685,9 +2517,6 @@ } }, "notification-url": "https://packagist.org/downloads/", - "license": [ - "SIU" - ], "authors": [ { "name": "Sistema de Información Universitaria - SIU", @@ -2698,9 +2527,9 @@ "homepage": "http://www.siu.edu.ar", "support": { "issues": "https://github.com/SIU-Toba/jwt-util/issues", - "source": "https://github.com/SIU-Toba/jwt-util/tree/v1.0.3" + "source": "https://github.com/SIU-Toba/jwt-util/tree/v1.0.5" }, - "time": "2018-04-25T02:23:49+00:00" + "time": "2023-04-17T20:28:44+00:00" }, { "name": "siu-toba/numbers_words", @@ -2768,26 +2597,26 @@ }, { "name": "siu-toba/rest", - "version": "v2.0.7", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/SIU-Toba/rest.git", - "reference": "27e2a639b625d3e33286361c41b15e362a20ce01" + "reference": "4605acacdc6c44873f7e3fa3bd14c9a6872dc42d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/SIU-Toba/rest/zipball/27e2a639b625d3e33286361c41b15e362a20ce01", - "reference": "27e2a639b625d3e33286361c41b15e362a20ce01", + "url": "https://api.github.com/repos/SIU-Toba/rest/zipball/4605acacdc6c44873f7e3fa3bd14c9a6872dc42d", + "reference": "4605acacdc6c44873f7e3fa3bd14c9a6872dc42d", "shasum": "" }, "require": { - "doctrine/cache": "~1.4", - "php": ">=5.6.0", + "doctrine/cache": "~1.13", + "php": ">=8.1.0", "siu-toba/jwt-util": "~1.0.0", "siu-toba/ssl-cert-utils": "1.0" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^9.5" }, "type": "library", "autoload": { @@ -2800,9 +2629,9 @@ "homepage": "http://toba.siu.edu.ar", "support": { "issues": "https://github.com/SIU-Toba/rest/issues", - "source": "https://github.com/SIU-Toba/rest/tree/v2.0.7" + "source": "https://github.com/SIU-Toba/rest/tree/v3.1.0" }, - "time": "2020-10-19T18:30:22+00:00" + "time": "2023-11-17T18:54:08+00:00" }, { "name": "siu-toba/services_json", @@ -2886,11 +2715,18 @@ }, { "name": "siu-toba/structures_graph", - "version": "v1.1.1.1", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/SIU-Toba/Structures_Graph.git", - "reference": "3e18b7c2f418f9d78ebe357134b49b11c157fb7f" + "reference": "10294ab8d3ea8b697dbd63180b29190f4f20d6ba" + }, + "require": { + "pear/pear-core-minimal": "~1.10", + "php": ">=8.0" + }, + "require-dev": { + "phpunit/phpunit": "~9.6" }, "type": "library", "autoload": { @@ -2902,7 +2738,7 @@ "./" ], "license": [ - "PHP License" + "LGPL-3.0-or-later" ], "authors": [ { @@ -2912,22 +2748,23 @@ } ], "description": "More info available on: http://pear.php.net/package/Structures_Graph", + "homepage": "http://pear.php.net/package/Structures_Graph", "support": { "source": "https://github.com/pear/Structures_Graph" }, - "time": "2017-01-05T17:19:07+00:00" + "time": "2023-11-27T20:43:55+00:00" }, { "name": "siu/arai-json-migrator", - "version": "v1.1.0", + "version": "v2.0.0", "source": { "type": "git", "url": "https://gitlab.siu.edu.ar/siu-arai/arai-json-migrator.git", - "reference": "ba33a9df19ba59fecd8e0084eabf62a9205dd461" + "reference": "f1ed58f5501c0c14654384cb6d8a66cfaca906d3" }, "require": { - "php": ">=5.3.0", - "siu/json-util": "~1.0" + "php": ">=8.0.0", + "siu/json-util": "~1.4" }, "type": "project", "autoload": { @@ -2942,15 +2779,72 @@ } ], "description": "Utilidades para exportar e importar usuarios en Araí mediante un archivo JSON", - "time": "2021-12-17T20:40:31+00:00" + "time": "2023-12-01T17:41:46+00:00" }, { "name": "siu/interfaces-manejador-salida-toba", - "version": "v1.2", + "version": "v1.4", "source": { "type": "git", "url": "https://gitlab.siu.edu.ar/siu/interfaces-manejador-salida-toba.git", - "reference": "b332538c73ffac6879845265b58e8bef6d038693" + "reference": "dcc2eac1f35d16853fefb4bd77e1415331129154" + }, + "type": "library", + "autoload": { + "psr-4": { + "": "src" + } + }, + "authors": [ + { + "name": "Paulo Toledo", + "email": "ptoledo@siu.edu.ar" + } + ], + "description": "Implementación de las interfaces del patrón Abstract Factory para la salida de Toba", + "time": "2023-11-28T15:48:35+00:00" + }, + { + "name": "siu/json-util", + "version": "v1.4", + "source": { + "type": "git", + "url": "https://gitlab.siu.edu.ar/siu-arai/json-util.git", + "reference": "f5805560d31a20ca66d08db6dc55eab20d133987" + }, + "require": { + "justinrainbow/json-schema": "~5.2", + "php": ">=8.0.0", + "seld/jsonlint": "~1.8" + }, + "require-dev": { + "phpunit/phpunit": "~9.5" + }, + "type": "project", + "autoload": { + "psr-4": { + "": "src" + } + }, + "authors": [ + { + "name": "Andrés Blanco", + "email": "ablanco@siu.edu.ar" + } + ], + "description": "Utilidades para el parseo y chequeo de schemas de archivos Json", + "time": "2023-11-29T20:33:28+00:00" + }, + { + "name": "siu/manejador-salida-toba", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://gitlab.siu.edu.ar/siu/manejador-salida-toba.git", + "reference": "c8fb5dbb666db3c10e5eb540834df81e9e059f98" + }, + "require": { + "siu/interfaces-manejador-salida-toba": "~1.4" }, "type": "library", "autoload": { @@ -2958,147 +2852,257 @@ "": "src" } }, - "authors": [ + "authors": [ + { + "name": "Paulo Toledo", + "email": "ptoledo@siu.edu.ar" + } + ], + "description": "Implementación del patrón 'Abstract Factory' para la salida de Toba", + "time": "2023-12-01T14:00:09+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" + }, + "funding": [ { - "name": "Paulo Toledo", - "email": "ptoledo@siu.edu.ar" + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Implementación de las interfaces del patrón Abstract Factory para la salida de Toba", - "time": "2019-11-08T15:44:20+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { - "name": "siu/json-util", - "version": "v1.3", + "name": "symfony/event-dispatcher-contracts", + "version": "v3.4.0", "source": { "type": "git", - "url": "https://gitlab.siu.edu.ar/siu-arai/json-util.git", - "reference": "d858335979f9165df1b54405594ec3e140b09db3" + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/a76aed96a42d2b521153fb382d418e30d18b59df", + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df", + "shasum": "" }, "require": { - "justinrainbow/json-schema": "~1.4", - "php": ">=5.3.0", - "seld/jsonlint": "~1.0" + "php": ">=8.1", + "psr/event-dispatcher": "^1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } }, - "type": "project", "autoload": { "psr-4": { - "": "src" + "Symfony\\Contracts\\EventDispatcher\\": "" } }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], "authors": [ { - "name": "Andrés Blanco", - "email": "ablanco@siu.edu.ar" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Utilidades para el parseo y chequeo de schemas de archivos Json", - "time": "2016-04-19T14:36:23+00:00" - }, - { - "name": "siu/manejador-salida-toba", - "version": "v1.1.3", - "source": { - "type": "git", - "url": "https://gitlab.siu.edu.ar/siu/manejador-salida-toba.git", - "reference": "79d4e5549ca03c469b99569203f9486a63621bf7" - }, - "require": { - "siu/interfaces-manejador-salida-toba": "^1.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "": "src" - } + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.4.0" }, - "authors": [ + "funding": [ { - "name": "Paulo Toledo", - "email": "ptoledo@siu.edu.ar" + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Implementación del patrón 'Abstract Factory' para la salida de Toba", - "time": "2021-01-19T13:45:12+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { - "name": "siu/security-multitool", - "version": "1.1.0", + "name": "symfony/password-hasher", + "version": "v6.4.0", "source": { "type": "git", - "url": "https://github.com/SIU-Toba/SecurityMultiTool.git", - "reference": "20d7e5bda22901a77faeef59a1cfe87c8276b9b4" + "url": "https://github.com/symfony/password-hasher.git", + "reference": "e001f752338a49d644ee0523fd7891aabaccb7e2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/password-hasher/zipball/e001f752338a49d644ee0523fd7891aabaccb7e2", + "reference": "e001f752338a49d644ee0523fd7891aabaccb7e2", + "shasum": "" }, "require": { - "ezyang/htmlpurifier": ">=4.5.0", - "ircmaxell/security-lib": "1.1.*@dev", - "laminas/laminas-uri": "2.7.*", - "michelf/php-markdown": ">=1.0.2", - "mjohnson/decoda": ">=5.1.2", - "paragonie/random-lib": "~2.0" + "php": ">=8.1" + }, + "conflict": { + "symfony/security-core": "<5.4" }, "require-dev": { - "mockery/mockery": "~1.3" + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/security-core": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { - "psr-0": { - "SecurityMultiTool": "library/" - } + "psr-4": { + "Symfony\\Component\\PasswordHasher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, + "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" + "name": "Robin Chalas", + "email": "robin.chalas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "A multitool library offering access to recommended security related libraries, standardised implementations of security defences, and secure implementations of commonly performed tasks.", - "homepage": "http://github.com/padraic/SecurityMultiTool", + "description": "Provides password hashing utilities", + "homepage": "https://symfony.com", "keywords": [ - "PRNG", - "RNG", - "csrf", - "escaping", - "htmlpurifier", - "library", - "random", - "sanitisation", - "sanitization", - "security", - "ssl", - "tls", - "xss" + "hashing", + "password" + ], + "support": { + "source": "https://github.com/symfony/password-hasher/tree/v6.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } ], - "time": "2020-03-27T15:17:49+00:00" + "time": "2023-11-06T11:00:25+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3106,12 +3110,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3136,7 +3140,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -3152,34 +3156,35 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { - "name": "symfony/polyfill-intl-idn", - "version": "v1.23.0", + "name": "symfony/polyfill-mbstring", + "version": "v1.28.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/65bd267525e82759e7d8c4e8ceea44f398838e65", - "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { - "php": ">=7.1", - "symfony/polyfill-intl-normalizer": "^1.10", - "symfony/polyfill-php72": "^1.10" + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" }, "suggest": { - "ext-intl": "For best performance" + "ext-mbstring": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3187,12 +3192,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Idn\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3200,30 +3205,25 @@ ], "authors": [ { - "name": "Laurent Bassin", - "email": "laurent@bassin.info" - }, - { - "name": "Trevor Rowbotham", - "email": "trevor.rowbotham@pm.me" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "description": "Symfony polyfill for the Mbstring extension", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "idn", - "intl", + "mbstring", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -3239,32 +3239,29 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:27:20+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", + "name": "symfony/polyfill-php80", + "version": "v1.28.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { "php": ">=7.1" }, - "suggest": { - "ext-intl": "For best performance" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3272,12 +3269,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -3287,6 +3284,10 @@ "MIT" ], "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -3296,18 +3297,16 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "intl", - "normalizer", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -3323,44 +3322,129 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", + "name": "symfony/security-core", + "version": "v6.4.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "url": "https://github.com/symfony/security-core.git", + "reference": "9e24a7199744d944c03fc1448276dc57f6237a33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/security-core/zipball/9e24a7199744d944c03fc1448276dc57f6237a33", + "reference": "9e24a7199744d944c03fc1448276dc57f6237a33", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/event-dispatcher-contracts": "^2.5|^3", + "symfony/password-hasher": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3" }, - "suggest": { - "ext-mbstring": "For best performance" + "conflict": { + "symfony/event-dispatcher": "<5.4", + "symfony/http-foundation": "<5.4", + "symfony/ldap": "<5.4", + "symfony/security-guard": "<5.4", + "symfony/validator": "<5.4" + }, + "require-dev": { + "psr/cache": "^1.0|^2.0|^3.0", + "psr/container": "^1.1|^2.0", + "psr/log": "^1|^2|^3", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/ldap": "^5.4|^6.0|^7.0", + "symfony/string": "^5.4|^6.0|^7.0", + "symfony/translation": "^5.4|^6.0|^7.0", + "symfony/validator": "^6.4|^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Core\\": "" }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - Core Library", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-core/tree/v6.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } + ], + "time": "2023-11-06T17:20:05+00:00" + }, + { + "name": "symfony/security-csrf", + "version": "v5.4.27", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-csrf.git", + "reference": "995fcfcc5a3be09df157b4960668f61cceb86611" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-csrf/zipball/995fcfcc5a3be09df157b4960668f61cceb86611", + "reference": "995fcfcc5a3be09df157b4960668f61cceb86611", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16", + "symfony/security-core": "^4.4|^5.0|^6.0" + }, + "conflict": { + "symfony/http-foundation": "<5.3" + }, + "require-dev": { + "symfony/http-foundation": "^5.3|^6.0" + }, + "suggest": { + "symfony/http-foundation": "For using the class SessionTokenStorage." }, + "type": "library", "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Component\\Security\\Csrf\\": "" }, - "files": [ - "bootstrap.php" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3369,25 +3453,18 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony Security Component - CSRF Library", "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" + "source": "https://github.com/symfony/security-csrf/tree/v5.4.27" }, "funding": [ { @@ -3403,42 +3480,47 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2023-07-28T14:44:35+00:00" }, { - "name": "symfony/polyfill-php72", - "version": "v1.23.0", + "name": "symfony/service-contracts", + "version": "v2.5.2", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" + "url": "https://github.com/symfony/service-contracts.git", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "2.5-dev" }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] + "Symfony\\Contracts\\Service\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3454,16 +3536,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "description": "Generic abstractions related to writing services", "homepage": "https://symfony.com", "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.23.0" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" }, "funding": [ { @@ -3479,20 +3563,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:17:38+00:00" + "time": "2022-05-30T19:17:29+00:00" }, { "name": "symfony/yaml", - "version": "v4.4.34", + "version": "v4.4.45", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "2c309e258adeb9970229042be39b360d34986fad" + "reference": "aeccc4dc52a9e634f1d1eebeb21eacfdcff1053d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/2c309e258adeb9970229042be39b360d34986fad", - "reference": "2c309e258adeb9970229042be39b360d34986fad", + "url": "https://api.github.com/repos/symfony/yaml/zipball/aeccc4dc52a9e634f1d1eebeb21eacfdcff1053d", + "reference": "aeccc4dc52a9e634f1d1eebeb21eacfdcff1053d", "shasum": "" }, "require": { @@ -3534,7 +3618,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v4.4.34" + "source": "https://github.com/symfony/yaml/tree/v4.4.45" }, "funding": [ { @@ -3550,40 +3634,47 @@ "type": "tidelift" } ], - "time": "2021-11-18T18:49:23+00:00" + "time": "2022-08-02T15:47:23+00:00" }, { "name": "vlucas/phpdotenv", - "version": "v3.6.10", + "version": "v5.6.0", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "5b547cdb25825f10251370f57ba5d9d924e6f68e" + "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/5b547cdb25825f10251370f57ba5d9d924e6f68e", - "reference": "5b547cdb25825f10251370f57ba5d9d924e6f68e", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", + "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0 || ^8.0", - "phpoption/phpoption": "^1.5.2", - "symfony/polyfill-ctype": "^1.17" + "ext-pcre": "*", + "graham-campbell/result-type": "^1.1.2", + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.2", + "symfony/polyfill-ctype": "^1.24", + "symfony/polyfill-mbstring": "^1.24", + "symfony/polyfill-php80": "^1.24" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", "ext-filter": "*", - "ext-pcre": "*", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21" + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" }, "suggest": { - "ext-filter": "Required to use the boolean validator.", - "ext-pcre": "Required to use most of the library." + "ext-filter": "Required to use the boolean validator." }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": true + }, "branch-alias": { - "dev-master": "3.6-dev" + "dev-master": "5.6-dev" } }, "autoload": { @@ -3615,7 +3706,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v3.6.10" + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.0" }, "funding": [ { @@ -3627,41 +3718,86 @@ "type": "tidelift" } ], - "time": "2021-12-12T23:02:06+00:00" + "time": "2023-11-12T22:43:29+00:00" } ], "packages-dev": [ { - "name": "doctrine/lexer", - "version": "1.2.1", + "name": "doctrine/deprecations", + "version": "1.1.2", "source": { "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" + "url": "https://github.com/doctrine/deprecations.git", + "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/4f2d4f2836e7ec4e7a8625e75c6aa916004db931", + "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" } }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.2" + }, + "time": "2023-09-27T20:04:15+00:00" + }, + { + "name": "doctrine/lexer", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.0", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^10", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "^0.18.3", + "vimeo/psalm": "^4.11 || ^5.0" + }, + "type": "library", "autoload": { "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + "Doctrine\\Common\\Lexer\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -3693,7 +3829,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.1" + "source": "https://github.com/doctrine/lexer/tree/2.1.0" }, "funding": [ { @@ -3709,34 +3845,43 @@ "type": "tidelift" } ], - "time": "2020-05-25T17:44:05+00:00" + "time": "2022-12-14T08:49:07+00:00" }, { "name": "egulias/email-validator", - "version": "1.2.17", + "version": "3.2.6", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "19674b35a0a3456be1b96e137098d31ed386fb61" + "reference": "e5997fa97e8790cdae03a9cbd5e78e45e3c7bda7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/19674b35a0a3456be1b96e137098d31ed386fb61", - "reference": "19674b35a0a3456be1b96e137098d31ed386fb61", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/e5997fa97e8790cdae03a9cbd5e78e45e3c7bda7", + "reference": "e5997fa97e8790cdae03a9cbd5e78e45e3c7bda7", "shasum": "" }, "require": { - "doctrine/lexer": "^1.0.1", - "php": ">=5.3.3" + "doctrine/lexer": "^1.2|^2", + "php": ">=7.2", + "symfony/polyfill-intl-idn": "^1.15" }, "require-dev": { - "phpunit/phpunit": "^4.8.36|^7.5.15", - "satooshi/php-coveralls": "^1.0.1" + "phpunit/phpunit": "^8.5.8|^9.3.3", + "vimeo/psalm": "^4" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, "autoload": { - "psr-0": { - "Egulias\\": "src/" + "psr-4": { + "Egulias\\EmailValidator\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -3748,7 +3893,7 @@ "name": "Eduardo Gulias Davis" } ], - "description": "A library for validating emails", + "description": "A library for validating emails against several RFCs", "homepage": "https://github.com/egulias/EmailValidator", "keywords": [ "email", @@ -3759,22 +3904,28 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/1.2" + "source": "https://github.com/egulias/EmailValidator/tree/3.2.6" }, - "time": "2020-04-11T12:59:45+00:00" + "funding": [ + { + "url": "https://github.com/egulias", + "type": "github" + } + ], + "time": "2023-06-01T07:04:22+00:00" }, { "name": "greenlion/php-sql-parser", - "version": "v4.4.0", + "version": "v4.6.0", "source": { "type": "git", "url": "https://github.com/greenlion/PHP-SQL-Parser.git", - "reference": "e38d6f0f500d4d86bee7722e2e89262eeaab7e59" + "reference": "f0e4645eb1612f0a295e3d35bda4c7740ae8c366" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/greenlion/PHP-SQL-Parser/zipball/e38d6f0f500d4d86bee7722e2e89262eeaab7e59", - "reference": "e38d6f0f500d4d86bee7722e2e89262eeaab7e59", + "url": "https://api.github.com/repos/greenlion/PHP-SQL-Parser/zipball/f0e4645eb1612f0a295e3d35bda4c7740ae8c366", + "reference": "f0e4645eb1612f0a295e3d35bda4c7740ae8c366", "shasum": "" }, "require": { @@ -3782,7 +3933,7 @@ }, "require-dev": { "analog/analog": "^1.0.6", - "phpunit/phpunit": "^4.0.14", + "phpunit/phpunit": "^9.5.13", "squizlabs/php_codesniffer": "^1.5.1" }, "type": "library", @@ -3821,106 +3972,20 @@ "issues": "https://github.com/greenlion/PHP-SQL-Parser/issues", "source": "https://github.com/greenlion/PHP-SQL-Parser" }, - "time": "2021-03-28T23:13:55+00:00" - }, - { - "name": "monolog/monolog", - "version": "1.26.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c6b00f05152ae2c9b04a448f99c7590beb6042f5", - "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/log-implementation": "1.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", - "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", - "php-amqplib/php-amqplib": "~2.4", - "php-console/php-console": "^3.1.3", - "phpstan/phpstan": "^0.12.59", - "phpunit/phpunit": "~4.5", - "ruflin/elastica": ">=0.90 <3.0", - "sentry/sentry": "^0.13", - "swiftmailer/swiftmailer": "^5.3|^6.0" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", - "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "php-console/php-console": "Allow sending log messages to Google Chrome", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "sentry/sentry": "Allow sending log messages to a Sentry server" - }, - "type": "library", - "autoload": { - "psr-4": { - "Monolog\\": "src/Monolog" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ], - "support": { - "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/1.26.1" - }, - "funding": [ - { - "url": "https://github.com/Seldaek", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", - "type": "tidelift" - } - ], - "time": "2021-05-28T08:32:12+00:00" + "time": "2023-03-09T20:54:23+00:00" }, { "name": "paragonie/constant_time_encoding", - "version": "v2.4.0", + "version": "v2.6.3", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c" + "reference": "58c3f47f650c94ec05a151692652a868995d2938" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c", - "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/58c3f47f650c94ec05a151692652a868995d2938", + "reference": "58c3f47f650c94ec05a151692652a868995d2938", "shasum": "" }, "require": { @@ -3966,160 +4031,62 @@ "bin2hex", "encoding", "hex", - "hex2bin", - "rfc4648" - ], - "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/constant_time_encoding/issues", - "source": "https://github.com/paragonie/constant_time_encoding" - }, - "time": "2020-12-06T15:14:20+00:00" - }, - { - "name": "pear/console_getopt", - "version": "v1.4.3", - "source": { - "type": "git", - "url": "https://github.com/pear/Console_Getopt.git", - "reference": "a41f8d3e668987609178c7c4a9fe48fecac53fa0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pear/Console_Getopt/zipball/a41f8d3e668987609178c7c4a9fe48fecac53fa0", - "reference": "a41f8d3e668987609178c7c4a9fe48fecac53fa0", - "shasum": "" - }, - "type": "library", - "autoload": { - "psr-0": { - "Console": "./" - } - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "./" - ], - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Andrei Zmievski", - "email": "andrei@php.net", - "role": "Lead" - }, - { - "name": "Stig Bakken", - "email": "stig@php.net", - "role": "Developer" - }, - { - "name": "Greg Beaver", - "email": "cellog@php.net", - "role": "Helper" - } - ], - "description": "More info available on: http://pear.php.net/package/Console_Getopt", - "support": { - "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Console_Getopt", - "source": "https://github.com/pear/Console_Getopt" - }, - "time": "2019-11-20T18:27:48+00:00" - }, - { - "name": "pear/pear-core-minimal", - "version": "v1.10.11", - "source": { - "type": "git", - "url": "https://github.com/pear/pear-core-minimal.git", - "reference": "68d0d32ada737153b7e93b8d3c710ebe70ac867d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/68d0d32ada737153b7e93b8d3c710ebe70ac867d", - "reference": "68d0d32ada737153b7e93b8d3c710ebe70ac867d", - "shasum": "" - }, - "require": { - "pear/console_getopt": "~1.4", - "pear/pear_exception": "~1.0" - }, - "replace": { - "rsky/pear-core-min": "self.version" - }, - "type": "library", - "autoload": { - "psr-0": { - "": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "src/" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Christian Weiske", - "email": "cweiske@php.net", - "role": "Lead" - } + "hex2bin", + "rfc4648" ], - "description": "Minimal set of PEAR core files to be used as composer dependency", "support": { - "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR", - "source": "https://github.com/pear/pear-core-minimal" + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/constant_time_encoding/issues", + "source": "https://github.com/paragonie/constant_time_encoding" }, - "time": "2021-08-10T22:31:03+00:00" + "time": "2022-06-14T06:56:20+00:00" }, { "name": "php-webdriver/webdriver", - "version": "1.12.0", + "version": "1.15.1", "source": { "type": "git", "url": "https://github.com/php-webdriver/php-webdriver.git", - "reference": "99d4856ed7dffcdf6a52eccd6551e83d8d557ceb" + "reference": "cd52d9342c5aa738c2e75a67e47a1b6df97154e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/99d4856ed7dffcdf6a52eccd6551e83d8d557ceb", - "reference": "99d4856ed7dffcdf6a52eccd6551e83d8d557ceb", + "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/cd52d9342c5aa738c2e75a67e47a1b6df97154e8", + "reference": "cd52d9342c5aa738c2e75a67e47a1b6df97154e8", "shasum": "" }, "require": { "ext-curl": "*", "ext-json": "*", "ext-zip": "*", - "php": "^5.6 || ~7.0 || ^8.0", + "php": "^7.3 || ^8.0", "symfony/polyfill-mbstring": "^1.12", - "symfony/process": "^2.8 || ^3.1 || ^4.0 || ^5.0 || ^6.0" + "symfony/process": "^5.0 || ^6.0 || ^7.0" }, "replace": { "facebook/webdriver": "*" }, "require-dev": { - "ondram/ci-detector": "^2.1 || ^3.5 || ^4.0", + "ergebnis/composer-normalize": "^2.20.0", + "ondram/ci-detector": "^4.0", "php-coveralls/php-coveralls": "^2.4", - "php-mock/php-mock-phpunit": "^1.1 || ^2.0", + "php-mock/php-mock-phpunit": "^2.0", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpunit/phpunit": "^5.7 || ^7 || ^8 || ^9", + "phpunit/phpunit": "^9.3", "squizlabs/php_codesniffer": "^3.5", - "symfony/var-dumper": "^3.3 || ^4.0 || ^5.0 || ^6.0" + "symfony/var-dumper": "^5.0 || ^6.0" }, "suggest": { "ext-SimpleXML": "For Firefox profile creation" }, "type": "library", "autoload": { - "psr-4": { - "Facebook\\WebDriver\\": "lib/" - }, "files": [ "lib/Exception/TimeoutException.php" - ] + ], + "psr-4": { + "Facebook\\WebDriver\\": "lib/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4136,9 +4103,9 @@ ], "support": { "issues": "https://github.com/php-webdriver/php-webdriver/issues", - "source": "https://github.com/php-webdriver/php-webdriver/tree/1.12.0" + "source": "https://github.com/php-webdriver/php-webdriver/tree/1.15.1" }, - "time": "2021-10-14T09:30:02+00:00" + "time": "2023-10-20T12:21:20+00:00" }, { "name": "pimple/pimple", @@ -4250,20 +4217,24 @@ }, { "name": "simpletest/simpletest", - "version": "v1.2.0", + "version": "v1.1.7", "source": { "type": "git", "url": "https://github.com/simpletest/simpletest.git", - "reference": "4fb6006517a1428785a0ea704fbedcc675421ec4" + "reference": "2f8c466c114bdb9c11028a0c3e6d1380ae6a18dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/simpletest/simpletest/zipball/4fb6006517a1428785a0ea704fbedcc675421ec4", - "reference": "4fb6006517a1428785a0ea704fbedcc675421ec4", + "url": "https://api.github.com/repos/simpletest/simpletest/zipball/2f8c466c114bdb9c11028a0c3e6d1380ae6a18dc", + "reference": "2f8c466c114bdb9c11028a0c3e6d1380ae6a18dc", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=5.0.5" + }, + "replace": { + "lastcraft/simpletest": "self.version", + "vierbergenlars/simpletest": "self.version" }, "type": "library", "autoload": { @@ -4276,6 +4247,14 @@ "LGPL-2.0+" ], "authors": [ + { + "name": "Lars Vierbergen", + "email": "vierbergenlars@gmail.com" + }, + { + "name": "Lachlan Donald", + "email": "lachlan@ljd.cc" + }, { "name": "Marcus Baker", "email": "marcus@lastcraft.com", @@ -4296,17 +4275,6 @@ { "name": "Edward Z. Yang", "role": "Original developer" - }, - { - "name": "Lachlan Donald", - "email": "lachlan@ljd.cc" - }, - { - "name": "Lars Vierbergen", - "email": "vierbergenlars@gmail.com" - }, - { - "name": "Jens A. Koch" } ], "description": "Unit testing, mock objects and web testing framework for PHP built around test cases.", @@ -4322,85 +4290,41 @@ "issues": "https://github.com/simpletest/simpletest/issues", "source": "https://github.com/simpletest/simpletest/tree/master" }, - "time": "2019-09-17T15:08:22+00:00" - }, - { - "name": "siu-toba/text_highlighter", - "version": "0.8.1.3", - "source": { - "type": "git", - "url": "https://github.com/SIU-Toba/Text_Highlighter.git", - "reference": "0f0625d59be8386214e90fcfbd9b608a68ab7557" - }, - "require": { - "pear/pear-core-minimal": "~1.10.0", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "@stable" - }, - "type": "library", - "autoload": { - "psr-0": { - "Text": "./" - } - }, - "include-path": [ - "./" - ], - "license": [ - "PHP-3.01" - ], - "authors": [ - { - "email": "ssttoo@gmail.com", - "name": "Stoyan Stefanov", - "role": "Lead" - }, - { - "email": "demenev@gmail.com", - "name": "Andrey Demenev", - "role": "Lead" - } - ], - "description": "More info available on: http://pear.php.net/package/Text_Highlighter", - "support": { - "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Text_Highlighter", - "source": "https://github.com/pear/Text_Highlighter" - }, - "time": "2018-05-08T18:10:23+00:00" + "time": "2015-09-21T18:19:52+00:00" }, { "name": "siu/arai-cli", - "version": "v3.0.0", + "version": "dev-develop", "source": { "type": "git", "url": "https://gitlab.siu.edu.ar/siu-arai/arai-cli.git", - "reference": "e26342659ad87667875b5dfd9ecc30dca87db005" + "reference": "d649431e3edac0bf083dd6e8c4aceb13339cd958" }, "require": { - "egulias/email-validator": "~1.2", - "guzzlehttp/guzzle": "~6.0", - "monolog/monolog": "~1.13", + "egulias/email-validator": "~3.1", + "guzzlehttp/guzzle": "~7.0", "paragonie/constant_time_encoding": "^1|^2", - "paragonie/sodium_compat": "~1.13", - "php": ">=7.3", + "paragonie/sodium_compat": "~1.17", + "php": ">=7.4", "pimple/pimple": "~3.0", + "psr/log": "~1.0|~2.0|~3.0", "seld/cli-prompt": "~1.0", - "siu/arai-crypto": "~v2.0.0", - "siu/arai-json-parser": "~3.1.5", - "symfony/console": "~3.1 | ~4.0", - "symfony/debug": "~3.1 | ~4.0" + "siu/arai-crypto": "~2.1", + "siu/arai-json-parser": "~3.2", + "symfony/console": "~4.4|~5.4|~5.5", + "symfony/error-handler": "~4.4|~5.4|~5.5" }, "conflict": { "siu-toba/framework": "<3.2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.0", - "mikey179/vfsstream": "1.6.5", - "phpunit/phpunit": "~9.0", - "symfony/process": "~3.1" + "friendsofphp/php-cs-fixer": "~3.8", + "mikey179/vfsstream": "~1.6", + "monolog/monolog": "~1.0|~2.0|~3.0", + "phpunit/phpunit": "~9.5", + "symfony/process": "~4.4|~5.4|~5.5" }, + "default-branch": true, "bin": [ "bin/arai-cli" ], @@ -4411,26 +4335,26 @@ } }, "description": "Librería cliente de los componentes ARAI", - "time": "2020-05-18T20:59:27+00:00" + "time": "2023-12-05T22:25:23+00:00" }, { "name": "siu/arai-crypto", - "version": "v2.0.0", + "version": "v2.1.0", "source": { "type": "git", "url": "https://gitlab.siu.edu.ar/siu-arai/arai-crypto", - "reference": "3af05ab326bba1abe51d69bf0f088d1b9c4c557e" + "reference": "314b0c2c74844630f7b063b1646ada6a1d1610a0" }, "require": { - "php": ">=7.3" + "php": ">=7.4" }, "conflict": { "paragonie/halite": "*" }, "require-dev": { - "mikey179/vfsstream": "1.6.5", + "mikey179/vfsstream": "~1.6", "paragonie/constant_time_encoding": "^1|^2", - "paragonie/sodium_compat": "~1.12", + "paragonie/sodium_compat": "~1.17", "phpunit/phpunit": "~9.0" }, "suggest": { @@ -4443,19 +4367,19 @@ } }, "description": "Librería que ofrece servicios de criptografía para ARAI", - "time": "2020-04-02T23:18:52+00:00" + "time": "2023-11-29T20:51:14+00:00" }, { "name": "siu/arai-json-parser", - "version": "v3.1.5", + "version": "v3.2.0", "source": { "type": "git", "url": "https://gitlab.siu.edu.ar/siu-arai/arai-json-parser.git", - "reference": "045c50ed1a9631de2067eb01b185ab9c4bc900e6" + "reference": "85f37ced08c8fd5e131bbbdd42176b05c7a44b51" }, "require": { - "php": ">=5.3.0", - "siu/json-util": "~1.0" + "php": ">=8.0.0", + "siu/json-util": "~v1.4" }, "type": "project", "autoload": { @@ -4470,18 +4394,18 @@ } ], "description": "Utilidades para parsear el json de Araí", - "time": "2019-05-20T20:08:48+00:00" + "time": "2023-12-01T19:17:23+00:00" }, { "name": "siu/manejador-salida-bootstrap", - "version": "v1.3.5", + "version": "v1.4.0", "source": { "type": "git", "url": "https://gitlab.siu.edu.ar/siu/manejador-salida-bootstrap.git", - "reference": "5e126cef93c7bcd9647252ddc630a77d9e44057a" + "reference": "a5bdcc56034c1a264a485430aaeff7c1cbbbdbc9" }, "require": { - "siu/interfaces-manejador-salida-toba": "^1.2" + "siu/interfaces-manejador-salida-toba": "~1.4" }, "type": "library", "autoload": { @@ -4491,8 +4415,8 @@ }, "scripts": { "post-install-cmd": [ - "yarn add font-awesome@4.7.0 respond.js@1.4.2 html5shiv@3.7.3 --modules-folder tmp_assets/", - "yarn add bootstrap@3.3.7 --no-dev --modules-folder tmp_assets/", + "yarn add font-awesome@4.7.0 respond.js@1.4.2 html5shiv@3.7.3 --modules-folder node_modules/", + "yarn add bootstrap@3.3.7 --no-dev --modules-folder node_modules/", "yarn install", "php bin/instalar_assets.php" ] @@ -4504,41 +4428,40 @@ } ], "description": "Implementacion del patron 'Abstract Factory' para la salida Bootstrap", - "time": "2021-01-19T13:56:40+00:00" + "time": "2023-12-01T13:58:36+00:00" }, { "name": "symfony/console", - "version": "v4.4.34", + "version": "v4.4.26", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "329b3a75cc6b16d435ba1b1a41df54a53382a3f0" + "reference": "9aa1eb46c1b12fada74dc0c529e93d1ccef22576" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/329b3a75cc6b16d435ba1b1a41df54a53382a3f0", - "reference": "329b3a75cc6b16d435ba1b1a41df54a53382a3f0", + "url": "https://api.github.com/repos/symfony/console/zipball/9aa1eb46c1b12fada74dc0c529e93d1ccef22576", + "reference": "9aa1eb46c1b12fada74dc0c529e93d1ccef22576", "shasum": "" }, "require": { "php": ">=7.1.3", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.16", + "symfony/polyfill-php80": "^1.15", "symfony/service-contracts": "^1.1|^2" }, "conflict": { - "psr/log": ">=3", "symfony/dependency-injection": "<3.4", "symfony/event-dispatcher": "<4.3|>=5", "symfony/lock": "<4.4", "symfony/process": "<3.3" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0" }, "require-dev": { - "psr/log": "^1|^2", + "psr/log": "~1.0", "symfony/config": "^3.4|^4.0|^5.0", "symfony/dependency-injection": "^3.4|^4.0|^5.0", "symfony/event-dispatcher": "^4.3", @@ -4578,7 +4501,7 @@ "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/console/tree/v4.4.34" + "source": "https://github.com/symfony/console/tree/v4.4.26" }, "funding": [ { @@ -4594,36 +4517,39 @@ "type": "tidelift" } ], - "time": "2021-11-04T12:23:33+00:00" + "time": "2021-06-06T09:12:27+00:00" }, { - "name": "symfony/debug", - "version": "v4.4.31", + "name": "symfony/error-handler", + "version": "v5.4.29", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "43ede438d4cb52cd589ae5dc070e9323866ba8e0" + "url": "https://github.com/symfony/error-handler.git", + "reference": "328c6fcfd2f90b64c16efaf0ea67a311d672f078" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/43ede438d4cb52cd589ae5dc070e9323866ba8e0", - "reference": "43ede438d4cb52cd589ae5dc070e9323866ba8e0", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/328c6fcfd2f90b64c16efaf0ea67a311d672f078", + "reference": "328c6fcfd2f90b64c16efaf0ea67a311d672f078", "shasum": "" }, "require": { - "php": ">=7.1.3", - "psr/log": "^1|^2|^3" - }, - "conflict": { - "symfony/http-kernel": "<3.4" + "php": ">=7.2.5", + "psr/log": "^1|^2|^3", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "require-dev": { - "symfony/http-kernel": "^3.4|^4.0|^5.0" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/serializer": "^4.4|^5.0|^6.0" }, + "bin": [ + "Resources/bin/patch-type-declarations" + ], "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Debug\\": "" + "Symfony\\Component\\ErrorHandler\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -4643,10 +4569,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Provides tools to ease debugging PHP code", + "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/debug/tree/v4.4.31" + "source": "https://github.com/symfony/error-handler/tree/v5.4.29" }, "funding": [ { @@ -4662,39 +4588,47 @@ "type": "tidelift" } ], - "time": "2021-09-24T13:30:14+00:00" + "time": "2023-09-06T21:54:06+00:00" }, { - "name": "symfony/deprecation-contracts", - "version": "v2.5.0", + "name": "symfony/polyfill-intl-idn", + "version": "v1.28.0", "source": { "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "ecaafce9f77234a6a449d29e49267ba10499116d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", - "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/ecaafce9f77234a6a449d29e49267ba10499116d", + "reference": "ecaafce9f77234a6a449d29e49267ba10499116d", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.1", + "symfony/polyfill-intl-normalizer": "^1.10", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "1.28-dev" }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { "files": [ - "function.php" - ] + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4702,18 +4636,30 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "A generic function and convention to trigger deprecation notices", + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.28.0" }, "funding": [ { @@ -4729,29 +4675,32 @@ "type": "tidelift" } ], - "time": "2021-07-12T14:48:14+00:00" + "time": "2023-01-26T09:30:37+00:00" }, { - "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.28.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", "shasum": "" }, "require": { "php": ">=7.1" }, + "suggest": { + "ext-intl": "For best performance" + }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4759,12 +4708,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -4783,16 +4732,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "description": "Symfony polyfill for intl's Normalizer class and related functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "intl", + "normalizer", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" }, "funding": [ { @@ -4808,20 +4759,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { - "name": "symfony/polyfill-php80", - "version": "v1.23.1", + "name": "symfony/polyfill-php72", + "version": "v1.28.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", "shasum": "" }, "require": { @@ -4830,7 +4781,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4838,12 +4789,88 @@ } }, "autoload": { + "files": [ + "bootstrap.php" + ], "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" + "Symfony\\Polyfill\\Php72\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -4853,10 +4880,6 @@ "MIT" ], "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -4866,7 +4889,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -4875,7 +4898,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" }, "funding": [ { @@ -4891,25 +4914,24 @@ "type": "tidelift" } ], - "time": "2021-07-28T13:41:28+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/process", - "version": "v5.4.0", + "version": "v6.4.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "5be20b3830f726e019162b26223110c8f47cf274" + "reference": "191703b1566d97a5425dc969e4350d32b8ef17aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/5be20b3830f726e019162b26223110c8f47cf274", - "reference": "5be20b3830f726e019162b26223110c8f47cf274", + "url": "https://api.github.com/repos/symfony/process/zipball/191703b1566d97a5425dc969e4350d32b8ef17aa", + "reference": "191703b1566d97a5425dc969e4350d32b8ef17aa", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" }, "type": "library", "autoload": { @@ -4937,7 +4959,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.0" + "source": "https://github.com/symfony/process/tree/v6.4.0" }, "funding": [ { @@ -4953,47 +4975,57 @@ "type": "tidelift" } ], - "time": "2021-11-28T15:25:38+00:00" + "time": "2023-11-17T21:06:49+00:00" }, { - "name": "symfony/service-contracts", - "version": "v2.5.0", + "name": "symfony/var-dumper", + "version": "v5.4.29", "source": { "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc" + "url": "https://github.com/symfony/var-dumper.git", + "reference": "6172e4ae3534d25ee9e07eb487c20be7760fcc65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", - "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/6172e4ae3534d25ee9e07eb487c20be7760fcc65", + "reference": "6172e4ae3534d25ee9e07eb487c20be7760fcc65", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1" + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16" }, "conflict": { - "ext-psr": "<1.1|>=2" + "symfony/console": "<4.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/uid": "^5.1|^6.0", + "twig/twig": "^2.13|^3.0.4" }, "suggest": { - "symfony/service-implementation": "" + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" }, + "bin": [ + "Resources/bin/var-dump-server" + ], "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, "autoload": { + "files": [ + "Resources/functions/dump.php" + ], "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -5009,18 +5041,14 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Generic abstractions related to writing services", + "description": "Provides mechanisms for walking through any arbitrary PHP variable", "homepage": "https://symfony.com", "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" + "debug", + "dump" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.0" + "source": "https://github.com/symfony/var-dumper/tree/v5.4.29" }, "funding": [ { @@ -5036,12 +5064,13 @@ "type": "tidelift" } ], - "time": "2021-11-04T16:48:04+00:00" + "time": "2023-09-12T10:09:58+00:00" } ], "aliases": [], "minimum-stability": "dev", "stability-flags": { + "dapphp/securimage": 20, "guiguiboy/php-cli-progress-bar": 20, "ioncube/php-openssl-cryptor": 20, "greenlion/php-sql-parser": 20 @@ -5053,5 +5082,5 @@ "ext-curl": "*" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } diff --git a/docker-compose.yml b/docker-compose.yml index a20e92c409..0ae64afc94 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,53 +1,35 @@ -pgdata: - image: postgres:9.6 - command: "true" - volumes: -#Comentar la siguiente linea para corregir permisos en OSX - - ./docker-data/pgdata:/var/lib/postgresql/data +version: '3.7' - - ./docker-data/toba:/var/local/docker-data/toba +services: + pg: + image: postgres:14 + ports: + - "7432:5432" + environment: + POSTGRES_USER : postgres + POSTGRES_PASSWORD : postgres -web: - image: siutoba/docker-toba:latest - ports: - - "2020:80" - env_file: docker.env - environment: -## Descomentar y definir para cagar/instalar un proyecto especifico o instalar toba en un path dado - TOBA_DIR: /var/local/toba - TOBA_INSTALACION_DIR: /var/local/toba/docker-data/instalacion -# TOBA_PROYECTO : miproyecto -# TOBA_BASE_NOMBRE : toba -# TOBA_PROYECTO_DIR : /var/local/toba/proyectos/miproyecto -# TOBA_PROYECTO_ALIAS : /miproyecto -# TOBA_PROYECTO_INSTALAR : "true" -# TOBA_PROYECTO_INSTALAR_PARAMETROS : --base-nombre miproyecto - links: - - pg -## Activar este link si se desea utilizar el servidor de Jasper -# - jasper -## Descomentar esta variable de entorno para corregir permisos en OSX -# OSX: 1 - volumes_from: - - pgdata - volumes: - - ./:/var/local/toba + web: + ## user: "$USER_ID" + image: siudocker/php:8.1-web-v1.0.3 + ports: + - "7008:8080" + environment: + DOCKER_NAME : web-toba + DOCKER_WEB_PORT : 7008 + TOBA_PASS : toba + TOBA_BASE_PASS : postgres + TOBA_INSTALACION_DIR : /var/local/docker-data/framework-instalacion + TOBA_BASE_HOST : pg + TOBA_BASE_NOMBRE : toba_trunk + TOBA_PROYECTO_INSTALAR : "True" + TOBA_INSTALAR_REFERENCIA : "True" + TOBA_INSTALAR_USUARIOS : "True" + TOBA_REDIRECCIONAR_LOGS : 1 + links: + - pg + volumes: + - ./ini_file:/etc/php81/conf.d/90-custom.ini + - .:/var/local/framework + - ./instalacion:/var/local/docker-data/framework-instalacion -# Descomentar este bloque si se desea utilizar el servidor Jasper (Por ahora esta sin testear) -#jasper: -## build: jasper/ -# image: siutoba/docker-guarani-jasper -# links: -# - pg -# volumes: -# - ./:/var/local/toba - -pg: - image: postgres:9.6 - ports: - - "4432:5432" - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - volumes_from: - - pgdata diff --git a/docker-template.env b/docker-template.env deleted file mode 100644 index 8c875dd278..0000000000 --- a/docker-template.env +++ /dev/null @@ -1,6 +0,0 @@ -# Configuraciones para la instalacion de toba -# Guardar como docker.env -TOBA_ID_DESARROLLADOR=0 -TOBA_USUARIO_ADMIN=toba -TOBA_PASS=toba -TOBA_NOMBRE_INSTALACION=Editor de Toba diff --git a/docker-template.yml b/docker-template.yml deleted file mode 100644 index 00405832ea..0000000000 --- a/docker-template.yml +++ /dev/null @@ -1,52 +0,0 @@ -pgdata: - image: postgres:9.6 - command: "true" - volumes: -#Comentar la siguiente linea para corregir permisos en OSX - - ./docker-data/pgdata:/var/lib/postgresql/data - - - ./docker-data/instalacion:/var/local/proyecto/docker-data/instalacion - -web: - image: siutoba/docker-toba - ports: - - "2020:80" - env_file: docker.env - environment: - TOBA_DIR: /var/local/proyecto/vendor/siu-toba/framework - TOBA_INSTALACION_DIR: /var/local/proyecto/docker-data/instalacion -## Descomentar y definir para cagar/instalar un proyecto especifico -# TOBA_PROYECTO : miproyecto -# TOBA_BASE_NOMBRE : toba -# TOBA_PROYECTO_DIR : /var/local/proyecto -# TOBA_PROYECTO_ALIAS : /miproyecto -# TOBA_PROYECTO_INSTALAR : "true" -# TOBA_PROYECTO_INSTALAR_PARAMETROS : --base-nombre miproyecto - - links: - - pg -## Activar este link si se desea utilizar el servidor de Jasper -# - jasper -## Descomentar esta variable de entorno para corregir permisos en OSX -# OSX: 1 - volumes_from: - - pgdata - volumes: - - ./:/var/local/proyecto - -# Descomentar este bloque si se desea utilizar el servidor Jasper. Por ahora esta sin testear -#jasper: -## build: jasper/ -# image: siutoba/docker-guarani-jasper -# links: -# - pg -# volumes: -# - ./:/var/local/proyecto/vendor/siu-toba/framework - -pg: - image: postgres:9.6 - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - volumes_from: - - pgdata diff --git a/ini_file b/ini_file new file mode 100644 index 0000000000..a282be642e --- /dev/null +++ b/ini_file @@ -0,0 +1,2 @@ +error_reporting = E_ALL +display_errors = On \ No newline at end of file diff --git a/package.json b/package.json index d7aad49722..22dc7d41eb 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,14 @@ { "name": "siu-toba-framework", - "version": "3.3.24", + "version": "3.4.0", "description": "Framework para desarrollo rápido de aplicaciones web", "license": "SEE LICENSE IN licencia.txt", "repository": "https://github.com/SIU-Toba/framework.git", "author": "enfoqueNativo ", "private": false, "dependencies": { - "ckeditor4": "~4.18", + "@highlightjs/cdn-assets": "^11.8.0", + "ckeditor4": "4.18", "jquery": "3.6", "jquery-migrate": "3.3", "siu-js-app-launcher": "1.0.6" diff --git a/php/3ros/PHP_Highlight.php b/php/3ros/PHP_Highlight.php deleted file mode 100644 index d29a5cd6a5..0000000000 --- a/php/3ros/PHP_Highlight.php +++ /dev/null @@ -1,462 +0,0 @@ - - * @version $Revision: 1.4 $ - * @since PHP 5 - */ -if (!defined('T_ML_COMMENT')) { - define('T_ML_COMMENT', T_COMMENT); -} -if (!defined('T_DOC_COMMENT')) { - define('T_DOC_COMMENT', T_ML_COMMENT); -} - -if (!defined('T_OLD_FUNCTION')) { - define('T_OLD_FUNCTION', -1); -} -if (!defined('T_ABSTRACT')) { - define('T_ABSTRACT', -1); -} -if (!defined('T_CATCH')) { - define('T_CATCH', -1); -} -if (!defined('T_FINAL')) { - define('T_FINAL', -1); -} -if (!defined('T_INSTANCEOF')) { - define('T_INSTANCEOF', -1); -} -if (!defined('T_PRIVATE')) { - define('T_PRIVATE', -1); -} -if (!defined('T_PROTECTED')) { - define('T_PROTECTED', -1); -} -if (!defined('T_PUBLIC')) { - define('T_PUBLIC', -1); -} -if (!defined('T_THROW')) { - define('T_THROW', -1); -} -if (!defined('T_TRY')) { - define('T_TRY', -1); -} -if (!defined('T_CLONE')) { - define('T_CLONE', -1); -} - - -/** - * Improved PHP syntax highlighting. - * - * Generates valid XHTML output with function referencing - * and line numbering. - * - * Three output methods provide maximum flexibility. - * Formatted HTML (toHTML), Ordered Lists (toList), or as an - * associative array (toArray). - * - * Highlighting can be inline (with styles), or the same as - * highlight_file() where colors are taken from php.ini. - * - * @author Aidan Lister - * @author Based on an idea by Matthew Harris - * @version 1.2.1 - */ -class PHP_Highlight -{ - /** - * Hold the source - * - * @var string - * @access private - */ - var $_source = false; - - /** - * Hold highlight colors - * - * Contains an associative array of token types and colours. - * By default, it contains the colours as specified by php.ini - * - * For example, to change the colour of strings, use something - * simular to $h->highlight['string'] = 'blue'; - * - * @var array - * @access public - */ - var $highlight; - - /** - * Things to be replaced for formatting or otherwise reasons - * - * The first element contains the match array, the second the replace - * array. - * - * @var array - * @access public - */ - var $replace = array( - 0 => array("\t", ' '), - 1 => array('    ', ' ')); - - /** - * Format of the link to the PHP manual page - * - * @var string - * @access public - */ - var $manual = '%s'; - - /** - * Format of the span tag to be wrapped around each token - * - * @var string - * @access public - */ - var $span; - - /** - * Constructor - * - * Populates highlight array - * - * @param bool $inline If inline styles rather than colors are to be used - */ - - function __construct($inline = false) - { - if ($inline === false) { - // Default colours from php.ini - $this->highlight = array( - 'string' => ini_get('highlight.string'), - 'comment' => ini_get('highlight.comment'), - 'keyword' => ini_get('highlight.keyword'), - 'bg' => ini_get('highlight.bg'), - 'default' => ini_get('highlight.default'), - 'html' => ini_get('highlight.html') - ); - $this->span = '%s'; - } else { - // Basic styles - $this->highlight = array( - 'string' => 'string', - 'comment' => 'comment', - 'keyword' => 'keyword', - 'bg' => 'bg', - 'default' => 'default', - 'html' => 'html' - ); - $this->span = '%s'; - } - } - - - /** - * Load a file - * - * @access public - * @param string $file The file to load - * @return bool Returns TRUE - */ - function loadFile($file) - { - $this->_source = file_get_contents($file); - return true; - } - - - /** - * Load a string - * - * @access public - * @param string $string The string to load - * @return bool Returns TRUE - */ - function loadString($string) - { - $this->_source = $string; - return true; - } - - - /** - * Parse the loaded string into an array - * Source is returned with the element key corresponding to the line number - * - * @access public - * @param bool $funcref Reference functions to the PHP manual - * @return array An array of highlighted source code - */ - function toArray($funcref = true) - { - // Ensure source has been loaded - if ($this->_source == false) { - return false; - } - - // Init - $tokens = token_get_all($this->_source); - $manual = $this->manual; - $span = $this->span; - $i = 0; - $out = array(); - $out[$i] = ''; - - // Loop through each token - foreach ($tokens as $j => $token) { - // Single char - if (is_string($token)) { - // Skip token2color check for speed - $out[$i] .= sprintf($span, $this->highlight['keyword'], htmlspecialchars($token)); - - // Heredocs behave strangely - list($tb) = isset($tokens[$j - 1]) ? $tokens[$j - 1] : false; - if ($tb == T_END_HEREDOC) { - $out[++$i] = ''; - } - - continue; - } - - // Proper token - list ($token, $value) = $token; - - // Make the value safe - $value = htmlspecialchars($value); - $value = str_replace($this->replace[0], $this->replace[1], $value); - - // Process - if ($value === "\n") { - // End this line and start the next - $out[++$i] = ''; - } else { - // Function linking - if ($funcref === true && $token === T_STRING) { - // Look ahead 1, look ahead 2, and look behind 3 - if ((isset($tokens[$j + 1]) && $tokens[$j + 1] === '(' || - isset($tokens[$j + 2]) && $tokens[$j + 2] === '(') && - isset($tokens[$j - 3][0]) && $tokens[$j - 3][0] !== T_FUNCTION - && function_exists($value)) { - - $funcion = new ReflectionFunction($value); - // Insert the manual link - if ($funcion->isInternal()) - $value = sprintf($manual, $value, $value); - } - } - - // Explode token block - $lines = explode("\n", $value); - foreach ($lines as $jj => $line) { - $line = trim($line); - if ($line !== '') { - $out[$i] .= sprintf($span, $this->_token2color($token), $line); - } - - // Start a new line - if (isset($lines[$jj + 1])) { - $out[++$i] = ''; - } - } - } - } - - return $out; - } - - - /** - * Convert the source to an ordered list. - * Each line is wrapped in
  • tags. - * - * @access public - * @param bool $return Return rather than print the results - * @param bool $funcref Reference functions to the PHP manual - * @return string A HTML ordered list - */ - function toList($return = true, $funcref = true) - { - // Ensure source has been loaded - if ($this->_source == false) { - return false; - } - - // Format list - $source = $this->toArray($funcref); - $out = "
      \n"; - foreach ($source as $line) { - $out .= "
    1. "; - $out .= empty($line) ? ' ' : "$line"; - $out .= "
    2. \n"; - } - $out .= "
    \n"; - - if ($return === true) { - return $out; - } else { - echo $out; - } - } - - - /** - * Convert the source to formatted HTML. - * Each line ends with
    . - * - * @access public - * @param bool $return Return rather than print the results - * @param bool $linenum Display line numbers - * @param string $linenummod Specify format of line numbers displayed - * @param bool $funcref Reference functions to the PHP manual - * @return string A HTML block of code - */ - function toHtml($return = true, $linenum = false, $linenummod = null, $funcref = true, $extra_linea = array()) - { - // Ensure source has been loaded - if ($this->_source == false) { - return false; - } - - // Line numbering - if ($linenum === true && $linenummod === null) { - $linenummod = '%02d '; - } - - // Format code - $source = $this->toArray($funcref); - $out = "\n"; - foreach ($source as $i => $line) { - $out .= " "; - if ($linenum === true) { - $out .= sprintf($linenummod, $i+1); - } - if (isset($extra_linea[$i+1])) { - $out .= $extra_linea[$i+1]; - } - $out .= empty($line) ? ' ' : $line; - $out .= "
    \n"; - } - $out .= "
    \n"; - - if ($return === true) { - return $out; - } else { - echo $out; - } - } - - - /** - * Assign a color based on the name of a token - * - * @access private - * @param int $token The token - * @return string The color of the token - */ - function _token2color($token) - { - switch ($token): - case T_CONSTANT_ENCAPSED_STRING: - return $this->highlight['string']; - break; - - case T_INLINE_HTML: - return $this->highlight['html']; - break; - - case T_COMMENT: - case T_DOC_COMMENT: - case T_ML_COMMENT: - return $this->highlight['comment']; - break; - - case T_ABSTRACT: - case T_ARRAY: - case T_ARRAY_CAST: - case T_AS: - case T_BOOLEAN_AND: - case T_BOOLEAN_OR: - case T_BOOL_CAST: - case T_BREAK: - case T_CASE: - case T_CATCH: - case T_CLASS: - case T_CLONE: - case T_CONCAT_EQUAL: - case T_CONTINUE: - case T_DEFAULT: - case T_DOUBLE_ARROW: - case T_DOUBLE_CAST: - case T_ECHO: - case T_ELSE: - case T_ELSEIF: - case T_EMPTY: - case T_ENDDECLARE: - case T_ENDFOR: - case T_ENDFOREACH: - case T_ENDIF: - case T_ENDSWITCH: - case T_ENDWHILE: - case T_END_HEREDOC: - case T_EXIT: - case T_EXTENDS: - case T_FINAL: - case T_FOREACH: - case T_FUNCTION: - case T_GLOBAL: - case T_IF: - case T_INC: - case T_INCLUDE: - case T_INCLUDE_ONCE: - case T_INSTANCEOF: - case T_INT_CAST: - case T_ISSET: - case T_IS_EQUAL: - case T_IS_IDENTICAL: - case T_IS_NOT_IDENTICAL: - case T_IS_SMALLER_OR_EQUAL: - case T_NEW: - case T_OBJECT_CAST: - case T_OBJECT_OPERATOR: - case T_PAAMAYIM_NEKUDOTAYIM: - case T_PRIVATE: - case T_PROTECTED: - case T_PUBLIC: - case T_REQUIRE: - case T_REQUIRE_ONCE: - case T_RETURN: - case T_SL: - case T_SL_EQUAL: - case T_SR: - case T_SR_EQUAL: - case T_START_HEREDOC: - case T_STATIC: - case T_STRING_CAST: - case T_THROW: - case T_TRY: - case T_UNSET_CAST: - case T_VAR: - case T_WHILE: - return $this->highlight['keyword']; - break; - - case T_CLOSE_TAG: - case T_OPEN_TAG: - case T_OPEN_TAG_WITH_ECHO: - default: - return $this->highlight['default']; - - endswitch; - } - -} - -?> - diff --git a/php/3ros/jpgraph/README b/php/3ros/jpgraph/README old mode 100755 new mode 100644 index 921e6a030b..e610c37b5e --- a/php/3ros/jpgraph/README +++ b/php/3ros/jpgraph/README @@ -1,7 +1,7 @@ -README FOR JPGRAPH 4.2.0 +README FOR JPGRAPH 4.4.1 ========================= -This package contains the JpGraph PHP library version 4.2.0 +This package contains the JpGraph PHP library version 4.4.1 The library is Copyright (C) 2000-2010 Asial Corporatoin and released under dual license QPL 1.0 for open source and educational diff --git a/php/3ros/jpgraph/barcode/demoapp/barcode_image.php b/php/3ros/jpgraph/barcode/demoapp/barcode_image.php deleted file mode 100755 index 2ad88fd6a0..0000000000 --- a/php/3ros/jpgraph/barcode/demoapp/barcode_image.php +++ /dev/null @@ -1,75 +0,0 @@ - 5 ) { - echo "

    Module width must be between 1 and 5 pixels

    "; -} -elseif( $data==="" ) { - echo "

    Please enter data to be encoded, select symbology and press 'Ok'.

    "; - echo "Note: Data must be valid for the choosen encoding."; -} -elseif( $code==-1 ) { - echo "

    No code symbology selected.

    "; -} -elseif( $height < 10 || $height > 500 ) { - echo "

    Height must be in range [10, 500]

    "; -} -elseif( $scale < 0.1 || $scale > 15 ) { - echo "

    Scale must be in range [0.1, 15]

    "; -} -else { - if( $code==20 ) { - $encoder = BarcodeFactory::Create(6); - $encoder->UseExtended(); - } - else { - $encoder = BarcodeFactory::Create($code); - } - $b = $backend=='EPS' ? 'PS' : $backend; - $b = substr($backend,0,5) == 'IMAGE' ? 'IMAGE' : $b; - $e = BackendFactory::Create($b,$encoder); - if( substr($backend,0,5) == 'IMAGE' ) { - if( substr($backend,5,1) == 'J' ) - $e->SetImgFormat('JPEG'); - } - if( $e ) { - if( $backend == 'EPS' ) - $e->SetEPS(); - if( $pswidth!='' ) - $modwidth = $pswidth; - $e->SetModuleWidth($modwidth); - $e->AddChecksum($checksum); - $e->NoText($notext); - $e->SetScale($scale); - $e->SetVertical($vertical); - $e->ShowFrame($showframe); - $e->SetHeight($height); - $r = $e->Stroke($data,$file,$info,$info); - if( $r ) - echo nl2br(htmlspecialchars($r)); - if( $file != '' ) - echo "

    Wrote file $file."; - } - else - echo "

    Can't create choosen backend: $backend.

    "; -} - -?> \ No newline at end of file diff --git a/php/3ros/jpgraph/barcode/demoapp/barcode_menu.php b/php/3ros/jpgraph/barcode/demoapp/barcode_menu.php deleted file mode 100755 index ea5030665e..0000000000 --- a/php/3ros/jpgraph/barcode/demoapp/barcode_menu.php +++ /dev/null @@ -1,125 +0,0 @@ -

    JpGraph Barcode 1.0

    -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Data:
    - -
    -Encoding:
    - -
    -Module width:
    - -
    -Add checksum:
    - -
    -Hide text:
    - -
    -Show frame:
    - -
    -Vertical layout:
    - -
    -Height:
    - -
    -Scale:
    - -
    -Write to file:
    - -
    -Format:
    - -
    -PS module width: - -
    -
    -(If specified will override Module width above)
    -
    -Debug info:
    - -
    -
    - -
    -
    - -

    -


    - - - diff --git a/php/3ros/jpgraph/barcode/demoapp/index.html b/php/3ros/jpgraph/barcode/demoapp/index.html deleted file mode 100755 index e65107cba7..0000000000 --- a/php/3ros/jpgraph/barcode/demoapp/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - -Barcode SYSTEMTEST - - -; - - - diff --git a/php/3ros/jpgraph/barcode/examples/barcode_errhandling_ex0.php b/php/3ros/jpgraph/barcode/examples/barcode_errhandling_ex0.php deleted file mode 100755 index 4f5b5393bf..0000000000 --- a/php/3ros/jpgraph/barcode/examples/barcode_errhandling_ex0.php +++ /dev/null @@ -1,16 +0,0 @@ -Stroke('abc123'); -} catch( JpGraphException $e ) { - //echo 'Error: ' . $e->getMessage()."\n"; - JpGraphError::Raise($e->getMessage()); -} - -?> diff --git a/php/3ros/jpgraph/barcode/examples/barcode_ex0.php b/php/3ros/jpgraph/barcode/examples/barcode_ex0.php deleted file mode 100755 index 021b5c7cc2..0000000000 --- a/php/3ros/jpgraph/barcode/examples/barcode_ex0.php +++ /dev/null @@ -1,11 +0,0 @@ -Stroke('ABC123'); - -?> diff --git a/php/3ros/jpgraph/barcode/examples/barcode_ex1.php b/php/3ros/jpgraph/barcode/examples/barcode_ex1.php deleted file mode 100755 index df7653b5cb..0000000000 --- a/php/3ros/jpgraph/barcode/examples/barcode_ex1.php +++ /dev/null @@ -1,14 +0,0 @@ -SetModuleWidth(2); -$e->SetHeight(20); -echo nl2br($e->Stroke('3125134772')); - - -?> diff --git a/php/3ros/jpgraph/barcode/examples/barcode_ex2.php b/php/3ros/jpgraph/barcode/examples/barcode_ex2.php deleted file mode 100755 index 8fce58e62f..0000000000 --- a/php/3ros/jpgraph/barcode/examples/barcode_ex2.php +++ /dev/null @@ -1,14 +0,0 @@ -SetModuleWidth(2); -$e->SetHeight(70); -$ps = $e->Stroke('3125134772'); -echo nl2br(htmlspecialchars($ps)); - -?> diff --git a/php/3ros/jpgraph/barcode/examples/barcode_ex3.php b/php/3ros/jpgraph/barcode/examples/barcode_ex3.php deleted file mode 100755 index a63f4ad43b..0000000000 --- a/php/3ros/jpgraph/barcode/examples/barcode_ex3.php +++ /dev/null @@ -1,17 +0,0 @@ -"; -$encoder = BarcodeFactory::Create(ENCODING_CODEI25); -$e = BackendFactory::Create(BACKEND_PS,$encoder); -$e->SetModuleWidth(2); -$e->SetHeight(70); -$e->SetEPS(); -$ps = $e->Stroke('3125134772'); -echo nl2br(htmlspecialchars($ps)); - - -?> diff --git a/php/3ros/jpgraph/barcode/examples/barcode_ex4.php b/php/3ros/jpgraph/barcode/examples/barcode_ex4.php deleted file mode 100755 index 721b56baff..0000000000 --- a/php/3ros/jpgraph/barcode/examples/barcode_ex4.php +++ /dev/null @@ -1,12 +0,0 @@ -SetModuleWidth(2); -$e->Stroke('1234'); - -?> diff --git a/php/3ros/jpgraph/barcode/examples/barcode_usps_example.php b/php/3ros/jpgraph/barcode/examples/barcode_usps_example.php deleted file mode 100755 index 80469beafa..0000000000 --- a/php/3ros/jpgraph/barcode/examples/barcode_usps_example.php +++ /dev/null @@ -1,74 +0,0 @@ -_USPS_chkd(substr($data,8)); - $data = '420'. $aZIP . '~191' . $aServiceType . $aDUNS . $aSeqNbr; - return $data . $cd; - } - - // Get type 2 of confirmation code (without ZIP) - function GetPIC($aServiceType,$aDUNS,$aSeqNbr) { - // Convert to USPS format with AI=91 - $data = '91' . $aServiceType . $aDUNS . $aSeqNbr; - $cd = $this->_USPS_chkd($data); - return $data . $cd; - } - -} - -$usps = new USPS_Confirmation(); -$zip = '92663'; -$service = '21'; -$DUNS = '805213907'; -$seqnr = '04508735'; -$data = $usps->GetPICwithZIP($zip,$service,$DUNS,$seqnr); -//$data = $usps->GetPIC('01','123456789','00000001'); - -$encoder = BarcodeFactory::Create(ENCODING_EAN128); -$e = BackendFactory::Create(BACKEND_IMAGE,$encoder); -$e->SetModuleWidth(2); -$e->SetFont(FF_ARIAL,FS_NORMAL,14); -$e->Stroke($data); - -?> \ No newline at end of file diff --git a/php/3ros/jpgraph/barcode/mkbarcode.php b/php/3ros/jpgraph/barcode/mkbarcode.php deleted file mode 100755 index 1b9e478bd6..0000000000 --- a/php/3ros/jpgraph/barcode/mkbarcode.php +++ /dev/null @@ -1,283 +0,0 @@ -argv = ($_SERVER['argv']); - $this->argc = ($_SERVER['argc']); - } - - function PrintUsage() { - $n = $this->argv[0]; - echo "$n -b [-r -h -c -o -m -s -y -f ] datastring \n". - "Create the specified barcode\n". - "-b What symbology to use, one of the following strings (case insensitive)\n". - " UPCA \n". - " UPCE \n". - " EAN128 \n". - " EAN13 \n". - " EAN8 \n". - " CODE11 \n". - " CODE39 \n". - " CODE128 \n". - " CODE25 \n". - " CODEI25 \n". - " CODABAR \n". - " BOOKLAND \n". - "-c Add checkdigit for symbologies where this is optional\n". - "-o Output format. 0=Image, 1=PS, 2=EPS\n". - "-m Module width\n". - "-s Scale factor\n". - "-h Show this help\n". - "-f Filename to write to\n". - "-r Rotate barcode 90 degrees\n". - "-y height Set height in pixels\n". - "-x Hide the human readable text\n". - "--silent Silent. Don't give any error mesages\n"; - exit(1); - } - - function Get() { - $barcode='code39'; - $hide=false; - $checkdigit=false; - $modulewidth=2; - $scale=1; - $output=0; - $filename=''; - $data = ''; - $rotate = false; - $silent=false; - $height = 70; - if( ($n=$this->GetNum()) > 0 ) { - $i=1; - while( $i <= $n ) { - switch( $this->argv[$i] ) { - case '-h': - $this->PrintUsage(); - exit(0); - break; - case '-b': - $barcode = $this->argv[++$i]; - break; - case '-o': - $output = (int)$this->argv[++$i]; - break; - case '-y': - $height = (int)$this->argv[++$i]; - break; - case '-x': - $hide=true; - break; - case '-r': - $rotate=true; - break; - case '-c': - $checkdigit=true; - break; - case '--silent': - $silent=true; - break; - case '-s': - $scale = (float)$this->argv[++$i]; - break; - case '-m': - $modulewidth = (float)$this->argv[++$i]; - break; - case '-f': - $filename = $this->argv[++$i]; - break; - default: - if( $data == '' ) { - $data = $this->argv[$i]; - } - else { - $this->PrintUsage(); - die("Illegal specified parameters"); - } - break; - } - ++$i; - } - - } - - if( $output < 0 || $output > 2 ) { - fwrite(STDERR,"Unkown output format ($output)\n"); - exit(1); - } - - if( $output === 0 ) { - $modulewidth = floor($modulewidth); - } - - // Sanity check - if( $modulewidth > 15 ) { - fwrite(STDERR,"Too large modulewidth\n"); - exit(1); - } - - // Sanity check - if( $height > 1000 ) { - fwrite(STDERR,"Too large height\n"); - exit(1); - } - - // Sanity check - if( $scale > 15 ) { - fwrite(STDERR,"Too large scale factor\n"); - exit(1); - } - - if( strlen($filename) > 256 ) { - fwrite(STDERR,"Too long filename\n"); - exit(1); - } - - if( trim($data) == '' ) { - fwrite(STDERR,"No input data specified\n"); - exit(1); - } - - $barcodes = array( - 'UPCA' => ENCODING_UPCA, - 'UPCE' => ENCODING_UPCE, - 'EAN128' => ENCODING_EAN128, - 'EAN13' => ENCODING_EAN13, - 'EAN8' => ENCODING_EAN8, - 'CODE11' => ENCODING_CODE11, - 'CODE39' => ENCODING_CODE39, - 'CODE128' => ENCODING_CODE128, - 'CODE25' => ENCODING_CODE25, - 'CODEI25' => ENCODING_CODEI25, - 'CODABAR' => ENCODING_CODABAR, - 'BOOKLAND' => ENCODING_BOOKLAND, - ); - $barcode = strtoupper($barcode); - if( key_exists($barcode,$barcodes) ) { - $barcode = $barcodes[$barcode]; - } - else { - fwrite(STDERR,'Specified barcode symbology ('.$barcode.") is not supported\n"); - exit(1); - } - - $ret = array( - 'barcode' => $barcode, - 'hide' => $hide, - 'modulewidth' => $modulewidth, - 'scale' => $scale, - 'output' => $output, - 'data' => $data, - 'silent' => $silent, - 'rotate' => $rotate, - 'height' => $height, - 'checkdigit' => $checkdigit, - 'filename' => $filename - ); - - return $ret; - } - - function _Dump() { - var_dump($this->argv); - } - - function GetNum() { - return $this->argc-1; - } -} - -//---------------------------------------------------------------------- -// CLASS Driver -// Main driver class to create barcodes with the parmeters specified on -// the command line. -//---------------------------------------------------------------------- -class Driver { - - private $iParams; - static public $silent=false; - - static public function ErrHandlerPS(Exception $e) { - if( !Driver::$silent ) - fwrite(STDERR,$e->getMessage()."\n"); - exit(1); - } - - static public function ErrHandlerImg(Exception $e) { - if( !Driver::$silent ) - fwrite(STDERR,$e->getMessage()."\n"); - $errobj = new JpGraphErrObjectImg(); - $errobj->Raise($e->getMessage()); - exit(1); - } - - function Run($aParams) { - - $this->iParams = $aParams; - - Driver::$silent = $aParams['silent']; - - $encoder = BarcodeFactory::Create($aParams['barcode']); - $encoder->AddChecksum($aParams['checkdigit']); - switch( $aParams['output'] ) { - case 0: - $e = BackendFactory::Create(BACKEND_IMAGE,$encoder); - set_exception_handler(array('Driver','ErrHandlerImg')); - break; - case 1: - $e = BackendFactory::Create(BACKEND_PS,$encoder); - set_exception_handler(array('Driver','ErrHandlerPS')); - break; - case 2: - $e = BackendFactory::Create(BACKEND_PS,$encoder); - $e->SetEPS(); - set_exception_handler(array('Driver','ErrHandlerPS')); - break; - } - $e->SetHeight($aParams['height']); - $e->SetVertical($aParams['rotate']); - $e->SetModuleWidth($aParams['modulewidth']); - $e->SetScale($aParams['scale']); - $e->HideText($aParams['hide']); - if( $aParams['output'] === 0 ) { - $err = $e->Stroke($aParams['data'], $aParams['filename']); - } - else { - $s = $e->Stroke($aParams['data'], $aParams['filename']); - if( $aParams['filename'] == '' ) { - // If no filename specified then return the generated postscript - echo $s; - } - } - } -} - -$pa = new ParseArgs(); -$params = $pa->Get(); -$driver = new Driver(); -$driver->Run($params); - -// Successfull termination -exit(0); - -?> diff --git a/php/3ros/jpgraph/contour_dev/findpolygon.php b/php/3ros/jpgraph/contour_dev/findpolygon.php deleted file mode 100644 index 4d105280ff..0000000000 --- a/php/3ros/jpgraph/contour_dev/findpolygon.php +++ /dev/null @@ -1,798 +0,0 @@ -contourCoord[0]); ++$i) { - // echo '('.$this->contourCoord[0][$i][0][0].','.$this->contourCoord[0][$i][0][1].') -> '. - // '('.$this->contourCoord[0][$i][1][0].','.$this->contourCoord[0][$i][1][1].")\n"; - // } - // - - $c=0; - $p[$c] = array(0.6,1, 1,0.5, 2,0.5, 3,0.5, 3.5,1, 3.5,2, 3,2.5, 2,2.5, 1,2.5, 0.5,2, 0.6,1); - $c++; - $p[$c] = array(6,0.5, 5.5,1, 5.5,2, 6,2.5); - - $this->nbrContours = $c+1; - - for ($c = 0 ; $c < count($p) ; $c++) { - $n=count($p[$c]); - - $this->contourCoord[$c][0] = array(array($p[$c][0],$p[$c][1]),array($p[$c][2],$p[$c][3])); - $k=1; - for ($i = 0; $i < ($n-4)/2; $i++, $k++) { - $this->contourCoord[$c][$k] = array($this->contourCoord[$c][$k-1][1], array($p[$c][2*$k+2],$p[$c][2*$k+1+2])); - } - - // Swap edges order at random - $n = count($this->contourCoord[$c]); - for($i=0; $i < floor($n/2); ++$i) { - $swap1 = rand(0,$n-1); - $t = $this->contourCoord[$c][$swap1]; - while( $swap1 == ($swap2 = rand(0,$n-1)) ) - ; - $this->contourCoord[$c][$swap1] = $this->contourCoord[$c][$swap2]; - $this->contourCoord[$c][$swap2] = $t; - } - - // Swap vector direction on 1/3 of the edges - for ($i = 0 ; $i < floor(count($this->contourCoord[$c])/3) ; $i++) { - $e = rand(0, count($this->contourCoord[$c])-1); - $edge = $this->contourCoord[$c][$e]; - $v1 = $edge[0]; $v2 = $edge[1]; - $this->contourCoord[$c][$e][0] = $v2; - $this->contourCoord[$c][$e][1] = $v1; - } - } - - $pp = array(); - for($j=0; $j < count($p); ++$j ) { - for( $i=0; $i < count($p[$j])/2; ++$i ) { - $pp[$j][$i] = array($p[$j][2*$i],$p[$j][2*$i+1]); - } - } - return $pp; - } - - function p_edges($v) { - for ($i = 0 ; $i < count($v) ; $i++) { - echo "(".$v[$i][0][0].",".$v[$i][0][1].") -> (".$v[$i][1][0].",".$v[$i][1][1].")\n"; - } - echo "\n"; - } - - function CompareCyclic($a,$b,$forward=true) { - - // We assume disjoint vertices and if last==first this just means - // that the polygon is closed. For this comparison it must be unique - // elements - if( $a[count($a)-1] == $a[0] ) { - array_pop($a); - } - if( $b[count($b)-1] == $b[0] ) { - array_pop($b); - } - - $n1 = count($a); $n2 = count($b); - if( $n1 != $n2 ) - return false; - - $i=0; - while( ($i < $n2) && ($a[0] != $b[$i]) ) - ++$i; - - if( $i >= $n2 ) - return false; - - $j=0; - if( $forward ) { - while( ($j < $n1) && ($a[$j] == $b[$i]) ) { - $i = ($i + 1) % $n2; - ++$j; - } - } - else { - while( ($j < $n1) && ($a[$j] == $b[$i]) ) { - --$i; - if( $i < 0 ) { - $i = $n2-1; - } - ++$j; - } - } - return $j >= $n1; - } - - function dbg($s) { - // echo $s."\n"; - } - - function IsVerticeOnBorder($x1,$y1) { - // Check if the vertice lies on any of the four border - if( $x1==$this->scale[0] || $x1==$this->scale[1] ) { - return true; - } - if( $y1==$this->scale[2] || $y1==$this->scale[3] ) { - return true; - } - return false; - } - - function FindPolygons($debug=false) { - - $pol = 0; - for ($c = 0; $c < $this->nbrContours; $c++) { - - $this->dbg("\n** Searching polygon chain $c ... "); - $this->dbg("------------------------------------------\n"); - - $edges = $this->contourCoord[$c]; - while( count($edges) > 0 ) { - - $edge = array_shift($edges); - list($x1,$y1) = $edge[0]; - list($x2,$y2) = $edge[1]; - $polygons[$pol]=array( - array($x1,$y1),array($x2,$y2) - ); - - $this->dbg("Searching on second vertice."); - - $found=false; - if( ! $this->IsVerticeOnBorder($x2,$y2) ) { - do { - - $this->dbg(" --Searching on edge: ($x1,$y1)->($x2,$y2)"); - - $found=false; - $nn = count($edges); - for( $i=0; $i < $nn && !$found; ++$i ) { - $edge = $edges[$i]; - if( $found = ($x2==$edge[0][0] && $y2==$edge[0][1]) ) { - $polygons[$pol][] = array($edge[1][0],$edge[1][1]); - $x1 = $x2; $y1 = $y2; - $x2 = $edge[1][0]; $y2 = $edge[1][1]; - } - elseif( $found = ($x2==$edge[1][0] && $y2==$edge[1][1]) ) { - $polygons[$pol][] = array($edge[0][0],$edge[0][1]); - $x1 = $x2; $y1 = $y2; - $x2 = $edge[0][0]; $y2 = $edge[0][1]; - } - if( $found ) { - $this->dbg(" --Found next edge: [i=$i], (%,%) -> ($x2,$y2)"); - unset($edges[$i]); - $edges = array_values($edges); - } - } - - } while( $found ); - } - - if( !$found && count($edges)>0 ) { - $this->dbg("Searching on first vertice."); - list($x1,$y1) = $polygons[$pol][0]; - list($x2,$y2) = $polygons[$pol][1]; - - if( ! $this->IsVerticeOnBorder($x1,$y1) ) { - do { - - $this->dbg(" --Searching on edge: ($x1,$y1)->($x2,$y2)"); - - $found=false; - $nn = count($edges); - for( $i=0; $i < $nn && !$found; ++$i ) { - $edge = $edges[$i]; - if( $found = ($x1==$edge[0][0] && $y1==$edge[0][1]) ) { - array_unshift($polygons[$pol],array($edge[1][0],$edge[1][1])); - $x2 = $x1; $y2 = $y1; - $x1 = $edge[1][0]; $y1 = $edge[1][1]; - } - elseif( $found = ($x1==$edge[1][0] && $y1==$edge[1][1]) ) { - array_unshift($polygons[$pol],array($edge[0][0],$edge[0][1])); - $x2 = $x1; $y2 = $y1; - $x1 = $edge[0][0]; $y1 = $edge[0][1]; - } - if( $found ) { - $this->dbg(" --Found next edge: [i=$i], ($x1,$y1) -> (%,%)"); - unset($edges[$i]); - $edges = array_values($edges); - } - } - - } while( $found ); - } - - } - - $pol++; - } - } - - return $polygons; - } - -} -define('HORIZ_EDGE',0); -define('VERT_EDGE',1); - -class FillGridRect { - private $edges,$dataPoints,$colors,$isoBars; - private $invert=false; - - function __construct(&$edges,&$dataPoints,$isoBars,$colors) { - $this->edges = $edges; - $this->dataPoints = $dataPoints; - $this->colors = $colors; - $this->isoBars = $isoBars; - } - - function GetIsobarColor($val) { - for ($i = 0 ; $i < count($this->isoBars) ; $i++) { - if( $val <= $this->isoBars[$i] ) { - return $this->colors[$i]; - } - } - return $this->colors[$i]; // The color for all values above the highest isobar - } - - function GetIsobarVal($a,$b) { - // Get the isobar that is between the values a and b - // If there are more isobars then return the one with lowest index - if( $b < $a ) { - $t=$a; $a=$b; $b=$t; - } - $i = 0 ; - $n = count($this->isoBars); - while( $i < $n && $this->isoBars[$i] < $a ) { - ++$i; - } - if( $i >= $n ) - die("Internal error. Cannot find isobar values for ($a,$b)"); - return $this->isoBars[$i]; - } - - function getCrossingCoord($aRow,$aCol,$aEdgeDir,$aIsobarVal) { - // In order to avoid numerical problem when two vertices are very close - // we have to check and avoid dividing by close to zero denumerator. - if( $aEdgeDir == HORIZ_EDGE ) { - $d = abs($this->dataPoints[$aRow][$aCol] - $this->dataPoints[$aRow][$aCol+1]); - if( $d > 0.001 ) { - $xcoord = $aCol + abs($aIsobarVal - $this->dataPoints[$aRow][$aCol]) / $d; - } - else { - $xcoord = $aCol; - } - $ycoord = $aRow; - } - else { - $d = abs($this->dataPoints[$aRow][$aCol] - $this->dataPoints[$aRow+1][$aCol]); - if( $d > 0.001 ) { - $ycoord = $aRow + abs($aIsobarVal - $this->dataPoints[$aRow][$aCol]) / $d; - } - else { - $ycoord = $aRow; - } - $xcoord = $aCol; - } - if( $this->invert ) { - $ycoord = $this->nbrRows-1 - $ycoord; - } - return array($xcoord,$ycoord); - } - - function Fill(ContCanvas $canvas) { - - $nx_vertices = count($this->dataPoints[0]); - $ny_vertices = count($this->dataPoints); - - // Loop through all squares in the grid - for($col=0; $col < $nx_vertices-1; ++$col) { - for($row=0; $row < $ny_vertices-1; ++$row) { - - $n = 0;$quad_edges=array(); - if ( $this->edges[VERT_EDGE][$row][$col] ) $quad_edges[$n++] = array($row, $col, VERT_EDGE); - if ( $this->edges[VERT_EDGE][$row][$col+1] ) $quad_edges[$n++] = array($row, $col+1,VERT_EDGE); - if ( $this->edges[HORIZ_EDGE][$row][$col] ) $quad_edges[$n++] = array($row, $col, HORIZ_EDGE); - if ( $this->edges[HORIZ_EDGE][$row+1][$col] ) $quad_edges[$n++] = array($row+1,$col, HORIZ_EDGE); - - if( $n == 0 ) { - // Easy, fill the entire quadrant with one color since we have no crossings - // Select the top left datapoint as representing this quadrant - // color for this quadrant - $color = $this->GetIsobarColor($this->dataPoints[$row][$col]); - $polygon = array($col,$row,$col,$row+1,$col+1,$row+1,$col+1,$row,$col,$row); - $canvas->FilledPolygon($polygon,$color); - - } elseif( $n==2 ) { - - // There is one isobar edge crossing this quadrant. In order to fill we need to - // find out the orientation of the two areas this edge is separating in order to - // construct the two polygons that define the two areas to be filled - // There are six possible variants - // 0) North-South - // 1) West-East - // 2) West-North - // 3) East-North - // 4) West-South - // 5) East-South - $type=-1; - if( $this->edges[HORIZ_EDGE][$row][$col] ) { - if( $this->edges[HORIZ_EDGE][$row+1][$col] ) $type=0; // North-South - elseif( $this->edges[VERT_EDGE][$row][$col] ) $type=2; - elseif( $this->edges[VERT_EDGE][$row][$col+1] ) $type=3; - } - elseif( $this->edges[HORIZ_EDGE][$row+1][$col] ) { - if( $this->edges[VERT_EDGE][$row][$col] ) $type=4; - elseif( $this->edges[VERT_EDGE][$row][$col+1] ) $type=5; - } - else { - $type=1; - } - if( $type==-1 ) { - die('Internal error: n=2 but no edges in the quadrant was find to determine type.'); - } - - switch( $type ) { - case 0: //North-South - - // North vertice - $v1 = $this->dataPoints[$row][$col]; - $v2 = $this->dataPoints[$row][$col+1]; - $isobarValue = $this->GetIsobarVal($v1, $v2); - list($x1,$y1) = $this->getCrossingCoord($row, $col,HORIZ_EDGE, $isobarValue); - - // South vertice - $v1 = $this->dataPoints[$row+1][$col]; - $v2 = $this->dataPoints[$row+1][$col+1]; - $isobarValue = $this->GetIsobarVal($v1, $v2); - list($x2,$y2) = $this->getCrossingCoord($row+1, $col,HORIZ_EDGE, $isobarValue); - - $polygon = array($col,$row,$x1,$y1,$x2,$y2,$col,$row+1,$col,$row); - $canvas->FilledPolygon($polygon,$this->GetIsobarColor($v1)); - - $polygon = array($col+1,$row,$x1,$y1,$x2,$y2,$col+1,$row+1,$col+1,$row); - $canvas->FilledPolygon($polygon,$this->GetIsobarColor($v2)); - - break; - - case 1: // West-East - - // West vertice - $v1 = $this->dataPoints[$row][$col]; - $v2 = $this->dataPoints[$row+1][$col]; - $isobarValue = $this->GetIsobarVal($v1, $v2); - list($x1,$y1) = $this->getCrossingCoord($row, $col,VERT_EDGE, $isobarValue); - - // East vertice - $v1 = $this->dataPoints[$row][$col+1]; - $v2 = $this->dataPoints[$row+1][$col+1]; - $isobarValue = $this->GetIsobarVal($v1, $v2); - list($x2,$y2) = $this->getCrossingCoord($row, $col+1,VERT_EDGE, $isobarValue); - - $polygon = array($col,$row,$x1,$y1,$x2,$y2,$col+1,$row,$col,$row); - $canvas->FilledPolygon($polygon,$this->GetIsobarColor($v1)); - - $polygon = array($col,$row+1,$x1,$y1,$x2,$y2,$col+1,$row+1,$col,$row+1); - $canvas->FilledPolygon($polygon,$this->GetIsobarColor($v2)); - break; - - case 2: // West-North - - // West vertice - $v1 = $this->dataPoints[$row][$col]; - $v2 = $this->dataPoints[$row+1][$col]; - $isobarValue = $this->GetIsobarVal($v1, $v2); - list($x1,$y1) = $this->getCrossingCoord($row, $col,VERT_EDGE, $isobarValue); - - // North vertice - $v1 = $this->dataPoints[$row][$col]; - $v2 = $this->dataPoints[$row][$col+1]; - $isobarValue = $this->GetIsobarVal($v1, $v2); - list($x2,$y2) = $this->getCrossingCoord($row, $col,HORIZ_EDGE, $isobarValue); - - $polygon = array($col,$row,$x1,$y1,$x2,$y2,$col,$row); - $canvas->FilledPolygon($polygon,$this->GetIsobarColor($v1)); - - $polygon = array($x1,$y1,$x2,$y2,$col+1,$row,$col+1,$row+1,$col,$row+1,$x1,$y1); - $canvas->FilledPolygon($polygon,$this->GetIsobarColor($v2)); - - break; - - case 3: // East-North - - // if( $row==3 && $col==1 && $n==2 ) { - // echo " ** East-North
    "; - // } - - - // East vertice - $v1 = $this->dataPoints[$row][$col+1]; - $v2 = $this->dataPoints[$row+1][$col+1]; - $isobarValue = $this->GetIsobarVal($v1, $v2); - list($x1,$y1) = $this->getCrossingCoord($row, $col+1,VERT_EDGE, $isobarValue); - // - // if( $row==3 && $col==1 && $n==2 ) { - // echo " ** E_val($v1,$v2), isobar=$isobarValue
    "; - // echo " ** E($x1,$y1)
    "; - // } - - - // North vertice - $v1 = $this->dataPoints[$row][$col]; - $v2 = $this->dataPoints[$row][$col+1]; - $isobarValue = $this->GetIsobarVal($v1, $v2); - list($x2,$y2) = $this->getCrossingCoord($row, $col,HORIZ_EDGE, $isobarValue); - - // if( $row==3 && $col==1 && $n==2 ) { - // echo " ** N_val($v1,$v2), isobar=$isobarValue
    "; - // echo " ** N($x2,$y2)
    "; - // } - // if( $row==3 && $col==1 && $n==2 ) - // $canvas->Line($x1,$y1,$x2,$y2,'blue'); - - $polygon = array($x1,$y1,$x2,$y2,$col+1,$row,$x1,$y1); - $canvas->FilledPolygon($polygon,$this->GetIsobarColor($v2)); - - $polygon = array($col,$row,$x2,$y2,$x1,$y1,$col+1,$row+1,$col,$row+1,$col,$row); - $canvas->FilledPolygon($polygon,$this->GetIsobarColor($v1)); - - break; - - case 4: // West-South - - // West vertice - $v1 = $this->dataPoints[$row][$col]; - $v2 = $this->dataPoints[$row+1][$col]; - $isobarValue = $this->GetIsobarVal($v1, $v2); - list($x1,$y1) = $this->getCrossingCoord($row, $col,VERT_EDGE, $isobarValue); - - // South vertice - $v1 = $this->dataPoints[$row+1][$col]; - $v2 = $this->dataPoints[$row+1][$col+1]; - $isobarValue = $this->GetIsobarVal($v1, $v2); - list($x2,$y2) = $this->getCrossingCoord($row+1, $col,HORIZ_EDGE, $isobarValue); - - $polygon = array($col,$row+1,$x1,$y1,$x2,$y2,$col,$row+1); - $canvas->FilledPolygon($polygon,$this->GetIsobarColor($v1)); - - $polygon = array($x1,$y1,$x2,$y2,$col+1,$row+1,$col+1,$row,$col,$row,$x1,$y1); - $canvas->FilledPolygon($polygon,$this->GetIsobarColor($v2)); - - break; - - case 5: // East-South - - // - // if( $row==1 && $col==1 && $n==2 ) { - // echo " ** Sout-East
    "; - // } - - // East vertice - $v1 = $this->dataPoints[$row][$col+1]; - $v2 = $this->dataPoints[$row+1][$col+1]; - $isobarValue = $this->GetIsobarVal($v1, $v2); - list($x1,$y1) = $this->getCrossingCoord($row, $col+1,VERT_EDGE, $isobarValue); - - // if( $row==1 && $col==1 && $n==2 ) { - // echo " ** E_val($v1,$v2), isobar=$isobarValue
    "; - // echo " ** E($x1,$y1)
    "; - // } - - // South vertice - $v1 = $this->dataPoints[$row+1][$col]; - $v2 = $this->dataPoints[$row+1][$col+1]; - $isobarValue = $this->GetIsobarVal($v1, $v2); - list($x2,$y2) = $this->getCrossingCoord($row+1, $col,HORIZ_EDGE, $isobarValue); - - // if( $row==1 && $col==1 && $n==2 ) { - // echo " ** S_val($v1,$v2), isobar=$isobarValue
    "; - // echo " ** S($x2,$y2)
    "; - // } - - $polygon = array($col+1,$row+1,$x1,$y1,$x2,$y2,$col+1,$row+1); - $canvas->FilledPolygon($polygon,$this->GetIsobarColor($v2)); - - $polygon = array($x1,$y1,$x2,$y2,$col,$row+1,$col,$row,$col+1,$row,$x1,$y1); - $canvas->FilledPolygon($polygon,$this->GetIsobarColor($v1)); - - break; - - } - - } - - } - } - - } -} - - -class ContCanvas { - public $g; - public $shape,$scale; - function __construct($xmax=6,$ymax=6,$width=400,$height=400) { - - $this->g = new CanvasGraph($width,$height); - $this->scale = new CanvasScale($this->g, 0, $xmax, 0, $ymax); - $this->shape = new Shape($this->g, $this->scale); - - //$this->g->SetFrame(true); - $this->g->SetMargin(5,5,5,5); - $this->g->SetMarginColor('white@1'); - $this->g->InitFrame(); - - - $this->shape->SetColor('gray'); - for( $col=1; $col<$xmax; ++$col ) { - $this->shape->Line($col, 0, $col, $ymax); - } - for( $row=1; $row<$ymax; ++$row ) { - $this->shape->Line(0, $row, $xmax, $row); - } - } - - function SetDatapoints($datapoints) { - $ny=count($datapoints); - $nx=count($datapoints[0]); - $t = new Text(); - $t->SetFont(FF_ARIAL,FS_NORMAL,8); - for( $x=0; $x < $nx; ++$x ) { - for( $y=0; $y < $ny; ++$y ) { - list($x1,$y1) = $this->scale->Translate($x,$y); - - if( $datapoints[$y][$x] > 0 ) - $t->SetColor('blue'); - else - $t->SetColor('black'); - $t->SetFont(FF_ARIAL,FS_BOLD,8); - $t->Set($datapoints[$y][$x]); - $t->Stroke($this->g->img,$x1,$y1); - - $t->SetColor('gray'); - $t->SetFont(FF_ARIAL,FS_NORMAL,8); - $t->Set("($y,$x)"); - $t->Stroke($this->g->img,$x1+10,$y1); - - } - } - } - - function DrawLinePolygons($p,$color='red') { - $this->shape->SetColor($color); - for ($i = 0 ; $i < count($p) ; $i++) { - $x1 = $p[$i][0][0]; $y1 = $p[$i][0][1]; - for ($j = 1 ; $j < count($p[$i]) ; $j++) { - $x2=$p[$i][$j][0]; $y2 = $p[$i][$j][1]; - $this->shape->Line($x1, $y1, $x2, $y2); - $x1=$x2; $y1=$y2; - } - } - } - - function Line($x1,$y1,$x2,$y2,$color='red') { - $this->shape->SetColor($color); - $this->shape->Line($x1, $y1, $x2, $y2); - } - function Polygon($p,$color='blue') { - $this->shape->SetColor($color); - $this->shape->Polygon($p); - } - - function FilledPolygon($p,$color='lightblue') { - $this->shape->SetColor($color); - $this->shape->FilledPolygon($p); - } - - function Point($x,$y,$color) { - list($x1,$y1) = $this->scale->Translate($x, $y); - $this->shape->SetColor($color); - $this->g->img->Point($x1,$y1); - } - - function Stroke() { - $this->g->Stroke(); - } - -} - - -class PixelFill { - - private $edges,$dataPoints,$colors,$isoBars; - - function __construct(&$edges,&$dataPoints,$isoBars,$colors) { - $this->edges = $edges; - $this->dataPoints = $dataPoints; - $this->colors = $colors; - $this->isoBars = $isoBars; - } - - function GetIsobarColor($val) { - for ($i = 0 ; $i < count($this->isoBars) ; $i++) { - if( $val <= $this->isoBars[$i] ) { - return $this->colors[$i]; - } - } - return $this->colors[$i]; // The color for all values above the highest isobar - } - - function Fill(ContCanvas $canvas) { - - $nx_vertices = count($this->dataPoints[0]); - $ny_vertices = count($this->dataPoints); - - // Loop through all squares in the grid - for($col=0; $col < $nx_vertices-1; ++$col) { - for($row=0; $row < $ny_vertices-1; ++$row) { - - $v=array( - $this->dataPoints[$row][$col], - $this->dataPoints[$row][$col+1], - $this->dataPoints[$row+1][$col+1], - $this->dataPoints[$row+1][$col], - ); - - list($x1,$y1) = $canvas->scale->Translate($col, $row); - list($x2,$y2) = $canvas->scale->Translate($col+1, $row+1); - - for( $x=$x1; $x < $x2; ++$x ) { - for( $y=$y1; $y < $y2; ++$y ) { - - $v1 = $v[0] + ($v[1]-$v[0])*($x-$x1)/($x2-$x1); - $v2 = $v[3] + ($v[2]-$v[3])*($x-$x1)/($x2-$x1); - $val = $v1 + ($v2-$v1)*($y-$y1)/($y2-$y1); - - if( $row==2 && $col==2 ) { - //echo " ($val ($x,$y)) (".$v[0].",".$v[1].",".$v[2].",".$v[3].")
    "; - } - $color = $this->GetIsobarColor($val); - $canvas->g->img->SetColor($color); - $canvas->g->img->Point($x, $y); - } - } - } - } - - } - -} - -$edges=array(array(),array(),array()); -$datapoints=array(); -for($col=0; $col<6; $col++) { - for($row=0; $row<6; $row++) { - $datapoints[$row][$col]=0; - $edges[VERT_EDGE][$row][$col] = false; - $edges[HORIZ_EDGE][$row][$col] = false; - } -} - -$datapoints[1][2] = 2; -$datapoints[2][1] = 1; -$datapoints[2][2] = 7; -$datapoints[2][3] = 2; -$datapoints[3][1] = 2; -$datapoints[3][2] = 17; -$datapoints[3][3] = 4; -$datapoints[4][2] = 3; - -$datapoints[1][4] = 12; - -$edges[VERT_EDGE][1][2] = true; -$edges[VERT_EDGE][3][2] = true; - -$edges[HORIZ_EDGE][2][1] = true; -$edges[HORIZ_EDGE][2][2] = true; -$edges[HORIZ_EDGE][3][1] = true; -$edges[HORIZ_EDGE][3][2] = true; - - - -$isobars = array(5,10,15); -$colors = array('lightgray','lightblue','lightred','red'); - -$engine = new PixelFill($edges, $datapoints, $isobars, $colors); -$canvas = new ContCanvas(); -$engine->Fill($canvas); -$canvas->SetDatapoints($datapoints); -$canvas->Stroke(); -die(); - - -//$tst = new Findpolygon(); -//$p1 = $tst->SetupTestData(); -// -//$canvas = new ContCanvas(); -//for ($i = 0 ; $i < count($tst->contourCoord); $i++) { -// $canvas->DrawLinePolygons($tst->contourCoord[$i]); -//} -// -//$p2 = $tst->FindPolygons(); -//for ($i = 0 ; $i < count($p2) ; $i++) { -// $canvas->FilledPolygon($tst->flattenEdges($p2[$i])); -//} -// -//for ($i = 0 ; $i < count($p2) ; $i++) { -// $canvas->Polygon($tst->flattenEdges($p2[$i])); -//} -// -//$canvas->Stroke(); -//die(); - - -//for( $trial = 0; $trial < 1; ++$trial ) { -// echo "\nTest $trial:\n"; -// echo "========================================\n"; -// $tst = new Findpolygon(); -// $p1 = $tst->SetupTestData(); -// -// // for ($i = 0 ; $i < count($p1) ; $i++) { -// // echo "Test polygon $i:\n"; -// // echo "---------------------\n"; -// // $tst->p_edges($tst->contourCoord[$i]); -// // echo "\n"; -// // } -// // -// $p2 = $tst->FindPolygons(); -// $npol = count($p2); -// //echo "\n** Found $npol separate polygon chains.\n\n"; -// -// for( $i=0; $i<$npol; ++$i ) { -// -// $res_forward = $tst->CompareCyclic($p1[$i], $p2[$i],true); -// $res_backward = $tst->CompareCyclic($p1[$i], $p2[$i],false); -// if( $res_backward || $res_forward ) { -// // if( $res_forward ) -// // echo "Forward matches!\n"; -// // else -// // echo "Backward matches!\n"; -// } -// else { -// echo "********** NO MATCH!!.\n\n"; -// echo "\nBefore find:\n"; -// for ($j = 0 ; $j < count($p1[$i]) ; $j++) { -// echo "(".$p1[$i][$j][0].','.$p1[$i][$j][1]."), "; -// } -// echo "\n"; -// -// echo "\nAfter find:\n"; -// for ($j = 0 ; $j < count($p2[$i]) ; $j++) { -// echo "(".$p2[$i][$j][0].','.$p2[$i][$j][1]."), "; -// } -// echo "\n"; -// } -// -// } -//} -// -//echo "\n\nAll tests ready.\n\n"; -// - - -?> diff --git a/php/3ros/jpgraph/contour_dev/tri-quad.php b/php/3ros/jpgraph/contour_dev/tri-quad.php deleted file mode 100644 index 7281f8e369..0000000000 --- a/php/3ros/jpgraph/contour_dev/tri-quad.php +++ /dev/null @@ -1,790 +0,0 @@ -g = new CanvasGraph($width,$height); - $this->scale = new CanvasScale($this->g, 0, $xmax, 0, $ymax); - $this->shape = new Shape($this->g, $this->scale); - - //$this->g->SetFrame(true); - $this->g->SetMargin(2,2,2,2); - $this->g->SetMarginColor('white@1'); - $this->g->InitFrame(); - } - - function StrokeGrid() { - list($xmin,$xmax,$ymin,$ymax) = $this->scale->Get(); - $this->shape->SetColor('gray'); - for( $col=1; $col<$xmax; ++$col ) { - $this->shape->Line($col, 0, $col, $ymax); - } - for( $row=1; $row<$ymax; ++$row ) { - $this->shape->Line(0, $row, $xmax, $row); - } - } - - function SetDatapoints($datapoints) { - $ny=count($datapoints); - $nx=count($datapoints[0]); - $t = new Text(); - $t->SetFont(FF_ARIAL,FS_NORMAL,8); - for( $x=0; $x < $nx; ++$x ) { - for( $y=0; $y < $ny; ++$y ) { - list($x1,$y1) = $this->scale->Translate($x,$y); - - if( $datapoints[$y][$x] > 0 ) - $t->SetColor('blue'); - else - $t->SetColor('black'); - $t->SetFont(FF_ARIAL,FS_BOLD,8); - $t->Set($datapoints[$y][$x]); - $t->Stroke($this->g->img,$x1,$y1); - - $t->SetColor('gray'); - $t->SetFont(FF_ARIAL,FS_NORMAL,8); - $t->Set("($y,$x)"); - $t->Stroke($this->g->img,$x1+10,$y1); - - } - } - } - - function DrawLinePolygons($p,$color='red') { - $this->shape->SetColor($color); - for ($i = 0 ; $i < count($p) ; $i++) { - $x1 = $p[$i][0][0]; $y1 = $p[$i][0][1]; - for ($j = 1 ; $j < count($p[$i]) ; $j++) { - $x2=$p[$i][$j][0]; $y2 = $p[$i][$j][1]; - $this->shape->Line($x1, $y1, $x2, $y2); - $x1=$x2; $y1=$y2; - } - } - } - - function Line($x1,$y1,$x2,$y2,$color='red') { - $this->shape->SetColor($color); - $this->shape->Line($x1, $y1, $x2, $y2); - } - function Polygon($p,$color='blue') { - $this->shape->SetColor($color); - $this->shape->Polygon($p); - } - - function FilledPolygon($p,$color='lightblue') { - $this->shape->SetColor($color); - $this->shape->FilledPolygon($p); - } - - function Point($x,$y,$color) { - list($x1,$y1) = $this->scale->Translate($x, $y); - $this->shape->SetColor($color); - $this->g->img->Point($x1,$y1); - } - - function Stroke() { - $this->g->Stroke(); - } - -} - -// Calculate the area for a simple polygon. This will not work for -// non-simple polygons, i.e. self crossing. -function polygonArea($aX, $aY) { - $n = count($aX); - $area = 0 ; - $j = 0 ; - for ($i=0; $i < $n; $i++) { - $j++; - if ( $j == $n) { - $j=0; - } - $area += ($aX[i]+$aX[j])*($aY[i]-$aY[j]); - } - return area*.5; -} - -class SingleTestTriangle { - const contval=5; - static $maxdepth=2; - static $cnt=0; - static $t; - public $g; - public $shape,$scale; - public $cont = array(2,4,5); - public $contcolors = array('yellow','purple','seagreen','green','lightblue','blue','teal','orange','red','darkred','brown'); - public $dofill=false; - public $showtriangulation=false,$triangulation_color="lightgray"; - public $showannotation=false; - public $contlinecolor='black',$showcontlines=true; - private $labels = array(), $showlabels=false; - private $labelColor='black',$labelFF=FF_ARIAL,$labelFS=FS_BOLD,$labelFSize=9; - - function __construct($width,$height,$nx,$ny) { - $xmax=$nx+0.1;$ymax=$ny+0.1; - $this->g = new CanvasGraph($width,$height); - $this->scale = new CanvasScale($this->g, -0.1, $xmax, -0.1, $ymax); - $this->shape = new Shape($this->g, $this->scale); - - //$this->g->SetFrame(true); - $this->g->SetMargin(2,2,2,2); - $this->g->SetMarginColor('white@1'); - //$this->g->InitFrame(); - - self::$t = new Text(); - self::$t->SetColor('black'); - self::$t->SetFont(FF_ARIAL,FS_BOLD,9); - self::$t->SetAlign('center','center'); - } - - function getPlotSize() { - return array($this->g->img->width,$this->g->img->height); - } - - function SetContours($c) { - $this->cont = $c; - } - - function ShowLabels($aFlg=true) { - $this->showlabels = $aFlg; - } - - function ShowLines($aFlg=true) { - $this->showcontlines=$aFlg; - } - - function SetFilled($f=true) { - $this->dofill = $f; - } - - function ShowTriangulation($f=true) { - $this->showtriangulation = $f; - } - - function Stroke() { - $this->g->Stroke(); - } - - function FillPolygon($color,&$p) { - self::$cnt++; - if( $this->dofill ) { - $this->shape->SetColor($color); - $this->shape->FilledPolygon($p); - } - if( $this->showtriangulation ) { - $this->shape->SetColor($this->triangulation_color); - $this->shape->Polygon($p); - } - } - - function GetNextHigherContourIdx($val) { - for( $i=0; $i < count($this->cont); ++$i ) { - if( $val < $this->cont[$i] ) return $i; - } - return count($this->cont); - } - - function GetContVal($v1) { - for( $i=0; $i < count($this->cont); ++$i ) { - if( $this->cont[$i] > $v1 ) { - return $this->cont[$i]; - } - } - die('No contour value is larger or equal than : '.$v1); - } - - function GetColor($v) { - return $this->contcolors[$this->GetNextHigherContourIdx($v)]; - } - - function storeAnnotation($x1,$y1,$v1,$angle) { - $this->labels[$this->GetNextHigherContourIdx($v1)][] = array($x1,$y1,$v1,$angle); - } - - function labelProx($x1,$y1,$v1) { - - list($w,$h) = $this->getPlotSize(); - - - if( $x1 < 20 || $x1 > $w-20 ) - return true; - - if( $y1 < 20 || $y1 > $h-20 ) - return true; - - if( !isset ($this->labels[$this->GetNextHigherContourIdx($v1)]) ) { - return false; - } - $p = $this->labels[$this->GetNextHigherContourIdx($v1)]; - $n = count($p); - $d = 999999; - for ($i = 0 ; $i < $n ; $i++) { - $xp = $p[$i][0]; - $yp = $p[$i][1]; - $d = min($d, ($x1-$xp)*($x1-$xp) + ($y1-$yp)*($y1-$yp)); - } - - $limit = $w*$h/9; - $limit = max(min($limit,20000),3500); - if( $d < $limit ) return true; - else return false; - } - - function putLabel($x1,$y1,$x2,$y2,$v1) { - - $angle = 0; - if( $x2 - $x1 != 0 ) { - $grad = ($y2-$y1)/($x2-$x1); - $angle = -(atan($grad) * 180/M_PI); - self::$t->SetAngle($angle); - } - - $x = $this->scale->TranslateX($x1); - $y = $this->scale->TranslateY($y1); - if( !$this->labelProx($x, $y, $v1) ) { - $this->storeAnnotation($x, $y, $v1, $angle); - } - } - - function strokeLabels() { - $t = new Text(); - $t->SetColor($this->labelColor); - $t->SetFont($this->labelFF,$this->labelFS,$this->labelFSize); - $t->SetAlign('center','center'); - - foreach ($this->labels as $cont_idx => $pos) { - if( $cont_idx >= 10 ) return; - foreach ($pos as $idx => $coord) { - $t->Set( sprintf("%.1f",$coord[2]) ); - $t->SetAngle($coord[3]); - $t->Stroke($this->g->img,$coord[0],$coord[1]); - } - } - } - - function annotate($x1,$y1,$x2,$y2,$x1p,$y1p,$v1,$v2,$v1p) { - if( !$this->showannotation ) return; - /* - $this->g->img->SetColor('green'); - $this->g->img->FilledCircle($this->scale->TranslateX($x1),$this->scale->TranslateY($y1), 4); - $this->g->img->FilledCircle($this->scale->TranslateX($x2),$this->scale->TranslateY($y2), 4); - - $this->g->img->SetColor('red'); - $this->g->img->FilledCircle($this->scale->TranslateX($x1p),$this->scale->TranslateY($y1p), 4); -*/ - //self::$t->Set(sprintf("%.1f",$v1,$this->VC($v1))); - //self::$t->Stroke($this->g->img,$this->scale->TranslateX($x1),$this->scale->TranslateY($y1)); - //self::$t->Set(sprintf("%.1f",$v2,$this->VC($v2))); - //self::$t->Stroke($this->g->img,$this->scale->TranslateX($x2),$this->scale->TranslateY($y2)); - - $x = $this->scale->TranslateX($x1p); - $y = $this->scale->TranslateY($y1p); - if( !$this->labelProx($x, $y, $v1p) ) { - $this->storeAnnotation($x, $y, $v1p); - self::$t->Set(sprintf("%.1f",$v1p,$this->VC($v1p))); - self::$t->Stroke($this->g->img,$x,$y); - } - } - - function Pertubate(&$v1,&$v2,&$v3,&$v4) { - $pert = 0.9999; - $n = count($this->cont); - for($i=0; $i < $n; ++$i) { - if( $v1==$this->cont[$i] ) { - $v1 *= $pert; - break; - } - } - for($i=0; $i < $n; ++$i) { - if( $v2==$this->cont[$i] ) { - $v2 *= $pert; - break; - } - } - for($i=0; $i < $n; ++$i) { - if( $v3==$this->cont[$i] ) { - $v3 *= $pert; - break; - } - } - for($i=0; $i < $n; ++$i) { - if( $v4==$this->cont[$i] ) { - $v4 *= $pert; - break; - } - } - } - - function interp2($x1,$y1,$x2,$y2,$v1,$v2) { - $cv = $this->GetContVal(min($v1,$v2)); - $alpha = ($v1-$cv)/($v1-$v2); - $x1p = $x1*(1-$alpha) + $x2*$alpha; - $y1p = $y1*(1-$alpha) + $y2*$alpha; - $v1p = $v1 + $alpha*($v2-$v1); - return array($x1p,$y1p,$v1p); - } - - function RectFill($v1,$v2,$v3,$v4,$x1,$y1,$x2,$y2,$x3,$y3,$x4,$y4,$depth) { - if( $depth >= self::$maxdepth ) { - // Abort and just appoximate the color of this area - // with the average of the three values - $color = $this->GetColor(($v1+$v2+$v3+$v4)/4); - $p = array($x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4, $x1, $y1); - $this->FillPolygon($color,$p) ; - } - else { - - $this->Pertubate($v1,$v2,$v3,$v4); - - $fcnt = 0 ; - $vv1 = $this->GetNextHigherContourIdx($v1); - $vv2 = $this->GetNextHigherContourIdx($v2); - $vv3 = $this->GetNextHigherContourIdx($v3); - $vv4 = $this->GetNextHigherContourIdx($v4); - $eps = 0.0001; - - if( $vv1 == $vv2 && $vv2 == $vv3 && $vv3 == $vv4 ) { - $color = $this->GetColor($v1); - $p = array($x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4, $x1, $y1); - $this->FillPolygon($color,$p) ; - } - else { - - $dv1 = abs($vv1-$vv2); - $dv2 = abs($vv2-$vv3); - $dv3 = abs($vv3-$vv4); - $dv4 = abs($vv1-$vv4); - - if( $dv1 == 1 ) { - list($x1p,$y1p,$v1p) = $this->interp2($x1,$y1,$x2,$y2,$v1,$v2); - $fcnt++; - } - - if( $dv2 == 1 ) { - list($x2p,$y2p,$v2p) = $this->interp2($x2,$y2,$x3,$y3,$v2,$v3); - $fcnt++; - } - - if( $dv3 == 1 ) { - list($x3p,$y3p,$v3p) = $this->interp2($x3,$y3,$x4,$y4,$v3,$v4); - $fcnt++; - } - - if( $dv4 == 1 ) { - list($x4p,$y4p,$v4p) = $this->interp2($x4,$y4,$x1,$y1,$v4,$v1); - $fcnt++; - } - - $totdv = $dv1 + $dv2 + $dv3 + $dv4 ; - - if( ($fcnt == 2 && $totdv==2) || ($fcnt == 4 && $totdv==4) ) { - - if( $fcnt == 2 && $totdv==2 ) { - - if( $dv1 == 1 && $dv2 == 1) { - $color1 = $this->GetColor($v2); - $p1 = array($x1p,$y1p,$x2,$y2,$x2p,$y2p,$x1p,$y1p); - $color2 = $this->GetColor($v4); - $p2 = array($x1,$y1,$x1p,$y1p,$x2p,$y2p,$x3,$y3,$x4,$y4,$x1,$y1); - - $color = $this->GetColor($v1p); - $p = array($x1p,$y1p,$x2p,$y2p); - $v = $v1p; - } - elseif( $dv1 == 1 && $dv3 == 1 ) { - $color1 = $this->GetColor($v2); - $p1 = array($x1p,$y1p,$x2,$y2,$x3,$y3,$x3p,$y3p,$x1p,$y1p); - $color2 = $this->GetColor($v4); - $p2 = array($x1,$y1,$x1p,$y1p,$x3p,$y3p,$x4,$y4,$x1,$y1); - - $color = $this->GetColor($v1p); - $p = array($x1p,$y1p,$x3p,$y3p); - $v = $v1p; - } - elseif( $dv1 == 1 && $dv4 == 1 ) { - $color1 = $this->GetColor($v1); - $p1 = array($x1,$y1,$x1p,$y1p,$x4p,$y4p,$x1,$y1); - $color2 = $this->GetColor($v3); - $p2 = array($x1p,$y1p,$x2,$y2,$x3,$y3,$x4,$y4,$x4p,$y4p,$x1p,$y1p); - - $color = $this->GetColor($v1p); - $p = array($x1p,$y1p,$x4p,$y4p); - $v = $v1p; - } - elseif( $dv2 == 1 && $dv4 == 1 ) { - $color1 = $this->GetColor($v1); - $p1 = array($x1,$y1,$x2,$y2,$x2p,$y2p,$x4p,$y4p,$x1,$y1); - $color2 = $this->GetColor($v3); - $p2 = array($x4p,$y4p,$x2p,$y2p,$x3,$y3,$x4,$y4,$x4p,$y4p); - - $color = $this->GetColor($v2p); - $p = array($x2p,$y2p,$x4p,$y4p); - $v = $v2p; - } - elseif( $dv2 == 1 && $dv3 == 1 ) { - $color1 = $this->GetColor($v1); - $p1 = array($x1,$y1,$x2,$y2,$x2p,$y2p,$x3p,$y3p,$x4,$y4,$x1,$y1); - $color2 = $this->GetColor($v3); - $p2 = array($x2p,$y2p,$x3,$y3,$x3p,$y3p,$x2p,$y2p); - - $color = $this->GetColor($v2p); - $p = array($x2p,$y2p,$x3p,$y3p); - $v = $v2p; - } - elseif( $dv3 == 1 && $dv4 == 1 ) { - $color1 = $this->GetColor($v1); - $p1 = array($x1,$y1,$x2,$y2,$x3,$y3,$x3p,$y3p,$x4p,$y4p,$x1,$y1); - $color2 = $this->GetColor($v4); - $p2 = array($x4p,$y4p,$x3p,$y3p,$x4,$y4,$x4p,$y4p); - - $color = $this->GetColor($v4p); - $p = array($x4p,$y4p,$x3p,$y3p); - $v = $v4p; - } - - $this->FillPolygon($color1,$p1); - $this->FillPolygon($color2,$p2); - - if( $this->showcontlines ) { - if( $this->dofill ) { - $this->shape->SetColor($this->contlinecolor); - } - else { - $this->shape->SetColor($color); - } - $this->shape->Line($p[0],$p[1],$p[2],$p[3]); - } - if( $this->showlabels ) { - $this->putLabel( ($p[0]+$p[2])/2, ($p[1]+$p[3])/2, $p[2],$p[3] , $v); - } - } - elseif( $fcnt == 4 && $totdv==4 ) { - $vc = ($v1+$v2+$v3+$v4)/4; - - if( $v1p == $v2p && $v2p == $v3p && $v3p == $v4p ) { - // Four edge crossings (saddle point) of the same contour - // so we first need to - // find out how the saddle is crossing "/" or "\" - - if( $this->GetNextHigherContourIdx($vc) == $this->GetNextHigherContourIdx($v1) ) { - // "\" - $color1 = $this->GetColor($v1); - $p1 = array($x1,$y1,$x1p,$y1p,$x4p,$y4p,$x1,$y1); - - $color2 = $this->GetColor($v2); - $p2 = array($x1p,$y1p,$x2,$y2,$x2p,$y2p,$x3p,$y3p,$x4,$y4,$x4p,$y4p,$x1p,$y1p); - - $color3 = $color1; - $p3 = array($x2p,$y2p,$x3,$y3,$x3p,$y3p,$x2p,$y2p); - - $colorl1 = $this->GetColor($v1p); - $pl1 = array($x1p,$y1p,$x4p,$y4p); - $colorl2 = $this->GetColor($v2p); - $pl2 = array($x2p,$y2p,$x3p,$y3p); - $vl1 = $v1p; $vl2 = $v2p; - - } - else { - // "/" - $color1 = $this->GetColor($v2); - $p1 = array($x1p,$y1p,$x2,$y2,$x2p,$y2p,$x1p,$y1p); - - $color2 = $this->GetColor($v3); - $p2 = array($x1p,$y1p,$x2p,$y2p,$x3,$y3,$x3p,$y3p,$x4p,$y4p,$x1,$y1,$x1p,$y1p); - - $color3 = $color1; - $p3 = array($x4p,$y4p,$x3p,$y3p,$x4,$y4,$x4p,$y4p); - - $colorl1 = $this->GetColor($v1p); - $pl1 = array($x1p,$y1p,$x2p,$y2p); - $colorl2 = $this->GetColor($v4p); - $pl2 = array($x4p,$y4p,$x3p,$y3p); - $vl1 = $v1p; $vl2 = $v4p; - } - } - else { - // There are two different contours crossing so we need to find - // out which belongs to which - if( $v1p == $v2p ) { - // "/" - $color1 = $this->GetColor($v2); - $p1 = array($x1p,$y1p,$x2,$y2,$x2p,$y2p,$x1p,$y1p); - - $color2 = $this->GetColor($v3); - $p2 = array($x1p,$y1p,$x2p,$y2p,$x3,$y3,$x3p,$y3p,$x4p,$y4p,$x1,$y1,$x1p,$y1p); - - $color3 = $this->GetColor($v4); - $p3 = array($x4p,$y4p,$x3p,$y3p,$x4,$y4,$x4p,$y4p); - - $colorl1 = $this->GetColor($v1p); - $pl1 = array($x1p,$y1p,$x2p,$y2p); - $colorl2 = $this->GetColor($v4p); - $pl2 = array($x4p,$y4p,$x3p,$y3p); - $vl1 = $v1p; $vl2 = $v4p; - } - else { //( $v1p == $v4p ) - // "\" - $color1 = $this->GetColor($v1); - $p1 = array($x1,$y1,$x1p,$y1p,$x4p,$y4p,$x1,$y1); - - $color2 = $this->GetColor($v2); - $p2 = array($x1p,$y1p,$x2,$y2,$x2p,$y2p,$x3p,$y3p,$x4,$y4,$x4p,$y4p,$x1p,$y1p); - - $color3 = $this->GetColor($v3); - $p3 = array($x2p,$y2p,$x3,$y3,$x3p,$y3p,$x2p,$y2p); - - $colorl1 = $this->GetColor($v1p); - $pl1 = array($x1p,$y1p,$x4p,$y4p); - $colorl2 = $this->GetColor($v2p); - $pl2 = array($x2p,$y2p,$x3p,$y3p); - $vl1 = $v1p; $vl2 = $v2p; - } - } - $this->FillPolygon($color1,$p1); - $this->FillPolygon($color2,$p2); - $this->FillPolygon($color3,$p3); - - if( $this->showcontlines ) { - if( $this->dofill ) { - $this->shape->SetColor($this->contlinecolor); - $this->shape->Line($pl1[0],$pl1[1],$pl1[2],$pl1[3]); - $this->shape->Line($pl2[0],$pl2[1],$pl2[2],$pl2[3]); - } - else { - $this->shape->SetColor($colorl1); - $this->shape->Line($pl1[0],$pl1[1],$pl1[2],$pl1[3]); - $this->shape->SetColor($colorl2); - $this->shape->Line($pl2[0],$pl2[1],$pl2[2],$pl2[3]); - } - } - if( $this->showlabels ) { - $this->putLabel( ($pl1[0]+$pl1[2])/2, ($pl1[1]+$pl1[3])/2, $pl1[2], $pl1[3], $vl1); - $this->putLabel( ($pl2[0]+$pl2[2])/2, ($pl2[1]+$pl2[3])/2, $pl2[2], $pl2[3],$vl2); - } - } - } - else { - $vc = ($v1+$v2+$v3+$v4)/4; - $xc = ($x1+$x4)/2; - $yc = ($y1+$y2)/2; - - // Top left - $this->RectFill(($v1+$v2)/2, $v2, ($v2+$v3)/2, $vc, - $x1,$yc, $x2,$y2, $xc,$y2, $xc,$yc, $depth+1); - // Top right - $this->RectFill($vc, ($v2+$v3)/2, $v3, ($v3+$v4)/2, - $xc,$yc, $xc,$y2, $x3,$y3, $x3,$yc, $depth+1); - - // Bottom left - $this->RectFill($v1, ($v1+$v2)/2, $vc, ($v1+$v4)/2, - $x1,$y1, $x1,$yc, $xc,$yc, $xc,$y4, $depth+1); - - // Bottom right - $this->RectFill(($v1+$v4)/2, $vc, ($v3+$v4)/2, $v4, - $xc,$y1, $xc,$yc, $x3,$yc, $x4,$y4, $depth+1); - - } - } - } - } - - function TriFill($v1,$v2,$v3,$x1,$y1,$x2,$y2,$x3,$y3,$depth) { - if( $depth >= self::$maxdepth ) { - // Abort and just appoximate the color of this area - // with the average of the three values - $color = $this->GetColor(($v1+$v2+$v3)/3); - $p = array($x1, $y1, $x2, $y2, $x3, $y3, $x1, $y1); - $this->FillPolygon($color,$p) ; - } - else { - // In order to avoid some real unpleasentness in case a vertice is exactly - // the same value as a contour we pertuberate them so that we do not end up - // in udefined situation. This will only affect the calculations and not the - // visual appearance - - $dummy=0; - $this->Pertubate($v1,$v2,$v3,$dummy); - - $fcnt = 0 ; - $vv1 = $this->GetNextHigherContourIdx($v1); - $vv2 = $this->GetNextHigherContourIdx($v2); - $vv3 = $this->GetNextHigherContourIdx($v3); - $eps = 0.0001; - - if( $vv1 == $vv2 && $vv2 == $vv3 ) { - $color = $this->GetColor($v1); - $p = array($x1, $y1, $x2, $y2, $x3, $y3, $x1, $y1); - $this->FillPolygon($color,$p) ; - } - else { - $dv1 = abs($vv1-$vv2); - $dv2 = abs($vv2-$vv3); - $dv3 = abs($vv1-$vv3); - - if( $dv1 == 1 ) { - list($x1p,$y1p,$v1p) = $this->interp2($x1,$y1,$x2,$y2,$v1,$v2); - $fcnt++; - } - else { - $x1p = ($x1+$x2)/2; - $y1p = ($y1+$y2)/2; - $v1p = ($v1+$v2)/2; - } - - if( $dv2 == 1 ) { - list($x2p,$y2p,$v2p) = $this->interp2($x2,$y2,$x3,$y3,$v2,$v3); - $fcnt++; - } - else { - $x2p = ($x2+$x3)/2; - $y2p = ($y2+$y3)/2; - $v2p = ($v2+$v3)/2; - } - - if( $dv3 == 1 ) { - list($x3p,$y3p,$v3p) = $this->interp2($x3,$y3,$x1,$y1,$v3,$v1); - $fcnt++; - } - else { - $x3p = ($x3+$x1)/2; - $y3p = ($y3+$y1)/2; - $v3p = ($v3+$v1)/2; - } - - if( $fcnt == 2 && - ((abs($v1p-$v2p) < $eps && $dv1 ==1 && $dv2==1 ) || - (abs($v1p-$v3p) < $eps && $dv1 ==1 && $dv3==1 ) || - (abs($v2p-$v3p) < $eps && $dv2 ==1 && $dv3==1 )) ) { - - // This means that the contour line crosses exactly two sides - // and that the values of each vertice is such that only this - // contour line will cross this section. - // We can now be smart. The cotour line will simply divide the - // area in two polygons that we can fill and then return. There is no - // need to recurse. - - // First find out which two sides the contour is crossing - if( abs($v1p-$v2p) < $eps ) { - $p4 = array($x1,$y1,$x1p,$y1p,$x2p,$y2p,$x3,$y3,$x1,$y1); - $color4 = $this->GetColor($v1); - - $p3 = array($x1p,$y1p,$x2,$y2,$x2p,$y2p,$x1p,$y1p); - $color3 = $this->GetColor($v2); - - $p = array($x1p,$y1p,$x2p,$y2p); - $color = $this->GetColor($v1p); - $v = $v1p; - } - elseif( abs($v1p-$v3p) < $eps ) { - $p4 = array($x1p,$y1p,$x2,$y2,$x3,$y3,$x3p,$y3p,$x1p,$y1p); - $color4 = $this->GetColor($v2); - - $p3 = array($x1,$y1,$x1p,$y1p,$x3p,$y3p,$x1,$y1); - $color3 = $this->GetColor($v1); - - $p = array($x1p,$y1p,$x3p,$y3p); - $color = $this->GetColor($v1p); - $v = $v1p; - } - else { - $p4 = array($x1,$y1,$x2,$y2,$x2p,$y2p,$x3p,$y3p,$x1,$y1); - $color4 = $this->GetColor($v2); - - $p3 = array($x3p,$y3p,$x2p,$y2p,$x3,$y3,$x3p,$y3p); - $color3 = $this->GetColor($v3); - - $p = array($x3p,$y3p,$x2p,$y2p); - $color = $this->GetColor($v3p); - $v = $v3p; - } - $this->FillPolygon($color4,$p4); - $this->FillPolygon($color3,$p3); - - if( $this->showcontlines ) { - if( $this->dofill ) { - $this->shape->SetColor($this->contlinecolor); - } - else { - $this->shape->SetColor($color); - } - $this->shape->Line($p[0],$p[1],$p[2],$p[3]); - } - if( $this->showlabels ) { - $this->putLabel( ($p[0]+$p[2])/2, ($p[1]+$p[3])/2, $p[2], $p[3], $v); - } - } - else { - $this->TriFill($v1, $v1p, $v3p, $x1, $y1, $x1p, $y1p, $x3p, $y3p, $depth+1); - $this->TriFill($v1p, $v2, $v2p, $x1p, $y1p, $x2, $y2, $x2p, $y2p, $depth+1); - $this->TriFill($v3p, $v1p, $v2p, $x3p, $y3p, $x1p, $y1p, $x2p, $y2p, $depth+1); - $this->TriFill($v3p, $v2p, $v3, $x3p, $y3p, $x2p, $y2p, $x3, $y3, $depth+1); - } - } - } - } - - function Fill($v1,$v2,$v3,$maxdepth) { - $x1=0; $y1=1; - $x2=1; $y2=0; - $x3=1; $y3=1; - self::$maxdepth = $maxdepth; - $this->TriFill($v1, $v2, $v3, $x1, $y1, $x2, $y2, $x3, $y3, 0); - } - - function Fillmesh($meshdata,$maxdepth,$method='tri') { - $nx = count($meshdata[0]); - $ny = count($meshdata); - self::$maxdepth = $maxdepth; - for( $x=0; $x < $nx-1; ++$x ) { - for( $y=0; $y < $ny-1; ++$y ) { - $v1 = $meshdata[$y][$x]; - $v2 = $meshdata[$y][$x+1]; - $v3 = $meshdata[$y+1][$x+1]; - $v4 = $meshdata[$y+1][$x]; - - if( $method == 'tri' ) { - // Fill upper and lower triangle - $this->TriFill($v4, $v1, $v2, $x, $y+1, $x, $y, $x+1, $y, 0); - $this->TriFill($v4, $v2, $v3, $x, $y+1, $x+1, $y, $x+1, $y+1, 0); - } - else { - $this->RectFill($v4, $v1, $v2, $v3, $x, $y+1, $x, $y, $x+1, $y, $x+1, $y+1, 0); - } - } - } - if( $this->showlabels ) { - $this->strokeLabels(); - } - } -} - -$meshdata = array( - array (12,12,10,10), - array (10,10,8,14), - array (7,7,13,17), - array (4,5,8,12), - array (10,8,7,8)); - -$tt = new SingleTestTriangle(400,400,count($meshdata[0])-1,count($meshdata)-1); -$tt->SetContours(array(4.7, 6.0, 7.2, 8.6, 9.9, 11.2, 12.5, 13.8, 15.1, 16.4)); -$tt->SetFilled(true); - -//$tt->ShowTriangulation(true); -$tt->ShowLines(true); - -//$tt->ShowLabels(true); -$tt->Fillmesh($meshdata, 8, 'rect'); - -//$tt->Fill(4.0,3.0,7.0, 4); -//$tt->Fill(7,4,1,5); -//$tt->Fill(1,7,4,5); - -$tt->Stroke(); - -?> diff --git a/php/3ros/jpgraph/flag_mapping b/php/3ros/jpgraph/flag_mapping old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/flags.dat b/php/3ros/jpgraph/flags.dat old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/flags_thumb100x100.dat b/php/3ros/jpgraph/flags_thumb100x100.dat old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/flags_thumb35x35.dat b/php/3ros/jpgraph/flags_thumb35x35.dat old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/flags_thumb60x60.dat b/php/3ros/jpgraph/flags_thumb60x60.dat old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/fonts/DejaVuSans-Bold.ttf b/php/3ros/jpgraph/fonts/DejaVuSans-Bold.ttf old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/fonts/DejaVuSans-BoldOblique.ttf b/php/3ros/jpgraph/fonts/DejaVuSans-BoldOblique.ttf old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/fonts/DejaVuSans-Oblique.ttf b/php/3ros/jpgraph/fonts/DejaVuSans-Oblique.ttf old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/fonts/DejaVuSans.ttf b/php/3ros/jpgraph/fonts/DejaVuSans.ttf old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/fonts/FF_FONT0-Bold.gdf b/php/3ros/jpgraph/fonts/FF_FONT0-Bold.gdf old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/fonts/FF_FONT0.gdf b/php/3ros/jpgraph/fonts/FF_FONT0.gdf old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/fonts/FF_FONT1-Bold.gdf b/php/3ros/jpgraph/fonts/FF_FONT1-Bold.gdf old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/fonts/FF_FONT1.gdf b/php/3ros/jpgraph/fonts/FF_FONT1.gdf old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/fonts/FF_FONT2-Bold.gdf b/php/3ros/jpgraph/fonts/FF_FONT2-Bold.gdf old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/fonts/FF_FONT2.gdf b/php/3ros/jpgraph/fonts/FF_FONT2.gdf old mode 100755 new mode 100644 diff --git a/php/3ros/jpgraph/gd_image.inc.php b/php/3ros/jpgraph/gd_image.inc.php old mode 100755 new mode 100644 index fddbe03d4c..dcaf1a9626 --- a/php/3ros/jpgraph/gd_image.inc.php +++ b/php/3ros/jpgraph/gd_image.inc.php @@ -1,4 +1,5 @@ img = @imagecreatetruecolor($aWidth, $aHeight); - if( $this->img < 1 ) { + if( !$this->img ) { JpGraphError::RaiseL(25126); //die("Can't create truecolor image. Check that you really have GD2 library installed."); } @@ -193,7 +191,7 @@ function CopyCanvasH($aToHdl,$aFromHdl,$aToX,$aToY,$aFromX,$aFromY,$aWidth,$aHei else { $f = 'imagecopyresampled'; } - $f($aToHdl,$aFromHdl,$aToX,$aToY,$aFromX,$aFromY, $aWidth,$aHeight,$aw,$ah); + $f($aToHdl,$aFromHdl,(int)$aToX,(int)$aToY,(int)$aFromX,(int)$aFromY, (int)$aWidth,(int)$aHeight,(int)$aw,(int)$ah); } function Copy($fromImg,$toX,$toY,$fromX,$fromY,$toWidth,$toHeight,$fromWidth=-1,$fromHeight=-1) { @@ -225,17 +223,11 @@ function CopyMerge($fromImg,$toX,$toY,$fromX,$fromY,$toWidth,$toHeight,$fromWidt } } - static function GetWidth($aImg=null) { - if( $aImg === null ) { - $aImg = $this->img; - } + static function GetWidth($aImg) { return imagesx($aImg); } - static function GetHeight($aImg=null) { - if( $aImg === null ) { - $aImg = $this->img; - } + static function GetHeight($aImg) { return imagesy($aImg); } @@ -296,7 +288,7 @@ function SetFont($family,$style=FS_NORMAL,$size=10) { // Get the specific height for a text string function GetTextHeight($txt="",$angle=0) { - $tmp = preg_split('/\n/',$txt); + $tmp = preg_split('/\n/',$txt ?: ''); $n = count($tmp); $m=0; for($i=0; $i< $n; ++$i) { @@ -344,7 +336,7 @@ function GetFontWidth($angle=0) { // etxt width. function GetTextWidth($txt,$angle=0) { - $tmp = preg_split('/\n/',$txt); + $tmp = preg_split('/\n/',$txt ?: ''); $n = count($tmp); if( $this->font_family <= FF_FONT2+1 ) { @@ -510,7 +502,7 @@ function StrokeBoxedText2($x,$y,$txt,$dir=0,$fcolor="white",$bcolor="black", $x -= $rect_width/2; $x += sin($dir*M_PI/180)*$height; - $y += $rect_height/2; + $y += $rect_height/2; } elseif( $dir >= 270 && $dir <= 360 ) { @@ -659,7 +651,7 @@ function _StrokeBuiltinFont($x,$y,$txt,$dir,$paragraph_align,&$aBoundingBox,$aDe $use_font = $this->font_family; if( $dir==90 ) { - imagestringup($this->img,$use_font,$x,$y,$txt,$this->current_color); + imagestringup($this->img,$use_font,(int)$x,(int)$y,$txt,$this->current_color); $aBoundingBox = array(round($x),round($y),round($x),round($y-$w),round($x+$h),round($y-$w),round($x+$h),round($y)); if( $aDebug ) { // Draw bounding box @@ -669,24 +661,24 @@ function _StrokeBuiltinFont($x,$y,$txt,$dir,$paragraph_align,&$aBoundingBox,$aDe } } else { - if( preg_match('/\n/',$txt) ) { + if( preg_match('/\n/',$txt ?: '') ) { $tmp = preg_split('/\n/',$txt); for($i=0; $i < count($tmp); ++$i) { $w1 = $this->GetTextWidth($tmp[$i]); if( $paragraph_align=="left" ) { - imagestring($this->img,$use_font,$x,$y-$h+1+$i*$fh,$tmp[$i],$this->current_color); + imagestring($this->img,$use_font,(int)$x,(int)($y-$h+1+$i*$fh),$tmp[$i],$this->current_color); } elseif( $paragraph_align=="right" ) { - imagestring($this->img,$use_font,$x+($w-$w1),$y-$h+1+$i*$fh,$tmp[$i],$this->current_color); + imagestring($this->img,$use_font,(int)($x+($w-$w1)),(int)($y-$h+1+$i*$fh),$tmp[$i],$this->current_color); } else { - imagestring($this->img,$use_font,$x+$w/2-$w1/2,$y-$h+1+$i*$fh,$tmp[$i],$this->current_color); + imagestring($this->img,$use_font,(int)($x+$w/2-$w1/2),(int)($y-$h+1+$i*$fh),$tmp[$i],$this->current_color); } } } else { //Put the text - imagestring($this->img,$use_font,$x,$y-$h+1,$txt,$this->current_color); + imagestring($this->img,$use_font,(int)$x,(int)($y-$h+1),$txt ?: '',$this->current_color); } if( $aDebug ) { // Draw the bounding rectangle and the bounding box @@ -761,7 +753,7 @@ function imagettfbbox_fixed($size, $angle, $fontfile, $text) { // box is sometimes coinciding with the first pixel of the text //$bbox[0] -= 1; //$bbox[6] -= 1; - + // For roatated text we need to add extra width for rotated // text since the kerning and stroking of the TTF is not the same as for // text at a 0 degree angle @@ -914,7 +906,7 @@ function _StrokeTTF($x,$y,$txt,$dir,$paragraph_align,&$aBoundingBox,$debug=false if( $this->text_valign != 'basepoint' ) { // Align x,y ot lower left corner of bbox - + if( $this->text_halign=='right' ) { $x -= $width; @@ -942,7 +934,7 @@ function _StrokeTTF($x,$y,$txt,$dir,$paragraph_align,&$aBoundingBox,$debug=false // Do nothing the text is drawn at baseline by default } } - ImageTTFText ($this->img, $this->font_size, $dir, $x, $y, + ImageTTFText ($this->img, $this->font_size, $dir, (int)$x, (int)$y, $this->current_color,$this->font_file,$txt); // Calculate and return the co-ordinates for the bounding box @@ -1049,7 +1041,7 @@ function _StrokeTTF($x,$y,$txt,$dir,$paragraph_align,&$aBoundingBox,$debug=false $xl -= $bbox[0]/2; $yl = $y - $yadj; //$xl = $xl- $xadj; - ImageTTFText($this->img, $this->font_size, $dir, $xl, $yl-($h-$fh)+$fh*$i, + ImageTTFText($this->img, $this->font_size, $dir, (int)$xl, (int)($yl-($h-$fh)+$fh*$i), $this->current_color,$this->font_file,$tmp[$i]); // echo "xl=$xl,".$tmp[$i]."
    "; @@ -1343,7 +1335,7 @@ function DashedLine($x1,$y1,$x2,$y2,$dash_length=1,$dash_space=4) { if( $this->use_anti_aliasing ) { // JpGraphError::RaiseL(25129); // Anti-alias can not be used with dashed lines. Please disable anti-alias or use solid lines. } - + $x1 = round($x1); $x2 = round($x2); $y1 = round($y1); @@ -1371,12 +1363,12 @@ function DashedLineForGrid($x1,$y1,$x2,$y2,$dash_length=1,$dash_space=4) { if( $this->use_anti_aliasing ) { // JpGraphError::RaiseL(25129); // Anti-alias can not be used with dashed lines. Please disable anti-alias or use solid lines. } - + $x1 = round($x1); $x2 = round($x2); $y1 = round($y1); $y2 = round($y2); - + /* $dash_length *= $this->scale; $dash_space *= $this->scale; @@ -1448,7 +1440,11 @@ function FilledPolygon($pts) { } $old = $this->line_weight; imagesetthickness($this->img,1); - imagefilledpolygon($this->img,$pts,count($pts)/2,$this->current_color); + if (CheckPHPVersion('8.1.0')) { + imagefilledpolygon($this->img,$pts,$this->current_color); + } else { + imagefilledpolygon($this->img,$pts,count($pts)/2,$this->current_color); + } $this->line_weight = $old; imagesetthickness($this->img,$old); } @@ -1672,14 +1668,14 @@ function Stream($aFile=NULL) { $func="image".$this->img_format; if( $this->img_format=="jpeg" && $this->quality != null ) { $res = @$func($this->img,$aFile,$this->quality); - + if(!$res){ - if($aFile != NULL){ + if($aFile != NULL){ JpGraphError::RaiseL(25107,$aFile);//("Can't write to file '$aFile'. Check that the process running PHP has enough permission."); }else{ JpGraphError::RaiseL(25108);//("Can't stream image. This is most likely due to a faulty PHP/GD setup. Try to recompile PHP and use the built-in GD library that comes with PHP."); } - + } } else { @@ -1764,11 +1760,11 @@ function DrawLine($im, $x1, $y1, $x2, $y2, $weight, $color) { return imageline($im,$x1,$y1,$x2,$y2,$color); } - $angle=(atan2(($y1 - $y2), ($x2 - $x1))); + $angle=(atan2(($y1 - $y2), ($x2 - $x1))); $dist_x = $weight * (sin($angle)) / 2; $dist_y = $weight * (cos($angle)) / 2; - + $p1x=ceil(($x1 + $dist_x)); $p1y=ceil(($y1 + $dist_y)); $p2x=ceil(($x2 + $dist_x)); @@ -1779,7 +1775,11 @@ function DrawLine($im, $x1, $y1, $x2, $y2, $weight, $color) { $p4y=ceil(($y1 - $dist_y)); $array=array($p1x,$p1y,$p2x,$p2y,$p3x,$p3y,$p4x,$p4y); - imagefilledpolygon ( $im, $array, (count($array)/2), $color ); + if (CheckPHPVersion('8.1.0')) { + imagefilledpolygon ( $im, $array, $color ); + } else { + imagefilledpolygon ( $im, $array, (count($array)/2), $color ); + } // for antialias imageline($im, $p1x, $p1y, $p2x, $p2y, $color); @@ -1815,12 +1815,12 @@ function DrawLine($im, $x1, $y1, $x2, $y2, $weight, $color) { $pts[] = $x2 - $weight; $pts[] = $y2; } else { - + var_dump($x1, $x2, $y1, $y2); $length = sqrt(pow($x2 - $x1, 2) + pow($y2 - $y1, 2)); var_dump($length);exit; exit; - + /* $lean = ($y2 - $y1) / ($x2 - $x1); $lean2 = -1 / $lean; @@ -1837,10 +1837,14 @@ function DrawLine($im, $x1, $y1, $x2, $y2, $weight, $color) { //print_r($pts);exit; if (count($pts)/2 < 3) { return; - } + } imagesetthickness($im, 1); - imagefilledpolygon($im, $pts,count($pts)/2, $color); + if (CheckPHPVersion('8.1.0')) { + imagefilledpolygon($im, $pts, $color); + } else { + imagefilledpolygon($im, $pts,count($pts)/2, $color); + } $weight *= 2; @@ -1858,7 +1862,7 @@ function DrawImageSmoothArc($im, $xc, $yc, $w, $h, $s, $e, $color, $style = null } function CreateColorForImageSmoothArc($color) { - $alpha = $color >> 24 & 0xFF; + $alpha = $color >> 24 & 0xFF; $red = $color >> 16 & 0xFF; $green = $color >> 8 & 0xFF; $blue = $color & 0xFF; @@ -1930,13 +1934,13 @@ function __get($name) { return $this->$variable_name; } - $variable_name = '_' . $name; + $variable_name = '_' . $name; if (isset($this->$variable_name)) { return $this->$variable_name * SUPERSAMPLING_SCALE; } else { JpGraphError::RaiseL('25132', $name); - } + } } function __set($name, $value) { @@ -1957,8 +1961,8 @@ class RotImage extends Image { function __construct($aWidth,$aHeight,$a=0,$aFormat=DEFAULT_GFORMAT,$aSetAutoMargin=true) { parent::__construct($aWidth,$aHeight,$aFormat,$aSetAutoMargin); - $this->dx=$this->left_margin+$this->plotwidth/2; - $this->dy=$this->top_margin+$this->plotheight/2; + $this->dx=$this->width/2; + $this->dy=$this->height/2; $this->SetAngle($a); } @@ -2025,8 +2029,6 @@ function FilledArc($xc,$yc,$w,$h,$s,$e,$style='') { function SetMargin($lm,$rm,$tm,$bm) { parent::SetMargin($lm,$rm,$tm,$bm); - $this->dx=$this->left_margin+$this->plotwidth/2; - $this->dy=$this->top_margin+$this->plotheight/2; $this->UpdateRotMatrice(); } @@ -2277,7 +2279,7 @@ function StreamImgFile($aImage,$aCacheFileName) { // image file doesn't exist or exists but is to old function GetAndStream($aImage,$aCacheFileName) { if( $this->Isvalid($aCacheFileName) ) { - $this->StreamImgFile($aImage,$aCacheFileName); + return $this->StreamImgFile($aImage,$aCacheFileName); } else { return false; diff --git a/php/3ros/jpgraph/imageSmoothArc.php b/php/3ros/jpgraph/imageSmoothArc.php old mode 100755 new mode 100644 index 56e5bfa6aa..ce93e649b5 --- a/php/3ros/jpgraph/imageSmoothArc.php +++ b/php/3ros/jpgraph/imageSmoothArc.php @@ -2,6 +2,7 @@ namespace JpGraph; + /* Copyright (c) 2006-2008 Ulrich Mierendorff diff --git a/php/3ros/jpgraph/imgdata_balls.inc.php b/php/3ros/jpgraph/imgdata_balls.inc.php old mode 100755 new mode 100644 index e21f2265b6..908ff31cfb --- a/php/3ros/jpgraph/imgdata_balls.inc.php +++ b/php/3ros/jpgraph/imgdata_balls.inc.php @@ -1,4 +1,5 @@ diff --git a/php/3ros/jpgraph/jpgraph.php b/php/3ros/jpgraph/jpgraph.php old mode 100755 new mode 100644 index 969f21ffba..251e163820 --- a/php/3ros/jpgraph/jpgraph.php +++ b/php/3ros/jpgraph/jpgraph.php @@ -1,4 +1,5 @@ Get(11,$file,$lineno); @@ -192,7 +198,7 @@ // Setup path for western/latin TTF fonts // if (!defined('TTF_DIR')) { - if (strstr( PHP_OS, 'WIN') ) { + if (JPG_IS_WINDOWS) { //mitoteam: better Windows OS detection under Cygwin $sroot = getenv('SystemRoot'); if( empty($sroot) ) { $t = new ErrMsgText(); @@ -211,7 +217,7 @@ // Setup path for MultiByte TTF fonts (japanese, chinese etc.) // if (!defined('MBTTF_DIR')) { - if (strstr( PHP_OS, 'WIN') ) { + if (JPG_IS_WINDOWS) { //mitoteam: better Windows OS detection under Cygwin $sroot = getenv('SystemRoot'); if( empty($sroot) ) { $t = new ErrMsgText(); @@ -394,15 +400,15 @@ function Set($aLocale) { } $this->iLocale = $aLocale; - for( $i = 0, $ofs = 0 - strftime('%w'); $i < 7; $i++, $ofs++ ) { - $day = strftime('%a', strtotime("$ofs day")); + for( $i = 0, $ofs = 0 - date('w'); $i < 7; $i++, $ofs++ ) { + $day = date('D', strtotime("$ofs day")); $day[0] = strtoupper($day[0]); $this->iDayAbb[$aLocale][]= $day[0]; $this->iShortDay[$aLocale][]= $day; } for($i=1; $i<=12; ++$i) { - list($short ,$full) = explode('|', strftime("%b|%B",strtotime("2001-$i-01"))); + list($short ,$full) = explode('|', date("M|F",strtotime("2001-$i-01"))); $this->iShortMonth[$aLocale][] = ucfirst($short); $this->iMonthName [$aLocale][] = ucfirst($full); } @@ -646,8 +652,7 @@ function __construct($aWidth=300,$aHeight=200,$aCachedName='',$aTimeout=0,$aInli $theme_class = DEFAULT_THEME_CLASS; if (class_exists($theme_class)) { - $class_name = 'JpGraph\Themes\\'. $theme_class; - $this->graph_theme = new $class_name(); + $this->graph_theme = new $theme_class(); } } } @@ -655,7 +660,7 @@ function __construct($aWidth=300,$aHeight=200,$aCachedName='',$aTimeout=0,$aInli function InitializeFrameAndMargin() { $this->doframe=true; $this->frame_color='black'; - $this->frame_weight=1; + $this->frame_weight=1; $this->titlebackground_framecolor = 'blue'; $this->titlebackground_framestyle = 2; @@ -743,11 +748,6 @@ function SetY2OrderBack($aBack=true) { // Rotate the graph 90 degrees and set the margin // when we have done a 90 degree rotation function Set90AndMargin($lm=0,$rm=0,$tm=0,$bm=0) { - $lm = $lm ==0 ? floor(0.2 * $this->img->width) : $lm ; - $rm = $rm ==0 ? floor(0.1 * $this->img->width) : $rm ; - $tm = $tm ==0 ? floor(0.2 * $this->img->height) : $tm ; - $bm = $bm ==0 ? floor(0.1 * $this->img->height) : $bm ; - $adj = ($this->img->height - $this->img->width)/2; $this->img->SetMargin($tm-$adj,$bm-$adj,$rm+$adj,$lm+$adj); $this->img->SetCenter(floor($this->img->width/2),floor($this->img->height/2)); @@ -1293,9 +1293,11 @@ function GetCSIMareas() { } } - $n = count($this->iTables); - for( $i=0; $i < $n; ++$i ) { - $csim .= $this->iTables[$i]->GetCSIMareas(); + if($this->iTables != null) { + $n = count($this->iTables); + for ($i = 0; $i < $n; ++$i) { + $csim .= $this->iTables[$i]->GetCSIMareas(); + } } return $csim; @@ -1370,7 +1372,7 @@ static function GetURLArguments($aAddRecursiveBlocker=false) { // Now reconstruct any user URL argument reset($_GET); - while( list($key,$value) = each($_GET) ) { + foreach ($_GET as $key => $value) { if( is_array($value) ) { foreach ( $value as $k => $v ) { $urlarg .= '&'.$key.'%5B'.$k.'%5D='.urlencode($v); @@ -1385,7 +1387,7 @@ static function GetURLArguments($aAddRecursiveBlocker=false) { // but there is little else we can do. One idea for the // future might be recreate the POST header in case. reset($_POST); - while( list($key,$value) = each($_POST) ) { + foreach ($_POST as $key => $value) { if( is_array($value) ) { foreach ( $value as $k => $v ) { $urlarg .= '&'.$key.'%5B'.$k.'%5D='.urlencode($v); @@ -1406,7 +1408,7 @@ function SetCSIMImgAlt($aAlt) { function StrokeCSIM($aScriptName='auto',$aCSIMName='',$aBorder=0) { if( $aCSIMName=='' ) { // create a random map name - srand ((double) microtime() * 1000000); + srand ((int)((double) microtime() * 1000000)); // MiTo Team: explicit type casting $r = rand(0,100000); $aCSIMName='__mapname'.$r.'__'; } @@ -1575,8 +1577,10 @@ function GetXMinMax() { foreach( $this->y2plots as $p ) { list($xmin,$ymin) = $p->Min(); list($xmax,$ymax) = $p->Max(); - $min = Min($xmin,$min); - $max = Max($xmax,$max); + if( $xmin !== null && $xmax !== null ) { + $min = Min($xmin, $min); + $max = Max($xmax, $max); + } } } @@ -1586,8 +1590,10 @@ function GetXMinMax() { foreach( $this->ynplots[$i] as $p ) { list($xmin,$ymin) = $p->Min(); list($xmax,$ymax) = $p->Max(); - $min = Min($xmin,$min); - $max = Max($xmax,$max); + if( $xmin !== null && $xmax !== null ) { + $min = Min($xmin, $min); + $max = Max($xmax, $max); + } } } } @@ -1595,14 +1601,14 @@ function GetXMinMax() { } function AdjustMarginsForTitles() { - $totrequired = - ($this->title->t != '' + $totrequired = + ($this->title->t != '' ? $this->title->GetTextHeight($this->img) + $this->title->margin + 5 * SUPERSAMPLING_SCALE : 0 ) + - ($this->subtitle->t != '' + ($this->subtitle->t != '' ? $this->subtitle->GetTextHeight($this->img) + $this->subtitle->margin + 5 * SUPERSAMPLING_SCALE : 0 ) + - ($this->subsubtitle->t != '' + ($this->subsubtitle->t != '' ? $this->subsubtitle->GetTextHeight($this->img) + $this->subsubtitle->margin + 5 * SUPERSAMPLING_SCALE : 0 ) ; @@ -1644,7 +1650,7 @@ function AdjustMarginsForTitles() { $this->SetMargin( $this->img->raw_left_margin, $this->img->raw_right_margin, - $totrequired / SUPERSAMPLING_SCALE, + $totrequired / SUPERSAMPLING_SCALE, $this->img->raw_bottom_margin ); } @@ -2521,7 +2527,7 @@ static function LoadBkgImage($aImgFormat='',$aFile='',$aImgStr='') { function StrokePlotGrad() { if( $this->plot_gradtype < 0 ) return; - + $grad = new Gradient($this->img); $xl = $this->img->left_margin; $yt = $this->img->top_margin; @@ -2746,7 +2752,7 @@ function StrokePlotArea() { $aa = $this->img->SetAngle(0); $this->StrokeFrame(); $aa = $this->img->SetAngle($aa); - $this->StrokeBackgroundGrad(); + $this->StrokeBackgroundGrad(); if( $this->bkg_gradtype < 0 || ($this->bkg_gradtype > 0 && $this->bkg_gradstyle==BGRAD_MARGIN) ) { $this->FillPlotArea(); } @@ -3137,7 +3143,7 @@ function ClearTheme() { $this->inputValues['aTimeout'], $this->inputValues['aInline'] ); - + if (!($this instanceof PieGraph)) { if ($this->isAfterSetScale) { $this->SetScale( @@ -3146,7 +3152,7 @@ function ClearTheme() { $this->inputValues['aYMax'], $this->inputValues['aXMin'], $this->inputValues['aXMax'] - ); + ); } } @@ -3644,7 +3650,6 @@ function DoStroke($aTicksPos,$aType,$aColor,$aWeight) { // assumption offset==0 so we might end up drawing one // to many gridlines $i=0; - $x=$aTicksPos[$i]; while( $iimg->Line($x,$yl,$x,$yu); elseif( $aType == 'dotted' ) $this->img->DashedLineForGrid($x,$yl,$x,$yu,1,6); @@ -3957,7 +3962,7 @@ function Stroke($aOtherAxisScale,$aStrokeLabels=true) { if( !$this->hide_line ) { // Stroke Y-axis $this->img->FilledRectangle( - $pos - $this->weight + 1, + $pos - $this->weight + 1, $this->img->top_margin, $pos, $this->img->height - $this->img->bottom_margin + $this->weight - 1 @@ -4062,7 +4067,7 @@ function StrokeLabels($aPos,$aMinor=false,$aAbsLabel=false) { // that holds the labels set by the user. If the user hasn't // specified any values we use whats in the automatically asigned // labels in the maj_ticks_label - if( isset($this->ticks_label[$i*$m]) ) { + if( isset($this->ticks_label[$i *(int)$m]) ) { $label=$this->ticks_label[$i*$m]; } else { @@ -4074,12 +4079,12 @@ function StrokeLabels($aPos,$aMinor=false,$aAbsLabel=false) { } // We number the scale from 1 and not from 0 so increase by one - if( $this->scale->textscale && + if( $this->scale->textscale && $this->scale->ticks->label_formfunc == '' && ! $this->scale->ticks->HaveManualLabels() ) { ++$label; - + } } @@ -4172,6 +4177,8 @@ class Ticks { $ticks_pos = array(), $maj_ticks_label = array(); public $precision; + public $ticks_label = array(); /* mitoteam: absent in original sources */ + protected $minor_abs_size=3, $major_abs_size=5; protected $scale; protected $is_set=false; @@ -5012,7 +5019,7 @@ function InitConstants($img) { $this->off=$img->left_margin; $this->scale_factor = 0; if( $this->world_size > 0 ) { - $this->scale_factor=$this->world_abs_size/($this->world_size*1.0); + $this->scale_factor=$this->world_abs_size/($this->world_size*0.999999); } } else { // y scale @@ -5020,7 +5027,7 @@ function InitConstants($img) { $this->off=$img->top_margin+$this->world_abs_size; $this->scale_factor = 0; if( $this->world_size > 0 ) { - $this->scale_factor=-$this->world_abs_size/($this->world_size*1.0); + $this->scale_factor=-$this->world_abs_size/($this->world_size*0.999999); } } $size = $this->world_size * $this->scale_factor; @@ -5221,13 +5228,13 @@ function MatchMin3($a,$b,$c,$weight) { } function __get($name) { - $variable_name = '_' . $name; + $variable_name = '_' . $name; if (isset($this->$variable_name)) { return $this->$variable_name * SUPERSAMPLING_SCALE; } else { JpGraphError::RaiseL('25132', $name); - } + } } function __set($name, $value) { @@ -5572,7 +5579,7 @@ function Legend($aGraph) { function Clear() { $this->isRunningClear = true; - $this->__construct($this->inputValues['aDatay'], $this->inputValues['aDatax']); + Plot::__construct($this->inputValues['aDatay'], $this->inputValues['aDatax']); $this->isRunningClear = false; } diff --git a/php/3ros/jpgraph/jpgraph_antispam-digits.php b/php/3ros/jpgraph/jpgraph_antispam-digits.php old mode 100755 new mode 100644 index ee476c2ab7..5e0ef42ca0 --- a/php/3ros/jpgraph/jpgraph_antispam-digits.php +++ b/php/3ros/jpgraph/jpgraph_antispam-digits.php @@ -1,4 +1,5 @@ numpoints does not updated correctly. + */ + function Clear() { + $this->isRunningClear = true; + $this->__construct($this->inputValues['aDatay'], $this->inputValues['aDatax']); + $this->isRunningClear = false; + } + function Stroke($img,$xscale,$yscale) { $numpoints = count($this->coords[0]); @@ -717,7 +730,7 @@ function Min() { $n = count($this->plots); for($i=0; $i < $n; ++$i) { list($xm,$ym) = $this->plots[$i]->Min(); - $xmin = max($xmin,$xm); + $xmin = min($xmin,$xm); $ymin = min($ymin,$ym); } return array($xmin,$ymin); @@ -1112,14 +1125,13 @@ function Stroke($img,$xscale,$yscale) { // First stroke the accumulated value for the entire bar // This value is always placed at the top/bottom of the bars - if( $accy_neg < 0 ) { + if( $accy + $accy_neg < 0 ) { $y=$yscale->Translate($accy_neg); - $this->value->Stroke($img,$accy_neg,$x,$y); } else { $y=$yscale->Translate($accy); - $this->value->Stroke($img,$accy,$x,$y); } + $this->value->Stroke($img,$accy + $accy_neg,$x,$y); $accy = 0; $accy_neg = 0; diff --git a/php/3ros/jpgraph/jpgraph_canvas.php b/php/3ros/jpgraph/jpgraph_canvas.php old mode 100755 new mode 100644 index 0acfd7fc1b..ce2415799a --- a/php/3ros/jpgraph/jpgraph_canvas.php +++ b/php/3ros/jpgraph/jpgraph_canvas.php @@ -1,7 +1,7 @@ Raise($this->getMessage()); } - static public function defaultHandler(\Exception $exception) { + static public function defaultHandler(Throwable $exception) { global $__jpg_OldHandler; if( $exception instanceof JpGraphException ) { $exception->Stroke(); diff --git a/php/3ros/jpgraph/jpgraph_error.php b/php/3ros/jpgraph/jpgraph_error.php old mode 100755 new mode 100644 index b9a85ec423..003ec91c9c --- a/php/3ros/jpgraph/jpgraph_error.php +++ b/php/3ros/jpgraph/jpgraph_error.php @@ -1,4 +1,5 @@ iStartDate); - $de=strftime("%w",$this->iEndDate); + $ds=date("w",$this->iStartDate); + $de=date("w",$this->iEndDate); // We want to start on iWeekStart day. But first we subtract a week // if the startdate is "behind" the day the week start at. @@ -2281,17 +2281,17 @@ function GetNumDaysInMonth($aMonth,$aYear) { // Get day in month function GetMonthDayNbr($aDate) { - return 0+strftime("%d",$aDate); + return 0+date("d",$aDate); } // Get day in year function GetYearDayNbr($aDate) { - return 0+strftime("%j",$aDate); + return 0+date("z",$aDate); } // Get month number function GetMonthNbr($aDate) { - return 0+strftime("%m",$aDate); + return 0+date("m",$aDate); } // Translate a date to screen coordinates (horizontal scale) @@ -2602,63 +2602,63 @@ function StrokeDays($aYCoord,$getHeight=false) { $x+$daywidth,$yb-$this->day->iFrameWeight); } - $mn = strftime('%m',$datestamp); + $mn = date('m',$datestamp); if( $mn[0]=='0' ) $mn = $mn[1]; switch( $this->day->iStyle ) { case DAYSTYLE_LONG: // "Monday" - $txt = strftime('%A',$datestamp); + $txt = date('l',$datestamp); break; case DAYSTYLE_SHORT: // "Mon" - $txt = strftime('%a',$datestamp); + $txt = date('D',$datestamp); break; case DAYSTYLE_SHORTDAYDATE1: // "Mon 23/6" - $txt = strftime('%a %d/'.$mn,$datestamp); + $txt = date('D d/'.$mn,$datestamp); break; case DAYSTYLE_SHORTDAYDATE2: // "Mon 23 Jun" - $txt = strftime('%a %d %b',$datestamp); + $txt = date('D d M',$datestamp); break; case DAYSTYLE_SHORTDAYDATE3: // "Mon 23 Jun 2003" - $txt = strftime('%a %d %b %Y',$datestamp); + $txt = date('D d M Y',$datestamp); break; case DAYSTYLE_LONGDAYDATE1: // "Monday 23 Jun" - $txt = strftime('%A %d %b',$datestamp); + $txt = date('l d M',$datestamp); break; case DAYSTYLE_LONGDAYDATE2: // "Monday 23 Jun 2003" - $txt = strftime('%A %d %b %Y',$datestamp); + $txt = date('l d M Y',$datestamp); break; case DAYSTYLE_SHORTDATE1: // "23/6" - $txt = strftime('%d/'.$mn,$datestamp); + $txt = date('d/'.$mn,$datestamp); break; case DAYSTYLE_SHORTDATE2: // "23 Jun" - $txt = strftime('%d %b',$datestamp); + $txt = date('d M',$datestamp); break; case DAYSTYLE_SHORTDATE3: // "Mon 23" - $txt = strftime('%a %d',$datestamp); + $txt = date('D d',$datestamp); break; case DAYSTYLE_SHORTDATE4: // "23" - $txt = strftime('%d',$datestamp); + $txt = date('d',$datestamp); break; case DAYSTYLE_CUSTOM: // Custom format - $txt = strftime($this->day->iLabelFormStr,$datestamp); + $txt = date($this->day->iLabelFormStr,$datestamp); break; case DAYSTYLE_ONELETTER: default: // "M" - $txt = strftime('%A',$datestamp); + $txt = date('l',$datestamp); $txt = strtoupper($txt[0]); break; } @@ -2811,7 +2811,7 @@ function StrokeMonths($aYCoord,$getHeight=false) { $img->SetLineWeight($this->month->grid->iWeight); $img->SetColor($this->month->iTextColor); - $year = 0+strftime("%Y",$this->iStartDate); + $year = 0+date("Y",$this->iStartDate); $img->SetTextAlign("center"); if( $this->GetMonthNbr($this->iStartDate) == $this->GetMonthNbr($this->iEndDate) && $this->GetYear($this->iStartDate)==$this->GetYear($this->iEndDate) ) { @@ -3637,6 +3637,7 @@ function __construct($aDate,$aTitle="",$aColor="darkred",$aWeight=2,$aStyle="sol $this->iLine->SetColor($aColor); $this->iLine->SetWeight($aWeight); $this->iLine->SetStyle($aStyle); + $this->iLine->Show(); $this->iStart = $aDate; $this->title = new TextPropertyBelow(); $this->title->Set($aTitle); diff --git a/php/3ros/jpgraph/jpgraph_gb2312.php b/php/3ros/jpgraph/jpgraph_gb2312.php old mode 100755 new mode 100644 index df60321ba0..f92b024cf6 --- a/php/3ros/jpgraph/jpgraph_gb2312.php +++ b/php/3ros/jpgraph/jpgraph_gb2312.php @@ -1,4 +1,5 @@ setslicecolors==null ) { - $graph->legend->Add($l,$colors[$ta[$i%$numcolors]],"",0,$this->csimtargets[$i],$alt,$wintarg); + $csimtarget = isset($this->csimtargets[$i]) ? $this->csimtargets[$i] : null; + $graph->legend->Add($l,$colors[$ta[$i%$numcolors]],"",0,$csimtarget,$alt,$wintarg); } else { - $graph->legend->Add($l,$this->setslicecolors[$i%$numcolors],"",0,$this->csimtargets[$i],$alt,$wintarg); + $csimtarget = isset($this->csimtargets[$i]) ? $this->csimtargets[$i] : null; + $graph->legend->Add($l,$this->setslicecolors[$i%$numcolors],"",0,$csimtarget,$alt,$wintarg); } } } diff --git a/php/3ros/jpgraph/jpgraph_pie3d.php b/php/3ros/jpgraph/jpgraph_pie3d.php old mode 100755 new mode 100644 index 5d88050af1..e09a5b8c18 --- a/php/3ros/jpgraph/jpgraph_pie3d.php +++ b/php/3ros/jpgraph/jpgraph_pie3d.php @@ -1,4 +1,5 @@ value->ApplyFont($img); $margin = $img->GetFontHeight()/2 + $this->value->margin ; + $labelpoasadj = $this->ilabelposadj === 'auto' ? 1.0 : $this->ilabelposadj; //mitoteam: 'auto' can not be used as float for($i=0; $i < count($data); ++$i ) { $la = $labeldata[$i][0]; - $x = $labeldata[$i][1] + cos($la*M_PI/180)*($d+$margin)*$this->ilabelposadj; - $y = $labeldata[$i][2] - sin($la*M_PI/180)*($h+$margin)*$this->ilabelposadj; - if( $this->ilabelposadj >= 1.0 ) { + $x = $labeldata[$i][1] + cos($la*M_PI/180)*($d+$margin)*$labelpoasadj; + $y = $labeldata[$i][2] - sin($la*M_PI/180)*($h+$margin)*$labelpoasadj; + if( $labelpoasadj >= 1.0 ) { if( $la > 180 && $la < 360 ) $y += $z; } if( $this->labeltype == 0 ) { diff --git a/php/3ros/jpgraph/jpgraph_plotband.php b/php/3ros/jpgraph/jpgraph_plotband.php old mode 100755 new mode 100644 index 6e167d5569..0e5a77b0ae --- a/php/3ros/jpgraph/jpgraph_plotband.php +++ b/php/3ros/jpgraph/jpgraph_plotband.php @@ -1,4 +1,5 @@ 1 ) { - $k = ($max+$min) / 2; + $k = (int) floor(($max+$min) / 2); if( $this->xdata[$k] > $xpoint ) $max=$k; else diff --git a/php/3ros/jpgraph/jpgraph_rgb.inc.php b/php/3ros/jpgraph/jpgraph_rgb.inc.php old mode 100755 new mode 100644 index f4514306a0..f81a96dd26 --- a/php/3ros/jpgraph/jpgraph_rgb.inc.php +++ b/php/3ros/jpgraph/jpgraph_rgb.inc.php @@ -1,4 +1,5 @@ 1 ) { JpGraphError::RaiseL(25080);//('Alpha parameter for color must be between 0.0 and 1.0'); } - return imagecolorresolvealpha($this->img, $r, $g, $b, round($aAlpha * 127)); + return imagecolorresolvealpha($this->img, (int)$r, (int)$g, (int)$b, (int)round($aAlpha * 127)); } // Try to convert an array with three valid numbers to the corresponding hex array diff --git a/php/3ros/jpgraph/jpgraph_scatter.php b/php/3ros/jpgraph/jpgraph_scatter.php old mode 100755 new mode 100644 index 3d2b12dc1d..15457ef7f4 --- a/php/3ros/jpgraph/jpgraph_scatter.php +++ b/php/3ros/jpgraph/jpgraph_scatter.php @@ -1,4 +1,5 @@ color_index = 0; } /** - * + * */ abstract function GetColorList(); @@ -39,7 +41,7 @@ abstract function ApplyPlot($plot); /** * - */ + */ function SetupPlot($plot) { if (is_array($plot)) { foreach ($plot as $obj) { @@ -80,13 +82,13 @@ function PreStrokeApply($graph) { /** * */ - function GetThemeColors($num = 30) { + function GetThemeColors($num = 30) { $result_list = array(); $old_index = $this->color_index; $this->color_index = 0; $count = 0; - + $i = 0; while (true) { for ($j = 0; $j < count($this->GetColorList()); $j++) { @@ -99,7 +101,7 @@ function GetThemeColors($num = 30) { } $this->color_index = $old_index; - + return $result_list; } diff --git a/php/3ros/jpgraph/jpgraph_ttf.inc.php b/php/3ros/jpgraph/jpgraph_ttf.inc.php old mode 100755 new mode 100644 index 02ea5c5f47..e2f1de9f7e --- a/php/3ros/jpgraph/jpgraph_ttf.inc.php +++ b/php/3ros/jpgraph/jpgraph_ttf.inc.php @@ -1,4 +1,5 @@ iCircGridWeight = 1; } - function _ThickCircle($aImg,$aXC,$aYC,$aRad,$aWeight=2,$aColor) { + function _ThickCircle($aImg,$aXC,$aYC,$aRad,$aWeight,$aColor) { $aImg->SetColor($aColor); $aRad *= 2 ; diff --git a/php/3ros/jpgraph/lang/de.inc.php b/php/3ros/jpgraph/lang/de.inc.php old mode 100755 new mode 100644 index 5a65cdf75f..0d9cf50535 --- a/php/3ros/jpgraph/lang/de.inc.php +++ b/php/3ros/jpgraph/lang/de.inc.php @@ -1,4 +1,5 @@ array(DEFAULT_ERROR_MESSAGE.'25132',0), 25133 => array(DEFAULT_ERROR_MESSAGE.'25133',0), 25500 => array(DEFAULT_ERROR_MESSAGE.'25500',0), -24003 => array(DEFAULT_ERROR_MESSAGE.'24003',0), -24004 => array(DEFAULT_ERROR_MESSAGE.'24004',0), +/*24003 => array(DEFAULT_ERROR_MESSAGE.'24003',0), +24004 => array(DEFAULT_ERROR_MESSAGE.'24004',0),*/ 24005 => array(DEFAULT_ERROR_MESSAGE.'24005',0), 24006 => array(DEFAULT_ERROR_MESSAGE.'24006',0), 24007 => array(DEFAULT_ERROR_MESSAGE.'24007',0), diff --git a/php/3ros/jpgraph/themes/AquaTheme.class.php b/php/3ros/jpgraph/themes/AquaTheme.class.php old mode 100755 new mode 100644 index e37312e0e6..d49e706eb5 --- a/php/3ros/jpgraph/themes/AquaTheme.class.php +++ b/php/3ros/jpgraph/themes/AquaTheme.class.php @@ -1,12 +1,12 @@ consola->mensaje(" ln -s $toba_conf /etc/apache2/sites-enabled/$nombre_toba.conf"); } $this->consola->mensaje(""); - if (in_array('toba_editor', $instancia->get_lista_proyectos_vinculados())) { - $url = $instancia->get_proyecto('toba_editor')->get_url(); - $this->consola->mensaje("Reiniciar el servicio apache e ingresar al framework navegando hacia "); - $this->consola->mensaje(""); - $this->consola->mensaje(" http://localhost$url"); - } + if (in_array('toba_editor', $instancia->get_lista_proyectos_vinculados(), true)) { + $url = $instancia->get_proyecto('toba_editor')->get_url(); + $this->consola->mensaje("Reiniciar el servicio apache e ingresar al framework navegando hacia "); + $this->consola->mensaje(""); + $this->consola->mensaje(" http://localhost$url"); + } $this->consola->mensaje(""); $this->consola->mensaje(""); } @@ -552,19 +552,24 @@ protected function definir_id_grupo_desarrollo() } - protected function definir_alias_nucleo() + protected function definir_alias_nucleo($param = array()) { - $this->consola->enter(); - $this->consola->subtitulo('Definir el nombre del ALIAS del núcleo Toba'); - $this->consola->mensaje('Este alias se utiliza para consumir todo el contenido navegable de Toba'); - $this->consola->enter(); - $resultado = $this->consola->dialogo_ingresar_texto( 'Nombre del Alias (por defecto "toba")', false ); - if ( $resultado == '' ) { - return '/toba'; - } else { - return '/'.$resultado; - } - + if (isset($param['--alias-nucleo'])) { + # si lo indicamos en linea de comando con --alias-nucleo usamos ese + $resultado = trim($param['--alias-nucleo']); + } else { + # si no lo indicamos con --alias-nucleo lo pedimos por consola + $this->consola->enter(); + $this->consola->subtitulo('Definir el nombre del ALIAS del núcleo Toba'); + $this->consola->mensaje('Este alias se utiliza para consumir todo el contenido navegable de Toba'); + $this->consola->enter(); + $resultado = $this->consola->dialogo_ingresar_texto( 'Nombre del Alias (por defecto "toba")', false ); + } + if ( $resultado == '' ) { + return '/toba'; + } else { + return '/'.$resultado; + } } protected function definir_tipo_instalacion_produccion() diff --git a/php/consola/comandos/comando_servicios_web.php b/php/consola/comandos/comando_servicios_web.php index b32da3a90e..53219df0be 100644 --- a/php/consola/comandos/comando_servicios_web.php +++ b/php/consola/comandos/comando_servicios_web.php @@ -117,6 +117,7 @@ function opcion__generar_cert() * --usuario Nombre usuario para autenticar (REST) * --usuario_pwd Password para autenticacion basica (REST) * --auth_tipo ssl|digest|basic indica el tipo de autenticacion a utilizar en el servidor (default digest) + * --version Indica el nro de version de API a consumir (Tipicamente 1.0, 2.3, etc) * --all Configura todos los WS consumibles con los mismos datos */ function opcion__cli_configurar() @@ -243,7 +244,7 @@ private function cliente_soap_configurar($parametros) private function cliente_rest_configurar($parametros) { - $url_sistema = $cert_cli = $key_cli = $cert_pwd = $usr = $usr_pwd = null; + $url_sistema = $cert_cli = $key_cli = $cert_pwd = $usr = $usr_pwd = $version_api =null; $proyecto = $this->get_proyecto(); $id_servicio = (isset($parametros['-s'])) ? $parametros['-s'] : $this->get_servicio_cli(); $servicio = toba_modelo_catalogo::get_servicio_web($proyecto, $id_servicio, $this->consola, 'rest'); @@ -274,8 +275,13 @@ private function cliente_rest_configurar($parametros) if (isset($parametros['-u']) && trim($parametros['-u']) != '') { $url_sistema = $parametros['-u']; } + + if (isset($parametros['--version']) && 1 === preg_match('/^\d\.\d$/', $parametros['--version'])) { + $version_api = $parametros['--version']; + } + //Genero la config para el servicio especificado (analizar si se pueden configurar varios distintos) - $servicio->generar_configuracion_cliente($cert_CA, $url_sistema, $cert_cli, $key_cli, $cert_pwd,$usr, $usr_pwd, $auth); + $servicio->generar_configuracion_cliente($cert_CA, $url_sistema, $cert_cli, $key_cli, $cert_pwd,$usr, $usr_pwd, $auth, $version_api); } //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// diff --git a/php/consola/comandos/comando_test.php b/php/consola/comandos/comando_test.php index e801629b36..4fb574418a 100644 --- a/php/consola/comandos/comando_test.php +++ b/php/consola/comandos/comando_test.php @@ -79,7 +79,7 @@ function opcion__automaticos() } $elegidos = $this->consola->dialogo_lista_opciones($lista, 'Seleccione el caso de test', true, null, false); foreach($klaves as $klave) { - if (! in_array($seleccionados[$klave]['id'], $elegidos)) { + if (! in_array($seleccionados[$klave]['id'], $elegidos, true)) { unset($seleccionados[$klave]); } } diff --git a/php/consola/comandos/comando_toba.php b/php/consola/comandos/comando_toba.php index 5d2094ab81..6150ccd437 100644 --- a/php/consola/comandos/comando_toba.php +++ b/php/consola/comandos/comando_toba.php @@ -34,7 +34,7 @@ function recuperar_contenido_archivo($nombre) { $resultado = ''; if (file_exists($nombre)) { - $resultado = file_get_contents($nombre); + $resultado = rtrim(file_get_contents($nombre)); } return $resultado; } diff --git a/php/consola/consola.php b/php/consola/consola.php index 3e79c1d35c..f12f229f5f 100644 --- a/php/consola/consola.php +++ b/php/consola/consola.php @@ -198,7 +198,7 @@ function dump_arbol( $arbol, $titulo ) /* * Genera la salida de una linea completando el espacio faltante del display con un caracter */ - function linea_completa( $base='', $caracter_relleno ) + function linea_completa($base='', $caracter_relleno='-') { if (self::$display_ancho > 100) { $ancho = 100; diff --git a/php/consola/lib/Table.php b/php/consola/lib/Table.php index 72ffcfebed..3e84332bbb 100644 --- a/php/consola/lib/Table.php +++ b/php/consola/lib/Table.php @@ -521,7 +521,7 @@ function _updateRowsCols($rowdata = null) function _calculateCellLengths($row) { for ($i=0; $i_cell_lengths[$i] = max(strlen(@$this->_headers[$i]), @$this->_cell_lengths[$i], strlen(@$row[$i])); + $this->_cell_lengths[$i] = max(strlen($this->_headers[$i]??''), $this->_cell_lengths[$i]??0, strlen($row[$i]??'')); } } } diff --git a/php/contrib/lib/toba_manejador_procesos.php b/php/contrib/lib/toba_manejador_procesos.php index 4dfff68f8d..e6011bbebd 100644 --- a/php/contrib/lib/toba_manejador_procesos.php +++ b/php/contrib/lib/toba_manejador_procesos.php @@ -176,24 +176,35 @@ static function buscar_pids_win($match) */ static function ejecutar($cmd, &$stdout, &$stderr) { - $outfile = tempnam(toba_dir().'/temp', "cmd"); - $errfile = tempnam(toba_dir().'/temp', "cmd"); + /*$outfile = tempnam(toba_dir().'/temp', "cmd_"); + $errfile = tempnam(toba_dir().'/temp', "cmd_"); $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("file", $outfile, "w"), 2 => array("file", $errfile, "w") - ); + );*/ + + $descriptorspec = array( + 0 => array("pipe", "r"), // STDIN + 1 => array("pipe", "w"), // STDOUT + 2 => array("pipe", "w") // STDERR + ); + $proc = proc_open($cmd, $descriptorspec, $pipes); - if (!is_resource($proc)) return 255; fclose($pipes[0]); + + $stdout = stream_get_contents($pipes[1]); + $stderr = stream_get_contents($pipes[2]); + fclose($pipes[1]); + fclose($pipes[2]); $exit = proc_close($proc); - $stdout = file_get_contents($outfile); - $stderr = file_get_contents($errfile); - unlink($outfile); - unlink($errfile); + //$stdout = file_get_contents($outfile); + //$stderr = file_get_contents($errfile); + //unlink($outfile); + //unlink($errfile); return $exit; } } diff --git a/php/contrib/lib/toba_nodo_basico.php b/php/contrib/lib/toba_nodo_basico.php index bc71c807f7..1fb30db8a1 100644 --- a/php/contrib/lib/toba_nodo_basico.php +++ b/php/contrib/lib/toba_nodo_basico.php @@ -84,12 +84,12 @@ function get_id() function get_nombre_corto() { - return $this->nombre_corto; + return $this->nombre_corto ?? ''; } function get_nombre_largo() { - return $this->nombre_largo; + return $this->nombre_largo ?? ''; } function get_info_extra() diff --git a/php/instalacion/toba_gtk_admin.php b/php/instalacion/toba_gtk_admin.php index 947ad6e518..74155b86d9 100644 --- a/php/instalacion/toba_gtk_admin.php +++ b/php/instalacion/toba_gtk_admin.php @@ -201,7 +201,7 @@ function evt__mostrar_opciones() $opciones_a_sacar = array('listar', 'registrar'); $hay_que_sacar = $objeto_cmd->tiene_definido_base(); foreach (array_keys($this->opciones) as $id) { - $existe = in_array($id, $opciones_a_sacar); + $existe = in_array($id, $opciones_a_sacar, true); if ($existe && $hay_que_sacar) { unset($this->opciones[$id]); } diff --git a/php/instalacion/toba_instalador.php b/php/instalacion/toba_instalador.php index 2df7880cc7..522b66a491 100644 --- a/php/instalacion/toba_instalador.php +++ b/php/instalacion/toba_instalador.php @@ -136,7 +136,7 @@ function instalacion_eliminar_instancias() $instancia = $this->get_instancia($id_inst); foreach ($instancia->get_lista_proyectos_vinculados() as $id_proy) { $proy_propios = array('toba_editor', 'toba_referencia', 'toba_testing', 'toba_instancia'); - if (in_array($id_proy, $proy_propios)) { + if (in_array($id_proy, $proy_propios, true)) { $instancia->get_proyecto($id_proy)->desinstalar(); } } diff --git a/php/lib/db/toba_db.php b/php/lib/db/toba_db.php index 668a4533be..14a5130efa 100644 --- a/php/lib/db/toba_db.php +++ b/php/lib/db/toba_db.php @@ -337,7 +337,9 @@ function get_semantica_valor_defecto() */ function quote($dato) { - if (! is_array($dato)) { + if (is_null($dato)) { + return 'NULL'; + } elseif (! is_array($dato)) { return $this->conexion->quote($dato); } else { $salida = array(); @@ -993,7 +995,7 @@ function get_sql_carga_tabla($tabla) //--- Es una referencia, hay que hacer joins $externo = $this->get_opciones_sql_campo_externo($columna); $alias_externo = sql_get_alias( $externo['tabla']); - if (in_array($alias_externo, $aliases)) { + if (in_array($alias_externo, $aliases, true)) { $nro_alias += 1; // EJPomares - SDN - 26/08/2010 $alias_externo .= $nro_alias; } @@ -1067,7 +1069,7 @@ function get_opciones_sql_campo_externo($campo) { $tablas_analizadas = array(); //--- Busca cual es el campo descripcion de la tabla destino - while (isset($campo['fk_tabla']) && ! in_array($campo['fk_tabla'], $tablas_analizadas)) { + while (isset($campo['fk_tabla']) && ! in_array($campo['fk_tabla'], $tablas_analizadas, true)) { $tabla = $campo['fk_tabla']; $tablas_analizadas[] = $tabla; $clave = $campo['fk_campo']; diff --git a/php/lib/db/toba_db_postgres7.php b/php/lib/db/toba_db_postgres7.php index d455ea2779..2f239a6c80 100644 --- a/php/lib/db/toba_db_postgres7.php +++ b/php/lib/db/toba_db_postgres7.php @@ -933,17 +933,17 @@ function get_lista_secuencias($esquema=null) SELECT c.relname as tabla, a.attname as campo, - replace( substring(pg_get_expr(adef.adbin, a.attrelid),'''[^'']*'''), '''', '' ) as nombre/*, - pg_get_serial_sequence(c.relname, a.attname)*/ + substring(pg_get_serial_sequence(c.relname, a.attname) , n.nspname || '\.(.*)' ) as nombre --- Elimina el nombre del schema FROM pg_catalog.pg_attribute a - LEFT JOIN pg_catalog.pg_attrdef adef ON a.attrelid=adef.adrelid AND a.attnum=adef.adnum - LEFT JOIN pg_catalog.pg_type t ON a.atttypid=t.oid - LEFT JOIN pg_catalog.pg_class c ON a.attrelid=c.oid - LEFT JOIN pg_catalog.pg_namespace as n ON c.relnamespace = n.oid + LEFT JOIN pg_catalog.pg_attrdef adef ON a.attrelid=adef.adrelid AND a.attnum=adef.adnum + LEFT JOIN pg_catalog.pg_type t ON a.atttypid=t.oid + LEFT JOIN pg_catalog.pg_class c ON a.attrelid=c.oid + LEFT JOIN pg_catalog.pg_namespace as n ON c.relnamespace = n.oid WHERE - pg_get_expr(adef.adbin, a.attrelid) like '%nextval%' - AND a.attnum > 0 AND NOT a.attisdropped + pg_get_serial_sequence(c.relname, a.attname) IS NOT NULL + AND a.attnum > 0 + AND NOT a.attisdropped $where ORDER BY a.attname; "; @@ -969,77 +969,85 @@ function get_definicion_columnas($tabla, $esquema=null) } $tabla_sana = $this->quote($tabla); //1) Busco definicion - $sql = "SELECT a.attname as nombre, - t.typname as tipo, - a.attlen as tipo_longitud, - a.atttypmod as longitud, - format_type(a.atttypid, a.atttypmod) as tipo_sql, - a.attnotnull as not_null, - a.atthasdef as tiene_predeterminado, - pg_get_expr(d.adbin, a.attrelid) valor_predeterminado, - '' as secuencia, - fc.relname as fk_tabla, - fa.attname as fk_campo, - a.attnum as orden, - c.relname as tabla, - EXISTS (SELECT - indisprimary - FROM - pg_index i INNER JOIN pg_class ic ON ic.oid = i.indexrelid AND indisprimary = TRUE - WHERE - ( a.attrelid = i.indrelid - AND (i.indkey[0] = a.attnum - OR i.indkey[1] = a.attnum - OR i.indkey[2] = a.attnum - OR i.indkey[3] = a.attnum - OR i.indkey[4] = a.attnum - OR i.indkey[5] = a.attnum - OR i.indkey[6] = a.attnum - OR i.indkey[7] = a.attnum) - ) - ) as pk, - EXISTS (SELECT - indisunique - FROM - pg_index i INNER JOIN pg_class ic ON ic.oid = i.indexrelid AND indisunique = TRUE - WHERE - ( a.attrelid = i.indrelid - AND (i.indkey[0] = a.attnum - OR i.indkey[1] = a.attnum - OR i.indkey[2] = a.attnum - OR i.indkey[3] = a.attnum - OR i.indkey[4] = a.attnum - OR i.indkey[5] = a.attnum - OR i.indkey[6] = a.attnum - OR i.indkey[7] = a.attnum) - ) - ) as uk - FROM pg_class c, - pg_type t, - pg_namespace as n, - pg_attribute a - LEFT OUTER JOIN pg_attrdef d - ON ( d.adrelid = a.attrelid AND d.adnum = a.attnum) - --- Foreign Keys - LEFT OUTER JOIN (pg_constraint const - INNER JOIN pg_class fc ON fc.oid = const.confrelid - INNER JOIN pg_attribute fa ON (fa.attrelid = const.confrelid AND fa.attnum = const.confkey[1] - AND const.confkey[2] IS NULL) - ) - ON (const.conrelid = a.attrelid - AND const.contype='f' - AND const.conkey[1] = a.attnum - ) - WHERE - c.relkind in ('r','v') - AND c.relname=$tabla_sana - AND a.attname not like '....%%' - AND a.attnum > 0 - AND a.atttypid = t.oid - AND a.attrelid = c.oid - AND c.relnamespace = n.oid - $where - ORDER BY a.attnum;"; + $sql = + "SELECT a.attname as nombre, + t.typname as tipo, + a.attlen as tipo_longitud, + a.atttypmod as longitud, + format_type(a.atttypid, a.atttypmod) as tipo_sql, + a.attnotnull as not_null, + CASE + WHEN a.attidentity IN ('a', 'd') THEN true + ELSE a.atthasdef + END AS tiene_predeterminado, + pg_get_expr(d.adbin, a.attrelid) as valor_predeterminado, + substring(pg_get_serial_sequence( n.nspname || '.' || c.relname, a.attname), n.nspname || '\.(.*)' ) as secuencia, --- Fuerza el schema para poder consultar desde cualquier lugar, luego lo retira por legibilidad + fc.relname as fk_tabla, + fa.attname as fk_campo, + a.attnum as orden, + c.relname as tabla, + EXISTS (SELECT + indisprimary + FROM + pg_index i + INNER JOIN pg_class ic ON ic.oid = i.indexrelid AND indisprimary = TRUE + WHERE + ( a.attrelid = i.indrelid + AND (i.indkey[0] = a.attnum + OR i.indkey[1] = a.attnum + OR i.indkey[2] = a.attnum + OR i.indkey[3] = a.attnum + OR i.indkey[4] = a.attnum + OR i.indkey[5] = a.attnum + OR i.indkey[6] = a.attnum + OR i.indkey[7] = a.attnum) + ) + ) as pk, + EXISTS (SELECT + indisunique + FROM + pg_index i + INNER JOIN pg_class ic ON ic.oid = i.indexrelid AND indisunique = TRUE + WHERE + ( a.attrelid = i.indrelid + AND (i.indkey[0] = a.attnum + OR i.indkey[1] = a.attnum + OR i.indkey[2] = a.attnum + OR i.indkey[3] = a.attnum + OR i.indkey[4] = a.attnum + OR i.indkey[5] = a.attnum + OR i.indkey[6] = a.attnum + OR i.indkey[7] = a.attnum) + ) + ) as uk + FROM pg_class c, + pg_type t, + pg_namespace as n, + pg_attribute a + LEFT OUTER JOIN pg_attrdef d + ON ( d.adrelid = a.attrelid AND d.adnum = a.attnum) + --- Foreign Keys + LEFT OUTER JOIN ( + pg_constraint const + INNER JOIN pg_class fc ON fc.oid = const.confrelid + INNER JOIN pg_attribute fa ON (fa.attrelid = const.confrelid + AND fa.attnum = const.confkey[1] + AND const.confkey[2] IS NULL) + ) + ON (const.conrelid = a.attrelid + AND const.contype='f' + AND const.conkey[1] = a.attnum + ) + WHERE + c.relkind in ('r','v') + AND c.relname=$tabla_sana + AND a.attname not like '....%%' + AND a.attnum > 0 + AND a.atttypid = t.oid + AND a.attrelid = c.oid + AND c.relnamespace = n.oid + $where + ORDER BY a.attnum;"; $columnas = $this->consultar($sql); if(!$columnas){ @@ -1071,13 +1079,6 @@ function get_definicion_columnas($tabla, $esquema=null) if ($columnas[$id]['tipo'] == 'numeric') { $columnas[$id]['longitud'] = -1; } - //Secuencias - if($columnas[$id]['tiene_predeterminado']){ - $match = array(); - if(preg_match("&nextval.*?(\'|\")(.*?[.]|)(.*)(\'|\")&",$columnas[$id]['valor_predeterminado'],$match)){ - $columnas[$id]['secuencia'] = $match[3]; - } - } } $this->cache_metadatos[$tabla] = array_values($columnas); return $this->cache_metadatos[$tabla]; diff --git a/php/lib/db/toba_parser_error_db_postgres7.php b/php/lib/db/toba_parser_error_db_postgres7.php index ab1ac8b60a..4f587a0579 100644 --- a/php/lib/db/toba_parser_error_db_postgres7.php +++ b/php/lib/db/toba_parser_error_db_postgres7.php @@ -53,7 +53,7 @@ function parsear($sql, $sqlstate, $mensaje) $mensaje = str_replace("\n", '', $mensaje); $metodos = reflexion_buscar_metodos($this, 'parsear_sqlstate_'); $metodo = "parsear_sqlstate_$sqlstate"; - if (in_array($metodo, $metodos)) { + if (in_array($metodo, $metodos,true)) { return $this->$metodo($accion, $sql, $mensaje); } } @@ -89,7 +89,7 @@ function get_comentario_campos($tabla, $posiciones=null) $rs = $db->consultar($sql); $salida = array(); foreach ($rs as $campo) { - if (! isset($posiciones) || in_array($campo['orden'], $posiciones)) { + if (! isset($posiciones) || in_array($campo['orden'], $posiciones, true)) { if (isset($campo['com_campo'])) { $salida[$campo['campo']] = $campo['com_campo']; } elseif ($this->mostrar_nombres_campos) { diff --git a/php/lib/puntos_montaje/toba_punto_montaje.php b/php/lib/puntos_montaje/toba_punto_montaje.php index 34663f25c6..2e68aaa525 100644 --- a/php/lib/puntos_montaje/toba_punto_montaje.php +++ b/php/lib/puntos_montaje/toba_punto_montaje.php @@ -167,12 +167,13 @@ function get_path() if (empty($this->path)) { $datos = toba::config()->get_subseccion('instancia', $this->get_proyecto()); $nombre = toba_modelo_pms::prefijo_ini.$this->get_etiqueta(); + $path_instancia_ini = '';//$this->instancia_toba()->get_path_ini(); if (!isset($datos[$nombre])) { toba_logger::instancia()->error("Punto de montaje: el punto de montaje '{$this->get_etiqueta()}' no existe en $path_instancia_ini. Debe agregar en instancia.ini la entrada 'pm_{$this->get_etiqueta()} = path' donde path es la ubicación absoluta en el sistema de archivos. Esta entrada debe ir en la sección [{$this->get_proyecto()}]"); - throw new toba_error('Punto de montaje: el punto de montaje no existe en la configuracion. Revise el log'); + throw new toba_error('Punto de montaje: el punto de montaje no existe en la configuración. Revise el log'); } $this->path = $datos[$nombre]; } diff --git a/php/lib/reflexion/toba_archivo_php.php b/php/lib/reflexion/toba_archivo_php.php old mode 100644 new mode 100755 index e42a2dadc7..e22e08b03c --- a/php/lib/reflexion/toba_archivo_php.php +++ b/php/lib/reflexion/toba_archivo_php.php @@ -70,7 +70,8 @@ function contiene_codigo_php() */ function contiene_clase($nombre) { - return self::codigo_tiene_clase(file_get_contents($this->nombre), $nombre); + $contenido = file_get_contents($this->nombre); + return (false !== $contenido) ? self::codigo_tiene_clase($contenido, $nombre): false; } /** @@ -79,7 +80,8 @@ function contiene_clase($nombre) */ function contiene_metodo($nombre) { - return self::codigo_tiene_metodo(file_get_contents($this->nombre), $nombre); + $contenido = file_get_contents($this->nombre); + return (false !== $contenido) ? self::codigo_tiene_metodo($contenido, $nombre): false; } @@ -98,12 +100,13 @@ function get_codigo() */ function mostrar() { - $h = new PHP_Highlight(false); + /*$h = new PHP_Highlight(false); $h->loadFile($this->nombre); $formato_linea = "". "%2d  "; - $h->toHtml(false, true, $formato_linea, true); + $h->toHtml(false, true, $formato_linea, true);*/ + throw new Exception('Tiene que usar highlight.js'); } /** @@ -251,7 +254,7 @@ function insertar($codigo) /** * Dado un codigo PHP, extrae un metodo y los sustituye por codigo nuevo */ - static function reemplazar_metodo($codigo, $nombre_metodo_a_extraer, $codigo_a_insertar) + static function reemplazar_metodo(String $codigo, String $nombre_metodo_a_extraer, String $codigo_a_insertar) { $contenido = explode("\n",$codigo); $codigo_a_insertar = explode("\n", $codigo_a_insertar); @@ -292,7 +295,7 @@ static function reemplazar_metodo($codigo, $nombre_metodo_a_extraer, $codigo_a_i /** * Retorna el cuerpo de un método */ - static function codigo_get_metodo($codigo, $nombre_metodo_a_extraer) + static function codigo_get_metodo(String $codigo, $nombre_metodo_a_extraer) { $contenido = explode("\n",$codigo); $encontrado = false; @@ -334,15 +337,15 @@ static function codigo_get_metodo($codigo, $nombre_metodo_a_extraer) /** * Determina si una porción de código tiene un método específico */ - static function codigo_tiene_metodo($codigo, $nombre) + static function codigo_tiene_metodo(String $codigo, String $nombre) { - return preg_match("/function\s+$nombre\s*\(/", $codigo); + return preg_match("/function\s+$nombre\s*\(/", $codigo); } /** * Determina si una porción de código tiene un método específico */ - static function codigo_tiene_metodo_js($codigo, $nombre) + static function codigo_tiene_metodo_js(String $codigo, String $nombre) { return preg_match("/\.$nombre = function\s*\(/", $codigo); } @@ -350,7 +353,7 @@ static function codigo_tiene_metodo_js($codigo, $nombre) /** * Determina si una porción de código tiene un método específico */ - static function codigo_tiene_codigo($actual, $codigo) + static function codigo_tiene_codigo(String $actual, String $codigo) { return strpos($actual, $codigo) !== false; } @@ -358,15 +361,15 @@ static function codigo_tiene_codigo($actual, $codigo) /** * Determina si una porción de código tiene una clase específica definida */ - static function codigo_tiene_clase($codigo, $nombre) + static function codigo_tiene_clase(String $codigo, String $nombre) { - return preg_match("/class\s+$nombre/", $codigo); + return preg_match("/class\s+$nombre/", $codigo??''); } /** * Retorna los métodos definidos en una porción de código */ - static function codigo_get_nombre_metodos($codigo, $solo_publicos=true) + static function codigo_get_nombre_metodos(String $codigo, $solo_publicos=true) { $no_publicos = ''; if ($solo_publicos) { @@ -389,7 +392,7 @@ static function codigo_get_nombre_metodos($codigo, $solo_publicos=true) /** * Toma una porción de código y agrega un nuevo método */ - static function codigo_agregar_metodo($codigo_actual, $metodo) + static function codigo_agregar_metodo(String $codigo_actual, String $metodo) { $pos = strrpos($codigo_actual, '}'); if ($pos !== false) { @@ -401,7 +404,7 @@ static function codigo_agregar_metodo($codigo_actual, $metodo) } - static function codigo_quitar_identacion($codigo, $identacion=1) + static function codigo_quitar_identacion(String $codigo, $identacion=1) { $salida = array(); foreach(explode("\n", $codigo) as $linea) { @@ -424,7 +427,7 @@ static function codigo_quitar_identacion($codigo, $identacion=1) /** * Toma una porción de código y le quita los tags php si los tiene */ - static function codigo_sacar_tags_php($codigo) + static function codigo_sacar_tags_php(String $codigo) { $codigo = str_replace('', '', $codigo)); @@ -433,11 +436,11 @@ static function codigo_sacar_tags_php($codigo) static function convertir_formato_interno($nombre_archivo) { $codigo = file_get_contents($nombre_archivo); - $codigo_interno = str_replace("\r\n", "\n", $codigo); + $codigo_interno = (false !== $codigo) ? str_replace("\r\n", "\n", $codigo): ''; return $codigo_interno; } - static function convertir_formato_so($contenido_archivo) + static function convertir_formato_so(String $contenido_archivo) { return str_replace("\n", PHP_EOL, $contenido_archivo); } diff --git a/php/lib/toba_config.php b/php/lib/toba_config.php index ee0b5e4179..60b280bf35 100644 --- a/php/lib/toba_config.php +++ b/php/lib/toba_config.php @@ -20,7 +20,7 @@ function __construct() /** * Dispara la carga de las configuraciones desde archivos */ - function load() + function load(): void { $this->reset(); $this->load_basics(); @@ -34,7 +34,7 @@ function load() * @param string $index * @param path $file */ - function add_config_file($index, $file) + function add_config_file($index, $file): void { if (file_exists($file)) { $this->config_files[$index] = realpath($file); @@ -44,7 +44,7 @@ function add_config_file($index, $file) /** * Resetea los valores de configuración cargados */ - function reset() + function reset(): void { if (isset($this->config_values) && ! empty($this->config_values)) { unset($this->config_values); @@ -59,8 +59,12 @@ function reset() * @param string $parametro * @return mixed */ - function get_parametro($seccion=null, $subseccion=null, $parametro) + function get_parametro($seccion=null, $subseccion=null, $parametro=null) { + if (is_null($parametro)) { + return null; //Ataja caso de parametro no especificado, no deberia ser null por definicion + } + if (is_null($seccion)) { $seccion = 'general'; } @@ -103,7 +107,7 @@ function get_seccion($seccion) * @param string $parametro * @return boolean */ - function existe_valor($seccion=null, $subseccion=null, $parametro) + function existe_valor($seccion=null, $subseccion=null, $parametro=null): bool { return $this->get_parametro($seccion, $subseccion, $parametro) != null; } @@ -113,7 +117,7 @@ function existe_valor($seccion=null, $subseccion=null, $parametro) /** * Carga los archivos basicos de configuración de Toba */ - protected function load_basics() + protected function load_basics(): void { $dir_start = toba_nucleo::toba_instalacion_dir(); //Reemplaza a toba::instalacion()->get_path_carpeta_instalacion() para no tener un ciclo que deja mal parada la config de instalacion foreach($this->basic_files as $index => $ini) { @@ -140,7 +144,7 @@ protected function load_basics() /** * Carga los archivos de configuración que se agregaron explicitamente */ - protected function load_manual_config() + protected function load_manual_config(): void { foreach($this->config_files as $index => $ini) { if (file_exists($ini)) { @@ -155,7 +159,7 @@ protected function load_manual_config() * @param sting $index * @param mixed $value_pairs */ - protected function add_config($index, $value_pairs) + protected function add_config($index, $value_pairs): void { if (false !== $value_pairs) { foreach($value_pairs as $key => $valores) { @@ -169,7 +173,7 @@ protected function add_config($index, $value_pairs) * @param array $arreglo * @return array */ - protected function parse_array_values($arreglo) + protected function parse_array_values($arreglo): mixed { $datos = array(); if (! is_array($arreglo)) { @@ -187,7 +191,7 @@ protected function parse_array_values($arreglo) * @param string $filename * @return string */ - protected function parse_file_content($filename) + protected function parse_file_content($filename): string { $content = file_get_contents($filename); $final = preg_replace_callback(self::$pattern_gral, diff --git a/php/lib/toba_extractor_clases.php b/php/lib/toba_extractor_clases.php index b569f19d18..06f0fbb5b8 100644 --- a/php/lib/toba_extractor_clases.php +++ b/php/lib/toba_extractor_clases.php @@ -139,7 +139,7 @@ protected function generar_arreglo($path_montaje, &$archivos, $extras = array()) continue; } //Si extiende de alguna clase y esta estaba excluida, lo ignoro tambien - if (null !== $nodo->extends && \is_object($nodo->extends) && \in_array($nodo->extends->parts, $this->extends_excluidos)) { + if (null !== $nodo->extends && \is_object($nodo->extends) && \in_array($nodo->extends->parts, $this->extends_excluidos, true)) { continue; } diff --git a/php/lib/toba_manejador_archivos.php b/php/lib/toba_manejador_archivos.php index 89e8dde26e..2089f0b3ba 100644 --- a/php/lib/toba_manejador_archivos.php +++ b/php/lib/toba_manejador_archivos.php @@ -20,7 +20,7 @@ static function crear_arbol_directorios($path, $modo=0777) $path = self::path_a_windows($path, false); } if (!file_exists($path)) { - if (!mkdir($path, $modo, true)) { + if (! mkdir($path, $modo, true)) { toba_logger::instancia()->error("No es posible crear el directorio $path, verifique que el usuario de Apache posea privilegios de escritura sobre este directorio"); throw new toba_error('No es posible crear el directorio solicitado, verifique que el usuario de Apache posea privilegios de escritura sobre este directorio'); } @@ -146,10 +146,10 @@ static function get_archivos_directorio( $directorio, $patron = null, $recursivo $archivos_ok = array(); if( ! is_dir( $directorio ) ) { toba_logger::instancia()->error("BUSCAR ARCHIVOS: El directorio '$directorio' es INVALIDO"); - throw new toba_error('BUSCAR ARCHIVOS: El directorio solicitado no es valido o no tiene permisos'); + throw new toba_error('BUSCAR ARCHIVOS: El directorio solicitado no es válido o no tiene permisos'); } - if (in_array($directorio, $exclude_dirs)) { + if (in_array($directorio, $exclude_dirs, true)) { return $archivos_ok; } @@ -190,12 +190,12 @@ static function buscar_archivos_directorio_recursivo( $directorio, &$exclude_dir { if( ! is_dir( $directorio ) ) { toba_logger::instancia()->error("BUSCAR ARCHIVOS: El directorio '$directorio' es INVALIDO"); - throw new toba_error('BUSCAR ARCHIVOS: El directorio solicitado no es valido o no tiene permisos'); + throw new toba_error('BUSCAR ARCHIVOS: El directorio solicitado no es válido o no tiene permisos'); } $archivos = array(); $d = dir( $directorio ); - if (in_array($directorio, $exclude_dirs)) { + if (in_array($directorio, $exclude_dirs, true)) { return $archivos; } @@ -224,7 +224,7 @@ static function get_subdirectorios( $directorio ) $dirs = array(); if( ! is_dir( $directorio ) ) { toba_logger::instancia()->error("BUSCAR SUBDIRECTORIOS: El directorio '$directorio' es INVALIDO"); - throw new toba_error('BUSCAR SUBDIRECTORIOS: El directorio solicitado no es valido o no tiene permisos'); + throw new toba_error('BUSCAR SUBDIRECTORIOS: El directorio solicitado no es válido o no tiene permisos'); } $dir = opendir($directorio); if ($dir !== false) { @@ -256,7 +256,7 @@ static function copiar_directorio( $origen, $destino, $excepciones=array(), $man { if( ! is_dir( $origen ) ) { toba_logger::instancia()->error("COPIAR DIRECTORIO: El directorio de origen '$origen' es INVALIDO"); - throw new toba_error('COPIAR DIRECTORIO: El directorio de origen no es valido o no tiene permisos'); + throw new toba_error('COPIAR DIRECTORIO: El directorio de origen no es válido o no tiene permisos'); } $ok = true; if( ! is_dir( $destino ) ) { @@ -278,7 +278,7 @@ static function copiar_directorio( $origen, $destino, $excepciones=array(), $man $x_origen = $origen . '/' . $archivo; $x_destino = $destino . '/' . $archivo; //Evito excepciones - if (! in_array($x_origen, $excepciones) && ($copiar_ocultos || substr($archivo, 0, 1) != '.')) { + if (! in_array($x_origen, $excepciones, true) && ($copiar_ocultos || substr($archivo, 0, 1) != '.')) { if ( is_dir( $x_origen )) { if (isset($manejador_interface)) { $manejador_interface->progreso_avanzar(); @@ -302,7 +302,7 @@ static function eliminar_directorio( $directorio ) { if( ! is_dir( $directorio ) ) { toba_logger::instancia()->error("ELIMINAR DIRECTORIO: El directorio '$directorio' es INVALIDO"); - throw new toba_error('ELIMINAR DIRECTORIO: El directorio solicitado no es valido o no tiene permisos'); + throw new toba_error('ELIMINAR DIRECTORIO: El directorio solicitado no es válido o no tiene permisos'); } $ok = true; $dir = opendir( $directorio ); diff --git a/php/lib/toba_sql.php b/php/lib/toba_sql.php index 4431b5f6e6..0fabf636dc 100644 --- a/php/lib/toba_sql.php +++ b/php/lib/toba_sql.php @@ -72,9 +72,9 @@ function sql_concatenar_where($sql,$clausulas_where=array(), $comentario='') } } } - //Llego al final sin encontrar naad + //Llego al final sin encontrar nada if(!isset($punto_insercion)){ - if(in_array(';',$separadores)){ + if(in_array(';',$separadores, true)){ $punto_insercion = count($palabras)-2; } else { $punto_insercion = count($palabras)-1; diff --git a/php/lib/toba_svn.php b/php/lib/toba_svn.php index d821f67f84..d8014c49c3 100644 --- a/php/lib/toba_svn.php +++ b/php/lib/toba_svn.php @@ -68,7 +68,7 @@ protected function ejecutar($cmd, $no_interactivo=true, $critico=true, $loguear= } if ($critico && $this->error != '') { toba_logger::instancia()->error($this->error); - throw new toba_error('Error critico durante el proceso, revise el log'); + throw new toba_error('Error crítico durante el proceso, revise el log'); } return $this->progreso; } diff --git a/php/lib/toba_varios.php b/php/lib/toba_varios.php index c111a57846..d61a010a42 100644 --- a/php/lib/toba_varios.php +++ b/php/lib/toba_varios.php @@ -142,7 +142,7 @@ function array_dejar_llaves($arreglo, $llaves) { $nuevo = array(); foreach ($arreglo as $clave => $valor) { - if (in_array($clave, $llaves)) { + if (in_array($clave, $llaves, true)) { $nuevo[$clave] = $valor; } } @@ -343,7 +343,7 @@ function tecla_acceso($etiqueta) // Ej: Proce&sar retornar array('Procesar', 'P') { $escapador = toba::escaper(); - $pos_guia = strpos($etiqueta, '&'); + $pos_guia = (null !== $etiqueta) ? strpos($etiqueta, '&'): false; if ($pos_guia === false || ($pos_guia == strlen($etiqueta) - 1)) { $nueva_etiqueta = $escapador->escapeHtmlAttr($etiqueta); $tecla = null; diff --git a/php/modelo/aplicacion/toba_aplicacion_comando_base.php b/php/modelo/aplicacion/toba_aplicacion_comando_base.php index 3684aea11e..02ff1b4314 100644 --- a/php/modelo/aplicacion/toba_aplicacion_comando_base.php +++ b/php/modelo/aplicacion/toba_aplicacion_comando_base.php @@ -110,18 +110,25 @@ function opcion__migrar_auditoria_3_1() $this->modelo->crear_auditoria(); //Regenero los triggers y SPs } + /** + * Hace compatible la estructura del esquema con los cambios en la version 3.4.0 + * @consola_separador 1 + */ + function opcion__migrar_auditoria_3_4() + { + $this->modelo->migrar_auditoria_3_4(); //Modifico la estructura de los triggers + } + /** * Arma archivo JSON con las personas y cuentas para importar en arai-usuarios - * - * @param array $parametros - * array( - * '-d' => $this->get_instalacion()->get_dir() . '/usersExportFiles/', - * '-f' => 'usuarios_' . date('YmdHis'), - * '-m' => 'toba', - * '-e' => 'toba@siu.edu.ar', + * @consola_parametros + * '-d' => Directorio de exportacion (default: $this->get_instalacion()->get_dir() . '/usersExportFiles/') + * '-f' => Nombre archivo exportacion (default: 'usuarios_' . date('YmdHis') ) + * '-m' => Identificador del mantainer de los datos (default: 'toba') + * '-e' => Mail del mantainer de los datos(default: 'toba@siu.edu.ar') * '--mascara' => ", " O una combinacion de patron similar * '--excluir-bloqueados' para indicar que no se quieren las cuentas bloqueadas - * ) + * @consola_separador 1 * @throws Exception */ function opcion__exportar_usuarios_arai($parametros) diff --git a/php/modelo/aplicacion/toba_aplicacion_modelo_base.php b/php/modelo/aplicacion/toba_aplicacion_modelo_base.php index 08ce59603f..60c138669f 100644 --- a/php/modelo/aplicacion/toba_aplicacion_modelo_base.php +++ b/php/modelo/aplicacion/toba_aplicacion_modelo_base.php @@ -367,8 +367,16 @@ function crear_auditoria($tablas=array(), $prefijo_tablas=null, $con_transaccion //Recorro los schemas de las fuentes del proyecto $schemas = array(); foreach($fuentes as $id_fuente) { - $schemas[$id_fuente] = aplanar_matriz(toba_info_editores::get_schemas_fuente($this->proyecto->get_id(), $id_fuente), 'schema'); - } + $lista_metadatos = toba_info_editores::get_schemas_fuente($this->proyecto->get_id(), $id_fuente); + if (! empty($lista_metadatos)) { + $schemas[$id_fuente] = aplanar_matriz($lista_metadatos, 'schema'); + } else { //Si la fuente no tiene schemas fijos en metadatos pero si configurado en bases.ini + $info_bases_ini = $this->proyecto->get_parametros_db_negocio(); + if (! empty($info_bases_ini)) { + $schemas[$id_fuente] = ['schema' => $info_bases_ini['schema']]; + } + } + } if (! is_null($fuente) && !empty($lista_schemas)) { $aux = array_intersect($schemas[$fuente], $lista_schemas); @@ -507,6 +515,13 @@ function migrar_auditoria_3_1($tablas=array(), $prefijo_tablas=null) $auditoria->migrar_estructura_campos_toba_3_1(); } + function migrar_auditoria_3_4($tablas=array(), $prefijo_tablas=null) + { + $auditoria = $this->preparar_migracion_estructura($tablas, $prefijo_tablas); + $auditoria->desactivar(); + $auditoria->migrar(); + } + /** * Ejecuta los scripts de migración entre dos versiones específicas del sistema * @param toba_version $desde diff --git a/php/modelo/asistentes/toba_asistente.php b/php/modelo/asistentes/toba_asistente.php index 55fe189cf0..ab62a962ef 100644 --- a/php/modelo/asistentes/toba_asistente.php +++ b/php/modelo/asistentes/toba_asistente.php @@ -233,8 +233,8 @@ function consultar_opcion_generacion($opcion) if (isset($this->retorno_opciones_generacion[$opcion])) { return $this->retorno_opciones_generacion[$opcion]; } else { - toba_logger::instancia()->error("ASISTENTE: La opcion de generacion '$opcion' no existe!"); - throw new toba_error_asistentes('ASISTENTE: La opcion indicada no existe!'); + toba_logger::instancia()->error("ASISTENTE: La opción de generacion '$opcion' no existe!"); + throw new toba_error_asistentes('ASISTENTE: La opción indicada no existe!'); } } diff --git a/php/modelo/asistentes/toba_asistente_abms.php b/php/modelo/asistentes/toba_asistente_abms.php index a410f5a193..dd4dcc267e 100644 --- a/php/modelo/asistentes/toba_asistente_abms.php +++ b/php/modelo/asistentes/toba_asistente_abms.php @@ -240,7 +240,7 @@ protected function generar_cuadro($cuadro) { //Cabecera $cuadro->set_nombre($this->molde['nombre'] . ' - Cuadro.'); - if (trim($this->molde_abms['cuadro_eof']) != '') { + if (isset($this->molde_abms['cuadro_eof']) && trim($this->molde_abms['cuadro_eof']) != '') { $cuadro->set_eof(trim($this->molde_abms['cuadro_eof'])); } else { $cuadro->set_eof_invisible(); diff --git a/php/modelo/ddl/pgsql_a02_tablas_usuario.sql b/php/modelo/ddl/pgsql_a02_tablas_usuario.sql index e711758462..0b831b3e63 100644 --- a/php/modelo/ddl/pgsql_a02_tablas_usuario.sql +++ b/php/modelo/ddl/pgsql_a02_tablas_usuario.sql @@ -57,9 +57,11 @@ CREATE TABLE apex_usuario dias smallint NULL, hora_entrada time without time zone NULL, hora_salida time without time zone NULL, - ip_permitida varchar(20) NULL, - forzar_cambio_pwd SMALLINT NOT NULL DEFAULT 0, - requiere_segundo_factor SMALLINT NOT NULL DEFAULT 0, + ip_permitida varchar(20) NULL, + forzar_cambio_pwd SMALLINT NOT NULL DEFAULT 0, + requiere_segundo_factor SMALLINT NOT NULL DEFAULT 0, + uid VARCHAR(36) DEFAULT NULL, + p_uid TEXT DEFAULT NULL, CONSTRAINT "apex_usuario_pk" PRIMARY KEY ("usuario"), --CONSTRAINT "apex_usuario_fk_sol_ot" FOREIGN KEY ("solicitud_obs_tipo_proyecto","solicitud_obs_tipo") REFERENCES "apex_solicitud_obs_tipo" ("proyecto","solicitud_obs_tipo") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT "apex_usuario_fk_tipodoc" FOREIGN KEY ("usuario_tipodoc") REFERENCES "apex_usuario_tipodoc" ("usuario_tipodoc") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY IMMEDIATE diff --git a/php/modelo/ddl/pgsql_a04_tablas_log_instancia.sql b/php/modelo/ddl/pgsql_a04_tablas_log_instancia.sql index c7deecc74d..96b5f788a8 100644 --- a/php/modelo/ddl/pgsql_a04_tablas_log_instancia.sql +++ b/php/modelo/ddl/pgsql_a04_tablas_log_instancia.sql @@ -53,7 +53,7 @@ CREATE TABLE apex_sesion_browser egreso timestamp(0) without time zone NULL, observaciones TEXT NULL, php_id TEXT NOT NULL, - ip varchar(20) NULL, + ip TEXT NULL, punto_acceso varchar(80) NULL, CONSTRAINT "apex_ses_brw_pk" PRIMARY KEY ("sesion_browser", "proyecto") --CONSTRAINT "apex_log_sol_fk_proy" FOREIGN KEY ("proyecto") REFERENCES "apex_proyecto" ("proyecto") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY IMMEDIATE @@ -74,7 +74,7 @@ CREATE TABLE apex_solicitud_browser sesion_browser int8 NOT NULL, solicitud_proyecto varchar(15) NULL, -- NOT! solicitud_browser int8 NOT NULL, - ip varchar(20) NULL, + ip TEXT NULL, CONSTRAINT "apex_sol_brw_pk" PRIMARY KEY ("solicitud_proyecto", "solicitud_browser"), CONSTRAINT "apex_sol_brw_fk_sol" FOREIGN KEY ("solicitud_browser", "solicitud_proyecto") REFERENCES "apex_solicitud" ("solicitud", "proyecto") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT "apex_sol_brw_fk_sesion" FOREIGN KEY ("sesion_browser","proyecto") REFERENCES "apex_sesion_browser" ("sesion_browser","proyecto") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY IMMEDIATE @@ -95,7 +95,7 @@ CREATE TABLE apex_solicitud_consola proyecto varchar(15) NULL, -- NOT! solicitud_consola int8 NOT NULL, usuario varchar(60) NOT NULL, - ip varchar(20) NULL, + ip TEXT NULL, llamada TEXT NULL, entorno text NULL, CONSTRAINT "apex_sol_consola_pk" PRIMARY KEY ("solicitud_consola", "proyecto"), @@ -211,7 +211,7 @@ CREATE TABLE apex_log_ip_rechazada --: version: 1.0 --------------------------------------------------------------------------------------------------- ( - ip varchar(255) NOT NULL, + ip TEXT NOT NULL, momento timestamp(0) without time zone DEFAULT current_timestamp NOT NULL, CONSTRAINT "apex_ip_rechazada_pk" PRIMARY KEY ("ip") ); @@ -282,9 +282,9 @@ CREATE TABLE apex_solicitud_web_service --------------------------------------------------------------------------------------------------- ( proyecto VARCHAR(15) NOT NULL, - solicitud BIGINT NOT NULL, + solicitud BIGINT NOT NULL, metodo TEXT NULL, - ip VARCHAR(20) NULL, + ip TEXT NULL, CONSTRAINT "apex_solicitud_web_service_pk" PRIMARY KEY ("solicitud","proyecto" ), CONSTRAINT "apex_sol_web_service_solicitud_fk" FOREIGN KEY ("solicitud","proyecto" ) REFERENCES "apex_solicitud" ( "solicitud","proyecto") ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE ); \ No newline at end of file diff --git a/php/modelo/estructura_db/toba_db_tablas_instancia.php b/php/modelo/estructura_db/toba_db_tablas_instancia.php index 4eaa28de25..25cc3adc31 100644 --- a/php/modelo/estructura_db/toba_db_tablas_instancia.php +++ b/php/modelo/estructura_db/toba_db_tablas_instancia.php @@ -192,6 +192,8 @@ static function apex_usuario() 22 => 'ip_permitida', 23 => 'forzar_cambio_pwd', 24 => 'requiere_segundo_factor', + 25 => 'uid', + 26 => 'p_uid', ), ); } diff --git a/php/modelo/info/componentes/toba_ap_relacion_db_info.php b/php/modelo/info/componentes/toba_ap_relacion_db_info.php index 2f244f0be4..c85c93721b 100644 --- a/php/modelo/info/componentes/toba_ap_relacion_db_info.php +++ b/php/modelo/info/componentes/toba_ap_relacion_db_info.php @@ -1,26 +1,26 @@ -datos = $datos; - } - - function get_nombre_instancia_abreviado() - { - return "dr_ap"; - } - - function set_subclase($nombre, $archivo, $pm) - { - $db = toba_contexto_info::get_db(); - $nombre = $db->quote($nombre); - $archivo = $db->quote($archivo); - $pm = $db->quote($pm); - $sql = " +datos = $datos; + } + + public function get_nombre_instancia_abreviado() + { + return "dr_ap"; + } + + public function set_subclase($nombre, $archivo, $pm) + { + $db = toba_contexto_info::get_db(); + $nombre = $db->quote($nombre); + $archivo = $db->quote($archivo); + $pm = $db->quote($pm); + $sql = " UPDATE apex_objeto_datos_rel SET ap = 3, @@ -30,97 +30,96 @@ function set_subclase($nombre, $archivo, $pm) WHERE proyecto = '{$this->datos['proyecto']}' AND objeto = '{$this->datos['objeto']}' - "; - toba::logger()->debug($sql); - $db->ejecutar($sql); - } - - //--------------------------------------------------------------------- - //-- METACLASE - //--------------------------------------------------------------------- - - function get_molde_subclase() - { - $molde = new toba_codigo_clase($this->get_subclase_nombre(), $this->get_clase_nombre()); - - //-- Ini - $doc = 'Se ejecuta al inicio de todos los request en donde participa el componente'; - $metodo = new toba_codigo_metodo_php('ini', array(), array($doc)); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - //-- Pre Sinc - $doc = "Ventana para incluír validaciones (disparar una excepcion) o disparar procesos previo a sincronizar"; - $comentarios = array( - $doc, - "La transacción con la bd ya fue iniciada (si es que hay)" - ); - $metodo = new toba_codigo_metodo_php('evt__pre_sincronizacion', array(), $comentarios); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - //-- Post Sinc - $doc = "Ventana para incluír validaciones (disparar una excepcion) o disparar procesos posteriores a la sincronización"; - $comentarios = array( - $doc, - "La transacción con la bd aún no fue terminada (si es que hay)" - ); - $metodo = new toba_codigo_metodo_php('evt__post_sincronizacion', array(), $comentarios); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - //-- Pre Elim - $doc = "Ventana para incluír validaciones (disparar una excepcion) o disparar procesos previo a la eliminación"; - $comentarios = array( - $doc, - "La transacción con la bd ya fue iniciada (si es que hay)" - ); - $metodo = new toba_codigo_metodo_php('evt__pre_eliminacion', array(), $comentarios); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - //-- Post Elim - $doc = "Ventana para incluír validaciones (disparar una excepcion) o disparar procesos posteriores a la eliminación"; - $comentarios = array( - $doc, - "La transacción con la bd ya fue iniciada (si es que hay)" - ); - $metodo = new toba_codigo_metodo_php('evt__post_eliminacion', array(), $comentarios); - $metodo->set_doc($doc); - $molde->agregar($metodo); - return $molde; - } - - function get_clase_nombre() - { - return 'toba_ap_relacion_db'; - } - - function get_clase_archivo() - { - return 'nucleo/componentes/persistencia/toba_ap_relacion_db.php'; - } - - function get_punto_montaje() - { - return $this->datos['punto_montaje']; - } - - function get_subclase_nombre() - { - return $this->datos['ap_clase']; - } - - function get_subclase_archivo() - { - return $this->datos['ap_archivo']; - } - - //--------------------------------------------------------------------- - - function get_descripcion_subcomponente() - { - return 'Administrador de Persistencia'; - } -} -?> \ No newline at end of file + "; + toba::logger()->debug($sql); + $db->ejecutar($sql); + } + + //--------------------------------------------------------------------- + //-- METACLASE + //--------------------------------------------------------------------- + + public function get_molde_subclase() + { + $molde = new toba_codigo_clase($this->get_subclase_nombre(), $this->get_clase_nombre()); + + //-- Ini + $doc = 'Se ejecuta al inicio de todos los request en donde participa el componente'; + $metodo = new toba_codigo_metodo_php('ini', array(), array($doc)); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //-- Pre Sinc + $doc = "Ventana para incluír validaciones (disparar una excepcion) o disparar procesos previo a sincronizar"; + $comentarios = array( + $doc, + "La transacción con la bd ya fue iniciada (si es que hay)" + ); + $metodo = new toba_codigo_metodo_php('evt__pre_sincronizacion', array(), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //-- Post Sinc + $doc = "Ventana para incluír validaciones (disparar una excepcion) o disparar procesos posteriores a la sincronización"; + $comentarios = array( + $doc, + "La transacción con la bd aún no fue terminada (si es que hay)" + ); + $metodo = new toba_codigo_metodo_php('evt__post_sincronizacion', array(), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //-- Pre Elim + $doc = "Ventana para incluír validaciones (disparar una excepcion) o disparar procesos previo a la eliminación"; + $comentarios = array( + $doc, + "La transacción con la bd ya fue iniciada (si es que hay)" + ); + $metodo = new toba_codigo_metodo_php('evt__pre_eliminacion', array(), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //-- Post Elim + $doc = "Ventana para incluír validaciones (disparar una excepcion) o disparar procesos posteriores a la eliminación"; + $comentarios = array( + $doc, + "La transacción con la bd ya fue iniciada (si es que hay)" + ); + $metodo = new toba_codigo_metodo_php('evt__post_eliminacion', array(), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + return $molde; + } + + public function get_clase_nombre() + { + return 'toba_ap_relacion_db'; + } + + public function get_clase_archivo() + { + return 'nucleo/componentes/persistencia/toba_ap_relacion_db.php'; + } + + public function get_punto_montaje() + { + return $this->datos['punto_montaje']; + } + + public function get_subclase_nombre() + { + return $this->datos['ap_clase']; + } + + public function get_subclase_archivo() + { + return $this->datos['ap_archivo']; + } + + //--------------------------------------------------------------------- + + public function get_descripcion_subcomponente() + { + return 'Administrador de Persistencia'; + } +} diff --git a/php/modelo/info/componentes/toba_ap_tabla_db_info.php b/php/modelo/info/componentes/toba_ap_tabla_db_info.php index 905b0fcdb1..dac26d4047 100644 --- a/php/modelo/info/componentes/toba_ap_tabla_db_info.php +++ b/php/modelo/info/componentes/toba_ap_tabla_db_info.php @@ -1,27 +1,27 @@ -datos = $datos; - } - - - function get_nombre_instancia_abreviado() - { - return "dt_ap"; - } - - function set_subclase($nombre, $archivo, $pm) - { - $db = toba_contexto_info::get_db(); - $nombre = $db->quote($nombre); - $archivo = $db->quote($archivo); - $pm = $db->quote($pm); - $sql = " +datos = $datos; + } + + + public function get_nombre_instancia_abreviado() + { + return "dt_ap"; + } + + public function set_subclase($nombre, $archivo, $pm) + { + $db = toba_contexto_info::get_db(); + $nombre = $db->quote($nombre); + $archivo = $db->quote($archivo); + $pm = $db->quote($pm); + $sql = " UPDATE apex_objeto_db_registros SET ap = 0, @@ -31,121 +31,119 @@ function set_subclase($nombre, $archivo, $pm) WHERE objeto_proyecto = '{$this->datos['proyecto']}' AND objeto = '{$this->datos['objeto']}' - "; - toba::logger()->debug($sql); - $db->ejecutar($sql); - } - - //--------------------------------------------------------------------- - //-- METACLASE - //--------------------------------------------------------------------- - - function get_molde_subclase() - { - $molde = new toba_codigo_clase( $this->get_subclase_nombre(), $this->get_clase_nombre() ); - - //-- Ini - $doc = 'Se ejecuta al inicio de todos los request en donde participa el componente'; - $metodo = new toba_codigo_metodo_php('ini', array(), array($doc)); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - //-- Pre Sinc - $doc = "Ventana para incluír validaciones (disparar una excepcion) o disparar procesos previo a sincronizar"; - $comentarios = array( - $doc, - "La transacción con la bd ya fue iniciada (si es que hay)" - ); - $metodo = new toba_codigo_metodo_php('evt__pre_sincronizacion', array(), $comentarios); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - //-- Post Sinc - $doc = "Ventana para incluír validaciones (disparar una excepcion) o disparar procesos posteriores a la sincronización"; - $comentarios = array( - $doc, - "La transacción con la bd aún no fue terminada (si es que hay)" - ); - $metodo = new toba_codigo_metodo_php('evt__post_sincronizacion', array(), $comentarios); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - - //------------------------------------- - $doc = "Ventana de extensión previo a la inserción de un registro durante una sincronización con la base"; - $comentarios = array($doc, '@param mixed $id_registro Clave interna en la estructura $this->datos'); - $metodo = new toba_codigo_metodo_php('evt__pre_insert',array('$id_registro'),$comentarios); - $metodo->set_doc($doc); - $molde->agregar( $metodo ); - - //------------------------------------- - $doc = "Ventana de extensión posterior a la inserción de un registro durante una sincronización con la base"; - $comentarios = array($doc, '@param mixed $id_registro Clave interna en la estructura $this->datos'); - $metodo = new toba_codigo_metodo_php('evt__post_insert',array('$id_registro'),$comentarios); - $metodo->set_doc($doc); - $molde->agregar( $metodo ); - - //------------------------------------- - $doc = "Ventana de extensión previo a la actualización de un registro durante una sincronización con la base"; - $comentarios = array($doc, '@param mixed $id_registro Clave interna en la estructura $this->datos'); - $metodo = new toba_codigo_metodo_php('evt__pre_update',array('$id_registro'),$comentarios); - $metodo->set_doc($doc); - $molde->agregar( $metodo ); - - //------------------------------------- - $doc = "Ventana de extensión posterior a la actualización de un registro durante una sincronización con la base"; - $comentarios = array($doc, '@param mixed $id_registro Clave interna en la estructura $this->datos'); - $metodo = new toba_codigo_metodo_php('evt__post_update',array('$id_registro'),$comentarios); - $metodo->set_doc($doc); - $molde->agregar( $metodo ); - - //------------------------------------- - $doc = "Ventana de extensión previa al borrado de un registro durante una sincronización con la base"; - $comentarios = array($doc, '@param mixed $id_registro Clave interna en la estructura $this->datos'); - $metodo = new toba_codigo_metodo_php('evt__pre_delete',array('$id_registro'),$comentarios); - $metodo->set_doc($doc); - $molde->agregar( $metodo ); - - //------------------------------------- - $doc = "Ventana de extensión posterior al borrado de un registro durante una sincronización con la base"; - $comentarios = array($doc, '@param mixed $id_registro Clave interna en la estructura $this->datos'); - $metodo = new toba_codigo_metodo_php('evt__post_delete',array('$id_registro'),$comentarios); - $metodo->set_doc($doc); - $molde->agregar( $metodo ); - return $molde; - - } - - function get_clase_nombre() - { - return 'toba_ap_tabla_db_s'; - } - - function get_clase_archivo() - { - return 'nucleo/componentes/persistencia/toba_ap_tabla_db_s.php'; - } - - function get_punto_montaje() - { - return $this->datos['punto_montaje']; - } - - function get_subclase_nombre() - { - return $this->datos['ap_sub_clase']; - } - - function get_subclase_archivo() - { - return $this->datos['ap_sub_clase_archivo']; - } - - //--------------------------------------------------------------------- - - function get_descripcion_subcomponente() - { - return 'Administrador de Persistencia'; - } -} -?> \ No newline at end of file + "; + toba::logger()->debug($sql); + $db->ejecutar($sql); + } + + //--------------------------------------------------------------------- + //-- METACLASE + //--------------------------------------------------------------------- + + public function get_molde_subclase() + { + $molde = new toba_codigo_clase($this->get_subclase_nombre(), $this->get_clase_nombre()); + + //-- Ini + $doc = 'Se ejecuta al inicio de todos los request en donde participa el componente'; + $metodo = new toba_codigo_metodo_php('ini', array(), array($doc)); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //-- Pre Sinc + $doc = "Ventana para incluír validaciones (disparar una excepcion) o disparar procesos previo a sincronizar"; + $comentarios = array( + $doc, + "La transacción con la bd ya fue iniciada (si es que hay)" + ); + $metodo = new toba_codigo_metodo_php('evt__pre_sincronizacion', array(), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //-- Post Sinc + $doc = "Ventana para incluír validaciones (disparar una excepcion) o disparar procesos posteriores a la sincronización"; + $comentarios = array( + $doc, + "La transacción con la bd aún no fue terminada (si es que hay)" + ); + $metodo = new toba_codigo_metodo_php('evt__post_sincronizacion', array(), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + + //------------------------------------- + $doc = "Ventana de extensión previo a la inserción de un registro durante una sincronización con la base"; + $comentarios = array($doc, '@param mixed $id_registro Clave interna en la estructura $this->datos'); + $metodo = new toba_codigo_metodo_php('evt__pre_insert', array('$id_registro'), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //------------------------------------- + $doc = "Ventana de extensión posterior a la inserción de un registro durante una sincronización con la base"; + $comentarios = array($doc, '@param mixed $id_registro Clave interna en la estructura $this->datos'); + $metodo = new toba_codigo_metodo_php('evt__post_insert', array('$id_registro'), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //------------------------------------- + $doc = "Ventana de extensión previo a la actualización de un registro durante una sincronización con la base"; + $comentarios = array($doc, '@param mixed $id_registro Clave interna en la estructura $this->datos'); + $metodo = new toba_codigo_metodo_php('evt__pre_update', array('$id_registro'), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //------------------------------------- + $doc = "Ventana de extensión posterior a la actualización de un registro durante una sincronización con la base"; + $comentarios = array($doc, '@param mixed $id_registro Clave interna en la estructura $this->datos'); + $metodo = new toba_codigo_metodo_php('evt__post_update', array('$id_registro'), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //------------------------------------- + $doc = "Ventana de extensión previa al borrado de un registro durante una sincronización con la base"; + $comentarios = array($doc, '@param mixed $id_registro Clave interna en la estructura $this->datos'); + $metodo = new toba_codigo_metodo_php('evt__pre_delete', array('$id_registro'), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //------------------------------------- + $doc = "Ventana de extensión posterior al borrado de un registro durante una sincronización con la base"; + $comentarios = array($doc, '@param mixed $id_registro Clave interna en la estructura $this->datos'); + $metodo = new toba_codigo_metodo_php('evt__post_delete', array('$id_registro'), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + return $molde; + } + + public function get_clase_nombre() + { + return 'toba_ap_tabla_db_s'; + } + + public function get_clase_archivo() + { + return 'nucleo/componentes/persistencia/toba_ap_tabla_db_s.php'; + } + + public function get_punto_montaje() + { + return $this->datos['punto_montaje']; + } + + public function get_subclase_nombre() + { + return $this->datos['ap_sub_clase']; + } + + public function get_subclase_archivo() + { + return $this->datos['ap_sub_clase_archivo']; + } + + //--------------------------------------------------------------------- + + public function get_descripcion_subcomponente() + { + return 'Administrador de Persistencia'; + } +} diff --git a/php/modelo/info/componentes/toba_ci_info.php b/php/modelo/info/componentes/toba_ci_info.php index d042340ef5..0d569bcab0 100644 --- a/php/modelo/info/componentes/toba_ci_info.php +++ b/php/modelo/info/componentes/toba_ci_info.php @@ -2,398 +2,408 @@ class toba_ci_info extends toba_ei_info { - static function get_tipo_abreviado() - { - return "CI"; - } - - function get_nombre_instancia_abreviado() - { - return "ci"; - } - - /** - * Retorna la metaclase correspondiente a la pantalla - */ - function get_metaclase_subcomponente($subcomponente) - { - for ($i = 0 ; $i < count($this->datos['_info_ci_me_pantalla']) ; $i++) { - if ($this->datos['_info_ci_me_pantalla'][$i]['identificador'] === $subcomponente) { - return new toba_ci_pantalla_info($this->datos['_info_ci_me_pantalla'][$i],array(), $this->proyecto, $this->id, $this->datos['_info_obj_pantalla']); - } - } - toba_logger::instancia()->error("No se encuentra la pantalla '$subcomponente'"); - throw new toba_error('No se encuentra la pantalla solicitada, revise el log'); - } - - /** - * Se redefine para clonar la subclase de la pantalla - */ - protected function clonar_subclase($dr, $dir_subclases, $proyecto_dest) - { - parent::clonar_subclase($dr, $dir_subclases, $proyecto_dest); - foreach ($this->get_hijos(true) as $pantalla) { - $pantalla->clonar_subclase($dr, $dir_subclases, $proyecto_dest); - } - } - - - - //--------------------------------------------------------------------- - //-- Recorrible como ARBOL - //--------------------------------------------------------------------- - - function es_hoja() - { - $es_hoja = parent::es_hoja() && $this->get_cant_pantallas() == 0; - } - - function tiene_hijos_cargados() - { - return (!$this->es_hoja() && count($this->subelementos) != 0) || $this->get_cant_pantallas() != 0; - } - - function get_pantalla($id) - { - for ($i = 0 ; $i < count($this->datos['_info_ci_me_pantalla']) ; $i++) { - if ((string) $this->datos['_info_ci_me_pantalla'][$i]['pantalla'] === (string) $id) { - return new toba_ci_pantalla_info($this->datos['_info_ci_me_pantalla'][$i], - $this->subelementos, $this->proyecto, $this->id, $this->datos['_info_obj_pantalla']); - } - } - toba_logger::instancia()->error("No se encuentra la pantalla $id"); - throw new toba_error('No se encuentra la pantalla solicitada, revise el log'); - } - - function get_cant_pantallas() - { - if ($this->carga_profundidad) { - return count($this->datos['_info_ci_me_pantalla']); - } else { - return 0; - } - } - - function get_hijos($solo_pantallas=false) - { - //Las dependencias son sus hijos - //Hay una responsabilidad no bien limitada - //Este objeto tiene las dependencias, cada pantalla debería poder sacar las que les concierne - //Pero tambien este objeto debería saber cuales no son utilizadas por las pantallas - $pantallas = array(); - if ($this->carga_profundidad && count($this->datos['_info_ci_me_pantalla'])>0) { - //Se ordena por la columna orden - $datos_pantallas = rs_ordenar_por_columna($this->datos['_info_ci_me_pantalla'],'orden'); - foreach ($datos_pantallas as $pantalla) { - $pantallas[] = new toba_ci_pantalla_info($pantalla, $this->subelementos, $this->proyecto, $this->id, $this->datos['_info_obj_pantalla']); - } - } - //Busca Dependencias libres - $dependencias_libres = array(); - foreach ($this->subelementos as $dependencia) { - $libre = true; - foreach ($pantallas as $pantalla) { - if ($pantalla->tiene_dependencia($dependencia)) { - $libre = false; - } - } - if ($libre) { - $dependencias_libres[] = $dependencia; - } - } - if ($solo_pantallas) { - return $pantallas; - } else { - return array_merge($pantallas, $dependencias_libres); - } - } - - function get_utilerias() - { - $iconos = array(); - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("objetos/objeto_nuevo.gif", false), - 'ayuda' => "Crear un nuevo componente asociado al controlador", - 'vinculo' => toba::vinculador()->get_url(toba_editor::get_id(),"1000247", - array( 'destino_tipo' => 'toba_ci', - 'destino_proyecto' => $this->proyecto, - 'destino_id' => $this->id ), - array( 'menu' => true, - 'celda_memoria' => 'central') - ), - 'plegado' => true - ); - return array_merge($iconos, parent::get_utilerias()); - } - - //--------------------------------------------------------------------- - //-- EVENTOS - //--------------------------------------------------------------------- - - function eventos_predefinidos() - { - $eventos = parent::eventos_predefinidos(); - /* Hay que agregar entradas y salidas de pantallas */ - return $eventos; - } - - static function get_modelos_evento() - { - $modelo[0]['id'] = 'proceso'; - $modelo[0]['nombre'] = 'Guardar - Cancelar'; - $modelo[1]['id'] = 'abm'; - $modelo[1]['nombre'] = 'ABM / CRUD'; - $modelo[2]['id'] = 'imprimir'; - $modelo[2]['nombre'] = 'Imprimir la Pantalla'; - return $modelo; - } - - static function get_lista_eventos_estandar($modelo) - { - $evento = array(); - switch($modelo){ - case 'proceso': - //Procesar - $evento[0]['identificador'] = "procesar"; - $evento[0]['etiqueta'] = "&Guardar"; - $evento[0]['imagen_recurso_origen'] = 'apex'; - $evento[0]['imagen'] = 'guardar.gif'; - $evento[0]['maneja_datos'] = 1; - $evento[0]['orden'] = 0; - $evento[0]['en_botonera'] = 1; - $evento[0]['defecto'] = 1; - //Cancelar - $evento[1]['identificador'] = "cancelar"; - $evento[1]['etiqueta'] = "&Cancelar"; - $evento[1]['maneja_datos'] = 0; - $evento[1]['orden'] = 1; - $evento[1]['en_botonera'] = 1; - break; - case 'abm': - //Agregar - $evento[0]['identificador'] = "agregar"; - $evento[0]['etiqueta'] = "&Agregar"; - $evento[0]['imagen_recurso_origen'] = 'apex'; - $evento[0]['imagen'] = 'nucleo/agregar.gif'; - $evento[0]['maneja_datos'] = 0; - $evento[0]['orden'] = 0; - $evento[0]['en_botonera'] = 1; - //volver - $evento[1]['identificador'] = "cancelar"; - $evento[1]['etiqueta'] = "&Volver"; - $evento[1]['imagen_recurso_origen'] = 'apex'; - $evento[1]['imagen'] = 'deshacer.png'; - $evento[1]['maneja_datos'] = 0; - $evento[1]['orden'] = 1; - $evento[1]['en_botonera'] = 1; - //Eliminar - $evento[2]['identificador'] = "eliminar"; - $evento[2]['etiqueta'] = "&Eliminar"; - $evento[2]['imagen_recurso_origen'] = 'apex'; - $evento[2]['imagen'] = 'borrar.png'; - $evento[2]['confirmacion'] = "¿Esta seguro que desea ELIMINAR los datos?"; - $evento[2]['maneja_datos'] = 0; - $evento[2]['orden'] = 2; - $evento[2]['en_botonera'] = 1; - //Guardar - $evento[3]['identificador'] = "guardar"; - $evento[3]['etiqueta'] = "&Guardar"; - $evento[3]['imagen_recurso_origen'] = 'apex'; - $evento[3]['imagen'] = 'guardar.gif'; - $evento[3]['maneja_datos'] = 1; - $evento[3]['orden'] = 3; - $evento[3]['en_botonera'] = 1; - $evento[3]['defecto'] = 1; - break; - case 'imprimir': - //Procesar - $evento[0]['identificador'] = "imprimir"; - $evento[0]['etiqueta'] = "&Imprimir"; - $evento[0]['imagen_recurso_origen'] = 'apex'; - $evento[0]['imagen'] = 'impresora.gif'; - $evento[0]['maneja_datos'] = 0; - $evento[0]['orden'] = 10; - $evento[0]['en_botonera'] = 1; - $evento[0]['defecto'] = 0; - $evento[0]['accion'] = 'H'; - $evento[0]['accion_imphtml_debug'] = 1; - break; - } - return $evento; - } - - //--------------------------------------------------------------------- - //-- METACLASE - //--------------------------------------------------------------------- - - function get_molde_subclase() - { - $molde = $this->get_molde_vacio(); - //************** Elementos PROPIOS ************* - //-- Ini operacion - $doc = array(); - $doc[] = "Se ejecuta por única vez cuando el componente entra en la operación."; - $doc[] = "Es útil por ejemplo para inicializar un conjunto de variables de sesion y evitar el chequeo continuo de las mismas"; - $doc[] = "Hay situaciones en las que su ejecución no coincide con el instante inicial de operación:"; - $doc[] = " - Si el componente es un ci dentro de otro ci, recién se ejecuta cuando entra a la operacion que no necesariamente es al inicio, si por ejemplo se encuentra en la 3er pantalla del ci principal."; - $doc[] = " - Si se ejecuta una limpieza de memoria (comportamiento por defecto del evt__cancelar)"; - $metodo = new toba_codigo_metodo_php('ini__operacion', array(), $doc); - $metodo->set_doc('[api:Componentes/Eis/toba_ci#ini__operacion Ver doc]'); - $molde->agregar($metodo); - - //-- Final - $doc = "Ventana de extensión previa a la destrucción del componente, al final de la atención de los servicios"; - $metodo = new toba_codigo_metodo_php('fin', array(), array($doc)); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - $molde->agregar( new toba_codigo_separador_php('Configuraciones','Configuracion','grande') ); - - //-- Conf - $doc = array(); - $doc[] = "Ventana que se ejecuta al inicio de la etapa de configuración. Antes de la configuración de la pantalla y sus componentes"; - $doc[] = "Se utiliza por ejemplo para determinar qué pantalla mostrar, eliminar tabs, etc."; - $metodo = new toba_codigo_metodo_php('conf', array(), $doc); - $metodo->set_doc('[api:Componentes/Eis/toba_ci#conf Ver doc]'); - $molde->agregar($metodo); - - - //-- Configuracion de pantallas ----------- - $datos_pantallas = rs_ordenar_por_columna($this->datos['_info_ci_me_pantalla'],'orden'); - foreach($datos_pantallas as $pantalla) { - $doc = array(); - $doc[] = 'Ventana de extensión para configurar la pantalla. Se ejecuta previo a la configuración de los componentes pertenecientes a la pantalla '; - $doc[] = 'por lo que es ideal por ejemplo para ocultarlos en base a una condición dinámica, ej. $pant->eliminar_dep("tal") '; - $doc[] = '@param toba_ei_pantalla $pantalla'; - $metodo = new toba_codigo_metodo_php('conf__' . $pantalla['identificador'], array('toba_ei_pantalla $pantalla'), $doc); - $metodo->set_doc(implode("\n", $doc)); - $molde->agregar($metodo); - - //Aca incluyo los metodos de entrada y salida de pantallas. - $doc = array(); - $doc[] = 'Ventana de extension para ejecutar controles antes de entrar a la pagina.'; - $doc[] = 'Se ejecuta luego de lanzar los eventos del ci.'; - $doc[] = 'Si se lanza una excepcion se evita el cambio de pantalla.'; - $doc[] = '[wiki:Referencia/Objetos/ci#Controlandolaentradaylasalida Ver más]'; - $nombre_metodo_entrada = 'evt__'. $pantalla['identificador'] . '__entrada'; - $metodo = new toba_codigo_metodo_php($nombre_metodo_entrada, array(), $doc); - $metodo->set_doc(implode("\n", $doc)); - $molde->agregar($metodo); - - $doc = array(); - $doc[] = 'Ventana de extension para ejecutar controles antes de salir de la pagina.'; - $doc[] = 'Se ejecuta luego de lanzar los eventos del ci.'; - $doc[] = 'Si se lanza una excepcion se evita el cambio de pantalla.'; - $doc[] = '[wiki:Referencia/Objetos/ci#Controlandolaentradaylasalida Ver más]'; - $nombre_metodo_salida = 'evt__' . $pantalla['identificador'] . '__salida'; - $metodo = new toba_codigo_metodo_php($nombre_metodo_salida, array(), $doc); - $metodo->set_doc(implode("\n", $doc)); - $molde->agregar($metodo); - } - - //-- Post Configurar - $doc = "Ventana para insertar lógica de la configuración del ci y sus dependencias"; - $metodo = new toba_codigo_metodo_php('post_configurar', array(), array($doc)); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - //-- Eventos propios ---------------------- - if (count($this->eventos_predefinidos()) > 0) { - $molde->agregar( new toba_codigo_separador_php('Eventos',null,'grande') ); - foreach ($this->eventos_predefinidos() as $evento => $info) { - if ($info['info']['accion'] != 'V') { //No es Vinculo - if ($evento == 'cancelar') { - $doc = array("Originalmente este método limpia las variables y definiciones del componente, y en caso de exisitr un CN asociado ejecuta su cancelar. Para mantener este comportamiento llamar a parent::evt__cancelar"); - } elseif ($evento == 'procesar') { - $doc = array("Originalmente este método si existe un CN asociado ejecuta su procesar. Para mantener este comportamiento llamar a parent::evt__procesar"); - } else { - $doc = array("Atrapa la interacción del usuario a través del botón asociado. El método no recibe parámetros"); - } - $metodo = new toba_codigo_metodo_php('evt__' . $evento, array(), $doc); - $metodo->set_doc(implode("\n", $doc)); - $molde->agregar($metodo); - } - } - } - - //-- Post Eventos - $doc = "Ventana que se ejecuta una vez que todos los eventos se han disparado para este objeto"; - $metodo = new toba_codigo_metodo_php('post_eventos', array(), array($doc)); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - - //**************** DEPENDENCIAS *************** - if (count($this->subelementos)>0) { - foreach ($this->subelementos as $id => $elemento) { - $es_ei = ($elemento instanceof toba_ei_info) && !($elemento instanceof toba_ci_info); - $rol = $elemento->rol_en_consumidor(); - if ($es_ei) { - $molde->agregar( new toba_codigo_separador_php($rol, null, 'grande') ); - //Metodo de CONFIGURACION - $tipo = $elemento->get_clase_nombre_final(); - $nombre_instancia = $elemento->get_nombre_instancia_abreviado(); - - $metodo = new toba_codigo_metodo_php('conf__' . $rol, - array($tipo.' $'.$nombre_instancia), - $elemento->get_comentario_carga()); - $metodo->set_grupo($rol); - $ei = get_class($elemento); - $ei = substr($ei, 5, strlen($ei) - 10); - $metodo->set_doc("Ventana para configurar al componente. Por lo general se le brindan datos a través del método
    set_datos(\$datos)
    . + public static function get_tipo_abreviado() + { + return "CI"; + } + + public function get_nombre_instancia_abreviado() + { + return "ci"; + } + + /** + * Retorna la metaclase correspondiente a la pantalla + */ + public function get_metaclase_subcomponente($subcomponente) + { + for ($i = 0 ; $i < count($this->datos['_info_ci_me_pantalla']) ; $i++) { + if ($this->datos['_info_ci_me_pantalla'][$i]['identificador'] === $subcomponente) { + return new toba_ci_pantalla_info($this->datos['_info_ci_me_pantalla'][$i], array(), $this->proyecto, $this->id, $this->datos['_info_obj_pantalla']); + } + } + toba_logger::instancia()->error("No se encuentra la pantalla '$subcomponente'"); + throw new toba_error('No se encuentra la pantalla solicitada, revise el log'); + } + + /** + * Se redefine para clonar la subclase de la pantalla + */ + protected function clonar_subclase($dr, $dir_subclases, $proyecto_dest) + { + parent::clonar_subclase($dr, $dir_subclases, $proyecto_dest); + foreach ($this->get_hijos(true) as $pantalla) { + $pantalla->clonar_subclase($dr, $dir_subclases, $proyecto_dest); + } + } + + + + //--------------------------------------------------------------------- + //-- Recorrible como ARBOL + //--------------------------------------------------------------------- + + public function es_hoja() + { + $es_hoja = parent::es_hoja() && $this->get_cant_pantallas() == 0; + } + + public function tiene_hijos_cargados() + { + return (!$this->es_hoja() && count($this->subelementos) != 0) || $this->get_cant_pantallas() != 0; + } + + public function get_pantalla($id) + { + for ($i = 0 ; $i < count($this->datos['_info_ci_me_pantalla']) ; $i++) { + if ((string) $this->datos['_info_ci_me_pantalla'][$i]['pantalla'] === (string) $id) { + return new toba_ci_pantalla_info( + $this->datos['_info_ci_me_pantalla'][$i], + $this->subelementos, + $this->proyecto, + $this->id, + $this->datos['_info_obj_pantalla'] + ); + } + } + toba_logger::instancia()->error("No se encuentra la pantalla $id"); + throw new toba_error('No se encuentra la pantalla solicitada, revise el log'); + } + + public function get_cant_pantallas() + { + if ($this->carga_profundidad) { + return count($this->datos['_info_ci_me_pantalla']); + } else { + return 0; + } + } + + public function get_hijos($solo_pantallas=false) + { + //Las dependencias son sus hijos + //Hay una responsabilidad no bien limitada + //Este objeto tiene las dependencias, cada pantalla debería poder sacar las que les concierne + //Pero tambien este objeto debería saber cuales no son utilizadas por las pantallas + $pantallas = array(); + if ($this->carga_profundidad && count($this->datos['_info_ci_me_pantalla'])>0) { + //Se ordena por la columna orden + $datos_pantallas = rs_ordenar_por_columna($this->datos['_info_ci_me_pantalla'], 'orden'); + foreach ($datos_pantallas as $pantalla) { + $pantallas[] = new toba_ci_pantalla_info($pantalla, $this->subelementos, $this->proyecto, $this->id, $this->datos['_info_obj_pantalla']); + } + } + //Busca Dependencias libres + $dependencias_libres = array(); + foreach ($this->subelementos as $dependencia) { + $libre = true; + foreach ($pantallas as $pantalla) { + if ($pantalla->tiene_dependencia($dependencia)) { + $libre = false; + } + } + if ($libre) { + $dependencias_libres[] = $dependencia; + } + } + if ($solo_pantallas) { + return $pantallas; + } else { + return array_merge($pantallas, $dependencias_libres); + } + } + + public function get_utilerias() + { + $iconos = array(); + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("objetos/objeto_nuevo.gif", false), + 'ayuda' => "Crear un nuevo componente asociado al controlador", + 'vinculo' => toba::vinculador()->get_url( + toba_editor::get_id(), + "1000247", + array( 'destino_tipo' => 'toba_ci', + 'destino_proyecto' => $this->proyecto, + 'destino_id' => $this->id ), + array( 'menu' => true, + 'celda_memoria' => 'central') + ), + 'plegado' => true + ); + return array_merge($iconos, parent::get_utilerias()); + } + + //--------------------------------------------------------------------- + //-- EVENTOS + //--------------------------------------------------------------------- + + public function eventos_predefinidos() + { + $eventos = parent::eventos_predefinidos(); + /* Hay que agregar entradas y salidas de pantallas */ + return $eventos; + } + + public static function get_modelos_evento() + { + $modelo[0]['id'] = 'proceso'; + $modelo[0]['nombre'] = 'Guardar - Cancelar'; + $modelo[1]['id'] = 'abm'; + $modelo[1]['nombre'] = 'ABM / CRUD'; + $modelo[2]['id'] = 'imprimir'; + $modelo[2]['nombre'] = 'Imprimir la Pantalla'; + return $modelo; + } + + public static function get_lista_eventos_estandar($modelo) + { + $evento = array(); + switch ($modelo) { + case 'proceso': + //Procesar + $evento[0]['identificador'] = "procesar"; + $evento[0]['etiqueta'] = "&Guardar"; + $evento[0]['imagen_recurso_origen'] = 'apex'; + $evento[0]['imagen'] = 'guardar.gif'; + $evento[0]['maneja_datos'] = 1; + $evento[0]['orden'] = 0; + $evento[0]['en_botonera'] = 1; + $evento[0]['defecto'] = 1; + //Cancelar + $evento[1]['identificador'] = "cancelar"; + $evento[1]['etiqueta'] = "&Cancelar"; + $evento[1]['maneja_datos'] = 0; + $evento[1]['orden'] = 1; + $evento[1]['en_botonera'] = 1; + break; + case 'abm': + //Agregar + $evento[0]['identificador'] = "agregar"; + $evento[0]['etiqueta'] = "&Agregar"; + $evento[0]['imagen_recurso_origen'] = 'apex'; + $evento[0]['imagen'] = 'nucleo/agregar.gif'; + $evento[0]['maneja_datos'] = 0; + $evento[0]['orden'] = 0; + $evento[0]['en_botonera'] = 1; + //volver + $evento[1]['identificador'] = "cancelar"; + $evento[1]['etiqueta'] = "&Volver"; + $evento[1]['imagen_recurso_origen'] = 'apex'; + $evento[1]['imagen'] = 'deshacer.png'; + $evento[1]['maneja_datos'] = 0; + $evento[1]['orden'] = 1; + $evento[1]['en_botonera'] = 1; + //Eliminar + $evento[2]['identificador'] = "eliminar"; + $evento[2]['etiqueta'] = "&Eliminar"; + $evento[2]['imagen_recurso_origen'] = 'apex'; + $evento[2]['imagen'] = 'borrar.png'; + $evento[2]['confirmacion'] = "¿Esta seguro que desea ELIMINAR los datos?"; + $evento[2]['maneja_datos'] = 0; + $evento[2]['orden'] = 2; + $evento[2]['en_botonera'] = 1; + //Guardar + $evento[3]['identificador'] = "guardar"; + $evento[3]['etiqueta'] = "&Guardar"; + $evento[3]['imagen_recurso_origen'] = 'apex'; + $evento[3]['imagen'] = 'guardar.gif'; + $evento[3]['maneja_datos'] = 1; + $evento[3]['orden'] = 3; + $evento[3]['en_botonera'] = 1; + $evento[3]['defecto'] = 1; + break; + case 'imprimir': + //Procesar + $evento[0]['identificador'] = "imprimir"; + $evento[0]['etiqueta'] = "&Imprimir"; + $evento[0]['imagen_recurso_origen'] = 'apex'; + $evento[0]['imagen'] = 'impresora.gif'; + $evento[0]['maneja_datos'] = 0; + $evento[0]['orden'] = 10; + $evento[0]['en_botonera'] = 1; + $evento[0]['defecto'] = 0; + $evento[0]['accion'] = 'H'; + $evento[0]['accion_imphtml_debug'] = 1; + break; + } + return $evento; + } + + //--------------------------------------------------------------------- + //-- METACLASE + //--------------------------------------------------------------------- + + public function get_molde_subclase() + { + $molde = $this->get_molde_vacio(); + //************** Elementos PROPIOS ************* + //-- Ini operacion + $doc = array(); + $doc[] = "Se ejecuta por única vez cuando el componente entra en la operación."; + $doc[] = "Es útil por ejemplo para inicializar un conjunto de variables de sesion y evitar el chequeo continuo de las mismas"; + $doc[] = "Hay situaciones en las que su ejecución no coincide con el instante inicial de operación:"; + $doc[] = " - Si el componente es un ci dentro de otro ci, recién se ejecuta cuando entra a la operacion que no necesariamente es al inicio, si por ejemplo se encuentra en la 3er pantalla del ci principal."; + $doc[] = " - Si se ejecuta una limpieza de memoria (comportamiento por defecto del evt__cancelar)"; + $metodo = new toba_codigo_metodo_php('ini__operacion', array(), $doc); + $metodo->set_doc('[api:Componentes/Eis/toba_ci#ini__operacion Ver doc]'); + $molde->agregar($metodo); + + //-- Final + $doc = "Ventana de extensión previa a la destrucción del componente, al final de la atención de los servicios"; + $metodo = new toba_codigo_metodo_php('fin', array(), array($doc)); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + $molde->agregar(new toba_codigo_separador_php('Configuraciones', 'Configuracion', 'grande')); + + //-- Conf + $doc = array(); + $doc[] = "Ventana que se ejecuta al inicio de la etapa de configuración. Antes de la configuración de la pantalla y sus componentes"; + $doc[] = "Se utiliza por ejemplo para determinar qué pantalla mostrar, eliminar tabs, etc."; + $metodo = new toba_codigo_metodo_php('conf', array(), $doc); + $metodo->set_doc('[api:Componentes/Eis/toba_ci#conf Ver doc]'); + $molde->agregar($metodo); + + + //-- Configuracion de pantallas ----------- + $datos_pantallas = rs_ordenar_por_columna($this->datos['_info_ci_me_pantalla'], 'orden'); + foreach ($datos_pantallas as $pantalla) { + $doc = array(); + $doc[] = 'Ventana de extensión para configurar la pantalla. Se ejecuta previo a la configuración de los componentes pertenecientes a la pantalla '; + $doc[] = 'por lo que es ideal por ejemplo para ocultarlos en base a una condición dinámica, ej. $pant->eliminar_dep("tal") '; + $doc[] = '@param toba_ei_pantalla $pantalla'; + $metodo = new toba_codigo_metodo_php('conf__' . $pantalla['identificador'], array('toba_ei_pantalla $pantalla'), $doc); + $metodo->set_doc(implode("\n", $doc)); + $molde->agregar($metodo); + + //Aca incluyo los metodos de entrada y salida de pantallas. + $doc = array(); + $doc[] = 'Ventana de extension para ejecutar controles antes de entrar a la pagina.'; + $doc[] = 'Se ejecuta luego de lanzar los eventos del ci.'; + $doc[] = 'Si se lanza una excepcion se evita el cambio de pantalla.'; + $doc[] = '[wiki:Referencia/Objetos/ci#Controlandolaentradaylasalida Ver más]'; + $nombre_metodo_entrada = 'evt__'. $pantalla['identificador'] . '__entrada'; + $metodo = new toba_codigo_metodo_php($nombre_metodo_entrada, array(), $doc); + $metodo->set_doc(implode("\n", $doc)); + $molde->agregar($metodo); + + $doc = array(); + $doc[] = 'Ventana de extension para ejecutar controles antes de salir de la pagina.'; + $doc[] = 'Se ejecuta luego de lanzar los eventos del ci.'; + $doc[] = 'Si se lanza una excepcion se evita el cambio de pantalla.'; + $doc[] = '[wiki:Referencia/Objetos/ci#Controlandolaentradaylasalida Ver más]'; + $nombre_metodo_salida = 'evt__' . $pantalla['identificador'] . '__salida'; + $metodo = new toba_codigo_metodo_php($nombre_metodo_salida, array(), $doc); + $metodo->set_doc(implode("\n", $doc)); + $molde->agregar($metodo); + } + + //-- Post Configurar + $doc = "Ventana para insertar lógica de la configuración del ci y sus dependencias"; + $metodo = new toba_codigo_metodo_php('post_configurar', array(), array($doc)); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //-- Eventos propios ---------------------- + if (count($this->eventos_predefinidos()) > 0) { + $molde->agregar(new toba_codigo_separador_php('Eventos', null, 'grande')); + foreach ($this->eventos_predefinidos() as $evento => $info) { + if ($info['info']['accion'] != 'V') { //No es Vinculo + if ($evento == 'cancelar') { + $doc = array("Originalmente este método limpia las variables y definiciones del componente, y en caso de exisitr un CN asociado ejecuta su cancelar. Para mantener este comportamiento llamar a parent::evt__cancelar"); + } elseif ($evento == 'procesar') { + $doc = array("Originalmente este método si existe un CN asociado ejecuta su procesar. Para mantener este comportamiento llamar a parent::evt__procesar"); + } else { + $doc = array("Atrapa la interacción del usuario a través del botón asociado. El método no recibe parámetros"); + } + $metodo = new toba_codigo_metodo_php('evt__' . $evento, array(), $doc); + $metodo->set_doc(implode("\n", $doc)); + $molde->agregar($metodo); + } + } + } + + //-- Post Eventos + $doc = "Ventana que se ejecuta una vez que todos los eventos se han disparado para este objeto"; + $metodo = new toba_codigo_metodo_php('post_eventos', array(), array($doc)); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + + //**************** DEPENDENCIAS *************** + if (count($this->subelementos)>0) { + foreach ($this->subelementos as $id => $elemento) { + $es_ei = ($elemento instanceof toba_ei_info) && !($elemento instanceof toba_ci_info); + $rol = $elemento->rol_en_consumidor(); + if ($es_ei) { + $molde->agregar(new toba_codigo_separador_php($rol, null, 'grande')); + //Metodo de CONFIGURACION + $tipo = $elemento->get_clase_nombre_final(); + $nombre_instancia = $elemento->get_nombre_instancia_abreviado(); + + $metodo = new toba_codigo_metodo_php( + 'conf__' . $rol, + array($tipo.' $'.$nombre_instancia), + $elemento->get_comentario_carga() + ); + $metodo->set_grupo($rol); + $ei = get_class($elemento); + $ei = substr($ei, 5, strlen($ei) - 10); + $metodo->set_doc("Ventana para configurar al componente. Por lo general se le brindan datos a través del método
    set_datos(\$datos)
    . [wiki:Referencia/Objetos/$ei#Configuraci%C3%B3n Ver más]"); - $molde->agregar($metodo); - - //Eventos predefinidos del elemento - if (count($elemento->eventos_predefinidos()) > 0) { - foreach ($elemento->eventos_predefinidos() as $evento => $info) { - $metodo = new toba_codigo_metodo_php('evt__' . $rol . '__' .$evento, - $info['parametros'], - $info['comentarios']); - $metodo->set_grupo($rol); - $metodo->set_doc('Atrapa la interacción del usuario con el botón asociado a la dependencia. + $molde->agregar($metodo); + + //Eventos predefinidos del elemento + if (count($elemento->eventos_predefinidos()) > 0) { + foreach ($elemento->eventos_predefinidos() as $evento => $info) { + $metodo = new toba_codigo_metodo_php( + 'evt__' . $rol . '__' .$evento, + $info['parametros'], + $info['comentarios'] + ); + $metodo->set_grupo($rol); + $metodo->set_doc('Atrapa la interacción del usuario con el botón asociado a la dependencia. Recibe por parámetro los datos que acarrea el evento, por ejemplo si es un formulario los datos del mismo. [wiki:Referencia/Eventos#Listeners Ver más]'); - $molde->agregar($metodo); - - //Si es evento sobre fila brindo la oportunidad de configurarlo (caso ML y Cuadro) - if (isset($info['info']['sobre_fila']) && ($info['info']['sobre_fila'] == 1)) { - $nombre ='conf_evt__' . $rol . '__' .$evento; - $parametros = array('toba_evento_usuario $evento', '$fila'); - $doc = array(); - $doc[] = 'Permite configurar el evento por fila.'; - $doc[] = 'Útil para decidir si el evento debe estar disponible o no de acuerdo a los datos de la fila'; - $doc[] = "[wiki:Referencia/Objetos/$ei#Filtradodeeventosporfila Ver más]"; - - //Agrego el metodo correspondiente para la configuracion del evento - $metodo = new toba_codigo_metodo_php($nombre, $parametros, $doc); - $metodo->set_doc(implode("\n", $doc)); - $metodo->set_grupo($rol); - $molde->agregar($metodo); - } - } - } - } - } - } - //***************** JAVASCRIPT ***************** - $molde->agregar_bloque( $this->get_molde_eventos_js() ); - return $molde; - } - - static function get_eventos_internos(toba_datos_relacion $dr) - { - $eventos = array(); - $navegacion = $dr->tabla('prop_basicas')->get_columna('tipo_navegacion'); - if (isset($navegacion)) { - if ($navegacion == 'wizard') { - $eventos['cambiar_tab__siguiente'] = "El usuario avanza de pantalla, generalmente con el botón Siguiente."; - $eventos['cambiar_tab__anterior'] = "El usuario retrocede de pantalla, generalmente con el botón Anterior."; - } else { - $eventos['cambiar_tab_X'] = "El usuario cambia a la pantalla X utilizando los tabs o solapas."; - } - } - return $eventos; - } + $molde->agregar($metodo); + + //Si es evento sobre fila brindo la oportunidad de configurarlo (caso ML y Cuadro) + if (isset($info['info']['sobre_fila']) && ($info['info']['sobre_fila'] == 1)) { + $nombre ='conf_evt__' . $rol . '__' .$evento; + $parametros = array('toba_evento_usuario $evento', '$fila'); + $doc = array(); + $doc[] = 'Permite configurar el evento por fila.'; + $doc[] = 'Útil para decidir si el evento debe estar disponible o no de acuerdo a los datos de la fila'; + $doc[] = "[wiki:Referencia/Objetos/$ei#Filtradodeeventosporfila Ver más]"; + + //Agrego el metodo correspondiente para la configuracion del evento + $metodo = new toba_codigo_metodo_php($nombre, $parametros, $doc); + $metodo->set_doc(implode("\n", $doc)); + $metodo->set_grupo($rol); + $molde->agregar($metodo); + } + } + } + } + } + } + //***************** JAVASCRIPT ***************** + $molde->agregar_bloque($this->get_molde_eventos_js()); + return $molde; + } + + public static function get_eventos_internos(toba_datos_relacion $dr) + { + $eventos = array(); + $navegacion = $dr->tabla('prop_basicas')->get_columna('tipo_navegacion'); + if (isset($navegacion)) { + if ($navegacion == 'wizard') { + $eventos['cambiar_tab__siguiente'] = "El usuario avanza de pantalla, generalmente con el botón Siguiente."; + $eventos['cambiar_tab__anterior'] = "El usuario retrocede de pantalla, generalmente con el botón Anterior."; + } else { + $eventos['cambiar_tab_X'] = "El usuario cambia a la pantalla X utilizando los tabs o solapas."; + } + } + return $eventos; + } } -?> \ No newline at end of file diff --git a/php/modelo/info/componentes/toba_ci_pantalla_info.php b/php/modelo/info/componentes/toba_ci_pantalla_info.php index a853f1a044..02a6261861 100644 --- a/php/modelo/info/componentes/toba_ci_pantalla_info.php +++ b/php/modelo/info/componentes/toba_ci_pantalla_info.php @@ -1,298 +1,311 @@ -datos = $datos; - $this->set_info_objetos_asociados($info_dep_asociadas); - $this->asociar_dependencias($dependencias_posibles); - $this->proyecto = $proyecto; - $this->id = $id; - $this->datos['_info']['clase'] = 'toba_ei_pantalla'; - } - - function set_info_objetos_asociados($obj) - { - $this->obj_asociados = $obj; - } - - protected function asociar_dependencias($posibles) - { - $eis = $this->get_lista_dependencias_asociadas(); - foreach ($posibles as $posible) { - if (in_array($posible->rol_en_consumidor(), $eis)) { - $this->dependencias[] = $posible; - } - } - } - - protected function get_lista_dependencias_asociadas() - { - $lista = array(); - $id_pantalla = $this->datos['pantalla']; - foreach($this->obj_asociados as $dep){ - if ($dep['pantalla'] == $id_pantalla){ - $lista[] = $dep['identificador_dep']; - } - } - return $lista; - } - - function tiene_dependencia($dep) - { - return in_array($dep, $this->dependencias, true); - } - - function clonar_subclase($dr, $dir_subclases, $proyecto_dest) - { - if (isset($this->datos['subclase_archivo'])) { - $filas = $dr->tabla('pantallas')->get_id_fila_condicion(array('pantalla' => $this->datos['pantalla']), false); - if (count($filas) != 1) { - toba_logger::instancia()->error("Imposible clonar subclase de pantalla {$this->datos['pantalla']}"); - throw new toba_error_modelo('Imposible clonar subclase de pantalla, revise el log'); - } - $fila = current($filas); - $archivo = $this->datos['subclase_archivo']; - $nuevo_archivo = $dir_subclases."/".basename($archivo); - - $id_pm_origen = $this->get_punto_montaje(); - $id_pm_destino = $dr->tabla('base')->get_fila_columna(0, 'punto_montaje'); - - //Busco los directorios de copia utilizando los puntos de montaje - $path_origen = $this->get_path_clonacion($id_pm_origen,$this->proyecto); - $path_destino = $this->get_path_clonacion($id_pm_destino, $proyecto_dest, $path_origen); - - //--- Si el dir. destino no existe, se lo crea - if (!file_exists($path_destino.$dir_subclases)) { - toba_manejador_archivos::crear_arbol_directorios($path_destino.$dir_subclases); - } - if (! copy($path_origen.$archivo, $path_destino.$nuevo_archivo)) { - toba_logger::instancia()->error('No es posible copiar el archivo desde '.$path_origen.$archivo.' hacia '.$path_destino.$nuevo_archivo); - throw new toba_error('No es posible copiar el archivo, revise el log'); - } - $dr->tabla('pantallas')->set_fila_columna_valor($fila, 'subclase_archivo', $nuevo_archivo); - } - } - - protected function get_path_clonacion($id_punto, $proyecto, $path_default='') - { - $path_final = $path_default; - $pm = toba_pms::instancia()->get_instancia_pm_proyecto($proyecto, $id_punto); //Instancio el pm para el proyecto - if (! is_null($pm)) { - $path_final = $pm->get_path_absoluto(). '/'; //Si existe recupero el path al punto, sino uso el generico del proyecto - } elseif (isset($proyecto)) { - $path_final = toba::instancia()->get_path_proyecto($proyecto).'/php/'; - } - return $path_final; - } - - //--------------------------------------------------------------------- - //-- Recorrible como ARBOL - //--------------------------------------------------------------------- - - function get_hijos() - { - return $this->dependencias; - } - - function es_hoja() - { - return (count($this->dependencias) == 0); - } - - function tiene_propiedades() - { - return false; - } - - function get_nombre_corto() - { - if ($this->datos['etiqueta'] != '') - return str_replace('&', '', $this->datos['etiqueta']); - else - return $this->get_id(); - } - - function get_nombre_largo() - { - if (trim($this->datos['descripcion']) != '') - return $this->datos['descripcion']; - else - return $this->get_nombre_corto(); - } - - function get_id() - { - return $this->datos['identificador']; - } - - function get_iconos() - { - $iconos = array(); - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba('objetos/pantalla.gif', false), - 'ayuda' => 'Pantalla dentro del [wiki:Referencia/Objetos/ci ci]' - ); - return $iconos; - } - - function get_utilerias() - { - $param_editores = array(apex_hilo_qs_zona=> $this->proyecto. apex_qs_separador. - $this->id, - "pantalla" => $this->datos['identificador']); - $iconos = array(); - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("objetos/objeto_nuevo.gif", false), - 'ayuda' => "Crear un objeto asociado a la pantalla", - 'vinculo' => toba::vinculador()->get_url(toba_editor::get_id(),"1000247", - array('destino_tipo' => 'toba_ci_pantalla', - 'destino_proyecto' => $this->proyecto, - 'destino_id' => $this->id, - 'destino_pantalla' => $this->datos['pantalla']), - array( 'menu' => true, - 'celda_memoria' => 'central') - ), - 'plegado' => true - ); - if ($this->datos['subclase'] && $this->datos['subclase_archivo']) { - // Hay PHP asociado - if ( admin_util::existe_archivo_subclase($this->datos['subclase_archivo'], $this->datos['punto_montaje']) ) { - $iconos[] = toba_componente_info::get_utileria_editor_ver_php( array( 'proyecto'=>$this->proyecto, - 'componente' =>$this->id ), - $this->datos['identificador'] ); - $iconos[] = toba_componente_info::get_utileria_editor_abrir_php( array( 'proyecto'=>$this->proyecto, - 'componente' =>$this->id ), - $this->datos['identificador'] ); - } else { - $iconos[] = toba_componente_info::get_utileria_editor_ver_php( array( 'proyecto'=>$this->proyecto, - 'componente' =>$this->id ), - $this->datos['identificador'], - 'nucleo/php_inexistente.gif', - false ); - } - } - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("objetos/editar.gif", false), - 'ayuda' => "Editar esta pantalla", - 'vinculo' => toba::vinculador()->get_url(toba_editor::get_id(), "1000249", - $param_editores, - array( 'menu' => true, - 'celda_memoria' => 'central') - ), - 'plegado' => false - ); - return $iconos; - } - - function get_info_extra() - { - return ""; - } - - function tiene_hijos_cargados() - { - return true; - } - - function get_padre() - { - return null; - } - - //------------------------------------------------------------------------ - //------ METACLASE ------------------------------------------------------- - //------------------------------------------------------------------------ - - function get_nombre_instancia_abreviado() - { - return 'pant'; - } - - function get_molde_subclase() - { - $molde = new toba_codigo_clase( $this->get_subclase_nombre(), $this->get_clase_nombre() ); - $ayuda = "Permite modificar la forma en que se grafica la pantalla, por defecto un componente sobre el otro"; - $comentarios = array( - $ayuda - ); - $metodo = new toba_codigo_metodo_php('generar_layout', array(), $comentarios); - $metodo->set_doc($ayuda); - $molde->agregar($metodo); - $php = array(); - $existe_previo = 0; - foreach($this->get_lista_dependencias_asociadas() as $dep) { - if($existe_previo) $php[] = "echo '
    ';"; - $php[] = '$this->dep(\''.$dep.'\')->generar_html();'; - $existe_previo = 1; - } - $molde->ultimo_elemento()->set_contenido($php); - return $molde; - } - - function get_punto_montaje() - { - return $this->datos['punto_montaje']; - } - - function get_subclase_nombre() - { - return $this->datos['subclase']; - } - - function get_subclase_archivo() - { - return $this->datos['subclase_archivo']; - } - - function get_clase_nombre() - { - return str_replace('objeto_', 'toba_', $this->datos['_info']['clase']); // Se deja esta línea para que conserve el mismo comportamiento - } - - function get_clase_archivo() - { - return 'nucleo/componentes/interface/toba_ei_pantalla.php'; - } - - function cambiar_clase_origen($nombre_clase) - { - $this->datos['_info']['clase'] = $nombre_clase; - } - - function set_subclase($nombre, $archivo, $pm) - { - $db = toba_contexto_info::get_db(); - $nombre = $db->quote($nombre); - $archivo = $db->quote($archivo); - $pm = $db->quote($pm); - $id = $db->quote($this->id); - $sql = " - UPDATE apex_objeto_ci_pantalla - SET - subclase = $nombre, - subclase_archivo = $archivo, - punto_montaje = $pm - WHERE - objeto_ci_proyecto = '{$this->proyecto}' - AND objeto_ci = $id - AND pantalla = '{$this->datos['pantalla']}' - "; - toba::logger()->debug($sql); - $db->ejecutar($sql); - } - //--------------------------------------------------------------------- - - function get_descripcion_subcomponente() - { - return 'Pantalla ' . $this->datos['identificador']; - } -} -?> \ No newline at end of file +datos = $datos; + $this->set_info_objetos_asociados($info_dep_asociadas); + $this->asociar_dependencias($dependencias_posibles); + $this->proyecto = $proyecto; + $this->id = $id; + $this->datos['_info']['clase'] = 'toba_ei_pantalla'; + } + + public function set_info_objetos_asociados($obj) + { + $this->obj_asociados = $obj; + } + + protected function asociar_dependencias($posibles) + { + $eis = $this->get_lista_dependencias_asociadas(); + foreach ($posibles as $posible) { + if (in_array($posible->rol_en_consumidor(), $eis)) { + $this->dependencias[] = $posible; + } + } + } + + protected function get_lista_dependencias_asociadas() + { + $lista = array(); + $id_pantalla = $this->datos['pantalla']; + foreach ($this->obj_asociados as $dep) { + if ($dep['pantalla'] == $id_pantalla) { + $lista[] = $dep['identificador_dep']; + } + } + return $lista; + } + + public function tiene_dependencia($dep) + { + return in_array($dep, $this->dependencias, true); + } + + public function clonar_subclase($dr, $dir_subclases, $proyecto_dest) + { + if (isset($this->datos['subclase_archivo'])) { + $filas = $dr->tabla('pantallas')->get_id_fila_condicion(array('pantalla' => $this->datos['pantalla']), false); + if (count($filas) != 1) { + toba_logger::instancia()->error("Imposible clonar subclase de pantalla {$this->datos['pantalla']}"); + throw new toba_error_modelo('Imposible clonar subclase de pantalla, revise el log'); + } + $fila = current($filas); + $archivo = $this->datos['subclase_archivo']; + $nuevo_archivo = $dir_subclases."/".basename($archivo); + + $id_pm_origen = $this->get_punto_montaje(); + $id_pm_destino = $dr->tabla('base')->get_fila_columna(0, 'punto_montaje'); + + //Busco los directorios de copia utilizando los puntos de montaje + $path_origen = $this->get_path_clonacion($id_pm_origen, $this->proyecto); + $path_destino = $this->get_path_clonacion($id_pm_destino, $proyecto_dest, $path_origen); + + //--- Si el dir. destino no existe, se lo crea + if (!file_exists($path_destino.$dir_subclases)) { + toba_manejador_archivos::crear_arbol_directorios($path_destino.$dir_subclases); + } + if (! copy($path_origen.$archivo, $path_destino.$nuevo_archivo)) { + toba_logger::instancia()->error('No es posible copiar el archivo desde '.$path_origen.$archivo.' hacia '.$path_destino.$nuevo_archivo); + throw new toba_error('No es posible copiar el archivo, revise el log'); + } + $dr->tabla('pantallas')->set_fila_columna_valor($fila, 'subclase_archivo', $nuevo_archivo); + } + } + + protected function get_path_clonacion($id_punto, $proyecto, $path_default='') + { + $path_final = $path_default; + $pm = toba_pms::instancia()->get_instancia_pm_proyecto($proyecto, $id_punto); //Instancio el pm para el proyecto + if (! is_null($pm)) { + $path_final = $pm->get_path_absoluto(). '/'; //Si existe recupero el path al punto, sino uso el generico del proyecto + } elseif (isset($proyecto)) { + $path_final = toba::instancia()->get_path_proyecto($proyecto).'/php/'; + } + return $path_final; + } + + //--------------------------------------------------------------------- + //-- Recorrible como ARBOL + //--------------------------------------------------------------------- + + public function get_hijos() + { + return $this->dependencias; + } + + public function es_hoja() + { + return (count($this->dependencias) == 0); + } + + public function tiene_propiedades() + { + return false; + } + + public function get_nombre_corto() + { + if ($this->datos['etiqueta'] != '') { + return str_replace('&', '', $this->datos['etiqueta']); + } else { + return $this->get_id(); + } + } + + public function get_nombre_largo() + { + if (isset($this->datos['descripcion']) && trim($this->datos['descripcion']) != '') { + return $this->datos['descripcion']; + } else { + return $this->get_nombre_corto(); + } + } + + public function get_id() + { + return $this->datos['identificador']; + } + + public function get_iconos() + { + $iconos = array(); + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba('objetos/pantalla.gif', false), + 'ayuda' => 'Pantalla dentro del [wiki:Referencia/Objetos/ci ci]' + ); + return $iconos; + } + + public function get_utilerias() + { + $param_editores = array(apex_hilo_qs_zona=> $this->proyecto. apex_qs_separador. + $this->id, + "pantalla" => $this->datos['identificador']); + $iconos = array(); + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("objetos/objeto_nuevo.gif", false), + 'ayuda' => "Crear un objeto asociado a la pantalla", + 'vinculo' => toba::vinculador()->get_url( + toba_editor::get_id(), + "1000247", + array('destino_tipo' => 'toba_ci_pantalla', + 'destino_proyecto' => $this->proyecto, + 'destino_id' => $this->id, + 'destino_pantalla' => $this->datos['pantalla']), + array( 'menu' => true, + 'celda_memoria' => 'central') + ), + 'plegado' => true + ); + if ($this->datos['subclase'] && $this->datos['subclase_archivo']) { + // Hay PHP asociado + if (admin_util::existe_archivo_subclase($this->datos['subclase_archivo'], $this->datos['punto_montaje'])) { + $iconos[] = toba_componente_info::get_utileria_editor_ver_php( + array( 'proyecto'=>$this->proyecto, + 'componente' =>$this->id ), + $this->datos['identificador'] + ); + $iconos[] = toba_componente_info::get_utileria_editor_abrir_php( + array( 'proyecto'=>$this->proyecto, + 'componente' =>$this->id ), + $this->datos['identificador'] + ); + } else { + $iconos[] = toba_componente_info::get_utileria_editor_ver_php( + array( 'proyecto'=>$this->proyecto, + 'componente' =>$this->id ), + $this->datos['identificador'], + 'nucleo/php_inexistente.gif', + false + ); + } + } + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("objetos/editar.gif", false), + 'ayuda' => "Editar esta pantalla", + 'vinculo' => toba::vinculador()->get_url( + toba_editor::get_id(), + "1000249", + $param_editores, + array( 'menu' => true, + 'celda_memoria' => 'central') + ), + 'plegado' => false + ); + return $iconos; + } + + public function get_info_extra() + { + return ""; + } + + public function tiene_hijos_cargados() + { + return true; + } + + public function get_padre() + { + return null; + } + + //------------------------------------------------------------------------ + //------ METACLASE ------------------------------------------------------- + //------------------------------------------------------------------------ + + public function get_nombre_instancia_abreviado() + { + return 'pant'; + } + + public function get_molde_subclase() + { + $molde = new toba_codigo_clase($this->get_subclase_nombre(), $this->get_clase_nombre()); + $ayuda = "Permite modificar la forma en que se grafica la pantalla, por defecto un componente sobre el otro"; + $comentarios = array( + $ayuda + ); + $metodo = new toba_codigo_metodo_php('generar_layout', array(), $comentarios); + $metodo->set_doc($ayuda); + $molde->agregar($metodo); + $php = array(); + $existe_previo = 0; + foreach ($this->get_lista_dependencias_asociadas() as $dep) { + if ($existe_previo) { + $php[] = "echo '
    ';"; + } + $php[] = '$this->dep(\''.$dep.'\')->generar_html();'; + $existe_previo = 1; + } + $molde->ultimo_elemento()->set_contenido($php); + return $molde; + } + + public function get_punto_montaje() + { + return $this->datos['punto_montaje']; + } + + public function get_subclase_nombre() + { + return $this->datos['subclase']; + } + + public function get_subclase_archivo() + { + return $this->datos['subclase_archivo']; + } + + public function get_clase_nombre() + { + return str_replace('objeto_', 'toba_', $this->datos['_info']['clase']); // Se deja esta línea para que conserve el mismo comportamiento + } + + public function get_clase_archivo() + { + return 'nucleo/componentes/interface/toba_ei_pantalla.php'; + } + + public function cambiar_clase_origen($nombre_clase) + { + $this->datos['_info']['clase'] = $nombre_clase; + } + + public function set_subclase($nombre, $archivo, $pm) + { + $db = toba_contexto_info::get_db(); + $nombre = $db->quote($nombre); + $archivo = $db->quote($archivo); + $pm = $db->quote($pm); + $id = $db->quote($this->id); + $sql = " + UPDATE apex_objeto_ci_pantalla + SET + subclase = $nombre, + subclase_archivo = $archivo, + punto_montaje = $pm + WHERE + objeto_ci_proyecto = '{$this->proyecto}' + AND objeto_ci = $id + AND pantalla = '{$this->datos['pantalla']}' + "; + toba::logger()->debug($sql); + $db->ejecutar($sql); + } + //--------------------------------------------------------------------- + + public function get_descripcion_subcomponente() + { + return 'Pantalla ' . $this->datos['identificador']; + } +} diff --git a/php/modelo/info/componentes/toba_cn_info.php b/php/modelo/info/componentes/toba_cn_info.php index dfce12eaaa..6502f19fab 100644 --- a/php/modelo/info/componentes/toba_cn_info.php +++ b/php/modelo/info/componentes/toba_cn_info.php @@ -2,90 +2,91 @@ class toba_cn_info extends toba_componente_info { - protected $cn_asociado = false; // Indica si el componente esta asociado en el contenedor + protected $cn_asociado = false; // Indica si el componente esta asociado en el contenedor - static function get_tipo_abreviado() - { - return "CN"; - } + public static function get_tipo_abreviado() + { + return "CN"; + } - function set_asociado($asociado=true) - { - $this->cn_asociado = $asociado; - } - - function get_utilerias() - { - $iconos = array(); - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("objetos/objeto_nuevo.gif", false), - 'ayuda' => "Crear un componente asociado al controlador", - 'vinculo' => toba::vinculador()->get_url(toba_editor::get_id(),"1000247", - array( 'destino_tipo' => 'toba_cn', - 'destino_proyecto' => $this->proyecto, - 'destino_id' => $this->id ), - array( 'menu' => true, - 'celda_memoria' => 'central') - ), - 'plegado' => true - ); - return array_merge($iconos, parent::get_utilerias()); - } + public function set_asociado($asociado=true) + { + $this->cn_asociado = $asociado; + } - function get_hijos() - { - // Un CN que esta asociado no muestra recursivamente sus asociaciones (puede haber relaciones circulares) - // El codigo se pone aca porque tiene que ser ejecutado despues del constructor para que el flag tenga efecto - // ... y esta es la unica ventana cuya ejecucion esta garantizada - if(!$this->cn_asociado) { - if( isset($this->datos['_info_consumo']) && - count($this->datos['_info_consumo']) > 0 ) { - $cantidad_subelementos = count($this->subelementos); - for ( $a=0; $adatos['_info_consumo']); $a++) { - $clave['proyecto'] = $this->datos['_info_consumo'][$a]['proyecto']; - $clave['componente'] = $this->datos['_info_consumo'][$a]['objeto']; - $tipo = $this->datos['_info_consumo'][$a]['clase']; - $id = $cantidad_subelementos + $a; - $this->subelementos[$id]= toba_constructor::get_info( $clave, $tipo, $this->carga_profundidad, null, true, $this->datos_resumidos); - $this->subelementos[$id]->set_consumidor($this, $this->datos['_info_consumo'][$a] ); - $this->subelementos[$id]->set_asociado(); - } - } - } - return $this->subelementos; - } + public function get_utilerias() + { + $iconos = array(); + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("objetos/objeto_nuevo.gif", false), + 'ayuda' => "Crear un componente asociado al controlador", + 'vinculo' => toba::vinculador()->get_url( + toba_editor::get_id(), + "1000247", + array( 'destino_tipo' => 'toba_cn', + 'destino_proyecto' => $this->proyecto, + 'destino_id' => $this->id ), + array( 'menu' => true, + 'celda_memoria' => 'central') + ), + 'plegado' => true + ); + return array_merge($iconos, parent::get_utilerias()); + } - function es_hoja() - { - return !$this->tiene_hijos_cargados(); - } + public function get_hijos() + { + // Un CN que esta asociado no muestra recursivamente sus asociaciones (puede haber relaciones circulares) + // El codigo se pone aca porque tiene que ser ejecutado despues del constructor para que el flag tenga efecto + // ... y esta es la unica ventana cuya ejecucion esta garantizada + if (!$this->cn_asociado) { + if (isset($this->datos['_info_consumo']) && + count($this->datos['_info_consumo']) > 0) { + $cantidad_subelementos = count($this->subelementos); + for ($a=0; $adatos['_info_consumo']); $a++) { + $clave['proyecto'] = $this->datos['_info_consumo'][$a]['proyecto']; + $clave['componente'] = $this->datos['_info_consumo'][$a]['objeto']; + $tipo = $this->datos['_info_consumo'][$a]['clase']; + $id = $cantidad_subelementos + $a; + $this->subelementos[$id]= toba_constructor::get_info($clave, $tipo, $this->carga_profundidad, null, true, $this->datos_resumidos); + $this->subelementos[$id]->set_consumidor($this, $this->datos['_info_consumo'][$a]); + $this->subelementos[$id]->set_asociado(); + } + } + } + return $this->subelementos; + } - function tiene_hijos_cargados() - { - $tiene_deps = ($this->datos['_info']['cant_dependencias'] > 0); - $consume_cns = isset($this->datos['_info_consumo']) && count($this->datos['_info_consumo']) > 0; - $tiene_hijos = $tiene_deps || ($consume_cns && ! $this->cn_asociado); - return $tiene_hijos; - } + public function es_hoja() + { + return !$this->tiene_hijos_cargados(); + } - function get_estilo_css_li() - { - if($this->cn_asociado) { - return "background-color: #FFD87C; font-style: italic;"; - } - } + public function tiene_hijos_cargados() + { + $tiene_deps = ($this->datos['_info']['cant_dependencias'] > 0); + $consume_cns = isset($this->datos['_info_consumo']) && count($this->datos['_info_consumo']) > 0; + $tiene_hijos = $tiene_deps || ($consume_cns && ! $this->cn_asociado); + return $tiene_hijos; + } - //--------------------------------------------------------------------- - //-- METACLASE - //--------------------------------------------------------------------- + public function get_estilo_css_li() + { + if ($this->cn_asociado) { + return "background-color: #FFD87C; font-style: italic;"; + } + } - function get_molde_subclase($multilinea=false) - { - $molde = $this->get_molde_vacio(); - $molde->agregar( new toba_codigo_metodo_php('ini') ); - $molde->agregar( new toba_codigo_metodo_php('evt__validar_datos') ); - $molde->agregar( new toba_codigo_metodo_php('evt__procesar_especifico') ); - return $molde; - } + //--------------------------------------------------------------------- + //-- METACLASE + //--------------------------------------------------------------------- + + public function get_molde_subclase($multilinea=false) + { + $molde = $this->get_molde_vacio(); + $molde->agregar(new toba_codigo_metodo_php('ini')); + $molde->agregar(new toba_codigo_metodo_php('evt__validar_datos')); + $molde->agregar(new toba_codigo_metodo_php('evt__procesar_especifico')); + return $molde; + } } -?> \ No newline at end of file diff --git a/php/modelo/info/componentes/toba_componente_info.php b/php/modelo/info/componentes/toba_componente_info.php index 3a689b6b48..e4487300e3 100644 --- a/php/modelo/info/componentes/toba_componente_info.php +++ b/php/modelo/info/componentes/toba_componente_info.php @@ -1,494 +1,497 @@ -carga_profundidad = $carga_profundidad; - $this->datos = $datos; - $this->datos_resumidos = $datos_resumidos; - $this->id = $this->datos['_info']['objeto']; - $this->proyecto = $this->datos['_info']['proyecto']; - if ($this->carga_profundidad) { - $this->cargar_dependencias(); - } - } - - function cargar_dependencias() - { - //Si hay objetos asociados... - if( isset($this->datos['_info_dependencias']) && - count($this->datos['_info_dependencias']) > 0 ) { - for ( $a=0; $adatos['_info_dependencias']); $a++) { - $clave['proyecto'] = $this->datos['_info_dependencias'][$a]['proyecto']; - $clave['componente'] = $this->datos['_info_dependencias'][$a]['objeto']; - $tipo = $this->datos['_info_dependencias'][$a]['clase']; - $this->subelementos[$a]= toba_constructor::get_info( $clave, $tipo, $this->carga_profundidad, null, true, $this->datos_resumidos); - $this->subelementos[$a]->set_consumidor($this, $this->datos['_info_dependencias'][$a] ); - } - } - } - - function set_consumidor($consumidor, $datos_consumidor) - { - $this->consumidor = $consumidor; - $this->datos_consumidor = $datos_consumidor; - } - - function tiene_consumidor() - { - return isset($this->datos_consumidor['identificador']); - } - - function rol_en_consumidor() - { - return $this->datos_consumidor['identificador']; - } - - function get_metadatos_subcomponente() - { - return array(); - } - - function acceso_zona($parametros = array()) - { - $parametros[apex_hilo_qs_zona] = $this->proyecto . apex_qs_separador . $this->id; - return $parametros; - } - - function vinculo_editor($parametros = array()) - { - $editor_item = $this->datos['_info']['clase_editor_item']; - $editor_proyecto = $this->datos['_info']['clase_editor_proyecto']; - return toba::vinculador()->get_url( $editor_proyecto, $editor_item, $this->acceso_zona($parametros), - array( 'menu' => true, - 'celda_memoria' => 'central') - ); - } - - function get_fuente_datos() - { - return $this->datos['_info']['fuente']; - } - - /** - * Duplica un objeto y sus dependencias recursivamente - * - * @param array $nuevos_datos Datos a modificar en la base del objeto. Para anexar algo al nombre se utiliza el campo 'anexo_nombre' - * @param boolean/string $dir_subclases Si el componente tiene subclases clona los archivos, en caso afirmativo indicar la ruta destino (relativa) - * @param boolean $con_transaccion Indica si la clonación se debe incluír en una transaccion - * @return array Clave del objeto que resulta del clonado - */ - function clonar($nuevos_datos, $dir_subclases=false, $con_transaccion = true) - { - //Se busca el id del datos_relacion de la clase - $id_dr = toba_info_editores::get_dr_de_clase($this->datos['_info']['clase']); - - //Se construye el objeto datos_relacion - $componente = array('proyecto' => $id_dr[0], 'componente' => $id_dr[1]); - $dr = toba_constructor::get_runtime($componente); - $dr->inicializar(); - - //Se carga con el id_origen - $dr->cargar(array('proyecto' => $this->proyecto, 'objeto' => $this->id)); - foreach ($nuevos_datos as $campo => $valor) { - if ($campo == 'anexo_nombre') { - $campo = 'nombre'; - $valor = $valor . $dr->tabla('base')->get_fila_columna(0, $campo); - } - $dr->tabla('base')->set_fila_columna_valor(0, $campo, $valor); - } - - //Se le fuerza una inserción a los datos_tabla - //Como la clave de los objetos son secuencias, esto garantiza claves nuevas - $dr->forzar_insercion(); - if (!$con_transaccion) { - $dr->persistidor()->desactivar_transaccion(); - } - - //--- Si tiene subclase, se copia el archivo y se cambia - if ($dir_subclases !== false) { - $proyecto_dest = isset($nuevos_datos['proyecto']) ? $nuevos_datos['proyecto'] : null; - $this->clonar_subclase($dr, $dir_subclases, $proyecto_dest); - } - - //--- Se reemplazan los datos y se clonan los hijos - foreach ($this->subelementos as $hijo) { - //-- Si se especifico un proyecto, se propaga - $datos_objeto = array(); - if (isset($nuevos_datos['proyecto'])) { - $datos_objeto['proyecto'] = $nuevos_datos['proyecto']; - } - //-- Si se especifica un anexo de nombre, se propaga - if (isset($nuevos_datos['anexo_nombre'])) { - $datos_objeto['anexo_nombre'] = $nuevos_datos['anexo_nombre']; - } - //-- La fuente tambien se propaga - if (isset($nuevos_datos['fuente_datos_proyecto'])) { - $datos_objeto['fuente_datos_proyecto'] = $nuevos_datos['fuente_datos_proyecto']; - } - if (isset($nuevos_datos['fuente_datos'])) { - $datos_objeto['fuente_datos'] = $nuevos_datos['fuente_datos']; - } - //-- Punto de montaje tambien se propaga - if (isset($nuevos_datos['punto_montaje'])) { - $datos_objeto['punto_montaje'] = $nuevos_datos['punto_montaje']; - } - - //-- SE CLONA - $id_clon = $hijo->clonar($datos_objeto, $dir_subclases, $con_transaccion); - //--- En el componente actual se reemplaza la dependencia por el clon - $id_fila = $dr->tabla('dependencias')->get_id_fila_condicion( - array('identificador' => $hijo->rol_en_consumidor())); - $dr->tabla('dependencias')->modificar_fila(current($id_fila), - array('objeto_proveedor' => $id_clon['componente'])); - } - //Se intenta acceder a las pantallas/db_registros para pasarle el nuevo punto de montaje - if (isset($nuevos_datos['punto_montaje'])) { - //Trato de setear el punto de montaje para las pantallas - try { - $dr->tabla('pantallas')->set_columna_valor('punto_montaje', $nuevos_datos['punto_montaje']); - } catch (Exception $e) { - - } - //Trato de setear el punto de montaje para las propiedades basicas - try { - $dr->tabla('prop_basicas')->set_columna_valor('punto_montaje', $nuevos_datos['punto_montaje']); - } catch (Exception $e) { - - } - //Trato de setear el punto de montaje para los efs - try { - $dr->tabla('efs')->set_columna_valor('punto_montaje', $nuevos_datos['punto_montaje']); - } catch (Exception $e) { - - } - //Trato de setear el punto de montaje para las columnas del filtro - try { - $dr->tabla('cols')->set_columna_valor('punto_montaje', $nuevos_datos['punto_montaje']); - } catch (Exception $e) { - - } - //Trato de setear el punto de montaje para las columnas externas del datos tabla - try { - $dr->tabla('externas')->set_columna_valor('punto_montaje', $nuevos_datos['punto_montaje']); - } catch (Exception $e) { - - } - } - $dr->sincronizar(); - - //Se busca la clave del nuevo objeto - $clave = $dr->tabla('base')->get_clave_valor(0); - $clave['componente'] = $clave['objeto']; - return $clave; - } - - protected function clonar_subclase($dr, $dir_subclases, $proyecto_dest) - { - if (isset($this->datos['_info']['subclase_archivo'])) { - $archivo = $this->datos['_info']['subclase_archivo']; - $nuevo_archivo = $dir_subclases."/".basename($archivo); - - $id_pm_origen = $this->get_punto_montaje(); - $id_pm_destino = $dr->tabla('base')->get_fila_columna(0, 'punto_montaje'); - - //Busco los directorios de copia utilizando los puntos de montaje - $path_origen = $this->get_path_clonacion($id_pm_origen,$this->proyecto); - $path_destino = $this->get_path_clonacion($id_pm_destino, $proyecto_dest, $path_origen); - - $dr->tabla('base')->set_fila_columna_valor(0, 'subclase_archivo', $nuevo_archivo); - //--- Si el dir. destino no existe, se lo crea - if (!file_exists($path_destino.$dir_subclases)) { - toba_manejador_archivos::crear_arbol_directorios($path_destino.$dir_subclases); - } - if (! copy($path_origen.$archivo, $path_destino.$nuevo_archivo)) { - toba_logger::instancia()->error('No es posible copiar el archivo desde '.$path_origen.$archivo.' hacia '.$path_destino.$nuevo_archivo); - throw new toba_error('No es posible copiar el archivo, revise el log'); - } - } - } - - protected function get_path_clonacion($id_punto, $proyecto, $path_default='') - { - $path_final = $path_default; - $pm = toba_pms::instancia()->get_instancia_pm_proyecto($proyecto, $id_punto); //Instancio el pm para el proyecto - if (! is_null($pm)) { - $path_final = $pm->get_path_absoluto(). '/'; //Si existe recupero el path al punto, sino uso el generico del proyecto - } elseif (isset($proyecto)) { - $path_final = toba::instancia()->get_path_proyecto($proyecto).'/php/'; - } - return $path_final; - } - - //--------------------------------------------------------------------- - //-- Recorrible como ARBOL - //--------------------------------------------------------------------- - - function get_id() - { - return $this->id; - } - - function get_hijos() - { - return $this->subelementos; - } - - function get_padre() - { - return null; - } - - function es_hoja() - { - return $this->datos['_info']['cant_dependencias'] == 0; - } - - function tiene_propiedades() - { - return false; - } - - function get_nombre_corto() - { - $nombre_objeto = $this->datos['_info']['nombre']; - if ($this->tiene_consumidor()) - $nombre = $this->rol_en_consumidor(); - else - $nombre = $nombre_objeto; - return $nombre; - } - - function get_nombre_largo() - { - $nombre_objeto = $this->datos['_info']['nombre']; - if ($this->tiene_consumidor()) - $nombre = "$nombre_objeto
    Rol: ".$this->rol_en_consumidor(); - else - $nombre = $nombre_objeto; - return $nombre; - } - - function get_nombre() - { - return $this->datos['_info']['nombre']; - } - - function get_iconos() - { - $clase_corto = substr($this->datos['_info']['clase'], 5); - $iconos = array(); - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba($this->datos['_info']['clase_icono'], false), - 'ayuda' => "Componente [wiki:Referencia/Objetos/$clase_corto $clase_corto]" - ); - return $iconos; - } - - function get_utilerias() - { - $iconos = array(); - if (isset($this->datos['_info']['subclase_archivo'])) { - // Administracion de la Subclase PHP} - if (admin_util::existe_archivo_subclase($this->datos['_info']['subclase_archivo'], $this->datos['_info']['punto_montaje'])) { - $iconos[] = $this->get_utileria_editor_abrir_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id )); - $iconos[] = $this->get_utileria_editor_ver_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id )); - } else { - $iconos[] = $this->get_utileria_editor_ver_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id ), null, 'nucleo/php_inexistente.gif', false); - } - } - //Editor - if (isset($this->datos['_info']['clase_editor_proyecto'])) { - $ayuda = null; - if (in_array($this->datos['_info']['clase'], toba_info_editores::get_lista_tipo_componentes())) { - $metodo = "get_pantallas_".$this->datos['_info']['clase']; - $pantallas = call_user_func(array("toba_datos_editores", $metodo)); - //-- Se incluye un vinculo a cada pantalla encontrada - $ayuda = "
    "; - foreach ($pantallas as $pantalla) { - $img = ($pantalla['imagen'] != '') ? $pantalla['imagen'] : "objetos/fantasma.gif"; - $origen = ($pantalla['imagen'] != '') ? $pantalla['imagen_recurso_origen'] : 'apex'; - $vinculo = $this->vinculo_editor(array('etapa' => $pantalla['identificador'])); - $tag_img = ($origen == 'apex') ? toba_recurso::imagen_toba($img, true) : toba_recurso::imagen_proyecto($img, true); - $ayuda .= '". - $tag_img. - ' '; - } - $ayuda .= "
    "; - $ayuda = str_replace("'", "\\'", $ayuda); - } - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("objetos/editar.gif", false), - 'ayuda' => $ayuda, - 'vinculo' => $this->vinculo_editor() - ); - } - return $iconos; - } - - function get_info_extra() - { - return $this->info_extra; - } - - function set_info_extra($info) - { - $this->info_extra .= $info; - } - - function tiene_hijos_cargados() - { - return !$this->es_hoja() && count($this->subelementos) != 0; - } - - function contiene_objeto($id) - { - if ($id == $this->get_id()) { - return true; - } - foreach ($this->subelementos as $elem) { - if ($elem->contiene_objeto($id)) { - return true; - } - } - } - - //--------------------------------------------------------------------- - // ACCESO al EDITOR PHP - //--------------------------------------------------------------------- - - static function get_utileria_editor_parametros($id_componente, $subcomponente=null) - { - $parametros[apex_hilo_qs_zona] = $id_componente['proyecto'] . apex_qs_separador . $id_componente['componente']; - if($subcomponente) { - $parametros['subcomponente'] = $subcomponente; - } - return $parametros; - } - - static function get_utileria_editor_abrir_php($id_componente, $subcomponente=null, $icono='reflexion/abrir.gif') - { - $parametros = self::get_utileria_editor_parametros($id_componente, $subcomponente); - $opciones = array('servicio' => 'ejecutar', 'zona' => true, 'celda_memoria' => 'ajax', 'menu' => true); - $vinculo = toba::vinculador()->get_url(toba_editor::get_id(),"3463", $parametros, $opciones); - $js = "toba.comunicar_vinculo('$vinculo')"; - return array( - 'imagen' => toba_recurso::imagen_proyecto($icono, false), - 'ayuda' => 'Abrir la [wiki:Referencia/Objetos/Extension extensión PHP] en el editor del escritorio.' . - '
    Ver [wiki:Referencia/AbrirPhp Configuración]', - 'vinculo' => "javascript: $js;", - 'js' => $js, - 'target' => '', - 'plegado' => false - ); - } - - static function get_utileria_editor_ver_php($id_componente, $subcomponente=null, $icono = 'nucleo/php.gif', $plegado = true) - { - $parametros = self::get_utileria_editor_parametros($id_componente, $subcomponente); - $opciones = array('zona' => true, 'celda_memoria' => 'central', 'menu' => true);//validar' => false, - $vinculo = toba::vinculador()->get_url(toba_editor::get_id(),"3463", $parametros, $opciones); - return array( 'imagen' => toba_recurso::imagen_toba($icono, false), - 'ayuda' => 'Ver o editar la [wiki:Referencia/Objetos/Extension extensión PHP]', - 'vinculo' => $vinculo, - 'plegado' => $plegado - ); - } - - //--------------------------------------------------------------------- - //-- METACLASE - //--------------------------------------------------------------------- - - /** - * Retorna el nombre de la clase o la subclase asociada al componente - */ - function get_clase_nombre_final() - { - $nombre = $this->get_subclase_nombre(); - if ($nombre == '') { - $nombre = $this->get_clase_extendida_nombre(); - } - return $nombre; - } - - function get_clase_nombre() - { - return str_replace('objeto_', 'toba_', $this->datos['_info']['clase']); // Se deja esta línea para que conserve el mismo comportamiento - } - - function get_clase_extendida_nombre() - { - $id_proyecto = toba_contexto_info::get_proyecto(); - $id_instancia = toba::instancia()->get_id(); - $proyecto = toba_modelo_catalogo::instanciacion()->get_proyecto($id_instancia, $id_proyecto); - - if ($proyecto->tiene_clases_proyecto_extendidas()) { - $replacement = $id_proyecto.'_pers_'; - } elseif ($proyecto->tiene_clases_toba_extendidas()) { - $replacement = $id_proyecto.'_'; - } else { - $replacement = 'toba_'; - } - $aux = str_replace('objeto_', 'toba_', $this->datos['_info']['clase']); // Se deja esta línea para que conserve el mismo comportamiento - return str_replace('toba_', $replacement, $aux); - } - - function get_clase_archivo() - { - return $this->datos['_info']['clase_archivo']; - } - - function get_subclase_nombre() - { - return $this->datos['_info']['subclase']; - } - - function get_subclase_archivo() - { - return $this->datos['_info']['subclase_archivo']; - } - - function get_punto_montaje() - { - return $this->datos['_info']['punto_montaje']; - } - - function get_molde_vacio() - { - $molde = new toba_codigo_clase( $this->get_subclase_nombre(), $this->get_clase_extendida_nombre() ); - //-- Ini - $doc = 'Se ejecuta al inicio de todos los request en donde participa el componente'; - $metodo = new toba_codigo_metodo_php('ini', array(), array($doc)); - $metodo->set_doc($doc); - $molde->agregar($metodo); - return $molde; - } - - function get_nombre_instancia_abreviado() - { - return "componente"; - } - - function set_subclase($nombre, $archivo, $pm) - { - $db = toba_contexto_info::get_db(); - $nombre = $db->quote($nombre); - $archivo = $db->quote($archivo); - $pm = $db->quote($pm); - $id = $db->quote($this->id); - $sql = " +carga_profundidad = $carga_profundidad; + $this->datos = $datos; + $this->datos_resumidos = $datos_resumidos; + $this->id = $this->datos['_info']['objeto']; + $this->proyecto = $this->datos['_info']['proyecto']; + if ($this->carga_profundidad) { + $this->cargar_dependencias(); + } + } + + public function cargar_dependencias() + { + //Si hay objetos asociados... + if (isset($this->datos['_info_dependencias']) && + count($this->datos['_info_dependencias']) > 0) { + for ($a=0; $adatos['_info_dependencias']); $a++) { + $clave['proyecto'] = $this->datos['_info_dependencias'][$a]['proyecto']; + $clave['componente'] = $this->datos['_info_dependencias'][$a]['objeto']; + $tipo = $this->datos['_info_dependencias'][$a]['clase']; + $this->subelementos[$a]= toba_constructor::get_info($clave, $tipo, $this->carga_profundidad, null, true, $this->datos_resumidos); + $this->subelementos[$a]->set_consumidor($this, $this->datos['_info_dependencias'][$a]); + } + } + } + + public function set_consumidor($consumidor, $datos_consumidor) + { + $this->consumidor = $consumidor; + $this->datos_consumidor = $datos_consumidor; + } + + public function tiene_consumidor() + { + return isset($this->datos_consumidor['identificador']); + } + + public function rol_en_consumidor() + { + return $this->datos_consumidor['identificador']; + } + + public function get_metadatos_subcomponente() + { + return array(); + } + + public function acceso_zona($parametros = array()) + { + $parametros[apex_hilo_qs_zona] = $this->proyecto . apex_qs_separador . $this->id; + return $parametros; + } + + public function vinculo_editor($parametros = array()) + { + $editor_item = $this->datos['_info']['clase_editor_item']; + $editor_proyecto = $this->datos['_info']['clase_editor_proyecto']; + return toba::vinculador()->get_url( + $editor_proyecto, + $editor_item, + $this->acceso_zona($parametros), + array( 'menu' => true, + 'celda_memoria' => 'central') + ); + } + + public function get_fuente_datos() + { + return $this->datos['_info']['fuente']; + } + + /** + * Duplica un objeto y sus dependencias recursivamente + * + * @param array $nuevos_datos Datos a modificar en la base del objeto. Para anexar algo al nombre se utiliza el campo 'anexo_nombre' + * @param boolean/string $dir_subclases Si el componente tiene subclases clona los archivos, en caso afirmativo indicar la ruta destino (relativa) + * @param boolean $con_transaccion Indica si la clonación se debe incluír en una transaccion + * @return array Clave del objeto que resulta del clonado + */ + public function clonar($nuevos_datos, $dir_subclases=false, $con_transaccion = true) + { + //Se busca el id del datos_relacion de la clase + $id_dr = toba_info_editores::get_dr_de_clase($this->datos['_info']['clase']); + + //Se construye el objeto datos_relacion + $componente = array('proyecto' => $id_dr[0], 'componente' => $id_dr[1]); + $dr = toba_constructor::get_runtime($componente); + $dr->inicializar(); + + //Se carga con el id_origen + $dr->cargar(array('proyecto' => $this->proyecto, 'objeto' => $this->id)); + foreach ($nuevos_datos as $campo => $valor) { + if ($campo == 'anexo_nombre') { + $campo = 'nombre'; + $valor = $valor . $dr->tabla('base')->get_fila_columna(0, $campo); + } + $dr->tabla('base')->set_fila_columna_valor(0, $campo, $valor); + } + + //Se le fuerza una inserción a los datos_tabla + //Como la clave de los objetos son secuencias, esto garantiza claves nuevas + $dr->forzar_insercion(); + if (!$con_transaccion) { + $dr->persistidor()->desactivar_transaccion(); + } + + //--- Si tiene subclase, se copia el archivo y se cambia + if ($dir_subclases !== false) { + $proyecto_dest = isset($nuevos_datos['proyecto']) ? $nuevos_datos['proyecto'] : null; + $this->clonar_subclase($dr, $dir_subclases, $proyecto_dest); + } + + //--- Se reemplazan los datos y se clonan los hijos + foreach ($this->subelementos as $hijo) { + //-- Si se especifico un proyecto, se propaga + $datos_objeto = array(); + if (isset($nuevos_datos['proyecto'])) { + $datos_objeto['proyecto'] = $nuevos_datos['proyecto']; + } + //-- Si se especifica un anexo de nombre, se propaga + if (isset($nuevos_datos['anexo_nombre'])) { + $datos_objeto['anexo_nombre'] = $nuevos_datos['anexo_nombre']; + } + //-- La fuente tambien se propaga + if (isset($nuevos_datos['fuente_datos_proyecto'])) { + $datos_objeto['fuente_datos_proyecto'] = $nuevos_datos['fuente_datos_proyecto']; + } + if (isset($nuevos_datos['fuente_datos'])) { + $datos_objeto['fuente_datos'] = $nuevos_datos['fuente_datos']; + } + //-- Punto de montaje tambien se propaga + if (isset($nuevos_datos['punto_montaje'])) { + $datos_objeto['punto_montaje'] = $nuevos_datos['punto_montaje']; + } + + //-- SE CLONA + $id_clon = $hijo->clonar($datos_objeto, $dir_subclases, $con_transaccion); + //--- En el componente actual se reemplaza la dependencia por el clon + $id_fila = $dr->tabla('dependencias')->get_id_fila_condicion( + array('identificador' => $hijo->rol_en_consumidor()) + ); + $dr->tabla('dependencias')->modificar_fila( + current($id_fila), + array('objeto_proveedor' => $id_clon['componente']) + ); + } + //Se intenta acceder a las pantallas/db_registros para pasarle el nuevo punto de montaje + if (isset($nuevos_datos['punto_montaje'])) { + //Trato de setear el punto de montaje para las pantallas + try { + $dr->tabla('pantallas')->set_columna_valor('punto_montaje', $nuevos_datos['punto_montaje']); + } catch (Exception $e) { + } + //Trato de setear el punto de montaje para las propiedades basicas + try { + $dr->tabla('prop_basicas')->set_columna_valor('punto_montaje', $nuevos_datos['punto_montaje']); + } catch (Exception $e) { + } + //Trato de setear el punto de montaje para los efs + try { + $dr->tabla('efs')->set_columna_valor('punto_montaje', $nuevos_datos['punto_montaje']); + } catch (Exception $e) { + } + //Trato de setear el punto de montaje para las columnas del filtro + try { + $dr->tabla('cols')->set_columna_valor('punto_montaje', $nuevos_datos['punto_montaje']); + } catch (Exception $e) { + } + //Trato de setear el punto de montaje para las columnas externas del datos tabla + try { + $dr->tabla('externas')->set_columna_valor('punto_montaje', $nuevos_datos['punto_montaje']); + } catch (Exception $e) { + } + } + $dr->sincronizar(); + + //Se busca la clave del nuevo objeto + $clave = $dr->tabla('base')->get_clave_valor(0); + $clave['componente'] = $clave['objeto']; + return $clave; + } + + protected function clonar_subclase($dr, $dir_subclases, $proyecto_dest) + { + if (isset($this->datos['_info']['subclase_archivo'])) { + $archivo = $this->datos['_info']['subclase_archivo']; + $nuevo_archivo = $dir_subclases."/".basename($archivo); + + $id_pm_origen = $this->get_punto_montaje(); + $id_pm_destino = $dr->tabla('base')->get_fila_columna(0, 'punto_montaje'); + + //Busco los directorios de copia utilizando los puntos de montaje + $path_origen = $this->get_path_clonacion($id_pm_origen, $this->proyecto); + $path_destino = $this->get_path_clonacion($id_pm_destino, $proyecto_dest, $path_origen); + + $dr->tabla('base')->set_fila_columna_valor(0, 'subclase_archivo', $nuevo_archivo); + //--- Si el dir. destino no existe, se lo crea + if (!file_exists($path_destino.$dir_subclases)) { + toba_manejador_archivos::crear_arbol_directorios($path_destino.$dir_subclases); + } + if (! copy($path_origen.$archivo, $path_destino.$nuevo_archivo)) { + toba_logger::instancia()->error('No es posible copiar el archivo desde '.$path_origen.$archivo.' hacia '.$path_destino.$nuevo_archivo); + throw new toba_error('No es posible copiar el archivo, revise el log'); + } + } + } + + protected function get_path_clonacion($id_punto, $proyecto, $path_default='') + { + $path_final = $path_default; + $pm = toba_pms::instancia()->get_instancia_pm_proyecto($proyecto, $id_punto); //Instancio el pm para el proyecto + if (! is_null($pm)) { + $path_final = $pm->get_path_absoluto(). '/'; //Si existe recupero el path al punto, sino uso el generico del proyecto + } elseif (isset($proyecto)) { + $path_final = toba::instancia()->get_path_proyecto($proyecto).'/php/'; + } + return $path_final; + } + + //--------------------------------------------------------------------- + //-- Recorrible como ARBOL + //--------------------------------------------------------------------- + + public function get_id() + { + return $this->id; + } + + public function get_hijos() + { + return $this->subelementos; + } + + public function get_padre() + { + return null; + } + + public function es_hoja() + { + return $this->datos['_info']['cant_dependencias'] == 0; + } + + public function tiene_propiedades() + { + return false; + } + + public function get_nombre_corto() + { + $nombre_objeto = $this->datos['_info']['nombre']; + if ($this->tiene_consumidor()) { + $nombre = $this->rol_en_consumidor(); + } else { + $nombre = $nombre_objeto; + } + return $nombre; + } + + public function get_nombre_largo() + { + $nombre_objeto = $this->datos['_info']['nombre']; + if ($this->tiene_consumidor()) { + $nombre = "$nombre_objeto
    Rol: ".$this->rol_en_consumidor(); + } else { + $nombre = $nombre_objeto; + } + return $nombre; + } + + public function get_nombre() + { + return $this->datos['_info']['nombre']; + } + + public function get_iconos() + { + $clase_corto = substr($this->datos['_info']['clase'], 5); + $iconos = array(); + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba($this->datos['_info']['clase_icono'], false), + 'ayuda' => "Componente [wiki:Referencia/Objetos/$clase_corto $clase_corto]" + ); + return $iconos; + } + + public function get_utilerias() + { + $iconos = array(); + if (isset($this->datos['_info']['subclase_archivo'])) { + // Administracion de la Subclase PHP} + if (admin_util::existe_archivo_subclase($this->datos['_info']['subclase_archivo'], $this->datos['_info']['punto_montaje'])) { + $iconos[] = $this->get_utileria_editor_abrir_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id )); + $iconos[] = $this->get_utileria_editor_ver_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id )); + } else { + $iconos[] = $this->get_utileria_editor_ver_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id ), null, 'nucleo/php_inexistente.gif', false); + } + } + //Editor + if (isset($this->datos['_info']['clase_editor_proyecto'])) { + $ayuda = null; + if (in_array($this->datos['_info']['clase'], toba_info_editores::get_lista_tipo_componentes())) { + $metodo = "get_pantallas_".$this->datos['_info']['clase']; + $pantallas = call_user_func(array("toba_datos_editores", $metodo)); + //-- Se incluye un vinculo a cada pantalla encontrada + $ayuda = "
    "; + foreach ($pantallas as $pantalla) { + $img = ($pantalla['imagen'] != '') ? $pantalla['imagen'] : "objetos/fantasma.gif"; + $origen = ($pantalla['imagen'] != '') ? $pantalla['imagen_recurso_origen'] : 'apex'; + $vinculo = $this->vinculo_editor(array('etapa' => $pantalla['identificador'])); + $tag_img = ($origen == 'apex') ? toba_recurso::imagen_toba($img, true) : toba_recurso::imagen_proyecto($img, true); + $ayuda .= '". + $tag_img. + ' '; + } + $ayuda .= "
    "; + $ayuda = str_replace("'", "\\'", $ayuda); + } + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("objetos/editar.gif", false), + 'ayuda' => $ayuda, + 'vinculo' => $this->vinculo_editor() + ); + } + return $iconos; + } + + public function get_info_extra() + { + return $this->info_extra; + } + + public function set_info_extra($info) + { + $this->info_extra .= $info; + } + + public function tiene_hijos_cargados() + { + return !$this->es_hoja() && count($this->subelementos) != 0; + } + + public function contiene_objeto($id) + { + if ($id == $this->get_id()) { + return true; + } + foreach ($this->subelementos as $elem) { + if ($elem->contiene_objeto($id)) { + return true; + } + } + } + + //--------------------------------------------------------------------- + // ACCESO al EDITOR PHP + //--------------------------------------------------------------------- + + public static function get_utileria_editor_parametros($id_componente, $subcomponente=null) + { + $parametros[apex_hilo_qs_zona] = $id_componente['proyecto'] . apex_qs_separador . $id_componente['componente']; + if ($subcomponente) { + $parametros['subcomponente'] = $subcomponente; + } + return $parametros; + } + + public static function get_utileria_editor_abrir_php($id_componente, $subcomponente=null, $icono='reflexion/abrir.gif') + { + $parametros = self::get_utileria_editor_parametros($id_componente, $subcomponente); + $opciones = array('servicio' => 'ejecutar', 'zona' => true, 'celda_memoria' => 'ajax', 'menu' => true); + $vinculo = toba::vinculador()->get_url(toba_editor::get_id(), "3463", $parametros, $opciones); + $js = "toba.comunicar_vinculo('$vinculo')"; + return array( + 'imagen' => toba_recurso::imagen_proyecto($icono, false), + 'ayuda' => 'Abrir la [wiki:Referencia/Objetos/Extension extensión PHP] en el editor del escritorio.' . + '
    Ver [wiki:Referencia/AbrirPhp Configuración]', + 'vinculo' => "javascript: $js;", + 'js' => $js, + 'target' => '', + 'plegado' => false + ); + } + + public static function get_utileria_editor_ver_php($id_componente, $subcomponente=null, $icono = 'nucleo/php.gif', $plegado = true) + { + $parametros = self::get_utileria_editor_parametros($id_componente, $subcomponente); + $opciones = array('zona' => true, 'celda_memoria' => 'central', 'menu' => true);//validar' => false, + $vinculo = toba::vinculador()->get_url(toba_editor::get_id(), "3463", $parametros, $opciones); + return array( 'imagen' => toba_recurso::imagen_toba($icono, false), + 'ayuda' => 'Ver o editar la [wiki:Referencia/Objetos/Extension extensión PHP]', + 'vinculo' => $vinculo, + 'plegado' => $plegado + ); + } + + //--------------------------------------------------------------------- + //-- METACLASE + //--------------------------------------------------------------------- + + /** + * Retorna el nombre de la clase o la subclase asociada al componente + */ + public function get_clase_nombre_final() + { + $nombre = $this->get_subclase_nombre(); + if ($nombre == '') { + $nombre = $this->get_clase_extendida_nombre(); + } + return $nombre; + } + + public function get_clase_nombre() + { + return str_replace('objeto_', 'toba_', $this->datos['_info']['clase']); // Se deja esta línea para que conserve el mismo comportamiento + } + + public function get_clase_extendida_nombre() + { + $id_proyecto = toba_contexto_info::get_proyecto(); + $id_instancia = toba::instancia()->get_id(); + $proyecto = toba_modelo_catalogo::instanciacion()->get_proyecto($id_instancia, $id_proyecto); + + if ($proyecto->tiene_clases_proyecto_extendidas()) { + $replacement = $id_proyecto.'_pers_'; + } elseif ($proyecto->tiene_clases_toba_extendidas()) { + $replacement = $id_proyecto.'_'; + } else { + $replacement = 'toba_'; + } + $aux = str_replace('objeto_', 'toba_', $this->datos['_info']['clase']); // Se deja esta línea para que conserve el mismo comportamiento + return str_replace('toba_', $replacement, $aux); + } + + public function get_clase_archivo() + { + return $this->datos['_info']['clase_archivo']; + } + + public function get_subclase_nombre() + { + return $this->datos['_info']['subclase']; + } + + public function get_subclase_archivo() + { + return $this->datos['_info']['subclase_archivo']; + } + + public function get_punto_montaje() + { + return $this->datos['_info']['punto_montaje']; + } + + public function get_molde_vacio() + { + $molde = new toba_codigo_clase($this->get_subclase_nombre(), $this->get_clase_extendida_nombre()); + //-- Ini + $doc = 'Se ejecuta al inicio de todos los request en donde participa el componente'; + $metodo = new toba_codigo_metodo_php('ini', array(), array($doc)); + $metodo->set_doc($doc); + $molde->agregar($metodo); + return $molde; + } + + public function get_nombre_instancia_abreviado() + { + return "componente"; + } + + public function set_subclase($nombre, $archivo, $pm) + { + $db = toba_contexto_info::get_db(); + $nombre = $db->quote($nombre); + $archivo = $db->quote($archivo); + $pm = $db->quote($pm); + $id = $db->quote($this->id); + $sql = " UPDATE apex_objeto SET subclase = $nombre, @@ -497,29 +500,28 @@ function set_subclase($nombre, $archivo, $pm) WHERE proyecto = '{$this->proyecto}' AND objeto = $id - "; - toba::logger()->debug($sql); - $db->ejecutar($sql); - } - - function cambiar_clase_origen($nombre_clase) - { - $this->datos['_info']['clase'] = $nombre_clase; - } - - //--------------------------------------------------------------------- - //-- Preguntas sobre EVENTOS - //--------------------------------------------------------------------- - - function eventos_predefinidos() - { - return array(); - } - - static function get_eventos_internos(toba_datos_relacion $dr) - { - $eventos = array(); - return $eventos; - } -} -?> \ No newline at end of file + "; + toba::logger()->debug($sql); + $db->ejecutar($sql); + } + + public function cambiar_clase_origen($nombre_clase) + { + $this->datos['_info']['clase'] = $nombre_clase; + } + + //--------------------------------------------------------------------- + //-- Preguntas sobre EVENTOS + //--------------------------------------------------------------------- + + public function eventos_predefinidos() + { + return array(); + } + + public static function get_eventos_internos(toba_datos_relacion $dr) + { + $eventos = array(); + return $eventos; + } +} diff --git a/php/modelo/info/componentes/toba_datos_relacion_info.php b/php/modelo/info/componentes/toba_datos_relacion_info.php index 4b7b483656..7c87496714 100644 --- a/php/modelo/info/componentes/toba_datos_relacion_info.php +++ b/php/modelo/info/componentes/toba_datos_relacion_info.php @@ -1,272 +1,281 @@ -datos['_info_estructura']); - } - - //--------------------------------------------------------------------- - //-- Recorrible como ARBOL - //--------------------------------------------------------------------- - - function get_utilerias($icono_nuevo=true) - { - //ei_arbol($this->datos); - $iconos = array(); - if ($icono_nuevo) { - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("objetos/objeto_nuevo.gif", false), - 'ayuda' => "Crear una nueva tabla asociada a la relación", - 'vinculo' => toba::vinculador()->get_url(toba_editor::get_id(),"1000247", - array( 'destino_tipo' => 'toba_datos_relacion', - 'destino_proyecto' => $this->proyecto, - 'destino_id' => $this->id), - array( 'menu' => true, - 'celda_memoria' => 'central') - ), - 'plegado' => true - ); - } - //--- Mejora para el caso de que la query sea una unica - if (isset($this->datos['_info']['punto_montaje'])) { - $this->datos['_info_estructura']['punto_montaje'] = $this->datos['_info']['punto_montaje']; - } - if (isset($this->datos['_info']['ap_clase'])) { - $this->datos['_info_estructura']['ap_clase'] = $this->datos['_info']['ap_clase']; - } - if (isset($this->datos['_info']['ap_archivo'])) { - $this->datos['_info_estructura']['ap_archivo'] = $this->datos['_info']['ap_archivo']; - } - if (isset($this->datos['_info_estructura']['ap_clase'])) { - // Hay PHP asociado - if ( admin_util::existe_archivo_subclase($this->datos['_info_estructura']['ap_archivo'], $this->datos['_info_estructura']['punto_montaje']) ) { - $iconos[] = toba_componente_info::get_utileria_editor_abrir_php( array( 'proyecto'=>$this->proyecto, - 'componente' =>$this->id ), - 'ap', - 'reflexion/abrir_ap.gif' ); - $iconos[] = toba_componente_info::get_utileria_editor_ver_php( array( 'proyecto'=>$this->proyecto, - 'componente' =>$this->id ), - 'ap', - 'nucleo/php_ap.gif' ); - - } else { - $iconos[] = toba_componente_info::get_utileria_editor_ver_php( array( 'proyecto'=>$this->proyecto, - 'componente' =>$this->id ), - 'ap', - 'nucleo/php_ap_inexistente.gif', - false ); - } - } - return array_merge($iconos, parent::get_utilerias()); - } - - - /** - * La clonacion del DR puede implicar clonar su AP - */ - protected function clonar_subclase($dr, $dir_subclases, $proyecto_dest) - { - parent::clonar_subclase($dr, $dir_subclases, $proyecto_dest); - if (isset($this->datos['_info_estructura']['ap_archivo'])) { - $archivo = $this->datos['_info_estructura']['ap_archivo']; - $nuevo_archivo = $dir_subclases."/".basename($archivo); - - $id_pm_origen = $this->get_punto_montaje(); - $id_pm_destino = $dr->tabla('base')->get_fila_columna(0, 'punto_montaje'); - - //Busco los directorios de copia utilizando los puntos de montaje - $path_origen = $this->get_path_clonacion($id_pm_origen,$this->proyecto); - $path_destino = $this->get_path_clonacion($id_pm_destino, $proyecto_dest, $path_origen); - - $dr->tabla('prop_basicas')->set_fila_columna_valor(0, 'ap_archivo', $nuevo_archivo); - //--- Si el dir. destino no existe, se lo crea - if (!file_exists($path_destino.$dir_subclases)) { - toba_manejador_archivos::crear_arbol_directorios($path_destino.$dir_subclases); - } - if (! copy($path_origen.$archivo, $path_destino.$nuevo_archivo)) { - toba_logger::instancia()->error('No es posible copiar el archivo desde '.$path_origen.$archivo.' hacia '.$path_destino.$nuevo_archivo); - throw new toba_error('No es posible copiar el archivo, revise el log'); - } - } - } - - //------------------------------------------------------------------------ - //------ METACLASE ------------------------------------------------------- - //------------------------------------------------------------------------ - - function get_molde_subclase() - { - $molde = $this->get_molde_vacio(); - - //-- Validacion - $doc = "Ventana para validaciones de toda la relación, se ejecuta justo antes de la sincronización"; - $comentarios = array( - $doc, - "El proceso puede ser abortado con un toba_error, el mensaje se muestra al usuario", - ); - $metodo = new toba_codigo_metodo_php('evt__validar', array(), $comentarios); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - return $molde; - } - - /** - * Duplica un objeto y sus dependencias recursivamente - * - * @param array $nuevos_datos Datos a modificar en la base del objeto. Para anexar algo al nombre se utiliza el campo 'anexo_nombre' - * @param boolean/string $dir_subclases Si el componente tiene subclases clona los archivos, en caso afirmativo indicar la ruta destino (relativa) - * @param boolean $con_transaccion Indica si la clonación se debe incluír en una transaccion - * @return array Clave del objeto que resulta del clonado - */ - function clonar($nuevos_datos, $dir_subclases=false, $con_transaccion = true) - { - //Se busca el id del datos_relacion de la clase - $id_dr = toba_info_editores::get_dr_de_clase($this->datos['_info']['clase']); - - //Se construye el objeto datos_relacion - $componente = array('proyecto' => $id_dr[0], 'componente' => $id_dr[1]); - $dr = toba_constructor::get_runtime($componente); - $dr->inicializar(); - - //Se carga con el id_origen - $dr->cargar(array('proyecto' => $this->proyecto, 'objeto' => $this->id)); - foreach ($nuevos_datos as $campo => $valor) { - if ($campo == 'anexo_nombre') { - $campo = 'nombre'; - $valor = $valor . $dr->tabla('base')->get_fila_columna(0, $campo); - } - $dr->tabla('base')->set_fila_columna_valor(0, $campo, $valor); - } - - //Se le fuerza una inserción a los datos_tabla - //Como la clave de los objetos son secuencias, esto garantiza claves nuevas - $dr->forzar_insercion(); - if (!$con_transaccion) { - $dr->persistidor()->desactivar_transaccion(); - } - - //-- Punto de montaje tambien se propaga - if (isset($nuevos_datos['punto_montaje'])) { - $dr->tabla('prop_basicas')->set_columna_valor('punto_montaje', $nuevos_datos['punto_montaje']); - } - - //--- Si tiene subclase, se copia el archivo y se cambia - if ($dir_subclases !== false) { - $proyecto_dest = isset($nuevos_datos['proyecto']) ? $nuevos_datos['proyecto'] : null; - $this->clonar_subclase($dr, $dir_subclases, $proyecto_dest); - } - - $dep_nuevas = array(); - $dep_viejas = array(); - //--- Se reemplazan los datos y se clonan los hijos - foreach ($this->subelementos as $hijo) { - //-- Si se especifico un proyecto, se propaga - $datos_objeto = array(); - if (isset($nuevos_datos['proyecto'])) { - $datos_objeto['proyecto'] = $nuevos_datos['proyecto']; - } - //-- Si se especifica un anexo de nombre, se propaga - if (isset($nuevos_datos['anexo_nombre'])) { - $datos_objeto['anexo_nombre'] = $nuevos_datos['anexo_nombre']; - } - //-- La fuente tambien se propaga - if (isset($nuevos_datos['fuente_datos_proyecto'])) { - $datos_objeto['fuente_datos_proyecto'] = $nuevos_datos['fuente_datos_proyecto']; - } - if (isset($nuevos_datos['fuente_datos'])) { - $datos_objeto['fuente_datos'] = $nuevos_datos['fuente_datos']; - } - //-- Punto de montaje tambien se propaga - if (isset($nuevos_datos['punto_montaje'])) { - $datos_objeto['punto_montaje'] = $nuevos_datos['punto_montaje']; - } - - //-- SE CLONA - $id_clon = $hijo->clonar($datos_objeto, $dir_subclases, $con_transaccion); - //--- En el componente actual se reemplaza la dependencia por el clon - $id_fila = $dr->tabla('dependencias')->get_id_fila_condicion( - array('identificador' => $hijo->rol_en_consumidor())); - $dr->tabla('dependencias')->modificar_fila(current($id_fila), - array('objeto_proveedor' => $id_clon['componente'])); - - //Aca obtengo la informacion de metadatos de la tabla recien clonada y guardo tambien - //la info de la tabla actual. - $index = $hijo->get_id(); - $dep_nuevas[$index] = toba_constructor::get_info( $id_clon, $hijo->get_clase_nombre()); - $dep_viejas[$index] = $hijo; - } - //Si hay dependencias clonadas entonces regenero las relaciones entre tablas y entre columnas. - if (! empty($dep_nuevas)) { - $this->clonar_relacion_tablas($dep_nuevas, $dr->tabla('relaciones')); - $this->clonar_relacion_columnas($dep_nuevas, $dep_viejas, $dr->tabla('columnas_relacion')); - } - $dr->sincronizar(); - - //Se busca la clave del nuevo objeto - $clave = $dr->tabla('base')->get_clave_valor(0); - $clave['componente'] = $clave['objeto']; - return $clave; - } - - /** - * Reconecta las relaciones entre las tablas recien clonadas - * @param array $dep_nuevas Objetos toba_datos_tabla_info con la informacion de las nuevas tablas - * @param toba_datos_tabla $tabla_dr Objeto que representa la tabla de relaciones - */ - function clonar_relacion_tablas($dep_nuevas, $tabla_dr) - { - $relaciones = $tabla_dr->get_filas(null, true, false); - foreach($relaciones as $id_fila => $relacion){ - //Obtengo los ids de las tablas padre e hija. - $tabla_padre = $relacion['padre_objeto']; - $tabla_hija = $relacion['hijo_objeto']; - //Genero la nueva fila con los datos modificados - $nva_fila = array('padre_objeto' => $dep_nuevas[$tabla_padre]->get_id(), 'hijo_objeto' => $dep_nuevas[$tabla_hija]->get_id()); - $tabla_dr->modificar_fila($id_fila, $nva_fila); - } - } - - /** - * Reconecta las columnas relacionadas entre las tablas recien clonadas - * @param array $dep_nuevas Objetos toba_datos_tabla_info con la informacion de la nuevas tablas - * @param array $dep_viejas Objetos toba_datos_tabla_info con la informacion de las originales - * @param toba_datos_tabla $tabla_dr Objeto que representa la tabla de relacion de columnas - */ - function clonar_relacion_columnas($dep_nuevas, $dep_viejas, $tabla_dr) - { - $relaciones_disponibles = $tabla_dr->get_filas(null, true, false); - foreach($relaciones_disponibles as $id_fila => $rel_columnas){ - //Obtengo los ids de las tablas padre e hija. - $tabla_padre = $rel_columnas['padre_objeto']; - $tabla_hija = $rel_columnas['hijo_objeto']; - - //Obtengo los datos originales de las columnas padre e hija. - $original_padre = current($dep_viejas[$tabla_padre]->get_info_columnas(array('col_id' => $rel_columnas['padre_clave']))); - $original_hijo = current($dep_viejas[$tabla_hija]->get_info_columnas(array('col_id' => $rel_columnas['hijo_clave']))); - - //Ahora busco los datos para la misma columna pero entre los nuevos - $nuevo_padre = current($dep_nuevas[$tabla_padre]->get_info_columnas(array('columna' => $original_padre['columna']))); - $nuevo_hijo = current($dep_nuevas[$tabla_hija]->get_info_columnas(array('columna' => $original_hijo['columna']))); - //Genero la nueva fila con los datos modificados - $nva_fila = array('padre_objeto' => $nuevo_padre['objeto'], 'padre_clave' => $nuevo_padre['col_id'], 'hijo_objeto' => $nuevo_hijo['objeto'], 'hijo_clave' => $nuevo_hijo['col_id']); - $tabla_dr->modificar_fila($id_fila, $nva_fila); - } - } -} -?> \ No newline at end of file +datos['_info_estructura']); + } + + //--------------------------------------------------------------------- + //-- Recorrible como ARBOL + //--------------------------------------------------------------------- + + public function get_utilerias($icono_nuevo=true) + { + //ei_arbol($this->datos); + $iconos = array(); + if ($icono_nuevo) { + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("objetos/objeto_nuevo.gif", false), + 'ayuda' => "Crear una nueva tabla asociada a la relación", + 'vinculo' => toba::vinculador()->get_url( + toba_editor::get_id(), + "1000247", + array( 'destino_tipo' => 'toba_datos_relacion', + 'destino_proyecto' => $this->proyecto, + 'destino_id' => $this->id), + array( 'menu' => true, + 'celda_memoria' => 'central') + ), + 'plegado' => true + ); + } + //--- Mejora para el caso de que la query sea una unica + if (isset($this->datos['_info']['punto_montaje'])) { + $this->datos['_info_estructura']['punto_montaje'] = $this->datos['_info']['punto_montaje']; + } + if (isset($this->datos['_info']['ap_clase'])) { + $this->datos['_info_estructura']['ap_clase'] = $this->datos['_info']['ap_clase']; + } + if (isset($this->datos['_info']['ap_archivo'])) { + $this->datos['_info_estructura']['ap_archivo'] = $this->datos['_info']['ap_archivo']; + } + if (isset($this->datos['_info_estructura']['ap_clase'])) { + // Hay PHP asociado + if (admin_util::existe_archivo_subclase($this->datos['_info_estructura']['ap_archivo'], $this->datos['_info_estructura']['punto_montaje'])) { + $iconos[] = toba_componente_info::get_utileria_editor_abrir_php( + array( 'proyecto'=>$this->proyecto, + 'componente' =>$this->id ), + 'ap', + 'reflexion/abrir_ap.gif' + ); + $iconos[] = toba_componente_info::get_utileria_editor_ver_php( + array( 'proyecto'=>$this->proyecto, + 'componente' =>$this->id ), + 'ap', + 'nucleo/php_ap.gif' + ); + } else { + $iconos[] = toba_componente_info::get_utileria_editor_ver_php( + array( 'proyecto'=>$this->proyecto, + 'componente' =>$this->id ), + 'ap', + 'nucleo/php_ap_inexistente.gif', + false + ); + } + } + return array_merge($iconos, parent::get_utilerias()); + } + + + /** + * La clonacion del DR puede implicar clonar su AP + */ + protected function clonar_subclase($dr, $dir_subclases, $proyecto_dest) + { + parent::clonar_subclase($dr, $dir_subclases, $proyecto_dest); + if (isset($this->datos['_info_estructura']['ap_archivo'])) { + $archivo = $this->datos['_info_estructura']['ap_archivo']; + $nuevo_archivo = $dir_subclases."/".basename($archivo); + + $id_pm_origen = $this->get_punto_montaje(); + $id_pm_destino = $dr->tabla('base')->get_fila_columna(0, 'punto_montaje'); + + //Busco los directorios de copia utilizando los puntos de montaje + $path_origen = $this->get_path_clonacion($id_pm_origen, $this->proyecto); + $path_destino = $this->get_path_clonacion($id_pm_destino, $proyecto_dest, $path_origen); + + $dr->tabla('prop_basicas')->set_fila_columna_valor(0, 'ap_archivo', $nuevo_archivo); + //--- Si el dir. destino no existe, se lo crea + if (!file_exists($path_destino.$dir_subclases)) { + toba_manejador_archivos::crear_arbol_directorios($path_destino.$dir_subclases); + } + if (! copy($path_origen.$archivo, $path_destino.$nuevo_archivo)) { + toba_logger::instancia()->error('No es posible copiar el archivo desde '.$path_origen.$archivo.' hacia '.$path_destino.$nuevo_archivo); + throw new toba_error('No es posible copiar el archivo, revise el log'); + } + } + } + + //------------------------------------------------------------------------ + //------ METACLASE ------------------------------------------------------- + //------------------------------------------------------------------------ + + public function get_molde_subclase() + { + $molde = $this->get_molde_vacio(); + + //-- Validacion + $doc = "Ventana para validaciones de toda la relación, se ejecuta justo antes de la sincronización"; + $comentarios = array( + $doc, + "El proceso puede ser abortado con un toba_error, el mensaje se muestra al usuario", + ); + $metodo = new toba_codigo_metodo_php('evt__validar', array(), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + return $molde; + } + + /** + * Duplica un objeto y sus dependencias recursivamente + * + * @param array $nuevos_datos Datos a modificar en la base del objeto. Para anexar algo al nombre se utiliza el campo 'anexo_nombre' + * @param boolean/string $dir_subclases Si el componente tiene subclases clona los archivos, en caso afirmativo indicar la ruta destino (relativa) + * @param boolean $con_transaccion Indica si la clonación se debe incluír en una transaccion + * @return array Clave del objeto que resulta del clonado + */ + public function clonar($nuevos_datos, $dir_subclases=false, $con_transaccion = true) + { + //Se busca el id del datos_relacion de la clase + $id_dr = toba_info_editores::get_dr_de_clase($this->datos['_info']['clase']); + + //Se construye el objeto datos_relacion + $componente = array('proyecto' => $id_dr[0], 'componente' => $id_dr[1]); + $dr = toba_constructor::get_runtime($componente); + $dr->inicializar(); + + //Se carga con el id_origen + $dr->cargar(array('proyecto' => $this->proyecto, 'objeto' => $this->id)); + foreach ($nuevos_datos as $campo => $valor) { + if ($campo == 'anexo_nombre') { + $campo = 'nombre'; + $valor = $valor . $dr->tabla('base')->get_fila_columna(0, $campo); + } + $dr->tabla('base')->set_fila_columna_valor(0, $campo, $valor); + } + + //Se le fuerza una inserción a los datos_tabla + //Como la clave de los objetos son secuencias, esto garantiza claves nuevas + $dr->forzar_insercion(); + if (!$con_transaccion) { + $dr->persistidor()->desactivar_transaccion(); + } + + //-- Punto de montaje tambien se propaga + if (isset($nuevos_datos['punto_montaje'])) { + $dr->tabla('prop_basicas')->set_columna_valor('punto_montaje', $nuevos_datos['punto_montaje']); + } + + //--- Si tiene subclase, se copia el archivo y se cambia + if ($dir_subclases !== false) { + $proyecto_dest = isset($nuevos_datos['proyecto']) ? $nuevos_datos['proyecto'] : null; + $this->clonar_subclase($dr, $dir_subclases, $proyecto_dest); + } + + $dep_nuevas = array(); + $dep_viejas = array(); + //--- Se reemplazan los datos y se clonan los hijos + foreach ($this->subelementos as $hijo) { + //-- Si se especifico un proyecto, se propaga + $datos_objeto = array(); + if (isset($nuevos_datos['proyecto'])) { + $datos_objeto['proyecto'] = $nuevos_datos['proyecto']; + } + //-- Si se especifica un anexo de nombre, se propaga + if (isset($nuevos_datos['anexo_nombre'])) { + $datos_objeto['anexo_nombre'] = $nuevos_datos['anexo_nombre']; + } + //-- La fuente tambien se propaga + if (isset($nuevos_datos['fuente_datos_proyecto'])) { + $datos_objeto['fuente_datos_proyecto'] = $nuevos_datos['fuente_datos_proyecto']; + } + if (isset($nuevos_datos['fuente_datos'])) { + $datos_objeto['fuente_datos'] = $nuevos_datos['fuente_datos']; + } + //-- Punto de montaje tambien se propaga + if (isset($nuevos_datos['punto_montaje'])) { + $datos_objeto['punto_montaje'] = $nuevos_datos['punto_montaje']; + } + + //-- SE CLONA + $id_clon = $hijo->clonar($datos_objeto, $dir_subclases, $con_transaccion); + //--- En el componente actual se reemplaza la dependencia por el clon + $id_fila = $dr->tabla('dependencias')->get_id_fila_condicion( + array('identificador' => $hijo->rol_en_consumidor()) + ); + $dr->tabla('dependencias')->modificar_fila( + current($id_fila), + array('objeto_proveedor' => $id_clon['componente']) + ); + + //Aca obtengo la informacion de metadatos de la tabla recien clonada y guardo tambien + //la info de la tabla actual. + $index = $hijo->get_id(); + $dep_nuevas[$index] = toba_constructor::get_info($id_clon, $hijo->get_clase_nombre()); + $dep_viejas[$index] = $hijo; + } + //Si hay dependencias clonadas entonces regenero las relaciones entre tablas y entre columnas. + if (! empty($dep_nuevas)) { + $this->clonar_relacion_tablas($dep_nuevas, $dr->tabla('relaciones')); + $this->clonar_relacion_columnas($dep_nuevas, $dep_viejas, $dr->tabla('columnas_relacion')); + } + $dr->sincronizar(); + + //Se busca la clave del nuevo objeto + $clave = $dr->tabla('base')->get_clave_valor(0); + $clave['componente'] = $clave['objeto']; + return $clave; + } + + /** + * Reconecta las relaciones entre las tablas recien clonadas + * @param array $dep_nuevas Objetos toba_datos_tabla_info con la informacion de las nuevas tablas + * @param toba_datos_tabla $tabla_dr Objeto que representa la tabla de relaciones + */ + public function clonar_relacion_tablas($dep_nuevas, $tabla_dr) + { + $relaciones = $tabla_dr->get_filas(null, true, false); + foreach ($relaciones as $id_fila => $relacion) { + //Obtengo los ids de las tablas padre e hija. + $tabla_padre = $relacion['padre_objeto']; + $tabla_hija = $relacion['hijo_objeto']; + //Genero la nueva fila con los datos modificados + $nva_fila = array('padre_objeto' => $dep_nuevas[$tabla_padre]->get_id(), 'hijo_objeto' => $dep_nuevas[$tabla_hija]->get_id()); + $tabla_dr->modificar_fila($id_fila, $nva_fila); + } + } + + /** + * Reconecta las columnas relacionadas entre las tablas recien clonadas + * @param array $dep_nuevas Objetos toba_datos_tabla_info con la informacion de la nuevas tablas + * @param array $dep_viejas Objetos toba_datos_tabla_info con la informacion de las originales + * @param toba_datos_tabla $tabla_dr Objeto que representa la tabla de relacion de columnas + */ + public function clonar_relacion_columnas($dep_nuevas, $dep_viejas, $tabla_dr) + { + $relaciones_disponibles = $tabla_dr->get_filas(null, true, false); + foreach ($relaciones_disponibles as $id_fila => $rel_columnas) { + //Obtengo los ids de las tablas padre e hija. + $tabla_padre = $rel_columnas['padre_objeto']; + $tabla_hija = $rel_columnas['hijo_objeto']; + + //Obtengo los datos originales de las columnas padre e hija. + $original_padre = current($dep_viejas[$tabla_padre]->get_info_columnas(array('col_id' => $rel_columnas['padre_clave']))); + $original_hijo = current($dep_viejas[$tabla_hija]->get_info_columnas(array('col_id' => $rel_columnas['hijo_clave']))); + + //Ahora busco los datos para la misma columna pero entre los nuevos + $nuevo_padre = current($dep_nuevas[$tabla_padre]->get_info_columnas(array('columna' => $original_padre['columna']))); + $nuevo_hijo = current($dep_nuevas[$tabla_hija]->get_info_columnas(array('columna' => $original_hijo['columna']))); + //Genero la nueva fila con los datos modificados + $nva_fila = array('padre_objeto' => $nuevo_padre['objeto'], 'padre_clave' => $nuevo_padre['col_id'], 'hijo_objeto' => $nuevo_hijo['objeto'], 'hijo_clave' => $nuevo_hijo['col_id']); + $tabla_dr->modificar_fila($id_fila, $nva_fila); + } + } +} diff --git a/php/modelo/info/componentes/toba_datos_tabla_info.php b/php/modelo/info/componentes/toba_datos_tabla_info.php index 30ebd12eea..a5cbcf3e2f 100644 --- a/php/modelo/info/componentes/toba_datos_tabla_info.php +++ b/php/modelo/info/componentes/toba_datos_tabla_info.php @@ -1,291 +1,299 @@ -datos['_info_estructura']; - $datos['objeto'] = $this->datos['_info']['objeto']; - $datos['proyecto'] = $this->datos['_info']['proyecto']; - return new toba_ap_tabla_db_info($datos); - } - - /** - * Duplica un objeto y sus dependencias recursivamente. - * En el caso del datos tabla, si el proyecto/fuente no difiere no se clona, se reusa - * - * @param array $nuevos_datos Datos a modificar en la base del objeto. Para anexar algo al nombre se utiliza el campo 'anexo_nombre' - * @param boolean/string $dir_subclases Si el componente tiene subclases clona los archivos, en caso afirmativo indicar la ruta destino (relativa) - * @param boolean $con_transaccion Indica si la clonación se debe incluír en una transaccion - * @return array Clave del objeto que resulta del clonado - */ - function clonar($nuevos_datos, $dir_subclases=false, $con_transaccion = true) - { - $distinto = false; - //-- Si difiere en el proyecto - if (isset($nuevos_datos['fuente_datos_proyecto']) && $nuevos_datos['fuente_datos_proyecto'] != $this->datos['_info']['fuente_proyecto']) { - $distinto = true; - } - //-- Si difiere en la fuente - if (isset($nuevos_datos['fuente_datos']) && $nuevos_datos['fuente_datos'] != $this->datos['_info']['fuente']) { - $distinto = true; - } - //Cambiar el punto de montaje no implica clonar, se tiene que hacer una personalizacion que cambie la subclase. - - if ($distinto) { - return parent::clonar($nuevos_datos, $dir_subclases, $con_transaccion); - } else { - //Se retorna a si mismo, se reusa - $clave = array(); - $clave['componente'] = $this->datos['_info']['objeto']; - $clave['proyecto'] = $this->datos['_info']['proyecto']; - return $clave; - } - } - - //--------------------------------------------------------------------- - //-- Recorrible como ARBOL - //--------------------------------------------------------------------- - - function get_utilerias() - { - //--- Mejora para el caso de que la query sea una unica - if (isset($this->datos['_info']['ap_punto_montaje'])) { - $this->datos['_info_estructura']['ap_punto_montaje'] = $this->datos['_info']['ap_punto_montaje']; - } - if (isset($this->datos['_info']['ap_clase'])) { - $this->datos['_info_estructura']['ap_clase'] = $this->datos['_info']['ap_clase']; - } - if (isset($this->datos['_info']['ap_archivo'])) { - $this->datos['_info_estructura']['ap_sub_clase_archivo'] = $this->datos['_info']['ap_archivo']; - } - - $iconos = array(); - if (isset($this->datos['_info_estructura']['ap_sub_clase_archivo'])) { - if (admin_util::existe_archivo_subclase($this->datos['_info_estructura']['ap_sub_clase_archivo'], $this->datos['_info_estructura']['ap_punto_montaje'])) { - $iconos[] = toba_componente_info::get_utileria_editor_abrir_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id ), - 'ap', - 'reflexion/abrir_ap.gif' ); - $iconos[] = toba_componente_info::get_utileria_editor_ver_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id ), - 'ap', - 'nucleo/php_ap.gif' ); - } else { - $iconos[] = toba_componente_info::get_utileria_editor_ver_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id ), - 'ap', - 'nucleo/php_ap_inexistente.gif', - false ); - } - } - return array_merge($iconos, parent::get_utilerias()); - } - - /** - * La clonacion del DT puede implicar clonar su AP - */ - protected function clonar_subclase($dr, $dir_subclases, $proyecto_dest) - { - parent::clonar_subclase($dr, $dir_subclases, $proyecto_dest); - if (isset($this->datos['_info_estructura']['ap_sub_clase_archivo'])) { - $archivo = $this->datos['_info_estructura']['ap_sub_clase_archivo']; - $nuevo_archivo = $dir_subclases."/".basename($archivo); - - $id_pm_origen = $this->get_punto_montaje(); - $id_pm_destino = $dr->tabla('base')->get_fila_columna(0, 'punto_montaje'); - - //Busco los directorios de copia utilizando los puntos de montaje - $path_origen = $this->get_path_clonacion($id_pm_origen,$this->proyecto); - $path_destino = $this->get_path_clonacion($id_pm_destino, $proyecto_dest, $path_origen); - - $dr->tabla('prop_basicas')->set_fila_columna_valor(0, 'ap_archivo', $nuevo_archivo); - $dr->tabla('prop_basicas')->set_fila_columna_valor(0, 'punto_montaje', $id_pm_destino); - - //--- Si el dir. destino no existe, se lo crea - if (!file_exists($path_destino.$dir_subclases)) { - toba_manejador_archivos::crear_arbol_directorios($path_destino.$dir_subclases); - } - if (! copy($path_origen.$archivo, $path_destino.$nuevo_archivo)) { - toba_logger::instancia()->error('No es posible copiar el archivo desde '.$path_origen.$archivo.' hacia '.$path_destino.$nuevo_archivo); - throw new toba_error('No es posible copiar el archivo, revise el log'); - } - } - } - - //--------------------------------------------------------------------- - //-- Generacion de METADATOS para otros componentes - //--------------------------------------------------------------------- - - private function is_col_fk($col) { - foreach ($this->datos['_info_fks'] as $fk) { - if ($fk['columna_ext'] == $col) { - return true; - } - } - return false; - } - - /** - * Exporta la definicion de una manera entendible para el datos_tabla de la tabla - * donde se guardan los EFs del ei_formulario - */ - function exportar_datos_efs($incluir_pk=false) - { - $datos = array(); - $a=0; - foreach($this->datos['_info_columnas'] as $columna){ - // HACK: Evitamos que se carguen las columnas de las tablas extendidas - // que son foreign keys para evitar repetición de columnas - if ($this->is_col_fk($columna['columna'])) { - continue; - } - - if( (!$columna['pk']) || $incluir_pk) { - $datos[$a]['identificador'] = $columna['columna']; - $datos[$a]['columnas'] = $columna['columna']; - $datos[$a]['etiqueta'] = ucfirst( str_replace("_"," ",$columna['columna']) ); - if(isset($columna['secuencia']) && $columna['secuencia'] != ''){ - $datos[$a]['elemento_formulario'] = 'ef_fijo'; - }else{ - if($columna['no_nulo_db']) $datos[$a]['obligatorio'] = 1; - switch($columna['tipo']){ - case 'E': - $datos[$a]['elemento_formulario'] = 'ef_editable_numero'; - break; - case 'N': - $datos[$a]['elemento_formulario'] = 'ef_editable_numero'; - break; - case 'L': - $datos[$a]['elemento_formulario'] = 'ef_checkbox'; - break; - case 'F': - $datos[$a]['elemento_formulario'] = 'ef_editable_fecha'; - break; - case 'B': - $datos[$a]['elemento_formulario'] = 'ef_upload'; - break; - case 'X': - $datos[$a]['elemento_formulario'] = 'ef_editable_textarea'; - break; - default: - $datos[$a]['elemento_formulario'] = 'ef_editable'; - } - } - // Si es editable, pongo el tamaño de campos - if( $datos[$a]['elemento_formulario'] == 'ef_editable' ) { - if($columna['largo'] > 0) { - $datos[$a]['edit_maximo'] = $columna['largo']; - if($columna['largo'] < 80) { - $datos[$a]['edit_tamano'] = $columna['largo']; - }else{ - $datos[$a]['edit_tamano'] = 80; - } - } - } - $datos[$a]['orden'] = $a+100; - $a++; - } - } - return $datos; - } - - /** - * Exporta la definicion de una manera entendible para el datos_tabla de la tabla - * donde se guardan las columnas del ei_cuadro - */ - function exportar_datos_columnas($incluir_pk=false) - { - $datos = array(); - $a=0; - foreach($this->datos['_info_columnas'] as $columna){ - if( ((!$columna['pk']) || $incluir_pk) && $columna['secuencia'] == '' ){ - $datos[$a]['clave'] = $columna['columna']; - $datos[$a]['titulo'] = ucfirst( str_replace("_"," ",$columna['columna']) ); - switch($columna['tipo']){ - case 'E': - $datos[$a]['estilo'] = '0';//numero-1 - break; - case 'N': - $datos[$a]['estilo'] = '0'; - break; - default: - $datos[$a]['estilo'] = '4'; //texto-1 - } - $datos[$a]['orden'] = $a; - $a++; - } - } - return $datos; - } - - /** - * Obtiene la informacion de metadatos de las columnas del dt, puede filtrar por - * condiciones particulares - * @param array $id Arreglo asociativo de condiciones ('nombre' => 'valor') - * @return array - */ - function get_info_columnas($id = array()) - { - $resultado = $this->datos['_info_columnas']; - if (! empty($id)){ - $cond = array_keys($id); - $keys_r = array_keys($resultado); - foreach($keys_r as $klave){ - $valido = true; - foreach($cond as $col){ - $valido = $valido && ($resultado[$klave][$col] == $id[$col]); - } - if (! $valido){ - unset($resultado[$klave]); - } - }//fe - } - return $resultado; - } - - - //------------------------------------------------------------------------ - //------ METACLASE ------------------------------------------------------- - //------------------------------------------------------------------------ - - function get_molde_subclase() - { - $molde = $this->get_molde_vacio(); - - //-- Validar Ingreso - $doc = "Ventana de validacion que se invoca cuando se crea o modifica una fila en memoria. Lanzar una excepcion en caso de error"; - $comentarios = array( - $doc, - '@param array $fila Datos de la fila', - '@param mixed $id Id. interno de la fila, si tiene (en el caso modificacion de la fila)' - ); - $metodo = new toba_codigo_metodo_php('evt__validar_ingreso', array('$fila','$id=null'), $comentarios); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - //-- Validar Foña - $doc = "Ventana de validacion que se invoca antes de sincronizar una fila con la base"; - $comentarios = array( - $doc, - "El proceso puede ser abortado con un toba_error, el mensaje se muestra al usuario", - '@param array $fila Asociativo clave-valor de la fila a validar' - ); - $metodo = new toba_codigo_metodo_php('evt__validar_fila', array('$fila'), $comentarios); - $metodo->set_doc($doc); - $molde->agregar($metodo); - - return $molde; - } -} -?> \ No newline at end of file +datos['_info_estructura']; + $datos['objeto'] = $this->datos['_info']['objeto']; + $datos['proyecto'] = $this->datos['_info']['proyecto']; + return new toba_ap_tabla_db_info($datos); + } + + /** + * Duplica un objeto y sus dependencias recursivamente. + * En el caso del datos tabla, si el proyecto/fuente no difiere no se clona, se reusa + * + * @param array $nuevos_datos Datos a modificar en la base del objeto. Para anexar algo al nombre se utiliza el campo 'anexo_nombre' + * @param boolean/string $dir_subclases Si el componente tiene subclases clona los archivos, en caso afirmativo indicar la ruta destino (relativa) + * @param boolean $con_transaccion Indica si la clonación se debe incluír en una transaccion + * @return array Clave del objeto que resulta del clonado + */ + public function clonar($nuevos_datos, $dir_subclases=false, $con_transaccion = true) + { + $distinto = false; + //-- Si difiere en el proyecto + if (isset($nuevos_datos['fuente_datos_proyecto']) && $nuevos_datos['fuente_datos_proyecto'] != $this->datos['_info']['fuente_proyecto']) { + $distinto = true; + } + //-- Si difiere en la fuente + if (isset($nuevos_datos['fuente_datos']) && $nuevos_datos['fuente_datos'] != $this->datos['_info']['fuente']) { + $distinto = true; + } + //Cambiar el punto de montaje no implica clonar, se tiene que hacer una personalizacion que cambie la subclase. + + if ($distinto) { + return parent::clonar($nuevos_datos, $dir_subclases, $con_transaccion); + } else { + //Se retorna a si mismo, se reusa + $clave = array(); + $clave['componente'] = $this->datos['_info']['objeto']; + $clave['proyecto'] = $this->datos['_info']['proyecto']; + return $clave; + } + } + + //--------------------------------------------------------------------- + //-- Recorrible como ARBOL + //--------------------------------------------------------------------- + + public function get_utilerias() + { + //--- Mejora para el caso de que la query sea una unica + if (isset($this->datos['_info']['ap_punto_montaje'])) { + $this->datos['_info_estructura']['ap_punto_montaje'] = $this->datos['_info']['ap_punto_montaje']; + } + if (isset($this->datos['_info']['ap_clase'])) { + $this->datos['_info_estructura']['ap_clase'] = $this->datos['_info']['ap_clase']; + } + if (isset($this->datos['_info']['ap_archivo'])) { + $this->datos['_info_estructura']['ap_sub_clase_archivo'] = $this->datos['_info']['ap_archivo']; + } + + $iconos = array(); + if (isset($this->datos['_info_estructura']['ap_sub_clase_archivo'])) { + if (admin_util::existe_archivo_subclase($this->datos['_info_estructura']['ap_sub_clase_archivo'], $this->datos['_info_estructura']['ap_punto_montaje'])) { + $iconos[] = toba_componente_info::get_utileria_editor_abrir_php( + array('proyecto'=>$this->proyecto, 'componente' =>$this->id ), + 'ap', + 'reflexion/abrir_ap.gif' + ); + $iconos[] = toba_componente_info::get_utileria_editor_ver_php( + array('proyecto'=>$this->proyecto, 'componente' =>$this->id ), + 'ap', + 'nucleo/php_ap.gif' + ); + } else { + $iconos[] = toba_componente_info::get_utileria_editor_ver_php( + array('proyecto'=>$this->proyecto, 'componente' =>$this->id ), + 'ap', + 'nucleo/php_ap_inexistente.gif', + false + ); + } + } + return array_merge($iconos, parent::get_utilerias()); + } + + /** + * La clonacion del DT puede implicar clonar su AP + */ + protected function clonar_subclase($dr, $dir_subclases, $proyecto_dest) + { + parent::clonar_subclase($dr, $dir_subclases, $proyecto_dest); + if (isset($this->datos['_info_estructura']['ap_sub_clase_archivo'])) { + $archivo = $this->datos['_info_estructura']['ap_sub_clase_archivo']; + $nuevo_archivo = $dir_subclases."/".basename($archivo); + + $id_pm_origen = $this->get_punto_montaje(); + $id_pm_destino = $dr->tabla('base')->get_fila_columna(0, 'punto_montaje'); + + //Busco los directorios de copia utilizando los puntos de montaje + $path_origen = $this->get_path_clonacion($id_pm_origen, $this->proyecto); + $path_destino = $this->get_path_clonacion($id_pm_destino, $proyecto_dest, $path_origen); + + $dr->tabla('prop_basicas')->set_fila_columna_valor(0, 'ap_archivo', $nuevo_archivo); + $dr->tabla('prop_basicas')->set_fila_columna_valor(0, 'punto_montaje', $id_pm_destino); + + //--- Si el dir. destino no existe, se lo crea + if (!file_exists($path_destino.$dir_subclases)) { + toba_manejador_archivos::crear_arbol_directorios($path_destino.$dir_subclases); + } + if (! copy($path_origen.$archivo, $path_destino.$nuevo_archivo)) { + toba_logger::instancia()->error('No es posible copiar el archivo desde '.$path_origen.$archivo.' hacia '.$path_destino.$nuevo_archivo); + throw new toba_error('No es posible copiar el archivo, revise el log'); + } + } + } + + //--------------------------------------------------------------------- + //-- Generacion de METADATOS para otros componentes + //--------------------------------------------------------------------- + + private function is_col_fk($col) + { + foreach ($this->datos['_info_fks'] as $fk) { + if ($fk['columna_ext'] == $col) { + return true; + } + } + return false; + } + + /** + * Exporta la definicion de una manera entendible para el datos_tabla de la tabla + * donde se guardan los EFs del ei_formulario + */ + public function exportar_datos_efs($incluir_pk=false) + { + $datos = array(); + $a=0; + foreach ($this->datos['_info_columnas'] as $columna) { + // HACK: Evitamos que se carguen las columnas de las tablas extendidas + // que son foreign keys para evitar repetición de columnas + if ($this->is_col_fk($columna['columna'])) { + continue; + } + + if ((!$columna['pk']) || $incluir_pk) { + $datos[$a]['identificador'] = $columna['columna']; + $datos[$a]['columnas'] = $columna['columna']; + $datos[$a]['etiqueta'] = ucfirst(str_replace("_", " ", $columna['columna'])); + if (isset($columna['secuencia']) && $columna['secuencia'] != '') { + $datos[$a]['elemento_formulario'] = 'ef_fijo'; + } else { + if ($columna['no_nulo_db']) { + $datos[$a]['obligatorio'] = 1; + } + switch ($columna['tipo']) { + case 'E': + $datos[$a]['elemento_formulario'] = 'ef_editable_numero'; + break; + case 'N': + $datos[$a]['elemento_formulario'] = 'ef_editable_numero'; + break; + case 'L': + $datos[$a]['elemento_formulario'] = 'ef_checkbox'; + break; + case 'F': + $datos[$a]['elemento_formulario'] = 'ef_editable_fecha'; + break; + case 'B': + $datos[$a]['elemento_formulario'] = 'ef_upload'; + break; + case 'X': + $datos[$a]['elemento_formulario'] = 'ef_editable_textarea'; + break; + default: + $datos[$a]['elemento_formulario'] = 'ef_editable'; + } + } + // Si es editable, pongo el tamaño de campos + if ($datos[$a]['elemento_formulario'] == 'ef_editable') { + if ($columna['largo'] > 0) { + $datos[$a]['edit_maximo'] = $columna['largo']; + if ($columna['largo'] < 80) { + $datos[$a]['edit_tamano'] = $columna['largo']; + } else { + $datos[$a]['edit_tamano'] = 80; + } + } + } + $datos[$a]['orden'] = $a+100; + $a++; + } + } + return $datos; + } + + /** + * Exporta la definicion de una manera entendible para el datos_tabla de la tabla + * donde se guardan las columnas del ei_cuadro + */ + public function exportar_datos_columnas($incluir_pk=false) + { + $datos = array(); + $a=0; + foreach ($this->datos['_info_columnas'] as $columna) { + if (((!$columna['pk']) || $incluir_pk) && $columna['secuencia'] == '') { + $datos[$a]['clave'] = $columna['columna']; + $datos[$a]['titulo'] = ucfirst(str_replace("_", " ", $columna['columna'])); + switch ($columna['tipo']) { + case 'E': + $datos[$a]['estilo'] = '0';//numero-1 + break; + case 'N': + $datos[$a]['estilo'] = '0'; + break; + default: + $datos[$a]['estilo'] = '4'; //texto-1 + } + $datos[$a]['orden'] = $a; + $a++; + } + } + return $datos; + } + + /** + * Obtiene la informacion de metadatos de las columnas del dt, puede filtrar por + * condiciones particulares + * @param array $id Arreglo asociativo de condiciones ('nombre' => 'valor') + * @return array + */ + public function get_info_columnas($id = array()) + { + $resultado = $this->datos['_info_columnas']; + if (! empty($id)) { + $cond = array_keys($id); + $keys_r = array_keys($resultado); + foreach ($keys_r as $klave) { + $valido = true; + foreach ($cond as $col) { + $valido = $valido && ($resultado[$klave][$col] == $id[$col]); + } + if (! $valido) { + unset($resultado[$klave]); + } + }//fe + } + return $resultado; + } + + + //------------------------------------------------------------------------ + //------ METACLASE ------------------------------------------------------- + //------------------------------------------------------------------------ + + public function get_molde_subclase() + { + $molde = $this->get_molde_vacio(); + + //-- Validar Ingreso + $doc = "Ventana de validacion que se invoca cuando se crea o modifica una fila en memoria. Lanzar una excepcion en caso de error"; + $comentarios = array( + $doc, + '@param array $fila Datos de la fila', + '@param mixed $id Id. interno de la fila, si tiene (en el caso modificacion de la fila)' + ); + $metodo = new toba_codigo_metodo_php('evt__validar_ingreso', array('$fila','$id=null'), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + //-- Validar Foña + $doc = "Ventana de validacion que se invoca antes de sincronizar una fila con la base"; + $comentarios = array( + $doc, + "El proceso puede ser abortado con un toba_error, el mensaje se muestra al usuario", + '@param array $fila Asociativo clave-valor de la fila a validar' + ); + $metodo = new toba_codigo_metodo_php('evt__validar_fila', array('$fila'), $comentarios); + $metodo->set_doc($doc); + $molde->agregar($metodo); + + return $molde; + } +} diff --git a/php/modelo/info/componentes/toba_ei_arbol_info.php b/php/modelo/info/componentes/toba_ei_arbol_info.php index bfb5afbb1b..4324f79e77 100644 --- a/php/modelo/info/componentes/toba_ei_arbol_info.php +++ b/php/modelo/info/componentes/toba_ei_arbol_info.php @@ -1,43 +1,42 @@ -get_molde_vacio(); - } - - function eventos_predefinidos() - { - $eventos = parent::eventos_predefinidos(); - $eventos['cambio_apertura']['parametros'] = array('$apertura'); - $eventos['cambio_apertura']['comentarios'] = array('Para cada nodo del árbol notifica si se encuentra expandido visualmente','@param array $apertura arreglo asociativo => 0|1 determinando si esta abierto o no'); - $eventos['ver_propiedades']['parametros'] = array('$nodo'); - $eventos['ver_propiedades']['comentarios'] = array('Notifica que el usuario ingreso a un nodo específico', '@param string $nodo Identificador del nodo seleccionado'); - return $eventos; - } - - function get_comentario_carga() - { - return array( - "Permite cambiar la configuración del arbol previo a la generación de la salida", - "El formato de carga a través del método set_datos es un arreglo de objetos que implementen la interface toba_nodo_arbol", - ); - } - -} -?> \ No newline at end of file +get_molde_vacio(); + } + + public function eventos_predefinidos() + { + $eventos = parent::eventos_predefinidos(); + $eventos['cambio_apertura']['parametros'] = array('$apertura'); + $eventos['cambio_apertura']['comentarios'] = array('Para cada nodo del árbol notifica si se encuentra expandido visualmente','@param array $apertura arreglo asociativo => 0|1 determinando si esta abierto o no'); + $eventos['ver_propiedades']['parametros'] = array('$nodo'); + $eventos['ver_propiedades']['comentarios'] = array('Notifica que el usuario ingreso a un nodo específico', '@param string $nodo Identificador del nodo seleccionado'); + return $eventos; + } + + public function get_comentario_carga() + { + return array( + "Permite cambiar la configuración del arbol previo a la generación de la salida", + "El formato de carga a través del método set_datos es un arreglo de objetos que implementen la interface toba_nodo_arbol", + ); + } +} diff --git a/php/modelo/info/componentes/toba_ei_archivos_info.php b/php/modelo/info/componentes/toba_ei_archivos_info.php index 42a00c63ca..4589389254 100644 --- a/php/modelo/info/componentes/toba_ei_archivos_info.php +++ b/php/modelo/info/componentes/toba_ei_archivos_info.php @@ -1,39 +1,39 @@ -get_molde_vacio(); - } - - function get_comentario_carga() - { - return array( - "Permite cambiar la configuración del componente previo a la generación de la salida", - ); - } - - function eventos_predefinidos() - { - $eventos = parent::eventos_predefinidos(); - $eventos['seleccionar_archivo']['parametros'] = array('$archivo'); - $eventos['seleccionar_archivo']['comentarios'] = array("Indica que el usuario seleccionó un archivo puntual de la lista", '@param string $archivo'); - return $eventos; - } -} -?> \ No newline at end of file +get_molde_vacio(); + } + + public function get_comentario_carga() + { + return array( + "Permite cambiar la configuración del componente previo a la generación de la salida", + ); + } + + public function eventos_predefinidos() + { + $eventos = parent::eventos_predefinidos(); + $eventos['seleccionar_archivo']['parametros'] = array('$archivo'); + $eventos['seleccionar_archivo']['comentarios'] = array("Indica que el usuario seleccionó un archivo puntual de la lista", '@param string $archivo'); + return $eventos; + } +} diff --git a/php/modelo/info/componentes/toba_ei_calendario_info.php b/php/modelo/info/componentes/toba_ei_calendario_info.php index dbd4729977..01071c765f 100644 --- a/php/modelo/info/componentes/toba_ei_calendario_info.php +++ b/php/modelo/info/componentes/toba_ei_calendario_info.php @@ -1,44 +1,44 @@ -get_molde_vacio(); - } - - function eventos_predefinidos() - { - $eventos = parent::eventos_predefinidos(); - $eventos['seleccionar_dia']['parametros'] = array('$dia'); - $eventos['seleccionar_dia']['comentarios'] = array("Indica que el usuario selecciono un día puntual del calendario","@param array \$dia Asociativo con los campos 'dia', 'mes' y 'anio'"); - $eventos['seleccionar_semana']['parametros'] = array('$semana'); - $eventos['seleccionar_semana']['comentarios'] = array("Indica que el usuario selecciono una semana puntual del calendario","@param array \$semana Asociativo con los campos 'semana' y 'anio'"); - $eventos['cambiar_mes']['parametros'] = array('$mes'); - $eventos['cambiar_mes']['comentarios'] = array("Indica que el usuario cambio el mes/año actual","@param array \$mes Asociativo conteniendo el 'mes' y el 'anio'"); - return $eventos; - } - - function get_comentario_carga() - { - return array( - "Permite cambiar la configuración del calendario previo a la generación de la salida", - "El formato de carga a través del método set_datos es un recordset con columnas dia y contenido", - ); - } -} -?> \ No newline at end of file +get_molde_vacio(); + } + + public function eventos_predefinidos() + { + $eventos = parent::eventos_predefinidos(); + $eventos['seleccionar_dia']['parametros'] = array('$dia'); + $eventos['seleccionar_dia']['comentarios'] = array("Indica que el usuario selecciono un día puntual del calendario","@param array \$dia Asociativo con los campos 'dia', 'mes' y 'anio'"); + $eventos['seleccionar_semana']['parametros'] = array('$semana'); + $eventos['seleccionar_semana']['comentarios'] = array("Indica que el usuario selecciono una semana puntual del calendario","@param array \$semana Asociativo con los campos 'semana' y 'anio'"); + $eventos['cambiar_mes']['parametros'] = array('$mes'); + $eventos['cambiar_mes']['comentarios'] = array("Indica que el usuario cambio el mes/año actual","@param array \$mes Asociativo conteniendo el 'mes' y el 'anio'"); + return $eventos; + } + + public function get_comentario_carga() + { + return array( + "Permite cambiar la configuración del calendario previo a la generación de la salida", + "El formato de carga a través del método set_datos es un recordset con columnas dia y contenido", + ); + } +} diff --git a/php/modelo/info/componentes/toba_ei_codigo_info.php b/php/modelo/info/componentes/toba_ei_codigo_info.php index 12698e9091..373628c2c0 100644 --- a/php/modelo/info/componentes/toba_ei_codigo_info.php +++ b/php/modelo/info/componentes/toba_ei_codigo_info.php @@ -1,54 +1,54 @@ -get_molde_vacio(); - } - - function get_comentario_carga() - { - return array( - "Permite cambiar la configuración del grafico previo a la generación de la salida" - ); - } - - static function get_modelos_evento() - { - $modelo[0]['id'] = 'basico'; - $modelo[0]['nombre'] = 'Basico'; - return $modelo; - } - - static function get_lista_eventos_estandar($modelo) - { - $evento = array(); - switch($modelo){ - case 'basico': - $evento[0]['identificador'] = "modificacion"; - $evento[0]['etiqueta'] = "&Modificar"; - $evento[0]['maneja_datos'] = 1; - $evento[0]['implicito'] = true; - $evento[0]['orden'] = 3; - $evento[0]['en_botonera'] = 0; - break; - } - return $evento; - } -} -?> \ No newline at end of file +get_molde_vacio(); + } + + public function get_comentario_carga() + { + return array( + "Permite cambiar la configuración del grafico previo a la generación de la salida" + ); + } + + public static function get_modelos_evento() + { + $modelo[0]['id'] = 'basico'; + $modelo[0]['nombre'] = 'Basico'; + return $modelo; + } + + public static function get_lista_eventos_estandar($modelo) + { + $evento = array(); + switch ($modelo) { + case 'basico': + $evento[0]['identificador'] = "modificacion"; + $evento[0]['etiqueta'] = "&Modificar"; + $evento[0]['maneja_datos'] = 1; + $evento[0]['implicito'] = true; + $evento[0]['orden'] = 3; + $evento[0]['en_botonera'] = 0; + break; + } + return $evento; + } +} diff --git a/php/modelo/info/componentes/toba_ei_cuadro_info.php b/php/modelo/info/componentes/toba_ei_cuadro_info.php index 060657642a..ddb7d110c3 100644 --- a/php/modelo/info/componentes/toba_ei_cuadro_info.php +++ b/php/modelo/info/componentes/toba_ei_cuadro_info.php @@ -1,120 +1,121 @@ -get_molde_vacio(); - $molde->agregar_bloque( $this->get_molde_eventos_js() ); - $molde->agregar_bloque( $this->get_molde_eventos_sobre_fila() ); - // Cortes de control - $molde->agregar( new toba_codigo_separador_php('Configuracion de cortes de control','Pantallas') ); - $datos_cortes = rs_ordenar_por_columna($this->datos['_info_cuadro_cortes'],'orden'); - foreach($datos_cortes as $corte) { - //-- Sumarizar cc - $comentario_param = 'Reemplazar esta línea para cambiar el titulo de la sumarizacion!'; - $comentario = 'Ventana que dado un conjunto de filas de un corte de control permite sumarizarlas de forma personalizada'; - $extra = 'Reemplazar "propia" con algún otro identificador, para distinguir la sumarizacion y poder realizar una por método '; - $parametros = '@param $filas Arreglo de filas tipo recordset'; - $metodo = new toba_codigo_metodo_php('sumarizar_cc__' . $corte['identificador'] . '__propia', array('$filas'), array($comentario_param, $comentario, $extra, $parametros)); - $metodo->set_doc($comentario); - $molde->agregar($metodo); - $molde->ultimo_elemento()->set_contenido('return 0;'); - - - //-- Cabecera de corte - $comentario = 'Ventana que permite determinar el titulo cabecera de un corte de control'; - $metodo = new toba_codigo_metodo_php('html_cabecera_cc_contenido__' . $corte['identificador'], array('&$nodo'), array($comentario) ); - $metodo->set_doc($comentario); - $molde->agregar($metodo); - $molde->ultimo_elemento()->set_contenido('echo \'descripcion\';'); - - $molde->agregar( new toba_codigo_metodo_php('html_pie_cc_contenido__' . $corte['identificador'], array('&$nodo') ) ); - $molde->ultimo_elemento()->set_contenido('echo \'descripcion\';'); - $molde->agregar( new toba_codigo_metodo_php('html_pie_cc_cabecera__' . $corte['identificador'], array('&$nodo') ) ); - $molde->ultimo_elemento()->set_contenido('return \'descripcion\';'); - } - return $molde; - } - - //--- Primitivas sobre eventos ------------------------------------------- - - function eventos_predefinidos() - { - $eventos = parent::eventos_predefinidos(); - if ($this->ordenable()){ - $eventos['ordenar']['parametros'] = array('$columna','$sentido'); - $eventos['ordenar']['comentarios'] = array('El usuario pide ordenar los datos del cuadro a partir de una columna específica. Al existir este método el cuadro no toma acción en el ordenamiento y se deja en manos de esta extensión', - "@param string \$columna Id. de la columna por la cual se pidio ordenar", - "@param string \$sentido puede ser \"des\" o \"asc\"" - ); - } - return $eventos; - } - - function ordenable() { - return $this->datos['_info_cuadro']['ordenar']; - } - - function get_comentario_carga() - { - return array( - "Permite cambiar la configuración del cuadro previo a la generación de la salida", - "El formato de carga es de tipo recordset: array( array('columna' => valor, ...), ...)", - ); - } - - //-- Generacion de metadatos - - static function get_modelos_evento() - { - $modelo[0]['id'] = 'seleccion'; - $modelo[0]['nombre'] = 'Seleccion'; - return $modelo; - } - - static function get_lista_eventos_estandar($modelo) - { - $evento = array(); - switch($modelo){ - case 'seleccion': - $evento[0]['identificador'] = "seleccion"; - $evento[0]['etiqueta'] = ""; - $evento[0]['orden'] = 1; - $evento[0]['sobre_fila'] = 1; - $evento[0]['en_botonera'] = 0; - $evento[0]['imagen_recurso_origen'] = "apex"; - $evento[0]['imagen'] = "doc.gif"; - break; - } - return $evento; - } - - static function get_eventos_internos(toba_datos_relacion $dr) - { - $eventos = array(); - if ($dr->tabla('prop_basicas')->get_columna('paginar') ) { - $eventos['cambiar_pagina'] = "Se recibe como parámetro el número de página a la que se cambio."; - } - if ($dr->tabla('prop_basicas')->get_columna('ordenar') ) { - $eventos['ordenar'] = "Se recibe como primer parámetro el sentido del ordenamiento ('asc' o 'des') y como segundo la columna a ordenar. ". - "Si no se atrapa el evento, el ordenamiento lo asume el propio cuadro."; - } - return $eventos; - } -} -?> \ No newline at end of file +get_molde_vacio(); + $molde->agregar_bloque($this->get_molde_eventos_js()); + $molde->agregar_bloque($this->get_molde_eventos_sobre_fila()); + // Cortes de control + $molde->agregar(new toba_codigo_separador_php('Configuracion de cortes de control', 'Pantallas')); + $datos_cortes = rs_ordenar_por_columna($this->datos['_info_cuadro_cortes'], 'orden'); + foreach ($datos_cortes as $corte) { + //-- Sumarizar cc + $comentario_param = 'Reemplazar esta línea para cambiar el titulo de la sumarizacion!'; + $comentario = 'Ventana que dado un conjunto de filas de un corte de control permite sumarizarlas de forma personalizada'; + $extra = 'Reemplazar "propia" con algún otro identificador, para distinguir la sumarizacion y poder realizar una por método '; + $parametros = '@param $filas Arreglo de filas tipo recordset'; + $metodo = new toba_codigo_metodo_php('sumarizar_cc__' . $corte['identificador'] . '__propia', array('$filas'), array($comentario_param, $comentario, $extra, $parametros)); + $metodo->set_doc($comentario); + $molde->agregar($metodo); + $molde->ultimo_elemento()->set_contenido('return 0;'); + + + //-- Cabecera de corte + $comentario = 'Ventana que permite determinar el titulo cabecera de un corte de control'; + $metodo = new toba_codigo_metodo_php('html_cabecera_cc_contenido__' . $corte['identificador'], array('&$nodo'), array($comentario)); + $metodo->set_doc($comentario); + $molde->agregar($metodo); + $molde->ultimo_elemento()->set_contenido('echo \'descripcion\';'); + + $molde->agregar(new toba_codigo_metodo_php('html_pie_cc_contenido__' . $corte['identificador'], array('&$nodo'))); + $molde->ultimo_elemento()->set_contenido('echo \'descripcion\';'); + $molde->agregar(new toba_codigo_metodo_php('html_pie_cc_cabecera__' . $corte['identificador'], array('&$nodo'))); + $molde->ultimo_elemento()->set_contenido('return \'descripcion\';'); + } + return $molde; + } + + //--- Primitivas sobre eventos ------------------------------------------- + + public function eventos_predefinidos() + { + $eventos = parent::eventos_predefinidos(); + if ($this->ordenable()) { + $eventos['ordenar']['parametros'] = array('$columna','$sentido'); + $eventos['ordenar']['comentarios'] = array('El usuario pide ordenar los datos del cuadro a partir de una columna específica. Al existir este método el cuadro no toma acción en el ordenamiento y se deja en manos de esta extensión', + "@param string \$columna Id. de la columna por la cual se pidio ordenar", + "@param string \$sentido puede ser \"des\" o \"asc\"" + ); + } + return $eventos; + } + + public function ordenable() + { + return $this->datos['_info_cuadro']['ordenar']; + } + + public function get_comentario_carga() + { + return array( + "Permite cambiar la configuración del cuadro previo a la generación de la salida", + "El formato de carga es de tipo recordset: array( array('columna' => valor, ...), ...)", + ); + } + + //-- Generacion de metadatos + + public static function get_modelos_evento() + { + $modelo[0]['id'] = 'seleccion'; + $modelo[0]['nombre'] = 'Seleccion'; + return $modelo; + } + + public static function get_lista_eventos_estandar($modelo) + { + $evento = array(); + switch ($modelo) { + case 'seleccion': + $evento[0]['identificador'] = "seleccion"; + $evento[0]['etiqueta'] = ""; + $evento[0]['orden'] = 1; + $evento[0]['sobre_fila'] = 1; + $evento[0]['en_botonera'] = 0; + $evento[0]['imagen_recurso_origen'] = "apex"; + $evento[0]['imagen'] = "doc.gif"; + break; + } + return $evento; + } + + public static function get_eventos_internos(toba_datos_relacion $dr) + { + $eventos = array(); + if ($dr->tabla('prop_basicas')->get_columna('paginar')) { + $eventos['cambiar_pagina'] = "Se recibe como parámetro el número de página a la que se cambio."; + } + if ($dr->tabla('prop_basicas')->get_columna('ordenar')) { + $eventos['ordenar'] = "Se recibe como primer parámetro el sentido del ordenamiento ('asc' o 'des') y como segundo la columna a ordenar. ". + "Si no se atrapa el evento, el ordenamiento lo asume el propio cuadro."; + } + return $eventos; + } +} diff --git a/php/modelo/info/componentes/toba_ei_esquema_info.php b/php/modelo/info/componentes/toba_ei_esquema_info.php index 5d017979b6..5661cff1a3 100644 --- a/php/modelo/info/componentes/toba_ei_esquema_info.php +++ b/php/modelo/info/componentes/toba_ei_esquema_info.php @@ -1,32 +1,32 @@ -get_molde_vacio(); - } - - function get_comentario_carga() - { - return array( - "Permite cambiar la configuración del esquea previo a la generación de la salida", - "El formato de carga a través del método set_datos es un arreglo de objetos que implementen la interface toba_nodo_arbol", - ); - } -} -?> \ No newline at end of file +get_molde_vacio(); + } + + public function get_comentario_carga() + { + return array( + "Permite cambiar la configuración del esquea previo a la generación de la salida", + "El formato de carga a través del método set_datos es un arreglo de objetos que implementen la interface toba_nodo_arbol", + ); + } +} diff --git a/php/modelo/info/componentes/toba_ei_filtro_info.php b/php/modelo/info/componentes/toba_ei_filtro_info.php index 349c2870d0..c105fc140a 100644 --- a/php/modelo/info/componentes/toba_ei_filtro_info.php +++ b/php/modelo/info/componentes/toba_ei_filtro_info.php @@ -1,114 +1,116 @@ -get_molde_vacio(); - // Redefinicion del LAYOUT - $ayuda = "Permite modificar la forma en que se grafica el formulario, por defecto un ef sobre el otro"; - $doc = array( - $ayuda - ); - $metodo = new toba_codigo_metodo_php('generar_layout', array(), $doc); - $metodo->set_doc($ayuda); - $molde->agregar($metodo); - $php = array(); - foreach ($this->datos['_info_filtro_col'] as $ef => $info) { - $php[] = '$this->generar_html_ef(\''.$info['nombre'].'\');'; - } - $molde->ultimo_elemento()->set_contenido($php); - - //--Javascript - $molde->agregar_bloque( $this->get_molde_eventos_js() ); - $molde->agregar( new toba_codigo_separador_js('Validacion general') ); +set_doc("Validación general del formulario"); - $molde->agregar($metodo); +class toba_ei_filtro_info extends toba_ei_formulario_info +{ + public static function get_tipo_abreviado() + { + return "Filtro"; + } - if(count($this->datos['_info_filtro_col'])) { - //-- Procesamiento de EFs - $doc = array("Método que se invoca al cambiar el valor del ef en el cliente", - "Se dispara inicialmente al graficar la pantalla, enviando en true el primer parámetro", - ); - $molde->agregar( new toba_codigo_separador_js('Procesamiento de EFs') ); - foreach ($this->datos['_info_filtro_col'] as $ef => $info) { - $parametros = array('es_inicial'); - if($multilinea) $parametros[] = 'fila'; - $metodo = new toba_codigo_metodo_js('evt__' . $info['nombre'] . '__procesar', $parametros, $doc); - $metodo->set_doc("Método que se invoca al cambiar el valor del ef en el cliente"); - $molde->agregar($metodo); - } - //-- Validacion de EFs - $molde->agregar( new toba_codigo_separador_js('Validacion de EFs') ); - $doc = array("Validación puntual de un ef en el cliente", - "Retornar true/false para controlar la validación", - "Usar this.ef(id).set_error(mensaje) para mostrar un error contextual al campo" - ); - foreach ($this->datos['_info_filtro_col'] as $ef => $info) { - $parametros = $multilinea ? array('fila') : array(); - $metodo = new toba_codigo_metodo_js('evt__' . $info['nombre'] . '__validar', $parametros, $doc) ; - $metodo->set_doc("Validación puntual de un ef en el cliente"); - $molde->agregar($metodo); - } - } - return $molde; - } - - //--------------------------------------------------------------------- - //-- EVENTOS - //--------------------------------------------------------------------- - - //-- Generacion de metadatos - - static function get_modelos_evento() - { - $modelo[0]['id'] = 'basico'; - $modelo[0]['nombre'] = 'Filtrar - Limpiar'; - return $modelo; - } - - static function get_lista_eventos_estandar($modelo) - { - $evento = array(); - switch($modelo){ - case 'basico': - $evento[0]['identificador'] = "filtrar"; - $evento[0]['etiqueta'] = "&Filtrar"; - $evento[0]['estilo'] = "ei-boton-filtrar"; - $evento[0]['orden'] = 1; - $evento[0]['en_botonera'] = 1; - $evento[0]['maneja_datos'] = 1; - $evento[0]['grupo'] = 'cargado,no_cargado'; - $evento[0]['imagen_recurso_origen'] = 'apex'; - $evento[0]['imagen'] = 'filtrar.png'; - - $evento[1]['identificador'] = "cancelar"; - $evento[1]['etiqueta'] = "&Limpiar"; - $evento[1]['estilo'] = "ei-boton-limpiar"; - $evento[1]['orden'] = 2; - $evento[1]['en_botonera'] = 1; - $evento[1]['grupo'] = 'cargado'; - $evento[1]['imagen_recurso_origen'] = 'apex'; - $evento[1]['imagen'] = 'limpiar.png'; - break; - } - return $evento; - } -} -?> \ No newline at end of file + public function get_nombre_instancia_abreviado() + { + return "filtro"; + } + + public function get_molde_subclase($multilinea=false) + { + $molde = $this->get_molde_vacio(); + // Redefinicion del LAYOUT + $ayuda = "Permite modificar la forma en que se grafica el formulario, por defecto un ef sobre el otro"; + $doc = array( + $ayuda + ); + $metodo = new toba_codigo_metodo_php('generar_layout', array(), $doc); + $metodo->set_doc($ayuda); + $molde->agregar($metodo); + $php = array(); + foreach ($this->datos['_info_filtro_col'] as $ef => $info) { + $php[] = '$this->generar_html_ef(\''.$info['nombre'].'\');'; + } + $molde->ultimo_elemento()->set_contenido($php); + + //--Javascript + $molde->agregar_bloque($this->get_molde_eventos_js()); + $molde->agregar(new toba_codigo_separador_js('Validacion general')); + + //Validar datos + $doc = array("Validación general del formulario", + "Retornar true/false para controlar la validación", + "Usar notificacion.agregar() para mostrar mensajes al usuario" + ); + $metodo = new toba_codigo_metodo_js('evt__validar_datos', array(), $doc); + $metodo->set_doc("Validación general del formulario"); + $molde->agregar($metodo); + + if (count($this->datos['_info_filtro_col'])) { + //-- Procesamiento de EFs + $doc = array("Método que se invoca al cambiar el valor del ef en el cliente", + "Se dispara inicialmente al graficar la pantalla, enviando en true el primer parámetro", + ); + $molde->agregar(new toba_codigo_separador_js('Procesamiento de EFs')); + foreach ($this->datos['_info_filtro_col'] as $ef => $info) { + $parametros = array('es_inicial'); + if ($multilinea) { + $parametros[] = 'fila'; + } + $metodo = new toba_codigo_metodo_js('evt__' . $info['nombre'] . '__procesar', $parametros, $doc); + $metodo->set_doc("Método que se invoca al cambiar el valor del ef en el cliente"); + $molde->agregar($metodo); + } + //-- Validacion de EFs + $molde->agregar(new toba_codigo_separador_js('Validacion de EFs')); + $doc = array("Validación puntual de un ef en el cliente", + "Retornar true/false para controlar la validación", + "Usar this.ef(id).set_error(mensaje) para mostrar un error contextual al campo" + ); + foreach ($this->datos['_info_filtro_col'] as $ef => $info) { + $parametros = $multilinea ? array('fila') : array(); + $metodo = new toba_codigo_metodo_js('evt__' . $info['nombre'] . '__validar', $parametros, $doc) ; + $metodo->set_doc("Validación puntual de un ef en el cliente"); + $molde->agregar($metodo); + } + } + return $molde; + } + + //--------------------------------------------------------------------- + //-- EVENTOS + //--------------------------------------------------------------------- + + //-- Generacion de metadatos + + public static function get_modelos_evento() + { + $modelo[0]['id'] = 'basico'; + $modelo[0]['nombre'] = 'Filtrar - Limpiar'; + return $modelo; + } + + public static function get_lista_eventos_estandar($modelo) + { + $evento = array(); + switch ($modelo) { + case 'basico': + $evento[0]['identificador'] = "filtrar"; + $evento[0]['etiqueta'] = "&Filtrar"; + $evento[0]['estilo'] = "ei-boton-filtrar"; + $evento[0]['orden'] = 1; + $evento[0]['en_botonera'] = 1; + $evento[0]['maneja_datos'] = 1; + $evento[0]['grupo'] = 'cargado,no_cargado'; + $evento[0]['imagen_recurso_origen'] = 'apex'; + $evento[0]['imagen'] = 'filtrar.png'; + + $evento[1]['identificador'] = "cancelar"; + $evento[1]['etiqueta'] = "&Limpiar"; + $evento[1]['estilo'] = "ei-boton-limpiar"; + $evento[1]['orden'] = 2; + $evento[1]['en_botonera'] = 1; + $evento[1]['grupo'] = 'cargado'; + $evento[1]['imagen_recurso_origen'] = 'apex'; + $evento[1]['imagen'] = 'limpiar.png'; + break; + } + return $evento; + } +} diff --git a/php/modelo/info/componentes/toba_ei_firma_info.php b/php/modelo/info/componentes/toba_ei_firma_info.php index e0f184e645..16c36a7589 100644 --- a/php/modelo/info/componentes/toba_ei_firma_info.php +++ b/php/modelo/info/componentes/toba_ei_firma_info.php @@ -1,54 +1,54 @@ -get_molde_vacio(); - } - - function get_comentario_carga() - { - return array( - "Permite cambiar la configuración del applet previo a la generación de la salida" - ); - } - - static function get_modelos_evento() - { - $modelo[0]['id'] = 'basico'; - $modelo[0]['nombre'] = 'Basico'; - return $modelo; - } - - static function get_lista_eventos_estandar($modelo) - { - $evento = array(); - switch($modelo){ - case 'basico': - $evento[0]['identificador'] = "modificacion"; - $evento[0]['etiqueta'] = "&Modificar"; - $evento[0]['maneja_datos'] = 1; - $evento[0]['implicito'] = true; - $evento[0]['orden'] = 3; - $evento[0]['en_botonera'] = 0; - break; - } - return $evento; - } -} -?> \ No newline at end of file +get_molde_vacio(); + } + + public function get_comentario_carga() + { + return array( + "Permite cambiar la configuración del applet previo a la generación de la salida" + ); + } + + public static function get_modelos_evento() + { + $modelo[0]['id'] = 'basico'; + $modelo[0]['nombre'] = 'Basico'; + return $modelo; + } + + public static function get_lista_eventos_estandar($modelo) + { + $evento = array(); + switch ($modelo) { + case 'basico': + $evento[0]['identificador'] = "modificacion"; + $evento[0]['etiqueta'] = "&Modificar"; + $evento[0]['maneja_datos'] = 1; + $evento[0]['implicito'] = true; + $evento[0]['orden'] = 3; + $evento[0]['en_botonera'] = 0; + break; + } + return $evento; + } +} diff --git a/php/modelo/info/componentes/toba_ei_formulario_info.php b/php/modelo/info/componentes/toba_ei_formulario_info.php index 00112db0c4..6e87da56b5 100644 --- a/php/modelo/info/componentes/toba_ei_formulario_info.php +++ b/php/modelo/info/componentes/toba_ei_formulario_info.php @@ -1,169 +1,171 @@ -get_molde_vacio(); - // Redefinicion del LAYOUT - $ayuda = "Permite modificar la forma en que se grafica el formulario, por defecto un ef sobre el otro"; - $doc = array( - $ayuda - ); - $metodo = new toba_codigo_metodo_php('generar_layout', array(), $doc); - $metodo->set_doc($ayuda); - $molde->agregar($metodo); - $php = array(); - foreach ($this->datos['_info_formulario_ef'] as $ef => $info) { - $php[] = '$this->generar_html_ef(\''.$info['identificador'].'\');'; - } - $molde->ultimo_elemento()->set_contenido($php); - - //--Javascript - $molde->agregar_bloque( $this->get_molde_eventos_js() ); - $molde->agregar( new toba_codigo_separador_js('Validacion general') ); - - //Validar datos - $doc = array("Validación general del formulario", - "Retornar true/false para controlar la validación", - "Usar notificacion.agregar() para mostrar mensajes al usuario" - ); - $metodo = new toba_codigo_metodo_js('evt__validar_datos', array(), $doc); - $metodo->set_doc("Validación general del formulario"); - $molde->agregar($metodo); - - if(count($this->datos['_info_formulario_ef'])) { - //-- Procesamiento de EFs - $doc = array("Método que se invoca al cambiar el valor del ef en el cliente", - "Se dispara inicialmente al graficar la pantalla, enviando en true el primer parámetro", - ); - $molde->agregar( new toba_codigo_separador_js('Procesamiento de EFs') ); - foreach ($this->datos['_info_formulario_ef'] as $ef => $info) { - $parametros = array('es_inicial'); - if($multilinea) $parametros[] = 'fila'; - $metodo = new toba_codigo_metodo_js('evt__' . $info['identificador'] . '__procesar', $parametros, $doc); - $metodo->set_doc("Método que se invoca al cambiar el valor del ef en el cliente"); - $molde->agregar($metodo); - } - //-- Validacion de EFs - $molde->agregar( new toba_codigo_separador_js('Validacion de EFs') ); - $doc = array("Validación puntual de un ef en el cliente", - "Retornar true/false para controlar la validación", - "Usar this.ef(id).set_error(mensaje) para mostrar un error contextual al campo" - ); - foreach ($this->datos['_info_formulario_ef'] as $ef => $info) { - $parametros = $multilinea ? array('fila') : array(); - $metodo = new toba_codigo_metodo_js('evt__' . $info['identificador'] . '__validar', $parametros, $doc) ; - $metodo->set_doc("Validación puntual de un ef en el cliente"); - $molde->agregar($metodo); - } - } - return $molde; - } - - function get_comentario_carga() - { - return array( - "Permite cambiar la configuración del formulario previo a la generación de la salida", - "El formato del carga debe ser array( => , ...)" - ); - } - - //-- Generacion de metadatos - - static function get_modelos_evento() - { - $modelo[0]['id'] = 'basico'; - $modelo[0]['nombre'] = 'Basico'; - $modelo[1]['id'] = 'abm'; - $modelo[1]['nombre'] = 'ABM'; - $modelo[2]['id'] = 'filtro'; - $modelo[2]['nombre'] = 'Filtrar/Limpiar'; - return $modelo; - } - - static function get_lista_eventos_estandar($modelo) - { - $evento = array(); - switch($modelo){ - case 'basico': - $evento[0]['identificador'] = "modificacion"; - $evento[0]['etiqueta'] = "&Modificar"; - $evento[0]['maneja_datos'] = 1; - $evento[0]['implicito'] = true; - $evento[0]['orden'] = 3; - $evento[0]['en_botonera'] = 0; - break; - case 'abm': - $evento[0]['identificador'] = "alta"; - $evento[0]['etiqueta'] = "&Agregar"; - $evento[0]['maneja_datos'] = 1; - $evento[0]['estilo'] = "ei-boton-alta"; - $evento[0]['orden'] = 1; - $evento[0]['en_botonera'] = 1; - $evento[0]['grupo'] = 'no_cargado'; - - $evento[1]['identificador'] = "baja"; - $evento[1]['etiqueta'] = "&Eliminar"; - $evento[1]['estilo'] = "ei-boton-baja"; - $evento[1]['imagen_recurso_origen'] = 'apex'; - $evento[1]['imagen'] = 'borrar.gif'; - $evento[1]['confirmacion'] = "¿Desea ELIMINAR el registro?"; - $evento[1]['orden'] = 2; - $evento[1]['en_botonera'] = 1; - $evento[1]['grupo'] = 'cargado'; - - $evento[2]['identificador'] = "modificacion"; - $evento[2]['etiqueta'] = "&Modificar"; - $evento[2]['maneja_datos'] = 1; - $evento[2]['estilo'] = "ei-boton-mod"; - $evento[2]['orden'] = 3; - $evento[2]['en_botonera'] = 1; - $evento[2]['grupo'] = 'cargado'; - - $evento[3]['identificador'] = "cancelar"; - $evento[3]['maneja_datos'] = 0; - $evento[3]['etiqueta'] = "Ca&ncelar"; - $evento[3]['estilo'] = "ei-boton-canc"; - $evento[3]['orden'] = 4; - $evento[3]['en_botonera'] = 1; - $evento[3]['grupo'] = 'cargado'; - break; - - case 'filtro': - $evento[0]['identificador'] = "filtrar"; - $evento[0]['etiqueta'] = "&Filtrar"; - $evento[0]['estilo'] = "ei-boton-filtrar"; - $evento[0]['orden'] = 1; - $evento[0]['en_botonera'] = 1; - $evento[0]['maneja_datos'] = 1; - $evento[0]['grupo'] = 'cargado,no_cargado'; - $evento[0]['imagen_recurso_origen'] = 'apex'; - $evento[0]['imagen'] = 'filtrar.png'; - - $evento[1]['identificador'] = "cancelar"; - $evento[1]['etiqueta'] = "&Limpiar"; - $evento[1]['estilo'] = "ei-boton-limpiar"; - $evento[1]['orden'] = 2; - $evento[1]['en_botonera'] = 1; - $evento[1]['grupo'] = 'cargado'; - $evento[1]['imagen_recurso_origen'] = 'apex'; - $evento[1]['imagen'] = 'limpiar.png'; - } - return $evento; - } -} -?> \ No newline at end of file +get_molde_vacio(); + // Redefinicion del LAYOUT + $ayuda = "Permite modificar la forma en que se grafica el formulario, por defecto un ef sobre el otro"; + $doc = array( + $ayuda + ); + $metodo = new toba_codigo_metodo_php('generar_layout', array(), $doc); + $metodo->set_doc($ayuda); + $molde->agregar($metodo); + $php = array(); + foreach ($this->datos['_info_formulario_ef'] as $ef => $info) { + $php[] = '$this->generar_html_ef(\''.$info['identificador'].'\');'; + } + $molde->ultimo_elemento()->set_contenido($php); + + //--Javascript + $molde->agregar_bloque($this->get_molde_eventos_js()); + $molde->agregar(new toba_codigo_separador_js('Validacion general')); + + //Validar datos + $doc = array("Validación general del formulario", + "Retornar true/false para controlar la validación", + "Usar notificacion.agregar() para mostrar mensajes al usuario" + ); + $metodo = new toba_codigo_metodo_js('evt__validar_datos', array(), $doc); + $metodo->set_doc("Validación general del formulario"); + $molde->agregar($metodo); + + if (count($this->datos['_info_formulario_ef'])) { + //-- Procesamiento de EFs + $doc = array("Método que se invoca al cambiar el valor del ef en el cliente", + "Se dispara inicialmente al graficar la pantalla, enviando en true el primer parámetro", + ); + $molde->agregar(new toba_codigo_separador_js('Procesamiento de EFs')); + foreach ($this->datos['_info_formulario_ef'] as $ef => $info) { + $parametros = array('es_inicial'); + if ($multilinea) { + $parametros[] = 'fila'; + } + $metodo = new toba_codigo_metodo_js('evt__' . $info['identificador'] . '__procesar', $parametros, $doc); + $metodo->set_doc("Método que se invoca al cambiar el valor del ef en el cliente"); + $molde->agregar($metodo); + } + //-- Validacion de EFs + $molde->agregar(new toba_codigo_separador_js('Validacion de EFs')); + $doc = array("Validación puntual de un ef en el cliente", + "Retornar true/false para controlar la validación", + "Usar this.ef(id).set_error(mensaje) para mostrar un error contextual al campo" + ); + foreach ($this->datos['_info_formulario_ef'] as $ef => $info) { + $parametros = $multilinea ? array('fila') : array(); + $metodo = new toba_codigo_metodo_js('evt__' . $info['identificador'] . '__validar', $parametros, $doc) ; + $metodo->set_doc("Validación puntual de un ef en el cliente"); + $molde->agregar($metodo); + } + } + return $molde; + } + + public function get_comentario_carga() + { + return array( + "Permite cambiar la configuración del formulario previo a la generación de la salida", + "El formato del carga debe ser array( => , ...)" + ); + } + + //-- Generacion de metadatos + + public static function get_modelos_evento() + { + $modelo[0]['id'] = 'basico'; + $modelo[0]['nombre'] = 'Basico'; + $modelo[1]['id'] = 'abm'; + $modelo[1]['nombre'] = 'ABM'; + $modelo[2]['id'] = 'filtro'; + $modelo[2]['nombre'] = 'Filtrar/Limpiar'; + return $modelo; + } + + public static function get_lista_eventos_estandar($modelo) + { + $evento = array(); + switch ($modelo) { + case 'basico': + $evento[0]['identificador'] = "modificacion"; + $evento[0]['etiqueta'] = "&Modificar"; + $evento[0]['maneja_datos'] = 1; + $evento[0]['implicito'] = true; + $evento[0]['orden'] = 3; + $evento[0]['en_botonera'] = 0; + break; + case 'abm': + $evento[0]['identificador'] = "alta"; + $evento[0]['etiqueta'] = "&Agregar"; + $evento[0]['maneja_datos'] = 1; + $evento[0]['estilo'] = "ei-boton-alta"; + $evento[0]['orden'] = 1; + $evento[0]['en_botonera'] = 1; + $evento[0]['grupo'] = 'no_cargado'; + + $evento[1]['identificador'] = "baja"; + $evento[1]['etiqueta'] = "&Eliminar"; + $evento[1]['estilo'] = "ei-boton-baja"; + $evento[1]['imagen_recurso_origen'] = 'apex'; + $evento[1]['imagen'] = 'borrar.gif'; + $evento[1]['confirmacion'] = "¿Desea ELIMINAR el registro?"; + $evento[1]['orden'] = 2; + $evento[1]['en_botonera'] = 1; + $evento[1]['grupo'] = 'cargado'; + + $evento[2]['identificador'] = "modificacion"; + $evento[2]['etiqueta'] = "&Modificar"; + $evento[2]['maneja_datos'] = 1; + $evento[2]['estilo'] = "ei-boton-mod"; + $evento[2]['orden'] = 3; + $evento[2]['en_botonera'] = 1; + $evento[2]['grupo'] = 'cargado'; + + $evento[3]['identificador'] = "cancelar"; + $evento[3]['maneja_datos'] = 0; + $evento[3]['etiqueta'] = "Ca&ncelar"; + $evento[3]['estilo'] = "ei-boton-canc"; + $evento[3]['orden'] = 4; + $evento[3]['en_botonera'] = 1; + $evento[3]['grupo'] = 'cargado'; + break; + + case 'filtro': + $evento[0]['identificador'] = "filtrar"; + $evento[0]['etiqueta'] = "&Filtrar"; + $evento[0]['estilo'] = "ei-boton-filtrar"; + $evento[0]['orden'] = 1; + $evento[0]['en_botonera'] = 1; + $evento[0]['maneja_datos'] = 1; + $evento[0]['grupo'] = 'cargado,no_cargado'; + $evento[0]['imagen_recurso_origen'] = 'apex'; + $evento[0]['imagen'] = 'filtrar.png'; + + $evento[1]['identificador'] = "cancelar"; + $evento[1]['etiqueta'] = "&Limpiar"; + $evento[1]['estilo'] = "ei-boton-limpiar"; + $evento[1]['orden'] = 2; + $evento[1]['en_botonera'] = 1; + $evento[1]['grupo'] = 'cargado'; + $evento[1]['imagen_recurso_origen'] = 'apex'; + $evento[1]['imagen'] = 'limpiar.png'; + } + return $evento; + } +} diff --git a/php/modelo/info/componentes/toba_ei_formulario_ml_info.php b/php/modelo/info/componentes/toba_ei_formulario_ml_info.php index 1a92ff6593..9f4437cf08 100644 --- a/php/modelo/info/componentes/toba_ei_formulario_ml_info.php +++ b/php/modelo/info/componentes/toba_ei_formulario_ml_info.php @@ -1,98 +1,99 @@ -agregar_bloque( $this->get_molde_eventos_sobre_fila() ); - return $molde; - } - - function eventos_predefinidos() - { - $eventos = parent::eventos_predefinidos(); - if ($this->tipo_analisis() == 'EVENTOS') { - $eventos['registro_alta']['parametros'] = array('datos', 'id_fila'); - $eventos['registro_alta']['comentarios'] = array("El \$id_fila es la clave de la fila en el arreglo asociativo retornado en la modificación"); - $eventos['registro_baja']['parametros'] = array('id_fila'); - $eventos['registro_baja']['comentarios'] = array("El \$id_fila es la clave de la fila en el arreglo asociativo retornado en la modificación"); - $eventos['registro_modificacion']['parametros'] = array('datos', 'id_fila'); - $eventos['registro_modificacion']['comentarios'] = array("El \$id_fila es la clave de la fila en el arreglo asociativo retornado en la modificación"); - } - return $eventos; - } - - function agregar_online() - { - return ($this->datos['_info_formulario']['filas_agregar_online'] == true); - } - - function tipo_analisis() { - return $this->datos['_info_formulario']['analisis_cambios']; - } - - function get_comentario_carga() - { - return array( - "Permite cambiar la configuración del ML previo a la generación de la salida", - "El formato debe ser una matriz array('id_fila' => array('id_ef' => valor, ...), ...)" - ); - } - - //-- Generacion de metadatos - - static function get_modelos_evento() - { - $modelo[0]['id'] = 'basico'; - $modelo[0]['nombre'] = 'Basico'; - return $modelo; - } - - static function get_lista_eventos_estandar($modelo) - { - $evento = array(); - switch($modelo){ - case 'basico': - $evento[0]['identificador'] = "modificacion"; - $evento[0]['etiqueta'] = "&Modificacion"; - $evento[0]['maneja_datos'] = 1; - $evento[0]['implicito'] = true; - $evento[0]['orden'] = 3; - $evento[0]['en_botonera'] = 0; - break; - } - return $evento; - } - - static function get_eventos_internos(toba_datos_relacion $dr) - { - $eventos = array(); - if (! $dr->tabla('prop_basicas')->get_columna('filas_agregar_online') ) { - $eventos['pedido_registro_nuevo'] = "El usuario notifica que quiere dar de alta un nuevo registro y necesita suministrarle un registro en blanco". - " para comenzar a editar. Escuchando este evento se puede cancelar el pedido de alta o brindar una fila inicial con datos usando ". - " el método set_registro_nuevo del ML"; - } - if ("EVENTOS" == $dr->tabla('prop_basicas')->get_columna('analisis_cambios') ) { - $eventos['registro_alta'] = "El usuario crea una nuevo registro. Como primer parámetro recibe los datos y como segundo el id de la fila."; - $eventos['registro_modificacion'] = "El usuario modifica un registro existente. Como primer parámetro recibe los datos y como segundo el id de la fila."; - $eventos['registro_baja'] = "El usuario borra un registro existente. Como primer parámetro recibe el id de la fila eliminada."; - } - return $eventos; - } -} -?> \ No newline at end of file +agregar_bloque($this->get_molde_eventos_sobre_fila()); + return $molde; + } + + public function eventos_predefinidos() + { + $eventos = parent::eventos_predefinidos(); + if ($this->tipo_analisis() == 'EVENTOS') { + $eventos['registro_alta']['parametros'] = array('datos', 'id_fila'); + $eventos['registro_alta']['comentarios'] = array("El \$id_fila es la clave de la fila en el arreglo asociativo retornado en la modificación"); + $eventos['registro_baja']['parametros'] = array('id_fila'); + $eventos['registro_baja']['comentarios'] = array("El \$id_fila es la clave de la fila en el arreglo asociativo retornado en la modificación"); + $eventos['registro_modificacion']['parametros'] = array('datos', 'id_fila'); + $eventos['registro_modificacion']['comentarios'] = array("El \$id_fila es la clave de la fila en el arreglo asociativo retornado en la modificación"); + } + return $eventos; + } + + public function agregar_online() + { + return ($this->datos['_info_formulario']['filas_agregar_online'] == true); + } + + public function tipo_analisis() + { + return $this->datos['_info_formulario']['analisis_cambios']; + } + + public function get_comentario_carga() + { + return array( + "Permite cambiar la configuración del ML previo a la generación de la salida", + "El formato debe ser una matriz array('id_fila' => array('id_ef' => valor, ...), ...)" + ); + } + + //-- Generacion de metadatos + + public static function get_modelos_evento() + { + $modelo[0]['id'] = 'basico'; + $modelo[0]['nombre'] = 'Basico'; + return $modelo; + } + + public static function get_lista_eventos_estandar($modelo) + { + $evento = array(); + switch ($modelo) { + case 'basico': + $evento[0]['identificador'] = "modificacion"; + $evento[0]['etiqueta'] = "&Modificacion"; + $evento[0]['maneja_datos'] = 1; + $evento[0]['implicito'] = true; + $evento[0]['orden'] = 3; + $evento[0]['en_botonera'] = 0; + break; + } + return $evento; + } + + public static function get_eventos_internos(toba_datos_relacion $dr) + { + $eventos = array(); + if (! $dr->tabla('prop_basicas')->get_columna('filas_agregar_online')) { + $eventos['pedido_registro_nuevo'] = "El usuario notifica que quiere dar de alta un nuevo registro y necesita suministrarle un registro en blanco". + " para comenzar a editar. Escuchando este evento se puede cancelar el pedido de alta o brindar una fila inicial con datos usando ". + " el método set_registro_nuevo del ML"; + } + if ("EVENTOS" == $dr->tabla('prop_basicas')->get_columna('analisis_cambios')) { + $eventos['registro_alta'] = "El usuario crea una nuevo registro. Como primer parámetro recibe los datos y como segundo el id de la fila."; + $eventos['registro_modificacion'] = "El usuario modifica un registro existente. Como primer parámetro recibe los datos y como segundo el id de la fila."; + $eventos['registro_baja'] = "El usuario borra un registro existente. Como primer parámetro recibe el id de la fila eliminada."; + } + return $eventos; + } +} diff --git a/php/modelo/info/componentes/toba_ei_grafico_info.php b/php/modelo/info/componentes/toba_ei_grafico_info.php index bf27d102bb..0ec8912b6f 100644 --- a/php/modelo/info/componentes/toba_ei_grafico_info.php +++ b/php/modelo/info/componentes/toba_ei_grafico_info.php @@ -1,31 +1,31 @@ -get_molde_vacio(); - } - - function get_comentario_carga() - { - return array( - "Permite cambiar la configuración del grafico previo a la generación de la salida" - ); - } -} -?> \ No newline at end of file +get_molde_vacio(); + } + + public function get_comentario_carga() + { + return array( + "Permite cambiar la configuración del grafico previo a la generación de la salida" + ); + } +} diff --git a/php/modelo/info/componentes/toba_ei_info.php b/php/modelo/info/componentes/toba_ei_info.php index 5c7e6eaa7d..b1703f4c9b 100644 --- a/php/modelo/info/componentes/toba_ei_info.php +++ b/php/modelo/info/componentes/toba_ei_info.php @@ -1,123 +1,122 @@ -datos['_info_eventos'] as $evento) { - if ($evento['identificador'] == $nombre) { - return true; - } - } - return false; - } - - function eventos_predefinidos() - { - $eventos = parent::eventos_predefinidos(); - foreach ($this->datos['_info_eventos'] as $evt_db) { - //ei_arbol($evt_db); - $id = $evt_db['identificador']; - $parametros = array(); - $doc = array("Atrapa la interacción del usuario con el botón asociado"); - if( $evt_db['sobre_fila'] ){ - if ($evt_db['es_seleccion_multiple'] == '1') { - $parametros[] = '$datos'; - $doc = array('Atrapa la interacción del usuario con el cuadro mediante los checks', - '@param array $datos Ids. correspondientes a las filas chequeadas.', - "El formato es de tipo recordset array(array('clave1' =>'valor', 'clave2' => 'valor'), array(....))"); - }else{ - $parametros[] = '$seleccion'; - $doc[] = '@param array $seleccion Id. de la fila seleccionada'; - } - }else{ - if($evt_db['maneja_datos']) { - $parametros[] = '$datos'; - $doc[] = '@param array $datos Estado del componente al momento de ejecutar el evento. El formato es el mismo que en la carga de la configuración'; - } - } - $eventos[$id]['parametros'] = $parametros; - $eventos[$id]['comentarios'] = $doc; - $eventos[$id]['info'] = $evt_db; - } - //ei_arbol($eventos); - return $eventos; - } - - function eventos_sobre_fila() - { - $eventos_sobre_fila = array(); - foreach ($this->eventos_predefinidos() as $evento => $info) { - if( isset($info['info']) && !$info['info']['implicito'] && $info['info']['sobre_fila']) { - $eventos_sobre_fila[$evento] = $info; - } - } - return $eventos_sobre_fila; - } - - function get_comentario_carga() - { - return array(""); - } - - static function get_modelos_evento() - { - $modelo = array(); - return $modelo; - } - - //--------------------------------------------------------------------- - //-- METACLASE - //--------------------------------------------------------------------- - - static function get_lista_eventos_estandar($modelo) - { - $evento = array(); - return $evento; - } - - function get_molde_eventos_js() - { - $bloque_molde[] = new toba_codigo_separador_js('Eventos'); - foreach ($this->eventos_predefinidos() as $evento => $info) { - //$info['info'] no esta seteado en los eventos predefinidos agregados a mano - if( isset($info['info']) && !$info['info']['implicito'] ) { //Excluyo los implicitos - // Atrapar evento en JS - if ($info['info']['accion'] == 'V') { //Vinculo - $metodo = new toba_codigo_metodo_js('modificar_vinculo__' . $evento, array('id_vinculo')); - $metodo->set_doc("Permite modificar el destino o parámetros de un vínculo en javascript. [wiki:Referencia/Eventos/Vinculo#ExtensionenJavascript Ver doc]"); - $bloque_molde[] = $metodo; - } else { - $metodo = new toba_codigo_metodo_js('evt__' . $evento); - $metodo->set_doc("Atrapa en javascript la interacción del usuario con el evento. +datos['_info_eventos'] as $evento) { + if ($evento['identificador'] == $nombre) { + return true; + } + } + return false; + } + + public function eventos_predefinidos() + { + $eventos = parent::eventos_predefinidos(); + foreach ($this->datos['_info_eventos'] as $evt_db) { + //ei_arbol($evt_db); + $id = $evt_db['identificador']; + $parametros = array(); + $doc = array("Atrapa la interacción del usuario con el botón asociado"); + if ($evt_db['sobre_fila']) { + if ($evt_db['es_seleccion_multiple'] == '1') { + $parametros[] = '$datos'; + $doc = array('Atrapa la interacción del usuario con el cuadro mediante los checks', + '@param array $datos Ids. correspondientes a las filas chequeadas.', + "El formato es de tipo recordset array(array('clave1' =>'valor', 'clave2' => 'valor'), array(....))"); + } else { + $parametros[] = '$seleccion'; + $doc[] = '@param array $seleccion Id. de la fila seleccionada'; + } + } else { + if ($evt_db['maneja_datos']) { + $parametros[] = '$datos'; + $doc[] = '@param array $datos Estado del componente al momento de ejecutar el evento. El formato es el mismo que en la carga de la configuración'; + } + } + $eventos[$id]['parametros'] = $parametros; + $eventos[$id]['comentarios'] = $doc; + $eventos[$id]['info'] = $evt_db; + } + //ei_arbol($eventos); + return $eventos; + } + + public function eventos_sobre_fila() + { + $eventos_sobre_fila = array(); + foreach ($this->eventos_predefinidos() as $evento => $info) { + if (isset($info['info']) && !$info['info']['implicito'] && $info['info']['sobre_fila']) { + $eventos_sobre_fila[$evento] = $info; + } + } + return $eventos_sobre_fila; + } + + public function get_comentario_carga() + { + return array(""); + } + + public static function get_modelos_evento() + { + $modelo = array(); + return $modelo; + } + + //--------------------------------------------------------------------- + //-- METACLASE + //--------------------------------------------------------------------- + + public static function get_lista_eventos_estandar($modelo) + { + $evento = array(); + return $evento; + } + + public function get_molde_eventos_js() + { + $bloque_molde[] = new toba_codigo_separador_js('Eventos'); + foreach ($this->eventos_predefinidos() as $evento => $info) { + //$info['info'] no esta seteado en los eventos predefinidos agregados a mano + if (isset($info['info']) && !$info['info']['implicito']) { //Excluyo los implicitos + // Atrapar evento en JS + if ($info['info']['accion'] == 'V') { //Vinculo + $metodo = new toba_codigo_metodo_js('modificar_vinculo__' . $evento, array('id_vinculo')); + $metodo->set_doc("Permite modificar el destino o parámetros de un vínculo en javascript. [wiki:Referencia/Eventos/Vinculo#ExtensionenJavascript Ver doc]"); + $bloque_molde[] = $metodo; + } else { + $metodo = new toba_codigo_metodo_js('evt__' . $evento); + $metodo->set_doc("Atrapa en javascript la interacción del usuario con el evento. Se puede parar la propagación del evento retornando false en la extensión. - [wiki:Referencia/Eventos#Listeners Ver más]"); - $bloque_molde[] = $metodo; - } - } - } - return $bloque_molde; - } - - function get_molde_eventos_sobre_fila() - { - $bloque_molde[] = new toba_codigo_separador_php('Config. EVENTOS sobre fila'); - foreach ($this->eventos_sobre_fila() as $evento => $info) { - $ayuda = "Permite configurar el evento sobre una fila especifica para modificarlo o anularlo"; - $doc = array( - $ayuda, - "@param toba_evento_usuario \$evento Evento diparado", - "@param array \$fila Clave de la fila" - ); - $metodo = new toba_codigo_metodo_php('conf_evt__' . $evento, array('$evento', '$fila')); - $metodo->set_doc($ayuda); - $bloque_molde[] = $metodo; - } - return $bloque_molde; - } -} -?> \ No newline at end of file + [wiki:Referencia/Eventos#Listeners Ver más]"); + $bloque_molde[] = $metodo; + } + } + } + return $bloque_molde; + } + + public function get_molde_eventos_sobre_fila() + { + $bloque_molde[] = new toba_codigo_separador_php('Config. EVENTOS sobre fila'); + foreach ($this->eventos_sobre_fila() as $evento => $info) { + $ayuda = "Permite configurar el evento sobre una fila especifica para modificarlo o anularlo"; + $doc = array( + $ayuda, + "@param toba_evento_usuario \$evento Evento diparado", + "@param array \$fila Clave de la fila" + ); + $metodo = new toba_codigo_metodo_php('conf_evt__' . $evento, array('$evento', '$fila')); + $metodo->set_doc($ayuda); + $bloque_molde[] = $metodo; + } + return $bloque_molde; + } +} diff --git a/php/modelo/info/componentes/toba_ei_mapa_info.php b/php/modelo/info/componentes/toba_ei_mapa_info.php index f68b7e4d36..df9966723f 100644 --- a/php/modelo/info/componentes/toba_ei_mapa_info.php +++ b/php/modelo/info/componentes/toba_ei_mapa_info.php @@ -1,31 +1,31 @@ -get_molde_vacio(); - } - - function get_comentario_carga() - { - return array( - "Permite cambiar la configuración del mapa previo a la generación de la salida", - ); - } -} -?> \ No newline at end of file +get_molde_vacio(); + } + + public function get_comentario_carga() + { + return array( + "Permite cambiar la configuración del mapa previo a la generación de la salida", + ); + } +} diff --git a/php/modelo/info/componentes/toba_interface_meta_clase.php b/php/modelo/info/componentes/toba_interface_meta_clase.php index 0bbec784f5..1c599d501b 100644 --- a/php/modelo/info/componentes/toba_interface_meta_clase.php +++ b/php/modelo/info/componentes/toba_interface_meta_clase.php @@ -6,11 +6,10 @@ */ interface toba_meta_clase { - function get_molde_subclase(); - function get_clase_nombre(); - function get_clase_archivo(); - function get_punto_montaje(); - function get_subclase_nombre(); - function get_subclase_archivo(); + public function get_molde_subclase(); + public function get_clase_nombre(); + public function get_clase_archivo(); + public function get_punto_montaje(); + public function get_subclase_nombre(); + public function get_subclase_archivo(); } -?> \ No newline at end of file diff --git a/php/modelo/info/componentes/toba_item_info.php b/php/modelo/info/componentes/toba_item_info.php index 1a7d77b5d0..945868faee 100644 --- a/php/modelo/info/componentes/toba_item_info.php +++ b/php/modelo/info/componentes/toba_item_info.php @@ -1,662 +1,713 @@ -datos = $datos; - $this->id = $this->datos['basica']['item']; - $this->proyecto = $this->datos['basica']['item_proyecto']; - $this->carga_profundidad = $carga_profundidad; - $this->datos_resumidos = $datos_resumidos; - if ($this->carga_profundidad) { - $this->cargar_dependencias(); - } - if($this->es_de_menu()) { - $this->info_extra .= toba_recurso::imagen_proyecto("menu.gif",true)." - Está incluído en el MENU"; - } - } - - function cargar_dependencias() - { - //Si hay objetos asociados... - if (isset($this->datos['objetos']) && count($this->datos['objetos'])>0) { - for ($a=0; $adatos['objetos']); $a++) { - $clave['proyecto'] = $this->datos['objetos'][$a]['objeto_proyecto']; - $clave['componente'] = $this->datos['objetos'][$a]['objeto']; - $tipo = $this->datos['objetos'][$a]['clase']; - $this->subelementos[$a] = toba_constructor::get_info( $clave, $tipo, $this->carga_profundidad, null, true, $this->datos_resumidos ); - } - } - } - - /** - * Crea una rama de items comenzando por la raiz - * Al asumir que los niveles son pocos se hace una consulta por nivel - * Quedan cargado en el objeto los ancestros de la rama - */ - function cargar_rama() - { - $item_ancestro = $this; - while (! $item_ancestro->es_raiz()) { - $id = array('componente' => $item_ancestro->get_id_padre(), - 'proyecto' => $item_ancestro->get_proyecto()); - $nodo = toba_constructor::get_info($id, 'toba_item', false); - $item_ancestro->set_padre($nodo); - $item_ancestro = $nodo; - } - } - - //--------------------------------------------------------------------- - // Preguntas - //--------------------------------------------------------------------- - - function es_carpeta() - { - return $this->datos['basica']['carpeta']; - } - - function es_de_menu() { - if (! $this->es_raiz()) { - return $this->datos['basica']['menu']; - } else { - return true; - } - } - - function es_raiz() - { - return $this->id == $this->get_id_padre(); - } - - function es_publico() { return $this->datos['basica']['publico']; } - - function puede_redireccionar() { return $this->datos['basica']['redirecciona']; } - - function retrasa_envio_headers() { return ($this->datos['basica']['retrasar_headers'] == '1'); } - - function generado_con_wizard() - { - return isset($this->datos['basica']['molde']); - } - - function tipo_asistente_utilizado() - { - $tipo = toba_catalogo_asistentes::get_asistente_molde($this->proyecto, $this->datos['basica']['molde']); - return $tipo; - } - - function vinculo_editor() - { - if ($this->es_carpeta()) - $item_editor = "1000238"; - else - $item_editor = "1000240"; - return toba::vinculador()->get_url(toba_editor::get_id(), $item_editor, - array( apex_hilo_qs_zona => $this->proyecto .apex_qs_separador. $this->id), - array( 'menu' => true, - 'celda_memoria' => 'central') - ); - } - - /** - * EJECUCION de operaciones desde el editor - */ - function vinculo_ejecutar() - { - if( toba_contexto_info::get_proyecto() == toba_editor::get_id() ) { - $vinculo = toba::vinculador()->get_url($this->get_proyecto(), $this->get_id(), - null, array('celda_memoria'=>'central', - 'validar' => false, - 'menu' => true ) ); - } else { - $vinculo = "javascript:top.frame_control.editor.ejecutar_item('".$this->get_id()."');"; - } - return $vinculo; - } - - /** - * Recorre el item en profundidad buscando el objeto pasado por parametro - * La ejecución de este método es muy costosa ya que hace una query por objeto - */ - function contiene_objeto($id) - { - foreach ($this->subelementos as $elem) { - if ($elem->contiene_objeto($id)) { - return true; - } - } - } - - function get_id_padre() { return $this->datos['basica']['item_padre']; } - - function get_nivel_prof() { return $this->nivel; } - - function get_camino() { return $this->camino; } - - function get_nombre() { return $this->datos['basica']['item_nombre']; } - - function get_proyecto() { return $this->datos['basica']['item_proyecto']; } - - function get_tipo_solicitud() { return $this->datos['basica']['solicitud_tipo']; } - - function crono() - { - if (isset($this->datos['crono'])) - return $this->datos['crono'] == 1; - } - - function cant_objetos() { return $this->datos['basica']['cant_dependencias']; } - - function registra_solicitud() - { - if (isset($this->datos['basica']['registrar'])) - return $this->datos['basica']["registrar"]; - } - - function propietario() { return $this->datos['basica']['usuario']; } - - function grupos_acceso() - { - if (!isset($this->grupos_acceso)) { - $id = toba_contexto_info::get_db()->quote($this->get_id()); - $proyecto = toba_contexto_info::get_db()->quote($this->get_proyecto()); - $sql = " +datos = $datos; + $this->id = $this->datos['basica']['item']; + $this->proyecto = $this->datos['basica']['item_proyecto']; + $this->carga_profundidad = $carga_profundidad; + $this->datos_resumidos = $datos_resumidos; + if ($this->carga_profundidad) { + $this->cargar_dependencias(); + } + if ($this->es_de_menu()) { + $this->info_extra .= toba_recurso::imagen_proyecto("menu.gif", true)." - Está incluído en el MENU"; + } + } + + public function cargar_dependencias() + { + //Si hay objetos asociados... + if (isset($this->datos['objetos']) && count($this->datos['objetos'])>0) { + for ($a=0; $adatos['objetos']); $a++) { + $clave['proyecto'] = $this->datos['objetos'][$a]['objeto_proyecto']; + $clave['componente'] = $this->datos['objetos'][$a]['objeto']; + $tipo = $this->datos['objetos'][$a]['clase']; + $this->subelementos[$a] = toba_constructor::get_info($clave, $tipo, $this->carga_profundidad, null, true, $this->datos_resumidos); + } + } + } + + /** + * Crea una rama de items comenzando por la raiz + * Al asumir que los niveles son pocos se hace una consulta por nivel + * Quedan cargado en el objeto los ancestros de la rama + */ + public function cargar_rama() + { + $item_ancestro = $this; + while (! $item_ancestro->es_raiz()) { + $id = array('componente' => $item_ancestro->get_id_padre(), + 'proyecto' => $item_ancestro->get_proyecto()); + $nodo = toba_constructor::get_info($id, 'toba_item', false); + $item_ancestro->set_padre($nodo); + $item_ancestro = $nodo; + } + } + + //--------------------------------------------------------------------- + // Preguntas + //--------------------------------------------------------------------- + + public function es_carpeta() + { + return $this->datos['basica']['carpeta']; + } + + public function es_de_menu() + { + if (! $this->es_raiz()) { + return $this->datos['basica']['menu']; + } else { + return true; + } + } + + public function es_raiz() + { + return $this->id == $this->get_id_padre(); + } + + public function es_publico() + { + return $this->datos['basica']['publico']; + } + + public function puede_redireccionar() + { + return $this->datos['basica']['redirecciona']; + } + + public function retrasa_envio_headers() + { + return ($this->datos['basica']['retrasar_headers'] == '1'); + } + + public function generado_con_wizard() + { + return isset($this->datos['basica']['molde']); + } + + public function tipo_asistente_utilizado() + { + $tipo = toba_catalogo_asistentes::get_asistente_molde($this->proyecto, $this->datos['basica']['molde']); + return $tipo; + } + + public function vinculo_editor() + { + if ($this->es_carpeta()) { + $item_editor = "1000238"; + } else { + $item_editor = "1000240"; + } + return toba::vinculador()->get_url( + toba_editor::get_id(), + $item_editor, + array( apex_hilo_qs_zona => $this->proyecto .apex_qs_separador. $this->id), + array( 'menu' => true, + 'celda_memoria' => 'central') + ); + } + + /** + * EJECUCION de operaciones desde el editor + */ + public function vinculo_ejecutar() + { + if (toba_contexto_info::get_proyecto() == toba_editor::get_id()) { + $vinculo = toba::vinculador()->get_url( + $this->get_proyecto(), + $this->get_id(), + null, + array('celda_memoria'=>'central', + 'validar' => false, + 'menu' => true ) + ); + } else { + $vinculo = "javascript:top.frame_control.editor.ejecutar_item('".$this->get_id()."');"; + } + return $vinculo; + } + + /** + * Recorre el item en profundidad buscando el objeto pasado por parametro + * La ejecución de este método es muy costosa ya que hace una query por objeto + */ + public function contiene_objeto($id) + { + foreach ($this->subelementos as $elem) { + if ($elem->contiene_objeto($id)) { + return true; + } + } + } + + public function get_id_padre() + { + return $this->datos['basica']['item_padre']; + } + + public function get_nivel_prof() + { + return $this->nivel; + } + + public function get_camino() + { + return $this->camino; + } + + public function get_nombre() + { + return $this->datos['basica']['item_nombre']; + } + + public function get_proyecto() + { + return $this->datos['basica']['item_proyecto']; + } + + public function get_tipo_solicitud() + { + return $this->datos['basica']['solicitud_tipo']; + } + + public function crono() + { + if (isset($this->datos['crono'])) { + return $this->datos['crono'] == 1; + } + } + + public function cant_objetos() + { + return $this->datos['basica']['cant_dependencias']; + } + + public function registra_solicitud() + { + if (isset($this->datos['basica']['registrar'])) { + return $this->datos['basica']["registrar"]; + } + } + + public function propietario() + { + return $this->datos['basica']['usuario']; + } + + public function grupos_acceso() + { + if (!isset($this->grupos_acceso)) { + $id = toba_contexto_info::get_db()->quote($this->get_id()); + $proyecto = toba_contexto_info::get_db()->quote($this->get_proyecto()); + $sql = " SELECT g.usuario_grupo_acc FROM apex_usuario_grupo_acc_item g WHERE g.item = $id AND - g.proyecto = $proyecto" ; - $rs = toba_contexto_info::get_db()->consultar($sql); - if (empty($rs)) - $this->grupos_acceso = array(); - else - $this->grupos_acceso = aplanar_matriz($rs); - } - return $this->grupos_acceso; - } - - function grupo_tiene_permiso($grupo) - { - return in_array($grupo, $this->grupos_acceso()); - } - - function es_buffer() - { - return !($this->datos['basica']['act_buf']== 0 && $this->datos['basica']['act_buf_p']=="toba"); - } - - function es_patron() - //--- Es un PATRON?? El patron representa la ausencia de PATRON - { - return !($this->datos['basica']['act_pat']=="especifico" && $this->datos['basica']['act_pat_p']=="toba"); - } - - function es_accion() - { - return !$this->es_buffer() && !$this->es_patron(); - } - - function es_hijo_de($carpeta) - { - if ($this->es_raiz()) - return false; - return $this->get_id_padre() == $carpeta->get_id(); - } - - function es_de_consola() - { - return $this->get_tipo_solicitud() == 'consola'; - } - - /** - * Un item inaccesible es uno en el que: - * - Esta marcado por menu pero alguno de sus padres no lo esta - * - No tiene permisos y no es ni publico ni de consola - */ - function es_inaccesible() - { - $grupos = $this->grupos_acceso(); - //--- Si no es de consola ni publico y no tiene grupos de acceso, no hay forma de accederlo - $sin_grupo = (!$this->es_de_consola() && !$this->es_publico() && count($this->grupos_acceso()) == 0); - if ($sin_grupo) { - if (!$this->es_carpeta()) { - $this->info_extra .= "El ítem es inaccesible porque no hay grupo de acceso que tenga permiso de accederlo."; - } - return true; - } - //--- Si es de menu y algun padre no lo es, no se va a mostrar en el mismo - $es_de_menu = $this->es_de_menu(); - $padre = $this->get_padre(); - while ($padre != null) { - if ($es_de_menu && ! $padre->es_de_menu()) { - $this->info_extra .= "El ítem es inaccesible por menú porque la carpeta `{$padre->get_nombre()}` no se muestra en el mismo."; - return true; - break; - } - $padre = $padre->get_padre(); - } - return false; - } - - //--------------------------------------------------------------------- - //-- Recorrible como ARBOL - //--------------------------------------------------------------------- - - function get_id() - { - return $this->id; - } - - function es_hoja() - { - return $this->datos['basica']['cant_items_hijos'] == 0 && $this->cant_objetos() == 0; - } - - function tiene_propiedades() - { - return true; - } - - function get_nombre_corto() - { - return $this->get_nombre(); - } - - function get_nombre_largo() - { - return $this->get_nombre(); - } - - function get_iconos() - { - $iconos = array(); - $img_item = null; - if (isset($this->datos['basica']['item_imagen']) && $this->datos['basica']['item_imagen'] != '' - && $this->datos['basica']['item_imagen_recurso_origen'] != '') { - if ($this->datos['basica']['item_imagen_recurso_origen'] == 'apex') { - $img_item = toba_recurso::imagen_toba($this->datos['basica']['item_imagen']); - } else { - $img_item = toba_recurso::url_proyecto($this->datos['basica']['item_proyecto']).'/img/'. - $this->datos['basica']['item_imagen']; - } - } - if ($this->es_carpeta()) { - $iconos[] = array( - 'imagen' => isset($img_item) ? $img_item : toba_recurso::imagen_toba("nucleo/carpeta.gif", false), - 'ayuda' => "Carpeta que contiene operaciones.", - ); - } else { - $iconos[] = array( - 'imagen' => isset($img_item) ? $img_item : toba_recurso::imagen_toba("item.gif", false), - 'ayuda' => "Una [wiki:Referencia/Operacion Operación] representa la unidad accesible por el usuario.", - ); - - if ($this->es_de_consola()) { - $iconos[] = array( - 'imagen' => toba_recurso::imagen_proyecto("solic_consola.gif",false), - 'ayuda' => 'Solicitud de Consola' - ); - } elseif($this->get_tipo_solicitud()=="wddx") { - $iconos[] = array( - 'imagen' => toba_recurso::imagen_proyecto("solic_wddx.gif",false), - 'ayuda' => 'Solicitud WDDX' - ); - } - if($this->crono()){ - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("cronometro.gif", false), - 'ayuda'=> "La operación se cronometra" - ); - } - if($this->es_publico()){ - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("usuarios/usuario.gif", false), - 'ayuda'=> "Operación pública" - ); - } - if($this->puede_redireccionar()){ - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("refrescar.png", false), - 'ayuda'=> "La operación puede redireccionar hacia otra." - ); - } - if ($this->retrasa_envio_headers()) { - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("rehacer.png", false), - 'ayuda'=> "La operación retrasa el envio de headers al cliente." - ); - } - if($this->registra_solicitud() == 1){ - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("solicitudes.gif", false), - 'ayuda'=> "La operación se registra en el log" - ); - } - if ( $this->posee_accion_predefinida() && ! $this->existe_php_accion() ) { - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("nucleo/php_inexistente.gif", false), - 'ayuda'=> "Existe un PHP plano asociado al item, pero el archivo no existe en el path especificado." - ); - } - if($this->generado_con_wizard()){ - $iconos[] = array( - 'imagen' => toba_recurso::imagen_toba("wizard.png", false), - 'ayuda'=> "La operación fue generada con un ASISTENTE", - 'vinculo' => toba::vinculador()->get_url(toba_editor::get_id(),"1000110", - array("padre_p"=>$this->get_proyecto(), "padre_i"=>$this->get_id(), - apex_hilo_qs_zona => $this->proyecto .apex_qs_separador. $this->id), - array( 'menu' => true, - 'celda_memoria' => 'central') - ), - 'plegado' => false - ); - - } - } - return $iconos; - } - - function get_utilerias() - { - $utilerias = array(); - - if ($this->es_carpeta()) { - // Ordenamiento, Nueva carpeta, nuevo item - $utilerias[] = array( - 'imagen' => toba_recurso::imagen_toba("nucleo/carpeta_nueva.gif", false), - 'ayuda'=> "Crear SUBCARPETA en esta rama del CATALOGO", - 'vinculo' => toba::vinculador()->get_url(toba_editor::get_id(),"1000238", - array("padre_p"=>$this->get_proyecto(), "padre_i"=>$this->get_id()), - array( 'menu' => true, - 'celda_memoria' => 'central') - ), - 'plegado' => true - ); - $utilerias[] = array( - 'imagen' => toba_recurso::imagen_proyecto("item_nuevo.gif", false), - 'ayuda'=> "Crear una nueva operación vacía en esta carpeta", - 'vinculo' => toba::vinculador()->get_url(toba_editor::get_id(),"1000240", - array("padre_p"=>$this->get_proyecto(), "padre_i"=>$this->get_id()), - array( 'menu' => true, - 'celda_memoria' => 'central') - ), - 'plegado' => false - ); - - } else { //Es un item común - - $utilerias[] = array( - 'imagen' => toba_recurso::imagen_toba("objetos/objeto_nuevo.gif", false), - 'ayuda' => "Crear un componente asociado al item", - 'vinculo' => toba::vinculador()->get_url(toba_editor::get_id(),"1000247", - array('destino_tipo' =>'toba_item', - 'destino_proyecto' => $this->proyecto, - 'destino_id' => $this->id ), - array( 'menu' => true, - 'celda_memoria' => 'central') - ), - 'plegado' => true - ); - - // Accion! - if ( $this->posee_accion_predefinida() && $this->existe_php_accion() ) { - $utilerias[] = $this->get_utileria_editor_abrir_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id )); - $utilerias[] = $this->get_utileria_editor_ver_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id )); - } - - } - if (!$this->es_carpeta() && - $this->get_tipo_solicitud() != 'consola' && - $this->get_tipo_solicitud() !="wddx") { - $utilerias[] = array( - 'imagen' => toba_recurso::imagen_toba("instanciar.png",false), - 'ayuda' => 'Ejecutar la operación', - 'vinculo' => $this->vinculo_ejecutar() - ); - - } - - $utilerias[] = array( - 'imagen' => toba_recurso::imagen_toba("objetos/editar.gif", false), - 'ayuda' => "Editar propiedades globales a la operación", - 'vinculo' => $this->vinculo_editor() - ); - return $utilerias; - } - - function posee_accion_predefinida() - { - return ($this->datos['basica']['item_act_accion_script'] != ''); - } - - function existe_php_accion() - { - if (class_exists('admin_util')) { - return admin_util::existe_archivo_subclase($this->datos['basica']['item_act_accion_script']); - } else { - return false; - } - } - - function get_utileria_editor_abrir_php($id_componente=null, $icono='reflexion/abrir.gif') - { - $parametros = array(); - $parametros['archivo'] = $this->datos['basica']['item_act_accion_script']; - $opciones = array('servicio' => 'ejecutar', 'zona' => false, 'celda_memoria' => 'ajax', 'menu' => true); - $vinculo = toba::vinculador()->get_url(toba_editor::get_id(), "30000014", $parametros, $opciones); - $js = "toba.comunicar_vinculo('$vinculo')"; - return array( - 'imagen' => toba_recurso::imagen_proyecto($icono, false), - 'ayuda' => 'Abrir el archivo PHP del ítem en el editor del escritorio.' . - '
    Ver [wiki:Referencia/AbrirPhp Configuración]', - 'vinculo' => "javascript: $js;", - 'js' => $js, - 'target' => '', - 'plegado' => false - ); - } - - function get_utileria_editor_ver_php($id_componente=null, $icono = 'nucleo/php.gif') - { - $parametros = array(); - $parametros['archivo'] = $this->datos['basica']['item_act_accion_script']; - $opciones = array('zona' => true, 'celda_memoria' => 'central', 'menu' => true); - $vinculo = toba::vinculador()->get_url(toba_editor::get_id(),"30000014", $parametros, $opciones); - return array( 'imagen' => toba_recurso::imagen_toba($icono, false), - 'ayuda' => 'Ver el contenido del archivo PHP del ítem', - 'vinculo' => $vinculo, - 'plegado' => true - ); - } - - function agregar_hijo($item) - { - $this->items_hijos[$item->get_id()] = $item; - } - - function quitar_hijo($item) - { - $this->datos['basica']['cant_items_hijos']--; - unset($this->items_hijos[$item->get_id()]); - } - - function set_padre($carpeta) - { - $this->padre = $carpeta; - } - - function get_padre() - { - return $this->padre; - } - - function tiene_padre() - { - return $this->padre !== null; - } - - function get_hijos() - { - if ($this->es_carpeta()) { - return $this->items_hijos; - } else { - return $this->subelementos; - } - } - - function tiene_hijos_cargados() - { - if ($this->es_carpeta() && ! $this->es_hoja()) { - return count($this->items_hijos) == $this->datos['basica']['cant_items_hijos']; - } - if (!$this->es_carpeta() && ! $this->carga_profundidad) { - return false; - } - return true; - } - - function get_info_extra() - { - return $this->info_extra; - } - - function get_zona() - { - return $this->datos['basica']['item_zona']; - } - //------------------------------------ CAMBIO DE ESTADO -------------------------------------------------------- - - function set_nivel($nivel) { $this->nivel = $nivel; } - - function set_camino($camino) { - $this->camino = $camino; - } - - function otorgar_permiso($grupo) - { - $sql = "INSERT INTO apex_usuario_grupo_acc_item (usuario_grupo_acc, proyecto, item) - VALUES ('$grupo', '{$this->get_proyecto()}', '{$this->get_id()}')"; - toba_contexto_info::get_db()->ejecutar($sql); - } - - /** - * Duplica un item y sus dependencias recursivamente - * - * @param array $nuevos_datos Datos a modificar en la base del item. Para anexar algo al nombre se utiliza el campo 'anexo_nombre' - * @param boolean/string $dir_subclases Si el componente tiene subclases clona los archivos, en caso afirmativo indicar la ruta destino (relativa) - * @param boolean $con_transaccion Indica si la clonación se debe incluír en una transaccion - * @return array Clave del item que resulta del clonado - */ - function clonar($nuevos_datos, $dir_subclases=false, $con_transaccion=true) - { - $campos_extra = array('fuente_datos', 'fuente_datos_proyecto'); - //-- Cargo el DR asociado - $id_dr = toba_info_editores::get_dr_de_clase('toba_item'); - $componente = array('proyecto' => $id_dr[0], 'componente' => $id_dr[1]); - $dr = toba_constructor::get_runtime($componente); - $dr->inicializar(); - $dr->cargar(array('proyecto' => $this->proyecto, 'item' => $this->id)); - - foreach ($nuevos_datos as $campo => $valor) { - if ($campo == 'anexo_nombre') { - $campo = 'nombre'; - $valor = $valor . $dr->tabla('base')->get_fila_columna(0, $campo); - } - if (! in_array($campo, $campos_extra)) { - $dr->tabla('base')->set_fila_columna_valor(0, $campo, $valor); - } - } - //Se le fuerza una inserción a los datos_tabla - //Como la clave de los objetos son secuencias, esto garantiza claves nuevas - $dr->forzar_insercion(); - $dr->persistidor()->desactivar_transaccion(); - if ($con_transaccion) { - abrir_transaccion('instancia'); - } - - if (isset($nuevos_datos['fuente_datos'])) { - $dr->tabla('permisos_tablas')->set_columna_valor('fuente_datos', $nuevos_datos['fuente_datos']); - } - - //--- Se clonan los hijos y se agregan como dependencias - $dr->tabla('objetos')->eliminar_filas(); - $i=0; - foreach ($this->subelementos as $hijo) { - //-- Si se especifico un proyecto, se propaga - $datos_objeto = array(); - if (isset($nuevos_datos['proyecto'])) { - $datos_objeto['proyecto'] = $nuevos_datos['proyecto']; - } - //-- Si se especifica un anexo de nombre, se propaga - if (isset($nuevos_datos['anexo_nombre'])) { - $datos_objeto['anexo_nombre'] = $nuevos_datos['anexo_nombre']; - } - //-- La fuente tambien se propaga - if (isset($nuevos_datos['fuente_datos_proyecto'])) { - $datos_objeto['fuente_datos_proyecto'] = $nuevos_datos['fuente_datos_proyecto']; - } - if (isset($nuevos_datos['fuente_datos'])) { - $datos_objeto['fuente_datos'] = $nuevos_datos['fuente_datos']; - } - //-- Punto de montaje tambien se propaga - if (isset($nuevos_datos['punto_montaje'])) { - $datos_objeto['punto_montaje'] = $nuevos_datos['punto_montaje']; - } - $nuevo_hijo = $hijo->clonar($datos_objeto, $dir_subclases, false); - $fila = array('objeto' => $nuevo_hijo['componente'], - 'proyecto' => $nuevo_hijo['proyecto'], - 'orden' => $i); - $dr->tabla('objetos')->nueva_fila($fila); - $i++; - } - - //--- GRABA - $dr->sincronizar(); - if ($con_transaccion) { - cerrar_transaccion('instancia'); - } - - //Se busca la clave del nuevo objeto - $clave = $dr->tabla('base')->get_clave_valor(0); - $clave['componente'] = $clave['item']; - return $clave; - } - - function asignar_componente($id_componente) - { - $id = toba_contexto_info::get_db()->quote($this->id); - $proyecto = toba_contexto_info::get_db()->quote($this->proyecto); - $componente = toba_contexto_info::get_db()->quote($id_componente['componente']); - - $sql = "SELECT COALESCE(MAX(orden),0) as maximo + g.proyecto = $proyecto" ; + $rs = toba_contexto_info::get_db()->consultar($sql); + if (empty($rs)) { + $this->grupos_acceso = array(); + } else { + $this->grupos_acceso = aplanar_matriz($rs); + } + } + return $this->grupos_acceso; + } + + public function grupo_tiene_permiso($grupo) + { + return in_array($grupo, $this->grupos_acceso()); + } + + public function es_buffer() + { + return !($this->datos['basica']['act_buf']== 0 && $this->datos['basica']['act_buf_p']=="toba"); + } + + public function es_patron() + //--- Es un PATRON?? El patron representa la ausencia de PATRON + { + return !($this->datos['basica']['act_pat']=="especifico" && $this->datos['basica']['act_pat_p']=="toba"); + } + + public function es_accion() + { + return !$this->es_buffer() && !$this->es_patron(); + } + + public function es_hijo_de($carpeta) + { + if ($this->es_raiz()) { + return false; + } + return $this->get_id_padre() == $carpeta->get_id(); + } + + public function es_de_consola() + { + return $this->get_tipo_solicitud() == 'consola'; + } + + /** + * Un item inaccesible es uno en el que: + * - Esta marcado por menu pero alguno de sus padres no lo esta + * - No tiene permisos y no es ni publico ni de consola + */ + public function es_inaccesible() + { + $grupos = $this->grupos_acceso(); + //--- Si no es de consola ni publico y no tiene grupos de acceso, no hay forma de accederlo + $sin_grupo = (!$this->es_de_consola() && !$this->es_publico() && count($this->grupos_acceso()) == 0); + if ($sin_grupo) { + if (!$this->es_carpeta()) { + $this->info_extra .= "El ítem es inaccesible porque no hay grupo de acceso que tenga permiso de accederlo."; + } + return true; + } + //--- Si es de menu y algun padre no lo es, no se va a mostrar en el mismo + $es_de_menu = $this->es_de_menu(); + $padre = $this->get_padre(); + while ($padre != null) { + if ($es_de_menu && ! $padre->es_de_menu()) { + $this->info_extra .= "El ítem es inaccesible por menú porque la carpeta `{$padre->get_nombre()}` no se muestra en el mismo."; + return true; + break; + } + $padre = $padre->get_padre(); + } + return false; + } + + //--------------------------------------------------------------------- + //-- Recorrible como ARBOL + //--------------------------------------------------------------------- + + public function get_id() + { + return $this->id; + } + + public function es_hoja() + { + return $this->datos['basica']['cant_items_hijos'] == 0 && $this->cant_objetos() == 0; + } + + public function tiene_propiedades() + { + return true; + } + + public function get_nombre_corto() + { + return $this->get_nombre(); + } + + public function get_nombre_largo() + { + return $this->get_nombre(); + } + + public function get_iconos() + { + $iconos = array(); + $img_item = null; + if (isset($this->datos['basica']['item_imagen']) && $this->datos['basica']['item_imagen'] != '' + && $this->datos['basica']['item_imagen_recurso_origen'] != '') { + if ($this->datos['basica']['item_imagen_recurso_origen'] == 'apex') { + $img_item = toba_recurso::imagen_toba($this->datos['basica']['item_imagen']); + } else { + $img_item = toba_recurso::url_proyecto($this->datos['basica']['item_proyecto']).'/img/'. + $this->datos['basica']['item_imagen']; + } + } + if ($this->es_carpeta()) { + $iconos[] = array( + 'imagen' => isset($img_item) ? $img_item : toba_recurso::imagen_toba("nucleo/carpeta.gif", false), + 'ayuda' => "Carpeta que contiene operaciones.", + ); + } else { + $iconos[] = array( + 'imagen' => isset($img_item) ? $img_item : toba_recurso::imagen_toba("item.gif", false), + 'ayuda' => "Una [wiki:Referencia/Operacion Operación] representa la unidad accesible por el usuario.", + ); + + if ($this->es_de_consola()) { + $iconos[] = array( + 'imagen' => toba_recurso::imagen_proyecto("solic_consola.gif", false), + 'ayuda' => 'Solicitud de Consola' + ); + } elseif ($this->get_tipo_solicitud()=="wddx") { + $iconos[] = array( + 'imagen' => toba_recurso::imagen_proyecto("solic_wddx.gif", false), + 'ayuda' => 'Solicitud WDDX' + ); + } + if ($this->crono()) { + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("cronometro.gif", false), + 'ayuda'=> "La operación se cronometra" + ); + } + if ($this->es_publico()) { + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("usuarios/usuario.gif", false), + 'ayuda'=> "Operación pública" + ); + } + if ($this->puede_redireccionar()) { + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("refrescar.png", false), + 'ayuda'=> "La operación puede redireccionar hacia otra." + ); + } + if ($this->retrasa_envio_headers()) { + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("rehacer.png", false), + 'ayuda'=> "La operación retrasa el envio de headers al cliente." + ); + } + if ($this->registra_solicitud() == 1) { + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("solicitudes.gif", false), + 'ayuda'=> "La operación se registra en el log" + ); + } + if ($this->posee_accion_predefinida() && ! $this->existe_php_accion()) { + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("nucleo/php_inexistente.gif", false), + 'ayuda'=> "Existe un PHP plano asociado al item, pero el archivo no existe en el path especificado." + ); + } + if ($this->generado_con_wizard()) { + $iconos[] = array( + 'imagen' => toba_recurso::imagen_toba("wizard.png", false), + 'ayuda'=> "La operación fue generada con un ASISTENTE", + 'vinculo' => toba::vinculador()->get_url( + toba_editor::get_id(), + "1000110", + array("padre_p"=>$this->get_proyecto(), "padre_i"=>$this->get_id(), + apex_hilo_qs_zona => $this->proyecto .apex_qs_separador. $this->id), + array( 'menu' => true, + 'celda_memoria' => 'central') + ), + 'plegado' => false + ); + } + } + return $iconos; + } + + public function get_utilerias() + { + $utilerias = array(); + + if ($this->es_carpeta()) { + // Ordenamiento, Nueva carpeta, nuevo item + $utilerias[] = array( + 'imagen' => toba_recurso::imagen_toba("nucleo/carpeta_nueva.gif", false), + 'ayuda'=> "Crear SUBCARPETA en esta rama del CATALOGO", + 'vinculo' => toba::vinculador()->get_url( + toba_editor::get_id(), + "1000238", + array("padre_p"=>$this->get_proyecto(), "padre_i"=>$this->get_id()), + array( 'menu' => true, + 'celda_memoria' => 'central') + ), + 'plegado' => true + ); + $utilerias[] = array( + 'imagen' => toba_recurso::imagen_proyecto("item_nuevo.gif", false), + 'ayuda'=> "Crear una nueva operación vacía en esta carpeta", + 'vinculo' => toba::vinculador()->get_url( + toba_editor::get_id(), + "1000240", + array("padre_p"=>$this->get_proyecto(), "padre_i"=>$this->get_id()), + array( 'menu' => true, + 'celda_memoria' => 'central') + ), + 'plegado' => false + ); + } else { //Es un item común + + $utilerias[] = array( + 'imagen' => toba_recurso::imagen_toba("objetos/objeto_nuevo.gif", false), + 'ayuda' => "Crear un componente asociado al item", + 'vinculo' => toba::vinculador()->get_url( + toba_editor::get_id(), + "1000247", + array('destino_tipo' =>'toba_item', + 'destino_proyecto' => $this->proyecto, + 'destino_id' => $this->id ), + array( 'menu' => true, + 'celda_memoria' => 'central') + ), + 'plegado' => true + ); + + // Accion! + if ($this->posee_accion_predefinida() && $this->existe_php_accion()) { + $utilerias[] = $this->get_utileria_editor_abrir_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id )); + $utilerias[] = $this->get_utileria_editor_ver_php(array('proyecto'=>$this->proyecto, 'componente' =>$this->id )); + } + } + if (!$this->es_carpeta() && + $this->get_tipo_solicitud() != 'consola' && + $this->get_tipo_solicitud() !="wddx") { + $utilerias[] = array( + 'imagen' => toba_recurso::imagen_toba("instanciar.png", false), + 'ayuda' => 'Ejecutar la operación', + 'vinculo' => $this->vinculo_ejecutar() + ); + } + + $utilerias[] = array( + 'imagen' => toba_recurso::imagen_toba("objetos/editar.gif", false), + 'ayuda' => "Editar propiedades globales a la operación", + 'vinculo' => $this->vinculo_editor() + ); + return $utilerias; + } + + public function posee_accion_predefinida() + { + return ($this->datos['basica']['item_act_accion_script'] != ''); + } + + public function existe_php_accion() + { + if (class_exists('admin_util')) { + return admin_util::existe_archivo_subclase($this->datos['basica']['item_act_accion_script']); + } else { + return false; + } + } + + public function get_utileria_editor_abrir_php($id_componente=null, $icono='reflexion/abrir.gif') + { + $parametros = array(); + $parametros['archivo'] = $this->datos['basica']['item_act_accion_script']; + $opciones = array('servicio' => 'ejecutar', 'zona' => false, 'celda_memoria' => 'ajax', 'menu' => true); + $vinculo = toba::vinculador()->get_url(toba_editor::get_id(), "30000014", $parametros, $opciones); + $js = "toba.comunicar_vinculo('$vinculo')"; + return array( + 'imagen' => toba_recurso::imagen_proyecto($icono, false), + 'ayuda' => 'Abrir el archivo PHP del ítem en el editor del escritorio.' . + '
    Ver [wiki:Referencia/AbrirPhp Configuración]', + 'vinculo' => "javascript: $js;", + 'js' => $js, + 'target' => '', + 'plegado' => false + ); + } + + public function get_utileria_editor_ver_php($id_componente=null, $icono = 'nucleo/php.gif') + { + $parametros = array(); + $parametros['archivo'] = $this->datos['basica']['item_act_accion_script']; + $opciones = array('zona' => true, 'celda_memoria' => 'central', 'menu' => true); + $vinculo = toba::vinculador()->get_url(toba_editor::get_id(), "30000014", $parametros, $opciones); + return array( 'imagen' => toba_recurso::imagen_toba($icono, false), + 'ayuda' => 'Ver el contenido del archivo PHP del ítem', + 'vinculo' => $vinculo, + 'plegado' => true + ); + } + + public function agregar_hijo($item) + { + $this->items_hijos[$item->get_id()] = $item; + } + + public function quitar_hijo($item) + { + $this->datos['basica']['cant_items_hijos']--; + unset($this->items_hijos[$item->get_id()]); + } + + public function set_padre($carpeta) + { + $this->padre = $carpeta; + } + + public function get_padre() + { + return $this->padre; + } + + public function tiene_padre() + { + return $this->padre !== null; + } + + public function get_hijos() + { + if ($this->es_carpeta()) { + return $this->items_hijos; + } else { + return $this->subelementos; + } + } + + public function tiene_hijos_cargados() + { + if ($this->es_carpeta() && ! $this->es_hoja()) { + return count($this->items_hijos) == $this->datos['basica']['cant_items_hijos']; + } + if (!$this->es_carpeta() && ! $this->carga_profundidad) { + return false; + } + return true; + } + + public function get_info_extra() + { + return $this->info_extra; + } + + public function get_zona() + { + return $this->datos['basica']['item_zona']; + } + //------------------------------------ CAMBIO DE ESTADO -------------------------------------------------------- + + public function set_nivel($nivel) + { + $this->nivel = $nivel; + } + + public function set_camino($camino) + { + $this->camino = $camino; + } + + public function otorgar_permiso($grupo) + { + $sql = "INSERT INTO apex_usuario_grupo_acc_item (usuario_grupo_acc, proyecto, item) + VALUES ('$grupo', '{$this->get_proyecto()}', '{$this->get_id()}')"; + toba_contexto_info::get_db()->ejecutar($sql); + } + + /** + * Duplica un item y sus dependencias recursivamente + * + * @param array $nuevos_datos Datos a modificar en la base del item. Para anexar algo al nombre se utiliza el campo 'anexo_nombre' + * @param boolean/string $dir_subclases Si el componente tiene subclases clona los archivos, en caso afirmativo indicar la ruta destino (relativa) + * @param boolean $con_transaccion Indica si la clonación se debe incluír en una transaccion + * @return array Clave del item que resulta del clonado + */ + public function clonar($nuevos_datos, $dir_subclases=false, $con_transaccion=true) + { + $campos_extra = array('fuente_datos', 'fuente_datos_proyecto'); + //-- Cargo el DR asociado + $id_dr = toba_info_editores::get_dr_de_clase('toba_item'); + $componente = array('proyecto' => $id_dr[0], 'componente' => $id_dr[1]); + $dr = toba_constructor::get_runtime($componente); + $dr->inicializar(); + $dr->cargar(array('proyecto' => $this->proyecto, 'item' => $this->id)); + + foreach ($nuevos_datos as $campo => $valor) { + if ($campo == 'anexo_nombre') { + $campo = 'nombre'; + $valor = $valor . $dr->tabla('base')->get_fila_columna(0, $campo); + } + if (! in_array($campo, $campos_extra)) { + $dr->tabla('base')->set_fila_columna_valor(0, $campo, $valor); + } + } + //Se le fuerza una inserción a los datos_tabla + //Como la clave de los objetos son secuencias, esto garantiza claves nuevas + $dr->forzar_insercion(); + $dr->persistidor()->desactivar_transaccion(); + if ($con_transaccion) { + abrir_transaccion('instancia'); + } + + if (isset($nuevos_datos['fuente_datos'])) { + $dr->tabla('permisos_tablas')->set_columna_valor('fuente_datos', $nuevos_datos['fuente_datos']); + } + + //--- Se clonan los hijos y se agregan como dependencias + $dr->tabla('objetos')->eliminar_filas(); + $i=0; + foreach ($this->subelementos as $hijo) { + //-- Si se especifico un proyecto, se propaga + $datos_objeto = array(); + if (isset($nuevos_datos['proyecto'])) { + $datos_objeto['proyecto'] = $nuevos_datos['proyecto']; + } + //-- Si se especifica un anexo de nombre, se propaga + if (isset($nuevos_datos['anexo_nombre'])) { + $datos_objeto['anexo_nombre'] = $nuevos_datos['anexo_nombre']; + } + //-- La fuente tambien se propaga + if (isset($nuevos_datos['fuente_datos_proyecto'])) { + $datos_objeto['fuente_datos_proyecto'] = $nuevos_datos['fuente_datos_proyecto']; + } + if (isset($nuevos_datos['fuente_datos'])) { + $datos_objeto['fuente_datos'] = $nuevos_datos['fuente_datos']; + } + //-- Punto de montaje tambien se propaga + if (isset($nuevos_datos['punto_montaje'])) { + $datos_objeto['punto_montaje'] = $nuevos_datos['punto_montaje']; + } + $nuevo_hijo = $hijo->clonar($datos_objeto, $dir_subclases, false); + $fila = array('objeto' => $nuevo_hijo['componente'], + 'proyecto' => $nuevo_hijo['proyecto'], + 'orden' => $i); + $dr->tabla('objetos')->nueva_fila($fila); + $i++; + } + + //--- GRABA + $dr->sincronizar(); + if ($con_transaccion) { + cerrar_transaccion('instancia'); + } + + //Se busca la clave del nuevo objeto + $clave = $dr->tabla('base')->get_clave_valor(0); + $clave['componente'] = $clave['item']; + return $clave; + } + + public function asignar_componente($id_componente) + { + $id = toba_contexto_info::get_db()->quote($this->id); + $proyecto = toba_contexto_info::get_db()->quote($this->proyecto); + $componente = toba_contexto_info::get_db()->quote($id_componente['componente']); + + $sql = "SELECT COALESCE(MAX(orden),0) as maximo FROM apex_item_objeto - WHERE item=$id AND proyecto= $proyecto"; - $res = toba_contexto_info::get_db()->consultar($sql); - $orden = toba_contexto_info::get_db()->quote($res[0]['maximo']); - $sql = "INSERT INTO apex_item_objeto + WHERE item=$id AND proyecto= $proyecto"; + $res = toba_contexto_info::get_db()->consultar($sql); + $orden = toba_contexto_info::get_db()->quote($res[0]['maximo']); + $sql = "INSERT INTO apex_item_objeto (proyecto, item, objeto, orden) VALUES ( $proyecto, $id, $componente, $orden - )"; - toba_contexto_info::get_db()->ejecutar($sql); - } - -} -?> \ No newline at end of file + )"; + toba_contexto_info::get_db()->ejecutar($sql); + } +} diff --git a/php/modelo/info/componentes/toba_servicio_web_info.php b/php/modelo/info/componentes/toba_servicio_web_info.php index 122ae2ff46..9f50d2e471 100644 --- a/php/modelo/info/componentes/toba_servicio_web_info.php +++ b/php/modelo/info/componentes/toba_servicio_web_info.php @@ -1,25 +1,24 @@ -get_molde_vacio(); - } - -} -?> \ No newline at end of file +get_molde_vacio(); + } +} diff --git a/php/modelo/info/componentes_perfil/toba_rf_componente.php b/php/modelo/info/componentes_perfil/toba_rf_componente.php index 6642d67a22..b1039b9c30 100644 --- a/php/modelo/info/componentes_perfil/toba_rf_componente.php +++ b/php/modelo/info/componentes_perfil/toba_rf_componente.php @@ -64,7 +64,7 @@ function cargar_eventos() $evt = array(); $grupo = new toba_rf_grupo_eventos('EVENTOS', $this); foreach($eventos as $evento) { - $evento['etiqueta'] = str_replace('&','', $evento['etiqueta']); + $evento['etiqueta'] = str_replace('&','', $evento['etiqueta'] ?? ''); $nombre = (trim($evento['etiqueta']) != '') ? $evento['etiqueta'] : '[' . $evento['identificador'] . ']'; $evt[] = new toba_rf_subcomponente_evento($nombre, $grupo, $evento['evento_id'], $evento['proyecto'], $this->item, $this->restriccion, $evento['no_visible']); } diff --git a/php/modelo/lib/toba_auditoria_tablas_postgres.php b/php/modelo/lib/toba_auditoria_tablas_postgres.php index 4a218d2a51..3f7ed65459 100644 --- a/php/modelo/lib/toba_auditoria_tablas_postgres.php +++ b/php/modelo/lib/toba_auditoria_tablas_postgres.php @@ -319,7 +319,6 @@ protected function crear_sp($tablas, $schema) $sql .= "CREATE OR REPLACE FUNCTION {$this->schema_logs}.sp_$t() RETURNS trigger AS\n"; $sql .= "' DECLARE - schema_temp varchar; rtabla_usr RECORD; rusuario RECORD; vusuario VARCHAR(60); @@ -328,19 +327,13 @@ protected function crear_sp($tablas, $schema) vestampilla timestamp; BEGIN vestampilla := clock_timestamp(); - SELECT INTO schema_temp $schema.recuperar_schema_temp(); - SELECT INTO rtabla_usr * FROM pg_tables WHERE tablename = ''tt_usuario'' AND schemaname = schema_temp; - IF FOUND THEN - SELECT INTO rusuario usuario, id_solicitud FROM tt_usuario; - IF FOUND THEN - vusuario := rusuario.usuario; - vid_solicitud := rusuario.id_solicitud; - ELSE - vusuario := user; - vid_solicitud := 0; - END IF; + SELECT INTO rusuario usuario, id_solicitud FROM ( select current_setting(''tt_usuario.usuario'', TRUE) as usuario, current_setting(''tt_usuario.id_solicitud'', TRUE) as id_solicitud) as one; + IF rusuario.usuario IS NOT NULL THEN + vusuario := rusuario.usuario; + vid_solicitud := rusuario.id_solicitud; ELSE vusuario := user; + vid_solicitud := 0; END IF; IF (TG_OP = ''INSERT'') OR (TG_OP = ''UPDATE'') THEN IF (TG_OP = ''INSERT'') THEN @@ -450,10 +443,12 @@ function set_estado_activacion_triggers($tablas, $schema, $estado) protected function eliminar_triggers($tablas, $schema) { $triggers = array(); - foreach ($tablas as $t) { - $triggers[$t] = "tauditoria_$t"; + if (! empty($tablas)) { + foreach ($tablas as $t) { + $triggers[$t] = "tauditoria_$t"; + } + $this->eliminar_triggers_especificos($schema, $triggers); } - $this->eliminar_triggers_especificos($schema, $triggers); } protected function eliminar_triggers_especificos($schema, $triggers) diff --git a/php/modelo/lib/toba_modelo_error.php b/php/modelo/lib/toba_modelo_error.php index 0a542bec8a..fb5f964d7a 100644 --- a/php/modelo/lib/toba_modelo_error.php +++ b/php/modelo/lib/toba_modelo_error.php @@ -1,6 +1,6 @@ \ No newline at end of file +class toba_error_asistentes extends toba_error +{ +} diff --git a/php/modelo/lib/toba_proceso_gui.php b/php/modelo/lib/toba_proceso_gui.php index d0359a36a6..4af3a5b92a 100644 --- a/php/modelo/lib/toba_proceso_gui.php +++ b/php/modelo/lib/toba_proceso_gui.php @@ -1,28 +1,47 @@ - \ No newline at end of file +elemento = $elemento_modelo; - $this->manejador_interface = $elemento_modelo->get_manejador_interface(); - $this->ini(); - } - - function ini() - { - - } - -} -?> \ No newline at end of file + +class toba_migracion +{ + protected $elemento; //Elemento del modelo que se esta migrando: instalacion, instancia o proyecto + protected $manejador_interface; + + public function __construct(toba_modelo_elemento $elemento_modelo) + { + $this->elemento = $elemento_modelo; + $this->manejador_interface = $elemento_modelo->get_manejador_interface(); + $this->ini(); + } + + public function ini() + { + } +} diff --git a/php/modelo/migraciones/toba_migracion_0_9_1.php b/php/modelo/migraciones/toba_migracion_0_9_1.php index a14bab8ecf..4e9945de0b 100644 --- a/php/modelo/migraciones/toba_migracion_0_9_1.php +++ b/php/modelo/migraciones/toba_migracion_0_9_1.php @@ -1,33 +1,31 @@ elemento->cambiar_info_basica(array('editor_php' => 'start')); - } - - function instancia__cambios_estructura() - { - $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_carpeta varchar(60)"; - $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_item varchar(60)"; - $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_objeto int4"; - $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_popup smallint"; - $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_popup_param varchar(100)"; - $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_target varchar(40)"; - $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_celda varchar(40)"; - $sql[] = "ALTER TABLE apex_log_objeto ADD COLUMN item varchar(60)"; - $this->elemento->get_db()->ejecutar($sql); - } -} -?> \ No newline at end of file + +class toba_migracion_0_9_1 extends toba_migracion +{ + //------------------------------------------------------------------------ + //-------------------------- INSTALACION -------------------------- + //------------------------------------------------------------------------ + + + /** + * Existe una nueva entrada en la instalacion que define el comando de invocación + * del editor utilizado en el escritorio + */ + public function instalacion__definir_comando_editor() + { + $this->elemento->cambiar_info_basica(array('editor_php' => 'start')); + } + + public function instancia__cambios_estructura() + { + $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_carpeta varchar(60)"; + $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_item varchar(60)"; + $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_objeto int4"; + $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_popup smallint"; + $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_popup_param varchar(100)"; + $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_target varchar(40)"; + $sql[] = "ALTER TABLE apex_objeto_eventos ADD COLUMN accion_vinculo_celda varchar(40)"; + $sql[] = "ALTER TABLE apex_log_objeto ADD COLUMN item varchar(60)"; + $this->elemento->get_db()->ejecutar($sql); + } +} diff --git a/php/modelo/migraciones/toba_migracion_3_4_0.php b/php/modelo/migraciones/toba_migracion_3_4_0.php new file mode 100644 index 0000000000..0f0b0fd44a --- /dev/null +++ b/php/modelo/migraciones/toba_migracion_3_4_0.php @@ -0,0 +1,33 @@ +elemento->get_db()->get_schema() . '_logs'; + + /** + * Se evita el mensaje 'ERROR: cannot ALTER TABLE "apex_objeto" because + * it has pending trigger events' de postgres 8.3 + */ + $sql = 'SET CONSTRAINTS ALL IMMEDIATE;'; + $this->elemento->get_db()->ejecutar($sql); + $sql = array(); + + $sql[] = "ALTER TABLE $schema_logs.apex_sesion_browser ALTER COLUMN ip SET DATA TYPE TEXT;"; + $sql[] = "ALTER TABLE $schema_logs.apex_solicitud_browser ALTER COLUMN ip SET DATA TYPE TEXT;"; + $sql[] = "ALTER TABLE $schema_logs.apex_solicitud_consola ALTER COLUMN ip SET DATA TYPE TEXT;"; + $sql[] = "ALTER TABLE $schema_logs.apex_log_ip_rechazada ALTER COLUMN ip SET DATA TYPE TEXT;"; + $sql[] = "ALTER TABLE $schema_logs.apex_solicitud_web_service ALTER COLUMN ip SET DATA TYPE TEXT;"; + $sql[] = 'ALTER TABLE apex_usuario ADD COLUMN uid VARCHAR(36) DEFAULT NULL;'; + $sql[] = 'ALTER TABLE apex_usuario ADD COLUMN p_uid TEXT DEFAULT NULL;'; + + $this->elemento->get_db()->ejecutar($sql); + + $sql = 'SET CONSTRAINTS ALL DEFERRED;'; + $this->elemento->get_db()->ejecutar($sql); + } +} diff --git a/php/modelo/migraciones_instancia/toba_migracion_3_4_0.php b/php/modelo/migraciones_instancia/toba_migracion_3_4_0.php new file mode 100644 index 0000000000..0f0b0fd44a --- /dev/null +++ b/php/modelo/migraciones_instancia/toba_migracion_3_4_0.php @@ -0,0 +1,33 @@ +elemento->get_db()->get_schema() . '_logs'; + + /** + * Se evita el mensaje 'ERROR: cannot ALTER TABLE "apex_objeto" because + * it has pending trigger events' de postgres 8.3 + */ + $sql = 'SET CONSTRAINTS ALL IMMEDIATE;'; + $this->elemento->get_db()->ejecutar($sql); + $sql = array(); + + $sql[] = "ALTER TABLE $schema_logs.apex_sesion_browser ALTER COLUMN ip SET DATA TYPE TEXT;"; + $sql[] = "ALTER TABLE $schema_logs.apex_solicitud_browser ALTER COLUMN ip SET DATA TYPE TEXT;"; + $sql[] = "ALTER TABLE $schema_logs.apex_solicitud_consola ALTER COLUMN ip SET DATA TYPE TEXT;"; + $sql[] = "ALTER TABLE $schema_logs.apex_log_ip_rechazada ALTER COLUMN ip SET DATA TYPE TEXT;"; + $sql[] = "ALTER TABLE $schema_logs.apex_solicitud_web_service ALTER COLUMN ip SET DATA TYPE TEXT;"; + $sql[] = 'ALTER TABLE apex_usuario ADD COLUMN uid VARCHAR(36) DEFAULT NULL;'; + $sql[] = 'ALTER TABLE apex_usuario ADD COLUMN p_uid TEXT DEFAULT NULL;'; + + $this->elemento->get_db()->ejecutar($sql); + + $sql = 'SET CONSTRAINTS ALL DEFERRED;'; + $this->elemento->get_db()->ejecutar($sql); + } +} diff --git a/php/modelo/moldes_codigo/toba_codigo_clase.php b/php/modelo/moldes_codigo/toba_codigo_clase.php old mode 100644 new mode 100755 index 990837b5ac..213bb3db4a --- a/php/modelo/moldes_codigo/toba_codigo_clase.php +++ b/php/modelo/moldes_codigo/toba_codigo_clase.php @@ -89,7 +89,7 @@ function metodo_js($nombre) //-- Preguntas sobre la composicion del molde ------------------ - function get_lista_metodos($codigo_existente=null) + function get_lista_metodos($codigo_existente='') { $plan = array(); $plan = $this->generar_lista_elementos($this->elementos_php, 'PHP', $codigo_existente); @@ -100,7 +100,7 @@ function get_lista_metodos($codigo_existente=null) /** Genera una lista de los elementos que conforman el molde */ - function generar_lista_elementos($elementos, $prefijo, $codigo_existente=null) + function generar_lista_elementos($elementos, $prefijo, $codigo_existente='') { $lista = array(); $titulo = ''; @@ -183,7 +183,7 @@ function get_codigo($codigo_existente=null, $elementos_a_utilizar=null, $incluir $this->filtrar_separadores(); } // Genero el codigo - return $this->generar_codigo($codigo_existente); + return $this->generar_codigo($codigo_existente ?? ''); } //-- Filtro de contenido ------------------------------------ diff --git a/php/modelo/moldes_codigo/toba_codigo_elemento.php b/php/modelo/moldes_codigo/toba_codigo_elemento.php index 0c3f03ed7d..f01cd6d463 100644 --- a/php/modelo/moldes_codigo/toba_codigo_elemento.php +++ b/php/modelo/moldes_codigo/toba_codigo_elemento.php @@ -1,48 +1,47 @@ -grupo = $grupo; - } - - function get_grupo() - { - return $this->grupo; - } - - function get_nombre() - { - return $this->nombre; - } - - function identar($nivel) - { - $this->identacion += $nivel; - } - - function identado() - { - return str_repeat("\t",$this->identacion); - } - - function get_caracteres_identacion() - { - return $this->identacion * $this->caracteres_tab; - } - - abstract function get_codigo(); -} -?> \ No newline at end of file +grupo = $grupo; + } + + public function get_grupo() + { + return $this->grupo; + } + + public function get_nombre() + { + return $this->nombre; + } + + public function identar($nivel) + { + $this->identacion += $nivel; + } + + public function identado() + { + return str_repeat("\t", $this->identacion); + } + + public function get_caracteres_identacion() + { + return $this->identacion * $this->caracteres_tab; + } + + abstract public function get_codigo(); +} diff --git a/php/modelo/moldes_metadatos/toba_ci_molde.php b/php/modelo/moldes_metadatos/toba_ci_molde.php index 49e43c5278..6cf67793c5 100644 --- a/php/modelo/moldes_metadatos/toba_ci_molde.php +++ b/php/modelo/moldes_metadatos/toba_ci_molde.php @@ -1,159 +1,158 @@ -datos->tabla('prop_basicas')->set(array()); - $this->datos->tabla('prop_basicas')->set_cursor(0); - } - - //--------------------------------------------------- - //-- API de construccion - //--------------------------------------------------- - - function agregar_pantalla($identificador, $etiqueta=null) - { - $datos = array('identificador'=>$identificador, 'etiqueta'=>$etiqueta, 'orden'=>$this->orden_pantalla); - $id = $this->datos->tabla('pantallas')->nueva_fila($datos); - $this->mapeo_pantallas[$identificador] = $id; - $this->orden_pantalla++; - } - - function asociar_pantalla_dep($pantalla, $dep) - { - if(!isset($this->mapeo_pantallas[$pantalla])){ - throw new toba_error_asistentes('Molde CI, asociando a pantallas: La pantalla solicitada no existe.'); - } - if(is_object($dep)){ - foreach($this->deps as $id => $d) { - if ($d === $dep) { - $dep = $id; - continue; - } - } - } else { - if(!isset($this->deps[$dep])){ - throw new toba_error_asistentes('Molde CI, asociando a pantallas: La dependencia solicitada no existe.'); - } - } - $lista_dep = explode(',', $dep); - foreach($lista_dep as $nombre_dep){ - $this->deps_pantallas_asoc[$pantalla][] = $nombre_dep; - } - } - - function asociar_pantalla_evento($pantalla, $evento) - { - if(!isset($this->mapeo_pantallas[$pantalla])){ - throw new toba_error_asistentes('Molde CI, asociando a pantallas: La pantalla solicitada no existe.'); - } - if(is_object($evento)){ - $evento = $evento->get_identificador(); - } else { - if(!isset($this->eventos[$evento])){ - throw new toba_error_asistentes('Molde CI, asociando a pantallas: El evento solicitado no existe.'); - } - } - $lista_evt = explode(',', $evento); - foreach($lista_evt as $nombre_evt){ - $this->pantallas_evt_asoc[$pantalla][] = $nombre_evt; - } - } - - function set_alto($alto) - { - if((strpos($alto,'%')===false) && (strpos($alto,'px')===false)) { - throw new toba_error_asistentes("MOLDE CUADRO: El alto debe definirse con el tipo de medida asociado ('%' o 'px'). Definido: $alto"); - } - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'alto',$alto); - } - - //--------------------------------------------------- - //-- Manejo de SUBCOMPONENTES - //--------------------------------------------------- - - function agregar_dep($tipo, $id) - { - $clase = $tipo . '_molde'; - $this->deps[$id] = new $clase($this->asistente); - //Asignacion a pantallas - return $this->deps[$id]; - } - - function dep($id) - { - if(!isset($this->deps[$id])){ - throw new toba_error_asistentes("La dependencia '$id' no existe"); - } - return $this->deps[$id]; - } - - //--------------------------------------------------- - //-- Generacion de METADATOS & ARCHIVOS - //--------------------------------------------------- - - function generar() - { - foreach($this->deps as $id => $dep) { - $dep->generar(); - $clave = $dep->get_clave_componente_generado(); - $this->asociar_dependencia($id, $clave['clave']); - } - $this->asociar_dependencias_a_pantalla(); - parent::generar(); - } - - function asociar_dependencia($id, $clave) - { - $datos = array('proyecto'=>$this->proyecto, 'objeto_proveedor'=>$clave, 'identificador'=> $id); - $this->datos->tabla('dependencias')->nueva_fila( $datos ); - } - - function asociar_dependencias_a_pantalla() - { - //Doy de alta la asociacion entre pantallas y objetos_ei, primero ciclo por las pantallas - foreach($this->deps_pantallas_asoc as $pantalla => $dependencias){ - //Seteo el cursor en la pantalla - $id_fila = $this->mapeo_pantallas[$pantalla]; - $this->datos->tabla('pantallas')->set_cursor($id_fila); - - //Ciclo por las dependencias de la pantalla - foreach($dependencias as $orden => $nombre_dep){ - $id = $this->datos->tabla('dependencias')->get_id_fila_condicion(array('identificador' => $nombre_dep)); - $this->datos->tabla('dependencias')->set_cursor(current($id)); - $this->datos->tabla('objetos_pantalla')->nueva_fila(array('orden' => $orden, 'dependencia' => $nombre_dep)); - } - } - $this->datos->tabla('pantallas')->resetear_cursor(); - $this->datos->tabla('dependencias')->resetear_cursor(); - } - - function asociar_eventos_a_pantallas() - { - //Doy de alta la asociacion entre pantallas y eventos - foreach($this->pantallas_evt_asoc as $pantalla => $eventos){ - //Seteo el cursor en la pantalla - $id_fila = $this->mapeo_pantallas[$pantalla]; - $this->datos->tabla('pantallas')->set_cursor($id_fila); - - foreach($eventos as $nombre_evt){ - $id_ev = $this->datos->tabla('eventos')->get_id_fila_condicion(array('identificador' => $nombre_evt)); - $this->datos->tabla('eventos')->set_cursor(current($id_ev)); - $this->datos->tabla('eventos_pantalla')->nueva_fila(array('identificador' => $nombre_evt)); - } - } - $this->datos->tabla('eventos')->resetear_cursor(); - $this->datos->tabla('pantallas')->resetear_cursor(); - } -} -?> \ No newline at end of file +datos->tabla('prop_basicas')->set(array()); + $this->datos->tabla('prop_basicas')->set_cursor(0); + } + + //--------------------------------------------------- + //-- API de construccion + //--------------------------------------------------- + + public function agregar_pantalla($identificador, $etiqueta=null) + { + $datos = array('identificador'=>$identificador, 'etiqueta'=>$etiqueta, 'orden'=>$this->orden_pantalla); + $id = $this->datos->tabla('pantallas')->nueva_fila($datos); + $this->mapeo_pantallas[$identificador] = $id; + $this->orden_pantalla++; + } + + public function asociar_pantalla_dep($pantalla, $dep) + { + if (!isset($this->mapeo_pantallas[$pantalla])) { + throw new toba_error_asistentes('Molde CI, asociando a pantallas: La pantalla solicitada no existe.'); + } + if (is_object($dep)) { + foreach ($this->deps as $id => $d) { + if ($d === $dep) { + $dep = $id; + continue; + } + } + } else { + if (!isset($this->deps[$dep])) { + throw new toba_error_asistentes('Molde CI, asociando a pantallas: La dependencia solicitada no existe.'); + } + } + $lista_dep = explode(',', $dep); + foreach ($lista_dep as $nombre_dep) { + $this->deps_pantallas_asoc[$pantalla][] = $nombre_dep; + } + } + + public function asociar_pantalla_evento($pantalla, $evento) + { + if (!isset($this->mapeo_pantallas[$pantalla])) { + throw new toba_error_asistentes('Molde CI, asociando a pantallas: La pantalla solicitada no existe.'); + } + if (is_object($evento)) { + $evento = $evento->get_identificador(); + } else { + if (!isset($this->eventos[$evento])) { + throw new toba_error_asistentes('Molde CI, asociando a pantallas: El evento solicitado no existe.'); + } + } + $lista_evt = explode(',', $evento); + foreach ($lista_evt as $nombre_evt) { + $this->pantallas_evt_asoc[$pantalla][] = $nombre_evt; + } + } + + public function set_alto($alto) + { + if ((strpos($alto, '%')===false) && (strpos($alto, 'px')===false)) { + throw new toba_error_asistentes("MOLDE CUADRO: El alto debe definirse con el tipo de medida asociado ('%' o 'px'). Definido: $alto"); + } + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'alto', $alto); + } + + //--------------------------------------------------- + //-- Manejo de SUBCOMPONENTES + //--------------------------------------------------- + + public function agregar_dep($tipo, $id) + { + $clase = $tipo . '_molde'; + $this->deps[$id] = new $clase($this->asistente); + //Asignacion a pantallas + return $this->deps[$id]; + } + + public function dep($id) + { + if (!isset($this->deps[$id])) { + throw new toba_error_asistentes("La dependencia '$id' no existe"); + } + return $this->deps[$id]; + } + + //--------------------------------------------------- + //-- Generacion de METADATOS & ARCHIVOS + //--------------------------------------------------- + + public function generar() + { + foreach ($this->deps as $id => $dep) { + $dep->generar(); + $clave = $dep->get_clave_componente_generado(); + $this->asociar_dependencia($id, $clave['clave']); + } + $this->asociar_dependencias_a_pantalla(); + parent::generar(); + } + + public function asociar_dependencia($id, $clave) + { + $datos = array('proyecto'=>$this->proyecto, 'objeto_proveedor'=>$clave, 'identificador'=> $id); + $this->datos->tabla('dependencias')->nueva_fila($datos); + } + + public function asociar_dependencias_a_pantalla() + { + //Doy de alta la asociacion entre pantallas y objetos_ei, primero ciclo por las pantallas + foreach ($this->deps_pantallas_asoc as $pantalla => $dependencias) { + //Seteo el cursor en la pantalla + $id_fila = $this->mapeo_pantallas[$pantalla]; + $this->datos->tabla('pantallas')->set_cursor($id_fila); + + //Ciclo por las dependencias de la pantalla + foreach ($dependencias as $orden => $nombre_dep) { + $id = $this->datos->tabla('dependencias')->get_id_fila_condicion(array('identificador' => $nombre_dep)); + $this->datos->tabla('dependencias')->set_cursor(current($id)); + $this->datos->tabla('objetos_pantalla')->nueva_fila(array('orden' => $orden, 'dependencia' => $nombre_dep)); + } + } + $this->datos->tabla('pantallas')->resetear_cursor(); + $this->datos->tabla('dependencias')->resetear_cursor(); + } + + public function asociar_eventos_a_pantallas() + { + //Doy de alta la asociacion entre pantallas y eventos + foreach ($this->pantallas_evt_asoc as $pantalla => $eventos) { + //Seteo el cursor en la pantalla + $id_fila = $this->mapeo_pantallas[$pantalla]; + $this->datos->tabla('pantallas')->set_cursor($id_fila); + + foreach ($eventos as $nombre_evt) { + $id_ev = $this->datos->tabla('eventos')->get_id_fila_condicion(array('identificador' => $nombre_evt)); + $this->datos->tabla('eventos')->set_cursor(current($id_ev)); + $this->datos->tabla('eventos_pantalla')->nueva_fila(array('identificador' => $nombre_evt)); + } + } + $this->datos->tabla('eventos')->resetear_cursor(); + $this->datos->tabla('pantallas')->resetear_cursor(); + } +} diff --git a/php/modelo/moldes_metadatos/toba_datos_relacion_molde.php b/php/modelo/moldes_metadatos/toba_datos_relacion_molde.php index 022b6c2a8c..28523d68c1 100644 --- a/php/modelo/moldes_metadatos/toba_datos_relacion_molde.php +++ b/php/modelo/moldes_metadatos/toba_datos_relacion_molde.php @@ -1,136 +1,135 @@ -pisar_archivo = false; - $this->carpeta_archivo = $this->asistente->get_carpeta_archivos_datos(); - } - - function cargar($id) - { - $this->datos->cargar(array('proyecto' => $this->proyecto, 'objeto' => $id)); - } - - function crear($nombre) - { - //Lanzo la generacion de los datos tabla, esto aun no genero los metadatos, solo las estructuras internas - foreach($this->tablas as $tabla => $molde_dt){ - $this->asistente->generar_datos_tabla($this->tablas[$tabla], $tabla, $this->definiciones[$tabla]); - } - - //Creo las lineas correspondientes en el datos relacion del molde. - $datos = array('nombre' => $nombre . ' - DR '); - $this->datos->tabla('base')->set($datos); - $predeterminados = array( - 'ap' => 2, - 'sinc_lock_optimista' => 1, - 'sinc_orden_automatico' => 1 - ); - $this->datos->tabla('prop_basicas')->set($predeterminados); - } - - function crear_relaciones() - { - $tablas_involucradas = array_keys($this->pre_relacion_columnas); - foreach($tablas_involucradas as $par){ - list($tabla_padre, $tabla_hija) = explode('|', $par); - if (! isset($this->relaciones[$tabla_padre])){ - throw new toba_error_asistentes("Molde DR, asociando tablas: La tabla $tabla_padre no existe en el conjunto de tablas padres."); - }elseif (! in_array($tabla_hija , $this->relaciones[$tabla_padre])){ - throw new toba_error_asistentes("Molde DR, asociando tablas: La tabla $tabla_hija no existe entre el conjunto de tablas hijas de $tabla_padre."); - } - - $this->columnas_relacionadas[$tabla_padre][$tabla_hija] = $this->pre_relacion_columnas[$par]; - } - } - - function crear_metodo_consulta($metodo, $sql, $parametros=null) - { - foreach($this->tablas as $tabla => $molde_dt){ - $molde_dt->crear_metodo_consulta($metodo, $sql, $parametros); - } - } - - //----------------------------------------------------------------------------------------------------------------// - function set_ap($ap_clase, $ap_archivo) - { - //Recupero el punto de montaje del componente y lo coloco para el AP. - $pm = $this->datos->tabla('base')->get_fila_columna(0, 'punto_montaje'); - - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'ap_clase',$ap_clase); - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'ap_archivo',$ap_archivo); - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'punto_montaje', $pm); - } - - //----------------------------------------------------------------------------------------------------------------// - function agregar_tabla($nombre_tabla) - { - $pm = $this->datos->tabla('base')->get_fila_columna(0, 'punto_montaje'); //Seteo el punto de montaje en la tabla nueva - $this->tablas[$nombre_tabla] = new toba_datos_tabla_molde($this->asistente); - $this->tablas[$nombre_tabla]->set_punto_montaje($pm); - } - - function agregar_relacion_tablas($tabla_padre, $tabla_hija) - { - $this->relaciones[$tabla_padre][] = $tabla_hija; - } - - /** - * Funcion que agrega las columnas que relacionan 2 tablas - * @param mixed $tabla_padre - * @param mixed $tabla_hija - * @param mixed $columna_padre - * @param mixed $columna_hija - */ - function agregar_columnas_relacionadas($tabla_padre, $tabla_hija, $columna_padre, $columna_hija) - { - $index = $tabla_padre . '|' . $tabla_hija; - $valor = array('columna_padre' => $columna_padre, 'columna_hija' => $columna_hija); - $this->pre_relacion_columnas[$index][] = $valor; - } - - function agregar_definicion_tabla($tabla, $def_fila) - { - $this->definiciones[$tabla] = $def_fila; - } - - //----------------------------------------------------------------------------------------------------------------// - function generar() - { - //Aca tengo que generar los datos tabla y la relacion - foreach($this->tablas as $tabla => $molde_dt){ - $molde_dt->generar(); - $datos = $molde_dt->get_clave_componente_generado(); - $this->datos->tabla('dependencias')->nueva_fila(array('identificador' => $tabla, 'objeto_proveedor' => $datos['clave'], 'proyecto' => $datos['proyecto'], 'parametros_a' => 1, 'parametros_b' => 1)); - } - - //Alpha testing required.. - $fuente = $this->asistente->get_fuente(); - foreach($this->relaciones as $tabla_padre => $tabla_hija){ - $dt_padre = toba_info_editores::get_dt_de_tabla_fuente($tabla_padre, $fuente, $this->proyecto); - $dt_hijo = toba_info_editores::get_dt_de_tabla_fuente($tabla_hija, $fuente, $this->proyecto); - $this->datos->tabla('relaciones')->nueva_fila(array('identificador' => "$tabla_padre -> $tabla_hija", 'padre_id' => $tabla_padre , 'hijo_id' => $tabla_hija, 'padre_objeto' => $padre_obj['id'], 'hijo_objeto' => $hijo_obj['id'])); - if (isset($this->columnas_relacionadas[$tabla_padre][$tabla_hija])){ - foreach($this->columnas_relacionadas[$tabla_padre][$tabla_hija] as $columnas){ - $this->datos->tabla('columnas_relacion')->nueva_fila(array('padre_clave' => $columnas['columna_padre'], 'hijo_clave' => $columnas['columna_hija'])); - } - } - } - - parent::generar(); - } -} -?> \ No newline at end of file +pisar_archivo = false; + $this->carpeta_archivo = $this->asistente->get_carpeta_archivos_datos(); + } + + public function cargar($id) + { + $this->datos->cargar(array('proyecto' => $this->proyecto, 'objeto' => $id)); + } + + public function crear($nombre) + { + //Lanzo la generacion de los datos tabla, esto aun no genero los metadatos, solo las estructuras internas + foreach ($this->tablas as $tabla => $molde_dt) { + $this->asistente->generar_datos_tabla($this->tablas[$tabla], $tabla, $this->definiciones[$tabla]); + } + + //Creo las lineas correspondientes en el datos relacion del molde. + $datos = array('nombre' => $nombre . ' - DR '); + $this->datos->tabla('base')->set($datos); + $predeterminados = array( + 'ap' => 2, + 'sinc_lock_optimista' => 1, + 'sinc_orden_automatico' => 1 + ); + $this->datos->tabla('prop_basicas')->set($predeterminados); + } + + public function crear_relaciones() + { + $tablas_involucradas = array_keys($this->pre_relacion_columnas); + foreach ($tablas_involucradas as $par) { + list($tabla_padre, $tabla_hija) = explode('|', $par); + if (! isset($this->relaciones[$tabla_padre])) { + throw new toba_error_asistentes("Molde DR, asociando tablas: La tabla $tabla_padre no existe en el conjunto de tablas padres."); + } elseif (! in_array($tabla_hija, $this->relaciones[$tabla_padre])) { + throw new toba_error_asistentes("Molde DR, asociando tablas: La tabla $tabla_hija no existe entre el conjunto de tablas hijas de $tabla_padre."); + } + + $this->columnas_relacionadas[$tabla_padre][$tabla_hija] = $this->pre_relacion_columnas[$par]; + } + } + + public function crear_metodo_consulta($metodo, $sql, $parametros=null) + { + foreach ($this->tablas as $tabla => $molde_dt) { + $molde_dt->crear_metodo_consulta($metodo, $sql, $parametros); + } + } + + //----------------------------------------------------------------------------------------------------------------// + public function set_ap($ap_clase, $ap_archivo) + { + //Recupero el punto de montaje del componente y lo coloco para el AP. + $pm = $this->datos->tabla('base')->get_fila_columna(0, 'punto_montaje'); + + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'ap_clase', $ap_clase); + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'ap_archivo', $ap_archivo); + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'punto_montaje', $pm); + } + + //----------------------------------------------------------------------------------------------------------------// + public function agregar_tabla($nombre_tabla) + { + $pm = $this->datos->tabla('base')->get_fila_columna(0, 'punto_montaje'); //Seteo el punto de montaje en la tabla nueva + $this->tablas[$nombre_tabla] = new toba_datos_tabla_molde($this->asistente); + $this->tablas[$nombre_tabla]->set_punto_montaje($pm); + } + + public function agregar_relacion_tablas($tabla_padre, $tabla_hija) + { + $this->relaciones[$tabla_padre][] = $tabla_hija; + } + + /** + * Funcion que agrega las columnas que relacionan 2 tablas + * @param mixed $tabla_padre + * @param mixed $tabla_hija + * @param mixed $columna_padre + * @param mixed $columna_hija + */ + public function agregar_columnas_relacionadas($tabla_padre, $tabla_hija, $columna_padre, $columna_hija) + { + $index = $tabla_padre . '|' . $tabla_hija; + $valor = array('columna_padre' => $columna_padre, 'columna_hija' => $columna_hija); + $this->pre_relacion_columnas[$index][] = $valor; + } + + public function agregar_definicion_tabla($tabla, $def_fila) + { + $this->definiciones[$tabla] = $def_fila; + } + + //----------------------------------------------------------------------------------------------------------------// + public function generar() + { + //Aca tengo que generar los datos tabla y la relacion + foreach ($this->tablas as $tabla => $molde_dt) { + $molde_dt->generar(); + $datos = $molde_dt->get_clave_componente_generado(); + $this->datos->tabla('dependencias')->nueva_fila(array('identificador' => $tabla, 'objeto_proveedor' => $datos['clave'], 'proyecto' => $datos['proyecto'], 'parametros_a' => 1, 'parametros_b' => 1)); + } + + //Alpha testing required.. + $fuente = $this->asistente->get_fuente(); + foreach ($this->relaciones as $tabla_padre => $tabla_hija) { + $dt_padre = toba_info_editores::get_dt_de_tabla_fuente($tabla_padre, $fuente, $this->proyecto); + $dt_hijo = toba_info_editores::get_dt_de_tabla_fuente($tabla_hija, $fuente, $this->proyecto); + $this->datos->tabla('relaciones')->nueva_fila(array('identificador' => "$tabla_padre -> $tabla_hija", 'padre_id' => $tabla_padre , 'hijo_id' => $tabla_hija, 'padre_objeto' => $padre_obj['id'], 'hijo_objeto' => $hijo_obj['id'])); + if (isset($this->columnas_relacionadas[$tabla_padre][$tabla_hija])) { + foreach ($this->columnas_relacionadas[$tabla_padre][$tabla_hija] as $columnas) { + $this->datos->tabla('columnas_relacion')->nueva_fila(array('padre_clave' => $columnas['columna_padre'], 'hijo_clave' => $columnas['columna_hija'])); + } + } + } + + parent::generar(); + } +} diff --git a/php/modelo/moldes_metadatos/toba_datos_tabla_molde.php b/php/modelo/moldes_metadatos/toba_datos_tabla_molde.php index 91cae3c4b4..f85b78f6cc 100644 --- a/php/modelo/moldes_metadatos/toba_datos_tabla_molde.php +++ b/php/modelo/moldes_metadatos/toba_datos_tabla_molde.php @@ -1,122 +1,121 @@ -pisar_archivo = false; - $this->carpeta_archivo = $this->asistente->get_carpeta_archivos_datos(); - } - - function crear($tabla) - { - $datos = array('nombre' => $tabla); - $this->datos->tabla('base')->set($datos); - $this->datos->tabla('prop_basicas')->set(array('ap'=>1)); //Admin persistencia por defecto - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'tabla', $tabla); - } - - function cargar($id) - { - $this->datos->cargar(array('proyecto' => $this->proyecto, 'objeto' => $id)); - } - - function get_tabla_nombre() - { - return $this->datos->tabla('prop_basicas')->get_columna('tabla'); - } - - //--------------------------------------------------- - //-- API de construccion - //--------------------------------------------------- - - function actualizar_campos() - { - $this->datos->actualizar_campos(); - } - - function set_ap($subclase, $archivo) - { - //Recupero el punto de montaje del componente y lo coloco para el AP. - $pm = $this->datos->tabla('base')->get_fila_columna(0, 'punto_montaje'); - - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'ap',0); - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'ap_clase',$subclase); - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'ap_archivo',$archivo); - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'punto_montaje', $pm); - } - - function permitir_modificar_pks() - { - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'modificar_claves', 1); - } - - //-- Columnas --------------------------------------- - - function agregar_columna($identificador, $tipo) - { - $this->columnas[$identificador] = new toba_molde_datos_tabla_col($identificador, $tipo); - return $this->columnas[$identificador]; - } - - function columna($identificador) - { - if(!isset($this->columnas[$identificador])) { - throw new toba_error_asistentes('Molde formulario: El ef solicitado no existe'); - } - return $this->columnas[$identificador]; - } - - //--------------------------------------------------- - //-- API de subclase - //--------------------------------------------------- - - /** - * Para el datos tabla, al querer acceder a la extension se crea sola ya que es global al proyecto - * - * @return unknown - */ - function php() - { - if (! isset($this->molde_php)) { - if (! $this->extendido()) { - $clase = 'dt_'.$this->get_tabla_nombre(); - $archivo = $this->carpeta_archivo.'/'.$clase.'.php'; - } else { - //-- Ya estaba extendido previamente, se carga la clase - $clase = $this->datos->tabla('base')->get_columna('subclase'); - $archivo = $this->datos->tabla('base')->get_columna('subclase_archivo'); - } - $this->extender($clase, $archivo); - } - return $this->molde_php; - } - - - function crear_metodo_consulta($metodo, $sql, $parametros=null) - { - $metodo = $this->asistente->crear_metodo_consulta($metodo, $sql, $parametros); - $this->php()->agregar($metodo); - } - - - //--------------------------------------------------- - //-- Generacion de METADATOS & ARCHIVOS - //--------------------------------------------------- - - - function generar() - { - foreach($this->columnas as $columna) { - $this->datos->tabla('columnas')->nueva_fila($columna->get_datos()); - } - parent::generar(); - } -} -?> \ No newline at end of file +pisar_archivo = false; + $this->carpeta_archivo = $this->asistente->get_carpeta_archivos_datos(); + } + + public function crear($tabla) + { + $datos = array('nombre' => $tabla); + $this->datos->tabla('base')->set($datos); + $this->datos->tabla('prop_basicas')->set(array('ap'=>1)); //Admin persistencia por defecto + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'tabla', $tabla); + } + + public function cargar($id) + { + $this->datos->cargar(array('proyecto' => $this->proyecto, 'objeto' => $id)); + } + + public function get_tabla_nombre() + { + return $this->datos->tabla('prop_basicas')->get_columna('tabla'); + } + + //--------------------------------------------------- + //-- API de construccion + //--------------------------------------------------- + + public function actualizar_campos() + { + $this->datos->actualizar_campos(); + } + + public function set_ap($subclase, $archivo) + { + //Recupero el punto de montaje del componente y lo coloco para el AP. + $pm = $this->datos->tabla('base')->get_fila_columna(0, 'punto_montaje'); + + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'ap', 0); + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'ap_clase', $subclase); + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'ap_archivo', $archivo); + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'punto_montaje', $pm); + } + + public function permitir_modificar_pks() + { + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'modificar_claves', 1); + } + + //-- Columnas --------------------------------------- + + public function agregar_columna($identificador, $tipo) + { + $this->columnas[$identificador] = new toba_molde_datos_tabla_col($identificador, $tipo); + return $this->columnas[$identificador]; + } + + public function columna($identificador) + { + if (!isset($this->columnas[$identificador])) { + throw new toba_error_asistentes('Molde formulario: El ef solicitado no existe'); + } + return $this->columnas[$identificador]; + } + + //--------------------------------------------------- + //-- API de subclase + //--------------------------------------------------- + + /** + * Para el datos tabla, al querer acceder a la extension se crea sola ya que es global al proyecto + * + * @return unknown + */ + public function php() + { + if (! isset($this->molde_php)) { + if (! $this->extendido()) { + $clase = 'dt_'.$this->get_tabla_nombre(); + $archivo = $this->carpeta_archivo.'/'.$clase.'.php'; + } else { + //-- Ya estaba extendido previamente, se carga la clase + $clase = $this->datos->tabla('base')->get_columna('subclase'); + $archivo = $this->datos->tabla('base')->get_columna('subclase_archivo'); + } + $this->extender($clase, $archivo); + } + return $this->molde_php; + } + + + public function crear_metodo_consulta($metodo, $sql, $parametros=null) + { + $metodo = $this->asistente->crear_metodo_consulta($metodo, $sql, $parametros); + $this->php()->agregar($metodo); + } + + + //--------------------------------------------------- + //-- Generacion de METADATOS & ARCHIVOS + //--------------------------------------------------- + + + public function generar() + { + foreach ($this->columnas as $columna) { + $this->datos->tabla('columnas')->nueva_fila($columna->get_datos()); + } + parent::generar(); + } +} diff --git a/php/modelo/moldes_metadatos/toba_ei_cuadro_molde.php b/php/modelo/moldes_metadatos/toba_ei_cuadro_molde.php index 11b616fbb9..d65ccbee36 100644 --- a/php/modelo/moldes_metadatos/toba_ei_cuadro_molde.php +++ b/php/modelo/moldes_metadatos/toba_ei_cuadro_molde.php @@ -1,77 +1,76 @@ -datos->tabla('prop_basicas')->nueva_fila(array()); - $this->datos->tabla('prop_basicas')->set_cursor(0); - } - - //--------------------------------------------------- - //-- API de construccion - //--------------------------------------------------- - - function agregar_columna($identificador, $tipo) - { - $this->columnas[$identificador] = new toba_molde_cuadro_col($identificador, $tipo); - $this->columnas[$identificador]->set_orden($this->proxima_col); - $this->proxima_col++; - return $this->columnas[$identificador]; - } - - function columna($identificador) - { - if(!isset($this->columnas[$identificador])) { - throw new toba_error_asistentes('Molde cuadro: la columna solicitada no existe'); - } - return $this->columnas[$identificador]; - } - - function set_clave($clave) - { - if(is_array($clave)){ - $clave = implode(',',$clave); - } - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'columnas_clave',$clave); - } +datos->tabla('prop_basicas')->set_fila_columna_valor(0,'eof_invisible', 1); - } - - function set_eof($mensaje) - { - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'eof_customizado',$mensaje); - } - - function set_scroll($alto) - { - if((strpos($alto,'%')===false) && (strpos($alto,'px')===false)) { - throw new toba_error_asistentes("MOLDE CUADRO: El alto del SCROLL debe definirse con el tipo de medida asociado ('%' o 'px'). Definido: $alto"); - } - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'scroll',1); - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'scroll_alto',$alto); - } - - //--------------------------------------------------- - //-- Generacion de METADATOS & ARCHIVOS - //--------------------------------------------------- - - function generar() - { - foreach($this->columnas as $ef) { - $this->datos->tabla('columnas')->nueva_fila($ef->get_datos()); - } - parent::generar(); - } -} -?> \ No newline at end of file + public function ini() + { + parent::ini(); + $this->datos->tabla('prop_basicas')->nueva_fila(array()); + $this->datos->tabla('prop_basicas')->set_cursor(0); + } + + //--------------------------------------------------- + //-- API de construccion + //--------------------------------------------------- + + public function agregar_columna($identificador, $tipo) + { + $this->columnas[$identificador] = new toba_molde_cuadro_col($identificador, $tipo); + $this->columnas[$identificador]->set_orden($this->proxima_col); + $this->proxima_col++; + return $this->columnas[$identificador]; + } + + public function columna($identificador) + { + if (!isset($this->columnas[$identificador])) { + throw new toba_error_asistentes('Molde cuadro: la columna solicitada no existe'); + } + return $this->columnas[$identificador]; + } + + public function set_clave($clave) + { + if (is_array($clave)) { + $clave = implode(',', $clave); + } + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'columnas_clave', $clave); + } + + public function set_eof_invisible() + { + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'eof_invisible', 1); + } + + public function set_eof($mensaje) + { + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'eof_customizado', $mensaje); + } + + public function set_scroll($alto) + { + if ((strpos($alto, '%')===false) && (strpos($alto, 'px')===false)) { + throw new toba_error_asistentes("MOLDE CUADRO: El alto del SCROLL debe definirse con el tipo de medida asociado ('%' o 'px'). Definido: $alto"); + } + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'scroll', 1); + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'scroll_alto', $alto); + } + + //--------------------------------------------------- + //-- Generacion de METADATOS & ARCHIVOS + //--------------------------------------------------- + + public function generar() + { + foreach ($this->columnas as $ef) { + $this->datos->tabla('columnas')->nueva_fila($ef->get_datos()); + } + parent::generar(); + } +} diff --git a/php/modelo/moldes_metadatos/toba_ei_filtro_molde.php b/php/modelo/moldes_metadatos/toba_ei_filtro_molde.php index 5774b40bf8..4c5b3a7533 100644 --- a/php/modelo/moldes_metadatos/toba_ei_filtro_molde.php +++ b/php/modelo/moldes_metadatos/toba_ei_filtro_molde.php @@ -1,9 +1,8 @@ - \ No newline at end of file +datos->tabla('prop_basicas')->set_fila_columna_valor(0,'filas_agregar',$estado); - } - - function agregar_filas_js($tipo=1) - { - $tipos_validos = array(0,1); //1=javascript - if(!in_array($tipo, $tipos_validos)) { - throw new toba_error_asistentes('MOLDE ML: El tipo de agregado de filas especificado no es valido'); - } - $this->agregar_filas(); - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'filas_agregar_online',$tipo); - } - - function set_analisis_cambios($tipo) - { - $tipos_validos = array('NO','LINEA','EVENTOS'); - if(!in_array($tipo, $tipos_validos)) { - throw new toba_error_asistentes('MOLDE ML: El tipo de analisis especificado no es valido'); - } - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'analisis_cambios',$tipo); - } -} -?> \ No newline at end of file +datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'filas_agregar', $estado); + } + + public function agregar_filas_js($tipo=1) + { + $tipos_validos = array(0,1); //1=javascript + if (!in_array($tipo, $tipos_validos)) { + throw new toba_error_asistentes('MOLDE ML: El tipo de agregado de filas especificado no es valido'); + } + $this->agregar_filas(); + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'filas_agregar_online', $tipo); + } + + public function set_analisis_cambios($tipo) + { + $tipos_validos = array('NO','LINEA','EVENTOS'); + if (!in_array($tipo, $tipos_validos)) { + throw new toba_error_asistentes('MOLDE ML: El tipo de analisis especificado no es valido'); + } + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'analisis_cambios', $tipo); + } +} diff --git a/php/modelo/moldes_metadatos/toba_ei_formulario_molde.php b/php/modelo/moldes_metadatos/toba_ei_formulario_molde.php index 6b92b588fc..d8beb4020c 100644 --- a/php/modelo/moldes_metadatos/toba_ei_formulario_molde.php +++ b/php/modelo/moldes_metadatos/toba_ei_formulario_molde.php @@ -1,63 +1,61 @@ -datos->tabla('prop_basicas')->nueva_fila(array()); - $this->datos->tabla('prop_basicas')->set_cursor(0); - } - - //--------------------------------------------------- - //-- API de construccion - //--------------------------------------------------- - - function set_comportamiento_filtro() - { - $datos = array(); - $datos['no_imprimir_efs_sin_estado'] = 1; - $datos['resaltar_efs_con_estado'] = 1; - $this->datos->tabla('prop_basicas')->set($datos); - } - - function agregar_ef($identificador, $tipo) - { - $this->efs[$identificador] = new toba_molde_ef($identificador, $tipo); - $this->efs[$identificador]->set_orden($this->proximo_ef); - $this->proximo_ef++; - return $this->efs[$identificador]; - } - - function ef($identificador) - { - if(!isset($this->efs[$identificador])) { - throw new toba_error_asistentes('Molde formulario: El ef solicitado no existe'); - } - return $this->efs[$identificador]; - } - - //--------------------------------------------------- - //-- Generacion de METADATOS & ARCHIVOS - //--------------------------------------------------- - - function generar() - { - foreach($this->efs as $ef) { - //-- Se generan los datos_tabla necesarios para la carga de los combos - if ($ef->tiene_carga_datos_tabla()) { - $ef->generar_datos_tabla_carga(); - } - $this->datos->tabla('efs')->nueva_fila($ef->get_datos()); - } - parent::generar(); - } - -} -?> \ No newline at end of file +datos->tabla('prop_basicas')->nueva_fila(array()); + $this->datos->tabla('prop_basicas')->set_cursor(0); + } + + //--------------------------------------------------- + //-- API de construccion + //--------------------------------------------------- + + public function set_comportamiento_filtro() + { + $datos = array(); + $datos['no_imprimir_efs_sin_estado'] = 1; + $datos['resaltar_efs_con_estado'] = 1; + $this->datos->tabla('prop_basicas')->set($datos); + } + + public function agregar_ef($identificador, $tipo) + { + $this->efs[$identificador] = new toba_molde_ef($identificador, $tipo); + $this->efs[$identificador]->set_orden($this->proximo_ef); + $this->proximo_ef++; + return $this->efs[$identificador]; + } + + public function ef($identificador) + { + if (!isset($this->efs[$identificador])) { + throw new toba_error_asistentes('Molde formulario: El ef solicitado no existe'); + } + return $this->efs[$identificador]; + } + + //--------------------------------------------------- + //-- Generacion de METADATOS & ARCHIVOS + //--------------------------------------------------- + + public function generar() + { + foreach ($this->efs as $ef) { + //-- Se generan los datos_tabla necesarios para la carga de los combos + if ($ef->tiene_carga_datos_tabla()) { + $ef->generar_datos_tabla_carga(); + } + $this->datos->tabla('efs')->nueva_fila($ef->get_datos()); + } + parent::generar(); + } +} diff --git a/php/modelo/moldes_metadatos/toba_item_molde.php b/php/modelo/moldes_metadatos/toba_item_molde.php index 6d4c9408b9..9a8a8a475e 100644 --- a/php/modelo/moldes_metadatos/toba_item_molde.php +++ b/php/modelo/moldes_metadatos/toba_item_molde.php @@ -1,125 +1,129 @@ -datos->tabla('base')->set_fila_columna_valor(0,'padre_proyecto',$this->proyecto); - $this->set_tipo_solicitud('web'); - $this->set_tipo_pagina('titulo'); - $tipo_pagina = toba_info_editores::get_tipo_pagina_defecto($this->proyecto); - $this->set_tipo_pagina($tipo_pagina['pagina_tipo'], $tipo_pagina['proyecto']); - $this->set_acceso_menu(); - } - - - function cargar($id) - { - $this->datos->cargar(array('proyecto' => $this->proyecto, 'item' => $id)); - } - - //---------------------------------------------------- - //-- API CONSTRUCCION - //---------------------------------------------------- - - function ci() - { - if(!isset($this->ci)) $this->ci = new toba_ci_molde($this->asistente); - return $this->ci; - } - - function cn() - { - if(!isset($this->cn)) $this->cn = new toba_cn_molde($this->asistente); - return $this->cn; - } - - function set_ci($ci) - { - $this->ci = $ci; - } - - function set_carpeta_item($id) - { - $this->datos->tabla('base')->set_fila_columna_valor(0,'padre',$id); - } - - function set_tipo_solicitud($id) - { - $this->datos->tabla('base')->set_fila_columna_valor(0,'solicitud_tipo',$id); - } - - function set_tipo_pagina($id, $proyecto=null) - { - if(!isset($proyecto)) $proyecto = 'toba'; - $this->datos->tabla('base')->set_fila_columna_valor(0,'pagina_tipo_proyecto',$proyecto); - $this->datos->tabla('base')->set_fila_columna_valor(0,'pagina_tipo',$id); - } - - function set_acceso_menu($estado=true, $orden=0) - { - $this->datos->tabla('base')->set_fila_columna_valor(0,'menu',$estado); - $this->datos->tabla('base')->set_fila_columna_valor(0,'orden',$orden); - } - - function cargar_grupos_acceso_activos() - { - foreach(toba_editor::get_perfiles_funcionales_previsualizacion() as $grupo) { - $this->datos->tabla('permisos')->nueva_fila(array('usuario_grupo_acc'=>$grupo)); - } - } - - function set_accion($archivo) - { - $this->archivo = $archivo; - } - - //--------------------------------------------------- - //-- Generacion de METADATOS & ARCHIVOS - //--------------------------------------------------- - - function generar() - { - //Abrir transaccion - if(isset($this->ci)) { - $this->ci->generar(); - $clave = $this->ci->get_clave_componente_generado(); - $this->asociar_objeto($clave['clave']); - } - if(isset($this->cn)) { - $this->cn->generar(); - $clave = $this->ci->get_clave_componente_generado(); - $this->asociar_objeto($clave['clave']); - } - parent::generar(); - } - - function asociar_objeto($clave) - { - static $a = 0; - $this->datos->tabla('objetos')->nueva_fila(array('proyecto' => $this->proyecto, 'objeto' => $clave, 'orden' => $a)); - $a++; - } - - protected function get_codigo_php() - { - return ''; - } - - protected function asociar_archivo() - { - - } - - function get_clave_componente_generado() - { - $datos = $this->datos->tabla('base')->get_clave_valor(0); - return array( 'clave' => $datos['item'], - 'proyecto' => $datos['proyecto']); - } -} -?> \ No newline at end of file +datos->tabla('base')->set_fila_columna_valor(0, 'padre_proyecto', $this->proyecto); + $this->set_tipo_solicitud('web'); + $this->set_tipo_pagina('titulo'); + $tipo_pagina = toba_info_editores::get_tipo_pagina_defecto($this->proyecto); + $this->set_tipo_pagina($tipo_pagina['pagina_tipo'], $tipo_pagina['proyecto']); + $this->set_acceso_menu(); + } + + + public function cargar($id) + { + $this->datos->cargar(array('proyecto' => $this->proyecto, 'item' => $id)); + } + + //---------------------------------------------------- + //-- API CONSTRUCCION + //---------------------------------------------------- + + public function ci() + { + if (!isset($this->ci)) { + $this->ci = new toba_ci_molde($this->asistente); + } + return $this->ci; + } + + public function cn() + { + if (!isset($this->cn)) { + $this->cn = new toba_cn_molde($this->asistente); + } + return $this->cn; + } + + public function set_ci($ci) + { + $this->ci = $ci; + } + + public function set_carpeta_item($id) + { + $this->datos->tabla('base')->set_fila_columna_valor(0, 'padre', $id); + } + + public function set_tipo_solicitud($id) + { + $this->datos->tabla('base')->set_fila_columna_valor(0, 'solicitud_tipo', $id); + } + + public function set_tipo_pagina($id, $proyecto=null) + { + if (!isset($proyecto)) { + $proyecto = 'toba'; + } + $this->datos->tabla('base')->set_fila_columna_valor(0, 'pagina_tipo_proyecto', $proyecto); + $this->datos->tabla('base')->set_fila_columna_valor(0, 'pagina_tipo', $id); + } + + public function set_acceso_menu($estado=true, $orden=0) + { + $this->datos->tabla('base')->set_fila_columna_valor(0, 'menu', $estado); + $this->datos->tabla('base')->set_fila_columna_valor(0, 'orden', $orden); + } + + public function cargar_grupos_acceso_activos() + { + foreach (toba_editor::get_perfiles_funcionales_previsualizacion() as $grupo) { + $this->datos->tabla('permisos')->nueva_fila(array('usuario_grupo_acc'=>$grupo)); + } + } + + public function set_accion($archivo) + { + $this->archivo = $archivo; + } + + //--------------------------------------------------- + //-- Generacion de METADATOS & ARCHIVOS + //--------------------------------------------------- + + public function generar() + { + //Abrir transaccion + if (isset($this->ci)) { + $this->ci->generar(); + $clave = $this->ci->get_clave_componente_generado(); + $this->asociar_objeto($clave['clave']); + } + if (isset($this->cn)) { + $this->cn->generar(); + $clave = $this->ci->get_clave_componente_generado(); + $this->asociar_objeto($clave['clave']); + } + parent::generar(); + } + + public function asociar_objeto($clave) + { + static $a = 0; + $this->datos->tabla('objetos')->nueva_fila(array('proyecto' => $this->proyecto, 'objeto' => $clave, 'orden' => $a)); + $a++; + } + + protected function get_codigo_php() + { + return ''; + } + + protected function asociar_archivo() + { + } + + public function get_clave_componente_generado() + { + $datos = $this->datos->tabla('base')->get_clave_valor(0); + return array( 'clave' => $datos['item'], + 'proyecto' => $datos['proyecto']); + } +} diff --git a/php/modelo/moldes_metadatos/toba_molde_cuadro_col.php b/php/modelo/moldes_metadatos/toba_molde_cuadro_col.php index f048fc8037..9434ac0821 100644 --- a/php/modelo/moldes_metadatos/toba_molde_cuadro_col.php +++ b/php/modelo/moldes_metadatos/toba_molde_cuadro_col.php @@ -1,46 +1,45 @@ -datos['clave'] = $identificador; - $this->datos['estilo'] = $estilo; - } - - //--------------------------------------------------- - //-- API de construccion - //--------------------------------------------------- - - function set_etiqueta($etiqueta) - { - $this->datos['titulo'] = $etiqueta; - } - - function set_estilo($estilo) - { - $this->datos['estilo'] = $estilo; - } - - function set_formato($formato) - { - $this->datos['formateo'] = $formato; - } - - function set_orden($orden) - { - $this->datos['orden'] = $orden; - } - - //--------------------------------------------------- - - function get_datos() - { - return $this->datos; - } -} -?> \ No newline at end of file +datos['clave'] = $identificador; + $this->datos['estilo'] = $estilo; + } + + //--------------------------------------------------- + //-- API de construccion + //--------------------------------------------------- + + public function set_etiqueta($etiqueta) + { + $this->datos['titulo'] = $etiqueta; + } + + public function set_estilo($estilo) + { + $this->datos['estilo'] = $estilo; + } + + public function set_formato($formato) + { + $this->datos['formateo'] = $formato; + } + + public function set_orden($orden) + { + $this->datos['orden'] = $orden; + } + + //--------------------------------------------------- + + public function get_datos() + { + return $this->datos; + } +} diff --git a/php/modelo/moldes_metadatos/toba_molde_datos_tabla_col.php b/php/modelo/moldes_metadatos/toba_molde_datos_tabla_col.php index 771b69008c..4485aef9bf 100644 --- a/php/modelo/moldes_metadatos/toba_molde_datos_tabla_col.php +++ b/php/modelo/moldes_metadatos/toba_molde_datos_tabla_col.php @@ -1,41 +1,40 @@ -datos['columna'] = $identificador; - $this->datos['tipo'] = $tipo; - } - - //--------------------------------------------------- - //-- API de construccion - //--------------------------------------------------- - - function set_secuencia($secuencia) - { - $this->datos['secuencia'] = $secuencia; - } - - function pk() - { - $this->datos['pk'] = 1; - } - - function externa() - { - $this->datos['externa'] = 1; - } - - //--------------------------------------------------- - - function get_datos() - { - return $this->datos; - } -} -?> \ No newline at end of file +datos['columna'] = $identificador; + $this->datos['tipo'] = $tipo; + } + + //--------------------------------------------------- + //-- API de construccion + //--------------------------------------------------- + + public function set_secuencia($secuencia) + { + $this->datos['secuencia'] = $secuencia; + } + + public function pk() + { + $this->datos['pk'] = 1; + } + + public function externa() + { + $this->datos['externa'] = 1; + } + + //--------------------------------------------------- + + public function get_datos() + { + return $this->datos; + } +} diff --git a/php/modelo/moldes_metadatos/toba_molde_ef.php b/php/modelo/moldes_metadatos/toba_molde_ef.php index 5ebc00564a..1ec6879d6a 100644 --- a/php/modelo/moldes_metadatos/toba_molde_ef.php +++ b/php/modelo/moldes_metadatos/toba_molde_ef.php @@ -1,81 +1,80 @@ -datos['identificador'] = $identificador; - $this->datos['elemento_formulario'] = $tipo; - $this->datos['etiqueta'] = $identificador; - $this->datos['columnas'] = $identificador; - } - - function get_identificador() - { - return $this->datos['identificador']; - } - - //--------------------------------------------------- - //-- API de construccion - //--------------------------------------------------- - - function set_etiqueta($etiqueta) - { - $this->datos['etiqueta'] = $etiqueta; - } - - function set_orden($orden) - { - $this->datos['orden'] = $orden; - } - - function set_columnas($columnas) - { - if(!is_array($columnas)){ - throw new error_toba('Las columnas deben definirse mediante un array'); - }else{ - $columnas = implode(', ',$columnas); - } - $this->datos['columnas'] = $columnas; - } - - function set_propiedad($nombre, $valor) - { - $this->datos[$nombre] = $valor; - } - - //--------------Relación con el datos_tabla de carga ----------------------- - - function tiene_carga_datos_tabla() - { - return isset($this->molde_datos_tabla); - } - - function set_molde_datos_tabla_carga($molde) - { - $this->molde_datos_tabla = $molde; - } - - /** - * Genera el datos_tabla utilizado para la tabla y lo asocia al parametro del ef - */ - function generar_datos_tabla_carga() - { - $this->molde_datos_tabla->generar(); - $clave = $this->molde_datos_tabla->get_clave_componente_generado(); - $this->datos['carga_dt'] = $clave['clave']; - } - - //------------------------------------------------------------------ - - function get_datos() - { - return $this->datos; - } -} -?> \ No newline at end of file +datos['identificador'] = $identificador; + $this->datos['elemento_formulario'] = $tipo; + $this->datos['etiqueta'] = $identificador; + $this->datos['columnas'] = $identificador; + } + + public function get_identificador() + { + return $this->datos['identificador']; + } + + //--------------------------------------------------- + //-- API de construccion + //--------------------------------------------------- + + public function set_etiqueta($etiqueta) + { + $this->datos['etiqueta'] = $etiqueta; + } + + public function set_orden($orden) + { + $this->datos['orden'] = $orden; + } + + public function set_columnas($columnas) + { + if (!is_array($columnas)) { + throw new error_toba('Las columnas deben definirse mediante un array'); + } else { + $columnas = implode(', ', $columnas); + } + $this->datos['columnas'] = $columnas; + } + + public function set_propiedad($nombre, $valor) + { + $this->datos[$nombre] = $valor; + } + + //--------------Relación con el datos_tabla de carga ----------------------- + + public function tiene_carga_datos_tabla() + { + return isset($this->molde_datos_tabla); + } + + public function set_molde_datos_tabla_carga($molde) + { + $this->molde_datos_tabla = $molde; + } + + /** + * Genera el datos_tabla utilizado para la tabla y lo asocia al parametro del ef + */ + public function generar_datos_tabla_carga() + { + $this->molde_datos_tabla->generar(); + $clave = $this->molde_datos_tabla->get_clave_componente_generado(); + $this->datos['carga_dt'] = $clave['clave']; + } + + //------------------------------------------------------------------ + + public function get_datos() + { + return $this->datos; + } +} diff --git a/php/modelo/moldes_metadatos/toba_molde_elemento.php b/php/modelo/moldes_metadatos/toba_molde_elemento.php index b6a06ed82b..5861e2a632 100644 --- a/php/modelo/moldes_metadatos/toba_molde_elemento.php +++ b/php/modelo/moldes_metadatos/toba_molde_elemento.php @@ -1,125 +1,125 @@ -asistente = $asistente; - $this->asistente->registrar_molde($this); - $this->id = $this->asistente->get_id_elemento(); - $this->proyecto = $this->asistente->get_proyecto(); - //Busco el datos relacion correspondientes al componente - $id = toba_info_editores::get_dr_de_clase($this->clase); - $componente = array('proyecto' => $id[0], 'componente' => $id[1]); - $this->datos = toba_constructor::get_runtime($componente); - $this->datos->inicializar(); - $datos = array( 'nombre'=>$this->clase.' generado automaticamente', - 'proyecto'=>$this->proyecto); - if ($this->asistente->tiene_fuente_definida()) { - $datos['fuente_datos_proyecto'] = $this->proyecto; - $datos['fuente_datos'] = $this->asistente->get_fuente(); - - } - $this->datos->tabla('base')->set($datos); - $this->ini(); - } - - /** - * Ventana para que cada componente setee su estado inicial - */ - function ini(){} - - //---------------------------------------------------- - //-- API CONSTRUCCION - //---------------------------------------------------- - - function set_nombre($nombre) - { - $this->datos->tabla('base')->set_fila_columna_valor(0,'nombre',$nombre); - } - - function set_punto_montaje($pm) - { - $this->datos->tabla('base')->set_fila_columna_valor(0, 'punto_montaje', $pm); - } - - //--------------------------------------------------- - //-- Generacion de METADATOS & ARCHIVOS - //--------------------------------------------------- - - function generar() - { - if (isset($this->archivo) ) { - if (!isset($this->carpeta_archivo)) { - throw new toba_error_asistentes('La carpeta no fue definida.'); - } - toba_manejador_archivos::crear_arbol_directorios(dirname($this->archivo_absoluto())); - if ($this->generar_archivo()) { - $this->asociar_archivo(); - } - } - $this->guardar_metadatos(); - } - - protected function generar_archivo() - { - $php = $this->get_codigo_php(); - toba_manejador_archivos::crear_archivo_con_datos($this->archivo_absoluto(), ""); - $this->asistente->registrar_elemento_creado('archivo', $this->proyecto, $this->archivo_relativo() ); - return true; - } - - protected function guardar_metadatos() - { - //ei_arbol($this->datos->get_conjunto_datos_interno(), $this->clase); - $this->datos->persistidor()->desactivar_transaccion(); - $this->datos->sincronizar(); - $clave = $this->get_clave_componente_generado(); - $this->asistente->registrar_elemento_creado($this->clase, $clave['proyecto'], $clave['clave'] ); - } - - function get_id_opcion_archivo() - { - return 'elemento_' . $this->id . '_archivo'; - } - - //-- PATHs ------------------------------------------------------------- - - function archivo_relativo() - { - return $this->directorio_relativo() .'/'. $this->archivo; - } - - function archivo_absoluto() - { - return $this->directorio_absoluto() .'/'. $this->archivo; - } - - function directorio_absoluto() - { - $path_proyecto = toba::instancia()->get_path_proyecto($this->proyecto); - return $path_proyecto . '/php/'. $this->directorio_relativo(); - } - - function directorio_relativo() - { - return $this->carpeta_archivo; - } -} -?> \ No newline at end of file +asistente = $asistente; + $this->asistente->registrar_molde($this); + $this->id = $this->asistente->get_id_elemento(); + $this->proyecto = $this->asistente->get_proyecto(); + //Busco el datos relacion correspondientes al componente + $id = toba_info_editores::get_dr_de_clase($this->clase); + $componente = array('proyecto' => $id[0], 'componente' => $id[1]); + $this->datos = toba_constructor::get_runtime($componente); + $this->datos->inicializar(); + $datos = array( 'nombre'=>$this->clase.' generado automaticamente', + 'proyecto'=>$this->proyecto); + if ($this->asistente->tiene_fuente_definida()) { + $datos['fuente_datos_proyecto'] = $this->proyecto; + $datos['fuente_datos'] = $this->asistente->get_fuente(); + } + $this->datos->tabla('base')->set($datos); + $this->ini(); + } + + /** + * Ventana para que cada componente setee su estado inicial + */ + public function ini() + { + } + + //---------------------------------------------------- + //-- API CONSTRUCCION + //---------------------------------------------------- + + public function set_nombre($nombre) + { + $this->datos->tabla('base')->set_fila_columna_valor(0, 'nombre', $nombre); + } + + public function set_punto_montaje($pm) + { + $this->datos->tabla('base')->set_fila_columna_valor(0, 'punto_montaje', $pm); + } + + //--------------------------------------------------- + //-- Generacion de METADATOS & ARCHIVOS + //--------------------------------------------------- + + public function generar() + { + if (isset($this->archivo)) { + if (!isset($this->carpeta_archivo)) { + throw new toba_error_asistentes('La carpeta no fue definida.'); + } + toba_manejador_archivos::crear_arbol_directorios(dirname($this->archivo_absoluto())); + if ($this->generar_archivo()) { + $this->asociar_archivo(); + } + } + $this->guardar_metadatos(); + } + + protected function generar_archivo() + { + $php = $this->get_codigo_php(); + toba_manejador_archivos::crear_archivo_con_datos($this->archivo_absoluto(), ""); + $this->asistente->registrar_elemento_creado('archivo', $this->proyecto, $this->archivo_relativo()); + return true; + } + + protected function guardar_metadatos() + { + //ei_arbol($this->datos->get_conjunto_datos_interno(), $this->clase); + $this->datos->persistidor()->desactivar_transaccion(); + $this->datos->sincronizar(); + $clave = $this->get_clave_componente_generado(); + $this->asistente->registrar_elemento_creado($this->clase, $clave['proyecto'], $clave['clave']); + } + + public function get_id_opcion_archivo() + { + return 'elemento_' . $this->id . '_archivo'; + } + + //-- PATHs ------------------------------------------------------------- + + public function archivo_relativo() + { + return $this->directorio_relativo() .'/'. $this->archivo; + } + + public function archivo_absoluto() + { + return $this->directorio_absoluto() .'/'. $this->archivo; + } + + public function directorio_absoluto() + { + $path_proyecto = toba::instancia()->get_path_proyecto($this->proyecto); + return $path_proyecto . '/php/'. $this->directorio_relativo(); + } + + public function directorio_relativo() + { + return $this->carpeta_archivo; + } +} diff --git a/php/modelo/moldes_metadatos/toba_molde_elemento_componente.php b/php/modelo/moldes_metadatos/toba_molde_elemento_componente.php index 8bc233f5f2..3e20f399b8 100644 --- a/php/modelo/moldes_metadatos/toba_molde_elemento_componente.php +++ b/php/modelo/moldes_metadatos/toba_molde_elemento_componente.php @@ -1,110 +1,109 @@ -datos->tabla('base')->get_clave_valor(0); - $sql = 'SELECT pm_contexto FROM apex_proyecto WHERE proyecto = '.$db->quote($datos['proyecto']); - $rs = $db->consultar_fila($sql); - $this->datos->tabla('base')->set_fila_columna_valor(0,'punto_montaje', $rs['pm_contexto']); - $this->datos->tabla('base')->set_fila_columna_valor(0,'clase',$this->clase); - $this->datos->tabla('base')->set_fila_columna_valor(0,'clase_proyecto',$this->clase_proyecto); - $this->carpeta_archivo = $this->asistente->get_carpeta_archivos(); - } - - function get_clase() - { - if (isset($this->clase)) { - return $this->clase; - } - } - - //--------------------------------------------------- - //-- Extension de clases - //--------------------------------------------------- - - /** - * Declara la extension del archivo, despues de su invocacion se puede usar - * el metodo php() para acceder al molde de la clase - */ - function extender($subclase, $archivo) - { - if(!isset($this->molde_php)) { - $this->subclase = $subclase; - $this->archivo = $archivo; - $extensiones = toba_info_editores::get_clases_extendidas_proyecto($this->proyecto); - $nombre_clase = get_nombre_clase_extendida($this->clase, $this->proyecto, $extensiones); - $this->molde_php = new toba_codigo_clase( $this->subclase, $nombre_clase); - //Dejo la marca - if (file_exists($this->archivo_absoluto())) { - /*$txt = "Reemplazar archivo: " . $this->archivo_relativo(); - $ayuda = "Si no desea reemplazar el archivo, modifique el molde especificando otra carpeta de destino u otro prefijo para la generacion de clases."; - $this->asistente->agregar_opcion_generacion( $this->get_id_opcion_archivo(), $txt, $ayuda );*/ - } - } - } - - /** - * Tiene una subclase? - * @return boolean - */ - function extendido() - { - return $this->datos->tabla('base')->get_columna('subclase') != ''; - } - - function php() - { - return $this->molde_php; - } - - //--------------------------------------------------- - //-- Generacion de METADATOS & ARCHIVOS - //--------------------------------------------------- - - protected function get_codigo_php() - { - $existente = null; - if (!$this->pisar_archivo && file_exists($this->archivo_absoluto())) { - $existente = toba_archivo_php::codigo_sacar_tags_php(file_get_contents($this->archivo_absoluto())); - } - return $this->molde_php->get_codigo($existente); - } - - protected function asociar_archivo() - { - $this->datos->tabla('base')->set_fila_columna_valor(0,'subclase',$this->subclase); - $this->datos->tabla('base')->set_fila_columna_valor(0,'subclase_archivo',$this->archivo_relativo()); - } - - function get_clave_componente_generado() - { - $datos = $this->datos->tabla('base')->get_clave_valor(0); - return array('clave' => $datos['objeto'], 'proyecto' => $datos['proyecto']); - } - - //---------------------------------------------------------- - // Ubicacion mediante punto de montaje - //---------------------------------------------------------- - function directorio_absoluto() - { - $datos = $this->datos->tabla('base')->get_fila(0); - if (!is_null($datos['punto_montaje']) && ($datos['punto_montaje'] !== 0)) { - $punto_montaje = toba_pms::instancia()->get_instancia_pm_proyecto($datos['proyecto'], $datos['punto_montaje']); - return $punto_montaje->get_path_absoluto(). '/' . $this->directorio_relativo(); - } else { - return parent::directorio_absoluto(); - } - } -} -?> \ No newline at end of file +datos->tabla('base')->get_clave_valor(0); + $sql = 'SELECT pm_contexto FROM apex_proyecto WHERE proyecto = '.$db->quote($datos['proyecto']); + $rs = $db->consultar_fila($sql); + $this->datos->tabla('base')->set_fila_columna_valor(0, 'punto_montaje', $rs['pm_contexto']); + $this->datos->tabla('base')->set_fila_columna_valor(0, 'clase', $this->clase); + $this->datos->tabla('base')->set_fila_columna_valor(0, 'clase_proyecto', $this->clase_proyecto); + $this->carpeta_archivo = $this->asistente->get_carpeta_archivos(); + } + + public function get_clase() + { + if (isset($this->clase)) { + return $this->clase; + } + } + + //--------------------------------------------------- + //-- Extension de clases + //--------------------------------------------------- + + /** + * Declara la extension del archivo, despues de su invocacion se puede usar + * el metodo php() para acceder al molde de la clase + */ + public function extender($subclase, $archivo) + { + if (!isset($this->molde_php)) { + $this->subclase = $subclase; + $this->archivo = $archivo; + $extensiones = toba_info_editores::get_clases_extendidas_proyecto($this->proyecto); + $nombre_clase = get_nombre_clase_extendida($this->clase, $this->proyecto, $extensiones); + $this->molde_php = new toba_codigo_clase($this->subclase, $nombre_clase); + //Dejo la marca + if (file_exists($this->archivo_absoluto())) { + /*$txt = "Reemplazar archivo: " . $this->archivo_relativo(); + $ayuda = "Si no desea reemplazar el archivo, modifique el molde especificando otra carpeta de destino u otro prefijo para la generacion de clases."; + $this->asistente->agregar_opcion_generacion( $this->get_id_opcion_archivo(), $txt, $ayuda );*/ + } + } + } + + /** + * Tiene una subclase? + * @return boolean + */ + public function extendido() + { + return $this->datos->tabla('base')->get_columna('subclase') != ''; + } + + public function php() + { + return $this->molde_php; + } + + //--------------------------------------------------- + //-- Generacion de METADATOS & ARCHIVOS + //--------------------------------------------------- + + protected function get_codigo_php() + { + $existente = null; + if (!$this->pisar_archivo && file_exists($this->archivo_absoluto())) { + $existente = toba_archivo_php::codigo_sacar_tags_php(file_get_contents($this->archivo_absoluto())); + } + return $this->molde_php->get_codigo($existente); + } + + protected function asociar_archivo() + { + $this->datos->tabla('base')->set_fila_columna_valor(0, 'subclase', $this->subclase); + $this->datos->tabla('base')->set_fila_columna_valor(0, 'subclase_archivo', $this->archivo_relativo()); + } + + public function get_clave_componente_generado() + { + $datos = $this->datos->tabla('base')->get_clave_valor(0); + return array('clave' => $datos['objeto'], 'proyecto' => $datos['proyecto']); + } + + //---------------------------------------------------------- + // Ubicacion mediante punto de montaje + //---------------------------------------------------------- + public function directorio_absoluto() + { + $datos = $this->datos->tabla('base')->get_fila(0); + if (!is_null($datos['punto_montaje']) && ($datos['punto_montaje'] !== 0)) { + $punto_montaje = toba_pms::instancia()->get_instancia_pm_proyecto($datos['proyecto'], $datos['punto_montaje']); + return $punto_montaje->get_path_absoluto(). '/' . $this->directorio_relativo(); + } else { + return parent::directorio_absoluto(); + } + } +} diff --git a/php/modelo/moldes_metadatos/toba_molde_elemento_componente_datos.php b/php/modelo/moldes_metadatos/toba_molde_elemento_componente_datos.php index 90824564b1..51ec8c9669 100644 --- a/php/modelo/moldes_metadatos/toba_molde_elemento_componente_datos.php +++ b/php/modelo/moldes_metadatos/toba_molde_elemento_componente_datos.php @@ -1,34 +1,33 @@ -archivo; - } - - function archivo_absoluto() - { - return $this->directorio_absoluto() .'/'. $this->archivo; - } - - function directorio_absoluto() - { - $datos = $this->datos->tabla('base')->get_fila(0); - if (!is_null($datos['punto_montaje']) && ($datos['punto_montaje'] !== 0)) { - $punto_montaje = toba_pms::instancia()->get_instancia_pm_proyecto($datos['proyecto'], $datos['punto_montaje']); - return $punto_montaje->get_path_absoluto(). '/' ; - } else { - return parent::directorio_absoluto(); - } - } - - function directorio_relativo() - { - //Redefino para eliminar comportamiento, el directorio ya esta incluido dentro de $this->archvo - } -} -?> \ No newline at end of file +archivo; + } + + public function archivo_absoluto() + { + return $this->directorio_absoluto() .'/'. $this->archivo; + } + + public function directorio_absoluto() + { + $datos = $this->datos->tabla('base')->get_fila(0); + if (!is_null($datos['punto_montaje']) && ($datos['punto_montaje'] !== 0)) { + $punto_montaje = toba_pms::instancia()->get_instancia_pm_proyecto($datos['proyecto'], $datos['punto_montaje']); + return $punto_montaje->get_path_absoluto(). '/' ; + } else { + return parent::directorio_absoluto(); + } + } + + public function directorio_relativo() + { + //Redefino para eliminar comportamiento, el directorio ya esta incluido dentro de $this->archvo + } +} diff --git a/php/modelo/moldes_metadatos/toba_molde_elemento_componente_ei.php b/php/modelo/moldes_metadatos/toba_molde_elemento_componente_ei.php index 102461a979..dd41b13625 100644 --- a/php/modelo/moldes_metadatos/toba_molde_elemento_componente_ei.php +++ b/php/modelo/moldes_metadatos/toba_molde_elemento_componente_ei.php @@ -1,65 +1,64 @@ -datos->tabla('base')->set_fila_columna_valor(0,'titulo',$titulo); - } - - function agregar_evento($identificador) - { - $this->eventos[$identificador] = new toba_molde_evento($identificador); - $this->eventos[$identificador]->set_orden($this->proximo_evento); - $this->proximo_evento++; - return $this->eventos[$identificador]; - } - - function evento($identificador) - { - if(!isset($this->eventos[$identificador])) { - throw new toba_error_asistentes('Molde formulario: El evento solicitado no existe'); - } - return $this->eventos[$identificador]; - } - - function set_ancho($ancho) - { - if((strpos($ancho,'%')===false) && (strpos($ancho,'px')===false)) { - throw new toba_error_asistentes("MOLDE CUADRO: El ancho debe definirse con el tipo de medida asociado ('%' o 'px'). Definido: $ancho"); - } - $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0,'ancho',$ancho); - } - - //--------------------------------------------------- - //-- Generacion de METADATOS & ARCHIVOS - //--------------------------------------------------- - - function generar() - { - foreach($this->eventos as $evento) { - $this->datos->tabla('eventos')->nueva_fila($evento->get_datos()); - } - $this->asociar_eventos_a_pantallas(); - parent::generar(); - } - - function asociar_eventos_a_pantallas() - { - //Ventana de extension para que se decida como asociar los eventos a pantallas. - //Se hace mediante callback porque necesito hacerlo antes de ir al parent que sincroniza - //Y quien hereda esta clase recien tiene el datos_tabla cargado cuando ya ha pasado - //por toda su generacion. - } -} -?> \ No newline at end of file +datos->tabla('base')->set_fila_columna_valor(0, 'titulo', $titulo); + } + + public function agregar_evento($identificador) + { + $this->eventos[$identificador] = new toba_molde_evento($identificador); + $this->eventos[$identificador]->set_orden($this->proximo_evento); + $this->proximo_evento++; + return $this->eventos[$identificador]; + } + + public function evento($identificador) + { + if (!isset($this->eventos[$identificador])) { + throw new toba_error_asistentes('Molde formulario: El evento solicitado no existe'); + } + return $this->eventos[$identificador]; + } + + public function set_ancho($ancho) + { + if ((strpos($ancho, '%')===false) && (strpos($ancho, 'px')===false)) { + throw new toba_error_asistentes("MOLDE CUADRO: El ancho debe definirse con el tipo de medida asociado ('%' o 'px'). Definido: $ancho"); + } + $this->datos->tabla('prop_basicas')->set_fila_columna_valor(0, 'ancho', $ancho); + } + + //--------------------------------------------------- + //-- Generacion de METADATOS & ARCHIVOS + //--------------------------------------------------- + + public function generar() + { + foreach ($this->eventos as $evento) { + $this->datos->tabla('eventos')->nueva_fila($evento->get_datos()); + } + $this->asociar_eventos_a_pantallas(); + parent::generar(); + } + + public function asociar_eventos_a_pantallas() + { + //Ventana de extension para que se decida como asociar los eventos a pantallas. + //Se hace mediante callback porque necesito hacerlo antes de ir al parent que sincroniza + //Y quien hereda esta clase recien tiene el datos_tabla cargado cuando ya ha pasado + //por toda su generacion. + } +} diff --git a/php/modelo/moldes_metadatos/toba_molde_evento.php b/php/modelo/moldes_metadatos/toba_molde_evento.php index 4a31c2455d..bf6e555a65 100644 --- a/php/modelo/moldes_metadatos/toba_molde_evento.php +++ b/php/modelo/moldes_metadatos/toba_molde_evento.php @@ -1,97 +1,96 @@ -datos['identificador'] = $identificador; - } - - function get_identificador() - { - return $this->datos['identificador']; - } - - //--------------------------------------------------- - //-- API de construccion - //--------------------------------------------------- - - function set_etiqueta($etiqueta) - { - $this->datos['etiqueta'] = $etiqueta; - } - - function set_orden($orden) - { - $this->datos['orden'] = $orden; - } - - function maneja_datos() - { - $this->datos['maneja_datos'] = 1; - } - - function en_botonera($activar=true) - { - $estado = $activar ? 1 : 0; - $this->datos['en_botonera'] = $estado; - $this->datos['sobre_fila'] = 1 - $estado; - } - - function sobre_fila() - { - $this->datos['sobre_fila'] = 1; - $this->datos['en_botonera'] = 0; - } - - function implicito() - { - $this->datos['implicito'] = 1; - $this->datos['sobre_fila'] = 0; - $this->datos['en_botonera'] = 0; - } - - function set_predeterminado() - { - $this->datos['defecto'] = 1; - } - - function set_imagen($url_relativa, $origen='apex') - { - if ($origen != 'apex' && $origen != 'proyecto' ) { - throw new toba_error_asistentes("Molde EVENTO: El origen de la imagen debe ser 'apex' o 'proyecto'. Valor recibido: $origen"); - } - $this->datos['imagen_recurso_origen'] = $origen; - $this->datos['imagen'] = $url_relativa; - } - - function set_grupos($grupos) - { - if(is_array($grupos)){ - $grupos = implode(',',$grupos); - } - $this->datos['grupo'] = $grupos; - } - - function set_confirmacion($mensaje) - { - $this->datos['confirmacion'] = $mensaje; - } - - function set_estilo($estilo) - { - $this->datos['estilo'] = $estilo; - } - - //--------------------------------------------------- - - function get_datos() - { - return $this->datos; - } -} -?> \ No newline at end of file +datos['identificador'] = $identificador; + } + + public function get_identificador() + { + return $this->datos['identificador']; + } + + //--------------------------------------------------- + //-- API de construccion + //--------------------------------------------------- + + public function set_etiqueta($etiqueta) + { + $this->datos['etiqueta'] = $etiqueta; + } + + public function set_orden($orden) + { + $this->datos['orden'] = $orden; + } + + public function maneja_datos() + { + $this->datos['maneja_datos'] = 1; + } + + public function en_botonera($activar=true) + { + $estado = $activar ? 1 : 0; + $this->datos['en_botonera'] = $estado; + $this->datos['sobre_fila'] = 1 - $estado; + } + + public function sobre_fila() + { + $this->datos['sobre_fila'] = 1; + $this->datos['en_botonera'] = 0; + } + + public function implicito() + { + $this->datos['implicito'] = 1; + $this->datos['sobre_fila'] = 0; + $this->datos['en_botonera'] = 0; + } + + public function set_predeterminado() + { + $this->datos['defecto'] = 1; + } + + public function set_imagen($url_relativa, $origen='apex') + { + if ($origen != 'apex' && $origen != 'proyecto') { + throw new toba_error_asistentes("Molde EVENTO: El origen de la imagen debe ser 'apex' o 'proyecto'. Valor recibido: $origen"); + } + $this->datos['imagen_recurso_origen'] = $origen; + $this->datos['imagen'] = $url_relativa; + } + + public function set_grupos($grupos) + { + if (is_array($grupos)) { + $grupos = implode(',', $grupos); + } + $this->datos['grupo'] = $grupos; + } + + public function set_confirmacion($mensaje) + { + $this->datos['confirmacion'] = $mensaje; + } + + public function set_estilo($estilo) + { + $this->datos['estilo'] = $estilo; + } + + //--------------------------------------------------- + + public function get_datos() + { + return $this->datos; + } +} diff --git a/php/modelo/moldes_metadatos/toba_molde_tipo_pagina.php b/php/modelo/moldes_metadatos/toba_molde_tipo_pagina.php index b8a66763f5..516ebb63b7 100644 --- a/php/modelo/moldes_metadatos/toba_molde_tipo_pagina.php +++ b/php/modelo/moldes_metadatos/toba_molde_tipo_pagina.php @@ -1,64 +1,64 @@ id = $this->asistente->get_id_elemento(); + $this->proyecto = $this->asistente->get_proyecto(); + //Busco el datos relacion correspondientes al componente + $id = toba_info_editores::get_dr_de_clase($this->clase); + $componente = array('proyecto' => $id[0], 'componente' => $id[1]); + $this->datos = toba_constructor::get_runtime($componente); + $this->datos->inicializar(); + $datos = array( 'nombre'=>$this->clase.' generado automaticamente', + 'proyecto'=>$this->proyecto); + $this->ini(); + } - function __construct($asistente) - { - $this->id = $this->asistente->get_id_elemento(); - $this->proyecto = $this->asistente->get_proyecto(); - //Busco el datos relacion correspondientes al componente - $id = toba_info_editores::get_dr_de_clase($this->clase); - $componente = array('proyecto' => $id[0], 'componente' => $id[1]); - $this->datos = toba_constructor::get_runtime($componente); - $this->datos->inicializar(); - $datos = array( 'nombre'=>$this->clase.' generado automaticamente', - 'proyecto'=>$this->proyecto); - $this->ini(); - } + public function ini() + { + $this->datos->set_fila_columna_valor(0, 'proyecto', $this->proyecto); + } - function ini() - { - $this->datos->set_fila_columna_valor(0,'proyecto',$this->proyecto); - } + public function cargar($tipo) + { + $this->datos->cargar(array('proyecto' => $this->proyecto, 'pagina_tipo' => $tipo)); + } - function cargar($tipo) - { - $this->datos->cargar(array('proyecto' => $this->proyecto, 'pagina_tipo' => $tipo)); - } + //-------------------------------------------------------------------------------------------------------- + public function set_tipo_pagina($tipo) + { + $this->datos->set_fila_columna_valor(0, 'pagina_tipo', $tipo); + } - //-------------------------------------------------------------------------------------------------------- - function set_tipo_pagina($tipo) - { - $this->datos->set_fila_columna_valor(0, 'pagina_tipo', $tipo); - } + public function set_descripcion($descripcion) + { + $this->datos->set_fila_columna_valor(0, 'descripcion', $descripcion); + } - function set_descripcion($descripcion) - { - $this->datos->set_fila_columna_valor(0, 'descripcion', $descripcion); - } + public function set_clase_nombre($clase) + { + $this->datos->set_fila_columna_valor(0, 'clase_nombre', $clase); + } - function set_clase_nombre($clase) - { - $this->datos->set_fila_columna_valor(0, 'clase_nombre', $clase); - } + public function set_clase_archivo($archivo) + { + $this->datos->set_fila_columna_valor(0, 'clase_archivo', $archivo); + } - function set_clase_archivo($archivo) - { - $this->datos->set_fila_columna_valor(0, 'clase_archivo', $archivo); - } + public function set_punto_montaje($pm) + { + $this->datos->set_fila_columna_valor(0, 'punto_montaje', $pm); + } - function set_punto_montaje($pm) - { - $this->datos->set_fila_columna_valor(0, 'punto_montaje', $pm); - } - - //----------------------------------------------------------------------------------------------------------- - function get_clave_componente_generado() - { - $datos = $this->datos->get_clave_valor(0); - return array('tipo_pagina' => $datos['tipo_pagina'], - 'proyecto' => $datos['proyecto']); - } + //----------------------------------------------------------------------------------------------------------- + public function get_clave_componente_generado() + { + $datos = $this->datos->get_clave_valor(0); + return array('tipo_pagina' => $datos['tipo_pagina'], + 'proyecto' => $datos['proyecto']); + } } -?> diff --git a/php/modelo/moldes_metadatos/toba_molde_zona.php b/php/modelo/moldes_metadatos/toba_molde_zona.php index 3e0542e15d..a4ca3e4be0 100644 --- a/php/modelo/moldes_metadatos/toba_molde_zona.php +++ b/php/modelo/moldes_metadatos/toba_molde_zona.php @@ -1,76 +1,76 @@ asistente = $asistente; + $this->asistente->registrar_molde($this); + $this->id = $this->asistente->get_id_elemento(); + $this->proyecto = $this->asistente->get_proyecto(); + //Busco el datos relacion correspondientes al componente + $id = toba_info_editores::get_dr_de_clase($this->clase); //TODO:Esto quizas no lo encuentre + $componente = array('proyecto' => $id[0], 'componente' => $id[1]); + $this->datos = toba_constructor::get_runtime($componente); + $this->datos->inicializar(); + $datos = array( 'nombre'=>$this->clase.' generado automaticamente', + 'proyecto'=>$this->proyecto); + $this->ini(); + } - function __construct($asistente) - { - $this->asistente = $asistente; - $this->asistente->registrar_molde($this); - $this->id = $this->asistente->get_id_elemento(); - $this->proyecto = $this->asistente->get_proyecto(); - //Busco el datos relacion correspondientes al componente - $id = toba_info_editores::get_dr_de_clase($this->clase); //TODO:Esto quizas no lo encuentre - $componente = array('proyecto' => $id[0], 'componente' => $id[1]); - $this->datos = toba_constructor::get_runtime($componente); - $this->datos->inicializar(); - $datos = array( 'nombre'=>$this->clase.' generado automaticamente', - 'proyecto'=>$this->proyecto); - $this->ini(); - } + public function ini() + { + $this->datos->set_fila_columna_valor(0, 'proyecto', $this->proyecto); + } - function ini() - { - $this->datos->set_fila_columna_valor(0,'proyecto',$this->proyecto); - } + public function cargar($zona) + { + $this->datos->cargar(array('proyecto' => $this->proyecto, 'zona' => $zona)); + } - function cargar($zona) - { - $this->datos->cargar(array('proyecto' => $this->proyecto, 'zona' => $zona)); - } + //-------------------------------------------------------------------------------------------------------- + public function set_identificador_zona($zona) + { + $this->datos->set_fila_columna_valor(0, 'zona', $zona); + } - //-------------------------------------------------------------------------------------------------------- - function set_identificador_zona($zona) - { - $this->datos->set_fila_columna_valor(0, 'zona', $zona); - } + public function set_descripcion($descripcion) + { + $this->datos->set_fila_columna_valor(0, 'nombre', $descripcion); + } - function set_descripcion($descripcion) - { - $this->datos->set_fila_columna_valor(0, 'nombre', $descripcion); - } + public function set_archivo($archivo) + { + $this->datos->set_fila_columna_valor(0, 'archivo', $archivo); + } - function set_archivo($archivo) - { - $this->datos->set_fila_columna_valor(0, 'archivo', $archivo); - } + public function set_clase_consulta($clase) + { + $this->datos->set_fila_columna_valor(0, 'consulta_clase', $clase); + } - function set_clase_consulta($clase) - { - $this->datos->set_fila_columna_valor(0, 'consulta_clase', $clase); - } + public function set_archivo_consulta($archivo) + { + $this->datos->set_fila_columna_valor(0, 'consulta_archivo', $archivo); + } - function set_archivo_consulta($archivo) - { - $this->datos->set_fila_columna_valor(0, 'consulta_archivo', $archivo); - } + public function set_metodo_consulta($metodo) + { + $this->datos->set_fila_columna_valor(0, 'consulta_metodo', $metodo); + } - function set_metodo_consulta($metodo) - { - $this->datos->set_fila_columna_valor(0, 'consulta_metodo', $metodo); - } + public function set_punto_montaje($pm) + { + $this->datos->set_fila_columna_valor(0, 'punto_montaje', $pm); + } - function set_punto_montaje($pm) - { - $this->datos->set_fila_columna_valor(0, 'punto_montaje', $pm); - } - - //----------------------------------------------------------------------------------------------------------- - function get_clave_componente_generado() - { - $datos = $this->datos->get_clave_valor(0); - return array('zona' => $datos['zona'], - 'proyecto' => $datos['proyecto']); - } + //----------------------------------------------------------------------------------------------------------- + public function get_clave_componente_generado() + { + $datos = $this->datos->get_clave_valor(0); + return array('zona' => $datos['zona'], + 'proyecto' => $datos['proyecto']); + } } -?> diff --git a/php/modelo/toba_modelo_instalacion.php b/php/modelo/toba_modelo_instalacion.php index 216829e166..c4f9ec52f8 100644 --- a/php/modelo/toba_modelo_instalacion.php +++ b/php/modelo/toba_modelo_instalacion.php @@ -11,7 +11,7 @@ class toba_modelo_instalacion extends toba_modelo_elemento static protected $conexion_externa; const db_encoding_estandar = 'LATIN1'; const info_basica = 'instalacion.ini'; - const info_basica_titulo = 'Configuracion de la INSTALACION'; + const info_basica_titulo = 'Configuracion de la INSTALACIÓN'; const info_bases = 'bases.ini'; const info_bases_titulo = 'Configuracion de BASES de DATOS'; private $dir; // Directorio con info de la instalacion. @@ -21,7 +21,7 @@ class toba_modelo_instalacion extends toba_modelo_elemento function __construct() { $this->dir = self::dir_base(); - toba_logger::instancia()->debug('INSTALACION "'.$this->dir.'"'); + toba_logger::instancia()->debug('INSTALACIÓN "'.$this->dir.'"'); } function cargar_info_ini($forzar_recarga=false) @@ -30,8 +30,8 @@ function cargar_info_ini($forzar_recarga=false) //--- Levanto la CONFIGURACION de bases $archivo_ini_bases = $this->dir . '/' . self::info_bases; if ( ! is_file( $archivo_ini_bases ) ) { - toba_logger::instancia()->error("INSTALACION: La instalacion '".toba_dir()."' es invalida. (El archivo de configuracion '$archivo_ini_bases' no existe)"); - throw new toba_error('INSTALACION: La instalacion es invalida. (El archivo de configuracion no existe) Revise el log'); + toba_logger::instancia()->error("INSTALACIÓN: La instalación '".toba_dir()."' es inválida. (El archivo de configuración '$archivo_ini_bases' no existe)"); + throw new toba_error('INSTALACIÓN: La instalación es inválida. (El archivo de configuración no existe) Revise el log'); } else { // BASE $pendientes = array(); @@ -54,8 +54,8 @@ function cargar_info_ini($forzar_recarga=false) //--- Levanto la CONFIGURACION de bases $archivo_ini_instalacion = $this->dir . '/' . self::info_basica; if ( ! is_file( $archivo_ini_instalacion ) ) { - toba_logger::instancia()->error("INSTALACION: La instalacion '".toba_dir()."' es invalida. (El archivo de configuracion '$archivo_ini_instalacion' no existe)"); - throw new toba_error('INSTALACION: La instalacion es invalida. (El archivo de configuracion no existe) Revise el log'); + toba_logger::instancia()->error("INSTALACIÓN: La instalación '".toba_dir()."' es inválida. (El archivo de configuración '$archivo_ini_instalacion' no existe)"); + throw new toba_error('INSTALACIÓN: La instalación es inválida. (El archivo de configuración no existe) Revise el log'); } $this->ini_cargado = true; } @@ -212,8 +212,8 @@ function get_parametros_base( $id_base ) if ( isset( $this->ini_bases[$id_base] ) ) { return $this->ini_bases[$id_base]; } else { - toba_logger::instancia()->error("INSTALACION: La base '$id_base' no existe en el archivo bases.ini"); - throw new toba_error('INSTALACION: La base solicitada no existe en el archivo bases.ini'); + toba_logger::instancia()->error("INSTALACIÓN: La base '$id_base' no existe en el archivo bases.ini"); + throw new toba_error('INSTALACIÓN: La base solicitada no existe en el archivo bases.ini'); } } @@ -328,7 +328,7 @@ function crear_base_datos($nombre, $con_encoding = false, $cant_intentos = 3) $db->destruir(); toba_logger::instancia()->debug("Creada base '$base_a_crear'"); } else { - throw new toba_error('INSTALACION: El metodo no esta definido para el motor especificado'); + throw new toba_error('INSTALACIÓN: El método no esta definido para el motor especificado'); } } @@ -350,7 +350,7 @@ function borrar_base_datos( $nombre ) $db->ejecutar($sql); $db->destruir(); }else{ - throw new toba_error('INSTALACION: El metodo no esta definido para el motor especificado'); + throw new toba_error('INSTALACIÓN: El método no esta definido para el motor especificado'); } } @@ -645,7 +645,7 @@ static function get_lista_proyectos() return toba_manejador_archivos::get_subdirectorios($dir); } - //-- Archivo de CONFIGURACION de la INSTALACION -------------------------------------- + //-- Archivo de CONFIGURACION de la INSTALACIÓN -------------------------------------- /** * Crea el archivo con la informacion basica sobre la instalacion @@ -722,8 +722,8 @@ static function crear_info_bases( $lista_bases = array() ) isset( $base['base'] ) ) { $ini->agregar_entrada( $id, $base ); } else { - toba_logger::instancia()->error("La definicion de la BASE '$id' es INCORRECTA."); - throw new toba_error("La definicion especificada para una BASE es INCORRECTA. Revise el log"); + toba_logger::instancia()->error("La definición de la BASE '$id' es INCORRECTA."); + throw new toba_error("La definición especificada para una BASE es INCORRECTA. Revise el log"); } } $ini->guardar( self::archivo_info_bases() ); @@ -733,20 +733,20 @@ static function crear_info_bases( $lista_bases = array() ) static private function validar_parametros_db($parametros) { if ( ! is_array( $parametros ) ) { - throw new toba_error('INSTALACION: Los parametros definidos son incorrectos'); + throw new toba_error('INSTALACIÓN: Los parámetros definidos son incorrectos'); } else { // Estan todos los parametros if ( !isset( $parametros['motor'] ) || !isset( $parametros['profile'] ) || !isset( $parametros['usuario'] ) || !isset( $parametros['base'] ) ) { - throw new toba_error('INSTALACION: Los parametros definidos son incorrectos'); + throw new toba_error('INSTALACIÓN: Los parámetros definidos son incorrectos'); } // El motor es reconocido $motores = array('postgres7', 'informix', 'mysql', 'odbc', 'sqlserver'); if( ! in_array( $parametros['motor'], $motores ) ) { - toba_logger::instancia()->error("INSTALACION: El motor tiene que pertenecer a la siguente lista: " . implode(', ',$motores)); - throw new toba_error('INSTALACION: El motor especificado no se encuentra entre los reconocidos, revise el log'); + toba_logger::instancia()->error("INSTALACIÓN: El motor tiene que pertenecer a la siguente lista: " . implode(', ',$motores)); + throw new toba_error('INSTALACIÓN: El motor especificado no se encuentra entre los reconocidos, revise el log'); } } } @@ -900,12 +900,12 @@ function importar_migrar_proyecto($id_instancia, $id_proyecto, $dir_toba_viejo, $archivo_ini_bases = $dir_toba_viejo.'/instalacion/bases.ini'; if (! file_exists($archivo_ini_bases)) { toba_logger::instancia()->error("No se encuentra el archivo $archivo_ini_bases"); - throw new toba_error('No se encuentra el archivo de configuracion, revise el log'); + throw new toba_error('No se encuentra el archivo de configuración, revise el log'); } $archivo_instancia = $dir_toba_viejo."/instalacion/i__$id_instancia/instancia.ini"; if (! file_exists($archivo_instancia)) { toba_logger::instancia()->error("No se encuentra el archivo $archivo_instancia"); - throw new toba_error('No se encuentra el archivo de configuracion, revise el log'); + throw new toba_error('No se encuentra el archivo de configuración, revise el log'); } $conf_instancia = parse_ini_file($archivo_instancia, true); $id_base_instancia = $instancia->get_ini_base(); diff --git a/php/modelo/toba_modelo_instancia.php b/php/modelo/toba_modelo_instancia.php index 375bf224f5..621fe05827 100644 --- a/php/modelo/toba_modelo_instancia.php +++ b/php/modelo/toba_modelo_instancia.php @@ -37,8 +37,8 @@ function __construct( toba_modelo_instalacion $instalacion, $identificador ) $this->instalacion = $instalacion; $this->dir = $this->instalacion->get_dir() . '/' . self::dir_prefijo . $this->identificador; if( ! is_dir( $this->dir ) ) { - toba_logger::instancia()->error("INSTANCIA: La instancia '{$this->identificador}' es invalida. (la carpeta '{$this->dir}' no existe)"); - throw new toba_error('INSTANCIA: La instancia es invalida. (la carpeta correspondiente no existe) revise el log'); + toba_logger::instancia()->error("INSTANCIA: La instancia '{$this->identificador}' es inválida. (la carpeta '{$this->dir}' no existe)"); + throw new toba_error('INSTANCIA: La instancia es inválida. (la carpeta correspondiente no existe) revise el log'); } //Solo se sincronizan los SQLs $this->cargar_info_ini(); @@ -67,8 +67,8 @@ function cargar_info_ini() { $archivo_ini = $this->dir . '/' . self::toba_instancia; if ( ! is_file( $archivo_ini ) ) { - toba_logger::instancia()->error("INSTANCIA: La instancia '{$this->identificador}' es invalida. (El archivo de configuracion '$archivo_ini' no existe)"); - throw new toba_error('INSTANCIA: La instancia es invalida. (El archivo de configuracion no existe) revise el log'); + toba_logger::instancia()->error("INSTANCIA: La instancia '{$this->identificador}' es inválida. (El archivo de configuración '$archivo_ini' no existe)"); + throw new toba_error('INSTANCIA: La instancia es inválida. (El archivo de configuración no existe) revise el log'); } else { //--- Levanto la CONFIGURACION de la instancia // BASE @@ -77,22 +77,22 @@ function cargar_info_ini() $this->datos_ini = toba::config()->get_seccion('instancia'); toba_logger::instancia()->debug("Parametros instancia {$this->identificador}: ".var_export($this->datos_ini, true)); if ( ! isset( $this->datos_ini['base'] ) ) { - toba_logger::instancia()->error("INSTANCIA: La instancia '{$this->identificador}' es invalida. (El archivo de configuracion '$archivo_ini' no posee una entrada 'base')"); - throw new toba_error('INSTANCIA: La instancia es invalida. (El archivo de configuracion no posee una entrada para la base) revise el log'); + toba_logger::instancia()->error("INSTANCIA: La instancia '{$this->identificador}' es inválida. (El archivo de configuración '$archivo_ini' no posee una entrada 'base')"); + throw new toba_error('INSTANCIA: La instancia es inválida. (El archivo de configuración no posee una entrada para la base) revise el log'); } $this->ini_base = $this->datos_ini['base']; // PROYECTOS if ( ! isset( $this->datos_ini['proyectos'] ) ) { - toba_logger::instancia()->error("INSTANCIA: La instancia '{$this->identificador}' es invalida. (El archivo de configuracion '$archivo_ini' no posee una entrada 'proyectos')"); - throw new toba_error('INSTANCIA: La instancia es invalida. (El archivo de configuracion no posee una entrada para el proyecto) revise el log'); + toba_logger::instancia()->error("INSTANCIA: La instancia '{$this->identificador}' es inválida. (El archivo de configuración '$archivo_ini' no posee una entrada 'proyectos')"); + throw new toba_error('INSTANCIA: La instancia es inválida. (El archivo de configuración no posee una entrada para el proyecto) revise el log'); } $lista_proyectos = array(); if (trim($this->datos_ini['proyectos']) != '') { $lista_proyectos = explode(',', $this->datos_ini['proyectos'] ); $lista_proyectos = array_map('trim',$lista_proyectos); if ( count( $lista_proyectos ) == 0 ) { - toba_logger::instancia()->error("INSTANCIA: La instancia '{$this->identificador}' es invalida. (El archivo de configuracion '$archivo_ini' no posee proyectos asociados. La entrada 'proyectos' debe estar constituida por una lista de proyectos separados por comas)"); - throw new toba_error('INSTANCIA: La instancia es invalida. (El archivo de configuracion no posee proyectos asociados) revise el log'); + toba_logger::instancia()->error("INSTANCIA: La instancia '{$this->identificador}' es inválida. (El archivo de configuración '$archivo_ini' no posee proyectos asociados. La entrada 'proyectos' debe estar constituida por una lista de proyectos separados por comas)"); + throw new toba_error('INSTANCIA: La instancia es inválida. (El archivo de configuración no posee proyectos asociados) revise el log'); } } sort($lista_proyectos); @@ -643,7 +643,7 @@ private function exportar_tablas_proyecto( $metodo_lista_tablas, $nombre_archivo private function guardar_archivo($archivo, $contenido, $append = false) { - $flags = null; + $flags = 0; if ($append) { $flags = FILE_APPEND; } @@ -675,7 +675,7 @@ function generar_ini_rest($id_proyecto) try { toba_modelo_rest::crear_directorio_destino($this->get_dir_instalacion_proyecto($id_proyecto)); } catch (Exception $e) { - $this->manejador_interface->mensaje("No se pudo crear la carpeta para las configuraciones de la api REST"); + $this->manejador_interface->mensaje("No se pudo crear la carpeta para las configuraciónes de la api REST"); return; } @@ -1066,7 +1066,7 @@ function importar_informacion_instancia($instancia_origen, $path_origen, $reempl $path = $path_origen.'/instalacion/'.self::dir_prefijo.$instancia_origen; if (! file_exists($path)) { toba_logger::instancia()->error("No existe la carpeta $path"); - throw new toba_error('No existe la carpeta en la instalacion origen, revise el log'); + throw new toba_error('No existe la carpeta en la instalación origen, revise el log'); } $subdirs = toba_manejador_archivos::get_subdirectorios($path); $proyectos = $this->get_lista_proyectos_vinculados(); @@ -1352,7 +1352,7 @@ function eliminar_modelo() } /** - * Elimina los archivos de configuracion y datos propios de la instancia + * Elimina los archivos de configuración y datos propios de la instancia */ function eliminar_archivos() { diff --git a/php/modelo/toba_modelo_nucleo.php b/php/modelo/toba_modelo_nucleo.php index 26f306f38a..ebe414fdf0 100644 --- a/php/modelo/toba_modelo_nucleo.php +++ b/php/modelo/toba_modelo_nucleo.php @@ -100,8 +100,8 @@ private function parsear_archivos() //Intento abrir el archivo $fd = @fopen ($archivo, "r"); if(!is_resource($fd)){ - toba_logger::instancia()->error("ERROR: '$archivo' no es un archivo valido\n"); - throw new toba_error('ERROR: El archivo procesado no es un archivo valido\n'); + toba_logger::instancia()->error("ERROR: '$archivo' no es un archivo válido\n"); + throw new toba_error('ERROR: El archivo procesado no es un archivo válido\n'); } //Recorro el archivo $table = null; //Referencia a una tabla. @@ -135,7 +135,7 @@ private function parsear_archivos() { $temp = preg_split("/(\s*):(\s*)/",$buffer); if(!isset($temp[1])||!isset($temp[2])){ - toba_logger::instancia()->error("Error parseando la linea: $temp\n (archivo: $archivo)"); + toba_logger::instancia()->error("Error parseando la línea: $temp\n (archivo: $archivo)"); throw new toba_error('Error parseando archivo, revise el log'); } $tabla[trim($temp[1])]=addslashes(trim($temp[2])); diff --git a/php/modelo/toba_modelo_proyecto.php b/php/modelo/toba_modelo_proyecto.php index bc3911ab7a..262613bcf1 100644 --- a/php/modelo/toba_modelo_proyecto.php +++ b/php/modelo/toba_modelo_proyecto.php @@ -48,8 +48,8 @@ function __construct( toba_modelo_instancia $instancia, $identificador ) $this->identificador = $identificador; $this->dir = $instancia->get_path_proyecto($identificador); if( ! is_dir( $this->dir ) ) { - toba_logger::instancia()->error("PROYECTO: El proyecto '{$this->identificador}' es invalido. (la carpeta '{$this->dir}' no existe)"); - throw new toba_error('PROYECTO: El proyecto solicitado es invalido. (la carpeta no existe o no tiene acceso) revise el log'); + toba_logger::instancia()->error("PROYECTO: El proyecto '{$this->identificador}' es inválido. (la carpeta '{$this->dir}' no existe)"); + throw new toba_error('PROYECTO: El proyecto solicitado es inválido. (la carpeta no existe o no tiene acceso) revise el log'); } $this->db = $this->instancia->get_db(); toba_contexto_info::set_db($this->get_db()); @@ -363,8 +363,8 @@ function get_parametro($seccion, $parametro=null, $obligatorio=true) if (toba::config()->existe_valor('proyecto', $seccion, $parametro)) { return toba::config()->get_parametro('proyecto', $seccion, $parametro); } elseif ($obligatorio) { - toba_logger::instancia()->error("INFO_PROYECTO: El parametro '$parametro' no se encuentra definido."); - throw new toba_error('INFO_PROYECTO: El parametro solicitado no se encuentra definido. Revise el log'); + toba_logger::instancia()->error("INFO_PROYECTO: El parámetro '$parametro' no se encuentra definido."); + throw new toba_error('INFO_PROYECTO: El parámetro solicitado no se encuentra definido. Revise el log'); } return null; } @@ -414,8 +414,8 @@ function exportar() $this->sincronizar_archivos(); $this->generar_checksum(); //Regenero el checksum } catch ( toba_error $e ) { - toba_logger::instancia()->error("Proyecto {$this->identificador}: Ha ocurrido un error durante la exportacion:\n". $e->getMessage()); - throw new toba_error('Proyecto: Ha ocurrido un error durante la exportacion, revise el log:'. PHP_EOL); + toba_logger::instancia()->error("Proyecto {$this->identificador}: Ha ocurrido un error durante la exportación:\n". $e->getMessage()); + throw new toba_error('Proyecto: Ha ocurrido un error durante la exportación, revise el log:'. PHP_EOL); } } @@ -530,7 +530,7 @@ private function exportar_componente( $tipo, $id ) } /* - * Genera el contenido de la exportacion de un componente + * Genera el contenido de la exportación de un componente */ private function & get_contenido_componente( $tipo, $id ) { @@ -636,8 +636,8 @@ function exportar_item($item) $this->get_sincronizador()->sincronizar_agregados(); //Sincronizo los archivos $this->generar_checksum(); //Regenero el checksum } catch ( toba_error $e ) { - toba_logger::instancia()->error("Proyecto {$this->identificador}: Ha ocurrido un error durante la exportacion del item $item:\n". $e->getMessage()); - throw new toba_error('Proyecto: Ha ocurrido un error durante la exportacion del item, revise el log:'. PHP_EOL); + toba_logger::instancia()->error("Proyecto {$this->identificador}: Ha ocurrido un error durante la exportación del item $item:\n". $e->getMessage()); + throw new toba_error('Proyecto: Ha ocurrido un error durante la exportación del item, revise el log:'. PHP_EOL); } $this->manejador_interface->titulo( "Recuerde que esta operación actualmente no exporta los permisos ni los perfiles para el item." ); @@ -1472,10 +1472,12 @@ private function cargar_perfiles_produccion() function publicar($url=null, $full_url=null) { if (! $this->esta_publicado()) { - $url_pers = (trim($url) != '') ? $url . '_pers/' : null; if ($url == '' || is_null($url)) { $url = $this->get_url(); - } + $url_pers = null; + } else { + $url_pers = $url . '_pers/'; + } $this->instancia->set_url_proyecto($this->get_id(), $url, $full_url); toba_modelo_instalacion::agregar_alias_apache( $url, $this->get_dir(), @@ -2376,7 +2378,7 @@ function get_indice_consultas_php() //------------------------------------------------------------------------------------- /** - * Devuelve la lista de componentes para los procesos de exportacion y compilacion + * Devuelve la lista de componentes para los procesos de exportación y compilacion */ function get_lista_tipo_componentes() { @@ -2808,11 +2810,11 @@ static function crear( toba_modelo_instancia $instancia, $nombre, $usuarios_a_vi //- 1 - Controles $dir_template = toba_dir() . self::template_proyecto; if ( $nombre == 'toba' ) { - throw new toba_error("INSTALACION: No es posible crear un proyecto con el nombre 'toba'"); + throw new toba_error("INSTALACIÓN: No es posible crear un proyecto con el nombre 'toba'"); } if ( self::existe( $nombre ) ) { - toba_logger::instancia()->error("INSTALACION: Ya existe una carpeta con el nombre '$nombre' en la carpeta 'proyectos'"); - throw new toba_error("INSTALACION: Ya existe una carpeta con el nombre especificado en la carpeta 'proyectos'"); + toba_logger::instancia()->error("INSTALACIÓN: Ya existe una carpeta con el nombre '$nombre' en la carpeta 'proyectos'"); + throw new toba_error("INSTALACIÓN: Ya existe una carpeta con el nombre especificado en la carpeta 'proyectos'"); } try { diff --git a/php/modelo/toba_modelo_rest.php b/php/modelo/toba_modelo_rest.php index ebcee2194e..e7a5b65239 100644 --- a/php/modelo/toba_modelo_rest.php +++ b/php/modelo/toba_modelo_rest.php @@ -262,7 +262,7 @@ static function get_dir_api_personalizacion($proyecto) return $proyecto->get_dir_pers().'/php' . self::CARPETA_REST; } - function generar_configuracion_cliente($id_servicio, $cert_CA, $url, $cert_cli, $key_cli, $cert_pwd, $usr, $usr_pwd, $tipo_auth) + function generar_configuracion_cliente($id_servicio, $cert_CA, $url, $cert_cli, $key_cli, $cert_pwd, $usr, $usr_pwd, $tipo_auth, $api_version) { //Intento crear la carpeta de destino de configuraciones por si no esta. try { @@ -313,6 +313,10 @@ function generar_configuracion_cliente($id_servicio, $cert_CA, $url, $cert_cli, } } + //Agrega version especifica de la api (si se indico) + if (! is_null($api_version) && trim($api_version) != '') { + $datos['version'] = $api_version; + } $ini->set_datos_entrada('conexion', $datos); $ini->guardar(); } diff --git a/php/modelo/toba_modelo_servicio_web.php b/php/modelo/toba_modelo_servicio_web.php index f3fcc9c7b3..e42681672e 100644 --- a/php/modelo/toba_modelo_servicio_web.php +++ b/php/modelo/toba_modelo_servicio_web.php @@ -124,7 +124,7 @@ function generar_documentacion($carpeta_doc, $forzar_reemplazo = false) * @param array $datos_cert * @param string $url_sistema */ - function generar_configuracion_cliente($cert_servidor, $url_sistema, $cert_cli=null, $key_cli=null, $cert_pwd=null,$usr=null, $usr_pwd=null, $tipo_auth=null) + function generar_configuracion_cliente($cert_servidor, $url_sistema, $cert_cli=null, $key_cli=null, $cert_pwd=null,$usr=null, $usr_pwd=null, $tipo_auth=null, $api_version=null) { if (! $this->rest) { $soap = new toba_modelo_soap($this->proyecto); @@ -133,7 +133,7 @@ function generar_configuracion_cliente($cert_servidor, $url_sistema, $cert_cli=n } else { $rest = new toba_modelo_rest($this->proyecto); $rest->set_manejador_interface($this->manejador_interface); - $rest->generar_configuracion_cliente($this->get_id(),$cert_servidor, $url_sistema, $cert_cli, $key_cli, $cert_pwd, $usr, $usr_pwd, $tipo_auth); + $rest->generar_configuracion_cliente($this->get_id(),$cert_servidor, $url_sistema, $cert_cli, $key_cli, $cert_pwd, $usr, $usr_pwd, $tipo_auth, $api_version); } } @@ -193,8 +193,8 @@ static function generar_certificados(toba_modelo_proyecto $proyecto, $directorio $cmd = "openssl req -x509 -nodes -days 2000 -newkey rsa:2048 -keyout $dir_sign -config $dir_inst/openssl.ini -out $out_cert"; $exito = toba_manejador_procesos::ejecutar($cmd, $stdout, $stderr); if ($exito != '0') { - toba_logger::instancia()->error($stderr. "\n Asegurese tener instalados los binarios de OpenSSL y disponibles en el path. Para comprobar ejecute 'openssl version'"); - throw new toba_error_usuario('Asegurese tener instalados los binarios de OpenSSL y disponibles en el path. Revise el log para mas info'); + toba_logger::instancia()->error($stderr. "\n Asegúrese tener instalados los binarios de OpenSSL y disponibles en el path. Para comprobar ejecute 'openssl version'"); + throw new toba_error_usuario('Asegúrese tener instalados los binarios de OpenSSL y disponibles en el path. Revise el log para mas info'); } $cmd = "openssl rsa -in $dir_sign -out $out_key"; diff --git a/php/modelo/var/rest_cliente.ini b/php/modelo/var/rest_cliente.ini index 76522d18a1..7a8a1a4d3b 100755 --- a/php/modelo/var/rest_cliente.ini +++ b/php/modelo/var/rest_cliente.ini @@ -5,6 +5,7 @@ ;auth_tipo = digest ;auth_usuario = usuario1 ;auth_password = CAMBIAR +;version=1.1 ;Parametros para auth_tipo = ssl ;cert_file=/path_al_certificado diff --git a/php/nucleo/componentes/definicion/_interfaces.php b/php/nucleo/componentes/definicion/_interfaces.php index 7bb0982003..7640297678 100644 --- a/php/nucleo/componentes/definicion/_interfaces.php +++ b/php/nucleo/componentes/definicion/_interfaces.php @@ -1,18 +1,17 @@ - \ No newline at end of file + \ No newline at end of file + +class toba_asistente_grilla_def extends toba_asistente_abms_def +{ +} diff --git a/php/nucleo/componentes/interface/botones/toba_boton.php b/php/nucleo/componentes/interface/botones/toba_boton.php index 3ef70223f7..37ff505af5 100644 --- a/php/nucleo/componentes/interface/botones/toba_boton.php +++ b/php/nucleo/componentes/interface/botones/toba_boton.php @@ -71,7 +71,7 @@ function esta_anulado() */ function posee_confirmacion() { - return ( trim($this->datos['confirmacion']) !== '' ); + return (isset($this->datos['confirmacion']) && trim($this->datos['confirmacion']) !== '' ); } //--------- Geters --------------------- @@ -174,7 +174,7 @@ function set_imagen($url_relativa, $origen='apex') { if ($origen != 'apex' && $origen != 'proyecto' ) { toba_logger::instancia()->error("EVENTO: El origen de la imagen debe ser 'apex' o 'proyecto'. Valor recibido: $origen"); - throw new toba_error_def('EVENTO: El origen de la imagen no es valido, revise el log'); + throw new toba_error_def('EVENTO: El origen de la imagen no es válido, revise el log'); } $this->datos['imagen_recurso_origen'] = $origen; $this->datos['imagen'] = $url_relativa; diff --git a/php/nucleo/componentes/interface/botones/toba_evento_usuario.php b/php/nucleo/componentes/interface/botones/toba_evento_usuario.php index c7cdf16369..473c6f80b0 100644 --- a/php/nucleo/componentes/interface/botones/toba_evento_usuario.php +++ b/php/nucleo/componentes/interface/botones/toba_evento_usuario.php @@ -50,8 +50,8 @@ function vinculo($forzar_instancia=false) } return $this->vinculo; } else { - toba_logger::instancia()->error('El evento "' . $this->get_id() . '" no posee un VINCULO ASOCIADO.'); - throw new toba_error_def('El evento solicitado no posee un VINCULO ASOCIADO. Revise el log'); + toba_logger::instancia()->error('El evento "' . $this->get_id() . '" no posee un VíNCULO ASOCIADO.'); + throw new toba_error_def('El evento solicitado no posee un VíNCULO ASOCIADO. Revise el log'); } } @@ -152,7 +152,7 @@ function posee_accion_vista_araireportes() function posee_grupo_asociado() { - return trim($this->datos['grupo'])!=''; + return (null !== $this->datos['grupo'] && trim($this->datos['grupo'])!=''); } function pertenece_a_grupo($grupo) @@ -287,7 +287,7 @@ function get_html($id_submit, $objeto_js, $id_componente) if (isset($this->datos['ayuda'])) { $tip = $this->datos['ayuda']; } - $acceso = tecla_acceso( $this->datos['etiqueta'] ); + $acceso = tecla_acceso( $this->datos['etiqueta'] ?? '' ); $image_resource = isset($this->datos['imagen_recurso_origen']) ? $this->datos['imagen_recurso_origen'] : null; $image_file = isset($this->datos['imagen']) ? $this->datos['imagen'] : null; $style = isset($this->datos['estilo']) ? $this->datos['estilo']: null; @@ -410,7 +410,7 @@ function get_invocacion_js($objeto_js=null, $id_componente = null) $url = toba::vinculador()->get_url( null, null, array(), $opciones ); $js = "document.location.href='$url';"; } elseif ( $this->posee_accion_vincular() ) { - // ---*** VINCULO ***--- + // ---*** VíNCULO ***--- if (isset($this->datos['accion_vinculo_servicio']) && !is_null($this->datos['accion_vinculo_servicio'])){ $this->vinculo()->set_servicio($this->datos['accion_vinculo_servicio']); diff --git a/php/nucleo/componentes/interface/botones/toba_tab.php b/php/nucleo/componentes/interface/botones/toba_tab.php index 634a2c5d4e..efba4b9da6 100644 --- a/php/nucleo/componentes/interface/botones/toba_tab.php +++ b/php/nucleo/componentes/interface/botones/toba_tab.php @@ -39,7 +39,7 @@ function get_html($tipo, $id_submit, $id_componente, $seleccionado, $editor='') if (!isset($tecla)&&($id_tab<10)) { $tecla = $id_tab; } - $tip = str_replace("'", "\\'",$tip); + $tip = (null !== $tip) ? str_replace("'", "\\'", $tip) : ''; $acceso = toba_recurso::ayuda($tecla, $tip); $id = $id_submit .'_cambiar_tab_'. $evento; //$js = "onclick=\"{$id_componente}.ir_a_pantalla('$evento');return false;\""; diff --git a/php/nucleo/componentes/interface/efs/toba_carga_opciones_ef.php b/php/nucleo/componentes/interface/efs/toba_carga_opciones_ef.php index 866279be6a..ed892cf6cc 100644 --- a/php/nucleo/componentes/interface/efs/toba_carga_opciones_ef.php +++ b/php/nucleo/componentes/interface/efs/toba_carga_opciones_ef.php @@ -321,8 +321,8 @@ protected function ef_metodo_carga_php($id_ef, $parametros, $maestros) toba_logger::instancia()->error("ERROR en la carga del ef $id_ef. No existe el método '{$parametros['carga_metodo']}' de la clase '{$parametros['carga_clase']}'"); throw new toba_error_def('ERROR en la carga del ef . No existe el método solicitado en la clase indicada. Revise el log'); } - $metodo = array($clase, $parametros['carga_metodo']); - return call_user_func_array($metodo, $maestros); + $metodo = array($clase, $parametros['carga_metodo']); + return call_user_func_array($metodo, array_values($maestros)); } else { //--- Es un metodo del CI contenedor if (! method_exists($this->_controlador->controlador(), $parametros['carga_metodo'])) { @@ -330,7 +330,7 @@ protected function ef_metodo_carga_php($id_ef, $parametros, $maestros) toba_logger::instancia()->error("ERROR en la carga del ef $id_ef. No existe el método '{$parametros['carga_metodo']}' en la clase '$clase'"); throw new toba_error_def('ERROR en la carga del ef . No existe el método solicitado en la clase indicada. Revise el log'); } - $dato = call_user_func_array(array($this->_controlador->controlador(), $parametros['carga_metodo']), $maestros); + $dato = call_user_func_array(array($this->_controlador->controlador(), $parametros['carga_metodo']), array_values($maestros)); return $dato; } } @@ -347,7 +347,7 @@ protected function ef_metodo_carga_consulta_php($id_ef, $parametros, $maestros) toba_logger::instancia()->error("ERROR en la carga del ef $id_ef. No existe el método '{$parametros['carga_metodo']}' de la consulta php '{$parametros['carga_consulta_php_clase']}'"); throw new toba_error_def('ERROR en la carga del ef . No existe el método solicitado en la clase indicada. Revise el log'); } - return call_user_func_array(array($objeto, $metodo), $maestros); + return call_user_func_array(array($objeto, $metodo), array_values($maestros)); } } @@ -364,7 +364,7 @@ protected function ef_metodo_carga_dt($id_ef, $parametros, $maestros) toba_logger::instancia()->error("ERROR en la carga del ef $id_ef. No existe el método '{$parametros['carga_metodo']}' de la clase '$clase'"); throw new toba_error_def('ERROR en la carga del ef . No existe el método solicitado en la clase indicada. Revise el log'); } - return call_user_func_array(array($dt, $parametros['carga_metodo']), $maestros); + return call_user_func_array(array($dt, $parametros['carga_metodo']), array_values($maestros)); } /* diff --git a/php/nucleo/componentes/interface/efs/toba_ef.php b/php/nucleo/componentes/interface/efs/toba_ef.php index 37f38ca9a4..92d3b61a8b 100644 --- a/php/nucleo/componentes/interface/efs/toba_ef.php +++ b/php/nucleo/componentes/interface/efs/toba_ef.php @@ -738,7 +738,7 @@ protected function parametros_js() $oculto_relaj = ($this->obligatorio_oculto_relaj) ? "true" : "false"; $relajado = ( $this->cascada_relajada ) ? "true" : "false"; $colapsable = ( $this->expandido ) ? "false" : "true"; - $etiqueta = str_replace("/", "\\/", $this->etiqueta); + $etiqueta = str_replace("/", "\\/", $this->etiqueta ?? ''); $etiqueta = str_replace(array('"', "'"), '', $etiqueta); return "'{$this->id_form_orig}', '$etiqueta', [$obligatorio, $relajado, $oculto_relaj], $colapsable"; } diff --git a/php/nucleo/componentes/interface/efs/toba_ef_cuit.php b/php/nucleo/componentes/interface/efs/toba_ef_cuit.php index 9173fefa64..386f32b326 100644 --- a/php/nucleo/componentes/interface/efs/toba_ef_cuit.php +++ b/php/nucleo/componentes/interface/efs/toba_ef_cuit.php @@ -11,7 +11,9 @@ class toba_ef_cuit extends toba_ef static protected $_excepciones; protected $clase_css = 'ef-cuit'; protected $_desactivar_validacion = false; - + + static protected $_prefijos_validos = [20, 23, 24, 27, 30, 33, 34]; + static function get_lista_parametros_carga() { return array(); @@ -35,6 +37,21 @@ static function get_excepciones() { return self::$_excepciones; } + + /** + * Premite incluir la lista de prefijos validos para el CUIT + * se crea para mantener BC con algun valor previo y no romper de entrada + * + * Modo de uso: toba_ef_cuit::set_prefijos(['19','24', '30']); + * + * @param array $prefijos + */ + static function set_prefijos(Array $prefijos) + { + if (! empty($prefijos)) { + self::$_prefijos_validos = $prefijos; + } + } function cargar_estado_post() { @@ -61,7 +78,7 @@ function tiene_estado() { if (isset($this->estado)) { return ($this->estado != ""); - } else{ + } else { return false; } } @@ -130,7 +147,8 @@ function get_descripcion_estado($tipo_salida) function crear_objeto_js() { $desactivar_validacion = $this->_desactivar_validacion ? '1' : '0'; - return "new ef_cuit({$this->parametros_js()}, $desactivar_validacion)"; + $prefijos = toba_js::arreglo(self::$_prefijos_validos, false, false); + return "new ef_cuit({$this->parametros_js()}, $desactivar_validacion, $prefijos)"; } function get_consumo_javascript() @@ -151,6 +169,13 @@ static function validar_cuit($cuit_rearmado) return true; } } + + $prefijo = intval(substr($cuit_rearmado, 0, 2)); //verifica prefijo de CUIT/CUIL + if (!in_array($prefijo, self::$_prefijos_validos, true)) { + toba::logger()->debug('Se encontro un prefijo no valido en el EF: ' . $prefijo); + return false; + } + $coeficiente = array(5, 4, 3, 2, 7, 6, 5, 4, 3, 2); $resultado=1; if (strlen($cuit_rearmado) != 11) { // si to estan todos los digitos diff --git a/php/nucleo/componentes/interface/efs/toba_ef_editable.php b/php/nucleo/componentes/interface/efs/toba_ef_editable.php index 40ec1497a7..2117c1ca69 100644 --- a/php/nucleo/componentes/interface/efs/toba_ef_editable.php +++ b/php/nucleo/componentes/interface/efs/toba_ef_editable.php @@ -772,7 +772,6 @@ static function set_rango_valido_global($desde, $hasta) function set_estado($estado="") { - toba::logger()->var_dump($estado); if(is_array($estado) && isset($estado['0']) && isset($estado['1'])) { $this->estado = array('fecha' => cambiar_fecha($estado['0'],'-','/') , 'hora' => $estado['1']); } else { @@ -793,7 +792,7 @@ function get_estado() function tiene_estado() { //Verifico que sea distinto de null y que ambas componenetes esten seteadas. - $hay_fecha = $hay_hora = true; + $hay_fecha = $hay_hora = false; if (! is_null($this->estado)) { $hay_fecha = (isset($this->estado['fecha']) && trim($this->estado['fecha'] != '')); $hay_hora = (isset($this->estado['hora']) && trim($this->estado['hora'] != '')); @@ -1157,7 +1156,7 @@ function set_estado($estado) { parent::set_estado($estado); if ($this->maximo) { - if (strlen($this->estado) > $this->maximo) { + if (null !== $this->estado && strlen($this->estado) > $this->maximo) { $this->estado = substr($this->estado, 0, $this->maximo); } } diff --git a/php/nucleo/componentes/interface/efs/toba_ef_editable_captcha.php b/php/nucleo/componentes/interface/efs/toba_ef_editable_captcha.php index 77fb141571..bab3f426b3 100644 --- a/php/nucleo/componentes/interface/efs/toba_ef_editable_captcha.php +++ b/php/nucleo/componentes/interface/efs/toba_ef_editable_captcha.php @@ -23,7 +23,7 @@ function __construct($padre, $nombre_formulario, $id, $etiqueta, $descripcion, $ throw new toba_error('toba_ef_editable_captcha: Necesita instalar en PHP el soporte para la extensión GD.'); } - $this->antispam = new toba_imagen_captcha(); + $this->antispam = new toba_imagen_captcha(['captchaId' => $id]); $parametros['estado_defecto'] = false; parent::__construct($padre, $nombre_formulario, $id,$etiqueta, $descripcion, $dato, $obligatorio, $parametros); @@ -115,7 +115,7 @@ function set_longitud_codigo($longitud) function generar_texto_aleatorio() { $this->antispam->createCode($this->longitud); - $this->texto = $this->antispam->getCode(); + $this->texto = $this->antispam->get_codigo(); } function get_input() @@ -123,6 +123,9 @@ function get_input() $this->input_extra .= $this->get_estilo_visualizacion_pixeles(); $this->input_extra .= $this->get_info_placeholder(); $this->estado = false; + + //Fuerza la generacion de un codigo, de lo contrario no hay texto a comparar + $this->generar_texto_aleatorio(); $longitud = strlen($this->texto); //la longitud maxima de caracteres del ef $tab = ' tabindex="'.$this->padre->get_tab_index().'"'; $text_input = toba_form::text($this->id_form, $this->estado, $this->es_solo_lectura(), $longitud, $this->tamano, $this->clase_css, $this->javascript.' '.$this->input_extra.$tab); @@ -162,7 +165,7 @@ function cargar_estado_post() { if (isset($_POST[$this->id_form])) { $texto_ef = trim($_POST[$this->id_form]); - $this->estado = ($this->antispam->check($texto_ef)) ? true : false; + $this->estado = ($this->antispam->check($texto_ef, $this->get_id())) ? true : false; } else { $this->estado = false; } diff --git a/php/nucleo/componentes/interface/efs/toba_ef_upload.php b/php/nucleo/componentes/interface/efs/toba_ef_upload.php index 799d6c275a..49bab7ec1a 100644 --- a/php/nucleo/componentes/interface/efs/toba_ef_upload.php +++ b/php/nucleo/componentes/interface/efs/toba_ef_upload.php @@ -27,8 +27,11 @@ function __construct($padre,$nombre_formulario,$id,$etiqueta,$descripcion,$dato, // Controlar las extensiones válidas... if (isset($parametros['upload_extensiones']) && trim($parametros['upload_extensiones']) != '') { $this->extensiones_validas = array(); - foreach (explode(',', $parametros['upload_extensiones']) as $valor) - $this->extensiones_validas[] = strtolower(trim($valor)); + foreach (explode(',', $parametros['upload_extensiones']) as $valor) { + if (null !== $valor) { + $this->extensiones_validas[] = strtolower(trim($valor)); + } + } } parent::__construct($padre,$nombre_formulario, $id,$etiqueta,$descripcion,$dato,$obligatorio, $parametros); } @@ -97,7 +100,7 @@ function cargar_estado_post() function es_archivo_vacio() { - return $_FILES[$this->id_form]["error"] == UPLOAD_ERR_NO_FILE; + return $_FILES[$this->id_form]['error'] == UPLOAD_ERR_NO_FILE; } function tiene_estado() @@ -118,7 +121,7 @@ function validar_estado() return $padre; } if (isset($this->archivo_subido[$this->id_form]) && $this->archivo_subido[$this->id_form]) { - $id = $this->estado['error']; + $id = $this->estado['error']??'NFW'; switch($id){ case UPLOAD_ERR_OK: break; diff --git a/php/nucleo/componentes/interface/filtro_columnas/toba_filtro_columna.php b/php/nucleo/componentes/interface/filtro_columnas/toba_filtro_columna.php index a01ec1081c..4d6d4a4b4f 100644 --- a/php/nucleo/componentes/interface/filtro_columnas/toba_filtro_columna.php +++ b/php/nucleo/componentes/interface/filtro_columnas/toba_filtro_columna.php @@ -48,10 +48,10 @@ function set_estado($estado) { if ($this->hay_condicion_fija()){ if (isset($estado['condicion']) && isset($this->_estado) &&($this->_estado['condicion'] != $estado['condicion'])){ //Si la condicion no viene seteada retorna al default - $msg = "Existe una condicion fija para la columna '".$this->get_nombre(). + $msg = "Existe una condición fija para la columna '".$this->get_nombre(). "' la misma no se puede cambiar seteando el estado."; toba_logger::instancia()->error($msg); - throw new toba_error_def('Existe una condicion fija para la columna, la misma no se puede cambiar seteando el estado. Revise el log'); + throw new toba_error_def('Existe una condición fija para la columna, la misma no se puede cambiar seteando el estado. Revise el log'); } } @@ -97,8 +97,8 @@ function cargar_estado_post() if (isset($_POST[$this->_id_form_cond])) { $condicion = $_POST[$this->_id_form_cond]; if (! isset($this->_condiciones[$condicion])) { - toba_logger::instancia()->error("La condicion '$condicion' no es una condicion válida"); - throw new toba_error_seguridad("La condicion indicada no es válida"); + toba_logger::instancia()->error("La condición '$condicion' no es una condición válida"); + throw new toba_error_seguridad("La condición indicada no es válida"); } $this->_estado['condicion'] = $condicion; } else { @@ -111,7 +111,7 @@ function cargar_estado_post() } /** - * Agrega una condicion a la columna + * Agrega una condición a la columna * @param mixed $id * @param toba_filtro_condicion $condicion */ @@ -319,13 +319,13 @@ function hay_condicion_fija() function set_condicion_fija($nombre, $estado = true) { if (!isset($this->_condiciones[$nombre])){ - toba_logger::instancia()->error("No existe la condicion '$nombre' para la columna '". $this->get_nombre()."'"); - throw new toba_error_def('No existe la condicion señalada para la columna indicada, revise el log'); + toba_logger::instancia()->error("No existe la condición '$nombre' para la columna '". $this->get_nombre()."'"); + throw new toba_error_def('No existe la condición señalada para la columna indicada, revise el log'); } if ($this->hay_condicion_fija()){ - toba_logger::instancia()->error("Ya existe una condicion fija para la columna '".$this->get_nombre()."'"); - throw new toba_error_def('Ya existe una condicion fija para la columna indicada, revise el log'); + toba_logger::instancia()->error("Ya existe una condición fija para la columna '".$this->get_nombre()."'"); + throw new toba_error_def('Ya existe una condición fija para la columna indicada, revise el log'); } $this->_condicion_default = ($estado) ? $nombre : null; //Si el estado es false se limpia el default @@ -340,8 +340,8 @@ function set_condicion_fija($nombre, $estado = true) function set_condicion_default($nombre) { if (!isset($this->_condiciones[$nombre])){ - toba_logger::instancia()->error("No existe la condicion '$nombre' para la columna '". $this->get_nombre()."'"); - throw new toba_error_def('No existe la condicion señalada para la columna indicada, revise el log'); + toba_logger::instancia()->error("No existe la condición '$nombre' para la columna '". $this->get_nombre()."'"); + throw new toba_error_def('No existe la condición señalada para la columna indicada, revise el log'); } $this->_condicion_default = $nombre; } @@ -373,8 +373,8 @@ function condicion($nombre = null) if (isset($this->_estado)) { return $this->_condiciones[$this->_estado['condicion']]; } else { - toba_logger::instancia()->error("No hay una condicion actualmente seleccionada para la columna '".$this->get_nombre()."'"); - throw new toba_error_def('No hay una condicion actualmente seleccionada para la columna indicada, revise el log'); + toba_logger::instancia()->error("No hay una condición actualmente seleccionada para la columna '".$this->get_nombre()."'"); + throw new toba_error_def('No hay una condición actualmente seleccionada para la columna indicada, revise el log'); } } else { return $this->_condiciones[$nombre]; @@ -393,8 +393,8 @@ function set_condicion(toba_filtro_condicion $condicion, $nombre=null) if (isset($this->_estado)) { $this->_condiciones[$this->_estado['condicion']] = $condicion; } else { - toba_logger::instancia()->error("No hay una condicion actualmente seleccionada para la columna '".$this->get_nombre()."'"); - throw new toba_error_def('No hay una condicion actualmente seleccionada para la columna indicada, revise el log'); + toba_logger::instancia()->error("No hay una condición actualmente seleccionada para la columna '".$this->get_nombre()."'"); + throw new toba_error_def('No hay una condición actualmente seleccionada para la columna indicada, revise el log'); } } else { $this->_condiciones[$nombre] = $condicion; diff --git a/php/nucleo/componentes/interface/filtro_columnas/toba_filtro_columna_compuesta.php b/php/nucleo/componentes/interface/filtro_columnas/toba_filtro_columna_compuesta.php index 691879d669..401eea9ef9 100644 --- a/php/nucleo/componentes/interface/filtro_columnas/toba_filtro_columna_compuesta.php +++ b/php/nucleo/componentes/interface/filtro_columnas/toba_filtro_columna_compuesta.php @@ -29,8 +29,8 @@ function cargar_estado_post() if (isset($_POST[$this->_id_form_cond])) { $condicion = $_POST[$this->_id_form_cond]; if (! isset($this->_condiciones[$condicion])) { - toba_logger::instancia()->error("La condicion '$condicion' no es una condicion válida"); - throw new toba_error_seguridad("La condicion indicada no es válida"); + toba_logger::instancia()->error("La condición '$condicion' no es una condición válida"); + throw new toba_error_seguridad("La condición indicada no es válida"); } //Cargo el estado del ef original $this->_ef->cargar_estado_post(); diff --git a/php/nucleo/componentes/interface/toba_ei.php b/php/nucleo/componentes/interface/toba_ei.php index d5aa8505b2..771069d8a1 100644 --- a/php/nucleo/componentes/interface/toba_ei.php +++ b/php/nucleo/componentes/interface/toba_ei.php @@ -657,7 +657,7 @@ function generar_html_barra_sup($titulo=null, $control_titulo_vacio=false, $esti } $botonera_sup = $this->hay_botones() && isset($this->_posicion_botonera) && ($this->_posicion_botonera == "arriba" || $this->_posicion_botonera == "ambos") && ! $botonera_en_item; - $tiene_titulo = trim($this->_info["titulo"])!="" || trim($titulo) != ''; + $tiene_titulo = trim($this->_info["titulo"]??'')!="" || trim($titulo??'') != ''; $fuerza_titulo = (isset($this->_info_cuadro) && $this->_info_cuadro['siempre_con_titulo'] == '1'); if ($botonera_sup || !$control_titulo_vacio || $tiene_titulo || $fuerza_titulo) { if (!isset($titulo)) { @@ -687,7 +687,7 @@ function generar_html_barra_sup($titulo=null, $control_titulo_vacio=false, $esti } //--- Descripcion con barra. Muestra una barra en lugar de un tooltip - if(trim($this->_info["descripcion"])!="" && !$this->_modo_descripcion_tooltip){ + if(!is_null($this->_info['descripcion']) && trim($this->_info["descripcion"])!="" && !$this->_modo_descripcion_tooltip){ $tipo = isset($this->_info['descripcion_tipo']) ? $this->_info['descripcion_tipo'] : null; $this->generar_html_descripcion($this->_info['descripcion'], $tipo); } diff --git a/php/nucleo/componentes/interface/toba_ei_arbol.php b/php/nucleo/componentes/interface/toba_ei_arbol.php index 2af977d726..f8b4b2f743 100644 --- a/php/nucleo/componentes/interface/toba_ei_arbol.php +++ b/php/nucleo/componentes/interface/toba_ei_arbol.php @@ -374,8 +374,9 @@ protected function generar_barra_navegacion() $nodo = $this->_nodos_inicial[0]; while ($nodo->get_padre() != null) { $nodo = $nodo->get_padre(); + $nombre = (is_null($nodo->get_nombre_corto())) ? '': $this->acortar_nombre($nodo->get_nombre_corto(), 20); $nodo_barra = "acortar_nombre($nodo->get_nombre_corto(), 20).''; + $nodo_barra .= "class='ei-arbol-ver-prop'>". $nombre.''; $camino = $nodo_barra . ' > '. $camino; $this->_ids_enviados[] = $nodo->get_id(); //Agrego los nodos de la barra del path } @@ -532,7 +533,7 @@ public function mostrar_nodo(toba_nodo_arbol $nodo, $es_visible) $salida .= $this->mostrar_iconos($nodo); //Nombre y ayuda - $corto = $this->acortar_nombre($nodo->get_nombre_corto()); + $corto = $this->acortar_nombre($nodo->get_nombre_corto() ?? ''); $id = $nodo->get_id(); $largo = $nodo->get_nombre_largo(); $extra = $nodo->get_info_extra(); @@ -603,7 +604,7 @@ protected function mostrar_iconos($nodo) { $salida = ''; foreach ($nodo->get_iconos() as $icono) { - $ayuda = toba_parser_ayuda::parsear($icono['ayuda']); + $ayuda = toba_parser_ayuda::parsear($icono['ayuda']?? ''); $js = isset($icono['javascript']) ? $icono['javascript'] : ''; $img = toba_recurso::imagen($icono['imagen'], null, null, $ayuda, null, $js); if (isset($icono['vinculo'])) { @@ -665,7 +666,7 @@ protected function mostrar_utilerias($nodo) * @param integer $limite Cantidad de caracteres a mostrar * @return string */ - protected function acortar_nombre($nombre, $limite=null) + protected function acortar_nombre(string $nombre, $limite=null) { if (! isset($limite)) { $limite = $this->_ancho_nombres; diff --git a/php/nucleo/componentes/interface/toba_ei_archivos.php b/php/nucleo/componentes/interface/toba_ei_archivos.php index fb17bbe36c..ee7e58997b 100644 --- a/php/nucleo/componentes/interface/toba_ei_archivos.php +++ b/php/nucleo/componentes/interface/toba_ei_archivos.php @@ -69,7 +69,7 @@ function disparar_eventos() //--- Chequeo de seguridad if (isset($this->_path_absoluto)) { if (strpos(realpath($seleccion), realpath($this->_path_absoluto)) !== 0) { - throw new toba_error_seguridad('El path es invalido'); + throw new toba_error_seguridad('El path es inválido'); } } $this->_dir_actual = toba_manejador_archivos::path_a_unix(realpath($seleccion)); @@ -133,7 +133,7 @@ protected function validacion_basica_nombre($nombre) if ( strpos($nombre,$char) !== false ) { $invs = array_map('addslashes',$this->_caracteres_invalidos_nombres); $invs = implode(', ', $invs); - toba_logger::instancia()->error("El nombre $nombre posee caracteres invalidos ($invs)"); + toba_logger::instancia()->error("El nombre $nombre posee caracteres inválidos ($invs)"); throw new toba_error_validacion('El nombre no es válido, revise el log'); } } diff --git a/php/nucleo/componentes/interface/toba_ei_calendario.php b/php/nucleo/componentes/interface/toba_ei_calendario.php index 53554e11cc..320cdbf859 100644 --- a/php/nucleo/componentes/interface/toba_ei_calendario.php +++ b/php/nucleo/componentes/interface/toba_ei_calendario.php @@ -1312,7 +1312,7 @@ function mkDay($var, $objeto_js=null, $eventos=array()) if ($this->solo_pasados && $this->compare_date($day) == 1) { //Es una fecha futura y no se permite clickearla $out = toba::output()->get('Calendario')->getDaySquare($this->cssSunday, $var. $content); - } elseif (($this->get_dayLinks()) && ((!$this->get_enableSatSelection() && ($this->getWeekday($var) == 0)) || ((!$this->get_enableSunSelection() && $this->getWeekday($var) == 6)))) { + } elseif (($this->get_dayLinks()) && ((!$this->get_enableSunSelection() && ($this->getWeekday($var) == 0)) || ((!$this->get_enableSatSelection() && $this->getWeekday($var) == 6)))) { $out = toba::output()->get('Calendario')->getDaySquare($this->cssSunday, $var); } elseif ($var==$this->getSelectedDay() && $this->actmonth==$this->getSelectedMonth() && $this->actyear==$this->getSelectedYear()) { if (!$this->get_dayLinks()) { diff --git a/php/nucleo/componentes/interface/toba_ei_cuadro.php b/php/nucleo/componentes/interface/toba_ei_cuadro.php index 838c9a261e..061929f9b7 100644 --- a/php/nucleo/componentes/interface/toba_ei_cuadro.php +++ b/php/nucleo/componentes/interface/toba_ei_cuadro.php @@ -438,8 +438,8 @@ protected function inspeccionar_sumarizaciones_usuario() if(! is_null($id)) { if(isset($this->_sum_usuario[$id])){ - toba_logger::instancia()->error("Las funciones de sumarizacion deben tener IDs unicos. El id '$id' ya existe"); - throw new toba_error_def('La funcion de sumarizacion no es correcta, revise el log'); + toba_logger::instancia()->error("Las funciones de sumarización deben tener IDs únicos. El id '$id' ya existe"); + throw new toba_error_def('La función de sumarización no es correcta, revise el log'); } // Agrego la sumarizacion en la pila de sumarizaciones. $this->_sum_usuario[$id]['metodo'] = $metodo->getName(); @@ -708,7 +708,7 @@ protected function inicializar_manejo_clave() { if (isset($this->_info_cuadro["clave_datos_tabla"]) && $this->_info_cuadro["clave_datos_tabla"] == '1') { //Se usa Clave del DT $this->_columnas_clave = array( apex_datos_clave_fila ); - } elseif (trim($this->_info_cuadro["columnas_clave"]) != '') { + } elseif (isset($this->_info_cuadro["columnas_clave"]) && trim($this->_info_cuadro["columnas_clave"]) != '') { $this->_columnas_clave = explode(",",$this->_info_cuadro["columnas_clave"]); //Clave usuario $this->_columnas_clave = array_map("trim", $this->_columnas_clave); } else { @@ -796,7 +796,7 @@ private function validar_y_separar_clave(&$klave) { if (! isset($this->_memoria['claves_enviadas']) || ! in_array($klave, $this->_memoria['claves_enviadas'])) { toba_logger::instancia()->error($this->get_txt()." La clave '$klave' del cuadro no estaba entre las enviadas"); - throw new toba_error_seguridad(' La clave seleccionada no es valida'); + throw new toba_error_seguridad(' La clave seleccionada no es válida'); } if ($this->_modo_clave_segura) { $aux = (isset($this->_mapeo_clave_segura[$klave])) ? $this->_mapeo_clave_segura[$klave] : array(); @@ -1042,7 +1042,7 @@ function habilitar_corte_control($corte) { if (! isset($this->_cortes_indice[$corte])) { toba::logger()->error("Se quiere habilitar el corte '$corte' y no existe"); - throw new toba_error_def(' Se desea eliminar un corte de control inexistente.'); + throw new toba_error_def(' Se desea habilitar un corte de control inexistente.'); } //Esto restaura el corte para su grafico. $this->_cortes_def[$corte]['habilitado'] = true; @@ -1971,10 +1971,10 @@ function set_datos($datos) $this->datos = $datos; if (!is_array($this->datos)) { toba_logger::instancia()->error( $this->get_txt() . - " El parametro para cargar el cuadro posee un formato incorrecto:" . + " El parámetro para cargar el cuadro posee un formato incorrecto:" . "Se esperaba un arreglo de dos dimensiones con formato recordset."); - throw new toba_error_def(' El parametro para cargar el cuadro posee un formato incorrecto, revise el log'); + throw new toba_error_def(' El parámetro para cargar el cuadro posee un formato incorrecto, revise el log'); } if (count($this->datos) > 0 ) { $this->validar_estructura_datos(); @@ -2091,8 +2091,8 @@ function generar_html() protected function generar_salida($tipo, $objeto_toba_salida = null) { if($tipo!="html" && $tipo!="impresion_html" && $tipo!="pdf" && $tipo!='excel' && $tipo!='xml'){ - toba_logger::instancia()->error("El tipo de salida '$tipo' es invalida"); - throw new toba_error_seguridad("El tipo de salida indicado es invalido, revise el log"); + toba_logger::instancia()->error("El tipo de salida '$tipo' es inválido"); + throw new toba_error_seguridad("El tipo de salida indicado es inválido, revise el log"); } $this->_tipo_salida = $tipo; $this->instanciar_manejador_tipo_salida($tipo); @@ -2119,10 +2119,10 @@ protected function generar_salida($tipo, $objeto_toba_salida = null) } }else{ if ($this->_info_cuadro["eof_invisible"]!=1){ - if(trim($this->_info_cuadro["eof_customizado"])!=""){ - $texto = $this->_info_cuadro["eof_customizado"]; + if(isset($this->_info_cuadro['eof_customizado']) && trim($this->_info_cuadro['eof_customizado'])!=''){ + $texto = $this->_info_cuadro['eof_customizado']; }else{ - $texto = "No hay datos cargados"; + $texto = 'No hay datos cargados'; } $this->generar_mensaje_cuadro_vacio($texto); } @@ -2482,7 +2482,17 @@ function get_etiqueta_cantidad_filas() return null; } } - + + function hay_zona():bool + { + try { + $hay_zona = toba::zona()->cargada(); + } catch (toba_error_def $ex) { + $hay_zona = false; + } + return $hay_zona; + } + //------------------------------------------------------------------------------- //---- JAVASCRIPT -- //------------------------------------------------------------------------------- diff --git a/php/nucleo/componentes/interface/toba_ei_cuadro_salida_excel.php b/php/nucleo/componentes/interface/toba_ei_cuadro_salida_excel.php index b636e47333..fff5da9a48 100644 --- a/php/nucleo/componentes/interface/toba_ei_cuadro_salida_excel.php +++ b/php/nucleo/componentes/interface/toba_ei_cuadro_salida_excel.php @@ -95,11 +95,11 @@ function generar_layout_fila ($columnas, $datos_cuadro, $id_fila, $formateo, &$e if(isset($datos_cuadro[$id_fila][$clave])) { $valor_real = $datos_cuadro[$id_fila][$clave]; } else { - $valor_real = ''; + $valor_real = null; } //Hay que formatear? $estilo = array(); - if(isset($columnas[$clave]["formateo"])) { + if(isset($columnas[$clave]["formateo"]) && null !== $valor_real) { $funcion = "formato_" . $columnas[$clave]["formateo"]; //Formateo el valor list($valor, $estilo) = $formateo->$funcion($valor_real); @@ -107,7 +107,7 @@ function generar_layout_fila ($columnas, $datos_cuadro, $id_fila, $formateo, &$e $estilo = array(); } } else { - $valor = $valor_real; + $valor = $valor_real ?? ''; } $estilos[$clave]['estilo'] = $this->excel_get_estilo($columnas[$clave]['estilo']); $estilos[$clave]['estilo'] = array_merge($estilo, $estilos[$clave]['estilo']); diff --git a/php/nucleo/componentes/interface/toba_ei_cuadro_salida_html.php b/php/nucleo/componentes/interface/toba_ei_cuadro_salida_html.php index e653558048..7ecc41ccec 100644 --- a/php/nucleo/componentes/interface/toba_ei_cuadro_salida_html.php +++ b/php/nucleo/componentes/interface/toba_ei_cuadro_salida_html.php @@ -112,13 +112,14 @@ protected function generar_tabla_base() */ protected function html_cabecera() { + $hay_zona = $this->_cuadro->hay_zona(); $info_cuadro = $this->_cuadro->get_informacion_basica_cuadro(); $objeto_js = $this->_cuadro->get_id_objeto_js(); $exportacion_excel_plano = $this->_cuadro->permite_exportacion_excel_plano(); $filas_disponibles_selector = $this->_cuadro->get_filas_disponibles_selector(); $total_col = $this->_cuadro->get_cantidad_columnas_total(); - echo toba::output()->get('CuadroSalidaHtml')->getCabeceraHtml($info_cuadro,$objeto_js, $exportacion_excel_plano,$filas_disponibles_selector,$total_col); + echo toba::output()->get('CuadroSalidaHtml')->getCabeceraHtml($info_cuadro,$objeto_js, $exportacion_excel_plano,$filas_disponibles_selector,$total_col, $hay_zona); } /** @@ -581,12 +582,12 @@ function generar_layout_fila($columnas, $datos, $id_fila, $clave_fila, $evt_mul //ATENCION!! hay una columna que no esta disponible! } //Hay que formatear? - if(isset($columnas[$a]["formateo"])) { + if(isset($columnas[$a]["formateo"]) && null !== $valor_real) { $funcion = "formato_" . $columnas[$a]["formateo"]; //Formateo el valor $valor = $formateo->$funcion($valor_real); } else { - $valor = $valor_real; + $valor = $valor_real ?? ''; } } @@ -626,7 +627,7 @@ protected function get_html_cuadro_celda_vinculo($columnas, $id_columna, $id_fil $id_evt_asoc = $columnas[$id_columna]['evento_asociado']; //Busco el evento asociado al vinculo $evento = $this->_cuadro->evento($id_evt_asoc); $parametros = $this->get_parametros_interaccion($id_fila, $clave_fila); - $parametros[$clave_columna] = $valor_real; //Esto es backward compatible + $parametros[$clave_columna] = $valor_real ?? ''; //Esto es backward compatible $js = $this->get_invocacion_evento_fila($evento, $id_fila, $clave_fila, true, $parametros); $valor = "$valor_real"; return $valor; @@ -690,7 +691,7 @@ protected function html_cuadro_cabecera_columnas() $alguna_tiene_titulo = false; $columnas = $this->_cuadro->get_columnas(); foreach(array_keys($columnas) as $clave) { - if (trim($columnas[$clave]["titulo"]) != '') { + if (isset($columnas[$clave]["titulo"]) && trim($columnas[$clave]["titulo"]) != '') { $alguna_tiene_titulo = true; break; } diff --git a/php/nucleo/componentes/interface/toba_ei_cuadro_salida_impresion_html.php b/php/nucleo/componentes/interface/toba_ei_cuadro_salida_impresion_html.php index c050215010..1246b8becd 100644 --- a/php/nucleo/componentes/interface/toba_ei_cuadro_salida_impresion_html.php +++ b/php/nucleo/componentes/interface/toba_ei_cuadro_salida_impresion_html.php @@ -35,8 +35,8 @@ function impresion_html_inicio() protected function impresion_html_cabecera() { $info = $this->_cuadro->get_informacion_basica_cuadro(); - if(trim($info["subtitulo"])<>""){ - echo $info["subtitulo"]; + if(null !== $info['subtitulo'] && trim($info['subtitulo'])<>''){ + echo $info['subtitulo']; } } @@ -103,12 +103,12 @@ function generar_layout_fila($columnas, $datos, $id_fila, $clave_fila, $evt_mul //ATENCION!! hay una columna que no esta disponible! } //Hay que formatear? - if(isset($columnas[$a]["formateo"])) { + if(isset($columnas[$a]["formateo"]) && null !== $valor_real) { $funcion = "formato_" . $columnas[$a]["formateo"]; //Formateo el valor $valor = $formateo->$funcion($valor_real); } else { - $valor = $valor_real; + $valor = $valor_real ?? ''; } } diff --git a/php/nucleo/componentes/interface/toba_ei_cuadro_salida_pdf.php b/php/nucleo/componentes/interface/toba_ei_cuadro_salida_pdf.php index 5bbf4fa241..84e96a2aef 100644 --- a/php/nucleo/componentes/interface/toba_ei_cuadro_salida_pdf.php +++ b/php/nucleo/componentes/interface/toba_ei_cuadro_salida_pdf.php @@ -91,13 +91,13 @@ function pdf_cuadro(&$filas, &$totales, &$nodo) //-- Genera la tablas $ancho = null; - if (strpos($this->_pdf_tabla_ancho, '%') !== false) { - $ancho = $this->_objeto_toba_salida->get_ancho(str_replace('%', '', $this->_pdf_tabla_ancho)); - } else { - $ancho = $this->_pdf_tabla_ancho; - } - $opciones = array('width' => $ancho, 'cols' => $estilos); - $opciones = array_merge($opciones, $this->get_opciones_columnas()); + if (isset($this->_pdf_tabla_ancho)) { + $ancho = $this->_pdf_tabla_ancho; + if (strpos($this->_pdf_tabla_ancho, '%') !== false) { + $ancho = $this->_objeto_toba_salida->get_ancho(str_replace('%', '', $this->_pdf_tabla_ancho)); + } + } + $opciones = array_merge(['width' => $ancho, 'cols' => $estilos], $this->get_opciones_columnas()); $this->_objeto_toba_salida->tabla(array('datos_tabla'=>$datos, 'titulos_columnas'=>$titulos), true, $this->_pdf_letra_tabla, $opciones); $this->_objeto_toba_salida->separacion($this->_pdf_sep_tabla); } @@ -122,20 +122,20 @@ function generar_layout_fila($columnas, $datos_cuadro, $id_fila, $formateo) { $fila = array(); foreach (array_keys($columnas) as $a) { - $valor = ""; + $valor = ''; if(isset($columnas[$a]["clave"])){ if(isset($datos_cuadro[$id_fila][$columnas[$a]["clave"]])){ $valor_real = $datos_cuadro[$id_fila][$columnas[$a]["clave"]]; }else{ - $valor_real = ''; + $valor_real = null; } //Hay que formatear? - if(isset($columnas[$a]["formateo"])){ + if(isset($columnas[$a]["formateo"]) && null !== $valor_real){ $funcion = "formato_" . $columnas[$a]["formateo"]; //Formateo el valor $valor = $formateo->$funcion($valor_real); } else { - $valor = $valor_real; + $valor = $valor_real ?? ''; } } $fila[$columnas[$a]["clave"]] = $valor; @@ -287,7 +287,7 @@ protected function pdf_get_fila_totales($totales, &$titulos=null, $resaltar=fals $datos[$clave] = $valor; }else{ unset($titulos[$clave]); - $datos[$clave] = null; + $datos[$clave] = ''; } } return $datos; diff --git a/php/nucleo/componentes/interface/toba_ei_cuadro_salida_xml.php b/php/nucleo/componentes/interface/toba_ei_cuadro_salida_xml.php index b62505e63e..12163ed82f 100644 --- a/php/nucleo/componentes/interface/toba_ei_cuadro_salida_xml.php +++ b/php/nucleo/componentes/interface/toba_ei_cuadro_salida_xml.php @@ -110,15 +110,15 @@ function generar_layout_fila($columnas, $datos_cuadro, $id_fila, $formateo) if(isset($datos_cuadro[$id_fila][$columnas[$a]["clave"]])){ $valor_real = $datos_cuadro[$id_fila][$columnas[$a]["clave"]]; }else{ - $valor_real = ''; + $valor_real = null; } //Hay que formatear? - if(isset($columnas[$a]["formateo"])){ + if(isset($columnas[$a]["formateo"]) && null !== $valor_real){ $funcion = "formato_" . $columnas[$a]["formateo"]; //Formateo el valor $valor = $formateo->$funcion($valor_real); } else { - $valor = $valor_real; + $valor = $valor_real ?? ''; } } $this->_objeto_toba_salida .= '<'.$this->xml_ns.'dato clave="'.$columnas[$a]["clave"].'" valor="'.$valor.'"/>'; diff --git a/php/nucleo/componentes/interface/toba_ei_filtro.php b/php/nucleo/componentes/interface/toba_ei_filtro.php index 3c56837882..3a03bd6a8d 100644 --- a/php/nucleo/componentes/interface/toba_ei_filtro.php +++ b/php/nucleo/componentes/interface/toba_ei_filtro.php @@ -188,7 +188,7 @@ protected function cargar_post() $validacion = $this->_columnas[$id]->validar_estado(); if ($validacion !== true) { $etiqueta = $this->_columnas[$id]->get_etiqueta(); - toba_logger::instancia()->error($etiqueta.': '.$validacion, $this->_columnas[$id]); + toba_logger::instancia()->error($etiqueta.': '.$validacion. ' ' .$this->_columnas[$id]->get_id()); throw new toba_error_validacion('Se produjo un error en la validación de la columna, revise el log'); } $this->_columnas_datos[$id] = $this->_columnas[$id]; @@ -484,8 +484,8 @@ function servicio__cascadas_columnas() if (trim($par) != '') { $param = explode("-;-", trim($par)); if (count($param) != 2) { - toba_logger::instancia()->error("Cascadas: Cantidad incorrecta de parametros ($par)."); - throw new toba_error_seguridad('Cascadas: parametros incorrectos.'); + toba_logger::instancia()->error("Cascadas: Cantidad incorrecta de parámetros ($par)."); + throw new toba_error_seguridad('Cascadas: parámetros incorrectos.'); } $id_col_maestro = $param[0]; @@ -504,7 +504,7 @@ function servicio__cascadas_columnas() //--- Manejo de claves múltiples if (count($valores) != count($campos)) { toba_logger::instancia()->error("Cascadas: El ef $id_col_maestro maneja distinta cantidad de datos que los campos pasados"); - throw new toba_error('Cascadas: parametros incorrectos.'); + throw new toba_error('Cascadas: parámetros incorrectos.'); } $valores_clave = array(); for ($i=0; $i < count($campos) ; $i++) { @@ -571,8 +571,8 @@ function servicio__filtrado_ef_ce() if (trim($par) != '') { $param = explode("-;-", trim($par)); if (count($param) != 2) { - toba_logger::instancia()->error("Filtrado de combo editable: Cantidad incorrecta de parametros ($par)."); - throw new toba_error_seguridad('Filtrado de combo editable: parametros incorrectos.'); + toba_logger::instancia()->error("Filtrado de combo editable: Cantidad incorrecta de parámetros ($par)."); + throw new toba_error_seguridad('Filtrado de combo editable: parámetros incorrectos.'); } $id_ef_maestro = $param[0]; @@ -591,7 +591,7 @@ function servicio__filtrado_ef_ce() //--- Manejo de claves múltiples if (count($valores) != count($campos)) { toba_logger::instancia()->error("Filtrado de combo editable: El ef $id_ef_maestro maneja distinta cantidad de datos que los campos pasados"); - throw new toba_error_def('Filtrado de combo editable: parametros incorrectos.'); + throw new toba_error_def('Filtrado de combo editable: parámetros incorrectos.'); } $valores_clave = array(); for ($i=0; $i < count($campos) ; $i++) { @@ -787,7 +787,7 @@ protected function generar_cuerpo_impresion() //-- Valor $fn_formateo = $columna->get_formateo(); - if (! is_null($fn_formateo)){ + if (! is_null($fn_formateo) && $columna->get_ef()->tiene_estado()){ $formateo = new $this->_clase_formateo('impresion_html'); $funcion = "formato_" . $fn_formateo; $valor_real = $columna->get_ef()->get_estado(); @@ -852,7 +852,7 @@ function vista_pdf( $salida ) $condicion = $columna->condicion()->get_etiqueta(); $fn_formateo = $columna->get_formateo(); - if (! is_null($fn_formateo)) { + if (! is_null($fn_formateo) && null !== $columna->get_pdf_valor()) { $funcion = "formato_" . $fn_formateo; $valor_real = $columna->get_pdf_valor(); $valor = $formateo->$funcion($valor_real); @@ -864,11 +864,12 @@ function vista_pdf( $salida ) } //-- Genera la tabla $ancho = null; - if (strpos($this->_pdf_tabla_ancho, '%') !== false) { - $ancho = $salida->get_ancho(str_replace('%', '', $this->_pdf_tabla_ancho)); - } elseif (isset($this->_pdf_tabla_ancho)) { - $ancho = $this->_pdf_tabla_ancho; - } + if (isset($this->_pdf_tabla_ancho)) { + $ancho = $this->_pdf_tabla_ancho; + if (strpos($this->_pdf_tabla_ancho, '%') !== false) { + $ancho = $salida->get_ancho(str_replace('%', '', $this->_pdf_tabla_ancho)); + } + } $opciones = $this->_pdf_tabla_opciones; if (isset($ancho)) { $opciones['width'] = $ancho; @@ -897,7 +898,7 @@ function vista_excel(toba_vista_excel $salida) //Hay que formatear? $estilo = array(); $fn_formateo = $columna->get_formateo(); - if (! is_null($fn_formateo)){ + if (! is_null($fn_formateo) && null !== $columna->get_excel_valor()){ $funcion = "formato_" . $fn_formateo; $valor_real = $columna->get_excel_valor(); list($valor, $estilo) = $formateo->$funcion($valor_real); @@ -965,7 +966,7 @@ function vista_xml($inicial=false, $xmlns=null) $condicion = $columna->condicion()->get_etiqueta(); $fn_formateo = $columna->get_formateo(); - if (! is_null($fn_formateo)){ + if (! is_null($fn_formateo) && null !== $columna->get_ef()->get_estado()){ $funcion = "formato_" . $fn_formateo; $valor_real = $columna->get_ef()->get_estado(); $valor = $formateo->$funcion($valor_real); diff --git a/php/nucleo/componentes/interface/toba_ei_formulario.php b/php/nucleo/componentes/interface/toba_ei_formulario.php index 0696c7b401..13dc62847e 100644 --- a/php/nucleo/componentes/interface/toba_ei_formulario.php +++ b/php/nucleo/componentes/interface/toba_ei_formulario.php @@ -173,7 +173,7 @@ protected function instanciar_ef($id_ef, $clase_ef, $indx, $clave_dato, $paramet $this->_nombre_formulario, $this->_info_formulario_ef[$indx]['identificador'], $this->_info_formulario_ef[$indx]['etiqueta'], - addslashes($this->_info_formulario_ef[$indx]['descripcion']), + addslashes($this->_info_formulario_ef[$indx]['descripcion']??''), $clave_dato, array($this->_info_formulario_ef[$indx]['obligatorio'], $this->_info_formulario_ef[$indx]['oculto_relaja_obligatorio']), @@ -406,8 +406,8 @@ function validar_estado() if ($validacion !== true) { $this->_efs_invalidos[$ef] = str_replace("'", '"', $validacion); $etiqueta = $this->_elemento_formulario[$ef]->get_etiqueta(); - toba_logger::instancia()->error($etiqueta.': '.$validacion, $this->ef($ef)); - throw new toba_error_validacion('Se produjo un error en la validacion del ef, revise el log'); + toba_logger::instancia()->error($etiqueta.': '.$validacion . ' ' .$this->ef($ef)->get_id()); + throw new toba_error_validacion('Se produjo un error en la validación del ef, revise el log'); } } } @@ -785,7 +785,7 @@ function servicio__cascadas_efs() toba_logger::instancia()->error($this->get_txt()." No existe ef '$id_ef'"); throw new toba_error_seguridad(' No existe el ef indicado'); } - $fila_actual = trim(toba::memoria()->get_parametro('cascadas-fila')); + $fila_actual = trim(toba::memoria()->get_parametro('cascadas-fila')??''); $maestros = array(); $cascadas_maestros = $this->_carga_opciones_ef->get_cascadas_maestros(); $ids_maestros = (!isset($cascadas_maestros[$id_ef]) || !is_array($cascadas_maestros[$id_ef])) ? [] : $cascadas_maestros[$id_ef]; @@ -793,8 +793,8 @@ function servicio__cascadas_efs() if (trim($par) != '') { $param = explode("-;-", trim($par)); if (count($param) != 2) { - toba_logger::instancia()->error("Cascadas: Cantidad incorrecta de parametros ($par)."); - throw new toba_error_seguridad('Cascadas: parametros incorrectos.'); + toba_logger::instancia()->error("Cascadas: Cantidad incorrecta de parámetros ($par)."); + throw new toba_error_seguridad('Cascadas: parámetros incorrectos.'); } $id_ef_maestro = $param[0]; @@ -813,7 +813,7 @@ function servicio__cascadas_efs() //--- Manejo de claves múltiples if (count($valores) != count($campos)) { toba_logger::instancia()->error("Cascadas: El ef $id_ef_maestro maneja distinta cantidad de datos que los campos pasados"); - throw new toba_error('Cascadas: parametros incorrectos.'); + throw new toba_error('Cascadas: parámetros incorrectos.'); } $valores_clave = array(); for ($i=0; $i < count($campos) ; $i++) { @@ -883,7 +883,7 @@ function servicio__filtrado_ef_ce() } $filtro = trim(toba::memoria()->get_parametro('filtrado-ce-valor')); - $fila_actual = trim(toba::memoria()->get_parametro('filtrado-ce-fila')); + $fila_actual = trim(toba::memoria()->get_parametro('filtrado-ce-fila')??''); $maestros = array($id_ef => $filtro); $cascadas_maestros = $this->_carga_opciones_ef->get_cascadas_maestros(); $ids_maestros = (!isset($cascadas_maestros[$id_ef]) || !is_array($cascadas_maestros[$id_ef])) ? [] : $cascadas_maestros[$id_ef]; @@ -891,8 +891,8 @@ function servicio__filtrado_ef_ce() if (trim($par) != '') { $param = explode("-;-", trim($par)); if (count($param) != 2) { - toba_logger::instancia()->error("Filtrado de combo editable: Cantidad incorrecta de parametros ($par)."); - throw new toba_error_seguridad('Filtrado de combo editable: parametros incorrectos.'); + toba_logger::instancia()->error("Filtrado de combo editable: Cantidad incorrecta de parámetros ($par)."); + throw new toba_error_seguridad('Filtrado de combo editable: parámetros incorrectos.'); } $id_ef_maestro = $param[0]; @@ -911,7 +911,7 @@ function servicio__filtrado_ef_ce() //--- Manejo de claves múltiples if (count($valores) != count($campos)) { toba_logger::instancia()->error("Filtrado de combo editable: El ef $id_ef_maestro maneja distinta cantidad de datos que los campos pasados"); - throw new toba_error_def('Filtrado de combo editable: parametros incorrectos.'); + throw new toba_error_def('Filtrado de combo editable: parámetros incorrectos.'); } $valores_clave = array(); for ($i=0; $i < count($campos) ; $i++) { @@ -1198,10 +1198,10 @@ protected function get_html_impresion_ef($ef) $html .= $this->_elemento_formulario[$ef]->get_etiqueta(); $html .= "\n"; //Hay que formatear? - if(isset($this->_info_formulario_ef[$ef]["formateo"])){ + $valor_real = $this->_elemento_formulario[$ef]->get_estado(); + if(isset($this->_info_formulario_ef[$ef]["formateo"]) && null !== $valor_real){ $formateo = new $this->_clase_formateo('impresion_html'); $funcion = "formato_" . $this->_info_formulario_ef[$ef]["formateo"]; - $valor_real = $this->_elemento_formulario[$ef]->get_estado(); $valor = $formateo->$funcion($valor_real); } else { $valor = $this->_elemento_formulario[$ef]->get_descripcion_estado('impresion_html'); @@ -1427,9 +1427,9 @@ function vista_pdf( $salida ) if ($this->_elemento_formulario[$ef]->tiene_estado()) { $etiqueta = $this->_elemento_formulario[$ef]->get_etiqueta(); //Hay que formatear? Le meto pa'delante... - if(isset($this->_info_formulario_ef[$ef]["formateo"])){ + $valor_real = $this->_elemento_formulario[$ef]->get_estado(); + if(isset($this->_info_formulario_ef[$ef]["formateo"]) && null !== $valor_real){ $funcion = "formato_" . $this->_info_formulario_ef[$ef]["formateo"]; - $valor_real = $this->_elemento_formulario[$ef]->get_estado(); $valor = $formateo->$funcion($valor_real); }else{ $valor = $this->_elemento_formulario[$ef]->get_descripcion_estado('pdf'); @@ -1439,10 +1439,11 @@ function vista_pdf( $salida ) } //-- Genera la tabla $ancho = null; - if (strpos($this->_pdf_tabla_ancho, '%') !== false) { - $ancho = $salida->get_ancho(str_replace('%', '', $this->_pdf_tabla_ancho)); - } elseif (isset($this->_pdf_tabla_ancho)) { - $ancho = $this->_pdf_tabla_ancho; + if (isset($this->_pdf_tabla_ancho)) { + $ancho = $this->_pdf_tabla_ancho; + if (strpos($this->_pdf_tabla_ancho, '%') !== false) { + $ancho = $salida->get_ancho(str_replace('%', '', $this->_pdf_tabla_ancho)); + } } $opciones = $this->_pdf_tabla_opciones; if (isset($ancho)) { @@ -1462,9 +1463,9 @@ function get_valores_pdf( $id_ef ) { $formateo = new $this->_clase_formateo('pdf'); $etiqueta = $this->_elemento_formulario[$id_ef]->get_etiqueta(); //Hay que formatear? Le meto pa'delante... - if(isset($this->_info_formulario_ef[$id_ef]["formateo"])){ - $funcion = "formato_" . $this->_info_formulario_ef[$id_ef]["formateo"]; - $valor_real = $this->_elemento_formulario[$id_ef]->get_estado(); + $valor_real = $this->_elemento_formulario[$id_ef]->get_estado(); + if(isset($this->_info_formulario_ef[$id_ef]["formateo"]) && null !== $valor_real){ + $funcion = "formato_" . $this->_info_formulario_ef[$id_ef]["formateo"]; $valor = $formateo->$funcion($valor_real); }else{ $valor = $this->_elemento_formulario[$id_ef]->get_descripcion_estado('pdf'); @@ -1489,9 +1490,9 @@ function vista_excel(toba_vista_excel $salida) $etiqueta = $this->_elemento_formulario[$ef]->get_etiqueta(); //Hay que formatear? $estilo = array(); - if(isset($this->_info_formulario_ef[$ef]["formateo"])){ + $valor_real = $this->_elemento_formulario[$ef]->get_estado(); + if(isset($this->_info_formulario_ef[$ef]["formateo"]) && null !== $valor_real){ $funcion = "formato_" . $this->_info_formulario_ef[$ef]["formateo"]; - $valor_real = $this->_elemento_formulario[$ef]->get_estado(); list($valor, $estilo) = $formateo->$funcion($valor_real); }else{ list($valor, $estilo) = $this->_elemento_formulario[$ef]->get_descripcion_estado('excel'); @@ -1544,10 +1545,11 @@ function vista_xml($inicial=false, $xmlns=null) $formateo = new $this->_clase_formateo('pdf'); $ancho = null; - if (strpos($this->_pdf_tabla_ancho, '%') !== false) { - $ancho = $salida->get_ancho(str_replace('%', '', $this->_pdf_tabla_ancho)); - } elseif (isset($this->_pdf_tabla_ancho)) { - $ancho = $this->_pdf_tabla_ancho; + if (isset($this->_pdf_tabla_ancho)) { + $ancho = $this->_pdf_tabla_ancho; + if (strpos($this->_pdf_tabla_ancho, '%') !== false) { + $ancho = $salida->get_ancho(str_replace('%', '', $this->_pdf_tabla_ancho)); + } } $opciones = $this->_pdf_tabla_opciones; if (isset($ancho)) { @@ -1568,9 +1570,9 @@ function vista_xml($inicial=false, $xmlns=null) if ($this->_elemento_formulario[$ef]->tiene_estado() && (!isset($this->xml_ef_no_procesar) || !in_array($ef,$this->xml_ef_no_procesar))) { $etiqueta = $this->_elemento_formulario[$ef]->get_etiqueta(); //Hay que formatear? Le meto pa'delante... - if(isset($this->_info_formulario_ef[$ef]["formateo"])){ + $valor_real = $this->_elemento_formulario[$ef]->get_estado(); + if(isset($this->_info_formulario_ef[$ef]["formateo"]) && null !== $valor_real){ $funcion = "formato_" . $this->_info_formulario_ef[$ef]["formateo"]; - $valor_real = $this->_elemento_formulario[$ef]->get_estado(); $valor = $formateo->$funcion($valor_real); }else{ $valor = $this->_elemento_formulario[$ef]->get_descripcion_estado('pdf'); diff --git a/php/nucleo/componentes/interface/toba_ei_formulario_ml.php b/php/nucleo/componentes/interface/toba_ei_formulario_ml.php index f8b022c0f2..fee0ac56e3 100644 --- a/php/nucleo/componentes/interface/toba_ei_formulario_ml.php +++ b/php/nucleo/componentes/interface/toba_ei_formulario_ml.php @@ -358,8 +358,8 @@ function validar_estado() if ($validacion !== true) { $this->_efs_invalidos[$id_fila][$ef] = $validacion; $etiqueta = $this->_elemento_formulario[$ef]->get_etiqueta(); - toba_logger::instancia()->error($etiqueta.': '.$validacion, $this->ef($ef)); - throw new toba_error_validacion('Se produjo un error en la validacion del ef, revise el log'); + toba_logger::instancia()->error($etiqueta.': '.$validacion . ' '. $this->ef($ef)->get_id()); + throw new toba_error_validacion('Se produjo un error en la validación del ef, revise el log'); } } } @@ -496,9 +496,9 @@ function pre_configurar() function set_datos($datos, $set_cargado=true) { if (!is_array($datos)) { - toba_logger::instancia()->error( $this->get_txt() . ' El parametro para cargar el ML posee un formato incorrecto:' . + toba_logger::instancia()->error( $this->get_txt() . ' El parámetro para cargar el ML posee un formato incorrecto:' . 'Se esperaba un arreglo de dos dimensiones con formato recordset.' . var_export($datos, true)); - throw new toba_error_def(' El parametro para cargar el ML posee un formato incorrecto, revise el log'); + throw new toba_error_def(' El parámetro para cargar el ML posee un formato incorrecto, revise el log'); } $this->_filas_recibidas = array(); @@ -1120,9 +1120,9 @@ function vista_impresion_html( toba_impresion $salida ) } foreach ($this->_lista_ef_post as $ef){ $this->_elemento_formulario[$ef]->ir_a_fila($fila); - if(isset($this->_info_formulario_ef[$ef]["formateo"])){ - $funcion = "formato_" . $this->_info_formulario_ef[$ef]["formateo"]; - $valor_real = $this->_elemento_formulario[$ef]->get_estado(); + $valor_real = $this->_elemento_formulario[$ef]->get_estado(); + if(isset($this->_info_formulario_ef[$ef]["formateo"]) && null !== $valor_real){ + $funcion = "formato_" . $this->_info_formulario_ef[$ef]["formateo"]; $valor = $formateo->$funcion($valor_real); }else{ $valor = $this->_elemento_formulario[$ef]->get_descripcion_estado('impresion_html'); @@ -1164,9 +1164,9 @@ function vista_pdf( $salida ) foreach ($this->_lista_ef_post as $ef){ $this->_elemento_formulario[$ef]->ir_a_fila($fila); //Hay que formatear? Le meto pa'delante... - if(isset($this->_info_formulario_ef[$ef]["formateo"])){ - $funcion = "formato_" . $this->_info_formulario_ef[$ef]["formateo"]; - $valor_real = $this->_elemento_formulario[$ef]->get_estado(); + $valor_real = $this->_elemento_formulario[$ef]->get_estado(); + if(isset($this->_info_formulario_ef[$ef]["formateo"]) && null !== $valor_real){ + $funcion = "formato_" . $this->_info_formulario_ef[$ef]["formateo"]; $valor = $formateo->$funcion($valor_real); }else{ $valor = $this->_elemento_formulario[$ef]->get_descripcion_estado('pdf'); @@ -1179,10 +1179,11 @@ function vista_pdf( $salida ) //-- Genera la tabla $ancho = null; - if (strpos($this->_pdf_tabla_ancho, '%') !== false) { - $ancho = $salida->get_ancho(str_replace('%', '', $this->_pdf_tabla_ancho)); - } elseif (isset($this->_pdf_tabla_ancho)) { - $ancho = $this->_pdf_tabla_ancho; + if (isset($this->_pdf_tabla_ancho)) { + $ancho = $this->_pdf_tabla_ancho; + if (strpos($this->_pdf_tabla_ancho, '%') !== false) { + $ancho = $salida->get_ancho(str_replace('%', '', $this->_pdf_tabla_ancho)); + } } $opciones = $this->_pdf_tabla_opciones; if (isset($ancho)) { @@ -1218,9 +1219,9 @@ function vista_excel(toba_vista_excel $salida) $datos_temp = array(); foreach ($this->_lista_ef_post as $ef){ $this->_elemento_formulario[$ef]->ir_a_fila($fila); - if(isset($this->_info_formulario_ef[$ef]["formateo"])){ - $funcion = "formato_" . $this->_info_formulario_ef[$ef]["formateo"]; - $valor_real = $this->_elemento_formulario[$ef]->get_estado(); + $valor_real = $this->_elemento_formulario[$ef]->get_estado(); + if(isset($this->_info_formulario_ef[$ef]["formateo"]) && null !== $valor_real){ + $funcion = "formato_" . $this->_info_formulario_ef[$ef]["formateo"]; list($valor, $estilo) = $formateo->$funcion($valor_real); }else{ list($valor, $estilo) = $this->_elemento_formulario[$ef]->get_descripcion_estado('excel'); @@ -1297,9 +1298,9 @@ function vista_xml($inicial=false, $xmlns=null) foreach ($this->_lista_ef_post as $ef){ $this->_elemento_formulario[$ef]->ir_a_fila($fila); //Hay que formatear? Le meto pa'delante... - if(isset($this->_info_formulario_ef[$ef]["formateo"])){ + $valor_real = $this->_elemento_formulario[$ef]->get_estado(); + if(isset($this->_info_formulario_ef[$ef]["formateo"]) && null !== $valor_real){ $funcion = "formato_" . $this->_info_formulario_ef[$ef]["formateo"]; - $valor_real = $this->_elemento_formulario[$ef]->get_estado(); $valor = $formateo->$funcion($valor_real); }else{ $valor = $this->_elemento_formulario[$ef]->get_descripcion_estado('xml'); diff --git a/php/nucleo/componentes/interface/toba_ei_pantalla.php b/php/nucleo/componentes/interface/toba_ei_pantalla.php index ef7ca18702..53472ea13a 100644 --- a/php/nucleo/componentes/interface/toba_ei_pantalla.php +++ b/php/nucleo/componentes/interface/toba_ei_pantalla.php @@ -132,7 +132,7 @@ function set_template($template) */ function get_descripcion() { - return trim($this->_info_pantalla["descripcion"]); + return trim($this->_info_pantalla["descripcion"]??''); } /** diff --git a/php/nucleo/componentes/persistencia/toba_ap_relacion_db.php b/php/nucleo/componentes/persistencia/toba_ap_relacion_db.php index 985a9c710a..5f9ddf0dd5 100644 --- a/php/nucleo/componentes/persistencia/toba_ap_relacion_db.php +++ b/php/nucleo/componentes/persistencia/toba_ap_relacion_db.php @@ -204,18 +204,18 @@ protected function proceso_sincronizacion($usar_cursores=false, $filas_tablas=nu { if(isset($filas_tablas)){ if (!is_array($filas_tablas)) { - throw new toba_error("La sincronizacion por filas requiere que se indiquen las filas a sincronizar por tabla en un array."); + throw new toba_error("La sincronización por filas requiere que se indiquen las filas a sincronizar por tabla en un array."); } if ($usar_cursores) { - throw new toba_error("La sincronizacion por filas no puede utilizarse junto a la sincronizacion por cursores."); + throw new toba_error("La sincronización por filas no puede utilizarse junto a la sincronización por cursores."); } $sincro_por_filas = true; - toba::logger()->info("AP_RELACION: Sincronizacion por FILAS", 'toba'); + toba::logger()->info("AP_RELACION: Sincronización por FILAS", 'toba'); } else { $sincro_por_filas = false; } if($usar_cursores) { - toba::logger()->info("AP_RELACION: Sincronizacion con CURSORES", 'toba'); + toba::logger()->info("AP_RELACION: Sincronización con CURSORES", 'toba'); } $tablas = $this->objeto_relacion->orden_sincronizacion(); @@ -235,8 +235,8 @@ protected function proceso_sincronizacion($usar_cursores=false, $filas_tablas=nu } elseif ($sincro_por_filas) { if(isset($filas_tablas[$tabla])) { if (!is_array($filas_tablas[$tabla])) { - toba_logger::instancia()->error("Sincronizacion por filas: error en la definicion de las filas de la tabla: $tabla. El parametro debe ser un array"); - throw new toba_error('Sincronizacion por filas: error en la definicion de las filas. Revise el log'); + toba_logger::instancia()->error("Sincronización por filas: error en la definición de las filas de la tabla: $tabla. El parametro debe ser un array"); + throw new toba_error('Sincronización por filas: error en la definición de las filas. Revise el log'); } $tabla->persistidor()->sincronizar_eliminados($filas_tablas[$tabla]); } @@ -257,8 +257,8 @@ protected function proceso_sincronizacion($usar_cursores=false, $filas_tablas=nu } elseif ($sincro_por_filas) { if(isset($filas_tablas[$tabla])) { if (!is_array($filas_tablas[$tabla])) { - toba_logger::instancia()->error("Sincronizacion por filas: error en la definicion de las filas de la tabla: $tabla. El parametro debe ser un array"); - throw new toba_error('Sincronizacion por filas: error en la definicion de las filas. Revise el log'); + toba_logger::instancia()->error("Sincronización por filas: error en la definición de las filas de la tabla: $tabla. El parametro debe ser un array"); + throw new toba_error('Sincronización por filas: error en la definición de las filas. Revise el log'); } $tabla->persistidor()->sincronizar_insertados($filas_tablas[$tabla]); $tabla->notificar_hijos_sincronizacion($filas_tablas[$tabla]); @@ -280,8 +280,8 @@ protected function proceso_sincronizacion($usar_cursores=false, $filas_tablas=nu } elseif ($sincro_por_filas) { if(isset($filas_tablas[$tabla])) { if (!is_array($filas_tablas[$tabla])) { - toba_logger::instancia()->error("Sincronizacion por filas: error en la definicion de las filas de la tabla: $tabla. El parametro debe ser un array"); - throw new toba_error('Sincronizacion por filas: error en la definicion de las filas. Revise el log'); + toba_logger::instancia()->error("Sincronización por filas: error en la definición de las filas de la tabla: $tabla. El parametro debe ser un array"); + throw new toba_error('Sincronización por filas: error en la definición de las filas. Revise el log'); } $tabla->persistidor()->sincronizar_actualizados($filas_tablas[$tabla]); $tabla->notificar_hijos_sincronizacion($filas_tablas[$tabla]); diff --git a/php/nucleo/componentes/persistencia/toba_ap_tabla_db.php b/php/nucleo/componentes/persistencia/toba_ap_tabla_db.php index c7c258d24d..8c58ea21b4 100644 --- a/php/nucleo/componentes/persistencia/toba_ap_tabla_db.php +++ b/php/nucleo/componentes/persistencia/toba_ap_tabla_db.php @@ -169,7 +169,7 @@ function activar_proceso_carga_externa_sql($sql, $col_parametros, $col_resultado * Una columna externa no participa en la sincronización posterior, pero por necesidades casi siempre estéticas * necesitan mantenerse junto al conjunto de datos. * - * @param string $metodo Método que obtiene los datos. + * @param string $método Método que obtiene los datos. * @param string $clase Clase a la que pertenece el método. Si es NULL usa el mismo AP * @param string $include Archivo donde se encuentra la clase. Si es NULL usa el mismo AP * @param array $col_parametros Columnas que espera recibir el DAO. @@ -178,7 +178,7 @@ function activar_proceso_carga_externa_sql($sql, $col_parametros, $col_resultado * @param boolean $estricto Indica si es imperioso que la columna externa posea un estado o se * permite que no posea valor. */ - function activar_proceso_carga_externa_dao($metodo, $clase=null, $include=null, $col_parametros, $col_resultado, $sincro_continua=true, $estricto=true, $carga_masiva = 0, $metodo_masivo = '') + function activar_proceso_carga_externa_dao($metodo, $clase=null, $include=null, $col_parametros=[], $col_resultado=[], $sincro_continua=true, $estricto=true, $carga_masiva = 0, $metodo_masivo = '') { $proximo = count($this->_proceso_carga_externa); $this->_proceso_carga_externa[$proximo]["tipo"] = "dao"; @@ -1275,13 +1275,13 @@ protected function usar_metodo_dao($param_dao, $parametros, $es_carga_inicial = if (!class_exists($parametros['clase'])) { require_once($parametros['include']); } - $datos = call_user_func_array(array($parametros['clase'],$nombre_metodo), $param_dao); + $datos = call_user_func_array(array($parametros['clase'],$nombre_metodo), array_values($param_dao)); } else { if (method_exists($this, $nombre_metodo)) { - $datos = call_user_func_array(array($this,$nombre_metodo), $param_dao); + $datos = call_user_func_array(array($this,$nombre_metodo), array_values($param_dao)); }else { - $this->log(' ERROR en la carga de una columna externa. El metodo: '. $nombre_metodo .' no esta definido', 'error'); - throw new toba_error_def('AP_TABLA_DB: ERROR en la carga de una columna externa. Metodo no definido, revise el log'); + $this->log(' ERROR en la carga de una columna externa. El método: '. $nombre_metodo .' no esta definido', 'error'); + throw new toba_error_def('AP_TABLA_DB: ERROR en la carga de una columna externa. Método no definido, revise el log'); } } return $datos; @@ -1301,9 +1301,9 @@ protected function usar_metodo_dt($param_dt, $parametros, $es_carga_inicial = fa if (! method_exists($dt, $nombre_metodo)) { $clase = get_class($dt); $this->log("ERROR en la carga de una columna externa. No existe el método '$nombre_metodo' de la clase '$clase'", 'error'); - throw new toba_error_def('AP_TABLA_DB: ERROR en la carga de una columna externa. Metodo no definido, revise el log'); + throw new toba_error_def('AP_TABLA_DB: ERROR en la carga de una columna externa. Método no definido, revise el log'); } - $datos = call_user_func_array(array($dt, $nombre_metodo), $param_dt); + $datos = call_user_func_array(array($dt, $nombre_metodo), array_values($param_dt)); return $datos; } @@ -1318,10 +1318,10 @@ protected function usar_clase_consulta_php($param_clase, $parametros, $es_carga_ //Recupero el objeto asociado a la clase php $obj = toba::consulta_php($parametros['clase']); if (method_exists($obj, $nombre_metodo)) { - $datos = call_user_func_array(array($obj,$nombre_metodo), $param_clase); + $datos = call_user_func_array(array($obj,$nombre_metodo), array_values($param_clase)); }else { - $this->log(' ERROR en la carga de una columna externa. El metodo: '. $nombre_metodo .' no esta definido en la clase de consulta '. $parametros['clase'], 'error'); - throw new toba_error_def('AP_TABLA_DB: ERROR en la carga de una columna externa. Metodo no definido, revise el log'); + $this->log(' ERROR en la carga de una columna externa. El método: '. $nombre_metodo .' no esta definido en la clase de consulta '. $parametros['clase'], 'error'); + throw new toba_error_def('AP_TABLA_DB: ERROR en la carga de una columna externa. Método no definido, revise el log'); } return $datos; } @@ -1408,7 +1408,7 @@ protected function verificar_existencia_valores($fila, $parametros, $evento = nu foreach( $parametros['col_parametro'] as $col_llave ) { if (isset($evento) && isset($this->_secuencias[$col_llave])) { toba_logger::instancia()->error("AP_TABLA: [{$this->_tabla}]:\n No puede actualizarse en linea un valor que dependende de una secuencia ($col_llave)"); - throw new toba_error_def('AP_TABLA_DB: No puede actualizarse en linea un valor secuencia, revise el log'); + throw new toba_error_def('AP_TABLA_DB: No puede actualizarse en línea un valor secuencia, revise el log'); } if (!isset($fila[$col_llave])) { $estan_todos = false; diff --git a/php/nucleo/componentes/persistencia/toba_datos_busqueda.php b/php/nucleo/componentes/persistencia/toba_datos_busqueda.php index 2fbf837b5c..e924161a7f 100644 --- a/php/nucleo/componentes/persistencia/toba_datos_busqueda.php +++ b/php/nucleo/componentes/persistencia/toba_datos_busqueda.php @@ -117,7 +117,7 @@ function set_columnas_orden($cols = array()) foreach($cols as $columna => $sentido) { if (! in_array($columna, $cols_existentes)) { toba_logger::instancia()->error('La columna por la que intenta ordenar no existe: '. $columna); - throw new toba_error_def('Parametro de ordenamiento incorrecto, revise el log'); + throw new toba_error_def('Parámetro de ordenamiento incorrecto, revise el log'); } } $this->_info_orden_col = $cols; diff --git a/php/nucleo/componentes/persistencia/toba_datos_tabla.php b/php/nucleo/componentes/persistencia/toba_datos_tabla.php index 05cadc2a73..2d9eafd780 100644 --- a/php/nucleo/componentes/persistencia/toba_datos_tabla.php +++ b/php/nucleo/componentes/persistencia/toba_datos_tabla.php @@ -476,8 +476,8 @@ function set_cursor($id) $this->_cursor = $id; $this->log("Nuevo cursor '{$this->_cursor}' en reemplazo del anterior '{$this->_cursor_original}'"); }else{ - toba_logger::instancia()->error($this->get_txt() . "La fila '$id' no es valida"); - throw new toba_error_def('La fila solicitada no es valida'); + toba_logger::instancia()->error($this->get_txt() . "La fila '$id' no es válida"); + throw new toba_error_def('La fila solicitada no es válida'); } } @@ -664,7 +664,7 @@ function get_id_fila_condicion($condiciones=null, $usar_cursores=true) } if( !isset($this->_columnas[$columna]) ){ toba_logger::instancia()->error("El campo '$columna' no existe. No es posible filtrar por dicho campo"); - throw new toba_error_def('Parametro de filtrado incorrecto, revise el log'); + throw new toba_error_def('Párametro de filtrado incorrecto, revise el log'); } if(!isset($this->_datos[$id_fila][$columna])) { // Es posible que una fila no posea una columa. Ej: una nueva fila no tiene la clave si esta es una secuencia. @@ -1011,12 +1011,12 @@ function set_fila_columna_valor($id, $columna, $valor) if( isset($this->_columnas[$columna]) ){ $this->modificar_fila($id, array($columna => $valor)); }else{ - toba_logger::instancia()->error("La columna '$columna' no es valida"); - throw new toba_error_def('Columna no valida, revise el log'); + toba_logger::instancia()->error("La columna '$columna' no es válida"); + throw new toba_error_def('Columna no válida, revise el log'); } }else{ - toba_logger::instancia()->error("La fila '$id' no es valida"); - throw new toba_error_def('La fila no es valida, revise el log'); + toba_logger::instancia()->error("La fila '$id' no es válida"); + throw new toba_error_def('La fila no es válida, revise el log'); } } @@ -1030,8 +1030,8 @@ function set_fila_columna_valor($id, $columna, $valor) function set_columna_valor($columna, $valor, $con_cursores=false) { if(! isset($this->_columnas[$columna]) ) { - toba_logger::instancia()->error("La columna '$columna' no es valida"); - throw new toba_error_def('La columna no es valida, revise el log'); + toba_logger::instancia()->error("La columna '$columna' no es válida"); + throw new toba_error_def('La columna no es válida, revise el log'); } foreach($this->get_id_filas($con_cursores) as $fila) { $this->modificar_fila($fila, array($columna => $valor)); @@ -1248,7 +1248,7 @@ private function validar_fila($fila, $id=null) { if(!is_array($fila)){ toba_logger::instancia()->error($this->get_txt() . ' La fila debe ser una array'); - throw new toba_error_def(' La fila no es valida, revise el log'); + throw new toba_error_def(' La fila no es válida, revise el log'); } $this->evt__validar_ingreso($fila, $id); $this->control_estructura_fila($fila); @@ -1387,7 +1387,7 @@ protected function control_tope_minimo_filas() { if ($this->_tope_min_filas != 0 && $this->get_cantidad_filas() < $this->_tope_min_filas) { toba_logger::instancia()->error("La tabla {$this->_id_en_controlador} requiere ingresar al menos {$this->_tope_min_filas} registro/s (se encontraron sólo {$this->get_cantidad_filas()})."); - throw new toba_error_validacion('El numero de filas enviadas no es adecuado'); + throw new toba_error_validacion('El número de filas enviadas no es adecuado'); } } @@ -1398,7 +1398,7 @@ protected function control_tope_maximo_filas($cantidad) { if (($this->_tope_max_filas != 0) && ($cantidad > $this->_tope_max_filas)) { toba_logger::instancia()->error("No está permitido ingresar más de {$this->_tope_max_filas} registros en la tabla {$this->_id_en_controlador} (se encontraron $cantidad)."); - throw new toba_error_validacion('El numero de filas enviadas no es adecuado'); + throw new toba_error_validacion('El número de filas enviadas no es adecuado'); } } @@ -1418,8 +1418,8 @@ function persistidor() $clase = $this->_info_estructura['ap_sub_clase']; $include = $this->_info_estructura['ap_sub_clase_archivo']; if( (trim($clase) == '' ) ){ - toba_logger::instancia()->error($this->get_txt() . 'Error en la definicion, falta definir la subclase'); - throw new toba_error_def('Error de definicion del persistidor, revise el log'); + toba_logger::instancia()->error($this->get_txt() . 'Error en la definición, falta definir la subclase'); + throw new toba_error_def('Error de definición del persistidor, revise el log'); } }else{ $clase = 'toba_'.$this->_info_estructura['ap_clase']; @@ -1940,13 +1940,17 @@ function es_campo_modificado($campo, $id_viejos, $datos_nuevos) */ function get_xml($xml) { - // Recupera los datos del registro marcado por el cursor - $datos = $this->get(); - - // Para cada columna, la agrega como atributo del nodo - foreach($datos as $clave => $valor){ - $xml->addAttribute($clave,utf8_encode($valor)); - } + // Recupera los datos del registro marcado por el cursor + $datos = $this->get(); + $id_fila = $this->get_cursor(); + + // Para cada columna, la agrega como atributo del nodo + foreach($datos as $clave => $valor){ + //Chequeo explicitamente que no se trate de un campo blob + if (!isset($this->_blobs[$id_fila][$clave])) { + $xml->addAttribute($clave, utf8_encode(strval($valor))); + } + } } } diff --git a/php/nucleo/componentes/toba_constructor.php b/php/nucleo/componentes/toba_constructor.php index fddde9f7e2..bdb5f08531 100644 --- a/php/nucleo/componentes/toba_constructor.php +++ b/php/nucleo/componentes/toba_constructor.php @@ -178,8 +178,8 @@ static function control_clave_valida( $clave_componente ) if(! is_array($clave_componente) || !isset($clave_componente['componente']) || !isset($clave_componente['proyecto']) ) { - toba_logger::instancia()->error('La clave utilizada para invocar el componente no es valida: '.var_export($clave_componente, true)); - throw new toba_error_def('La clave utilizada para el componente no es valida o no se encontro, revise el log'); + toba_logger::instancia()->error('La clave utilizada para invocar el componente no es válida: '.var_export($clave_componente, true)); + throw new toba_error_def('La clave utilizada para el componente no es válida o no se encontro, revise el log'); } } diff --git a/php/nucleo/lib/interface/toba_ei_grafico/toba_ei_grafico_conf_especifico.php b/php/nucleo/lib/interface/toba_ei_grafico/toba_ei_grafico_conf_especifico.php index 54d3d0b871..cdfff39be1 100644 --- a/php/nucleo/lib/interface/toba_ei_grafico/toba_ei_grafico_conf_especifico.php +++ b/php/nucleo/lib/interface/toba_ei_grafico/toba_ei_grafico_conf_especifico.php @@ -129,7 +129,7 @@ function serie($id_serie) { if (!isset($this->series[$id_serie])) { toba_logger::instancia()->error("No existe la serie $id_serie"); - throw new toba_error('Identificador de serie no encontrado o no valido'); + throw new toba_error('Identificador de serie no encontrado o no válido'); } return $this->series[$id_serie]; diff --git a/php/nucleo/lib/interface/toba_formateo.php b/php/nucleo/lib/interface/toba_formateo.php index aaa186d0b8..24c27b2e0d 100644 --- a/php/nucleo/lib/interface/toba_formateo.php +++ b/php/nucleo/lib/interface/toba_formateo.php @@ -92,7 +92,7 @@ function formato_moneda($valor) return '$'.$this->get_separador(). number_format($valor,2,',','.'); } else { return array($valor, array('numberFormat' => - array('formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE) + array('formatCode' => toba_vista_excel::FORMAT_CURRENCY_CUSTOM) )); } } diff --git a/php/nucleo/lib/salidas/toba_imagen_captcha.php b/php/nucleo/lib/salidas/toba_imagen_captcha.php index 137935281b..a93fc88685 100644 --- a/php/nucleo/lib/salidas/toba_imagen_captcha.php +++ b/php/nucleo/lib/salidas/toba_imagen_captcha.php @@ -90,7 +90,8 @@ function set_codigo($codigo) */ function get_codigo() { - return parent::getCode(false, true); + $obj = parent::getCode(false, true); + return !empty($obj) ? $obj->code_display: ''; } /** diff --git a/php/nucleo/lib/salidas/toba_impr_html.php b/php/nucleo/lib/salidas/toba_impr_html.php index d7657b9db7..8af1b95a26 100644 --- a/php/nucleo/lib/salidas/toba_impr_html.php +++ b/php/nucleo/lib/salidas/toba_impr_html.php @@ -34,7 +34,7 @@ function generar_salida() protected function generar_html_encabezado() { echo ""; - $estilo = toba::proyecto()->get_parametro('estilo'); + //$estilo = toba::proyecto()->get_parametro('estilo'); echo toba_recurso::link_css("toba_impr", 'screen'); echo toba_recurso::link_css("toba_impr", 'print'); echo ""; foreach ($this->get_efs_activos() as $id_ef) { - if (! in_array($id_ef, array('fecha_hasta', 'valor'))) { + if (! in_array($id_ef, array('fecha_hasta', 'valor'), true)) { $this->generar_html_ef($id_ef); } } diff --git a/proyectos/toba_usuarios/php/extension_toba/contexto_ejecucion.php b/proyectos/toba_usuarios/php/extension_toba/contexto_ejecucion.php index 78deebbc2d..23d328a566 100644 --- a/proyectos/toba_usuarios/php/extension_toba/contexto_ejecucion.php +++ b/proyectos/toba_usuarios/php/extension_toba/contexto_ejecucion.php @@ -7,6 +7,9 @@ class contexto_ejecucion implements toba_interface_contexto_ejecucion { function conf__inicial() { + if (false !== \getenv('TOBA_REDIRECCIONAR_LOGS')) { + toba_logger::instancia()->redirect_to_stdout(\getenv('TOBA_REDIRECCIONAR_LOGS') == 1); + } require_once('lib/admin_instancia.php'); require_once('lib/consultas_instancia.php'); diff --git a/proyectos/toba_usuarios/php/extension_toba/toba_usuarios_modelo.php b/proyectos/toba_usuarios/php/extension_toba/toba_usuarios_modelo.php index 7744409252..14cd0e1ae5 100755 --- a/proyectos/toba_usuarios/php/extension_toba/toba_usuarios_modelo.php +++ b/proyectos/toba_usuarios/php/extension_toba/toba_usuarios_modelo.php @@ -17,7 +17,7 @@ function instalar($datos_servidor) if (! $this->permitir_instalar) { return; } - $id_def_base = $this->proyecto->construir_id_def_base($this->get_fuente_defecto()); + $id_def_base = $this->proyecto->construir_id_def_base('toba_usuarios'); if (! $this->instalacion->existe_base_datos_definida($id_def_base)) { $datos_servidor = $this->instancia->get_parametros_db(); //-- Agrega la definición de la base diff --git a/proyectos/toba_usuarios/php/lib/InterfaseApiUsuarios.php b/proyectos/toba_usuarios/php/lib/InterfaseApiUsuarios.php new file mode 100644 index 0000000000..050a96c1b0 --- /dev/null +++ b/proyectos/toba_usuarios/php/lib/InterfaseApiUsuarios.php @@ -0,0 +1,21 @@ +get_db()->get_schema(). '_logs'; $sql = "SELECT momento, ip FROM $schema_logs.apex_log_ip_rechazada;"; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_lista_usuarios_bloqueados($estado) @@ -101,7 +101,7 @@ static function get_lista_usuarios_bloqueados($estado) apex_usuario WHERE bloqueado = $estado"; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } function eliminar_bloqueo($ip) @@ -109,40 +109,40 @@ function eliminar_bloqueo($ip) $ip = quote($ip); $schema_logs = toba::instancia()->get_db()->get_schema(). '_logs'; $sql = "DELETE FROM $schema_logs.apex_log_ip_rechazada WHERE ip = $ip"; - toba::db()->ejecutar($sql); + toba::db('toba_usuarios')->ejecutar($sql); } function eliminar_bloqueos() { $schema_logs = toba::instancia()->get_db()->get_schema(). '_logs'; $sql = "DELETE FROM $schema_logs.apex_log_ip_rechazada;"; - toba::db()->ejecutar($sql); + toba::db('toba_usuarios')->ejecutar($sql); } function eliminar_bloqueo_usuario($usuario) { $usuario = quote($usuario); $sql = "UPDATE apex_usuario SET bloqueado = 0 WHERE usuario = $usuario"; - toba::db()->ejecutar($sql); + toba::db('toba_usuarios')->ejecutar($sql); } function eliminar_bloqueo_usuarios() { $sql = 'UPDATE apex_usuario SET bloqueado = 0 WHERE bloqueado = 1'; - toba::db()->ejecutar($sql); + toba::db('toba_usuarios')->ejecutar($sql); } function agregar_bloqueo_usuario($usuario) { $usuario = quote($usuario); $sql = "UPDATE apex_usuario SET bloqueado = 1 WHERE usuario = $usuario"; - toba::db()->ejecutar($sql); + toba::db('toba_usuarios')->ejecutar($sql); } function agregar_bloqueo_usuarios() { $sql = 'UPDATE apex_usuario SET bloqueado = 1 WHERE bloqueado = 0'; - toba::db()->ejecutar($sql); + toba::db('toba_usuarios')->ejecutar($sql); } } diff --git a/proyectos/toba_usuarios/php/lib/api_usuarios_1.php b/proyectos/toba_usuarios/php/lib/api_usuarios_1.php new file mode 100644 index 0000000000..96a5a12c21 --- /dev/null +++ b/proyectos/toba_usuarios/php/lib/api_usuarios_1.php @@ -0,0 +1,172 @@ +cliente = $cliente; + } + + //----------------------------------------------------------------------------------- + //---- Auxiliares ------------------------------------------------------------------- + //----------------------------------------------------------------------------------- + + /** + * Ver http://docs.guzzlephp.org/en/latest/docs.html + * @return GuzzleHttp\Client + */ + protected function get_cliente_rest() + { + return $this->cliente; + } + + protected function manejar_excepcion_request(RequestException $e) + { + $msg = $e->getMessage() . PHP_EOL . Psr7\Message::toString($e->getRequest()). PHP_EOL; + if ($e->hasResponse()) { + $msg .= Psr7\Message::toString($e->getResponse()) . PHP_EOL; + } + toba_logger::instancia()->error($msg); + throw new toba_error(toba::escaper()->escapeJs($e->getMessage())); + } + + public function get_usuarios($filtro=array(), $excluir_aplicacion = null) + { + $query = $datos = array(); + $url = 'usuarios'; + if (! is_null($excluir_aplicacion)) { + $query['excluir_aplicacion'] = $excluir_aplicacion; + } + + if (isset($filtro) && is_array($filtro)) { + foreach ($filtro as $id => $campo) { + $valor = (is_array($campo['valor'])) ? $campo['valor']['desde'] . ';' . $campo['valor']['hasta'] : $campo['valor']; + $query[$id] = $campo['condicion'] . ';' . $valor; + } + } + try { + // obtengo la respuesta + $response = $this->cliente->get($url, array('query' => $query)); + $datos = rest_decode($response->getBody()->__toString()); + foreach ($datos as $clave => $dato) { + $datos[$clave]['nombre_apellido'] = $dato['nombre'] . ' ' . $dato['apellido']; + } + } catch (RequestException | \Exception $e) { + toba_logger::instancia()->var_dump(['filtro' => $filtro, 'exluir_app' => $excluir_aplicacion]); + $this->manejar_excepcion_request($e); + } + return $datos; + } + + public function get_usuario($identificador) + { + try { + $url = "usuarios/$identificador"; + // obtengo la respuesta + $response = $this->cliente->get($url); + $datos = rest_decode($response->getBody()->__toString()); + if (! empty($datos)) { + $datos['nombre_apellido'] = $datos['nombre'] . ' ' . $datos['apellido']; + } + } catch (RequestException | \Exception $e) { + toba_logger::instancia()->var_dump(['id' => $identificador]); + $this->manejar_excepcion_request($e); + } + return $datos; + } + + public function get_cuenta($identificador_aplicacion, $cuenta) + { + try { + $url = "aplicaciones/$identificador_aplicacion/cuentas/$cuenta"; + + // obtengo la respuesta + $response = $this->cliente->get($url); + $datos = rest_decode($response->getBody()->__toString()); + } catch (RequestException $e) { + if ($e->getCode() == 404) { + return array(); + } + $this->manejar_excepcion_request($e); + } catch (Exception $e) { + throw new toba_error(toba::escaper()->escapeJs($e)); + } + return $datos; + } + + public function agregar_cuenta($identificador_aplicacion, $datos_cuenta) + { + try { + $url = "aplicaciones/$identificador_aplicacion/cuentas"; + + // obtengo la respuesta + $response = $this->cliente->post($url, array('body' => rest_encode($datos_cuenta))); + $datos = rest_decode($response->getBody()->__toString()); + } catch (RequestException $e) { + $this->manejar_excepcion_request($e); + } catch (Exception $e) { + throw new toba_error(toba::escaper()->escapeJs($e)); + } + return $datos; + } + + public function eliminar_cuenta($identificador_aplicacion, $cuenta) + { + try { + $url = "aplicaciones/$identificador_aplicacion/cuentas/$cuenta"; + + // obtengo la respuesta + $this->cliente->delete($url); + } catch (RequestException $e) { + $this->manejar_excepcion_request($e); + } catch (Exception $e) { + throw new toba_error(toba::escaper()->escapeJs($e)); + } + } + + public function get_nombre_apellido_usuario($identificador) + { + $datos = $this->get_usuario($identificador); + if (isset($datos) && !empty($datos)) { + return $datos['nombre_apellido']; + } else { + return ''; + } + } + + public function get_identificador_x_aplicacion_cuenta($identificador_aplicacion, $cuenta) + { + $datos = $this->get_cuenta($identificador_aplicacion, $cuenta); + if (isset($datos) && !empty($datos)) { + return $datos['identificador_usuario']; + } else { + return null; + } + } +} diff --git a/proyectos/toba_usuarios/php/lib/api_usuarios_2.php b/proyectos/toba_usuarios/php/lib/api_usuarios_2.php new file mode 100644 index 0000000000..5a87a82121 --- /dev/null +++ b/proyectos/toba_usuarios/php/lib/api_usuarios_2.php @@ -0,0 +1,159 @@ + $campo) { + $valor = (is_array($campo['valor'])) ? $campo['valor']['desde'] . ';' . $campo['valor']['hasta'] : $campo['valor']; + $query[$id] = $campo['condicion'] . ';' . $valor; + } + } + try { + // obtengo la respuesta + $response = $this->cliente->get($url, array('query' => $query)); + $datos = rest_decode($response->getBody()->__toString()); + foreach ($datos as $clave => $dato) { + $datos[$clave]['nombre_apellido'] = $dato['nombre'] . ' ' . $dato['apellido']; + } + } catch (RequestException $e) { + $this->manejar_excepcion_request($e); + } catch (Exception $e) { + throw new toba_error(toba::escaper()->escapeJs($e)); + } + return $datos; + } + + public function get_usuario($identificador) + { + try { + $uid = $this->get_uid_x_identificador($identificador); + $datos = $this->get_usuario_datos($uid); + } catch (RequestException $e) { + $this->manejar_excepcion_request($e); + } catch (Exception $e) { + throw new toba_error(toba::escaper()->escapeJs($e)); + } + return $datos; + } + + public function agregar_cuenta($identificador_aplicacion, $datos_cuenta) + { + try { + $uid = $this->get_uid_x_identificador($datos_cuenta['identificador_usuario']); + if (null !== $uid) { + $url = "aplicaciones/$identificador_aplicacion/cuentas"; + $datos_cuenta['identificador_usuario'] = $uid; //Reemplaza el "identificador" de v1 por UID en v2 + + // obtengo la respuesta + $response = $this->cliente->post($url, array('body' => rest_encode($datos_cuenta))); + $datos = rest_decode($response->getBody()->__toString()); + } + } catch (RequestException $e) { + $this->manejar_excepcion_request($e); + } catch (Exception $e) { + throw new toba_error(toba::escaper()->escapeJs($e)); + } + return $datos; + } + + public function get_identificador_x_aplicacion_cuenta($identificador_aplicacion, $cuenta) + { + $datos = $this->get_cuenta($identificador_aplicacion, $cuenta); + if (isset($datos) && !empty($datos)) { + //En esta version de la API hay que recuperar el identificador con un nuevo pedido, sino se intercambia valor con uid + $datos_usuario = $this->get_usuario_datos($datos['identificador_usuario']); + return $datos_usuario['identificador'] ?? null; + } else { + return null; + } + } + + //----------------------------------------------------------------------------// + // AUXILIARES + //----------------------------------------------------------------------------// + + /** + * Recupera el UID del usuario a partir del identificador legible + * @param string $identificador + * @return string + * @throws toba_error + */ + private function get_uid_x_identificador($identificador) + { + if (! isset($this->uid)) { + try { + $response = $this->cliente->get("uuid/$identificador"); + $datos = rest_decode($response->getBody()->__toString()); + if (! empty($datos) && $identificador == $datos['identificador']) { + $this->uid = $datos['uid']; + } else { + toba_logger::instancia()->error('La api devolvio: '. var_export($datos, true)); + throw new toba_error('Usuario no válido'); + } + } catch (RequestException $e) { + $this->manejar_excepcion_request($e); + } catch (Exception $e) { + throw new toba_error(toba::escaper()->escapeJs($e)); + } + } + + return $this->uid; + } + + /** + * Recupera los datos del usuario solo por UID + * @param uuid $uid + * @return array + */ + private function get_usuario_datos($uid) + { + $datos = []; + if ($uid !== null) { + $url = "usuarios/$uid"; + // obtengo la respuesta + $response = $this->cliente->get($url); + $datos = rest_decode($response->getBody()->__toString()); + if (! empty($datos)) { + $datos['nombre_apellido'] = $datos['nombre'] . ' ' . $datos['apellido']; + } + } + return $datos; + } +} diff --git a/proyectos/toba_usuarios/php/lib/consultas_instancia.php b/proyectos/toba_usuarios/php/lib/consultas_instancia.php index d7d678bb29..e6ffdce932 100644 --- a/proyectos/toba_usuarios/php/lib/consultas_instancia.php +++ b/proyectos/toba_usuarios/php/lib/consultas_instancia.php @@ -5,36 +5,36 @@ class consultas_instancia static function get_lista_proyectos() { $sql = "SELECT proyecto FROM apex_proyecto WHERE proyecto <> 'toba' ORDER BY proyecto;"; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_datos_proyecto($proyecto) { $proyecto = quote($proyecto); $sql = "SELECT * FROM apex_proyecto WHERE proyecto = $proyecto"; - $rs = toba::db()->consultar($sql); + $rs = toba::db('toba_usuarios')->consultar($sql); return $rs[0]; } static function get_cantidad_ips_rechazadas() { - $schema_logs = toba::db()->get_schema(). '_logs'; + $schema_logs = toba::db('toba_usuarios')->get_schema(). '_logs'; $sql = "SELECT count(*) as cantidad FROM $schema_logs.apex_log_ip_rechazada;"; - $rs = toba::db()->consultar($sql); + $rs = toba::db('toba_usuarios')->consultar($sql); return $rs[0]['cantidad']; } static function get_cantidad_usuarios_bloqueados() { $sql = 'SELECT count(*) as cantidad FROM apex_usuario WHERE bloqueado = 1;'; - $rs = toba::db()->consultar($sql); + $rs = toba::db('toba_usuarios')->consultar($sql); return $rs[0]['cantidad']; } static function get_cantidad_usuarios_desbloqueados() { $sql = 'SELECT count(*) as cantidad FROM apex_usuario WHERE bloqueado = 0;'; - $rs = toba::db()->consultar($sql); + $rs = toba::db('toba_usuarios')->consultar($sql); return $rs[0]['cantidad']; } @@ -45,9 +45,9 @@ static function get_cantidad_usuarios_desbloqueados() static function get_cantidad_sesiones_proyecto($proyecto) { $proyecto = quote($proyecto); - $schema_logs = toba::db()->get_schema(). '_logs'; + $schema_logs = toba::db('toba_usuarios')->get_schema(). '_logs'; $sql = "SELECT count(*) as cantidad FROM $schema_logs.apex_sesion_browser WHERE proyecto = $proyecto;"; - $rs = toba::db()->consultar($sql); + $rs = toba::db('toba_usuarios')->consultar($sql); return $rs[0]['cantidad']; } @@ -56,7 +56,7 @@ static function get_sesiones($proyecto, $filtro) $proyecto = quote($proyecto); $where = ''; $filtro_sano = quote($filtro); - $schema_logs = toba::db()->get_schema(). '_logs'; + $schema_logs = toba::db('toba_usuarios')->get_schema(). '_logs'; if (isset($filtro['sesion'])) { $where .= " AND se.sesion_browser = {$filtro_sano['sesion']} "; @@ -96,19 +96,19 @@ static function get_sesiones($proyecto, $filtro) GROUP BY 1,2,3,4,5 ORDER BY ingreso DESC;"; toba::logger()->debug($sql); - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_id_sesion($id_solicitud) { $id_solicitud = quote($id_solicitud); - $schema_logs = toba::db()->get_schema(). '_logs'; + $schema_logs = toba::db('toba_usuarios')->get_schema(). '_logs'; $sql = " SELECT sesion_browser as id FROM $schema_logs.apex_solicitud_browser WHERE solicitud_browser = $id_solicitud "; - $fila = toba::db()->consultar_fila($sql); + $fila = toba::db('toba_usuarios')->consultar_fila($sql); if (isset($fila['id'])) { return $fila['id']; } else { @@ -125,7 +125,7 @@ static function get_solicitudes_browser($sesion, $id_solicitud=null) $extra = "AND sb.solicitud_browser = $id_solicitud"; } $sesion = quote($sesion); - $schema_logs = toba::db()->get_schema(). '_logs'; + $schema_logs = toba::db('toba_usuarios')->get_schema(). '_logs'; $sql = " SELECT s.solicitud as id, s.item_proyecto as item_proyecto, @@ -148,13 +148,13 @@ static function get_solicitudes_browser($sesion, $id_solicitud=null) $extra GROUP BY 1,2,3,4,5,6 ORDER BY s.momento DESC;"; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_solicitud_observaciones($solicitud) { $solicitud = quote($solicitud); - $schema_logs = toba::db()->get_schema(). '_logs'; + $schema_logs = toba::db('toba_usuarios')->get_schema(). '_logs'; $sql = " SELECT solicitud_observacion, observacion, @@ -165,13 +165,13 @@ static function get_solicitud_observaciones($solicitud) AND ot.proyecto = o.solicitud_obs_tipo_proyecto WHERE o.solicitud = $solicitud ORDER BY 1;"; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_solicitudes_consola($proyecto, $filtro) { $proyecto = quote($proyecto); - $schema_logs = toba::db()->get_schema(). '_logs'; + $schema_logs = toba::db('toba_usuarios')->get_schema(). '_logs'; $sql = " SELECT s.solicitud as id, s.momento as momento, @@ -185,7 +185,7 @@ static function get_solicitudes_consola($proyecto, $filtro) WHERE s.proyecto = sc.proyecto AND s.solicitud = sc.solicitud_consola AND s.proyecto = $proyecto;"; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_solicitudes_web_service($filtro=array()) @@ -196,7 +196,7 @@ static function get_solicitudes_web_service($filtro=array()) if (isset($filtro['metodo'])) { $where[] = 'sws.metodo ILIKE ' . quote("{$filtro['metodo']}%");} if (isset($filtro['ip'])) { $where[] = 'sws.ip =' .quote($filtro['ip']);} if (isset($filtro['solicitud'])) { $where[] = 's.solicitud = ' .quote($filtro['solicitud']);} - $schema_logs = toba::db()->get_schema(). '_logs'; + $schema_logs = toba::db('toba_usuarios')->get_schema(). '_logs'; $sql = " SELECT s.solicitud as id, s.momento as momento, @@ -214,7 +214,7 @@ static function get_solicitudes_web_service($filtro=array()) if (! empty($where)) { $sql = sql_concatenar_where($sql, $where); } - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } //--------------------------------------------------------------------- @@ -250,7 +250,7 @@ static function armar_where_usuarios($filtro) static function get_cantidad_usuarios() { $sql = 'SELECT count(usuario) as cantidad FROM apex_usuario;'; - $rs = toba::db()->consultar_fila($sql); + $rs = toba::db('toba_usuarios')->consultar_fila($sql); return ($rs !== false) ? $rs['cantidad'] : 0; } @@ -258,7 +258,7 @@ static function get_cantidad_usuarios_proyecto($proyecto) { $proyecto = quote($proyecto); $sql = "SELECT count(usuario) as cantidad FROM apex_usuario_proyecto WHERE proyecto = $proyecto"; - $rs = toba::db()->consultar_fila($sql); + $rs = toba::db('toba_usuarios')->consultar_fila($sql); return ($rs !== false) ? $rs['cantidad'] : 0; } @@ -268,7 +268,7 @@ static function get_cantidad_usuarios_no_vinculados($proyecto = null) $sql = 'SELECT count(usuario) as cantidad FROM apex_usuario WHERE usuario NOT IN (SELECT up.usuario FROM apex_usuario_proyecto up '. $where_proyecto. ' );'; - $rs = toba::db()->consultar_fila($sql); + $rs = toba::db('toba_usuarios')->consultar_fila($sql); return ($rs !== false) ? $rs['cantidad'] : 0; } @@ -286,7 +286,7 @@ static function get_lista_usuarios($filtro=null, $tamanio=null, $pagina=null) $where ORDER BY usuario $limit;"; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_usuarios_no_vinculados($filtro=null) @@ -302,7 +302,7 @@ static function get_usuarios_no_vinculados($filtro=null) FROM apex_usuario u $where ;"; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_usuarios_vinculados_proyecto($proyecto, $filtro=null, $tamanio=null, $pagina=null) @@ -329,7 +329,7 @@ static function get_usuarios_vinculados_proyecto($proyecto, $filtro=null, $tama ORDER BY usuario $limit "; - $datos = toba::db()->consultar($sql); + $datos = toba::db('toba_usuarios')->consultar($sql); $temp = array(); foreach ($datos as $dato) { $temp[$dato['usuario']]['proyecto'] = $dato['proyecto']; @@ -363,14 +363,14 @@ static function get_usuarios_no_vinculados_proyecto($proyecto, $filtro=null, $ta $where ORDER BY usuario $limit;"; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_existe_usuario($usuario) { $usuario = quote($usuario); $sql = "SELECT count(*) as cantidad FROM apex_usuario WHERE usuario = $usuario;"; - $rs = toba::db()->consultar_fila($sql); + $rs = toba::db('toba_usuarios')->consultar_fila($sql); if (isset($rs) && !empty($rs) && intval($rs['cantidad']) > 0) { return true; } else { @@ -393,8 +393,8 @@ static function set_segundo_factor_x_perfil($proyecto, $perfil, $segundo_factor, AND up.usuario_grupo_acc = :perfil '. $extra . ');'; - $id = toba::db()->sentencia_preparar($sql); - return toba::db()->sentencia_ejecutar($id, $params); + $id = toba::db('toba_usuarios')->sentencia_preparar($sql); + return toba::db('toba_usuarios')->sentencia_ejecutar($id, $params); } //--------------------------------------------------------------------- @@ -410,7 +410,7 @@ static function get_lista_grupos_acceso_usuario_proyecto($usuario, $proyecto) WHERE proyecto = $proyecto AND usuario = $usuario ;"; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_lista_grupos_acceso($filtro) @@ -429,7 +429,7 @@ static function get_lista_grupos_acceso($filtro) $sql = sql_concatenar_where($sql, $where); } toba::logger()->debug($sql); - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_usuarios_con_grupo_acceso_unico($proyecto, $perfil) @@ -444,7 +444,7 @@ static function get_usuarios_con_grupo_acceso_unico($proyecto, $perfil) GROUP BY up.usuario HAVING count(up.usuario_grupo_acc) > 1 );'; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } // static function get_lista_grupos_acceso_con_segundo_factor($filtro) @@ -480,7 +480,7 @@ static function get_usuarios_con_grupo_acceso_unico($proyecto, $perfil) // //Hago el union entre ambos // $sql = "($sql_nofa)". PHP_EOL . ' UNION '. PHP_EOL . "($sql_2fa)"; // toba::logger()->debug($sql); -// return toba::db()->consultar($sql); +// return toba::db('toba_usuarios')->consultar($sql); // } static function get_lista_grupos_acceso_proyecto($proyecto) @@ -497,7 +497,7 @@ static function get_descripcion_grupo_acceso($proyecto, $grupo) FROM apex_usuario_grupo_acc WHERE proyecto = $proyecto AND usuario_grupo_acc = $grupo"; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_descripcion_perfil_datos($proyecto, $perfil) @@ -509,7 +509,7 @@ static function get_descripcion_perfil_datos($proyecto, $perfil) FROM apex_usuario_perfil_datos WHERE proyecto = $proyecto AND usuario_perfil_datos = $perfil"; - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } //--------------------------------------------------------------------- @@ -529,7 +529,7 @@ static function get_menu_tipos($filtro=array()) if (! empty($where)) { $sql = sql_concatenar_where($sql, $where); } - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_menus_existentes($proyecto) @@ -546,7 +546,7 @@ static function get_menus_existentes($proyecto) if (! empty($where)) { $sql = sql_concatenar_where($sql, $where); } - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } static function get_items_combo($proyecto) @@ -567,7 +567,7 @@ static function get_lista_perfil_datos($proyecto) descripcion FROM apex_usuario_perfil_datos WHERE proyecto = $proyecto"; - $datos = toba::db()->consultar($sql); + $datos = toba::db('toba_usuarios')->consultar($sql); return $datos; } @@ -588,7 +588,7 @@ static function get_servicios_web_consumidos($filtro) if (! empty($where_filtro)) { $sql = sql_concatenar_where($sql, $where_filtro); } - return toba::db()->consultar($sql); + return toba::db('toba_usuarios')->consultar($sql); } } ?> \ No newline at end of file diff --git a/proyectos/toba_usuarios/php/lib/rest_arai_usuarios.php b/proyectos/toba_usuarios/php/lib/rest_arai_usuarios.php index 79047282cd..952d2a421d 100644 --- a/proyectos/toba_usuarios/php/lib/rest_arai_usuarios.php +++ b/proyectos/toba_usuarios/php/lib/rest_arai_usuarios.php @@ -1,191 +1,91 @@ instanciarClienteCompatible(); + } + return self::$instancia; + } - /** - * Constructor de la clase rest_arai_usuarios - * @param boolean $recargar Flag que determina si recarga la instancia - */ - private function __construct($recargar) - { - $this->cliente = $this->get_cliente_rest(); - } - - //----------------------------------------------------------------------------------- - //---- Auxiliares ------------------------------------------------------------------- - //----------------------------------------------------------------------------------- - - /** - * Ver http://docs.guzzlephp.org/en/latest/docs.html - * @return GuzzleHttp\Client - */ - protected function get_cliente_rest() - { - try { - $opciones = array(); - $cliente = toba::servicio_web_rest('rest_arai_usuarios', $opciones); - return $cliente->guzzle(); - } catch (toba_error $e) { - toba_logger::instancia()->error("Hay un problema de configuracion del cliente REST.\n Mensaje: " . $e->get_mensaje()); - throw new toba_error_usuario('Hay un problema de configuracion del cliente REST. Por favor asegurese de configurarlo correctamente en el archivo cliente.ini del servicio usado.'); - } - } - - private function manejar_excepcion_request(RequestException $e) - { - $msg = $e->getMessage() . PHP_EOL . Psr7\str($e->getRequest()) . PHP_EOL; - if ($e->hasResponse()) { - $msg .= Psr7\str($e->getResponse()) . PHP_EOL; - } - toba_logger::instancia()->error($msg); - throw new toba_error(toba::escaper()->escapeJs($msg)); - } - - public function get_usuarios($filtro=array(), $excluir_aplicacion = null) - { - $query = $datos = array(); - $url = 'usuarios'; - if (! is_null($excluir_aplicacion)) { - $query['excluir_aplicacion'] = $excluir_aplicacion; - } - - if (isset($filtro) && is_array($filtro)) { - foreach ($filtro as $id => $campo) { - $valor = (is_array($campo['valor'])) ? $campo['valor']['desde'] . ';' . $campo['valor']['hasta'] : $campo['valor']; - $query[$id] = $campo['condicion'] . ';' . $valor; - } - } - try { - // obtengo la respuesta - $response = $this->cliente->get($url, array('query' => $query)); - $datos = rest_decode($response->getBody()->__toString()); - foreach($datos as $clave => $dato) { - $datos[$clave]['nombre_apellido'] = $dato['nombre'] . ' ' . $dato['apellido']; - } - } catch (RequestException $e) { - $this->manejar_excepcion_request($e); - } catch (Exception $e) { - throw new toba_error(toba::escaper()->escapeJs($e)); - } - return $datos; - } - - public function get_usuario($identificador) - { - try { - $url = "usuarios/$identificador"; - // obtengo la respuesta - $response = $this->cliente->get($url); - $datos = rest_decode($response->getBody()->__toString()); - if (! empty($datos)) { - $datos['nombre_apellido'] = $datos['nombre'] . ' ' . $datos['apellido']; - } - } catch (RequestException $e) { - $this->manejar_excepcion_request($e); - } catch (Exception $e) { - throw new toba_error(toba::escaper()->escapeJs($e)); - } - return $datos; - } - - public function get_cuenta($identificador_aplicacion, $cuenta) - { - try { - $url = "aplicaciones/$identificador_aplicacion/cuentas/$cuenta"; + /** + * Eliminar la instancia actual + */ + public static function eliminar_instancia() + { + self::$instancia = null; + } - // obtengo la respuesta - $response = $this->cliente->get($url); - $datos = rest_decode($response->getBody()->__toString()); - } catch (RequestException $e) { - if ($e->getCode() == 404) { return array(); } - $this->manejar_excepcion_request($e); - } catch (Exception $e) { - throw new toba_error(toba::escaper()->escapeJs($e)); - } - return $datos; - } - - public function agregar_cuenta($identificador_aplicacion, $datos_cuenta) - { - try { - $url = "aplicaciones/$identificador_aplicacion/cuentas"; - - // obtengo la respuesta - $response = $this->cliente->post($url, array('body' => rest_encode($datos_cuenta))); - $datos = rest_decode($response->getBody()->__toString()); - } catch (RequestException $e) { - $this->manejar_excepcion_request($e); - } catch (Exception $e) { - throw new toba_error(toba::escaper()->escapeJs($e)); - } - return $datos; - } - - public function eliminar_cuenta($identificador_aplicacion, $cuenta) - { - try { - $url = "aplicaciones/$identificador_aplicacion/cuentas/$cuenta"; - - // obtengo la respuesta - $this->cliente->delete($url); - } catch (RequestException $e) { - $this->manejar_excepcion_request($e); - } catch (Exception $e) { - throw new toba_error(toba::escaper()->escapeJs($e)); - } - } - - public function get_nombre_apellido_usuario($identificador) - { - $datos = $this->get_usuario($identificador); - if (isset($datos) && !empty($datos)) { - return $datos['nombre_apellido']; - } else { - return ''; - } - } - - public function get_identificador_x_aplicacion_cuenta($identificador_aplicacion, $cuenta) - { - $datos = $this->get_cuenta($identificador_aplicacion, $cuenta); - if (isset($datos) && !empty($datos)) { - return $datos['identificador_usuario']; - } else { - return null; - } - } - + private function instanciarClienteCompatible() + { + $this->cliente = $this->get_cliente_rest(); + $major = $this->getVersionApi(); + switch ($major) { + case '2': + $cliente = api_usuarios_2::instancia($this->cliente); + break; + case '1': + default: + $cliente = api_usuarios_1::instancia($this->cliente); + } + return $cliente; + } + + /** + * Devuelve la version major de api desde configuracion o un patron no numerico en caso de no presencia + * @return string + */ + private function getVersionApi(): string + { + $cliente = toba_servicio_web_cliente_rest::get_datos_conexion('rest_arai_usuarios'); + $data = $cliente->get('conexion', 'version', '-x.0', false); + list($major, $minor) = explode('.', $data); + return $major; + } + + //----------------------------------------------------------------------------------- + //---- Auxiliares ------------------------------------------------------------------- + //----------------------------------------------------------------------------------- + + /** + * Ver http://docs.guzzlephp.org/en/latest/docs.html + * @return GuzzleHttp\Client + */ + protected function get_cliente_rest() + { + try { + $opciones = array(); + $cliente = toba_servicio_web_cliente_rest::conectar('rest_arai_usuarios', $opciones); + return $cliente->guzzle(); + } catch (toba_error $e) { + toba_logger::instancia()->error("Hay un problema de configuración del cliente REST.\n Mensaje: " . $e->get_mensaje()); + throw new toba_error_usuario('Hay un problema de configuración del cliente REST. Por favor asegurese de configurarlo correctamente en el archivo cliente.ini del servicio usado.'); + } + } + + private function manejar_excepcion_request(RequestException $e) + { + $msg = $e->getMessage() . PHP_EOL . Psr7\Message::toString($e->getRequest()). PHP_EOL; + if ($e->hasResponse()) { + $msg .= Psr7\Message::toString($e->getResponse()) . PHP_EOL; + } + toba_logger::instancia()->error($msg); + throw new toba_error(toba::escaper()->escapeJs($e->getMessage())); + } } -?> diff --git a/proyectos/toba_usuarios/php/menu/ci_armador_menues.php b/proyectos/toba_usuarios/php/menu/ci_armador_menues.php index 656c5edcd7..05bc1e2544 100644 --- a/proyectos/toba_usuarios/php/menu/ci_armador_menues.php +++ b/proyectos/toba_usuarios/php/menu/ci_armador_menues.php @@ -266,7 +266,7 @@ function descubrir_padre($datos, $id) { $padre = null; foreach ($datos as $klave => $grupo) { - if (in_array($id, $grupo)) { + if (in_array($id, $grupo, true)) { $padre = $klave; } } diff --git a/proyectos/toba_usuarios/php/perfiles/asociacion_menu/ci_asociar_menu_perfil.php b/proyectos/toba_usuarios/php/perfiles/asociacion_menu/ci_asociar_menu_perfil.php index eda69f186e..a82a3c3f8d 100644 --- a/proyectos/toba_usuarios/php/perfiles/asociacion_menu/ci_asociar_menu_perfil.php +++ b/proyectos/toba_usuarios/php/perfiles/asociacion_menu/ci_asociar_menu_perfil.php @@ -38,23 +38,23 @@ function evt__procesar() $menu = quote($this->datos['id_menu']); $perfiles = quote($this->datos['ids_perfil_funcional']); $proyecto = quote($this->s__proyecto); - toba::db()->abrir_transaccion(); + toba::db('toba_usuarios')->abrir_transaccion(); try { //Primero le quito el menu a todos los grupos de acceso que actualmente lo usan $sql = "UPDATE apex_usuario_grupo_acc SET menu_usuario = null WHERE proyecto = $proyecto AND menu_usuario = $menu;"; - toba::db()->ejecutar($sql); + toba::db('toba_usuarios')->ejecutar($sql); //Le agrego el menu a los grupos existentes foreach ($perfiles as $grupo) { $sql = "UPDATE apex_usuario_grupo_acc SET menu_usuario = $menu WHERE proyecto = $proyecto AND usuario_grupo_acc = $grupo;"; toba::logger()->debug($sql); - toba::db()->ejecutar($sql); + toba::db('toba_usuarios')->ejecutar($sql); } - toba::db()->cerrar_transaccion(); + toba::db('toba_usuarios')->cerrar_transaccion(); } catch (toba_error_db $e) { - toba::db()->abortar_transaccion(); + toba::db('toba_usuarios')->abortar_transaccion(); toba::logger()->debug($e->getMessage()); throw new toba_error_usuario('Hubo un inconveniente al actualizar los datos'); } diff --git a/proyectos/toba_usuarios/php/perfiles/perfil_funcional/ci_navegacion_perfiles.php b/proyectos/toba_usuarios/php/perfiles/perfil_funcional/ci_navegacion_perfiles.php index d3e0d09c5f..391be0a292 100644 --- a/proyectos/toba_usuarios/php/perfiles/perfil_funcional/ci_navegacion_perfiles.php +++ b/proyectos/toba_usuarios/php/perfiles/perfil_funcional/ci_navegacion_perfiles.php @@ -55,7 +55,7 @@ function actualizar_script_roles($eliminados=array()) if ($usa_permisos_por_tabla) { $modelo = toba_modelo_catalogo::instanciacion(); - $modelo->set_db(toba::db()); + $modelo->set_db(toba::db('toba_usuarios')); $proyecto = $modelo->get_proyecto(toba::instancia()->get_id(), $this->s__filtro['proyecto']); $dir = $proyecto->get_dir(). '/'; try { @@ -71,7 +71,7 @@ function actualizar_script_roles($eliminados=array()) function evt__guardar() { $this->dep('datos')->persistidor()->desactivar_transaccion(); - $db = toba::db(); + $db = toba::db('toba_usuarios'); $db->abrir_transaccion(); $db->retrasar_constraints(true); //- Sincronizar la relacion @@ -119,7 +119,7 @@ function evt__eliminar() } $this->dep('datos')->persistidor()->desactivar_transaccion(); - toba::db()->abrir_transaccion(); + toba::db('toba_usuarios')->abrir_transaccion(); $this->dep('datos')->eliminar(); $this->dep('datos')->resetear(); //- Elimino el acceso a los items @@ -128,8 +128,8 @@ function evt__eliminar() WHERE usuario_grupo_acc = '{$datos['usuario_grupo_acc']}' AND proyecto = '{$datos['proyecto']}';"; - toba::db()->ejecutar($sql); - toba::db()->cerrar_transaccion(); + toba::db('toba_usuarios')->ejecutar($sql); + toba::db('toba_usuarios')->cerrar_transaccion(); //-- Si estamos en produccion guardamos un flag indicando que cambiaron los perfiles y ahora se encarga el proyecto de manejarlos $this->actualizar_info_ini(); @@ -251,7 +251,7 @@ function get_grafo() //Relaciones foreach ($perfiles as $perfil) { //Necesita pasarle la conexion porque aun no termino la transacción - $miembros = toba_info_permisos::get_perfiles_funcionales_miembros($perfil['proyecto'], $perfil['usuario_grupo_acc'], toba::db()); + $miembros = toba_info_permisos::get_perfiles_funcionales_miembros($perfil['proyecto'], $perfil['usuario_grupo_acc'], toba::db('toba_usuarios')); foreach ($miembros as $miembro) { $nodos[$perfil['usuario_grupo_acc']]->connectTo($nodos[$miembro['usuario_grupo_acc_pertenece']]); } diff --git a/proyectos/toba_usuarios/php/perfiles/restricciones_funcionales/ci_restricciones_funcionales.php b/proyectos/toba_usuarios/php/perfiles/restricciones_funcionales/ci_restricciones_funcionales.php index 96239e21c8..cc443c2789 100644 --- a/proyectos/toba_usuarios/php/perfiles/restricciones_funcionales/ci_restricciones_funcionales.php +++ b/proyectos/toba_usuarios/php/perfiles/restricciones_funcionales/ci_restricciones_funcionales.php @@ -21,10 +21,10 @@ function evt__guardar() $alta = true; } $this->dep('restricciones')->persistidor()->desactivar_transaccion(); - toba::db()->abrir_transaccion(); + toba::db('toba_usuarios')->abrir_transaccion(); $this->dep('restricciones')->sincronizar(); if ($alta) { - $restriccion = toba::db()->recuperar_secuencia('apex_restriccion_funcional_seq'); + $restriccion = toba::db('toba_usuarios')->recuperar_secuencia('apex_restriccion_funcional_seq'); } foreach ($raices as $raiz) { if ($alta) { @@ -32,7 +32,7 @@ function evt__guardar() } $raiz->sincronizar(); } - toba::db()->cerrar_transaccion(); + toba::db('toba_usuarios')->cerrar_transaccion(); $this->dep('restricciones')->resetear(); $this->cortar_arbol(); $this->set_pantalla('seleccion'); @@ -56,7 +56,7 @@ function evt__eliminar() $this->dep('restricciones')->persistidor()->desactivar_transaccion(); - toba::db()->abrir_transaccion(); + toba::db('toba_usuarios')->abrir_transaccion(); $sql = array(); $sql[] = "DELETE FROM apex_restriccion_funcional_ef WHERE restriccion_funcional = '$this->s__restriccion' and proyecto = '$proyecto';"; @@ -65,12 +65,12 @@ function evt__eliminar() $sql[] = "DELETE FROM apex_restriccion_funcional_ei WHERE restriccion_funcional = '$this->s__restriccion' and proyecto = '$proyecto';"; $sql[] = "DELETE FROM apex_restriccion_funcional_cols WHERE restriccion_funcional = '$this->s__restriccion' and proyecto = '$proyecto';"; - toba::db()->ejecutar($sql); + toba::db('toba_usuarios')->ejecutar($sql); $this->dep('restricciones')->eliminar_fila($this->dep('restricciones')->get_cursor()); $this->dep('restricciones')->sincronizar(); - toba::db()->cerrar_transaccion(); + toba::db('toba_usuarios')->cerrar_transaccion(); $this->cortar_arbol(); $this->set_pantalla('seleccion'); diff --git a/proyectos/toba_usuarios/php/servicios_web/generar_certificados/ci_gen_certificado.php b/proyectos/toba_usuarios/php/servicios_web/generar_certificados/ci_gen_certificado.php index 1e07e4fad8..1d97441154 100644 --- a/proyectos/toba_usuarios/php/servicios_web/generar_certificados/ci_gen_certificado.php +++ b/proyectos/toba_usuarios/php/servicios_web/generar_certificados/ci_gen_certificado.php @@ -18,7 +18,7 @@ function get_modelo_proyecto() { if (! isset($this->modelo_proyecto)) { $modelo = toba_modelo_catalogo::instanciacion(); - $modelo->set_db(toba::db()); + $modelo->set_db(toba::db('toba_usuarios')); $this->modelo_proyecto = $modelo->get_proyecto(toba::instancia()->get_id(), $this->s__datos_proyecto['proyecto']); } return $this->modelo_proyecto; diff --git a/proyectos/toba_usuarios/php/servicios_web/keystore_clientes/ci_servicios_ofrecidos.php b/proyectos/toba_usuarios/php/servicios_web/keystore_clientes/ci_servicios_ofrecidos.php index b7ea425334..eb7004ccd2 100644 --- a/proyectos/toba_usuarios/php/servicios_web/keystore_clientes/ci_servicios_ofrecidos.php +++ b/proyectos/toba_usuarios/php/servicios_web/keystore_clientes/ci_servicios_ofrecidos.php @@ -22,7 +22,7 @@ function get_modelo_proyecto() { if (! isset($this->modelo_proyecto)) { $modelo = toba_modelo_catalogo::instanciacion(); - $modelo->set_db(toba::db()); + $modelo->set_db(toba::db('toba_usuarios')); $this->modelo_proyecto = $modelo->get_proyecto(toba::instancia()->get_id(), $this->s__filtro['proyecto']); } return $this->modelo_proyecto; diff --git a/proyectos/toba_usuarios/php/servicios_web/keystore_servidores/ci_servicios_consumidos.php b/proyectos/toba_usuarios/php/servicios_web/keystore_servidores/ci_servicios_consumidos.php index 8167b66dce..fd5b7871fc 100644 --- a/proyectos/toba_usuarios/php/servicios_web/keystore_servidores/ci_servicios_consumidos.php +++ b/proyectos/toba_usuarios/php/servicios_web/keystore_servidores/ci_servicios_consumidos.php @@ -20,7 +20,7 @@ function get_modelo_proyecto() { if (! isset($this->modelo_proyecto)) { $modelo = toba_modelo_catalogo::instanciacion(); - $modelo->set_db(toba::db()); + $modelo->set_db(toba::db('toba_usuarios')); $this->modelo_proyecto = $modelo->get_proyecto(toba::instancia()->get_id(), $this->s__filtro['proyecto']); } return $this->modelo_proyecto; diff --git a/proyectos/toba_usuarios/php/servicios_web/rest/servicios_consumidos/ci_servicios_consumidos.php b/proyectos/toba_usuarios/php/servicios_web/rest/servicios_consumidos/ci_servicios_consumidos.php index 00945380e5..55344284e7 100644 --- a/proyectos/toba_usuarios/php/servicios_web/rest/servicios_consumidos/ci_servicios_consumidos.php +++ b/proyectos/toba_usuarios/php/servicios_web/rest/servicios_consumidos/ci_servicios_consumidos.php @@ -22,7 +22,7 @@ function get_modelo_proyecto() { if (! isset($this->modelo_proyecto)) { $modelo = toba_modelo_catalogo::instanciacion(); - $modelo->set_db(toba::db()); + $modelo->set_db(toba::db('toba_usuarios')); $this->modelo_proyecto = $modelo->get_proyecto(toba::instancia()->get_id(), $this->s__filtro['proyecto']); } return $this->modelo_proyecto; @@ -111,7 +111,7 @@ function ajax__test_configuracion($clave_param, toba_ajax_respuesta $respuesta) } $rest = toba::servicio_web_rest($parametro['servicio_web']); - $response = $rest->guzzle()->get('status'); //Hay que crear este servicio para que todos puedan responder + $response = $rest->guzzle()->get('info'); $respuesta->set($response->json()); } //----------------------------------------------------------------------------------- diff --git a/proyectos/toba_usuarios/php/servicios_web/rest/servicios_ofrecidos/ci_servicios_ofrecidos.php b/proyectos/toba_usuarios/php/servicios_web/rest/servicios_ofrecidos/ci_servicios_ofrecidos.php index 4f72dd0f61..ed589ece65 100644 --- a/proyectos/toba_usuarios/php/servicios_web/rest/servicios_ofrecidos/ci_servicios_ofrecidos.php +++ b/proyectos/toba_usuarios/php/servicios_web/rest/servicios_ofrecidos/ci_servicios_ofrecidos.php @@ -20,7 +20,7 @@ function get_modelo_proyecto() { if (! isset($this->modelo_proyecto)) { $modelo = toba_modelo_catalogo::instanciacion(); - $modelo->set_db(toba::db()); + $modelo->set_db(toba::db('toba_usuarios')); $this->modelo_proyecto = $modelo->get_proyecto(toba::instancia()->get_id(), $this->s__filtro['proyecto']); } return $this->modelo_proyecto; diff --git a/proyectos/toba_usuarios/php/toba_usuarios_autoload.php b/proyectos/toba_usuarios/php/toba_usuarios_autoload.php index 75c06d89ab..92a60005fc 100644 --- a/proyectos/toba_usuarios/php/toba_usuarios_autoload.php +++ b/proyectos/toba_usuarios/php/toba_usuarios_autoload.php @@ -1,6 +1,6 @@ 'auditoria/bloqueo_ip/ci_bloqueo_ip.php', 'ci_bloqueo_usuarios' => 'auditoria/bloqueo_usuarios/ci_bloqueo_usuarios.php', + 'ci_conf_auditoria' => 'auditoria/configuracion/ci_conf_auditoria.php', + 'ci_conf_log' => 'auditoria/configuracion/ci_conf_log.php', + 'form_conf_log' => 'auditoria/configuracion/form_conf_log.php', 'ci_auditoria' => 'auditoria/log_datos/ci_auditoria.php', 'filtro_auditoria' => 'auditoria/log_datos/filtro_auditoria.php', 'pant_auditoria' => 'auditoria/log_datos/pant_auditoria.php', @@ -25,19 +30,34 @@ static function cargar($nombre) 'ci_visor_observaciones' => 'auditoria/sesiones/ci_visor_observaciones.php', 'cuadro_sesiones' => 'auditoria/sesiones/cuadro_sesiones.php', 'cuadro_solicitudes' => 'auditoria/sesiones/cuadro_solicitudes.php', + 'ci_ws_logs' => 'auditoria/web_services/ci_ws_logs.php', + 'form_proyecto' => 'auditoria/web_services/form_proyecto.php', + 'pantalla_detalle_ws' => 'auditoria/web_services/pantalla_detalle_ws.php', 'contexto_ejecucion' => 'extension_toba/contexto_ejecucion.php', 'fuente' => 'extension_toba/fuente.php', 'sesion' => 'extension_toba/sesion.php', + 'toba_sin_menu' => 'extension_toba/toba_sin_menu.php', + 'toba_usuarios_comando' => 'extension_toba/toba_usuarios_comando.php', 'toba_usuarios_modelo' => 'extension_toba/toba_usuarios_modelo.php', 'toba_usuarios_normal' => 'extension_toba/toba_usuarios_normal.php', + 'InterfaseApiUsuarios' => 'lib/InterfaseApiUsuarios.php', 'admin_instancia' => 'lib/admin_instancia.php', + 'api_usuarios_1' => 'lib/api_usuarios_1.php', + 'api_usuarios_2' => 'lib/api_usuarios_2.php', 'consultas_instancia' => 'lib/consultas_instancia.php', + 'rest_arai_usuarios' => 'lib/rest_arai_usuarios.php', 'ci_login' => 'login/ci_login.php', 'cuadro_autologin' => 'login/cuadro_autologin.php', - 'form_proyecto' => 'perfiles/form_proyecto.php', + 'pant_login' => 'login/pant_login.php', + 'arbol_perfiles_funcionales' => 'menu/arbol_perfiles_funcionales.php', + 'ci_armador_menues' => 'menu/ci_armador_menues.php', + 'form_armado' => 'menu/form_armado.php', + 'pant_armado' => 'menu/pant_armado.php', + 'pant_descripciones' => 'menu/pant_descripciones.php', + 'pant_final' => 'menu/pant_final.php', + 'ci_asociar_menu_perfil' => 'perfiles/asociacion_menu/ci_asociar_menu_perfil.php', 'ci_editor' => 'perfiles/perfil_datos/ci_editor.php', 'ci_navegacion' => 'perfiles/perfil_datos/ci_navegacion.php', - 'arbol_perfiles_funcionales' => 'perfiles/perfil_funcional/arbol_perfiles_funcionales.php', 'ci_editor_perfiles' => 'perfiles/perfil_funcional/ci_editor_perfiles.php', 'ci_navegacion_perfiles' => 'perfiles/perfil_funcional/ci_navegacion_perfiles.php', 'datos_relacion_perfiles' => 'perfiles/perfil_funcional/datos_relacion_perfiles.php', @@ -45,13 +65,24 @@ static function cargar($nombre) 'arbol_restricciones_funcionales' => 'perfiles/restricciones_funcionales/arbol_restricciones_funcionales.php', 'ci_restricciones_funcionales' => 'perfiles/restricciones_funcionales/ci_restricciones_funcionales.php', 'pant_restricciones_funcionales' => 'perfiles/restricciones_funcionales/pant_restricciones_funcionales.php', + 'ci_gen_certificado' => 'servicios_web/generar_certificados/ci_gen_certificado.php', + 'ci_servicios_ofrecidos' => 'servicios_web/keystore_clientes/ci_servicios_ofrecidos.php', + 'pant_edicion_serv_ofrecidos' => 'servicios_web/keystore_clientes/pant_edicion_serv_ofrecidos.php', + 'ci_servicios_consumidos' => 'servicios_web/keystore_servidores/ci_servicios_consumidos.php', + 'cuadro_servicios_consumidos' => 'servicios_web/keystore_servidores/cuadro_servicios_consumidos.php', + 'form_basicos' => 'servicios_web/rest/servicios_consumidos/form_basicos.php', + 'caso_base' => 'testing/selenium/basics/caso_base.php', + 'test_login' => 'testing/selenium/test_login/test_login.php', + 'test_selenium_autoload' => 'testing/selenium/test_selenium_autoload.php', + 'test_usuarios' => 'testing/selenium/test_usuarios/test_usuarios.php', + 'toba_usuarios_autoload' => 'toba_usuarios_autoload.php', 'apdb_usuario_basicas' => 'usuarios/apdb_usuario_basicas.php', - 'ci_editor' => 'usuarios/ci_editor.php', - 'ci_navegacion' => 'usuarios/ci_navegacion.php', 'ei_form_basica' => 'usuarios/ei_form_basica.php', 'ei_form_filtro_usuarios' => 'usuarios/ei_form_filtro_usuarios.php', - 'rest_arai_usuarios' => 'lib/rest_arai_usuarios.php', - 'gestion_arai_usuarios' => 'usuarios/gestion_arai_usuarios.php' + 'form_ml_resp_secreta' => 'usuarios/form_ml_resp_secreta.php', + 'gestion_arai_usuarios' => 'usuarios/gestion_arai_usuarios.php', + 'ci_2fa_por_perfil' => 'usuarios/segundo_factor/ci_2fa_por_perfil.php', + 'ci_seleccion_usuario' => 'usuarios/seleccion_usuario/ci_seleccion_usuario.php', ); } ?> \ No newline at end of file diff --git a/proyectos/toba_usuarios/php/usuarios/ci_editor.php b/proyectos/toba_usuarios/php/usuarios/ci_editor.php index 88aa864007..a5a51c855a 100644 --- a/proyectos/toba_usuarios/php/usuarios/ci_editor.php +++ b/proyectos/toba_usuarios/php/usuarios/ci_editor.php @@ -2,288 +2,288 @@ class ci_editor extends toba_ci { - const clave_falsa = 'xS34Io9gF2JD'; //La clave no se envia al cliente - - protected $s__proyecto; - protected $s__usuario; - protected $s__usuario_arai; - - function ini() - { - toba::solicitud()->set_autocomplete(false); //Evita que el browser quiera guardar la clave de usuario - } - - function datos($tabla) - { - return $this->controlador->dep('datos')->tabla($tabla); - } - - function limpiar_datos() - { - unset($this->s__proyecto); - } - - function conf() - { - if ($this->controlador()->dep('datos')->esta_cargada()) { - $usuario = $this->datos('basica')->get(); - $this->s__usuario = $usuario['usuario']; - $desc = 'Usuario: ' . texto_plano($usuario['nombre']) . ''; - $this->pantalla()->set_descripcion($desc); - $this->dep('basica')->ef('usuario')->set_solo_lectura(true); - $this->dep('basica')->ef('usuario_arai')->set_solo_lectura(true); - $this->dep('basica')->ef('cuenta')->set_solo_lectura(true); - } else { - $this->controlador->pantalla()->eliminar_evento('eliminar'); - } - - // Elimina la dependencia form_pregunta_secreta cuando esta vinculado a arai-usuarios - if (toba::instalacion()->vincula_arai_usuarios() && $this->pantalla('usuario')->existe_dependencia('form_pregunta_secreta')) { - $this->pantalla('usuario')->eliminar_dep('form_pregunta_secreta'); - } - } - - function conf__proyecto() - { - if (!isset($this->s__proyecto)) { - $this->pantalla('proyecto')->eliminar_dep('form_proyectos'); - } - } - - //---- Info BASICA ------------------------------------------------------- - - function evt__basica__modificacion($datos) - { - $largo_clave = toba_parametros::get_largo_pwd(null); - - // seteo los datos de arai-usuarios - $datos = gestion_arai_usuarios::completar_datos_usuario($datos, $largo_clave); - if (isset($datos['usuario_arai'])) { - $this->s__usuario_arai = $datos['usuario_arai']; - } - - if ($datos['clave'] == self::clave_falsa ) { - unset($datos['clave']); - } else { //Chequeamos que la composicion de la clave sea valida - if (! toba::instalacion()->usa_2FA() || ! toba::instalacion()->vincula_arai_usuarios() || $datos['pide_2do_factor'] == 1) { - toba_usuario::verificar_composicion_clave($datos['clave'], $largo_clave); - } - } - - if (! isset($datos['autentificacion'])) { - $datos['autentificacion'] = apex_pa_algoritmo_hash; - } - $this->datos('basica')->set($datos); - } - - function conf__basica($form) - { - $datos = $this->datos('basica')->get(); - if (isset($datos)) { - $datos['clave'] = self::clave_falsa; - } - - $largo_clave = toba_parametros::get_largo_pwd(null); //Como aun no se sobre que proyecto trabajo.. el largo es el por defecto, osea 8. - $form->ef('clave')->set_expreg(toba_usuario::get_exp_reg_pwd($largo_clave)); - $form->ef('clave')->set_descripcion("La clave debe tener al menos $largo_clave caracteres, entre letras mayúsculas, minúsculas, números y símbolos, no pudiendo repetir caracteres adyacentes"); - $form->ef('clave')->set_obligatorio(true); - - // obtengo los datos de arai-usuarios - $datos = gestion_arai_usuarios::get_datos($datos); - - // quito los campos que no se utilizan cuando esta vinculado con arai-usuarios y ademas usa 2FA - if (toba::instalacion()->vincula_arai_usuarios()) { - $efs = array('usuario', 'nombre', 'email', 'clave', 'forzar_cambio_pwd', 'vencimiento', 'pide_2do_factor'); - if (toba::instalacion()->usa_2FA()) { - $efs = array_diff($efs, ['clave', 'pide_2do_factor']); - $form->ef('clave')->set_obligatorio(false); - } - } else { - $efs = array('usuario_arai', 'cuenta', 'pide_2do_factor'); - } - $form->desactivame_campos($efs); - return $datos; - } - - //---- Asociacion a PROYECTOS ------------------------------------------------- - - function evt__proyecto__salida() - { - $this->datos('proyecto')->resetear_cursor(); - } - - function evt__cuadro_proyectos__seleccion($seleccion) - { - $this->s__proyecto = $seleccion['proyecto']; - } - - function conf__cuadro_proyectos($componente) - { - $proyectos = consultas_instancia::get_lista_proyectos(); - foreach ($proyectos as $id => $proyecto) { - $grupos_acceso = $this->datos('proyecto')->get_filas(array('proyecto' => $proyecto['proyecto'])); - $grupos = array(); - //-- Perfil funcional ------------------------- - foreach ($grupos_acceso as $ga) { - $grupos[] = $ga['grupo_acceso']; - } - $proyectos[$id]['grupos_acceso'] = empty($grupos) ? '-- Sin Acceso --' : implode(', ', $grupos); - //-- Perfil datos ----------------------------- - $perfil_datos = $this->datos('proyecto_pd')->get_filas(array('proyecto' => $proyecto['proyecto'])); - if ($perfil_datos) { - $proyectos[$id]['perfil_datos'] = $perfil_datos[0]['perfil_datos_nombre']; - } else { - $proyectos[$id]['perfil_datos'] = ' '; - } - } - $componente->set_datos($proyectos); - } - - function evt__form_proyectos__modificacion($datos) - { - //-- Perfil funcional ------------------------- - $id = $this->datos('proyecto')->get_id_fila_condicion(array('proyecto'=>$this->s__proyecto)); - foreach ($id as $clave) { - $this->datos('proyecto')->eliminar_fila($clave); - } - $fila = array('proyecto' => $this->s__proyecto, 'usuario' => $this->s__usuario); - foreach ($datos['usuario_grupo_acc'] as $grupo_acceso) { - $fila['usuario_grupo_acc'] = $grupo_acceso; - $this->datos('proyecto')->nueva_fila($fila); - } - - //-- Perfil datos ----------------------------- - $id = $this->datos('proyecto_pd')->get_id_fila_condicion(array('proyecto'=>$this->s__proyecto)); - foreach ($id as $clave) { - $this->datos('proyecto_pd')->eliminar_fila($clave); - } - - $fila = array('proyecto' => $this->s__proyecto, 'usuario' => $this->s__usuario); - foreach ($datos['usuario_perfil_datos'] as $perfil) { - $fila['usuario_perfil_datos'] = $perfil; - $this->datos('proyecto_pd')->nueva_fila($fila); - } - $this->limpiar_datos(); - } - - function evt__form_proyectos__baja() - { - //-- Perfil funcional ------------------------- - $id = $this->datos('proyecto')->get_id_fila_condicion(array('proyecto' => $this->s__proyecto)); - foreach ($id as $clave) { - $this->datos('proyecto')->eliminar_fila($clave); - } - //-- Perfil datos ----------------------------- - $id = $this->datos('proyecto_pd')->get_id_fila_condicion(array('proyecto'=>$this->s__proyecto)); - foreach ($id as $clave) { - $this->datos('proyecto_pd')->eliminar_fila($clave); - } - $this->limpiar_datos(); - } - - function evt__form_proyectos__cancelar() - { - unset($this->s__proyecto); - } - - function conf__form_proyectos($componente) - { - if (isset($this->s__proyecto)) { - $datos = array(); - $datos['proyecto'] = $this->s__proyecto; - //-- Perfil funcional ------------------------- - $grupo_acc = $this->datos('proyecto')->get_filas(array('usuario'=> $this->s__usuario, 'proyecto'=>$this->s__proyecto)); - $ga_seleccionados = array(); - foreach ($grupo_acc as $ga) { - $ga_seleccionados[] = $ga['usuario_grupo_acc']; - } - $datos['usuario_grupo_acc'] = $ga_seleccionados; - - //-- Perfil datos ----------------------------- - $pd_seleccionados = array(); - $perfil_datos = $this->datos('proyecto_pd')->get_filas(array('usuario'=> $this->s__usuario, 'proyecto'=>$this->s__proyecto)); - foreach($perfil_datos as $perfil) { - $pd_seleccionados[] = $perfil['usuario_perfil_datos']; - } - $datos['usuario_perfil_datos'] = $pd_seleccionados; - - //Veo si dejo el evento, no tiene sentido si no hay nada que asociar - if (empty($grupo_acc) && empty($perfil_datos)) { - $componente->eliminar_evento('baja'); - } - $componente->set_datos($datos); - } - } - - //----------------------------------------------------------------------------------- - //---- form_pregunta_secreta -------------------------------------------------------- - //----------------------------------------------------------------------------------- - - function conf__form_pregunta_secreta(toba_ei_formulario_ml $form_ml) - { - $datos = $this->datos('pregunta_secreta')->get_filas(); - foreach ($datos as $klave => $fila) { - $datos[$klave]['activa'] = ($datos[$klave]['activa'] == '1') ? 'SI' : 'NO'; - $datos[$klave]['pregunta'] = $this->desencriptar_datos($datos[$klave]['pregunta']); - $datos[$klave]['respuesta'] = $this->desencriptar_datos($datos[$klave]['respuesta']); - } - $form_ml->set_datos($datos); - } - - function evt__form_pregunta_secreta__modificacion($datos) - { - $hay_alta = false; - //Solo una de las preguntas tiene que estar activa. - $keys_d = array_keys($datos); - foreach ($keys_d as $klave) { - if ($datos[$klave]['apex_ei_analisis_fila'] == 'A') { - $datos[$klave]['activa'] = '1'; - $hay_alta = true; - } elseif (isset($datos[$klave]['activa'])) { - unset($datos[$klave]['activa']); - } - $datos[$klave]['pregunta'] = $this->encriptar_datos($datos[$klave]['pregunta']); - $datos[$klave]['respuesta'] = $this->encriptar_datos($datos[$klave]['respuesta']); - } - if ($hay_alta) { //Si hay una fila nueva deshabilito las anteriores - $this->datos('pregunta_secreta')->set_columna_valor('activa', '0'); - } - $this->datos('pregunta_secreta')->procesar_filas($datos); - } - - //---- Consultas --------------------------------------------------- - - function get_lista_grupos_acceso_proyecto() - { - $proyecto = quote($this->s__proyecto); - $sql = "SELECT usuario_grupo_acc, + public const clave_falsa = 'xS34Io9gF2JD'; //La clave no se envia al cliente + + protected $s__proyecto; + protected $s__usuario; + protected $s__usuario_arai; + + public function ini() + { + toba::solicitud()->set_autocomplete(false); //Evita que el browser quiera guardar la clave de usuario + } + + public function datos($tabla) + { + return $this->controlador->dep('datos')->tabla($tabla); + } + + public function limpiar_datos() + { + unset($this->s__proyecto); + } + + public function conf() + { + if ($this->controlador()->dep('datos')->esta_cargada()) { + $usuario = $this->datos('basica')->get(); + $this->s__usuario = $usuario['usuario']; + $desc = 'Usuario: ' . texto_plano($usuario['nombre']) . ''; + $this->pantalla()->set_descripcion($desc); + $this->dep('basica')->ef('usuario')->set_solo_lectura(true); + $this->dep('basica')->ef('usuario_arai')->set_solo_lectura(true); + $this->dep('basica')->ef('cuenta')->set_solo_lectura(true); + } else { + $this->controlador->pantalla()->eliminar_evento('eliminar'); + } + + // Elimina la dependencia form_pregunta_secreta cuando esta vinculado a arai-usuarios + if (toba::instalacion()->vincula_arai_usuarios() && $this->pantalla('usuario')->existe_dependencia('form_pregunta_secreta')) { + $this->pantalla('usuario')->eliminar_dep('form_pregunta_secreta'); + } + } + + public function conf__proyecto() + { + if (!isset($this->s__proyecto)) { + $this->pantalla('proyecto')->eliminar_dep('form_proyectos'); + } + } + + //---- Info BASICA ------------------------------------------------------- + + public function evt__basica__modificacion($datos) + { + $largo_clave = toba_parametros::get_largo_pwd(null); + + // seteo los datos de arai-usuarios + $datos = gestion_arai_usuarios::completar_datos_usuario($datos, $largo_clave); + if (isset($datos['usuario_arai'])) { + $this->s__usuario_arai = $datos['usuario_arai']; + } + + if ($datos['clave'] == self::clave_falsa) { + unset($datos['clave']); + } else { //Chequeamos que la composicion de la clave sea valida + if (! toba::instalacion()->usa_2FA() || ! toba::instalacion()->vincula_arai_usuarios() || $datos['pide_2do_factor'] == 1) { + toba_usuario::verificar_composicion_clave($datos['clave'], $largo_clave); + } + } + + if (! isset($datos['autentificacion'])) { + $datos['autentificacion'] = apex_pa_algoritmo_hash; + } + $this->datos('basica')->set($datos); + } + + public function conf__basica($form) + { + $datos = $this->datos('basica')->get(); + if (isset($datos)) { + $datos['clave'] = self::clave_falsa; + } + + $largo_clave = toba_parametros::get_largo_pwd(null); //Como aun no se sobre que proyecto trabajo.. el largo es el por defecto, osea 8. + $form->ef('clave')->set_expreg(toba_usuario::get_exp_reg_pwd($largo_clave)); + $form->ef('clave')->set_descripcion("La clave debe tener al menos $largo_clave caracteres, entre letras mayúsculas, minúsculas, números y símbolos, no pudiendo repetir caracteres adyacentes"); + $form->ef('clave')->set_obligatorio(true); + + // obtengo los datos de arai-usuarios y mergeo con los del DT + $datos = gestion_arai_usuarios::get_datos($datos); + + // quito los campos que no se utilizan cuando esta vinculado con arai-usuarios y ademas usa 2FA + if (toba::instalacion()->vincula_arai_usuarios()) { + $efs = array('usuario', 'nombre', 'email', 'clave', 'forzar_cambio_pwd', 'vencimiento', 'pide_2do_factor'); + if (toba::instalacion()->usa_2FA()) { + $efs = array_diff($efs, ['clave', 'pide_2do_factor']); + $form->ef('clave')->set_obligatorio(false); + } + } else { + $efs = array('usuario_arai', 'cuenta', 'pide_2do_factor'); + } + $form->desactivame_campos($efs); + return $datos; + } + + //---- Asociacion a PROYECTOS ------------------------------------------------- + + public function evt__proyecto__salida() + { + $this->datos('proyecto')->resetear_cursor(); + } + + public function evt__cuadro_proyectos__seleccion($seleccion) + { + $this->s__proyecto = $seleccion['proyecto']; + } + + public function conf__cuadro_proyectos($componente) + { + $proyectos = consultas_instancia::get_lista_proyectos(); + foreach ($proyectos as $id => $proyecto) { + $grupos_acceso = $this->datos('proyecto')->get_filas(array('proyecto' => $proyecto['proyecto'])); + $grupos = array(); + //-- Perfil funcional ------------------------- + foreach ($grupos_acceso as $ga) { + $grupos[] = $ga['grupo_acceso']; + } + $proyectos[$id]['grupos_acceso'] = empty($grupos) ? '-- Sin Acceso --' : implode(', ', $grupos); + //-- Perfil datos ----------------------------- + $perfil_datos = $this->datos('proyecto_pd')->get_filas(array('proyecto' => $proyecto['proyecto'])); + if ($perfil_datos) { + $proyectos[$id]['perfil_datos'] = $perfil_datos[0]['perfil_datos_nombre']; + } else { + $proyectos[$id]['perfil_datos'] = ' '; + } + } + $componente->set_datos($proyectos); + } + + public function evt__form_proyectos__modificacion($datos) + { + //-- Perfil funcional ------------------------- + $id = $this->datos('proyecto')->get_id_fila_condicion(array('proyecto'=>$this->s__proyecto)); + foreach ($id as $clave) { + $this->datos('proyecto')->eliminar_fila($clave); + } + $fila = array('proyecto' => $this->s__proyecto, 'usuario' => $this->s__usuario); + foreach ($datos['usuario_grupo_acc'] as $grupo_acceso) { + $fila['usuario_grupo_acc'] = $grupo_acceso; + $this->datos('proyecto')->nueva_fila($fila); + } + + //-- Perfil datos ----------------------------- + $id = $this->datos('proyecto_pd')->get_id_fila_condicion(array('proyecto'=>$this->s__proyecto)); + foreach ($id as $clave) { + $this->datos('proyecto_pd')->eliminar_fila($clave); + } + + $fila = array('proyecto' => $this->s__proyecto, 'usuario' => $this->s__usuario); + foreach ($datos['usuario_perfil_datos'] as $perfil) { + $fila['usuario_perfil_datos'] = $perfil; + $this->datos('proyecto_pd')->nueva_fila($fila); + } + $this->limpiar_datos(); + } + + public function evt__form_proyectos__baja() + { + //-- Perfil funcional ------------------------- + $id = $this->datos('proyecto')->get_id_fila_condicion(array('proyecto' => $this->s__proyecto)); + foreach ($id as $clave) { + $this->datos('proyecto')->eliminar_fila($clave); + } + //-- Perfil datos ----------------------------- + $id = $this->datos('proyecto_pd')->get_id_fila_condicion(array('proyecto'=>$this->s__proyecto)); + foreach ($id as $clave) { + $this->datos('proyecto_pd')->eliminar_fila($clave); + } + $this->limpiar_datos(); + } + + public function evt__form_proyectos__cancelar() + { + unset($this->s__proyecto); + } + + public function conf__form_proyectos($componente) + { + if (isset($this->s__proyecto)) { + $datos = array(); + $datos['proyecto'] = $this->s__proyecto; + //-- Perfil funcional ------------------------- + $grupo_acc = $this->datos('proyecto')->get_filas(array('usuario'=> $this->s__usuario, 'proyecto'=>$this->s__proyecto)); + $ga_seleccionados = array(); + foreach ($grupo_acc as $ga) { + $ga_seleccionados[] = $ga['usuario_grupo_acc']; + } + $datos['usuario_grupo_acc'] = $ga_seleccionados; + + //-- Perfil datos ----------------------------- + $pd_seleccionados = array(); + $perfil_datos = $this->datos('proyecto_pd')->get_filas(array('usuario'=> $this->s__usuario, 'proyecto'=>$this->s__proyecto)); + foreach ($perfil_datos as $perfil) { + $pd_seleccionados[] = $perfil['usuario_perfil_datos']; + } + $datos['usuario_perfil_datos'] = $pd_seleccionados; + + //Veo si dejo el evento, no tiene sentido si no hay nada que asociar + if (empty($grupo_acc) && empty($perfil_datos)) { + $componente->eliminar_evento('baja'); + } + $componente->set_datos($datos); + } + } + + //----------------------------------------------------------------------------------- + //---- form_pregunta_secreta -------------------------------------------------------- + //----------------------------------------------------------------------------------- + + public function conf__form_pregunta_secreta(toba_ei_formulario_ml $form_ml) + { + $datos = $this->datos('pregunta_secreta')->get_filas(); + foreach ($datos as $klave => $fila) { + $datos[$klave]['activa'] = ($datos[$klave]['activa'] == '1') ? 'SI' : 'NO'; + $datos[$klave]['pregunta'] = $this->desencriptar_datos($datos[$klave]['pregunta']); + $datos[$klave]['respuesta'] = $this->desencriptar_datos($datos[$klave]['respuesta']); + } + $form_ml->set_datos($datos); + } + + public function evt__form_pregunta_secreta__modificacion($datos) + { + $hay_alta = false; + //Solo una de las preguntas tiene que estar activa. + $keys_d = array_keys($datos); + foreach ($keys_d as $klave) { + if ($datos[$klave]['apex_ei_analisis_fila'] == 'A') { + $datos[$klave]['activa'] = '1'; + $hay_alta = true; + } elseif (isset($datos[$klave]['activa'])) { + unset($datos[$klave]['activa']); + } + $datos[$klave]['pregunta'] = $this->encriptar_datos($datos[$klave]['pregunta']); + $datos[$klave]['respuesta'] = $this->encriptar_datos($datos[$klave]['respuesta']); + } + if ($hay_alta) { //Si hay una fila nueva deshabilito las anteriores + $this->datos('pregunta_secreta')->set_columna_valor('activa', '0'); + } + $this->datos('pregunta_secreta')->procesar_filas($datos); + } + + //---- Consultas --------------------------------------------------- + + public function get_lista_grupos_acceso_proyecto() + { + $proyecto = quote($this->s__proyecto); + $sql = "SELECT usuario_grupo_acc, nombre, descripcion FROM apex_usuario_grupo_acc WHERE proyecto = $proyecto;"; - return toba::db()->consultar($sql); - } - - private function encriptar_datos($dato_original) - { - if (trim($dato_original) != '') { - $clave = toba::instalacion()->get_claves_encriptacion(); - $cripter = toba_encriptador::instancia(); - return $cripter->encriptar($dato_original, $clave['get']); - } - } - - private function desencriptar_datos($dato_encriptado) - { - if (trim($dato_encriptado) != '') { - $clave = toba::instalacion()->get_claves_encriptacion(); - $cripter = toba_encriptador::instancia(); - return $cripter->desencriptar($dato_encriptado, $clave['get']); - } - } - - public function get_usuario_arai() { - return $this->s__usuario_arai; - } + return toba::db('toba_usuarios')->consultar($sql); + } + + private function encriptar_datos($dato_original) + { + if (trim($dato_original) != '') { + $clave = toba::instalacion()->get_claves_encriptacion(); + $cripter = toba_encriptador::instancia(); + return $cripter->encriptar($dato_original, $clave['get']); + } + } + + private function desencriptar_datos($dato_encriptado) + { + if (trim($dato_encriptado) != '') { + $clave = toba::instalacion()->get_claves_encriptacion(); + $cripter = toba_encriptador::instancia(); + return $cripter->desencriptar($dato_encriptado, $clave['get']); + } + } + + public function get_usuario_arai() + { + return $this->s__usuario_arai; + } } -?> \ No newline at end of file diff --git a/proyectos/toba_usuarios/php/usuarios/gestion_arai_usuarios.php b/proyectos/toba_usuarios/php/usuarios/gestion_arai_usuarios.php index a3d648bfbe..35a87bdbe4 100644 --- a/proyectos/toba_usuarios/php/usuarios/gestion_arai_usuarios.php +++ b/proyectos/toba_usuarios/php/usuarios/gestion_arai_usuarios.php @@ -1,147 +1,153 @@ -vincula_arai_usuarios()) { - if (! isset($datos['cuenta']) && isset($datos['usuario'])) { - $datos['cuenta'] = $datos['usuario']; - } - if (! isset($datos['usuario_arai']) && isset($datos['cuenta']) && self::verifica_version_arai_cli()) { - $datos['usuario_arai'] = rest_arai_usuarios::instancia()->get_identificador_x_aplicacion_cuenta(self::getIdAplicacion(), $datos['cuenta']); - } - } - return $datos; - } - - /** - * @deprecated desde version 3.1.0 - * @param array $datos - * @param int $largo_clave - * @return array - */ - static public function set_datos($datos, $largo_clave) - { - return self::completar_datos_usuario($datos, $largo_clave); - } - - static public function completar_datos_usuario($datos, $largo_clave) - { - if (toba::instalacion()->vincula_arai_usuarios()) { - if (!isset($datos['clave'])) { - $datos['clave'] = self::get_clave_aleatoria($largo_clave); - } - if (!isset($datos['usuario']) && isset($datos['cuenta'])) { - $datos['usuario'] = $datos['cuenta']; - } - if (isset($datos['usuario_arai'])) { - $datos['usuario_arai'] = self::get_identificador_arai_usuarios($datos['usuario_arai']); - } - if (!isset($datos['nombre']) && isset($datos['usuario_arai'])) { - $datos['nombre'] = rest_arai_usuarios::instancia()->get_nombre_apellido_usuario($datos['usuario_arai']); - } - } - return $datos; - } - - static public function sincronizar_datos($cuenta, $identificador) - { - $resultado = true; - if (toba::instalacion()->vincula_arai_usuarios() && self::verifica_version_arai_cli()) { - $appUniqueId = self::getIdAplicacion(); - $identificador_arai_usuarios = rest_arai_usuarios::instancia()->get_identificador_x_aplicacion_cuenta($appUniqueId, $cuenta); - if (!isset($identificador_arai_usuarios)) { - $datos_cuenta = array( - 'identificador_aplicacion' => $appUniqueId, - 'cuenta' => $cuenta, - 'identificador_usuario' => $identificador, - ); - $resultado = rest_arai_usuarios::instancia()->agregar_cuenta($appUniqueId, $datos_cuenta); - } elseif ($identificador != $identificador_arai_usuarios) { - throw new toba_error('La cuenta se encuentra asociada a otro usuario de ARAI.'); - } - } - return $resultado; - } - - static public function eliminar_datos($cuenta) - { - $resultado = true; - if (toba::instalacion()->vincula_arai_usuarios() && self::verifica_version_arai_cli()) { - $resultado = rest_arai_usuarios::instancia()->eliminar_cuenta(self::getIdAplicacion(), $cuenta); - } - return $resultado; - } - - static function get_nombre_usuario_arai($identificador) - { - return rest_arai_usuarios::instancia()->get_nombre_apellido_usuario($identificador); - } - - static function get_identificador_arai_usuarios($clave) - { - $datos = toba_ei_cuadro::recuperar_clave_fila('31000002', $clave); - if (isset($datos) && !empty($datos) && isset($datos['identificador'])) { - return $datos['identificador']; - } else { - return $clave; - } - } - - static public function get_usuarios_disponibles_aplicacion($filtro) - { - $datos = array(); - if (toba::instalacion()->vincula_arai_usuarios() && self::verifica_version_arai_cli()) { - $datos = rest_arai_usuarios::instancia()->get_usuarios($filtro, self::getIdAplicacion()); - } - return $datos; - } - - /************************************************************************************************* - METODOS PRIVADOS - *************************************************************************************************/ - - static private function get_clave_aleatoria($largo_clave) - { - do { - try { - $claveok = true; - $clave_tmp = toba_usuario::generar_clave_aleatoria($largo_clave); - toba_usuario::verificar_composicion_clave($clave_tmp, $largo_clave); - } catch(toba_error_pwd_conformacion_invalida $e) { - $claveok = false; - } catch(toba_error_usuario $e) { - $claveok = false; - } - } while(! $claveok); - return $clave_tmp; - } - - static private function verifica_version_arai_cli() - { - if (! class_exists('SIU\AraiCli\AraiCli')) { - throw new toba_error('No se encuentra instalado el paquete siu/arai-cli, revise los paquetes sugeridos en composer.'); - } - //Agregar verificacion puntual de version compatible de arai-cli - if (! SIUToba\Framework\Arai\RegistryHooksProyectoToba::checkVersionCompatible()) { - throw new toba_error('La versión del paquete siu/arai-cli no es compatible, revise la documentación del sistema.'); - } - - return true; - } - - static private function getIdAplicacion() - { - $appID = toba::instalacion()->vincula_arai_proyecto(); - if (null === $appID) { - $appID = SIUToba\Framework\Arai\RegistryHooksProyectoToba::getAppUniqueId(); - } - return $appID; - } + public static function get_datos($datos) + { + if (toba::instalacion()->vincula_arai_usuarios()) { + if (! isset($datos['cuenta']) && isset($datos['usuario'])) { + $datos['cuenta'] = $datos['usuario']; + } + if (! isset($datos['usuario_arai']) && isset($datos['cuenta']) && self::verifica_version_arai_cli()) { + $datos['usuario_arai'] = rest_arai_usuarios::instancia()->get_identificador_x_aplicacion_cuenta(self::getIdAplicacion(), $datos['cuenta']); + } + } + return $datos; + } + + /** + * @deprecated desde version 3.1.0 + * @param array $datos + * @param int $largo_clave + * @return array + */ + public static function set_datos($datos, $largo_clave) + { + return self::completar_datos_usuario($datos, $largo_clave); + } + + public static function completar_datos_usuario($datos, $largo_clave) + { + if (toba::instalacion()->vincula_arai_usuarios()) { + if (!isset($datos['clave'])) { + $datos['clave'] = self::get_clave_aleatoria($largo_clave); + } + if (!isset($datos['usuario']) && isset($datos['cuenta'])) { + $datos['usuario'] = $datos['cuenta']; + } + if (isset($datos['usuario_arai'])) { + $datos['usuario_arai'] = self::get_identificador_arai_usuarios($datos['usuario_arai']); + + $restData = rest_arai_usuarios::instancia()->get_usuario($datos['usuario_arai']); + if (!isset($datos['nombre']) && ! empty($restData)) { + $datos['nombre'] = $restData['nombre_apellido'] ?? ''; + } + + if (! isset($datos['uid']) && ! empty($restData)) { + $datos['uid'] = $restData['uid'] ?? ''; + } + } + } + return $datos; + } + + public static function sincronizar_datos($cuenta, $identificador) + { + $resultado = true; + if (toba::instalacion()->vincula_arai_usuarios() && self::verifica_version_arai_cli()) { + $appUniqueId = self::getIdAplicacion(); + $identificador_arai_usuarios = rest_arai_usuarios::instancia()->get_identificador_x_aplicacion_cuenta($appUniqueId, $cuenta); + if (!isset($identificador_arai_usuarios)) { + $datos_cuenta = array( + 'identificador_aplicacion' => $appUniqueId, + 'cuenta' => $cuenta, + 'identificador_usuario' => $identificador, + ); + $resultado = rest_arai_usuarios::instancia()->agregar_cuenta($appUniqueId, $datos_cuenta); + } elseif ($identificador != $identificador_arai_usuarios) { + throw new toba_error('La cuenta se encuentra asociada a otro usuario de ARAI.'); + } + } + return $resultado; + } + + public static function eliminar_datos($cuenta) + { + $resultado = true; + if (toba::instalacion()->vincula_arai_usuarios() && self::verifica_version_arai_cli()) { + $resultado = rest_arai_usuarios::instancia()->eliminar_cuenta(self::getIdAplicacion(), $cuenta); + } + return $resultado; + } + + public static function get_nombre_usuario_arai($identificador) + { + return rest_arai_usuarios::instancia()->get_nombre_apellido_usuario($identificador); + } + + public static function get_identificador_arai_usuarios($clave) + { + $datos = toba_ei_cuadro::recuperar_clave_fila('31000002', $clave); + if (isset($datos) && !empty($datos) && isset($datos['identificador'])) { + return $datos['identificador']; + } else { + return $clave; + } + } + + public static function get_usuarios_disponibles_aplicacion($filtro) + { + $datos = array(); + if (toba::instalacion()->vincula_arai_usuarios() && self::verifica_version_arai_cli()) { + $datos = rest_arai_usuarios::instancia()->get_usuarios($filtro, self::getIdAplicacion()); + } + return $datos; + } + + /************************************************************************************************* + METODOS PRIVADOS + *************************************************************************************************/ + + private static function get_clave_aleatoria($largo_clave) + { + do { + try { + $claveok = true; + $clave_tmp = toba_usuario::generar_clave_aleatoria($largo_clave); + toba_usuario::verificar_composicion_clave($clave_tmp, $largo_clave); + } catch (toba_error_pwd_conformacion_invalida $e) { + $claveok = false; + } catch (toba_error_usuario $e) { + $claveok = false; + } + } while (! $claveok); + return $clave_tmp; + } + + private static function verifica_version_arai_cli() + { + if (! class_exists('SIU\AraiCli\AraiCli')) { + throw new toba_error('No se encuentra instalado el paquete siu/arai-cli, revise los paquetes sugeridos en composer.'); + } + //Agregar verificacion puntual de version compatible de arai-cli + if (! SIUToba\Framework\Arai\RegistryHooksProyectoToba::checkVersionCompatible()) { + throw new toba_error('La versión del paquete siu/arai-cli no es compatible, revise la documentación del sistema.'); + } + + return true; + } + + private static function getIdAplicacion() + { + $appID = toba::instalacion()->vincula_arai_proyecto(); + if (null === $appID) { + $appID = SIUToba\Framework\Arai\RegistryHooksProyectoToba::getAppUniqueId(); + } + return $appID; + } } -?> diff --git a/proyectos/toba_usuarios/php/usuarios/segundo_factor/ci_2fa_por_perfil.php b/proyectos/toba_usuarios/php/usuarios/segundo_factor/ci_2fa_por_perfil.php index 4e6408213c..78c6562100 100755 --- a/proyectos/toba_usuarios/php/usuarios/segundo_factor/ci_2fa_por_perfil.php +++ b/proyectos/toba_usuarios/php/usuarios/segundo_factor/ci_2fa_por_perfil.php @@ -28,12 +28,12 @@ function conf__cuadro(toba_ei_cuadro $cuadro) function evt__cuadro__segundo_factor_mas($seleccion) { try { - toba::db()->abrir_transaccion(); + toba::db('toba_usuarios')->abrir_transaccion(); $membresias = $this->buscar_membresias($seleccion); $this->marcar_usuarios_perfil($membresias); - toba::db()->cerrar_transaccion(); + toba::db('toba_usuarios')->cerrar_transaccion(); }catch (\toba_error_db $e) { - toba::db()->abortar_transaccion(); + toba::db('toba_usuarios')->abortar_transaccion(); throw $e; } } @@ -42,14 +42,14 @@ function evt__cuadro__segundo_factor_mas($seleccion) function evt__cuadro__segundo_factor_menos($seleccion) { try { - toba::db()->abrir_transaccion(); + toba::db('toba_usuarios')->abrir_transaccion(); $membresias = $this->buscar_membresias($seleccion); if (count($membresias) == 1) { //No desactivo cuando hay mas de un perfil funcional involucrado $this->desmarcar_usuarios_perfil($membresias); } - toba::db()->cerrar_transaccion(); + toba::db('toba_usuarios')->cerrar_transaccion(); }catch (\toba_error_db $e) { - toba::db()->abortar_transaccion(); + toba::db('toba_usuarios')->abortar_transaccion(); throw $e; } } diff --git a/proyectos/toba_usuarios/php/usuarios/seleccion_usuario/ci_seleccion_usuario.php b/proyectos/toba_usuarios/php/usuarios/seleccion_usuario/ci_seleccion_usuario.php index 533b763f49..bceb9c7435 100644 --- a/proyectos/toba_usuarios/php/usuarios/seleccion_usuario/ci_seleccion_usuario.php +++ b/proyectos/toba_usuarios/php/usuarios/seleccion_usuario/ci_seleccion_usuario.php @@ -9,6 +9,7 @@ class ci_seleccion_usuario extends toba_ci function conf__cuadro(toba_ei_cuadro $cuadro) { + $cuadro->desactivar_modo_clave_segura(); if (isset($this->s__filtro)) { $cuadro->set_datos(gestion_arai_usuarios::get_usuarios_disponibles_aplicacion($this->s__filtro)); } diff --git a/proyectos/toba_usuarios/proyecto.ini b/proyectos/toba_usuarios/proyecto.ini index c0cf17ff8a..3242c06e8d 100644 --- a/proyectos/toba_usuarios/proyecto.ini +++ b/proyectos/toba_usuarios/proyecto.ini @@ -5,7 +5,7 @@ descripcion = Descripci? del proyecto mail_soporte = ;Versi? del proyecto, debe ser formato x.y.z -version = 3.3.24 +version = 3.4.0 app_launcher = 1 ;Nombre de fantas? de la versi? diff --git a/www/js/basicos/notificacion.js b/www/js/basicos/notificacion.js index 5ee84118c3..691d9db433 100644 --- a/www/js/basicos/notificacion.js +++ b/www/js/basicos/notificacion.js @@ -89,7 +89,7 @@ notificacion = new function() { } else { gravedad = ' '; } - var texto = this._mensajes[i][0]; + var texto = this._mensajes[i][0].decodeEntities(); if (typeof this._mensajes[i][2] != 'undefined' && isset(this._mensajes[i][2])) { texto = "" + this._mensajes[i][2].decodeEntities() + " " + texto; } diff --git a/www/js/basicos/tipclick.js b/www/js/basicos/tipclick.js index 34a294dd01..0f64e038d7 100644 --- a/www/js/basicos/tipclick.js +++ b/www/js/basicos/tipclick.js @@ -29,10 +29,13 @@ var tipclick = { var x = Math.round(this._get_pos_offset(obj, true)); var y = Math.round(this._get_pos_offset(obj, false)); + //Calcula ajuste extra sobre eje X para posiciones cercanas al borde de pantalla + var xVariance = (screen.width - x < 100) ? 115 : 0; + //Agregamos la clase correspondiente y modificamos la posicion via css tip_div.addClass('tooltip') .css('visibility', 'visible') - .css('left', x - this._clear_browser_edge(obj, true, x, y ) + "px") + .css('left', x - xVariance - this._clear_browser_edge(obj, true, x, y ) + "px") .css('top', y - this._clear_browser_edge(obj, false, x, y) + obj.offsetHeight + "px"); return true; diff --git a/www/js/componentes/ei.js b/www/js/componentes/ei.js index c38d2c25df..219bae712e 100644 --- a/www/js/componentes/ei.js +++ b/www/js/componentes/ei.js @@ -309,13 +309,13 @@ ei.prototype.constructor = ei; return document.getElementById(this._input_submit + '_' + id); }; - ei.prototype.exportar_pdf = function() { - var url = vinculador.get_url(null, null, 'vista_pdf', null, [this._id]); + ei.prototype.exportar_pdf = function(propaga_zona = false) { + var url = vinculador.get_url(null, null, 'vista_pdf', null, [this._id], false, propaga_zona); document.location.href = url; }; - ei.prototype.exportar_excel = function() { - var url = vinculador.get_url(null, null, 'vista_excel', null, [this._id]); + ei.prototype.exportar_excel = function(propaga_zona = false) { + var url = vinculador.get_url(null, null, 'vista_excel', null, [this._id], false, propaga_zona); document.location.href = url; }; diff --git a/www/js/componentes/ei_cuadro.js b/www/js/componentes/ei_cuadro.js index 7bb0dde335..b049489e58 100644 --- a/www/js/componentes/ei_cuadro.js +++ b/www/js/componentes/ei_cuadro.js @@ -344,9 +344,9 @@ function ei_cuadro(id, instancia, input_submit, filas, ids_eventos_multiple) { this.set_ordenamiento_multiple(seleccion_actual); } - ei_cuadro.prototype.exportar_excel_sin_cortes = function() { + ei_cuadro.prototype.exportar_excel_sin_cortes = function(propaga_zona = false) { var param = {es_plano:true}; - var url = vinculador.get_url(null, null, 'vista_excel', param, [this._id]); + var url = vinculador.get_url(null, null, 'vista_excel', param, [this._id], false, propaga_zona); document.location.href = url; }; diff --git a/www/js/efs/ef_combo_editable.js b/www/js/efs/ef_combo_editable.js index 3c2e8da9c6..82834b7170 100644 --- a/www/js/efs/ef_combo_editable.js +++ b/www/js/efs/ef_combo_editable.js @@ -63,10 +63,12 @@ function ef_combo_editable(id_form, etiqueta, obligatorio, colapsado, tamano, mo //Recorro las opciones del combo por si viene cargado desde el servidor, asi no elimino opciones validas var valor_actual; + var aux_valor; this._ultimas_opciones_server[this._id_form] = []; //Inicializo la coleccion para el ML for (var i=0; i < combo_original.options.length; i++) { - valor_actual = combo_original.options[i].value; + aux_valor = combo_original.options[i].value; + valor_actual = (typeof aux_valor == 'string') ? trim(aux_valor): aux_valor; //Se trimea para que la comparacion contra get_estado() luego sea homogenea if (isset(valor_actual) && valor_actual != 'nopar') { this._ultimas_opciones_server[this._id_form].push(valor_actual); } @@ -299,7 +301,7 @@ function ef_combo_editable(id_form, etiqueta, obligatorio, colapsado, tamano, mo var datos = []; this._ultimas_opciones_server[this._id_form] = []; for (var i = 0; i < valores.length; i++) { - var clave = valores[i][0]; + var clave = (typeof valores[i][0] == 'string') ? trim(valores[i][0]): valores[i][0]; var valor = (typeof valores[i][1] == 'string') ? valores[i][1].decodeEntities(): valores[i][1]; if (clave != 'nopar') { datos.push([clave, valor]); diff --git a/www/js/efs/ef_cuit.js b/www/js/efs/ef_cuit.js index 95dc8ffc2f..c5672128c5 100644 --- a/www/js/efs/ef_cuit.js +++ b/www/js/efs/ef_cuit.js @@ -6,9 +6,10 @@ ef_cuit.prototype.constructor = ef_cuit; * @constructor * @phpdoc classes/toba_ef_cuit.html toba_ef_cuit */ - function ef_cuit(id_form, etiqueta, obligatorio, colapsado, desactivar_validacion) { + function ef_cuit(id_form, etiqueta, obligatorio, colapsado, desactivar_validacion, tipos_validos) { ef.prototype.constructor.call(this, id_form, etiqueta, obligatorio, colapsado); this._desactivar_validacion = desactivar_validacion; + this._tipos_validos = tipos_validos; } ef_cuit.prototype.input = function(posicion) { @@ -31,7 +32,7 @@ ef_cuit.prototype.constructor = ef_cuit; this._error = ' tiene que ser numérico.'; return false; } - if (valor !== '' && ! this._desactivar_validacion && ! es_cuit(valor)) { + if (valor !== '' && ! this._desactivar_validacion && ! es_cuit(valor, this._tipos_validos)) { this._error = ' no es una clave válida.'; return false; } @@ -115,12 +116,12 @@ ef_cuit.prototype.constructor = ef_cuit; }; //-------------------------------------------- -function es_cuit(nro) { +function es_cuit(nro, prefijos) { if (typeof ef_cuit_excepciones != 'undefined') { if (in_array(nro, ef_cuit_excepciones)) { return true; } - } + } var suma; var resto; var verif; @@ -129,6 +130,15 @@ function es_cuit(nro) { return false; } + //Chequea prefijos + if (typeof prefijos != 'undefined') { + var pref_actual = pos[0]+pos[1]; + console.log(pref_actual); + if (! in_array(pref_actual, prefijos)) { + return false; + } + } + while (true) { suma = (pos[0] * 5 + pos[1] * 4 + pos[2] * 3 + pos[3] * 2 + pos[4] * 7 + pos[5] * 6 + pos[6] * 5 + pos[7] * 4 + pos[8] * 3 + pos[9] * 2); resto = suma % 11;