summaryrefslogtreecommitdiff
path: root/fai_gestion/config/bake_extra.php
blob: 559b3406bce7b5747e05c39c8605328df4656b28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?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',
                'field' => ['id','nom','nom2','prenom','prenom2','raison','proprio','tel_mobile1','tel_mobile2'],
                'colspan' => 3,
                'hint' => 'Find...',
            ],
            'adherent_type_id' => [
                'mode' => 'value',
                'colspan' => 2,
                'hint' => 'AdherentTypes',
            ],
            'ville_id' => [
                'mode' => 'value',
                'colspan' => 2,
                'hint' => 'Villes',
            ],
        ],
    ],
];

return compact('skipTables', 'taskParams', 'controllerActions', 'templateExtra');