示例#1
0
 /**
  * Serve the cover thumbnail for a published monograph.
  */
 function thumbnail($args, $request)
 {
     // use ASSOC_TYPE_MONOGRAPH to set the cover at any workflow stage
     // i.e. also if the monograph has not been published yet
     $monograph = $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
     $publishedMonographDao = DAORegistry::getDAO('PublishedMonographDAO');
     $publishedMonograph = $publishedMonographDao->getById($monograph->getId(), null, false);
     if (!$publishedMonograph || !($coverImage = $publishedMonograph->getCoverImage())) {
         // Can't use Request::redirectUrl; FireFox doesn't
         // seem to like it for images.
         header('Location: ' . $request->getBaseUrl() . '/templates/images/book-default-small.png');
         exit;
     }
     import('classes.file.SimpleMonographFileManager');
     $simpleMonographFileManager = new SimpleMonographFileManager($publishedMonograph->getPressId(), $publishedMonograph->getId());
     $simpleMonographFileManager->downloadFile($simpleMonographFileManager->getBasePath() . $coverImage['thumbnailName'], null, true);
 }
示例#2
0
 /**
  * Serve the cover catalog image for a published monograph.
  */
 function catalog($args, $request)
 {
     $publishedMonograph = $this->getAuthorizedContextObject(ASSOC_TYPE_PUBLISHED_MONOGRAPH);
     if (!($coverImage = $publishedMonograph->getCoverImage())) {
         // Can't use Request::redirectUrl; FireFox doesn't
         // seem to like it for images.
         header('Location: ' . $request->getBaseUrl() . '/templates/images/book-default.png');
         exit;
     }
     import('classes.file.SimpleMonographFileManager');
     $simpleMonographFileManager = new SimpleMonographFileManager($publishedMonograph->getPressId(), $publishedMonograph->getId());
     $simpleMonographFileManager->downloadFile($simpleMonographFileManager->getBasePath() . $coverImage['catalogName'], null, true);
 }