本文整理汇总了PHP中_convert_options函数的典型用法代码示例。如果您正苦于以下问题:PHP _convert_options函数的具体用法?PHP _convert_options怎么用?PHP _convert_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_convert_options函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: input_sf_asset_tag
function input_sf_asset_tag($name, $value, $options = array())
{
use_helper('Form', 'I18N');
use_javascript('/sfDoctrineAssetsLibraryPlugin/js/main', 'last');
$options = _convert_options($options);
$type = 'all';
if (isset($options['images_only'])) {
$type = 'image';
unset($options['images_only']);
}
if (!isset($options['id'])) {
$options['id'] = get_id_from_name($name);
}
$form_name = 'this.previousSibling.previousSibling.form.name';
if (isset($options['form_name'])) {
$form_name = "'" . $options['form_name'] . "'";
unset($options['form_name']);
}
// The popup should open in the currently selected subdirectory
$html = input_tag($name, $value, $options) . ' ';
$html .= image_tag('/sfDoctrineAssetsLibraryPlugin/images/folder_open', array('alt' => __('Insert Image'), 'style' => 'cursor: pointer; vertical-align: middle', 'onclick' => "\n initialDir = document.getElementById('" . $options['id'] . "').value.replace(/\\/[^\\/]*\$/, '');\n if(!initialDir) initialDir = '" . sfConfig::get('app_sfDoctrineAssetsLibrary_upload_dir', 'media') . "';\n sfAssetsLibrary.openWindow({\n form_name: " . $form_name . ",\n field_name: '" . $name . "',\n type: '" . $type . "',\n url: '" . url_for('sfAsset/list?dir=PLACEHOLDER') . "?popup=2'.replace('PLACEHOLDER', initialDir),\n scrollbars: 'yes'\n });"));
return $html;
}
示例2: checklists_tag
function checklists_tag($name, $options_array = null, $options = array())
{
$options = _convert_options($options);
if (isset($options['multiple']) && $options['multiple'] && substr($name, -2) !== '[]') {
$name .= '[]';
}
$options['class'] = "checklist cl1";
if (isset($options['style'])) {
$options['class'] = "checklist " . $options['style'];
}
$css_path = 'sfChecklistsPlugin/css/checklists.css';
if (!is_readable(sfConfig::get('sf_web_dir') . $css_path)) {
//throw new sfConfigurationException("Cannot find the specified css file: ".sfConfig::get('sf_web_dir').'/'.$css_path);
}
sfContext::getInstance()->getResponse()->addStylesheet($css_path);
$js_path = javascript_path('sfChecklistsPlugin/checklists.js');
if (!is_readable(sfConfig::get('sf_web_dir') . $js_path)) {
//throw new sfConfigurationException('You must install checklists.js to use this helper.');
}
sfContext::getInstance()->getResponse()->addJavascript($js_path);
$option_tags = options_for_checklists($options_array, null, array('name' => $name));
return content_tag('ul', $option_tags, array_merge(array('name' => $name, 'id' => $name), $options));
}
示例3: jq_input_auto_complete_tag
/**
* wrapper for jquery autocompleter.
* @param string name value of input field
* @param string default value for the input field
* @param string url to server script
* @param array input tag options. (size, autocomplete, etc...)
* @param array completion options. (use_style, etc...)
*
* @return string input field tag, div for completion results, and
* auto complete javascript tags
*/
function jq_input_auto_complete_tag($name, $value, $url, $tag_options = array(), $completion_options = array())
{
$context = sfContext::getInstance();
$tag_options = _convert_options($tag_options);
$response = sfContext::getInstance()->getResponse();
$response->addJavascript(sfConfig::get('app_mdToolsPlugin_jquery_ui_folder', '/mdToolsPlugin/js/jquery') . '/plugins/jquery-autocomplete');
//$comp_options = _convert_options($completion_options);
if (isset($comp_options['use_style']) && $comp_options['use_style'] == true) {
$response->addStylesheet(sfConfig::get('sf_prototype_web_dir') . '/css/input_auto_complete_tag');
}
$tag_options['id'] = get_id_from_name(isset($tag_options['id']) ? $tag_options['id'] : $name);
$javascript = input_tag($name, $value, $tag_options);
$javascript .= jq_javascript_tag("\$('#" . $name . "').autocomplete('{$url}', " . _jq_options_for_javascript($completion_options) . ");");
if (isset($comp_options['hidden_value']) && $comp_options['hidden_value'] == true) {
$javascript .= input_hidden_tag($name . '_value');
$javascript .= jq_javascript_tag('$(\'#' . $name . '\').result(function(event, data, formatted) {$(\'#' . $name . '_value\').val(data[1]);});');
}
return $javascript;
}
示例4: input_in_place_editor_tag
/**
* wrapper for script.aculo.us/prototype Ajax.InPlaceEditor.
* @param string name id of field that can be edited
* @param string url of module/action to be called when ok is clicked
* @param array editor tag options. (rows, cols, highlightcolor, highlightendcolor, etc...)
*
* @return string javascript to manipulate the id field to allow click and edit functionality
*/
function input_in_place_editor_tag($name, $url, $editor_options = array())
{
$response = sfContext::getInstance()->getResponse();
$response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/prototype');
$response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/effects');
$response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/controls');
$editor_options = _convert_options($editor_options);
return _in_place_editor($name, $url, $editor_options);
}
示例5: toHTML
/**
* Returns the rich text editor as HTML.
*
* @return string Rich text editor HTML representation
*/
public function toHTML()
{
$options = $this->options;
// we need to know the id for things the rich text editor
// in advance of building the tag
$id = _get_option($options, 'id', get_id_from_name($this->name, null));
// use tinymce's gzipped js?
$tinymce_file = _get_option($options, 'tinymce_gzip') ? '/tiny_mce_gzip.php' : '/tiny_mce.js';
// tinymce installed?
$js_path = sfConfig::get('sf_rich_text_js_dir') ? '/' . sfConfig::get('sf_rich_text_js_dir') . $tinymce_file : '/sf/tinymce/js' . $tinymce_file;
if (!is_readable(sfConfig::get('sf_web_dir') . $js_path)) {
throw new sfConfigurationException('You must install TinyMCE to use this helper (see rich_text_js_dir settings).');
}
sfContext::getInstance()->getResponse()->addJavascript($js_path);
use_helper('Javascript');
$tinymce_options = '';
$style_selector = '';
// custom CSS file?
if ($css_file = _get_option($options, 'css')) {
$css_path = stylesheet_path($css_file);
sfContext::getInstance()->getResponse()->addStylesheet($css_path);
$css = file_get_contents(sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $css_path);
$styles = array();
preg_match_all('#^/\\*\\s*user:\\s*(.+?)\\s*\\*/\\s*\\015?\\012\\s*\\.([^\\s]+)#Smi', $css, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$styles[] = $match[1] . '=' . $match[2];
}
$tinymce_options .= ' content_css: "' . $css_path . '",' . "\n";
$tinymce_options .= ' theme_advanced_styles: "' . implode(';', $styles) . '"' . "\n";
$style_selector = 'styleselect,separator,';
}
$culture = sfContext::getInstance()->getUser()->getCulture();
$tinymce_js = '
tinyMCE.init({
mode: "exact",
language: "' . strtolower(substr($culture, 0, 2)) . '",
elements: "' . $id . '",
plugins: "table,advimage,advlink,flash",
theme: "advanced",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_path_location: "bottom",
theme_advanced_buttons1: "' . $style_selector . 'justifyleft,justifycenter,justifyright,justifyfull,separator,bold,italic,strikethrough,separator,sub,sup,separator,charmap",
theme_advanced_buttons2: "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,image,flash,separator,cleanup,removeformat,separator,code",
theme_advanced_buttons3: "tablecontrols",
extended_valid_elements: "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style]",
relative_urls: false,
debug: false
' . ($tinymce_options ? ',' . $tinymce_options : '') . '
' . (isset($options['tinymce_options']) ? ',' . $options['tinymce_options'] : '') . '
});';
if (isset($options['tinymce_options'])) {
unset($options['tinymce_options']);
}
return content_tag('script', javascript_cdata_section($tinymce_js), array('type' => 'text/javascript')) . content_tag('textarea', $this->content, array_merge(array('name' => $this->name, 'id' => $id), _convert_options($options)));
}
示例6: submit_image_tag
/**
* Returns an XHTML compliant <input> tag with type="image".
*
* The submit_image_tag is very similar to the submit_tag, the only difference being that it uses an image
* for the submit button instead of the browser-generated default button. The image is defined by the
* <i>$source</i> parameter and must be a valid image, either local or remote (URL). By default, this
* helper creates a submit tag with a name of <em>commit</em> to avoid conflicts with other parts of the
* framework. It is recommended that you do not use the name "submit" for submit tags unless absolutely necessary.
*
* <b>Examples:</b>
* <code>
* // Assuming your image is in the /web/images/ directory
* echo submit_image_tag('my_submit_button.gif');
* </code>
*
* <code>
* echo submit_image_tag('http://mydomain.com/my_submit_button.gif');
* </code>
*
* @param string path to image file
* @param array additional HTML compliant <input> tag parameters
* @return string XHTML compliant <input> tag with type="image"
*/
function submit_image_tag($source, $options = array())
{
if (!isset($options['alt'])) {
$path_pos = strrpos($source, '/');
$dot_pos = strrpos($source, '.');
$begin = $path_pos ? $path_pos + 1 : 0;
$nb_str = ($dot_pos ? $dot_pos : strlen($source)) - $begin;
$options['alt'] = ucfirst(substr($source, $begin, $nb_str));
}
return tag('input', array_merge(array('type' => 'image', 'name' => 'commit', 'src' => image_path($source)), _convert_options_to_javascript(_convert_options($options))));
}
示例7: array
$t->is(submit_tag("save"), '<input type="submit" name="commit" value="save" />', 'submit_tag() takes a value as its first argument');
// options
$t->is(submit_tag('save', array('class' => 'foo')), '<input type="submit" name="commit" value="save" class="foo" />', 'submit_tag() takes an array of attribute options as its second argument');
$t->is(submit_tag('save', array('name' => 'foo')), '<input type="submit" name="foo" value="save" />', 'submit_tag() can override the "name" attribute');
// reset_tag()
$t->diag('reset_tag()');
$t->is(reset_tag(), '<input type="reset" name="reset" value="Reset" />', 'reset_tag() default value is "Reset"');
$t->is(reset_tag("save"), '<input type="reset" name="reset" value="save" />', 'reset_tag() takes a value as its first argument');
// options
$t->is(reset_tag('save', array('class' => 'foo')), '<input type="reset" name="reset" value="save" class="foo" />', 'reset_tag() takes an array of attribute options as its second argument');
$t->is(reset_tag('save', array('name' => 'foo')), '<input type="reset" name="foo" value="save" />', 'reset_tag() can override the "name" attribute');
// submit_image_tag()
$t->diag('submit_image_tag()');
$t->is(submit_image_tag('submit'), '<input type="image" name="commit" src="/images/submit.png" alt="Submit" />', 'submit_image_tag() takes an image source as its first argument');
$t->is(submit_image_tag('/img/submit.gif'), '<input type="image" name="commit" src="/img/submit.gif" alt="Submit" />', 'submit_image_tag() takes an image source as its first argument');
// options
$t->is(submit_image_tag('submit', array('class' => 'foo')), '<input type="image" name="commit" src="/images/submit.png" class="foo" alt="Submit" />', 'submit_image_tag() takes an array of attribute options as its second argument');
$t->is(submit_image_tag('submit', array('alt' => 'foo')), '<input type="image" name="commit" src="/images/submit.png" alt="foo" />', 'reset_tag() can override the "alt" attribute');
$t->is(submit_image_tag('submit', array('name' => 'foo')), '<input type="image" name="foo" src="/images/submit.png" alt="Submit" />', 'reset_tag() can override the "name" attribute');
// label_for()
$t->diag('label_for()');
$t->todo('label_for()');
// get_id_from_name()
$t->diag('get_id_from_name()');
$t->is(get_id_from_name('foo'), 'foo', 'get_id_from_name() returns the id if there is no [] in the id');
$t->is(get_id_from_name('foo[]', 'name'), 'foo_name', 'get_id_from_name() removes all [] from ids');
// _convert_options()
$t->diag('_convert_options()');
$t->is(_convert_options(array('class' => 'foo', 'multiple' => true)), array('class' => 'foo', 'multiple' => 'multiple'), '_convert_options() converts some options for XHTML compliance');
$t->is(_convert_options(array('class' => 'foo', 'multiple' => false)), array('class' => 'foo'), '_convert_options() converts some options for XHTML compliance');
示例8: jq_input_auto_complete_tag
/**
* wrapper for script.aculo.us/prototype Ajax.Autocompleter.
* @author Bruno Adele <bruno.adele@jesuislibre.org>
* @param string name value of input field
* @param string default value for input field
* @param array input tag options. (size, autocomplete, etc...)
* @param array completion options. (use_style, etc...)
*
* Example:
* echo jq_input_auto_complete_tag('q','', 'search/index',array(
* 'size' => 15),array(
* 'use_style' => false,
* 'scrollHeight' => 480,
* 'scroll' => false,
* 'highlight' => false,
* ) ) ?>
*
* @return string input field tag, div for completion results, and
* auto complete javascript tags
*/
function jq_input_auto_complete_tag($name, $value, $url, $tag_options = array(), $completion_options = array())
{
// We need ui.autocomplete for this trick
jq_add_plugins_by_name(array("autocomplete"));
$tag_options = _convert_options($tag_options);
$comp_options = _convert_options($completion_options);
// Convert to JSON parameters
$jsonOptions = '';
foreach ($comp_options as $key => $val) {
if ($jsonOptions != '') {
$jsonOptions .= ', ';
}
switch ($key) {
case 'formatItem':
case 'formatResult':
$jsonOptions .= "{$key}: " . $val;
break;
default:
$jsonOptions .= "{$key}: " . json_encode($val);
break;
}
}
// Get Stylesheet
$context = sfContext::getInstance();
$response = $context->getResponse();
$comp_options = _convert_options($completion_options);
if (isset($comp_options['use_style']) && $comp_options['use_style'] == true) {
$response->addStylesheet(sfConfig::get('sf_jquery_web_dir') . '/css/JqueryAutocomplete');
}
// Get Id from name attribute
$tag_options['id'] = get_id_from_name(isset($tag_options['id']) ? $tag_options['id'] : $name);
// Add input form
$javascript = tag('input', array_merge(array('type' => 'text', 'name' => $name, 'value' => $value), _convert_options($tag_options)));
// Calc JQuery Javascript code
$autocomplete_script = sprintf('$("#%s").autocomplete("%s",{ %s });', $name, $url, $jsonOptions);
$javascript .= javascript_tag($autocomplete_script);
return $javascript;
}
示例9: submit_tag
/**
* Returns an XHTML compliant <input> tag with type="submit".
*
* By default, this helper creates a submit tag with a name of <em>commit</em> to avoid
* conflicts with other parts of the framework. It is recommended that you do not use the name
* "submit" for submit tags unless absolutely necessary. Also, the default <i>$value</i> parameter
* (title of the button) is set to "Save changes", which can be easily overwritten by passing a
* <i>$value</i> parameter.
*
* <b>Examples:</b>
* <code>
* echo submit_tag();
* </code>
*
* <code>
* echo submit_tag('Update Record');
* </code>
*
* @param string $name field value (title of submit button)
* @param array $options additional HTML compliant <input> tag parameters
*
* @return string XHTML compliant <input> tag with type="submit"
*/
function submit_tag($value = 'Save changes', $options = array())
{
return tag('input', array_merge(array('type' => 'submit', 'name' => 'commit', 'value' => $value), _convert_options_to_javascript(_convert_options($options))));
}
示例10: button_to
/**
* Creates an <input> button tag of the given name pointing to a routed URL
* based on the module/action passed as argument and the routing configuration.
* The syntax is similar to the one of link_to.
*
* <b>Options:</b>
* - 'absolute' - if set to true, the helper outputs an absolute URL
* - 'query_string' - to append a query string (starting by ?) to the routed url
* - 'confirm' - displays a javascript confirmation alert when the button is clicked
* - 'popup' - if set to true, the button opens a new browser window
* - 'post' - if set to true, the button submits a POST request instead of GET (caution: do not use inside a form)
*
* <b>Examples:</b>
* <code>
* echo button_to('Delete this page', 'my_module/my_action');
* => <input value="Delete this page" type="button" onclick="document.location.href='/path/to/my/action';" />
* </code>
*
* @param string name of the button
* @param string 'module/action' or '@rule' of the action
* @param array additional HTML compliant <input> tag parameters
* @return string XHTML compliant <input> tag
* @see url_for, link_to
*/
function button_to($name, $internal_uri, $options = array())
{
$html_options = _convert_options($options);
$html_options['value'] = $name;
if (isset($html_options['post']) && $html_options['post']) {
if (isset($html_options['popup'])) {
throw new sfConfigurationException('You can\'t use "popup" and "post" together');
}
$html_options['type'] = 'submit';
unset($html_options['post']);
$html_options = _convert_options_to_javascript($html_options);
return form_tag($internal_uri, array('method' => 'post', 'class' => 'button_to')) . tag('input', $html_options) . '</form>';
} else {
if (isset($html_options['popup'])) {
$html_options['type'] = 'button';
$html_options = _convert_options_to_javascript($html_options, $internal_uri);
return tag('input', $html_options);
} else {
$html_options['type'] = 'button';
$html_options['onclick'] = "document.location.href='" . url_for($internal_uri) . "';";
$html_options = _convert_options_to_javascript($html_options);
return tag('input', $html_options);
}
}
}
示例11: input_in_place_editor_tag
/**
* wrapper for script.aculo.us/prototype Ajax.InPlaceEditor.
* @param string name id of field that can be edited
* @param string url of module/action to be called when ok is clicked
* @param array editor tag options. (rows, cols, highlightcolor, highlightendcolor, etc...)
*
* @return string javascript to manipulate the id field to allow click and edit functionality
*/
function input_in_place_editor_tag($name, $url, $editor_options = array())
{
$response = sfContext::getInstance()->getResponse();
$response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/prototype');
$response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/effects');
$response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/controls');
$editor_options = _convert_options($editor_options);
$default_options = array('tag' => 'span', 'id' => '\'' . $name . '_in_place_editor', 'class' => 'in_place_editor_field');
return _in_place_editor($name, $url, array_merge($default_options, $editor_options));
}
示例12: toHTML
//.........这里部分代码省略.........
public function toHTML()
{
$options = $this->options;
// we need to know the id for things the rich text editor
// in advance of building the tag
$id = _get_option($options, 'id', $this->name);
// use tinymce's gzipped js?
$tinymce_file = _get_option($options, 'tinymce_gzip') ? '/tiny_mce_gzip.php' : '/tiny_mce.js';
// tinymce installed?
$js_path = sfConfig::get('sf_rich_text_js_dir') ? '/' . sfConfig::get('sf_rich_text_js_dir') . $tinymce_file : '/sf/tinymce/js' . $tinymce_file;
if (!is_readable(sfConfig::get('sf_web_dir') . $js_path)) {
throw new sfConfigurationException('You must install TinyMCE to use this helper (see rich_text_js_dir settings).');
}
sfContext::getInstance()->getResponse()->addJavascript($js_path);
use_helper('Javascript');
$tinymce_options = '';
$style_selector = '';
// custom CSS file?
if ($css_file = _get_option($options, 'css')) {
$css_path = stylesheet_path($css_file);
sfContext::getInstance()->getResponse()->addStylesheet($css_path);
$css = file_get_contents(sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $css_path);
$styles = array();
preg_match_all('#^/\\*\\s*user:\\s*(.+?)\\s*\\*/\\s*\\015?\\012\\s*\\.([^\\s]+)#Smi', $css, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$styles[] = $match[1] . '=' . $match[2];
}
$tinymce_options .= ' content_css: "' . $css_path . '",' . "\n";
$tinymce_options .= ' theme_advanced_styles: "' . implode(';', $styles) . '"' . "\n";
$style_selector = 'styleselect,separator,';
}
$config = sfConfig::get('sf_config_dir_name');
$path = sfConfigCache::getInstance()->checkConfig($config . DIRECTORY_SEPARATOR . 'tiny_mce.yml');
$config = sfYaml::load($path);
$culture = isset($config['culture']) ? $config['culture'] : sfContext::getInstance()->getUser()->getCulture();
$mode = $config['options']['mode'];
$plugins = implode(',', $config['options']['plugins']);
$theme = $config['options']['theme'];
$tbLocation = $config['options']['theme_settings']['theme_' . $theme . '_toolbar_location'];
$tbAlign = $config['options']['theme_settings']['theme_' . $theme . '_toolbar_align'];
$pathLocation = $config['options']['theme_settings']['theme_' . $theme . '_path_location'];
$buttons = array();
reset($config['options']['theme_settings']['buttons']);
while (($key = key($config['options']['theme_settings']['buttons'])) !== null) {
$current = current($config['options']['theme_settings']['buttons']);
$buttons[] = $key . ': "' . implode(',', $current) . '"';
next($config['options']['theme_settings']['buttons']);
}
$buttons = implode(",\n", $buttons);
$extendedValidElements = array();
reset($config['options']['theme_settings']['extended_valid_elements']);
while (($key = key($config['options']['theme_settings']['extended_valid_elements'])) !== null) {
$current = current($config['options']['theme_settings']['extended_valid_elements']);
$extendedValidElements[] = $key . '[' . implode('|', $current) . ']';
next($config['options']['theme_settings']['extended_valid_elements']);
}
$extendedValidElements = '"' . implode(",\n", $extendedValidElements) . '"';
$relativeUrls = $config['options']['relative_urls'] ? 'true' : 'false';
$debug = $config['options']['debug'] ? 'true' : 'false';
$tinymce_js = 'tinyMCE.init({';
// Mode
$tinymce_js .= "mode: '{$mode}'";
// Language
$tinymce_js .= ', language: "' . strtolower(substr($culture, 0, 2)) . '"';
// Elements
$tinymce_js .= ', elements: "' . $id . '"';
// Plugins
if ($plugins) {
$tinymce_js .= ', plugins: "' . $plugins . '"';
}
// Theme
$tinymce_js .= ", theme: '{$theme}'";
// Toolbar
$tinymce_js .= ', theme_' . $theme . '_toolbar_location: "' . $tbLocation . '"';
$tinymce_js .= ', theme_' . $theme . '_toolbar_align: "' . $tbAlign . '"';
$tinymce_js .= ', theme_' . $theme . '_path_location: "' . $pathLocation . '"';
// Buttons
if ($buttons) {
$tinymce_js .= ', ' . $buttons;
}
// Extended Valid Elements
$tinymce_js .= ', extended_valid_elements: ' . $extendedValidElements;
// Relative Urls
$tinymce_js .= ', relative_urls: ' . $relativeUrls;
// Debug
$tinymce_js .= ', debug: ' . $debug;
// Custom Options
$tinymce_js .= $tinymce_options ? ',' . $tinymce_options : '';
$tinymce_js .= isset($options['tinymce_options']) ? ',' . $options['tinymce_options'] : '';
if (isset($config['options']['misc'])) {
foreach ($config['options']['misc'] as $name => $value) {
$tinymce_js .= ", {$name}: \"{$value}\"";
}
}
if (isset($options['tinymce_options'])) {
unset($options['tinymce_options']);
}
$tinymce_js .= '});';
return content_tag('script', javascript_cdata_section($tinymce_js), array('type' => 'text/javascript')) . content_tag('textarea', $this->content, array_merge(array('name' => $this->name, 'id' => get_id_from_name($id, null)), _convert_options($options)));
}
示例13: input_in_place_editor_tag
function input_in_place_editor_tag($name, $url, $editor_options = array())
{
$obj =& get_instance();
$obj->response->enqueue_js(array('prototype', 'controls', 'effects'));
$editor_options = _convert_options($editor_options);
$default_options = array('tag' => 'span', 'id' => '\'' . $name . '_in_place_editor', 'class' => 'in_place_editor_field');
return _in_place_editor($name, $url, array_merge($default_options, $editor_options));
}
示例14: submit_image_tag
/**
* Returns an XHTML compliant <input> tag with type="image".
*
* The submit_image_tag is very similar to the submit_tag, the only difference being that it uses an image
* for the submit button instead of the browser-generated default button. The image is defined by the
* <i>$source</i> parameter and must be a valid image, either local or remote (URL). By default, this
* helper creates a submit tag with a name of <em>commit</em> to avoid conflicts with other parts of the
* framework. It is recommended that you do not use the name "submit" for submit tags unless absolutely necessary.
*
* <b>Examples:</b>
* <code>
* // Assuming your image is in the /web/images/ directory
* echo submit_image_tag('my_submit_button.gif');
* </code>
*
* <code>
* echo submit_image_tag('http://mydomain.com/my_submit_button.gif');
* </code>
*
* @param string path to image file
* @param array additional HTML compliant <input> tag parameters
* @return string XHTML compliant <input> tag with type="image"
*/
function submit_image_tag($source, $options = array())
{
return tag('input', array_merge(array('type' => 'image', 'name' => 'commit', 'src' => system_url($source)), _convert_options($options)));
}
示例15: my_radiobutton_tag
function my_radiobutton_tag($name, $value, $checked = false, $options = array())
{
$id = str_replace('[]', '', $name);
if ($value != null) {
$id .= '_' . $value;
}
$html_options = array_merge(array('type' => 'radio', 'name' => $name, 'id' => get_id_from_name($id, $value), 'value' => $value), _convert_options($options));
if ($checked) {
$html_options['checked'] = 'checked';
}
return tag('input', $html_options);
}