1 | <?php
|
---|
2 | include('global.php');
|
---|
3 | include('aktuality/rss_generator.php');
|
---|
4 |
|
---|
5 | class LogShow extends Page
|
---|
6 | {
|
---|
7 | var $FullTitle = 'Zobrazení záznamu operací';
|
---|
8 | var $ShortTitle = 'Záznam operací';
|
---|
9 | var $RowPerPage = 20;
|
---|
10 |
|
---|
11 | function Show()
|
---|
12 | {
|
---|
13 | if(!$this->System->Modules['User']->CheckPermission('Log', 'Show')) return('Nemáte oprávnění');
|
---|
14 | $DbResult = $this->Database->select('Log', 'COUNT(*)');
|
---|
15 | $RowTotal = $DbResult->fetch_array();
|
---|
16 | $PageMax = $RowTotal[0];
|
---|
17 | if(array_key_exists('Page', $_GET)) $Page = $_GET['Page']; else $Page = 0;
|
---|
18 |
|
---|
19 | $Output = '<div align="center"><table class="WideTable" style="font-size: small;">';
|
---|
20 | $Output .= '<tr><th>Čas</th><th>Uživatel</th><th>Modul</th><th>Operace</th><th>Hodnota</th></tr>';
|
---|
21 | $DbResult = $this->Database->query('SELECT Log.*, `User`.`Name` as UserName FROM `Log` LEFT JOIN `User` ON `User`.`Id` = `Log`.`User` ORDER BY Time DESC LIMIT '.$Page * $this->RowPerPage.','.$this->RowPerPage);
|
---|
22 | while($DbRow = $DbResult->fetch_assoc())
|
---|
23 | {
|
---|
24 | $Output .= '<tr><td>'.$DbRow['Time'].'</td><td>'.$DbRow['UserName'].'</td><td>'.$DbRow['Module'].'</td><td>'.$DbRow['Operation'].'</td><td>'.$DbRow['Value'].'</td></tr>';
|
---|
25 | }
|
---|
26 | $Output .= '</table>';
|
---|
27 | $Output .= PagesList('?Page=', $Page, $PageMax, $this->RowPerPage);
|
---|
28 | $Output .= '</div>';
|
---|
29 | return($Output);
|
---|
30 | }
|
---|
31 | }
|
---|
32 |
|
---|
33 | if(array_key_exists('Action', $_GET))
|
---|
34 | {
|
---|
35 | if($_GET['Action'] == 'rss')
|
---|
36 | {
|
---|
37 | $DbResult = $Database->query('SELECT UNIX_TIMESTAMP(Time), Log.*, `User`.`Name` as UserName FROM `Log` LEFT JOIN `User` ON `User`.`Id` = `Log`.`User` ORDER BY Time DESC LIMIT 0, 50');
|
---|
38 | while($Row = $DbResult->fetch_assoc())
|
---|
39 | {
|
---|
40 | $Info = $Row['UserName'].': '.$Row['Module'].' '.$Row['Operation'].' '.$Row['Value'];
|
---|
41 | $Items[] = array
|
---|
42 | (
|
---|
43 | 'Title' => $Info,
|
---|
44 | 'Link' => 'http://'.$Config['Web']['Host'].'/',
|
---|
45 | 'Description' => $Info,
|
---|
46 | 'Time' => $Row['UNIX_TIMESTAMP(Time)'],
|
---|
47 | );
|
---|
48 | }
|
---|
49 | echo(GenerateRSS(array(
|
---|
50 | 'Title' => $Config['Web']['Title'].' - Záznamy operací',
|
---|
51 | 'Link' => 'http://'.$Config['Web']['Host'].'/',
|
---|
52 | 'Description' => 'Záznamy operací',
|
---|
53 | 'WebmasterEmail' => $Config['Web']['AdminEmail'],
|
---|
54 | 'Items' => $Items)));
|
---|
55 | } else
|
---|
56 | {
|
---|
57 | $System->AddModule(new LogShow());
|
---|
58 | $System->Modules['LogShow']->GetOutput();
|
---|
59 | }
|
---|
60 | } else
|
---|
61 | {
|
---|
62 | $System->AddModule(new LogShow());
|
---|
63 | $System->Modules['LogShow']->GetOutput();
|
---|
64 | }
|
---|
65 |
|
---|
66 | ?>
|
---|