display message when search returns zero rows
[phpmyadmin/dkf.git] / libraries / db_events.inc.php
blob8204770214485ee0af34449871d40e43fb53ce65
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin
6 */
7 if (! defined('PHPMYADMIN')) {
8 exit;
11 /**
12 * Append goto to ulr_query.
14 $url_query .= '&amp;goto=db_structure.php';
16 $events = PMA_DBI_fetch_result('SELECT EVENT_NAME, EVENT_TYPE FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' . PMA_sqlAddslashes($db,true) . '\';');
18 if ($events) {
19 PMA_generate_slider_effect('events', __('Events'));
20 echo '<fieldset>' . "\n";
21 echo ' <legend>' . __('Events') . '</legend>' . "\n";
22 echo '<table border="0">';
23 echo sprintf('<tr>
24 <th>%s</th>
25 <th>&nbsp;</th>
26 <th>&nbsp;</th>
27 <th>%s</th>
28 </tr>',
29 __('Name'),
30 __('Type'));
31 $ct=0;
32 $delimiter = '//';
33 foreach ($events as $event) {
35 // information_schema (at least in MySQL 5.1.22) does not return
36 // the full CREATE EVENT statement in a way that could be useful for us
37 // so we rely on PMA_DBI_get_definition() which uses SHOW CREATE EVENT
39 $definition = 'DROP EVENT ' . PMA_backquote($event['EVENT_NAME']) . $delimiter . "\n"
40 . PMA_DBI_get_definition($db, 'EVENT', $event['EVENT_NAME'])
41 . "\n";
43 $sqlDrop = 'DROP EVENT ' . PMA_backquote($event['EVENT_NAME']);
44 echo sprintf('<tr class="%s">
45 <td><strong>%s</strong></td>
46 <td>%s</td>
47 <td>%s</td>
48 <td>%s</td>
49 </tr>',
50 ($ct%2 == 0) ? 'even' : 'odd',
51 $event['EVENT_NAME'],
52 ! 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;',
53 '<a class="drop_event_anchor" href="sql.php?' . $url_query . '&amp;sql_query=' . urlencode($sqlDrop) . '" >' . $titles['Drop'] . '</a>',
54 $event['EVENT_TYPE']);
55 $ct++;
57 echo '</table>';
58 echo '</fieldset>' . "\n";
59 echo '</div>' . "\n";