tableName = &$_REQUEST['table'];
} elseif (isset($_REQUEST['view'])) {
$this->tableName = &$_REQUEST['view'];
} elseif (isset($_REQUEST['matview'])) {
$this->tableName = &$_REQUEST['matview'];
} else {
$this->halt($this->lang['strnotableprovided']);
}
$this->printHeader($this->headerTitle('', '', $this->tableName), null, true, 'header_select2.twig');
$this->printBody();
if (isset($_REQUEST['view']) || isset($_REQUEST['matview'])) {
$this->doDefault(null, false);
} else {
switch ($this->action) {
case 'properties':
if (isset($_POST['cancel'])) {
$this->doDefault();
} else {
$this->doAlter();
}
break;
default:
$this->doDefault();
break;
}
}
$this->printFooter();
}
/**
* Show default list of columns in the table.
*
* @param string $msg message to display
* @param bool $isTable tells if we're showing table properties
*/
public function doDefault($msg = '', $isTable = true)
{
if (!isset($_REQUEST['table']) || empty($_REQUEST['table'])) {
$isTable = false;
}
$data = $this->misc->getDatabaseAccessor();
$attPre = function (&$rowdata) use ($data) {
$rowdata->fields['+type'] = $data->formatType($rowdata->fields['type'], $rowdata->fields['atttypmod']);
};
if (empty($_REQUEST['column'])) {
$msg .= "
{$this->lang['strnoobjects']}";
}
$this->printTrail('column');
//$this->printTitle($this->lang['strcolprop']);
$this->printTabs('column', 'properties');
$this->printMsg($msg);
if (!empty($_REQUEST['column'])) {
// Get table
$tdata = $data->getTable($this->tableName);
//\Kint::dump($tdata);
// Get columns
$attrs = $data->getTableAttributes($this->tableName, $_REQUEST['column']);
// Show comment if any
if (null !== $attrs->fields['comment']) {
echo '
', $this->misc->printVal($attrs->fields['comment']), '
'.PHP_EOL; } $this->prtrace('$isTable', $isTable); $column = [ 'column' => [ 'title' => $this->lang['strcolumn'], 'field' => Decorator::field('attname'), ], 'type' => [ 'title' => $this->lang['strtype'], 'field' => Decorator::field('+type'), ], ]; if ($isTable) { $column['notnull'] = [ 'title' => $this->lang['strnotnull'], 'field' => Decorator::field('attnotnull'), 'type' => 'bool', 'params' => ['true' => 'NOT NULL', 'false' => ''], ]; $column['default'] = [ 'title' => $this->lang['strdefault'], 'field' => Decorator::field('adsrc'), ]; } $actions = []; echo $this->printTable($attrs, $column, $actions, $this->table_place, $this->lang['strnodata'], $attPre); echo '{$this->lang['strinvalidparam']}
".PHP_EOL; } } }