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


PHP sfWidgetFormInput类代码示例

本文整理汇总了PHP中sfWidgetFormInput的典型用法代码示例。如果您正苦于以下问题:PHP sfWidgetFormInput类的具体用法?PHP sfWidgetFormInput怎么用?PHP sfWidgetFormInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: render

    /**
     * @param  string $name        The element name
     * @param  string $value       The date displayed in this widget
     * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
     * @param  array  $errors      An array of errors for the field
     *
     * @return string An HTML tag string
     *
     * @see sfWidgetForm
     */
    public function render($name, $value = null, $attributes = array(), $errors = array())
    {
        //return '<input type="text" class="datepicker">';
        $image = '';
        $attributes = array_merge($attributes, $this->getAttributes());
        if (!$this->getOption('inline')) {
            $input = new sfWidgetFormInput(array(), $attributes);
            $html = $input->render($name, $value);
            if (false !== $this->getOption('image')) {
                $image = sprintf('params.buttonImage = "%s"; params.buttonImageOnly = true; params.showOn = "button";', $this->getOption('image'));
            }
        } else {
            $id = $this->generateId($name);
            $html = '<div id="' . $id . '"></div>';
        }
        $id = $this->generateId($name);
        $culture = $this->getOption('culture');
        $html .= <<<EOHTML
<script type="text/javascript">
\t\$(function() {
    // datepicker inicializálás
    \$('#{$id}').datepicker({
      dateFormat: 'yy-mm-dd',
      altField: '#dateStart',
      inline: true,
      showOtherMonths: true
//      minDate: new Date(),
//      defaultDate: \$('#dateStart').val(),
      
    });    
  });      
</script>
EOHTML;
        return $html;
    }
开发者ID:nova76,项目名称:nova-plugins,代码行数:45,代码来源:sfWidgetFormDateJQueryUI.class.php

