/**
  * Visit a Site Navigation Block
  * 
  * @param object SiteNavBlockSiteComponent $siteComponent
  * @return mixed
  * @access public
  * @since 4/13/08
  */
 public function visitSiteNavBlock(SiteNavBlockSiteComponent $siteComponent)
 {
     return $siteComponent->getOrganizer()->acceptVisitor($this);
 }
 /**
  * Visit a Site Navigation Block
  * 
  * @param object SiteNavBlockSiteComponent $siteComponent
  * @return mixed
  * @access public
  * @since 8/31/07
  */
 public function visitSiteNavBlock(SiteNavBlockSiteComponent $siteNavBlock)
 {
     $childOrganizer = $siteNavBlock->getOrganizer();
     $childOrganizer->acceptVisitor($this);
     return $this->taggableItems;
 }
예제 #3
0
 /**
  * Visit a Site Navigation Block
  * 
  * @param object SiteNavBlockSiteComponent $siteComponent
  * @return mixed
  * @access public
  * @since 8/31/07
  */
 public function visitSiteNavBlock(SiteNavBlockSiteComponent $siteComponent)
 {
     $visitor = new SiteNodeDataVisitor();
     $siteComponent->acceptVisitor($visitor);
     $this->_nodeData = $visitor->getNodeData();
 }
 /**
  * Visit a Site Navigation Block
  * 
  * @param object SiteNavBlockSiteComponent $siteComponent
  * @return mixed
  * @access public
  * @since 8/31/07
  */
 public function visitSiteNavBlock(SiteNavBlockSiteComponent $siteComponent)
 {
     // If there is an implicit role coming from above the site in the authorization
     // hierarchy, make lesser roles disabled.
     $roleMgr = SegueRoleManager::instance();
     $groupImplicitRole = $roleMgr->getGroupImplictRole($this->agentId, $siteComponent->getQualifierId(), true);
     $implicitRole = $roleMgr->getAgentsImplicitRole($this->agentId, $siteComponent->getQualifierId(), true);
     if ($implicitRole->isGreaterThan($roleMgr->getRole('no_access')) && $implicitRole->isGreaterThan($groupImplicitRole)) {
         $this->siteImplicitRole = $implicitRole;
         $message = _("You cannot remove the '%1' role for '%2' because it was set for all of Segue.");
         $message = str_replace("%1", $implicitRole->getDisplayName(), $message);
         $message = str_replace("%2", $this->agent->getDisplayName(), $message);
         $this->siteImplicitRoleMessage = $message;
     }
     $this->addQualifierForSiteComponent($siteComponent, true);
     $siteComponent->getOrganizer()->acceptVisitor($this);
 }
 /**
  * Visit a Site Navigation Block
  * 
  * @param object SiteNavBlockSiteComponent $siteComponent
  * @return mixed
  * @access public
  * @since 8/31/07
  */
 public function visitSiteNavBlock(SiteNavBlockSiteComponent $siteComponent)
 {
     // If there is no menu in the site, then by definition there is no header
     // or footer
     return $siteComponent->acceptVisitor($this->hasMenuBelowVisitor);
 }
예제 #6
0
 /**
  * Visit a Site Navigation Block
  * 
  * @param object SiteNavBlockSiteComponent $siteComponent
  * @return mixed
  * @access public
  * @since 8/5/08
  */
 public function visitSiteNavBlock(SiteNavBlockSiteComponent $siteComponent)
 {
     if (!$this->firstSeen) {
         $this->firstSeen = true;
     }
     $siteComponent->getOrganizer()->acceptVisitor($this);
 }
예제 #7
0
 /**
  * Visit a Site Navigation Block
  * 
  * @param object SiteNavBlockSiteComponent $siteComponent
  * @return mixed
  * @access public
  * @since 8/31/07
  */
 public function visitSiteNavBlock(SiteNavBlockSiteComponent $siteComponent)
 {
     $actionRows = $this->getActionRows();
     $actionRows->add(new Heading(_("Site map for: ") . $siteComponent->getDisplayName(), 2));
     $this->printNodeStart($siteComponent);
     $this->printNodeInfo($siteComponent);
     //children
     print $this->getTabs() . "\t";
     print "<div class='children' id='site_children'>";
     $this->depth++;
     $this->depth++;
     $organizer = $siteComponent->getOrganizer();
     $organizer->acceptVisitor($this);
     $this->depth--;
     $this->depth--;
     print $this->getTabs() . "\t";
     print "</div>";
     $this->printNodeEnd($siteComponent);
 }
