Andrey Andreev | c5536aa | 2012-11-01 17:33:58 +0200 | [diff] [blame] | 1 | <?php |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 2 | /** |
| 3 | * CodeIgniter |
| 4 | * |
Andrey Andreev | fe9309d | 2015-01-09 17:48:58 +0200 | [diff] [blame] | 5 | * An open source application development framework for PHP |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 6 | * |
Andrey Andreev | bdb96ca | 2014-10-28 00:13:31 +0200 | [diff] [blame] | 7 | * This content is released under the MIT License (MIT) |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 8 | * |
Andrey Andreev | cce6bd1 | 2018-01-09 11:32:02 +0200 | [diff] [blame^] | 9 | * Copyright (c) 2014 - 2018, British Columbia Institute of Technology |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 10 | * |
Andrey Andreev | bdb96ca | 2014-10-28 00:13:31 +0200 | [diff] [blame] | 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 12 | * of this software and associated documentation files (the "Software"), to deal |
| 13 | * in the Software without restriction, including without limitation the rights |
| 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 15 | * copies of the Software, and to permit persons to whom the Software is |
| 16 | * furnished to do so, subject to the following conditions: |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 17 | * |
Andrey Andreev | bdb96ca | 2014-10-28 00:13:31 +0200 | [diff] [blame] | 18 | * The above copyright notice and this permission notice shall be included in |
| 19 | * all copies or substantial portions of the Software. |
| 20 | * |
| 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 27 | * THE SOFTWARE. |
| 28 | * |
| 29 | * @package CodeIgniter |
| 30 | * @author EllisLab Dev Team |
Andrey Andreev | 1924e87 | 2016-01-11 12:55:34 +0200 | [diff] [blame] | 31 | * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) |
Andrey Andreev | cce6bd1 | 2018-01-09 11:32:02 +0200 | [diff] [blame^] | 32 | * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) |
Andrey Andreev | bdb96ca | 2014-10-28 00:13:31 +0200 | [diff] [blame] | 33 | * @license http://opensource.org/licenses/MIT MIT License |
Andrey Andreev | bd202c9 | 2016-01-11 12:50:18 +0200 | [diff] [blame] | 34 | * @link https://codeigniter.com |
Andrey Andreev | bdb96ca | 2014-10-28 00:13:31 +0200 | [diff] [blame] | 35 | * @since Version 1.3.1 |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 36 | * @filesource |
| 37 | */ |
Andrey Andreev | c5536aa | 2012-11-01 17:33:58 +0200 | [diff] [blame] | 38 | defined('BASEPATH') OR exit('No direct script access allowed'); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 39 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 40 | /** |
| 41 | * HTML Table Generating Class |
| 42 | * |
| 43 | * Lets you create tables manually or from database result objects, or arrays. |
| 44 | * |
| 45 | * @package CodeIgniter |
| 46 | * @subpackage Libraries |
| 47 | * @category HTML Tables |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 48 | * @author EllisLab Dev Team |
Andrey Andreev | bd202c9 | 2016-01-11 12:50:18 +0200 | [diff] [blame] | 49 | * @link https://codeigniter.com/user_guide/libraries/table.html |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 50 | */ |
| 51 | class CI_Table { |
| 52 | |
Timothy Warren | 3182a76 | 2012-04-26 18:09:25 -0400 | [diff] [blame] | 53 | /** |
| 54 | * Data for table rows |
| 55 | * |
| 56 | * @var array |
| 57 | */ |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 58 | public $rows = array(); |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 59 | |
Timothy Warren | 3182a76 | 2012-04-26 18:09:25 -0400 | [diff] [blame] | 60 | /** |
| 61 | * Data for table heading |
| 62 | * |
| 63 | * @var array |
| 64 | */ |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 65 | public $heading = array(); |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 66 | |
Timothy Warren | 3182a76 | 2012-04-26 18:09:25 -0400 | [diff] [blame] | 67 | /** |
| 68 | * Whether or not to automatically create the table header |
| 69 | * |
| 70 | * @var bool |
| 71 | */ |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 72 | public $auto_heading = TRUE; |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 73 | |
Timothy Warren | 3182a76 | 2012-04-26 18:09:25 -0400 | [diff] [blame] | 74 | /** |
| 75 | * Table caption |
| 76 | * |
| 77 | * @var string |
| 78 | */ |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 79 | public $caption = NULL; |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 80 | |
Timothy Warren | 3182a76 | 2012-04-26 18:09:25 -0400 | [diff] [blame] | 81 | /** |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 82 | * Table layout template |
Timothy Warren | 3182a76 | 2012-04-26 18:09:25 -0400 | [diff] [blame] | 83 | * |
| 84 | * @var array |
| 85 | */ |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 86 | public $template = NULL; |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 87 | |
Timothy Warren | 3182a76 | 2012-04-26 18:09:25 -0400 | [diff] [blame] | 88 | /** |
| 89 | * Newline setting |
| 90 | * |
| 91 | * @var string |
| 92 | */ |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 93 | public $newline = "\n"; |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 94 | |
Timothy Warren | 3182a76 | 2012-04-26 18:09:25 -0400 | [diff] [blame] | 95 | /** |
| 96 | * Contents of empty cells |
| 97 | * |
| 98 | * @var string |
| 99 | */ |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 100 | public $empty_cells = ''; |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 101 | |
Timothy Warren | 3182a76 | 2012-04-26 18:09:25 -0400 | [diff] [blame] | 102 | /** |
| 103 | * Callback for custom table layout |
| 104 | * |
| 105 | * @var function |
| 106 | */ |
Andrey Andreev | a49c8ad | 2014-02-11 17:15:07 +0200 | [diff] [blame] | 107 | public $function = NULL; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 108 | |
Mike Funk | 46e3a9a | 2012-02-24 09:38:35 -0500 | [diff] [blame] | 109 | /** |
| 110 | * Set the template from the table config file if it exists |
Andrey Andreev | 8029532 | 2012-03-12 16:29:16 +0200 | [diff] [blame] | 111 | * |
Mike Funk | 5fbaf27 | 2012-03-12 10:19:46 -0400 | [diff] [blame] | 112 | * @param array $config (default: array()) |
Mike Funk | aa20f5b | 2012-02-28 13:43:16 -0500 | [diff] [blame] | 113 | * @return void |
Mike Funk | 46e3a9a | 2012-02-24 09:38:35 -0500 | [diff] [blame] | 114 | */ |
| 115 | public function __construct($config = array()) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 116 | { |
Mike Funk | 46e3a9a | 2012-02-24 09:38:35 -0500 | [diff] [blame] | 117 | // initialize config |
| 118 | foreach ($config as $key => $val) |
| 119 | { |
| 120 | $this->template[$key] = $val; |
| 121 | } |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 122 | |
Andrey Andreev | 90726b8 | 2015-01-20 12:39:22 +0200 | [diff] [blame] | 123 | log_message('info', 'Table Class Initialized'); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | // -------------------------------------------------------------------- |
| 127 | |
| 128 | /** |
| 129 | * Set the template |
| 130 | * |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 131 | * @param array $template |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 132 | * @return bool |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 133 | */ |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 134 | public function set_template($template) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 135 | { |
| 136 | if ( ! is_array($template)) |
| 137 | { |
| 138 | return FALSE; |
| 139 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 140 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 141 | $this->template = $template; |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 142 | return TRUE; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | // -------------------------------------------------------------------- |
| 146 | |
| 147 | /** |
| 148 | * Set the table heading |
| 149 | * |
| 150 | * Can be passed as an array or discreet params |
| 151 | * |
Andrey Andreev | 3fcc3f6 | 2014-02-11 17:28:36 +0200 | [diff] [blame] | 152 | * @param mixed |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 153 | * @return CI_Table |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 154 | */ |
Andrey Andreev | 3fcc3f6 | 2014-02-11 17:28:36 +0200 | [diff] [blame] | 155 | public function set_heading($args = array()) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 156 | { |
Andrey Andreev | 3fcc3f6 | 2014-02-11 17:28:36 +0200 | [diff] [blame] | 157 | $this->heading = $this->_prep_args(func_get_args()); |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 158 | return $this; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | // -------------------------------------------------------------------- |
| 162 | |
| 163 | /** |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 164 | * Set columns. Takes a one-dimensional array as input and creates |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 165 | * a multi-dimensional array with a depth equal to the number of |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 166 | * columns. This allows a single array with many elements to be |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 167 | * displayed in a table that has a fixed column count. |
| 168 | * |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 169 | * @param array $array |
| 170 | * @param int $col_limit |
| 171 | * @return array |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 172 | */ |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 173 | public function make_columns($array = array(), $col_limit = 0) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 174 | { |
Taufan Aditya | 8749bc7 | 2012-03-11 05:43:45 +0700 | [diff] [blame] | 175 | if ( ! is_array($array) OR count($array) === 0 OR ! is_int($col_limit)) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 176 | { |
| 177 | return FALSE; |
| 178 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 179 | |
| 180 | // Turn off the auto-heading feature since it's doubtful we |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 181 | // will want headings from a one-dimensional array |
| 182 | $this->auto_heading = FALSE; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 183 | |
Alex Bilbie | d261b1e | 2012-06-02 11:12:16 +0100 | [diff] [blame] | 184 | if ($col_limit === 0) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 185 | { |
| 186 | return $array; |
| 187 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 188 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 189 | $new = array(); |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 190 | do |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 191 | { |
| 192 | $temp = array_splice($array, 0, $col_limit); |
| 193 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 194 | if (count($temp) < $col_limit) |
| 195 | { |
| 196 | for ($i = count($temp); $i < $col_limit; $i++) |
| 197 | { |
| 198 | $temp[] = ' '; |
| 199 | } |
| 200 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 201 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 202 | $new[] = $temp; |
| 203 | } |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 204 | while (count($array) > 0); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 205 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 206 | return $new; |
| 207 | } |
| 208 | |
| 209 | // -------------------------------------------------------------------- |
| 210 | |
| 211 | /** |
| 212 | * Set "empty" cells |
| 213 | * |
| 214 | * Can be passed as an array or discreet params |
| 215 | * |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 216 | * @param mixed $value |
| 217 | * @return CI_Table |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 218 | */ |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 219 | public function set_empty($value) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 220 | { |
| 221 | $this->empty_cells = $value; |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 222 | return $this; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 223 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 224 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 225 | // -------------------------------------------------------------------- |
| 226 | |
| 227 | /** |
| 228 | * Add a table row |
| 229 | * |
| 230 | * Can be passed as an array or discreet params |
| 231 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 232 | * @param mixed |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 233 | * @return CI_Table |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 234 | */ |
Timothy Warren | 3182a76 | 2012-04-26 18:09:25 -0400 | [diff] [blame] | 235 | public function add_row($args = array()) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 236 | { |
Andrey Andreev | 3fcc3f6 | 2014-02-11 17:28:36 +0200 | [diff] [blame] | 237 | $this->rows[] = $this->_prep_args(func_get_args()); |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 238 | return $this; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 239 | } |
| 240 | |
| 241 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 242 | |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 243 | /** |
| 244 | * Prep Args |
| 245 | * |
| 246 | * Ensures a standard associative array format for all cell data |
| 247 | * |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 248 | * @param array |
| 249 | * @return array |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 250 | */ |
Andrey Andreev | 49ddaa3 | 2011-12-26 16:54:10 +0200 | [diff] [blame] | 251 | protected function _prep_args($args) |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 252 | { |
| 253 | // If there is no $args[0], skip this and treat as an associative array |
| 254 | // This can happen if there is only a single key, for example this is passed to table->generate |
| 255 | // array(array('foo'=>'bar')) |
Andrey Andreev | f0b69a8 | 2014-02-11 17:56:44 +0200 | [diff] [blame] | 256 | if (isset($args[0]) && count($args) === 1 && is_array($args[0]) && ! isset($args[0]['data'])) |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 257 | { |
Andrey Andreev | f0b69a8 | 2014-02-11 17:56:44 +0200 | [diff] [blame] | 258 | $args = $args[0]; |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 259 | } |
Andrey Andreev | f0b69a8 | 2014-02-11 17:56:44 +0200 | [diff] [blame] | 260 | |
| 261 | foreach ($args as $key => $val) |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 262 | { |
Andrey Andreev | f0b69a8 | 2014-02-11 17:56:44 +0200 | [diff] [blame] | 263 | is_array($val) OR $args[$key] = array('data' => $val); |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 264 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 265 | |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 266 | return $args; |
| 267 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 268 | |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 269 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 270 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 271 | /** |
| 272 | * Add a table caption |
| 273 | * |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 274 | * @param string $caption |
| 275 | * @return CI_Table |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 276 | */ |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 277 | public function set_caption($caption) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 278 | { |
| 279 | $this->caption = $caption; |
Andrey Andreev | fb4cec2 | 2016-10-20 11:47:58 +0300 | [diff] [blame] | 280 | return $this; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 281 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 282 | |
| 283 | // -------------------------------------------------------------------- |
| 284 | |
| 285 | /** |
| 286 | * Generate the table |
| 287 | * |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 288 | * @param mixed $table_data |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 289 | * @return string |
| 290 | */ |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 291 | public function generate($table_data = NULL) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 292 | { |
| 293 | // The table data can optionally be passed to this function |
| 294 | // either as a database result object or an array |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 295 | if ( ! empty($table_data)) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 296 | { |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 297 | if ($table_data instanceof CI_DB_result) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 298 | { |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 299 | $this->_set_from_db_result($table_data); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 300 | } |
| 301 | elseif (is_array($table_data)) |
| 302 | { |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 303 | $this->_set_from_array($table_data); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 304 | } |
| 305 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 306 | |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 307 | // Is there anything to display? No? Smite them! |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 308 | if (empty($this->heading) && empty($this->rows)) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 309 | { |
| 310 | return 'Undefined table data'; |
| 311 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 312 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 313 | // Compile and validate the template date |
| 314 | $this->_compile_template(); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 315 | |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 316 | // Validate a possibly existing custom cell manipulation function |
Andrey Andreev | a49c8ad | 2014-02-11 17:15:07 +0200 | [diff] [blame] | 317 | if (isset($this->function) && ! is_callable($this->function)) |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 318 | { |
Andrey Andreev | a49c8ad | 2014-02-11 17:15:07 +0200 | [diff] [blame] | 319 | $this->function = NULL; |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 320 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 321 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 322 | // Build the table! |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 323 | |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 324 | $out = $this->template['table_open'].$this->newline; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 325 | |
| 326 | // Add any caption here |
| 327 | if ($this->caption) |
| 328 | { |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 329 | $out .= '<caption>'.$this->caption.'</caption>'.$this->newline; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | // Is there a table heading to display? |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 333 | if ( ! empty($this->heading)) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 334 | { |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 335 | $out .= $this->template['thead_open'].$this->newline.$this->template['heading_row_start'].$this->newline; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 336 | |
Pascal Kriete | 14287f3 | 2011-02-14 13:39:34 -0500 | [diff] [blame] | 337 | foreach ($this->heading as $heading) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 338 | { |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 339 | $temp = $this->template['heading_cell_start']; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 340 | |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 341 | foreach ($heading as $key => $val) |
| 342 | { |
Alex Bilbie | d261b1e | 2012-06-02 11:12:16 +0100 | [diff] [blame] | 343 | if ($key !== 'data') |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 344 | { |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 345 | $temp = str_replace('<th', '<th '.$key.'="'.$val.'"', $temp); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 346 | } |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 347 | } |
| 348 | |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 349 | $out .= $temp.(isset($heading['data']) ? $heading['data'] : '').$this->template['heading_cell_end']; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 350 | } |
| 351 | |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 352 | $out .= $this->template['heading_row_end'].$this->newline.$this->template['thead_close'].$this->newline; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 353 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 354 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 355 | // Build the table rows |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 356 | if ( ! empty($this->rows)) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 357 | { |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 358 | $out .= $this->template['tbody_open'].$this->newline; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 359 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 360 | $i = 1; |
Pascal Kriete | 14287f3 | 2011-02-14 13:39:34 -0500 | [diff] [blame] | 361 | foreach ($this->rows as $row) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 362 | { |
| 363 | if ( ! is_array($row)) |
| 364 | { |
| 365 | break; |
| 366 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 367 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 368 | // We use modulus to alternate the row colors |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 369 | $name = fmod($i++, 2) ? '' : 'alt_'; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 370 | |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 371 | $out .= $this->template['row_'.$name.'start'].$this->newline; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 372 | |
Pascal Kriete | 14287f3 | 2011-02-14 13:39:34 -0500 | [diff] [blame] | 373 | foreach ($row as $cell) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 374 | { |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 375 | $temp = $this->template['cell_'.$name.'start']; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 376 | |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 377 | foreach ($cell as $key => $val) |
| 378 | { |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 379 | if ($key !== 'data') |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 380 | { |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 381 | $temp = str_replace('<td', '<td '.$key.'="'.$val.'"', $temp); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 382 | } |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 383 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 384 | |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 385 | $cell = isset($cell['data']) ? $cell['data'] : ''; |
| 386 | $out .= $temp; |
| 387 | |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 388 | if ($cell === '' OR $cell === NULL) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 389 | { |
| 390 | $out .= $this->empty_cells; |
| 391 | } |
Andrey Andreev | a49c8ad | 2014-02-11 17:15:07 +0200 | [diff] [blame] | 392 | elseif (isset($this->function)) |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 393 | { |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 394 | $out .= call_user_func($this->function, $cell); |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 395 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 396 | else |
| 397 | { |
Andrey Andreev | 2b39d9d | 2012-04-03 19:14:23 +0300 | [diff] [blame] | 398 | $out .= $cell; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 399 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 400 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 401 | $out .= $this->template['cell_'.$name.'end']; |
| 402 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 403 | |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 404 | $out .= $this->template['row_'.$name.'end'].$this->newline; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 405 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 406 | |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 407 | $out .= $this->template['tbody_close'].$this->newline; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 408 | } |
| 409 | |
| 410 | $out .= $this->template['table_close']; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 411 | |
Greg Aker | 02b3a5b | 2011-02-01 01:29:21 -0600 | [diff] [blame] | 412 | // Clear table class properties before generating the table |
| 413 | $this->clear(); |
| 414 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 415 | return $out; |
| 416 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 417 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 418 | // -------------------------------------------------------------------- |
| 419 | |
| 420 | /** |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 421 | * Clears the table arrays. Useful if multiple tables are being generated |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 422 | * |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 423 | * @return CI_Table |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 424 | */ |
Andrey Andreev | fe9b9a9 | 2011-12-25 16:11:01 +0200 | [diff] [blame] | 425 | public function clear() |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 426 | { |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 427 | $this->rows = array(); |
| 428 | $this->heading = array(); |
| 429 | $this->auto_heading = TRUE; |
| 430 | return $this; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 431 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 432 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 433 | // -------------------------------------------------------------------- |
| 434 | |
| 435 | /** |
| 436 | * Set table data from a database result object |
| 437 | * |
Andrey Andreev | ee9d428 | 2017-06-05 10:44:37 +0300 | [diff] [blame] | 438 | * @param CI_DB_result $object Database result object |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 439 | * @return void |
| 440 | */ |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 441 | protected function _set_from_db_result($object) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 442 | { |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 443 | // First generate the headings from the table column names |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 444 | if ($this->auto_heading === TRUE && empty($this->heading)) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 445 | { |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 446 | $this->heading = $this->_prep_args($object->list_fields()); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 447 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 448 | |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 449 | foreach ($object->result_array() as $row) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 450 | { |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 451 | $this->rows[] = $this->_prep_args($row); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 452 | } |
| 453 | } |
| 454 | |
| 455 | // -------------------------------------------------------------------- |
| 456 | |
| 457 | /** |
| 458 | * Set table data from an array |
| 459 | * |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 460 | * @param array $data |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 461 | * @return void |
| 462 | */ |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 463 | protected function _set_from_array($data) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 464 | { |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 465 | if ($this->auto_heading === TRUE && empty($this->heading)) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 466 | { |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 467 | $this->heading = $this->_prep_args(array_shift($data)); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 468 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 469 | |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 470 | foreach ($data as &$row) |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 471 | { |
Andrey Andreev | 05983fc | 2014-02-11 16:51:43 +0200 | [diff] [blame] | 472 | $this->rows[] = $this->_prep_args($row); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 473 | } |
| 474 | } |
| 475 | |
| 476 | // -------------------------------------------------------------------- |
| 477 | |
| 478 | /** |
| 479 | * Compile Template |
| 480 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 481 | * @return void |
| 482 | */ |
Andrey Andreev | 49ddaa3 | 2011-12-26 16:54:10 +0200 | [diff] [blame] | 483 | protected function _compile_template() |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 484 | { |
Alex Bilbie | d261b1e | 2012-06-02 11:12:16 +0100 | [diff] [blame] | 485 | if ($this->template === NULL) |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 486 | { |
| 487 | $this->template = $this->_default_template(); |
| 488 | return; |
| 489 | } |
| 490 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 491 | $this->temp = $this->_default_template(); |
Derek Jones | 7b5b0e2 | 2010-03-02 22:48:53 -0600 | [diff] [blame] | 492 | foreach (array('table_open', 'thead_open', 'thead_close', 'heading_row_start', 'heading_row_end', 'heading_cell_start', 'heading_cell_end', 'tbody_open', 'tbody_close', 'row_start', 'row_end', 'cell_start', 'cell_end', 'row_alt_start', 'row_alt_end', 'cell_alt_start', 'cell_alt_end', 'table_close') as $val) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 493 | { |
| 494 | if ( ! isset($this->template[$val])) |
| 495 | { |
| 496 | $this->template[$val] = $this->temp[$val]; |
| 497 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 498 | } |
| 499 | } |
| 500 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 501 | // -------------------------------------------------------------------- |
| 502 | |
| 503 | /** |
| 504 | * Default Template |
| 505 | * |
Gabriel Potkány | 1fb5000 | 2015-02-04 01:45:59 +0100 | [diff] [blame] | 506 | * @return array |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 507 | */ |
Andrey Andreev | 49ddaa3 | 2011-12-26 16:54:10 +0200 | [diff] [blame] | 508 | protected function _default_template() |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 509 | { |
Andrey Andreev | 838a9d6 | 2012-12-03 14:37:47 +0200 | [diff] [blame] | 510 | return array( |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 511 | 'table_open' => '<table border="0" cellpadding="4" cellspacing="0">', |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 512 | |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 513 | 'thead_open' => '<thead>', |
| 514 | 'thead_close' => '</thead>', |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 515 | |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 516 | 'heading_row_start' => '<tr>', |
| 517 | 'heading_row_end' => '</tr>', |
| 518 | 'heading_cell_start' => '<th>', |
| 519 | 'heading_cell_end' => '</th>', |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 520 | |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 521 | 'tbody_open' => '<tbody>', |
| 522 | 'tbody_close' => '</tbody>', |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 523 | |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 524 | 'row_start' => '<tr>', |
| 525 | 'row_end' => '</tr>', |
| 526 | 'cell_start' => '<td>', |
| 527 | 'cell_end' => '</td>', |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 528 | |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 529 | 'row_alt_start' => '<tr>', |
| 530 | 'row_alt_end' => '</tr>', |
| 531 | 'cell_alt_start' => '<td>', |
| 532 | 'cell_alt_end' => '</td>', |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 533 | |
Andrey Andreev | 1f59095 | 2014-02-08 19:50:26 +0200 | [diff] [blame] | 534 | 'table_close' => '</table>' |
| 535 | ); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 536 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 537 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 538 | } |