示例2: render

 public function render($name, $value = array(), $attributes = array(), $errors = array())
 {
     $widget = array();
     use_javascript('jquery.tooltip/jquery.tooltip.js');
     use_stylesheet('../js/jquery.tooltip/jquery.tooltip.css');
     $widget['%thumbnails%'] = '';
     $widget['%thumbnails%'] .= '';
     $j = 0;
     foreach ($value as $j => $image) {
         if (!isset($image['id'])) {
             continue;
         }
         $fileIdInput = new sfWidgetFormInputHidden();
         $fileNameInput = new sfWidgetFormInputHidden();
         $commentInput = new sfWidgetFormInput(array(), array('maxlength' => 255));
         $largeInput = new sfWidgetFormInputHidden();
         $thumbnailInput = new sfWidgetFormInputHidden();
         $widget['%thumbnails%'] .= '<div class="upload_item" style="margin-bottom: 10px;" >' . '<span style="display: inline; width: 260px; float: left; text-align: center; padding-top: 10px;">' . link_to($image['name'], strval($image['Large']), array('class' => 'preview', 'rel' => strval($image['Thumbnail']))) . '</span>' . '&nbsp;' . $thumbnailInput->render($name . "[" . $j . "][Thumbnail]", strval($image['Thumbnail']), array()) . $largeInput->render($name . "[" . $j . "][Large]", strval($image['Large']), array()) . $fileNameInput->render($name . "[" . $j . "][name]", $image['name'], array()) . $fileIdInput->render($name . "[" . $j . "][id]", $image['id'], array()) . '<span>Title:</span>' . $commentInput->render($name . "[" . $j . "][description]", $image['description'], array('class' => 'text  input-mercha-account')) . '&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="del-photo"><img src="/images/cross.gif"  style="vertical-align:middle;" /></a>' . '</div>';
     }
     $i = $j + 1;
     $fileInput = new sfWidgetFormInputFile();
     $commentInput = new sfWidgetFormInput();
     $widget['%thumbnails%'] .= '<div class="upload_item" style="margin-bottom: 10px;" >' . $fileInput->render($name . "[" . $i . "][file]", null, array('class' => '', 'style' => "padding-left:0px;  width: 260px;  padding:0px; ")) . '&nbsp;' . '<span>Title:</span>' . $commentInput->render($name . "[" . $i . "][description]", null, array('class' => 'text  input-mercha-account')) . '&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="del-photo" style="vertical-align:middle;"><img src="/images/cross.gif" /></a>' . '</div>' . '<div class=" add-another-location bottom_add_new_category_link" style="padding-top: 0px; padding-bottom: 15px;">' . '<div class="plus_category">' . '<div class="left margin1"><img src="/images/plus.gif" /></div>' . '<div class="left margin_top3"><a href="#" class="add-photo">Add Another Photo</a></div>' . '</div>' . '</div>';
     $js = jq_javascript_tag("\r\n      jQuery(document).ready(function(){\r\n        i = jQuery('.upload_item').length + 1;\r\n        \r\n        jQuery('a.del-photo').live('click', function(e){\r\n          e.preventDefault();\r\n          jQuery(this).parents('.upload_item').remove();\r\n        });\r\n        \r\n        jQuery('.preview').tooltip({ \r\n            delay: 0, \r\n            showURL: false, \r\n            bodyHandler: function() { \r\n                return jQuery('<img/>').attr('src', jQuery(this).attr('rel')); \r\n            } \r\n        });\r\n        \r\n        jQuery('a.add-photo').live('click', function(e){\r\n          \r\n          e.preventDefault();\r\n          \r\n          var already = jQuery('.upload_item');\r\n          \r\n          var newUpload = '';\r\n          \r\n          var maxCount = " . intval($this->getOption('max_count')) . ";\r\n          \r\n          if ((maxCount > 0 && already.length < maxCount) || maxCount == 0) {\r\n          \r\n            newUpload = \r\n              '<div class=\\'upload_item\\' style=\\'margin-bottom: 10px;\\'><input type=\\'file\\' name=\\'" . $name . "[' + i + '][file]" . "\\' class=\"\" style=\"padding-left:0px;  width: 260px; padding:0px; \" />' +\n              '&nbsp;<span>Title:</span>' +\r\n              '<input type=\\'text\\' name=\\'" . $name . "[' + i + '][description]" . "\\' class=\\'text input-mercha-account\\' >';\r\n          \r\n            newUpload += \r\n              '&nbsp;&nbsp;&nbsp;&nbsp;<a href=\\'#\\' class=\\'del-photo\\'><img src=\\'/images/cross.gif\\'  style=\\'vertical-align:middle;\\' /></a>';\r\n          \r\n            \r\n            \r\n            newUpload += '</div>';\r\n            \r\n            jQuery(newUpload).insertBefore(jQuery(this).parents('div.add-another-location'));\r\n            i++;\r\n          }\r\n        })\r\n      \r\n      });\r\n    ");
     return $js . '<div id="uploader" style="width: 590px;">' . strtr($this->getOption('template'), $widget) . '</div>';
 }
开发者ID:rollmax,项目名称:read2read,代码行数:26,代码来源:tsWidgetFormUploadImageMany.class.php

示例3: sort_tasks_tree

 public function sort_tasks_tree($title)
 {
     if ($this->access['edit']) {
         $f = new sfWidgetFormInput();
         $attributes = array('type' => 'button', 'class' => 'btn', 'onClick' => 'location.href=\'' . url_for($this->module . '/sortTree' . $this->add_url_params('?'), true) . '\'');
         return $f->render('', $title, $attributes);
     }
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:8,代码来源:listingController.php

示例4: render

 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     $login = new sfWidgetFormInput();
     $login->setAttribute('readonly', 'readonly');
     $choices = array('0' => 'etu.utc.fr', '1' => 'utc.fr', '2' => 'escom.fr');
     $domaine = new sfWidgetFormChoice(array('choices' => $choices));
     return $login->render("nickname_email") . " @ " . $domaine->render($name);
 }
开发者ID:TheoJD,项目名称:portail,代码行数:8,代码来源:sfWidgetDomainSelector.php

示例5: render

 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     $i18n = sfContext::getInstance()->getI18N();
     $widget = new sfWidgetFormInputFile(array(), $attributes);
     $file = '<dt>' . $i18n->__($this->getOption('file_label')) . '</dt>' . '<dd>' . $widget->render($name . '[file]', null, array('id' => $this->generateId($name))) . '</dd>';
     $widget = new sfWidgetFormInput(array(), $attributes);
     $description = '<dt>' . $i18n->__($this->getOption('description_label')) . '</dt>' . '<dd>' . $widget->render($name . '[description]') . '</dd>';
     $emptyValues = $this->getOption('empty_values');
     return '<dl>' . $file . $description . '</dl>';
 }
