| |
---|
| | foreach ($words as $wordInLine) { |
---|
| | // Check if the word contains "#takeout" (case-insensitive) |
---|
| | if (stripos($wordInLine, "#$filter") !== false) { |
---|
| | $wordFound = true; |
---|
| | //echo "found: $line\n"; |
---|
| | break; |
---|
| | } |
---|
| | } |
---|
| | |
---|
| |
---|
| | |
---|
| | foreach ($dateOccurrences as $date => $count) { |
---|
| | // Convert each date to the format $year-$weekNo |
---|
| | $dateTime = new DateTime($date); |
---|
| | $dateTime->modify('this week sunday'); // Set to Sunday of the current week |
---|
| | $yearWeek = $dateTime->format('Y-m-W'); |
---|
| | |
---|
| | // Add +1 for each date converted into $year-$weekNo as a key |
---|
| | if (isset($weeklyOccurrences[$yearWeek])) { |
---|
| |
---|
| | // Populate the dateOccurrences array |
---|
| | if ($date !== null) { |
---|
| | // Calculate the difference in weeks |
---|
| | // Check if the date is within the last 10 weeks |
---|
| | if (strtotime($date) < strtotime('-9 weeks')) { |
---|
| | if (strtotime($date) < strtotime('-11 weeks')) { |
---|
| | continue; |
---|
| | } |
---|
| | } |
---|
| | // Populate the dateOccurrences array |
---|
| |
---|
| | |
---|
| | foreach ($dateOccurrences as $date => $count) { |
---|
| | // Convert each date to the format $year-$weekNo |
---|
| | $dateTime = new DateTime($date); |
---|
| | $dateTime->modify('this week sunday'); // Set to Sunday of the current week |
---|
| | $yearWeek = $dateTime->format('Y-m-W'); |
---|
| | |
---|
| | // Add +1 for each date converted into $year-$weekNo as a key |
---|
| | if (isset($weeklyOccurrences[$yearWeek])) { |
---|
| |
---|
| | |
---|
| | foreach ($dateOccurrences as $date => $count) { |
---|
| | // Convert each date to the format $year-$weekNo |
---|
| | $dateTime = new DateTime($date); |
---|
| | $yearWeek = $dateTime->format('Y-W'); |
---|
| | $dateTime->modify('this week sunday'); // Set to Sunday of the current week |
---|
| | $yearWeek = $dateTime->format('Y-m-W'); |
---|
| | |
---|
| | // Add +1 for each date converted into $year-$weekNo as a key |
---|
| | if (isset($weeklyOccurrences[$yearWeek])) { |
---|
| | $weeklyOccurrences[$yearWeek]++; |
---|
| |
---|
| | $today = new DateTime(); |
---|
| | $currentDate = date('Y-m-d'); |
---|
| | |
---|
| | while (strtotime($first) <= strtotime($currentDate)) { |
---|
| | $dateTime = new DateTime($currentDate); |
---|
| | $yearWeekKey = $dateTime->format('Y-W'); |
---|
| | $weeklyOccurrences[$yearWeekKey] = 0; |
---|
| | $dateTime = new DateTime($date); |
---|
| | $dateTime->modify('this week sunday'); // Set to Sunday of the current week |
---|
| | $yearWeek = $dateTime->format('Y-m-W'); |
---|
| | $weeklyOccurrences[$yearWeek] = 0; |
---|
| | //echo $yearWeekKey; |
---|
| | $currentDate = date('Y-m-d', strtotime($currentDate . ' -1 day')); |
---|
| | } |
---|
| | |
---|
| | |
---|
| | $consecutiveCount = 0; |
---|
| | $maxConsecutiveCount = 0; |
---|
| | |
---|
| | //ksort($weeklyOccurrences); |
---|
| | ksort($weeklyOccurrences); |
---|
| | |
---|
| | foreach ($weeklyOccurrences as $week => $value) { |
---|
| | if ($value >= $multiplier) { |
---|
| | $consecutiveCount++; |
---|
| |
---|
| | function create_new_weekly_cal(){ |
---|
| | $calHTML = ""; |
---|
| | // Get current date |
---|
| | $currentDate = new \DateTime(); |
---|
| | $currentDate->modify('this week sunday'); |
---|
| | // Create an array to store months |
---|
| | $months = []; |
---|
| | |
---|
| | |
---|
| | // Loop through the current month to 23 months ago and store in the array |
---|
| | for ($i = 0; $i < 23; $i++) { |
---|
| | $year = $currentDate->format('Y'); |
---|
| |
---|
| | // Loop through the months array to output the grid |
---|
| | foreach ($months as $monthData) { |
---|
| | $year = $monthData['year']; |
---|
| | $month = $monthData['month']; |
---|
| | $lastDay = date('t', strtotime("$year-$month-01")); |
---|
| | $isoWeeksInMonth = $monthData['isoWeeks']; |
---|
| | |
---|
| | $calHTML .= '<div class="month">'; |
---|
| | //echo "<h3>{$year}-{$month}</h3>"; |
---|
| | $calHTML .= '<div class="week-container">'; |
---|
| | |
---|
| | // Keep the last ISO week if it's December and the last day is Sunday |
---|
| | if ($month === '12' && isSunday(new \DateTime("$year-$month-31"))) { |
---|
| | foreach ($isoWeeksInMonth as $isoWeek) { |
---|
| | $calHTML .= "<div class='week' id='{$year}-{$month}-{$isoWeek}' title='{$year}-{$month}, Week {$isoWeek}'></div>"; |
---|
| | } |
---|
| | } else if( isSunday(new \DateTime("$year-$month-$lastDay")) ){ |
---|
| | foreach ($isoWeeksInMonth as $isoWeek) { |
---|
| | $calHTML .= "<div class='week' id='{$year}-{$month}-{$isoWeek}' title='{$year}-{$month}, Week {$isoWeek}'></div>"; |
---|
| | } |
---|
| | } else { |
---|
| |
---|
| | |