|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PhpOffice\PhpPresentation\Writer\ODPresentation; |
|
4
|
|
|
|
|
5
|
|
|
use PhpOffice\Common\XMLWriter; |
|
6
|
|
|
|
|
7
|
|
|
class Meta extends AbstractDecoratorWriter |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* @return ZipInterface |
|
11
|
|
|
*/ |
|
12
|
|
|
public function render() |
|
13
|
|
|
{ |
|
14
|
|
|
// Create XML writer |
|
15
|
|
|
$objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); |
|
16
|
|
|
$objWriter->startDocument('1.0', 'UTF-8'); |
|
17
|
|
|
|
|
18
|
|
|
// office:document-meta |
|
19
|
|
|
$objWriter->startElement('office:document-meta'); |
|
20
|
|
|
$objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); |
|
21
|
|
|
$objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink'); |
|
22
|
|
|
$objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
|
23
|
|
|
$objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'); |
|
24
|
|
|
$objWriter->writeAttribute('xmlns:presentation', 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0'); |
|
25
|
|
|
$objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office'); |
|
26
|
|
|
$objWriter->writeAttribute('xmlns:smil', 'urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0'); |
|
27
|
|
|
$objWriter->writeAttribute('xmlns:anim', 'urn:oasis:names:tc:opendocument:xmlns:animation:1.0'); |
|
28
|
|
|
$objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#'); |
|
29
|
|
|
$objWriter->writeAttribute('xmlns:officeooo', 'http://openoffice.org/2009/office'); |
|
30
|
|
|
$objWriter->writeAttribute('xmlns:drawooo', 'http://openoffice.org/2010/draw'); |
|
31
|
|
|
$objWriter->writeAttribute('office:version', '1.2'); |
|
32
|
|
|
|
|
33
|
|
|
// office:meta |
|
34
|
|
|
$objWriter->startElement('office:meta'); |
|
35
|
|
|
|
|
36
|
|
|
// dc:creator |
|
37
|
|
|
$objWriter->writeElement('dc:creator', $this->getPresentation()->getDocumentProperties()->getLastModifiedBy()); |
|
38
|
|
|
// dc:date |
|
39
|
|
|
$objWriter->writeElement('dc:date', gmdate('Y-m-d\TH:i:s.000', $this->getPresentation()->getDocumentProperties()->getModified())); |
|
40
|
|
|
// dc:description |
|
41
|
|
|
$objWriter->writeElement('dc:description', $this->getPresentation()->getDocumentProperties()->getDescription()); |
|
42
|
|
|
// dc:subject |
|
43
|
|
|
$objWriter->writeElement('dc:subject', $this->getPresentation()->getDocumentProperties()->getSubject()); |
|
44
|
|
|
// dc:title |
|
45
|
|
|
$objWriter->writeElement('dc:title', $this->getPresentation()->getDocumentProperties()->getTitle()); |
|
46
|
|
|
// meta:creation-date |
|
47
|
|
|
$objWriter->writeElement('meta:creation-date', gmdate('Y-m-d\TH:i:s.000', $this->getPresentation()->getDocumentProperties()->getCreated())); |
|
48
|
|
|
// meta:initial-creator |
|
49
|
|
|
$objWriter->writeElement('meta:initial-creator', $this->getPresentation()->getDocumentProperties()->getCreator()); |
|
50
|
|
|
// meta:keyword |
|
51
|
|
|
$objWriter->writeElement('meta:keyword', $this->getPresentation()->getDocumentProperties()->getKeywords()); |
|
52
|
|
|
|
|
53
|
|
|
// @todo : Where these properties are written ? |
|
54
|
|
|
// $this->getPresentation()->getDocumentProperties()->getCategory() |
|
55
|
|
|
// $this->getPresentation()->getDocumentProperties()->getCompany() |
|
56
|
|
|
|
|
57
|
|
|
$objWriter->endElement(); |
|
58
|
|
|
|
|
59
|
|
|
$objWriter->endElement(); |
|
60
|
|
|
|
|
61
|
|
|
$this->getZip()->addFromString('meta.xml', $objWriter->getData()); |
|
62
|
|
|
return $this->getZip(); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|