1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
<?php
/**
* PHPPgAdmin v6.0.0-beta.52
*/
namespace PHPPgAdmin\Controller;
use PHPPgAdmin\Decorators\Decorator;
/**
* Base controller class.
*
* @package PHPPgAdmin
*/
class OpclassesController extends BaseController
{
public $controller_title = 'stropclasses';
/**
* Default method to render the controller according to the action parameter.
*/
public function render()
{
if ('tree' == $this->action) {
return $this->doTree();
}
$this->printHeader();
$this->printBody();
switch ($this->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 = '')
{
$data = $this->misc->getDatabaseAccessor();
$this->printTrail('schema');
$this->printTabs('schema', 'opclasses');
$this->printMsg($msg);
$opclasses = $data->getOpClasses();
$columns = [
'accessmethod' => [
'title' => $this->lang['straccessmethod'],
'field' => Decorator::field('amname'),
],
'opclass' => [
'title' => $this->lang['strname'],
'field' => Decorator::field('opcname'),
],
'type' => [
'title' => $this->lang['strtype'],
'field' => Decorator::field('opcintype'),
],
'default' => [
'title' => $this->lang['strdefault'],
'field' => Decorator::field('opcdefault'),
'type' => 'yesno',
],
'comment' => [
'title' => $this->lang['strcomment'],
'field' => Decorator::field('opccomment'),
],
];
$actions = [];
echo $this->printTable($opclasses, $columns, $actions, 'opclasses-opclasses', $this->lang['strnoopclasses']);
}
/**
* Generate XML for the browser tree.
*/
public function doTree()
{
$data = $this->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');
}
}
|