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:
authorAmenadiel <amenadiel@gmail.com>2017-08-18 19:53:41 +0300
committerAmenadiel <amenadiel@gmail.com>2017-08-18 19:53:41 +0300
commita5d38628800385c4225500a09fb1ba4e67905619 (patch)
treebfd7cf068c99ef2fc538766dd142d66a91f0d586 /src/controllers/OpclassesController.php
parent12193ee3b8c442520241984008c4a5204112910a (diff)
renaming controller classnames WIP
Diffstat (limited to 'src/controllers/OpclassesController.php')
-rw-r--r--src/controllers/OpclassesController.php110
1 files changed, 110 insertions, 0 deletions
diff --git a/src/controllers/OpclassesController.php b/src/controllers/OpclassesController.php
new file mode 100644
index 00000000..e1f057e0
--- /dev/null
+++ b/src/controllers/OpclassesController.php
@@ -0,0 +1,110 @@
+<?php
+
+namespace PHPPgAdmin\Controller;
+
+use PHPPgAdmin\Decorators\Decorator;
+
+/**
+ * Base controller class
+ */
+class OpclassesController extends BaseController
+{
+ public $_name = 'OpclassesController';
+
+ public function render()
+ {
+ $conf = $this->conf;
+ $misc = $this->misc;
+ $lang = $this->lang;
+
+ $action = $this->action;
+ if ($action == 'tree') {
+ return $this->doTree();
+ }
+
+ $this->printHeader($lang['stropclasses']);
+ $this->printBody();
+
+ switch ($action) {
+ default:
+ $this->doDefault();
+ break;
+ }
+
+ $this->printFooter();
+ }
+
+ /**
+ * Show default list of opclasss in the database
+ *
+ * @param string $msg
+ * @return string|void
+ */
+ public function doDefault($msg = '')
+ {
+ $conf = $this->conf;
+ $misc = $this->misc;
+ $lang = $this->lang;
+ $data = $misc->getDatabaseAccessor();
+
+ $this->printTrail('schema');
+ $this->printTabs('schema', 'opclasses');
+ $this->printMsg($msg);
+
+ $opclasses = $data->getOpClasses();
+
+ $columns = [
+ 'accessmethod' => [
+ 'title' => $lang['straccessmethod'],
+ 'field' => Decorator::field('amname'),
+ ],
+ 'opclass' => [
+ 'title' => $lang['strname'],
+ 'field' => Decorator::field('opcname'),
+ ],
+ 'type' => [
+ 'title' => $lang['strtype'],
+ 'field' => Decorator::field('opcintype'),
+ ],
+ 'default' => [
+ 'title' => $lang['strdefault'],
+ 'field' => Decorator::field('opcdefault'),
+ 'type' => 'yesno',
+ ],
+ 'comment' => [
+ 'title' => $lang['strcomment'],
+ 'field' => Decorator::field('opccomment'),
+ ],
+ ];
+
+ $actions = [];
+
+ echo $this->printTable($opclasses, $columns, $actions, 'opclasses-opclasses', $lang['strnoopclasses']);
+ }
+
+ /**
+ * Generate XML for the browser tree.
+ */
+ public function doTree()
+ {
+
+ $conf = $this->conf;
+ $misc = $this->misc;
+ $lang = $this->lang;
+ $data = $misc->getDatabaseAccessor();
+
+ $opclasses = $data->getOpClasses();
+
+ // OpClass prototype: "op_class/access_method"
+ $proto = Decorator::concat(Decorator::field('opcname'), '/', Decorator::field('amname'));
+
+ $attrs = [
+ 'text' => $proto,
+ 'icon' => 'OperatorClass',
+ 'toolTip' => Decorator::field('opccomment'),
+ ];
+
+ return $this->printTree($opclasses, $attrs, 'opclasses');
+ }
+
+}