本文整理汇总了PHP中sfWidgetFormInput::render方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWidgetFormInput::render方法的具体用法?PHP sfWidgetFormInput::render怎么用?PHP sfWidgetFormInput::render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfWidgetFormInput
的用法示例。
在下文中一共展示了sfWidgetFormInput::render方法的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;
}
示例2: 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())
{
$visibleValue = $this->getOption('value_callback') ? call_user_func($this->getOption('value_callback'), $value) : $value;
return $this->renderTag('input', array('type' => 'hidden', 'name' => $name, 'value' => $value)) . parent::render('autocomplete_' . $name, $visibleValue, $attributes, $errors) . sprintf(<<<EOF
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#%s")
.autocomplete('%s', jQuery.extend({}, {
dataType: 'json',
parse: function(data) {
var parsed = [];
for (key in data) {
parsed[parsed.length] = { data: [ data[key], key ], value: data[key], result: data[key] };
}
return parsed;
}
}, %s))
.result(function(event, data) { jQuery("#%s").val(data[1]); })
.keyup(function() {
if(this.value.length == 0) {
\$('#%s').val('');
}
});
});
</script>
EOF
, $this->generateId('autocomplete_' . $name), $this->getOption('url'), $this->getOption('config'), $this->generateId($name), $this->generateId($name));
}
示例3: 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;
}
示例4: 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);
}
示例5: 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);
}
示例6: 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>' . ' ' . $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')) . ' <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; ")) . ' ' . '<span>Title:</span>' . $commentInput->render($name . "[" . $i . "][description]", null, array('class' => 'text input-mercha-account')) . ' <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 ' <span>Title:</span>' +\r\n '<input type=\\'text\\' name=\\'" . $name . "[' + i + '][description]" . "\\' class=\\'text input-mercha-account\\' >';\r\n \r\n newUpload += \r\n ' <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>';
}
示例7: 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;"> <img src="/sfFormExtraPlugin/images/indicator.gif" alt="loading" /></span>';
return $ihiddenText . $itextText . $checkbox . $checkboxtext . $indicator . $autocompleteDiv . $autocompleteJs;
}
示例8: 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');");
}
示例9: 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);
}
示例10: 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);
}
示例11: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$response = sfContext::getInstance()->getResponse();
$response->addStylesheet('/sfExtraWidgetsPlugin/css/autocompleter.css');
$autocompleteDiv = content_tag('div', '', array('id' => $this->generateId($name) . '_autocomplete', 'class' => 'autocomplete'));
$autocompleteJs = javascript_tag("\n function ac_update_" . $this->generateId($name) . "(text, li)\n {\n \$('" . $this->generateId($name) . "').value = li.id;\n }\n \n new Ajax.Autocompleter(\n '" . $this->generateId($name) . "',\n '" . $this->generateId($name) . '_autocomplete' . "',\n '" . url_for($this->getOption('url')) . "',\n {\n paramName: '" . $this->getOption('param') . "',\n indicator: 'indicator-" . $this->generateId($name) . "',\n minChars: " . $this->getOption('min_chars') . ",\n afterUpdateElement: ac_update_" . $this->generateId($name) . "\n });");
return parent::render($name, $value, $attributes, $errors) . '<span id="indicator-' . $this->generateId($name) . '" style="display: none;"> <img src="/sfExtraWidgetsPlugin/img/ajax-loader.gif" align="absmiddle" alt="Loading" /></span>' . $autocompleteDiv . $autocompleteJs;
}
示例12: render
/**
* Renders the widget.
*
* @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('multiple')) {
$name .= '[]';
$attributes['multiple'] = $this->getOption('multiple');
}
return parent::render($name, $value, $attributes, $errors);
}
示例13: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$input = parent::render($name, null, $attributes, $errors);
$root = sfContext::getInstance()->getRequest()->getRelativeUrlRoot();
$captchaImage = $this->renderTag('img', array('src' => $root . '/captcha.php', 'alt' => 'captcha'));
$result = $this->renderContentTag('p', $captchaImage) . $input;
return $result;
}
示例14: 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);
}
}
示例15: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$html = parent::render($name, $value, $attributes, $errors);
$html .= " <span class='round_color'> </span> ";
$html .= image_tag('ColorPickerUIBtnWheel.png', array('class' => 'color_pckr'));
$html .= "\n <script type=\"text/javascript\">\n \$(document).ready(function () { \n \$('.round_color').css('backgroundColor','" . $value . "'); \n \$('.color_pckr').qtip({\n show: { delay: 0, event: 'click'},\n hide: { event: 'click' },\n style: { \n name: 'light',\n title: { padding: '3px'},\n width: { min: '215px', max: '215px'}\n }, \n content: {\n title: { button: true, text: ' ' },\n text: '<div id=\"colorpicker\"></div>',\n },\n events: {\n show: function () {\n \$('#colorpicker').farbtastic(function(color){\n \$('#" . $this->generateId($name) . "').val(color);\n \$('.round_color').css('backgroundColor', color); \n });\n }\n } \n }); \n \$('#" . $this->generateId($name) . "').keyup(function(){\n \$.farbtastic('#colorpicker').setColor(\$(this).val());\n \$('.round_color').css('backgroundColor', color); \n });\n \$('#" . $this->generateId($name) . "').attr('value', '" . ($value ? $value : '#ededee') . "');\n });\n </script>\n ";
return $html;
}