Repository navigation
Expand file tree
/
Copy pathopclasses.php
More file actions
129 lines (105 loc) · 2.36 KB
/
Copy pathopclasses.php
File metadata and controls
129 lines (105 loc) · 2.36 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
use PhpPgAdmin\Core\AppContainer;
use PhpPgAdmin\Database\Actions\OperatorClassActions;
/**
* Manage opclasss in a database
*
* $Id: opclasses.php,v 1.10 2007/08/31 18:30:11 ioguix Exp $
*/
// Include application functions
include_once('./libraries/bootstrap.php');
/**
* Show default list of opclasss in the database
*/
function doDefault($msg = '')
{
$pg = AppContainer::getPostgres();
$misc = AppContainer::getMisc();
$lang = AppContainer::getLang();
$opClassActions = new OperatorClassActions($pg);
$misc->printTrail('schema');
$misc->printTabs('schema', 'opclasses');
$misc->printMsg($msg);
$opClasses = $opClassActions->getOpClasses();
$columns = [
'accessmethod' => [
'title' => $lang['straccessmethod'],
'field' => field('amname'),
],
'opclass' => [
'title' => $lang['strname'],
'field' => field('opcname'),
],
'type' => [
'title' => $lang['strtype'],
'field' => field('opcintype'),
],
'default' => [
'title' => $lang['strdefault'],
'field' => field('opcdefault'),
'type' => 'yesno',
],
'owner' => [
'title' => $lang['strowner'],
'field' => field('opcowner'),
],
'comment' => [
'title' => $lang['strcomment'],
'field' => field('opccomment'),
],
];
$footer = [
'accessmethod' => [
'agg' => 'count',
'format' => fn($v) => "$v {$lang['stropclasses']}",
'colspan' => 4,
],
'owner' => [
'text' => $lang['strtotal'],
'colspan' => 2,
],
];
$actions = [];
$misc->printTable(
$opClasses,
$columns,
$actions,
'opclasses-opclasses',
$lang['strnoopclasses'],
null,
$footer
);
}
/**
* Generate XML for the browser tree.
*/
function doTree()
{
$misc = AppContainer::getMisc();
$pg = AppContainer::getPostgres();
$opClassActions = new OperatorClassActions($pg);
$opClasses = $opClassActions->getOpClasses();
// OpClass prototype: "op_class/access_method"
$proto = concat(field('opcname'), '/', field('amname'));
$attrs = [
'text' => $proto,
'icon' => 'OperatorClass',
'toolTip' => field('opccomment'),
];
$misc->printTree($opClasses, $attrs, 'opclasses');
exit;
}
// Main program
$misc = AppContainer::getMisc();
$lang = AppContainer::getLang();
$action = $_REQUEST['action'] ?? '';
if ($action == 'tree')
doTree();
$misc->printHeader($lang['stropclasses']);
$misc->printBody();
switch ($action) {
default:
doDefault();
break;
}
$misc->printFooter();