本文整理汇总了PHP中HTML_QuickForm_text类的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm_text类的具体用法?PHP HTML_QuickForm_text怎么用?PHP HTML_QuickForm_text使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTML_QuickForm_text类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HTML_QuickForm_text
/**
* Class constructor
*
* @param string $elementName (optional)Input field name attribute
* @param string $elementLabel (optional)Input field label
* @param mixed $attributes (optional)Either a typical HTML attribute string
* or an associative array
* @since 1.0
* @access public
* @return void
*/
function HTML_QuickForm_text($elementName = null, $elementLabel = null, $attributes = null)
{
//HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
new HTML_QuickForm_input($elementName, $elementLabel, $attributes);
self::$_persistantFreeze = true;
self::setType('text');
}
示例2: MoodleQuickForm_tccolourpopup
public function MoodleQuickForm_tccolourpopup($elementname = null, $elementlabel = null, $attributes = null, $options = null)
{
parent::HTML_QuickForm_text($elementname, $elementlabel, $attributes);
}
示例3: toHtml
/**
* @return string
*/
public function toHtml()
{
$js = $this->getElementJS();
$this->removeAttribute('format');
$this->removeAttribute('timepicker');
$this->removeAttribute('validate_format');
return $js . parent::toHtml();
}
示例4: 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();
}
}
示例5: DatePicker
/**
* @param string $elementName
* @param string $elementLabel
* @param array $attributes
*/
public function DatePicker($elementName = null, $elementLabel = null, $attributes = null)
{
if (!isset($attributes['id'])) {
$attributes['id'] = $elementName;
}
$attributes['class'] = 'form-control';
parent::__construct($elementName, $elementLabel, $attributes);
$this->_appendName = true;
$this->_type = 'date_picker';
}
示例6: __construct
/**
* Constructor of Url class
* @param type $elementName
* @param type $elementLabel
* @param type $attributes
*/
public function __construct($elementName = null, $elementLabel = null, $attributes = null)
{
if (!isset($attributes['id'])) {
$attributes['id'] = $elementName;
}
$attributes['type'] = 'url';
$attributes['class'] = 'form-control';
parent::__construct($elementName, $elementLabel, $attributes);
$this->setType('url');
}
示例7: 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;
}
示例8: 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;
}
}
示例9: foreach
function HTML_QuickForm_calendar($elementName = null, $elementLabel = null, $attributes = null, $properties = null)
{
parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
$this->_type = 'calendar';
// Default language is english
if (!@$properties['lang']) {
$properties['lang'] = 'en';
}
// Default theme is windows 2k. This is the name of a css file (without the .css extension)
if (!@$properties['theme']) {
$properties['theme'] = 'calendar-win2k-2';
}
// Whether to load the stripped javascript files (i.e., the versions with spaces and whitespace stripped out).
// for faster loading
if (!isset($properties['stripped'])) {
$properties['stripped'] = false;
}
// Default show Monday first (first day = 1)
if (!isset($properties['firstDay'])) {
$properties['firstDay'] = 1;
}
// Whether or not to show the time also
if (!isset($properties['showsTime'])) {
$properties['showsTime'] = true;
}
// Whether or not to show others (not sure what this means ... check jscalendar docs
if (!isset($properties['showOthers'])) {
$properties['showOthers'] = true;
}
// The Format to be placed in the input field.
if (!isset($properties['ifFormat'])) {
$properties['ifFormat'] = '%Y-%m-%d %I:%M %P';
}
// The time format
if (!isset($properties['timeFormat'])) {
$properties['timeFormat'] = '12';
}
foreach (array_keys($properties) as $key) {
$this->setProperty($key, $properties[$key]);
}
$this->calendar = new DHTML_Calendar($GLOBALS['HTML_QuickForm_calendar']['jscalendar_BasePath'], $this->getProperty('lang'), $this->getProperty('theme'), $this->getProperty('stripped'));
}
示例10: 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;
}
示例11: 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();
}
示例12: 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;
}
示例13: 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;
}
示例14: 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;
//.........这里部分代码省略.........
示例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>';
}