dmBridge PHP API
DMMonocleViewer.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 
00022 class DMMonocleViewer extends DMAbstractViewer
00023 implements DMObjectViewerDelegate {
00024 
00025    function viewerWillRender() {
00026       $root_uri = dirname($_SERVER['PHP_SELF'])
00027          . "/system/viewers/DMMonocleViewer";
00028 
00029       $this->getHelper()->addHeadScriptTag(
00030             dirname($_SERVER['PHP_SELF']) . "/includes/js/jquery-1.3.2.min.js");
00031       $this->getHelper()->addBodyScriptTag(
00032             $root_uri . "/scripts/jquery.event.drag-1.5.min.js");
00033       $this->getHelper()->addBodyScriptTag(
00034             $root_uri . "/scripts/jquery-ui-1.7.1.custom.min.js");
00035       $this->getHelper()->addBodyScriptTag(
00036             $root_uri . "/scripts/dmmonocle.js");
00037    }
00038 
00042    public function getHTMLTag() {
00043       /* an alternative "viewer" for users who do not have javascript
00044       enabled; will be embedded in a <noscript> tag below. */
00045       $alt_viewer = new DMGenericImageViewer();
00046       $alt_viewer->setObject($this->getObject());
00047       $alt_viewer->setMediaType($this->getMediaType());
00048       $alt_viewer->setWidth($this->getWidth());
00049       $alt_viewer->setHeight($this->getHeight());
00050 
00051       return sprintf(
00052          '<div id="dmMonocle" style="width:%s; height:%s">
00053             <noscript>%s</noscript>
00054          </div>
00055          <script type="text/javascript">
00056          $(window).ready(function() {
00057             dmMonocle(%d, %d, %d, "%s", "%s");
00058          });
00059          </script>',
00060          $this->getWidth(),
00061          $this->getHeight(),
00062          $alt_viewer->getHTMLTag(),
00063          $this->getObject()->getWidth(),
00064          $this->getObject()->getHeight(),
00065          $this->getObject()->getPtr(),
00066          $this->getObject()->getCollection()->getAlias(),
00067          DMConfigIni::getInstance()->getString("contentdm.getimage_exe.path")
00068       );
00069    }
00070 
00074    public function getHTMLTagNoJS() {
00075       // dmMonocle requires javascript; sorry
00076       return $this->getHtmlTag();
00077    }
00078 
00085    public function isLowBandwidthCompatible() {
00086       return true;
00087    }
00088 
00092    public function getName() {
00093       return "dmMonocle Image Viewer";
00094    }
00095 
00096 }
00097 
 All Data Structures Functions Variables