dmBridge PHP API
DMGenericPDFViewer.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 
00021 class DMGenericPDFViewer extends DMAbstractViewer
00022 implements DMObjectViewerDelegate {
00023 
00025    private $query;
00026 
00027 
00032    public function getHTMLTag() {
00033       $terms = "";
00034       if ($this->getQuery() instanceof DMObjectQuery) {
00035          $terms = array();
00036          foreach ($this->getQuery()->getPredicates() as $t) {
00037             $terms[] = $t->getString();
00038          }
00039          $terms = DMString::websafe("#search=" . implode(" ", $terms));
00040       }
00041 
00042       // width & height may be strings (%)
00043       return sprintf('<div class="dmPDFViewer">
00044             <embed src="%s%s" type="%s" width="%s" height="%s">
00045                <a href="%s">Download this PDF</a>
00046             </embed>
00047          </div>',
00048          $this->getObject()->getFileURL(),
00049          $terms,
00050          $this->getMediaType(),
00051          $this->getWidth(),
00052          $this->getHeight(),
00053          $this->getObject()->getFileURL());
00054    }
00055 
00059    public function getHTMLTagNoJS() {
00060       return $this->getHTMLTag();
00061    }
00062 
00069    public function isLowBandwidthCompatible() {
00070       return false;
00071    }
00072 
00076    public function getName() {
00077       return "Generic PDF Viewer";
00078    }
00079 
00083    protected function getQuery() {
00084       return $this->query;
00085    }
00086 
00090    public function setQuery(DMObjectQuery $query) {
00091       $this->query = $query;
00092    }
00093 
00094 }
 All Data Structures Functions Variables