NEW hidden conf to set nb weeks to show into user view

This commit is contained in:
Alexis Algoud 2018-03-10 16:46:57 +01:00
parent 96aaeb2fd0
commit 129c032118

View File

@ -245,7 +245,9 @@ $next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
$nb_weeks_to_show = !empty($conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER) ? (int)$conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER * 7 : 7;
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, $nb_weeks_to_show, 'd');
//print $firstday.'-'.$first_month.'-'.$first_year; //print $firstday.'-'.$first_month.'-'.$first_year;
//print dol_print_date($firstdaytoshow,'dayhour'); //print dol_print_date($firstdaytoshow,'dayhour');
//print dol_print_date($lastdaytoshow,'dayhour'); //print dol_print_date($lastdaytoshow,'dayhour');
@ -465,7 +467,7 @@ if ($filtert > 0 || $usergroup > 0)
} }
// Sort on date // Sort on date
$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action $sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
//print $sql;exit;
dol_syslog("comm/action/peruser.php", LOG_DEBUG); dol_syslog("comm/action/peruser.php", LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);
@ -619,8 +621,11 @@ echo '<input type="hidden" name="newdate" id="newdate">' ;
//print "begin_d=".$begin_d." end_d=".$end_d; //print "begin_d=".$begin_d." end_d=".$end_d;
$currentdaytoshow = $firstdaytoshow;
echo '<div class="div-table-responsive">'; echo '<div class="div-table-responsive">';
while($currentdaytoshow<$lastdaytoshow) {
echo '<table width="100%" class="noborder nocellnopadd cal_month">'; echo '<table width="100%" class="noborder nocellnopadd cal_month">';
echo '<tr class="liste_titre">'; echo '<tr class="liste_titre">';
@ -636,8 +641,8 @@ while ($i < 7)
echo '<td align="center" colspan="'.($end_h - $begin_h).'">'; echo '<td align="center" colspan="'.($end_h - $begin_h).'">';
echo $langs->trans("Day".(($i+(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)) % 7)); echo $langs->trans("Day".(($i+(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)) % 7));
print "<br>"; print "<br>";
if ($i) print dol_print_date(dol_time_plus_duree($firstdaytoshow, $i, 'd'),'day'); if ($i) print dol_print_date(dol_time_plus_duree($currentdaytoshow, $i, 'd'),'day');
else print dol_print_date($firstdaytoshow,'day'); else print dol_print_date($currentdaytoshow,'day');
echo "</td>\n"; echo "</td>\n";
$i++; $i++;
} }
@ -768,6 +773,7 @@ foreach ($usernames as $username)
$i = 0; $i = 0;
for ($iter_day = 0; $iter_day < 8; $iter_day++) for ($iter_day = 0; $iter_day < 8; $iter_day++)
{ {
if (($i + 1) < $begin_d || ($i + 1) > $end_d) if (($i + 1) < $begin_d || ($i + 1) > $end_d)
{ {
$i++; $i++;
@ -775,7 +781,7 @@ foreach ($usernames as $username)
} }
// Show days of the current week // Show days of the current week
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); $curtime = dol_time_plus_duree($currentdaytoshow, $iter_day, 'd');
$tmparray = dol_getdate($curtime,'fast'); $tmparray = dol_getdate($curtime,'fast');
$tmpday = $tmparray['mday']; $tmpday = $tmparray['mday'];
$tmpmonth = $tmparray['mon']; $tmpmonth = $tmparray['mon'];
@ -796,6 +802,12 @@ foreach ($usernames as $username)
} }
echo "</table>\n"; echo "</table>\n";
echo "<br />";
$currentdaytoshow = dol_time_plus_duree($currentdaytoshow, 7, 'd');
}
echo '</div>'; echo '</div>';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE))