From 2bc13859b72ceb8400d37adbba52b8404995bf03 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 24 Oct 2006 23:16:17 +0000 Subject: --- system/application/config/mimes.php | 5 ++--- system/libraries/Loader.php | 5 +++++ system/libraries/Model.php | 1 + system/libraries/Table.php | 38 +++++++++++++++++++++++++++++++------ user_guide/libraries/table.html | 10 ++++++++++ 5 files changed, 50 insertions(+), 9 deletions(-) diff --git a/system/application/config/mimes.php b/system/application/config/mimes.php index 8b5036f23..12b9de750 100644 --- a/system/application/config/mimes.php +++ b/system/application/config/mimes.php @@ -11,7 +11,6 @@ $mimes = array( 'hqx' => 'application/mac-binhex40', 'cpt' => 'application/mac-compactpro', 'csv' => array('text/x-comma-separated-values', 'application/vnd.ms-excel'), - 'doc' => 'application/msword', 'bin' => 'application/macbinary', 'dms' => 'application/octet-stream', 'lha' => 'application/octet-stream', @@ -23,7 +22,7 @@ $mimes = array( 'hqx' => 'application/mac-binhex40', 'sea' => 'application/octet-stream', 'dll' => 'application/octet-stream', 'oda' => 'application/oda', - 'pdf' => 'application/pdf', + 'pdf' => array('application/pdf', 'application/x-download'), 'ai' => 'application/postscript', 'eps' => 'application/postscript', 'ps' => 'application/postscript', @@ -94,7 +93,7 @@ $mimes = array( 'hqx' => 'application/mac-binhex40', 'avi' => 'video/x-msvideo', 'movie' => 'video/x-sgi-movie', 'doc' => 'application/msword', - 'word' => 'application/msword', + 'word' => array('application/msword', 'application/octet-stream'), 'xl' => 'application/excel', 'eml' => 'message/rfc822' ); diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php index 7c42123f5..f243a2879 100644 --- a/system/libraries/Loader.php +++ b/system/libraries/Loader.php @@ -837,6 +837,11 @@ class CI_Loader { */ function _ci_assign_to_models() { + if (count($this->_ci_models) == 0) + { + return; + } + if ($this->_ci_is_instance()) { $CI =& get_instance(); diff --git a/system/libraries/Model.php b/system/libraries/Model.php index dfb48a5d0..2fe93dd00 100644 --- a/system/libraries/Model.php +++ b/system/libraries/Model.php @@ -37,6 +37,7 @@ class Model { { // If the magic __get() method is used in a Model references can't be used. $this->_assign_libraries( (method_exists($this, '__get')) ? FALSE : TRUE ); + //$this->_assign_libraries( (method_exists($this, '__get') OR method_exists('__set')) ? FALSE : TRUE ); // We don't want to assign the model object to itself when using the // assign_libraries function below so we'll grab the name of the model parent diff --git a/system/libraries/Table.php b/system/libraries/Table.php index f3f9b32f6..da7bbbecf 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -28,10 +28,11 @@ */ class CI_Table { - var $rows = array(); - var $heading = array(); - var $template = NULL; - var $newline = "\n"; + var $rows = array(); + var $heading = array(); + var $template = NULL; + var $newline = "\n"; + var $empty_cells = ""; function CI_Table() @@ -77,6 +78,22 @@ class CI_Table { // -------------------------------------------------------------------- + /** + * Set "empty" cells + * + * Can be passed as an array or discreet params + * + * @access public + * @param mixed + * @return void + */ + function set_empty($value) + { + $this->empty_cells = $value; + } + + // -------------------------------------------------------------------- + /** * Add a table row * @@ -166,10 +183,19 @@ class CI_Table { $out .= $this->template['row_'.$alt.'start']; $out .= $this->newline; - foreach($row as $cells) + foreach($row as $cell) { $out .= $this->template['cell_'.$alt.'start']; - $out .= $cells; + + if ($cell == "") + { + $out .= $this->empty_cells; + } + else + { + $out .= $cell; + } + $out .= $this->template['cell_'.$alt.'end']; } diff --git a/user_guide/libraries/table.html b/user_guide/libraries/table.html index d41cc88a8..1a11c53db 100644 --- a/user_guide/libraries/table.html +++ b/user_guide/libraries/table.html @@ -210,6 +210,16 @@ $this->table->set_template($tmpl); +

$this->table->set_empty()

+ +

Let's you set a default value for use in any table cells that are empty. You might, for example, set a non-breaking space:

+ + +$this->table->set_empty(" "); + + + + -- cgit v1.2.3-24-g4f1b