dmBridge PHP API
DMFavoriteQuery.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 DMFavoriteQuery extends DMAbstractQuery implements DMQuery {
00016 
00018    private static $current;
00019 
00021    private $session;
00022 
00024    private $template_set;
00025 
00030    public static function getCurrent() {
00031       return self::$current;
00032    }
00033 
00038    public static function setCurrent(DMFavoriteQuery $oq) {
00039       self::$current = $oq;
00040    }
00041 
00046    public function __construct(DMSession $session, DMTemplateSet $ts = null) {
00047       $this->session = $session;
00048       $this->template_set = $ts;
00049       $this->setNumResults(count($this->session->getAllFavorites()));
00050    }
00051 
00056    public function getSearchResults() {
00057       $results = ($this->template_set)
00058             ? $this->session->getAccessibleFavorites($this->template_set)
00059             : $this->session->getAllFavorites();
00060       return array_slice($results,
00061             ($this->getPage() - 1) * $this->getNumResultsPerPage(),
00062             $this->getNumResultsPerPage());
00063    }
00064 
00065 }
 All Data Structures Functions Variables