dmBridge PHP API
DMObjectResultsTemplateHelper.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 
00020 class DMObjectResultsTemplateHelper extends DMResultsTemplateHelper
00021 implements DMTemplateHelper {
00022 
00029    public function getHtmlResults($view = "grid") {
00030       $uri = DMHTTPRequest::getCurrent()->getURI();
00031       $term = DMString::websafe(trim($uri->getQueryValue("term")));
00032       $idx = 1;
00033       $rows = "";
00034       foreach ($this->getView()->getQuery()->getSearchResults() as $obj) {
00035          $rows .= sprintf(
00036             '<tr%s>
00037                <td class="dmIndex">%d</td>
00038                <td class="dmThumbnail"><a href="%s"><img src="%s"></a></td>
00039                <td class="dmTitle"><a href="%s">%s</a></td>
00040                <td class="dmFullText">%s</td>
00041             </tr>',
00042             ($idx & 1) ? ' class="odd"' : '',
00043             $idx,
00044             DMString::websafe($obj->getURI()),
00045             DMString::websafe($obj->getThumbURL()),
00046             DMString::websafe($obj->getURI()),
00047             DMString::websafe($obj->getMetadata('title')),
00048             DMString::highlight($term, DMString::websafe($obj->getFullText()))
00049          );
00050          $idx++;
00051       }
00052       return '<table class="dmGridResults" cellpadding="0" cellspacing="0"
00053          border="0">' . $rows . '</table>';
00054    }
00055 
00056 }
00057 
 All Data Structures Functions Variables