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


PHP Tag::select方法代码示例

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


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

示例1: registryFunctions

 /**
  * Registers common function in Twig
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  * @param \Phalcon\DiInterface       $di
  * @param array                      $userFunctions
  */
 protected function registryFunctions($view, DiInterface $di, $userFunctions = array())
 {
     $options = array('is_safe' => array('html'));
     $functions = array(new \Twig_SimpleFunction('content', function () use($view) {
         return $view->getContent();
     }, $options), new \Twig_SimpleFunction('partial', function ($partialPath) use($view) {
         return $view->partial($partialPath);
     }, $options), new \Twig_SimpleFunction('linkTo', function ($parameters, $text = null) {
         return \Phalcon\Tag::linkTo($parameters, $text);
     }, $options), new \Twig_SimpleFunction('textField', function ($parameters) {
         return \Phalcon\Tag::textField($parameters);
     }, $options), new \Twig_SimpleFunction('passwordField', function ($parameters) {
         return \Phalcon\Tag::passwordField($parameters);
     }, $options), new \Twig_SimpleFunction('hiddenField', function ($parameters) {
         return \Phalcon\Tag::hiddenField($parameters);
     }, $options), new \Twig_SimpleFunction('fileField', function ($parameters) {
         return \Phalcon\Tag::fileField($parameters);
     }, $options), new \Twig_SimpleFunction('checkField', function ($parameters) {
         return \Phalcon\Tag::checkField($parameters);
     }, $options), new \Twig_SimpleFunction('radioField', function ($parameters) {
         return \Phalcon\Tag::radioField($parameters);
     }, $options), new \Twig_SimpleFunction('submitButton', function ($parameters) {
         return \Phalcon\Tag::submitButton($parameters);
     }, $options), new \Twig_SimpleFunction('selectStatic', function ($parameters, $data = array()) {
         return \Phalcon\Tag::selectStatic($parameters, $data);
     }, $options), new \Twig_SimpleFunction('select', function ($parameters, $data = array()) {
         return \Phalcon\Tag::select($parameters, $data);
     }, $options), new \Twig_SimpleFunction('textArea', function ($parameters) {
         return \Phalcon\Tag::textArea($parameters);
     }, $options), new \Twig_SimpleFunction('form', function ($parameters = array()) {
         return \Phalcon\Tag::form($parameters);
     }, $options), new \Twig_SimpleFunction('endForm', function () {
         return \Phalcon\Tag::endForm();
     }, $options), new \Twig_SimpleFunction('getTitle', function () {
         return \Phalcon\Tag::getTitle();
     }, $options), new \Twig_SimpleFunction('stylesheetLink', function ($parameters = null, $local = true) {
         return \Phalcon\Tag::stylesheetLink($parameters, $local);
     }, $options), new \Twig_SimpleFunction('javascriptInclude', function ($parameters = null, $local = true) {
         return \Phalcon\Tag::javascriptInclude($parameters, $local);
     }, $options), new \Twig_SimpleFunction('image', function ($parameters) {
         return \Phalcon\Tag::image($parameters);
     }, $options), new \Twig_SimpleFunction('friendlyTitle', function ($text, $separator = null, $lowercase = true) {
         return \Phalcon\Tag::friendlyTitle($text, $separator, $lowercase);
     }, $options), new \Twig_SimpleFunction('getDocType', function () {
         return \Phalcon\Tag::getDocType();
     }, $options), new \Twig_SimpleFunction('getSecurityToken', function () use($di) {
         return $di->get("security")->getToken();
     }, $options), new \Twig_SimpleFunction('getSecurityTokenKey', function () use($di) {
         return $di->get("security")->getTokenKey();
     }, $options), new \Twig_SimpleFunction('url', function ($route) use($di) {
         return $di->get("url")->get($route);
     }, $options));
     if (!empty($userFunctions)) {
         $functions = array_merge($functions, $userFunctions);
     }
     foreach ($functions as $function) {
         $this->twig->addFunction($function);
     }
 }
开发者ID:lisong,项目名称:incubator,代码行数:66,代码来源:Twig.php

示例2: select

 public static function select($parameters, $data = NULL)
 {
     if (self::isAbFormField($parameters)) {
         $view = KxApplication::current()->view;
         $itemViewMode = $view->getVar('itemViewMode');
         return AbTag::formSelect($parameters, $itemViewMode);
     }
     $data = $parameters['data'];
     return Tag::select($parameters, $data);
 }
开发者ID:healerkx,项目名称:AdminBuildr,代码行数:10,代码来源:AbTag.php

