예제 #1
0
 /**
  * Adds a child to Composite, initializing it, if current Composite is
  * initialized.
  *
  * @api
  * @param \Nethgui\Module\ModuleInterface $childModule
  * @return Composite
  */
 public function addChild(\Nethgui\Module\ModuleInterface $childModule)
 {
     if (isset($this->children[$childModule->getIdentifier()])) {
         throw new \LogicException(sprintf('%s: the module identifier "%s" is already registered as child!', __CLASS__, $childModule->getIdentifier()), 1322818691);
     }
     $this->children[$childModule->getIdentifier()] = $childModule;
     $childModule->setParent($this);
     if ($this->isInitialized() && !$childModule->isInitialized()) {
         call_user_func($this->dependencyInjector, $childModule);
         $childModule->initialize();
     }
     return $this;
 }
 /**
  * Render callback.
  *
  * This is the view template callback function that forwards the
  * render message to the current action.
  *
  * Note: The current action template is wrapped inside a DIV.Action tag.
  *
  * @param \Nethgui\Renderer\Xhtml $view The view
  * @return string
  */
 public function renderCurrentAction(\Nethgui\Renderer\Xhtml $view)
 {
     $flags = $view::INSET_WRAP;
     if ($this->needsAutoFormWrap($this->currentAction)) {
         $flags |= $view::INSET_FORM;
     }
     return $view->inset($this->currentAction->getIdentifier(), $flags);
 }
 public function onParametersSaved(\Nethgui\Module\ModuleInterface $currentAction, $changes, $parameters)
 {
     $actionName = $currentAction->getIdentifier();
     if ($actionName === 'update') {
         $actionName = 'modify';
     }
     $this->getPlatform()->signalEvent(sprintf('host-%s &', $actionName));
 }
 /**
  * Create a new instance from basic module informations
  * 
  * @param \Nethgui\Module\ModuleInterface $module
  * @return SimpleModuleAttributesProvider 
  */
 public function initializeFromModule(\Nethgui\Module\ModuleInterface $module)
 {
     $i = $module->getIdentifier();
     $this->title = $i . '_Title';
     $this->description = $i . '_Description';
     $this->languageCatalog = strtr(get_class($module), '\\', '_');
     $this->tags = $i . '_Tags';
     return $this;
 }
예제 #5
0
 public function spawnView(\Nethgui\Module\ModuleInterface $module, $register = FALSE)
 {
     $spawnedView = new static($this->targetFormat, $module, $this->translator, $this->urlParts);
     $spawnedView->commands = $this->getCommands();
     if ($register === TRUE) {
         $this[$module->getIdentifier()] = $spawnedView;
     } elseif (is_string($register)) {
         $this[$register] = $spawnedView;
     }
     return $spawnedView;
 }
예제 #6
0
 public function getSuccessor(\Nethgui\Module\ModuleInterface $m)
 {
     $successor = NULL;
     $pos = $this->getStepList();
     while ($child = array_shift($pos)) {
         if ($m->getIdentifier() === $child->getIdentifier()) {
             $successor = array_shift($pos);
             break;
         }
     }
     return $successor;
 }