source: extensions/GrumPluginClasses/classes/External/odsPhpGenerator/ods.php @ 17735

Last change on this file since 17735 was 17735, checked in by grum, 12 years ago

version 3.5.4 - fix minor bug & add new functions to framework

  • Property svn:executable set to *
File size: 70.3 KB
Line 
1<?php
2/*-
3 * Copyright (c) 2009 Laurent VUIBERT
4 * License : GNU Lesser General Public License v3
5 *
6 * -----------------------------------------------------------------------------
7 * 2012-09-04 / modified by grum
8 *              . replace ZipArchive class by PclZip class (assume that the class
9 *                was already loaded before)
10 *
11 *              . fix bug on file format
12 */
13
14require_once("class/odsFontFace.php");
15require_once("class/odsStyle.php");
16require_once("class/odsTable.php");
17require_once("class/odsTableColumn.php");
18require_once("class/odsTableRow.php");
19require_once("class/odsTableCell.php");
20
21class ods {
22  private $defaultTable;
23
24  private $scripts;        // FIXME: Looking
25  private $fontFaces;
26  private $styles;
27  private $tmpStyles;
28  private $tmpPictures;
29  private $tables;
30
31  private $title;
32  private $subject;
33  private $keyword;
34  private $description;
35
36  public function __construct() {
37    $this->title         = null;
38    $this->subject       = null;
39    $this->keyword       = null;
40    $this->description   = null;
41    $this->path2OdsFiles = ".";
42
43    $this->defaultTable = null;
44
45    $this->scripts   = array();
46    $this->fontFaces = array();
47    $this->styles    = array();
48    $this->tables    = array();
49
50    $this->addFontFaces( new odsFontFace( "Nimbus Sans L", "swiss" ) );
51    $this->addFontFaces( new odsFontFace( "Bitstream Vera Sans", "system" ) );
52
53    $this->addStyles( new odsStyleTableColumn("co1") );
54    $this->addStyles( new odsStyleTable("ta1") );
55    $this->addStyles( new odsStyleTableRow("ro1") );
56    $this->addStyles( new odsStyleTableCell("ce1") );
57
58  }
59
60  public function setTitle($title) {
61    $this->title = $title;
62  }
63
64  public function setSubject($subject) {
65    $this->subject = $subject;
66  }
67
68  public function setKeyword($keyword) {
69    $this->keyword = $keyword;
70  }
71
72  public function setDescription($description) {
73    $this->description = $description;
74  }
75
76  // Deprecated
77  public function setPath2OdsFiles($path) {}
78
79  public function addFontFaces(odsFontFace $odsFontFace) {
80    if(in_array($odsFontFace,$this->fontFaces)) return;
81    $this->fontFaces[$odsFontFace->getFontName()] = $odsFontFace;
82  }
83
84  public function addStyles(odsStyle $odsStyle) {
85    if(in_array($odsStyle,$this->styles)) return;
86    $this->styles[$odsStyle->getName()] = $odsStyle;
87  }
88
89  public function addTmpStyles(odsStyle $odsStyle) {
90    if(in_array($odsStyle,$this->styles)) return;
91    if(in_array($odsStyle,$this->tmpStyles)) return;
92    $this->tmpStyles[$odsStyle->getName()] = $odsStyle;
93  }
94
95  public function addTmpPictures($file) {
96    if(in_array($file,$this->tmpPictures)) return;
97    $this->tmpPictures[$file] = "Pictures/".md5(time().rand()).'.jpg';
98    return $this->tmpPictures[$file];
99  }
100
101  public function getStyleByName($name) {
102    if(isset($this->styles[$name])) return $this->styles[$name];
103    if(isset($this->tmpStyles[$name])) return $this->tmpStyles[$name];
104    return null;
105  }
106
107  public function addTable(odsTable $odsTable) {
108    if(in_array($odsTable,$this->tables)) return;
109    $this->tables[$odsTable->getName()] = $odsTable;
110  }
111
112  public function setDefaultTable(odsTable $odsTable) {
113    $this->defaultTable = $odsTable;
114  }
115
116  private function getDefaultTableName() {
117    if($this->defaultTable) {
118      return $this->defaultTable->getName();
119    } elseif(count($this->tables)){
120      $keys = array_keys($this->tables);
121      //var_dump($keys);
122      return $this->tables[$keys[0]]->getName();
123    } else {
124      return "feuille1";
125    }
126  }
127
128  public function getContent() {
129    $this->tmpStyles = array();
130    $this->tmpPictures = array();
131
132    $dom = new DOMDocument('1.0', 'UTF-8');
133    $root = $dom->createElement('office:document-content');
134      $root->setAttribute("xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0");
135      $root->setAttribute("xmlns:style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0");
136      $root->setAttribute("xmlns:text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0");
137      $root->setAttribute("xmlns:table", "urn:oasis:names:tc:opendocument:xmlns:table:1.0");
138      $root->setAttribute("xmlns:draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0");
139      $root->setAttribute("xmlns:fo", "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0");
140      $root->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
141      $root->setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
142      $root->setAttribute("xmlns:meta", "urn:oasis:names:tc:opendocument:xmlns:meta:1.0");
143      $root->setAttribute("xmlns:number", "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0");
144      $root->setAttribute("xmlns:presentation", "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0");
145      $root->setAttribute("xmlns:svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0");
146      $root->setAttribute("xmlns:chart", "urn:oasis:names:tc:opendocument:xmlns:chart:1.0");
147      $root->setAttribute("xmlns:dr3d", "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0");
148      $root->setAttribute("xmlns:math", "http://www.w3.org/1998/Math/MathML");
149      $root->setAttribute("xmlns:form", "urn:oasis:names:tc:opendocument:xmlns:form:1.0");
150      $root->setAttribute("xmlns:script", "urn:oasis:names:tc:opendocument:xmlns:script:1.0");
151      $root->setAttribute("xmlns:ooo", "http://openoffice.org/2004/office");
152      $root->setAttribute("xmlns:ooow", "http://openoffice.org/2004/writer");
153      $root->setAttribute("xmlns:oooc", "http://openoffice.org/2004/calc");
154      $root->setAttribute("xmlns:dom", "http://www.w3.org/2001/xml-events");
155      $root->setAttribute("xmlns:xforms", "http://www.w3.org/2002/xforms");
156      $root->setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
157      $root->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
158      $root->setAttribute("xmlns:rpt", "http://openoffice.org/2005/report");
159      $root->setAttribute("xmlns:of", "urn:oasis:names:tc:opendocument:xmlns:of:1.2");
160      $root->setAttribute("xmlns:rdfa", "http://docs.oasis-open.org/opendocument/meta/rdfa#");
161      $root->setAttribute("xmlns:field", "urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:field:1.0");
162      $root->setAttribute("xmlns:formx", "urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0");
163      $root->setAttribute("office:version", "1.2");
164      $dom->appendChild($root);
165
166    // office:scripts
167    $root->appendChild($dom->createElement('office:scripts'));
168
169    //office:font-face-decls
170    $office_font_face_decls =  $dom->createElement('office:font-face-decls');
171    $root->appendChild($office_font_face_decls);
172
173      foreach($this->fontFaces as $fontFace)
174        $office_font_face_decls->appendChild($fontFace->getContent($this,$dom));
175
176    // office:automatic-styles
177    $office_automatic_styles =  $dom->createElement('office:automatic-styles');
178      $root->appendChild($office_automatic_styles);
179
180      foreach($this->styles as $style)
181        $office_automatic_styles->appendChild($style->getContent($this,$dom));
182
183    // office:body
184    $office_body =  $dom->createElement('office:body');
185      $root->appendChild($office_body);
186
187      // office:spreadsheet
188      $office_spreadsheet = $dom->createElement('office:spreadsheet');
189        $office_body->appendChild($office_spreadsheet);
190
191          foreach($this->tables as $table)
192            $office_spreadsheet->appendChild($table->getContent($this,$dom));
193
194      foreach($this->tmpStyles as $style)
195        $office_automatic_styles->appendChild($style->getContent($this,$dom));
196
197    return $dom->saveXML();
198  }
199
200  public function getMeta() {
201    $dom = new DOMDocument('1.0', 'UTF-8');
202
203    $root = $dom->createElement('office:document-meta');
204      $root->setAttribute("xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0");
205      $root->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
206      $root->setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
207      $root->setAttribute("xmlns:meta", "urn:oasis:names:tc:opendocument:xmlns:meta:1.0");
208      $root->setAttribute("xmlns:ooo", "http://openoffice.org/2004/office");
209      $root->setAttribute("office:version", "1.2");
210      $dom->appendChild($root);
211
212    $meta =  $dom->createElement('office:meta');
213      $root->appendChild($meta);
214
215    $meta->appendChild($dom->createElement('meta:creation-date',date("Y-m-d\TH:j:s")));
216    $meta->appendChild($dom->createElement('meta:generator','ods générator'));
217    $meta->appendChild($dom->createElement('dc:date',date("Y-m-d\TH:j:s")));
218    $meta->appendChild($dom->createElement('meta:editing-duration','PT1S'));
219    $meta->appendChild($dom->createElement('meta:editing-cycles','1'));
220    if($this->title)
221      $meta->appendChild($dom->createElement('dc:title',$this->title));
222    if($this->subject)
223      $meta->appendChild($dom->createElement('dc:subject',$this->subject));
224    if($this->keyword)
225      $meta->appendChild($dom->createElement('meta:keyword',$this->keyword));
226    if($this->description)
227      $meta->appendChild($dom->createElement('dc:description',$this->description));
228    $elm = $dom->createElement('meta:document-statistic');
229      $elm->setAttribute("meta:table-count", "1");
230      $elm->setAttribute("meta:cell-count", "4");
231      $elm->setAttribute("meta:object-count", "0");
232      $meta->appendChild($elm);
233
234    return $dom->saveXML();
235  }
236
237  public function getSettings() {
238    $dom = new DOMDocument('1.0', 'UTF-8');
239
240    $root = $dom->createElement('office:document-settings');
241      $root->setAttribute("xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0");
242      $root->setAttribute("xmlns:xlink",  "http://www.w3.org/1999/xlink");
243      $root->setAttribute("xmlns:config", "urn:oasis:names:tc:opendocument:xmlns:config:1.0");
244      $root->setAttribute("xmlns:ooo",    "http://openoffice.org/2004/office");
245      $root->setAttribute("office:version", "1.2");
246      $dom->appendChild($root);
247
248      $office_settings =  $dom->createElement('office:settings');
249        $root->appendChild($office_settings);
250
251        $config_config_item_set = $dom->createElement('config:config-item-set');
252          $config_config_item_set->setAttribute("config:name", "ooo:view-settings");
253          $office_settings->appendChild($config_config_item_set);
254
255          $config_config_item = $dom->createElement('config:config-item',0);
256            $config_config_item->setAttribute("config:name", "VisibleAreaTop");
257            $config_config_item->setAttribute("config:type", "int");
258            $config_config_item_set->appendChild($config_config_item);
259
260          $config_config_item = $dom->createElement('config:config-item',0);
261            $config_config_item->setAttribute("config:name", "VisibleAreaLeft");
262            $config_config_item->setAttribute("config:type", "int");
263            $config_config_item_set->appendChild($config_config_item);
264
265          $config_config_item = $dom->createElement('config:config-item',10018);
266            $config_config_item->setAttribute("config:name", "VisibleAreaWidth");
267            $config_config_item->setAttribute("config:type", "int");
268            $config_config_item_set->appendChild($config_config_item);
269
270          $config_config_item = $dom->createElement('config:config-item',2592);
271            $config_config_item->setAttribute("config:name", "VisibleAreaHeight");
272            $config_config_item->setAttribute("config:type", "int");
273            $config_config_item_set->appendChild($config_config_item);
274
275          $config_config_item_map_indexed = $dom->createElement('config:config-item-map-indexed');
276            $config_config_item_map_indexed->setAttribute("config:name", "Views");
277            $config_config_item_set->appendChild($config_config_item_map_indexed);
278
279            $config_config_item_map_entry1 = $dom->createElement('config:config-item-map-entry');
280              $config_config_item_map_indexed->appendChild($config_config_item_map_entry1);
281
282              //<config:config-item config:name="ViewId" config:type="string">View1</config:config-item>
283              $config_config_item = $dom->createElement('config:config-item', 'View1');
284                $config_config_item->setAttribute("config:name", "ViewId");
285                $config_config_item->setAttribute("config:type", "string");
286                $config_config_item_map_entry1->appendChild($config_config_item);
287
288              //<config:config-item-map-named config:name="Tables">
289              $config_config_item_map_named = $dom->createElement('config:config-item-map-named');
290                $config_config_item_map_named->setAttribute("config:name", "Tables");
291                $config_config_item_map_entry1->appendChild($config_config_item_map_named);
292
293                foreach($this->tables as $table)
294                  $config_config_item_map_named->appendChild($table->getSettings($this,$dom));
295
296              $config_config_item = $dom->createElement('config:config-item', $this->getDefaultTableName());
297                $config_config_item->setAttribute("config:name", "ActiveTable");
298                $config_config_item->setAttribute("config:type", "string");
299                $config_config_item_map_entry1->appendChild($config_config_item);
300
301              $config_config_item = $dom->createElement('config:config-item', '270');
302                $config_config_item->setAttribute("config:name", "HorizontalScrollbarWidth");
303                $config_config_item->setAttribute("config:type", "int");
304                $config_config_item_map_entry1->appendChild($config_config_item);
305
306
307              $config_config_item = $dom->createElement('config:config-item', '0');
308                $config_config_item->setAttribute("config:name", "ZoomType");
309                $config_config_item->setAttribute("config:type", "short");
310                $config_config_item_map_entry1->appendChild($config_config_item);
311
312              $config_config_item = $dom->createElement('config:config-item', '100');
313                $config_config_item->setAttribute("config:name", "ZoomValue");
314                $config_config_item->setAttribute("config:type", "int");
315                $config_config_item_map_entry1->appendChild($config_config_item);
316
317              $config_config_item = $dom->createElement('config:config-item', '60');
318                $config_config_item->setAttribute("config:name", "PageViewZoomValue");
319                $config_config_item->setAttribute("config:type", "int");
320                $config_config_item_map_entry1->appendChild($config_config_item);
321
322              $config_config_item = $dom->createElement('config:config-item', 'false');
323                $config_config_item->setAttribute("config:name", "ShowPageBreakPreview");
324                $config_config_item->setAttribute("config:type", "boolean");
325                $config_config_item_map_entry1->appendChild($config_config_item);
326
327              $config_config_item = $dom->createElement('config:config-item', 'true');
328                $config_config_item->setAttribute("config:name", "ShowZeroValues");
329                $config_config_item->setAttribute("config:type", "boolean");
330                $config_config_item_map_entry1->appendChild($config_config_item);
331
332              $config_config_item = $dom->createElement('config:config-item', 'true');
333                $config_config_item->setAttribute("config:name", "ShowNotes");
334                $config_config_item->setAttribute("config:type", "boolean");
335                $config_config_item_map_entry1->appendChild($config_config_item);
336
337              $config_config_item = $dom->createElement('config:config-item', 'true');
338                $config_config_item->setAttribute("config:name", "ShowGrid");
339                $config_config_item->setAttribute("config:type", "boolean");
340                $config_config_item_map_entry1->appendChild($config_config_item);
341
342              $config_config_item = $dom->createElement('config:config-item', '12632256');
343                $config_config_item->setAttribute("config:name", "GridColor");
344                $config_config_item->setAttribute("config:type", "long");
345                $config_config_item_map_entry1->appendChild($config_config_item);
346
347              $config_config_item = $dom->createElement('config:config-item', 'true');
348                $config_config_item->setAttribute("config:name", "ShowPageBreaks");
349                $config_config_item->setAttribute("config:type", "boolean");
350                $config_config_item_map_entry1->appendChild($config_config_item);
351
352              $config_config_item = $dom->createElement('config:config-item', 'true');
353                $config_config_item->setAttribute("config:name", "HasColumnRowHeaders");
354                $config_config_item->setAttribute("config:type", "boolean");
355                $config_config_item_map_entry1->appendChild($config_config_item);
356
357              $config_config_item = $dom->createElement('config:config-item', 'true');
358                $config_config_item->setAttribute("config:name", "HasSheetTabs");
359                $config_config_item->setAttribute("config:type", "boolean");
360                $config_config_item_map_entry1->appendChild($config_config_item);
361
362              $config_config_item = $dom->createElement('config:config-item', 'true');
363                $config_config_item->setAttribute("config:name", "IsOutlineSymbolsSet");
364                $config_config_item->setAttribute("config:type", "boolean");
365                $config_config_item_map_entry1->appendChild($config_config_item);
366
367              $config_config_item = $dom->createElement('config:config-item', 'false');
368                $config_config_item->setAttribute("config:name", "IsSnapToRaster");
369                $config_config_item->setAttribute("config:type", "boolean");
370                $config_config_item_map_entry1->appendChild($config_config_item);
371
372              $config_config_item = $dom->createElement('config:config-item', 'false');
373                $config_config_item->setAttribute("config:name", "RasterIsVisible");
374                $config_config_item->setAttribute("config:type", "boolean");
375                $config_config_item_map_entry1->appendChild($config_config_item);
376
377              $config_config_item = $dom->createElement('config:config-item', '1000');
378                $config_config_item->setAttribute("config:name", "RasterResolutionX");
379                $config_config_item->setAttribute("config:type", "int");
380                $config_config_item_map_entry1->appendChild($config_config_item);
381
382              $config_config_item = $dom->createElement('config:config-item', '1000');
383                $config_config_item->setAttribute("config:name", "RasterResolutionY");
384                $config_config_item->setAttribute("config:type", "int");
385                $config_config_item_map_entry1->appendChild($config_config_item);
386
387              $config_config_item = $dom->createElement('config:config-item', '1');
388                $config_config_item->setAttribute("config:name", "RasterSubdivisionX");
389                $config_config_item->setAttribute("config:type", "int");
390                $config_config_item_map_entry1->appendChild($config_config_item);
391
392              $config_config_item = $dom->createElement('config:config-item', '1');
393                $config_config_item->setAttribute("config:name", "RasterSubdivisionY");
394                $config_config_item->setAttribute("config:type", "int");
395                $config_config_item_map_entry1->appendChild($config_config_item);
396
397              $config_config_item = $dom->createElement('config:config-item', 'true');
398                $config_config_item->setAttribute("config:name", "IsRasterAxisSynchronized");
399                $config_config_item->setAttribute("config:type", "boolean");
400                $config_config_item_map_entry1->appendChild($config_config_item);
401
402        $config_config_item_set = $dom->createElement('config:config-item-set');
403          $config_config_item_set->setAttribute("config:name", "ooo:configuration-settings");
404          $office_settings->appendChild($config_config_item_set);
405
406          $config_config_item = $dom->createElement('config:config-item', 'true');
407            $config_config_item->setAttribute("config:name", "ShowZeroValues");
408            $config_config_item->setAttribute("config:type", "boolean");
409            $config_config_item_set->appendChild($config_config_item);
410
411          $config_config_item = $dom->createElement('config:config-item', 'true');
412            $config_config_item->setAttribute("config:name", "ShowNotes");
413            $config_config_item->setAttribute("config:type", "boolean");
414            $config_config_item_set->appendChild($config_config_item);
415
416          $config_config_item = $dom->createElement('config:config-item', 'true');
417            $config_config_item->setAttribute("config:name", "ShowGrid");
418            $config_config_item->setAttribute("config:type", "boolean");
419            $config_config_item_set->appendChild($config_config_item);
420
421          $config_config_item = $dom->createElement('config:config-item', '12632256');// test 0
422            $config_config_item->setAttribute("config:name", "GridColor");
423            $config_config_item->setAttribute("config:type", "long");
424            $config_config_item_set->appendChild($config_config_item);
425
426          $config_config_item = $dom->createElement('config:config-item', 'true');
427            $config_config_item->setAttribute("config:name", "ShowPageBreaks");
428            $config_config_item->setAttribute("config:type", "boolean");
429            $config_config_item_set->appendChild($config_config_item);
430
431          $config_config_item = $dom->createElement('config:config-item', '3');
432            $config_config_item->setAttribute("config:name", "LinkUpdateMode");
433            $config_config_item->setAttribute("config:type", "short");
434            $config_config_item_set->appendChild($config_config_item);
435
436          $config_config_item = $dom->createElement('config:config-item', 'true');
437            $config_config_item->setAttribute("config:name", "HasColumnRowHeaders");
438            $config_config_item->setAttribute("config:type", "boolean");
439            $config_config_item_set->appendChild($config_config_item);
440
441          $config_config_item = $dom->createElement('config:config-item', 'true');
442            $config_config_item->setAttribute("config:name", "HasSheetTabs");
443            $config_config_item->setAttribute("config:type", "boolean");
444            $config_config_item_set->appendChild($config_config_item);
445
446          $config_config_item = $dom->createElement('config:config-item', 'true');
447            $config_config_item->setAttribute("config:name", "IsOutlineSymbolsSet");
448            $config_config_item->setAttribute("config:type", "boolean");
449            $config_config_item_set->appendChild($config_config_item);
450
451          $config_config_item = $dom->createElement('config:config-item', 'false');
452            $config_config_item->setAttribute("config:name", "IsSnapToRaster");
453            $config_config_item->setAttribute("config:type", "boolean");
454            $config_config_item_set->appendChild($config_config_item);
455
456          $config_config_item = $dom->createElement('config:config-item', 'false');
457            $config_config_item->setAttribute("config:name", "RasterIsVisible");
458            $config_config_item->setAttribute("config:type", "boolean");
459            $config_config_item_set->appendChild($config_config_item);
460
461          $config_config_item = $dom->createElement('config:config-item', '1000');
462            $config_config_item->setAttribute("config:name", "RasterResolutionX");
463            $config_config_item->setAttribute("config:type", "int");
464            $config_config_item_set->appendChild($config_config_item);
465
466          $config_config_item = $dom->createElement('config:config-item', '1000');
467            $config_config_item->setAttribute("config:name", "RasterResolutionY");
468            $config_config_item->setAttribute("config:type", "int");
469            $config_config_item_set->appendChild($config_config_item);
470
471          $config_config_item = $dom->createElement('config:config-item', '1');
472            $config_config_item->setAttribute("config:name", "RasterSubdivisionX");
473            $config_config_item->setAttribute("config:type", "int");
474            $config_config_item_set->appendChild($config_config_item);
475
476          $config_config_item = $dom->createElement('config:config-item', '1');
477            $config_config_item->setAttribute("config:name", "RasterSubdivisionY");
478            $config_config_item->setAttribute("config:type", "int");
479            $config_config_item_set->appendChild($config_config_item);
480
481          $config_config_item = $dom->createElement('config:config-item', 'true');
482            $config_config_item->setAttribute("config:name", "IsRasterAxisSynchronized");
483            $config_config_item->setAttribute("config:type", "boolean");
484            $config_config_item_set->appendChild($config_config_item);
485
486          $config_config_item = $dom->createElement('config:config-item', 'true');
487            $config_config_item->setAttribute("config:name", "AutoCalculate");
488            $config_config_item->setAttribute("config:type", "boolean");
489            $config_config_item_set->appendChild($config_config_item);
490
491          $config_config_item = $dom->createElement('config:config-item');
492            $config_config_item->setAttribute("config:name", "PrinterName");
493            $config_config_item->setAttribute("config:type", "string");
494            $config_config_item_set->appendChild($config_config_item);
495
496          $config_config_item = $dom->createElement('config:config-item');
497            $config_config_item->setAttribute("config:name", "PrinterSetup");
498            $config_config_item->setAttribute("config:type", "base64Binary");
499            $config_config_item_set->appendChild($config_config_item);
500
501          $config_config_item = $dom->createElement('config:config-item', 'true');
502            $config_config_item->setAttribute("config:name", "ApplyUserData");
503            $config_config_item->setAttribute("config:type", "boolean");
504            $config_config_item_set->appendChild($config_config_item);
505
506          $config_config_item = $dom->createElement('config:config-item', '0');
507            $config_config_item->setAttribute("config:name", "CharacterCompressionType");
508            $config_config_item->setAttribute("config:type", "short");
509            $config_config_item_set->appendChild($config_config_item);
510
511          $config_config_item = $dom->createElement('config:config-item', 'false');
512            $config_config_item->setAttribute("config:name", "IsKernAsianPunctuation");
513            $config_config_item->setAttribute("config:type", "boolean");
514            $config_config_item_set->appendChild($config_config_item);
515
516          $config_config_item = $dom->createElement('config:config-item', 'false');
517            $config_config_item->setAttribute("config:name", "SaveVersionOnClose");
518            $config_config_item->setAttribute("config:type", "boolean");
519            $config_config_item_set->appendChild($config_config_item);
520
521          $config_config_item = $dom->createElement('config:config-item', 'true');
522            $config_config_item->setAttribute("config:name", "UpdateFromTemplate");
523            $config_config_item->setAttribute("config:type", "boolean");
524            $config_config_item_set->appendChild($config_config_item);
525
526          $config_config_item = $dom->createElement('config:config-item', 'true');
527            $config_config_item->setAttribute("config:name", "AllowPrintJobCancel");
528            $config_config_item->setAttribute("config:type", "boolean");
529            $config_config_item_set->appendChild($config_config_item);
530
531          $config_config_item = $dom->createElement('config:config-item', 'false');
532            $config_config_item->setAttribute("config:name", "LoadReadonly");
533            $config_config_item->setAttribute("config:type", "boolean");
534            $config_config_item_set->appendChild($config_config_item);
535
536          $config_config_item = $dom->createElement('config:config-item', 'false');
537            $config_config_item->setAttribute("config:name", "IsDocumentShared");
538            $config_config_item->setAttribute("config:type", "boolean");
539            $config_config_item_set->appendChild($config_config_item);
540
541      return $dom->saveXML();
542  }
543
544  public function getStyles() {
545    $dom = new DOMDocument('1.0', 'UTF-8');
546
547    $root = $dom->createElement('office:document-styles');
548      $root->setAttribute("xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0");
549      $root->setAttribute("xmlns:style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0");
550      $root->setAttribute("xmlns:text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0");
551      $root->setAttribute("xmlns:table", "urn:oasis:names:tc:opendocument:xmlns:table:1.0");
552      $root->setAttribute("xmlns:draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0");
553      $root->setAttribute("xmlns:fo", "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0");
554      $root->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
555      $root->setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
556      $root->setAttribute("xmlns:meta", "urn:oasis:names:tc:opendocument:xmlns:meta:1.0");
557      $root->setAttribute("xmlns:number", "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0");
558      $root->setAttribute("xmlns:presentation", "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0");
559      $root->setAttribute("xmlns:svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0");
560      $root->setAttribute("xmlns:chart", "urn:oasis:names:tc:opendocument:xmlns:chart:1.0");
561      $root->setAttribute("xmlns:dr3d", "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0");
562      $root->setAttribute("xmlns:math", "http://www.w3.org/1998/Math/MathML");
563      $root->setAttribute("xmlns:form", "urn:oasis:names:tc:opendocument:xmlns:form:1.0");
564      $root->setAttribute("xmlns:script", "urn:oasis:names:tc:opendocument:xmlns:script:1.0");
565      $root->setAttribute("xmlns:ooo", "http://openoffice.org/2004/office");
566      $root->setAttribute("xmlns:ooow", "http://openoffice.org/2004/writer");
567      $root->setAttribute("xmlns:oooc", "http://openoffice.org/2004/calc");
568      $root->setAttribute("xmlns:dom", "http://www.w3.org/2001/xml-events");
569      $root->setAttribute("xmlns:rpt", "http://openoffice.org/2005/report");
570      $root->setAttribute("xmlns:of", "urn:oasis:names:tc:opendocument:xmlns:of:1.2");
571      $root->setAttribute("xmlns:rdfa", "http://docs.oasis-open.org/opendocument/meta/rdfa#");
572      $root->setAttribute("office:version", "1.2");
573      $dom->appendChild($root);
574
575
576      $office_font_face_decls = $dom->createElement('office:font-face-decls');
577        $root->appendChild($office_font_face_decls);
578
579        foreach($this->fontFaces as $fontFace)
580          $office_font_face_decls->appendChild($fontFace->getStyles($this,$dom));
581
582      $office_styles = $dom->createElement('office:styles');
583        $root->appendChild($office_styles);
584
585        $style_default_style = $dom->createElement('style:default-style');
586          $style_default_style->setAttribute("style:family", "table-cell");
587          $office_styles->appendChild($style_default_style);
588
589          $style_table_cell_properties = $dom->createElement('style:table-cell-properties');
590            $style_table_cell_properties->setAttribute("style:decimal-places", "2");
591            $style_default_style->appendChild($style_table_cell_properties);
592
593          $style_paragraph_properties = $dom->createElement('style:paragraph-properties');
594            $style_paragraph_properties->setAttribute("style:tab-stop-distance", "1.25cm");
595            $style_default_style->appendChild($style_paragraph_properties);
596
597          $style_text_properties = $dom->createElement('style:text-properties');
598            $style_text_properties->setAttribute("style:font-name", "Nimbus Sans L");
599            $style_text_properties->setAttribute("fo:language", "fr");
600            $style_text_properties->setAttribute("fo:country", "FR");
601            $style_text_properties->setAttribute("style:font-name-asian", "Bitstream Vera Sans");
602            $style_text_properties->setAttribute("style:language-asian", "zxx");
603            $style_text_properties->setAttribute("style:country-asian", "none");
604            $style_text_properties->setAttribute("style:font-name-complex", "Bitstream Vera Sans");
605            $style_text_properties->setAttribute("style:language-complex", "zxx");
606            $style_text_properties->setAttribute("style:country-complex", "none");
607            $style_default_style->appendChild($style_text_properties);
608
609        $style_default_style = $dom->createElement('style:default-style');
610          $style_default_style->setAttribute("style:family", "graphic");
611          $office_styles->appendChild($style_default_style);
612
613          $style_graphic_properties = $dom->createElement('style:graphic-properties');
614            $style_graphic_properties->setAttribute("draw:shadow-offset-x", "0.3cm");
615            $style_graphic_properties->setAttribute("draw:shadow-offset-y", "0.3cm");
616            $style_default_style->appendChild($style_graphic_properties);
617
618          $style_paragraph_properties = $dom->createElement('style:paragraph-properties');
619            $style_paragraph_properties->setAttribute("style:text-autospace", "ideograph-alpha");
620            $style_paragraph_properties->setAttribute("style:punctuation-wrap", "simple");
621            $style_paragraph_properties->setAttribute("style:line-break", "strict");
622            $style_paragraph_properties->setAttribute("style:writing-mode", "page");
623            $style_paragraph_properties->setAttribute("style:font-independent-line-spacing", "false");
624            $style_default_style->appendChild($style_paragraph_properties);
625
626            $style_tab_stops = $dom->createElement('style:tab-stops');
627              $style_paragraph_properties->appendChild($style_tab_stops);
628
629          $style_text_properties =  $dom->createElement('style:text-properties');
630            $style_text_properties->setAttribute("style:use-window-font-color", "true");
631            $style_text_properties->setAttribute("fo:font-family", "'Nimbus Roman No9 L'");
632            $style_text_properties->setAttribute("style:font-family-generic", "roman");
633            $style_text_properties->setAttribute("style:font-pitch", "variable");
634            $style_text_properties->setAttribute("fo:font-size", "12pt");
635            $style_text_properties->setAttribute("fo:language", "fr");
636            $style_text_properties->setAttribute("fo:country", "FR");
637            $style_text_properties->setAttribute("style:letter-kerning", "true");
638            $style_text_properties->setAttribute("style:font-size-asian", "24pt");
639            $style_text_properties->setAttribute("style:language-asian", "zxx");
640            $style_text_properties->setAttribute("style:country-asian", "none");
641            $style_text_properties->setAttribute("style:font-size-complex", "24pt");
642            $style_text_properties->setAttribute("style:language-complex", "zxx");
643            $style_text_properties->setAttribute("style:country-complex", "none");
644            $style_default_style->appendChild($style_text_properties);
645
646        //<number:number-style style:name="N0">
647        $number_number_style = $dom->createElement('number:number-style');
648          $number_number_style->setAttribute("style:name", "N0");
649          $office_styles->appendChild($number_number_style);
650
651          $number_number = $dom->createElement('number:number');
652            $number_number->setAttribute("number:min-integer-digits", "1");
653            $number_number_style->appendChild($number_number);
654
655        $style_style = $dom->createElement('style:style');
656          $style_style->setAttribute("style:name", "Default");
657          $style_style->setAttribute("style:family", "table-cell");
658          $office_styles->appendChild($style_style);
659
660        $style_style = $dom->createElement('style:style');
661          $style_style->setAttribute("style:name", "Result");
662          $style_style->setAttribute("style:family", "table-cell");
663          $style_style->setAttribute("style:parent-style-name", "Default");
664          $office_styles->appendChild($style_style);
665
666          $style_text_properties = $dom->createElement('style:text-properties');
667            $style_text_properties->setAttribute("fo:font-style", "italic");
668            $style_text_properties->setAttribute("style:text-underline-style", "solid");
669            $style_text_properties->setAttribute("style:text-underline-width", "auto");
670            $style_text_properties->setAttribute("style:text-underline-color", "font-color");
671            $style_text_properties->setAttribute("fo:font-weight", "bold");
672            $style_style->appendChild($style_text_properties);
673
674        $style_style = $dom->createElement('style:style');
675          $style_style->setAttribute("style:name", "Result2");
676          $style_style->setAttribute("style:family", "table-cell");
677          $style_style->setAttribute("style:parent-style-name", "Result");
678          $style_style->setAttribute("style:data-style-name", "N106");
679          $office_styles->appendChild($style_style);
680
681        $style_style = $dom->createElement('style:style');
682          $style_style->setAttribute("style:name", "Heading");
683          $style_style->setAttribute("style:family", "table-cell");
684          $style_style->setAttribute("style:parent-style-name", "Default");
685          $office_styles->appendChild($style_style);
686
687          $style_table_cell_properties = $dom->createElement('style:table-cell-properties');
688            $style_table_cell_properties->setAttribute("style:text-align-source", "fix");
689            $style_table_cell_properties->setAttribute("style:repeat-content", "false");
690            $style_style->appendChild($style_table_cell_properties);
691
692          $style_paragraph_properties = $dom->createElement('style:paragraph-properties');
693            $style_paragraph_properties->setAttribute("fo:text-align", "center");
694            $style_style->appendChild($style_paragraph_properties);
695
696          $style_text_properties = $dom->createElement('style:text-properties');
697            $style_text_properties->setAttribute("fo:font-size", "16pt");
698            $style_text_properties->setAttribute("fo:font-style", "italic");
699            $style_text_properties->setAttribute("fo:font-weight", "bold");
700            $style_style->appendChild($style_text_properties);
701
702        $style_style = $dom->createElement('style:style');
703          $style_style->setAttribute("style:name", "Heading1");
704          $style_style->setAttribute("style:family", "table-cell");
705          $style_style->setAttribute("style:parent-style-name", "Heading");
706          $office_styles->appendChild($style_style);
707
708          $style_table_cell_properties = $dom->createElement('style:table-cell-properties');
709            $style_table_cell_properties->setAttribute("style:rotation-angle", "90");
710            $style_style->appendChild($style_table_cell_properties);
711
712      $office_automatic_styles = $dom->createElement('office:automatic-styles');
713        $root->appendChild($office_automatic_styles);
714
715        $style_page_layout = $dom->createElement('style:page-layout');
716          $style_page_layout->setAttribute("style:name", "Mpm1");
717          $office_automatic_styles->appendChild($style_page_layout);
718
719          $style_page_layout_properties = $dom->createElement('style:page-layout-properties');
720            $style_page_layout_properties->setAttribute("style:writing-mode", "lr-tb");
721            $style_page_layout->appendChild($style_page_layout_properties);
722
723          $style_header_style = $dom->createElement('style:header-style');
724            $style_page_layout->appendChild($style_header_style);
725
726            $style_header_footer_properties = $dom->createElement('style:header-footer-properties');
727              $style_header_footer_properties->setAttribute("fo:min-height", "0.751cm");
728              $style_header_footer_properties->setAttribute("fo:margin-left", "0cm");
729              $style_header_footer_properties->setAttribute("fo:margin-right", "0cm");
730              $style_header_footer_properties->setAttribute("fo:margin-bottom", "0.25cm");
731              $style_header_style->appendChild($style_header_footer_properties);
732
733          $style_footer_style = $dom->createElement('style:footer-style');
734            $style_page_layout->appendChild($style_footer_style);
735
736            $style_header_footer_properties = $dom->createElement('style:header-footer-properties');
737              $style_header_footer_properties->setAttribute("fo:min-height", "0.751cm");
738              $style_header_footer_properties->setAttribute("fo:margin-left", "0cm");
739              $style_header_footer_properties->setAttribute("fo:margin-right", "0cm");
740              $style_header_footer_properties->setAttribute("fo:margin-top", "0.25cm");
741              $style_footer_style->appendChild($style_header_footer_properties);
742
743        $style_page_layout = $dom->createElement('style:page-layout');
744          $style_page_layout->setAttribute("style:name", "Mpm2");
745          $office_automatic_styles->appendChild($style_page_layout);
746
747          $style_page_layout_properties = $dom->createElement('style:page-layout-properties');
748            $style_page_layout_properties->setAttribute("style:writing-mode", "lr-tb");
749            $style_page_layout->appendChild($style_page_layout_properties);
750
751          $style_header_style = $dom->createElement('style:header-style');
752            $style_page_layout->appendChild($style_header_style);
753
754            $style_header_footer_properties = $dom->createElement('style:header-footer-properties');
755              $style_header_footer_properties->setAttribute("fo:min-height", "0.751cm");
756              $style_header_footer_properties->setAttribute("fo:margin-left", "0cm");
757              $style_header_footer_properties->setAttribute("fo:margin-right", "0cm");
758              $style_header_footer_properties->setAttribute("fo:margin-bottom", "0.25cm");
759              $style_header_footer_properties->setAttribute("fo:border", "0.088cm solid #000000");
760              $style_header_footer_properties->setAttribute("fo:padding", "0.018cm");
761              $style_header_footer_properties->setAttribute("fo:background-color", "#c0c0c0");
762              $style_header_style->appendChild($style_header_footer_properties);
763
764              $style_background_image = $dom->createElement('style:background-image');
765                $style_header_footer_properties->appendChild($style_background_image);
766
767          $style_footer_style = $dom->createElement('style:footer-style');
768            $style_page_layout->appendChild($style_footer_style);
769
770            $style_header_footer_properties = $dom->createElement('style:header-footer-properties');
771              $style_header_footer_properties->setAttribute("fo:min-height", "0.751cm");
772              $style_header_footer_properties->setAttribute("fo:margin-left", "0cm");
773              $style_header_footer_properties->setAttribute("fo:margin-right", "0cm");
774              $style_header_footer_properties->setAttribute("fo:margin-top", "0.25cm");
775              $style_header_footer_properties->setAttribute("fo:border", "0.088cm solid #000000");
776              $style_header_footer_properties->setAttribute("fo:padding", "0.018cm");
777              $style_header_footer_properties->setAttribute("fo:background-color", "#c0c0c0");
778              $style_footer_style->appendChild($style_header_footer_properties);
779
780              $style_background_image = $dom->createElement('style:background-image');
781                $style_header_footer_properties->appendChild($style_background_image);
782
783      $office_master_styles = $dom->createElement('office:master-styles');
784        $root->appendChild($office_master_styles);
785
786        $style_master_page = $dom->createElement('style:master-page');
787          $style_master_page->setAttribute("style:name", "Default");
788          $style_master_page->setAttribute("style:page-layout-name", "Mpm1");
789          $office_master_styles->appendChild($style_master_page);
790
791          $style_header = $dom->createElement('style:header');
792            $style_master_page->appendChild($style_header);
793
794            $text_p = $dom->createElement('text:p');
795              $style_header->appendChild($text_p);
796
797              $text_sheet_name = $dom->createElement('text:sheet-name', '???');
798                $text_p->appendChild($text_sheet_name);
799
800          $style_header_left = $dom->createElement('style:header-left');
801            $style_header_left->setAttribute("style:display", "false");
802            $style_master_page->appendChild($style_header_left);
803
804          $style_footer = $dom->createElement('style:footer');
805            $style_master_page->appendChild($style_footer);
806
807            $text_p = $dom->createElement('text:p', "Page");
808              $style_footer->appendChild($text_p);
809
810              $text_page_number = $dom->createElement('text:page-number', '1');
811                $text_p->appendChild($text_page_number);
812
813          $style_footer_left = $dom->createElement('style:footer-left');
814            $style_footer_left->setAttribute("style:display", "false");
815            $style_master_page->appendChild($style_footer_left);
816
817        $style_master_page = $dom->createElement('style:master-page');
818          $style_master_page->setAttribute("style:name", "Report");
819          $style_master_page->setAttribute("style:page-layout-name", "Mpm2");
820          $office_master_styles->appendChild($style_master_page);
821
822          $style_header = $dom->createElement('style:header');
823            $style_master_page->appendChild($style_header);
824
825            $style_region_left = $dom->createElement('style:region-left');
826              $style_header->appendChild($style_region_left);
827
828              $text_p = $dom->createElement('text:p');
829                $style_region_left->appendChild($text_p);
830
831                $text_sheet_name = $dom->createElement('text:sheet-name', '???');
832                  $text_p->appendChild($text_sheet_name);
833
834                $note_text = $dom->createTextNode('(');
835                  $text_p->appendChild($note_text);
836
837                $text_title = $dom->createElement('text:title', '???');
838                  $text_p->appendChild($text_title);
839
840                $note_text = $dom->createTextNode(')');
841                  $text_p->appendChild($note_text);
842
843            $style_region_right = $dom->createElement('style:region-right');
844              $style_header->appendChild($style_region_right);
845
846              $text_p = $dom->createElement('text:p');
847                $style_region_right->appendChild($text_p);
848
849                $text_date = $dom->createElement('text:date','31/10/2009');
850                  $text_date->setAttribute("style:data-style-name", "N2");
851                  $text_date->setAttribute("text:date-value", "2009-10-31");
852                  $text_p->appendChild($text_date);
853
854                $note_text = $dom->createTextNode(',');
855                  $text_p->appendChild($note_text);
856
857                $text_date = $dom->createElement('text:time','18:09:40');
858                  $text_p->appendChild($text_date);
859
860          $style_header_left = $dom->createElement('style:header-left');
861            $style_header_left->setAttribute("style:display", "false");
862            $style_master_page->appendChild($style_header_left);
863
864          $style_footer = $dom->createElement('style:footer');
865            $style_master_page->appendChild($style_footer);
866
867            $text_p = $dom->createElement('text:p', 'Page');
868              $style_footer->appendChild($text_p);
869
870              $text_page_number = $dom->createElement('text:page-number','1');
871                $text_p->appendChild($text_page_number);
872
873              $note_text = $dom->createTextNode('/');
874                $text_p->appendChild($note_text);
875
876              $text_page_count = $dom->createElement('text:page-count','99');
877                $text_p->appendChild($text_page_count);
878
879          $style_footer_left = $dom->createElement('style:footer-left');
880            $style_footer_left->setAttribute("style:display", "false");
881            $style_master_page->appendChild($style_footer_left);
882
883
884    return $dom->saveXML();
885  }
886
887  private function getMimeType() {
888    return "application/vnd.oasis.opendocument.spreadsheet";
889  }
890
891  private function getAcceleratorCurrent() {
892    return "";
893  }
894
895  private function getManifest() {
896    $dom = new DOMDocument('1.0', 'UTF-8');
897    $root = $dom->createElement('manifest:manifest');
898      $root->setAttribute("xmlns:manifest", "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0");
899      $dom->appendChild($root);
900
901      $manifest_file_entry = $dom->createElement("manifest:file-entry");
902        $manifest_file_entry->setAttribute("manifest:media-type", "application/vnd.oasis.opendocument.spreadsheet");
903        $manifest_file_entry->setAttribute("manifest:version", "1.2");
904        $manifest_file_entry->setAttribute("manifest:full-path", "/");
905        $root->appendChild($manifest_file_entry);
906
907      $manifest_file_entry = $dom->createElement("manifest:file-entry");
908        $manifest_file_entry->setAttribute("manifest:media-type", "text/xml");
909        $manifest_file_entry->setAttribute("manifest:full-path", "content.xml");
910        $root->appendChild($manifest_file_entry);
911
912      $manifest_file_entry = $dom->createElement("manifest:file-entry");
913        $manifest_file_entry->setAttribute("manifest:media-type", "text/xml");
914        $manifest_file_entry->setAttribute("manifest:full-path", "styles.xml");
915        $root->appendChild($manifest_file_entry);
916
917      $manifest_file_entry = $dom->createElement("manifest:file-entry");
918        $manifest_file_entry->setAttribute("manifest:media-type", "text/xml");
919        $manifest_file_entry->setAttribute("manifest:full-path", "meta.xml");
920        $root->appendChild($manifest_file_entry);
921
922      $manifest_file_entry = $dom->createElement("manifest:file-entry");
923        $manifest_file_entry->setAttribute("manifest:media-type", "");
924        $manifest_file_entry->setAttribute("manifest:full-path", "Thumbnails/thumbnail.png");
925        $root->appendChild($manifest_file_entry);
926
927      $manifest_file_entry = $dom->createElement("manifest:file-entry");
928        $manifest_file_entry->setAttribute("manifest:media-type", "");
929        $manifest_file_entry->setAttribute("manifest:full-path", "Thumbnails/");
930        $root->appendChild($manifest_file_entry);
931
932      $manifest_file_entry = $dom->createElement("manifest:file-entry");
933        $manifest_file_entry->setAttribute("manifest:media-type", "");
934        $manifest_file_entry->setAttribute("manifest:full-path", "Configurations2/accelerator/current.xml");
935        $root->appendChild($manifest_file_entry);
936
937      $manifest_file_entry = $dom->createElement("manifest:file-entry");
938        $manifest_file_entry->setAttribute("manifest:media-type", "");
939        $manifest_file_entry->setAttribute("manifest:full-path", "Configurations2/accelerator/");
940        $root->appendChild($manifest_file_entry);
941
942      $manifest_file_entry = $dom->createElement("manifest:file-entry");
943        $manifest_file_entry->setAttribute("manifest:media-type", "");
944        $manifest_file_entry->setAttribute("manifest:full-path", "Configurations2/progressbar/");
945        $root->appendChild($manifest_file_entry);
946
947      $manifest_file_entry = $dom->createElement("manifest:file-entry");
948        $manifest_file_entry->setAttribute("manifest:media-type", "");
949        $manifest_file_entry->setAttribute("manifest:full-path", "Configurations2/floater/");
950        $root->appendChild($manifest_file_entry);
951
952      $manifest_file_entry = $dom->createElement("manifest:file-entry");
953        $manifest_file_entry->setAttribute("manifest:media-type", "");
954        $manifest_file_entry->setAttribute("manifest:full-path", "Configurations2/popupmenu/");
955        $root->appendChild($manifest_file_entry);
956
957      $manifest_file_entry = $dom->createElement("manifest:file-entry");
958        $manifest_file_entry->setAttribute("manifest:media-type", "");
959        $manifest_file_entry->setAttribute("manifest:full-path", "Configurations2/menubar/");
960        $root->appendChild($manifest_file_entry);
961
962      $manifest_file_entry = $dom->createElement("manifest:file-entry");
963        $manifest_file_entry->setAttribute("manifest:media-type", "");
964        $manifest_file_entry->setAttribute("manifest:full-path", "Configurations2/toolbar/");
965        $root->appendChild($manifest_file_entry);
966
967      $manifest_file_entry = $dom->createElement("manifest:file-entry");
968        $manifest_file_entry->setAttribute("manifest:media-type", "");
969        $manifest_file_entry->setAttribute("manifest:full-path", "Configurations2/images/Bitmaps/");
970        $root->appendChild($manifest_file_entry);
971
972      $manifest_file_entry = $dom->createElement("manifest:file-entry");
973        $manifest_file_entry->setAttribute("manifest:media-type", "");
974        $manifest_file_entry->setAttribute("manifest:full-path", "Configurations2/images/");
975        $root->appendChild($manifest_file_entry);
976
977      $manifest_file_entry = $dom->createElement("manifest:file-entry");
978        $manifest_file_entry->setAttribute("manifest:media-type", "");
979        $manifest_file_entry->setAttribute("manifest:full-path", "Configurations2/statusbar/");
980        $root->appendChild($manifest_file_entry);
981
982      $manifest_file_entry = $dom->createElement("manifest:file-entry");
983        $manifest_file_entry->setAttribute("manifest:media-type", "application/vnd.sun.xml.ui.configuration");
984        $manifest_file_entry->setAttribute("manifest:full-path", "Configurations2/");
985        $root->appendChild($manifest_file_entry);
986
987      $manifest_file_entry = $dom->createElement("manifest:file-entry");
988        $manifest_file_entry->setAttribute("manifest:media-type", "text/xml");
989        $manifest_file_entry->setAttribute("manifest:full-path", "settings.xml");
990        $root->appendChild($manifest_file_entry);
991
992    return $dom->saveXML();
993  }
994
995  private function getThumbnail() {
996    return base64_decode("
997      iVBORw0KGgoAAAANSUhEUgAAALoAAAEACAYAAAAEKGxWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz
998      AAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURB
999      VHic7Z152F3T9cc/K3PMNcUUMZQ0hFJRQypiFmOpuai21NRWfmhNpWooRVDaGmqe1VDUUC1iaFHS
1000      0BojIaExlRAlEQlZvz/WvnlPznuGO4/r8zz3ue89e+9z1r33e/e7z95rryWqiuO0Oz0abYDj1AMX
1001      utMRuNCdjsCF7nQELnSnI3ChOx2BC93pCFzoTkfgQnfqhhg/F5G/isjvRWRo3a7tK6NOPRCRnsCN
1002      wO6Rw68Bw1T1w1pf33t0p15sy/wiB1gFGFKPi7vQnXqxZXh+L3JMgVfqcXEXulMvvgjPewP3AS8B
1003      O6vq+/W4uI/RnbogImsDzwK7q+pt9b6+9+hOTRGRr4vIb4E3gduAo0Wkd73tcKE7teZXwGHAROAD
1004      YEPg0nob4UMXp2aIyCjg3pTic4GfquoXKeVVxXt0pyaISA/gjIwqRwKPisigWLveIrJzte1xoTu1
1005      Yh/gqzl1Ngb+JSI/EpFe4dgvgTtEZP1qGuNDF6fqiIgAE4AvAaOA9YEjgMEZzV4DxgF7ALep6m5V
1006      tcmF7tQCERkCLKiq48LrHsB3gdOBARlNZwFDVHVKVe1xoTv1REQWAU4Efgz0SahymqqeWPXrutCd
1007      RiAiqwHnAdtHDr8JDFbVGVW/ngvdqTYiMhxYGVgW+Ay4Q1XfSKk7GhM8wL6qen1NbHKhO9VCRDbD
1008      phQ3SCh+Gvixqj4Za7MKMAl4EhiuNRKkTy86VUFEzgAeIlnkYDMvD4rI9rHjB4TnI2olcvAe3akC
1009      InIg8Psiq38ObK6qj4W2CwDbqurttbIPXOhOhYjIMOAJ4DngOOB9YDvgQGDFlGb3qep29bHQcKE7
1010      FSEilwPfAlZQ1U8ix3sA22BL/VvGmikwVFVfrJedPkZ3yiYMO3YHnouKHEBV56rqfcDWmAfjfE2B
1011      depjpeFCdypha2BhYJiILJZUQY1jge8BcyJFPetg3zxc6E4l9A/P/YB7RSR1aV9VrwS+GTkktTQs
1012      jgvdqYRoD70R8JSIpHosquq9wMvh5eO1NCyOC92phGmx1ysCfxeRfUMclyQWAJ5Q1Um1NW1+XOhO
1013      JTyCbZGLsiBwLTBVRM6ORuMSkaOwH8PV9TMxXNunF51KEJHDgN/mVHsJ801fBvgLsF29ttAVcKE7
1014      RSMi/YGlVfX1yLE+wPVAMRslXgY2VNWPamRiKj50ceZDRAaKyFgR2TCh+KfAS8F5CwBVnQ3sSX6v
1015      fi+21F93kYP36E4METkdOB5bvbwBOEZV3xSRgViP/AHmMz4zoe0G2ALS7sAiwFvAFGCMqj5Un3eQ
1016      jAvdmY8wPLkdCwoKMBM4E1gLE/C3VfWGBplXNi50pxth3P0wNjceZQK2nzNRNCJyCnBv3Oe8GfAx
1017      utONMO4+EJgdKxoMPBTiKM6HiCyBOXA9LCJ71d7K0nChO4kEz8KHE4pGAuNF5GIRWTJSfxowAnPT
1018      vVJEVq+HncXiQneyeCHleE/gYGCiiIwuBB9S1fFYnMV+2E7/psGF7mSxbHiemlK+GLax+TkR2TtE
1019      yS0sBGUFK6o7LnQni6HA68Dq2IzLlJR6X8GmIv8D3BKOzUmp2xBc6E4WmwC7qOqnqnorlm/oZ0Ba
1020      3JUBdLnu3lgH+4rGpxedkhGR5bC59X1J9it/HVi3HtnmisV7dKdkVPUtVd0fC2Hx51jxdMxpq2lE
1021      Dt6jOymEFdJZxcRaEZH1sGHOB8CdjfJnycKF7syHiOyHRdtaHgvlfAlwSTOKtxRc6A4wL6b5Ndi4
1022      O8572E3oZao6t66GVQkfozsFjiJZ5ABLYT37eBEZWTgoIoNE5PA62FYx3qM7hWhbj2MzKFOBlXKa
1023      3IWlYBkJnAKsoaqv1tDEinGhO4jIWGA9YDdV/YuIDMayU4wG+hZxiu3DDv+mxYXe4YQZk3HA0ao6
1024      JlZ2E7ZFLi/Y0NKq+l6NTKwKPkZ3Dg7PD0QPhnAV22BL+1sCaUOTW5td5OBCd+Dr4fkCETlLRJYK
1025      r4dhTlt/VdUHsXnyV0LZDCyw//nA3vU0tlx65Vdx2pyC3/iI8FgOm30pRMB9C0BV3w4zLs8AD6nq
1026      PnW2syK8R3cmxF4vHp4LQp83LFHVt4F/YDFaWgoXunNl7PVtIRz0xuH1TwoFYdw+FNvh31L40KXD
1027      UdULROQzLPfQg6p6fZiJKeQA3dcWTXkY2B9YhSZzwS0Gn17sMMJS/w+xTu4VVb0noc5guqLexlFg
1028      VVWdXDsrq4/36B2EiCwIXEckTrmIHKaqF8WqfpBxmvtbTeTgY/RO4wTmD8YP8IuEeu8Ddycc/xA4
1029      pNpG1QMXemexG12blwtMiVcKPuh7YUluC7yGLfW/Hq/fCvgYvYMQkTexYckDwI+Bj4G9VDW+Syja
1030      ZgPMBWC8qs6qi6E1wIXeQYjIVViCrYHY/dkCzbblrVa40DsAEdkGeAMLMfcysGetMzU3Gy70Nics
1031      /kwElgZ+h6VWGQFsrKrxVdG2xYXe5ojI8cDpkUNzsUmIV4FNVfXNhhhWZ1zobUyIcPsqsGhKlWnA
1032      d1X1T7F2iwGfqupnNTaxbvj0YntzPOkiB1gCuEtEficiUUetK4B/ZqRQbDm8R29TRGQQ5pn4DhZV
1033      6yDgaxlN3gcuxvKAHgmcpKqn1trOeuFCb1NCD/0L4EJVnRiObQGMAVKzOwdeB77SyvPmcVzoHYaI
1034      9MB699OAJVOq7aGqt6SUtSQu9A4l3HCeDBzO/M59j6jqyEbYVEtc6G2IiGwMbIeFcO6JOWg9mBRH
1035      UUSGAPcBg7Cpx/VU9dk6mlsXXOhtRMgb9Gu6UidGmQKcpqqXJ7Q7BLgIuFRVD46XtwPuj94miMgA
1036      4K/YymcSK2FOXIhIj1gMxW8DH2HxFdsSn0dvA0SkH3Antsx/C7aBOf6v+lFV/YOILA6MjaY5By4F
1037      jmyF+Czl4kOXNkBEDsA2OX+r4KwVslIciQUPnTf2FpFFsRAWk4F1VPXzxlhdX7xHbw/2Bf4H3FE4
1038      oKpvAfeHl5cXbjBDnPObgTWBDetsZ8Nwobc4IrI8sBmwEBZZq3BcMGeuj7AtdFGuCs+b1sHEpsCF
1039      3voMxL7HHsB1ISULWGiK9YFTEsbehR/EQvUxsfG40Fuf6ZG/RwH3h17+DMzX5cKENsPDc0e46IJP
1040      L7YD02OvNwFeAhYGDlTV+RLbishAoBA38cHam9cceI/e4qjqO1hk2ygLh+fjROQIEVlBRPqELXUP
1041      ACtggUJfqqetjcSnF9sAEdkWW8ZPQ4GZwILh9WfACFV9qta2NQveo7cBIVxF1mZnoUvkAId2ksjB
1042      hd5O7IH5q2QxFzhVVeMRdNseH7q0GSKyN/AdYAvmn2wYBxyiqv9siGENxoXeYojIlpiD1gfAPWkb
1043      mINPy3rAu8BUVc0KHNr2uNBbhJBb6E5go8jh/wK/Bcao6oyGGNYiuNBbABHpCzxEVxaKOFOBY1T1
1044      hvpZ1Vr4zWhrsDfpIgebF79eRP4mIvN2+ovIEiJykoh0zFJ/Gi701mDHIusNB54WkStEZBRwPfBz
1045      YHDNLGsRfOjS5IhIH+zGc0EsXvlhwGrATlgM87wgQ1eo6vdramQL4EJvcoK77btYysNFVXVmpGwo
1046      cB5dqRLjfAyspqrv1tzQJseHLk2MiCwfdu7fD7wWFTmAqj6vqlsBOwOTEk5xqovccKE3KSLSC3hY
1047      RP6GTSOuJiIrJdVV1buwHUPRfESTsIgADj50aVpE5FAsnnmUR4BdsxZ/wg9jOLBTPEpuJ+NCb0JC
1048      8P5XgWUSil8FdkxysQ1hot8GxqrqNrW1srXwoUtzMppkkQOsCjwjImeFHf1R/gfsF9o7EVzoTUbo
1049      lX+K+YynpTrsC/wEmCgiB4tILxHZCovGNaWTNlQUiwu9+dgE6IO53a4K7AmkxUJcCotpPh3zR+8L
1050      vFIHG1sOH6M3ISKyePSGM4R6/h4WvmLpjKZJ6c4dXOgthYgsgsVHPALr9aM8B6yrqvHM0A4u9JZE
1051      RL4MnMv8PjCbq+rYBpnU9LjQm4QQK/E4bLNEf+xm9CbgWlWdllBfsBB0OwG3q+q36mhuy+FCbwJE
1052      5FjMy7BfQvFs4DuqelNCu4ex+IlDVHVyTY1scXzWpcGIyPexqFpJIgdzzLo/1F0h0m5BLBb6GBd5
1053      Pt6jNxAR2Qhb1n8aC/s8DHPQii4WHaaqF4nI5liKlk1V9enQvh/2HX5aX8tbDxd6AxGRW4DNgUGq
1054      +kk41gObRjyWyEyKiKyMLf8/oarD087pJONDlwYRlu93AMYXRA4QUq4UQsodUZguDMOTvwAbi0ia
1055      e4CTggu9ceyMjcvXiYR6LmSJOxibSYlPFxYC/WftH3UScKE3jgXC85LAn8NiENiOoc+BoxPaDAnP
1056      s2tsW9vhQm8c0XDPI7AEWgcA2wDnpsykFHry/9TYtrbDb0YbRIi49deEoo+AlVR1eqz+j7EdQxOw
1057      eXP/4krAEwFUERHZHXgsxCzPYywwEdvRH2VR4FURuRO4FfgC2B1z6gL4nYu8dLxHrxJhFuU9bPx8
1058      HnC2qv4vp823getKuMzfMJ+WObk1nflwoVeJ4HvyEV1Tg+8DpwEXqWrizWOYM78aS5+Yx1RgmO/q
1059      Lw+/Ga0u0R1BSwLnAxNE5NvhhzAPEVkMWEBV98N+EFk8A4xykZePC70KhAWc+4ChCcUrYcOTeOiJ
1060      X2E/gsVV9UTMa/EsLKOzYkGLxmO+5+ur6vO1sb4z8KFLhYjIepjIlwLuxbJOTMXG6wthAv4acJmq
1061      vhzafBUT8QuqunbCOXv7OLy6+KxLBYThx63Yf8YNVfUfCdUmAPFwzr8ObRLjrrjIq48LvTIuwzwN
1062      t0gReTdE5Ft0pSb/iYjMAM4MPi5OjfChS5mE8HCTMZEeV2SbfsCLwMqxomcwB67Hqmmj04XfjJbP
1063      XuH53hLaHEl3kQOsCzwqIjeLyKCKLXO64T16mYjIv4C1gP5pCbNi9ZfFYq7kZZ+YBZwDnBGPnuuU
1064      j/foZSAiawBrY4lqi80mcQYm8nOxBFv/TanXD/gR+T8IpwRc6OURnRLM3e0Twsx9E7hTVY9S1R8C
1065      XwbuilQbgw1hRgKbqWraD8EpAx+6lEHYv/lgePk+tjSfFiex0GYAMFtVP4wcE2x6clfgGlX9To1M
1066      7ni8Ry+P6FL8ksCdIdRzKqr6blTk4ZgC/4dttPhK1a105uFCL4+4z8lXgZsju4SKRlXfwP4rdAtS
1067      5FQPF3p5TAPiMyI7AM+KyIalnCgMX3oCHuq5hrjQyyAMOS5IKFoZeExEjheRvLSIBUZgfjIPVMs+
1068      pzt+M1omwc/lNSwtYhKTMQ/Fq9Lm2UWkIPD+wGDfOVQ7vEcvk7Cn81cZVVbGgvRPDmnKNxGRvmDe
1069      iSIyDIvStTbwSxd5bfEevQJCPJZbgO2LbPIZFm1rVSw7BcAFqnpEDcxzIrjQKyRshzsNC/lcKn8C
1070      vumei7XHhV4lRGRP4Aq6AhPl8QAm8hm1s8op4GP0KqGqN2NhnH+IRcdN4yFsiX8rF3n98B69RoQY
1071      itsAczGPxFnAhGI3aDjVxYVeJiIyEPg+liWuDzAJuF5VPVxcE+JCLxER6QNcgsViiW9FnIuFdj5Q
1072      Vd+st21OOi70EgjL9dcDe+dUfRu70Xyq9lY5xeA3o6UxmnyRAywLPCIi69TYHqdIXOilUQj0+QZw
1073      LfBkRt1+2JY4pwnwoUuRiMhg4GUsAu5GhdyfIbntvsB+wCoJTbdV1fvrZqiTiPfoxVOInXhjNMGt
1074      qk5S1ZOBNYHbEtqNqINtTg4u9CIQkTWBt4DUMNCqOgvYg+4xFlesoWlOkbjQcwh+5bdioeXmALuF
1075      QETdUNW5qjoa2+hcwHfzNwEu9Hy+h+3nXAZYAlgDuCxnY8XFkb//XEPbnCJxoWcQNjyfnFD0bWz6
1076      MCnqFsDi4XkuXSkTnQbiQs9mNLBcStlw4DkROSdE4QJARBbGghSBbajw4P1NgE8vpiAiS2KbJPpj
1077      N6FLZFT/HJt2fBdYP7S5WFUPr7WdTnF4j57O1phv+T7ACsBBWOzEJHphyW5HAg8DX3aRNxfeo2cg
1078      Iiuo6tTI696Yv/nPsTSJScwFLgd+Fg0rF+Ki/82HMo3Be/QMoiIPr+eo6nlYbtBLMVHH6YH1/hNF
1079      5GgR6R9C2P2B5LTnTh3wHr0CgtPWr8le/fwCm3//BFgtnhHaqQ/eo8cQkT4ismReLEUAVX1WVTfF
1080      VkTTgoz2xBy8TnKRNw4XegQROQrzTHwP+EhEbhKRDfLaqeot2KLSSXQPVQfwHDbUcRqED10CInIy
1081      dpOZxC3AT/JCQ4fzrACcTVfqF7BkXg9VbKRTNh0hdBGRrEhYIrI+kLcbqJBy5czo7n0R+Zqqjk84
1082      51XAd4A7VHWXsgx3qkbbD12Cv/i/RWTbjGq7FnGqfsDPgFdEZB8R6SUiRwD/FJEdE+ovjkXm8pmW
1083      JqDte3QRuRI4ILy8BzhSVV+J1XkBc9aaCZwJDARGYQtFaXyG3WhOAtZS1c8j5+sFPAvcrarHVued
1084      OJXQ1kIXkVWxXUHR3fpzsCnBU1X1f6Hem5hPy3BVfTwc6wn8ADiV7OX/UarazUMxiL23qn5ajffi
1085      VEa7D11OoHtIit7YcGKiiHw/xE58BPgAeKJQSVW/UNWLsMWh32Dz4XHuSRJ5aP+5i7x5aNseXURW
1086      wTZL5KWBHw88j7nerqCq76ScbyhwIebPAvafYWh8GOQ0J+3coxd683OAi4C0OIdfA/bHxtunpm2o
1087      UNXnga2AR8OhC1zkrUM79+g/wLJIHBVeLwYcg2WB65vR9H5g73gGuXAOwdxxF8aW81P3kDrNRdsK
1088      PY0wpBmDJbhN4w3gGFW9Kda2H5a76ElVvaJ2VjrVpuOEXkBEtgDOB4ZmVHsCOEJVnw4bMc7HZmsm
1089      1MNGp3q0pdBDypUdgB2x6cUHgHHxzBJhPH4IcApd+zzjzMU2UywKrAeMVNVHamO5UyvaTugicihw
1090      Ft3DTEwCtlbVyQltFgd+ARyK3ZSmcauq7l4tW5360VZCF5HjgF9mVHkbE/vzKe3XxIYnWyYUzwKG
1091      qOqUSu106k/bTC+KyP5kixwsyu3ZaYWq+oKqbgXsguUQjXKOi7x1aYseXUSWxxZ9Fiui+hxgQNL0
1092      YeycfbGpxk2BN7GpSs851KK0S49+GSby24ENsB35B2IbHuL0Br6ed8KQ7XlceHmMi7y1afkeXUT2
1093      Am4EblbVvWJlPbBIWycw/496TVV9Mee8PbCefDLm7NXaH1SH09JCD9OIL2MiHqKqn6TUO5qusflc
1094      YIHQY+edfzDQS1VfqJLJToNo9aHLT7CwzOekiTxwIbYPFOC5YkQOoKoTXOTtQcsKPezNPCa8TJwu
1095      LBCEPSu8jMcvdzqAlhU68Cu60pHfLCKj0iqGwJ9LY8H8r6+DbU6T0ZJCF5GNsJiIBZYA7hWRu0Vk
1096      9YQmB2Ieixeo6ux62Og0Fy13MxpcZf+BRa1NYg7mYXiqqn4UEuC+gmV3Xj1nLO+0KXm7b5qR/UkX
1097      Odg8+VHAfiJyAtbbDwK+4yLvXFqqRxeRhbDeeVngbiy0c58imj4PrO1z4Z1Lq43Rj8NEfoaq7gis
1098      jE0dfp7ZynzObxGRlZIKRWTpMCRy2pRW69EHY8lrT4r2ziIyBDgP2CbnFLOw3UVnFJb0w4zMk8Br
1099      4cfjtCEtJfQ8RGR7LH9Q0sxLlLdCvcuxVOc7AIeq6sWZrZyWpa2EDvOyUvwIi2yblpWiwGxsjP9v
1100      4GuqmhS7xWkD2k7oBURkKeA0bA49715kc1UdW3urnEbRajejRaOq76nqwdg+z6w9nre7yNuflha6
1101      iPQWkbWy6oSsFCOB3YGpsWKPdtshtLTQsWHJsyJyjYismFVRVW8F1gZujRw+N2mztNN+tLrQB2Hv
1102      YT8sbvk5aSHlAML2uUJW57fJ32PqtAktK3QR2R2LyVKgL5bINm/mZN/wfKy7BHQOLTnrEkT+B2Aa
1103      tnPo+fB4A1gTS4y1OuYucJGqXhvaCfAilvJ8Q3cJ6BxaTugisgy2fe5jLEbLS5GyfYFL6PJTLzAG
1104      S7alYSV0KVWNh7Nw2phWHLocgC0EjSqIXIwLsFXOpPygRwHbAqjqxy7yzqMVe/QXgf6qunLk2EXM
1105      P15P4jZV3a2mxjlNSyv26AOBRUVkqTCP/nuSRf445sZ7VXidlXjLaXNasUefgQ1PJmDeiF9NqHY7
1106      sJeqzgmpzj8AnlbVTWpkU39sqnMZ4H3gP6r6US2uVQ4hrvuKWEKyacDUvEhl9SRMCa+MuWC/jtk3
1107      N7tViahqwx9Y5KyNiqx7I6AZjweAvpH6Q8LxX1bZ5v7Y/cKTKXY8jv2n6degz7QvlpfpMSyWTdy+
1108      p4AfYjFu6m2bAHsCN2MOdbNits0CXgDuxKaDe1R8zUZ8CQlvvPBlXAcsn1N3HWx6MElcd2Pj92j9
1109      MaFstSra+3Xg1ZwfXOHxMvCNOn+e64TrFmPfq5hTW71sG57ROaQ9XsRcOKRlhQ5sEXtTn2AZmlN7
1110      QmAYFu+80GY6Ft+8V6zeoaH80iraezDm3hu1eSJwIrBJsH1KrPwLYL86fZ77J/SQk8PnswlwbOyz
1111      09DJHFxju3qGjix63SlYassfYaEDb8WSGqcJ/nFg4VYV+mMpb2oysFtO26GY/8pCWJDRjbB/1ycC
1112      Y8N5xmX9aEq0dTe6DwM+BpaJ1VsbcxiLi32vGn+W22PbCqPX/RQYFKu3eoKg5gLfq6FtZ0auNQs4
1113      KN4xhXqDsWFVmtj/nNSuqYVO99486TEW+GrOeXpiY71429uBRapk63pBNPFrHJ9S/+yEujMxN4Va
1114      fJZrYv8N49c8PaX+zxPqfoblTq22bbvGrrN7Tv2lsf/SaZq4rNWEXujN88aTXwAXA0umnKcHdmP4
1115      RqTNx1Qwpks4/9MptiWO/RO+3MLjMapwc5VwvUdSrrdOSv2tU+qPK6fHzLBrCea/p5oNfKmIdsfm
1116      aGLdlhA6sHkw+ArsLnwt4Oog6rQ39yEwOu2LAPph/uUfAI9V0dYfZNi0REqbNTLaHFrlz3KfjGut
1117      mNJmxYw2R1fRtl0Szv8I5oaR1W5kjtD/r1WE3p+Q3DZ2fN2M3qnweAnYNuGchXWBxYBVqmSn0P3m
1118      svCYC/RMadeH7uPlwmMCVfpvE671YsZntVDG+5qR0uaNtPdVhm1jUq7xFrBpRrvlcjRwR0sIvYgP
1119      aDfMZzzrzd6NhZkrtPkp8Cdg0SrasXnG9T/MaftKRtstqmTfBhnXmJ3TdnxG252qZF/WVOLnwLIp
1120      7QbmfPdvlmJHU7oAiMguwGHAgJyq2wPPi8h1InIUthl6EDY+rxYHZJR9kNM2vnUvyoGlm5LIARll
1121      eaufb2aUHVS6KYkMyijrSXC2S2Bgznknl2JE0wldRA7EZktWBH6MLRRcC6QtqffGphTPCX+fpNVd
1122      Pv5GRlmekD7NKNusDFuSyLIv74c4M6NsREhvUyl5nqJpn8PKKccL/LMUI5pK6CLyDeAibJrrG6r6
1123      G1W9VVX3x3r3nUlOwFXgaVW9o4r29MJ+cGlUIqQBaSHySiRLEHn2Zf0QF8HcJyplXE75+ynH96jw
1124      vPPRVELH/p33Al5U1XeiBar6mareha3upYWv+FmV7RlEdibpSoQENr4uGxEZACyYUaVS+zYszaJE
1125      ziT7B39P/ICILIcNS9OYht2LFU3TCD30njuFl2uISGLOUDWvwG2A28Khwpf5mKr+pcpmrZJTXqmQ
1126      8kLn5VGpfVkCBFitBFsSUdW3sd55WrwIOEtVH0xoNprsDuYUVZ1eih3NFB/9S+EB5nn3RxHZVRPc
1127      SVX1MxHZA7shuQ5zTHopXq8K1FpIxSQAzmLVnPJKf4hfyikvClW9R0TWAEZh08fTgAdU9Yl4XRH5
1128      OnBkxukmYcPbkmgaoavqeyLyCea3ArZg8HcR2U4TUpOr6lwReQDYWFVPqJFZte7RKxVSnn2V3CxD
1129      5T/Eeajqf7EFwavT6gS/+atJ781nYc5nc0q9ftMMXQITYq+HAE+KyA5haBNnLfK/7ErImhoD88fI
1130      otZCyrOvUqFXpUcvgfOBr6SUzQC2V9WHyjlxswn97IRjA7Abj7dF5GIR2VxEhoUtdOsD1R6XR8nr
1131      sbPGkZC8UTvK/0qwJYlK7eufU163XVIi8lPMBTrNjq3KFTk0mdBV9WZsJS2JJbEP4kHMwaqw4PLH
1132      GpqUNwecJ5TFc8onlWBLEnn25f3Qam1fUYQ092emFD+MOXB1G8+XQl3G6CLSF9ssMQwTh2KrhuOA
1133      VzSs+Qb2Ae7CfM3zuA+4v7rWzkezC+nVnPJG/xBzEZER2Ab2eGqdGZgH429j+iiLmgo9BAs6HjiC
1134      9A/9bRG5ELhYVT9U1ckisjE2m7JTShuAZ4A9tLbB+5tdSM3+Q8wkREK+E5tli/Iotgmk2+cvIpsB
1135      m4aXZ2iR6e5r6ZR1IPAO2Y450cd0YJ/YOTbFBB/d8DAJ23q1YK1sj1x/4Rybz85p/0xO+8UqtK83
1136      6R6SCvwup33a7q7CI3P/boW2r4R5MEavNwPrFFM9O7H1k4JDWNEeoLV6E8eVIPD44zJiGxOwX/zC
1137      WA9VNffWIt/Lexm2/ian7esZbd+rkn1TMq5xVU7bFzLazqzVZw0sRXfPzqcoYvcVXR6t75Ryzarf
1138      jIrIKMyLsPBF/xFzwCnuXwx8H/Nhnofa8v/HqjpTw7utIy9klFUyNHixDFuSyLKvkqHVS7X4rMNw
1139      9j7mX3X9NebblDlUEpFNsNg5AP8t5bpVFbqIfBm4ARuyDFXVlVR1V1UdhvXI62J313nTVqNFZJ9q
1140      2lYB12eUpc4zh6RhC6WVAzflXVhElsirQ5n2BbKEfmPehUVk8VLys4Z09X/E9t+CDVd3UdXRqjq7
1141      iFNEXZtLEnq1/yUV3GkH59RbGNvyNpX0f51TiO0+asQD8+JL24nzYka7ARnvbSYpm0OwXvgc4N1Q
1142      9wNsOJc4ng/10zYSv55h34IZ9s0BBqS064slUCgMIaYD15CynzfSrgcW6IisqQAAA8pJREFU6rtw
1143      jeex+DOLZTyWxBYFt8VEHo1ccH1J32MVBbFoMOS6Etr0xRaJ0vaJfrfRQg92XpRi32zS968OSWmj
1144      pMSZwRZ4Hk9pM5H0bXHnpLSZS8pNO9k7eG5IaSPYOkZSmzfI2PRMclSESh7nNUrohwQD9i6j7UiS
1145      b9xuabTIg31LYcvpSR/46ilthqfUnw4sndLm8HK+XKyTeTelTeJueSxmZVL9GcDAlDYH5NiX9gNO
1146      i4hQyeO4Ur7Dao7R9w7PedvfuqGqD2NBfx6PFY2szKTqoKrvYQl6k0jbnJCWLe8kNQenJLbOMSUx
1147      Bbya6/KxKW3WSDm+dsrx01T1PyllJdsX7tuuzGlXDo0ZowPPYr+0eys4xxLMP+2Uufm4zr26YDd+
1148      8Z7lKbqHwluI5I3d15I9R5wVoUqBaTk2/j6hzb/pHmmhH8nTkreREXOGruhnaY9Po+8Pu3/4V06b
1149      ch87lvT91UDoc8mJxJRznlXpih34VqMFHrOtD/BQwod+CWFxBetBb06ocy/QuwyhRh9/yWnfC9ux
1150      E293NSG+C7bZ45qEOmPjP4iE85+fY9/fY/WvrJHIFdig0UJX7KZ0vQrOdV84z6uNFneK2MfQPQbj
1151      XGxJPv6FfIHNUuRGv8KmX+dkfLmjijhHL+B0km/wk+ybC5wH9Cni3EPoHsA0+tgtVj/rvVT6WLlR
1152      Qr8/ZshblBkuma6bsnsaLewMGzcD/pog+KiA7gdGlHjegxLE9DnwsxLPMxz7L5Jmn2L/nbYs8bz7
1153      0n269QsS4s/XWOgluYBULeOFiByOhQCOMhdbIDpZS9gVIiInAqcA31TVO6tiYI0QkcGY6FfCVu3e
1154      wca/D6nqK2We8yvYPsuhWFzK21X12TLPtSqwJbZJY1nMpWEK8LCqlrU6G24w98JuuCcCd6rq0wn1
1155      VsO2zU3XKoQgCQtOi2HTmPFNOtltqyj05bA9nH0SiscBBxX7ZYnIWGyJeJDW1jvR6RCqNr2oqm9h
1156      PgtJDAOeEZH7gptlKiKyHzACCw3sIneqQlWTdYnIIpiz0vI5VZ/GshuMD48PsR58e2wFbTwwUlXz
1157      dtE7TlFUPSudiKyNOc4vWkKzmXR5Ar6OTR29W1XDnI6m6m66qvpvYEfSQ40lURD5R9hObxe5U1Vq
1158      sjlaVR/DlpiTojCl8SgWSjnLv9pxyqLmCXVFZH1sKmpPksfu44ATtPrh5BxnHnXLHB0c9DfBnL6m
1159      Fx6qOrEuBjgdTculSHeccmiqAEaOUytc6E5H4EJ3OgIXutMRuNCdjsCF7nQELnSnI/h/RFS3BiKq
1160      JXMAAAAASUVORK5CYII=");
1161  }
1162
1163  public function genOdsFile($file) {
1164    /*
1165      --------------------------------------------------------------------------
1166      2012-09-04 / replace ZipArchive class with PclZip
1167      --------------------------------------------------------------------------
1168
1169    $zip = new ZipArchive();
1170
1171    if ($zip->open($file, ZIPARCHIVE::OVERWRITE)!==TRUE) {
1172       exit("cannot open $file\n");
1173    }
1174
1175    $zip->addFromString("meta.xml", $this->getMeta());
1176    $zip->addFromString("content.xml", $this->getContent());
1177    $zip->addFromString("files/mimetype", $this->getMimeType());
1178    $zip->addFromString("settings.xml", $this->getSettings());
1179    $zip->addFromString("styles.xml", $this->getStyles());
1180    $zip->addFromString("files/Configurations2/accelerator/current.xml", $this->getAcceleratorCurrent());
1181    $zip->addFromString("META-INF/manifest.xml", $this->getManifest());
1182    $zip->addFromString("files/Thumbnails/thumbnail.png", $this->getThumbnail());
1183    */
1184
1185    // create temporary files
1186    $tmpDir=$file.'.tmp';
1187    if(!file_exists($tmpDir))
1188        mkdir($tmpDir, 0755, true);
1189
1190    $this->writeFile($tmpDir, 'meta.xml', $this->getMeta());
1191    $this->writeFile($tmpDir, 'content.xml', $this->getContent());
1192    $this->writeFile($tmpDir, 'mimetype', $this->getMimeType());
1193    $this->writeFile($tmpDir, 'settings.xml', $this->getSettings());
1194    $this->writeFile($tmpDir, 'styles.xml', $this->getStyles());
1195    $this->writeFile($tmpDir, 'Configurations2/accelerator/current.xml', $this->getAcceleratorCurrent());
1196    $this->writeFile($tmpDir, 'META-INF/manifest.xml', $this->getManifest());
1197    //$this->writeFile($tmpDir, 'files/Thumbnails/thumbnail.png', $this->getThumbnail());
1198
1199    $fileList=array(
1200      $tmpDir.'/meta.xml',
1201      $tmpDir.'/content.xml',
1202      $tmpDir.'/mimetype',
1203      $tmpDir.'/settings.xml',
1204      $tmpDir.'/styles.xml',
1205      $tmpDir.'/Configurations2/accelerator/current.xml',
1206      $tmpDir.'/META-INF/manifest.xml'
1207    );
1208    foreach($this->tmpPictures AS $imgfile => $name)
1209    {
1210      $fileList[$name]=$imgfile;
1211    }
1212    $zip=new PclZip($file);
1213    $result=$zip->create($fileList, PCLZIP_OPT_REMOVE_PATH, $tmpDir);
1214    $this->rmDir($tmpDir);
1215
1216    if($result===0)
1217    {
1218      return(false);
1219    }
1220    return(true);
1221  }
1222
1223  public function downloadOdsFile($fileName) {
1224    header('Content-type: application/vnd.oasis.opendocument.spreadsheet');
1225    header('Content-Disposition: attachment; filename="'.$fileName.'"');
1226    $tmpfile = tempnam("tmp", "genods");
1227    $this->genOdsFile($tmpfile);
1228    readfile($tmpfile);
1229    unlink($tmpfile);
1230  }
1231
1232  /**
1233   * -- Added by grum
1234   * write file content into tmp file
1235   *
1236   * @param String $tmpDir: temporary directory
1237   * @param String $file: file name
1238   * @param String $content: content of the file
1239   * @return Boolean: true, or false :)
1240   */
1241  private function writeFile($tmpDir, $file, $content)
1242  {
1243    $tmpDir=dirname($tmpDir.'/'.$file);
1244    if(!file_exists($tmpDir))
1245        mkdir($tmpDir, 0755, true);
1246
1247    $fHandle=fopen($tmpDir.'/'.basename($file), 'w');
1248    if($fHandle)
1249    {
1250      fwrite($fHandle, $content);
1251      fclose($fHandle);
1252      return(true);
1253    }
1254    return(false);
1255  }
1256
1257  /**
1258   * -- Added by grum
1259   * remove a path recursively
1260   *
1261   * @param String $directory : directory to remove
1262   * @return Bool : true if directory was succesfully removed, otherwise false
1263   */
1264  private function rmDir($directory)
1265  {
1266    $directory=rtrim($directory, '\/').'/';
1267    $returned=true;
1268    if(file_exists($directory) and is_dir($directory) and $directory!='./' and $directory!='../')
1269    {
1270      $dhandle=scandir($directory);
1271      foreach($dhandle as $file)
1272      {
1273        if($file!='.' and $file!='..' )
1274        {
1275          if(is_dir($directory.$file))
1276          {
1277            $returned=self::rmDir($directory.$file, true) & $returned;
1278          }
1279          else
1280          {
1281            $returned=unlink($directory.$file) & $returned;
1282          }
1283        }
1284      }
1285      if($returned) $returned=rmdir($directory);
1286    }
1287    return($returned);
1288  }
1289
1290}
1291
1292?>
Note: See TracBrowser for help on using the repository browser.