dmBridge PHP API
DMCPReferenceURLController.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 
00013 class DMCPReferenceURLController extends DMCPAdminController {
00014 
00015    public function index() {
00016       $this->preFlightCheck();
00017 
00018       if (DMHTTPRequest::getCurrent()->getMethod() == DMHTTPMethod::POST) {
00019          $sets = DMHTTPRequest::getCurrent()->getRepresentation()->getFormValue("set");
00020          $flash = null;
00021          if (is_array($sets)) {
00022             foreach ($sets as $alias => $dest) {
00023                $alias = DMCollection::getSanitizedAlias($alias);
00024                $col = DMCollectionFactory::getCollection($alias);
00025                $col->setRedirectingReferenceURLs(($dest == "dmbridge"));
00026                DMConfigXML::getInstance()->saveCollection($col);
00027             }
00028             $flash = new DMFlash(
00029                DMLocalizedString::getString("PREFS_UPDATED"), true);
00030          }
00031          DMHTTPRequest::getCurrent()->getSession()->setFlash($flash);
00032          DMHTTPRequest::reload();
00033          die;
00034       }
00035 
00036       // check whether the replacement reference URL routing script is
00037       // installed
00038       $installed = false;
00039       if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/u/index.php")) {
00040          $tmp = @file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/u/index.php");
00041          $tmp = explode("\n", $tmp);
00042          $installed = (strpos($tmp[0], "dmBridge") !== false);
00043       }
00044 
00045       $this->tpl_vars['script_installed'] = $installed;
00046       $this->tpl_vars['all_collections'] = DMCollection::getAuthorized();
00047 
00048       $this->renderTemplate("/templates/reference_url/index.html.php");
00049       die;
00050    }
00051 
00052 }
00053 
 All Data Structures Functions Variables