dmBridge PHP API
DMAPICollectionController.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 DMAPICollectionController extends DMAbstractController {
00014 
00015    public function index() {
00016       $response = new DMHTTPResponse();
00017       $rep = DMHTTPResponseFactory::getRepresentation();
00018       $trans = DMHTTPResponseFactory::getTransformer();
00019       $rep->setBody($trans->transformCollections(DMCollection::getAuthorized()));
00020       $response->setRepresentation($rep);
00021       $response->send();
00022       die;
00023    }
00024 
00028    public function view($alias) {
00029       $alias = DMCollection::getSanitizedAlias($alias);
00030       if (!DMCollection::exists($alias)) {
00031          throw new DMUnavailableModelException("Invalid collection.");
00032       }
00033 
00034       $collection = DMCollectionFactory::getCollection($alias);
00035 
00036       $response = new DMHTTPResponse();
00037       $rep = DMHTTPResponseFactory::getRepresentation();
00038       $trans = DMHTTPResponseFactory::getTransformer();
00039       $rep->setBody($trans->transformCollection($collection));
00040       $response->setRepresentation($rep);
00041       $response->send();
00042       die;
00043    }
00044 
00045 }
 All Data Structures Functions Variables