-
-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathTable.php
More file actions
111 lines (94 loc) · 3.03 KB
/
Copy pathTable.php
File metadata and controls
111 lines (94 loc) · 3.03 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
<?php
/*
* Textpattern Content Management System
* https://textpattern.com/
*
* Copyright (C) 2026 The Textpattern Development Team
*
* This file is part of Textpattern.
*
* Textpattern is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2.
*
* Textpattern is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Textpattern. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* List tables.
*
* @since 4.7.0
* @package Admin\Table
*/
namespace Textpattern\Admin;
class Table
{
/**
* Textpattern event (panel) to which this table applies.
*
* @var string
*/
protected $event = null;
/**
* Constructor.
*
* @param string $evt Textpattern event (panel)
*/
public function __construct($evt = null)
{
global $event;
if ($evt === null) {
$evt = $event;
}
$this->event = $evt;
}
/**
* Renders a widget to display lists.
*
* @param array $data Current search/pagination settings
* @return string HTML
*/
public function render($data = array(), $search = null, $create = null, $content = null, $footer = null)
{
$event = $this->event;
extract($data + array(
'heading' => 'tab_'.$event,
'total' => 0,
'crit' => '',
'html_id' => 'txp-list-container',
'help' => null,
));
$out = n.'<div class="txp-layout">'.
n.tag(
hed(gTxt($heading).($help ? popHelp($help) : ''), 1, array('class' => 'txp-heading')),
'div', array('class' => 'txp-layout-4col-alt')
).n.$search;
$out .= tag_start('div', array(
'class' => 'txp-layout-1col',
'id' => $event.'_container',
)).
n.tag($create, 'div', array('class' => 'txp-layout-cell-row txp-list-head'));
$out .= n.tag_start('div', array('id' => $html_id, 'class' => $html_id ? 'txp-async-update' : false));
if ($total >= 1) {
$out .= script_js('$(".txp-search").show()');
} elseif ($crit === '') {
$out .= script_js('$(".txp-search").hide()');
}
$out .= $content;
$out .= n.tag_start('div', array(
'class' => $total < 1 ? 'txp-layout-cell-row txp-navigation hidden' : 'txp-layout-cell-row txp-navigation',
'id' => $event.'_navigation',
)).
$footer.
n.tag_end('div').
n.'</div>'. // End of #txp-list-container.
n.'</div>'. // End of .txp-layout-1col.
n.'</div>'; // End of .txp-layout.
return $out;
}
}