dmBridge PHP API
DMCommentQuery.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 
00015 class DMCommentQuery extends DMAbstractSocialDataQuery
00016 implements DMDataStoreQuery, DMURIAddressable {
00017 
00021    public function getSearchResults() {
00022       $this->setNumResults(
00023             $this->getDataStore()->getCommentsForQuery($this, true));
00024       return $this->getDataStore()->getCommentsForQuery($this, false);
00025    }
00026 
00030    public function getURI() {
00031       $terms = $this->getPredicates();
00032       $collections = $this->getCollections();
00033       $objects = $this->getObjects();
00034       $query = array();
00035       if (count($terms)) {
00036          $query['term'] = $terms[0];
00037       }
00038       if (count($collections)) {
00039          $aliases = array();
00040          foreach ($collections as $col) {
00041             $aliases[] = $col->getAlias();
00042          }
00043          $query['collections'] = implode(",", $aliases);
00044       } else if (count($objects)) {
00045          $encoded_objects = array();
00046          foreach ($objects as $obj) {
00047             $encoded_objects[] = $obj->getCollection()->getAlias() . "/"
00048                   . $obj->getPtr();
00049          }
00050          $query['objects'] = implode(",", $encoded_objects);
00051       }
00052       return DMInternalURI::getURIWithParams("comments/search", $query);
00053    }
00054 
00055 }
 All Data Structures Functions Variables