/** * Visit a menu organizer and return the menu GUI component that corresponds * to it. * * @param object MenuOrganizerSiteComponent * @return object Component * @access public * @since 1/15/07 */ public function visitFlowOrganizer(FlowOrganizerSiteComponent $organizer) { $numCells = $organizer->getTotalNumberOfCells(); if ($organizer->getNumRows() == 0) { $cellsPerPage = $numCells + 1; } else { $cellsPerPage = $organizer->getNumColumns() * $organizer->getNumRows(); } $childGuiComponents = array(); $i = 0; foreach ($organizer->getSortedSubcomponents() as $child) { if ($child) { $childGuiComponent = $child->acceptVisitor($this); // Filter out false entries returned due to lack of authorization if ($childGuiComponent) { $childGuiComponents[] = $this->addFlowChildWrapper($organizer, $i, $childGuiComponent); } } $i++; } // Add the "Append" form to the organizer $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.add_children"), $organizer->getQualifierId())) { $pluginManager = Services::getService("PluginManager"); $formHtml = "\n\t<div class='ui2_add_form_wrapper'>"; $formHtml .= $this->getAddFormHTML($organizer->getId(), null, $pluginManager->getEnabledPlugins()); // Move/Copy from selection $formHtml .= "\n\t | " . Segue_Selection::instance()->getMoveCopyLink($organizer); $formHtml .= "\n\t</div>"; $form = $this->addFlowChildWrapper($organizer, $i, new UnstyledBlock($formHtml)); // Add the form to the beginning of the list for custom ordering or recent last if (in_array($organizer->sortMethod(), array('custom', 'create_date_asc', 'mod_date_asc'))) { $childGuiComponents[] = $form; } else { array_unshift($childGuiComponents, $form); } } if (count($childGuiComponents)) { $resultPrinter = new ArrayResultPrinter($childGuiComponents, $organizer->getNumColumns(), $cellsPerPage); $resultPrinter->setRenderDirection($organizer->getDirection()); $resultPrinter->setNamespace('pages_' . $organizer->getId()); $resultPrinter->addLinksStyleProperty(new MarginTopSP("10px")); $guiContainer = $resultPrinter->getLayout(); } else { return null; } // Add controls bar and border $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $organizer->getQualifierId())) { $controlsHTML = $this->getBarPreHTML('#00F', $organizer) . $this->getControlsHTML($organizer, "<em>" . $this->_classNames['FlowOrganizer'] . "</em>", $organizer->acceptVisitor($this->_controlsVisitor), '#00F', '#99F', '#66F'); $guiContainer->setPreHTML($controlsHTML . "\n<div style='z-index: 0;'>" . $guiContainer->getPreHTML($null = null)); $guiContainer->setPostHTML($guiContainer->getPostHTML($null = null) . "</div>" . $this->getBarPostHTML()); } return $guiContainer; }
/** * Visit a flow organizer and return the resultant GUI component [a container]. * * @param object FlowOrganizerSiteComponent * @return object Component * @access public * @since 4/3/06 */ public function visitFlowOrganizer(FlowOrganizerSiteComponent $organizer) { $numCells = $organizer->getTotalNumberOfCells(); if ($organizer->getNumRows() == 0) { $cellsPerPage = $numCells; } else { $cellsPerPage = $organizer->getNumColumns() * $organizer->getNumRows(); } $childGuiComponents = array(); foreach ($organizer->getSortedSubcomponents() as $child) { if ($child) { $childGuiComponent = $child->acceptVisitor($this); // Filter out false entries returned due to lack of authorization if ($childGuiComponent) { $childGuiComponents[] = $childGuiComponent; } } } if (count($childGuiComponents)) { $resultPrinter = new ArrayResultPrinter($childGuiComponents, $organizer->getNumColumns(), $cellsPerPage); $resultPrinter->setRenderDirection($organizer->getDirection()); $resultPrinter->setNamespace('pages_' . $organizer->getId()); $resultPrinter->addLinksStyleProperty(new MarginTopSP("10px")); return $resultPrinter->getLayout(); } else { return null; } }