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,
/** array table definitions */
'showtable' => null,
/** string */
'printview' => null,
/** string URL query */
'url_query' => null,
/** array column names to highlight */
'highlight_columns' => null,
/** array informations used with vertical display mode */
'vertical_display' => null,
/** array mime types information of fields */
'mime_map' => null,
/** boolean */
'editable' => null
);
/**
* 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 PMA_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);
}
/**
* Sets default transformations for some columns
*
* @return void
*/
private function _setDefaultTransformations()
{
$sql_highlighting_data = array(
'libraries/plugins/transformations/Text_Plain_Formatted.class.php',
'Text_Plain_Formatted',
'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
)
)
);
$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
);
}
}
}
/**
* 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
*
* @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
) {
$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);
} // end of the 'setProperties()' function
/**
* Defines the display mode to use for the results of a SQL query
*
* It uses a synthetic string that contains all the required informations.
* In this string:
* - the first two characters stand for the action to do while
* clicking on the "edit" link (e.g. 'ur' for update a row, 'nn' for no
* edit link...);
* - the next two characters stand for the action to do while
* clicking on the "delete" link (e.g. 'kp' for kill a process, 'nn' for
* no delete link...);
* - the next characters are boolean values (1/0) and respectively stand
* for sorting links, navigation bar, "insert a new row" link, the
* bookmark feature, the expand/collapse text/blob fields button and
* the "display printable view" option.
* Of course '0'/'1' means the feature won't/will be enabled.
*
* @param string &$the_disp_mode the synthetic value for display_mode (see a few
* lines above for explanations)
* @param integer &$the_total 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,
* elsecomputed inside this function)
*
* @return array an array with explicit indexes for all the display
* elements
*
* @access private
*
* @see getTable()
*/
private function _setDisplayMode(&$the_disp_mode, &$the_total)
{
// 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');
$fields_meta = $this->__get('fields_meta');
$printview = $this->__get('printview');
// 1. Initializes the $do_display array
$do_display = array();
$do_display['edit_lnk'] = $the_disp_mode[0] . $the_disp_mode[1];
$do_display['del_lnk'] = $the_disp_mode[2] . $the_disp_mode[3];
$do_display['sort_lnk'] = (string) $the_disp_mode[4];
$do_display['nav_bar'] = (string) $the_disp_mode[5];
$do_display['ins_row'] = (string) $the_disp_mode[6];
$do_display['bkm_form'] = (string) $the_disp_mode[7];
$do_display['text_btn'] = (string) $the_disp_mode[8];
$do_display['pview_lnk'] = (string) $the_disp_mode[9];
// 2. Display mode is not "false for all elements" -> updates the
// display mode
if ($the_disp_mode != 'nnnn000000') {
if (isset($printview) && ($printview == '1')) {
// 2.0 Print view -> set all elements to false!
$do_display['edit_lnk'] = self::NO_EDIT_OR_DELETE; // no edit link
$do_display['del_lnk'] = self::NO_EDIT_OR_DELETE; // no delete link
$do_display['sort_lnk'] = (string) '0';
$do_display['nav_bar'] = (string) '0';
$do_display['ins_row'] = (string) '0';
$do_display['bkm_form'] = (string) '0';
$do_display['text_btn'] = (string) '0';
$do_display['pview_lnk'] = (string) '0';
} elseif ($this->__get('is_count') || $this->__get('is_analyse')
|| $this->__get('is_maint') || $this->__get('is_explain')
) {
// 2.1 Statement is a "SELECT COUNT", a
// "CHECK/ANALYZE/REPAIR/OPTIMIZE", an "EXPLAIN" one or
// contains a "PROC ANALYSE" part
$do_display['edit_lnk'] = self::NO_EDIT_OR_DELETE; // no edit link
$do_display['del_lnk'] = self::NO_EDIT_OR_DELETE; // no delete link
$do_display['sort_lnk'] = (string) '0';
$do_display['nav_bar'] = (string) '0';
$do_display['ins_row'] = (string) '0';
$do_display['bkm_form'] = (string) '1';
if ($this->__get('is_maint')) {
$do_display['text_btn'] = (string) '1';
} else {
$do_display['text_btn'] = (string) '0';
}
$do_display['pview_lnk'] = (string) '1';
} elseif ($this->__get('is_show')) {
// 2.2 Statement is a "SHOW..."
/**
* 2.2.1
* @todo defines edit/delete links depending on show statement
*/
preg_match(
'@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?'
. 'PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS'
. ')@i',
$this->__get('sql_query'), $which
);
if (isset($which[1])
&& (strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0)
) {
// no edit link
$do_display['edit_lnk'] = self::NO_EDIT_OR_DELETE;
// "kill process" type edit link
$do_display['del_lnk'] = self::KILL_PROCESS;
} else {
// Default case -> no links
// no edit link
$do_display['edit_lnk'] = self::NO_EDIT_OR_DELETE;
// no delete link
$do_display['del_lnk'] = self::NO_EDIT_OR_DELETE;
}
// 2.2.2 Other settings
$do_display['sort_lnk'] = (string) '0';
$do_display['nav_bar'] = (string) '0';
$do_display['ins_row'] = (string) '0';
$do_display['bkm_form'] = (string) '1';
$do_display['text_btn'] = (string) '1';
$do_display['pview_lnk'] = (string) '1';
} else {
// 2.3 Other statements (ie "SELECT" ones) -> updates
// $do_display['edit_lnk'], $do_display['del_lnk'] and
// $do_display['text_btn'] (keeps other default values)
$prev_table = $fields_meta[0]->table;
$do_display['text_btn'] = (string) '1';
for ($i = 0; $i < $this->__get('fields_cnt'); $i++) {
$is_link = ($do_display['edit_lnk'] != self::NO_EDIT_OR_DELETE)
|| ($do_display['del_lnk'] != self::NO_EDIT_OR_DELETE)
|| ($do_display['sort_lnk'] != '0')
|| ($do_display['ins_row'] != '0');
// 2.3.2 Displays edit/delete/sort/insert links?
if ($is_link
&& (($fields_meta[$i]->table == '')
|| ($fields_meta[$i]->table != $prev_table))
) {
// don't display links
$do_display['edit_lnk'] = self::NO_EDIT_OR_DELETE;
$do_display['del_lnk'] = self::NO_EDIT_OR_DELETE;
/**
* @todo May be problematic with same field names
* in two joined table.
*/
// $do_display['sort_lnk'] = (string) '0';
$do_display['ins_row'] = (string) '0';
if ($do_display['text_btn'] == '1') {
break;
}
} // end if (2.3.2)
// 2.3.3 Always display print view link
$do_display['pview_lnk'] = (string) '1';
$prev_table = $fields_meta[$i]->table;
} // end for
} // end if..elseif...else (2.1 -> 2.3)
} // end if (2)
// 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 ((($do_display['nav_bar'] == '1')
|| ($do_display['sort_lnk'] == '1'))
&& (strlen($db) && !empty($table))
) {
$the_total = PMA_Table::countRecords($db, $table);
}
// 4. If navigation bar or sorting fields names URLs should be
// displayed but there is only one row, change these settings to
// false
if ($do_display['nav_bar'] == '1' || $do_display['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.
if (isset($unlim_num_rows)
&& ($unlim_num_rows < 2)
&& ! PMA_Table::isView($db, $table)
) {
// force display of navbar for vertical/horizontal display-choice.
// $do_display['nav_bar'] = (string) '0';
$do_display['sort_lnk'] = (string) '0';
}
} // end if (3)
// 5. Updates the synthetic var
$the_disp_mode = join('', $do_display);
return $do_display;
} // end of the 'setDisplayMode()' function
/**
* Return true if we are executing a query in the form of
* "SELECT * FROM ..."
*
* @param array $analyzed_sql the analyzed query
*
* @return boolean
*
* @access private
*
* @see _getTableHeaders(), _getColumnParams()
*/
private function _isSelect($analyzed_sql)
{
if (!isset($analyzed_sql[0]['select_expr'])) {
$analyzed_sql[0]['select_expr'] = 0;
}
return ! ($this->__get('is_count') || $this->__get('is_export')
|| $this->__get('is_func') || $this->__get('is_analyse'))
&& (count($analyzed_sql[0]['select_expr']) == 0)
&& isset($analyzed_sql[0]['queryflags']['select_from'])
&& (count($analyzed_sql[0]['table_ref']) == 1);
}
/**
* 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 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, $onsubmit = '',
$input_for_real_end = '', $onclick = ''
) {
$caption_output = '';
if (PMA_Util::showIcons('TableNavigationLinksMode')) {
$caption_output .= $caption;
}
if (PMA_Util::showText('TableNavigationLinksMode')) {
$caption_output .= ' ' . $title;
}
$title_output = ' title="' . $title . '"';
return '
'
. ''
. '
';
} // end function _getTableNavigationButton()
/**
* 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 string $id_for_direction_dropdown the id for the direction dropdown
* @param boolean $is_innodb whether its InnoDB or not
*
* @return string html content
*
* @access private
*
* @see _getTable()
*/
private function _getTableNavigation(
$pos_next, $pos_prev, $id_for_direction_dropdown, $is_innodb
) {
$table_navigation_html = '';
$showtable = $this->__get('showtable'); // To use in isset
// here, using htmlentities() would cause problems if the query
// contains accented characters
$html_sql_query = htmlspecialchars($this->__get('sql_query'));
/**
* @todo move this to a central place
* @todo for other future table types
*/
$is_innodb = (isset($showtable['Type'])
&& $showtable['Type'] == self::TABLE_TYPE_INNO_DB);
// 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) { //if1
$pageNow = @floor(
$_SESSION['tmpval']['pos']
/ $_SESSION['tmpval']['max_rows']
) + 1;
$nbTotalPage = @ceil(
$this->__get('unlim_num_rows')
/ $_SESSION['tmpval']['max_rows']
);
if ($nbTotalPage > 1) { //if2
$table_navigation_html .= '
';
} //_if2
} //_if1
// Display the "Show all" button if allowed
if (($this->__get('num_rows') < $this->__get('unlim_num_rows'))
&& ($GLOBALS['cfg']['ShowAll']
|| ($this->__get('unlim_num_rows') <= 500))
) {
$table_navigation_html .= $this->_getShowAllButtonForTableNavigation(
$html_sql_query
);
} // end show all
// 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
.= '
|
';
}
$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 .= ''
. '
'
. '
'
. '
'
. '
';
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
)
. $this->_getTableNavigationButton(
'<', _pgettext('Previous page', 'Previous'), $pos_prev,
$html_sql_query
);
} // end of the '_getMoveBackwardButtonsForTableNavigation()' function
/**
* Prepare Show All button for table navigation
*
* @param string $html_sql_query the sql encoded by html special characters
*
* @return string html content
*
* @access private
*
* @see _getTableNavigation()
*/
private function _getShowAllButtonForTableNavigation($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
);
// 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, $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()
* @param string $id_for_direction_dropdown the id for the direction dropdown
*
* @return string $additional_fields_html html content
*
* @access private
*
* @see _getTableNavigation()
*/
private function _getAdditionalFieldsForTableNavigation(
$html_sql_query, $id_for_direction_dropdown
) {
$additional_fields_html = '';
$additional_fields_html .= ''
. ''
. '';
$numberOfRowsChoices = array(
'25' => 25,
'50' => 50,
'100' => 100,
'250' => 250,
'500' => 500
);
$additional_fields_html .= __('Number of rows:') . ' ';
$additional_fields_html .= PMA_Util::getDropdown(
'session_max_rows', $numberOfRowsChoices,
$_SESSION['tmpval']['max_rows'], '', 'autosubmit'
);
if ($GLOBALS['cfg']['ShowDisplayDirection']) {
// Display mode (horizontal/vertical)
$additional_fields_html .= __('Mode:') . ' ' . "\n";
$choices = array(
'horizontal' => __('horizontal'),
'horizontalflipped' => __('horizontal (rotated headers)'),
'vertical' => __('vertical')
);
$additional_fields_html .= PMA_Util::getDropdown(
'disp_direction', $choices,
$_SESSION['tmpval']['disp_direction'],
$id_for_direction_dropdown, 'autosubmit'
);
unset($choices);
}
return $additional_fields_html;
} // end of the '_getAdditionalFieldsForTableNavigation()' function
/**
* Get the headers of the results table
*
* @param array &$is_display which elements to display
* @param array|string $analyzed_sql the analyzed query
* @param string $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
*
* @return string html content
*
* @access private
*
* @see getTable()
*/
private function _getTableHeaders(
&$is_display, $analyzed_sql = '',
$sort_expression = '', $sort_expression_nodirection = '',
$sort_direction = '', $is_limited_display = false
) {
$table_headers_html = '';
// Following variable are needed for use in isset/empty or
// use with array indexes/safe use in foreach
$fields_meta = $this->__get('fields_meta');
$highlight_columns = $this->__get('highlight_columns');
$printview = $this->__get('printview');
$vertical_display = $this->__get('vertical_display');
// 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'];
$direction = isset($_SESSION['tmpval']['disp_direction'])
? $_SESSION['tmpval']['disp_direction']
: '';
if ($analyzed_sql == '') {
$analyzed_sql = array();
}
$directionCondition = ($direction == self::DISP_DIR_HORIZONTAL)
|| ($direction == self::DISP_DIR_HORIZONTAL_FLIPPED);
// can the result be sorted?
if ($is_display['sort_lnk'] == '1') {
list($unsorted_sql_query, $drop_down_html)
= $this->_getUnsortedSqlAndSortByKeyDropDown(
$analyzed_sql, $sort_expression
);
$table_headers_html .= $drop_down_html;
}
// Output data needed for grid editing
$table_headers_html .= ''
. '
';
// Output data needed for column reordering and show/hide column
if ($this->_isSelect($analyzed_sql)) {
$table_headers_html .= $this->_getDataForResettingColumnOrder();
}
$vertical_display['emptypre'] = 0;
$vertical_display['emptyafter'] = 0;
$vertical_display['textbtn'] = '';
$full_or_partial_text_link = null;
$this->__set('vertical_display', $vertical_display);
// 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(
$is_display['del_lnk']
);
// 1. Set $colspan or $rowspan and generate html with full/partial
// text button or link
list($colspan, $rowspan, $button_html)
= $this->_getFieldVisibilityParams(
$directionCondition, $is_display, $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)
// 2.0.1 Prepare Display column comments if enabled
// ($GLOBALS['cfg']['ShowBrowseComments']).
// Do not show comments, if using horizontalflipped mode,
// because of space usage
$comments_map = $this->_getTableCommentsArray($direction, $analyzed_sql);
if ($GLOBALS['cfgRelation']['commwork']
&& $GLOBALS['cfgRelation']['mimework']
&& $GLOBALS['cfg']['BrowseMIME']
&& ! $_SESSION['tmpval']['hide_transformation']
) {
include_once './libraries/transformations.lib.php';
$this->__set(
'mime_map',
PMA_getMIME($this->__get('db'), $this->__get('table'))
);
}
// See if we have to highlight any header fields of a WHERE query.
// Uses SQL-Parser results.
$this->_setHighlightedColumnGlobalField($analyzed_sql);
list($col_order, $col_visib) = $this->_getColumnParams($analyzed_sql);
for ($j = 0; $j < $this->__get('fields_cnt'); $j++) {
// assign $i with 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.
$condition_field = (isset($highlight_columns[$fields_meta[$i]->name])
|| isset(
$highlight_columns[PMA_Util::backquote($fields_meta[$i]->name)])
)
? true
: false;
// 2.0 Prepare comment-HTML-wrappers for each row, if defined/enabled.
$comments = $this->_getCommentForRow($comments_map, $fields_meta[$i]);
$vertical_display = $this->__get('vertical_display');
if (($is_display['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, $direction, $comments,
$sort_direction, $directionCondition, $col_visib,
$col_visib[$j], $condition_field
);
$table_headers_html .= $sorted_header_html;
$vertical_display['desc'][] = '
';
} // end else (2.2)
$this->__set('vertical_display', $vertical_display);
} // end for
// Display column at rightside - checkboxes or empty column
$table_headers_html .= $this->_getColumnAtRightSide(
$is_display, $directionCondition, $full_or_partial_text_link,
$colspan, $rowspan
);
if ($directionCondition) {
$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 the analyzed query
* @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, $sort_expression
) {
$drop_down_html = '';
// Just as fallback
$unsorted_sql_query = $this->__get('sql_query');
if (isset($analyzed_sql[0]['unsorted_query'])) {
$unsorted_sql_query = $analyzed_sql[0]['unsorted_query'];
}
// Handles the case of multiple clicks on a column's header
// which would add many spaces before "ORDER BY" in the
// generated query.
$unsorted_sql_query = trim($unsorted_sql_query);
// sorting by indexes, only if it makes sense (only one table ref)
if (isset($analyzed_sql)
&& isset($analyzed_sql[0])
&& isset($analyzed_sql[0]['querytype'])
&& ($analyzed_sql[0]['querytype'] == self::QUERY_TYPE_SELECT)
&& isset($analyzed_sql[0]['table_ref'])
&& (count($analyzed_sql[0]['table_ref']) == 1)
) {
// grab indexes data:
$indexes = PMA_Index::getFromTable(
$this->__get('table'),
$this->__get('db')
);
// do we have any index?
if ($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 array $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 boolean $directionCondition display direction horizontal or
* horizontalflipped
* @param array &$is_display which elements to display
* @param string $full_or_partial_text_link full/partial link or text button
*
* @return array 3 element array - $colspan, $rowspan, $button_html
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getFieldVisibilityParams(
$directionCondition, &$is_display, $full_or_partial_text_link
) {
$button_html = '';
$colspan = $rowspan = null;
$vertical_display = $this->__get('vertical_display');
// 1. Displays the full/partial text button (part 1)...
if ($directionCondition) {
$button_html .= '
' . "\n";
} // end vertical mode
} elseif (($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_NONE)
&& ($directionCondition)
) {
// ... elseif display an empty column if the actions links are
// disabled to match the rest of the table
$button_html .= '
';
}
$this->__set('vertical_display', $vertical_display);
return array($colspan, $rowspan, $button_html);
} // end of the '_getFieldVisibilityParams()' function
/**
* Get table comments as array
*
* @param boolean $direction display direction, horizontal
* or horizontalflipped
* @param array $analyzed_sql the analyzed query
*
* @return array $comments_map table comments when condition true
* null when condition falls
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getTableCommentsArray($direction, $analyzed_sql)
{
$comments_map = null;
if ($GLOBALS['cfg']['ShowBrowseComments']
&& ($direction != self::DISP_DIR_HORIZONTAL_FLIPPED)
) {
$comments_map = array();
if (isset($analyzed_sql[0])
&& is_array($analyzed_sql[0])
&& isset($analyzed_sql[0]['table_ref'])
) {
foreach ($analyzed_sql[0]['table_ref'] as $tbl) {
$tb = $tbl['table_true_name'];
$comments_map[$tb] = PMA_getComments($this->__get('db'), $tb);
unset($tb);
}
}
}
return $comments_map;
} // end of the '_getTableCommentsArray()' function
/**
* Set global array for store highlighted header fields
*
* @param array $analyzed_sql the analyzed query
*
* @return void
*
* @access private
*
* @see _getTableHeaders()
*/
private function _setHighlightedColumnGlobalField($analyzed_sql)
{
$highlight_columns = array();
if (isset($analyzed_sql) && isset($analyzed_sql[0])
&& isset($analyzed_sql[0]['where_clause_identifiers'])
&& is_array($analyzed_sql[0]['where_clause_identifiers'])
) {
foreach ($analyzed_sql[0]['where_clause_identifiers'] as $wci) {
$highlight_columns[$wci] = '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 PMA_Table($this->__get('table'), $this->__get('db'));
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
if ($col_order) {
$data_html .= '';
}
$col_visib = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_VISIB);
if ($col_visib) {
$data_html .= '';
}
// generate table create time
if (! PMA_Table::isView($this->__get('db'), $this->__get('table'))) {
$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 PMA_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 string $empty_line empty line depend on the $place
* @param boolean $is_innodb whether its InnoDB or not
*
* @return string html content of navigation bar
*
* @access private
*
* @see _getTable()
*/
private function _getPlacedTableNavigations(
$pos_next, $pos_prev, $place, $empty_line, $is_innodb
) {
$navigation_html = '';
if ($place == self::PLACE_BOTTOM_DIRECTION_DROPDOWN) {
$navigation_html .= ' ' . "\n";
}
$navigation_html .= $this->_getTableNavigation(
$pos_next, $pos_prev, 'top_direction_dropdown', $is_innodb
);
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 the analyzed Query
* @param string $url_query String with URL Parameters
*
* @return string
*
* @access private
*
* @see _getResultsOperations()
*/
private function _getLinkForCreateView($analyzed_sql, $url_query)
{
$results_operations_html = '';
if (!PMA_DRIZZLE && !isset($analyzed_sql[0]['queryflags']['procedure'])) {
$ajax_class = ' ajax';
$results_operations_html .= ''
. PMA_Util::linkOrButton(
'view_create.php' . $url_query,
PMA_Util::getIcon(
'b_views.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 the analyzed Query
*
* @return string
*
* @access public
*
*/
public function getCreateViewQueryResultOp($analyzed_sql)
{
$results_operations_html = '';
$fake_display_mode = array();
//calling to _getResultOperations with a fake display mode
//and setting only_view parameter to be true to generate just view
$results_operations_html .= $this->_getResultsOperations(
$fake_display_mode,
$analyzed_sql,
true
);
return $results_operations_html;
}
/**
* Get operations that are available on results.
*
* @param array $the_disp_mode the display mode
* @param array $analyzed_sql the analyzed query
* @param boolean $only_view Whether to show only view
*
* @return string $results_operations_html html content
*
* @access private
*
* @see getTable()
*/
private function _getResultsOperations(
$the_disp_mode, $analyzed_sql, $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;
}
if (($the_disp_mode[6] == '1') || ($the_disp_mode[9] == '1')) {
// Displays "printable view" link if required
if ($the_disp_mode[9] == '1') {
$results_operations_html
.= PMA_Util::linkOrButton(
'sql.php' . $url_query,
PMA_Util::getIcon(
'b_print.png', __('Print view'), true
),
array('target' => 'print_view'),
true,
true,
'print_view'
)
. "\n";
if ($_SESSION['tmpval']['pftext']) {
$_url_params['pftext'] = self::DISPLAY_FULL_TEXT;
$results_operations_html
.= PMA_Util::linkOrButton(
'sql.php' . PMA_URL_getCommon($_url_params),
PMA_Util::getIcon(
'b_print.png',
__('Print view (with full texts)'), true
),
array('target' => 'print_view'),
true,
true,
'print_view'
)
. "\n";
unset($_url_params['pftext']);
}
} // 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 display_export.inc.php
// 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 (isset($analyzed_sql[0])
&& ($analyzed_sql[0]['querytype'] == self::QUERY_TYPE_SELECT)
&& ! isset($printview)
&& ! isset($analyzed_sql[0]['queryflags']['procedure'])
) {
if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name'])
&& ! isset($analyzed_sql[0]['table_ref'][1]['table_true_name'])
) {
$_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 .= PMA_Util::linkOrButton(
'tbl_export.php' . PMA_URL_getCommon($_url_params),
PMA_Util::getIcon(
'b_tblexport.png', __('Export'), true
),
'',
true,
true,
''
)
. "\n";
// prepare chart
$results_operations_html .= PMA_Util::linkOrButton(
'tbl_chart.php' . PMA_URL_getCommon($_url_params),
PMA_Util::getIcon(
'b_chart.png', __('Display chart'), true
),
'',
true,
true,
''
)
. "\n";
// prepare GIS chart
$geometry_found = false;
// If atleast 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
.= PMA_Util::linkOrButton(
'tbl_gis_visualization.php'
. PMA_URL_getCommon($_url_params),
PMA_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, $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 string $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
*
* @return mixed string or float
*
* @access private
*
* @see _getDataCellForBlobColumns(),
* _getDataCellForGeometryColumns(),
* _getDataCellForNonNumericAndNonBlobColumns(),
* _getSortedColumnMessage()
*/
private function _handleNonPrintableContents(
$category, $content, $transformation_plugin, $transform_options,
$default_function, $meta, $url_params = array()
) {
$result = '[' . $category;
if (isset($content)) {
$size = strlen($content);
$display_size = PMA_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"
&& (strpos($transformation_plugin->getMIMESubtype(), 'Octetstream')
|| strpos($transformation_plugin->getMIMEtype(), 'Text') !== false)
) {
$result = $content;
}
if ($size > 0) {
if ($default_function != $transformation_plugin) {
$result = $transformation_plugin->applyTransformation(
$result,
$transform_options,
$meta
);
} else {
$result = $this->$default_function($result, array(), $meta);
if (stristr($meta->type, self::BLOB_FIELD)
&& $_SESSION['tmpval']['display_blob']
) {
// in this case, restart from the original $content
$result = $this->_displayBinaryAsPrintable($content, 'blob');
}
/* Create link to download */
if (count($url_params) > 0) {
$result = ''
. $result . '';
}
}
}
return($result);
} // end of the '_handleNonPrintableContents()' function
/**
* 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 string $analyzed_sql 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 $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 array of options for transformation
* @param bool $is_field_truncated whether the field is truncated
*
* @return string formatted data
*
* @access private
*
* @see _getDataCellForNumericColumns(), _getDataCellForGeometryColumns(),
* _getDataCellForNonNumericAndNonBlobColumns(),
*
*/
private function _getRowData(
$class, $condition_field, $analyzed_sql, $meta, $map, $data,
$transformation_plugin, $default_function, $nowrap, $where_comparison,
$transform_options, $is_field_truncated
) {
$relational_display = $_SESSION['tmpval']['relational_display'];
$printview = $this->__get('printview');
$result = '
';
if (isset($analyzed_sql[0]['select_expr'])
&& is_array($analyzed_sql[0]['select_expr'])
) {
foreach ($analyzed_sql[0]['select_expr']
as $select_expr_position => $select_expr
) {
$alias = $analyzed_sql[0]['select_expr']
[$select_expr_position]['alias'];
if (isset($alias) && strlen($alias)) {
$true_column = $analyzed_sql[0]['select_expr']
[$select_expr_position]['column'];
if ($alias == $meta->name) {
// this change in the parameter does not matter
// outside of the function
$meta->name = $true_column;
} // end if
} // end if
} // end foreach
} // end if
if (isset($map[$meta->name])) {
// Field to display from the foreign table?
if (isset($map[$meta->name][2]) && strlen($map[$meta->name][2])) {
$dispsql = 'SELECT '
. PMA_Util::backquote($map[$meta->name][2])
. ' FROM '
. PMA_Util::backquote($map[$meta->name][3])
. '.'
. PMA_Util::backquote($map[$meta->name][0])
. ' WHERE '
. PMA_Util::backquote($map[$meta->name][1])
. $where_comparison;
$dispresult = $GLOBALS['dbi']->tryQuery(
$dispsql,
null,
PMA_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);
} else {
$dispval = '';
} // end if... else...
if (isset($printview) && ($printview == '1')) {
$result .= ($transformation_plugin != $default_function
? $transformation_plugin->applyTransformation(
$data,
$transform_options,
$meta
)
: $this->$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))
? ' title="' . htmlspecialchars($dispval) . '"'
: '';
} else {
$title = ' title="' . htmlspecialchars($data) . '"';
}
$_url_params = array(
'db' => $map[$meta->name][3],
'table' => $map[$meta->name][0],
'pos' => '0',
'sql_query' => 'SELECT * FROM '
. PMA_Util::backquote(
$map[$meta->name][3]
) . '.'
. PMA_Util::backquote(
$map[$meta->name][0]
)
. ' WHERE '
. PMA_Util::backquote(
$map[$meta->name][1]
)
. $where_comparison,
);
$result .= '';
if ($transformation_plugin != $default_function) {
// always apply a transformation on the real data,
// not on the display field
$result .= $transformation_plugin->applyTransformation(
$data,
$transform_options,
$meta
);
} else {
if ($relational_display == self::RELATIONAL_DISPLAY_COLUMN) {
// user chose "relational display field" in the
// display options, so show display field in the cell
$result .= $this->$default_function($dispval);
} else {
// otherwise display data in the cell
$result .= $this->$default_function($data);
}
}
$result .= '';
}
} else {
$result .= ($transformation_plugin != $default_function
? $transformation_plugin->applyTransformation(
$data,
$transform_options,
$meta
)
: $this->$default_function($data)
);
}
// create hidden field if results from structure table
if (isset($_GET['browse_distinct']) && ($_GET['browse_distinct'] == 1)) {
$where_comparison = " = '" . $data . "'";
$_url_params_for_show_data_row = array(
'db' => $this->__get('db'),
'table' => $meta->orgtable,
'pos' => '0',
'sql_query' => 'SELECT * FROM '
. PMA_Util::backquote($this->__get('db'))
. '.' . PMA_Util::backquote($meta->orgtable)
. ' WHERE '
. PMA_Util::backquote($meta->orgname)
. $where_comparison,
);
$result .= '';
}
$result .= '
' . "\n";
return $result;
} // end of the '_getRowData()' function
/**
* Prepares a checkbox for multi-row submits
*
* @param string $del_url delete url
* @param array $is_display 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 $del_query delete query
* @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, $is_display, $row_no, $where_clause_html, $condition_array,
$del_query, $id_suffix, $class
) {
$ret = '';
if (! empty($del_url) && $is_display['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 .= '
'
. PMA_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 .= '
'
. PMA_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)) {
$ret .= '