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-04-17 15:53:46 +0300
committerFelipe Figueroa <amenadiel@gmail.com>2018-04-17 15:53:46 +0300
commit4ca846d04861df11ca0711889858ab7a03f86c33 (patch)
tree789401c5332639a68e9967d52b1160220dc2c02d /src/controllers/BrowserController.php
parent176b4067c90b55b7ea4c2e2ad36a41abc057475e (diff)
testing jstree
Diffstat (limited to 'src/controllers/BrowserController.php')
-rw-r--r--src/controllers/BrowserController.php74
1 files changed, 71 insertions, 3 deletions
diff --git a/src/controllers/BrowserController.php b/src/controllers/BrowserController.php
index b8d22b77..2d2c798f 100644
--- a/src/controllers/BrowserController.php
+++ b/src/controllers/BrowserController.php
@@ -6,6 +6,8 @@
namespace PHPPgAdmin\Controller;
+use PHPPgAdmin\Decorators\Decorator;
+
/**
* Base controller class.
*
@@ -18,10 +20,59 @@ class BrowserController extends BaseController
/**
* Default method to render the controller according to the action parameter.
*/
- public function render()
+ public function render($action = null)
+ {
+ if ($action === null) {
+ $action = $this->action;
+ }
+
+ switch ($action) {
+ case 'tree':
+ return $this->doTree();
+
+ break;
+ case 'jstree':
+ return $this->jsTree();
+ break;
+
+ default:
+ return $this->doDefault();
+ break;
+ }
+ }
+
+ /**
+ * Default method to render the controller according to the action parameter.
+ */
+ public function doDefault()
{
- $lang = $this->lang;
+ $this->misc->setNoDBConnection(true);
+
+ $this->setNoBottomLink(true);
+
+ $viewVars = ['icon' => [
+ 'blank' => $this->misc->icon('blank'),
+ 'I' => $this->misc->icon('I'),
+ 'L' => $this->misc->icon('L'),
+ 'Lminus' => $this->misc->icon('Lminus'),
+ 'Loading' => $this->misc->icon('Loading'),
+ 'Lplus' => $this->misc->icon('Lplus'),
+ 'ObjectNotFound' => $this->misc->icon('ObjectNotFound'),
+ 'Refresh' => $this->misc->icon('Refresh'),
+ 'Servers' => $this->misc->icon('Servers'),
+ 'T' => $this->misc->icon('T'),
+ 'Tminus' => $this->misc->icon('Tminus'),
+ 'Tplus' => $this->misc->icon('Tplus'),
+ ]];
+
+ return $this->view->fetch('browser.twig', $viewVars);
+ }
+ /**
+ * Default method to render the controller according to the action parameter.
+ */
+ public function jsTree()
+ {
$this->misc->setNoDBConnection(true);
$this->setNoBottomLink(true);
@@ -41,6 +92,23 @@ class BrowserController extends BaseController
'Tplus' => $this->misc->icon('Tplus'),
]];
- echo $this->view->fetch('browser.twig', $viewVars);
+ return $this->view->fetch('jstree.twig', $viewVars);
+ }
+
+ public function doTree()
+ {
+ $treedata = new \PHPPgAdmin\ArrayRecordSet([]);
+ $reqvars = [];
+
+ $attrs = [
+ 'text' => 'Servers',
+ 'icon' => 'Servers',
+ 'is_root' => 'true',
+ 'action' => Decorator::url('/src/views/servers'),
+ 'branch' => Decorator::url('/src/views/servers', $reqvars, ['action' => 'tree']),
+ ];
+
+ return $this->printTree($treedata, $attrs, 'server');
}
+
}