Merge pull request #431 from xmujay/0609_monitor
[phpmyadmin/aamir.git] / server_engines.php
blobd5c3b7cd9043d1ceac9474a55b756fd3ac4d4f3b
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * display list of server engines and additional information about them
6 * @package PhpMyAdmin
7 */
9 /**
10 * requirements
12 require_once 'libraries/common.inc.php';
14 /**
15 * Does the common work
17 require 'libraries/server_common.inc.php';
18 require 'libraries/StorageEngine.class.php';
20 /**
21 * start output
23 $response = PMA_Response::getInstance();
24 $response->addHTML(PMA_getServerEnginesHtml());
26 exit;
29 /**
30 * setup HTML for server Engines information
32 * @return string
34 function PMA_getServerEnginesHtml()
36 /**
37 * Did the user request information about a certain storage engine?
39 $html = '';
40 if (empty($_REQUEST['engine'])
41 || ! PMA_StorageEngine::isValid($_REQUEST['engine'])
42 ) {
43 $html .= PMA_getAllServerEnginesHtml();
44 } else {
45 $html .= PMA_getSpecifiedServerEnginesHtml();
48 return $html;
51 /**
52 * setup HTML for server all Engines information
54 * @return string
56 function PMA_getAllServerEnginesHtml()
58 /**
59 * Displays the sub-page heading
61 $html = '<h2>' . "\n"
62 . PMA_Util::getImage('b_engine.png')
63 . "\n" . __('Storage Engines') . "\n"
64 . '</h2>' . "\n";
66 /**
67 * Displays the table header
69 $html .= '<table class="noclick">' . "\n"
70 . '<thead>' . "\n"
71 . '<tr><th>' . __('Storage Engine') . '</th>' . "\n"
72 . ' <th>' . __('Description') . '</th>' . "\n"
73 . '</tr>' . "\n"
74 . '</thead>' . "\n"
75 . '<tbody>' . "\n";
78 /**
79 * Listing the storage engines
81 $odd_row = true;
82 foreach (PMA_StorageEngine::getStorageEngines() as $engine => $details) {
83 $html .= '<tr class="'
84 . ($odd_row ? 'odd' : 'even')
85 . ($details['Support'] == 'NO' || $details['Support'] == 'DISABLED'
86 ? ' disabled' : '')
87 . '">' . "\n"
88 . ' <td><a rel="newpage" href="server_engines.php'
89 . PMA_generate_common_url(array('engine' => $engine)) . '">' . "\n"
90 . ' ' . htmlspecialchars($details['Engine']) . "\n"
91 . ' </a></td>' . "\n"
92 . ' <td>' . htmlspecialchars($details['Comment']) . '</td>' . "\n"
93 . '</tr>' . "\n";
94 $odd_row = !$odd_row;
97 unset($odd_row, $engine, $details);
98 $html .= '</tbody>' . "\n"
99 . '</table>' . "\n";
101 return $html;
105 * setup HTML for a given Storage Engine
107 * @return string
109 function PMA_getSpecifiedServerEnginesHtml()
112 * Displays details about a given Storage Engine
114 $html = '';
115 $engine_plugin = PMA_StorageEngine::getEngine($_REQUEST['engine']);
116 $html .= '<h2>' . "\n"
117 . PMA_Util::getImage('b_engine.png')
118 . ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n"
119 . ' ' . PMA_Util::showMySQLDocu('', $engine_plugin->getMysqlHelpPage())
120 . "\n" . '</h2>' . "\n\n";
121 $html .= '<p>' . "\n"
122 . ' <em>' . "\n"
123 . ' ' . htmlspecialchars($engine_plugin->getComment()) . "\n"
124 . ' </em>' . "\n"
125 . '</p>' . "\n\n";
126 $infoPages = $engine_plugin->getInfoPages();
127 if (! empty($infoPages) && is_array($infoPages)) {
128 $html .= '<p>' . "\n"
129 . ' <strong>[</strong>' . "\n";
130 if (empty($_REQUEST['page'])) {
131 $html .= ' <strong>' . __('Variables') . '</strong>' . "\n";
132 } else {
133 $html .= ' <a href="server_engines.php'
134 . PMA_generate_common_url(array('engine' => $_REQUEST['engine']))
135 . '">' . __('Variables') . '</a>' . "\n";
137 foreach ($infoPages as $current => $label) {
138 $html .= ' <strong>|</strong>' . "\n";
139 if (isset($_REQUEST['page']) && $_REQUEST['page'] == $current) {
140 $html .= ' <strong>' . $label . '</strong>' . "\n";
141 } else {
142 $html .= ' <a href="server_engines.php'
143 . PMA_generate_common_url(
144 array('engine' => $_REQUEST['engine'], 'page' => $current)
146 . '">' . htmlspecialchars($label) . '</a>' . "\n";
149 unset($current, $label);
150 $html .= ' <strong>]</strong>' . "\n"
151 . '</p>' . "\n\n";
153 unset($infoPages, $page_output);
154 if (! empty($_REQUEST['page'])) {
155 $page_output = $engine_plugin->getPage($_REQUEST['page']);
157 if (! empty($page_output)) {
158 $html .= $page_output;
159 } else {
160 $html .= '<p> ' . $engine_plugin->getSupportInformationMessage() . "\n"
161 . '</p>' . "\n"
162 . $engine_plugin->getHtmlVariables();
165 return $html;