示例#1
0
 /**
  * Primary processor
  * @return bool|void
  */
 public function process()
 {
     // Set parent process
     parent::process();
     // Validate the book source type
     $this->checkBookSourceType(self::BOOK_SOURCE_TYPE_IDML);
     // Get book source files
     $this->getBookSourceFiles();
     // Initialize ePub structure
     $this->initLocalEpub();
     // Start up the routine
     $rc = $this->processBook();
     // Copy the image files, both those uploaded by the user, and those created by the IDML processing, to the ePub and its manifest
     $this->importSourceAssets();
     $this->setCoverImage();
     // Update ePub files
     $this->epub->updateEpubFiles();
     // Copy book to S3
     $this->publishBookDir();
     // Generate thumbnails
     $this->generateThumbnails(1, $this->getPageCount());
     // Set process complete
     $this->processComplete();
     // Return success
     return $rc;
 }
示例#2
0
 /**
  * Primary processor
  * @return bool|void
  */
 public function process()
 {
     // Set parent process
     parent::process();
     // Initialize ePub structure
     $this->epub->initEpub();
     // Get book source files
     $this->getBookSourceFiles();
     // Start up the routine
     $this->processBook();
     //handle any extra files included with the book
     $this->importSourceAssets();
     // Update ePub files
     $this->epub->updateEpubFiles();
     // Set process complete
     $this->processComplete();
     // Return success
     return TRUE;
 }
示例#3
0
 /**
  * Primary processor
  * @return bool|void
  */
 public function process()
 {
     // Set parent process
     parent::process();
     // Validate the book source type
     $this->checkBookSourceType(self::BOOK_SOURCE_TYPE_WORD);
     // Get book source files
     $this->getBookSourceFiles(self::BOOK_SOURCE_TYPE_WORD);
     // Initialize ePub structure
     $this->initLocalEpub();
     // Start up the routine
     $this->processBook();
     // Update ePub files
     $this->epub->updateEpubFiles();
     //copy book to S3
     $this->publishBookDir();
     // Generate thumbnails
     $this->generateThumbnails(1, $this->getPageCount());
     // Set process complete
     $this->processComplete();
     // Return success
     return TRUE;
 }
示例#4
0
 /**
  * Primary processor
  * @return bool|void
  */
 public function process()
 {
     // Set parent process
     parent::process();
     // Validate the book source type
     $this->checkBookSourceType(self::BOOK_SOURCE_TYPE_EPUB);
     // Get book source files
     $this->getBookSourceFiles();
     // Start up the routine
     $this->processBook();
     // Set process complete
     $this->processComplete();
     // Return success
     return true;
 }
示例#5
0
 /**
  * copy new files into book directory by treating the importFiles array as additional assets
  */
 public function process()
 {
     if (!is_array($this->importFiles)) {
         throw new Exception('[BookFilesProcessor::process] Source book directory not set');
     }
     if (count($this->importFiles) == 0) {
         throw new Exception('[BookFilesProcessor::process] No source files found');
     }
     parent::process();
     $this->epub->initEpub();
     CakeLog::debug('[BookFilesProcessor::process] Copying ' . count($this->importFiles) . ' book files for ID ' . $this->bookId);
     foreach ($this->importFiles as $srcFile => $targetPath) {
         $ext = pathinfo($srcFile, PATHINFO_EXTENSION);
         if (in_array($ext, self::$supportedImageTypes)) {
             if (!strlen($targetPath)) {
                 $targetPath = 'images/';
             }
             CakeLog::debug('[ImportProcessor::importSourceAssets] Adding image file ' . $srcFile . ' to book in ' . $targetPath);
             $this->addImageAssetToBook($srcFile, $targetPath);
         } elseif (in_array($ext, self::$supportedFontTypes)) {
             CakeLog::debug('[ImportProcessor::importSourceAssets] Adding font file ' . $srcFile . ' to book in ' . $targetPath);
             $this->addFontToBook($srcFile);
         } elseif (in_array($ext, self::$supportedAudioTypes)) {
             if (!strlen($targetPath)) {
                 $targetPath = 'audio/';
             }
             CakeLog::debug('[ImportProcessor::importSourceAssets] Adding audio file ' . $srcFile . ' to book in ' . $targetPath);
             $this->addAudioAssetToBook($srcFile, $targetPath);
         } elseif (in_array($ext, self::$supportedVideoTypes)) {
             if (!strlen($targetPath)) {
                 $targetPath = 'video/';
             }
             CakeLog::debug('[ImportProcessor::importSourceAssets] Adding video file ' . $srcFile . ' to book in ' . $targetPath);
             $this->addVideoAssetToBook($srcFile, $targetPath);
         } else {
             switch ($ext) {
                 case 'js':
                     if (!strlen($targetPath)) {
                         $targetPath = 'js/';
                     }
                     CakeLog::debug('[ImportProcessor::importSourceAssets] Adding javascript file ' . $srcFile . ' to book in ' . $targetPath);
                     $this->addJavaScriptAssetToBook($srcFile, $targetPath);
                     break;
                 case 'css':
                     if (!strlen($targetPath)) {
                         $targetPath = 'styles/';
                     }
                     CakeLog::debug('[ImportProcessor::importSourceAssets] Adding css file ' . $srcFile . ' to book in ' . $targetPath);
                     $this->addCssAssetToBook($srcFile, $targetPath);
                     break;
                 default:
                     if (strlen($targetPath) > 0) {
                         CakeLog::debug('[ImportProcessor::importSourceAssets] Adding misc file ' . $srcFile . ' to book in ' . $targetPath);
                         $this->addMiscAssetToBook($srcFile, $targetPath);
                     }
                     break;
             }
         }
         $this->progress->incrementStep();
     }
     $this->epub->updateEpubFiles();
     $this->processComplete();
     CakeLog::debug('[BookFilesProcessor::process] Book id ' . $this->bookId . ' copy Complete');
     return true;
 }