/** * 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); }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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); }
public function getInput() { if (!self::hide_it()) { return parent::getInput(); } return ''; }
protected function getInput() { if (!is_array($this->value)) { $this->value = explode(',', $this->value); } return parent::getInput(); }
protected function getInput() { if (count($this->getOptions()) == 0) { return ""; } return parent::getInput(); }
protected function getInput() { if (is_string($this->value)) { $this->value = explode(",", $this->value); } return parent::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>'; } }
/** * 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; }
/** * 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(); } }
/** * 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; }
/** * 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(); } }
/** * 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">' . JText::_('COM_MAPFRANCE_AREA_FIELD_ORDERING_TEXT') . '</span>'; } else { return parent::getInput(); } }
/** * Override to add refresh button * * @return string The field input markup. * * @since 3.2 */ protected function getInput() { JHtml::script('system/helpsite.js', false, true); JFactory::getDocument()->addScriptDeclaration('var helpsite_base = "' . addslashes(JUri::root()) . '";'); $html = parent::getInput(); $button = '<button type="button" class="btn btn-small" id="helpsite-refresh" rel="' . $this->id . '"><span>' . JText::_('JGLOBAL_HELPREFRESH_BUTTON') . '</span></button>'; return $html . $button; }
protected function getInput() { $db = FabrikWorker::getDbo(); $query = $db->getQuery(true); $query->select('form_id')->from('#__{package}_formgroup')->where('group_id = ' . (int) $this->form->getValue('id')); $db->setQuery($query); $this->value = $db->loadResult(); return parent::getInput(); }
protected function getInput() { $baseURL = JURI::root() . '/images/'; $a1 = ' onkeyup="' . "Mosimage.showImageProps( '" . $baseURL . "' );"; $a2 = ' onclick="' . "Mosimage.showImageProps( '" . $baseURL . "' );"; // wir misbrauchen hier onchange, da Fieldlist kein onclick und onkeyup unterstützt $this->onchange = '" ' . $a1 . '"' . $a2; return parent::getInput(); }
protected function getInput() { if (is_string($this->value)) { $this->value = explode(",", $this->value); } JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php"); JEVHelper::ConditionalFields($this->element, $this->form->getName()); return parent::getInput(); }
/** * Method to get the field input markup for check boxes. * * @return string The field input markup. * * @since 1.2.0 */ protected function getInput() { // Get the field options. $options = $this->getOptions(); if (empty($options)) { return '<span class="readonly">' . JText::_('COM_FIELDSANDFILTERS_ERROR_FIELD_VALUES_EMPTY') . '</span>'; } return parent::getInput(); }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { if ($this->element['active'] == 1) { $this->element['readonly'] = ''; } else { $this->element['readonly'] = 'true'; } return parent::getInput(); }
public function getInput() { $onchange = "if (this.value=='default')\n {\n document.getElementById('loginbutton_custom_notice').style.display='block';\n var fieldsets = document.getElementsByTagName('fieldset');\n for(var i = 0; i < fieldsets.length; i++) {\n if(fieldsets[i].id.indexOf('jform_params_') == 0 && fieldsets[i].id.indexOf('_loginbuttons_') > 0) {\n fieldsets[i].style.display='none';\n }\n }\n }\n else\n {\n document.getElementById('loginbutton_custom_notice').style.display='none';\n var fieldsets = document.getElementsByTagName('fieldset');\n for(var i = 0; i < fieldsets.length; i++) {\n if(fieldsets[i].id.indexOf('jform_params_') == 0 && fieldsets[i].id.indexOf('_loginbuttons_') > 0) {\n fieldsets[i].style.display='block';\n }\n }\n }"; // J3.x $this->onchange = $onchange; // J2.5 $this->element->addAttribute('onchange', $onchange); return parent::getInput(); }
protected function getInput() { $html = '<input type="text" name="' . $this->name . '" value="' . $this->value . '" id="' . $this->id . '" />'; $this->id = 'img_class_list'; $this->name = 'img_class_list'; $html .= parent::getInput(); $doc = JFactory::getDocument(); $doc->addScriptDeclaration("\n window.addEvent('domready', function() {\n \$('img_class_list').addEvent('change', function() {\n \$('jform_img').set('value', this.get('value'));\n });\n });\n "); return $html; }
protected function getInput() { static $resources = true; if ($resources) { $resources = false; $document = JFactory::getDocument(); $document->addScript(JUri::root(true) . "/components/com_oziogallery3/js/listnanoalbums.js"); } return parent::getInput() . '<div id="jform_params_ozio_nano_albumList_alert"></div>'; }
/** * Method to get the list of files for the field options. * Specify the target directory with a directory attribute * Attributes allow an exclude mask and stripping of extensions from file name. * Default attribute may optionally be set to null (no file) or -1 (use a default). * * @return array The field option objects. * * @since 11.1 */ protected function getInput() { $value = $this->value; if (is_string($value) && preg_match('/^\\[.*\\]$/', $value)) { $value = str_replace('\'', '"', $value); $this->value = json_decode($value); } $this->multiple = true; $this->name .= '[]'; return parent::getInput(); }
protected function getInput() { $db = JFactory::getDBO(); $db->setQuery("SELECT enabled FROM #__extensions WHERE name = 'com_easyblog'"); $isEnabled = $db->loadResult(); if ($isEnabled) { return parent::getInput(); } else { return '<span class="' . $this->element['class'] . '">' . JText::_('EASYBLOG_IS_NOT_ENABLED_OR_INSTALLED') . '</span>'; } }
/** * 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() { if (!empty($this->element['placeholder'])) { $this->class = $this->element['class'] . '" data-placeholder="' . JText::_($this->element['placeholder']) . '"'; } if ($this->multiple && !empty($this->value) && !is_array($this->value)) { // This is a fix to allow multiple default values $this->value = array_map('trim', explode(",", $this->value)); } return parent::getInput(); }
public function getInput() { $db = JFactory::getDBO(); $db->setQuery('SELECT enabled FROM #__extensions WHERE name = ' . $db->quote('com_k2')); $isEnabled = $db->loadResult(); if ($isEnabled) { return parent::getInput(); } else { return '<span class="' . $this->element['class'] . '">' . JText::_('K2_IS_NOT_ENABLED_OR_INSTALLED') . '</span>'; } }
protected function getInput() { $name = basename(realpath(dirname(__FILE__) . "/../..")); static $resources = true; if ($resources) { $resources = false; $document = JFactory::getDocument(); $prefix = JURI::current() . "?option=" . $name . "&view=loader"; // jquery $document->addScript("https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"); $document->addScript(JURI::root(true) . "/components/com_oziogallery3/js/jquery-noconflict.js"); // pwi $document->addScript(JURI::root(true) . "/components/" . $name . "/js/jquery-pwi.js"); // Alternative code: $type = strtolower($this->type); $type = (string) $this->element["type"]; if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) { $document->addScript($prefix . "&type=js&filename=" . $type); } if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) { $document->addStyleSheet(JURI::base(true) . "/components/" . $name . "/css/" . $type . ".css"); } // per la compatibilità con Internet Explorer $document->addScript(JURI::root(true) . "/components/" . $name . "/js/jQuery.XDomainRequest.js"); } return '<div id="album_selection">' . parent::getInput() . '<img id="jform_params_' . (string) $this->element["name"] . '_loader" style="display:none;" src="' . JURI::root(true) . '/components/' . $name . '/views/00fuerte/img/progress.gif">' . '<span id="jform_params_' . (string) $this->element["name"] . '_warning" style="display:none;">' . JText::_("COM_OZIOGALLERY3_CONNECTION_FAILED") . '</span>' . '<span id="jform_params_' . (string) $this->element["name"] . '_selected" style="display:none;">' . $this->value . '</span>' . '</div>'; }