null,
/** string Table name */
'table' => null,
/** string the URL to go back in case of errors */
'goto' => null,
/** string the SQL query */
'sql_query' => null,
/**
* integer the total number of rows returned by the SQL query without any
* appended "LIMIT" clause programmatically
*/
'unlim_num_rows' => null,
/** array meta information about fields */
'fields_meta' => null,
/** boolean */
'is_count' => null,
/** integer */
'is_export' => null,
/** boolean */
'is_func' => null,
/** integer */
'is_analyse' => null,
/** integer the total number of rows returned by the SQL query */
'num_rows' => null,
/** integer the total number of fields returned by the SQL query */
'fields_cnt' => null,
/** double time taken for execute the SQL query */
'querytime' => null,
/** string path for theme images directory */
'pma_theme_image' => null,
/** string */
'text_dir' => null,
/** boolean */
'is_maint' => null,
/** boolean */
'is_explain' => null,
/** boolean */
'is_show' => null,
/** boolean */
'is_browse_distinct' => null,
/** array table definitions */
'showtable' => null,
/** string */
'printview' => null,
/** string URL query */
'url_query' => null,
/** array column names to highlight */
'highlight_columns' => null,
/** array holding various display information */
'display_params' => null,
/** array mime types information of fields */
'mime_map' => null,
/** boolean */
'editable' => null,
/** random unique ID to distinguish result set */
'unique_id' => null,
/** where clauses for each row, each table in the row */
'whereClauseMap' => array(),
);
/**
* This variable contains the column transformation information
* for some of the system databases.
* One element of this array represent all relevant columns in all tables in
* one specific database
*/
public $transformation_info;
/**
* Get any property of this class
*
* @param string $property name of the property
*
* @return mixed|void if property exist, value of the relevant property
*/
public function __get($property)
{
if (array_key_exists($property, $this->_property_array)) {
return $this->_property_array[$property];
}
}
/**
* Set values for any property of this class
*
* @param string $property name of the property
* @param mixed $value value to set
*
* @return void
*/
public function __set($property, $value)
{
if (array_key_exists($property, $this->_property_array)) {
$this->_property_array[$property] = $value;
}
}
/**
* Constructor for DisplayResults class
*
* @param string $db the database name
* @param string $table the table name
* @param string $goto the URL to go back in case of errors
* @param string $sql_query the SQL query
*
* @access public
*/
public function __construct($db, $table, $goto, $sql_query)
{
$this->_setDefaultTransformations();
$this->__set('db', $db);
$this->__set('table', $table);
$this->__set('goto', $goto);
$this->__set('sql_query', $sql_query);
$this->__set('unique_id', rand());
}
/**
* Sets default transformations for some columns
*
* @return void
*/
private function _setDefaultTransformations()
{
$json_highlighting_data = array(
'libraries/plugins/transformations/output/Text_Plain_Json.php',
'PMA\libraries\plugins\transformations\output\Text_Plain_Json',
'Text_Plain'
);
$sql_highlighting_data = array(
'libraries/plugins/transformations/output/Text_Plain_Sql.php',
'PMA\libraries\plugins\transformations\output\Text_Plain_Sql',
'Text_Plain'
);
$blob_sql_highlighting_data = array(
'libraries/plugins/transformations/output/Text_Octetstream_Sql.php',
'PMA\libraries\plugins\transformations\output\Text_Octetstream_Sql',
'Text_Octetstream'
);
$link_data = array(
'libraries/plugins/transformations/Text_Plain_Link.php',
'PMA\libraries\plugins\transformations\Text_Plain_Link',
'Text_Plain'
);
$this->transformation_info = array(
'information_schema' => array(
'events' => array(
'event_definition' => $sql_highlighting_data
),
'processlist' => array(
'info' => $sql_highlighting_data
),
'routines' => array(
'routine_definition' => $sql_highlighting_data
),
'triggers' => array(
'action_statement' => $sql_highlighting_data
),
'views' => array(
'view_definition' => $sql_highlighting_data
)
),
'mysql' => array(
'event' => array(
'body' => $blob_sql_highlighting_data,
'body_utf8' => $blob_sql_highlighting_data
),
'general_log' => array(
'argument' => $sql_highlighting_data
),
'help_category' => array(
'url' => $link_data
),
'help_topic' => array(
'example' => $sql_highlighting_data,
'url' => $link_data
),
'proc' => array(
'param_list' => $blob_sql_highlighting_data,
'returns' => $blob_sql_highlighting_data,
'body' => $blob_sql_highlighting_data,
'body_utf8' => $blob_sql_highlighting_data
),
'slow_log' => array(
'sql_text' => $sql_highlighting_data
)
)
);
$cfgRelation = PMA_getRelationsParam();
if ($cfgRelation['db']) {
$this->transformation_info[$cfgRelation['db']] = array();
$relDb = &$this->transformation_info[$cfgRelation['db']];
if (! empty($cfgRelation['history'])) {
$relDb[$cfgRelation['history']] = array(
'sqlquery' => $sql_highlighting_data
);
}
if (! empty($cfgRelation['bookmark'])) {
$relDb[$cfgRelation['bookmark']] = array(
'query' => $sql_highlighting_data
);
}
if (! empty($cfgRelation['tracking'])) {
$relDb[$cfgRelation['tracking']] = array(
'schema_sql' => $sql_highlighting_data,
'data_sql' => $sql_highlighting_data
);
}
if (! empty($cfgRelation['favorite'])) {
$relDb[$cfgRelation['favorite']] = array(
'tables' => $json_highlighting_data
);
}
if (! empty($cfgRelation['recent'])) {
$relDb[$cfgRelation['recent']] = array(
'tables' => $json_highlighting_data
);
}
if (! empty($cfgRelation['savedsearches'])) {
$relDb[$cfgRelation['savedsearches']] = array(
'search_data' => $json_highlighting_data
);
}
if (! empty($cfgRelation['designer_settings'])) {
$relDb[$cfgRelation['designer_settings']] = array(
'settings_data' => $json_highlighting_data
);
}
if (! empty($cfgRelation['table_uiprefs'])) {
$relDb[$cfgRelation['table_uiprefs']] = array(
'prefs' => $json_highlighting_data
);
}
if (! empty($cfgRelation['userconfig'])) {
$relDb[$cfgRelation['userconfig']] = array(
'config_data' => $json_highlighting_data
);
}
if (! empty($cfgRelation['export_templates'])) {
$relDb[$cfgRelation['export_templates']] = array(
'template_data' => $json_highlighting_data
);
}
}
}
/**
* Set properties which were not initialized at the constructor
*
* @param integer $unlim_num_rows the total number of rows returned by
* the SQL query without any appended
* "LIMIT" clause programmatically
* @param array $fields_meta meta information about fields
* @param boolean $is_count statement is SELECT COUNT
* @param integer $is_export statement contains INTO OUTFILE
* @param boolean $is_func statement contains a function like SUM()
* @param integer $is_analyse statement contains PROCEDURE ANALYSE
* @param integer $num_rows total no. of rows returned by SQL query
* @param integer $fields_cnt total no.of fields returned by SQL query
* @param double $querytime time taken for execute the SQL query
* @param string $pmaThemeImage path for theme images directory
* @param string $text_dir text direction
* @param boolean $is_maint statement contains a maintenance command
* @param boolean $is_explain statement contains EXPLAIN
* @param boolean $is_show statement contains SHOW
* @param array $showtable table definitions
* @param string $printview print view was requested
* @param string $url_query URL query
* @param boolean $editable whether the results set is editable
* @param boolean $is_browse_dist whether browsing distinct values
*
* @return void
*
* @see sql.php
*/
public function setProperties(
$unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func,
$is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage, $text_dir,
$is_maint, $is_explain, $is_show, $showtable, $printview, $url_query,
$editable, $is_browse_dist
) {
$this->__set('unlim_num_rows', $unlim_num_rows);
$this->__set('fields_meta', $fields_meta);
$this->__set('is_count', $is_count);
$this->__set('is_export', $is_export);
$this->__set('is_func', $is_func);
$this->__set('is_analyse', $is_analyse);
$this->__set('num_rows', $num_rows);
$this->__set('fields_cnt', $fields_cnt);
$this->__set('querytime', $querytime);
$this->__set('pma_theme_image', $pmaThemeImage);
$this->__set('text_dir', $text_dir);
$this->__set('is_maint', $is_maint);
$this->__set('is_explain', $is_explain);
$this->__set('is_show', $is_show);
$this->__set('showtable', $showtable);
$this->__set('printview', $printview);
$this->__set('url_query', $url_query);
$this->__set('editable', $editable);
$this->__set('is_browse_distinct', $is_browse_dist);
} // end of the 'setProperties()' function
/**
* Defines the parts to display for a print view
*
* @param array $displayParts the parts to display
*
* @return array $displayParts the modified display parts
*
* @access private
*
*/
private function _setDisplayPartsForPrintView($displayParts)
{
// set all elements to false!
$displayParts['edit_lnk'] = self::NO_EDIT_OR_DELETE; // no edit link
$displayParts['del_lnk'] = self::NO_EDIT_OR_DELETE; // no delete link
$displayParts['sort_lnk'] = (string) '0';
$displayParts['nav_bar'] = (string) '0';
$displayParts['bkm_form'] = (string) '0';
$displayParts['text_btn'] = (string) '0';
$displayParts['pview_lnk'] = (string) '0';
return $displayParts;
}
/**
* Defines the parts to display for a SHOW statement
*
* @param array $displayParts the parts to display
*
* @return array $displayParts the modified display parts
*
* @access private
*
*/
private function _setDisplayPartsForShow($displayParts)
{
preg_match(
'@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?'
. 'PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS'
. ')@i',
$this->__get('sql_query'), $which
);
$bIsProcessList = isset($which[1]);
if ($bIsProcessList) {
$str = ' ' . strtoupper($which[1]);
$bIsProcessList = $bIsProcessList
&& strpos($str, 'PROCESSLIST') > 0;
}
if ($bIsProcessList) {
// no edit link
$displayParts['edit_lnk'] = self::NO_EDIT_OR_DELETE;
// "kill process" type edit link
$displayParts['del_lnk'] = self::KILL_PROCESS;
} else {
// Default case -> no links
// no edit link
$displayParts['edit_lnk'] = self::NO_EDIT_OR_DELETE;
// no delete link
$displayParts['del_lnk'] = self::NO_EDIT_OR_DELETE;
}
// Other settings
$displayParts['sort_lnk'] = (string) '0';
$displayParts['nav_bar'] = (string) '0';
$displayParts['bkm_form'] = (string) '1';
$displayParts['text_btn'] = (string) '1';
$displayParts['pview_lnk'] = (string) '1';
return $displayParts;
}
/**
* Defines the parts to display for statements not related to data
*
* @param array $displayParts the parts to display
*
* @return array $displayParts the modified display parts
*
* @access private
*
*/
private function _setDisplayPartsForNonData($displayParts)
{
// Statement is a "SELECT COUNT", a
// "CHECK/ANALYZE/REPAIR/OPTIMIZE/CHECKSUM", an "EXPLAIN" one or
// contains a "PROC ANALYSE" part
$displayParts['edit_lnk'] = self::NO_EDIT_OR_DELETE; // no edit link
$displayParts['del_lnk'] = self::NO_EDIT_OR_DELETE; // no delete link
$displayParts['sort_lnk'] = (string) '0';
$displayParts['nav_bar'] = (string) '0';
$displayParts['bkm_form'] = (string) '1';
if ($this->__get('is_maint')) {
$displayParts['text_btn'] = (string) '1';
} else {
$displayParts['text_btn'] = (string) '0';
}
$displayParts['pview_lnk'] = (string) '1';
return $displayParts;
}
/**
* Defines the parts to display for other statements (probably SELECT)
*
* @param array $displayParts the parts to display
*
* @return array $displayParts the modified display parts
*
* @access private
*
*/
private function _setDisplayPartsForSelect($displayParts)
{
// Other statements (ie "SELECT" ones) -> updates
// $displayParts['edit_lnk'], $displayParts['del_lnk'] and
// $displayParts['text_btn'] (keeps other default values)
$fields_meta = $this->__get('fields_meta');
$prev_table = '';
$displayParts['text_btn'] = (string) '1';
$number_of_columns = $this->__get('fields_cnt');
for ($i = 0; $i < $number_of_columns; $i++) {
$is_link = ($displayParts['edit_lnk'] != self::NO_EDIT_OR_DELETE)
|| ($displayParts['del_lnk'] != self::NO_EDIT_OR_DELETE)
|| ($displayParts['sort_lnk'] != '0');
// Displays edit/delete/sort/insert links?
if ($is_link
&& $prev_table != ''
&& $fields_meta[$i]->table != ''
&& $fields_meta[$i]->table != $prev_table
) {
// don't display links
$displayParts['edit_lnk'] = self::NO_EDIT_OR_DELETE;
$displayParts['del_lnk'] = self::NO_EDIT_OR_DELETE;
/**
* @todo May be problematic with same field names
* in two joined table.
*/
// $displayParts['sort_lnk'] = (string) '0';
if ($displayParts['text_btn'] == '1') {
break;
}
} // end if
// Always display print view link
$displayParts['pview_lnk'] = (string) '1';
if ($fields_meta[$i]->table != '') {
$prev_table = $fields_meta[$i]->table;
}
} // end for
if ($prev_table == '') { // no table for any of the columns
// don't display links
$displayParts['edit_lnk'] = self::NO_EDIT_OR_DELETE;
$displayParts['del_lnk'] = self::NO_EDIT_OR_DELETE;
}
return $displayParts;
}
/**
* Defines the parts to display for the results of a SQL query
* and the total number of rows
*
* @param array $displayParts the parts to display (see a few
* lines above for explanations)
*
* @return array the first element is an array with explicit indexes
* for all the display elements
* the second element is the total number of rows returned
* by the SQL query without any programmatically appended
* LIMIT clause (just a copy of $unlim_num_rows if it exists,
* else computed inside this function)
*
*
* @access private
*
* @see getTable()
*/
private function _setDisplayPartsAndTotal($displayParts)
{
$the_total = 0;
// 1. Following variables are needed for use in isset/empty or
// use with array indexes or safe use in foreach
$db = $this->__get('db');
$table = $this->__get('table');
$unlim_num_rows = $this->__get('unlim_num_rows');
$num_rows = $this->__get('num_rows');
$printview = $this->__get('printview');
// 2. Updates the display parts
if ($printview == '1') {
$displayParts = $this->_setDisplayPartsForPrintView($displayParts);
} elseif ($this->__get('is_count') || $this->__get('is_analyse')
|| $this->__get('is_maint') || $this->__get('is_explain')
) {
$displayParts = $this->_setDisplayPartsForNonData($displayParts);
} elseif ($this->__get('is_show')) {
$displayParts = $this->_setDisplayPartsForShow($displayParts);
} else {
$displayParts = $this->_setDisplayPartsForSelect($displayParts);
} // end if..elseif...else
// 3. Gets the total number of rows if it is unknown
if (isset($unlim_num_rows) && $unlim_num_rows != '') {
$the_total = $unlim_num_rows;
} elseif ((($displayParts['nav_bar'] == '1')
|| ($displayParts['sort_lnk'] == '1'))
&& (mb_strlen($db) && !empty($table))
) {
$the_total = $GLOBALS['dbi']->getTable($db, $table)->countRecords();
}
// if for COUNT query, number of rows returned more than 1
// (may be being used GROUP BY)
if ($this->__get('is_count') && isset($num_rows) && $num_rows > 1) {
$displayParts['nav_bar'] = (string) '1';
$displayParts['sort_lnk'] = (string) '1';
}
// 4. If navigation bar or sorting fields names URLs should be
// displayed but there is only one row, change these settings to
// false
if ($displayParts['nav_bar'] == '1' || $displayParts['sort_lnk'] == '1') {
// - Do not display sort links if less than 2 rows.
// - For a VIEW we (probably) did not count the number of rows
// so don't test this number here, it would remove the possibility
// of sorting VIEW results.
$_table = new Table($table, $db);
if (isset($unlim_num_rows)
&& ($unlim_num_rows < 2)
&& ! $_table->isView()
) {
$displayParts['sort_lnk'] = (string) '0';
}
} // end if (3)
return array($displayParts, $the_total);
} // end of the 'setDisplayPartsAndTotal()' function
/**
* Return true if we are executing a query in the form of
* "SELECT * FROM ..."
*
* @param array $analyzed_sql_results analyzed sql results
*
* @return boolean
*
* @access private
*
* @see _getTableHeaders(), _getColumnParams()
*/
private function _isSelect($analyzed_sql_results)
{
return ! ($this->__get('is_count')
|| $this->__get('is_export')
|| $this->__get('is_func')
|| $this->__get('is_analyse'))
&& !empty($analyzed_sql_results['select_from'])
&& !empty($analyzed_sql_results['statement']->from)
&& (count($analyzed_sql_results['statement']->from) == 1)
&& !empty($analyzed_sql_results['statement']->from[0]->table);
}
/**
* Get a navigation button
*
* @param string $caption iconic caption for button
* @param string $title text for button
* @param integer $pos position for next query
* @param string $html_sql_query query ready for display
* @param boolean $back whether 'begin' or 'previous'
* @param string $onsubmit optional onsubmit clause
* @param string $input_for_real_end optional hidden field for special treatment
* @param string $onclick optional onclick clause
*
* @return string html content
*
* @access private
*
* @see _getMoveBackwardButtonsForTableNavigation(),
* _getMoveForwardButtonsForTableNavigation()
*/
private function _getTableNavigationButton(
$caption, $title, $pos, $html_sql_query, $back, $onsubmit = '',
$input_for_real_end = '', $onclick = ''
) {
$caption_output = '';
if ($back) {
if (Util::showIcons('TableNavigationLinksMode')) {
$caption_output .= $caption;
}
if (Util::showText('TableNavigationLinksMode')) {
$caption_output .= ' ' . $title;
}
} else {
if (Util::showText('TableNavigationLinksMode')) {
$caption_output .= $title;
}
if (Util::showIcons('TableNavigationLinksMode')) {
$caption_output .= ' ' . $caption;
}
}
$title_output = ' title="' . $title . '"';
return '
'
. ''
. '
';
} // end function _getTableNavigationButton()
/**
* Possibly return a page selector for table navigation
*
* @param string $table_navigation_html the current navigation HTML
*
* @return array ($table_navigation_html, $nbTotalPage)
*
* @access private
*
*/
private function _getHtmlPageSelector($table_navigation_html)
{
$pageNow = @floor(
$_SESSION['tmpval']['pos']
/ $_SESSION['tmpval']['max_rows']
) + 1;
$nbTotalPage = @ceil(
$this->__get('unlim_num_rows')
/ $_SESSION['tmpval']['max_rows']
);
if ($nbTotalPage > 1) {
$table_navigation_html .= '
';
}
return array($table_navigation_html, $nbTotalPage);
}
/**
* Get a navigation bar to browse among the results of a SQL query
*
* @param integer $pos_next the offset for the "next" page
* @param integer $pos_prev the offset for the "previous" page
* @param boolean $is_innodb whether its InnoDB or not
* @param string $sort_by_key_html the sort by key dialog
*
* @return string html content
*
* @access private
*
* @see _getTable()
*/
private function _getTableNavigation(
$pos_next, $pos_prev, $is_innodb, $sort_by_key_html
) {
$table_navigation_html = '';
// here, using htmlentities() would cause problems if the query
// contains accented characters
$html_sql_query = htmlspecialchars($this->__get('sql_query'));
// Navigation bar
$table_navigation_html
.= '
'
. '
'
. '
';
// Move to the beginning or to the previous page
if ($_SESSION['tmpval']['pos']
&& ($_SESSION['tmpval']['max_rows'] != self::ALL_ROWS)
) {
$table_navigation_html
.= $this->_getMoveBackwardButtonsForTableNavigation(
$html_sql_query, $pos_prev
);
} // end move back
$nbTotalPage = 1;
//page redirection
// (unless we are showing all records)
if ($_SESSION['tmpval']['max_rows'] != self::ALL_ROWS) {
list(
$table_navigation_html,
$nbTotalPage
) = $this->_getHtmlPageSelector($table_navigation_html);
}
$showing_all = false;
if ($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS) {
$showing_all = true;
}
// Move to the next page or to the last one
$endpos = $_SESSION['tmpval']['pos']
+ $_SESSION['tmpval']['max_rows'];
if (($endpos < $this->__get('unlim_num_rows'))
&& ($this->__get('num_rows') >= $_SESSION['tmpval']['max_rows'])
&& ($_SESSION['tmpval']['max_rows'] != self::ALL_ROWS)
) {
$table_navigation_html
.= $this->_getMoveForwardButtonsForTableNavigation(
$html_sql_query, $pos_next, $is_innodb
);
} // end move toward
// show separator if pagination happen
if ($nbTotalPage > 1) {
$table_navigation_html
.= '
|
';
}
// Display the "Show all" button if allowed
if ($GLOBALS['cfg']['ShowAll'] || ($this->__get('unlim_num_rows') <= 500) ) {
$table_navigation_html .= $this->_getShowAllCheckboxForTableNavigation(
$showing_all, $html_sql_query
);
$table_navigation_html
.= '
|
';
} // end show all
$table_navigation_html .= '
'
. '
'
. ''
. '
|
'
. '
'
. '
'
. '
'
. '
'
. ''
. '
|
'
. '
'
. '
';
// if displaying a VIEW, $unlim_num_rows could be zero because
// of $cfg['MaxExactCountViews']; in this case, avoid passing
// the 5th parameter to checkFormElementInRange()
// (this means we can't validate the upper limit
$table_navigation_html .= '
';
$table_navigation_html .= ''
. '
'
. '
'
. '
'
. '' . __('Filter rows') . ':'
. ''
. '
';
$table_navigation_html .= '
' . $sort_by_key_html . '
';
$table_navigation_html .= '
'
. '
'
. '
';
return $table_navigation_html;
} // end of the '_getTableNavigation()' function
/**
* Prepare move backward buttons - previous and first
*
* @param string $html_sql_query the sql encoded by html special characters
* @param integer $pos_prev the offset for the "previous" page
*
* @return string html content
*
* @access private
*
* @see _getTableNavigation()
*/
private function _getMoveBackwardButtonsForTableNavigation(
$html_sql_query, $pos_prev
) {
return $this->_getTableNavigationButton(
'<<', _pgettext('First page', 'Begin'), 0, $html_sql_query, true
)
. $this->_getTableNavigationButton(
'<', _pgettext('Previous page', 'Previous'), $pos_prev,
$html_sql_query, true
);
} // end of the '_getMoveBackwardButtonsForTableNavigation()' function
/**
* Prepare Show All checkbox for table navigation
*
* @param bool $showing_all whether all rows are shown currently
* @param string $html_sql_query the sql encoded by html special characters
*
* @return string html content
*
* @access private
*
* @see _getTableNavigation()
*/
private function _getShowAllCheckboxForTableNavigation(
$showing_all, $html_sql_query
) {
return "\n"
. '
'
. ''
. '
';
} // end of the '_getShowAllButtonForTableNavigation()' function
/**
* Prepare move forward buttons - next and last
*
* @param string $html_sql_query the sql encoded by htmlspecialchars()
* @param integer $pos_next the offset for the "next" page
* @param boolean $is_innodb whether it's InnoDB or not
*
* @return string $buttons_html html content
*
* @access private
*
* @see _getTableNavigation()
*/
private function _getMoveForwardButtonsForTableNavigation(
$html_sql_query, $pos_next, $is_innodb
) {
// display the Next button
$buttons_html = $this->_getTableNavigationButton(
'>',
_pgettext('Next page', 'Next'),
$pos_next,
$html_sql_query,
false
);
// prepare some options for the End button
if ($is_innodb
&& $this->__get('unlim_num_rows') > $GLOBALS['cfg']['MaxExactCount']
) {
$input_for_real_end = '';
// no backquote around this message
$onclick = '';
} else {
$input_for_real_end = $onclick = '';
}
$maxRows = $_SESSION['tmpval']['max_rows'];
$onsubmit = 'onsubmit="return '
. ($_SESSION['tmpval']['pos']
+ $maxRows
< $this->__get('unlim_num_rows')
&& $this->__get('num_rows') >= $maxRows)
? 'true'
: 'false' . '"';
// display the End button
$buttons_html .= $this->_getTableNavigationButton(
'>>',
_pgettext('Last page', 'End'),
@((ceil(
$this->__get('unlim_num_rows')
/ $_SESSION['tmpval']['max_rows']
)- 1) * $maxRows),
$html_sql_query, false, $onsubmit, $input_for_real_end, $onclick
);
return $buttons_html;
} // end of the '_getMoveForwardButtonsForTableNavigation()' function
/**
* Prepare fields for table navigation
* Number of rows
*
* @param string $html_sql_query the sql encoded by htmlspecialchars()
*
* @return string $additional_fields_html html content
*
* @access private
*
* @see _getTableNavigation()
*/
private function _getAdditionalFieldsForTableNavigation(
$html_sql_query
) {
$additional_fields_html = '';
$additional_fields_html .= ''
. ''
. ''
. '' ;
$numberOfRowsPlaceholder = null;
if ($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS) {
$numberOfRowsPlaceholder = __('All');
}
$numberOfRowsChoices = array(
'25' => 25,
'50' => 50,
'100' => 100,
'250' => 250,
'500' => 500
);
$additional_fields_html .= __('Number of rows:') . ' ';
$additional_fields_html .= Util::getDropdown(
'session_max_rows', $numberOfRowsChoices,
$_SESSION['tmpval']['max_rows'], '',
'autosubmit', $numberOfRowsPlaceholder
);
return $additional_fields_html;
} // end of the '_getAdditionalFieldsForTableNavigation()' function
/**
* Get the headers of the results table, for all of the columns
*
* @param array $displayParts which elements to display
* @param array $analyzed_sql_results analyzed sql results
* @param array $sort_expression sort expression
* @param string $sort_expression_nodirection sort expression
* without direction
* @param string $sort_direction sort direction
* @param boolean $is_limited_display with limited operations
* or not
* @param string $unsorted_sql_query query without the sort part
*
* @return string html content
*
* @access private
*
* @see getTableHeaders()
*/
private function _getTableHeadersForColumns(
$displayParts, $analyzed_sql_results, $sort_expression,
$sort_expression_nodirection, $sort_direction, $is_limited_display,
$unsorted_sql_query
) {
$html = '';
// required to generate sort links that will remember whether the
// "Show all" button has been clicked
$sql_md5 = md5($this->__get('sql_query'));
$session_max_rows = $is_limited_display
? 0
: $_SESSION['tmpval']['query'][$sql_md5]['max_rows'];
// Following variable are needed for use in isset/empty or
// use with array indexes/safe use in the for loop
$highlight_columns = $this->__get('highlight_columns');
$fields_meta = $this->__get('fields_meta');
// Prepare Display column comments if enabled
// ($GLOBALS['cfg']['ShowBrowseComments']).
$comments_map = $this->_getTableCommentsArray($analyzed_sql_results);
list($col_order, $col_visib) = $this->_getColumnParams(
$analyzed_sql_results
);
// optimize: avoid calling a method on each iteration
$number_of_columns = $this->__get('fields_cnt');
for ($j = 0; $j < $number_of_columns; $j++) {
// assign $i with the appropriate column order
$i = $col_order ? $col_order[$j] : $j;
// See if this column should get highlight because it's used in the
// where-query.
$name = $fields_meta[$i]->name;
$condition_field = (isset($highlight_columns[$name])
|| isset($highlight_columns[Util::backquote($name)]))
? true
: false;
// Prepare comment-HTML-wrappers for each row, if defined/enabled.
$comments = $this->_getCommentForRow($comments_map, $fields_meta[$i]);
$display_params = $this->__get('display_params');
if (($displayParts['sort_lnk'] == '1') && ! $is_limited_display) {
list($order_link, $sorted_header_html)
= $this->_getOrderLinkAndSortedHeaderHtml(
$fields_meta[$i], $sort_expression,
$sort_expression_nodirection, $i, $unsorted_sql_query,
$session_max_rows, $comments,
$sort_direction, $col_visib,
$col_visib[$j]
);
$html .= $sorted_header_html;
$display_params['desc'][] = '
';
// Output data needed for column reordering and show/hide column
if ($this->_isSelect($analyzed_sql_results)) {
$table_headers_html .= $this->_getDataForResettingColumnOrder();
}
$display_params['emptypre'] = 0;
$display_params['emptyafter'] = 0;
$display_params['textbtn'] = '';
$full_or_partial_text_link = null;
$this->__set('display_params', $display_params);
// Display options (if we are not in print view)
if (! (isset($printview) && ($printview == '1')) && ! $is_limited_display) {
$table_headers_html .= $this->_getOptionsBlock();
// prepare full/partial text button or link
$full_or_partial_text_link = $this->_getFullOrPartialTextButtonOrLink();
}
// Start of form for multi-rows edit/delete/export
$table_headers_html .= $this->_getFormForMultiRowOperations(
$displayParts['del_lnk']
);
// 1. Set $colspan and generate html with full/partial
// text button or link
list($colspan, $button_html)
= $this->_getFieldVisibilityParams(
$displayParts, $full_or_partial_text_link
);
$table_headers_html .= $button_html;
// 2. Displays the fields' name
// 2.0 If sorting links should be used, checks if the query is a "JOIN"
// statement (see 2.1.3)
// See if we have to highlight any header fields of a WHERE query.
// Uses SQL-Parser results.
$this->_setHighlightedColumnGlobalField($analyzed_sql_results);
// Get the headers for all of the columns
$table_headers_html .= $this->_getTableHeadersForColumns(
$displayParts, $analyzed_sql_results, $sort_expression,
$sort_expression_nodirection, $sort_direction,
$is_limited_display, $unsorted_sql_query
);
// Display column at rightside - checkboxes or empty column
if (! $printview) {
$table_headers_html .= $this->_getColumnAtRightSide(
$displayParts, $full_or_partial_text_link, $colspan
);
}
$table_headers_html .= '' . '';
return $table_headers_html;
} // end of the '_getTableHeaders()' function
/**
* Prepare unsorted sql query and sort by key drop down
*
* @param array $analyzed_sql_results analyzed sql results
* @param string $sort_expression sort expression
*
* @return array two element array - $unsorted_sql_query, $drop_down_html
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getUnsortedSqlAndSortByKeyDropDown(
$analyzed_sql_results, $sort_expression
) {
$drop_down_html = '';
$unsorted_sql_query = Query::replaceClause(
$analyzed_sql_results['statement'],
$analyzed_sql_results['parser']->list,
'ORDER BY',
''
);
// Data is sorted by indexes only if it there is only one table.
if ($this->_isSelect($analyzed_sql_results)) {
// grab indexes data:
$indexes = Index::getFromTable(
$this->__get('table'),
$this->__get('db')
);
// do we have any index?
if (! empty($indexes)) {
$drop_down_html = $this->_getSortByKeyDropDown(
$indexes, $sort_expression,
$unsorted_sql_query
);
}
}
return array($unsorted_sql_query, $drop_down_html);
} // end of the '_getUnsortedSqlAndSortByKeyDropDown()' function
/**
* Prepare sort by key dropdown - html code segment
*
* @param Index[] $indexes the indexes of the table for sort criteria
* @param string $sort_expression the sort expression
* @param string $unsorted_sql_query the unsorted sql query
*
* @return string $drop_down_html html content
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getSortByKeyDropDown(
$indexes, $sort_expression, $unsorted_sql_query
) {
$drop_down_html = '';
$drop_down_html .= '' . "\n";
return $drop_down_html;
} // end of the '_getSortByKeyDropDown()' function
/**
* Set column span, row span and prepare html with full/partial
* text button or link
*
* @param array &$displayParts which elements to display
* @param string $full_or_partial_text_link full/partial link or text button
*
* @return array 2 element array - $colspan, $button_html
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getFieldVisibilityParams(
&$displayParts, $full_or_partial_text_link
) {
$button_html = '';
$display_params = $this->__get('display_params');
// 1. Displays the full/partial text button (part 1)...
$button_html .= '
' . "\n";
$colspan = (($displayParts['edit_lnk'] != self::NO_EDIT_OR_DELETE)
&& ($displayParts['del_lnk'] != self::NO_EDIT_OR_DELETE))
? ' colspan="4"'
: '';
// ... before the result table
if ((($displayParts['edit_lnk'] == self::NO_EDIT_OR_DELETE)
&& ($displayParts['del_lnk'] == self::NO_EDIT_OR_DELETE))
&& ($displayParts['text_btn'] == '1')
) {
$display_params['emptypre']
= (($displayParts['edit_lnk'] != self::NO_EDIT_OR_DELETE)
&& ($displayParts['del_lnk'] != self::NO_EDIT_OR_DELETE)) ? 4 : 0;
} elseif ((($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_LEFT)
|| ($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_BOTH))
&& ($displayParts['text_btn'] == '1')
) {
// ... at the left column of the result table header if possible
// and required
$display_params['emptypre']
= (($displayParts['edit_lnk'] != self::NO_EDIT_OR_DELETE)
&& ($displayParts['del_lnk'] != self::NO_EDIT_OR_DELETE)) ? 4 : 0;
$button_html .= '
';
} elseif (($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_NONE)) {
// ... elseif display an empty column if the actions links are
// disabled to match the rest of the table
$button_html .= '
';
}
$this->__set('display_params', $display_params);
return array($colspan, $button_html);
} // end of the '_getFieldVisibilityParams()' function
/**
* Get table comments as array
*
* @param array $analyzed_sql_results analyzed sql results
*
* @return array $comments_map table comments
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getTableCommentsArray($analyzed_sql_results)
{
if ((!$GLOBALS['cfg']['ShowBrowseComments'])
|| (empty($analyzed_sql_results['statement']->from))
) {
return array();
}
$ret = array();
foreach ($analyzed_sql_results['statement']->from as $field) {
if (empty($field->table)) {
continue;
}
$ret[$field->table] = PMA_getComments(
empty($field->database) ? $this->__get('db') : $field->database,
$field->table
);
}
return $ret;
} // end of the '_getTableCommentsArray()' function
/**
* Set global array for store highlighted header fields
*
* @param array $analyzed_sql_results analyzed sql results
*
* @return void
*
* @access private
*
* @see _getTableHeaders()
*/
private function _setHighlightedColumnGlobalField($analyzed_sql_results)
{
$highlight_columns = array();
if (!empty($analyzed_sql_results['statement']->where)) {
foreach ($analyzed_sql_results['statement']->where as $expr) {
foreach ($expr->identifiers as $identifier) {
$highlight_columns[$identifier] = 'true';
}
}
}
$this->__set('highlight_columns', $highlight_columns);
} // end of the '_setHighlightedColumnGlobalField()' function
/**
* Prepare data for column restoring and show/hide
*
* @return string $data_html html content
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getDataForResettingColumnOrder()
{
$data_html = '';
// generate the column order, if it is set
$pmatable = new Table($this->__get('table'), $this->__get('db'));
$col_order = $pmatable->getUiProp(Table::PROP_COLUMN_ORDER);
if ($col_order) {
$data_html .= '';
}
$col_visib = $pmatable->getUiProp(Table::PROP_COLUMN_VISIB);
if ($col_visib) {
$data_html .= '';
}
// generate table create time
$table = new Table($this->__get('table'), $this->__get('db'));
if (! $table->isView()) {
$data_html .= '';
}
return $data_html;
} // end of the '_getDataForResettingColumnOrder()' function
/**
* Prepare option fields block
*
* @return string $options_html html content
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getOptionsBlock()
{
$options_html = '';
$options_html .= '';
return $options_html;
} // end of the '_getOptionsBlock()' function
/**
* Get full/partial text button or link
*
* @return string html content
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getFullOrPartialTextButtonOrLink()
{
$url_params_full_text = array(
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'sql_query' => $this->__get('sql_query'),
'goto' => $this->__get('goto'),
'full_text_button' => 1
);
if ($_SESSION['tmpval']['pftext'] == self::DISPLAY_FULL_TEXT) {
// currently in fulltext mode so show the opposite link
$tmp_image_file = $this->__get('pma_theme_image') . 's_partialtext.png';
$tmp_txt = __('Partial texts');
$url_params_full_text['pftext'] = self::DISPLAY_PARTIAL_TEXT;
} else {
$tmp_image_file = $this->__get('pma_theme_image') . 's_fulltext.png';
$tmp_txt = __('Full texts');
$url_params_full_text['pftext'] = self::DISPLAY_FULL_TEXT;
}
$tmp_image = '';
$tmp_url = 'sql.php' . PMA_URL_getCommon($url_params_full_text);
return Util::linkOrButton(
$tmp_url, $tmp_image, array(), false
);
} // end of the '_getFullOrPartialTextButtonOrLink()' function
/**
* Prepare html form for multi row operations
*
* @param string $del_lnk the delete link of current row
*
* @return string $form_html html content
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getFormForMultiRowOperations($del_lnk)
{
$form_html = '';
if (($del_lnk == self::DELETE_ROW) || ($del_lnk == self::KILL_PROCESS)) {
$form_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($analyzed_sql_results, $url_query)
{
$results_operations_html = '';
if (empty($analyzed_sql_results['procedure'])) {
$ajax_class = ' ajax';
$results_operations_html .= ''
. Util::linkOrButton(
'view_create.php' . $url_query,
Util::getIcon(
'b_view_add.png', __('Create view'), true
),
array('class' => 'create_view' . $ajax_class), true, true, ''
)
. '' . "\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($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.png', __('Copy to clipboard'), true
),
array('id' => 'copyToClipBoard'),
true,
true,
'copy_to_clip_board'
);
return $html;
}
/**
* Get printview links for results operations
*
* @return string $html
*
* @access private
*/
private function _getPrintviewLinks()
{
$html = Util::linkOrButton(
'#',
Util::getIcon(
'b_print.png', __('Print'), true
),
array('id' => 'printView'),
true,
true,
'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(
$displayParts, $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 PMA_getExportDisplay()
// 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' . PMA_URL_getCommon($_url_params),
Util::getIcon(
'b_tblexport.png', __('Export'), true
),
'',
true,
true,
''
)
. "\n";
// prepare chart
$results_operations_html .= Util::linkOrButton(
'tbl_chart.php' . PMA_URL_getCommon($_url_params),
Util::getIcon(
'b_chart.png', __('Display chart'), true
),
'',
true,
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'
. PMA_URL_getCommon($_url_params),
Util::getIcon(
'b_globe.gif', __('Visualize GIS data'), true
),
'',
true,
true,
''
)
. "\n";
}
}
// CREATE VIEW
/**
*
* @todo detect privileges to create a view
* (but see 2006-01-19 note in display_create_table.lib.php,
* 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:
* PMA_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, $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))
) {
$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($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,
null,
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 object|string $transformation_plugin transformation plugin.
* Can also be the default function:
* PMA_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, $analyzed_sql_results, $meta, $map, $data,
$transformation_plugin, $default_function, $nowrap, $where_comparison,
$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 = '
' . "\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, $displayParts, $row_no, $where_clause_html, $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, array(), false
);
/*
* 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, array(), false
);
/*
* 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 .= '