示例3: registryFunctions

 /**
  * Registers common function in Twig
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  */
 private function registryFunctions($view)
 {
     $options = array('is_safe' => array('html'));
     $functions = array(new \Twig_SimpleFunction('content', function () use($view) {
         return $view->getContent();
     }, $options), new \Twig_SimpleFunction('partial', function ($partialPath) use($view) {
         return $view->partial($partialPath);
     }, $options), new \Twig_SimpleFunction('linkTo', function ($parameters, $text = null) {
         return \Phalcon\Tag::linkTo($parameters, $text);
     }, $options), new \Twig_SimpleFunction('textField', function ($parameters) {
         return \Phalcon\Tag::textField($parameters);
     }, $options), new \Twig_SimpleFunction('passwordField', function ($parameters) {
         return \Phalcon\Tag::passwordField($parameters);
     }, $options), new \Twig_SimpleFunction('hiddenField', function ($parameters) {
         return \Phalcon\Tag::hiddenField($parameters);
     }, $options), new \Twig_SimpleFunction('fileField', function ($parameters) {
         return \Phalcon\Tag::fileField($parameters);
     }, $options), new \Twig_SimpleFunction('checkField', function ($parameters) {
         return \Phalcon\Tag::checkField($parameters);
     }, $options), new \Twig_SimpleFunction('radioField', function ($parameters) {
         return \Phalcon\Tag::radioField($parameters);
     }, $options), new \Twig_SimpleFunction('submitButton', function ($parameters) {
         return \Phalcon\Tag::submitButton($parameters);
     }, $options), new \Twig_SimpleFunction('selectStatic', function ($parameters, $data = []) {
         return \Phalcon\Tag::selectStatic($parameters, $data);
     }, $options), new \Twig_SimpleFunction('select', function ($parameters, $data = []) {
         return \Phalcon\Tag::select($parameters, $data);
     }, $options), new \Twig_SimpleFunction('textArea', function ($parameters) {
         return \Phalcon\Tag::textArea($parameters);
     }, $options), new \Twig_SimpleFunction('form', function ($parameters = []) {
         return \Phalcon\Tag::form($parameters);
     }, $options), new \Twig_SimpleFunction('endForm', function () {
         return \Phalcon\Tag::endForm();
     }, $options), new \Twig_SimpleFunction('getTitle', function () {
         return \Phalcon\Tag::getTitle();
     }, $options), new \Twig_SimpleFunction('getTitle', function () {
         return \Phalcon\Tag::getTitle();
     }, $options), new \Twig_SimpleFunction('stylesheetLink', function ($parameters = null, $local = true) {
         return \Phalcon\Tag::stylesheetLink($parameters, $local);
     }, $options), new \Twig_SimpleFunction('javascriptInclude', function ($parameters = null, $local = true) {
         return \Phalcon\Tag::javascriptInclude($parameters, $local);
     }, $options), new \Twig_SimpleFunction('image', function ($parameters) {
         return \Phalcon\Tag::image($parameters);
     }, $options), new \Twig_SimpleFunction('friendlyTitle', function ($text, $separator = null, $lowercase = true) {
         return \Phalcon\Tag::friendlyTitle($text, $separator, $lowercase);
     }, $options), new \Twig_SimpleFunction('getDocType', function () {
         return \Phalcon\Tag::getDocType();
     }, $options));
     foreach ($functions as $function) {
         $this->_twig->addFunction($function);
     }
 }
开发者ID:tashik,项目名称:phalcon_core,代码行数:57,代码来源:Twig.php

示例4: testSelectBasic

 /**
  * Tests an image tag with a bare minimum of information passed
  *
  * @author Nikos Dimopoulos <nikos@niden.net>
  * @since  2012-09-09
  */
 public function testSelectBasic()
 {
     // Populate the table
     // Empty the relationship table first
     $this->emptyTable('robots_parts');
     $this->populateTable('robots');
     $this->populateTable('robots_parts');
     $robots = \Robots::find();
     $params = array('some_name', $robots, 'using' => array('id', 'name'));
     $expected = '<select id="some_name" name="some_name">' . PHP_EOL . chr(9) . '<option value="1">Robotina</option>' . PHP_EOL . chr(9) . '<option value="2">Astro Boy</option>' . PHP_EOL . chr(9) . '<option value="3">Terminator</option>' . PHP_EOL . '</select>';
     $actual = PhTag::select($params);
     $this->assertEquals($expected, $actual, sprintf($this->message, 'select basic'));
 }
开发者ID:lisong,项目名称:cphalcon,代码行数:19,代码来源:Model.php

