ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilExcelWriterAdapter.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
35 {
36  var $workbook = null;
37 
38  var $format_bold = null;
39  var $format_header = null;
40 
41  function ilExcelWriterAdapter($a_filename,$a_send = true)
42  {
43  global $ilias, $lng;
44 
45  $result = @include_once 'Spreadsheet/Excel/Writer.php';
46  if (!$result)
47  {
48  $ilias->raiseError($lng->txt("error_no_excel_support"), $ilias->error_obj->WARNING);
49  }
50  if($a_send)
51  {
52  $this->workbook =& new Spreadsheet_Excel_Writer();
53  $this->workbook->send($a_filename);
54  }
55  else
56  {
57  $this->workbook =& new Spreadsheet_Excel_Writer($a_filename);
58  }
59 
60  if(strlen($tmp = ini_get('upload_tmp_dir')))
61  {
62  $this->workbook->setTempDir($tmp);
63  }
64 
65  $this->__initFormatBold();
66  $this->__initFormatHeader();
67  $this->__initFormatTitle();
68  }
69 
70  function &getWorkbook()
71  {
72  return $this->workbook;
73  }
74 
75  function &getFormatBold()
76  {
77  return $this->format_bold;
78  }
79  function &getFormatHeader()
80  {
81  return $this->format_header;
82  }
83  function &getFormatTitle()
84  {
85  return $this->format_title;
86  }
87  function &getFormatDate()
88  {
89  return $this->format_date;
90  }
91  function &getFormatDayTime()
92  {
93  return $this->format_day_time;
94  }
95 
96  // PROTECTED
97  function __initFormatBold()
98  {
99  $this->format_bold =& $this->workbook->addFormat();
100  $this->format_bold->setBold();
101  }
103  {
104  $this->format_header =& $this->workbook->addFormat();
105  $this->format_header->setBold();
106  $this->format_header->setTop(100);
107  $this->format_header->setColor('black');
108  $this->format_header->setPattern(1);
109  $this->format_header->setFgColor('silver');
110  }
111  function __initFormatTitle()
112  {
113  $this->format_title =& $this->workbook->addFormat();
114  $this->format_title->setBold();
115  $this->format_title->setColor('black');
116  $this->format_title->setPattern(1);
117  $this->format_title->setSize(16);
118  $this->format_title->setAlign('center');
119  }
120  function __initFormatDate()
121  {
122  $this->format_date =& $this->workbook->addFormat();
123  $this->format_date->setNumFormat("YYYY-MM-DD hh:mm:ss");
124  }
125 
127  {
128  $this->format_day_time =& $this->workbook->addFormat();
129  $this->format_day_time->setNumFormat("DD:hh:mm:ss");
130  }
131 
132 
133 }
134 ?>