function composeResources($resourceList) { //CODICE DI PROVAA!!!! $risorsa1 = new Resource(); $risorsa1->setLogo("HiernateIco.jpg"); $risorsa1->setTitle("Titolo 1"); $risorsa1->setDescription("descrizione della risorsa 1, tipo etc"); $resourceArray = array($risorsa1); print "<div id='resourceBlock'>"; foreach ($resourceArray as $i) { if ($risorsa1->getLogo() != NULL) { print "<p><h2><a href='" . $i->getHomeUrl() . "'><img src='" . $i->getLogo() . "' /></a>" . $i->getTitle() . "</h2></p>"; } else { print "<p><h2>" . $i->getTitle() . "</h2></p>"; } print "<p class='results'>" . $i->getDescription() . "</p>"; print "<div>" . $this->composeResultsInResources($i->getResults()) . "</div>"; print "<br/>"; } print "<p>That's not what you expected? Improve your search, insert a synonim: <input type='text' action='resultShower.php' method='POST' /></p>"; print '<hr/></div>'; }
private function createFromDBRow($row) { $r = new Resource($row[DB::RESOURCE_OWNER], $row[DB::RESOURCE_PATH], $row[DB::RESOURCE_TYPE]); $r->setID($row[DB::RESOURCE_ID]); $r->setDescription($row[DB::RESOURCE_DESCRIPTION])->setCreationDate($row[DB::RESOURCE_CREATION_DATE])->setTags($row[DB::RESOURCE_TAGS]); if (!is_null($row[DB::RESOURCE_MODIFICATION_DATE])) { $mod = $row[DB::RESOURCE_MODIFICATION_DATE]; } else { $mod = $row[DB::RESOURCE_CREATION_DATE]; } $r->setModificationDate(date_timestamp_get(date_create_from_format("Y-m-d G:i:s", $mod))); //setto lo stato $r->setEditable($row[DB::EDITABLE])->setRemovable($row[DB::REMOVABLE]); $r->setBlackContent($row[DB::BLACK_CONTENT])->setRedContent($row[DB::RED_CONTENT])->setYellowContent($row[DB::YELLOW_CONTENT])->setAutoBlackContent($row[DB::AUTO_BLACK_CONTENT]); $user = Session::getUser(); if ($this->loadReports && AuthorizationManager::canUserDo(AuthorizationManager::READ_REPORTS, $r)) { require_once 'dao/ReportDao.php'; $reportDao = new ReportDao(); $reportDao->loadAll($r); } //$r->setAccessCount($this->getAccessCount($r)); return $r; }
public function getResourcesForTag($tag = "", $pluginname = "") { if (empty($tag) || empty($pluginname)) { return null; } foreach ($this->_PluginsLoaded as $Plugin) { if (method_exists($Plugin, "getResourcesForTag") && $Plugin->getName() == $pluginname) { $res = new Resource(); $res->setTitle($Plugin->getName()); $res->setLogo($Plugin->getLogo()); $res->setDescription($Plugin->getDescription()); $res->setHomeUrl($Plugin->getWebURL()); $res->setResults($Plugin->getResourcesForTag($tag)); $Bundle[] = $res; } } return $Bundle; }