/**
  * Visit a Navigation Block
  * 
  * @param object NavBlockSiteComponent $siteComponent
  * @return mixed
  * @access public
  * @since 8/31/07
  */
 public function visitNavBlock(NavBlockSiteComponent $siteComponent)
 {
     $element = $this->getElementForNewId($siteComponent->getId());
     $this->applyDisplayName($siteComponent, $element);
     $this->applyDescription($siteComponent, $element);
     $this->applyCommonProperties($siteComponent, $element);
     $this->importComponent($this->getSingleChild('NavOrganizer', $element), $siteComponent->getOrganizer());
     try {
         $nestedMenuElement = $this->getSingleChild('MenuOrganizer', $element);
     } catch (MissingNodeException $e) {
     }
     if (isset($nestedMenuElement)) {
         $menu = $this->createComponent($nestedMenuElement, $siteComponent);
         $siteComponent->makeNested($menu);
         $this->importComponent($nestedMenuElement, $menu);
     }
     $this->setAssetAuthorship($siteComponent->getAsset(), $element);
     $this->setAssetDates($siteComponent->getAsset(), $element);
     $this->applyRoles($siteComponent, $element);
 }
 /**
  * Answer an element that represents a single tag application for a block.
  * 
  * @param object NavBlockSiteComponent $siteComponent
  * @access protected
  * @since 1/17/08
  */
 protected function recordCategory(NavBlockSiteComponent $siteComponent, $parentId = '')
 {
     $query = 'count(wp:category[wp:term_id = "' . $siteComponent->getId() . '"])';
     if (!$this->xpath->evaluate($query, $this->channel)) {
         $element = $this->channel->insertBefore($this->doc->createElementNS('http://wordpress.org/export/1.1/', 'wp:category'), $this->endCategories);
         $element->appendChild($this->getElementNS('http://wordpress.org/export/1.1/', 'wp:term_id', $siteComponent->getId()));
         $element->appendChild($this->getElementNS('http://wordpress.org/export/1.1/', 'wp:category_nicename', $this->getUniqueSlug($siteComponent)));
         $element->appendChild($this->getCDATAElementNS('http://wordpress.org/export/1.1/', 'wp:cat_name', $siteComponent->getDisplayName()));
         $element->appendChild($this->getElementNS('http://wordpress.org/export/1.1/', 'wp:category_parent', $parentId));
     }
 }
Ejemplo n.º 3
0
 /**
  * Visit a block and return the resulting GUI component.
  * 
  * @param object NavBlockSiteComponent $navBlock
  * @return ref array
  * @access public
  * @since 4/3/06
  */
 public function visitNavBlock(NavBlockSiteComponent $navBlock)
 {
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     // Since view AZs cascade up, just check at the node.
     if (!$authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $idManager->getId($navBlock->getId()))) {
         return false;
     }
     $menuItems = array();
     // Create the menu item
     $title = $navBlock->getTitleMarkup();
     if (!$title) {
         $title = _("Untitled");
     }
     $menuItems[] = new MenuItemLinkWithAdditionalHtml($title, $this->getUrlForComponent($navBlock->getId()), $navBlock->isActive(), 1, null, null, $navBlock->getDescription(), $this->getAdditionalNavHTML($navBlock));
     // Traverse our child organizer, and place it in the _missingTargets array
     // if our target is not available.
     if ($navBlock->isActive()) {
         $childOrganizer = $navBlock->getOrganizer();
         $childGuiComponent = $childOrganizer->acceptVisitor($this);
         if (isset($this->_emptyCellContainers[$navBlock->getTargetId()])) {
             $this->_emptyCellContainers[$navBlock->getTargetId()]->insertAtPlaceholder($this->_emptyCellPlaceholders[$navBlock->getTargetId()], $childGuiComponent, $childOrganizer->getWidth(), '100%', null, TOP);
             unset($this->_emptyCellContainers[$navBlock->getTargetId()], $this->_emptyCellPlaceholders[$navBlock->getTargetId()]);
         } else {
             $this->_missingTargets[$navBlock->getTargetId()] = $childGuiComponent;
             $this->_missingTargetWidths[$navBlock->getTargetId()] = $childOrganizer->getWidth();
         }
         $nestedMenuOrganizer = $navBlock->getNestedMenuOrganizer();
         if (!is_null($nestedMenuOrganizer)) {
             $this->_menuNestingLevel++;
             $menuItems[] = $nestedMenuOrganizer->acceptVisitor($this);
         } else {
             $this->_menuNestingLevel = 0;
         }
     }
     // return the menu items
     return $menuItems;
 }