本文整理汇总了PHP中JFormFieldList::getInput方法的典型用法代码示例。如果您正苦于以下问题:PHP JFormFieldList::getInput方法的具体用法?PHP JFormFieldList::getInput怎么用?PHP JFormFieldList::getInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFormFieldList
的用法示例。
在下文中一共展示了JFormFieldList::getInput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
/**
* Method to get the field input markup for check boxes.
*
* @return string The field input markup.
*/
protected function getInput()
{
$html = array();
$document = JFactory::getDocument();
$inputhtml = '<div id="' . $this->id . 'div#index#" class="input-prepend input-append span4"><span class="add-on label"><label for="' . $this->id . '#index#" title="#name#">#name#</label></span><input type="text" aria-invalid="false" class="validate-numeric" value="0" name="jform[' . $this->fieldname . '][#index#]" id="' . $this->id . '#index#"><span class="add-on btn"><i class="icon-delete" onclick="removeComposition(#index#)"></i></span></div>';
$script = "\nfunction removeComposition(cid)\n{\n\tvar compo = '#{$this->id}'+'div'+cid;\n\tjQuery(compo).remove();\n\n\tvar compoopt = '#{$this->id} option[value=\"'+cid+'\"]';\n\tjQuery(compoopt).removeAttr('disabled');\n\tjQuery('#{$this->id}').trigger('liszt:updated');\n}\n\nfunction newComposition()\n{\n\tvar seletedoption = jQuery('#{$this->id}').find(\":selected\");\n\tvar selectedvalue = jQuery(seletedoption).val();\n\tif(selectedvalue){\n\t\tvar selectedtext = jQuery(seletedoption).text();\n\t\tvar inputtext = '{$inputhtml}';\n\t\tinputtext = inputtext.replace(/#index#/g, selectedvalue);\n\t\tinputtext = inputtext.replace(/#name#/g, selectedtext);\n\t\tjQuery('#compitems').append(inputtext);\n\t\tjQuery(seletedoption).attr('disabled','disabled');\n\t\tjQuery('#{$this->id} option:first').attr('selected','selected');\n\t}\n\tjQuery('#{$this->id}').trigger('liszt:updated');\n}";
$document->addScriptDeclaration($script);
$this->onchange = 'newComposition()';
$html[] = parent::getInput();
$html[] = '<br /><br /><div id="compitems"><span></span>';
$db = JFactory::getDbo();
foreach ($this->value as $key => $value) {
$query = $db->getQuery(true)->select("title, print_title")->from('#__sibdiet_compositions AS a')->where("a.id = " . $key);
$db->setQuery($query);
$result = $db->loadObject();
$lang_tag = JFactory::getLanguage()->get('tag');
// Convert the print_title field to an array.
$registry = new JRegistry();
$registry->loadString($result->print_title);
$print_title = $registry->toArray();
$name = array_key_exists($lang_tag, $print_title) ? $result->title . ' { ' . $print_title[$lang_tag] . ' }' : $result->title;
$opthtml = str_replace('#index#', $key, $inputhtml);
$opthtml = str_replace('value="0"', 'value="' . $value . '"', $opthtml);
$opthtml = str_replace('#name#', $name, $opthtml);
$html[] = $opthtml;
}
$html[] = '</div>';
return implode($html);
}
示例2: getInput
/**
* Method to get the field input markup for a generic list.
* Use the multiple attribute to enable multiselect.
*
* @return string The field input markup.
*
* @since 11.1
*/
protected function getInput()
{
$document = JFactory::getDocument();
$jsPath = JURI::root(true) . '/modules/mod_currentdatetime/js';
$joomlaVersion = new JVersion();
if ($joomlaVersion->isCompatible('3')) {
JHtml::_('jquery.ui', array('core', 'sortable'));
} else {
$document->addStyleSheet($jsPath . '/25/css/chosen.min.css');
$document->addScript($jsPath . '/25/jquery.min.js');
$document->addScript($jsPath . '/25/jquery-noconflict.js');
$document->addScript($jsPath . '/25/chosen.jquery.min.js');
$document->addScript($jsPath . '/25/jquery.ui.core.min.js');
$document->addScript($jsPath . '/25/jquery.ui.widget.min.js');
$document->addScript($jsPath . '/25/jquery.ui.mouse.min.js');
$document->addScript($jsPath . '/25/jquery.ui.sortable.min.js');
}
$document->addScript($jsPath . '/jquery-chosen-sortable.min.js');
$script = 'jQuery(function(){jQuery(".chzn-sortable").chosen().chosenSortable();});';
$document->addScriptDeclaration($script);
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
$html = parent::getInput();
return $html;
}
示例3: getInput
/**
* Method to get the user field input markup.
*
* @return string The field input markup.
*
* @since 1.6.0
*/
protected function getInput()
{
$html = parent::getInput();
$user_default = $this->getDefaultUser();
$html = str_replace("value=\"" . $user_default . "\"", "value=\"" . $user_default . "\" select='selected' ", $html);
return $html;
}
示例4: getInput
/**
* Method to get the field input for a tag field.
*
* @return string The field input.
*
* @since 3.1
*/
protected function getInput()
{
// AJAX mode requires ajax-chosen
if (!$this->isNested()) {
// Get the field id
$id = isset($this->element['id']) ? $this->element['id'] : null;
$cssId = '#' . $this->getId($id, $this->element['name']);
// Load the ajax-chosen customised field
JHtml::_('tag.ajaxfield', $cssId, $this->allowCustom());
}
if (!is_array($this->value) && !empty($this->value)) {
if ($this->value instanceof JHelperTags) {
if (empty($this->value->tags)) {
$this->value = array();
} else {
$this->value = $this->value->tags;
}
}
// String in format 2,5,4
if (is_string($this->value)) {
$this->value = explode(',', $this->value);
}
}
$input = parent::getInput();
return $input;
}
示例5: getInput
/**
* Method to get the field input markup with an image tag.
*
* @return string The field input markup.
*/
protected function getInput()
{
// This Form is used outside of our component, therefor fix the path
JLoader::import('mapicons', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_simplegeotag' . DS . 'models');
$model = JModel::getInstance('MapIcons', 'SimpleGeoTagModel');
$this->items = $model->getItems();
//var_dump($this->items);
// Add Google Map's js
$doc =& JFactory::getDocument();
/*
$lang = & JFactory::getLanguage();
$langcode = $lang->getTag();
$doc->addScript('http://maps.google.com/maps/api/js?sensor=false&language='.$langcode );
*/
// Add data to javascript array (for image preview)
$js = array();
$js[] = "var mapicons = ";
$js[] = json_encode($this->items);
$js[] = ";\n";
$js[] = "function setMapIcon (val) {\n";
$js[] = "\tvar mapicon = mapicons.filter(function(item, index, arr) { if(item[\"id\"] == val) return true; },val)[0];\n";
$js[] = "\tvar imgtag = \$('jform_metadata_mapicon_img')\n";
$js[] = "\timgtag.src = mapicon['image'];\n";
$js[] = "\timgtag.width = mapicon['size_width'];\n";
$js[] = "\timgtag.height = mapicon['size_height'];\n";
$js[] = "}\n";
$doc->addScriptDeclaration(implode($js));
$this->element['onchange'] = "setMapIcon(this.value)";
$html = parent::getInput();
$this->imgid = $this->id . '_' . $this->imgid;
$html = $html . '<img id="' . $this->imgid . '" src="" />';
return $html;
}
示例6: getInput
/**
* Method to get the field input markup for check boxes.
*
* @return string The field input markup.
*
* @since 11.1
*/
protected function getInput()
{
$html = array();
// Get default id
$this->defaults_id = $this->form->getValue('defaults_id') ? $this->form->getValue('defaults_id') : 0;
// Set days
$days = $this->element['days'] ? $this->element['days'] : '1-2-3-4-5-6-7';
$days = $this->form->getValue('days') ? $this->form->getValue('days') : $days;
$days = explode('-', $days);
// Set meals
$meals = $this->element['meals'] ? $this->element['meals'] : '1,2,3';
$meals = $this->form->getValue('meal') ? $this->form->getValue('meal') : $meals;
$meals = explode(',', $meals);
// Temp value
$value_array = $this->value;
foreach ($meals as $meal) {
$this->meal = $meal;
$options = (array) $this->getOptions();
$html[] = '<div class="span4">';
$html[] = '<div class="control-group center">' . SibdietHelper::convertMeals($meal) . '</div>';
foreach ($days as $day) {
$this->value = isset($value_array[$meal][$day]) ? $value_array[$meal][$day] : '';
$this->name = 'jform[' . $this->fieldname . '][' . $meal . '][' . $day . ']';
$this->id = $this->id . 'meal' . $meal . 'day' . $day;
$this->hint = SibdietHelper::dayToString($day);
$html[] = '<div class="control-group center">';
$html[] = parent::getInput();
$html[] = '</div>';
}
$html[] = '</div>';
}
return implode($html);
}
示例7: getInput
public function getInput()
{
if (!self::hide_it()) {
return parent::getInput();
}
return '';
}
示例8: getInput
protected function getInput()
{
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
return parent::getInput();
}
示例9: getInput
protected function getInput()
{
if (count($this->getOptions()) == 0) {
return "";
}
return parent::getInput();
}
示例10: getInput
protected function getInput()
{
if (is_string($this->value)) {
$this->value = explode(",", $this->value);
}
return parent::getInput();
}
示例11: getInput
function getInput()
{
$jid = $this->form->getValue('attribs.user_id');
if ($jid) {
$uid = JFBCFactory::usermap()->getProviderUserId($jid, 'linkedin');
if ($uid) {
$access_token = JFBCFactory::usermap()->getUserAccessToken($jid, 'linkedin');
$params['access_token'] = $access_token;
$liLibrary = JFBCFactory::provider('linkedin');
$liLibrary->client->setToken((array) $access_token);
$url = 'https://api.linkedin.com/v1/companies/?is-company-admin=true&start=0&count=20';
try {
$companies = $liLibrary->client->query($url);
if ($companies->code == '200') {
$this->companies = json_decode($companies->body);
}
return parent::getInput();
} catch (Exception $e) {
return '<div class="jfbc-error">' . JText::_('COM_JFBCONNECT_CHANNEL_LINKEDIN_PERM_TOKEN_EXPIRED_LABEL') . '</div>';
}
} else {
return '<div class="jfbc-error">' . JText::_('COM_JFBCONNECT_CHANNEL_LINKEDIN_PERM_USER_AUTH_ERROR_LABEL') . '</div>';
}
} else {
return '<div class="jfbc-error">' . JText::_('COM_JFBCONNECT_CHANNEL_SELECT_USER_ERROR_LABEL') . '</div>';
}
}
示例12: getInput
/**
* Override to add new button
*
* @return string The field input markup.
*
* @since 3.2
*/
protected function getInput()
{
// see if we should add buttons
$setButton = $this->getAttribute('button');
// get html
$html = parent::getInput();
// if true set button
if ($setButton === 'true') {
$button = array();
$script = array();
$buttonName = $this->getAttribute('name');
// get the input from url
$jinput = JFactory::getApplication()->input;
// get the view name & id
$values = $jinput->getArray(array('id' => 'int', 'view' => 'word'));
// check if new item
$ref = '';
$refJ = '';
if (!is_null($values['id']) && strlen($values['view'])) {
// only load referal if not new item.
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
}
$user = JFactory::getUser();
// only add if user allowed to create intervention
if ($user->authorise('intervention.create', 'com_costbenefitprojection')) {
// build Create button
$buttonNamee = trim($buttonName);
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
$buttonNamee = preg_replace('/\\s+/', ' ', $buttonNamee);
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
$buttonNamee = ucfirst(strtolower($buttonNamee));
$button[] = '<a id="' . $buttonName . 'Create" class="btn btn-small btn-success hasTooltip" title="' . JText::sprintf('COM_COSTBENEFITPROJECTION_CREATE_NEW_S', $buttonNamee) . '" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_costbenefitprojection&view=intervention&layout=edit' . $ref . '" >
<span class="icon-new icon-white"></span></a>';
}
// only add if user allowed to edit intervention
if (($buttonName == 'intervention' || $buttonName == 'interventions') && $user->authorise('intervention.edit', 'com_costbenefitprojection')) {
// build edit button
$buttonNamee = trim($buttonName);
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
$buttonNamee = preg_replace('/\\s+/', ' ', $buttonNamee);
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
$buttonNamee = ucfirst(strtolower($buttonNamee));
$button[] = '<a id="' . $buttonName . 'Edit" class="btn btn-small hasTooltip" title="' . JText::sprintf('COM_COSTBENEFITPROJECTION_EDIT_S', $buttonNamee) . '" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "\n\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\tjQuery('#adminForm').on('change', '#jform_" . $buttonName . "',function (e) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tvar " . $buttonName . "Value = jQuery('#jform_" . $buttonName . "').val();\n\t\t\t\t\t\t\t" . $buttonName . "Button(" . $buttonName . "Value);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tvar " . $buttonName . "Value = jQuery('#jform_" . $buttonName . "').val();\n\t\t\t\t\t\t" . $buttonName . "Button(" . $buttonName . "Value);\n\t\t\t\t\t});\n\t\t\t\t\tfunction " . $buttonName . "Button(value) {\n\t\t\t\t\t\tif (value > 0) {\n\t\t\t\t\t\t\t// hide the create button\n\t\t\t\t\t\t\tjQuery('#" . $buttonName . "Create').hide();\n\t\t\t\t\t\t\t// show edit button\n\t\t\t\t\t\t\tjQuery('#" . $buttonName . "Edit').show();\n\t\t\t\t\t\t\tvar url = 'index.php?option=com_costbenefitprojection&view=interventions&task=intervention.edit&id='+value+'" . $refJ . "';\n\t\t\t\t\t\t\tjQuery('#" . $buttonName . "Edit').attr('href', url);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// show the create button\n\t\t\t\t\t\t\tjQuery('#" . $buttonName . "Create').show();\n\t\t\t\t\t\t\t// hide edit button\n\t\t\t\t\t\t\tjQuery('#" . $buttonName . "Edit').hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t}";
}
// check if button was created for intervention field.
if (is_array($button) && count($button) > 0) {
// Load the needed script.
$document = JFactory::getDocument();
$document->addScriptDeclaration(implode(' ', $script));
// return the button attached to input field.
return '<div class="input-append">' . $html . implode('', $button) . '</div>';
}
}
return $html;
}
示例13: getInput
/**
* Method to get the list field input markup.
*
* @return string The field input markup if version is less than Joomla 3.0, else text string.
*
* @since 1.3.0
*/
protected function getInput()
{
if (version_compare(JVERSION, '3.0.0', 'ge')) {
return '<span class="readonly">' . JText::_('JJ_SOCIAL_SLIDER_NOJQUERY_30') . '</span>';
} else {
return parent::getInput();
}
}
示例14: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
* @since 11.1
*/
public function getInput()
{
if (JVERSION < 3) {
AKHelper::_('include.addCSS', 'buttons/delicious-buttons/delicious-buttons.css', 'ww');
}
$a = ' <a style="float: left; margin-left: 10px;" class="akmarkdown-help-button btn btn-small delicious light green-pastel" href="http://markitup.jaysalvat.com/examples/" target="_blank">' . JText::_('JHELP') . '</a>';
return '<div class="akmarkdown-help-wrap pull-left fltlft">' . parent::getInput() . '</div>' . $a;
}
示例15: getInput
/**
* Method to get the field input markup
*
* @return string The field input markup.
* @since 1.7
*/
protected function getInput()
{
if ($this->form->getValue('id', 0) == 0) {
return '<span class="readonly">' . Lang::txt('COM_MENUS_ITEM_FIELD_ORDERING_TEXT') . '</span>';
} else {
return parent::getInput();
}
}