';
// 4. ----- Prepares the link for multi-fields edit and delete
if ($displayParts['del_lnk'] == self::DELETE_ROW
&& $displayParts['del_lnk'] != self::KILL_PROCESS
) {
$table_html .= $this->_getMultiRowOperationLinks(
$dt_result,
$analyzed_sql_results,
$displayParts['del_lnk']
);
}
// 5. ----- Get the navigation bar at the bottom if required -----
if (($displayParts['nav_bar'] == '1') && !is_null($statement) && empty($statement->limit)) {
$table_html .= $this->_getPlacedTableNavigations(
$pos_next, $pos_prev, self::PLACE_BOTTOM_DIRECTION_DROPDOWN,
$is_innodb, $sort_by_key_html
);
} elseif (! isset($printview) || ($printview != '1')) {
$table_html .= "\n" . '
' . "\n";
}
// 6. ----- Prepare "Query results operations"
if ((! isset($printview) || ($printview != '1')) && ! $is_limited_display) {
$table_html .= $this->_getResultsOperations(
$displayParts, $analyzed_sql_results
);
}
return $table_html;
} // end of the 'getTable()' function
/**
* Get offsets for next page and previous page
*
* @return array array with two elements - $pos_next, $pos_prev
*
* @access private
*
* @see getTable()
*/
private function _getOffsets()
{
if ($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS) {
$pos_next = 0;
$pos_prev = 0;
} else {
$pos_next = $_SESSION['tmpval']['pos']
+ $_SESSION['tmpval']['max_rows'];
$pos_prev = $_SESSION['tmpval']['pos']
- $_SESSION['tmpval']['max_rows'];
if ($pos_prev < 0) {
$pos_prev = 0;
}
}
return array($pos_next, $pos_prev);
} // end of the '_getOffsets()' function
/**
* Prepare sorted column message
*
* @param integer &$dt_result the link id associated to the
* query which results have to
* be displayed
* @param string $sort_expression_nodirection sort expression without direction
*
* @return string html content
* null if not found sorted column
*
* @access private
*
* @see getTable()
*/
private function _getSortedColumnMessage(
&$dt_result, $sort_expression_nodirection
) {
$fields_meta = $this->__get('fields_meta'); // To use array indexes
if (empty($sort_expression_nodirection)) {
return null;
}
if (mb_strpos($sort_expression_nodirection, '.') === false) {
$sort_table = $this->__get('table');
$sort_column = $sort_expression_nodirection;
} else {
list($sort_table, $sort_column)
= explode('.', $sort_expression_nodirection);
}
$sort_table = Util::unQuote($sort_table);
$sort_column = Util::unQuote($sort_column);
// find the sorted column index in row result
// (this might be a multi-table query)
$sorted_column_index = false;
foreach ($fields_meta as $key => $meta) {
if (($meta->table == $sort_table) && ($meta->name == $sort_column)) {
$sorted_column_index = $key;
break;
}
}
if ($sorted_column_index === false) {
return null;
}
// fetch first row of the result set
$row = $GLOBALS['dbi']->fetchRow($dt_result);
// initializing default arguments
$default_function = [Core::class, 'mimeDefaultFunction'];
$transformation_plugin = $default_function;
$transform_options = array();
// check for non printable sorted row data
$meta = $fields_meta[$sorted_column_index];
if (stristr($meta->type, self::BLOB_FIELD)
|| ($meta->type == self::GEOMETRY_FIELD)
) {
$column_for_first_row = $this->_handleNonPrintableContents(
$meta->type, $row[$sorted_column_index],
$transformation_plugin, $transform_options,
$default_function, $meta
);
} else {
$column_for_first_row = $row[$sorted_column_index];
}
$column_for_first_row = mb_strtoupper(
mb_substr(
$column_for_first_row, 0, $GLOBALS['cfg']['LimitChars']
) . '...'
);
// fetch last row of the result set
$GLOBALS['dbi']->dataSeek($dt_result, $this->__get('num_rows') - 1);
$row = $GLOBALS['dbi']->fetchRow($dt_result);
// check for non printable sorted row data
$meta = $fields_meta[$sorted_column_index];
if (stristr($meta->type, self::BLOB_FIELD)
|| ($meta->type == self::GEOMETRY_FIELD)
) {
$column_for_last_row = $this->_handleNonPrintableContents(
$meta->type, $row[$sorted_column_index],
$transformation_plugin, $transform_options,
$default_function, $meta
);
} else {
$column_for_last_row = $row[$sorted_column_index];
}
$column_for_last_row = mb_strtoupper(
mb_substr(
$column_for_last_row, 0, $GLOBALS['cfg']['LimitChars']
) . '...'
);
// reset to first row for the loop in _getTableBody()
$GLOBALS['dbi']->dataSeek($dt_result, 0);
// we could also use here $sort_expression_nodirection
return ' [' . htmlspecialchars($sort_column)
. ': ' . htmlspecialchars($column_for_first_row) . ' - '
. htmlspecialchars($column_for_last_row) . ']';
} // end of the '_getSortedColumnMessage()' function
/**
* Set the content that needs to be shown in message
*
* @param string $sorted_column_message the message for sorted column
* @param array $analyzed_sql_results the analyzed query
* @param integer $total the total number of rows returned by
* the SQL query without any
* programmatically appended LIMIT clause
* @param integer $pos_next the offset for next page
* @param string $pre_count the string renders before row count
* @param string $after_count the string renders after row count
*
* @return Message $message an object of Message
*
* @access private
*
* @see getTable()
*/
private function _setMessageInformation(
$sorted_column_message, array $analyzed_sql_results, $total,
$pos_next, $pre_count, $after_count
) {
$unlim_num_rows = $this->__get('unlim_num_rows'); // To use in isset()
if (!empty($analyzed_sql_results['statement']->limit)) {
$first_shown_rec = $analyzed_sql_results['statement']->limit->offset;
$row_count = $analyzed_sql_results['statement']->limit->rowCount;
if ($row_count < $total) {
$last_shown_rec = $first_shown_rec + $row_count - 1;
} else {
$last_shown_rec = $first_shown_rec + $total - 1;
}
} elseif (($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS)
|| ($pos_next > $total)
) {
$first_shown_rec = $_SESSION['tmpval']['pos'];
$last_shown_rec = $total - 1;
} else {
$first_shown_rec = $_SESSION['tmpval']['pos'];
$last_shown_rec = $pos_next - 1;
}
$table = new Table($this->__get('table'), $this->__get('db'));
if ($table->isView()
&& ($total == $GLOBALS['cfg']['MaxExactCountViews'])
) {
$message = Message::notice(
__(
'This view has at least this number of rows. '
. 'Please refer to %sdocumentation%s.'
)
);
$message->addParam('[doc@cfg_MaxExactCount]');
$message->addParam('[/doc]');
$message_view_warning = Util::showHint($message);
} else {
$message_view_warning = false;
}
$message = Message::success(__('Showing rows %1s - %2s'));
$message->addParam($first_shown_rec);
if ($message_view_warning !== false) {
$message->addParamHtml('... ' . $message_view_warning);
} else {
$message->addParam($last_shown_rec);
}
$message->addText('(');
if ($message_view_warning === false) {
if (isset($unlim_num_rows) && ($unlim_num_rows != $total)) {
$message_total = Message::notice(
$pre_count . __('%1$d total, %2$d in query')
);
$message_total->addParam($total);
$message_total->addParam($unlim_num_rows);
} else {
$message_total = Message::notice($pre_count . __('%d total'));
$message_total->addParam($total);
}
if (!empty($after_count)) {
$message_total->addHtml($after_count);
}
$message->addMessage($message_total, '');
$message->addText(', ', '');
}
$message_qt = Message::notice(__('Query took %01.4f seconds.') . ')');
$message_qt->addParam($this->__get('querytime'));
$message->addMessage($message_qt, '');
if (! is_null($sorted_column_message)) {
$message->addHtml($sorted_column_message, '');
}
return $message;
} // end of the '_setMessageInformation()' function
/**
* Set the value of $map array for linking foreign key related tables
*
* @param array &$map the list of relations
*
* @return void
*
* @access private
*
* @see getTable()
*/
private function _setParamForLinkForeignKeyRelatedTables(array &$map)
{
// To be able to later display a link to the related table,
// we verify both types of relations: either those that are
// native foreign keys or those defined in the phpMyAdmin
// configuration storage. If no PMA storage, we won't be able
// to use the "column to display" notion (for example show
// the name related to a numeric id).
$exist_rel = $this->relation->getForeigners(
$this->__get('db'), $this->__get('table'), '', self::POSITION_BOTH
);
if (! empty($exist_rel)) {
foreach ($exist_rel as $master_field => $rel) {
if ($master_field != 'foreign_keys_data') {
$display_field = $this->relation->getDisplayField(
$rel['foreign_db'], $rel['foreign_table']
);
$map[$master_field] = array(
$rel['foreign_table'],
$rel['foreign_field'],
$display_field,
$rel['foreign_db']
);
} else {
foreach ($rel as $key => $one_key) {
foreach ($one_key['index_list'] as $index => $one_field) {
$display_field = $this->relation->getDisplayField(
isset($one_key['ref_db_name'])
? $one_key['ref_db_name']
: $GLOBALS['db'],
$one_key['ref_table_name']
);
$map[$one_field] = array(
$one_key['ref_table_name'],
$one_key['ref_index_list'][$index],
$display_field,
isset($one_key['ref_db_name'])
? $one_key['ref_db_name']
: $GLOBALS['db']
);
}
}
}
} // end while
} // end if
} // end of the '_setParamForLinkForeignKeyRelatedTables()' function
/**
* Prepare multi field edit/delete links
*
* @param integer &$dt_result the link id associated to the query which
* results have to be displayed
* @param array $analyzed_sql_results analyzed sql results
* @param string $del_link the display element - 'del_link'
*
* @return string $links_html html content
*
* @access private
*
* @see getTable()
*/
private function _getMultiRowOperationLinks(
&$dt_result, array $analyzed_sql_results, $del_link
) {
$links_html = '
\n";
$links_html .= ''
. "\n";
if (! empty($url_query)) {
$links_html .= '' . "\n";
}
// fetch last row of the result set
$GLOBALS['dbi']->dataSeek($dt_result, $this->__get('num_rows') - 1);
$row = $GLOBALS['dbi']->fetchRow($dt_result);
// @see DbiMysqi::fetchRow & DatabaseInterface::fetchRow
if (! is_array($row)) {
$row = array();
}
// $clause_is_unique is needed by getTable() to generate the proper param
// in the multi-edit and multi-delete form
list($where_clause, $clause_is_unique, $condition_array)
= Util::getUniqueCondition(
$dt_result, // handle
$this->__get('fields_cnt'), // fields_cnt
$this->__get('fields_meta'), // fields_meta
$row, // row
false, // force_unique
false, // restrict_to_table
$analyzed_sql_results // analyzed_sql_results
);
unset($where_clause, $condition_array);
// reset to first row for the loop in _getTableBody()
$GLOBALS['dbi']->dataSeek($dt_result, 0);
$links_html .= '' . "\n";
$links_html .= '' . "\n";
return $links_html;
} // end of the '_getMultiRowOperationLinks()' function
/**
* Prepare table navigation bar at the top or bottom
*
* @param integer $pos_next the offset for the "next" page
* @param integer $pos_prev the offset for the "previous" page
* @param string $place the place to show navigation
* @param boolean $is_innodb whether its InnoDB or not
* @param string $sort_by_key_html the sort by key dialog
*
* @return string html content of navigation bar
*
* @access private
*
* @see _getTable()
*/
private function _getPlacedTableNavigations(
$pos_next, $pos_prev, $place, $is_innodb, $sort_by_key_html
) {
$navigation_html = '';
if ($place == self::PLACE_BOTTOM_DIRECTION_DROPDOWN) {
$navigation_html .= ' ' . "\n";
}
$navigation_html .= $this->_getTableNavigation(
$pos_next, $pos_prev, $is_innodb, $sort_by_key_html
);
if ($place == self::PLACE_TOP_DIRECTION_DROPDOWN) {
$navigation_html .= "\n";
}
return $navigation_html;
} // end of the '_getPlacedTableNavigations()' function
/**
* Generates HTML to display the Create view in span tag
*
* @param array $analyzed_sql_results analyzed sql results
* @param string $url_query String with URL Parameters
*
* @return string
*
* @access private
*
* @see _getResultsOperations()
*/
private function _getLinkForCreateView(array $analyzed_sql_results, $url_query)
{
$results_operations_html = '';
if (empty($analyzed_sql_results['procedure'])) {
$results_operations_html .= ''
. Util::linkOrButton(
'view_create.php' . $url_query,
Util::getIcon(
'b_view_add', __('Create view'), true
),
array('class' => 'create_view ajax')
)
. '' . "\n";
}
return $results_operations_html;
}
/**
* Calls the _getResultsOperations with $only_view as true
*
* @param array $analyzed_sql_results analyzed sql results
*
* @return string
*
* @access public
*
*/
public function getCreateViewQueryResultOp(array $analyzed_sql_results)
{
$results_operations_html = '';
//calling to _getResultOperations with a fake $displayParts
//and setting only_view parameter to be true to generate just view
$results_operations_html .= $this->_getResultsOperations(
array(),
$analyzed_sql_results,
true
);
return $results_operations_html;
}
/**
* Get copy to clipboard links for results operations
*
* @return string $html
*
* @access private
*/
private function _getCopytoclipboardLinks()
{
$html = Util::linkOrButton(
'#',
Util::getIcon(
'b_insrow', __('Copy to clipboard'), true
),
array('id' => 'copyToClipBoard')
);
return $html;
}
/**
* Get printview links for results operations
*
* @return string $html
*
* @access private
*/
private function _getPrintviewLinks()
{
$html = Util::linkOrButton(
'#',
Util::getIcon(
'b_print', __('Print'), true
),
array('id' => 'printView'),
'print_view'
);
return $html;
}
/**
* Get operations that are available on results.
*
* @param array $displayParts the parts to display
* @param array $analyzed_sql_results analyzed sql results
* @param boolean $only_view Whether to show only view
*
* @return string $results_operations_html html content
*
* @access private
*
* @see getTable()
*/
private function _getResultsOperations(
array $displayParts, array $analyzed_sql_results, $only_view = false
) {
global $printview;
$results_operations_html = '';
$fields_meta = $this->__get('fields_meta'); // To safe use in foreach
$header_shown = false;
$header = ' ';
}
return $results_operations_html;
}
// Displays "printable view" link if required
if ($displayParts['pview_lnk'] == '1') {
$results_operations_html .= $this->_getPrintviewLinks();
$results_operations_html .= $this->_getCopytoclipboardLinks();
} // end displays "printable view"
// Export link
// (the url_query has extra parameters that won't be used to export)
// (the single_table parameter is used in Export::getDisplay()
// to hide the SQL and the structure export dialogs)
// If the parser found a PROCEDURE clause
// (most probably PROCEDURE ANALYSE()) it makes no sense to
// display the Export link).
if (($analyzed_sql_results['querytype'] == self::QUERY_TYPE_SELECT)
&& ! isset($printview)
&& empty($analyzed_sql_results['procedure'])
) {
if (count($analyzed_sql_results['select_tables']) == 1) {
$_url_params['single_table'] = 'true';
}
if (! $header_shown) {
$results_operations_html .= $header;
$header_shown = true;
}
$_url_params['unlim_num_rows'] = $this->__get('unlim_num_rows');
/**
* At this point we don't know the table name; this can happen
* for example with a query like
* SELECT bike_code FROM (SELECT bike_code FROM bikes) tmp
* As a workaround we set in the table parameter the name of the
* first table of this database, so that tbl_export.php and
* the script it calls do not fail
*/
if (empty($_url_params['table']) && ! empty($_url_params['db'])) {
$_url_params['table'] = $GLOBALS['dbi']->fetchValue("SHOW TABLES");
/* No result (probably no database selected) */
if ($_url_params['table'] === false) {
unset($_url_params['table']);
}
}
$results_operations_html .= Util::linkOrButton(
'tbl_export.php' . Url::getCommon($_url_params),
Util::getIcon(
'b_tblexport', __('Export'), true
)
)
. "\n";
// prepare chart
$results_operations_html .= Util::linkOrButton(
'tbl_chart.php' . Url::getCommon($_url_params),
Util::getIcon(
'b_chart', __('Display chart'), true
)
)
. "\n";
// prepare GIS chart
$geometry_found = false;
// If at least one geometry field is found
foreach ($fields_meta as $meta) {
if ($meta->type == self::GEOMETRY_FIELD) {
$geometry_found = true;
break;
}
}
if ($geometry_found) {
$results_operations_html
.= Util::linkOrButton(
'tbl_gis_visualization.php'
. Url::getCommon($_url_params),
Util::getIcon(
'b_globe',
__('Visualize GIS data'),
true
)
)
. "\n";
}
}
// CREATE VIEW
/**
*
* @todo detect privileges to create a view
* (but see 2006-01-19 note in PhpMyAdmin\Display\CreateTable,
* I think we cannot detect db-specific privileges reliably)
* Note: we don't display a Create view link if we found a PROCEDURE clause
*/
if (!$header_shown) {
$results_operations_html .= $header;
$header_shown = true;
}
$results_operations_html .= $this->_getLinkForCreateView(
$analyzed_sql_results, $url_query
);
if ($header_shown) {
$results_operations_html .= ' ';
}
return $results_operations_html;
} // end of the '_getResultsOperations()' function
/**
* Verifies what to do with non-printable contents (binary or BLOB)
* in Browse mode.
*
* @param string $category BLOB|BINARY|GEOMETRY
* @param string $content the binary content
* @param mixed $transformation_plugin transformation plugin.
* Can also be the default function:
* Core::mimeDefaultFunction
* @param string $transform_options transformation parameters
* @param string $default_function default transformation function
* @param object $meta the meta-information about the field
* @param array $url_params parameters that should go to the
* download link
* @param boolean &$is_truncated the result is truncated or not
*
* @return mixed string or float
*
* @access private
*
* @see _getDataCellForGeometryColumns(),
* _getDataCellForNonNumericColumns(),
* _getSortedColumnMessage()
*/
private function _handleNonPrintableContents(
$category, $content, $transformation_plugin, $transform_options,
$default_function, $meta, array $url_params = array(), &$is_truncated = null
) {
$is_truncated = false;
$result = '[' . $category;
if (isset($content)) {
$size = strlen($content);
$display_size = Util::formatByteDown($size, 3, 1);
$result .= ' - ' . $display_size[0] . ' ' . $display_size[1];
} else {
$result .= ' - NULL';
$size = 0;
}
$result .= ']';
// if we want to use a text transformation on a BLOB column
if (gettype($transformation_plugin) === "object") {
$posMimeOctetstream = strpos(
$transformation_plugin->getMIMESubtype(),
'Octetstream'
);
$posMimeText = strpos($transformation_plugin->getMIMEtype(), 'Text');
if ($posMimeOctetstream
|| $posMimeText !== false
) {
// Applying Transformations on hex string of binary data
// seems more appropriate
$result = pack("H*", bin2hex($content));
}
}
if ($size <= 0) {
return($result);
}
if ($default_function != $transformation_plugin) {
$result = $transformation_plugin->applyTransformation(
$result,
$transform_options,
$meta
);
return($result);
}
$result = $default_function($result, array(), $meta);
if (($_SESSION['tmpval']['display_binary']
&& $meta->type === self::STRING_FIELD)
|| ($_SESSION['tmpval']['display_blob']
&& stristr($meta->type, self::BLOB_FIELD))
) {
// in this case, restart from the original $content
if (mb_check_encoding($content, 'utf-8')
&& !preg_match('/[\x00-\x08\x0B\x0C\x0E-\x1F\x80-\x9F]/u', $content)
) {
// show as text if it's valid utf-8
$result = htmlspecialchars($content);
} else {
$result = '0x' . bin2hex($content);
}
list(
$is_truncated,
$result,
// skip 3rd param
) = $this->_getPartialText($result);
}
/* Create link to download */
// in PHP < 5.5, empty() only checks variables
$tmpdb = $this->__get('db');
if (count($url_params) > 0
&& (!empty($tmpdb) && !empty($meta->orgtable))
) {
$url_params['where_clause_sign'] = Core::signSqlQuery($url_params['where_clause']);
$result = ''
. $result . '';
}
return($result);
} // end of the '_handleNonPrintableContents()' function
/**
* Retrieves the associated foreign key info for a data cell
*
* @param array $map the list of relations
* @param object $meta the meta-information about the field
* @param string $where_comparison data for the where clause
*
* @return string formatted data
*
* @access private
*
*/
private function _getFromForeign(array $map, $meta, $where_comparison)
{
$dispsql = 'SELECT '
. Util::backquote($map[$meta->name][2])
. ' FROM '
. Util::backquote($map[$meta->name][3])
. '.'
. Util::backquote($map[$meta->name][0])
. ' WHERE '
. Util::backquote($map[$meta->name][1])
. $where_comparison;
$dispresult = $GLOBALS['dbi']->tryQuery(
$dispsql,
DatabaseInterface::CONNECT_USER,
DatabaseInterface::QUERY_STORE
);
if ($dispresult && $GLOBALS['dbi']->numRows($dispresult) > 0) {
list($dispval) = $GLOBALS['dbi']->fetchRow($dispresult, 0);
} else {
$dispval = __('Link not found!');
}
$GLOBALS['dbi']->freeResult($dispresult);
return $dispval;
}
/**
* Prepares the displayable content of a data cell in Browse mode,
* taking into account foreign key description field and transformations
*
* @param string $class css classes for the td element
* @param bool $condition_field whether the column is a part of
* the where clause
* @param array $analyzed_sql_results the analyzed query
* @param object $meta the meta-information about the
* field
* @param array $map the list of relations
* @param string $data data
* @param string $displayedData data that will be displayed (maybe be chunked)
* @param object|string $transformation_plugin transformation plugin.
* Can also be the default function:
* Core::mimeDefaultFunction
* @param string $default_function default function
* @param string $nowrap 'nowrap' if the content should
* not be wrapped
* @param string $where_comparison data for the where clause
* @param array $transform_options options for transformation
* @param bool $is_field_truncated whether the field is truncated
* @param string $original_length of a truncated column, or ''
*
* @return string formatted data
*
* @access private
*
* @see _getDataCellForNumericColumns(), _getDataCellForGeometryColumns(),
* _getDataCellForNonNumericColumns(),
*
*/
private function _getRowData(
$class, $condition_field, array $analyzed_sql_results, $meta,
array $map, $data, $displayedData,
$transformation_plugin, $default_function, $nowrap, $where_comparison,
array $transform_options, $is_field_truncated, $original_length=''
) {
$relational_display = $_SESSION['tmpval']['relational_display'];
$printview = $this->__get('printview');
$decimals = isset($meta->decimals) ? $meta->decimals : '-1';
$result = '
_addClass(
$class, $condition_field, $meta, $nowrap,
$is_field_truncated, $transformation_plugin, $default_function
)
. '">';
if (!empty($analyzed_sql_results['statement']->expr)) {
foreach ($analyzed_sql_results['statement']->expr as $expr) {
if ((empty($expr->alias)) || (empty($expr->column))) {
continue;
}
if (strcasecmp($meta->name, $expr->alias) == 0) {
$meta->name = $expr->column;
}
}
}
if (isset($map[$meta->name])) {
// Field to display from the foreign table?
if (isset($map[$meta->name][2])
&& strlen($map[$meta->name][2]) > 0
) {
$dispval = $this->_getFromForeign(
$map, $meta, $where_comparison
);
} else {
$dispval = '';
} // end if... else...
if (isset($printview) && ($printview == '1')) {
$result .= ($transformation_plugin != $default_function
? $transformation_plugin->applyTransformation(
$data,
$transform_options,
$meta
)
: $default_function($data)
)
. ' [->' . $dispval . ']';
} else {
if ($relational_display == self::RELATIONAL_KEY) {
// user chose "relational key" in the display options, so
// the title contains the display field
$title = (! empty($dispval))
? htmlspecialchars($dispval)
: '';
} else {
$title = htmlspecialchars($data);
}
$sqlQuery = 'SELECT * FROM '
. Util::backquote($map[$meta->name][3]) . '.'
. Util::backquote($map[$meta->name][0])
. ' WHERE '
. Util::backquote($map[$meta->name][1])
. $where_comparison;
$_url_params = array(
'db' => $map[$meta->name][3],
'table' => $map[$meta->name][0],
'pos' => '0',
'sql_signature' => Core::signSqlQuery($sqlQuery),
'sql_query' => $sqlQuery,
);
if ($transformation_plugin != $default_function) {
// always apply a transformation on the real data,
// not on the display field
$displayedData = $transformation_plugin->applyTransformation(
$data,
$transform_options,
$meta
);
} else {
if ($relational_display == self::RELATIONAL_DISPLAY_COLUMN
&& ! empty($map[$meta->name][2])
) {
// user chose "relational display field" in the
// display options, so show display field in the cell
$displayedData = $default_function($dispval);
} else {
// otherwise display data in the cell
$displayedData = $default_function($displayedData);
}
}
$tag_params = array('title' => $title);
if (strpos($class, 'grid_edit') !== false) {
$tag_params['class'] = 'ajax';
}
$result .= Util::linkOrButton(
'sql.php' . Url::getCommon($_url_params),
$displayedData, $tag_params
);
}
} else {
$result .= ($transformation_plugin != $default_function
? $transformation_plugin->applyTransformation(
$data,
$transform_options,
$meta
)
: $default_function($data)
);
}
$result .= '
' . "\n";
return $result;
} // end of the '_getRowData()' function
/**
* Prepares a checkbox for multi-row submits
*
* @param string $del_url delete url
* @param array $displayParts array with explicit indexes for all
* the display elements
* @param string $row_no the row number
* @param string $where_clause_html url encoded where clause
* @param array $condition_array array of conditions in the where clause
* @param string $id_suffix suffix for the id
* @param string $class css classes for the td element
*
* @return string the generated HTML
*
* @access private
*
* @see _getTableBody(), _getCheckboxAndLinks()
*/
private function _getCheckboxForMultiRowSubmissions(
$del_url, array $displayParts, $row_no, $where_clause_html, array $condition_array,
$id_suffix, $class
) {
$ret = '';
if (! empty($del_url) && $displayParts['del_lnk'] != self::KILL_PROCESS) {
$ret .= '
'
. ''
. ' ';
}
return $ret;
} // end of the '_getCheckboxForMultiRowSubmissions()' function
/**
* Prepares an Edit link
*
* @param string $edit_url edit url
* @param string $class css classes for td element
* @param string $edit_str text for the edit link
* @param string $where_clause where clause
* @param string $where_clause_html url encoded where clause
*
* @return string the generated HTML
*
* @access private
*
* @see _getTableBody(), _getCheckboxAndLinks()
*/
private function _getEditLink(
$edit_url, $class, $edit_str, $where_clause, $where_clause_html
) {
$ret = '';
if (! empty($edit_url)) {
$ret .= '
'
. Util::linkOrButton($edit_url, $edit_str);
/*
* Where clause for selecting this row uniquely is provided as
* a hidden input. Used by jQuery scripts for handling grid editing
*/
if (! empty($where_clause)) {
$ret .= '';
}
$ret .= '
';
}
return $ret;
} // end of the '_getEditLink()' function
/**
* Prepares an Copy link
*
* @param string $copy_url copy url
* @param string $copy_str text for the copy link
* @param string $where_clause where clause
* @param string $where_clause_html url encoded where clause
* @param string $class css classes for the td element
*
* @return string the generated HTML
*
* @access private
*
* @see _getTableBody(), _getCheckboxAndLinks()
*/
private function _getCopyLink(
$copy_url, $copy_str, $where_clause, $where_clause_html, $class
) {
$ret = '';
if (! empty($copy_url)) {
$ret .= '
'
. Util::linkOrButton($copy_url, $copy_str);
/*
* Where clause for selecting this row uniquely is provided as
* a hidden input. Used by jQuery scripts for handling grid editing
*/
if (! empty($where_clause)) {
$ret .= '';
}
$ret .= '
';
}
return $ret;
} // end of the '_getCopyLink()' function
/**
* Prepares a Delete link
*
* @param string $del_url delete url
* @param string $del_str text for the delete link
* @param string $js_conf text for the JS confirmation
* @param string $class css classes for the td element
*
* @return string the generated HTML
*
* @access private
*
* @see _getTableBody(), _getCheckboxAndLinks()
*/
private function _getDeleteLink($del_url, $del_str, $js_conf, $class)
{
$ret = '';
if (empty($del_url)) {
return $ret;
}
$ret .= '