예제 #8
0
 /**
  * Save the theme step
  * 
  * @param array $values
  * @param object SiteNavBlockSiteComponent $site
  * @return boolean
  * @access protected
  * @since 5/8/08
  */
 protected function saveThemeStep(array $values, SiteNavBlockSiteComponent $site)
 {
     $themeMgr = Services::getService("GUIManager");
     /*********************************************************
      * Set the default theme of the site.
      *********************************************************/
     $themeMgr = Services::getService('GUIManager');
     try {
         // Set the chosen theme.
         if (is_null($values['theme']['selected'])) {
             if (defined('SEGUE_DEFAULT_SITE_THEME')) {
                 $site->updateTheme($themeMgr->getTheme(SEGUE_DEFAULT_SITE_THEME));
             } else {
                 $site->updateTheme($themeMgr->getDefaultTheme());
             }
         } else {
             $site->updateTheme($themeMgr->getTheme($values['theme']['selected']));
         }
     } catch (UnknownIdException $e) {
         $site->updateTheme($themeMgr->getDefaultTheme());
     }
     return true;
 }
 /**
  * Apply the theme if one is defined.
  * 
  * @param object SiteNavBlockSiteComponent $site
  * @return void
  * @access protected
  * @since 6/6/08
  */
 protected function applyTheme(SiteNavBlockSiteComponent $site)
 {
     // Get the theme specified in the source
     $themeElements = $this->xpath->evaluate('/Segue2/SiteNavBlock/theme');
     if ($themeElements->length) {
         $themeElement = $themeElements->item(0);
         $themeMgr = Services::getService("GUIManager");
         try {
             $theme = $themeMgr->getTheme($themeElement->getAttribute("id"));
         } catch (UnknownIdException $e) {
             return null;
             // Give up and use default theme.
         }
         if ($theme->supportsOptions()) {
             $optSession = $theme->getOptionsSession();
             $optionChoices = $this->xpath->evaluate('./theme_option_choice', $themeElement);
             foreach ($optionChoices as $choiceElement) {
                 $this->applyThemeOption($optSession, $choiceElement);
             }
         }
         // update theme with options from source
         $site->updateTheme($theme);
     }
 }
 /**
  * Visit a SiteNavBlock and return the site GUI component that corresponds to
  *	it.
  * 
  * @param object SiteNavBlockSiteComponent
  * @return object Component
  * @access public
  * @since 4/3/06
  */
 public function visitSiteNavBlock(SiteNavBlockSiteComponent $siteNavBlock)
 {
     // Traverse our child organizer, and place it in the _missingTargets array
     // if our target is not available.
     if ($siteNavBlock->isActive()) {
         $childOrganizer = $siteNavBlock->getOrganizer();
         $childOrganizer->acceptVisitor($this);
     }
     return $this->visitSiteComponent($siteNavBlock);
 }
예제 #11
0
 /**
  * Visit a SiteNavBlock and return the site GUI component that corresponds to
  *	it.
  * 
  * @param object SiteNavBlockSiteComponent
  * @return object Component
  * @access public
  * @since 4/3/06
  */
 public function visitSiteNavBlock(SiteNavBlockSiteComponent $siteNavBlock)
 {
     // Traverse our child organizer, and place it in the _missingTargets array
     // if our target is not available.
     $childOrganizer = $siteNavBlock->getOrganizer();
     $childGuiComponent = $childOrganizer->acceptVisitor($this);
     // Check completeness and render any nodes still waiting for targets
     try {
         foreach (array_keys($this->_missingTargets) as $targetId) {
             if (!isset($this->_emptyCellContainers[$targetId])) {
                 throw new OperationFailedException("Target id '{$targetId}' was not found or is not empty.", 390134);
             }
             if (!is_object($this->_emptyCellContainers[$targetId])) {
                 ob_start();
                 var_dump($this->_emptyCellContainers[$targetId]);
                 throwError(new Error("Expecting object, found '" . ob_get_clean() . "'.", __CLASS__));
             }
             if (isset($this->_missingTargetWidths[$targetId]) && $this->_missingTargetWidths[$targetId]) {
                 $width = $this->_missingTargetWidths[$targetId];
             } else {
                 $width = null;
             }
             $this->_emptyCellContainers[$targetId]->insertAtPlaceholder($this->_emptyCellPlaceholders[$targetId], $this->_missingTargets[$targetId], $width, '100%', null, TOP);
             unset($this->_emptyCellContainers[$targetId]);
             unset($this->_emptyCellPlaceholders[$targetId]);
             unset($this->_missingTargets[$targetId]);
             unset($this->_missingTargetWidths[$targetId]);
         }
     } catch (OperationFailedException $e) {
         /*********************************************************
          * Try to allow recovery if we have just one
          * missing empty cell and one menu missing a target.
          *********************************************************/
         if ($e->getCode() == 390134 && count($this->_missingTargets) == 1 && count($this->_emptyCellContainers) == 1) {
             print "<div class='error'>";
             printpre("Inconsistant state. Looking for empty cell: ");
             printpre(array_keys($this->_missingTargets));
             printpre("Found empty cell: ");
             printpre(array_keys($this->_emptyCellContainers));
             print "Using arrange mode, drag the Layout container for your section/page to fix this state.";
             print "Please report what you did to cause this state at the <a href='https://sourceforge.net/tracker/index.php?func=detail&amp;aid=2046491&amp;group_id=82171&amp;atid=565234'>bug tracker</a> or to Adam Franco (afranco@middlebury.edu).";
             print "</div>";
             $emptyCellId = key($this->_emptyCellContainers);
             $targetId = key($this->_missingTargets);
             if (!is_object($this->_emptyCellContainers[$emptyCellId])) {
                 ob_start();
                 var_dump($this->_emptyCellContainers[$emptyCellId]);
                 throwError(new Error("Expecting object, found '" . ob_get_clean() . "'.", __CLASS__));
             }
             if (isset($this->_missingTargetWidths[$targetId]) && $this->_missingTargetWidths[$targetId]) {
                 $width = $this->_missingTargetWidths[$targetId];
             } else {
                 $width = null;
             }
             $this->_emptyCellContainers[$emptyCellId]->insertAtPlaceholder($this->_emptyCellPlaceholders[$emptyCellId], $this->_missingTargets[$targetId], $width, '100%', null, TOP);
             unset($this->_emptyCellContainers[$emptyCellId]);
             unset($this->_emptyCellPlaceholders[$emptyCellId]);
             unset($this->_missingTargets[$targetId]);
             unset($this->_missingTargetWidths[$targetId]);
         } else {
             throw $e;
         }
     }
     // returning the entire site in GUI component object tree.
     return $childGuiComponent;
 }