/** * Visit a Block * * @param object BlockSiteComponent $siteComponent * @return mixed * @access public * @since 8/31/07 */ public function visitBlock(BlockSiteComponent $siteComponent) { // 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_comments"), $idManager->getId($siteComponent->getId()))) { return; } $harmoni = Harmoni::instance(); //get all comments for site component $commentsManager = CommentManager::instance(); $comments = $commentsManager->getAllComments($siteComponent->getAsset()); while ($comments->hasNext()) { $comment = $comments->next(); $item = $this->addItem(new RSSItem()); $item->setTitle($comment->getSubject()); $item->setLink(SiteDispatcher::quickURL("view", "html", array("node" => $siteComponent->getId())) . "#comment_" . $comment->getIdString(), true); $item->setPubDate($comment->getModificationDate()); $agentMgr = Services::getService("Agent"); $agent = $comment->getAuthor(); $item->setAuthor($agent->getDisplayName()); $item->setCommentsLink(SiteDispatcher::quickURL("view", "html", array("node" => $siteComponent->getId()))); $pluginMgr = Services::getService("PluginManager"); $plugin = $pluginMgr->getPlugin($comment->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) { } } }
/** * Visit a Block * * @param object BlockSiteComponent $siteComponent * @return mixed * @access public * @since 8/31/07 */ public function visitBlockInMenu(BlockSiteComponent $siteComponent) { $parent = $siteComponent->getParentComponent(); if (!$parent) { throw new OperationFailedException("No parent for " . $siteComponent->getId()); } return $parent->acceptVisitor($this); }
/** * 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 and add to * * @param object BlockSiteComponent $siteComponent * @return object * @access public * @since 8/31/07 */ public function visitBlock(BlockSiteComponent $block) { $this->taggableItems[] = HarmoniNodeTaggedItem::forId($block->getId(), 'segue'); return $this->taggableItems; //return visitTaggableComponents($block); }
/** * 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; }
/** * Add a subcomponent * * @param object SiteComponent $siteComponent * @return void * @access public * @since 3/31/06 */ public function addSubcomponent(BlockSiteComponent $siteComponent) { $cell = $this->_element->ownerDocument->createElement('cell'); $snippet = $this->_element->ownerDocument->createElement($siteComponent->getComponentClass()); $snippet->setAttribute('id', $siteComponent->getId()); $cell->appendChild($snippet); $this->_element->appendChild($cell); // this is only for single page load deletes (testing) $this->_getChildComponents(true); $this->_saveXml(); if (!$this->isOrganizer($siteComponent->_asset->getAssetType())) { $this->_asset->addAsset($siteComponent->_asset->getId()); } }
/** * Answer an XML representation of the files attached to a site component. * * @param object BlockSiteComponent $siteComponent * @access protected */ protected function recordAttachedMedia(BlockSiteComponent $siteComponent, $pageId = null) { if (is_null($pageId)) { $pageId = $siteComponent->getId(); } $mediaAssetType = new Type('segue', 'edu.middlebury', 'media_file', 'A file that is uploaded to Segue.'); $children = $siteComponent->getAsset()->getAssets(); while ($children->hasNext()) { $child = $children->next(); if ($mediaAssetType->isEqual($child->getAssetType())) { try { $this->recordMediaAsset($child, $pageId); } catch (PermissionDeniedException $e) { } catch (OperationFailedException $e) { } } } }
/** * Visit a Block * * @param object BlockSiteComponent $siteComponent * @return mixed * @access public * @since 8/31/07 */ public function visitBlockInMenu(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; } $this->printNodeStart($siteComponent); print $this->getTabs() . "\t"; print "<div class='expandSpacer'>"; print " "; print "</div>"; $this->printNodeInfo($siteComponent, true); $this->printNodeEnd($siteComponent); }
/** * Visit a block and return the resulting GUI component. (A menu item) * * @param object BlockSiteComponent $block * @return object MenuItem * @access public * @since 4/3/06 */ public function visitBlockInMenu(BlockSiteComponent $block) { $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if (!$authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $idManager->getId($block->getId()))) { $false = false; return $false; } }
/** * Apply tags to a block * * @param BlockSiteComponent $siteComponent * @param object DOMElement $element * @return void * @access protected * @since 4/18/08 */ protected function applyTags(BlockSiteComponent $siteComponent, DOMElement $element) { //$asset = $siteComponent->getAsset(); $tagManager = Services::getService("Tagging"); $idManager = Services::getService("Id"); $item = HarmoniNodeTaggedItem::forId($siteComponent->getId(), 'segue'); $tagElements = $this->xpath->query('./tags/tag', $element); foreach ($tagElements as $tagElement) { $tag = new Tag($tagElement->nodeValue); $date = DateAndTime::fromString($tagElement->getAttribute('create_date')); $agentId = $this->getAgentId($tagElement->getAttribute('agent_id')); $tag->tagItemForAgent($item, $agentId, $date); } }
/** * Visit a block and return the resulting GUI component. (A menu item) * * @param object BlockSiteComponent $block * @return object MenuItem * @access public * @since 4/3/06 */ public function visitBlockInMenu(BlockSiteComponent $block) { $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if (!$authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $idManager->getId($block->getId()))) { $false = false; return $false; } $pluginManager = Services::getService('PluginManager'); // Create and return the component ob_start(); if ($this->showBlockTitle($block)) { $desc = strip_tags($block->getDescription()); print "<div class='heading' title=\"" . $desc . "\">" . $this->getBlockTitle($block) . "</div>"; } print "<div>" . $this->getPluginContent($block, true) . "</div>"; $menuItem = new MenuItem(ob_get_clean(), 1); return $menuItem; }