From 38ed033b8a96a86ef1238cf0314526796cff2666 Mon Sep 17 00:00:00 2001 From: kev-73 <69631660+kev-73@users.noreply.github.com> Date: Thu, 3 Sep 2020 14:03:40 +0200 Subject: [PATCH] New: add week number for month view in agenda Agenda, view by month : add a column on left side of agenda, which containt the week number for each line, so for each week. Column width at 2%, no change for width of others columns, because with 14% by defalut, so 14*7=98, the 2% for new column is available. For get date and week number, use fonctions and variables already define in file. --- htdocs/comm/action/index.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index dd29d84cbc3..8742e4d91af 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1210,6 +1210,8 @@ if (empty($action) || $action == 'show_month') // View by month print '
'; print ''; print ' '; + // Column title of weeks numbers + echo ' '; $i = 0; while ($i < 7) { @@ -1232,6 +1234,24 @@ if (empty($action) || $action == 'show_month') // View by month //var_dump($eventarray); for ($iter_week = 0; $iter_week < 6; $iter_week++) { echo " \n"; + // Get date of the current day, format 'yyyy-mm-dd' + if ($tmpday <= 0) // If number of the current day is in previous month + { + $currdate0 = sprintf("%04d", $prev_year).sprintf("%02d", $prev_month).sprintf("%02d", $max_day_in_prev_month + $tmpday); + } + elseif ($tmpday <= $max_day_in_month) // If number of the current day is in current month + { + $currdate0 = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $tmpday); + } + else // If number of the current day is in next month + { + $currdate0 = sprintf("%04d", $next_year).sprintf("%02d", $next_month).sprintf("%02d", $tmpday - $max_day_in_month); + } + // Get week number for the targeted date '$currdate0' + $numweek0 = date("W", strtotime(date($currdate0))); + // Show the week number, and define column width + echo ' '; + for ($iter_day = 0; $iter_day < 7; $iter_day++) { if ($tmpday <= 0) { /* Show days before the beginning of the current month (previous month) */
#
'.$numweek0.'