本文整理汇总了PHP中PMA_getDisplayField函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_getDisplayField函数的具体用法?PHP PMA_getDisplayField怎么用?PHP PMA_getDisplayField使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_getDisplayField函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_tables_info
/**
* retrieves table info and stores it in $GLOBALS['PMD']
*
* @return array with table info
*/
function get_tables_info()
{
$retval = array();
$GLOBALS['PMD']['TABLE_NAME'] = array();
// that foreach no error
$GLOBALS['PMD']['OWNER'] = array();
$GLOBALS['PMD']['TABLE_NAME_SMALL'] = array();
$tables = PMA_DBI_get_tables_full($GLOBALS['db']);
// seems to be needed later
PMA_DBI_select_db($GLOBALS['db']);
$i = 0;
foreach ($tables as $one_table) {
$GLOBALS['PMD']['TABLE_NAME'][$i] = $GLOBALS['db'] . "." . $one_table['TABLE_NAME'];
$GLOBALS['PMD']['OWNER'][$i] = $GLOBALS['db'];
$GLOBALS['PMD']['TABLE_NAME_SMALL'][$i] = $one_table['TABLE_NAME'];
$GLOBALS['PMD_URL']['TABLE_NAME'][$i] = urlencode($GLOBALS['db'] . "." . $one_table['TABLE_NAME']);
$GLOBALS['PMD_URL']['OWNER'][$i] = urlencode($GLOBALS['db']);
$GLOBALS['PMD_URL']['TABLE_NAME_SMALL'][$i] = urlencode($one_table['TABLE_NAME']);
$GLOBALS['PMD_OUT']['TABLE_NAME'][$i] = htmlspecialchars($GLOBALS['db'] . "." . $one_table['TABLE_NAME'], ENT_QUOTES);
$GLOBALS['PMD_OUT']['OWNER'][$i] = htmlspecialchars($GLOBALS['db'], ENT_QUOTES);
$GLOBALS['PMD_OUT']['TABLE_NAME_SMALL'][$i] = htmlspecialchars($one_table['TABLE_NAME'], ENT_QUOTES);
$GLOBALS['PMD']['TABLE_TYPE'][$i] = strtoupper($one_table['ENGINE']);
$DF = PMA_getDisplayField($GLOBALS['db'], $one_table['TABLE_NAME']);
if ($DF != '') {
$retval[$GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i]] = urlencode($DF);
}
$i++;
}
return $retval;
}
示例2: get_tabs
/**
* retrieves table info and stores it in $GLOBALS['PMD']
*
* @uses $GLOBALS['script_display_field']
* @uses $GLOBALS['PMD'] to fill it
* @uses $GLOBALS['db']
* @uses PMA_DBI_get_tables_full()
* @uses PMA_DBI_select_db()
* @uses PMA_getDisplayField()
* @uses urlencode()
* @uses htmlspecialchars()
* @uses strtoupper()
* @uses urlencode()
*/
function get_tabs()
{
$GLOBALS['PMD']['TABLE_NAME'] = array();
// that foreach no error
$GLOBALS['PMD']['OWNER'] = array();
$GLOBALS['PMD']['TABLE_NAME_SMALL'] = array();
$tables = PMA_DBI_get_tables_full($GLOBALS['db']);
// seems to be needed later
PMA_DBI_select_db($GLOBALS['db']);
$i = 0;
foreach ($tables as $one_table) {
$GLOBALS['PMD']['TABLE_NAME'][$i] = $GLOBALS['db'] . "." . $one_table['TABLE_NAME'];
$GLOBALS['PMD']['OWNER'][$i] = $GLOBALS['db'];
$GLOBALS['PMD']['TABLE_NAME_SMALL'][$i] = $one_table['TABLE_NAME'];
$GLOBALS['PMD_URL']['TABLE_NAME'][$i] = urlencode($GLOBALS['db'] . "." . $one_table['TABLE_NAME']);
$GLOBALS['PMD_URL']['OWNER'][$i] = urlencode($GLOBALS['db']);
$GLOBALS['PMD_URL']['TABLE_NAME_SMALL'][$i] = urlencode($one_table['TABLE_NAME']);
$GLOBALS['PMD_OUT']['TABLE_NAME'][$i] = htmlspecialchars($GLOBALS['db'] . "." . $one_table['TABLE_NAME'], ENT_QUOTES);
$GLOBALS['PMD_OUT']['OWNER'][$i] = htmlspecialchars($GLOBALS['db'], ENT_QUOTES);
$GLOBALS['PMD_OUT']['TABLE_NAME_SMALL'][$i] = htmlspecialchars($one_table['TABLE_NAME'], ENT_QUOTES);
$GLOBALS['PMD']['TABLE_TYPE'][$i] = strtoupper($one_table['ENGINE']);
$DF = PMA_getDisplayField($GLOBALS['db'], $one_table['TABLE_NAME']);
if ($DF != '') {
$GLOBALS['script_display_field'] .= " display_field['" . $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i] . "'] = '" . urlencode($DF) . "';\n";
}
$i++;
}
$GLOBALS['script_display_field'] .= '// ]]>' . "\n" . '</script>' . "\n";
// return $GLOBALS['PMD']; // many bases // not use ??????
}
示例3: _setParamForLinkForiegnKeyRelatedTables
/**
* Set the value of $map array for linking foreign key related tables
*
* @param array &$map the list of relations
*
* @return void
*
* @access private
*
* @see getTable()
*/
private function _setParamForLinkForiegnKeyRelatedTables(&$map)
{
// To be able to later display a link to the related table,
// we verify both types of relations: either those that are
// native foreign keys or those defined in the phpMyAdmin
// configuration storage. If no PMA storage, we won't be able
// to use the "column to display" notion (for example show
// the name related to a numeric id).
$exist_rel = PMA_getForeigners($this->__get('_db'), $this->__get('_table'), '', self::POSITION_BOTH);
if ($exist_rel) {
foreach ($exist_rel as $master_field => $rel) {
$display_field = PMA_getDisplayField($rel['foreign_db'], $rel['foreign_table']);
$map[$master_field] = array($rel['foreign_table'], $rel['foreign_field'], $display_field, $rel['foreign_db']);
}
// end while
}
// end if
}
示例4: PMA_getHtmlForDisplayFieldInfos
/**
* Function to get html for display field infos
*
* @param string $db current database
* @param string $table current table
* @param array $save_row save row
*
* @return string
*/
function PMA_getHtmlForDisplayFieldInfos($db, $table, $save_row)
{
$disp = PMA_getDisplayField($db, $table);
$html_output = '<fieldset>' . '<label>' . __('Choose column to display:') . '</label>' . '<select name="display_field">' . '<option value="">---</option>';
foreach ($save_row as $row) {
$html_output .= '<option value="' . htmlspecialchars($row['Field']) . '"';
if (isset($disp) && $row['Field'] == $disp) {
$html_output .= ' selected="selected"';
}
$html_output .= '>' . htmlspecialchars($row['Field']) . '</option>' . "\n";
}
// end while
$html_output .= '</select>' . '</fieldset>';
return $html_output;
}
示例5: _setParamForLinkForeignKeyRelatedTables
/**
* Set the value of $map array for linking foreign key related tables
*
* @param array &$map the list of relations
*
* @return void
*
* @access private
*
* @see getTable()
*/
private function _setParamForLinkForeignKeyRelatedTables(&$map)
{
// To be able to later display a link to the related table,
// we verify both types of relations: either those that are
// native foreign keys or those defined in the phpMyAdmin
// configuration storage. If no PMA storage, we won't be able
// to use the "column to display" notion (for example show
// the name related to a numeric id).
$exist_rel = PMA_getForeigners($this->__get('db'), $this->__get('table'), '', self::POSITION_BOTH);
if ($exist_rel) {
foreach ($exist_rel as $master_field => $rel) {
if ($master_field != 'foreign_keys_data') {
$display_field = PMA_getDisplayField($rel['foreign_db'], $rel['foreign_table']);
$map[$master_field] = array($rel['foreign_table'], $rel['foreign_field'], $display_field, $rel['foreign_db']);
} else {
foreach ($rel as $key => $one_key) {
foreach ($one_key['index_list'] as $index => $one_field) {
$display_field = PMA_getDisplayField(isset($one_key['ref_db_name']) ? $one_key['ref_db_name'] : $GLOBALS['db'], $one_key['ref_table_name']);
$map[$one_field] = array($one_key['ref_table_name'], $one_key['ref_index_list'][$index], $display_field, isset($one_key['ref_db_name']) ? $one_key['ref_db_name'] : $GLOBALS['db']);
}
}
}
}
// end while
}
// end if
}
示例6: PMA_displayTable
//.........这里部分代码省略.........
// for example in MySQL 5.0.x, the query SHOW STATUS
// returns STATUS as a table name
$table = $fields_meta[0]->table;
} else {
$table = '';
}
}
if ($is_display['nav_bar'] == '1') {
PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, 'top_direction_dropdown');
echo "\n";
} elseif (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
echo "\n" . '<br /><br />' . "\n";
}
// 2b ----- Get field references from Database -----
// (see the 'relation' configuration variable)
// loic1, 2002-03-02: extended to php3
// initialize map
$map = array();
// find tables
$target = array();
if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) {
foreach ($analyzed_sql[0]['table_ref'] as $table_ref_position => $table_ref) {
$target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name'];
}
}
$tabs = '(\'' . join('\',\'', $target) . '\')';
if ($cfgRelation['displaywork']) {
if (!strlen($table)) {
$exist_rel = false;
} else {
$exist_rel = PMA_getForeigners($db, $table, '', 'both');
if ($exist_rel) {
foreach ($exist_rel as $master_field => $rel) {
$display_field = PMA_getDisplayField($rel['foreign_db'], $rel['foreign_table']);
$map[$master_field] = array($rel['foreign_table'], $rel['foreign_field'], $display_field, $rel['foreign_db']);
}
// end while
}
// end if
}
// end if
}
// end if
// end 2b
// 3. ----- Displays the results table -----
PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $analyzed_sql, $sort_expression, $sort_expression_nodirection, $sort_direction);
$url_query = '';
echo '<tbody>' . "\n";
$clause_is_unique = PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql);
// vertical output case
if ($_SESSION['tmp_user_values']['disp_direction'] == 'vertical') {
PMA_displayVerticalTable();
}
// end if
unset($vertical_display);
echo '</tbody>' . "\n";
?>
</table>
<?php
// 4. ----- Displays the link for multi-fields edit and delete
if ($is_display['del_lnk'] == 'dr' && $is_display['del_lnk'] != 'kp') {
$delete_text = $is_display['del_lnk'] == 'dr' ? $GLOBALS['strDelete'] : $GLOBALS['strKill'];
$_url_params = array('db' => $db, 'table' => $table, 'sql_query' => $sql_query, 'goto' => $goto);
$uncheckall_url = 'sql.php' . PMA_generate_common_url($_url_params);
$_url_params['checkall'] = '1';
示例7: PMA_saveDisplayField
/**
* Saves the display field for a table.
*
* @param string $db database name
* @param string $table table name
* @param string $field display field name
*
* @return boolean
*/
function PMA_saveDisplayField($db, $table, $field)
{
$cfgRelation = PMA_getRelationsParam();
if (!$cfgRelation['displaywork']) {
return false;
}
$disp = PMA_getDisplayField($db, $table);
if ($disp && $disp === $field) {
$field = '';
}
$upd_query = new PMA_Table($table, $db, $GLOBALS['dbi']);
$upd_query->updateDisplayField($disp, $field, $cfgRelation);
return true;
}
示例8: indexAction
/**
* Index action
*
* @return void
*/
public function indexAction()
{
switch ($this->_searchType) {
case 'replace':
if (isset($_POST['find'])) {
$this->findAction();
return;
}
$this->response->getHeader()->getScripts()->addFile('tbl_find_replace.js');
if (isset($_POST['replace'])) {
$this->replaceAction();
}
// Displays the find and replace form
$this->displaySelectionFormAction();
break;
case 'normal':
$this->response->getHeader()->getScripts()->addFiles(array('makegrid.js', 'sql.js', 'tbl_select.js', 'tbl_change.js', 'jquery/jquery-ui-timepicker-addon.js', 'jquery/jquery.uitablefilter.js', 'gis_data_editor.js'));
if (isset($_REQUEST['range_search'])) {
$this->rangeSearchAction();
return;
}
/**
* No selection criteria received -> display the selection form
*/
if (!isset($_POST['columnsToDisplay']) && !isset($_POST['displayAllColumns'])) {
$this->displaySelectionFormAction();
} else {
$this->doSelectionAction();
}
break;
case 'zoom':
$this->response->getHeader()->getScripts()->addFiles(array('makegrid.js', 'sql.js', 'jqplot/jquery.jqplot.js', 'jqplot/plugins/jqplot.canvasTextRenderer.js', 'jqplot/plugins/jqplot.canvasAxisLabelRenderer.js', 'jqplot/plugins/jqplot.dateAxisRenderer.js', 'jqplot/plugins/jqplot.highlighter.js', 'jqplot/plugins/jqplot.cursor.js', 'jquery/jquery-ui-timepicker-addon.js', 'tbl_zoom_plot_jqplot.js', 'tbl_change.js'));
/**
* Handle AJAX request for data row on point select
*
* @var boolean Object containing parameters for the POST request
*/
if (isset($_REQUEST['get_data_row']) && $_REQUEST['get_data_row'] == true) {
$this->getDataRowAction();
return;
}
/**
* Handle AJAX request for changing field information
* (value,collation,operators,field values) in input form
*
* @var boolean Object containing parameters for the POST request
*/
if (isset($_REQUEST['change_tbl_info']) && $_REQUEST['change_tbl_info'] == true) {
$this->changeTableInfoAction();
return;
}
// Gets tables information
include_once './libraries/tbl_info.inc.php';
//Set default datalabel if not selected
if (!isset($_POST['zoom_submit']) || $_POST['dataLabel'] == '') {
$dataLabel = PMA_getDisplayField($this->db, $this->table);
} else {
$dataLabel = $_POST['dataLabel'];
}
// Displays the zoom search form
$this->displaySelectionFormAction($dataLabel);
/*
* Handle the input criteria and generate the query result
* Form for displaying query results
*/
if (isset($_POST['zoom_submit']) && $_POST['criteriaColumnNames'][0] != 'pma_null' && $_POST['criteriaColumnNames'][1] != 'pma_null' && $_POST['criteriaColumnNames'][0] != $_POST['criteriaColumnNames'][1]) {
if (!isset($goto)) {
$goto = Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabTable'], 'table');
}
$this->zoomSubmitAction($dataLabel, $goto);
}
break;
}
}
示例9: PMA_displayTable
//.........这里部分代码省略.........
}
// 2.3 Displays the navigation bars
if (!isset($table) || strlen(trim($table)) == 0) {
$table = $fields_meta[0]->table;
}
if ($is_display['nav_bar'] == '1') {
PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
echo "\n";
} else {
if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
echo "\n" . '<br /><br />' . "\n";
}
}
// 2b ----- Get field references from Database -----
// (see the 'relation' config variable)
// loic1, 2002-03-02: extended to php3
// init map
$map = array();
// find tables
$target = array();
if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) {
foreach ($analyzed_sql[0]['table_ref'] as $table_ref_position => $table_ref) {
$target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name'];
}
}
$tabs = '(\'' . join('\',\'', $target) . '\')';
if ($cfgRelation['displaywork']) {
if (empty($table)) {
$exist_rel = FALSE;
} else {
$exist_rel = PMA_getForeigners($db, $table, '', 'both');
if ($exist_rel) {
foreach ($exist_rel as $master_field => $rel) {
$display_field = PMA_getDisplayField($rel['foreign_db'], $rel['foreign_table']);
$map[$master_field] = array($rel['foreign_table'], $rel['foreign_field'], $display_field, $rel['foreign_db']);
}
// end while
}
// end if
}
// end if
}
// end if
// end 2b
// 3. ----- Displays the results table -----
PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $analyzed_sql);
$url_query = '';
PMA_displayTableBody($dt_result, $is_display, $map, $analyzed_sql);
// vertical output case
if ($disp_direction == 'vertical') {
PMA_displayVerticalTable();
}
// end if
unset($vertical_display);
?>
</table>
<?php
echo "\n";
// 4. ----- Displays the link for multi-fields delete
if ($is_display['del_lnk'] == 'dr' && $is_display['del_lnk'] != 'kp') {
$delete_text = $is_display['del_lnk'] == 'dr' ? $GLOBALS['strDelete'] : $GLOBALS['strKill'];
$propicon = (string) $GLOBALS['cfg']['PropertiesIconic'];
?>
<img src="<?php
echo $GLOBALS['pmaThemeImage'] . 'arrow_' . $GLOBALS['text_dir'] . '.png';
?>
示例10: indexAction
/**
* Index action
*
* @return void
*/
public function indexAction()
{
switch ($this->_searchType) {
case 'replace':
if (isset($_POST['find'])) {
$this->findAction();
return;
}
$this->response->getHeader()->getScripts()->addFile('tbl_find_replace.js');
// Show secondary level of tabs
$this->response->addHTML(Template::get('secondary_tabs')->render(array('url_params' => array('db' => $this->db, 'table' => $this->table), 'sub_tabs' => $this->_getSubTabs())));
if (isset($_POST['replace'])) {
$this->replaceAction();
}
if (!isset($goto)) {
$goto = Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabTable'], 'table');
}
// Defines the url to return to in case of error in the next sql
// statement
$params = array('db' => $this->db, 'table' => $this->table);
$err_url = $goto . '?' . PMA_URL_getCommon($params);
// Displays the find and replace form
$this->response->addHTML(Template::get('table/search/selection_form')->render(array('searchType' => $this->_searchType, 'db' => $this->db, 'table' => $this->table, 'goto' => $goto, 'self' => $this, 'geomColumnFlag' => $this->_geomColumnFlag, 'columnNames' => $this->_columnNames, 'columnTypes' => $this->_columnTypes, 'columnCollations' => $this->_columnCollations, 'dataLabel' => null)));
break;
case 'normal':
$this->response->getHeader()->getScripts()->addFiles(array('makegrid.js', 'sql.js', 'tbl_select.js', 'tbl_change.js', 'jquery/jquery-ui-timepicker-addon.js', 'jquery/jquery.uitablefilter.js', 'gis_data_editor.js'));
if (isset($_REQUEST['range_search'])) {
$this->rangeSearchAction();
return;
}
/**
* No selection criteria received -> display the selection form
*/
if (!isset($_POST['columnsToDisplay']) && !isset($_POST['displayAllColumns'])) {
$this->displaySelectionFormAction();
} else {
$this->doSelectionAction();
}
break;
case 'zoom':
$this->response->getHeader()->getScripts()->addFiles(array('makegrid.js', 'sql.js', 'jqplot/jquery.jqplot.js', 'jqplot/plugins/jqplot.canvasTextRenderer.js', 'jqplot/plugins/jqplot.canvasAxisLabelRenderer.js', 'jqplot/plugins/jqplot.dateAxisRenderer.js', 'jqplot/plugins/jqplot.highlighter.js', 'jqplot/plugins/jqplot.cursor.js', 'canvg/canvg.js', 'jquery/jquery-ui-timepicker-addon.js', 'tbl_zoom_plot_jqplot.js', 'tbl_change.js'));
/**
* Handle AJAX request for data row on point select
*
* @var boolean Object containing parameters for the POST request
*/
if (isset($_REQUEST['get_data_row']) && $_REQUEST['get_data_row'] == true) {
$this->getDataRowAction();
return;
}
/**
* Handle AJAX request for changing field information
* (value,collation,operators,field values) in input form
*
* @var boolean Object containing parameters for the POST request
*/
if (isset($_REQUEST['change_tbl_info']) && $_REQUEST['change_tbl_info'] == true) {
$this->changeTableInfoAction();
return;
}
$this->url_query .= '&goto=tbl_select.php&back=tbl_select.php';
// Gets tables information
include_once './libraries/tbl_info.inc.php';
if (!isset($goto)) {
$goto = Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabTable'], 'table');
}
// Defines the url to return to in case of error in the next sql
// statement
$err_url = $goto . PMA_URL_getCommon(array('db' => $this->db, 'table' => $this->table));
//Set default datalabel if not selected
if (!isset($_POST['zoom_submit']) || $_POST['dataLabel'] == '') {
$dataLabel = PMA_getDisplayField($this->db, $this->table);
} else {
$dataLabel = $_POST['dataLabel'];
}
// Displays the zoom search form
$this->response->addHTML(Template::get('secondary_tabs')->render(array('url_params' => array('db' => $this->db, 'table' => $this->table), 'sub_tabs' => $this->_getSubTabs())));
$this->response->addHTML(Template::get('table/search/selection_form')->render(array('searchType' => $this->_searchType, 'db' => $this->db, 'table' => $this->table, 'goto' => $goto, 'self' => $this, 'geomColumnFlag' => $this->_geomColumnFlag, 'columnNames' => $this->_columnNames, 'columnTypes' => $this->_columnTypes, 'columnCollations' => $this->_columnCollations, 'dataLabel' => $dataLabel)));
/*
* Handle the input criteria and generate the query result
* Form for displaying query results
*/
if (isset($_POST['zoom_submit']) && $_POST['criteriaColumnNames'][0] != 'pma_null' && $_POST['criteriaColumnNames'][1] != 'pma_null' && $_POST['criteriaColumnNames'][0] != $_POST['criteriaColumnNames'][1]) {
$this->zoomSubmitAction($dataLabel, $goto);
}
break;
}
}
示例11: testPMARelationsCleanupColumn
/**
* Test for PMA_relationsCleanupColumn
*
* @return void
* @group medium
*/
public function testPMARelationsCleanupColumn()
{
$db = "PMA";
$table = "PMA_bookmark";
$column = "name";
$this->redefineRelation();
//the $cfgRelation value before cleanup column
$cfgRelation = PMA_checkRelationsParam();
$this->assertEquals(true, $cfgRelation['commwork']);
//validate PMA_getDbComments when commwork = true
$db_comments = PMA_getDbComments();
$this->assertEquals(array('db_name0' => 'comment0', 'db_name1' => 'comment1'), $db_comments);
$this->assertEquals(true, $cfgRelation['displaywork']);
//validate PMA_getDisplayField when displaywork = true
$display_field = PMA_getDisplayField($db, $table);
$this->assertEquals('PMA_display_field', $display_field);
$this->assertEquals(true, $cfgRelation['relwork']);
$this->assertEquals('column_info', $cfgRelation['column_info']);
$this->assertEquals('table_info', $cfgRelation['table_info']);
$this->assertEquals('relation', $cfgRelation['relation']);
//cleanup
PMA_relationsCleanupColumn($db, $table, $column);
//the $cfgRelation value after cleanup column
$cfgRelation = PMA_checkRelationsParam();
$is_defined_column_info = isset($cfgRelation['column_info']) ? $cfgRelation['column_info'] : null;
$is_defined_table_info = isset($cfgRelation['table_info']) ? $cfgRelation['table_info'] : null;
$is_defined_relation = isset($cfgRelation['relation']) ? $cfgRelation['relation'] : null;
$this->assertEquals(null, $is_defined_column_info);
$this->assertEquals(null, $is_defined_table_info);
$this->assertEquals(null, $is_defined_relation);
}
示例12: PMA_getForeigners
* transformed fields, if they were edited. After that, output the correct
* link/transformed value and exit
*
* Logic taken from libraries/display_tbl.lib.php
*/
if (isset($_REQUEST['rel_fields_list']) && $_REQUEST['rel_fields_list'] != '') {
//handle relations work here for updated row.
include_once './libraries/relation.lib.php';
$map = PMA_getForeigners($db, $table, '', 'both');
$rel_fields = array();
parse_str($_REQUEST['rel_fields_list'], $rel_fields);
// loop for each relation cell
foreach ($rel_fields as $cell_index => $curr_cell_rel_field) {
foreach ($curr_cell_rel_field as $rel_field => $rel_field_value) {
$where_comparison = "='" . $rel_field_value . "'";
$display_field = PMA_getDisplayField($map[$rel_field]['foreign_db'], $map[$rel_field]['foreign_table']);
// Field to display from the foreign table?
if (isset($display_field) && strlen($display_field)) {
$dispsql = 'SELECT ' . PMA_backquote($display_field) . ' FROM ' . PMA_backquote($map[$rel_field]['foreign_db']) . '.' . PMA_backquote($map[$rel_field]['foreign_table']) . ' WHERE ' . PMA_backquote($map[$rel_field]['foreign_field']) . $where_comparison;
$dispresult = PMA_DBI_try_query($dispsql, null, PMA_DBI_QUERY_STORE);
if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
list($dispval) = PMA_DBI_fetch_row($dispresult, 0);
} else {
//$dispval = __('Link not found');
}
@PMA_DBI_free_result($dispresult);
} else {
$dispval = '';
}
// end if... else...
if ('K' == $_SESSION['tmp_user_values']['relational_display']) {
示例13: PMA_countRecords
$foreign_link = false;
if ($foreigners && isset($foreigners[$field])) {
$foreigner = $foreigners[$field];
$foreign_db = $foreigner['foreign_db'];
$foreign_table = $foreigner['foreign_table'];
$foreign_field = $foreigner['foreign_field'];
// Count number of rows in the foreign table. Currently we do
// not use a drop-down if more than 200 rows in the foreign table,
// for speed reasons and because we need a better interface for this.
//
// We could also do the SELECT anyway, with a LIMIT, and ensure that
// the current value of the field is one of the choices.
$the_total = PMA_countRecords($foreign_db, $foreign_table, TRUE);
if (isset($override_total) && $override_total == true || $the_total < 200) {
// foreign_display can be FALSE if no display field defined:
$foreign_display = PMA_getDisplayField($foreign_db, $foreign_table);
$dispsql = 'SELECT ' . PMA_backquote($foreign_field) . ($foreign_display == FALSE ? '' : ', ' . PMA_backquote($foreign_display)) . ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table) . ($foreign_display == FALSE ? '' : ' ORDER BY ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($foreign_display)) . (isset($foreign_limit) ? $foreign_limit : '');
$disp = PMA_DBI_query($dispsql);
if ($disp) {
// garvin: If a resultset has been created, pre-cache it in the $disp_row array
// This helps us from not needing to use mysql_data_seek by accessing a pre-cached
// PHP array. Usually those resultsets are not that big, so a performance hit should
// not be expected.
$disp_row = array();
while ($single_disp_row = @PMA_DBI_fetch_assoc($disp)) {
$disp_row[] = $single_disp_row;
}
@PMA_DBI_free_result($disp);
}
} else {
unset($disp_row);
示例14: __construct
/**
* The "PMA_RT_Table" constructor
*
* @param string $ The table name
* @param integer $ The font size
* @param integer $ The max. with among tables
* @global object The current PDF document
* @global integer The current page number (from the
* $cfg['Servers'][$i]['table_coords'] table)
* @global array The relations settings
* @global string The current db name
* @access private
* @see PMA_PDF, PMA_RT_Table::PMA_RT_Table_setWidth,
PMA_RT_Table::PMA_RT_Table_setHeight
*/
function __construct($table_name, $ff, &$same_wide_width, $show_keys)
{
global $pdf, $pdf_page_number, $cfgRelation, $db;
$this->table_name = $table_name;
$sql = 'DESCRIBE ' . PMA_backquote($table_name);
$result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
if (!$result || !PMA_DBI_num_rows($result)) {
$pdf->PMA_PDF_die(sprintf($GLOBALS['strPdfInvalidTblName'], $table_name));
}
// load fields
//check to see if it will load all fields or only the foreign keys
if ($show_keys) {
$indexes = PMA_Index::getFromTable($this->table_name, $db);
$all_columns = array();
foreach ($indexes as $index) {
$all_columns = array_merge($all_columns, array_flip(array_keys($index->getColumns())));
}
$this->fields = array_keys($all_columns);
} else {
while ($row = PMA_DBI_fetch_row($result)) {
$this->fields[] = $row[0];
}
}
// height and width
$this->PMA_RT_Table_setWidth($ff);
$this->PMA_RT_Table_setHeight();
if ($same_wide_width < $this->width) {
$same_wide_width = $this->width;
}
// x and y
$sql = 'SELECT x, y FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table_name) . '\'' . ' AND pdf_page_number = ' . $pdf_page_number;
$result = PMA_query_as_cu($sql, false, PMA_DBI_QUERY_STORE);
if (!$result || !PMA_DBI_num_rows($result)) {
$pdf->PMA_PDF_die(sprintf($GLOBALS['strConfigureTableCoord'], $table_name));
}
list($this->x, $this->y) = PMA_DBI_fetch_row($result);
$this->x = (double) $this->x;
$this->y = (double) $this->y;
// displayfield
$this->displayfield = PMA_getDisplayField($db, $table_name);
// index
$result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($table_name) . ';', null, PMA_DBI_QUERY_STORE);
if (PMA_DBI_num_rows($result) > 0) {
while ($row = PMA_DBI_fetch_assoc($result)) {
if ($row['Key_name'] == 'PRIMARY') {
$this->primary[] = $row['Column_name'];
}
}
}
// end if
}
示例15: PMA_getDisplayValueForForeignTableColumn
/**
* Column to display from the foreign table?
*
* @param string $where_comparison string that contain relation field value
* @param string $relation_field_value relation field value
* @param array $map all Relations to foreign tables for a given
* table or optionally a given column in a table
* @param string $relation_field relation field
*
* @return string $dispval display value from the foriegn table
*/
function PMA_getDisplayValueForForeignTableColumn($where_comparison, $relation_field_value, $map, $relation_field)
{
$display_field = PMA_getDisplayField($map[$relation_field]['foreign_db'], $map[$relation_field]['foreign_table']);
// Field to display from the foreign table?
if (isset($display_field) && strlen($display_field)) {
$dispsql = 'SELECT ' . PMA_Util::backquote($display_field) . ' FROM ' . PMA_Util::backquote($map[$relation_field]['foreign_db']) . '.' . PMA_Util::backquote($map[$relation_field]['foreign_table']) . ' WHERE ' . PMA_Util::backquote($map[$relation_field]['foreign_field']) . $where_comparison;
$dispresult = PMA_DBI_try_query($dispsql, null, PMA_DBI_QUERY_STORE);
if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
list($dispval) = PMA_DBI_fetch_row($dispresult, 0);
}
@PMA_DBI_free_result($dispresult);
return $dispval;
}
return '';
}