'
. '
'
. PMA_URL_getHiddenInputs($db, $table)
. ' '
. ' ';
if (isset($_REQUEST['rownumber'])) {
$output .= ' ';
}
$output .= ''
. '' . __('Search:') . ' '
. ' '
. ' '
. ' '
. '' . $gotopage . ' '
. '' . $showall . ' '
. ' '
. '';
$output .= '';
if (!is_array($foreignData['disp_row'])) {
$output .= ''
. '
';
return $output;
}
$header = '
' . __('Keyname') . '
' . __('Description') . '
' . __('Description') . '
' . __('Keyname') . '
';
$output .= '' . $header . ' ' . "\n"
. '' . $header . ' ' . "\n"
. '' . "\n";
$descriptions = array();
$keys = array();
foreach ($foreignData['disp_row'] as $relrow) {
if ($foreignData['foreign_display'] != false) {
$descriptions[] = $relrow[$foreignData['foreign_display']];
} else {
$descriptions[] = '';
}
$keys[] = $relrow[$foreignData['foreign_field']];
}
asort($keys);
$hcount = 0;
$odd_row = true;
$indexByDescription = 0;
// whether the keyname corresponds to the selected value in the form
$rightKeynameIsSelected = false;
$leftKeynameIsSelected = false;
foreach ($keys as $indexByKeyname => $value) {
$hcount++;
if ($GLOBALS['cfg']['RepeatCells'] > 0
&& $hcount > $GLOBALS['cfg']['RepeatCells']
) {
$output .= $header;
$hcount = 0;
$odd_row = true;
}
// keynames and descriptions for the left section,
// sorted by keynames
$leftKeyname = $keys[$indexByKeyname];
list(
$leftDescription,
$leftDescriptionTitle
) = PMA_getDescriptionAndTitle($descriptions[$indexByKeyname]);
// keynames and descriptions for the right section,
// sorted by descriptions
$rightKeyname = $keys[$indexByDescription];
list(
$rightDescription,
$rightDescriptionTitle
) = PMA_getDescriptionAndTitle($descriptions[$indexByDescription]);
$indexByDescription++;
if (! empty($data)) {
$rightKeynameIsSelected = $rightKeyname == $data;
$leftKeynameIsSelected = $leftKeyname == $data;
}
$output .= '';
$odd_row = ! $odd_row;
$output .= PMA_getHtmlForColumnElement(
'class="nowrap"', $leftKeynameIsSelected,
$leftKeyname, $leftDescription,
$leftDescriptionTitle, $field
);
$output .= PMA_getHtmlForColumnElement(
'', $leftKeynameIsSelected, $leftKeyname,
$leftDescription, $leftDescriptionTitle, $field
);
$output .= ''
. ' ';
$output .= PMA_getHtmlForColumnElement(
'', $rightKeynameIsSelected, $leftKeyname,
$rightDescription, $rightDescriptionTitle, $field
);
$output .= PMA_getHtmlForColumnElement(
'class="nowrap"', $rightKeynameIsSelected,
$rightKeyname, $rightDescription,
$rightDescriptionTitle, $field
);
$output .= ' ';
} // end while
$output .= ' '
. '';
return $output;
}
/**
* Get the description (possibly truncated) and the title
*
* @param string $description the keyname's description
*
* @return array the new description and title
*/
function PMA_getDescriptionAndTitle($description)
{
$pmaString = $GLOBALS['PMA_String'];
$limitChars = $GLOBALS['cfg']['LimitChars'];
if ($pmaString->strlen($description) <= $limitChars) {
$description = htmlspecialchars(
$description
);
$descriptionTitle = '';
} else {
$descriptionTitle = htmlspecialchars(
$description
);
$description = htmlspecialchars(
$pmaString->substr(
$description, 0, $limitChars
)
. '...'
);
}
return array($description, $descriptionTitle);
}
/**
* Function to get html for each column element
*
* @param string $cssClass class="nowrap" or ''
* @param bool $isSelected whether current equals form's value
* @param string $keyname current key
* @param string $description current value
* @param string $title current title
* @param string $field field
*
* @return string
*/
function PMA_getHtmlForColumnElement($cssClass, $isSelected, $keyname,
$description, $title, $field
) {
$output = ''
. ($isSelected ? '' : '')
. '';
if ($cssClass !== '') {
$output .= htmlspecialchars($keyname);
} else {
$output .= $description;
}
$output .= ' ' . ($isSelected ? ' ' : '') . ' ';
return $output;
}
/**
* Function to get javascript code to handle display selection for relational
* field values
*
* @return string
*/
function PMA_getJsScriptToHandleSelectRelationalFields()
{
$element_name = PMA_getElementName();
$fieldkey = PMA_getFieldKey();
$error = PMA_getJsError();
$code = << $GLOBALS['cfg']['MaxRows'])
) {
$showall = ' ';
}
}
return $showall;
}
/**
* Function to get html for the goto page option
*
* @param array $foreignData foreign data
*
* @return string
*/
function PMA_getHtmlForGotoPage($foreignData)
{
$gotopage = '';
isset($_REQUEST['pos']) ? $pos = $_REQUEST['pos'] : $pos = 0;
if (!is_array($foreignData['disp_row'])) {
return $gotopage;
}
$session_max_rows = $GLOBALS['cfg']['MaxRows'];
$pageNow = @floor($pos / $session_max_rows) + 1;
$nbTotalPage = @ceil($foreignData['the_total'] / $session_max_rows);
if ($foreignData['the_total'] > $GLOBALS['cfg']['MaxRows']) {
$gotopage = PMA_Util::pageselector(
'pos',
$session_max_rows,
$pageNow,
$nbTotalPage,
200,
5,
5,
20,
10,
__('Page number:')
);
}
return $gotopage;
}
/**
* Function to get foreign limit
*
* @param string $foreign_navig foreign navigation
*
* @return string
*/
function PMA_getForeignLimit($foreign_navig)
{
if (isset($foreign_navig) && $foreign_navig == __('Show all')) {
return null;
}
isset($_REQUEST['pos']) ? $pos = $_REQUEST['pos'] : $pos = 0;
return 'LIMIT ' . $pos . ', ' . $GLOBALS['cfg']['MaxRows'] . ' ';
}
?>