dmBridge PHP API
DMSystemErrorTemplateHelper.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 
00016 class DMSystemErrorTemplateHelper extends DMGenericTemplateHelper
00017 implements DMTemplateHelper {
00018 
00024    public function getHtmlException() {
00025       $e = $this->getView()->getException();
00026       $msg = sprintf("<p>%s</p>", DMString::websafe($e->getMessage()));
00027       $debug_msg = "";
00028       if (DMConfigIni::getInstance()->getString("dmbridge.debug_mode")) {
00029          $debug_msg = sprintf('
00030             <div class="dmExceptionDebug">
00031                <dl>
00032                   <dt>Type:</dt>
00033                   <dd>%s</dd>
00034 
00035                   <dt>Stack trace:</dt>
00036                   <dd><pre>%s</pre></dd>
00037 
00038                   <dt>dmBridge version:</dt>
00039                   <dd>%s</dd>
00040                </dl>
00041                <p><strong>Debug mode is ON.</strong> To hide the above
00042                information from public view, turn it off in
00043                config.ini.</p>
00044             </div>',
00045             get_class($e),
00046             wordwrap(DMString::websafe($e->getTraceAsString()), 100),
00047             DMString::websafe(DMConfigXML::getInstance()->getVersion())
00048          );
00049       }
00050       return $msg . $debug_msg;
00051    }
00052 
00053 }
 All Data Structures Functions Variables