Beispiel #1
0
 protected function renderContent()
 {
     // force container tag to FIELDSET:
     $this->setAttribute('tag', 'fieldset');
     $flags = $this->getAttribute('flags', 0);
     if ($flags & \Nethgui\Renderer\WidgetFactoryInterface::FIELDSET_EXPANDABLE) {
         $this->setAttribute('class', 'Fieldset expandable');
     } else {
         $this->setAttribute('class', 'Fieldset');
     }
     $labelWidget = new TextLabel($this->view);
     $labelWidget->setAttribute('tag', 'span');
     $renderLegend = FALSE;
     if ($this->hasAttribute('name')) {
         $labelWidget->setAttribute('name', $this->getAttribute('name'));
         $renderLegend = TRUE;
     }
     if ($this->hasAttribute('template')) {
         $labelWidget->setAttribute('template', $this->getAttribute('template'));
         $renderLegend = TRUE;
     }
     if ($renderLegend && !($flags & \Nethgui\Renderer\WidgetFactoryInterface::LABEL_NONE)) {
         $legendWidget = $this->view->panel()->setAttribute('tag', 'legend')->insert($labelWidget);
         if ($this->hasAttribute('icon-before')) {
             $legendWidget->prepend($this->view->literal($this->openTag('span', array('class' => 'ui-icon ' . $this->getAttribute('icon-before'))) . $this->closeTag('span')));
         }
         if ($this->hasAttribute('icon-after')) {
             $legendWidget->append($this->view->literal($this->openTag('span', array('class' => 'ui-icon ' . $this->getAttribute('icon-after'))) . $this->closeTag('span')));
         }
         $this->prepend($legendWidget);
     }
     return parent::renderContent();
 }
Beispiel #2
0
 private function renderWidgetList($value, $choices, $attributes)
 {
     $name = $this->getAttribute('name');
     $flags = $this->getAttribute('flags');
     $hiddenWidget = new Hidden($this->view);
     $hiddenWidget->setAttribute('flags', $flags)->setAttribute('value', '')->setAttribute('class', 'Hidden')->setAttribute('name', $name);
     $contentWidget = new Literal($this->view);
     $contentWidget->setAttribute('data', $this->generateSelectorContentWidgetList($name, $value, $choices, $flags));
     $panelWidget = new Panel($this->view);
     $panelWidget->setAttribute('class', $attributes['class'])->setAttribute('name', $name)->insert($hiddenWidget)->insert($contentWidget);
     if ($this->getAttribute('flags') & \Nethgui\Renderer\WidgetFactoryInterface::LABEL_NONE) {
         return $panelWidget->renderContent();
     }
     $fieldsetWidget = new Fieldset($this->view);
     $fieldsetWidget->setAttribute('template', $this->getAttribute('label', $this->getTranslateClosure($name . '_label')))->setAttribute('flags', $this->getAttribute('flags'));
     if ($this->hasAttribute('icon-before')) {
         $fieldsetWidget->setAttribute('icon-before', $this->getAttribute('icon-before'));
     }
     $fieldsetWidget->insert($panelWidget);
     return $fieldsetWidget->renderContent();
 }
Beispiel #3
0
 protected function renderContent()
 {
     // Ensure a name is defined:
     if (!$this->hasAttribute('name')) {
         $this->setAttribute('name', 'FormAction');
     }
     $name = $this->getAttribute('name');
     if (isset($this->view[$name])) {
         $action = $this->view[$name];
     } else {
         // Rely on action attribute as fallback:
         $action = $this->view->getModuleUrl($this->getAttribute('action', ''));
     }
     // Clear the INSET_FORM flag as the form is now rendered.
     $this->getRenderer()->rejectFlag(\Nethgui\Renderer\WidgetFactoryInterface::INSET_FORM);
     $attributes = array('method' => $this->getAttribute('method', 'post'), 'action' => $action, 'class' => 'Form ' . $this->getClientEventTarget());
     // Change default panel wrap tag:
     $this->setAttribute('tag', $this->getAttribute('tag', FALSE));
     $content = '';
     $content .= $this->openTag('form', $attributes);
     $content .= parent::renderContent();
     $content .= $this->closeTag('form');
     return $content;
 }
Beispiel #4
0
 protected function renderContent()
 {
     $childCountClass = ' c' . count($this->getChildren());
     $this->setAttribute('class', $this->getAttribute('class', 'columns') . $childCountClass);
     return parent::renderContent();
 }