ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
MetaInf.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
7 class MetaInf extends WriterPart
8 {
14  public function write(): string
15  {
16  $objWriter = null;
17  if ($this->getParentWriter()->getUseDiskCaching()) {
18  $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
19  } else {
20  $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
21  }
22 
23  // XML header
24  $objWriter->startDocument('1.0', 'UTF-8');
25 
26  // Manifest
27  $objWriter->startElement('manifest:manifest');
28  $objWriter->writeAttribute('xmlns:manifest', 'urn:oasis:names:tc:opendocument:xmlns:manifest:1.0');
29  $objWriter->writeAttribute('manifest:version', '1.2');
30 
31  $objWriter->startElement('manifest:file-entry');
32  $objWriter->writeAttribute('manifest:full-path', '/');
33  $objWriter->writeAttribute('manifest:version', '1.2');
34  $objWriter->writeAttribute('manifest:media-type', 'application/vnd.oasis.opendocument.spreadsheet');
35  $objWriter->endElement();
36  $objWriter->startElement('manifest:file-entry');
37  $objWriter->writeAttribute('manifest:full-path', 'meta.xml');
38  $objWriter->writeAttribute('manifest:media-type', 'text/xml');
39  $objWriter->endElement();
40  $objWriter->startElement('manifest:file-entry');
41  $objWriter->writeAttribute('manifest:full-path', 'settings.xml');
42  $objWriter->writeAttribute('manifest:media-type', 'text/xml');
43  $objWriter->endElement();
44  $objWriter->startElement('manifest:file-entry');
45  $objWriter->writeAttribute('manifest:full-path', 'content.xml');
46  $objWriter->writeAttribute('manifest:media-type', 'text/xml');
47  $objWriter->endElement();
48  $objWriter->startElement('manifest:file-entry');
49  $objWriter->writeAttribute('manifest:full-path', 'Thumbnails/thumbnail.png');
50  $objWriter->writeAttribute('manifest:media-type', 'image/png');
51  $objWriter->endElement();
52  $objWriter->startElement('manifest:file-entry');
53  $objWriter->writeAttribute('manifest:full-path', 'styles.xml');
54  $objWriter->writeAttribute('manifest:media-type', 'text/xml');
55  $objWriter->endElement();
56  $objWriter->endElement();
57 
58  return $objWriter->getData();
59  }
60 }
write()
Write META-INF/manifest.xml to XML format.
Definition: MetaInf.php:14
getDiskCachingDirectory()
Get disk caching directory.
Definition: BaseWriter.php:92
getUseDiskCaching()
Get use disk caching where possible?
Definition: BaseWriter.php:72