|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* You may not change or alter any portion of this comment or credits |
|
4
|
|
|
* of supporting developers from this source code or any supporting source code |
|
5
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
* |
|
7
|
|
|
* This program is distributed in the hope that it will be useful, |
|
8
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
14
|
|
|
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
|
15
|
|
|
* @package extcal |
|
16
|
|
|
* @since |
|
17
|
|
|
* @author XOOPS Development Team, |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
use XoopsModules\Extcal\{Helper, |
|
21
|
|
|
Time, |
|
22
|
|
|
TableForm, |
|
23
|
|
|
Form |
|
24
|
|
|
}; |
|
25
|
|
|
|
|
26
|
|
|
global $xoopsUser; |
|
27
|
|
|
require_once dirname(__DIR__) . '/include/constantes.php'; |
|
28
|
|
|
|
|
29
|
|
|
//--------------------------------------------------------------------------- |
|
30
|
|
|
/** |
|
31
|
|
|
* @param $options |
|
32
|
|
|
* |
|
33
|
|
|
* @return array|bool |
|
34
|
|
|
*/ |
|
35
|
|
|
function bExtcalMinicalShow($options) |
|
36
|
|
|
{ |
|
37
|
|
|
global $xoopsUser; |
|
38
|
|
|
|
|
39
|
|
|
extcal_getDefautminicalOption($options); |
|
40
|
|
|
|
|
41
|
|
|
// // require_once dirname(__DIR__) . '/class/Config.php'; |
|
42
|
|
|
|
|
43
|
|
|
require_once _EXTCAL_PEAR_CALENDAR_ROOT . '/Util/Textual.php'; |
|
44
|
|
|
require_once _EXTCAL_PEAR_CALENDAR_ROOT . '/Month/Weeks.php'; |
|
45
|
|
|
require_once _EXTCAL_PEAR_CALENDAR_ROOT . '/Day.php'; |
|
46
|
|
|
// require_once CALENDAR_ROOT . 'Month/Weeks.php'; |
|
47
|
|
|
// require_once CALENDAR_ROOT . 'Day.php'; |
|
48
|
|
|
|
|
49
|
|
|
/** @var Helper $helper */ |
|
50
|
|
|
if (!class_exists(Helper::class)) { |
|
51
|
|
|
return false; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
$helper = Helper::getInstance(); |
|
55
|
|
|
$helper->loadLanguage('main'); |
|
56
|
|
|
|
|
57
|
|
|
// Retriving Image for block if enabled |
|
58
|
|
|
if (isset($options[0]) && 1 == $options[0]) { |
|
59
|
|
|
$imageHandler = xoops_getHandler('image'); |
|
60
|
|
|
$criteria = new \Criteria('imgcat_id', $options[1]); |
|
61
|
|
|
$criteria->setSort('RAND()'); |
|
62
|
|
|
$criteria->setLimit($options[6]); |
|
63
|
|
|
$images = $imageHandler->getObjects($criteria); |
|
|
|
|
|
|
64
|
|
|
$slideShowParam = [ |
|
65
|
|
|
'images' => $images, |
|
66
|
|
|
'frameHeight' => $options[3], |
|
67
|
|
|
'frameWidth' => $options[2], |
|
68
|
|
|
'transTime' => $options[4], |
|
69
|
|
|
'pauseTime' => $options[5], |
|
70
|
|
|
]; |
|
71
|
|
|
if (count($images) > 0) { |
|
72
|
|
|
_makeXMLSlideshowConf($slideShowParam); |
|
73
|
|
|
$imageParam = ['displayImage' => true]; |
|
74
|
|
|
} else { |
|
75
|
|
|
$imageParam = ['displayImage' => false]; |
|
76
|
|
|
} |
|
77
|
|
|
} else { |
|
78
|
|
|
$imageParam = ['displayImage' => false]; |
|
79
|
|
|
} |
|
80
|
|
|
$imageParam['frameHeight'] = $options[3]; |
|
81
|
|
|
$imageParam['frameWidth'] = $options[2]; |
|
82
|
|
|
|
|
83
|
|
|
$categoryHandler = $helper->getHandler(_EXTCAL_CLN_CAT); |
|
84
|
|
|
|
|
85
|
|
|
$cats = $categoryHandler->getAllCatById($xoopsUser); |
|
|
|
|
|
|
86
|
|
|
// $t = print_r($cats,true); |
|
87
|
|
|
// echo "zzz<pre>{$t}</pre>"; |
|
88
|
|
|
|
|
89
|
|
|
$eventHandler = $helper->getHandler(_EXTCAL_CLN_EVENT); |
|
90
|
|
|
$timeHandler = Time::getHandler(); |
|
91
|
|
|
|
|
92
|
|
|
// Retriving month and year value according to block options |
|
93
|
|
|
//modif JJD |
|
94
|
|
|
$offset = $helper->getConfig('offsetMinical'); |
|
95
|
|
|
$monthToShow = mktime(0, 0, 0, date('m') + $offset, date('d'), date('Y')); |
|
|
|
|
|
|
96
|
|
|
$month = date('n', $monthToShow); |
|
97
|
|
|
$year = date('Y', $monthToShow); |
|
98
|
|
|
|
|
99
|
|
|
//---------------------------------------------------- |
|
100
|
|
|
$month += $options[7]; //ajout ou retrait du nombre de mois de décalage |
|
101
|
|
|
if ($month < 1) { |
|
102
|
|
|
$month = 12; |
|
103
|
|
|
--$year; |
|
104
|
|
|
} elseif ($month > 12) { |
|
105
|
|
|
$month = 1; |
|
106
|
|
|
++$year; |
|
107
|
|
|
} |
|
108
|
|
|
//---------------------------------------------------- |
|
109
|
|
|
|
|
110
|
|
|
// Saving display link preference |
|
111
|
|
|
$displayLink = $options[8]; |
|
112
|
|
|
|
|
113
|
|
|
// Delete options to keep only categorie data |
|
114
|
|
|
$tCatSelected = explode(',', $options[9]); |
|
115
|
|
|
|
|
116
|
|
|
/***************************************************************/ // Retriving events and formatting them |
|
117
|
|
|
//$events = $eventHandler->objectToArray($eventHandler->getEventCalendarMonth($month, $year, $tCatSelected)); |
|
118
|
|
|
if (true) { |
|
119
|
|
|
$criteres = [ |
|
120
|
|
|
'periode' => _EXTCAL_EVENTS_MONTH, |
|
121
|
|
|
'month' => $month, |
|
122
|
|
|
'year' => $year, |
|
123
|
|
|
'category' => $tCatSelected, |
|
124
|
|
|
'externalKeys' => 'cat_id', |
|
125
|
|
|
]; |
|
126
|
|
|
$events = $eventHandler->getEventsOnPeriode($criteres); |
|
|
|
|
|
|
127
|
|
|
} else { |
|
128
|
|
|
$events = []; |
|
129
|
|
|
} |
|
130
|
|
|
//Utility::echoArray($events, 'minical'); |
|
131
|
|
|
/***************************************************************/ //$eventHandler->formatEventDate($events, "l dS \of F Y h:i A"); |
|
132
|
|
|
|
|
133
|
|
|
// Calculating timestamp for the begin and the end of the month |
|
134
|
|
|
$startMonth = mktime(0, 0, 0, $month, 1, $year); |
|
135
|
|
|
$endMonth = mktime(23, 59, 59, $month + 1, 0, $year); |
|
136
|
|
|
|
|
137
|
|
|
/* |
|
138
|
|
|
* Adding all event occuring during this month to an array indexed by day number |
|
139
|
|
|
*/ |
|
140
|
|
|
$eventsArray = []; |
|
141
|
|
|
foreach ($events as $event) { |
|
142
|
|
|
//echo "id->{$event['event_id']}<br>"; |
|
143
|
|
|
bExtcalMinicalAddEventToArray($event, $eventsArray, $timeHandler, $startMonth, $endMonth, $cats); |
|
144
|
|
|
// if (!$event['event_isrecur']) { |
|
145
|
|
|
// bExtcalMinicalAddEventToArray($event, $eventsArray, $timeHandler, $startMonth, $endMonth, $cats); |
|
146
|
|
|
// } else { |
|
147
|
|
|
// |
|
148
|
|
|
// $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startMonth, $endMonth); |
|
149
|
|
|
// foreach ($recurEvents as $recurEvent) |
|
150
|
|
|
// { |
|
151
|
|
|
// bExtcalMinicalAddEventToArray($recurEvent, $eventsArray, $timeHandler, $startMonth, $endMonth, $cats); |
|
152
|
|
|
// } |
|
153
|
|
|
// } |
|
154
|
|
|
} |
|
155
|
|
|
//Utility::echoArray($eventsArray); |
|
156
|
|
|
|
|
157
|
|
|
/* |
|
158
|
|
|
* Making an array to create tabbed output on the template |
|
159
|
|
|
*/ |
|
160
|
|
|
// Flag current day |
|
161
|
|
|
$selectedDays = [ |
|
162
|
|
|
new Calendar_Day( |
|
163
|
|
|
date('Y', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']))), |
|
|
|
|
|
|
164
|
|
|
date('n', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']))), |
|
|
|
|
|
|
165
|
|
|
date('j', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']))) |
|
|
|
|
|
|
166
|
|
|
), |
|
167
|
|
|
]; |
|
168
|
|
|
|
|
169
|
|
|
// Build calendar object |
|
170
|
|
|
$monthCalObj = new Calendar_Month_Weeks($year, $month, $helper->getConfig('week_start_day')); |
|
|
|
|
|
|
171
|
|
|
$monthCalObj->build(); |
|
172
|
|
|
|
|
173
|
|
|
$tableRows = []; |
|
174
|
|
|
$rowId = 0; |
|
175
|
|
|
$cellId = 0; |
|
176
|
|
|
while (false !== ($weekCalObj = $monthCalObj->fetch())) { |
|
177
|
|
|
$weekCalObj->build($selectedDays); |
|
178
|
|
|
$tableRows[$rowId]['weekInfo'] = [ |
|
179
|
|
|
'week' => $weekCalObj->thisWeek('n_in_year'), |
|
180
|
|
|
'day' => $weekCalObj->thisDay(), |
|
181
|
|
|
'month' => $monthCalObj->thisMonth(), |
|
182
|
|
|
'year' => $monthCalObj->thisYear(), |
|
183
|
|
|
]; |
|
184
|
|
|
while (false !== ($dayCalObj = $weekCalObj->fetch())) { |
|
185
|
|
|
$tableRows[$rowId]['week'][$cellId] = [ |
|
186
|
|
|
'isEmpty' => $dayCalObj->isEmpty(), |
|
187
|
|
|
'number' => $dayCalObj->thisDay(), |
|
188
|
|
|
'isSelected' => $dayCalObj->isSelected(), |
|
189
|
|
|
]; |
|
190
|
|
|
$day = $dayCalObj->thisDay(); |
|
191
|
|
|
if (isset($eventsArray[$day]) && !$dayCalObj->isEmpty()) { |
|
192
|
|
|
$tableRows[$rowId]['week'][$cellId]['haveEvents'] = true; |
|
193
|
|
|
$tableRows[$rowId]['week'][$cellId]['color'] = $eventsArray[$day]['color']; |
|
194
|
|
|
} else { |
|
195
|
|
|
$tableRows[$rowId]['week'][$cellId]['haveEvents'] = false; |
|
196
|
|
|
} |
|
197
|
|
|
++$cellId; |
|
198
|
|
|
} |
|
199
|
|
|
$cellId = 0; |
|
200
|
|
|
++$rowId; |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
// Retriving weekdayNames |
|
204
|
|
|
//$loc_de = setlocale (LC_ALL, 'Fr'); |
|
205
|
|
|
|
|
206
|
|
|
$weekdayNames = Calendar_Util_Textual::weekdayNames('one'); |
|
207
|
|
|
//$weekdayNames=array('D','L','M','M','J','V','S'); |
|
208
|
|
|
|
|
209
|
|
|
// echo "<hr>L'identifiant de l'allemand sur ce système est '$loc_de'"; |
|
210
|
|
|
// echoArray($weekdayNames,true); |
|
211
|
|
|
|
|
212
|
|
|
for ($i = 0; $i < $helper->getConfig('week_start_day'); ++$i) { |
|
213
|
|
|
$weekdayName = array_shift($weekdayNames); |
|
214
|
|
|
$weekdayNames[] = $weekdayName; |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
// Making navig data |
|
218
|
|
|
$navig = [ |
|
219
|
|
|
'page' => $helper->getConfig('start_page'), |
|
220
|
|
|
'uri' => 'year=' . $monthCalObj->thisYear() . '&month=' . $monthCalObj->thisMonth(), |
|
221
|
|
|
'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $monthCalObj->getTimestamp()), |
|
222
|
|
|
]; |
|
223
|
|
|
|
|
224
|
|
|
$horloge = []; |
|
225
|
|
|
$horloge['display'] = ('' != trim($options[10])); |
|
226
|
|
|
$horloge['fullName'] = XOOPS_URL . _EXTCAL_PATH_HORLOGES . $options[11]; |
|
227
|
|
|
$horloge['width'] = $options[12] . 'px'; |
|
228
|
|
|
$horloge['height'] = $options[13] . 'px'; |
|
229
|
|
|
|
|
230
|
|
|
$ret = [ |
|
231
|
|
|
'imageParam' => $imageParam, |
|
232
|
|
|
'displayLink' => $displayLink, |
|
233
|
|
|
'submitText' => _MB_EXTCAL_SUBMIT_LINK_TEXT, |
|
234
|
|
|
'tableRows' => $tableRows, |
|
235
|
|
|
'weekdayNames' => $weekdayNames, |
|
236
|
|
|
'navig' => $navig, |
|
237
|
|
|
'horloge' => $horloge, |
|
238
|
|
|
'bgColor' => $options[10], |
|
239
|
|
|
]; |
|
240
|
|
|
|
|
241
|
|
|
// $t = print_r($horloge,true); |
|
242
|
|
|
// echo "<pre>{$t}</pre>"; |
|
243
|
|
|
return $ret; |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
//--------------------------------------------------------------------------- |
|
247
|
|
|
/** |
|
248
|
|
|
* @param $options |
|
249
|
|
|
* |
|
250
|
|
|
* @return string |
|
251
|
|
|
*/ |
|
252
|
|
|
function bExtcalMinicalEdit($options) |
|
253
|
|
|
{ |
|
254
|
|
|
// // require_once dirname(__DIR__) . '/class/form/spin/formspin.php'; |
|
255
|
|
|
global $xoopsUser; |
|
256
|
|
|
|
|
257
|
|
|
// $t = print_r(get_defined_vars(),true); |
|
258
|
|
|
// // $t = print_r($options,true); |
|
259
|
|
|
// echo "<pre>{$t}</pre>"; |
|
260
|
|
|
|
|
261
|
|
|
extcal_getDefautminicalOption($options); |
|
262
|
|
|
|
|
263
|
|
|
$xfValue = []; |
|
264
|
|
|
|
|
265
|
|
|
$form = new TableForm(_OPTIONS, '', ''); |
|
266
|
|
|
//$form->setExtra('enctype="multipart/form-data"'); |
|
267
|
|
|
|
|
268
|
|
|
//============================================================ |
|
269
|
|
|
|
|
270
|
|
|
$helper = Helper::getInstance(); |
|
271
|
|
|
$categoryHandler = $helper->getHandler(_EXTCAL_CLN_CAT); |
|
272
|
|
|
$cats = $categoryHandler->getAllCat($xoopsUser, 'extcal_cat_view'); |
|
|
|
|
|
|
273
|
|
|
$imageCatHandler = xoops_getHandler('imagecategory'); |
|
274
|
|
|
|
|
275
|
|
|
//===================================================================== |
|
276
|
|
|
$form->insertBreak('<div style="text-align: center;font-weight: bold;">' . _MB_EXTCAL_OPT_SLIDE_SHOW . '</div>', 'head'); |
|
277
|
|
|
|
|
278
|
|
|
$k = 0; |
|
279
|
|
|
$xfValue[$k] = new \XoopsFormRadio(_MB_EXTCAL_DISPLAY_IMG, "options[{$k}]", $options[$k]); |
|
280
|
|
|
$xfValue[$k]->addOption(1, _YES); |
|
281
|
|
|
$xfValue[$k]->addOption(0, _NO); |
|
282
|
|
|
|
|
283
|
|
|
$form->addElement($xfValue[$k], false); |
|
284
|
|
|
//--------------------------------------------------------------------- |
|
285
|
|
|
$imageCats = $imageCatHandler->getObjects(); |
|
286
|
|
|
$t = []; |
|
287
|
|
|
$t[0] = _NONE; |
|
288
|
|
|
foreach ($imageCats as $cat) { |
|
289
|
|
|
$t[$cat->getVar('imgcat_id')] = $cat->getVar('imgcat_name'); |
|
290
|
|
|
} |
|
291
|
|
|
|
|
292
|
|
|
$k = 1; |
|
293
|
|
|
$xfValue[$k] = new \XoopsFormSelect(_MB_EXTCAL_IMG_CAT, "options[{$k}]", $options[$k], 1, false); |
|
294
|
|
|
$xfValue[$k]->addOptionArray($t); |
|
295
|
|
|
$form->addElement($xfValue[$k], false); |
|
296
|
|
|
//--------------------------------------------------------------------- |
|
297
|
|
|
$k = 2; |
|
298
|
|
|
$xfValue[$k] = new Form\Spin\FormSpin(_MB_EXTCAL_SS_WIDTH, "options[{$k}]", $options[$k], 100, 250, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = ''); |
|
299
|
|
|
$form->addElement($xfValue[$k], false); |
|
300
|
|
|
//--------------------------------------------------------------------- |
|
301
|
|
|
$k = 3; |
|
302
|
|
|
$xfValue[$k] = new Form\Spin\FormSpin(_MB_EXTCAL_SS_HEIGHT, "options[{$k}]", $options[$k], 100, 250, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = ''); |
|
303
|
|
|
$form->addElement($xfValue[$k], false); |
|
304
|
|
|
//--------------------------------------------------------------------- |
|
305
|
|
|
$k = 4; |
|
306
|
|
|
$xfValue[$k] = new Form\Spin\FormSpin(_MB_EXTCAL_SS_TRANS_TIME, "options[{$k}]", $options[$k], 0, 12, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = ''); |
|
307
|
|
|
$form->addElement($xfValue[$k], false); |
|
308
|
|
|
//--------------------------------------------------------------------- |
|
309
|
|
|
$k = 5; |
|
310
|
|
|
$xfValue[$k] = new Form\Spin\FormSpin(_MB_EXTCAL_SS_PAUSE_TIME, "options[{$k}]", $options[$k], 0, 12, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = ''); |
|
311
|
|
|
$form->addElement($xfValue[$k], false); |
|
312
|
|
|
//--------------------------------------------------------------------- |
|
313
|
|
|
$k = 6; |
|
314
|
|
|
$xfValue[$k] = new Form\Spin\FormSpin(_MB_EXTCAL_SS_NB_PHOTOS, "options[{$k}]", $options[$k], 0, 50, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = ''); |
|
315
|
|
|
$form->addElement($xfValue[$k], false); |
|
316
|
|
|
//===================================================================== |
|
317
|
|
|
$form->insertBreak('<div style="text-align: center;font-weight: bold;">' . _MB_EXTCAL_OPT_SHOW . '</div>', 'head'); |
|
318
|
|
|
|
|
319
|
|
|
$t = [ |
|
320
|
|
|
-1 => _MB_EXTCAL_PREVIEW, |
|
321
|
|
|
0 => _MB_EXTCAL_CURRENT, |
|
322
|
|
|
1 => _MB_EXTCAL_NEXT, |
|
323
|
|
|
]; |
|
324
|
|
|
|
|
325
|
|
|
$k = 7; |
|
326
|
|
|
$xfValue[$k] = new \XoopsFormSelect(_MB_EXTCAL_DISPLAY_MONTH, "options[{$k}]", $options[$k], 1, false); |
|
327
|
|
|
$xfValue[$k]->addOptionArray($t); |
|
328
|
|
|
$form->addElement($xfValue[$k], false); |
|
329
|
|
|
//--------------------------------------------------------------------- |
|
330
|
|
|
$k = 8; |
|
331
|
|
|
$xfValue[$k] = new \XoopsFormRadio(_MB_EXTCAL_DISPLAY_SUBMIT_LINK, "options[{$k}]", $options[$k]); |
|
332
|
|
|
$xfValue[$k]->addOption(1, _YES); |
|
333
|
|
|
$xfValue[$k]->addOption(0, _NO); |
|
334
|
|
|
|
|
335
|
|
|
$form->addElement($xfValue[$k], false); |
|
336
|
|
|
//--------------------------------------------------------------------- |
|
337
|
|
|
//for ($h=0;$h<8;++$h) array_shift($options); |
|
338
|
|
|
$t = []; |
|
339
|
|
|
foreach ($cats as $cat) { |
|
340
|
|
|
$t[$cat->getVar('cat_id')] = $cat->getVar('cat_name'); |
|
341
|
|
|
} |
|
342
|
|
|
|
|
343
|
|
|
//function XoopsFormSelect($caption, $name, $value = null, $size = 1, $multiple = false) |
|
344
|
|
|
|
|
345
|
|
|
$k = 9; |
|
346
|
|
|
$xfValue[$k] = new \XoopsFormSelect(_MB_EXTCAL_CAT_TO_USE, "options[{$k}]", explode(',', $options[$k]), 8, true); |
|
347
|
|
|
$xfValue[$k]->setDescription(_MB_EXTCAL_CAT_TO_USE_DESC); |
|
348
|
|
|
$xfValue[$k]->addOptionArray($t); |
|
349
|
|
|
$form->addElement($xfValue[$k], false); |
|
350
|
|
|
//--------------------------------------------------------------------- |
|
351
|
|
|
$k = 10; |
|
352
|
|
|
$xfValue[$k] = new \XoopsFormColorPicker(_MB_EXTCAL_BGCOLOR, "options[{$k}]", $options[$k]); |
|
353
|
|
|
$form->addElement($xfValue[$k], false); |
|
354
|
|
|
|
|
355
|
|
|
//===================================================================== |
|
356
|
|
|
$form->insertBreak('<div style="text-align: center;font-weight: bold;">' . _MB_EXTCAL_HORLOGE_OPT . '</div>', 'head'); |
|
357
|
|
|
//--------------------------------------------------------------------- |
|
358
|
|
|
$t = \XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH . _EXTCAL_PATH_HORLOGES); |
|
359
|
|
|
$t = array_merge([' ' => _NONE], $t); |
|
360
|
|
|
|
|
361
|
|
|
$k = 11; |
|
362
|
|
|
$xfValue[$k] = new \XoopsFormSelect(_MB_EXTCAL_HORLOGE, "options[{$k}]", $options[$k], 1, false); |
|
363
|
|
|
$xfValue[$k]->addOptionArray($t); |
|
364
|
|
|
$form->addElement($xfValue[$k], false); |
|
365
|
|
|
|
|
366
|
|
|
//--------------------------------------------------------------------- |
|
367
|
|
|
$k = 12; |
|
368
|
|
|
$xfValue[$k] = new Form\Spin\FormSpin(_MB_EXTCAL_WIDTH, "options[{$k}]", $options[$k], 50, 250, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = ''); |
|
369
|
|
|
$form->addElement($xfValue[$k], false); |
|
370
|
|
|
//--------------------------------------------------------------------- |
|
371
|
|
|
$k = 13; |
|
372
|
|
|
$xfValue[$k] = new Form\Spin\FormSpin(_MB_EXTCAL_HEIGHT, "options[{$k}]", $options[$k], 50, 250, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = ''); |
|
373
|
|
|
$form->addElement($xfValue[$k], false); |
|
374
|
|
|
//--------------------------------------------------------------------- |
|
375
|
|
|
//===================================================================== |
|
376
|
|
|
return $form->render(); |
|
377
|
|
|
/* |
|
378
|
|
|
$t = []; |
|
379
|
|
|
//while (list($key,$val) = each($xfValue)) { |
|
380
|
|
|
foreach ($xfValue as $key => $val) { |
|
381
|
|
|
$t[] = $val->render(); |
|
382
|
|
|
} |
|
383
|
|
|
return implode("\n", $t); |
|
384
|
|
|
|
|
385
|
|
|
return extcal_buildHtmlArray($xfValue, _OPTIONS); |
|
386
|
|
|
*/ |
|
387
|
|
|
} |
|
388
|
|
|
|
|
389
|
|
|
/**************************************************************************/ |
|
390
|
|
|
/** |
|
391
|
|
|
* @param $options |
|
392
|
|
|
*/ |
|
393
|
|
|
function _makeXMLSlideshowConf($options) |
|
394
|
|
|
{ |
|
395
|
|
|
// create a new \XML document |
|
396
|
|
|
$doc = new DomDocument('1.0'); |
|
397
|
|
|
$doc->formatOutput = true; |
|
398
|
|
|
|
|
399
|
|
|
// create root node |
|
400
|
|
|
$root = $doc->createElement('slideshow'); |
|
401
|
|
|
$root = $doc->appendChild($root); |
|
402
|
|
|
|
|
403
|
|
|
// Create config node |
|
404
|
|
|
$config = $doc->createElement('config'); |
|
405
|
|
|
$config = $root->appendChild($config); |
|
406
|
|
|
|
|
407
|
|
|
// Add config param |
|
408
|
|
|
$frameHeight = $doc->createElement('frameHeight'); |
|
409
|
|
|
$frameHeight = $config->appendChild($frameHeight); |
|
410
|
|
|
$value = $doc->createTextNode($options['frameHeight']); |
|
411
|
|
|
$frameHeight->appendChild($value); |
|
412
|
|
|
|
|
413
|
|
|
$frameWidth = $doc->createElement('frameWidth'); |
|
414
|
|
|
$frameWidth = $config->appendChild($frameWidth); |
|
415
|
|
|
$value = $doc->createTextNode($options['frameWidth']); |
|
416
|
|
|
$frameWidth->appendChild($value); |
|
417
|
|
|
|
|
418
|
|
|
$transTime = $doc->createElement('transTime'); |
|
419
|
|
|
$transTime = $config->appendChild($transTime); |
|
420
|
|
|
$value = $doc->createTextNode($options['transTime']); |
|
421
|
|
|
$transTime->appendChild($value); |
|
422
|
|
|
|
|
423
|
|
|
$pauseTime = $doc->createElement('pauseTime'); |
|
424
|
|
|
$pauseTime = $config->appendChild($pauseTime); |
|
425
|
|
|
$value = $doc->createTextNode($options['pauseTime']); |
|
426
|
|
|
$pauseTime->appendChild($value); |
|
427
|
|
|
|
|
428
|
|
|
// Add photos node |
|
429
|
|
|
$photos = $doc->createElement('photos'); |
|
430
|
|
|
$photos = $root->appendChild($photos); |
|
431
|
|
|
|
|
432
|
|
|
$tempPhoto = $doc->createElement('photo'); |
|
433
|
|
|
$tempSrc = $doc->createElement('src'); |
|
434
|
|
|
foreach ($options['images'] as $images) { |
|
435
|
|
|
// $photo = $doc->createElement('photo'); |
|
436
|
|
|
$photo = clone $tempPhoto; |
|
437
|
|
|
$photo = $photos->appendChild($photo); |
|
438
|
|
|
|
|
439
|
|
|
// $src = $doc->createElement('src'); |
|
440
|
|
|
$src = clone $tempSrc; |
|
441
|
|
|
$src = $photo->appendChild($src); |
|
442
|
|
|
$value = $doc->createTextNode(XOOPS_URL . '/uploads/' . $images->getVar('image_name')); |
|
443
|
|
|
$src->appendChild($value); |
|
444
|
|
|
} |
|
445
|
|
|
|
|
446
|
|
|
// get completed xml document |
|
447
|
|
|
$xml_string = $doc->save(XOOPS_ROOT_PATH . '/cache/extcalSlideShowParam.xml'); |
|
|
|
|
|
|
448
|
|
|
} |
|
449
|
|
|
|
|
450
|
|
|
/**************************************************************************/ |
|
451
|
|
|
/** |
|
452
|
|
|
* @param array $event |
|
453
|
|
|
* @param array $eventsArray |
|
454
|
|
|
* @param Time $timeHandler |
|
455
|
|
|
* @param $startMonth |
|
456
|
|
|
* @param $endMonth |
|
457
|
|
|
* @param $cats |
|
458
|
|
|
* |
|
459
|
|
|
* @return bool |
|
460
|
|
|
*/ |
|
461
|
|
|
function bExtcalMinicalAddEventToArray($event, &$eventsArray, $timeHandler, $startMonth, $endMonth, $cats) |
|
|
|
|
|
|
462
|
|
|
{ |
|
463
|
|
|
// Utility::echoArray($event); |
|
464
|
|
|
// exit; |
|
465
|
|
|
// $d1 = date("j, m, Y", $startMonth); |
|
466
|
|
|
// $d2 = date("j, m, Y", $endMonth); |
|
467
|
|
|
// echo "bExtcalMinicalAddEventToArray : {$d1} - {$d2}<br>"; |
|
468
|
|
|
// $d1 = date("j, m, Y", $event['event_start']); |
|
469
|
|
|
// $d2 = date("j, m, Y", $event['event_end']); |
|
470
|
|
|
// echo "bExtcalMinicalAddEventToArray : {$d1} - {$d2}<br>"; |
|
471
|
|
|
|
|
472
|
|
|
// $color = $cats[$event['cat_id']]['cat_color']; |
|
473
|
|
|
// $weight = $cats[$event['cat_id']]['cat_weight']; |
|
474
|
|
|
$color = $event['cat']['cat_color']; |
|
475
|
|
|
$weight = $event['cat']['cat_weight']; |
|
476
|
|
|
|
|
477
|
|
|
// Calculating the start and the end of the event |
|
478
|
|
|
$startEvent = xoops_getUserTimestamp($event['event_start'], $timeHandler->getUserTimeZone($GLOBALS['xoopsUser'])); |
|
479
|
|
|
$endEvent = xoops_getUserTimestamp($event['event_end'], $timeHandler->getUserTimeZone($GLOBALS['xoopsUser'])); |
|
480
|
|
|
// Utility::echoTsu($event['event_start'],"event['event_start']"); |
|
481
|
|
|
// Utility::echoTsu($event['event_end'],"event['event_end']"); |
|
482
|
|
|
|
|
483
|
|
|
//--------------------------------------------------------------- |
|
484
|
|
|
if ($startEvent < $startMonth) { |
|
485
|
|
|
$firstDay = 1; |
|
|
|
|
|
|
486
|
|
|
} elseif ($startEvent > $endEvent) { |
|
487
|
|
|
return false; |
|
488
|
|
|
} else { |
|
489
|
|
|
$firstDay = date('j', $startEvent); |
|
490
|
|
|
} |
|
491
|
|
|
|
|
492
|
|
|
if ($endEvent < $startMonth) { |
|
493
|
|
|
return false; |
|
494
|
|
|
} elseif ($endEvent > $endMonth) { |
|
495
|
|
|
$lastDay = date('j', $endMonth); |
|
|
|
|
|
|
496
|
|
|
} else { |
|
497
|
|
|
$lastDay = date('j', $endEvent); |
|
498
|
|
|
} |
|
499
|
|
|
|
|
500
|
|
|
//echo "first dat - last day : {$firstDay} - {$lastDay}<br>"; |
|
501
|
|
|
//echo $event['event_id'] . '-' . $weight .'<br>'; |
|
502
|
|
|
|
|
503
|
|
|
$d = date('j', $event['event_start']); |
|
504
|
|
|
if (isset($eventsArray[$d])) { |
|
505
|
|
|
if ($weight > $eventsArray[$d]['weight']) { |
|
506
|
|
|
$eventsArray[$d]['weight'] = $weight; |
|
507
|
|
|
$eventsArray[$d]['color'] = $color; |
|
508
|
|
|
} |
|
509
|
|
|
} else { |
|
510
|
|
|
$eventsArray[$d]['hasEvent'] = true; |
|
511
|
|
|
$eventsArray[$d]['weight'] = $weight; |
|
512
|
|
|
$eventsArray[$d]['color'] = $color; |
|
513
|
|
|
} |
|
514
|
|
|
/* |
|
515
|
|
|
for ($i = $firstDay; $i <= $lastDay; ++$i) { |
|
516
|
|
|
} |
|
517
|
|
|
|
|
518
|
|
|
$eventsArray[$i]['hasEvent'] = true; |
|
519
|
|
|
if (isset($eventsArray[$i]['weight'])) { |
|
520
|
|
|
if ($weight > $eventsArray[$i]['weight']) { |
|
521
|
|
|
$eventsArray[$i]['weight'] = $weight; |
|
522
|
|
|
$eventsArray[$i]['color'] = $color; |
|
523
|
|
|
} |
|
524
|
|
|
} else { |
|
525
|
|
|
$eventsArray[$i]['weight'] = $weight; |
|
526
|
|
|
$eventsArray[$i]['color'] = $color; |
|
527
|
|
|
} |
|
528
|
|
|
} |
|
529
|
|
|
*/ |
|
530
|
|
|
|
|
531
|
|
|
// $t = print_r($cats,true); |
|
532
|
|
|
// echo "<pre>{$t}</pre><hr>"; |
|
533
|
|
|
// |
|
534
|
|
|
// $t = print_r($eventsArray,true); |
|
535
|
|
|
// echo "event id = {$event['event_id']} - weight = {$weight}<br>color = {$color}<br><pre>{$t}</pre><hr>"; |
|
536
|
|
|
} |
|
537
|
|
|
|
|
538
|
|
|
/** |
|
539
|
|
|
* @param $options |
|
540
|
|
|
*/ |
|
541
|
|
|
function extcal_getDefautminicalOption(&$options) |
|
542
|
|
|
{ |
|
543
|
|
|
// 0|0|150|225|1|3|10|0|1|1,2|| |120|120 |
|
544
|
|
|
for ($h = 0; $h <= 13; ++$h) { |
|
545
|
|
|
if (!isset($options[$h])) { |
|
546
|
|
|
switch ($h) { |
|
547
|
|
|
case 0: |
|
548
|
|
|
$options[$h] = '0'; |
|
549
|
|
|
break; |
|
550
|
|
|
case 1: |
|
551
|
|
|
$options[$h] = 0; |
|
552
|
|
|
break; |
|
553
|
|
|
case 2: |
|
554
|
|
|
$options[$h] = '150'; |
|
555
|
|
|
break; |
|
556
|
|
|
case 3: |
|
557
|
|
|
$options[$h] = '255'; |
|
558
|
|
|
break; |
|
559
|
|
|
case 4: |
|
560
|
|
|
$options[$h] = '1'; |
|
561
|
|
|
break; |
|
562
|
|
|
case 5: |
|
563
|
|
|
$options[$h] = '3'; |
|
564
|
|
|
break; |
|
565
|
|
|
case 6: |
|
566
|
|
|
$options[$h] = '10'; |
|
567
|
|
|
break; |
|
568
|
|
|
case 7: |
|
569
|
|
|
$options[$h] = '0'; |
|
570
|
|
|
break; |
|
571
|
|
|
case 8: |
|
572
|
|
|
$options[$h] = '1'; |
|
573
|
|
|
break; |
|
574
|
|
|
case 9: |
|
575
|
|
|
$options[$h] = '1,2,3,4,5'; |
|
576
|
|
|
break; |
|
577
|
|
|
case 10: |
|
578
|
|
|
$options[$h] = ''; |
|
579
|
|
|
break; |
|
580
|
|
|
case 11: |
|
581
|
|
|
$options[$h] = ''; |
|
582
|
|
|
break; |
|
583
|
|
|
case 12: |
|
584
|
|
|
$options[$h] = 120; |
|
585
|
|
|
break; |
|
586
|
|
|
case 13: |
|
587
|
|
|
$options[$h] = 120; |
|
588
|
|
|
break; |
|
589
|
|
|
} |
|
590
|
|
|
} |
|
591
|
|
|
} |
|
592
|
|
|
} |
|
593
|
|
|
|