/** * 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()) { sfContext::getInstance()->getConfiguration()->loadHelpers(array('I18N')); $default_text = $this->getOption('default_text', null); if ($default_text) { $default_text = __($default_text); } else { $default_text = $this->getOption('multiple') ? __("Select Some Options") . '...' : __("Select an Option") . '...'; } $align_right = $this->getOption('align_right', null); if ($align_right) { if (!isset($attributes['class'])) { $attributes['class'] = ''; } $attributes['class'] .= ' chzn-select chzn-rtl'; } if (!isset($attributes['style'])) { $attributes['style'] = 'min-width: 300px; max-width: 700px;'; } else { $attributes['style'] = '; min-width: 300px; max-width: 700px;'; } $html = parent::render($name, $value, $attributes, $errors); $html .= dcWidgetFormChosenChoice::getWidgetInitializationJS($this->generateId($name), $value, $default_text, $this->getOption('config')); return $html; }
public function render($name, $value = null, $attributes = array(), $errors = array()) { if (false !== ($empty = $this->getOption('add_empty'))) { $label = true === $empty ? '' : $empty; $first_option = '<option value="">' . $label . '</option>'; } else { $first_option = ''; } return parent::render($name, $value, $attributes, $errors) . sprintf("\n<script type='text/javascript'>\n\$(function(){\n \$('#%s').change(function(){\n \$.getJSON('%s', { id: \$(this).val() }, function(data){\n var options = '%s';\n for (key in data) {\n options += '<option value=\"' + key + '\">' + data[key] + '</option>';\n }\n \$('#%s').html(options);\n })\n })\n})\n</script>\n", $this->generateId($this->getOption('parent')), $this->getOption('url'), $first_option, $this->generateId($name)); }
public function render($name, $value = null, $attributes = array(), $errors = array()) { $select_parent = parent::render($name, $value, $attributes, $errors); $foreing_id = $this->getOption('foreing_id') ? $this->getOption('foreing_id') : strtolower($this->getOption('model') . '_id'); $option_name = $this->getOption('option_name') ? $this->getOption('option_name') : 'name'; $where = $this->getOption('where') ? ' where="' . $this->getOption('where') . '"' : ''; $conten_tag = '<div class="moo_widget dependent_observer_select" observer_id="' . $this->getOption('observer_select_id') . '" model="' . $this->getOption('model') . '" option_name="' . $option_name . '" foreing_id="' . $foreing_id . '" action_to_select="' . url_for('mooForm/loadSelectDependent') . '"' . $where . '>'; $conten_tag .= $select_parent; $conten_tag .= '</div>'; return $conten_tag; }
public function render($name, $value = null, $attributes = array(), $errors = array()) { $dropdown = parent::render($name, null, array('class' => 'tag-select'), $errors); $hidden = new sfWidgetFormInputHidden(); $content = ''; $values = $this->getChoices(); if ($value) { foreach ($value as $i => $id) { if (isset($values[$id])) { $content .= $this->renderContentTag('li', $values[$id] . $hidden->render($name . "[]", $id) . ' ' . $this->renderContentTag('a', 'x', array('class' => 'remove', 'href' => '#')), array('class' => 'taggable-tag-' . $id)); } } } $content = $dropdown . $this->renderContentTag('ul', $content) . $this->getJavascriptBlock($name); return $this->renderContentTag('div', $content, array('id' => $this->generateId($name) . '_tagger', 'class' => 'taggable_container')); }
public function render($name, $value = null, $attributes = array(), $errors = array()) { return strtr($this->getOption('format'), array('%select%' => parent::render($name . '[select]', $this->getValueFor('select', $value), array_merge(array('size' => 5), $this->getAttributesFor('select', $attributes)), $errors), '%input%' => $this->getInputWidget($attributes)->render($name . '[input]', $this->getValueFor('input', $value), $this->getAttributesFor('input', $attributes)))); }
<?php slot('title'); ?> <?php echo 'Online information of routes and itineraries - NoJam'; end_slot(); ?> <h1>Routes</h1> <div class="column span-8 box"> <div class="filter"> <?php $select = new sfWidgetFormDoctrineChoice(array('model' => 'NjRoute', 'add_empty' => 'Select a route'), array('class' => 'select-box')); echo $select->render('nj_route_id'); ?> <?php $select = new sfWidgetFormSelect(array('choices' => $buses), array('class' => 'select-box')); echo $select->render('buses_from_route'); ?> </div> <br /> <hr class="space"/> <div> <table> <thead> <th colspan="100%"><h2>Schedules</h2></th> </thead> <tfoot> <th colspan="100%">Schedules</th> </tfoot>