ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilExcelWriterAdapter.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
15 {
16  var $workbook = null;
17 
18  var $format_bold = null;
19  var $format_header = null;
20 
21  function ilExcelWriterAdapter($a_filename,$a_send = true)
22  {
23  global $ilias, $lng;
24 
25  $result = @include_once 'Spreadsheet/Excel/Writer.php';
26  if (!$result)
27  {
28  $ilias->raiseError($lng->txt("error_no_excel_support"), $ilias->error_obj->WARNING);
29  }
30  if($a_send)
31  {
32  $this->workbook =& new Spreadsheet_Excel_Writer();
33  $this->workbook->send($a_filename);
34  }
35  else
36  {
37  $this->workbook =& new Spreadsheet_Excel_Writer($a_filename);
38  }
39 
40  if(strlen($tmp = ini_get('upload_tmp_dir')))
41  {
42  $this->workbook->setTempDir($tmp);
43  }
44 
45  $this->__initFormatBold();
46  $this->__initFormatHeader();
47  $this->__initFormatTitle();
48  }
49 
50  function &getWorkbook()
51  {
52  return $this->workbook;
53  }
54 
55  function &getFormatBold()
56  {
57  return $this->format_bold;
58  }
59  function &getFormatHeader()
60  {
61  return $this->format_header;
62  }
63  function &getFormatTitle()
64  {
65  return $this->format_title;
66  }
67  function &getFormatDate()
68  {
69  return $this->format_date;
70  }
71  function &getFormatDayTime()
72  {
73  return $this->format_day_time;
74  }
75 
76  // PROTECTED
77  function __initFormatBold()
78  {
79  $this->format_bold =& $this->workbook->addFormat();
80  $this->format_bold->setBold();
81  }
82  function __initFormatHeader()
83  {
84  $this->format_header =& $this->workbook->addFormat();
85  $this->format_header->setBold();
86  $this->format_header->setTop(100);
87  $this->format_header->setColor('black');
88  $this->format_header->setPattern(1);
89  $this->format_header->setFgColor('silver');
90  }
91  function __initFormatTitle()
92  {
93  $this->format_title =& $this->workbook->addFormat();
94  $this->format_title->setBold();
95  $this->format_title->setColor('black');
96  $this->format_title->setPattern(1);
97  $this->format_title->setSize(16);
98  $this->format_title->setAlign('center');
99  }
100  function __initFormatDate()
101  {
102  $this->format_date =& $this->workbook->addFormat();
103  $this->format_date->setNumFormat("YYYY-MM-DD hh:mm:ss");
104  }
105 
107  {
108  $this->format_day_time =& $this->workbook->addFormat();
109  $this->format_day_time->setNumFormat("DD:hh:mm:ss");
110  }
111 
112 
113 }
114 ?>