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.
This commit is contained in:
kev-73 2020-09-03 14:03:40 +02:00 committed by GitHub
parent 2a4f0fc034
commit 38ed033b8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1210,6 +1210,8 @@ if (empty($action) || $action == 'show_month') // View by month
print '<div class="div-table-responsive-no-min">';
print '<table width="100%" class="noborder nocellnopadd cal_pannel cal_month">';
print ' <tr class="liste_titre">';
// Column title of weeks numbers
echo ' <td align="center">#</td>';
$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 " <tr>\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 ' <td align="center" width="2.0%">'.$numweek0.'</td>';
for ($iter_day = 0; $iter_day < 7; $iter_day++) {
if ($tmpday <= 0) {
/* Show days before the beginning of the current month (previous month) */