-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtblhistory.php
More file actions
109 lines (85 loc) · 3.14 KB
/
Copy pathtblhistory.php
File metadata and controls
109 lines (85 loc) · 3.14 KB
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
<?php
/*
* Display the E-Maj history of a table, i.e. the table group ownership and E-Maj properties changes.
*/
// Include application functions
include_once('./libraries/lib.inc.php');
/********************************************************************************************************
* Callback functions
*******************************************************************************************************/
// Callback function to dynamicaly add an icon to each history row
function renderHistoryGraphic($val) {
global $misc;
$icon = $misc->icon($val);
$div = "<div><img src=\"$icon\" alt=\"$val\" class=\"fullsizecellicon\" /></div>";
return $div;
}
/********************************************************************************************************
* Main functions displaying pages
*******************************************************************************************************/
/**
* Show the table E-Maj history.
*/
function doDefault() {
global $data, $conf, $misc, $lang, $emajdb;
$misc->printHeader('table', 'table', 'history');
// Display the E-Maj history.
$misc->printTitle(sprintf($lang['stremajhistorytable'], $_REQUEST['schema'], $_REQUEST['table']));
$type = $emajdb->getEmajTypeTblSeq($_REQUEST['schema'], $_REQUEST['table']);
if ($type == 'L') {
echo "<p>{$lang['stremajlogtable']}</p>\n";
} elseif ($type == 'E') {
echo "<p>{$lang['stremajinternaltable']}</p>\n";
} elseif ($type == 'U') {
echo "<p>{$lang['strnotassignabletable']}</p>\n";
} else {
$events = $emajdb->getTblSeqEmajHist($_REQUEST['schema'], $_REQUEST['table']);
if ($events->recordCount() < 1) {
// There is no history to display
echo "<p>{$lang['strnoemajhistory']}</p>\n";
} else {
echo "<p>{$lang['strdescendingeventsorder']}</p>\n";
$columns = array(
'graphic' => array(
'title' => '',
'field' => field('ev_graphic'),
'type' => 'callback',
'params'=> array('function' => 'renderHistoryGraphic'),
'class' => 'nopadding center',
'filter'=> false,
),
'time' => array(
'title' => $lang['strdatetime'],
'field' => field('ev_ts'),
'type' => 'spanned',
'params'=> array(
'dateformat' => $lang['stroldtimestampformat'],
'locale' => $lang['applocale'],
'class' => 'tooltip left-aligned-tooltip',
),
),
'event' => array(
'title' => $lang['strevent'],
'field' => field('ev_text'),
),
);
$misc->printTable($events, $columns, $actions, 'tbl_emaj_history', null, null, array('sorter' => false, 'filter' => true));
}
}
echo "<hr/>\n";
}
/********************************************************************************************************
* Main piece of code
*******************************************************************************************************/
// Check that emaj and the table still exist.
$misc->onErrorRedirect('emaj');
$misc->onErrorRedirect('table');
$misc->printHtmlHeader($lang['strtables'] . ' - ' . $_REQUEST['table']);
$misc->printBody();
switch ($action) {
default:
doDefault();
break;
}
$misc->printFooter();
?>