summaryrefslogtreecommitdiff
path: root/fai_gestion/plugins/CustomTheme/src
diff options
context:
space:
mode:
Diffstat (limited to 'fai_gestion/plugins/CustomTheme/src')
-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
11 files changed, 713 insertions, 0 deletions
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>