コード例 #1
0
ファイル: IdmlPackage.php プロジェクト: skypeter1/webapps
 /** Quickly scan the spreads to determine how many pages are in this package. This is suitable for use
  *  by IdmlAssembler::preparation(), but not by IdmlAssembler::assembler().
  * 
  *  @return int $pageCount
  */
 public function determinePageCount()
 {
     $pageCount = 0;
     // The designmap contains references to everything in the package
     $designmap = $this->tempDir . '/designmap.xml';
     if (!file_exists($designmap)) {
         $this->idmlAssembler->getProgressUpdater()->setWarning("{$designmap} does not exist.");
         return false;
     }
     // create DOMDocument and DOMXPath objects
     $doc = new DomDocument();
     $b = $doc->load($designmap);
     if ($b === false) {
         return false;
     }
     $xpath = new DOMXPath($doc);
     // There are most likely many Spread files, and they are ordered in the designmap
     // according to the book's page ordering.
     $tags = $xpath->query('//idPkg:Spread');
     foreach ($tags as $tag) {
         $attr = $tag->attributes->getNamedItem('src');
         $filename = "{$this->tempDir}/{$attr->value}";
         $obj = new IdmlSpread($this);
         $pageCount += $obj->determinePageCount($filename);
     }
     return $pageCount;
 }
コード例 #2
0
 /** The constructor
  * @param IdmlPackage $idmlPackage is the parent object
  */
 public function __construct($idmlPackage)
 {
     parent::__construct($idmlPackage);
     $this->xmlRootName = 'MasterSpread';
 }