示例5: form

 /**
  * @return string
  */
 public function form()
 {
     $title = isset($this->options->title) ? $this->options->title : "";
     $slide_show_id = isset($this->options->slide_show_id) ? $this->options->slide_show_id : "";
     $form = '<p><label for="' . $this->getFieldId('title') . '">' . __('gb_title') . '</label>';
     $form .= Tag::textField([$this->getFieldName('title'), 'class' => 'form-control input-sm', 'value' => $title]);
     $form .= '</p>';
     $form .= '<p><label for="' . $this->getFieldId('slide_show_id') . '">' . __('w_slide_show_form_id_slide_show') . '</label><br/>';
     //Get all slide show
     $slideShows = SlideShows::find(['conditions' => 'published = 1', 'order' => 'slide_show_id ASC']);
     $form .= Tag::select([$this->getFieldName('slide_show_id'), $slideShows, 'using' => ['slide_show_id', 'title'], 'class' => 'form-control input-sm', 'value' => $slide_show_id]);
     $form .= '</p>';
     return $form;
 }
开发者ID:kimthangatm,项目名称:zcms,代码行数:17,代码来源:slideshow.php

示例6: notestSelectBasic

 /**
  * Tests an image tag with a bare minimum of information passed
  *
  * @author Nikolaos Dimopoulos <nikos@niden.net>
  * @since  2014-10-17
  */
 public function notestSelectBasic()
 {
     //        $user = new User();
     //        $user->setName('Miles');
     //        $user->setSurname('Davis');
     //        $user->save();
     //        $this->assertEquals('Miles Davis', $user->getFullName());
     //        $this->unitTester->seeInDatabase('users',array('name' => 'Miles', 'surname' => 'Davis'));
     $select = Select::find();
     $params = array('some_name', $select, 'using' => array('id', 'name'));
     $expected = '<select name="some_name" id="some_name">' . PHP_EOL . chr(9) . '<option value="1">Robotina</option>' . PHP_EOL . chr(9) . '<option value="2">Astro Boy</option>' . PHP_EOL . chr(9) . '<option value="3">Terminator</option>' . PHP_EOL . '</select>';
     $actual = PhTag::select($params);
     $this->assertEquals($expected, $actual, sprintf($this->message, 'select basic'));
 }
开发者ID:lisong,项目名称:cphalcon,代码行数:20,代码来源:TagBase.php

示例7: form

 /**
  * Admin widget form
  *
  * @return string
  */
 public function form()
 {
     $menu_left = isset($this->options->menu_left) ? $this->options->menu_left : '';
     $menu_right = isset($this->options->menu_right) ? $this->options->menu_right : '';
     $title = isset($this->options->title) ? $this->options->title : '';
     $form = '<p><label for="' . $this->getFieldId('title') . '">' . __('gb_title') . '</label>';
     $form .= Tag::textField([$this->getFieldName('title'), 'class' => 'form-control input-sm', 'value' => $title]);
     $form .= '</p>';
     $menuTypeAvailable = MenuTypes::find(['order' => 'name ASC']);
     $form .= '<p><label for="' . $this->getFieldId('menu_left') . '">' . __('w_menu_form_label_select_menu_left') . '</label>';
     $form .= Tag::select([$this->getFieldName('menu_left'), $menuTypeAvailable, 'using' => ['menu_type_id', 'name'], 'class' => 'form-control input-sm', 'value' => $menu_left, 'usingEmpty' => true]);
     $form .= '</p>';
     $form .= '<p><label for="' . $this->getFieldId('menu_left') . '">' . __('w_menu_form_label_select_menu_right') . '</label>';
     $form .= Tag::select([$this->getFieldName('menu_right'), $menuTypeAvailable, 'using' => ['menu_type_id', 'name'], 'class' => 'form-control input-sm', 'value' => $menu_right, 'usingEmpty' => true]);
     $form .= '</p>';
     return $form;
 }
开发者ID:kimthangatm,项目名称:zcms,代码行数:22,代码来源:MenuBootstrap.php

