Esempio n. 1
0
if (!$user->rights->holiday->read_all) {
    accessforbidden();
}
$year = GETPOST('year');
if (empty($year)) {
    $tmpdate = dol_getdate(dol_now());
    $year = $tmpdate['year'];
}
$langs->load('users');
/*
 * View
 */
$cp = new Holiday($db);
llxHeader(array(), $langs->trans('CPTitreMenu') . ' (' . $langs->trans("Year") . ' ' . $year . ')');
// Recent changes are more important than old changes
$log_holiday = $cp->fetchLog('ORDER BY cpl.rowid DESC', " AND date_action BETWEEN '" . $db->idate(dol_get_first_day($year, 1, 1)) . "' AND '" . $db->idate(dol_get_last_day($year, 12, 1)) . "'");
// Load $cp->logs
print load_fiche_titre($langs->trans('LogCP'), '<div class="pagination"><ul><li class="pagination"><a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year - 1) . '">&lt;</a><li class="pagination"><a href="">' . $langs->trans("Year") . ' ' . $year . '</a></li><li class="pagination"><a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year + 1) . '">&gt;</a></li></lu></div>', 'title_hrm.png');
print '<div class="info">' . $langs->trans('LastUpdateCP') . ': ' . "\n";
if ($cp->getConfCP('lastUpdate')) {
    print '<strong>' . dol_print_date($db->jdate($cp->getConfCP('lastUpdate')), 'dayhour', 'tzuser') . '</strong>';
} else {
    print $langs->trans('None');
}
print "</div><br>\n";
print '<table class="noborder" width="100%">';
print '<tbody>';
print '<tr class="liste_titre">';
print '<td class="liste_titre">' . $langs->trans('ID') . '</td>';
print '<td class="liste_titre" align="center">' . $langs->trans('Date') . '</td>';
print '<td class="liste_titre">' . $langs->trans('ActionByCP') . '</td>';
// Protection if external user
if ($user->societe_id > 0) {
    accessforbidden();
}
// Si l'utilisateur n'a pas le droit de lire cette page
if (!$user->rights->holiday->view_log) {
    accessforbidden();
}
/*
 * View
 */
$langs->load('users');
llxHeader(array(), $langs->trans('CPTitreMenu'));
$cp = new Holiday($db);
// Recent changes are more important than old changes
$log_holiday = $cp->fetchLog('ORDER BY cpl.rowid DESC', '');
print_fiche_titre($langs->trans('LogCP'));
print '<table class="noborder" width="100%">';
print '<tbody>';
print '<tr class="liste_titre">';
print '<td class="liste_titre">' . $langs->trans('ID') . '</td>';
print '<td class="liste_titre" align="center">' . $langs->trans('Date') . '</td>';
print '<td class="liste_titre">' . $langs->trans('ActionByCP') . '</td>';
print '<td class="liste_titre">' . $langs->trans('UserUpdateCP') . '</td>';
print '<td class="liste_titre">' . $langs->trans('Description') . '</td>';
print '<td class="liste_titre" align="right">' . $langs->trans('PrevSoldeCP') . '</td>';
print '<td class="liste_titre" align="right">' . $langs->trans('NewSoldeCP') . '</td>';
print '</tr>';
$var = true;
foreach ($cp->logs as $logs_CP) {
    $var = !$var;