summaryrefslogtreecommitdiffstats
path: root/system/libraries/Table.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-20 15:59:04 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-20 15:59:04 +0100
commit817164d822ce5dc1159ddc3e8fad2fa094dfc5ea (patch)
tree125069e2089d0e0ee3b8337b7acac6050ca1e045 /system/libraries/Table.php
parent4b4363871256df9009bb4245def8f89420331cfd (diff)
parent8480f7c35af9aacaf2ebee43677ff1d31a5cce13 (diff)
Merge upstream branch
Diffstat (limited to 'system/libraries/Table.php')
-rw-r--r--system/libraries/Table.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index fb154e50f..11a4858a9 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -25,8 +25,6 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* HTML Table Generating Class
*
@@ -49,9 +47,21 @@ class CI_Table {
public $empty_cells = '';
public $function = FALSE;
- public function __construct()
+ /**
+ * Set the template from the table config file if it exists
+ *
+ * @param array $config (default: array())
+ * @return void
+ */
+ public function __construct($config = array())
{
- log_message('debug', "Table Class Initialized");
+ log_message('debug', 'Table Class Initialized');
+
+ // initialize config
+ foreach ($config as $key => $val)
+ {
+ $this->template[$key] = $val;
+ }
}
// --------------------------------------------------------------------
@@ -102,7 +112,7 @@ class CI_Table {
*/
public function make_columns($array = array(), $col_limit = 0)
{
- if ( ! is_array($array) OR count($array) === 0)
+ if ( ! is_array($array) OR count($array) === 0 OR ! is_int($col_limit))
{
return FALSE;
}
@@ -395,7 +405,7 @@ class CI_Table {
// First generate the headings from the table column names
if (count($this->heading) === 0)
{
- if ( ! method_exists($query, 'list_fields'))
+ if ( ! is_callable(array($query, 'list_fields')))
{
return FALSE;
}