/**
  * Visit a Block
  * 
  * @param object BlockSiteComponent $siteComponent
  * @return mixed
  * @access public
  * @since 1/26/09
  */
 public function visitBlock(BlockSiteComponent $siteComponent)
 {
     $view = new Participation_View($siteComponent);
     $idMgr = Services::getService('Id');
     $azMgr = Services::getService('AuthZ');
     // get create actions
     if ($azMgr->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.modify'), $siteComponent->getQualifierId()) == TRUE) {
         $this->_actions[] = new Participation_CreateAction($view, $siteComponent);
     }
     // get comment actions
     $commentsManager = CommentManager::instance();
     $comments = $commentsManager->getAllComments($siteComponent->getAsset(), DESC);
     while ($comments->hasNext()) {
         $comment = $comments->next();
         if ($azMgr->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.comment'), $siteComponent->getQualifierId()) == TRUE) {
             $this->_actions[] = new Participation_CommentAction($view, $comment);
         }
     }
     // get history actions
     $pluginManager = Services::getService('PluginManager');
     $plugin = $pluginManager->getPlugin($siteComponent->getAsset());
     if ($plugin->supportsVersioning()) {
         $versions = $plugin->getVersions();
         $firstVersion = 0;
         foreach ($versions as $version) {
             if ($version->getNumber() != 1) {
                 if ($azMgr->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.modify'), $siteComponent->getQualifierId()) == TRUE) {
                     $this->_actions[] = new Participation_HistoryAction($view, $siteComponent, $version);
                 }
             }
         }
     }
 }
Exemple #2
0
 /**
  * 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());
     }
 }
 /**
  * Answer controls for adding to the selection.
  * 
  * @param object BlockSiteComponent $siteComponent
  * @return string
  * @access public
  * @since 8/5/08
  */
 public function getSelectionAdd(BlockSiteComponent $siteComponent)
 {
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     $harmoni = Harmoni::instance();
     if (!$authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $siteComponent->getQualifierId())) {
         return false;
     }
     return Segue_Selection::instance()->getAddLink($siteComponent);
 }
 /**
  * Add controls to the block
  * 
  * @param object BlockSiteComponent $block
  * @param object Container $guiContainer
  * @return object Container The guiContainer
  * @access public
  * @since 5/24/07
  */
 function addBlockControls(BlockSiteComponent $block, Container $guiContainer)
 {
     // Add controls bar and border
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $block->getQualifierId())) {
         $controlsHTML = $this->getBarPreHTML('#090', $block) . $this->getControlsHTML($block, "<em>" . $this->_classNames['Block'] . "</em>", $block->acceptVisitor($this->_controlsVisitor), '#090', '#9F9', '#6C6', 0, '0px', Segue_Selection::instance()->getAddLink($block));
         $guiContainer->setPreHTML($controlsHTML . $guiContainer->getPreHTML($null = null));
         $guiContainer->setPostHTML($this->getBarPostHTML());
     }
     return $guiContainer;
 }
 /**
  * Apply a Role to a site component
  * 
  * @param object BlockSiteComponent $siteComponent
  * @param object DOMElement $element
  * @return void
  * @access protected
  * @since 1/25/08
  */
 protected function applyRole(BlockSiteComponent $siteComponent, DOMElement $element)
 {
     $roleMgr = SegueRoleManager::instance();
     $role = $roleMgr->getRole($element->getAttribute('role'));
     $role->apply($this->getAgentId($element->getAttribute('agent_id')), $siteComponent->getQualifierId(), true);
 }