private function _getTableBody(&$dt_result, &$displayParts, $map, $analyzed_sql_results, $is_limited_display = false)
{
global $row;
// mostly because of browser transformations,
// to make the row-data accessible in a plugin
$table_body_html = '';
// query without conditions to shorten URLs when needed, 200 is just
// guess, it should depend on remaining URL length
$url_sql_query = $this->_getUrlSqlQuery($analyzed_sql_results);
$display_params = $this->__get('display_params');
if (!is_array($map)) {
$map = array();
}
$row_no = 0;
$display_params['edit'] = array();
$display_params['copy'] = array();
$display_params['delete'] = array();
$display_params['data'] = array();
$display_params['row_delete'] = array();
$this->__set('display_params', $display_params);
// name of the class added to all grid editable elements;
// if we don't have all the columns of a unique key in the result set,
// do not permit grid editing
if ($is_limited_display || !$this->__get('editable')) {
$grid_edit_class = '';
} else {
switch ($GLOBALS['cfg']['GridEditing']) {
case 'double-click':
// trying to reduce generated HTML by using shorter
// classes like click1 and click2
$grid_edit_class = 'grid_edit click2';
break;
case 'click':
$grid_edit_class = 'grid_edit click1';
break;
default:
// 'disabled'
$grid_edit_class = '';
break;
}
}
// prepare to get the column order, if available
list($col_order, $col_visib) = $this->_getColumnParams($analyzed_sql_results);
// Correction University of Virginia 19991216 in the while below
// Previous code assumed that all tables have keys, specifically that
// the phpMyAdmin GUI should support row delete/edit only for such
// tables.
// Although always using keys is arguably the prescribed way of
// defining a relational table, it is not required. This will in
// particular be violated by the novice.
// We want to encourage phpMyAdmin usage by such novices. So the code
// below has been changed to conditionally work as before when the
// table being displayed has one or more keys; but to display
// delete/edit options correctly for tables without keys.
$whereClauseMap = $this->__get('whereClauseMap');
while ($row = $GLOBALS['dbi']->fetchRow($dt_result)) {
// add repeating headers
if ($row_no != 0 && $_SESSION['tmpval']['repeat_cells'] != 0 && !($row_no % $_SESSION['tmpval']['repeat_cells'])) {
$table_body_html .= $this->_getRepeatingHeaders($display_params);
}
$tr_class = array();
if ($GLOBALS['cfg']['BrowsePointerEnable'] != true) {
$tr_class[] = 'nopointer';
}
if ($GLOBALS['cfg']['BrowseMarkerEnable'] != true) {
$tr_class[] = 'nomarker';
}
// pointer code part
$classes = empty($tr_class) ? ' ' : 'class="' . implode(' ', $tr_class) . '"';
$table_body_html .= '<tr ' . $classes . ' >';
// 1. Prepares the row
// In print view these variable needs to be initialized
$del_url = $del_str = $edit_anchor_class = $edit_str = $js_conf = $copy_url = $copy_str = $edit_url = null;
// 1.2 Defines the URLs for the modify/delete link(s)
if ($displayParts['edit_lnk'] != self::NO_EDIT_OR_DELETE || $displayParts['del_lnk'] != self::NO_EDIT_OR_DELETE) {
// Results from a "SELECT" statement -> builds the
// WHERE clause to use in links (a unique key if possible)
/**
* @todo $where_clause could be empty, for example a table
* with only one field and it's a BLOB; in this case,
* avoid to display the delete and edit links
*/
list($where_clause, $clause_is_unique, $condition_array) = Util::getUniqueCondition($dt_result, $this->__get('fields_cnt'), $this->__get('fields_meta'), $row, false, $this->__get('table'), $analyzed_sql_results);
$whereClauseMap[$row_no][$this->__get('table')] = $where_clause;
$this->__set('whereClauseMap', $whereClauseMap);
$where_clause_html = htmlspecialchars($where_clause);
// 1.2.1 Modify link(s) - update row case
if ($displayParts['edit_lnk'] == self::UPDATE_ROW) {
list($edit_url, $copy_url, $edit_str, $copy_str, $edit_anchor_class) = $this->_getModifiedLinks($where_clause, $clause_is_unique, $url_sql_query);
}
// end if (1.2.1)
// 1.2.2 Delete/Kill link(s)
list($del_url, $del_str, $js_conf) = $this->_getDeleteAndKillLinks($where_clause, $clause_is_unique, $url_sql_query, $displayParts['del_lnk'], $row);
// 1.3 Displays the links at left if required
if ($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_LEFT || $GLOBALS['cfg']['RowActionLinks'] == self::POSITION_BOTH) {
$table_body_html .= $this->_getPlacedLinks(self::POSITION_LEFT, $del_url, $displayParts, $row_no, $where_clause, $where_clause_html, $condition_array, $edit_url, $copy_url, $edit_anchor_class, $edit_str, $copy_str, $del_str, $js_conf);
} elseif ($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_NONE) {
$table_body_html .= $this->_getPlacedLinks(self::POSITION_NONE, $del_url, $displayParts, $row_no, $where_clause, $where_clause_html, $condition_array, $edit_url, $copy_url, $edit_anchor_class, $edit_str, $copy_str, $del_str, $js_conf);
}
// end if (1.3)
}
// end if (1)
// 2. Displays the rows' values
if (is_null($this->__get('mime_map'))) {
$this->_setMimeMap();
}
$table_body_html .= $this->_getRowValues($dt_result, $row, $row_no, $col_order, $map, $grid_edit_class, $col_visib, $url_sql_query, $analyzed_sql_results);
// 3. Displays the modify/delete links on the right if required
if ($displayParts['edit_lnk'] != self::NO_EDIT_OR_DELETE || $displayParts['del_lnk'] != self::NO_EDIT_OR_DELETE) {
if ($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_RIGHT || $GLOBALS['cfg']['RowActionLinks'] == self::POSITION_BOTH) {
$table_body_html .= $this->_getPlacedLinks(self::POSITION_RIGHT, $del_url, $displayParts, $row_no, $where_clause, $where_clause_html, $condition_array, $edit_url, $copy_url, $edit_anchor_class, $edit_str, $copy_str, $del_str, $js_conf);
}
}
// end if (3)
$table_body_html .= '</tr>';
$table_body_html .= "\n";
$row_no++;
}
// end while
return $table_body_html;
}