';
$htmlOutput .= '';
// we do validation on page refresh when browser remembers field values,
// add a field with known value which will be used for checks
if (! $has_check_page_refresh) {
$has_check_page_refresh = true;
$htmlOutput .= '' . "\n";
}
$htmlOutput .= PMA_URL_getHiddenInputs('', '', 0, 'server') . "\n";
$htmlOutput .= PMA_getHiddenFields((array)$hidden_fields);
return $htmlOutput;
}
/**
* Displays form tabs which are given by an array indexed by fieldset id
* ({@link PMA_displayFieldsetTop}), with values being tab titles.
*
* @param array $tabs tab names
*
* @return string
*/
function PMA_displayTabsTop($tabs)
{
$items = array();
foreach ($tabs as $tab_id => $tab_name) {
$items[] = array(
'content' => htmlspecialchars($tab_name),
'url' => array(
'href' => '#' . $tab_id,
),
);
}
$htmlOutput = Template::get('list/unordered')->render(
array(
'class' => 'tabs',
'items' => $items,
)
);
$htmlOutput .= ' ';
$htmlOutput .= '
';
return $htmlOutput;
}
/**
* Displays top part of a fieldset
*
* @param string $title title of fieldset
* @param string $description description shown on top of fieldset
* @param array $errors error messages to display
* @param array $attributes optional extra attributes of fieldset
*
* @return string
*/
function PMA_displayFieldsetTop($title = '', $description = '', $errors = null,
$attributes = array()
) {
global $_FormDisplayGroup;
$_FormDisplayGroup = 0;
$attributes = array_merge(array('class' => 'optbox'), $attributes);
foreach ($attributes as $k => &$attr) {
$attr = $k . '="' . htmlspecialchars($attr) . '"';
}
$htmlOutput = '';
return $htmlOutput;
}
/**
* Displays simple bottom part of a fieldset (without submit buttons)
*
* @return string
*/
function PMA_displayFieldsetBottomSimple()
{
$htmlOutput = '';
$htmlOutput .= '';
return $htmlOutput;
}
/**
* Closes form tabs
*
* @return string
*/
function PMA_displayTabsBottom()
{
$htmlOutput = "
\n";
return $htmlOutput;
}
/**
* Displays bottom part of the form
*
* @return string
*/
function PMA_displayFormBottom()
{
$htmlOutput = "\n";
return $htmlOutput;
}
/**
* Appends JS validation code to $js_array
*
* @param string $field_id ID of field to validate
* @param string|array $validators validators callback
* @param array &$js_array will be updated with javascript code
*
* @return void
*/
function PMA_addJsValidate($field_id, $validators, &$js_array)
{
foreach ((array)$validators as $validator) {
$validator = (array)$validator;
$v_name = array_shift($validator);
$v_name = "PMA_" . $v_name;
$v_args = array();
foreach ($validator as $arg) {
$v_args[] = PMA_escapeJsString($arg);
}
$v_args = $v_args ? ", ['" . implode("', '", $v_args) . "']" : '';
$js_array[] = "validateField('$field_id', '$v_name', true$v_args)";
}
}
/**
* Displays JavaScript code
*
* @param array $js_array lines of javascript code
*
* @return string
*/
function PMA_displayJavascript($js_array)
{
if (empty($js_array)) {
return null;
}
return Template::get('javascript/display')->render(
array('js_array' => $js_array,)
);
}
/**
* Displays error list
*
* @param string $name name of item with errors
* @param array $error_list list of errors to show
*
* @return string HTML for errors
*/
function PMA_displayErrors($name, $error_list)
{
$htmlOutput = '
';
$htmlOutput .= '
' . htmlspecialchars($name) . '
';
foreach ($error_list as $error) {
$htmlOutput .= '