/** * Visit a Block * * @param object BlockSiteComponent $siteComponent * @return mixed * @access public * @since 8/31/07 */ public function visitBlock(BlockSiteComponent $siteComponent) { $harmoni = Harmoni::instance(); // check to see if user is authorized to view block $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if (!$authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $idManager->getId($siteComponent->getId()))) { return; } $item = $this->addItem(new RSSItem()); $item->setTitle($siteComponent->getDisplayName()); $item->setLink(SiteDispatcher::quickURL("view", "html", array("node" => $siteComponent->getId())), true); $item->setPubDate($siteComponent->getModificationDate()); $agentMgr = Services::getService("Agent"); $agent = $agentMgr->getAgent($siteComponent->getCreator()); $item->setAuthor($agent->getDisplayName()); $item->setCommentsLink(SiteDispatcher::quickURL("view", "html", array("node" => $siteComponent->getId()))); $pluginMgr = Services::getService("PluginManager"); $plugin = $pluginMgr->getPlugin($siteComponent->getAsset()); $item->setDescription($plugin->executeAndGetMarkup()); // MediaFile eclosures. try { foreach ($plugin->getRelatedMediaFiles() as $file) { $item->addEnclosure($file->getUrl(), $file->getSize()->value(), $file->getMimeType()); } } catch (UnimplementedException $e) { } // Tags $taggedItem = TaggedItem::forId($siteComponent->getQualifierId(), 'segue'); $tags = $taggedItem->getTags(); while ($tags->hasNext()) { $item->addCategory($tags->next()->getValue()); } }