]> git.mjollnir.org Git - moodle.git/commitdiff
Solve some notices that were breaking Excel generation under
authorstronk7 <stronk7>
Tue, 11 Apr 2006 22:49:09 +0000 (22:49 +0000)
committerstronk7 <stronk7>
Tue, 11 Apr 2006 22:49:09 +0000 (22:49 +0000)
some PHP versions. As bug is well documented but PEAR code hasn't
been changed in origin, we'll patch it here. Changes will
merge smoothly in the future, I think.
(Moode Bug: http://moodle.org/bugs/bug.php?op=show&bugid=4763)
(PEAR Bug: http://pear.php.net/bugs/bug.php?id=6509)

lib/excellib.class.php
lib/pear/Spreadsheet/Excel/Writer/Worksheet.php

index 13817b5d8da1499c7ad474a19975177748170abd..1cb92495ee192c8380ebdb4b7084a72bb1c76253 100644 (file)
@@ -219,7 +219,7 @@ class MoodleExcelWorksheet {
      * @return mixed PEAR Excel Format object
      */
     function MoodleExcelFormat2PearExcelFormat($format) {
-        if ($format != 0) {
+        if (is_object($format)) {
             return $format->pear_excel_format;
         } else {
             return 0;
index f868e2f0367490f09f4b3ac636016cb8bdb1798c..5d843dc31d67cfc67a3172dda377211446643fb3 100644 (file)
@@ -1230,7 +1230,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
     */
     function _XF(&$format)
     {
-        if ($format != 0) {
+        if (is_object($format)) {
             return($format->getXfIndex());
         } else {
             return(0x0F);
@@ -1683,7 +1683,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
     function writeBlank($row, $col, $format)
     {
         // Don't write a blank cell unless it has a format
-        if ($format == 0) {
+        if (!is_object($format)) {
             return(0);
         }
 
@@ -1870,7 +1870,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
         $record      = 0x01B8;                       // Record identifier
         $length      = 0x00000;                      // Bytes to follow
 
-        if ($format == 0) {
+        if (!is_object($format)) {
             $format = $this->_url_format;
         }
 
@@ -1930,7 +1930,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
         $record      = 0x01B8;                       // Record identifier
         $length      = 0x00000;                      // Bytes to follow
 
-        if ($format == 0) {
+        if (!is_object($format)) {
             $format = $this->_url_format;
         }
 
@@ -2002,7 +2002,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
         $record      = 0x01B8;                       // Record identifier
         $length      = 0x00000;                      // Bytes to follow
     
-        if ($format == 0) {
+        if (!is_object($format)) {
             $format = $this->_url_format;
         }
     
@@ -2158,7 +2158,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
             $grbit |= 0x0020;
         }
         $grbit |= 0x0040; // fUnsynced
-        if ($format) {
+        if (is_object($format)) {
             $grbit |= 0x0080;
         }
         $grbit |= 0x0100;