summaryrefslogtreecommitdiff
path: root/fai_gestion/config/bake_extra.php
diff options
context:
space:
mode:
Diffstat (limited to 'fai_gestion/config/bake_extra.php')
-rw-r--r--fai_gestion/config/bake_extra.php95
1 files changed, 95 insertions, 0 deletions
diff --git a/fai_gestion/config/bake_extra.php b/fai_gestion/config/bake_extra.php
new file mode 100644
index 0000000..e33b2a0
--- /dev/null
+++ b/fai_gestion/config/bake_extra.php
@@ -0,0 +1,95 @@
+<?php
+/**
+ * Copyright 2016-2018 Ludovic Pouzenc <ludovic@pouzenc.fr>
+ * Copyright 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+ *
+ * This file is part of FAI Gestion forked from CHD Gestion.
+ *
+ * FAI 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.
+ *
+ * FAI 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 FAI Gestion. If not, see <http://www.gnu.org/licenses/>.
+**/
+/*
+ * This config file is used twice when "cake bake all" is run :
+ *
+ * -> config/bootstrap_cli.php : Plugin::load('CustomTheme',['bootstrap' => true,...])
+ * (1)->plugins/CustomTheme/src/Shell/BakeShell.php
+ * startup() include this file and set Model->skipTables
+ * all() set $this->{$task}->params at each task run
+ *
+ * So "all" subcommand is limited/tweaked by $skipTables and $taskParams
+ *
+ * (2)->plugins/CustomTheme/config/bootstrap.php:
+ * EventManager::instance()->on('Bake.initialize',...)
+ * $extra = include(<this file>);
+ * $view->loadHelper('CustomTheme.BakeExtra', $extra);
+ * EventManager::instance()->on('Bake.beforeRender.Controller.controller',...)
+ * set $view->viewVars['actions'] with $extra
+ *
+ * So the whole config it goes into CustomTheme\BakeExtraHelper $config
+ * and becomes available in all .twig via BakeExtraHelper methods.
+ */
+
+$skipTables = [ 'network_edge_list_tree' ];
+$taskParams = [
+ 'default' => [
+ 'theme' => 'CustomTheme',
+ 'no-fixture' => true,
+ 'no-test' => true,
+ 'no-rules' => true,
+ 'index-columns' => 6
+ #'components' => 'hello,world',
+ ],
+ 'Adherents' => [ 'index-columns' => 7 ],
+];
+$controllerActions = [
+ 'default' => [ 'index', 'view', 'add', 'edit'],
+ 'AdherentRoles' => [ 'index', 'add', 'delete' ],
+ 'AdherentRoleTypes' => [ ],
+];
+$templateExtra = [
+ 'Adherents' => [
+ 'title' => [
+ 'custom_code' => <<<'EOT'
+ "ADT" . $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' => 3,
+ 'hint' => 'Find...',
+ ],
+ 'adherent_type_id' => [
+ 'mode' => 'value',
+ 'before' => 'false',
+ 'after' => 'false',
+ 'model' => 'AdherentTypes',
+ 'colspan' => 2,
+ 'hint' => 'AdherentTypes',
+ ],
+ 'ville_id' => [
+ 'mode' => 'value',
+ 'before' => 'false',
+ 'after' => 'false',
+ 'model' => 'Villes',
+ 'colspan' => 2,
+ 'hint' => 'Villes',
+ ],
+ ],
+ ],
+];
+
+return compact('skipTables', 'taskParams', 'controllerActions', 'templateExtra');