1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* PHPPgAdmin 6.1.3 |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace PHPPgAdmin\Controller; |
8
|
|
|
|
9
|
|
|
use PHPPgAdmin\Decorators\Decorator; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Base controller class. |
13
|
|
|
*/ |
14
|
|
|
class LanguagesController extends BaseController |
15
|
|
|
{ |
16
|
|
|
public $controller_title = 'strlanguages'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Default method to render the controller according to the action parameter. |
20
|
|
|
*/ |
21
|
|
|
public function render() |
22
|
|
|
{ |
23
|
|
|
if ('tree' === $this->action) { |
24
|
|
|
return $this->doTree(); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
$this->printHeader(); |
28
|
|
|
$this->printBody(); |
29
|
|
|
|
30
|
|
|
switch ($this->action) { |
31
|
|
|
default: |
32
|
|
|
$this->doDefault(); |
33
|
|
|
|
34
|
|
|
break; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
$this->printFooter(); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Show default list of languages in the database. |
42
|
|
|
* |
43
|
|
|
* @param mixed $msg |
44
|
|
|
*/ |
45
|
|
|
public function doDefault($msg = ''): void |
46
|
|
|
{ |
47
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
48
|
|
|
|
49
|
|
|
$this->printTrail('database'); |
50
|
|
|
$this->printTabs('database', 'languages'); |
51
|
|
|
$this->printMsg($msg); |
52
|
|
|
|
53
|
|
|
$languages = $data->getLanguages(); |
54
|
|
|
|
55
|
|
|
$columns = [ |
56
|
|
|
'language' => [ |
57
|
|
|
'title' => $this->lang['strname'], |
58
|
|
|
'field' => Decorator::field('lanname'), |
59
|
|
|
], |
60
|
|
|
'trusted' => [ |
61
|
|
|
'title' => $this->lang['strtrusted'], |
62
|
|
|
'field' => Decorator::field('lanpltrusted'), |
63
|
|
|
'type' => 'yesno', |
64
|
|
|
], |
65
|
|
|
'function' => [ |
66
|
|
|
'title' => $this->lang['strfunction'], |
67
|
|
|
'field' => Decorator::field('lanplcallf'), |
68
|
|
|
], |
69
|
|
|
]; |
70
|
|
|
|
71
|
|
|
$actions = []; |
72
|
|
|
|
73
|
|
|
echo $this->printTable($languages, $columns, $actions, 'languages-languages', $this->lang['strnolanguages']); |
|
|
|
|
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Generate XML for the browser tree. |
78
|
|
|
*/ |
79
|
|
|
public function doTree() |
80
|
|
|
{ |
81
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
82
|
|
|
|
83
|
|
|
$languages = $data->getLanguages(); |
84
|
|
|
|
85
|
|
|
$attrs = [ |
86
|
|
|
'text' => Decorator::field('lanname'), |
87
|
|
|
'icon' => 'Language', |
88
|
|
|
]; |
89
|
|
|
|
90
|
|
|
return $this->printTree($languages, $attrs, 'languages'); |
|
|
|
|
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
|