summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2018-07-16 13:24:18 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2018-07-16 13:26:14 +0200
commit31a40cfc446c9586f89a4aa69ef76d76d469e5a4 (patch)
treea68141ff714b1e91027d551d38fabc792bd498e7
parentc9939556d486da50f180ce424dd456252b1e0349 (diff)
downloadchd_gestion-31a40cfc446c9586f89a4aa69ef76d76d469e5a4.zip
chd_gestion-31a40cfc446c9586f89a4aa69ef76d76d469e5a4.tar.gz
chd_gestion-31a40cfc446c9586f89a4aa69ef76d76d469e5a4.tar.bz2
Bake : setup and create empty CustomTheme
-rw-r--r--app-from-scratch.sh19
-rw-r--r--fai_gestion/composer.json8
-rw-r--r--fai_gestion/composer.lock2
-rw-r--r--fai_gestion/config/bootstrap_cli.php2
-rw-r--r--fai_gestion/plugins/CustomTheme/.gitignore3
-rw-r--r--fai_gestion/plugins/CustomTheme/README.md11
-rw-r--r--fai_gestion/plugins/CustomTheme/composer.json23
-rw-r--r--fai_gestion/plugins/CustomTheme/config/routes.php12
-rw-r--r--fai_gestion/plugins/CustomTheme/phpunit.xml.dist36
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Controller/AppController.php10
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Plugin.php12
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Template/Bake/Controller/controller.twig57
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/add.twig46
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/edit.twig49
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/index.twig33
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/form.twig80
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/entity.twig61
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/table.twig138
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig90
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/view.twig137
-rw-r--r--fai_gestion/plugins/CustomTheme/tests/bootstrap.php30
-rw-r--r--fai_gestion/plugins/CustomTheme/webroot/empty (renamed from fai_gestion/plugins/empty)0
22 files changed, 855 insertions, 4 deletions
diff --git a/app-from-scratch.sh b/app-from-scratch.sh
index 9d6ed70..9fcdf90 100644
--- a/app-from-scratch.sh
+++ b/app-from-scratch.sh
@@ -208,3 +208,22 @@ cat ~/chd_gestion/schema/enum-tables-data-mysql.sql | sudo mariadb fai_gestion
# - ALTER TABLE equipements CHANGE ipmgmt_id ip_management VARCHAR(39) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
# - import PROCEDURE refresh_network_elt(IN root INT)
# - TODO : work on fai_gestion_exports permissions
+# - TODO : dump everything cleanly then git
+
+# bake initial setup
+cd ~/chd_gestion/fai_gestion/
+composer.phar require --dev cakephp/bake:~1.0
+yes | cake bake plugin CustomTheme
+v=vendor/cakephp/bake/src/Template/Bake
+p=plugins/CustomTheme/src/Template/Bake
+mkdir -p $p/{Controller,Element/Controller,Model,Template}
+cp -a $v/Controller/controller.twig $p/Controller/
+cp -a $v/Element/form.twig $p/Element/
+cp -a $v/Element/Controller/{add,edit,index}.twig $p/Element/Controller
+cp -a $v/Model/{entity,table}.twig $p/Model/
+cp -a $v/Template/{index,view}.twig $p/Template/
+editor config/bootstrap.php config/bootstrap_cli.php
+# load the plugin only in cli mode
+git checkout -- config/bootstrap.php
+git add ../app-from-scratch.sh composer.json composer.lock config/bootstrap_cli.php plugins/
+git commit -m "Bake : setup and create empty CustomTheme"
diff --git a/fai_gestion/composer.json b/fai_gestion/composer.json
index 7787c9a..d370f55 100644
--- a/fai_gestion/composer.json
+++ b/fai_gestion/composer.json
@@ -13,7 +13,7 @@
"mobiledetect/mobiledetectlib": "2.*"
},
"require-dev": {
- "cakephp/bake": "^1.1",
+ "cakephp/bake": "~1.0",
"cakephp/cakephp-codesniffer": "^3.0",
"cakephp/debug_kit": "^3.15.0",
"psy/psysh": "@stable"
@@ -25,13 +25,15 @@
},
"autoload": {
"psr-4": {
- "App\\": "src/"
+ "App\\": "src/",
+ "CustomTheme\\": "./plugins/CustomTheme/src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests/",
- "Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
+ "Cake\\Test\\": "vendor/cakephp/cakephp/tests/",
+ "CustomTheme\\Test\\": "./plugins/CustomTheme/tests/"
}
},
"scripts": {
diff --git a/fai_gestion/composer.lock b/fai_gestion/composer.lock
index 21c6029..b1a1098 100644
--- a/fai_gestion/composer.lock
+++ b/fai_gestion/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "226c85de8ca341def4f0f5329bb17fb3",
+ "content-hash": "bdfe56ce06a95062ff683ed4dad28676",
"packages": [
{
"name": "aura/intl",
diff --git a/fai_gestion/config/bootstrap_cli.php b/fai_gestion/config/bootstrap_cli.php
index 287683a..43b569a 100644
--- a/fai_gestion/config/bootstrap_cli.php
+++ b/fai_gestion/config/bootstrap_cli.php
@@ -28,3 +28,5 @@ use Cake\Core\Plugin;
// 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');
+
+Plugin::load('CustomTheme', ['bootstrap' => false, 'routes' => true]);
diff --git a/fai_gestion/plugins/CustomTheme/.gitignore b/fai_gestion/plugins/CustomTheme/.gitignore
new file mode 100644
index 0000000..bc959c5
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/.gitignore
@@ -0,0 +1,3 @@
+/composer.lock
+/phpunit.xml
+/vendor
diff --git a/fai_gestion/plugins/CustomTheme/README.md b/fai_gestion/plugins/CustomTheme/README.md
new file mode 100644
index 0000000..4ccb8e2
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/README.md
@@ -0,0 +1,11 @@
+# CustomTheme plugin for CakePHP
+
+## Installation
+
+You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).
+
+The recommended way to install composer packages is:
+
+```
+composer require your-name-here/CustomTheme
+```
diff --git a/fai_gestion/plugins/CustomTheme/composer.json b/fai_gestion/plugins/CustomTheme/composer.json
new file mode 100644
index 0000000..ddbb4a3
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/composer.json
@@ -0,0 +1,23 @@
+{
+ "name": "your-name-here/CustomTheme",
+ "description": "CustomTheme plugin for CakePHP",
+ "type": "cakephp-plugin",
+ "license": "MIT",
+ "require": {
+ "cakephp/cakephp": "^3.5"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5.7.14|^6.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "CustomTheme\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "CustomTheme\\Test\\": "tests/",
+ "Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
+ }
+ }
+}
diff --git a/fai_gestion/plugins/CustomTheme/config/routes.php b/fai_gestion/plugins/CustomTheme/config/routes.php
new file mode 100644
index 0000000..62cbd6c
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/config/routes.php
@@ -0,0 +1,12 @@
+<?php
+use Cake\Routing\RouteBuilder;
+use Cake\Routing\Router;
+use Cake\Routing\Route\DashedRoute;
+
+Router::plugin(
+ 'CustomTheme',
+ ['path' => '/custom-theme'],
+ function (RouteBuilder $routes) {
+ $routes->fallbacks(DashedRoute::class);
+ }
+);
diff --git a/fai_gestion/plugins/CustomTheme/phpunit.xml.dist b/fai_gestion/plugins/CustomTheme/phpunit.xml.dist
new file mode 100644
index 0000000..399f43d
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/phpunit.xml.dist
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit
+ colors="true"
+ processIsolation="false"
+ stopOnFailure="false"
+ syntaxCheck="false"
+ bootstrap="tests/bootstrap.php"
+ >
+ <php>
+ <ini name="memory_limit" value="-1"/>
+ <ini name="apc.enable_cli" value="1"/>
+ </php>
+
+ <!-- Add any additional test suites you want to run here -->
+ <testsuites>
+ <testsuite name="CustomTheme">
+ <directory>tests/TestCase/</directory>
+ </testsuite>
+ </testsuites>
+
+ <!-- Setup a listener for fixtures -->
+ <listeners>
+ <listener class="\Cake\TestSuite\Fixture\FixtureInjector">
+ <arguments>
+ <object class="\Cake\TestSuite\Fixture\FixtureManager"/>
+ </arguments>
+ </listener>
+ </listeners>
+
+ <filter>
+ <whitelist>
+ <directory suffix=".php">src/</directory>
+ </whitelist>
+ </filter>
+
+</phpunit>
diff --git a/fai_gestion/plugins/CustomTheme/src/Controller/AppController.php b/fai_gestion/plugins/CustomTheme/src/Controller/AppController.php
new file mode 100644
index 0000000..80729f4
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/src/Controller/AppController.php
@@ -0,0 +1,10 @@
+<?php
+
+namespace CustomTheme\Controller;
+
+use App\Controller\AppController as BaseController;
+
+class AppController extends BaseController
+{
+
+}
diff --git a/fai_gestion/plugins/CustomTheme/src/Plugin.php b/fai_gestion/plugins/CustomTheme/src/Plugin.php
new file mode 100644
index 0000000..21f198e
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/src/Plugin.php
@@ -0,0 +1,12 @@
+<?php
+
+namespace CustomTheme;
+
+use Cake\Core\BasePlugin;
+
+/**
+ * Plugin for CustomTheme
+ */
+class Plugin extends BasePlugin
+{
+}
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Controller/controller.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Controller/controller.twig
new file mode 100644
index 0000000..9558878
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Controller/controller.twig
@@ -0,0 +1,57 @@
+{#
+/**
+ * Controller bake template file
+ *
+ * Allows templating of Controllers generated from bake.
+ *
+ * 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 2.0.0
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+#}
+<?php
+namespace {{ namespace }}\Controller{{ prefix }};
+
+use {{ namespace }}\Controller\AppController;
+
+/**
+ * {{ name }} Controller
+ *
+{% if defaultModel %}
+ * @property \{{ defaultModel }} ${{ name }}
+{% endif %}
+
+{%- for component in components %}
+{% set classInfo = Bake.classInfo(component, 'Controller/Component', 'Component') %}
+ * @property {{ classInfo.fqn }} ${{ classInfo.name }}
+{% endfor %}
+
+{%- if 'index' in actions %}
+ *
+ * @method \{{ namespace }}\Model\Entity\{{ entityClassName }}[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
+{% endif %}
+ */
+class {{ name }}Controller extends AppController
+{
+{% set helpers = Bake.arrayProperty('helpers', helpers, {'indent': false})|raw %}
+{% if helpers|trim %}
+ {{- helpers|raw }}
+{% endif %}
+
+{%- set components = Bake.arrayProperty('components', components, {'indent': false})|raw %}
+{% if components|trim %}
+ {{- components|raw }}
+{% endif %}
+
+{%- for action in actions %}
+ {%- element 'Controller/' ~ action %}
+{% endfor %}
+}
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/add.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/add.twig
new file mode 100644
index 0000000..1c67f5e
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/add.twig
@@ -0,0 +1,46 @@
+{#
+/**
+ * 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 2.0.0
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+#}
+{% set compact = ["'#{singularName}'"] %}
+
+ /**
+ * Add method
+ *
+ * @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
+ */
+ public function add()
+ {
+ ${{ singularName }} = $this->{{ currentModelName }}->newEntity();
+ if ($this->request->is('post')) {
+ ${{ singularName }} = $this->{{ currentModelName }}->patchEntity(${{ singularName }}, $this->request->getData());
+ if ($this->{{ currentModelName }}->save(${{ singularName }})) {
+ $this->Flash->success(__('The {{ singularHumanName|lower }} has been saved.'));
+
+ return $this->redirect(['action' => 'index']);
+ }
+ $this->Flash->error(__('The {{ singularHumanName|lower }} could not be saved. Please, try again.'));
+ }
+{% set associations = Bake.aliasExtractor(modelObj, 'BelongsTo') %}
+{% set associations = associations|merge(Bake.aliasExtractor(modelObj, 'BelongsToMany')) %}
+
+{%- for assoc in associations %}
+ {%- set otherName = Bake.getAssociatedTableAlias(modelObj, assoc) %}
+ {%- set otherPlural = otherName|variable %}
+ ${{ otherPlural }} = $this->{{ currentModelName }}->{{ otherName }}->find('list', ['limit' => 200]);
+ {{- "\n" }}
+ {%- set compact = compact|merge(["'#{otherPlural}'"]) %}
+{% endfor %}
+ $this->set(compact({{ compact|join(', ')|raw }}));
+ }
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/edit.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/edit.twig
new file mode 100644
index 0000000..d06cb9c
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/edit.twig
@@ -0,0 +1,49 @@
+{#
+/**
+ * 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 2.0.0
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+#}
+{% set belongsTo = Bake.aliasExtractor(modelObj, 'BelongsTo') %}
+{% set belongsToMany = Bake.aliasExtractor(modelObj, 'belongsToMany') %}
+{% set compact = ["'#{singularName}'"] %}
+
+ /**
+ * Edit method
+ *
+ * @param string|null $id {{ singularHumanName }} id.
+ * @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
+ * @throws \Cake\Network\Exception\NotFoundException When record not found.
+ */
+ public function edit($id = null)
+ {
+ ${{ singularName }} = $this->{{ currentModelName }}->get($id, [
+ 'contain' => [{{ Bake.stringifyList(belongsToMany, {'indent': false})|raw }}]
+ ]);
+ if ($this->request->is(['patch', 'post', 'put'])) {
+ ${{ singularName }} = $this->{{ currentModelName }}->patchEntity(${{ singularName }}, $this->request->getData());
+ if ($this->{{ currentModelName }}->save(${{ singularName }})) {
+ $this->Flash->success(__('The {{ singularHumanName|lower }} has been saved.'));
+
+ return $this->redirect(['action' => 'index']);
+ }
+ $this->Flash->error(__('The {{ singularHumanName|lower }} could not be saved. Please, try again.'));
+ }
+{% for assoc in belongsTo|merge(belongsToMany) %}
+ {%- set otherName = Bake.getAssociatedTableAlias(modelObj, assoc) %}
+ {%- set otherPlural = otherName|variable %}
+ ${{ otherPlural }} = $this->{{ currentModelName }}->{{ otherName }}->find('list', ['limit' => 200]);
+ {{- "\n" }}
+ {%- set compact = compact|merge(["'#{otherPlural}'"]) %}
+{% endfor %}
+ $this->set(compact({{ compact|join(', ')|raw }}));
+ }
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/index.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/index.twig
new file mode 100644
index 0000000..181e830
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/Controller/index.twig
@@ -0,0 +1,33 @@
+{#
+/**
+ * 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 2.0.0
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+#}
+
+ /**
+ * Index method
+ *
+ * @return \Cake\Http\Response|void
+ */
+ public function index()
+ {
+{% set belongsTo = Bake.aliasExtractor(modelObj, 'BelongsTo') %}
+{% if belongsTo %}
+ $this->paginate = [
+ 'contain' => [{{ Bake.stringifyList(belongsTo, {'indent': false})|raw }}]
+ ];
+{% endif %}
+ ${{ pluralName }} = $this->paginate($this->{{ currentModelName }});
+
+ $this->set(compact('{{ pluralName }}'));
+ }
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/form.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/form.twig
new file mode 100644
index 0000000..b2d9e50
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Element/form.twig
@@ -0,0 +1,80 @@
+{#
+/**
+ * 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 2.0.0
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+#}
+{% set fields = Bake.filterFields(fields, schema, modelObject) %}
+<nav class="large-3 medium-4 columns" id="actions-sidebar">
+ <ul class="side-nav">
+ <li class="heading"><?= __('Actions') ?></li>
+{% if strpos(action, 'add') is same as(false) %}
+ <li><?= $this->Form->postLink(
+ __('Delete'),
+ ['action' => 'delete', ${{ singularVar }}->{{ primaryKey[0] }}],
+ ['confirm' => __('Are you sure you want to delete # {0}?', ${{ singularVar }}->{{ primaryKey[0] }})]
+ )
+ ?></li>
+{% endif %}
+ <li><?= $this->Html->link(__('List {{ pluralHumanName }}'), ['action' => 'index']) ?></li>
+ {{- "\n" }}
+{%- set done = [] %}
+{% for type, data in associations %}
+ {%- for alias, details in data %}
+ {%- if details.controller is not same as(_view.name) and details.controller not in done %}
+ <li><?= $this->Html->link(__('List {{ alias|underscore|humanize }}'), ['controller' => '{{ details.controller }}', 'action' => 'index']) ?></li>
+ <li><?= $this->Html->link(__('New {{ alias|singularize|underscore|humanize }}'), ['controller' => '{{ details.controller }}', 'action' => 'add']) ?></li>
+ {{- "\n" }}
+ {%- set done = done|merge([details.controller]) %}
+ {%- endif %}
+ {%- endfor %}
+{% endfor %}
+ </ul>
+</nav>
+<div class="{{ pluralVar }} form large-9 medium-8 columns content">
+ <?= $this->Form->create(${{ singularVar }}) ?>
+ <fieldset>
+ <legend><?= __('{{ action|humanize }} {{ singularHumanName }}') ?></legend>
+ <?php
+{% for field in fields if field not in primaryKey %}
+ {%- if keyFields[field] %}
+ {%- set fieldData = Bake.columnData(field, schema) %}
+ {%- if fieldData.null %}
+ echo $this->Form->control('{{ field }}', ['options' => ${{ keyFields[field] }}, 'empty' => true]);
+ {{- "\n" }}
+ {%- else %}
+ echo $this->Form->control('{{ field }}', ['options' => ${{ keyFields[field] }}]);
+ {{- "\n" }}
+ {%- endif %}
+ {%- elseif field not in ['created', 'modified', 'updated'] %}
+ {%- set fieldData = Bake.columnData(field, schema) %}
+ {%- if fieldData.type in ['date', 'datetime', 'time'] and fieldData.null %}
+ echo $this->Form->control('{{ field }}', ['empty' => true]);
+ {{- "\n" }}
+ {%- else %}
+ echo $this->Form->control('{{ field }}');
+ {{- "\n" }}
+ {%- endif %}
+ {%- endif %}
+{%- endfor %}
+
+{%- if associations.BelongsToMany %}
+ {%- for assocName, assocData in associations.BelongsToMany %}
+ echo $this->Form->control('{{ assocData.property }}._ids', ['options' => ${{ assocData.variable }}]);
+ {{- "\n" }}
+ {%- endfor %}
+{% endif %}
+ ?>
+ </fieldset>
+ <?= $this->Form->button(__('Submit')) ?>
+ <?= $this->Form->end() ?>
+</div>
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/entity.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/entity.twig
new file mode 100644
index 0000000..e09794a
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/entity.twig
@@ -0,0 +1,61 @@
+{#
+/**
+ * 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 2.0.0
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+#}
+{% set propertyHintMap = DocBlock.buildEntityPropertyHintTypeMap(propertySchema ?: []) %}
+{% set associationHintMap = DocBlock.buildEntityAssociationHintTypeMap(propertySchema ?: []) %}
+{% set annotations = DocBlock.propertyHints(propertyHintMap) %}
+
+{%- if associationHintMap %}
+ {%- set annotations = annotations|merge(['']) %}
+ {%- set annotations = annotations|merge(DocBlock.propertyHints(associationHintMap)) %}
+{% endif %}
+
+{%- set accessible = Bake.getFieldAccessibility(fields, primaryKey) %}
+<?php
+namespace {{ namespace }}\Model\Entity;
+
+use Cake\ORM\Entity;
+
+{{ DocBlock.classDescription(name, 'Entity', annotations)|raw }}
+class {{ name }} extends Entity
+{
+{% if accessible %}
+
+ /**
+ * Fields that can be mass assigned using newEntity() or patchEntity().
+ *
+ * Note that when '*' is set to true, this allows all unspecified fields to
+ * be mass assigned. For security purposes, it is advised to set '*' to false
+ * (or remove it), and explicitly make individual fields accessible as needed.
+ *
+ * @var array
+ */
+ protected $_accessible = [{{ Bake.stringifyList(accessible, {'quotes': false})|raw }}];
+{% endif %}
+
+{%- if hidden %}
+
+ /**
+ * Fields that are excluded from JSON versions of the entity.
+ *
+ * @var array
+ */
+ protected $_hidden = [{{ Bake.stringifyList(hidden)|raw }}];
+{% endif %}
+
+{%- if not accessible and not hidden %}
+
+{% endif %}
+}
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/table.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/table.twig
new file mode 100644
index 0000000..94ad17c
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/table.twig
@@ -0,0 +1,138 @@
+{#
+/**
+ * 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 2.0.0
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+#}
+{% set annotations = DocBlock.buildTableAnnotations(associations, associationInfo, behaviors, entity, namespace) %}
+<?php
+namespace {{ namespace }}\Model\Table;
+
+{% set uses = ['use Cake\\ORM\\Query;', 'use Cake\\ORM\\RulesChecker;', 'use Cake\\ORM\\Table;', 'use Cake\\Validation\\Validator;'] %}
+{{ uses|join('\n')|raw }}
+
+{{ DocBlock.classDescription(name, 'Model', annotations)|raw }}
+class {{ name }}Table extends Table
+{
+
+ /**
+ * Initialize method
+ *
+ * @param array $config The configuration for the Table.
+ * @return void
+ */
+ public function initialize(array $config)
+ {
+ parent::initialize($config);
+
+{% if table %}
+ $this->setTable('{{ table }}');
+{% endif %}
+
+{%- if displayField %}
+ $this->setDisplayField('{{ displayField }}');
+{% endif %}
+
+{%- if primaryKey %}
+ {%- if primaryKey is iterable and primaryKey|length > 1 %}
+ $this->setPrimaryKey([{{ Bake.stringifyList(primaryKey, {'indent': false})|raw }}]);
+ {{- "\n" }}
+ {%- else %}
+ $this->setPrimaryKey('{{ primaryKey|as_array|first }}');
+ {{- "\n" }}
+ {%- endif %}
+{% endif %}
+
+{%- if behaviors %}
+
+{% endif %}
+
+{%- for behavior, behaviorData in behaviors %}
+ $this->addBehavior('{{ behavior }}'{{ (behaviorData ? (", [" ~ Bake.stringifyList(behaviorData, {'indent': 3, 'quotes': false})|raw ~ ']') : '')|raw }});
+{% endfor %}
+
+{%- if associations.belongsTo or associations.hasMany or associations.belongsToMany %}
+
+{% endif %}
+
+{%- for type, assocs in associations %}
+ {%- for assoc in assocs %}
+ {%- set assocData = [] %}
+ {%- for key, val in assoc if key is not same as('alias') %}
+ {%- set assocData = assocData|merge({(key): val}) %}
+ {%- endfor %}
+ $this->{{ type }}('{{ assoc.alias }}', [{{ Bake.stringifyList(assocData, {'indent': 3})|raw }}]);
+ {{- "\n" }}
+ {%- endfor %}
+{% endfor %}
+ }
+{{- "\n" }}
+
+{%- if validation %}
+
+ /**
+ * Default validation rules.
+ *
+ * @param \Cake\Validation\Validator $validator Validator instance.
+ * @return \Cake\Validation\Validator
+ */
+ public function validationDefault(Validator $validator)
+ {
+{% for field, rules in validation %}
+{% set validationMethods = Bake.getValidationMethods(field, rules) %}
+{% if validationMethods %}
+ $validator
+{% for validationMethod in validationMethods %}
+{% if loop.last %}
+{% set validationMethod = validationMethod ~ ';' %}
+{% endif %}
+ {{ validationMethod|raw }}
+{% endfor %}
+
+{% endif %}
+{% endfor %}
+ return $validator;
+ }
+{% endif %}
+
+{%- if rulesChecker %}
+
+ /**
+ * Returns a rules checker object that will be used for validating
+ * application integrity.
+ *
+ * @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
+ * @return \Cake\ORM\RulesChecker
+ */
+ public function buildRules(RulesChecker $rules)
+ {
+{% for field, rule in rulesChecker %}
+ $rules->add($rules->{{ rule.name }}(['{{ field }}']{{ (rule.extra is defined and rule.extra ? (", '#{rule.extra}'") : '')|raw }}));
+{% endfor %}
+
+ return $rules;
+ }
+{% endif %}
+
+{%- if connection is not same as('default') %}
+
+ /**
+ * Returns the database connection name to use by default.
+ *
+ * @return string
+ */
+ public static function defaultConnectionName()
+ {
+ return '{{ connection }}';
+ }
+{% endif %}
+}
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig
new file mode 100644
index 0000000..79050ef
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig
@@ -0,0 +1,90 @@
+{#
+/**
+ * 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 2.0.0
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+#}
+<?php
+/**
+ * @var \{{ namespace }}\View\AppView $this
+ * @var \{{ entityClass }}[]|\Cake\Collection\CollectionInterface ${{ pluralVar }}
+ */
+?>
+{% set fields = Bake.filterFields(fields, schema, modelObject, indexColumns, ['binary', 'text']) %}
+<nav class="large-3 medium-4 columns" id="actions-sidebar">
+ <ul class="side-nav">
+ <li class="heading"><?= __('Actions') ?></li>
+ <li><?= $this->Html->link(__('New {{ singularHumanName }}'), ['action' => 'add']) ?></li>
+{% set done = [] %}
+{% for type, data in associations %}
+{% for alias, details in data %}
+{% if details.navLink and details.controller is not same as(_view.name) and details.controller not in done %}
+ <li><?= $this->Html->link(__('List {{ alias|underscore|humanize }}'), ['controller' => '{{ details.controller }}', 'action' => 'index']) ?></li>
+ <li><?= $this->Html->link(__('New {{ alias|singularize|underscore|humanize }}'), ['controller' => '{{ details.controller }}', 'action' => 'add']) ?></li>
+{% set done = done|merge([details.controller]) %}
+{% endif %}
+{% endfor %}
+{% endfor %}
+ </ul>
+</nav>
+<div class="{{ pluralVar }} index large-9 medium-8 columns content">
+ <h3><?= __('{{ pluralHumanName }}') ?></h3>
+ <table cellpadding="0" cellspacing="0">
+ <thead>
+ <tr>
+{% for field in fields %}
+ <th scope="col"><?= $this->Paginator->sort('{{ field }}') ?></th>
+{% endfor %}
+ <th scope="col" class="actions"><?= __('Actions') ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach (${{ pluralVar }} as ${{ singularVar }}): ?>
+ <tr>
+{% for field in fields %}
+{% set isKey = false %}
+{% if associations.BelongsTo %}
+{% for alias, details in associations.BelongsTo if field == details.foreignKey %}
+{% set isKey = true %}
+ <td><?= ${{ singularVar }}->has('{{ details.property }}') ? $this->Html->link(${{ singularVar }}->{{ details.property }}->{{ details.displayField }}, ['controller' => '{{ details.controller }}', 'action' => 'view', ${{ singularVar }}->{{ details.property }}->{{ details.primaryKey[0] }}]) : '' ?></td>
+{% endfor %}
+{% endif %}
+{% if isKey is not same as(true) %}
+{% set columnData = Bake.columnData(field, schema) %}
+{% if columnData.type not in ['integer', 'float', 'decimal', 'biginteger', 'smallinteger', 'tinyinteger'] %}
+ <td><?= h(${{ singularVar }}->{{ field }}) ?></td>
+{% else %}
+ <td><?= $this->Number->format(${{ singularVar }}->{{ field }}) ?></td>
+{% endif %}
+{% endif %}
+{% endfor %}
+{% set pk = '$' ~ singularVar ~ '->' ~ primaryKey[0] %}
+ <td class="actions">
+ <?= $this->Html->link(__('View'), ['action' => 'view', {{ pk|raw }}]) ?>
+ <?= $this->Html->link(__('Edit'), ['action' => 'edit', {{ pk|raw }}]) ?>
+ <?= $this->Form->postLink(__('Delete'), ['action' => 'delete', {{ pk|raw }}], ['confirm' => __('Are you sure you want to delete # {0}?', {{ pk|raw }})]) ?>
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+ <div class="paginator">
+ <ul class="pagination">
+ <?= $this->Paginator->first('<< ' . __('first')) ?>
+ <?= $this->Paginator->prev('< ' . __('previous')) ?>
+ <?= $this->Paginator->numbers() ?>
+ <?= $this->Paginator->next(__('next') . ' >') ?>
+ <?= $this->Paginator->last(__('last') . ' >>') ?>
+ </ul>
+ <p><?= $this->Paginator->counter(['format' => __('Page {{ '{{' }}page{{ '}}' }} of {{ '{{' }}pages{{ '}}' }}, showing {{ '{{' }}current{{ '}}' }} record(s) out of {{ '{{' }}count{{ '}}' }} total')]) ?></p>
+ </div>
+</div>
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/view.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/view.twig
new file mode 100644
index 0000000..200a2f8
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/view.twig
@@ -0,0 +1,137 @@
+{#
+/**
+ * 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 2.0.0
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+#}
+<?php
+/**
+ * @var \{{ namespace }}\View\AppView $this
+ * @var \{{ entityClass }} ${{ singularVar }}
+ */
+?>
+{% set associations = {'BelongsTo': [], 'HasOne': [], 'HasMany': [], 'BelongsToMany': []}|merge(associations) %}
+{% set fieldsData = Bake.getViewFieldsData(fields, schema, associations) %}
+{% set associationFields = fieldsData.associationFields %}
+{% set groupedFields = fieldsData.groupedFields %}
+{% set pK = '$' ~ singularVar ~ '->' ~ primaryKey[0] %}
+<nav class="large-3 medium-4 columns" id="actions-sidebar">
+ <ul class="side-nav">
+ <li class="heading"><?= __('Actions') ?></li>
+ <li><?= $this->Html->link(__('Edit {{ singularHumanName }}'), ['action' => 'edit', {{ pK|raw }}]) ?> </li>
+ <li><?= $this->Form->postLink(__('Delete {{ singularHumanName }}'), ['action' => 'delete', {{ pK|raw }}], ['confirm' => __('Are you sure you want to delete # {0}?', {{ pK|raw }})]) ?> </li>
+ <li><?= $this->Html->link(__('List {{ pluralHumanName }}'), ['action' => 'index']) ?> </li>
+ <li><?= $this->Html->link(__('New {{ singularHumanName }}'), ['action' => 'add']) ?> </li>
+{% set done = [] %}
+{% for type, data in associations %}
+{% for alias, details in data %}
+{% if details.controller is not same as(_view.name) and details.controller not in done %}
+ <li><?= $this->Html->link(__('List {{ alias|underscore|humanize }}'), ['controller' => '{{ details.controller }}', 'action' => 'index']) ?> </li>
+ <li><?= $this->Html->link(__('New {{ alias|underscore|singularize|humanize }}'), ['controller' => '{{ details.controller }}', 'action' => 'add']) ?> </li>
+{% set done = done|merge(['controller']) %}
+{% endif %}
+{% endfor %}
+{% endfor %}
+ </ul>
+</nav>
+<div class="{{ pluralVar }} view large-9 medium-8 columns content">
+ <h3><?= h(${{ singularVar }}->{{ displayField }}) ?></h3>
+ <table class="vertical-table">
+{% if groupedFields['string'] %}
+{% for field in groupedFields['string'] %}
+{% if associationFields[field] %}
+{% set details = associationFields[field] %}
+ <tr>
+ <th scope="row"><?= __('{{ details.property|humanize }}') ?></th>
+ <td><?= ${{ singularVar }}->has('{{ details.property }}') ? $this->Html->link(${{ singularVar }}->{{ details.property }}->{{ details.displayField }}, ['controller' => '{{ details.controller }}', 'action' => 'view', ${{ singularVar }}->{{ details.property }}->{{ details.primaryKey[0] }}]) : '' ?></td>
+ </tr>
+{% else %}
+ <tr>
+ <th scope="row"><?= __('{{ field|humanize }}') ?></th>
+ <td><?= h(${{ singularVar }}->{{ field }}) ?></td>
+ </tr>
+{% endif %}
+{% endfor %}
+{% endif %}
+{% if associations.HasOne %}
+{% for alias, details in associations.HasOne %}
+ <tr>
+ <th scope="row"><?= __('{{ alias|underscore|singularize|humanize }}') ?></th>
+ <td><?= ${{ singularVar }}->has('{{ details.property }}') ? $this->Html->link(${{ singularVar }}->{{ details.property }}->{{ details.displayField }}, ['controller' => '{{ details.controller }}', 'action' => 'view', ${{ singularVar }}->{{ details.property }}->{{ details.primaryKey[0] }}]) : '' ?></td>
+ </tr>
+{% endfor %}
+{% endif %}
+{% if groupedFields.number %}
+{% for field in groupedFields.number %}
+ <tr>
+ <th scope="row"><?= __('{{ field|humanize }}') ?></th>
+ <td><?= $this->Number->format(${{ singularVar }}->{{ field }}) ?></td>
+ </tr>
+{% endfor %}
+{% endif %}
+{% if groupedFields.date %}
+{% for field in groupedFields.date %}
+ <tr>
+ <th scope="row"><?= __('{{ field|humanize }}') ?></th>
+ <td><?= h(${{ singularVar }}->{{ field }}) ?></td>
+ </tr>
+{% endfor %}
+{% endif %}
+{% if groupedFields.boolean %}
+{% for field in groupedFields.boolean %}
+ <tr>
+ <th scope="row"><?= __('{{ field|humanize }}') ?></th>
+ <td><?= ${{ singularVar }}->{{ field }} ? __('Yes') : __('No'); ?></td>
+ </tr>
+{% endfor %}
+{% endif %}
+ </table>
+{% if groupedFields.text %}
+{% for field in groupedFields.text %}
+ <div class="row">
+ <h4><?= __('{{ field|humanize }}') ?></h4>
+ <?= $this->Text->autoParagraph(h(${{ singularVar }}->{{ field }})); ?>
+ </div>
+{% endfor %}
+{% endif %}
+{% set relations = associations.BelongsToMany|merge(associations.HasMany) %}
+{% for alias, details in relations %}
+{% set otherSingularVar = alias|variable %}
+{% set otherPluralHumanName = details.controller|underscore|humanize %}
+ <div class="related">
+ <h4><?= __('Related {{ otherPluralHumanName }}') ?></h4>
+ <?php if (!empty(${{ singularVar }}->{{ details.property }})): ?>
+ <table cellpadding="0" cellspacing="0">
+ <tr>
+{% for field in details.fields %}
+ <th scope="col"><?= __('{{ field|humanize }}') ?></th>
+{% endfor %}
+ <th scope="col" class="actions"><?= __('Actions') ?></th>
+ </tr>
+ <?php foreach (${{ singularVar }}->{{ details.property }} as ${{ otherSingularVar }}): ?>
+ <tr>
+{% for field in details.fields %}
+ <td><?= h(${{ otherSingularVar }}->{{ field }}) ?></td>
+{% endfor %}
+{% set otherPk = '$' ~ otherSingularVar ~ '->' ~ details.primaryKey[0] %}
+ <td class="actions">
+ <?= $this->Html->link(__('View'), ['controller' => '{{ details.controller }}', 'action' => 'view', {{ otherPk|raw }}]) ?>
+ <?= $this->Html->link(__('Edit'), ['controller' => '{{ details.controller }}', 'action' => 'edit', {{ otherPk|raw }}]) ?>
+ <?= $this->Form->postLink(__('Delete'), ['controller' => '{{ details.controller }}', 'action' => 'delete', {{ otherPk|raw }}], ['confirm' => __('Are you sure you want to delete # {0}?', {{ otherPk|raw }})]) ?>
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ </table>
+ <?php endif; ?>
+ </div>
+{% endfor %}
+</div>
diff --git a/fai_gestion/plugins/CustomTheme/tests/bootstrap.php b/fai_gestion/plugins/CustomTheme/tests/bootstrap.php
new file mode 100644
index 0000000..644321d
--- /dev/null
+++ b/fai_gestion/plugins/CustomTheme/tests/bootstrap.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Test suite bootstrap for CustomTheme.
+ *
+ * This function is used to find the location of CakePHP whether CakePHP
+ * has been installed as a dependency of the plugin, or the plugin is itself
+ * installed as a dependency of an application.
+ */
+$findRoot = function ($root) {
+ do {
+ $lastRoot = $root;
+ $root = dirname($root);
+ if (is_dir($root . '/vendor/cakephp/cakephp')) {
+ return $root;
+ }
+ } while ($root !== $lastRoot);
+
+ throw new Exception("Cannot find the root of the application, unable to run tests");
+};
+$root = $findRoot(__FILE__);
+unset($findRoot);
+
+chdir($root);
+
+if (file_exists($root . '/config/bootstrap.php')) {
+ require $root . '/config/bootstrap.php';
+
+ return;
+}
+require $root . '/vendor/cakephp/cakephp/tests/bootstrap.php';
diff --git a/fai_gestion/plugins/empty b/fai_gestion/plugins/CustomTheme/webroot/empty
index e69de29..e69de29 100644
--- a/fai_gestion/plugins/empty
+++ b/fai_gestion/plugins/CustomTheme/webroot/empty