1
0
Fork 0
MySQLDumper/application/views/scripts/sql/tables/show-tables.phtml

267 Zeilen
8,4 KiB
PHTML

2011-06-10 21:55:32 +00:00
<div id="content">
<h2><?php echo $this->lang->L_SQL_TABLESOFDB;?> `<?php echo $this->config->get('dynamic.dbActual');?>`
</h2>
<?php
echo $this->sqlHeadNavi();
if (!isset($this->selectedTables)) {
$this->selectedTables = array();
}
if (!empty($this->actionResult)) {
$i = 1;
?>
<h4><?php echo $this->action;?>:</h4>
<table class="bdr" summary="Action result">
<tr class="thead nowrap">
<th class="right">#</th>
<th class="left"><?php echo $this->lang->L_TABLE;?></th>
<th class="left"><?php echo $this->lang->L_ACTION;?></th>
<th class="left"><?php echo $this->lang->L_MESSAGE_TYPE;?></th>
<th colspan="2" class="left"><?php echo $this->lang->L_MESSAGE;?></th>
</tr>
<?php
$cycleHelper = $this->getHelper('cycle')->cycle(array('row-even', 'row-odd'));
foreach ($this->actionResult as $data) {
if (!isset($data['code'])) {
//success, operation done, show result
?>
<tr class="<?php echo $cycleHelper->next();?> nowrap">
<td class="small right"><?php echo $this->numberFormat($i);?>.</td>
<td class="small"><?php echo $data['Table'];?></td>
<td class="small"><?php echo $data['Op'];?></td>
<td class="small"><?php echo $data['Msg_type'];?></td>
<td class="small"><?php echo $data['Msg_text'];?></td>
<td class="small right">
<?php
if ($data['Msg_type'] !== 'Error') {
echo $this->getIcon('Ok', '', 16);
} else {
echo $this->getIcon('Attention', '', 16);
}
?>
</td>
</tr>
<?php } else {
// an MySQL error occured
?>
<tr class="<?php echo $cycleHelper->next();?> nowrap">
<td class="small right"><?php echo $this->numberFormat($i);?>.</td>
<td class="small"><?php echo $data['Table'];?></td>
<td class="small"><?php echo $this->action;?></td>
<td class="small"><?php echo $this->lang->L_ERROR;?></td>
<td class="small">(<?php echo $data['code'] . ') '. $data['message'];?></td>
<td class="small right"><?php echo $this->getIcon('Attention', '', 16);?></td>
</tr>
<?php
}
$i++;
}
?>
</table>
<br />
<?php
}
if ($this->tables->getTotalItemCount() >= 1) {
?>
<div>
<?php echo $this->paginationControl($this->tables,
'Sliding',
'sql/paginator.phtml',
array(1));
?>
<br />
</div>
<?php
}
?>
<br />
<form method="post" action="../" class="tablesForm">
<table class="bdr" summary="Table lists all tables of the database">
<?php
echo $this->partial('/sql/tables/button-bar.phtml',
array('lang' => $this->lang));
echo $this->partial('/sql/tables/table-header.phtml',
array('lang' => $this->lang));
$i = $this->startEntry;
$cycleHelper = $this->getHelper('cycle')->cycle(array('row-even', 'row-odd'));
$imgTableData = $this->getIcon('Tabledata', '' ,16);
foreach ($this->tables as $data):
$tableName = $data['TABLE_NAME'];
$tableNameOut = $this->out($tableName);
?>
<tr class="nowrap <?php echo $cycleHelper->next()?>">
<td class="small center">
<a href="<?php echo $this->url(array('controller'=>'sql','action'=>'show.table.data',
'tableName'=> base64_encode($tableName)));?>"
class="tooltip" title="<?php echo $this->lang->L_TITLE_SHOW_DATA . ': ' . $tableNameOut;?>">
<?php echo $imgTableData;?>
</a>
</td>
<td class="small right center">
<input type="checkbox"
class="tableCheckbox checkbox"
name="tables[]"
id="<?php echo $tableNameOut;?>"
value="<?php echo $tableNameOut;?>"
<?php
if (in_array($tableName, $this->selectedTables)) {
echo ' checked="checked"';
}
?>
/>
</td>
<td class="small right"><?php echo $i; ?>.</td>
<td class="small">
<label for="<?php echo $tableNameOut;?>" class="block tooltip"
title="<?php echo $this->lang->L_SELECT . ': ' . $tableNameOut;?>">
<?php echo $tableNameOut;?>
</label>
</td>
<td class="small right">
<?php
if ($data['TABLE_ROWS'] > 0) {
echo $this->numberFormat($data['TABLE_ROWS']);
} elseif ($data['TABLE_ROWS'] === null) {
echo '<i>NULL</i>';
} else {
echo '-';
}
?>
</td>
<td class="small right">
<?php
if ($data['TABLE_TYPE'] == 'BASE TABLE') {
echo $this->byteOutput($data['DATA_LENGTH'] + $data['INDEX_LENGTH']);
} else {
echo '-';
}
?>
</td>
<td class="small right">
<?php
if ($data['INDEX_LENGTH'] > 0) {
echo $this->byteOutput($data['INDEX_LENGTH']);
} else {
echo '-';
}
?>
</td>
<td class="small right">
<?php
if ($data['AUTO_INCREMENT'] > 0) {
echo $this->numberFormat($data['AUTO_INCREMENT']);
} else {
echo '-';
}
?>
</td>
<td class="small right">
<?php
if ($this->isTableOptimizable($data['ENGINE'])) {
if ($data['DATA_FREE'] == 0) {
echo '-';
} else {
if ($data['ENGINE'] == 'InnoDB') {
echo '-';
} else {
echo $this->byteOutput($data['DATA_FREE']);
}
}
} else {
echo '&nbsp;';
}
?>
</td>
<td class="small">
<?php
if ($data['CREATE_TIME'] != '') {
echo$data['CREATE_TIME'];
} else {
echo '-';
}
?>
</td>
<td class="small">
<?php
if ($data['UPDATE_TIME'] != '') {
echo $data['UPDATE_TIME'];
} else {
echo '-';
}
?>
</td>
<td class="small"><?php echo$data['TABLE_TYPE'];?></td>
<td class="small"><?php echo$data['ENGINE'];?></td>
<td class="small">
<?php
if ($data['TABLE_COLLATION'] != '') {
echo $data['TABLE_COLLATION'];
} else {
echo '-';
}
?>
</td>
<td class="small">
<?php
if ($data['TABLE_COMMENT'] != '') {
echo $this->escape($data['TABLE_COMMENT']);
} else {
echo '-';
}
?>
</td>
</tr>
<?php
$i++;
endforeach;
if ($this->tables->getTotalItemCount() <= 0) { ?>
<tr><td colspan="12" class="error"><?php echo $this->lang->L_INFO_DBEMPTY;?></td></tr>
<?php }
echo $this->partial('/sql/tables/table-header.phtml',
array('lang' => $this->lang));
?>
</table>
</form>
<?php
if ($this->tables->getTotalItemCount() >= 1) {
?>
<div id="pagination" style="margin-top: 15px;">
<?php echo $this->paginationControl($this->tables,
'Sliding',
'sql/paginator.phtml',
array(1));
?>
</div>
<?php
}
?>
</div>
<?php
$this->jQuery()->onLoadCaptureStart();
?>
$('.tableCheckbox').change(function() {
checkButtonState();
});
<?php
$this->jQuery()->onLoadCaptureEnd();
?>
<script type="text/javascript">
function checkButtonState() {
var objs = ['#buttonOptimize', '#buttonAnalyze', '#buttonCheck',
'#buttonRepair', '#buttonTruncate', '#buttonDelete'];
if ($('.tableCheckbox:checked').size() > 0) {
objs_enable(objs);
} else {
objs_disable(objs);
}
}
2011-06-13 20:03:08 +00:00
checkButtonState();
2011-06-10 21:55:32 +00:00
</script>