Deprecation: 0.7
Inheritance: extends AbstractLayoutPack
 /**
  * Write presentation relationships to XML format
  *
  * @return string        XML Output
  * @throws \Exception
  */
 public function writePresentationRelationships()
 {
     // Create XML writer
     $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8', 'yes');
     // Relationships
     $objWriter->startElement('Relationships');
     $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
     // Relation id
     $relationId = 1;
     $oLayoutPack = new PackDefault();
     $masterSlides = $oLayoutPack->getMasterSlides();
     foreach ($masterSlides as $masterSlide) {
         // Relationship slideMasters/slideMasterX.xml
         $this->writeRelationship($objWriter, $relationId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster', 'slideMasters/slideMaster' . $masterSlide['masterid'] . '.xml');
     }
     // Add slide theme (only one!)
     // Relationship theme/theme1.xml
     $this->writeRelationship($objWriter, $relationId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', 'theme/theme1.xml');
     // Relationships with slides
     $slideCount = $this->getPresentation()->getSlideCount();
     for ($i = 0; $i < $slideCount; ++$i) {
         $this->writeRelationship($objWriter, $relationId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slides/slide' . ($i + 1) . '.xml');
     }
     $this->writeRelationship($objWriter, $relationId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps', 'presProps.xml');
     $this->writeRelationship($objWriter, $relationId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps', 'viewProps.xml');
     $this->writeRelationship($objWriter, $relationId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles', 'tableStyles.xml');
     $objWriter->endElement();
     // Return
     return $objWriter->getData();
 }
Exemple #2
0
 /**
  * Write theme relationships to XML format
  *
  * @param  int       $masterId Master slide id
  * @return string    XML Output
  * @throws \Exception
  */
 public function writeThemeRelationships($masterId = 1)
 {
     // Create XML writer
     $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
     // Layout pack
     $oLayoutPack = new PackDefault();
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8', 'yes');
     // Relationships
     $objWriter->startElement('Relationships');
     $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
     // Other relationships
     $otherRelations = $oLayoutPack->getThemeRelations();
     foreach ($otherRelations as $otherRelation) {
         if ($otherRelation['masterid'] == $masterId) {
             $this->writeRelationship($objWriter, $otherRelation['id'], $otherRelation['type'], $otherRelation['target']);
         }
     }
     $objWriter->endElement();
     // Return
     return $objWriter->getData();
 }
 /**
  * Write slide layout relationships to XML format
  *
  * @param  int       $slideLayoutIndex
  * @param  int       $masterId
  * @return string    XML Output
  * @throws \Exception
  */
 public function writeSlideLayoutRelationships($slideLayoutIndex, $masterId = 1)
 {
     // Create XML writer
     $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
     // Layout pack
     $oLayoutPack = new PackDefault();
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8', 'yes');
     // Relationships
     $objWriter->startElement('Relationships');
     $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
     // Write slideMaster relationship
     $this->writeRelationship($objWriter, 1, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster', '../slideMasters/slideMaster' . $masterId . '.xml');
     // Other relationships
     foreach ($oLayoutPack->getLayoutRelations() as $otherRelation) {
         if ($otherRelation['layoutId'] == $slideLayoutIndex) {
             $this->writeRelationship($objWriter, $otherRelation['id'], $otherRelation['type'], $otherRelation['target']);
         }
     }
     $objWriter->endElement();
     // Return
     return $objWriter->getData();
 }
 /**
  * Write slide master relationships to XML format
  *
  * @param  int       $masterId Master slide id
  * @return string    XML Output
  * @throws \Exception
  */
 public function writeSlideMasterRelationships($masterId = 1)
 {
     // Create XML writer
     $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8', 'yes');
     // Relationships
     $objWriter->startElement('Relationships');
     $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
     // Keep content id
     $contentId = 0;
     // Lookup layouts
     $layouts = array();
     $oLayoutPack = new PackDefault();
     foreach ($oLayoutPack->getLayouts() as $key => $layout) {
         if ($layout['masterid'] == $masterId) {
             $layouts[$key] = $layout;
         }
     }
     // Write slideLayout relationships
     foreach ($layouts as $key => $layout) {
         $this->writeRelationship($objWriter, ++$contentId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout', '../slideLayouts/slideLayout' . $key . '.xml');
     }
     // Relationship theme/theme1.xml
     $this->writeRelationship($objWriter, ++$contentId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', '../theme/theme' . $masterId . '.xml');
     // Other relationships
     $otherRelations = $oLayoutPack->getMasterSlideRelations();
     foreach ($otherRelations as $otherRelation) {
         if ($otherRelation['masterid'] == $masterId) {
             $this->writeRelationship($objWriter, ++$contentId, $otherRelation['type'], $otherRelation['target']);
         }
     }
     $objWriter->endElement();
     // Return
     return $objWriter->getData();
 }
 /**
  * @return \PhpOffice\Common\Adapter\Zip\ZipInterface
  */
 public function render()
 {
     // Create XML writer
     $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8', 'yes');
     // p:presentation
     $objWriter->startElement('p:presentation');
     $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
     $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
     $objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main');
     // p:sldMasterIdLst
     $objWriter->startElement('p:sldMasterIdLst');
     // Add slide masters
     $relationId = 1;
     $slideMasterId = 2147483648.0;
     $oLayoutPack = new PackDefault();
     $masterSlides = $oLayoutPack->getMasterSlides();
     $masterSlidesCount = count($masterSlides);
     // @todo foreach ($masterSlides as $masterSlide)
     for ($i = 0; $i < $masterSlidesCount; $i++) {
         // p:sldMasterId
         $objWriter->startElement('p:sldMasterId');
         $objWriter->writeAttribute('id', $slideMasterId);
         $objWriter->writeAttribute('r:id', 'rId' . $relationId++);
         $objWriter->endElement();
         // Increase identifier
         $slideMasterId += 12;
     }
     $objWriter->endElement();
     // theme
     $relationId++;
     // p:sldIdLst
     $objWriter->startElement('p:sldIdLst');
     // Write slides
     $slideCount = $this->oPresentation->getSlideCount();
     for ($i = 0; $i < $slideCount; ++$i) {
         // p:sldId
         $objWriter->startElement('p:sldId');
         $objWriter->writeAttribute('id', $i + 256);
         $objWriter->writeAttribute('r:id', 'rId' . ($i + $relationId));
         $objWriter->endElement();
     }
     $objWriter->endElement();
     // p:sldSz
     $objWriter->startElement('p:sldSz');
     $objWriter->writeAttribute('cx', $this->oPresentation->getLayout()->getCX());
     $objWriter->writeAttribute('cy', $this->oPresentation->getLayout()->getCY());
     if ($this->oPresentation->getLayout()->getDocumentLayout() != DocumentLayout::LAYOUT_CUSTOM) {
         $objWriter->writeAttribute('type', $this->oPresentation->getLayout()->getDocumentLayout());
     }
     $objWriter->endElement();
     // p:notesSz
     $objWriter->startElement('p:notesSz');
     $objWriter->writeAttribute('cx', '6858000');
     $objWriter->writeAttribute('cy', '9144000');
     $objWriter->endElement();
     $objWriter->endElement();
     $this->oZip->addFromString('ppt/presentation.xml', $objWriter->getData());
     // Return
     return $this->oZip;
 }
 /**
  * @expectedException \Exception
  */
 public function testFindLayoutNameException()
 {
     $oLayout = new PackDefault();
     $oLayout->findLayoutName(1000);
 }
Exemple #7
0
 /**
  * Write slide relationships to XML format
  *
  * @param  \PhpOffice\PhpPresentation\Slide $pSlide
  * @return string              XML Output
  * @throws \Exception
  */
 protected function writeSlideRelationships(Slide $pSlide)
 {
     // Create XML writer
     $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8', 'yes');
     // Relationships
     $objWriter->startElement('Relationships');
     $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
     // Starting relation id
     $relId = 1;
     $idxSlide = $pSlide->getParent()->getIndex($pSlide);
     // Write slideLayout relationship
     $oLayoutPack = new PackDefault();
     $layoutId = $oLayoutPack->findlayoutId($pSlide->getSlideLayout(), $pSlide->getSlideMasterId());
     $this->writeRelationship($objWriter, $relId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout', '../slideLayouts/slideLayout' . $layoutId . '.xml');
     // Write drawing relationships?
     if ($pSlide->getShapeCollection()->count() > 0) {
         // Loop trough images and write relationships
         $iterator = $pSlide->getShapeCollection()->getIterator();
         while ($iterator->valid()) {
             if ($iterator->current() instanceof ShapeDrawing || $iterator->current() instanceof MemoryDrawing) {
                 // Write relationship for image drawing
                 $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . str_replace(' ', '_', $iterator->current()->getIndexedFilename()));
                 $iterator->current()->relationId = 'rId' . $relId;
                 ++$relId;
             } elseif ($iterator->current() instanceof ShapeChart) {
                 // Write relationship for chart drawing
                 $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', '../charts/' . $iterator->current()->getIndexedFilename());
                 $iterator->current()->relationId = 'rId' . $relId;
                 ++$relId;
             } elseif ($iterator->current() instanceof Group) {
                 $iterator2 = $iterator->current()->getShapeCollection()->getIterator();
                 while ($iterator2->valid()) {
                     if ($iterator2->current() instanceof ShapeDrawing || $iterator2->current() instanceof MemoryDrawing) {
                         // Write relationship for image drawing
                         $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . str_replace(' ', '_', $iterator2->current()->getIndexedFilename()));
                         $iterator2->current()->relationId = 'rId' . $relId;
                         ++$relId;
                     } elseif ($iterator2->current() instanceof ShapeChart) {
                         // Write relationship for chart drawing
                         $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', '../charts/' . $iterator2->current()->getIndexedFilename());
                         $iterator2->current()->relationId = 'rId' . $relId;
                         ++$relId;
                     }
                     $iterator2->next();
                 }
             }
             $iterator->next();
         }
     }
     // Write background relationships?
     $oBackground = $pSlide->getBackground();
     if ($oBackground instanceof Image) {
         $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $oBackground->getIndexedFilename($idxSlide));
         $oBackground->relationId = 'rId' . $relId;
         ++$relId;
     }
     // Write hyperlink relationships?
     if ($pSlide->getShapeCollection()->count() > 0) {
         // Loop trough hyperlinks and write relationships
         $iterator = $pSlide->getShapeCollection()->getIterator();
         while ($iterator->valid()) {
             // Hyperlink on shape
             if ($iterator->current()->hasHyperlink()) {
                 // Write relationship for hyperlink
                 $hyperlink = $iterator->current()->getHyperlink();
                 $hyperlink->relationId = 'rId' . $relId;
                 if (!$hyperlink->isInternal()) {
                     $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External');
                 } else {
                     $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml');
                 }
                 ++$relId;
             }
             // Hyperlink on rich text run
             if ($iterator->current() instanceof RichText) {
                 foreach ($iterator->current()->getParagraphs() as $paragraph) {
                     foreach ($paragraph->getRichTextElements() as $element) {
                         if ($element instanceof Run || $element instanceof RunTextElement) {
                             if ($element->hasHyperlink()) {
                                 // Write relationship for hyperlink
                                 $hyperlink = $element->getHyperlink();
                                 $hyperlink->relationId = 'rId' . $relId;
                                 if (!$hyperlink->isInternal()) {
                                     $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External');
                                 } else {
                                     $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml');
                                 }
                                 ++$relId;
                             }
                         }
                     }
                 }
             }
             // Hyperlink in table
             if ($iterator->current() instanceof ShapeTable) {
                 // Rows
                 $countRows = count($iterator->current()->getRows());
                 for ($row = 0; $row < $countRows; $row++) {
                     // Cells in rows
                     $countCells = count($iterator->current()->getRow($row)->getCells());
                     for ($cell = 0; $cell < $countCells; $cell++) {
                         $currentCell = $iterator->current()->getRow($row)->getCell($cell);
                         // Paragraphs in cell
                         foreach ($currentCell->getParagraphs() as $paragraph) {
                             // RichText in paragraph
                             foreach ($paragraph->getRichTextElements() as $element) {
                                 // Run or Text in RichText
                                 if ($element instanceof Run || $element instanceof TextElement) {
                                     if ($element->hasHyperlink()) {
                                         // Write relationship for hyperlink
                                         $hyperlink = $element->getHyperlink();
                                         $hyperlink->relationId = 'rId' . $relId;
                                         if (!$hyperlink->isInternal()) {
                                             $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External');
                                         } else {
                                             $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml');
                                         }
                                         ++$relId;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             if ($iterator->current() instanceof Group) {
                 $iterator2 = $pSlide->getShapeCollection()->getIterator();
                 while ($iterator2->valid()) {
                     // Hyperlink on shape
                     if ($iterator2->current()->hasHyperlink()) {
                         // Write relationship for hyperlink
                         $hyperlink = $iterator2->current()->getHyperlink();
                         $hyperlink->relationId = 'rId' . $relId;
                         if (!$hyperlink->isInternal()) {
                             $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External');
                         } else {
                             $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml');
                         }
                         ++$relId;
                     }
                     // Hyperlink on rich text run
                     if ($iterator2->current() instanceof RichText) {
                         foreach ($iterator2->current()->getParagraphs() as $paragraph) {
                             foreach ($paragraph->getRichTextElements() as $element) {
                                 if ($element instanceof Run || $element instanceof TextElement) {
                                     if ($element->hasHyperlink()) {
                                         // Write relationship for hyperlink
                                         $hyperlink = $element->getHyperlink();
                                         $hyperlink->relationId = 'rId' . $relId;
                                         if (!$hyperlink->isInternal()) {
                                             $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External');
                                         } else {
                                             $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml');
                                         }
                                         ++$relId;
                                     }
                                 }
                             }
                         }
                     }
                     // Hyperlink in table
                     if ($iterator2->current() instanceof ShapeTable) {
                         // Rows
                         $countRows = count($iterator2->current()->getRows());
                         for ($row = 0; $row < $countRows; $row++) {
                             // Cells in rows
                             $countCells = count($iterator2->current()->getRow($row)->getCells());
                             for ($cell = 0; $cell < $countCells; $cell++) {
                                 $currentCell = $iterator2->current()->getRow($row)->getCell($cell);
                                 // Paragraphs in cell
                                 foreach ($currentCell->getParagraphs() as $paragraph) {
                                     // RichText in paragraph
                                     foreach ($paragraph->getRichTextElements() as $element) {
                                         // Run or Text in RichText
                                         if ($element instanceof Run || $element instanceof TextElement) {
                                             if ($element->hasHyperlink()) {
                                                 // Write relationship for hyperlink
                                                 $hyperlink = $element->getHyperlink();
                                                 $hyperlink->relationId = 'rId' . $relId;
                                                 if (!$hyperlink->isInternal()) {
                                                     $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External');
                                                 } else {
                                                     $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml');
                                                 }
                                                 ++$relId;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     $iterator2->next();
                 }
             }
             $iterator->next();
         }
     }
     if ($pSlide->getNote()->getShapeCollection()->count() > 0) {
         $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide', '../notesSlides/notesSlide' . ($idxSlide + 1) . '.xml');
     }
     $objWriter->endElement();
     // Return
     return $objWriter->getData();
 }
 /**
  * @return \PhpOffice\Common\Adapter\Zip\ZipInterface
  * @throws \Exception
  */
 public function render()
 {
     $oLayoutPack = new PowerPoint2007\LayoutPack\PackDefault();
     // Create XML writer
     $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8', 'yes');
     // Types
     $objWriter->startElement('Types');
     $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
     // Rels
     $this->writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml');
     // XML
     $this->writeDefaultContentType($objWriter, 'xml', 'application/xml');
     // Themes
     $masterSlides = $oLayoutPack->getMasterSlides();
     foreach ($masterSlides as $masterSlide) {
         $this->writeOverrideContentType($objWriter, '/ppt/theme/theme' . $masterSlide['masterid'] . '.xml', 'application/vnd.openxmlformats-officedocument.theme+xml');
     }
     // Presentation
     $this->writeOverrideContentType($objWriter, '/ppt/presentation.xml', 'application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml');
     // PptProps
     $this->writeOverrideContentType($objWriter, '/ppt/presProps.xml', 'application/vnd.openxmlformats-officedocument.presentationml.presProps+xml');
     $this->writeOverrideContentType($objWriter, '/ppt/tableStyles.xml', 'application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml');
     $this->writeOverrideContentType($objWriter, '/ppt/viewProps.xml', 'application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml');
     // DocProps
     $this->writeOverrideContentType($objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml');
     $this->writeOverrideContentType($objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml');
     $this->writeOverrideContentType($objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml');
     // Slide masters
     $masterSlides = $oLayoutPack->getMasterSlides();
     foreach ($masterSlides as $masterSlide) {
         $this->writeOverrideContentType($objWriter, '/ppt/slideMasters/slideMaster' . $masterSlide['masterid'] . '.xml', 'application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml');
     }
     // Slide layouts
     $slideLayouts = $oLayoutPack->getLayouts();
     $numSlideLayouts = count($slideLayouts);
     for ($i = 0; $i < $numSlideLayouts; ++$i) {
         $this->writeOverrideContentType($objWriter, '/ppt/slideLayouts/slideLayout' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml');
     }
     // Slides
     $slideCount = $this->oPresentation->getSlideCount();
     for ($i = 0; $i < $slideCount; ++$i) {
         $this->writeOverrideContentType($objWriter, '/ppt/slides/slide' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.presentationml.slide+xml');
         if ($this->oPresentation->getSlide($i)->getNote()->getShapeCollection()->count() > 0) {
             $this->writeOverrideContentType($objWriter, '/ppt/notesSlides/notesSlide' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml');
         }
     }
     // Add layoutpack content types
     $otherRelations = $oLayoutPack->getMasterSlideRelations();
     foreach ($otherRelations as $otherRelation) {
         if (strpos($otherRelation['target'], 'http://') !== 0 && $otherRelation['contentType'] != '') {
             $this->writeOverrideContentType($objWriter, '/ppt/slideMasters/' . $otherRelation['target'], $otherRelation['contentType']);
         }
     }
     $otherRelations = $oLayoutPack->getThemeRelations();
     foreach ($otherRelations as $otherRelation) {
         if (strpos($otherRelation['target'], 'http://') !== 0 && $otherRelation['contentType'] != '') {
             $this->writeOverrideContentType($objWriter, '/ppt/theme/' . $otherRelation['target'], $otherRelation['contentType']);
         }
     }
     $otherRelations = $oLayoutPack->getLayoutRelations();
     foreach ($otherRelations as $otherRelation) {
         if (strpos($otherRelation['target'], 'http://') !== 0 && $otherRelation['contentType'] != '') {
             $this->writeOverrideContentType($objWriter, '/ppt/slideLayouts/' . $otherRelation['target'], $otherRelation['contentType']);
         }
     }
     // Add media content-types
     $aMediaContentTypes = array();
     // GIF, JPEG, PNG
     $aMediaContentTypes['gif'] = 'image/gif';
     $aMediaContentTypes['jpg'] = 'image/jpeg';
     $aMediaContentTypes['jpeg'] = 'image/jpeg';
     $aMediaContentTypes['png'] = 'image/png';
     foreach ($aMediaContentTypes as $key => $value) {
         $this->writeDefaultContentType($objWriter, $key, $value);
     }
     // XLSX
     $this->writeDefaultContentType($objWriter, 'xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     // Other media content types
     $mediaCount = $this->getDrawingHashTable()->count();
     for ($i = 0; $i < $mediaCount; ++$i) {
         $extension = '';
         $mimeType = '';
         $shapeIndex = $this->getDrawingHashTable()->getByIndex($i);
         if ($shapeIndex instanceof ShapeChart) {
             // Chart content type
             $this->writeOverrideContentType($objWriter, '/ppt/charts/chart' . $shapeIndex->getImageIndex() . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml');
         } else {
             if ($shapeIndex instanceof ShapeDrawing) {
                 $extension = strtolower($shapeIndex->getExtension());
                 $mimeType = $this->getImageMimeType($shapeIndex->getPath());
             } elseif ($shapeIndex instanceof MemoryDrawing) {
                 $extension = strtolower($shapeIndex->getMimeType());
                 $extension = explode('/', $extension);
                 $extension = $extension[1];
                 $mimeType = $shapeIndex->getMimeType();
             }
             if (!isset($aMediaContentTypes[$extension])) {
                 $aMediaContentTypes[$extension] = $mimeType;
                 $this->writeDefaultContentType($objWriter, $extension, $mimeType);
             }
         }
     }
     $objWriter->endElement();
     $this->oZip->addFromString('[Content_Types].xml', $objWriter->getData());
     return $this->oZip;
 }