Test Failed
Pull Request — develop (#380)
by Felipe
03:38
created

AggregatesController   A

Complexity

Total Complexity 34

Size/Duplication

Total Lines 661
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 451
c 1
b 0
f 0
dl 0
loc 661
rs 9.68
wmc 34

9 Methods

Rating   Name   Duplication   Size   Complexity  
C render() 0 63 12
B doDefault() 0 90 2
B doAlter() 0 68 2
A doDrop() 0 40 3
A doSaveAlter() 0 29 3
A doTree() 0 24 1
B doProperties() 0 131 4
B doSaveCreate() 0 36 6
B doCreate() 0 117 1
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 AggregatesController extends BaseController
15
{
16
    public $table_place = 'aggregates-aggregates';
17
18
    public $controller_title = 'straggregates';
19
20
    /**
21
     * Default method to render the controller according to the action parameter.
22
     */
23
    public function render()
24
    {
25
        if ('tree' === $this->action) {
26
            return $this->doTree();
27
        }
28
29
        \ob_start();
30
31
        switch ($this->action) {
32
            case 'create':
33
                $this->doCreate();
34
35
                break;
36
            case 'save_create':
37
                if (null !== $this->getPostParam('cancel')) {
38
                    $this->doDefault();
39
                } else {
40
                    $this->doSaveCreate();
41
                }
42
43
                break;
44
            case 'alter':
45
                $this->doAlter();
46
47
                break;
48
            case 'save_alter':
49
                if (null !== $this->getPostParam('alter')) {
50
                    $this->doSaveAlter();
51
                } else {
52
                    $this->doProperties();
53
                }
54
55
                break;
56
            case 'drop':
57
                if (null !== $this->getPostParam('drop')) {
58
                    $this->doDrop(false);
59
                } else {
60
                    $this->doDefault();
61
                }
62
63
                break;
64
            case 'confirm_drop':
65
                $this->doDrop(true);
66
67
                break;
68
69
            default:
70
                $this->doDefault();
71
72
                break;
73
            case 'properties':
74
                $this->doProperties();
75
76
                break;
77
        }
78
79
        $output = \ob_get_clean();
80
81
        $this->printHeader($this->headerTitle());
82
        $this->printBody();
83
        echo $output;
84
85
        return $this->printFooter();
86
    }
87
88
    /**
89
     * Show default list of aggregate functions in the database.
90
     *
91
     * @param mixed $msg
92
     */
93
    public function doDefault($msg = ''): void
94
    {
95
        $this->printTrail('schema');
96
        $this->printTabs('schema', 'aggregates');
97
        $this->printMsg($msg);
98
99
        $aggregates = $this->data->getAggregates();
100
        $columns = [
101
            'aggrname' => [
102
                'title' => $this->lang['strname'],
103
                'field' => Decorator::field('proname'),
104
                'url' => \sprintf(
105
                    'redirect.php?subject=aggregate&amp;action=properties&amp;%s&amp;',
106
                    $this->misc->href
107
                ),
108
                'vars' => ['aggrname' => 'proname', 'aggrtype' => 'proargtypes'],
109
            ],
110
            'aggrtype' => [
111
                'title' => $this->lang['strtype'],
112
                'field' => Decorator::field('proargtypes'),
113
            ],
114
            'aggrtransfn' => [
115
                'title' => $this->lang['straggrsfunc'],
116
                'field' => Decorator::field('aggtransfn'),
117
            ],
118
            'owner' => [
119
                'title' => $this->lang['strowner'],
120
                'field' => Decorator::field('usename'),
121
            ],
122
            'actions' => [
123
                'title' => $this->lang['stractions'],
124
            ],
125
            'comment' => [
126
                'title' => $this->lang['strcomment'],
127
                'field' => Decorator::field('aggrcomment'),
128
            ],
129
        ];
130
131
        $actions = [
132
            'alter' => [
133
                'content' => $this->lang['stralter'],
134
                'attr' => [
135
                    'href' => [
136
                        'url' => 'aggregates.php',
137
                        'urlvars' => [
138
                            'action' => 'alter',
139
                            'aggrname' => Decorator::field('proname'),
140
                            'aggrtype' => Decorator::field('proargtypes'),
141
                        ],
142
                    ],
143
                ],
144
            ],
145
            'drop' => [
146
                'content' => $this->lang['strdrop'],
147
                'attr' => [
148
                    'href' => [
149
                        'url' => 'aggregates.php',
150
                        'urlvars' => [
151
                            'action' => 'confirm_drop',
152
                            'aggrname' => Decorator::field('proname'),
153
                            'aggrtype' => Decorator::field('proargtypes'),
154
                        ],
155
                    ],
156
                ],
157
            ],
158
        ];
159
160
        if (!$this->data->hasAlterAggregate()) {
161
            unset($actions['alter']);
162
        }
163
164
        echo $this->printTable($aggregates, $columns, $actions, $this->table_place, $this->lang['strnoaggregates']);
165
166
        $navlinks = [
167
            'create' => [
168
                'attr' => [
169
                    'href' => [
170
                        'url' => 'aggregates.php',
171
                        'urlvars' => [
172
                            'action' => 'create',
173
                            'server' => $_REQUEST['server'],
174
                            'database' => $_REQUEST['database'],
175
                            'schema' => $_REQUEST['schema'],
176
                        ],
177
                    ],
178
                ],
179
                'content' => $this->lang['strcreateaggregate'],
180
            ],
181
        ];
182
        $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
183
    }
184
185
    /**
186
     * @return \Slim\Http\Response|string
187
     */
188
    public function doTree()
189
    {
190
        $this->data = $this->misc->getDatabaseAccessor();
191
192
        $aggregates = $this->data->getAggregates();
193
        $proto = Decorator::concat(Decorator::field('proname'), ' (', Decorator::field('proargtypes'), ')');
194
        $reqvars = $this->misc->getRequestVars('aggregate');
195
196
        $attrs = [
197
            'text' => $proto,
198
            'icon' => 'Aggregate',
199
            'toolTip' => Decorator::field('aggcomment'),
200
            'action' => Decorator::redirecturl(
201
                'redirect',
202
                $reqvars,
203
                [
204
                    'action' => 'properties',
205
                    'aggrname' => Decorator::field('proname'),
206
                    'aggrtype' => Decorator::field('proargtypes'),
207
                ]
208
            ),
209
        ];
210
211
        return $this->printTree($aggregates, $attrs, 'aggregates');
0 ignored issues
show
Bug introduced by
It seems like $aggregates can also be of type integer; however, parameter $_treedata of PHPPgAdmin\Controller\BaseController::printTree() does only seem to accept PHPPgAdmin\ADORecordSet|PHPPgAdmin\ArrayRecordSet, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

211
        return $this->printTree(/** @scrutinizer ignore-type */ $aggregates, $attrs, 'aggregates');
Loading history...
212
    }
213
214
    /**
215
     * Actually creates the new aggregate in the database.
216
     */
217
    public function doSaveCreate()
218
    {
219
        $this->data = $this->misc->getDatabaseAccessor();
220
        // Check inputs
221
        if ('' === \trim($_REQUEST['name'])) {
222
            return $this->doCreate($this->lang['straggrneedsname']);
223
        }
224
225
        if ('' === \trim($_REQUEST['basetype'])) {
226
            return $this->doCreate($this->lang['straggrneedsbasetype']);
227
        }
228
229
        if ('' === \trim($_REQUEST['sfunc'])) {
230
            return $this->doCreate($this->lang['straggrneedssfunc']);
231
        }
232
233
        if ('' === \trim($_REQUEST['stype'])) {
234
            return $this->doCreate($this->lang['straggrneedsstype']);
235
        }
236
237
        $status = $this->data->createAggregate(
238
            $_REQUEST['name'],
239
            $_REQUEST['basetype'],
240
            $_REQUEST['sfunc'],
241
            $_REQUEST['stype'],
242
            $_REQUEST['ffunc'],
243
            $_REQUEST['initcond'],
244
            $_REQUEST['sortop'],
245
            $_REQUEST['aggrcomment']
246
        );
247
248
        if (0 === $status) {
249
            $this->view->setReloadBrowser(true);
250
            $this->doDefault($this->lang['straggrcreated']);
251
        } else {
252
            $this->doCreate($this->lang['straggrcreatedbad']);
253
        }
254
    }
255
256
    /**
257
     * Displays a screen for create a new aggregate function.
258
     *
259
     * @param mixed $msg
260
     */
261
    public function doCreate($msg = ''): void
262
    {
263
        $this->data = $this->misc->getDatabaseAccessor();
264
265
        $this->coalesceArr($_REQUEST, 'name', '');
266
267
        $this->coalesceArr($_REQUEST, 'basetype', '');
268
269
        $this->coalesceArr($_REQUEST, 'sfunc', '');
270
271
        $this->coalesceArr($_REQUEST, 'stype', '');
272
273
        $this->coalesceArr($_REQUEST, 'ffunc', '');
274
275
        $this->coalesceArr($_REQUEST, 'initcond', '');
276
277
        $this->coalesceArr($_REQUEST, 'sortop', '');
278
279
        $this->coalesceArr($_REQUEST, 'aggrcomment', '');
280
281
        $this->printTrail('schema');
282
        $this->printTitle($this->lang['strcreateaggregate'], 'pg.aggregate.create');
283
        $this->printMsg($msg);
284
285
        echo '<form action="' . \containerInstance()->subFolder . '/src/views/aggregates" method="post">' . \PHP_EOL;
286
        echo '<table>' . \PHP_EOL;
287
        echo \sprintf(
288
            '	<tr>
289
		<th class="data left required">%s</th>',
290
            $this->lang['strname']
291
        ) . \PHP_EOL;
292
        echo \sprintf(
293
            '		<td class="data"><input name="name" size="32" maxlength="%s" value="',
294
            $this->data->_maxNameLen
295
        ),
296
        \htmlspecialchars($_REQUEST['name']), "\" /></td>\n\t</tr>" . \PHP_EOL;
297
        echo \sprintf(
298
            '	<tr>
299
		<th class="data left required">%s</th>',
300
            $this->lang['straggrbasetype']
301
        ) . \PHP_EOL;
302
        echo \sprintf(
303
            '		<td class="data"><input name="basetype" size="32" maxlength="%s" value="',
304
            $this->data->_maxNameLen
305
        ),
306
        \htmlspecialchars($_REQUEST['basetype']), "\" /></td>\n\t</tr>" . \PHP_EOL;
307
        echo \sprintf(
308
            '	<tr>
309
		<th class="data left required">%s</th>',
310
            $this->lang['straggrsfunc']
311
        ) . \PHP_EOL;
312
        echo \sprintf(
313
            '		<td class="data"><input name="sfunc" size="32" maxlength="%s" value="',
314
            $this->data->_maxNameLen
315
        ),
316
        \htmlspecialchars($_REQUEST['sfunc']), "\" /></td>\n\t</tr>" . \PHP_EOL;
317
        echo \sprintf(
318
            '	<tr>
319
		<th class="data left required">%s</th>',
320
            $this->lang['straggrstype']
321
        ) . \PHP_EOL;
322
        echo \sprintf(
323
            '		<td class="data"><input name="stype" size="32" maxlength="%s" value="',
324
            $this->data->_maxNameLen
325
        ),
326
        \htmlspecialchars($_REQUEST['stype']), "\" /></td>\n\t</tr>" . \PHP_EOL;
327
        echo \sprintf(
328
            '	<tr>
329
		<th class="data left">%s</th>',
330
            $this->lang['straggrffunc']
331
        ) . \PHP_EOL;
332
        echo \sprintf(
333
            '		<td class="data"><input name="ffunc" size="32" maxlength="%s" value="',
334
            $this->data->_maxNameLen
335
        ),
336
        \htmlspecialchars($_REQUEST['ffunc']), "\" /></td>\n\t</tr>" . \PHP_EOL;
337
        echo \sprintf(
338
            '	<tr>
339
		<th class="data left">%s</th>',
340
            $this->lang['straggrinitcond']
341
        ) . \PHP_EOL;
342
        echo \sprintf(
343
            '		<td class="data"><input name="initcond" size="32" maxlength="%s" value="',
344
            $this->data->_maxNameLen
345
        ),
346
        \htmlspecialchars($_REQUEST['initcond']), "\" /></td>\n\t</tr>" . \PHP_EOL;
347
        echo \sprintf(
348
            '	<tr>
349
		<th class="data left">%s</th>',
350
            $this->lang['straggrsortop']
351
        ) . \PHP_EOL;
352
        echo \sprintf(
353
            '		<td class="data"><input name="sortop" size="32" maxlength="%s" value="',
354
            $this->data->_maxNameLen
355
        ),
356
        \htmlspecialchars($_REQUEST['sortop']), "\" /></td>\n\t</tr>" . \PHP_EOL;
357
        echo \sprintf(
358
            '	<tr>
359
		<th class="data left">%s</th>',
360
            $this->lang['strcomment']
361
        ) . \PHP_EOL;
362
        echo "\t\t<td><textarea name=\"aggrcomment\" rows=\"3\" cols=\"32\">",
363
        \htmlspecialchars($_REQUEST['aggrcomment']), "</textarea></td>\n\t</tr>" . \PHP_EOL;
364
365
        echo '</table>' . \PHP_EOL;
366
        echo '<p><input type="hidden" name="action" value="save_create" />' . \PHP_EOL;
367
        echo $this->view->form;
368
        echo \sprintf(
369
            '<input type="submit" value="%s" />',
370
            $this->lang['strcreate']
371
        ) . \PHP_EOL;
372
        echo \sprintf(
373
            '<input type="submit" name="cancel" value="%s"  /></p>%s',
374
            $this->lang['strcancel'],
375
            \PHP_EOL
376
        );
377
        echo '</form>' . \PHP_EOL;
378
    }
379
380
    /**
381
     * Function to save after altering an aggregate.
382
     */
383
    public function doSaveAlter(): void
384
    {
385
        $this->data = $this->misc->getDatabaseAccessor();
386
387
        // Check inputs
388
        if ('' === \trim($_REQUEST['aggrname'])) {
389
            $this->doAlter($this->lang['straggrneedsname']);
390
391
            return;
392
        }
393
394
        $status = $this->data->alterAggregate(
395
            $_REQUEST['aggrname'],
396
            $_REQUEST['aggrtype'],
397
            $_REQUEST['aggrowner'],
398
            $_REQUEST['aggrschema'],
399
            $_REQUEST['aggrcomment'],
400
            $_REQUEST['newaggrname'],
401
            $_REQUEST['newaggrowner'],
402
            $_REQUEST['newaggrschema'],
403
            $_REQUEST['newaggrcomment']
404
        );
405
406
        if (0 === $status) {
407
            $this->doDefault($this->lang['straggraltered']);
408
        } else {
409
            $this->doAlter($this->lang['straggralteredbad']);
410
411
            return;
412
        }
413
    }
414
415
    /**
416
     * Function to allow editing an aggregate function.
417
     *
418
     * @param mixed $msg
419
     */
420
    public function doAlter($msg = ''): void
421
    {
422
        $this->data = $this->misc->getDatabaseAccessor();
423
424
        $this->printTrail('aggregate');
425
        $this->printTitle($this->lang['stralter'], 'pg.aggregate.alter');
426
        $this->printMsg($msg);
427
428
        echo '<form action="' . \containerInstance()->subFolder . '/src/views/aggregates" method="post">' . \PHP_EOL;
429
        $aggrdata = $this->data->getAggregate($_REQUEST['aggrname'], $_REQUEST['aggrtype']);
430
431
        if (0 < $aggrdata->recordCount()) {
432
            // Output table header
433
            echo '<table>' . \PHP_EOL;
434
            echo \sprintf(
435
                '	<tr>
436
		<th class="data required">%s</th>',
437
                $this->lang['strname']
438
            );
439
            echo \sprintf(
440
                '<th class="data required">%s</th>',
441
                $this->lang['strowner']
442
            );
443
            echo \sprintf(
444
                '<th class="data required">%s</th>
445
	</tr>',
446
                $this->lang['strschema']
447
            ) . \PHP_EOL;
448
449
            // Display aggregate's name, owner and schema
450
            echo "\t<tr>\n\t\t<td><input name=\"newaggrname\" size=\"32\" maxlength=\"32\" value=\"", \htmlspecialchars($_REQUEST['aggrname']), '" /></td>';
451
            echo '<td><input name="newaggrowner" size="32" maxlength="32" value="', \htmlspecialchars($aggrdata->fields['usename']), '" /></td>';
452
            echo '<td><input name="newaggrschema" size="32" maxlength="32" value="', \htmlspecialchars($_REQUEST['schema']), "\" /></td>\n\t</tr>" . \PHP_EOL;
453
            echo \sprintf(
454
                '	<tr>
455
		<th class="data left">%s</th>',
456
                $this->lang['strcomment']
457
            ) . \PHP_EOL;
458
            echo "\t\t<td><textarea name=\"newaggrcomment\" rows=\"3\" cols=\"32\">",
459
            \htmlspecialchars($aggrdata->fields['aggrcomment']), "</textarea></td>\n\t</tr>" . \PHP_EOL;
460
            echo '</table>' . \PHP_EOL;
461
            echo '<p><input type="hidden" name="action" value="save_alter" />' . \PHP_EOL;
462
            echo $this->view->form;
463
            echo '<input type="hidden" name="aggrname" value="', \htmlspecialchars($_REQUEST['aggrname']), '" />' . \PHP_EOL;
464
            echo '<input type="hidden" name="aggrtype" value="', \htmlspecialchars($_REQUEST['aggrtype']), '" />' . \PHP_EOL;
465
            echo '<input type="hidden" name="aggrowner" value="', \htmlspecialchars($aggrdata->fields['usename']), '" />' . \PHP_EOL;
466
            echo '<input type="hidden" name="aggrschema" value="', \htmlspecialchars($_REQUEST['schema']), '" />' . \PHP_EOL;
467
            echo '<input type="hidden" name="aggrcomment" value="', \htmlspecialchars($aggrdata->fields['aggrcomment']), '" />' . \PHP_EOL;
468
            echo \sprintf(
469
                '<input type="submit" name="alter" value="%s" />',
470
                $this->lang['stralter']
471
            ) . \PHP_EOL;
472
            echo \sprintf(
473
                '<input type="submit" name="cancel" value="%s"  /></p>%s',
474
                $this->lang['strcancel'],
475
                \PHP_EOL
476
            );
477
        } else {
478
            echo \sprintf(
479
                '<p>%s</p>',
480
                $this->lang['strnodata']
481
            ) . \PHP_EOL;
482
            echo \sprintf(
483
                '<input type="submit" name="cancel" value="%s" /></p>',
484
                $this->lang['strback']
485
            ) . \PHP_EOL;
486
        }
487
        echo '</form>' . \PHP_EOL;
488
    }
489
490
    /**
491
     * Show confirmation of drop and perform actual drop of the aggregate function selected.
492
     *
493
     * @param mixed $confirm
494
     */
495
    public function doDrop($confirm): void
496
    {
497
        $this->data = $this->misc->getDatabaseAccessor();
498
499
        if ($confirm) {
500
            $this->printTrail('aggregate');
501
            $this->printTitle($this->lang['strdrop'], 'pg.aggregate.drop');
502
503
            echo '<p>', \sprintf(
504
                $this->lang['strconfdropaggregate'],
505
                \htmlspecialchars($_REQUEST['aggrname'])
506
            ), '</p>' . \PHP_EOL;
507
508
            echo '<form action="' . \containerInstance()->subFolder . '/src/views/aggregates" method="post">' . \PHP_EOL;
509
            echo \sprintf(
510
                '<p><input type="checkbox" id="cascade" name="cascade" /> <label for="cascade">%s</label></p>',
511
                $this->lang['strcascade']
512
            ) . \PHP_EOL;
513
            echo '<p><input type="hidden" name="action" value="drop" />' . \PHP_EOL;
514
            echo '<input type="hidden" name="aggrname" value="', \htmlspecialchars($_REQUEST['aggrname']), '" />' . \PHP_EOL;
515
            echo '<input type="hidden" name="aggrtype" value="', \htmlspecialchars($_REQUEST['aggrtype']), '" />' . \PHP_EOL;
516
            echo $this->view->form;
517
            echo \sprintf(
518
                '<input type="submit" name="drop" value="%s" />',
519
                $this->lang['strdrop']
520
            ) . \PHP_EOL;
521
            echo \sprintf(
522
                '<input type="submit" name="cancel" value="%s"  /></p>%s',
523
                $this->lang['strcancel'],
524
                \PHP_EOL
525
            );
526
            echo '</form>' . \PHP_EOL;
527
        } else {
528
            $status = $this->data->dropAggregate($_POST['aggrname'], $_POST['aggrtype'], isset($_POST['cascade']));
529
530
            if (0 === $status) {
531
                $this->view->setReloadBrowser(true);
532
                $this->doDefault($this->lang['straggregatedropped']);
533
            } else {
534
                $this->doDefault($this->lang['straggregatedroppedbad']);
535
            }
536
        }
537
    }
538
539
    /**
540
     * Show the properties of an aggregate.
541
     *
542
     * @param mixed $msg
543
     */
544
    public function doProperties($msg = ''): void
545
    {
546
        $this->data = $this->misc->getDatabaseAccessor();
547
548
        $this->printTrail('aggregate');
549
        $this->printTitle($this->lang['strproperties'], 'pg.aggregate');
550
        $this->printMsg($msg);
551
552
        $aggrdata = $this->data->getAggregate($_REQUEST['aggrname'], $_REQUEST['aggrtype']);
553
554
        if (0 < $aggrdata->recordCount()) {
555
            // Display aggregate's info
556
            echo '<table>' . \PHP_EOL;
557
            echo \sprintf(
558
                '<tr>
559
	<th class="data left">%s</th>',
560
                $this->lang['strname']
561
            ) . \PHP_EOL;
562
            echo "\t<td class=\"data1\">", \htmlspecialchars($_REQUEST['aggrname']), "</td>\n</tr>" . \PHP_EOL;
563
            echo \sprintf(
564
                '<tr>
565
	<th class="data left">%s</th>',
566
                $this->lang['straggrbasetype']
567
            ) . \PHP_EOL;
568
            echo "\t<td class=\"data1\">", \htmlspecialchars($_REQUEST['aggrtype']), "</td>\n</tr>" . \PHP_EOL;
569
            echo \sprintf(
570
                '<tr>
571
	<th class="data left">%s</th>',
572
                $this->lang['straggrsfunc']
573
            ) . \PHP_EOL;
574
            echo "\t<td class=\"data1\">", \htmlspecialchars($aggrdata->fields['aggtransfn']), "</td>\n</tr>" . \PHP_EOL;
575
            echo \sprintf(
576
                '<tr>
577
	<th class="data left">%s</th>',
578
                $this->lang['straggrstype']
579
            ) . \PHP_EOL;
580
            echo "\t<td class=\"data1\">", \htmlspecialchars($aggrdata->fields['aggstype']), "</td>\n</tr>" . \PHP_EOL;
581
            echo \sprintf(
582
                '<tr>
583
	<th class="data left">%s</th>',
584
                $this->lang['straggrffunc']
585
            ) . \PHP_EOL;
586
            echo "\t<td class=\"data1\">", \htmlspecialchars($aggrdata->fields['aggfinalfn']), "</td>\n</tr>" . \PHP_EOL;
587
            echo \sprintf(
588
                '<tr>
589
	<th class="data left">%s</th>',
590
                $this->lang['straggrinitcond']
591
            ) . \PHP_EOL;
592
            echo "\t<td class=\"data1\">", \htmlspecialchars($aggrdata->fields['agginitval']), "</td>\n</tr>" . \PHP_EOL;
593
594
            if ($this->data->hasAggregateSortOp()) {
595
                echo \sprintf(
596
                    '<tr>
597
	<th class="data left">%s</th>',
598
                    $this->lang['straggrsortop']
599
                ) . \PHP_EOL;
600
                echo "\t<td class=\"data1\">", \htmlspecialchars($aggrdata->fields['aggsortop']), "</td>\n</tr>" . \PHP_EOL;
601
            }
602
            echo \sprintf(
603
                '<tr>
604
	<th class="data left">%s</th>',
605
                $this->lang['strowner']
606
            ) . \PHP_EOL;
607
            echo "\t<td class=\"data1\">", \htmlspecialchars($aggrdata->fields['usename']), "</td>\n</tr>" . \PHP_EOL;
608
            echo \sprintf(
609
                '<tr>
610
	<th class="data left">%s</th>',
611
                $this->lang['strcomment']
612
            ) . \PHP_EOL;
613
            echo "\t<td class=\"data1\">", $this->misc->printVal($aggrdata->fields['aggrcomment']), "</td>\n</tr>" . \PHP_EOL;
614
            echo '</table>' . \PHP_EOL;
615
        } else {
616
            echo \sprintf(
617
                '<p>%s</p>',
618
                $this->lang['strnodata']
619
            ) . \PHP_EOL;
620
        }
621
622
        $navlinks = [
623
            'showall' => [
624
                'attr' => [
625
                    'href' => [
626
                        'url' => 'aggregates',
627
                        'urlvars' => [
628
                            'server' => $_REQUEST['server'],
629
                            'database' => $_REQUEST['database'],
630
                            'schema' => $_REQUEST['schema'],
631
                        ],
632
                    ],
633
                ],
634
                'content' => $this->lang['straggrshowall'],
635
            ],
636
        ];
637
638
        if ($this->data->hasAlterAggregate()) {
639
            $navlinks['alter'] = [
640
                'attr' => [
641
                    'href' => [
642
                        'url' => 'aggregates',
643
                        'urlvars' => [
644
                            'action' => 'alter',
645
                            'server' => $_REQUEST['server'],
646
                            'database' => $_REQUEST['database'],
647
                            'schema' => $_REQUEST['schema'],
648
                            'aggrname' => $_REQUEST['aggrname'],
649
                            'aggrtype' => $_REQUEST['aggrtype'],
650
                        ],
651
                    ],
652
                ],
653
                'content' => $this->lang['stralter'],
654
            ];
655
        }
656
657
        $navlinks['drop'] = [
658
            'attr' => [
659
                'href' => [
660
                    'url' => 'aggregates',
661
                    'urlvars' => [
662
                        'action' => 'confirm_drop',
663
                        'server' => $_REQUEST['server'],
664
                        'database' => $_REQUEST['database'],
665
                        'schema' => $_REQUEST['schema'],
666
                        'aggrname' => $_REQUEST['aggrname'],
667
                        'aggrtype' => $_REQUEST['aggrtype'],
668
                    ],
669
                ],
670
            ],
671
            'content' => $this->lang['strdrop'],
672
        ];
673
674
        $this->printNavLinks($navlinks, 'aggregates-properties', \get_defined_vars());
675
    }
676
}
677