Merge branch 'QA_3_3'
[phpmyadmin/dkf.git] / libraries / tbl_triggers.lib.php
blobd397b3c2ef4f02a805bd9934bee0f9870cd03c19
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 $url_query .= '&amp;goto=tbl_structure.php';
14 $triggers = PMA_DBI_get_triggers($db, $table);
16 if ($triggers) {
17 echo '<div id="tabletriggers">' . "\n";
18 echo '<table class="data">' . "\n";
19 echo ' <caption class="tblHeaders">' . __('Triggers') . '</caption>' . "\n";
20 echo sprintf('<tr>
21 <th>%s</th>
22 <th>&nbsp;</th>
23 <th>&nbsp;</th>
24 <th>%s</th>
25 <th>%s</th>
26 </tr>',
27 __('Name'),
28 __('Time'),
29 __('Event'));
30 $ct=0;
31 $delimiter = '//';
32 foreach ($triggers as $trigger) {
33 $drop_and_create = $trigger['drop'] . $delimiter . "\n" . $trigger['create'] . "\n";
35 echo sprintf('<tr class="%s">
36 <td><strong>%s</strong></td>
37 <td>%s</td>
38 <td>%s</td>
39 <td>%s</td>
40 <td>%s</td>
41 </tr>',
42 ($ct%2 == 0) ? 'even' : 'odd',
43 $trigger['name'],
44 PMA_linkOrButton('tbl_sql.php?' . $url_query . '&amp;sql_query=' . urlencode($drop_and_create) . '&amp;show_query=1&amp;delimiter=' . urlencode($delimiter), $titles['Change']),
45 '<a href="sql.php?' . $url_query . '&sql_query=' . urlencode($trigger['drop']) . '" onclick="return confirmLink(this, \'' . PMA_jsFormat($trigger['drop'], false) . '\')">' . $titles['Drop'] . '</a>',
46 $trigger['action_timing'],
47 $trigger['event_manipulation']);
48 $ct++;
50 echo '</table>';
51 echo '</div>' . "\n";