/** * Visit a block and return the resulting GUI component. * * @param object BlockSiteComponent $block * @return object Component * @access public * @since 4/3/06 */ function visitBlock(BlockSiteComponent $block) { $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $idManager->getId($block->getId()))) { print "\n<div>" . $block->getDisplayName() . "</div>"; // $item->setDescription($this->getPluginContent($block)); // $item->setLink($this->getDetailUrl($block->getId())); return; } else { return; } }
/** * Visit a block and return the resulting GUI component. * * @param object BlockSiteComponent $block * @return object Component * @access public * @since 4/3/06 */ function visitBlock(BlockSiteComponent $block) { $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $idManager->getId($block->getId()))) { $item = $this->rssFeed->addItem(new RSSItem()); $item->setTitle($block->getDisplayName()); $item->setDescription($this->getPluginContent($block)); $item->setLink($this->getDetailUrl($block->getId())); return; } else { return; } }
/** * Visit a Block * * @param object BlockSiteComponent $siteComponent * @return mixed * @access public * @since 6/11/08 */ public function visitBlock(BlockSiteComponent $siteComponent) { $orig = $siteComponent->getDisplayName(); $new = $this->replacePlaceholders($orig); if ($orig != $new) { $siteComponent->updateDisplayName($new); } // $orig = $siteComponent->getDescription(); // $new = $this->replacePlaceholders($orig); // if ($orig != $new) // $siteComponent->updateDescription($new); $asset = $siteComponent->getAsset(); $orig = $asset->getContent()->asString(); $new = $this->replacePlaceholders($orig); if ($orig != $new) { $asset->updateContent(Blob::withValue($new)); } }
/** * 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()); } }
/** * Visit a Block * * @param object BlockSiteComponent $siteComponent * @return mixed * @access public * @since 8/31/07 */ public function visitBlock(BlockSiteComponent $siteComponent) { if (in_array($siteComponent->getId(), $this->visited)) { return null; } $this->visited[] = $siteComponent->getId(); $name = html_entity_decode($siteComponent->getDisplayName()); $name = mb_convert_encoding($name, 'UTF-8', mb_detect_encoding($name, "ASCII,UTF-8,ISO-8859-1,JIS,EUC-JP,SJIS")); $name = mb_strtolower($name, 'UTF-8'); $name = trim($name); if ($name == $this->title) { return $siteComponent->getId(); } return null; }
/** * Answer a unique slug for the site component * * @param BlockSiteComponent $siteComponent * @return string */ public function getUniqueSlug(BlockSiteComponent $siteComponent) { // append the id for uniqueness. $slug = strtolower($siteComponent->getDisplayName() . ' ' . $siteComponent->getId()); $slug = preg_replace('/[^a-z0-9]/', '-', $slug); $slug = preg_replace('/-+/', '-', $slug); return $slug; }