本文整理汇总了PHP中YDForm::_convertToHtmlAttrib方法的典型用法代码示例。如果您正苦于以下问题:PHP YDForm::_convertToHtmlAttrib方法的具体用法?PHP YDForm::_convertToHtmlAttrib怎么用?PHP YDForm::_convertToHtmlAttrib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YDForm
的用法示例。
在下文中一共展示了YDForm::_convertToHtmlAttrib方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// Create the list of attributes
$attribs = array('type' => 'text', 'name' => $this->_form . '_' . $this->_name, 'value' => $this->_value);
$attribs = array_merge($this->_attributes, $attribs);
// trick to make this text box with the same width as autocompleter.
// create a style array and a default width for text and div
$style = array();
$style['width'] = '143px';
// if user has defined a custom style we must parse it to check if width was defined
if (isset($attribs['style'])) {
foreach (explode(";", $attribs['style']) as $att) {
if (trim($att) != '') {
list($name, $value) = split(":", $att);
$style[strtolower($name)] = trim($value);
}
}
}
// compute style attribute
$attribs['style'] = '';
foreach ($style as $name => $value) {
$attribs['style'] .= $name . ':' . $value . ';';
}
// if is a autocompleter we must add an extra div. TODO: automagically apply width to text element and div
return '<input' . YDForm::_convertToHtmlAttrib($attribs) . ' /><div style="display:none; z-index:999;' . $attribs['style'] . '" id="' . $attribs['name'] . '_div"><ul></ul></div>';
}
示例2: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// Create the list of attributes
$attribs = array('id' => $this->_form . '_' . $this->_name);
$attribs = array_merge($this->_attributes, $attribs);
// Get the HTML
return '<span' . YDForm::_convertToHtmlAttrib($attribs) . '>' . nl2br($this->_value) . '</span>';
}
示例3: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// Create the list of attributes
$attribs = array('name' => $this->_form . '_' . $this->_name);
$attribs = array_merge($this->_attributes, $attribs);
// Get the HTML
return '<textarea' . YDForm::_convertToHtmlAttrib($attribs) . '>' . $this->_value . '</textarea>';
}
示例4: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// Create the list of attributes
$attribs = array('type' => $this->_type, 'name' => $this->_form . '_' . $this->_name, 'src' => $this->_value);
$attribs = array_merge($this->_attributes, $attribs);
// Get the HTML
return '<input' . YDForm::_convertToHtmlAttrib($attribs) . ' />';
}
示例5: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// Create the list of attributes
$attribs = array('type' => $this->_type, 'name' => $this->_form . '_' . $this->_name, 'id' => $this->_form . '_' . $this->_name);
$attribs = array_merge($this->_attributes, $attribs);
// If a value, fill it in and make it checked
if (!empty($this->_value)) {
$attribs['checked'] = '';
}
// Get the HTML
return '<input' . YDForm::_convertToHtmlAttrib($attribs) . '>';
}
示例6: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// Create the list of attributes
$attribs = array('type' => $this->_type, 'name' => $this->_form . '_' . $this->_name, 'value' => $this->_value);
$attribs = array_merge($this->_attributes, $attribs);
// check dynamic
if ($this->_dynamic) {
$attribs['onfocus'] = "if(this.value=='" . $this->_value . "'){this.value=''};";
$attribs['onblur'] = "if(this.value==''){this.value='" . $this->_value . "'};";
}
// Get the HTML
return '<input' . YDForm::_convertToHtmlAttrib($attribs) . ' />';
}
示例7: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// Create the list of attributes
$attribs = array('name' => $this->_form . '_' . $this->_name);
$attribs = array_merge($this->_attributes, $attribs);
// check if we are in a Javascript environment
if (YDConfig::get('YD_FORMELEMENT_TEXTAREA_NL')) {
$this->_value = preg_replace("/\r*\n/", "\\n", $this->_value);
$this->_value = preg_replace("/\\//", "\\\\/", $this->_value);
$this->_value = preg_replace("/'/", " ", $this->_value);
}
// Get the HTML
return '<textarea' . YDForm::_convertToHtmlAttrib($attribs) . '>' . $this->_value . '</textarea>';
}
示例8: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// Create the list of attributes
$attribs = array('name' => $this->_form . '_' . $this->_name);
$attribs = array_merge($this->_attributes, $attribs);
// Get the HTML
$out = '';
// if js code was not loaded we must load
if (!defined('YD_SWMENU_MAINSCRIPT')) {
$out .= trim('<script type="text/javascript">');
$out .= trim('function hideSMenu( menudiv, obj ){');
$out .= trim(' var ar = document.getElementById( menudiv ).getElementsByTagName( "span" );');
$out .= trim(' if( document.getElementById( obj ).style.display != "block" ){');
$out .= trim(' for ( var i = 0; i < ar.length; i++ ){');
$out .= trim(' if ( ar[i].className == "submenu" )');
$out .= trim(' ar[i].style.display = "none";');
$out .= trim(' }');
$out .= trim(' document.getElementById( obj ).style.display = "block";');
$out .= trim(' }else{');
$out .= trim(' document.getElementById( obj ).style.display = "none";');
$out .= trim(' }');
$out .= trim('}');
$out .= trim('</script>');
define('YD_SWMENU_MAINSCRIPT', 1);
}
// create menu div
$out .= '<div' . YDForm::_convertToHtmlAttrib($attribs) . '>';
// create menu id
$IDmenu = $this->getAttribute('id');
$i = 1;
// cycle menus
foreach ($this->_elements as $_title => $_elements) {
// create submenu id
$IDsubmenu = $IDmenu . '_' . $i++;
// create menu div
$out .= "<div class=\"menutitle\" onclick=\"hideSMenu('" . $IDmenu . "', '" . $IDsubmenu . "')\">" . $_title . "</div>";
// create span that includes all menu subitems
$out .= '<span class="submenu" id="' . $IDsubmenu . '" style="display:none">';
$out .= implode('<br>', $_elements);
$out .= '</span>';
}
// add final menu div tag
$out .= '</div>';
return $out;
}
示例9: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// Create the list of attributes
$attribs = array('name' => $this->_form . '_' . $this->_name);
$attribs = array_merge($this->_attributes, $attribs);
// Get the HTML
$html = '';
$html .= '<select' . YDForm::_convertToHtmlAttrib($attribs) . '>';
foreach ($this->_options as $val => $label) {
if (strval($this->_value) == strval($val)) {
$html .= '<option value="' . $val . '" selected="selected">' . $label . '</option>';
} else {
$html .= '<option value="' . $val . '">' . $label . '</option>';
}
}
$html .= '</select>';
return $html;
}
示例10: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// Create the list of attributes
$attribs = array('type' => $this->_type, 'name' => $this->_form . '_' . $this->_name, 'value' => $this->_value);
$attribs = array_merge($this->_attributes, $attribs);
// Create the HTML
$out = '';
if (sizeof($this->_options) > 0) {
foreach ($this->_options as $key => $val) {
$attribsElement = $attribs;
$attribsElement['value'] = $key;
if ($this->_value == strval($key)) {
$attribsElement['checked'] = '';
}
$out .= '<input' . YDForm::_convertToHtmlAttrib($attribsElement) . '>' . $val;
}
} else {
$out .= '<input' . YDForm::_convertToHtmlAttrib($attribs) . '>' . $this->_value;
}
// Return the HTML
return $out;
}
示例11: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// Get the HTML
return '<a' . YDForm::_convertToHtmlAttrib($this->_attributes) . '>' . $this->_value . '</a>';
}
示例12: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// Create the list of attributes
$attribs = array('name' => $this->_form . '_' . $this->_name, 'id' => $this->_form . '_' . $this->_name, 'class' => 'bbtextarea');
//if ( ! isset( $attribs['width'] ) ) { $attribs['width'] = '640'; }
$attribs = array_merge($this->_attributes, $attribs);
// Get the HTML
$out = '';
if (sizeof($this->_buttons) > 0) {
if (!defined('YD_BBTA_MAINSCRIPT')) {
$out .= '<script language="JavaScript">';
$out .= ' function AddText( element, startTag, defaultText, endTag ) {';
$out .= ' objElement = document.getElementById( element );';
$out .= ' if ( objElement.createTextRange ) {';
$out .= ' var text;';
$out .= ' objElement.focus( objElement.caretPos);';
$out .= ' objElement.caretPos = document.selection.createRange().duplicate();';
$out .= ' if ( objElement.caretPos.text.length > 0 ) {' . "\n";
$out .= ' objElement.caretPos.text = startTag + objElement.caretPos.text + endTag;';
$out .= ' } else {';
$out .= ' objElement.caretPos.text = startTag + defaultText + endTag;';
$out .= ' }';
$out .= ' } else {';
$out .= ' objElement.value += startTag + defaultText + endTag;';
$out .= ' }';
$out .= ' }';
$out .= ' function openWin( url, name, opts ) {';
$out .= ' win = window.open( url, name, opts );';
$out .= ' win.focus();';
$out .= ' }';
$out .= '</script>';
define('YD_BBTA_MAINSCRIPT', 1);
}
$out .= '<script language="JavaScript">';
$out .= ' function doButton( element, name ) {';
foreach ($this->_buttons as $button) {
if ($button['type'] == 'modifier') {
$out .= 'if ( name == \'' . addslashes($button['name']) . '\' ) {';
$out .= ' AddText ( element, \'[' . addslashes($button['name']) . ']\',\'' . addslashes($button['text']) . '\',\'[/' . addslashes($button['name']) . ']\');';
$out .= '}';
}
if ($button['type'] == 'simplepopup') {
$out .= 'if ( name == \'' . addslashes($button['name']) . '\' ) {';
$out .= ' data = prompt( "' . addslashes($button['question']) . '", "' . addslashes($button['default']) . '" );';
$out .= ' if ( data == null ) return;';
$out .= ' AddText( element, \'[' . addslashes($button['name']) . '=\' + data + \']\',\'' . addslashes($button['text']) . '\',\'[/' . addslashes($button['name']) . ']\');';
$out .= '}';
}
}
$out .= ' }';
$out .= '</script>';
if (isset($attribs['width'])) {
$out .= '<table border="0" cellpadding="0" cellspacing="0" width="' . $attribs['width'] . '">';
} else {
$out .= '<table border="0" cellpadding="0" cellspacing="0">';
}
$out .= '<tr>';
$out .= '<td class="bbtoolbar">';
foreach ($this->_buttons as $button) {
if ($button['type'] == 'modifier') {
$out .= '<a href="#" onClick="void( doButton( \'' . addslashes($attribs['name']) . '\', \'' . addslashes($button['name']) . '\') );">[ ' . $button['label'] . ' ]</a> ';
}
if ($button['type'] == 'simplepopup') {
$out .= '<a href="#" onClick="void( doButton( \'' . addslashes($attribs['name']) . '\', \'' . addslashes($button['name']) . '\') );">[ ' . $button['label'] . ' ]</a> ';
}
if ($button['type'] == 'popupwindow') {
$out .= '<a href="#" onClick="void( openWin( \'' . addslashes($button['url']) . '\', \'' . addslashes($button['name']) . '\', \'' . addslashes($button['params']) . '\' ) );">[ ' . $button['label'] . ' ]</a> ';
}
}
$out .= '</td>';
$out .= '</tr>';
$out .= '<tr>';
$out .= '<td><textarea' . YDForm::_convertToHtmlAttrib($attribs) . '>' . $this->_value . '</textarea></td>';
$out .= '</tr>';
$out .= '</table>';
} else {
$out .= '<textarea' . YDForm::_convertToHtmlAttrib($attribs) . '>' . $this->_value . '</textarea>';
}
return $out;
}
示例13: addLink
/**
* This function adds a link to the installer template body.
*
* @param $url The url
* @param $text (optional) The link text. Default: $url.
* @param $attributes (optional) Array of attributes
*/
function addLink($url, $text = '', $attributes = array())
{
$attributes['href'] = $url;
$this->_items[] = array('type' => 'link', 'info' => sizeof($text) ? $text : $url, 'attributes' => YDForm::_convertToHtmlAttrib($attributes));
}
示例14: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
// when using a multiple select, we should check if name ends with '[]'
if (isset($this->_attributes['multiple']) && strpos($this->_name, '[]') === false) {
$this->_name .= '[]';
}
// Create the list of attributes
$attribs = array('name' => $this->_form . '_' . $this->_name);
$attribs = array_merge($this->_attributes, $attribs);
// check if value is array ( used on multiple select ) or a simple value
if (!is_array($this->_value)) {
$this->_value = explode(';', $this->_value);
}
// Get the HTML
$html = '';
$html .= '<select' . YDForm::_convertToHtmlAttrib($attribs) . '>';
foreach ($this->_options as $val => $label) {
if (in_array(strval($val), $this->_value)) {
$html .= '<option value="' . $val . '" selected="selected">' . $label . '</option>';
} else {
$html .= '<option value="' . $val . '">' . $label . '</option>';
}
}
$html .= '</select>';
return $html;
}
示例15: toHtml
/**
* This function will return the element as HTML.
*
* @returns The form element as HTML text.
*/
function toHtml()
{
$out = '';
if (!defined('YD_CTTA_MAINSCRIPT')) {
$out .= '<script type="text/javascript">';
$out .= 'function textCounter( field, maxlimit ) {';
$out .= " var f = document.getElementById( field );";
$out .= " var c = document.getElementById( field + '_counter' );";
$out .= ' if ( f.value.length > maxlimit )';
$out .= ' f.value = f.value.substring( 0, maxlimit );';
$out .= ' else ';
$out .= ' c.innerHTML = maxlimit - f.value.length;';
$out .= '}';
$out .= '</script>';
define('YD_CTTA_MAINSCRIPT', 1);
}
// Create the list of attributes
$attribs = array('name' => $this->_form . '_' . $this->_name);
$attribs = array_merge($this->_attributes, $attribs);
// Get the HTML
$out .= '<textarea' . YDForm::_convertToHtmlAttrib($attribs) . '>' . $this->_value . '</textarea>';
return $out;
}