dmBridge PHP API
DMFavoritesTemplateHelper.php
00001 <?php
00002 #
00003 # dmBridge: a data access framework for CONTENTdm(R)
00004 #
00005 # Copyright © 2009, 2010 Board of Regents of the Nevada System of Higher
00006 # Education, on behalf of the University of Nevada, Las Vegas
00007 #
00008 
00019 class DMFavoritesTemplateHelper extends DMResultsTemplateHelper
00020 implements DMTemplateHelper {
00021 
00026    protected function getResultsForm() {
00027       $alias = $this->getView()->getCollection()->getAlias();
00028       $alias = ($alias == "/dmdefault") ? "" : $alias;
00029       $tpl_set = $this->getView()->getTemplate()->getTemplateSet();
00030 
00031       $dxml = new DMDOMDocument("1.0", "utf-8");
00032       $dxml->loadXML("<form/>");
00033       $dxml->documentElement->setAttribute("class", "dmResults");
00034       $table = $dxml->createElement("table");
00035       $dxml->documentElement->appendChild($table);
00036 
00037       $dxml->documentElement->setAttribute("action",
00038             DMInternalURI::getURIWithParams(
00039                   sprintf("objects%s/favorites", $alias)));
00040       $dxml->documentElement->setAttribute("method", "post");
00041 
00042       $input_div = $dxml->createElement("div");
00043 
00044       if (count($this->getSession()->getAccessibleFavorites($tpl_set))) {
00045          $input = $dxml->createElement("input");
00046          $input->setAttribute("type", "hidden");
00047          $input->setAttribute("name", "params");
00048          $input->setAttribute("value",
00049                sprintf("objects%s/favorites", $alias));
00050          $input_div->appendChild($input);
00051 
00052          $input = $dxml->createElement("input");
00053          $input->setAttribute("type", "hidden");
00054          $input->setAttribute("name", "method");
00055          $input->setAttribute("value", "DELETE");
00056          $input_div->appendChild($input);
00057 
00058          $input = $dxml->createElement("input");
00059          $input->setAttribute("type", "submit");
00060          $input->setAttribute("class", "dmRemoveFavorites");
00061          $input->setAttribute("value", "Remove Checked From Favorites");
00062          $input_div->appendChild($input);
00063       }
00064 
00065       $dxml->documentElement->appendChild($input_div);
00066       return $dxml;
00067    }
00068 
00069 }
00070 
 All Data Structures Functions Variables