开发者ID:kawahara,项目名称:opAlbumPlugin,代码行数:10,代码来源:opWidgetFormInputAlbumImage.class.php

示例6: render

    /**
     * @param  string $name        The element name
     * @param  string $value       The date displayed in this widget
     * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
     * @param  array  $errors      An array of errors for the field
     *
     * @return string An HTML tag string
     *
     * @see sfWidgetForm
     */
    public function render($name, $value = null, $attributes = array(), $errors = array())
    {
        $attributes = $this->getAttributes();
        $input = new sfWidgetFormInput(array(), $attributes);
        $date = new DateTime($value);
        $html = $input->render($name, $date->format('m/d/Y'));
        $id = $input->generateId($name);
        $culture = $this->getOption('culture');
        $cm = $this->getOption("change_month") ? "true" : "false";
        $cy = $this->getOption("change_year") ? "true" : "false";
        $nom = $this->getOption("number_of_months");
        $sbp = $this->getOption("show_button_panel") ? "true" : "false";
        $showOn = $this->getOption("show_on");
        $buttonImage = $this->getOption("button_image");
        $bio = $this->getOption("button_image_only") ? "true" : "false";
        if ($culture != 'en') {
            $html .= <<<EOHTML
<script type="text/javascript">
\t\$(function() {
    var params = \$.datepicker.regional['{$culture}'];
    params.dateFormat = 'mm/dd/yy';
    params.changeMonth = {$cm};
    params.changeYear = {$cy};
    params.numberOfMonths = {$nom};
    params.showButtonPanel = {$sbp};
    params.showOn = '{$showOn}';
    params.buttonImage = '{$buttonImage}';
\t\tparams.buttonImageOnly = {$bio};
    \$("#{$id}").datepicker(params);
\t});
</script>
EOHTML;
        } else {
            $html .= <<<EOHTML
<script type="text/javascript">
\t\$(function() {
    var params = {
      dateFormat: 'mm/dd/yy',
      changeMonth : {$cm},
      changeYear : {$cy},
      numberOfMonths : {$nom},
      showButtonPanel : {$sbp},
      showOn : '{$showOn}',
      buttonImage: '{$buttonImage}',
      buttonImageOnly: {$bio}
    };
    \$("#{$id}").datepicker(params);
\t});
</script>
EOHTML;
        }
        return $html;
    }
开发者ID:nubee,项目名称:nubee,代码行数:63,代码来源:nbWidgetFormDateJQueryUI.class.php

示例7: render

    /**
     * @param  string $name        The element name
     * @param  string $value       The date and time displayed in this widget
     * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
     * @param  array  $errors      An array of errors for the field
     * @return string An HTML tag string
     *
     * @see sfWidgetForm
     */
    function render($name, $value = null, $attributes = array(), $errors = array())
    {
        $options = $this->getOptions();
        $date_format = $options['format_date'];
        $value = (string) $value == (string) (int) $value ? (int) $value : strtotime($value);
        if ($value === false) {
            $value = array('date1' => null, 'date2' => null);
        } else {
            $value = array('date1' => 'new Date(' . date('Y', $value) . ', ' . (date('n', $value) - 1) . ', ' . date('j', $value) . ')', 'date2' => date($date_format['php'], $value));
        }
        $add = '';
        if ($value['date1']) {
            $add .= ', defaultDate:' . $value['date1'];
        }
        if ($options['change_year']) {
            $add .= ', changeYear: true';
        }
        if ($options['change_month']) {
            $add .= ', changeMonth: true';
        }
        if ($options['button']) {
            $add .= ", showOn: 'both', buttonImage: '" . $options['button'] . "', buttonImageOnly: true";
        }
        if ($options['min_date']) {
            $add .= ", minDate: '" . $options['min_date'] . "'";
        }
        if ($options['max_date']) {
            $add .= ", maxDate: '" . $options['max_date'] . "'";
        }
        unset($options['format_date'], $options['change_month'], $options['change_year'], $options['min_date'], $options['max_date'], $options['button']);
        $input_widget = new sfWidgetFormInput($options, $this->getAttributes());
        if (isset($attributes['id'])) {
            $id = $attributes['id'];
        } else {
            $id = $this->generateId($name);
        }
        $date = $input_widget->render($name, $value['date2'], $attributes) . sprintf(<<<EOF
<script type="text/javascript">
//<![CDATA[
jQuery(function() {
  jQuery("#%s").datepicker({ dateFormat: '%s'%s });
});
//]]>
</script>
EOF
, $id, $date_format['js'], $add);
        return $date;
    }
