summaryrefslogtreecommitdiff
path: root/generator/before-bake/config
diff options
context:
space:
mode:
Diffstat (limited to 'generator/before-bake/config')
-rw-r--r--generator/before-bake/config/app.php321
-rw-r--r--generator/before-bake/config/bake_extra.php162
-rw-r--r--generator/before-bake/config/bootstrap_cli.php70
3 files changed, 553 insertions, 0 deletions
diff --git a/generator/before-bake/config/app.php b/generator/before-bake/config/app.php
new file mode 100644
index 0000000..f8d0e1d
--- /dev/null
+++ b/generator/before-bake/config/app.php
@@ -0,0 +1,321 @@
+<?php
+/**
+ * Copyright 2016 Ludovic Pouzenc <ludovic@pouzenc.fr>
+ * Copyright 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+ *
+ * This file is part of CHD Gestion.
+ *
+ * CHD Gestion is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CHD Gestion is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CHD Gestion. If not, see <http://www.gnu.org/licenses/>.
+**/
+return [
+ /**
+ * Debug Level:
+ *
+ * Production Mode:
+ * false: No error messages, errors, or warnings shown.
+ *
+ * Development Mode:
+ * true: Errors and warnings shown.
+ */
+ 'debug' => false,
+
+ /**
+ * Configure basic information about the application.
+ *
+ * - namespace - The namespace to find app classes under.
+ * - encoding - The encoding used for HTML + database connections.
+ * - base - The base directory the app resides in. If false this
+ * will be auto detected.
+ * - dir - Name of app directory.
+ * - webroot - The webroot directory.
+ * - wwwRoot - The file path to webroot.
+ * - baseUrl - To configure CakePHP to *not* use mod_rewrite and to
+ * use CakePHP pretty URLs, remove these .htaccess
+ * files:
+ * /.htaccess
+ * /webroot/.htaccess
+ * And uncomment the baseUrl key below.
+ * - fullBaseUrl - A base URL to use for absolute links.
+ * - imageBaseUrl - Web path to the public images directory under webroot.
+ * - cssBaseUrl - Web path to the public css directory under webroot.
+ * - jsBaseUrl - Web path to the public js directory under webroot.
+ * - paths - Configure paths for non class based resources. Supports the
+ * `plugins`, `templates`, `locales` subkeys, which allow the definition of
+ * paths for plugins, view templates and locale files respectively.
+ */
+ 'App' => [
+ 'namespace' => 'App',
+ 'encoding' => 'UTF-8',
+ 'base' => false,
+ 'dir' => 'src',
+ 'webroot' => 'webroot',
+ 'wwwRoot' => WWW_ROOT,
+ // 'baseUrl' => env('SCRIPT_NAME'),
+ 'fullBaseUrl' => false,
+ 'imageBaseUrl' => 'img/',
+ 'cssBaseUrl' => 'css/',
+ 'jsBaseUrl' => 'js/',
+ 'paths' => [
+ 'plugins' => [ROOT . DS . 'plugins' . DS],
+ 'templates' => [APP . 'Template' . DS],
+ 'locales' => [APP . 'Locale' . DS],
+ ],
+ ],
+
+ /**
+ * Security and encryption configuration
+ *
+ * - salt - A random string used in security hashing methods.
+ * The salt value is also used as the encryption key.
+ * You should treat it as extremely sensitive data.
+ */
+ 'Security' => [
+ 'salt' => 'eb74ed8697b7bc31587f48bec13cdcc0460debf26cec73137e4c6d390a93de4d',
+ ],
+
+ /**
+ * Apply timestamps with the last modified time to static assets (js, css, images).
+ * Will append a querystring parameter containing the time the file was modified.
+ * This is useful for busting browser caches.
+ *
+ * Set to true to apply timestamps when debug is true. Set to 'force' to always
+ * enable timestamping regardless of debug value.
+ */
+ 'Asset' => [
+ // 'timestamp' => true,
+ ],
+
+ /**
+ * Configure the cache adapters.
+ */
+ 'Cache' => [
+ 'default' => [
+ 'className' => 'File',
+ 'path' => CACHE,
+ ],
+
+ /**
+ * Configure the cache used for general framework caching.
+ * Translation cache files are stored with this configuration.
+ */
+ '_cake_core_' => [
+ 'className' => 'File',
+ 'prefix' => 'myapp_cake_core_',
+ 'path' => CACHE . 'persistent/',
+ 'serialize' => true,
+ 'duration' => '+2 minutes',
+ ],
+
+ /**
+ * Configure the cache for model and datasource caches. This cache
+ * configuration is used to store schema descriptions, and table listings
+ * in connections.
+ */
+ '_cake_model_' => [
+ 'className' => 'File',
+ 'prefix' => 'myapp_cake_model_',
+ 'path' => CACHE . 'models/',
+ 'serialize' => true,
+ 'duration' => '+2 minutes',
+ ],
+ ],
+
+ /**
+ * Configure the Error and Exception handlers used by your application.
+ *
+ * By default errors are displayed using Debugger, when debug is true and logged
+ * by Cake\Log\Log when debug is false.
+ *
+ * In CLI environments exceptions will be printed to stderr with a backtrace.
+ * In web environments an HTML page will be displayed for the exception.
+ * With debug true, framework errors like Missing Controller will be displayed.
+ * When debug is false, framework errors will be coerced into generic HTTP errors.
+ *
+ * Options:
+ *
+ * - `errorLevel` - int - The level of errors you are interested in capturing.
+ * - `trace` - boolean - Whether or not backtraces should be included in
+ * logged errors/exceptions.
+ * - `log` - boolean - Whether or not you want exceptions logged.
+ * - `exceptionRenderer` - string - The class responsible for rendering
+ * uncaught exceptions. If you choose a custom class you should place
+ * the file for that class in src/Error. This class needs to implement a
+ * render method.
+ * - `skipLog` - array - List of exceptions to skip for logging. Exceptions that
+ * extend one of the listed exceptions will also be skipped for logging.
+ * E.g.:
+ * `'skipLog' => ['Cake\Network\Exception\NotFoundException', 'Cake\Network\Exception\UnauthorizedException']`
+ */
+ 'Error' => [
+ 'errorLevel' => E_ALL & ~E_DEPRECATED,
+ 'exceptionRenderer' => 'Cake\Error\ExceptionRenderer',
+ 'skipLog' => [],
+ 'log' => true,
+ 'trace' => true,
+ ],
+
+ /**
+ * Email configuration.
+ *
+ * By defining transports separately from delivery profiles you can easily
+ * re-use transport configuration across multiple profiles.
+ *
+ * You can specify multiple configurations for production, development and
+ * testing.
+ *
+ * Each transport needs a `className`. Valid options are as follows:
+ *
+ * Mail - Send using PHP mail function
+ * Smtp - Send using SMTP
+ * Debug - Do not send the email, just return the result
+ *
+ * You can add custom transports (or override existing transports) by adding the
+ * appropriate file to src/Mailer/Transport. Transports should be named
+ * 'YourTransport.php', where 'Your' is the name of the transport.
+ */
+ 'EmailTransport' => [
+ 'default' => [
+ 'className' => 'Mail',
+ // The following keys are used in SMTP transports
+ 'host' => 'localhost',
+ 'port' => 25,
+ 'timeout' => 30,
+ 'username' => 'user',
+ 'password' => 'secret',
+ 'client' => null,
+ 'tls' => null,
+ ],
+ ],
+
+ /**
+ * Email delivery profiles
+ *
+ * Delivery profiles allow you to predefine various properties about email
+ * messages from your application and give the settings a name. This saves
+ * duplication across your application and makes maintenance and development
+ * easier. Each profile accepts a number of keys. See `Cake\Network\Email\Email`
+ * for more information.
+ */
+ 'Email' => [
+ 'default' => [
+ 'transport' => 'default',
+ 'from' => 'you@localhost',
+ //'charset' => 'utf-8',
+ //'headerCharset' => 'utf-8',
+ ],
+ ],
+
+ /**
+ * Connection information used by the ORM to connect
+ * to your application's datastores.
+ * Drivers include Mysql Postgres Sqlite Sqlserver
+ * See vendor\cakephp\cakephp\src\Database\Driver for complete list
+ */
+ 'Datasources' => [
+ 'default' => [
+ 'className' => 'Cake\Database\Connection',
+ 'driver' => 'Cake\Database\Driver\Mysql',
+ 'persistent' => false,
+ 'host' => 'localhost',
+ 'username' => 'gestion',
+ 'password' => 'cha6fus0EiPh',
+ 'database' => 'gestion',
+ 'encoding' => 'utf8',
+ 'timezone' => 'UTC',
+ 'cacheMetadata' => true,
+ 'log' => false,
+ 'quoteIdentifiers' => false,
+ //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
+ ],
+
+ /**
+ * The test connection is used during the test suite.
+ */
+ 'test' => [
+ 'className' => 'Cake\Database\Connection',
+ 'driver' => 'Cake\Database\Driver\Mysql',
+ 'persistent' => false,
+ 'host' => 'localhost',
+ 'username' => 'gestion_test',
+ 'password' => 'cha6fus0EiPh',
+ 'database' => 'gestion_test',
+ 'encoding' => 'utf8',
+ 'timezone' => 'UTC',
+ 'cacheMetadata' => true,
+ 'log' => false,
+ 'quoteIdentifiers' => false,
+ //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
+ ],
+ ],
+
+ /**
+ * Configures logging options
+ */
+ 'Log' => [
+ 'debug' => [
+ 'className' => 'Cake\Log\Engine\FileLog',
+ 'path' => LOGS,
+ 'file' => 'debug',
+ 'levels' => ['notice', 'info', 'debug'],
+ ],
+ 'error' => [
+ 'className' => 'Cake\Log\Engine\FileLog',
+ 'path' => LOGS,
+ 'file' => 'error',
+ 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
+ ],
+ ],
+
+ /**
+ * Session configuration.
+ *
+ * Contains an array of settings to use for session configuration. The
+ * `defaults` key is used to define a default preset to use for sessions, any
+ * settings declared here will override the settings of the default config.
+ *
+ * ## Options
+ *
+ * - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'.
+ * - `cookiePath` - The url path for which session cookie is set. Maps to the
+ * `session.cookie_path` php.ini config. Defaults to base path of app.
+ * - `timeout` - The time in minutes the session should be valid for.
+ * Pass 0 to disable checking timeout.
+ * Please note that php.ini's session.gc_maxlifetime must be equal to or greater
+ * than the largest Session['timeout'] in all served websites for it to have the
+ * desired effect.
+ * - `defaults` - The default configuration set to use as a basis for your session.
+ * There are four built-in options: php, cake, cache, database.
+ * - `handler` - Can be used to enable a custom session handler. Expects an
+ * array with at least the `engine` key, being the name of the Session engine
+ * class to use for managing the session. CakePHP bundles the `CacheSession`
+ * and `DatabaseSession` engines.
+ * - `ini` - An associative array of additional ini values to set.
+ *
+ * The built-in `defaults` options are:
+ *
+ * - 'php' - Uses settings defined in your php.ini.
+ * - 'cake' - Saves session files in CakePHP's /tmp directory.
+ * - 'database' - Uses CakePHP's database sessions.
+ * - 'cache' - Use the Cache class to save sessions.
+ *
+ * To define a custom session handler, save it at src/Network/Session/<name>.php.
+ * Make sure the class implements PHP's `SessionHandlerInterface` and set
+ * Session.handler to <name>
+ *
+ * To use database sessions, load the SQL file located at config/Schema/sessions.sql
+ */
+ 'Session' => [
+ 'defaults' => 'php',
+ ],
+];
diff --git a/generator/before-bake/config/bake_extra.php b/generator/before-bake/config/bake_extra.php
new file mode 100644
index 0000000..3ff3352
--- /dev/null
+++ b/generator/before-bake/config/bake_extra.php
@@ -0,0 +1,162 @@
+<?php
+/**
+ * Copyright 2016 Ludovic Pouzenc <ludovic@pouzenc.fr>
+ * Copyright 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+ *
+ * This file is part of CHD Gestion.
+ *
+ * CHD Gestion is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CHD Gestion is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CHD Gestion. If not, see <http://www.gnu.org/licenses/>.
+**/
+return [
+ 'default' => [ 'actions' => [ 'index', 'view', 'add', 'edit'] ],
+ 'AdherentRoles' => [ 'actions' => [ 'index', 'add', 'delete' ] ],
+ 'AdherentRoleTypes' => [ 'actions' => [ '_empty' ] ],
+ 'AdherentStatuts' => [ 'actions' => [ '_empty' ] ],
+ 'AdherentTypes' => [ 'actions' => [ '_empty' ] ],
+ 'Civilites' => [ 'actions' => [ '_empty' ] ],
+ 'Periodicites' => [ 'actions' => [ '_empty' ] ],
+ 'Secteurs' => [ 'actions' => [ '_empty' ] ],
+ 'ServiceStatuts' => [ 'actions' => [ '_empty' ] ],
+ 'ServiceTypes' => [ 'actions' => [ '_empty' ] ],
+ 'EquipementModes' => [ 'actions' => [ '_empty' ] ],
+ 'EquipementModeles' => [
+ 'title' => [
+ 'glue' => ' ',
+ 'pieces' => ['constructeur', 'modele'],
+ ],
+ ],
+ 'Adherents' => [
+ 'title' => [
+ 'custom_code' => <<<'EOT'
+"CHD" . $this->_properties['id'] . " - " . ( $this->_properties['raison']?($this->_properties['raison'] . " (" . $this->_properties['nom'] . ")" ):($this->_properties['nom'] . " " . $this->_properties['prenom']) )
+EOT
+ ],
+ 'filters' => [
+ 'q' => [
+ 'mode' => 'like',
+ 'before' => 'true',
+ 'after' => 'true',
+ 'columns' => ['id','nom','nom2','prenom','prenom2','raison','proprio','tel_mobile1','tel_mobile2'],
+ 'colspan' => 5,
+ 'hint' => 'Rechercher...',
+ ],
+ 'ville_id' => [
+ 'mode' => 'value',
+ 'before' => 'false',
+ 'after' => 'false',
+ 'model' => 'Villes',
+ 'colspan' => 2,
+ 'hint' => 'Villes',
+ ],
+ ],
+ ],
+ 'Equipements' => [
+ 'title' => [
+ 'glue' => ' ',
+ 'pieces' => ['mac'],
+ ],
+ 'filters' => [
+ 'q' => [
+ 'mode' => 'like',
+ 'before' => 'true',
+ 'after' => 'true',
+ //'columns' => ['id', 'ipmgmt.ip4','ipmgmt.ip6', 'mac'],
+ 'columns' => ['mac'],
+ 'colspan' => 3,
+ 'hint' => 'Adresse MAC...',
+ ],
+ 'equipement_modele_id' => [
+ 'mode' => 'value',
+ 'before' => 'false',
+ 'after' => 'false',
+ 'model' => 'EquipementModeles',
+ 'colspan' => 2,
+ 'hint' => 'Equipement Modeles',
+ ],
+ 'relais_id' => [
+ 'mode' => 'value',
+ 'before' => 'false',
+ 'after' => 'false',
+ 'model' => 'Relais',
+ 'colspan' => 2,
+ 'hint' => 'Relais',
+ ],
+ ],
+ ],
+ 'Services' => [
+ 'title' => [
+ 'glue' => '-',
+ 'prefix' => 'SER',
+ 'pieces' => ['service_type_id', 'adherent_id', 'id'],
+ ],
+ 'filters' => [
+ 'service_type_id' => [
+ 'mode' => 'value',
+ 'before' => 'false',
+ 'after' => 'false',
+ 'model' => 'ServiceTypes',
+ 'colspan' => 3,
+ 'hint' => 'Service Type',
+ ],
+ 'service_statut_id' => [
+ 'mode' => 'value',
+ 'before' => 'false',
+ 'after' => 'false',
+ 'model' => 'ServiceStatuts',
+ 'colspan' => 2,
+ 'hint' => 'Service Statut',
+ ],
+ 'relais_id' => [
+ 'mode' => 'value',
+ 'before' => 'false',
+ 'after' => 'false',
+ 'model' => 'Relais',
+ 'colspan' => 2,
+ 'hint' => 'Relais',
+ ],
+ ],
+ ],
+ 'Ipmgmt' => [
+ 'actions' => [ 'index', 'view' ],
+ 'title' => [
+ 'glue' => ' ',
+ 'pieces' => ['ip4', 'ip6'],
+ ],
+ ],
+ 'Ippubliques' => [
+ 'actions' => [ 'index', 'view' ],
+ 'title' => [
+ 'glue' => ' ',
+ 'pieces' => ['ip4', 'ip6'],
+ ],
+ 'filters' => [
+ 'q' => [
+ 'mode' => 'like',
+ 'before' => 'true',
+ 'after' => 'false',
+ 'columns' => ['ip4','ip6'],
+ 'colspan' => 2,
+ 'hint' => 'Rechercher...',
+ ],
+ 'secteur_id' => [
+ 'mode' => 'value',
+ 'before' => 'false',
+ 'after' => 'false',
+ 'model' => 'Secteurs',
+ 'colspan' => 1,
+ 'hint' => 'Secteurs',
+ ],
+ ],
+ ],
+];
diff --git a/generator/before-bake/config/bootstrap_cli.php b/generator/before-bake/config/bootstrap_cli.php
new file mode 100644
index 0000000..b27c7e5
--- /dev/null
+++ b/generator/before-bake/config/bootstrap_cli.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Copyright 2016 Ludovic Pouzenc <ludovic@pouzenc.fr>
+ * Copyright 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+ *
+ * This file is part of CHD Gestion.
+ *
+ * CHD Gestion is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CHD Gestion is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CHD Gestion. If not, see <http://www.gnu.org/licenses/>.
+**/
+/**
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @since 3.0.0
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+use Cake\Core\Configure;
+use Cake\Core\Exception\MissingPluginException;
+use Cake\Core\Plugin;
+use Cake\Event\Event;
+use Cake\Event\EventManager;
+use Cake\Utility\Hash;
+
+/**
+ * Additional bootstrapping and configuration for CLI environments should
+ * be put here.
+ */
+
+// Set logs to different files so they don't have permission conflicts.
+Configure::write('Log.debug.file', 'cli-debug');
+Configure::write('Log.error.file', 'cli-error');
+
+try {
+ Plugin::load('Bake');
+} catch (MissingPluginException $e) {
+ // Do not halt if the plugin is missing
+}
+
+EventManager::instance()->on('Bake.initialize', function (Event $event) {
+ // Initialize BakeExtraHelper with bake_extra.php config array
+ $view = $event->subject;
+ $extra = include(ROOT . DS . 'config' . DS . 'bake_extra.php');
+ $view->loadHelper('CustomTheme.BakeExtra', $extra);
+});
+
+EventManager::instance()->on('Bake.beforeRender', function (Event $event) {
+ $view = $event->subject;
+ $isController = strpos($event->data[0], 'Bake/Controller/controller.ctp') !== false;
+ if ($isController) {
+ // Override controller's default action list with the configured one in bake_extra.php
+ $view->set('actions', $view->BakeExtra->getActions($view->get('name')));
+ }
+});