Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Figueroa <amenadiel@gmail.com>2018-02-15 22:43:34 +0300
committerFelipe Figueroa <amenadiel@gmail.com>2018-02-15 22:43:34 +0300
commitbd98efb04690870bc69146f666d3c252004a2154 (patch)
tree000b26b2443d4b8962abe7c9be4a5eb0154374e0 /src/controllers/AggregatesController.php
parent5739f96c854c62782d60198071c6be2f55ccab75 (diff)
remove unused assignments to variable
Diffstat (limited to 'src/controllers/AggregatesController.php')
-rw-r--r--src/controllers/AggregatesController.php208
1 files changed, 9 insertions, 199 deletions
diff --git a/src/controllers/AggregatesController.php b/src/controllers/AggregatesController.php
index d59b0107..d323b0e5 100644
--- a/src/controllers/AggregatesController.php
+++ b/src/controllers/AggregatesController.php
@@ -6,8 +6,6 @@
namespace PHPPgAdmin\Controller;
-use PHPPgAdmin\Decorators\Decorator;
-
/**
* Base controller class.
*/
@@ -18,205 +16,22 @@ class AggregatesController extends BaseController
/**
* Default method to render the controller according to the action parameter.
*/
- public function render()
- {
- $conf = $this->conf;
-
- $lang = $this->lang;
-
- $action = $this->action;
- if ('tree' == $action) {
- return $this->doTree();
- }
-
- $this->printHeader($lang['straggregates']);
- $this->printBody();
-
- switch ($action) {
- case 'create':
- $this->doCreate();
-
- break;
- case 'save_create':
- if (isset($_POST['cancel'])) {
- $this->doDefault();
- } else {
- $this->doSaveCreate();
- }
-
- break;
- case 'alter':
- $this->doAlter();
-
- break;
- case 'save_alter':
- if (isset($_POST['alter'])) {
- $this->doSaveAlter();
- } else {
- $this->doProperties();
- }
-
- break;
- case 'drop':
- if (isset($_POST['drop'])) {
- $this->doDrop(false);
- } else {
- $this->doDefault();
- }
-
- break;
- case 'confirm_drop':
- $this->doDrop(true);
-
- break;
- default:
- $this->doDefault();
-
- break;
- case 'properties':
- $this->doProperties();
-
- break;
- }
-
- return $this->printFooter();
- }
+ public function render() {}
/**
* Show default list of aggregate functions in the database.
*
* @param mixed $msg
*/
- public function doDefault($msg = '')
- {
- $conf = $this->conf;
-
- $lang = $this->lang;
- $data = $this->misc->getDatabaseAccessor();
- $this->printTrail('schema');
- $this->printTabs('schema', 'aggregates');
- $this->printMsg($msg);
-
- $aggregates = $data->getAggregates();
-
- $columns = [
- 'aggrname' => [
- 'title' => $lang['strname'],
- 'field' => Decorator::field('proname'),
- 'url' => \SUBFOLDER."/redirect/aggregate?action=properties&amp;{$this->misc->href}&amp;",
- 'vars' => ['aggrname' => 'proname', 'aggrtype' => 'proargtypes'],
- ],
- 'aggrtype' => [
- 'title' => $lang['strtype'],
- 'field' => Decorator::field('proargtypes'),
- ],
- 'aggrtransfn' => [
- 'title' => $lang['straggrsfunc'],
- 'field' => Decorator::field('aggtransfn'),
- ],
- 'owner' => [
- 'title' => $lang['strowner'],
- 'field' => Decorator::field('usename'),
- ],
- 'actions' => [
- 'title' => $lang['stractions'],
- ],
- 'comment' => [
- 'title' => $lang['strcomment'],
- 'field' => Decorator::field('aggrcomment'),
- ],
- ];
-
- $actions = [
- 'alter' => [
- 'content' => $lang['stralter'],
- 'attr' => [
- 'href' => [
- 'url' => 'aggregates.php',
- 'urlvars' => [
- 'action' => 'alter',
- 'aggrname' => Decorator::field('proname'),
- 'aggrtype' => Decorator::field('proargtypes'),
- ],
- ],
- ],
- ],
- 'drop' => [
- 'content' => $lang['strdrop'],
- 'attr' => [
- 'href' => [
- 'url' => 'aggregates.php',
- 'urlvars' => [
- 'action' => 'confirm_drop',
- 'aggrname' => Decorator::field('proname'),
- 'aggrtype' => Decorator::field('proargtypes'),
- ],
- ],
- ],
- ],
- ];
-
- if (!$data->hasAlterAggregate()) {
- unset($actions['alter']);
- }
-
- echo $this->printTable($aggregates, $columns, $actions, 'aggregates-aggregates', $lang['strnoaggregates']);
-
- $navlinks = [
- 'create' => [
- 'attr' => [
- 'href' => [
- 'url' => 'aggregates.php',
- 'urlvars' => [
- 'action' => 'create',
- 'server' => $_REQUEST['server'],
- 'database' => $_REQUEST['database'],
- 'schema' => $_REQUEST['schema'],
- ],
- ],
- ],
- 'content' => $lang['strcreateaggregate'],
- ],
- ];
- $this->printNavLinks($navlinks, 'aggregates-aggregates', get_defined_vars());
- }
-
- public function doTree()
- {
- $conf = $this->conf;
+ public function doDefault($msg = '') {}
- $lang = $this->lang;
- $data = $this->misc->getDatabaseAccessor();
-
- $aggregates = $data->getAggregates();
-
- $proto = Decorator::concat(Decorator::field('proname'), ' (', Decorator::field('proargtypes'), ')');
- $reqvars = $this->misc->getRequestVars('aggregate');
-
- $attrs = [
- 'text' => $proto,
- 'icon' => 'Aggregate',
- 'toolTip' => Decorator::field('aggcomment'),
- 'action' => Decorator::redirecturl(
- 'redirect.php',
- $reqvars,
- [
- 'action' => 'properties',
- 'aggrname' => Decorator::field('proname'),
- 'aggrtype' => Decorator::field('proargtypes'),
- ]
- ),
- ];
-
- return $this->printTree($aggregates, $attrs, 'aggregates');
- }
+ public function doTree() {}
/**
* Actually creates the new aggregate in the database.
*/
public function doSaveCreate()
{
- $conf = $this->conf;
$lang = $this->lang;
$data = $this->misc->getDatabaseAccessor();
@@ -268,7 +83,6 @@ class AggregatesController extends BaseController
*/
public function doCreate($msg = '')
{
- $conf = $this->conf;
$lang = $this->lang;
$data = $this->misc->getDatabaseAccessor();
@@ -309,7 +123,7 @@ class AggregatesController extends BaseController
$this->printTitle($lang['strcreateaggregate'], 'pg.aggregate.create');
$this->printMsg($msg);
- echo '<form action="'.\SUBFOLDER."/src/views/aggregates.php\" method=\"post\">\n";
+ echo '<form action="' . \SUBFOLDER . "/src/views/aggregates.php\" method=\"post\">\n";
echo "<table>\n";
echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n";
echo "\t\t<td class=\"data\"><input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"",
@@ -349,7 +163,6 @@ class AggregatesController extends BaseController
*/
public function doSaveAlter()
{
- $conf = $this->conf;
$lang = $this->lang;
$data = $this->misc->getDatabaseAccessor();
@@ -388,7 +201,6 @@ class AggregatesController extends BaseController
*/
public function doAlter($msg = '')
{
- $conf = $this->conf;
$lang = $this->lang;
$data = $this->misc->getDatabaseAccessor();
@@ -397,7 +209,7 @@ class AggregatesController extends BaseController
$this->printTitle($lang['stralter'], 'pg.aggregate.alter');
$this->printMsg($msg);
- echo '<form action="'.\SUBFOLDER."/src/views/aggregates.php\" method=\"post\">\n";
+ echo '<form action="' . \SUBFOLDER . "/src/views/aggregates.php\" method=\"post\">\n";
$aggrdata = $data->getAggregate($_REQUEST['aggrname'], $_REQUEST['aggrtype']);
if ($aggrdata->recordCount() > 0) {
// Output table header
@@ -437,7 +249,6 @@ class AggregatesController extends BaseController
*/
public function doDrop($confirm)
{
- $conf = $this->conf;
$lang = $this->lang;
$data = $this->misc->getDatabaseAccessor();
@@ -448,7 +259,7 @@ class AggregatesController extends BaseController
echo '<p>', sprintf($lang['strconfdropaggregate'], htmlspecialchars($_REQUEST['aggrname'])), "</p>\n";
- echo '<form action="'.\SUBFOLDER."/src/views/aggregates.php\" method=\"post\">\n";
+ echo '<form action="' . \SUBFOLDER . "/src/views/aggregates.php\" method=\"post\">\n";
echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n";
echo "<p><input type=\"hidden\" name=\"action\" value=\"drop\" />\n";
echo '<input type="hidden" name="aggrname" value="', htmlspecialchars($_REQUEST['aggrname']), "\" />\n";
@@ -475,7 +286,6 @@ class AggregatesController extends BaseController
*/
public function doProperties($msg = '')
{
- $conf = $this->conf;
$lang = $this->lang;
$data = $this->misc->getDatabaseAccessor();
@@ -516,7 +326,7 @@ class AggregatesController extends BaseController
$navlinks = [
'showall' => [
- 'attr' => [
+ 'attr' => [
'href' => [
'url' => 'aggregates.php',
'urlvars' => [
@@ -532,7 +342,7 @@ class AggregatesController extends BaseController
if ($data->hasAlterAggregate()) {
$navlinks['alter'] = [
- 'attr' => [
+ 'attr' => [
'href' => [
'url' => 'aggregates.php',
'urlvars' => [
@@ -550,7 +360,7 @@ class AggregatesController extends BaseController
}
$navlinks['drop'] = [
- 'attr' => [
+ 'attr' => [
'href' => [
'url' => 'aggregates.php',
'urlvars' => [