getFilterDatesInterval((string) $filters['dates'], $local = true, $sql = false); if ($fromDt && $toDt) { $fromYmd = date('Y-m-01', strtotime($fromDt)); $toYmd = date('Y-m-t', strtotime($toDt)); } } // build the pool of month tasks $monthTasks = []; if ($areaIds) { // save current filters in the user state JFactory::getApplication()->setUserState('vbo.tm.filters', $filters); // load tasks according to filters, by always forcing/injecting the area IDs and the dates foreach (VBOTaskModelTask::getInstance()->filterItems(array_merge($filters, ['id_areas' => $areaIds, 'dates' => $fromYmd . ':' . $toYmd]), 0, 0) as $taskRecord) { // wrap task record into a registry $task = VBOTaskTaskregistry::getInstance((array) $taskRecord); // get task due date in Y-m-d format $due_date_key = $task->getDueDate($local = true, $format = 'Y-m-d'); if ($due_date_key) { // start a container for this date $monthTasks[$due_date_key] = $monthTasks[$due_date_key] ?? []; // push task registry for this day $monthTasks[$due_date_key][] = $task; } } } // obtain the current month information $monthDate = getdate(strtotime($fromYmd)); $monthIter = $monthDate; // get navigation dates $todayYmd = date('Y-m-d'); $monthBack = date('Y-m-01', strtotime('-1 month', $monthDate[0])); $monthNext = date('Y-m-01', strtotime('+1 month', $monthDate[0])); $monthToday = date('Y-m-01'); // build week-day indexes $firstwday = (int) VikBooking::getFirstWeekDay(); $days_indexes = []; $wday_labels = [ JText::translate('VBSUN'), JText::translate('VBMON'), JText::translate('VBTUE'), JText::translate('VBWED'), JText::translate('VBTHU'), JText::translate('VBFRI'), JText::translate('VBSAT'), ]; for ($d = 0; $d < 7; $d++) { $days_indexes[$d] = (6-($firstwday-$d)+1)%7; } ?>