From 3182a76899e75bc99da855d79867ce9fcfdc5592 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 26 Apr 2012 18:09:25 -0400 Subject: Fix Table library docblocks --- system/libraries/Table.php | 52 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) (limited to 'system/libraries/Table.php') diff --git a/system/libraries/Table.php b/system/libraries/Table.php index 3777d29ff..c5c71d889 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -38,13 +38,60 @@ */ class CI_Table { + /** + * Data for table rows + * + * @var array + */ public $rows = array(); + + /** + * Data for table heading + * + * @var array + */ public $heading = array(); + + /** + * Whether or not to automatically create the table header + * + * @var bool + */ public $auto_heading = TRUE; + + /** + * Table caption + * + * @var string + */ public $caption = NULL; + + /** + * Table layout template + * + * @var array + */ public $template = NULL; + + /** + * Newline setting + * + * @var string + */ public $newline = "\n"; + + /** + * Contents of empty cells + * + * @var string + */ public $empty_cells = ''; + + /** + * Callback for custom table layout + * + * @var function + */ public $function = FALSE; /** @@ -93,7 +140,7 @@ class CI_Table { * @param mixed * @return void */ - public function set_heading() + public function set_heading($args=array()) { $args = func_get_args(); $this->heading = $this->_prep_args($args); @@ -172,7 +219,7 @@ class CI_Table { * @param mixed * @return void */ - public function add_row() + public function add_row($args = array()) { $args = func_get_args(); $this->rows[] = $this->_prep_args($args); @@ -420,6 +467,7 @@ class CI_Table { * Set table data from an array * * @param array + * @param bool * @return void */ protected function _set_from_array($data, $set_heading = TRUE) -- cgit v1.2.3-24-g4f1b From 68f098142cb71f6a57f74ce34b5f58616cc1ed2f Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 27 Apr 2012 10:38:32 -0400 Subject: Fix calendar and session libraries --- system/libraries/Table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Table.php') diff --git a/system/libraries/Table.php b/system/libraries/Table.php index c5c71d889..236129531 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -140,7 +140,7 @@ class CI_Table { * @param mixed * @return void */ - public function set_heading($args=array()) + public function set_heading($args = array()) { $args = func_get_args(); $this->heading = $this->_prep_args($args); -- cgit v1.2.3-24-g4f1b From 5645479c622eb36cf9869797896dc0921568c4a9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 May 2012 14:32:19 +0300 Subject: Clean up the libraries --- system/libraries/Table.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'system/libraries/Table.php') diff --git a/system/libraries/Table.php b/system/libraries/Table.php index 236129531..f844d6435 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -44,49 +44,49 @@ class CI_Table { * @var array */ public $rows = array(); - + /** * Data for table heading * * @var array */ public $heading = array(); - + /** * Whether or not to automatically create the table header * * @var bool */ public $auto_heading = TRUE; - + /** * Table caption * * @var string */ public $caption = NULL; - + /** - * Table layout template + * Table layout template * * @var array */ public $template = NULL; - + /** * Newline setting * * @var string */ public $newline = "\n"; - + /** * Contents of empty cells * * @var string */ public $empty_cells = ''; - + /** * Callback for custom table layout * -- cgit v1.2.3-24-g4f1b From d261b1e89c3d4d5191036d5a5660ef6764e593a0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:12:16 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/libraries --- system/libraries/Table.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'system/libraries/Table.php') diff --git a/system/libraries/Table.php b/system/libraries/Table.php index f844d6435..0f8404d85 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -169,7 +169,7 @@ class CI_Table { // will want headings from a one-dimensional array $this->auto_heading = FALSE; - if ($col_limit == 0) + if ($col_limit === 0) { return $array; } @@ -298,7 +298,7 @@ class CI_Table { } elseif (is_array($table_data)) { - $set_heading = (count($this->heading) !== 0 OR $this->auto_heading != FALSE); + $set_heading = (count($this->heading) !== 0 OR $this->auto_heading !== FALSE); $this->_set_from_array($table_data, $set_heading); } } @@ -336,7 +336,7 @@ class CI_Table { foreach ($heading as $key => $val) { - if ($key != 'data') + if ($key !== 'data') { $temp = str_replace(' 1 && count($this->heading) === 0 && $set_heading == TRUE) + if ($i++ === 0 && count($data) > 1 && count($this->heading) === 0 && $set_heading === TRUE) { $this->heading = $this->_prep_args($row); } @@ -501,7 +501,7 @@ class CI_Table { */ protected function _compile_template() { - if ($this->template == NULL) + if ($this->template === NULL) { $this->template = $this->_default_template(); return; -- cgit v1.2.3-24-g4f1b From cbe905eba9721cfdc6fe5725b99921f04d716770 Mon Sep 17 00:00:00 2001 From: Cory Date: Tue, 5 Jun 2012 16:01:24 -0400 Subject: Fixing extra td; Issue #1374 --- system/libraries/Table.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/libraries/Table.php') diff --git a/system/libraries/Table.php b/system/libraries/Table.php index 0f8404d85..06b68db32 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -247,7 +247,7 @@ class CI_Table { { foreach ($args[0] as $key => $val) { - $args[$key] = (is_array($val) && isset($val['data'])) ? $val : array('data' => $val); + $ret_args[$key] = (is_array($val) && isset($val['data'])) ? $val : array('data' => $val); } } } @@ -257,12 +257,12 @@ class CI_Table { { if ( ! is_array($val)) { - $args[$key] = array('data' => $val); + $ret_args[$key] = array('data' => $val); } } } - return $args; + return $ret_args; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From d09ff35e8c4b7cae6313cc40ec0e6b57b9f52106 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 Jun 2012 15:46:32 +0300 Subject: Revert 296ab9a06e3c648de56861ad67581236a6dae71a - there's no bug to fix --- system/libraries/Table.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/libraries/Table.php') diff --git a/system/libraries/Table.php b/system/libraries/Table.php index 06b68db32..0f8404d85 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -247,7 +247,7 @@ class CI_Table { { foreach ($args[0] as $key => $val) { - $ret_args[$key] = (is_array($val) && isset($val['data'])) ? $val : array('data' => $val); + $args[$key] = (is_array($val) && isset($val['data'])) ? $val : array('data' => $val); } } } @@ -257,12 +257,12 @@ class CI_Table { { if ( ! is_array($val)) { - $ret_args[$key] = array('data' => $val); + $args[$key] = array('data' => $val); } } } - return $ret_args; + return $args; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b