2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Common functions for generating the footer for Routines, Triggers and Events.
8 if (! defined('PHPMYADMIN')) {
13 * Creates a fieldset for adding a new item, if the user has the privileges.
15 * @param string $docu String used to create a link to the MySQL docs
16 * @param string $priv Privilege to check for adding a new item
17 * @param string $name MySQL name of the item
19 * @return string An HTML snippet with the link to add a new item
21 function PMA_RTE_getFooterLinks($docu, $priv, $name)
23 global $db, $url_query, $ajax_class;
25 $icon = 'b_' . strtolower($name) . '_add.png';
27 $retval .= "<!-- ADD " . $name . " FORM START -->\n";
28 $retval .= "<fieldset class='left'>\n";
29 $retval .= " <legend>" . __('New'). "</legend>\n";
30 $retval .= " <div class='wrap'>\n";
31 if (PMA_currentUserHasPrivilege($priv, $db)) {
32 $retval .= " <a {$ajax_class['add']} ";
33 $retval .= "href='db_" . strtolower($name) . "s.php";
34 $retval .= "?$url_query&add_item=1'>";
35 $retval .= PMA_getIcon($icon);
36 $retval .= PMA_RTE_getWord('add') . "</a>\n";
38 $retval .= " " . PMA_getIcon($icon);
39 $retval .= PMA_RTE_getWord('no_create') . "\n";
41 $retval .= " " . PMA_showMySQLDocu('SQL-Syntax', $docu) . "\n";
42 $retval .= " </div>\n";
43 $retval .= "</fieldset>\n";
44 $retval .= "<!-- ADD " . $name . " FORM END -->\n\n";
47 } // end PMA_RTE_getFooterLinks()
50 * Creates a fieldset for adding a new routine, if the user has the privileges.
52 * @return string HTML code with containing the fotter fieldset
54 function PMA_RTN_getFooterLinks()
56 return PMA_RTE_getFooterLinks('CREATE_PROCEDURE', 'CREATE ROUTINE', 'ROUTINE');
57 }// end PMA_RTN_getFooterLinks()
60 * Creates a fieldset for adding a new trigger, if the user has the privileges.
62 * @return string HTML code with containing the fotter fieldset
64 function PMA_TRI_getFooterLinks()
66 return PMA_RTE_getFooterLinks('CREATE_TRIGGER', 'TRIGGER', 'TRIGGER');
67 } // end PMA_TRI_getFooterLinks()
70 * Creates a fieldset for adding a new event, if the user has the privileges.
72 * @return string HTML code with containing the fotter fieldset
74 function PMA_EVN_getFooterLinks()
76 global $db, $url_query, $ajax_class;
79 * For events, we show the usual 'Add event' form and also
80 * a form for toggling the state of the event scheduler
82 // Init options for the event scheduler toggle functionality
83 $es_state = PMA_DBI_fetch_value(
84 "SHOW GLOBAL VARIABLES LIKE 'event_scheduler'",
88 $es_state = strtolower($es_state);
92 'value' => "SET GLOBAL event_scheduler=\"OFF\"",
93 'selected' => ($es_state != 'on')
97 'value' => "SET GLOBAL event_scheduler=\"ON\"",
98 'selected' => ($es_state == 'on')
102 $retval = "<!-- FOOTER LINKS START -->\n";
103 $retval .= "<div class='doubleFieldset'>\n";
104 // show the usual footer
105 $retval .= PMA_RTE_getFooterLinks('CREATE_EVENT', 'EVENT', 'EVENT');
106 $retval .= " <fieldset class='right'>\n";
107 $retval .= " <legend>\n";
108 $retval .= " " . __('Event scheduler status') . "\n";
109 $retval .= " </legend>\n";
110 $retval .= " <div class='wrap'>\n";
111 // show the toggle button
112 $retval .= PMA_toggleButton(
113 "sql.php?$url_query&goto=db_events.php" . urlencode("?db=$db"),
116 'PMA_slidingMessage(data.sql_query);'
118 $retval .= " </div>\n";
119 $retval .= " </fieldset>\n";
120 $retval .= " <div style='clear: both;'></div>\n";
122 $retval .= "<!-- FOOTER LINKS END -->\n";
125 } // end PMA_EVN_getFooterLinks()