/** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = '';
     if ($fieldset->has('Groups')) {
         $groups = $fieldset->get('Groups');
         if ($groups->count()) {
             $output = "<div>\n";
             foreach ($groups as $element) {
                 if ($element instanceof \Zend\Form\Element\Radio) {
                     $label = $view->htmlTag('a', $view->escapeHtml($element->getLabel()), array('href' => $view->consoleUrl('group', 'general', array('name' => $element->getLabel()))));
                     $output .= $view->htmlTag('fieldset', "<legend>{$label}</legend>\n" . $view->formRadio($element));
                 }
             }
             $output .= $view->formRow($fieldset->get('Submit'));
             $output .= "\n</div>\n";
         }
     }
     return $output;
 }
Esempio n. 2
0
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = '';
     if ($fieldset->has('Packages')) {
         $packages = $fieldset->get('Packages');
         if ($packages->count()) {
             $formRow = $view->plugin('FormRow');
             $translatorEnabled = $formRow->isTranslatorEnabled();
             $formRow->setTranslatorEnabled(false);
             $output = "<div class='table'>\n";
             foreach ($packages as $package) {
                 $output .= $view->formRow($package, 'append') . "\n\n";
             }
             $output .= "<span class='cell'></span>\n";
             $output .= $view->formSubmit($fieldset->get('Submit')) . "\n";
             $output .= "</div>\n";
             $formRow->setTranslatorEnabled($translatorEnabled);
         }
     }
     return $output;
 }
Esempio n. 3
0
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $name = $fieldset->getName();
     if ($name) {
         $default = $view->translate('Default');
         $effective = $view->translate('Effective');
         $yes = $view->translate('Yes');
         $no = $view->translate('No');
         switch ($name) {
             case 'Agent':
                 $legend = $view->translate('Agent');
                 break;
             case 'Download':
                 $legend = $view->translate('Download');
                 break;
             case 'Scan':
                 $legend = $view->translate('Network scanning');
                 break;
         }
         $output = "<div class='table'>\n";
         foreach ($fieldset as $element) {
             if ($element->getAttribute('disabled')) {
                 continue;
             }
             preg_match('/.*\\[(.*)\\]$/', $element->getName(), $matches);
             $option = $matches[1];
             if ($option == 'scanThisNetwork') {
                 $row = '';
             } else {
                 $defaultValue = $this->_object->getDefaultConfig($option);
                 if ($element instanceof Element\Checkbox) {
                     $defaultValue = $defaultValue ? $yes : $no;
                 }
                 $row = sprintf('%s: %s', $default, $defaultValue);
                 if ($this->_object instanceof \Model\Client\Client) {
                     $effectiveValue = $this->_object->getEffectiveConfig($option);
                     if ($element instanceof Element\Checkbox) {
                         $effectiveValue = $effectiveValue ? $yes : $no;
                     }
                     $row .= sprintf(', %s: %s', $effective, $effectiveValue);
                 }
                 $row = $view->escapeHtml("({$row})");
             }
             if ($element->getMessages()) {
                 $element->setAttribute('class', 'input-error');
             }
             $row = $view->htmlElement('span', $view->formElement($element) . $row, array('class' => 'values'));
             $row = $view->htmlElement('span', $view->translate($element->getLabel()), array('class' => 'label')) . $row;
             $output .= $view->htmlElement('label', $row);
             if ($element->getMessages()) {
                 $output .= $view->htmlElement('span', null, array('class' => 'cell'));
                 $output .= $view->formElementErrors($element, array('class' => 'error'));
             }
         }
         $output .= "</div>\n";
         $output = $view->htmlElement('fieldset', $view->htmlElement('legend', $legend) . $output);
     } else {
         $output = "<div class='table'>\n";
         foreach ($fieldset as $element) {
             if ($element instanceof \Zend\Form\Fieldset) {
                 $output .= $this->renderFieldset($view, $element);
             }
         }
         $output .= $view->formRow($fieldset->get('Submit'));
         $output .= "</div>\n";
     }
     return $output;
 }
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset = null)
 {
     $output = '';
     $name = $fieldset->getName();
     switch ($name) {
         case 'inspect':
             $output .= "<div class='textcenter'>\n";
             $output .= $view->formRow($fieldset->get('inspect'), 'append') . "\n";
             $output .= "</div>\n";
             break;
         case 'existing':
             $table = '';
             foreach ($this->_definedValues as $value) {
                 $id = $value['Id'];
                 $element = $fieldset->get("value_{$id}_name");
                 $row = $view->htmlElement('td', $view->formElement($element) . $view->formElementErrors($element, array('class' => 'errors')));
                 $row .= $view->htmlElement('td', $view->escapeHtml($element->getLabel()));
                 $row .= $view->htmlElement('td', $view->htmlElement('a', $view->translate('Delete'), array('href' => $view->consoleUrl('preferences', 'deleteregistryvalue', array('name' => $value['Name'])))));
                 $table .= $view->htmlElement('tr', $row);
             }
             $output .= $view->htmlElement('table', $table);
             break;
         case 'new_value':
             $output .= parent::renderFieldset($view, $fieldset);
             break;
         default:
             if ($fieldset == $this) {
                 $output .= $this->renderFieldset($view, $fieldset->get('inspect'));
                 if (count($this->_definedValues)) {
                     $output .= $view->htmlElement('h2', $view->translate('Values'));
                     $output .= $this->renderFieldset($view, $fieldset->get('existing'));
                 }
                 $output .= $view->htmlElement('h2', $view->translate('Add'));
                 $output .= $this->renderFieldset($view, $fieldset->get('new_value'));
             }
             break;
     }
     return $output;
 }
Esempio n. 5
0
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = "<div class='table'>\n";
     $output .= "<fieldset><legend><span>What to save</span></legend>\n";
     $output .= $view->formRow($fieldset->get('What'));
     $output .= "</fieldset>\n";
     $output .= "<fieldset><legend><span>Where to save</span></legend>\n";
     $output .= $view->formRow($fieldset->get('Where'));
     foreach (array('NewGroup', 'Description') as $name) {
         $element = $fieldset->get($name);
         $output .= $view->formRow($element, null, false);
         $output .= $view->formElementErrors($element, array('class' => 'error'));
     }
     $output .= $view->formRow($fieldset->get('ExistingGroup'));
     $output .= "</fieldset>\n";
     $output .= $view->formRow($fieldset->get('Submit'));
     $output .= "</div>\n";
     return $output;
 }
Esempio n. 6
0
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     if ($fieldset->getName() == 'Fields') {
         // Labels (except "Category") are user defined and must not be translated.
         $fieldset->get('TAG')->setLabel($view->translate('Category'));
         $formRow = $view->plugin('FormRow');
         $translatorEnabled = $formRow->isTranslatorEnabled();
         $formRow->setTranslatorEnabled(false);
         $output = parent::renderFieldset($view, $fieldset);
         $formRow->setTranslatorEnabled($translatorEnabled);
     } else {
         $output = $this->renderFieldset($view, $this->get('Fields'));
         $output .= "<div class='table'>\n";
         $output .= "<span class='cell'></span>\n";
         $output .= $view->formSubmit($fieldset->get('Submit')) . "\n";
         $output .= "</div>\n";
     }
     return $output;
 }
Esempio n. 7
0
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = $view->htmlTag('div', $view->formRow($fieldset->get('DeleteInterfaces'), 'append'));
     $output .= $view->htmlTag('div', $view->formRow($fieldset->get('yes')) . $view->formRow($fieldset->get('no')));
     return $output;
 }