3.3.2-rc1
[phpmyadmin/madhuracj.git] / libraries / db_events.inc.php
blob9ff5f760c196341c3dd4b1c3c285a8b5bdc6ba50
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 /**
13 * Append goto to ulr_query.
15 $url_query .= '&amp;goto=db_structure.php';
17 $events = PMA_DBI_fetch_result('SELECT EVENT_NAME, EVENT_TYPE FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' . PMA_sqlAddslashes($db,true) . '\';');
19 if ($events) {
20 PMA_generate_slider_effect('events', $strEvents);
21 echo '<fieldset>' . "\n";
22 echo ' <legend>' . $strEvents . '</legend>' . "\n";
23 echo '<table border="0">';
24 echo sprintf('<tr>
25 <th>%s</th>
26 <th>&nbsp;</th>
27 <th>&nbsp;</th>
28 <th>%s</th>
29 </tr>',
30 $strName,
31 $strType);
32 $ct=0;
33 $delimiter = '//';
34 foreach ($events as $event) {
36 // information_schema (at least in MySQL 5.1.22) does not return
37 // the full CREATE EVENT statement in a way that could be useful for us
38 // so we rely on PMA_DBI_get_definition() which uses SHOW CREATE EVENT
40 $definition = 'DROP EVENT ' . PMA_backquote($event['EVENT_NAME']) . $delimiter . "\n"
41 . PMA_DBI_get_definition($db, 'EVENT', $event['EVENT_NAME'])
42 . "\n";
44 $sqlDrop = 'DROP EVENT ' . PMA_backquote($event['EVENT_NAME']);
45 echo sprintf('<tr class="%s">
46 <td><strong>%s</strong></td>
47 <td>%s</td>
48 <td>%s</td>
49 <td>%s</td>
50 </tr>',
51 ($ct%2 == 0) ? 'even' : 'odd',
52 $event['EVENT_NAME'],
53 ! empty($definition) ? PMA_linkOrButton('db_sql.php?' . $url_query . '&amp;sql_query=' . urlencode($definition) . '&amp;show_query=1&amp;delimiter=' . urlencode($delimiter), $titles['Structure']) : '&nbsp;',
54 '<a href="sql.php?' . $url_query . '&amp;sql_query=' . urlencode($sqlDrop) . '" onclick="return confirmLink(this, \'' . PMA_jsFormat($sqlDrop, false) . '\')">' . $titles['Drop'] . '</a>',
55 $event['EVENT_TYPE']);
56 $ct++;
58 echo '</table>';
59 echo '</fieldset>' . "\n";
60 echo '</div>' . "\n";