/**
  * Visit a fixed organizer and return the GUI component [a container] 
  * that corresponds to it. Traverse-to/add child components.
  * 
  * @param object FixedOrganizerSiteComponent $organizer
  * @return object Component
  * @access public
  * @since 4/3/06
  */
 public function visitFixedOrganizer(FixedOrganizerSiteComponent $organizer)
 {
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $organizer->getQualifierId())) {
         $tdStyles = 'border: 1px solid #F00; padding: 6px;';
     } else {
         $tdStyles = '';
     }
     $guiContainer = new Container(new TableLayout($organizer->getNumColumns(), $tdStyles), BLANK, 1);
     // Add controls bar and border
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.add_children"), $organizer->getQualifierId())) {
         $canAdd = true;
     } else {
         $canAdd = false;
     }
     $numCells = $organizer->getTotalNumberOfCells();
     for ($i = 0; $i < $numCells; $i++) {
         $child = $organizer->getSubcomponentForCell($i);
         if (is_object($child)) {
             $childComponent = $child->acceptVisitor($this);
             if ($childComponent) {
                 $guiContainer->add($childComponent, $child->getWidth(), null, null, TOP);
             } else {
                 $childComponent = $guiContainer->add(new Blank(), $child->getWidth(), null, null, TOP);
             }
         } else {
             $this->_emptyCellContainers[$organizer->getId() . '_cell:' . $i] = $guiContainer;
             $this->_emptyCellPlaceholders[$organizer->getId() . '_cell:' . $i] = $guiContainer->addPlaceholder();
             $childComponent = $guiContainer->getComponent($this->_emptyCellPlaceholders[$organizer->getId() . '_cell:' . $i]);
         }
         if ($canAdd) {
             $this->wrapAsDroppable($childComponent, $organizer->getId() . "_cell:" . $i, array_keys($organizer->getVisibleComponentsForPossibleAdditionToCell($i)));
         }
     }
     if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $organizer->getQualifierId())) {
         $controlsHTML = $this->getBarPreHTML('#F00', $organizer, '1px') . $this->getControlsHTML($organizer, $organizer->getDisplayName(), $organizer->acceptVisitor($this->_controlsVisitor), '#F00', '#F99', '#F66', 0, '1px');
         $guiContainer->setPreHTML($controlsHTML . "\n<div style='z-index: 0;'>" . $guiContainer->getPreHTML($null = null));
         $guiContainer->setPostHTML($guiContainer->getPostHTML($null = null) . "</div>" . $this->getBarPostHTML());
         if (count($organizer->getVisibleDestinationsForPossibleAddition())) {
             $this->wrapAsDraggable($guiContainer, $organizer->getId(), 'FixedOrganizer');
         }
     }
     return $guiContainer;
 }
Ejemplo n.º 2
0
 /**
  * Visit a fixed organizer and return the GUI component [a container] 
  * that corresponds to it. Traverse-to/add child components.
  * 
  * @param object FixedOrganizerSiteComponent $organizer
  * @return object Component
  * @access public
  * @since 4/3/06
  */
 public function visitFixedOrganizer(FixedOrganizerSiteComponent $organizer)
 {
     $guiContainer = new Container(new TableLayout($organizer->getNumColumns()), BLANK, 1);
     $numCells = $organizer->getTotalNumberOfCells();
     for ($i = 0; $i < $numCells; $i++) {
         $child = $organizer->getSubcomponentForCell($i);
         if (is_object($child)) {
             $childComponent = $child->acceptVisitor($this);
             if ($childComponent) {
                 $guiContainer->add($childComponent, $child->getWidth(), null, null, TOP);
             } else {
                 $guiContainer->add(new UnstyledBlock("<div style='height: 0px;'> &nbsp; </div>"), null, "0px", null, TOP);
             }
         } else {
             $this->_emptyCellContainers[$organizer->getId() . '_cell:' . $i] = $guiContainer;
             $this->_emptyCellPlaceholders[$organizer->getId() . '_cell:' . $i] = $guiContainer->addPlaceholder(new UnstyledBlock("<div style='height: 0px;'> &nbsp; </div>"));
         }
     }
     return $guiContainer;
 }