开发者ID:yasirgit,项目名称:afids,代码行数:57,代码来源:widgetFormDate.class.php

示例8: render

 /**
  * @param  string $name        The element name
  * @param  string $value       The value displayed in this widget
  * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
  * @param  array  $errors      An array of errors for the field
  *
  * @return string An HTML tag string
  *
  * @see sfWidgetFormInput
  */
 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     $input = parent::render($name, $value, $attributes, $errors);
     $suggestions = $this->renderTag('div', array('id' => 'geo_complete_suggestions', 'class' => 'auto_complete', 'style' => 'display:none'));
     $js = '<script type="text/javascript">location_input = "' . $this->generateId($name) . '"</script>';
     return $input . $suggestions . $js;
 }
开发者ID:jfesquet,项目名称:tempos,代码行数:17,代码来源:sfWidgetFormInputGeoComplete.class.php

示例9: render

 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     $context = sfContext::getInstance();
     $response = $context->getResponse();
     $autocompleteDiv = "";
     // content_tag('div' , '', array('id' => $this->generateId($name) . '_autocomplete', 'class' => 'autocomplete'));
     $desc = '';
     if (true === $this->getOption('desc')) {
         $desc = '.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
                  return $( "<li>" )
                   .append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
                   .appendTo( ul );
                }';
     }
     $autocompleteJs = $this->javascriptTag("\n              \n            \$(function(){\n               \n              \$('#" . $this->generateId($name) . "_ajaxtext').autocomplete({\n                  source: '" . url_for($this->getOption('url')) . "',\n                  delay:30,\n                  minChars:0,\n                  appendTo: '" . $this->getOption('appendTo') . "',\n                  max:30,\n                  width: 300,\n                  matchSubset:1,\n                  matchContains:1,\n                  cacheLength:10,\n                  autoFill:false,\n                  autoFocus: true,\n                  select: function( event, ui ) {\n                    \$('#" . $this->generateId($name) . "').val(ui.item.id);\n                    \$('#" . get_id_from_name($name) . "_ajaxcheckbox').prop('checked', true)\n                    \$('#" . get_id_from_name($name) . "_ajaxcheckboxText').html('" . __('kiválasztva') . "');\n                    \$('#" . $this->generateId($name) . "').trigger('change', [ui.item])\n                  }  \n                }){$desc}\n                \n              \n              \n              \$.fn.autocomplete.keypressEvent = function (evt, id){\n                 car =  evt.keyCode || evt.charCode;\n                 if (car != 27 && car!=9) //ESC + TAB\n                 {\n                    \$('#'+id).val('');\n                    \$('#'+id+'_ajaxcheckbox').attr('checked',false);\n                    \$('#'+id+'_ajaxcheckboxText').html('" . __('nincs kiválasztva') . "');                   \n                    \$('#" . $this->generateId($name) . "').trigger('change')\n                 } \n              }  \n                \n           });");
     $ihidden = new sfWidgetFormInputHidden();
     $ihiddenText = $ihidden->render($name, $value, $attributes);
     if ($value != '') {
         $checked = 'checked="checked"';
         $checkboxtext = "<span id='" . get_id_from_name($name) . "_ajaxcheckboxText'>" . __('kiválasztva') . "</span>";
     } else {
         $checked = '';
         $checkboxtext = "<span id='" . get_id_from_name($name) . "_ajaxcheckboxText'>" . __('nincs kiválasztva') . "</span>";
     }
     $checkbox = '<input type="checkbox" id="' . get_id_from_name($name) . '_ajaxcheckbox' . '" ' . $checked . ' disabled="disabled" />';
     $attributesText = array_merge($attributes, array('name' => false, 'id' => get_id_from_name($name) . '_ajaxtext'));
     $attributesText['onkeydown'] = "\$('#" . $this->generateId($name) . "_ajaxtext').autocomplete.keypressEvent(event, '" . $this->generateId($name) . "')";
     $itextText = parent::render($name, $this->getValueFromId($value), $attributesText, $errors);
     $indicator = '<span id="indicator-' . $this->generateId($name) . '" style="display: none;">&nbsp;&nbsp;<img src="/sfFormExtraPlugin/images/indicator.gif" alt="loading" /></span>';
     return $ihiddenText . $itextText . $checkbox . $checkboxtext . $indicator . $autocompleteDiv . $autocompleteJs;
 }