示例8: _getLayout

 /**
  * Get layout for this widget
  *
  * @param $widgetName
  * @return string Select widget templates
  */
 private function _getLayout($widgetName)
 {
     $files = get_files_in_folder(ROOT_PATH . '/app/widgets/frontend/' . $widgetName . '/views/', 'volt', true);
     array_unshift($files, 'default');
     $overrideWidgetFolder = ROOT_PATH . '/app/templates/frontend/' . $this->config->frontendTemplate->defaultTemplate . '/widgets/' . $widgetName . DS;
     if (is_dir($overrideWidgetFolder)) {
         $filesOverride = get_files_in_folder($overrideWidgetFolder, 'volt', true);
         foreach ($filesOverride as $file) {
             if (!in_array($file, $files)) {
                 $files[] = $file;
             }
         }
     }
     $selectItems = [];
     foreach ($files as $index => $file) {
         $selectItems[$file] = ucwords(str_replace(['_', '-'], ' ', $file));
     }
     //echo '<pre>'; var_dump($selectItems);echo '</pre>'; die();
     return '<p><label for="' . $this->getFieldId('_layout') . '">' . __('gb_layout') . '</label>' . Tag::select([$this->getFieldName('_layout'), $selectItems, 'class' => 'form-control input-sm', 'value' => isset($this->options->_layout) ? $this->options->_layout : ""]) . '</p>';
 }
开发者ID:kimthangatm,项目名称:zcms,代码行数:26,代码来源:ZWidget.php

示例9: select

 public static function select($parameters, $data = null)
 {
     return parent::select($parameters, $data);
 }
开发者ID:mattvb91,项目名称:cphalcon,代码行数:4,代码来源:Tag.php

示例10: select

 /**
  * Create select with bootstrap style
  * @param array $data
  * @return string
  */
 public function select($data)
 {
     $params = array_shift($data);
     if (!is_array($params)) {
         $attribute = $params;
         $params = [];
         $params[] = $attribute;
         $params['class'] = 'form-control';
     } else {
         $attribute = $params[0];
         if (!isset($params['class'])) {
             $params['class'] = 'form-control';
         } else {
             $params['class'] .= ' form-control';
         }
     }
     array_unshift($data, $params);
     if ($this->hasError($attribute)) {
         $div_class = 'form-group has-error';
         $error = $this->createErorr($attribute);
     } else {
         $div_class = 'form-group';
         $error = '';
     }
     return $this->startDefault($div_class) . $this->label($attribute) . Tag::select($data) . $error . $this->endDefault();
 }
开发者ID:wataridori,项目名称:bphalcon,代码行数:31,代码来源:BForm.php

示例11: builtInSingleChoose

 /**
  * Make a single select widget, if options < 5 it will be expanded into radios by default
  *
  * Required parameters:
  * 'id', 'options' (in array)
  * Optional parameters:
  * 'name', 'class', 'value' (selected value) or other html attributes
  * 'expand' (true or false, by default 'auto')
  * 'useEmpty', 'emptyText' (used in select mode)
  * 'prefix', 'suffix' (used to wrap radios in expanded mode)
  * 'labelOn' ('left' or 'right', by default 'right', used to identify radios in expanded mode)
  *
  * @param array $parameters
  * @return string
  */
 protected static function builtInSingleChoose(array $parameters)
 {
     static::checkRequiredParameters($parameters, ['id', 'options']);
     $options = (array) $parameters['options'];
     $parameters[0] = $id = $parameters['id'];
     $expand = isset($parameters['expand']) ? $parameters['expand'] : 'auto';
     unset($parameters['options'], $parameters['expand']);
     // Expand select into radio buttons
     if ($expand === true || $expand == 'auto' && count($options) < 5) {
         $html = [];
         $i = 0;
         $radioParams = $parameters;
         $labelOn = isset($radioParams['labelOn']) ? $radioParams['labelOn'] : 'right';
         $prefix = isset($radioParams['prefix']) ? $radioParams['prefix'] : '';
         $suffix = isset($radioParams['suffix']) ? $radioParams['suffix'] : '';
         unset($radioParams['expand'], $radioParams['labelOn'], $radioParams['prefix'], $radioParams['suffix']);
         unset($radioParams['options'], $radioParams['useEmpty'], $radioParams['emptyText']);
         $selected = isset($parameters['value']) ? (string) $parameters['value'] : '';
         foreach ($options as $value => $label) {
             $radioParams['id'] = $radioId = $id . '_' . $i;
             $radioParams['value'] = $value;
             if ((string) $value === $selected) {
                 $radioParams['checked'] = 'checked';
             } else {
                 $radioParams['checked'] = null;
             }
             $radio = Tag::radioField($radioParams);
             $labelElement = static::label(['for' => $radioId], $label);
             if ($labelOn == 'right') {
                 $radio .= PHP_EOL . $labelElement;
             } else {
                 $radio = $labelElement . PHP_EOL . $radio;
             }
             ++$i;
             $html[] = $prefix . $radio . $suffix;
         }
         return implode(PHP_EOL, $html);
     }
     return Tag::select($parameters, $options);
 }
开发者ID:phwoolcon,项目名称:phwoolcon,代码行数:55,代码来源:Widget.php


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