-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.php
206 lines (192 loc) · 10.8 KB
/
config.php
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?php
if(!defined('PLX_ROOT')) exit;
/**
* Plugin addEvents config
*
* @CMS required PluXml
* @version 3.1
* @date 2024-10-13
* @author G.Cyrillus
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░ ░░ ░░░░░░░ ░░░░ ░ ░░░░ ░░ ░░ ░░░ ░░ ░░░░░░░ ░░ ░░░░░ ░░░ ░ ░ ░
▒ ▒▒▒▒ ▒ ▒▒▒▒▒▒▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒ ▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒ ▒▒ ▒ ▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒
▓ ▓▓ ▓▓▓▓▓▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓ ▓ ▓▓ ▓▓▓▓ ▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓▓ ▓ ▓ ▓ ▓▓▓▓▓▓ ▓▓▓▓
█ ███████ ███████ ████ ██ ██ ██ ████ █ ███████ ████ █ ██████████ ██████████ ████ ██ █ ██████████ ████
█ ███████ ██ ██ ████ ██ ██ ████████ ██ █ ██ ██ █ ███ █ ████ ████
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
**/
# Control du token du formulaire
plxToken::validateFormToken($_POST);
# Liste des langues disponibles et prises en charge par le plugin
$aLangs = array($plxAdmin->aConf['default_lang']);
# Si le plugin plxMyMultiLingue est installé on filtre sur les langues utilisées
# On garde par défaut le fr si aucune langue sélectionnée dans plxMyMultiLingue
if(defined('PLX_MYMULTILINGUE')) {
$langs = plxMyMultiLingue::_Langs();
$multiLangs = empty($langs) ? array() : explode(',', $langs);
$aLangs = $multiLangs;
}
if(!empty($_POST)) {
$plxPlugin->setParam('dateFormat'.$plxPlugin->langParam, $_POST['dateFormat'.$plxPlugin->langParam], 'cdata');
#multilingue
$plxPlugin->setParam('mnuDisplay', $_POST['mnuDisplay'], 'numeric');
$plxPlugin->setParam('mnuPos', $_POST['mnuPos'], 'numeric');
$plxPlugin->setParam('bypage', $_POST['bypage'], 'numeric');
$plxPlugin->setParam('template', $_POST['template'], 'string');
$plxPlugin->setParam('past', $_POST['past'], 'numeric');
$plxPlugin->setParam('tri', $_POST['tri'], 'string');
$plxPlugin->setParam('url', plxUtils::title2url($_POST['url']), 'string');
$plxPlugin->setParam('showParticipation', plxUtils::title2url($_POST['showParticipation']), 'numeric');
foreach($aLangs as $lang) {
$plxPlugin->setParam('mnuName_'.$lang, $_POST['mnuName_'.$lang], 'string');
}
$plxPlugin->saveParams();
header("Location: parametres_plugin.php?p=".basename(__DIR__));
exit;
}
# formatage de la date à l'affichage
$var['dateFormat'.$plxPlugin->langParam] = $plxPlugin->getParam('dateFormat'.$plxPlugin->langParam) == '' ? '#day #num_day #month #num_year(4)' : $plxPlugin->getParam('dateFormat'.$plxPlugin->langParam);
# initialisation des variables propres à chaque lanque
$langs = array();
foreach($aLangs as $lang) {
# chargement de chaque fichier de langue
$langs[$lang] = $plxPlugin->loadLang(PLX_PLUGINS.'addEvents/lang/'.$lang.'.php');
$var[$lang]['mnuName'] = $plxPlugin->getParam('mnuName_'.$lang)=='' ? $plxPlugin->getLang('L_DEFAULT_MENU_NAME') : $plxPlugin->getParam('mnuName_'.$lang);
}
# initialisation des variables page statique
$var['mnuDisplay'] = $plxPlugin->getParam('mnuDisplay')=='' ? 1 : $plxPlugin->getParam('mnuDisplay');
$var['mnuPos'] = $plxPlugin->getParam('mnuPos')=='' ? 2 : $plxPlugin->getParam('mnuPos');
$var['template'] = $plxPlugin->getParam('template')=='' ? 'static.php' : $plxPlugin->getParam('template');
$var['url'] = $plxPlugin->getParam('url')=='' ? strtolower(basename(__DIR__)) : $plxPlugin->getParam('url');
$var['tri'] = $plxPlugin->getParam('tri')=='' ? 'asc' : $plxPlugin->getParam('tri');
$var['past'] = $plxPlugin->getParam('past')=='' ? 0 : $plxPlugin->getParam('past');
$var['bypage'] = $plxPlugin->getParam('bypage')=='' ? 5 : $plxPlugin->getParam('bypage');
$var['showParticipation'] = $plxPlugin->getParam('showParticipation')=='' ? 5 : $plxPlugin->getParam('showParticipation');
# Tableau du tri
$aTriArts = array(
'desc' => L_SORT_DESCENDING_DATE,
'asc' => L_SORT_ASCENDING_DATE,
);
# On récupère les templates des pages statiques
$glob = plxGlob::getInstance(PLX_ROOT . $plxAdmin->aConf['racine_themes'] . $plxAdmin->aConf['style'], false, true, '#^^static(?:-[\\w-]+)?\\.php$#');
if (!empty($glob->aFiles)) {
$aTemplates = array();
foreach($glob->aFiles as $v)
$aTemplates[$v] = basename($v, '.php');
} else {
$aTemplates = array('' => L_NONE1);
}
/* end template */
# affichage du wizard à la demande
if(isset($_GET['wizard'])) {$_SESSION['justactivated'.basename(__DIR__)] = true;}
# fermeture session wizard
if (isset($_SESSION['justactivated'.basename(__DIR__)])) {unset($_SESSION['justactivated'.basename(__DIR__)]);}
?>
<link rel="stylesheet" href="<?php echo PLX_PLUGINS."addEvents/css/tabs.css" ?>" media="all" />
<p><?php $plxPlugin->lang("L_ASSOCIATE_EVENT") ?></p><ul>
<li> <?php $plxPlugin->lang("L_EVENT_INSERT_FIELD") ?></li>
<li> <?php $plxPlugin->lang("L_EVENT_INSERT_NOTE") ?></li>
<li> <?php $plxPlugin->lang("L_EVENT_CREATE_STATIC") ?></li></ul>
<h2><?php $plxPlugin->lang("L_CONFIG") ?></h2>
<div id="tabContainer">
<form action="parametres_plugin.php?p=<?= basename(__DIR__) ?>" method="post" >
<div class="tabs">
<ul>
<li id="tabHeader_Param"><?php $plxPlugin->lang('L_PARAMS') ?></li>
<li id="tabHeader_main"><?php $plxPlugin->lang('L_MAIN') ?></li>
<?php
foreach($aLangs as $lang) {
echo '<li id="tabHeader_'.$lang.'">'.strtoupper($lang).'</li>';
} ?>
</ul>
</div>
<div class="tabscontent">
<div class="tabpage" id="tabpage_Param">
<fieldset><legend><?php $plxPlugin->lang("L_CONFIG") ?></legend>
<fieldset style="display:flex;gap:1em;place-content:center;flex-wrap:wrap;"><legend>- Date -</legend>
<p>
<label for="dateFormat"><?= $plxPlugin->getLang('L_DATE_FORMAT') ?></label>
<?php plxUtils::printInput('dateFormat'.$plxPlugin->langParam,$var['dateFormat'.$plxPlugin->langParam],'text','40-255') ?>
<br><br><span style="display:grid;grid-template-columns:auto,1fr;text-align-last:justify;" class="alert orange"><b style="grid-row:1/3;">Ex.</b> <code style="border-bottom:solid 1px;"><?= $var['dateFormat'.$plxPlugin->langParam] ?></code><?= plxDate::formatDate(date('Ymd'),$var['dateFormat'.$plxPlugin->langParam]); ?></span>
</p>
<div><h4 style="text-align:center" class="alert green"><?= $plxPlugin->getLang('L_PARAMS_HELP') ?></h4>
<ul>
<li><b>#day</b> : <?php $plxPlugin->lang('L_#DAY') ?></li>
<li><b>#month</b> : <?php $plxPlugin->lang('L_#MONTH') ?></li>
<li><b>#num_day</b> : <?php $plxPlugin->lang('L_#NUM_DAY') ?></li>
<li><b>#num_month</b> : <?php $plxPlugin->lang('L_#NUM_MONTH') ?></li>
<li><b>#num_year(4)</b> : <?php $plxPlugin->lang('L_#NUM_YEAR4') ?></li>
<li><b>#num_year(2</b>) : <?php $plxPlugin->lang('L_#NUM_YEAR2') ?></li>
<li><b>valeur libre</b> : <?php $plxPlugin->lang('L_#FREE_VALUE') ?></li>
</ul>
</div>
</fieldset>
<fieldset><legend><?= L_MENU_CONFIG_VIEW.' "'.$plxPlugin->getLang('L_PARTICIPANTS').'"' ?></legend>
<p>
<label for="id_showParticipation"><?php echo $plxPlugin->lang('L_DISPLAY_PARTICIPANTS') ?> :</label>
<?php plxUtils::printSelect('showParticipation',array('1'=>L_YES,'0'=>L_NO),$var['showParticipation']); ?>
</p>
</fieldset>
</div>
<div class="tabpage" style="grid-template-columns:repeat(auto-fit,minmax(350px,1fr))" id="tabpage_main">
<fieldset>
<legend><?php $plxPlugin->lang('L_PARAMS'). $plxPlugin->lang('L_MAIN') ?></legend>
<p>
<label for="id_url"><?php $plxPlugin->lang('L_PARAM_URL') ?> :</label>
<?php plxUtils::printInput('url',$var['url'],'text','20-20') ?>
</p>
<p>
<label for="id_mnuDisplay"><?php echo $plxPlugin->lang('L_MENU_DISPLAY') ?> :</label>
<?php plxUtils::printSelect('mnuDisplay',array('1'=>L_YES,'0'=>L_NO),$var['mnuDisplay']); ?>
</p>
<p>
<label for="id_mnuPos"><?php $plxPlugin->lang('L_MENU_POS') ?> :</label>
<?php plxUtils::printInput('mnuPos',$var['mnuPos'],'text','2-5') ?>
</p>
<p>
<label for="id_template"><?php $plxPlugin->lang('L_TEMPLATE') ?> :</label>
<?php plxUtils::printSelect('template', $aTemplates, $var['template']) ?>
</p>
</fieldset>
<fieldset>
<legend><?php $plxPlugin->lang('L_CONFIG_VIEW_STATIC') ?></legend>
<p>
<label for="id_tri"><?= L_CONFIG_VIEW_SORT ?> :</label>
<?php plxUtils::printSelect('tri', $aTriArts, $var['tri']);?>
</p>
<p>
<label for="id_tri"><?php $plxPlugin->lang('L_CONFIG_VIEW_PAST') ?> :</label>
<?php plxUtils::printSelect('past', array('1'=>L_YES,'0'=>L_NO), $var['past']);?>
</p>
<p>
<label for="id_bypage"><?php echo L_CONFIG_VIEW_BYPAGE ?> :</label>
<?php plxUtils::printInput('bypage', $var['bypage'], 'text', '2-4',false,'fieldnum'); ?>
</p>
</fieldset>
</div>
<?php foreach($aLangs as $lang) : ?>
<div class="tabpage" id="tabpage_<?php echo $lang ?>">
<?php if(!file_exists(PLX_PLUGINS.basename(__DIR__).'/lang/'.$lang.'.php')) : ?>
<p><?php printf($plxPlugin->getLang('L_LANG_UNAVAILABLE'), PLX_PLUGINS.basename(__DIR__).'/lang/'.$lang.'.php') ?></p>
<?php else : ?>
<fieldset>
<p>
<label for="id_mnuName_<?php echo $lang ?>"><?php $plxPlugin->lang('L_MENU_TITLE') ?> :</label>
<?php plxUtils::printInput('mnuName_'.$lang,$var[$lang]['mnuName'],'text','20-20') ?>
</p>
</fieldset>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<fieldset>
<p class="in-action-bar">
<?php echo plxToken::getTokenPostMethod() ?><br>
<input type="submit" name="submit" value="<?= $plxPlugin->getLang('L_SAVE') ?>"/>
</p>
</fieldset>
</form>
</div>
<script type="text/javascript" src="<?php echo PLX_PLUGINS."addEvents/js/tabs.js" ?>"></script>
<hr>
<a href="parametres_plugin.php?p=<?= basename(__DIR__) ?>&wizard" class="aWizard"><img src="<?= PLX_PLUGINS.basename(__DIR__)?>/img/wizard.png" style="height:2em;vertical-align:middle" alt="Wizard"> Wizard</a>