diff options
author | Felipe Figueroa <amenadiel@gmail.com> | 2018-03-15 02:02:10 +0300 |
---|---|---|
committer | Felipe Figueroa <amenadiel@gmail.com> | 2018-03-15 02:02:10 +0300 |
commit | 49270fe791619ba2d0dbf666cfa66ca80457dd44 (patch) | |
tree | 916738a0243836b5cfba76c470b083bd4e344ed1 /src/controllers/ColpropertiesController.php | |
parent | c2a9af3868f88a47497b88b0dbd3ac4994e01670 (diff) |
add package tag to controllers
Diffstat (limited to 'src/controllers/ColpropertiesController.php')
-rw-r--r-- | src/controllers/ColpropertiesController.php | 113 |
1 files changed, 57 insertions, 56 deletions
diff --git a/src/controllers/ColpropertiesController.php b/src/controllers/ColpropertiesController.php index dae4975a..0957d245 100644 --- a/src/controllers/ColpropertiesController.php +++ b/src/controllers/ColpropertiesController.php @@ -10,13 +10,14 @@ use PHPPgAdmin\Decorators\Decorator; /** * Base controller class. + * * @package PHPPgAdmin */ class ColpropertiesController extends BaseController { public $controller_name = 'ColpropertiesController'; - public $tableName = ''; - public $table_place = 'colproperties-colproperties'; + public $tableName = ''; + public $table_place = 'colproperties-colproperties'; /** * Default method to render the controller according to the action parameter. @@ -31,10 +32,10 @@ class ColpropertiesController extends BaseController die($lang['strnotableprovided']); } - $lang = $this->lang; + $lang = $this->lang; $action = $this->action; - $this->printHeader($lang['strtables'] . ' - ' . $this->tableName, null, true, 'header_select2.twig'); + $this->printHeader($lang['strtables'].' - '.$this->tableName, null, true, 'header_select2.twig'); $this->printBody(); if (isset($_REQUEST['view'])) { @@ -99,7 +100,7 @@ class ColpropertiesController extends BaseController 'title' => $lang['strcolumn'], 'field' => Decorator::field('attname'), ], - 'type' => [ + 'type' => [ 'title' => $lang['strtype'], 'field' => Decorator::field('+type'), ], @@ -107,9 +108,9 @@ class ColpropertiesController extends BaseController if ($isTable) { $column['notnull'] = [ - 'title' => $lang['strnotnull'], - 'field' => Decorator::field('attnotnull'), - 'type' => 'bool', + 'title' => $lang['strnotnull'], + 'field' => Decorator::field('attnotnull'), + 'type' => 'bool', 'params' => ['true' => 'NOT NULL', 'false' => ''], ]; $column['default'] = [ @@ -124,8 +125,8 @@ class ColpropertiesController extends BaseController echo "<br />\n"; $f_attname = $_REQUEST['column']; - $f_table = $this->tableName; - $f_schema = $data->_schema; + $f_table = $this->tableName; + $f_schema = $data->_schema; $data->fieldClean($f_attname); $data->fieldClean($f_table); $data->fieldClean($f_schema); @@ -138,50 +139,50 @@ class ColpropertiesController extends BaseController $navlinks = [ 'browse' => [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display.php', 'urlvars' => [ - 'subject' => 'column', - 'server' => $_REQUEST['server'], + 'subject' => 'column', + 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], - 'table' => $this->tableName, - 'column' => $_REQUEST['column'], - 'return' => 'column', - 'query' => $query, + 'schema' => $_REQUEST['schema'], + 'table' => $this->tableName, + 'column' => $_REQUEST['column'], + 'return' => 'column', + 'query' => $query, ], ], ], 'content' => $lang['strbrowse'], ], - 'alter' => [ - 'attr' => [ + 'alter' => [ + 'attr' => [ 'href' => [ - 'url' => 'colproperties.php', + 'url' => 'colproperties.php', 'urlvars' => [ - 'action' => 'properties', - 'server' => $_REQUEST['server'], + 'action' => 'properties', + 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], - 'table' => $this->tableName, - 'column' => $_REQUEST['column'], + 'schema' => $_REQUEST['schema'], + 'table' => $this->tableName, + 'column' => $_REQUEST['column'], ], ], ], 'content' => $lang['stralter'], ], - 'drop' => [ - 'attr' => [ + 'drop' => [ + 'attr' => [ 'href' => [ - 'url' => 'tblproperties.php', + 'url' => 'tblproperties.php', 'urlvars' => [ - 'action' => 'confirm_drop', - 'server' => $_REQUEST['server'], + 'action' => 'confirm_drop', + 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], - 'table' => $this->tableName, - 'column' => $_REQUEST['column'], + 'schema' => $_REQUEST['schema'], + 'table' => $this->tableName, + 'column' => $_REQUEST['column'], ], ], ], @@ -192,18 +193,18 @@ class ColpropertiesController extends BaseController // Browse link $navlinks = [ 'browse' => [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display.php', 'urlvars' => [ - 'subject' => 'column', - 'server' => $_REQUEST['server'], + 'subject' => 'column', + 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], - 'view' => $this->tableName, - 'column' => $_REQUEST['column'], - 'return' => 'column', - 'query' => $query, + 'schema' => $_REQUEST['schema'], + 'view' => $this->tableName, + 'column' => $_REQUEST['column'], + 'return' => 'column', + 'query' => $query, ], ], ], @@ -238,8 +239,8 @@ class ColpropertiesController extends BaseController $this->printTitle($lang['stralter'], 'pg.column.alter'); $this->printMsg($msg); - echo '<script src="' . \SUBFOLDER . '/js/tables.js" type="text/javascript"></script>'; - echo '<form action="' . \SUBFOLDER . "/src/views/colproperties.php\" method=\"post\">\n"; + echo '<script src="'.\SUBFOLDER.'/js/tables.js" type="text/javascript"></script>'; + echo '<form action="'.\SUBFOLDER."/src/views/colproperties.php\" method=\"post\">\n"; // Output table header echo "<table>\n"; @@ -252,21 +253,21 @@ class ColpropertiesController extends BaseController } echo "<th class=\"data\">{$lang['strnotnull']}</th>\n<th class=\"data\">{$lang['strdefault']}</th>\n<th class=\"data\">{$lang['strcomment']}</th></tr>\n"; - $column = $data->getTableAttributes($_REQUEST['table'], $_REQUEST['column']); + $column = $data->getTableAttributes($_REQUEST['table'], $_REQUEST['column']); $column->fields['attnotnull'] = $data->phpBool($column->fields['attnotnull']); // Upon first drawing the screen, load the existing column information // from the database. if (!isset($_REQUEST['default'])) { $_REQUEST['field'] = $column->fields['attname']; - $_REQUEST['type'] = $column->fields['base_type']; + $_REQUEST['type'] = $column->fields['base_type']; // Check to see if its' an array type... // XXX: HACKY if ('[]' == substr($column->fields['base_type'], strlen($column->fields['base_type']) - 2)) { - $_REQUEST['type'] = substr($column->fields['base_type'], 0, strlen($column->fields['base_type']) - 2); + $_REQUEST['type'] = substr($column->fields['base_type'], 0, strlen($column->fields['base_type']) - 2); $_REQUEST['array'] = '[]'; } else { - $_REQUEST['type'] = $column->fields['base_type']; + $_REQUEST['type'] = $column->fields['base_type']; $_REQUEST['array'] = ''; } // To figure out the length, look in the brackets :( @@ -293,12 +294,12 @@ class ColpropertiesController extends BaseController $escaped_predef_types = []; // the JS escaped array elements if ($data->hasAlterColumnType()) { // Fetch all available types - $types = $data->getTypes(true, false, true); + $types = $data->getTypes(true, false, true); $types_for_js = []; - echo "<td><select name=\"type\" id=\"type\" class=\"select2\" onchange=\"checkLengths(document.getElementById('type').value,'');\">" . "\n"; + echo "<td><select name=\"type\" id=\"type\" class=\"select2\" onchange=\"checkLengths(document.getElementById('type').value,'');\">"."\n"; while (!$types->EOF) { - $typname = $types->fields['typname']; + $typname = $types->fields['typname']; $types_for_js[] = $typname; echo "\t<option value=\"", htmlspecialchars($typname), '"', ($typname == $_REQUEST['type']) ? ' selected="selected"' : '', '>', $this->misc->printVal($typname), "</option>\n"; @@ -350,7 +351,7 @@ class ColpropertiesController extends BaseController echo "<input type=\"submit\" value=\"{$lang['stralter']}\" />\n"; echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n"; echo "</form>\n"; - echo '<script type="text/javascript">predefined_lengths = new Array(' . implode(',', $escaped_predef_types) . ");checkLengths(document.getElementById('type').value,'');</script>\n"; + echo '<script type="text/javascript">predefined_lengths = new Array('.implode(',', $escaped_predef_types).");checkLengths(document.getElementById('type').value,'');</script>\n"; break; case 2: @@ -386,10 +387,10 @@ class ColpropertiesController extends BaseController $_REQUEST['column'] = $_REQUEST['field']; $this->misc->setReloadBrowser(true); } - $this->doDefault($sql . "<br/>{$lang['strcolumnaltered']}"); + $this->doDefault($sql."<br/>{$lang['strcolumnaltered']}"); } else { $_REQUEST['stage'] = 1; - $this->doAlter($sql . "<br/>{$lang['strcolumnalteredbad']}"); + $this->doAlter($sql."<br/>{$lang['strcolumnalteredbad']}"); return; } |