dmBridge PHP API
DMPaginatedPDFViewer.php
00001 <?php
00002 #
00003 # dmBridge: a data access framework for CONTENTdm(R)
00004 #
00005 # Copyright © 2009, 2010, 2011 Board of Regents of the Nevada System of Higher
00006 # Education, on behalf of the University of Nevada, Las Vegas
00007 #
00008 
00023 class DMPaginatedPDFViewer extends DMAbstractViewer
00024 implements DMObjectViewerDelegate {
00025 
00026    function viewerWillRender() {
00027       $root_uri = dirname($_SERVER['PHP_SELF'])
00028          . "/system/viewers/DMPaginatedPDFViewer";
00029       
00030       $this->getHelper()->addStylesheetTag(
00031             $root_uri . "/styles/DMPaginatedPDFViewer.css");
00032       $this->getHelper()->addBodyScriptTag(
00033             "http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js");
00034       $this->getHelper()->addBodyScriptTag(
00035             $root_uri . "/scripts/DMPaginatedPDFViewer.js");
00036    }
00037 
00042    public function getHTMLTag() {
00043       $num_pages = ($this->getObject()->getFile() instanceof DMPDFFile)
00044             ? $this->getObject()->getFile()->getNumPages() : 0;
00045       return sprintf('<div class="DMPaginatedPDFViewer" style="width:%s; height:%s">
00046             <input type="hidden" name="fullPdfUri" value="%s"/>
00047             <input type="hidden" name="pdfGeneratorUri" value="%s"/>
00048             <input type="hidden" name="viewerBaseUri" value="%s/system/viewers/DMPaginatedPDFViewer"/>
00049             <input type="hidden" name="numPages" value="%d"/>
00050          </div>',
00051          $this->getWidth(),
00052          $this->getHeight(),
00053          $this->getObject()->getFileURL(),
00054          DMInternalURI::getURIWithParams("api/1/objects"
00055                . $this->getObject()->getCollection()->getAlias()
00056                . "/" . $this->getObject()->getPtr() . "/excerpt"),
00057          dirname($_SERVER['PHP_SELF']),
00058          $num_pages);
00059    }
00060 
00064    public function getHTMLTagNoJS() {
00065       return $this->getHTMLTag();
00066    }
00067 
00071    public function getName() {
00072       return "Paginated PDF Viewer";
00073    }
00074 
00075 }
 All Data Structures Functions Variables