当前位置: 首页>>代码示例>>PHP>>正文


PHP PhpRenderer::formElementErrors方法代码示例

本文整理汇总了PHP中Zend\View\Renderer\PhpRenderer::formElementErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpRenderer::formElementErrors方法的具体用法?PHP PhpRenderer::formElementErrors怎么用?PHP PhpRenderer::formElementErrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\View\Renderer\PhpRenderer的用法示例。


在下文中一共展示了PhpRenderer::formElementErrors方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderFieldset

 /** {@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;
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:69,代码来源:ClientConfig.php

示例2: renderFieldset

 /** {@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;
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:40,代码来源:ManageRegistryValues.php

示例3: renderFieldset

 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset = null)
 {
     $output = "<div class='table'>\n";
     $fields = $this->get('Fields');
     foreach ($this->_definedFields as $name => $type) {
         $element = $fields->get($name);
         if ($element->getMessages()) {
             $element->setAttribute('class', 'input-error');
         }
         $row = $view->formText($element) . "\n";
         $row .= $view->htmlTag('span', $view->translate($type), array('class' => 'cell'));
         $row .= $view->htmlTag('span', $view->htmlTag('a', $view->translate('Delete'), array('href' => $view->consoleUrl('preferences', 'deletefield', array('name' => $name))), true), array('class' => 'cell'));
         $output .= $view->htmlTag('div', $row, array('class' => 'row'));
         $output .= $view->formElementErrors($element, array('class' => 'error'));
         $output .= "\n";
     }
     $newName = $this->get('NewName');
     $output .= $view->htmlTag('div', $view->formRow($newName, null, false) . $view->formRow($this->get('NewType')), array('class' => 'row'));
     $output .= $view->formElementErrors($newName, array('class' => 'error'));
     $output .= $view->formRow($this->get('Submit'));
     $output .= "\n</div>\n";
     return $output;
 }
开发者ID:patrickpreuss,项目名称:Braintacle,代码行数:24,代码来源:DefineFields.php

示例4: renderFieldset

 /** {@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;
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:20,代码来源:AddToGroup.php

示例5: renderFieldset

 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset = null)
 {
     $output = "<div class='table'>\n";
     $types = $this->get('Types');
     foreach ($this->_definedTypes as $name => $count) {
         $element = $types->get($name);
         if ($element->getMessages()) {
             $element->setAttribute('class', 'input-error');
         }
         $row = $view->formText($element);
         if ($count == 0) {
             $row .= $view->htmlElement('a', $view->translate('Delete'), array('href' => $view->consoleUrl('preferences', 'deletedevicetype', array('name' => $name))), true);
         }
         $output .= $view->htmlElement('div', $row);
         $output .= $view->formElementErrors($element, array('class' => 'error'));
         $output .= "\n";
     }
     $add = $this->get('Add');
     $output .= $view->formRow($add, null, false);
     $output .= $view->formElementErrors($add, array('class' => 'error'));
     $output .= $view->formRow($this->get('Submit'));
     $output .= "\n</div>\n";
     return $output;
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:25,代码来源:NetworkDeviceTypes.php


注:本文中的Zend\View\Renderer\PhpRenderer::formElementErrors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。