1 | <?php |
||
15 | abstract class display |
||
16 | { |
||
17 | /** @var \phpbb\db\driver\driver_interface */ |
||
18 | protected $db; |
||
19 | |||
20 | /** @var string */ |
||
21 | protected $items_table; |
||
22 | |||
23 | /** @var string */ |
||
24 | protected $pk; |
||
25 | |||
26 | /** @var string */ |
||
27 | protected $sql_where; |
||
28 | |||
29 | /** @var array */ |
||
30 | protected $errors = array(); |
||
31 | |||
32 | /** @var array */ |
||
33 | protected $data = array(); |
||
34 | |||
35 | /** |
||
36 | * Construct |
||
37 | * |
||
38 | * @param \phpbb\db\driver\driver_interface $db Database connection |
||
39 | * @param string $items_table Table name |
||
40 | * @param string $pk Primary key |
||
41 | * @param string $sql_where Column restriction |
||
42 | */ |
||
43 | 18 | public function __construct(\phpbb\db\driver\driver_interface $db, $items_table, $pk, $sql_where = '') |
|
50 | |||
51 | /** |
||
52 | * Is subject node an ancestor of the object node? |
||
53 | * @param array $object |
||
54 | * @param array $subject |
||
55 | * @return bool |
||
56 | */ |
||
57 | public function is_in_path(array $object, array $subject) |
||
61 | |||
62 | /** |
||
63 | * Count node descendants |
||
64 | * @param array $row |
||
65 | * @return int |
||
66 | */ |
||
67 | 8 | public function count_descendants(array $row) |
|
71 | |||
72 | /** |
||
73 | * Get node row |
||
74 | * @param int $node_id |
||
75 | * @return mixed |
||
76 | */ |
||
77 | public function get_node_info($node_id) |
||
88 | |||
89 | /** |
||
90 | * Get Tree Query |
||
91 | * |
||
92 | * @param integer $start Starting level |
||
93 | * @param integer $level Max depth |
||
94 | * @param array $sql_array Array of elements to merge into query |
||
95 | * array( |
||
96 | * 'SELECT' => array('p.*'), |
||
97 | * 'WHERE' => array('p.post_id = 2'), |
||
98 | * ) |
||
99 | * @return string The sql query |
||
100 | */ |
||
101 | public function qet_tree_sql($start = 0, $level = 0, $sql_array = array()) |
||
123 | |||
124 | /** |
||
125 | * @param int $start |
||
126 | * @param int $level |
||
127 | * @param array $sql_array |
||
128 | * @return array |
||
129 | */ |
||
130 | public function get_tree_array($start = 0, $level = 0, $sql_array = array()) |
||
144 | |||
145 | /** |
||
146 | * @param array $data |
||
147 | * @param \phpbb\template\twig\twig $template |
||
148 | * @param string $handle |
||
149 | */ |
||
150 | 1 | public function display_list(array $data, \phpbb\template\twig\twig &$template, $handle = 'tree') |
|
184 | |||
185 | /** |
||
186 | * Get tree as form options or data |
||
187 | * |
||
188 | * @param array $db_data Raw tree data from database |
||
189 | * @param string $title_column Database column name to use as label/title for each item |
||
190 | * @param array $selected_ids Array of selected items |
||
191 | * @param string $return_mode options | data |
||
192 | * @param string $pad_with Character used to denote nesting |
||
193 | * |
||
194 | * @return mixed Returns array of padded titles or html string of options depending on $return_mode |
||
195 | */ |
||
196 | public function display_options($db_data, $title_column, $selected_ids = array(), $return_mode = 'options', $pad_with = ' ') |
||
229 | } |
||
230 |