Beispiel #1
0
    LogStats::daily($table, $year, $month);
} elseif ($year) {
    LogStats::monthly($table, $year);
} else {
    LogStats::yearly($table);
}
if ($table == 'record') {
    include_once "../model/Query/Page/Record.php";
    $logQ = new Query_Page_Record();
} else {
    include_once "../model/Query/Page/Access.php";
    $logQ = new Query_Page_Access();
    $profiles = array(OPEN_PROFILE_ADMINISTRATOR => _("Administrator"), OPEN_PROFILE_ADMINISTRATIVE => _("Administrative"), OPEN_PROFILE_DOCTOR => _("Doctor"));
}
if (!$logQ->select($year, $month, $day)) {
    $logQ->close();
    echo Msg::info(_("No logs in this date."));
    include_once "../layout/footer.php";
    exit;
}
$thead = array(_("#"), _("Access Date"), _("Login"));
if ($table == 'record') {
    $thead[] = _("Table");
    $thead[] = _("Operation");
    $thead[] = _("Data");
} else {
    $thead[] = _("Profile");
}
$options = array('align' => 'center', 0 => array('align' => 'right'));
$tbody = array();
for ($i = 1; $log = $logQ->fetch(); $i++) {
require_once "../lib/Search.php";
require_once "../lib/Check.php";
/**
 * Retrieving get vars
 */
$idUser = intval($_GET["id_user"]);
$login = Check::safeText($_GET["login"]);
$currentPage = isset($_GET["page"]) ? intval($_GET["page"]) : 1;
/**
 * Search user accesses
 */
$accessQ = new Query_Page_Access();
$accessQ->setItemsPerPage(OPEN_ITEMS_PER_PAGE);
$accessQ->searchUser($idUser, $currentPage);
if ($accessQ->getRowCount() == 0) {
    $accessQ->close();
    FlashMsg::add(sprintf(_("No logs for user %s."), $login));
    header("Location: " . $returnLocation);
    exit;
}
/**
 * Show page
 */
$title = _("Access Logs");
require_once "../layout/header.php";
/**
 * Breadcrumb
 */
$links = array(_("Admin") => "../admin/index.php", _("Users") => $returnLocation, $title => "");
echo HTML::breadcrumb($links, "icon icon_user");
unset($links);