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


PHP PhpRenderer::translate方法代码示例

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


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

示例1: form

 /**
  * {@inheritDoc}
  */
 public function form(PhpRenderer $view, array $options = [])
 {
     $urlInput = new UrlElement('o:media[__index__][o:source]');
     $urlInput->setOptions(['label' => $view->translate('oEmbed URL'), 'info' => $view->translate('URL for the media to embed.')]);
     $urlInput->setAttributes(['id' => 'media-oembed-source-__index__', 'required' => true]);
     return $view->formRow($urlInput);
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:10,代码来源:OEmbed.php

示例2: getForm

 /**
  * Get the HTML editor textarea markup.
  *
  * @param PhpRenderer $view
  * @param string $id HTML ID for the textarea
  * @param string $value Value to pre-fill
  *
  * @return string
  */
 protected function getForm(PhpRenderer $view, $id, $value = '')
 {
     $view->ckEditor();
     $textarea = new Textarea('o:media[__index__][html]');
     $textarea->setOptions(['label' => $view->translate('HTML'), 'info' => $view->translate('HTML or plain text.')]);
     $textarea->setAttributes(['rows' => 15, 'id' => $id, 'required' => true, 'class' => 'media-html', 'value' => $value]);
     $field = $view->formRow($textarea);
     $field .= "\n            <script type='text/javascript'>\n                \$('#{$id}').ckeditor();\n            </script>\n        ";
     return $field;
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:19,代码来源:Html.php

示例3: form

 public function form(PhpRenderer $view, SiteRepresentation $site, SitePageBlockRepresentation $block = null)
 {
     $text = new Text("o:block[__blockIndex__][o:data][query]");
     if ($block) {
         $text->setAttribute('value', $this->getData($block->data(), 'query'));
     }
     $html = '<div class="field"><div class="field-meta">';
     $html .= '<label>' . $view->translate('Query') . '</label>';
     $html .= '<div class="field-description">' . $view->translate('Display resources using this search query') . '</div>';
     $html .= '</div>';
     $html .= '<div class="inputs">' . $view->formRow($text) . '</div></div>';
     return $html;
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:13,代码来源:BrowsePreview.php

示例4: form

 /**
  * {@inheritDoc}
  */
 public function form(PhpRenderer $view, array $options = [])
 {
     $fileInput = new File('file[__index__]');
     $fileInput->setOptions(['label' => $view->translate('Upload File')]);
     $fileInput->setAttributes(['id' => 'media-file-input-__index__']);
     $field = $view->formRow($fileInput);
     return $field . '<input type="hidden" name="o:media[__index__][file_index]" value="__index__">';
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:11,代码来源:Upload.php

示例5: getItems

 /**
  * @see \Auth\Dependency\ListInterface::getItems()
  */
 public function getItems(User $user, View $view, $limit)
 {
     $items = [];
     foreach ($this->repository->getUserJobs($user->getId(), $limit) as $job) {
         $title = $job->getTitle() ?: $view->translate('untitled');
         $title .= ' (' . $view->dateFormat($job->getDateCreated(), 'short', 'none') . ')';
         $url = $view->url('lang/jobs/manage', ['action' => 'edit'], ['query' => ['id' => $job->getId()]]);
         $items[] = new ListItem($title, $url);
     }
     return $items;
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:14,代码来源:ListListener.php

示例6: form

 /**
  * {@inheritDoc}
  */
 public function form(PhpRenderer $view, array $options = [])
 {
     $urlInput = new UrlElement('o:media[__index__][o:source]');
     $urlInput->setOptions(['label' => $view->translate('Video URL'), 'info' => $view->translate('URL for the video to embed.')]);
     $urlInput->setAttributes(['id' => 'media-youtube-source-__index__', 'required' => true]);
     $urlInput->setAttributes(['id' => 'media-youtube-source-__index__', 'required' => true]);
     $startInput = new Text('o:media[__index__][start]');
     $startInput->setOptions(['label' => $view->translate('Start'), 'info' => $view->translate('Begin playing the video at the given number of seconds from the start of the video.')]);
     $endInput = new Text('o:media[__index__][end]');
     $endInput->setOptions(['label' => $view->translate('End'), 'info' => $view->translate('End playing the video at the given number of seconds from the start of the video.')]);
     return $view->formRow($urlInput) . $view->formRow($startInput) . $view->formRow($endInput);
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:15,代码来源:Youtube.php

示例7: renderFieldset

 /**
  * Render all elements from a fieldset
  *
  * This method iterates over all elements from the given fieldset and
  * renders them in a way appropriate for each element type. Subclasses with
  * more specialized rendering may extend or replace this method.
  *
  * @param \Zend\View\Renderer\PhpRenderer $view
  * @param \Zend\Form\Fieldset $fieldset
  * @return string HTML code
  */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = '<div class="table">';
     foreach ($fieldset as $element) {
         $row = '';
         if ($element instanceof \Zend\Form\Element\Submit) {
             $row .= "<span class='cell'></span>\n";
             $row .= $view->formSubmit($element);
         } elseif ($element instanceof \Zend\Form\Fieldset) {
             $row .= $view->htmlTag('span', $view->translate($element->getLabel()), array('class' => 'label'), true) . "\n";
             $row .= $view->htmlTag('fieldset', "<legend></legend>\n" . $this->renderFieldset($view, $element));
         } elseif (!$element instanceof \Zend\Form\Element\Csrf) {
             $row .= $view->formRow($element, 'prepend', false);
             if ((string) $element->getLabel() == '') {
                 $row = "<div class='row'>\n<span class='label'></span>\n{$row}\n</div>";
             }
             if ($element->getMessages()) {
                 $row .= "\n<span class='cell'></span>\n";
                 $row .= $view->formElementErrors($element, array('class' => 'errors'));
             }
             if ($element->hasAttribute('id')) {
                 // The FormRow helper renders the label differently: It
                 // precedes the element instead of encapsulating it.
                 // Add a div wrapper to achieve the same appearance.
                 $row = "<div class='row'>\n{$row}\n</div>";
             }
         }
         $output .= $row . "\n";
     }
     $output .= "</div>\n";
     return $output;
 }
开发者ID:patrickpreuss,项目名称:Braintacle,代码行数:43,代码来源:Form.php

示例8: render

    /** {@inheritdoc} */
    public function render(\Zend\View\Renderer\PhpRenderer $view)
    {
        $commandLine = $view->translate('Command line');
        $labels = array('launch' => $commandLine, 'execute' => $commandLine, 'store' => $view->translate('Target Path'));
        $labels = '    var actionParamLabels = ' . json_encode($labels) . ";\n";
        $view->headScript()->captureStart();
        print $labels;
        ?>

        /**
         * Hide or display a block element.
         */
        function display(name, display)
        {
            document.getElementsByName(name)[0].parentNode.style.display = display ? 'table-row' : 'none';
        }

        /*
         * Event handler for Platform combobox. Also called for form
         * initialization. Hides/displays notification elements which have no
         * effect on non-Windows platforms.
         */
        function changePlatform()
        {
            if (document.getElementById('form_package_build_platform').value == 'windows') {
                display('Warn', true);
                display('PostInstMessage', true);
                toggleWarn();
            } else {
                display('Warn', false);
                display('WarnMessage', false);
                display('WarnCountdown', false);
                display('WarnAllowAbort', false);
                display('WarnAllowDelay', false);
                display('PostInstMessage', false);
            }
        }

        /*
         * Event handler for Action combobox. Also called for form initialization.
         * Changes label of parameter input field according to selected action.
         */
        function changeParam()
        {
            var label = actionParamLabels[document.getElementsByName('DeployAction')[0].value];
            document.getElementsByName('ActionParam')[0].parentNode.getElementsByTagName('span')[0].innerHTML = label;
        }

        /*
         * Event handler for Warn checkbox. Also called for form initialization.
         * Hides or displays Warn* fields according to checked state.
         */
        function toggleWarn()
        {
            var checked = document.getElementById('form_package_build_warn').checked &&
                          document.getElementById('form_package_build_platform').value == 'windows';
            display('WarnMessage', checked);
            display('WarnCountdown', checked);
            display('WarnAllowAbort', checked);
            display('WarnAllowDelay', checked);
        }

        <?php 
        $view->headScript()->captureEnd();
        $view->placeholder('BodyOnLoad')->append('changePlatform()');
        $view->placeholder('BodyOnLoad')->append('changeParam()');
        $view->placeholder('BodyOnLoad')->append('toggleWarn()');
        $view->placeholder('BodyOnLoad')->append('document.getElementsByName("Name")[0].focus()');
        return parent::render($view);
    }
开发者ID:hschletz,项目名称:braintacle,代码行数:71,代码来源:Build.php

示例9: 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

示例10: 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

示例11: renderFieldset

 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $headers = array('Id' => 'ID', 'Name' => $view->translate('Name'), 'NetworkInterface.MacAddress' => $view->translate('MAC address'), 'Serial' => $view->translate('Serial number'), 'AssetTag' => $view->translate('Asset tag'), 'LastContactDate' => $view->translate('Last contact'));
     $renderCriteria = function ($view, $client, $property) {
         $value = $client[$property];
         if ($value === null) {
             // NULL values are never considered for duplicates and cannot be blacklisted.
             return;
         }
         if ($property == 'NetworkInterface.MacAddress') {
             $property = 'MacAddress';
         }
         // Hyperlink to blacklist form
         return $view->htmlElement('a', $view->escapeHtml($value), array('href' => $view->consoleUrl('duplicates', 'allow', array('criteria' => $property, 'value' => $value))), true);
     };
     $renderCallbacks = array('Id' => function ($view, $client) {
         // Display ID and a checkbox. Render checkbox manually because
         // ZF's MultiCheckbox element does not handle duplicate values.
         // $_POST['clients'] will become an array of selected
         // (possibly duplicate) IDs.
         return sprintf('<input type="checkbox" name="clients[]" value="%d">%d', $client['Id'], $client['Id']);
     }, 'Name' => function ($view, $client) {
         // Hyperlink to "customfields" page of given client.
         // This allows for easy review of the information about to be merged.
         return $view->htmlElement('a', $view->escapeHtml($client['Name']), array('href' => $view->consoleUrl('client', 'customfields', array('id' => $client['Id']))), true);
     }, 'NetworkInterface.MacAddress' => $renderCriteria, 'Serial' => $renderCriteria, 'AssetTag' => $renderCriteria);
     $formContent = $view->table($this->getOption('clients'), $headers, array('order' => $this->getOption('order'), 'direction' => $this->getOption('direction')), $renderCallbacks);
     $formContent .= "<div>\n";
     foreach ($this as $element) {
         $formContent .= $view->formRow($element, 'append') . "\n";
     }
     $formContent .= "</div>\n";
     return $formContent;
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:35,代码来源:ShowDuplicates.php

示例12: renderFieldset

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

示例13: 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

示例14: form

 public function form(PhpRenderer $view, array $options = [])
 {
     $urlInput = new UrlElement('o:media[__index__][o:source]');
     $urlInput->setOptions(['label' => $view->translate('IIIF Image URL'), 'info' => $view->translate('URL for the image to embed.')]);
     return $view->formRow($urlInput);
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:6,代码来源:IIIF.php

示例15: 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::translate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。