本文整理汇总了PHP中select_tag函数的典型用法代码示例。如果您正苦于以下问题:PHP select_tag函数的具体用法?PHP select_tag怎么用?PHP select_tag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了select_tag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: object_enum_tag
function object_enum_tag($object, $method, $options)
{
$enumValues = _get_option($options, 'enumValues', array());
$currentValue = _get_object_value($object, $method);
$enumValues = array_combine($enumValues, $enumValues);
return select_tag(_convert_method_to_name($method, $options), options_for_select($enumValues, $currentValue), $options);
}
示例2: enum_values_select_tag
/**
* Determines the possible index/value pairs for the given table/field from their
* Peer objects. Sets the selected index to the value in $selected. Returns the
* HTML for a <select> field accordingly.
*/
function enum_values_select_tag($table, $field, $selected = null)
{
//Load the options
$options = call_user_func(array($table . 'Peer', 'get' . $field . 's'));
//Return the select area
return select_tag(strtolower($table) . '[' . strtolower($field) . ']', options_for_select($options, $selected), array('style' => 'width: 125px'));
}
示例3: testBooleanOptions
public function testBooleanOptions()
{
$this->assertDomEqual(check_box_tag('admin', 1, true, array('disabled' => true, 'readonly' => true)), '<input checked="checked" disabled="disabled" id="admin" name="admin" readonly="readonly" type="checkbox" value="1" />');
$this->assertDomEqual(check_box_tag('admin', 1, true, array('disabled' => false, 'readonly' => null)), '<input checked="checked" id="admin" name="admin" type="checkbox" value="1" />');
$this->assertDomEqual(select_tag('people', '<option>raph</option>', array('multiple' => true)), '<select id="people" name="people" multiple="multiple"><option>raph</option></select>');
$this->assertDomEqual(select_tag('people', '<option>raph</option>', array('multiple' => null)), '<select id="people" name="people"><option>raph</option></select>');
}
示例4: sf_simple_cms_slot
function sf_simple_cms_slot($page, $slot, $default_text = null, $default_type = 'Text')
{
$context = sfContext::getInstance();
$request = $context->getRequest();
$culture = $request->getAttribute('culture');
$slot_object = $page->getSlot($slot, constant(sfConfig::get('app_sfSimpleCMS_escaping_strategy', 'ESC_RAW')));
if (!$slot_object) {
$slot_object = new sfSimpleCMSSlot();
$slot_object->setType($default_type);
$slot_object->setCulture($culture);
}
$slot_value = $slot_object->getValue();
$slot_type_name = $slot_object->getType();
$slot_type_class = 'sfSimpleCMSSlot' . $slot_type_name;
$slot_type = new $slot_type_class();
if ($request->getParameter('edit') == 'true' && !$request->getParameter('preview')) {
echo '<div class="editable_slot" title="' . __('Double-click to edit') . '" id="slot_' . $slot . '" onDblClick="Element.show(\'edit_' . $slot . '\');Element.hide(\'slot_' . $slot . '\');">';
if ($slot_value) {
// Get slot value from the slot type object
echo $slot_type->getSlotValue($slot_object);
} else {
// default text
echo $default_text ? $default_text : sfConfig::get('app_sfSimpleCMS_default_text', __('[add text here]'));
}
echo '</div>';
echo form_remote_tag(array('url' => 'sfSimpleCMS/updateSlot', 'script' => 'true', 'update' => 'slot_' . $slot, 'success' => 'Element.show(\'slot_' . $slot . '\');
Element.hide(\'edit_' . $slot . '\');
' . visual_effect('highlight', 'slot_' . $slot)), array('class' => 'edit_slot', 'id' => 'edit_' . $slot, 'style' => 'display:none'));
echo input_hidden_tag('slug', $page->getSlug(), 'id=edit_path' . $slot);
echo input_hidden_tag('slot', $slot);
if (sfConfig::get('app_sfSimpleCMS_use_l10n', false)) {
echo input_hidden_tag('sf_culture', $slot_object->getCulture());
}
// Get slot editor from the slot type object
echo $slot_type->getSlotEditor($slot_object);
echo label_for('slot_type', __('Type: '));
echo select_tag('slot_type', options_for_select(sfConfig::get('app_sfSimpleCMS_slot_types', array('Text' => __('Simple Text'), 'RichText' => __('Rich text'), 'Php' => __('PHP code'), 'Image' => __('Image'), 'Modular' => __('List of partials/components'))), $slot_type_name));
if ($rich = sfConfig::get('app_sfSimpleCMS_rich_editing', false)) {
// activate rich text if global rich_editing is true and is the current slot is RichText
$rich = $slot_type_name == 'RichText';
}
echo submit_tag('update', array('onclick' => $rich ? 'tinymceDeactivate()' . ';submitForm(\'edit_' . $slot . '\'); return false' : '', 'class' => 'submit_tag'));
echo button_to_function('cancel', 'Element.hide(\'edit_' . $slot . '\');Element.show(\'slot_' . $slot . '\');', 'class=submit_tag');
echo '</form>';
} else {
echo $slot_type->getSlotValue($slot_object);
}
}
示例5: object_multiselect_language_tag
/**
* Returns a <selectize> tag populated with all the languages in the world (or almost).
*
* The select_language_tag builds off the traditional select_tag function, and is conveniently populated with
* all the languages in the world (sorted alphabetically). Each option in the list has a two or three character
* language/culture code for its value and the language's name as its display title. The country data is
* retrieved via the sfCultureInfo class, which stores a wide variety of i18n and i10n settings for various
* countries and cultures throughout the world. Here's an example of an <option> tag generated by the select_country_tag:
*
* <samp>
* <option value="en">English</option>
* </samp>
*
* <b>Examples:</b>
* <code>
* echo select_language_tag('language', 'de');
* </code>
*
* @param string $name field name
* @param string $selected selected field values (two or three-character language/culture code)
* @param array $options additional HTML compliant <select> tag parameters
*
* @return string <selectize> tag populated with all the languages in the world.
* @see select_tag, options_for_select, sfCultureInfo
*/
function object_multiselect_language_tag($name, $selected = null, $options = array())
{
$c = new sfCultureInfo(sfContext::getInstance()->getUser()->getCulture());
$languages = $c->getLanguages();
if ($language_option = _get_option($options, 'languages')) {
foreach ($languages as $key => $value) {
if (!in_array($key, $language_option)) {
unset($languages[$key]);
}
}
}
asort($languages);
$option_tags = options_for_select($languages, $selected, $options);
unset($options['include_blank'], $options['include_custom']);
return select_tag($name, $option_tags, $options);
}
示例6: select_state_tag
/**
* Returns a <select> tag populated with all the states in the country.
*
* The select_state_tag builds off the traditional select_tag function, and is conveniently populated with
* all the states in the default country (sorted alphabetically). Each option in the list has a state code (two-character
* for US and Canada) for its value and the state's name as its display title.
* The options[] array may also contain the following non-html options:
* A states[] array containing a list of states to be added in the form array
* Here's an example of an <option> tag generated by the select_state_tag:
*
* <samp>
* <option value="NY">New York</option>
* </samp>
*
* <b>Examples:</b>
* <code>
* echo select_state_tag('state', 'NY');
* </code>
*
* @param string field name
* @param string selected field value (two-character state code)
* @param string country (two-character country code)
* @param array additional HTML compliant <select> tag parameters.
* May also include a 'states[]' array containing a list of states to be removed from the list
* May also include a 'country' value that will select the states from a country code
* @return string <select> tag populated with all the states in the default or selected country.
* @see select_tag, options_for_select
*/
function select_state_tag($name, $value, $options = array())
{
if (isset($options['country'])) {
$country = $options['country'];
unset($options['country']);
}
$states = getStates($country);
if (isset($options['states']) && is_array($options['states'])) {
foreach ($options['states'] as $key) {
if (isset($states[$key])) {
unset($states[$key]);
}
}
unset($options['states']);
}
if (isset($options['sort'])) {
asort($states);
unset($options['sort']);
}
$option_tags = options_for_select($states, $value);
return select_tag($name, $option_tags, $options);
}
示例7: form_tag
echo form_tag('#', array("id" => "disegni-decreti-filter", "class" => $active ? 'active' : ''));
?>
<fieldset class="labels">
<label for="filter_article">articolo:</label>
<label for="filter_site">sede:</label>
<label for="filter_presenter">presentatore:</label>
<label for="filter_status">status:</label>
</fieldset>
<p>filtra per</p>
<fieldset>
<?php
echo select_tag('filter_article', options_for_select($available_articles, $selected_article));
?>
<?php
echo select_tag('filter_site', options_for_select($available_sites, $selected_site));
?>
<?php
echo select_tag('filter_presenter', options_for_select($available_presenters, $selected_presenter));
?>
<?php
echo select_tag('filter_status', options_for_select($available_statuses, $selected_status));
?>
<?php
echo submit_image_tag('btn-applica.png', array('id' => 'disegni-decreti-filter-apply', 'alt' => 'applica', 'style' => 'display: none;', 'name' => 'disegni-decreti-filter-apply'));
?>
</fieldset>
</form>
示例8: select_tag
<label for="form-item-2">Mission Date Range</label>
<?php
echo $date_widget->render('mission_date1', $mission_date1);
?>
<strong class="to">to</strong>
<?php
echo $date_widget->render('mission_date2', $mission_date2);
?>
</div>
<div class="holder1">
<label>Wing</label>
<?php
if (!isset($wing)) {
$wing = null;
}
echo select_tag('wing', objects_for_select($wings, 'getId', 'getName', $wing, array('include_custom' => 'All')), array('id' => 'wing_list', 'class' => 'text'));
?>
</div>
<div class="holder2">
<label>Passenger</label>
<input name="pass_name" type="text" class="text1" value="<?php
echo isset($pass_name) ? $pass_name : '';
?>
"/>
</div>
<div class="holder2">
<label>Pilot</label>
<input name="pilot_name" type="text" class="text1" value="<?php
echo isset($pilot_name) ? $pilot_name : '';
?>
"/>
示例9: image_tag
<?php
echo image_tag('indicator.gif');
?>
Assigning users...
</p>
</div>
<div id="task-status-holder">
<?php
echo form_remote_tag(array('update' => 'task-' . $task->getUuid() . '-holder', 'url' => 'project/ajaxSetTaskStatus', 'loading' => "Element.show('indicator-" . $task->getUuid() . "-status')", 'complete' => "Element.hide('indicator-" . $task->getUuid() . "-status');" . visual_effect('highlight', 'task-' . $task->getUuid())));
?>
<?php
echo input_hidden_tag('task', $task->getUuid(), array());
?>
<?php
echo select_tag('task-status', options_for_select(array('2' => 'Pending/In Planning', '1' => 'In Progress', '0' => 'Complete'), $task->getStatus()));
?>
<?php
echo submit_tag('go', array());
?>
</form>
</div>
<div style="height:20px">
<p id="indicator-<?php
echo $task->getUuid();
?>
-status" style="display:none">
<?php
echo image_tag('indicator.gif');
?>
Settings task status...
示例10: select_timezone_tag
/**
* Returns a <select> tag populated with all the timezones in the world.
*
* The select_timezone_tag builds off the traditional select_tag function, and is conveniently populated with
* all the timezones in the world (sorted alphabetically). Each option in the list has a unique timezone identifier
* for its value and the timezone's locale as its display title. The timezone data is retrieved via the sfCultureInfo
* class, which stores a wide variety of i18n and i10n settings for various countries and cultures throughout the world.
* Here's an example of an <option> tag generated by the select_timezone_tag:
*
* <b>Options:</b>
* - display -
* identifer - Display the PHP timezone identifier (e.g. America/Denver)
* timezone - Display the full timezone name (e.g. Mountain Standard Time)
* timezone_abbr - Display the timezone abbreviation (e.g. MST)
* timzone_dst - Display the full timezone name with daylight savings time (e.g. Mountain Daylight Time)
* timezone_dst_abbr - Display the timezone abbreviation with daylight savings time (e.g. MDT)
* city - Display the city/region that relates to the timezone (e.g. Denver)
*
* <samp>
* <option value="America/Denver">America/Denver</option>
* </samp>
*
* <b>Examples:</b>
* <code>
* echo select_timezone_tag('timezone', 'America/Denver');
* </code>
*
* @param string $name field name
* @param string $selected selected field value (timezone identifier)
* @param array $options additional HTML compliant <select> tag parameters
*
* @return string <select> tag populated with all the timezones in the world.
* @see select_tag, options_for_select, sfCultureInfo
*/
function select_timezone_tag($name, $selected = null, $options = array())
{
static $display_keys = array('identifier' => 0, 'timezone' => 1, 'timezone_abbr' => 2, 'timezone_dst' => 3, 'timezone_dst_abbr' => 4, 'city' => 5);
$display = _get_option($options, 'display', 'identifier');
$display_key = isset($display_keys[$display]) ? $display_keys[$display] : 0;
$c = sfCultureInfo::getInstance(sfContext::getInstance()->getUser()->getCulture());
$timezone_groups = $c->getTimeZones();
$timezones = array();
foreach ($timezone_groups as $tz_group) {
$array_key = isset($tz_group[0]) ? $tz_group[0] : null;
if (isset($tz_group[$display_key]) and !empty($tz_group[$display_key])) {
$timezones[$array_key] = $tz_group[$display_key];
}
}
if ($timezone_option = _get_option($options, 'timezones')) {
$timezones = array_intersect_key($timezones, array_flip((array) $timezone_option));
}
// Remove duplicate values
$timezones = array_unique($timezones);
asort($timezones);
$option_tags = options_for_select($timezones, $selected);
return select_tag($name, $option_tags, $options);
}
示例11: __
<fieldset >
<h2><?php
echo __('filtros');
?>
</h2>
<div class="form-row">
<?php
echo label_for("filters[es_evento]", __('tipo') . ":");
?>
<div class="content">
<?php
$opciones = array('0' => __('tareas'), '1' => __('eventos'));
$tipo_tarea = isset($filters['es_evento']) ? $filters['es_evento'] : null;
$value = select_tag('filters[es_evento]', options_for_select($opciones, $tipo_tarea, array('include_custom' => __('tareas y eventos'))));
echo $value ? $value : " ";
?>
</div>
</div>
<div class="form-row">
<?php
echo label_for("filters[estado_tarea]", __('estado tarea') . ":");
?>
<div class="content">
<?php
$opciones = TareaPeer::getAllEstadosTareas();
$html = "";
$html .= "<ul class=\"sf_admin_checklist\">\n";
示例12: form_tag
echo form_tag();
?>
<?php
echo label_tag('data', 'Input Data: ') . '<br />' . text_area_tag('data', '', array('cols' => 80, 'rows' => 10));
?>
<br />
<?php
echo label_tag('uri', 'or Uri: ') . text_field_tag('uri', 'http://www.dajobe.org/foaf.rdf', array('size' => 80));
?>
<br />
<?php
echo label_tag('input_format', 'Input Format: ') . select_tag('input_format', $input_format_options, 'guess');
?>
<br />
<?php
echo label_tag('output_format', 'Output Format: ') . select_tag('output_format', $output_format_options, 'turtle');
?>
<br />
<?php
echo reset_tag();
?>
<?php
echo submit_tag();
?>
<?php
echo form_end_tag();
?>
</div>
<?php
if (isset($_REQUEST['uri']) or isset($_REQUEST['data'])) {
示例13: input_tag
echo input_tag($name, $cs_setting->getValue(), 'size=55');
break;
case 'textarea':
echo textarea_tag($name, $cs_setting->getValue());
break;
case 'yesno':
echo 'Yes: ' . radiobutton_tag($name, 1, $cs_setting->getValue());
echo 'No: ' . radiobutton_tag($name, 0, $cs_setting->getValue() ? false : true);
break;
case 'select':
$options = _parse_attributes($cs_setting->getOptions());
echo select_tag($name, options_for_select($options, $cs_setting->getValue(), 'include_blank=true'));
break;
case 'model':
$config = _parse_attributes($cs_setting->getOptions());
$method = $cs_setting->getOption('table_method');
$method = $method ? $method : 'findAll';
$options = Doctrine::getTable($cs_setting->getOption('model', true))->{$method}();
echo select_tag($name, objects_for_select($options, 'getId', '__toString', $cs_setting->getValue()), 'include_blank=true');
break;
case 'wysiwyg':
echo textarea_tag($name, $cs_setting->getvalue(), 'rich=true ' . $cs_setting->getOptions());
break;
case 'upload':
echo $cs_setting->getValue() ? link_to($cs_setting->getValue(), public_path('uploads/setting/' . $cs_setting->getValue())) . '<br />' : '';
echo input_file_tag($name, $cs_setting->getValue(), $cs_setting->getOptions());
break;
default:
echo input_tag($name, $cs_setting->getValue(), 'size=55');
break;
}
示例14: form_tag
}
if (!isset($_REQUEST['input_format'])) {
$_REQUEST['input_format'] = 'guess';
}
// Display the form, if raw option isn't set
if (!isset($_REQUEST['raw'])) {
print "<html>\n";
print "<head><title>EasyRdf Converter</title></head>\n";
print "<body>\n";
print "<h1>EasyRdf Converter</h1>\n";
print "<div style='margin: 10px'>\n";
print form_tag();
print label_tag('data', 'Input Data: ') . '<br />' . text_area_tag('data', '', array('cols' => 80, 'rows' => 10)) . "<br />\n";
print label_tag('uri', 'or Uri: ') . text_field_tag('uri', 'http://www.dajobe.org/foaf.rdf', array('size' => 80)) . "<br />\n";
print label_tag('input_format', 'Input Format: ') . select_tag('input_format', $input_format_options) . "<br />\n";
print label_tag('output_format', 'Output Format: ') . select_tag('output_format', $output_format_options) . "<br />\n";
print label_tag('raw', 'Raw Output: ') . check_box_tag('raw') . "<br />\n";
print reset_tag() . submit_tag();
print form_end_tag();
print "</div>\n";
}
if (isset($_REQUEST['uri']) or isset($_REQUEST['data'])) {
// Parse the input
$graph = new EasyRdf_Graph($_REQUEST['uri']);
if (empty($_REQUEST['data'])) {
$graph->load($_REQUEST['uri'], $_REQUEST['input_format']);
} else {
$graph->parse($_REQUEST['data'], $_REQUEST['input_format'], $_REQUEST['uri']);
}
// Lookup the output format
$format = EasyRdf_Format::getFormat($_REQUEST['output_format']);
示例15: __
?>
</span>
<div id="fake_div">
<div id="outing_wizard">
<hr />
<h4><?php
echo __('Step 1: choose a summit');
?>
</h4>
<div>
<?php
echo global_form_errors_tag();
echo select_tag('wizard_type', options_for_select(array('summits' => __('Summit:'), 'sites' => __('Site:')), 0));
echo input_tag('summits_name', '', array('size' => '35'));
echo input_tag('sites_name', '', array('size' => '35', 'style' => 'display:none'));
echo javascript_queue("var indicator = \$('#indicator');\n\$('#wizard_type').change(function() {\n \$('#summits_name, #sites_name').val('').toggle();\n \$('#wizard_no_route, #wizard_route, #summit_link, #last_ok').hide();\n\n var summit = \$(this).val() == 'summits';\n \$('#wizard_routes_hints').toggle(summit);\n \$('#wizard_sites_hints').toggle(!summit);\n \n});\n\n\$('#summits_name').c2cAutocomplete({\n url: '" . url_for('summits/autocomplete') . "',\n minChars: " . sfConfig::get('app_autocomplete_min_chars') . "\n}).on('itemselect', function(e, item) {\n indicator.show();\n \$('#summit_id').val(item.id);\n \$('#wizard_no_route, .wizard_hints').hide();\n \$.get('" . url_for('summits/getroutes') . "',\n 'summit_id=' + \$('#summit_id').val() + '&div_name=routes')\n .always(function() { indicator.hide(); })\n .done(function(data) {\n \$('#divRoutes').html(data);\n \$('#last_ok h4').html(\$('#wizard_routes_hints h4').last().html());\n \$('#wizard_no_route').hide();\n \$('#summit_link, #wizard_route, #last_ok').show();\n C2C.getWizardRouteRatings('routes');\n })\n .fail(function(data) {\n \$('#wizard_route, #wizard_hints, #wizard_route_descr, #last_ok').hide();\n \$('#summit_link, #wizard_no_route').show();\n C2C.showFailure(data.responseText);\n })\n});\n\n\$('#sites_name').c2cAutocomplete({\n url: '" . url_for('sites/autocomplete') . "',\n minChars: " . sfConfig::get('app_autocomplete_min_chars') . "\n}).on('itemselect', function(e, item) {\n \$('.wizard_hints').hide();\n \$('#last_ok h4').html(\$('#wizard_sites_hints h4').last().html());\n \$('#last_ok').show();\n \$('#link').val(item.id);\n});\n");
echo form_tag('outings/wizard');
echo input_hidden_tag('summit_id', '0');
?>
<p id="summit_link" style="display: none">
<a href="#" onclick="window.open('/summits/' + $('#summit_id').val());"><?php
echo __('Show the summit');
?>
</a>
</p>
<p id="wizard_summit_create" class="wizard_tip"><?php
echo __('No summit matching your search?') . ' ' . link_to(__('Add your summit'), '@document_edit?module=summits&id=&lang=');
?>