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