• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilExcelWriterAdapter.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00034 class ilExcelWriterAdapter
00035 {
00036         var $workbook = null;
00037 
00038         var $format_bold = null;
00039         var $format_header = null;
00040 
00041         function ilExcelWriterAdapter($a_filename,$a_send = true)
00042         {
00043                 global $ilias, $lng;
00044                 
00045                 $result = @include_once 'Spreadsheet/Excel/Writer.php';
00046                 if (!$result)
00047                 {
00048                         $ilias->raiseError($lng->txt("error_no_excel_support"), $ilias->error_obj->WARNING);
00049                 }
00050                 if($a_send)
00051                 {
00052                         $this->workbook =& new Spreadsheet_Excel_Writer();
00053                         $this->workbook->send($a_filename);
00054                 }
00055                 else
00056                 {
00057                         $this->workbook =& new Spreadsheet_Excel_Writer($a_filename);
00058                 }
00059                 
00060                 if(strlen($tmp = ini_get('upload_tmp_dir')))
00061                 {
00062                         $this->workbook->setTempDir($tmp);
00063                 }
00064                 
00065                 $this->__initFormatBold();
00066                 $this->__initFormatHeader();
00067                 $this->__initFormatTitle();
00068         }
00069 
00070         function &getWorkbook()
00071         {
00072                 return $this->workbook;
00073         }
00074 
00075         function &getFormatBold()
00076         {
00077                 return $this->format_bold;
00078         }
00079         function &getFormatHeader()
00080         {
00081                 return $this->format_header;
00082         }
00083         function &getFormatTitle()
00084         {
00085                 return $this->format_title;
00086         }
00087         function &getFormatDate()
00088         {
00089                 return $this->format_date;
00090         }
00091         function &getFormatDayTime()
00092         {
00093                 return $this->format_day_time;
00094         }
00095 
00096         // PROTECTED
00097         function __initFormatBold()
00098         {
00099                 $this->format_bold =& $this->workbook->addFormat();
00100                 $this->format_bold->setBold();
00101         }
00102         function __initFormatHeader()
00103         {
00104                 $this->format_header =& $this->workbook->addFormat();
00105                 $this->format_header->setBold();
00106                 $this->format_header->setTop(100);
00107                 $this->format_header->setColor('black');
00108                 $this->format_header->setPattern(1);
00109                 $this->format_header->setFgColor('silver');
00110         }
00111         function __initFormatTitle()
00112         {
00113                 $this->format_title =& $this->workbook->addFormat();
00114                 $this->format_title->setBold();
00115                 $this->format_title->setColor('black');
00116                 $this->format_title->setPattern(1);
00117                 $this->format_title->setSize(16);
00118                 $this->format_title->setAlign('center');
00119         }
00120         function __initFormatDate()
00121         {
00122                 $this->format_date =& $this->workbook->addFormat();
00123                 $this->format_date->setNumFormat("YYYY-MM-DD hh:mm:ss");
00124         }
00125 
00126         function __initFormatDayTime()
00127         {
00128                 $this->format_day_time =& $this->workbook->addFormat();
00129                 $this->format_day_time->setNumFormat("DD:hh:mm:ss");
00130         }
00131 
00132 
00133 }
00134 ?>

Generated on Fri Dec 13 2013 17:56:47 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1