本文整理汇总了PHP中HTML_QuickForm_text::toHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm_text::toHtml方法的具体用法?PHP HTML_QuickForm_text::toHtml怎么用?PHP HTML_QuickForm_text::toHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm_text
的用法示例。
在下文中一共展示了HTML_QuickForm_text::toHtml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toHtml
/**
* @return string
*/
public function toHtml()
{
$js = $this->getElementJS();
$this->removeAttribute('format');
$this->removeAttribute('timepicker');
$this->removeAttribute('validate_format');
return $js . parent::toHtml();
}
示例2: toHtml
function toHtml()
{
if ($this->_hiddenLabel) {
$this->_generateId();
return '<label class="accesshide" for="' . $this->getAttribute('id') . '" >' . $this->getLabel() . '</label>' . parent::toHtml();
} else {
return parent::toHtml();
}
}
示例3: toHtml
function toHtml()
{
$oldFrozen = $this->_flagFrozen;
$this->_flagFrozen = 0;
if (intval($oldFrozen) !== 0) {
$this->updateAttributes(array('data-depselect-frozen' => '1'));
}
$out = parent::toHtml();
$this->_flagFrozen = $oldFrozen;
return $out;
}
示例4: toHtml
/**
* Returns the textarea element in HTML
*
* @since 1.0
* @access public
* @return string
*/
function toHtml()
{
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
} else {
ob_start();
if (!defined('HTML_QuickForm_yui_autocomplete_js_loaded')) {
// Load the javascript files if they haven't been loaded yet
define('HTML_QuickForm_yui_autocomplete_js_loaded', true);
$yahoo_dom_event_src = DATAFACE_URL . '/HTML/QuickForm/yui_autocomplete/yahoo-dom-event.js';
$autocomplete_src = DATAFACE_URL . '/HTML/QuickForm/yui_autocomplete/autocomplete-min.js';
$df_autocomplete_src = DATAFACE_URL . '/HTML/QuickForm/yui_autocomplete/df_yui_autocomplete.js';
echo <<<END
\t\t\t\t<script type="text/javascript" src="{$yahoo_dom_event_src}"></script>
END;
if (isset($this->datasourceUrl)) {
// Since a datasource URL has been provided, we must be using
// AJAX for autocompletion
$xhr_src = DATAFACE_URL . '/HTML/QuickForm/yui_autocomplete/connection-min.js';
echo <<<END
\t\t\t\t\t<script type="text/javascript" src="{$xhr_src}"></script>
END;
}
echo <<<END
\t\t\t\t<script type="text/javascript" src="{$autocomplete_src}"></script>
\t\t\t\t<script language="javascript" src="{$df_autocomplete_src}"></script>
END;
}
if ($this->vocabularyName and !defined('HTML_QuickForm_yui_autocomplete_js_valuelists_' . $this->vocabularyName . '_loaded')) {
define('HTML_QuickForm_yui_autocomplete_js_valuelists_' . $this->vocabularyName . '_loaded', 1);
// We must be using in-memory arrays for the vocabulary
import('Services/JSON.php');
$json = new Services_JSON();
$js_options = $json->encode(array_values($this->options));
$valuelistName = $this->vocabularyName;
echo <<<END
\t\t\t<script language="javascript">
\t\t\tif ( !window.DATAFACE ) window.DATAFACE = {};
\t\t\tif ( window.DATAFACE.VALUELISTS == null) window.DATAFACE.VALUELISTS = {};
\t\t\tif ( window.DATAFACE.VALUELISTS['{$valuelistName}'] == null ) window.DATAFACE.VALUELISTS['{$valuelistName}'] = {$js_options};
\t\t\t</script>
END;
}
echo '<div>' . parent::toHtml() . '</div>';
$out = ob_get_contents();
ob_end_clean();
return $out;
}
}
示例5: toHtml
/**
* Returns HTML for this form element.
*
* @return string
*/
function toHtml()
{
global $CFG, $COURSE, $USER, $PAGE, $OUTPUT;
$id = $this->_attributes['id'];
$elname = $this->_attributes['name'];
if ($this->_hiddenLabel) {
$this->_generateId();
$str = '<label class="accesshide" for="' . $this->getAttribute('id') . '" >' . $this->getLabel() . '</label>' . parent::toHtml();
} else {
$str = parent::toHtml();
}
if (empty($this->_options['usefilepicker'])) {
return $str;
}
$strsaved = get_string('filesaved', 'repository');
$straddlink = get_string('choosealink', 'repository');
if ($COURSE->id == SITEID) {
$context = context_system::instance();
} else {
$context = context_course::instance($COURSE->id);
}
$client_id = uniqid();
$str .= <<<EOD
<button id="filepicker-button-{$client_id}" style="display:none">
{$straddlink}
</button>
EOD;
$args = new stdClass();
$args->accepted_types = '*';
$args->return_types = FILE_EXTERNAL;
$args->context = $PAGE->context;
$args->client_id = $client_id;
$args->env = 'url';
$fp = new file_picker($args);
$options = $fp->options;
// print out file picker
$str .= $OUTPUT->render($fp);
$module = array('name' => 'form_url', 'fullpath' => '/lib/form/url.js', 'requires' => array('core_filepicker'));
$PAGE->requires->js_init_call('M.form_url.init', array($options), true, $module);
$PAGE->requires->js_function_call('show_item', array('filepicker-button-' . $client_id));
return $str;
}
示例6: toHtml
/**
* HTML code to display this datepicker
*
* @return string
*/
public function toHtml()
{
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
}
$id = $this->getAttribute('id');
$value = $this->getValue();
if (!empty($value)) {
$value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H);
}
if (empty($this->getLabel())) {
return $this->getElementJS() . '
<div class="input-group">
<span class="input-group-addon">
<input ' . $this->_getAttrString($this->_attributes) . '>
</span>
<input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '">
</div>
';
}
return $this->getElementJS() . parent::toHtml();
}
示例7: toHtml
/**
* Returns HTML for this form element.
*
* @return string
*/
function toHtml()
{
global $PAGE, $OUTPUT;
$id = $this->_attributes['id'];
$elname = $this->_attributes['name'];
if ($this->_hiddenLabel) {
$this->_generateId();
$str = '<label class="accesshide" for="' . $this->getAttribute('id') . '" >' . $this->getLabel() . '</label>' . parent::toHtml();
} else {
$str = parent::toHtml();
}
if (empty($this->_options['usefilepicker'])) {
return $str;
}
$client_id = uniqid();
$args = new stdClass();
$args->accepted_types = '*';
$args->return_types = FILE_EXTERNAL;
$args->context = $PAGE->context;
$args->client_id = $client_id;
$args->env = 'url';
$fp = new file_picker($args);
$options = $fp->options;
if (count($options->repositories) > 0) {
$straddlink = get_string('choosealink', 'repository');
$str .= <<<EOD
<button id="filepicker-button-{$client_id}" class="visibleifjs">
{$straddlink}
</button>
EOD;
}
// print out file picker
$str .= $OUTPUT->render($fp);
$module = array('name' => 'form_url', 'fullpath' => '/lib/form/url.js', 'requires' => array('core_filepicker'));
$PAGE->requires->js_init_call('M.form_url.init', array($options), true, $module);
return $str;
}
示例8: searchRequest
/**
* Returns Html for the LiveSearch_Select input text element
*
* @access public
* @return string
*/
function toHtml()
{
$this->realName = $this->getName();
$liveform = '';
$scriptLoad = '';
$style = 'display: block;';
$divstyle = ' class="divstyle" ';
$ulstyle = ' class="ulstyle" ';
$listyle = ' class="listyle" ';
$zeroLength = 0;
$printStyle = 1;
$this->updateAttributes(array('name' => $this->getPrivateName($this->realName)));
if (isset($this->_options['style']) and $this->_options['style'] != '') {
$style = $this->_options['style'];
}
if (isset($this->_options['divstyle']) and $this->_options['divstyle'] != '') {
$divstyle = ' class="' . $this->_options['divstyle'] . '" ';
}
if (isset($this->_options['ulstyle']) and $this->_options['ulstyle'] != '') {
$ulstyle = ' class="' . $this->_options['ulstyle'] . '" ';
}
if (isset($this->_options['listyle']) and $this->_options['listyle'] != '') {
$listyle = ' class="' . $this->_options['listyle'] . '" ';
}
if (isset($this->_options['searchZeroLength']) and $this->_options['searchZeroLength'] == 1) {
$zeroLength = 1;
} else {
$zeroLength = 0;
}
if (isset($this->_options['printStyle']) and $this->_options['printStyle'] != 1) {
$printStyle = 0;
}
if (isset($this->_options['autoserverPath']) and $this->_options['autoserverPath'] != '') {
$autoserverPath = $this->_options['autoserverPath'];
} else {
$autoserverPath = '';
}
if (isset($this->_options['autoComplete']) and $this->_options['autoComplete'] != 0) {
$this->updateAttributes(array('autocomplete' => 'off'));
}
$this->updateAttributes(array('onkeyup' => 'javascript:liveSearchKeyPress(this, event, \'' . $this->getName() . 'Result\', \'target_' . $this->_options['elementId'] . '\', \'' . $this->_options['elementId'] . '\', \'' . $this->realName . '\', ' . $zeroLength . ');', 'onblur' => 'javascript:liveSearchHide(\'' . $this->getName() . 'Result\');', 'id' => $this->_options['elementId'], 'style' => $style));
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
} else {
$liveform .= '
<div' . $divstyle . 'id="' . $this->getName() . 'Result">
<ul' . $ulstyle . 'id="target_' . $this->_options['elementId'] . '">
<li' . $listyle . '> </li>
</ul>
</div>';
if (!defined('HTML_QUICKFORM_LIVESEARCH_EXISTS')) {
if ($printStyle != 0) {
$scriptLoad = <<<EOS
<style type="text/css">
<!--
.divstyle {
position: absolute;
background-color: #aaa;
z-index: 1;
min-width: 140px;
float:left;
clear:left;
background: url(shadowAlpha.png) no-repeat bottom right !important;
background: url(shadow.gif) no-repeat bottom right;
margin: 10px 0 10px 10px !important;
padding: 0px;
display: none;
}
* html .divstyle { width: 140px;}
.ulstyle {
list-style-type: none;
position: relative;
right: 0px;
z-index: 1;
margin: 0px;
padding: 0px;
}
.listyle {
text-indent: -20px;
z-index: 1;
padding-right: 15px;
padding-bottom: 2px;
padding-top: 2px;
padding-left: 20px;
line-height:15px;
margin-bottom: 0px;
}
.outerUl {
list-style-type: none;
position: relative;
z-index: 1;
background-color: #FFFFFF;
color: inherit;
//.........这里部分代码省略.........
示例9: toHtml
/**
* HTML code to display this datepicker
* @return string
*/
public function toHtml()
{
$js = $this->getElementJS();
return $js . parent::toHtml();
}
示例10: qf_AJAXACConfiguration
/**
* Returns the filter in HTML
*
* @since 1.0
* @access public
* @return string
*/
function toHtml()
{
$arrayName = str_replace(array('[', ']'), array('__', ''), $this->getName()) . '_values';
$onFocus = 'javascript:QF_AJAXAutocomplete_Focus(this, "' . $this->sourceUrl . '" , ' . $arrayName . ');';
$this->updateAttributes(array('onfocus' => $onFocus));
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
} else {
$tabs = $this->_getTabs();
$js = '<script type="text/javascript">';
$js .= "\n";
$js .= '//<![CDATA[';
$js .= "\n";
if (!defined('HTML_QUICKFORM_AJAXAUTOCOMPLETE_EXISTS')) {
$js .= <<<EOS
// begin javascript for filtered select
qf_AJAXAC.configure = function()
{
// Timeout (in ms) after which the list is automatically hidden
qf_AJAXAC.config.hideTimeout = 15000;
// Timeout (in ms) after which the search is began
qf_AJAXAC.config.acTimeout = 250;
// How many items have to stay visibile in the list
qf_AJAXAC.config.listMaxItem = 10;
// How many characters are required before auto complete
qf_AJAXAC.config.minchar = 0;
}
qf_AJAXAC.onInputKeyUp = function ( hEvent )
{
if (qf_AJAXAC.hideTimer != null)
clearTimeout(qf_AJAXAC.hideTimer);
qf_AJAXAC.hideTimer = setTimeout("qf_AJAXAC.hideList()", qf_AJAXAC.config.hideTimeout);
if (qf_AJAXAC.input.value.length < qf_AJAXAC.config.minchar && qf_AJAXAC.listShown)
qf_AJAXAC.hideList();
}
qf_AJAXAC.onInputKeyDown = function ( hEvent )
{
if(!hEvent)
hEvent = window.event;
switch(hEvent.keyCode)
{
case 37: // left arrow
case 39: // right arrow
case 33: // page up
case 34: // page down
case 36: // home
case 35: // end
case 27: // esc
case 16: // shift
case 17: // ctrl
case 18: // alt
case 20: // caps lock
case 38: // up arrow
case 40: // down arrow
break;
default:
break;
}
switch(hEvent.keyCode)
{
case 13:
case 39: // Enter & Right
qf_AJAXAC.setValue();
qf_AJAXAC.clearList();
qf_AJAXAC.hideList();
hEvent.returnValue = false;
break;
case 40: // Down
if (!qf_AJAXAC.listShown)
{
if (qf_AJAXAC.acTimer != null)
clearTimeout(qf_AJAXAC.acTimer);
qf_AJAXAC.autoComplete();
qf_AJAXAC.selectCurrent();
break;
}
if (qf_AJAXAC.container && qf_AJAXAC.list.hasChildNodes())
{
if (qf_AJAXAC.activeItem == null)
{
try {
qf_AJAXAC.activeItem = qf_AJAXAC.list.childNodes.item(0).firstChild;
qf_AJAXAC.activeItemIdx = 0;
qf_AJAXAC.windowMax = qf_AJAXAC.config.listMaxItem - 1;
qf_AJAXAC.windowMin = 0;
//.........这里部分代码省略.........
示例11: toHtml
/**
* Returns the element in HTML
*
* @since 1.0
* @access public
* @return string
*/
function toHtml()
{
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
}
$html = '';
$id = $this->getAttribute('id');
if (!$id) {
$this->setAttribute('id', $this->getName());
$id = $this->getName();
}
$value = $this->getAttribute('value');
if (!$id) {
$value = '#ddd';
}
if (!defined('HTML_QUICKFORM_colorpicker_LOADED')) {
$html = " <input type=\"button\" value=\"\" ";
$html .= sprintf('style="background-color:%s;border:1px solid #000;' . 'padding:0px;width:20px;cursor:pointer" id="%s_trigger"/>', $value, $id);
if (isset($this->_options['jsFile'])) {
$html .= sprintf("\n<script type=\"text/javascript\" src=\"%s\"></script>", $this->_options['jsFile']);
}
if (isset($this->_options['cssFile'])) {
$html .= sprintf("\n<style type=\"text/css\">@import \"%s\";</style>", $this->_options['cssFile']);
}
$html .= sprintf("\n<script type=\"text/javascript\">\n" . "//<![CDATA[\n" . "connect(window, 'onload', function() { if(\$('%s')) " . "attachColorPicker(\$('%s'), \$('%s_trigger'), false); });\n" . "//]]>\n" . "</script>\n", $id, $id, $id);
define('HTML_QUICKFORM_colorpicker_LOADED', true);
}
$html = parent::toHtml() . $html;
return $html;
}
示例12: toHtml
/**
* Returns HTML for this form element.
*
* @return string
*/
function toHtml()
{
$id = $this->_attributes['id'];
$elname = $this->_attributes['name'];
// Add the class at the last minute.
if ($this->get_force_ltr()) {
if (!isset($this->_attributes['class'])) {
$this->_attributes['class'] = 'text-ltr';
} else {
$this->_attributes['class'] .= ' text-ltr';
}
}
if ($this->_hiddenLabel) {
$this->_generateId();
$str = '<label class="accesshide" for="' . $this->getAttribute('id') . '" >' . $this->getLabel() . '</label>' . parent::toHtml();
} else {
$str = parent::toHtml();
}
if (empty($this->_options['usefilepicker'])) {
return $str;
}
// Print out file picker.
$str .= $this->getFilePickerHTML();
return $str;
}
示例13: toHtml
/**
* Returns the textarea element in HTML
*
* @since 1.0
* @access public
* @return string
*/
function toHtml()
{
$out = '';
if (!defined('HTML_QuickForm_lookup_files_loaded')) {
define('HTML_QuickForm_lookup_files_loaded', 1);
$out .= '<script type="text/javascript" src="' . DATAFACE_URL . '/js/jquery-ui-1.7.2.custom.min.js"></script>';
$out .= '<script type="text/javascript" src="' . DATAFACE_URL . '/js/RecordBrowser/RecordBrowser.js"></script>
<script type="text/javascript" src="' . DATAFACE_URL . '/js/RecordDialog/RecordDialog.js"></script>
';
}
$properties = $this->getProperties();
if ($this->_flagFrozen) {
$properties['frozen'] = 1;
}
ob_start();
$oldFrozen = $this->_flagFrozen;
$this->_flagFrozen = 0;
echo parent::toHtml();
$this->_flagFrozen = $oldFrozen;
$out .= ob_get_contents();
ob_end_clean();
$selector = null;
if ($this->getName()) {
$selector = "input[name='" . $this->getName() . "']";
} else {
$selector = '.xf-lookup-' . $this->index_prefix . '-' . $this->index;
}
$out .= '
<script type="text/javascript">
jQuery(document).ready(function($){
$("' . $selector . '").RecordBrowserWidget(' . json_encode($properties) . ');
});
</script>';
return '<span style="white-space:nowrap">' . $out . '</span>';
}
示例14: toHtml
/**
* Generates the HTML for this element
* @global object $PAGE Moodle page object for fetching renderer
* @return string Generated HTML
* @version 2011070501
* @since 2011070501
*/
public function toHtml()
{
global $PAGE;
$output = $PAGE->get_renderer('block_moodletxt');
$renderedElement = parent::toHtml();
$renderedElement .= $output->render($this->getIcon());
return $renderedElement;
}
示例15: toHtml
/**
* Returns the textarea element in HTML
*
* @since 1.0
* @access public
* @return string
*/
function toHtml()
{
$out = '';
if (!defined('HTML_QuickForm_lookup_files_loaded')) {
define('HTML_QuickForm_lookup_files_loaded', 1);
$jt = Dataface_JavascriptTool::getInstance();
$jt->import('xataface/widgets/lookup.js');
}
$properties = $this->getProperties();
if ($this->_flagFrozen) {
$properties['frozen'] = 1;
}
if (!isset($properties['callback'])) {
$properties['callback'] = 'function(out){}';
}
ob_start();
$oldFrozen = $this->_flagFrozen;
$this->_flagFrozen = 0;
$this->updateAttributes(array('data-xf-lookup-options' => json_encode($properties)));
echo parent::toHtml();
$this->_flagFrozen = $oldFrozen;
$out .= ob_get_contents();
ob_end_clean();
$selector = null;
if ($this->getName()) {
$selector = "input[name='" . $this->getName() . "']";
} else {
$selector = '.xf-lookup-' . $this->index_prefix . '-' . $this->index;
}
return '<span style="white-space:nowrap">' . $out . '</span>';
}