本文整理汇总了PHP中JFormFieldText类的典型用法代码示例。如果您正苦于以下问题:PHP JFormFieldText类的具体用法?PHP JFormFieldText怎么用?PHP JFormFieldText使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JFormFieldText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetInput
/**
* Test the getInput method.
*
* @return void
*/
public function testGetInput()
{
$form = new JFormInspector('form1');
$this->assertThat(
$form->load('<form><field name="text" type="text" /></form>'),
$this->isTrue(),
'Line:' . __LINE__ . ' XML string should load successfully.'
);
$field = new JFormFieldText($form);
$this->assertThat(
$field->setup($form->getXml()->field, 'value'),
$this->isTrue(),
'Line:' . __LINE__ . ' The setup method should return true.'
);
$this->assertThat(
strlen($field->input),
$this->greaterThan(0),
'Line:' . __LINE__ . ' The getInput method should return something without error.'
);
// TODO: Should check all the attributes have come in properly.
}
示例2: testSetupMaxlength
/**
* Tests maxLength attribute setup by JFormFieldText::setup method
*
* @covers JFormField::setup
* @covers JFormField::__get
*
* @return void
*/
public function testSetupMaxlength()
{
$field = new JFormFieldText();
$element = simplexml_load_string('<field name="myName" type="text" maxlength="60" />');
$this->assertThat($field->setup($element, ''), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true if successful.');
$this->assertThat($field->maxLength, $this->equalTo(60), 'Line:' . __LINE__ . ' The property should be computed from the XML.');
}
示例3: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
* @since 11.1
*/
protected function getInput()
{
$html = array();
$thisid = $this->id;
$values = $this->value;
$class = $this->class;
$languages = JLanguageHelper::getLanguages();
foreach ($languages as $lang) {
$language = new JLanguage($lang->lang_code);
$this->class = $class . ($language->isRTL() ? ' rtl' : ' ltr');
$this->element['label'] = $lang->title;
$this->name = 'jform[' . $this->fieldname . '][' . $lang->lang_code . ']';
$this->id = $thisid . '_' . $lang->lang_code;
$this->value = array_key_exists($lang->lang_code, $values) ? $values[$lang->lang_code] : '';
$html[] = '<div class="control-group">';
$html[] = '<div class="control-label">';
$html[] = parent::getLabel();
$html[] = '</div>';
$html[] = '<div class="controls">';
$html[] = parent::getInput();
$html[] = '</div>';
$html[] = '</div>';
}
return implode($html);
}
示例4: getInput
protected function getInput()
{
if (file_exists(JPATH_ROOT . '/components/com_acymailing/acymailing.php')) {
JHtml::_('behavior.modal');
$this->element['class'] .= ($this->element['class'] ? ' ' : '') . 'input-medium';
$link = 'index.php?option=com_acymailing&tmpl=component&ctrl=chooselist&task=' . $this->id . '&values=' . $this->value . '&control=';
if (version_compare(JVERSION, '3.0.0') == -1) {
$html = '<div class="fltlft">';
$html .= parent::getInput();
$html .= '</div><div class="button2-left"><div class="blank">';
$html .= '<a class="modal hasTip" id="link' . $this->id . '" title="::' . JText::_('MOD_PWEBCONTACT_ACYMAILING_SELECT_LISTS') . '"';
$html .= ' href="' . $link . '" rel="{handler:\'iframe\',size:{x:650,y:375}}">';
$html .= JText::_('MOD_PWEBCONTACT_ACYMAILING_SELECT');
$html .= '</a>';
$html .= '</div></div>';
} else {
$html = '<div class="input-append">';
$html .= parent::getInput();
$html .= '<a class="btn modal hasTip" id="link' . $this->id . '" title="::' . JText::_('MOD_PWEBCONTACT_ACYMAILING_SELECT_LISTS') . '"';
$html .= ' href="' . $link . '" rel="{handler:\'iframe\',size:{x:650,y:375}}">';
$html .= '<i class="icon-list-view"></i>';
$html .= '</a>';
$html .= '</div>';
}
} else {
$html = '<span class="badge badge-warning">' . JText::_('MOD_PWEBCONTACT_ACYMAILING_NOT_INSTALLED') . '</span>';
if (version_compare(JVERSION, '3.0.0') == -1) {
$html = '<div class="fltlft">' . $htm . '</div>';
}
}
return $html;
}
示例5: getInput
/**
* Method to get the field input markup for Compositions Nutrients.
*
* @return string The field input markup.
*/
protected function getInput()
{
$html = array();
$thisid = $this->id;
$values = $this->value;
// Start the Compositions Nutrients field output.
$html[] = '<fieldset id="' . $thisid . '" class="nutrients"><span></span>';
// Get the field options.
$options = $this->getOptions();
// Build the nutrients field output.
foreach ($options as $option) {
$this->element['label'] = JText::_($option->text);
$this->name = 'jform[' . $this->fieldname . '][' . $option->index . ']';
$this->id = $thisid . '_' . $option->index;
$this->value = array_key_exists($option->index, $values) ? $values[$option->index] : '';
$html[] = '<div class="input-prepend span3">';
$html[] = '<span class="add-on">';
$html[] = parent::getLabel();
$html[] = '</span>';
$html[] = parent::getInput();
$html[] = '</div>';
}
// End the Compositions Nutrients field output.
$html[] = '</fieldset>';
return implode($html);
}
示例6: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
* @since 1.6
*/
protected function getInput()
{
// Get the client id.
$clientId = $this->element['client_id'];
if (!isset($clientId)) {
$clientName = $this->element['client'];
if (isset($clientName)) {
$client = JApplicationHelper::getClientInfo($clientName, true);
$clientId = $client->id;
}
}
if (!isset($clientId) && $this->form instanceof JForm) {
$clientId = $this->form->getValue('client_id');
}
$clientId = (int) $clientId;
// Load the modal behavior script.
JHtml::_('behavior.modal', 'a.modal');
// Build the script.
$script = array();
$script[] = ' function jSelectPosition_' . $this->id . '(name) {';
$script[] = ' document.id("' . $this->id . '").value = name;';
$script[] = ' SqueezeBox.close();';
$script[] = ' }';
// Add the script to the document head.
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
// Setup variables for display.
$html = array();
$link = 'index.php?option=com_modules&view=positions&layout=modal&tmpl=component&function=jSelectPosition_' . $this->id . '&client_id=' . $clientId;
// The current user display field.
$html[] = '<div class="input-append">';
$html[] = parent::getInput() . '<a class="btn modal" title="' . JText::_('COM_MODULES_CHANGE_POSITION_TITLE') . '" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . '<i class="icon-screenshot"></i> ' . JText::_('COM_MODULES_CHANGE_POSITION_BUTTON') . '</a>';
$html[] = '</div>';
return implode("\n", $html);
}
示例7: getInput
protected function getInput()
{
$html = array();
$direct = $this->form->getValue('direct_alias', 'params', false);
$absent = $this->form->getValue('absent_alias', 'params', false);
JFactory::getDocument()->addScriptDeclaration('
function toggleDirectAlias(button) {
var direct = document.getElementById("jform_params_direct_alias");
direct.value = 1 - direct.value;
button.value = (direct.value > 0) ? "' . JText::_('PLG_SYSTEM_DIRECT_ALIAS_DIRECT') . '" : "' . JText::_('PLG_SYSTEM_DIRECT_ALIAS_RELATIVE') . '";
}
function toggleAbsentAlias(button) {
var absent = document.getElementById("jform_params_absent_alias");
absent.value = 1 - absent.value;
button.value = (absent.value > 0) ? "' . JText::_('PLG_SYSTEM_DIRECT_ALIAS_ABSENT') . '" : "' . JText::_('PLG_SYSTEM_DIRECT_ALIAS_PRESENT') . '";
}
');
if (version_compare(JVERSION, '3.2', 'ge')) {
$html[] = '<div class="input-append">';
$html[] = parent::getInput();
$html[] = '<input type="button" onclick="toggleDirectAlias(this)" value="' . JText::_($direct ? 'PLG_SYSTEM_DIRECT_ALIAS_DIRECT' : 'PLG_SYSTEM_DIRECT_ALIAS_RELATIVE') . '" class="btn hasTooltip" title="<b>' . JText::_('PLG_SYSTEM_DIRECT_ALIAS_DIRECT_TIP_TITLE') . '</b><br/><br/>' . JText::_('PLG_SYSTEM_DIRECT_ALIAS_DIRECT_TIP_DESC') . '" style="cursor:pointer" data-placement="bottom" />';
$html[] = '<input type="button" onclick="toggleAbsentAlias(this)" value="' . JText::_($absent ? 'PLG_SYSTEM_DIRECT_ALIAS_ABSENT' : 'PLG_SYSTEM_DIRECT_ALIAS_PRESENT') . '" class="btn hasTooltip" title="<b>' . JText::_('PLG_SYSTEM_DIRECT_ALIAS_ABSENT_TIP_TITLE') . '</b><br/><br/>' . JText::_('PLG_SYSTEM_DIRECT_ALIAS_ABSENT_TIP_DESC') . '" style="cursor:pointer" data-placement="bottom" />';
$html[] = '</div>';
} else {
$html[] = parent::getInput();
$html[] = '<input type="button" onclick="toggleDirectAlias(this)" value="' . JText::_($direct ? 'PLG_SYSTEM_DIRECT_ALIAS_DIRECT' : 'PLG_SYSTEM_DIRECT_ALIAS_RELATIVE') . '" class="button hasTip" title="' . JText::_('PLG_SYSTEM_DIRECT_ALIAS_DIRECT_TIP_TITLE') . '::' . JText::_('PLG_SYSTEM_DIRECT_ALIAS_DIRECT_TIP_DESC') . '" style="cursor:pointer" />';
$html[] = '<input type="button" onclick="toggleAbsentAlias(this)" value="' . JText::_($absent ? 'PLG_SYSTEM_DIRECT_ALIAS_ABSENT' : 'PLG_SYSTEM_DIRECT_ALIAS_PRESENT') . '" class="button hasTip" title="' . JText::_('PLG_SYSTEM_DIRECT_ALIAS_ABSENT_TIP_TITLE') . '::' . JText::_('PLG_SYSTEM_DIRECT_ALIAS_ABSENT_TIP_DESC') . '" style="cursor:pointer" />';
}
return implode("\n", $html);
}
示例8: getInput
function getInput()
{
$config = JComponentHelper::getParams('com_fabrik');
if ($config->get('fbConf_wysiwyg_label', '0') == '0') {
return parent::getInput();
}
// Initialize some field attributes.
$rows = (int) $this->element['rows'];
$cols = (int) $this->element['cols'];
$height = (string) $this->element['height'] ? (string) $this->element['height'] : '250';
$width = (string) $this->element['width'] ? (string) $this->element['width'] : '100%';
$assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id';
$authorField = $this->element['created_by_field'] ? (string) $this->element['created_by_field'] : 'created_by';
$asset = $this->form->getValue($assetField) ? $this->form->getValue($assetField) : (string) $this->element['asset_id'];
// Build the buttons array.
$buttons = (string) $this->element['buttons'];
if ($buttons == 'true' || $buttons == 'yes' || $buttons == '1') {
$buttons = true;
} elseif ($buttons == 'false' || $buttons == 'no' || $buttons == '0') {
$buttons = false;
} else {
$buttons = explode(',', $buttons);
}
$hide = (string) $this->element['hide'] ? explode(',', (string) $this->element['hide']) : array();
// Get an editor object.
$editor = $this->getEditor();
return $editor->display($this->name, htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'), $width, $height, $cols, $rows, $buttons ? is_array($buttons) ? array_merge($buttons, $hide) : $hide : false, $this->id, $asset, $this->form->getValue($authorField));
}
示例9: getInput
protected function getInput()
{
$size = $this->element['size'];
$doc = JFactory::getDocument();
$doc->addScriptDeclaration('if(typeof jQuery!=="undefined")
jQuery(document).ready(function($){
$("#pwebcontact_paste_' . $this->id . '").click(function(e){
e.preventDefault();
var s = prompt("' . JText::_('MOD_PWEBCONTACT_ADWORDS_SCRIPT_PASTE') . '");
if(s){
var u = s.match(/<img[^>]* src=["]([^"]+)"/i);
if (u && typeof u[1] != "undefined") document.getElementById("' . $this->id . '").value = u[1].replace(new RegExp("&", "gi"), "&");
}
});
});');
if (version_compare(JVERSION, '3.0.0') == -1) {
$html = '<div class="fltlft">';
$html .= parent::getInput();
$html .= '</div><div class="button2-left"><div class="blank">';
$html .= '<a id="pwebcontact_paste_' . $this->id . '" href="#">';
$html .= JText::_('MOD_PWEBCONTACT_PASTE_BUTTON');
$html .= '</a>';
$html .= '</div></div>';
} else {
$html = '<div class="input-append">';
$html .= parent::getInput();
$html .= '<a class="btn" id="pwebcontact_paste_' . $this->id . '" href="#">';
$html .= JText::_('MOD_PWEBCONTACT_PASTE_BUTTON');
$html .= '</a>';
$html .= '</div>';
}
return $html;
}
示例10: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
$price = $this->form->getValue('price');
$html = "";
if (is_array($price)) {
foreach ($price as $wday => $priceOfWeekDay) {
$html .= '
<div class="input-prepend prependtop">
<span class="add-on">' . JText::_($wday) . '</span>
<input class="align-right input-mini" name="jform[price][' . $wday . ']" value="' . $priceOfWeekDay . '">
</div>
';
}
$html .= '
<p class="help-block">
Switch back to <a id="sr-switch-simple-tariff" href="">Simple Tariff</a>
or use <a id="sr-switch-complexed-tariff" href="">Complex Tariff</a>
</p>
';
} else {
$html .= parent::getInput();
$html .= '
<p class="help-block">
For more flexible tariff, you can try <a id="sr-switch-advanced-tariff" href="">Advanced Tariff</a>
or <a id="sr-switch-complexed-tariff" href="">Complex Tariff</a>
</p>
';
}
return $html;
}
示例11:
function __construct($form = null)
{
// Must load admin language files
$lang = JFactory::getLanguage();
$lang->load("com_jevents", JPATH_ADMINISTRATOR);
parent::__construct($form);
}
示例12: getInput
public function getInput()
{
$doc = JFactory::getDocument();
$db = JFactory::getDbo();
// jQuery UI JS
$doc->addScript(JURI::root(true) . '/administrator/components/com_rsmembership/assets/js/ui/core.js');
$doc->addScript(JURI::root(true) . '/administrator/components/com_rsmembership/assets/js/ui/widget.js');
$doc->addScript(JURI::root(true) . '/administrator/components/com_rsmembership/assets/js/ui/mouse.js');
$doc->addScript(JURI::root(true) . '/administrator/components/com_rsmembership/assets/js/ui/slider.js');
$doc->addScript(JURI::root(true) . '/administrator/components/com_rsmembership/assets/js/ui/datepicker.js');
$doc->addScript(JURI::root(true) . '/administrator/components/com_rsmembership/assets/js/ui/timepicker.js');
// & CSS
$doc->addStyleSheet(JURI::root(true) . '/administrator/components/com_rsmembership/assets/css/ui/jquery.ui.all.css');
$doc->addStyleSheet(JURI::root(true) . '/administrator/components/com_rsmembership/assets/css/ui/jquery.ui.timepicker.css');
// Initialize
$doc->addScriptDeclaration("jQuery(document).ready(function(\$){\r\n\t\t\t\$('#" . $this->id . "').datetimepicker({\r\n\t\t\t\tchangeMonth: true,\r\n\t\t\t\tchangeYear: true,\r\n\t\t\t\tdateFormat: 'yy-mm-dd',\r\n\t\t\t\ttimeFormat: 'HH:mm:ss'\r\n\t\t\t});\r\n\t\t\r\n\t\t\t\$('#" . $this->id . "_img').click(function(){\r\n\t\t\t\t\$('#" . $this->id . "').datetimepicker('show');\r\n\t\t\t});\r\n\r\n\t\t});");
if ($this->value == $db->getNullDate()) {
$this->value = '';
} else {
$this->value = JHtml::_('date', $this->value, 'Y-m-d H:i:s');
}
$html[] = '<div class="input-append">';
$html[] = parent::getInput();
$html[] = '<span id="' . $this->id . '_img" class="add-on rsme_pointer"><i class="icon-calendar"></i></span>';
$html[] = '</div>';
return implode("\n", $html);
}
示例13: getInput
protected function getInput()
{
//ConditionalHelperAsset::load('conditional.js');
$this->class = !empty($this->class) ? $this->class . ' hp_conditional' : 'hp_conditional';
return parent::getInput();
$conditionalOn = $this->conditionalOn;
}
示例14: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*/
protected function getInput()
{
$input = parent::getInput();
$params = JComponentHelper::getParams('com_jea');
$surface_measure = $params->get('surface_measure', 'm²');
return $input . ' <span class="input-suffix">' . $surface_measure . '</span>';
}
示例15: setup
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$this->element = $element;
$element['label'] = $this->prepareText($element['label']);
$element['description'] = $this->prepareText($element['description']);
$element['translateDescription'] = false;
return parent::setup($element, $value, $group);
}