开发者ID:nova76,项目名称:nova-plugins,代码行数:31,代码来源:novaWidgetFormjQqueryUIAutocomplete.class.php

示例10: configure

  /**
   * Configures the current widget.
   *
   * @param array $options     An array of options
   * @param array $attributes  An array of default HTML attributes
   *
   * @see sfWidgetFormInput
   */
  protected function configure($options = array(), $attributes = array())
  {
    parent::configure($options, $attributes);

    $this->setOption('type', 'file');
    $this->setOption('needs_multipart', true);
  }
开发者ID:nationalfield,项目名称:symfony,代码行数:15,代码来源:sfWidgetFormInputFile.class.php

示例11: configure

  /**
   * Configures the current widget.
   *
   * @param array $options     An array of options
   * @param array $attributes  An array of default HTML attributes
   *
   * @see sfWidgetFormInput
   */
  protected function configure($options = array(), $attributes = array())
  {
    parent::configure($options, $attributes);

    $this->setOption('is_hidden', true);
    $this->setOption('type', 'hidden');
  }
开发者ID:nationalfield,项目名称:symfony,代码行数:15,代码来源:sfWidgetFormInputHidden.class.php

示例12: render

 /**
  * @param  string $name        The element name
  * @param  string $value       The this widget is checked if value is not null
  * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
  * @param  array  $errors      An array of errors for the field
  *
  * @return string An HTML tag string
  *
  * @see sfWidgetForm
  */
 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     if (!is_null($value)) {
         $attributes['checked'] = 'checked';
     }
     return parent::render($name, null, $attributes, $errors);
 }
开发者ID:ajith24,项目名称:ajithworld,代码行数:17,代码来源:sfWidgetFormInputCheckbox.class.php

示例13: render

 /**
  * @param  string $name        The element name
  * @param  string $value       The value displayed in this widget
  * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
  * @param  array  $errors      An array of errors for the field
  *
  * @return string An HTML tag string
  *
  * @see sfWidgetForm
  */
 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     if ($this->getOption('int')) {
         if (!is_null($this->getOption('min'))) {
             $attributes['min'] = intval(ceil($this->getOption('min')));
         }
         if (!is_null($this->getOption('max'))) {
             $attributes['max'] = intval(floor($this->getOption('max')));
         }
         if (!is_null($value)) {
             $value = intval(round($value));
         }
         $attributes['step'] = isset($attributes['step']) ? intval(round($attributes['step'])) : 1;
     } else {
         if (!is_null($this->getOption('min'))) {
             $attributes['min'] = floatval($this->getOption('min'));
         }
         if (!is_null($this->getOption('max'))) {
             $attributes['max'] = floatval($this->getOption('max'));
         }
         if (!is_null($value)) {
             $value = floatval($value);
         }
     }
     return parent::render($name, $value, $attributes, $errors);
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:36,代码来源:sfWidgetFormInputNumber.class.php

示例14: render

 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     $response = sfContext::getInstance()->getResponse();
     $response->addJavascript('/sfExtraWidgetsPlugin/js/spinbutton.js');
     $response->addStylesheet('/sfExtraWidgetsPlugin/css/spinbutton.css');
     return parent::render($name, $value, $attributes, $errors) . javascript_tag("new SpinButton(\$('" . $this->generateId($name) . "'),{min:" . $this->getOption('min') . ", max:" . $this->getOption('max') . "}); \$('" . $this->generateId($name) . "').addClassName('spin-button');");
 }
开发者ID:alexhandzhiev,项目名称:sifact,代码行数:7,代码来源:sfExtraWidgetFormInputSpin.class.php

示例15: render

 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     if (!isset($attributes['value']) && null !== $this->getOption('value_attribute_value')) {
         $attributes['value'] = $this->getOption('value_attribute_value');
     }
     return parent::render($name, null, $attributes, $errors);
 }
开发者ID:uniteddiversity,项目名称:policat,代码行数:7,代码来源:WidgetFormInputCheckbox.class.php


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