PHPPowerPoint_Writer_PowerPoint2007
[ class tree: PHPPowerPoint_Writer_PowerPoint2007 ] [ index: PHPPowerPoint_Writer_PowerPoint2007 ] [ all elements ]

Source for file DocProps.php

Documentation is available at DocProps.php

  1. <?php
  2. /**
  3.  * PHPPowerPoint
  4.  *
  5.  * Copyright (c) 2009 - 2010 PHPPowerPoint
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPPowerPoint
  22.  * @package    PHPPowerPoint_Writer_PowerPoint2007
  23.  * @copyright  Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    0.1.0, 2009-04-27
  26.  */
  27.  
  28.  
  29. /** PHPPowerPoint */
  30. require_once 'PHPPowerPoint.php';
  31.  
  32. /** PHPPowerPoint_Writer_PowerPoint2007 */
  33. require_once 'PHPPowerPoint/Writer/PowerPoint2007.php';
  34.  
  35. /** PHPPowerPoint_Writer_PowerPoint2007_WriterPart */
  36. require_once 'PHPPowerPoint/Writer/PowerPoint2007/WriterPart.php';
  37.  
  38. /** PHPPowerPoint_Shared_XMLWriter */
  39. require_once 'PHPPowerPoint/Shared/XMLWriter.php';
  40.  
  41.  
  42. /**
  43.  * PHPPowerPoint_Writer_PowerPoint2007_DocProps
  44.  *
  45.  * @category   PHPPowerPoint
  46.  * @package    PHPPowerPoint_Writer_PowerPoint2007
  47.  * @copyright  Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
  48.  */
  49. {
  50. /**
  51.      * Write docProps/app.xml to XML format
  52.      *
  53.      * @param     PHPPowerPoint    $pPHPPowerPoint 
  54.      * @return     string         XML Output
  55.      * @throws     Exception
  56.      */
  57.     public function writeDocPropsApp(PHPPowerPoint $pPHPPowerPoint null)
  58.     {
  59.         // Create XML writer
  60.         $objWriter null;
  61.         if ($this->getParentWriter()->getUseDiskCaching()) {
  62.             $objWriter new PHPPowerPoint_Shared_XMLWriter(PHPPowerPoint_Shared_XMLWriter::STORAGE_DISK$this->getParentWriter()->getDiskCachingDirectory());
  63.         else {
  64.             $objWriter new PHPPowerPoint_Shared_XMLWriter(PHPPowerPoint_Shared_XMLWriter::STORAGE_MEMORY);
  65.         }
  66.  
  67.         // XML header
  68.         $objWriter->startDocument('1.0','UTF-8','yes');
  69.  
  70.         // Properties
  71.         $objWriter->startElement('Properties');
  72.         $objWriter->writeAttribute('xmlns''http://schemas.openxmlformats.org/officeDocument/2006/extended-properties');
  73.         $objWriter->writeAttribute('xmlns:vt''http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
  74.  
  75.             // Application
  76.             $objWriter->writeElement('Application',     'Microsoft Office PowerPoint');
  77.  
  78.             // Slides
  79.             $objWriter->writeElement('Slides',     $pPHPPowerPoint->getSlideCount());
  80.  
  81.             // ScaleCrop
  82.             $objWriter->writeElement('ScaleCrop',         'false');
  83.  
  84.             // HeadingPairs
  85.             $objWriter->startElement('HeadingPairs');
  86.  
  87.                 // Vector
  88.                 $objWriter->startElement('vt:vector');
  89.                 $objWriter->writeAttribute('size',         '4');
  90.                 $objWriter->writeAttribute('baseType',     'variant');
  91.  
  92.                     // Variant
  93.                     $objWriter->startElement('vt:variant');
  94.                         $objWriter->writeElement('vt:lpstr',     'Theme');
  95.                     $objWriter->endElement();
  96.  
  97.                     // Variant
  98.                     $objWriter->startElement('vt:variant');
  99.                         $objWriter->writeElement('vt:i4',         '1');
  100.                     $objWriter->endElement();
  101.                     
  102.                     // Variant
  103.                     $objWriter->startElement('vt:variant');
  104.                         $objWriter->writeElement('vt:lpstr',     'Slide Titles');
  105.                     $objWriter->endElement();
  106.  
  107.                     // Variant
  108.                     $objWriter->startElement('vt:variant');
  109.                         $objWriter->writeElement('vt:i4',         '1');
  110.                     $objWriter->endElement();
  111.  
  112.                 $objWriter->endElement();
  113.  
  114.             $objWriter->endElement();
  115.  
  116.             // TitlesOfParts
  117.             $objWriter->startElement('TitlesOfParts');
  118.  
  119.                 // Vector
  120.                 $objWriter->startElement('vt:vector');
  121.                 $objWriter->writeAttribute('size',         '1');
  122.                 $objWriter->writeAttribute('baseType',    'lpstr');
  123.  
  124.                     $objWriter->writeElement('vt:lpstr',     'Office Theme');
  125.  
  126.                 $objWriter->endElement();
  127.  
  128.             $objWriter->endElement();
  129.  
  130.             // Company
  131.             $objWriter->writeElement('Company',             'Microsoft Corporation');
  132.  
  133.             // LinksUpToDate
  134.             $objWriter->writeElement('LinksUpToDate',         'false');
  135.  
  136.             // SharedDoc
  137.             $objWriter->writeElement('SharedDoc',             'false');
  138.  
  139.             // HyperlinksChanged
  140.             $objWriter->writeElement('HyperlinksChanged',     'false');
  141.  
  142.             // AppVersion
  143.             $objWriter->writeElement('AppVersion',             '12.0000');
  144.  
  145.         $objWriter->endElement();
  146.  
  147.         // Return
  148.         return $objWriter->getData();
  149.     }
  150.  
  151.     /**
  152.      * Write docProps/core.xml to XML format
  153.      *
  154.      * @param     PHPPowerPoint    $pPHPPowerPoint 
  155.      * @return     string         XML Output
  156.      * @throws     Exception
  157.      */
  158.     public function writeDocPropsCore(PHPPowerPoint $pPHPPowerPoint null)
  159.     {
  160.         // Create XML writer
  161.         $objWriter null;
  162.         if ($this->getParentWriter()->getUseDiskCaching()) {
  163.             $objWriter new PHPPowerPoint_Shared_XMLWriter(PHPPowerPoint_Shared_XMLWriter::STORAGE_DISK$this->getParentWriter()->getDiskCachingDirectory());
  164.         else {
  165.             $objWriter new PHPPowerPoint_Shared_XMLWriter(PHPPowerPoint_Shared_XMLWriter::STORAGE_MEMORY);
  166.         }
  167.  
  168.         // XML header
  169.         $objWriter->startDocument('1.0','UTF-8','yes');
  170.  
  171.         // cp:coreProperties
  172.         $objWriter->startElement('cp:coreProperties');
  173.         $objWriter->writeAttribute('xmlns:cp''http://schemas.openxmlformats.org/package/2006/metadata/core-properties');
  174.         $objWriter->writeAttribute('xmlns:dc''http://purl.org/dc/elements/1.1/');
  175.         $objWriter->writeAttribute('xmlns:dcterms''http://purl.org/dc/terms/');
  176.         $objWriter->writeAttribute('xmlns:dcmitype''http://purl.org/dc/dcmitype/');
  177.         $objWriter->writeAttribute('xmlns:xsi''http://www.w3.org/2001/XMLSchema-instance');
  178.  
  179.             // dc:creator
  180.             $objWriter->writeElement('dc:creator',            $pPHPPowerPoint->getProperties()->getCreator());
  181.  
  182.             // cp:lastModifiedBy
  183.             $objWriter->writeElement('cp:lastModifiedBy',     $pPHPPowerPoint->getProperties()->getLastModifiedBy());
  184.  
  185.             // dcterms:created
  186.             $objWriter->startElement('dcterms:created');
  187.             $objWriter->writeAttribute('xsi:type''dcterms:W3CDTF');
  188.             $objWriter->writeRaw(date(DATE_W3C,             $pPHPPowerPoint->getProperties()->getCreated()));
  189.             $objWriter->endElement();
  190.  
  191.             // dcterms:modified
  192.             $objWriter->startElement('dcterms:modified');
  193.             $objWriter->writeAttribute('xsi:type''dcterms:W3CDTF');
  194.             $objWriter->writeRaw(date(DATE_W3C,             $pPHPPowerPoint->getProperties()->getModified()));
  195.             $objWriter->endElement();
  196.  
  197.             // dc:title
  198.             $objWriter->writeElement('dc:title',             $pPHPPowerPoint->getProperties()->getTitle());
  199.  
  200.             // dc:description
  201.             $objWriter->writeElement('dc:description',         $pPHPPowerPoint->getProperties()->getDescription());
  202.  
  203.             // dc:subject
  204.             $objWriter->writeElement('dc:subject',             $pPHPPowerPoint->getProperties()->getSubject());
  205.  
  206.             // cp:keywords
  207.             $objWriter->writeElement('cp:keywords',         $pPHPPowerPoint->getProperties()->getKeywords());
  208.  
  209.             // cp:category
  210.             $objWriter->writeElement('cp:category',         $pPHPPowerPoint->getProperties()->getCategory());
  211.  
  212.         $objWriter->endElement();
  213.  
  214.         // Return
  215.         return $objWriter->getData();
  216.     }
  217. }

Documentation generated on Sat, 25 Apr 2009 11:37:02 +0200 by phpDocumentor 1.4.1