File: activity_log.php

package info (click to toggle)
webcalendar 0.9.45-4sarge7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,888 kB
  • ctags: 4,775
  • sloc: php: 16,990; sql: 1,272; perl: 777; sh: 120; makefile: 45
file content (113 lines) | stat: -rw-r--r-- 3,588 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
include_once 'includes/init.php';
include_once 'includes/site_extras.php';
$PAGE_SIZE = 25;
print_header();

echo "<h3>" . translate("Activity Log") . "</h3>\n";

echo "<a title=\"" . translate("Admin") . "\" class=\"nav\" href=\"adminhome.php\">&laquo;&nbsp;" . translate("Admin") . "</a><br /><br />\n";

echo "<table>\n";
echo "<tr><th class=\"usr\">\n" .
  translate("User") . "</th><th class=\"cal\">\n" .
  translate("Calendar") . "</th><th class=\"scheduled\">\n" .
  translate("Date") . "/" . translate("Time") . "</th><th class=\"dsc\">\n" .
  translate("Event") . "</th><th class=\"action\">\n" .
  translate("Action") . "\n</th></tr>\n";
$sql = "SELECT webcal_entry_log.cal_login, webcal_entry_log.cal_user_cal, " .
  "webcal_entry_log.cal_type, webcal_entry_log.cal_date, " .
  "webcal_entry_log.cal_time, webcal_entry.cal_id, " .
  "webcal_entry.cal_name, webcal_entry_log.cal_log_id " .
  "FROM webcal_entry_log, webcal_entry " .
  "WHERE webcal_entry_log.cal_entry_id = webcal_entry.cal_id ";
$startid = getIntValue ( 'startid', true );
if ( ! empty ( $startid ) )
  $sql .= "AND webcal_entry_log.cal_log_id <= $startid ";
$sql .= "ORDER BY webcal_entry_log.cal_log_id DESC";
$res = dbi_query ( $sql );

$nextpage = "";

if ( $res ) {
  $num = 0;
  while ( $row = dbi_fetch_row ( $res ) ) {
    $num++;
    if ( $num > $PAGE_SIZE ) {
      $nextpage = $row[7];
      break;
    } else {
	echo "<tr";
		if ( $num % 2 ) {
			echo " class=\"odd\"";
		}
	echo "><td>\n" .
        $row[0] . "</td><td>\n" .
        $row[1] . "</td><td>\n" . 
        date_to_str ( $row[3] ) . "&nbsp;" .
        display_time ( $row[4] ) . "</td><td>\n" . 
        "<a title=\"" .
        htmlspecialchars($row[6]) . "\" href=\"view_entry.php?id=$row[5]\">" .
        htmlspecialchars($row[6]) . "</a></td><td>\n";
      if ( $row[2] == $LOG_CREATE )
        etranslate("Event created");
      else if ( $row[2] == $LOG_APPROVE )
        etranslate("Event approved");
      else if ( $row[2] == $LOG_REJECT )
        etranslate("Event rejected");
      else if ( $row[2] == $LOG_UPDATE )
        etranslate("Event updated");
      else if ( $row[2] == $LOG_DELETE )
        etranslate("Event deleted");
      else if ( $row[2] == $LOG_NOTIFICATION )
        etranslate("Notification sent");
      else if ( $row[2] == $LOG_REMINDER )
        etranslate("Reminder sent");
      else
        echo "???";
      echo "\n</td></tr>\n";
    }
  }
  dbi_free_result ( $res );
} else {
  echo translate("Database error") . ": " . dbi_error ();
}
?>
</table><br />
<div class="navigation">
<?php
//go BACK in time
if ( ! empty ( $nextpage ) ) {
  echo "<a title=\"" . 
  	translate("Previous") . "&nbsp;$PAGE_SIZE&nbsp;" . 
	translate("Events") . "\" class=\"prev\" href=\"activity_log.php?startid=$nextpage\">" . 
  	translate("Previous") . "&nbsp;$PAGE_SIZE&nbsp;" . 
	translate("Events") . "</a>\n";
}

if ( ! empty ( $startid ) ) {
  $previd = $startid + $PAGE_SIZE;
  $res = dbi_query ( "SELECT MAX(cal_log_id) FROM " .
    "webcal_entry_log" );
  if ( $res ) {
    if ( $row = dbi_fetch_row ( $res ) ) {
      if ( $row[0] <= $previd ) {
        $prevarg = '';
      } else {
        $prevarg = "?startid=$previd";
      }
      //go FORWARD in time
      echo "<a title=\"" . 
  	translate("Next") . "&nbsp;$PAGE_SIZE&nbsp;" . 
	translate("Events") . "\" class=\"next\" href=\"activity_log.php$prevarg\">" . 
  	translate("Next") . "&nbsp;$PAGE_SIZE&nbsp;" . 
	translate("Events") . "</a><br />\n";
    }
    dbi_free_result ( $res );
  }
}
?>
</div>
<?php print_trailer(); ?>
</body>
</html>