本文整理汇总了PHP中PMA\libraries\Util::buildActionTitles方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::buildActionTitles方法的具体用法?PHP Util::buildActionTitles怎么用?PHP Util::buildActionTitles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA\libraries\Util
的用法示例。
在下文中一共展示了Util::buildActionTitles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayTableList
/**
* Displays the list of tables
*
* @return void
*/
protected function displayTableList()
{
// table form
$this->response->addHTML(Template::get('database/structure/table_header')->render(array('db' => $this->db, 'db_is_system_schema' => $this->_db_is_system_schema, 'replication' => $GLOBALS['replication_info']['slave']['status'])));
$i = $sum_entries = 0;
$overhead_check = '';
$create_time_all = '';
$update_time_all = '';
$check_time_all = '';
$num_columns = $GLOBALS['cfg']['PropertiesNumColumns'] > 1 ? ceil($this->_num_tables / $GLOBALS['cfg']['PropertiesNumColumns']) + 1 : 0;
$row_count = 0;
$sum_size = (double) 0;
$overhead_size = (double) 0;
$hidden_fields = array();
$odd_row = true;
$overall_approx_rows = false;
foreach ($this->_tables as $keyname => $current_table) {
// Get valid statistics whatever is the table type
$drop_query = '';
$drop_message = '';
$overhead = '';
$table_is_view = false;
$table_encoded = urlencode($current_table['TABLE_NAME']);
// Sets parameters for links
$tbl_url_query = $this->_url_query . '&table=' . $table_encoded;
// do not list the previous table's size info for a view
list($current_table, $formatted_size, $unit, $formatted_overhead, $overhead_unit, $overhead_size, $table_is_view, $sum_size) = $this->getStuffForEngineTypeTable($current_table, $sum_size, $overhead_size);
$curTable = $this->dbi->getTable($this->db, $current_table['TABLE_NAME']);
if (!$curTable->isMerge()) {
$sum_entries += $current_table['TABLE_ROWS'];
}
if (isset($current_table['Collation'])) {
$collation = '<dfn title="' . PMA_getCollationDescr($current_table['Collation']) . '">' . $current_table['Collation'] . '</dfn>';
} else {
$collation = '---';
}
if ($this->_is_show_stats) {
if ($formatted_overhead != '') {
$overhead = '<a href="tbl_structure.php' . $tbl_url_query . '#showusage">' . '<span>' . $formatted_overhead . '</span> ' . '<span class="unit">' . $overhead_unit . '</span>' . '</a>' . "\n";
$overhead_check .= "markAllRows('row_tbl_" . ($i + 1) . "');";
} else {
$overhead = '-';
}
}
// end if
$showtable = $this->dbi->getTable($this->db, $current_table['TABLE_NAME'])->getStatusInfo(null, true);
if ($GLOBALS['cfg']['ShowDbStructureCreation']) {
$create_time = isset($showtable['Create_time']) ? $showtable['Create_time'] : '';
if ($create_time && (!$create_time_all || $create_time < $create_time_all)) {
$create_time_all = $create_time;
}
}
if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) {
// $showtable might already be set from ShowDbStructureCreation,
// see above
$update_time = isset($showtable['Update_time']) ? $showtable['Update_time'] : '';
if ($update_time && (!$update_time_all || $update_time < $update_time_all)) {
$update_time_all = $update_time;
}
}
if ($GLOBALS['cfg']['ShowDbStructureLastCheck']) {
// $showtable might already be set from ShowDbStructureCreation,
// see above
$check_time = isset($showtable['Check_time']) ? $showtable['Check_time'] : '';
if ($check_time && (!$check_time_all || $check_time < $check_time_all)) {
$check_time_all = $check_time;
}
}
$truename = htmlspecialchars(!empty($tooltip_truename) && isset($tooltip_truename[$current_table['TABLE_NAME']]) ? $tooltip_truename[$current_table['TABLE_NAME']] : $current_table['TABLE_NAME']);
$truename = str_replace(' ', ' ', $truename);
$i++;
$row_count++;
if ($table_is_view) {
$hidden_fields[] = '<input type="hidden" name="views[]" value="' . htmlspecialchars($current_table['TABLE_NAME']) . '" />';
}
/*
* Always activate links for Browse, Search and Empty, even if
* the icons are greyed, because
* 1. for views, we don't know the number of rows at this point
* 2. for tables, another source could have populated them since the
* page was generated
*
* I could have used the PHP ternary conditional operator but I find
* the code easier to read without this operator.
*/
$may_have_rows = $current_table['TABLE_ROWS'] > 0 || $table_is_view;
$titles = Util::buildActionTitles();
$browse_table = Template::get('database/structure/browse_table')->render(array('tbl_url_query' => $tbl_url_query, 'title' => $may_have_rows ? $titles['Browse'] : $titles['NoBrowse']));
$search_table = Template::get('database/structure/search_table')->render(array('tbl_url_query' => $tbl_url_query, 'title' => $may_have_rows ? $titles['Search'] : $titles['NoSearch']));
$browse_table_label = Template::get('database/structure/browse_table_label')->render(array('tbl_url_query' => $tbl_url_query, 'title' => htmlspecialchars($current_table['TABLE_COMMENT']), 'truename' => $truename));
$empty_table = '';
if (!$this->_db_is_system_schema) {
$empty_table = ' ';
if (!$table_is_view) {
$empty_table = Template::get('database/structure/empty_table')->render(array('tbl_url_query' => $tbl_url_query, 'sql_query' => urlencode('TRUNCATE ' . Util::backquote($current_table['TABLE_NAME'])), 'message_to_show' => urlencode(sprintf(__('Table %s has been emptied.'), htmlspecialchars($current_table['TABLE_NAME']))), 'title' => $may_have_rows ? $titles['Empty'] : $titles['NoEmpty']));
//.........这里部分代码省略.........
示例2: addRemoveFavoriteTablesAction
/**
* Add or remove favorite tables
*
* @return void
*/
public function addRemoveFavoriteTablesAction()
{
$fav_instance = RecentFavoriteTable::getInstance('favorite');
if (isset($_REQUEST['favorite_tables'])) {
$favorite_tables = json_decode($_REQUEST['favorite_tables'], true);
} else {
$favorite_tables = array();
}
// Required to keep each user's preferences separate.
$user = sha1($GLOBALS['cfg']['Server']['user']);
// Request for Synchronization of favorite tables.
if (isset($_REQUEST['sync_favorite_tables'])) {
$this->synchronizeFavoriteTables($fav_instance, $user, $favorite_tables);
return;
}
$changes = true;
$titles = Util::buildActionTitles();
$favorite_table = $_REQUEST['favorite_table'];
$already_favorite = $this->checkFavoriteTable($favorite_table);
if (isset($_REQUEST['remove_favorite'])) {
if ($already_favorite) {
// If already in favorite list, remove it.
$fav_instance->remove($this->db, $favorite_table);
$already_favorite = false;
// for favorite_anchor template
}
} elseif (isset($_REQUEST['add_favorite'])) {
if (!$already_favorite) {
$nbTables = count($fav_instance->getTables());
if ($nbTables == $GLOBALS['cfg']['NumFavoriteTables']) {
$changes = false;
} else {
// Otherwise add to favorite list.
$fav_instance->add($this->db, $favorite_table);
$already_favorite = true;
// for favorite_anchor template
}
}
}
$favorite_tables[$user] = $fav_instance->getTables();
$this->response->addJSON('changes', $changes);
if (!$changes) {
$this->response->addJSON('message', Template::get('components/error_message')->render(array('msg' => __("Favorite List is full!"))));
return;
}
$this->response->addJSON(array('user' => $user, 'favorite_tables' => json_encode($favorite_tables), 'list' => $fav_instance->getHtmlList(), 'anchor' => Template::get('database/structure/favorite_anchor')->render(array('db' => $this->db, 'current_table' => array('TABLE_NAME' => $favorite_table), 'titles' => $titles, 'already_favorite' => $already_favorite))));
}