|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PhpOffice\PhpPresentation\Writer\PowerPoint2007; |
|
4
|
|
|
|
|
5
|
|
|
use PhpOffice\Common\XMLWriter; |
|
6
|
|
|
|
|
7
|
|
|
class DocPropsCore extends AbstractDecoratorWriter |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* @return \PhpOffice\Common\Adapter\Zip\ZipInterface |
|
11
|
|
|
* @throws \Exception |
|
12
|
|
|
*/ |
|
13
|
113 |
|
public function render() |
|
14
|
|
|
{ |
|
15
|
|
|
// Create XML writer |
|
16
|
113 |
|
$objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); |
|
17
|
|
|
|
|
18
|
|
|
// XML header |
|
19
|
113 |
|
$objWriter->startDocument('1.0', 'UTF-8', 'yes'); |
|
20
|
|
|
|
|
21
|
|
|
// cp:coreProperties |
|
22
|
113 |
|
$objWriter->startElement('cp:coreProperties'); |
|
23
|
113 |
|
$objWriter->writeAttribute('xmlns:cp', 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties'); |
|
24
|
113 |
|
$objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
|
25
|
113 |
|
$objWriter->writeAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/'); |
|
26
|
113 |
|
$objWriter->writeAttribute('xmlns:dcmitype', 'http://purl.org/dc/dcmitype/'); |
|
27
|
113 |
|
$objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
|
28
|
|
|
|
|
29
|
|
|
// dc:creator |
|
30
|
113 |
|
$objWriter->writeElement('dc:creator', $this->oPresentation->getDocumentProperties()->getCreator()); |
|
31
|
|
|
|
|
32
|
|
|
// cp:lastModifiedBy |
|
33
|
113 |
|
$objWriter->writeElement('cp:lastModifiedBy', $this->oPresentation->getDocumentProperties()->getLastModifiedBy()); |
|
34
|
|
|
|
|
35
|
|
|
// dcterms:created |
|
36
|
113 |
|
$objWriter->startElement('dcterms:created'); |
|
37
|
113 |
|
$objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF'); |
|
38
|
113 |
|
$objWriter->writeRaw(gmdate("Y-m-d\TH:i:s\Z", $this->oPresentation->getDocumentProperties()->getCreated())); |
|
39
|
113 |
|
$objWriter->endElement(); |
|
40
|
|
|
|
|
41
|
|
|
// dcterms:modified |
|
42
|
113 |
|
$objWriter->startElement('dcterms:modified'); |
|
43
|
113 |
|
$objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF'); |
|
44
|
113 |
|
$objWriter->writeRaw(gmdate("Y-m-d\TH:i:s\Z", $this->oPresentation->getDocumentProperties()->getModified())); |
|
45
|
113 |
|
$objWriter->endElement(); |
|
46
|
|
|
|
|
47
|
|
|
// dc:title |
|
48
|
113 |
|
$objWriter->writeElement('dc:title', $this->oPresentation->getDocumentProperties()->getTitle()); |
|
49
|
|
|
|
|
50
|
|
|
// dc:description |
|
51
|
113 |
|
$objWriter->writeElement('dc:description', $this->oPresentation->getDocumentProperties()->getDescription()); |
|
52
|
|
|
|
|
53
|
|
|
// dc:subject |
|
54
|
113 |
|
$objWriter->writeElement('dc:subject', $this->oPresentation->getDocumentProperties()->getSubject()); |
|
55
|
|
|
|
|
56
|
|
|
// cp:keywords |
|
57
|
113 |
|
$objWriter->writeElement('cp:keywords', $this->oPresentation->getDocumentProperties()->getKeywords()); |
|
58
|
|
|
|
|
59
|
|
|
// cp:category |
|
60
|
113 |
|
$objWriter->writeElement('cp:category', $this->oPresentation->getDocumentProperties()->getCategory()); |
|
61
|
|
|
|
|
62
|
113 |
|
if ($this->oPresentation->getPresentationProperties()->isMarkedAsFinal()) { |
|
63
|
|
|
// cp:contentStatus = Final |
|
64
|
2 |
|
$objWriter->writeElement('cp:contentStatus', 'Final'); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
113 |
|
$objWriter->endElement(); |
|
68
|
|
|
|
|
69
|
113 |
|
$this->oZip->addFromString('docProps/core.xml', $objWriter->getData()); |
|
70
|
|
|
|
|
71
|
|
|
// Return |
|
72
|
113 |
|
return $this->oZip; |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|