protected function getInput() { JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php"); JEVHelper::ConditionalFields($this->element, $this->form->getName()); $params = JComponentHelper::getParams("com_jevents"); $value = (int) $this->value; if ($value == -1) { if (version_compare(JVERSION, '3.0.0', "<")) { $default25 = (string) $this->element["default25"]; if ($default25 != "") { $this->value = $this->default = intval($default25); } } else { if (version_compare(JVERSION, '3.0.0', ">=")) { $default30 = (string) $this->element["default30"]; if ($default30 != "") { $this->value = $this->default = intval($default30); } } } } if (!$params->get("bootstrapchosen", 1)) { $x = 1; } return parent::getInput(); }
/** * Test the getOptions method. * * @return void * * @since 11.3 */ public function testGetOptions() { $form = new JFormInspector('form1'); $this->assertThat( $form->load('<form><field name="radio" type="radio"><option value="0">No</option><item value="1">Yes</item></field></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.' ); $field = new JFormFieldRadio($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->logicalNot( $this->StringContains('Yes') ), 'Line:' . __LINE__ . ' The field should not contain a Yes option.' ); }
/** * Test the getInput method. */ public function testGetInput() { $form = new JFormInspector('form1'); $this->assertThat( $form->load('<form><field name="radio" type="radio" /></form>'), $this->isTrue(), 'Line:'.__LINE__.' XML string should load successfully.' ); $field = new JFormFieldRadio($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. }
protected function getInput() { $html = parent::getInput(); // Automatically hide/show the owners list filter depending on chosen value. $html .= '<script> kQuery(function($) { var users_listbox = $("#docman_users_select2").parents("div.control-group"), hide = function() { users_listbox.hide(); }, show = function() { users_listbox.show(); }, own = $(\'input[name="' . $this->name . '"]:checked\').val(); if (!users_listbox.length) { users_listbox = $("#docman_users_select2").parents("li") } if (own == 1) { hide(); } $("#' . $this->id . '0").click(function() { hide(); }); $("#' . $this->id . '1").click(function() { show(); }); }); </script>'; return $html; }
protected function getLabel() { if (JPluginHelper::isEnabled('system', 'wow')) { return parent::getLabel(); } return ''; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { $doc = JFactory::getDocument(); // add documentation toolbar button if (version_compare(JVERSION, '3.0.0') == -1) { $button = '<a href="' . $this->documentation . '" style="font-weight:bold;border-color:#025A8D;background-color:#DBE4E9;" target="_blank"><span class="icon-32-help"> </span> ' . JText::_('MOD_PWEBFBLIKEBOX_DOCUMENTATION') . '</a>'; } else { $button = '<a href="' . $this->documentation . '" class="btn btn-small btn-info" target="_blank"><i class="icon-support"> </i> ' . JText::_('MOD_PWEBFBLIKEBOX_DOCUMENTATION') . '</a>'; } $bar = JToolBar::getInstance(); $bar->appendButton('Custom', $button, $this->extension . '-docs'); // add script $doc->addScript(JUri::root(true) . '/media/mod_pwebfblikebox/js/admin.js'); JText::script('MOD_PWEBFBLIKEBOX_WIDTH_MESSAGE'); // add feed script if ($this->value) { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('manifest_cache'); $query->from('#__extensions'); $query->where('type = "module"'); $query->where('element = "mod_pwebfblikebox"'); $db->setQuery($query); try { $manifest_str = $db->loadResult(); } catch (RuntimeException $e) { $manifest_str = null; } $manifest = new JRegistry($manifest_str); $doc->addScriptDeclaration('(function(){' . 'var pw=document.createElement("script");pw.type="text/javascript";pw.async=true;' . 'pw.src="https://www.perfect-web.co/index.php?option=com_pwebshop&view=updates&format=raw&extension=' . $this->extension . '&version=' . $manifest->get('version', '1.0.0') . '&jversion=' . JVERSION . '&host=' . urlencode(JUri::root()) . '";' . 'var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(pw,s);' . '})();'); } return parent::getInput(); }
public function getControlGroup() { if (!self::hide_it()) { return parent::getControlGroup(); } return ''; }
protected function getOptions() { $options = array(); foreach ($this->options as $option) { $options[] = JHtml::_('select.option', $option, JText::_('MOD_WOW_RECRUITMENT_PRIO_' . strtoupper($option))); } return array_merge(parent::getOptions(), $options); }
/** * Method to get the field input markup. * * @return string The field input markup. */ protected function getInput() { if ((int) $this->form->getValue('form') === 0) { return '<input class="readonly" size="60" value="' . JText::_('COM_FABRIK_FIELD_ASSIGN_GROUP_TO_FORM_FIRST') . '" type="readonly" />'; } else { return parent::getInput(); } }
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); }
protected function getInput() { $classes = array('radio', 'btn-group', 'btn-group-yesno'); if (in_array($this->fieldname, array('published', 'enabled', 'state'))) { $classes[] = 'jpublished'; } $this->class = implode(' ', $classes); return parent::getInput(); }
protected function getOptions() { $options = parent::getOptions(); if ($this->global != 0) { array_unshift($options, JHtml::_('select.option', $this->global, JText::_('JGLOBAL'))); } array_unshift($options, JHtml::_('select.option', '1', JText::_('JYES'))); array_unshift($options, JHtml::_('select.option', '0', JText::_('JNO'))); return $options; }
protected function getInput() { $style = ' class="jev_none" '; // if not showing copyright show message if (!$this->value) { $style = ' class="jev_block" '; } JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php"); JEVHelper::ConditionalFields($this->element, $this->form->getName()); return parent::getInput() . '<div id="jevcopymsg" ' . $style . '>' . JText::_("Before removing the copyright footer please read this important message at the <a href='https://www.jevents.net/hidecopyright?tmpl=component&template=beez_20' title='get hide copyright code' class='modal' rel='{handler: \"iframe\", size: {x: 650, y: 450}}'>JEvents website</a>.") . '</div>'; }
/** * Method to get the field input markup. * * @return string The field input markup. * * @since 1.6 */ protected function getInput() { if (!$this->value) { $conf = JFactory::getConfig(); if ($conf->get('sampledata')) { $this->value = $conf->get('sampledata'); } else { $this->value = ''; } } return parent::getInput(); }
* type="JSRadio" * default="1" * label="MOD_JS_LABEL" * description="MOD_JS_DESC"> * <option value="1" sub_fields="mod_yes_field_1,mod_yes_field_2">JYES</option> * <option value="0" sub_fields="mod_no_field_1,mod_no_field_2">JNO</option> * </field>
protected function getInput() { global $JElementJSRadioJSWritten; if (!$JElementJSRadioJSWritten) { $file = dirname(__FILE__) . DS . "jsradio.js"; $url = str_replace(JPATH_ROOT, JURI::root(true), $file); $url = str_replace(DS, "/", $url); $doc = JFactory::getDocument(); $doc->addScript($url); $JElementJSRadioJSWritten = TRUE; } $this->element['class'] = $this->element['class'] ? 'jck_radio btn-group' . chr(32) . (string) $this->element['class'] : 'jck_radio btn-group'; return parent::getInput(); }
/** * Method to get the field input markup. * * Options: * - target: the group id to toggler * - Show: the radio list's value to show target * - Hide: the radio list's value to hide the target * - alt: another group id, which is shown when target is hidden and hidden when target shown. * * @return string The field input markup. */ protected function getInput() { $alt = $this->element['alt']; $script = array(); $script[] = "window.addEvent('domready', function() {\n\t\tvar s = document.id('" . $this->id . "').getElements('input').filter(function (e) {\n\t\treturn (e.checked);\n\t\t});\n\t\tif (s[0].get('value') == '" . $this->element['hide'] . "') {\n\t\t\tdocument.id('" . $this->element['toggle'] . "').hide();\n\t\t}"; if ($alt) { $script[] = "if (s[0].get('value') == '" . $this->element['show'] . "') {\n\t\t\tdocument.id('" . $alt . "').hide();\n\t\t}"; } $script[] = "document.id('" . $this->id . "').getElements('input').addEvent('change', function (e) {\n\t\t\t\tif (e.target.checked == true) {\n\t\t\t\t\tvar v = e.target.get('value');\n\t\t\t\t\tif (v == '" . $this->element['show'] . "') {\n\t\t\t\t\t\tdocument.id('" . $this->element['toggle'] . "').show();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (v == '" . $this->element['hide'] . "') {\n\t\t\t\t\t\t\tdocument.id('" . $this->element['toggle'] . "').hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t}"; if ($alt) { $script[] = "if (v == '" . $this->element['show'] . "') {\n\t\t\t\t\t\tdocument.id('" . $alt . "').hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (v == '" . $this->element['hide'] . "') {\n\t\t\t\t\t\t\tdocument.id('" . $alt . "').show();\n\t\t\t\t\t\t}\n\t\t\t\t\t}"; } $script[] = "\n\t\t\t\t}\n\t\t\t});\n\t\t})"; FabrikHelperHTML::addScriptDeclaration(implode("\n", $script)); return parent::getInput(); }
/** * Method to get certain otherwise inaccessible properties from the form field object. * * @param string $name The property name for which to the the value. * * @return mixed The property value or null. * * @since 2.0 */ public function __get($name) { switch ($name) { case 'static': if (empty($this->static)) { $this->static = $this->getStatic(); } return $this->static; break; case 'repeatable': if (empty($this->repeatable)) { $this->repeatable = $this->getRepeatable(); } return $this->repeatable; break; default: return parent::__get($name); } }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { $doc = JFactory::getDocument(); // add documentation toolbar button if (version_compare(JVERSION, '3.0.0') == -1) { $button = '<a href="' . $this->documentation . '" style="font-weight:bold;border-color:#025A8D;background-color:#DBE4E9;" target="_blank"><span class="icon-32-help"> </span> ' . JText::_('MOD_PWEBFBLIKEBOX_DOCUMENTATION') . '</a>'; } else { $button = '<a href="' . $this->documentation . '" class="btn btn-small btn-info" target="_blank"><i class="icon-support"> </i> </span> ' . JText::_('MOD_PWEBFBLIKEBOX_DOCUMENTATION') . '</a>'; } $bar = JToolBar::getInstance(); $bar->appendButton('Custom', $button, $this->extension . '-docs'); // add script $doc->addScript(JURI::root(true) . '/media/mod_pwebfblikebox/js/admin.js'); // add feed script if ($this->value) { $doc->addScriptDeclaration('(function(){' . 'var pw=document.createElement("script");pw.type="text/javascript";pw.async=true;' . 'pw.src="//www.perfect-web.co/updates/feed.js?ext=' . $this->extension . '&j=' . JVERSION . '";' . 'var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(pw,s);' . '})();'); } return parent::getInput(); }
/** * Method to get the options to populate list * * @return array The field option objects. * * @since 3.2 */ protected function getOptions() { // Hash for caching $hash = md5($this->element); $type = strtolower($this->type); if (!isset(static::$options[$type][$hash]) && !empty($this->predefinedOptions)) { static::$options[$type][$hash] = parent::getOptions(); $options = array(); // Allow to only use specific values of the predefined list $filter = isset($this->element['filter']) ? explode(',', $this->element['filter']) : array(); foreach ($this->predefinedOptions as $value => $text) { if (empty($filter) || in_array($value, $filter)) { $text = $this->translate ? JText::_($text) : $text; $options[] = (object) array('value' => $value, 'text' => $text); } } static::$options[$type][$hash] = array_merge(static::$options[$type][$hash], $options); } return static::$options[$type][$hash]; }
/** * Method to get the field input markup. * * Options: * - target: the group id to toggler * - Show: the radio list's value to show target * - Hide: the radio list's value to hide the target * - alt: another group id, which is shown when target is hidden and hidden when target shown. * * @return string The field input markup. */ protected function getInput() { $fs = str_replace("'", '"', $this->element['fieldsets']); $script = array(); if ($fs !== '') { /** * New way: * * <field name="slack_attachment" type="toggleoptionsradio" class="btn-group" default="0" description="PLG_FORM_SLACK_ATTACHMENTS_DESC" label="PLG_FORM_SLACK_ATTACHMENTS_LABEL" fieldsets="{'0':'plg-form-slack-simple','1':'plg-form-slack-attachments'}"> <option value="0">JNO</option> <option value="1">JYES</option> </field> * */ $script[] = "jQuery('document').ready(function(\$) {\n\t\t\t\tvar fs = {$fs};\n\t\t\t\tvar v = \$('#" . $this->id . "').find('input:checked').val();\n\t\t\t\t\$.each(fs, function (value, fieldset) {\n\t\t\t\t\tv !== value ? \$('#' + fieldset).hide() : \$('#' + fieldset).show();\n\t\t\t\t\tv !== value ? \$('a[href*=' + fieldset + ']').hide() : \$('a[href*=' + fieldset + ']').show();\n\t\t\t\t});\n\n\t\t\t\t \$('#" . $this->id . "').find('input').on('click', function () {\n\t\t\t\t var v = \$(this).val();\n\t\t\t\t \$.each(fs, function (value, fieldset) {\n\t\t\t\t\t\tv !== value ? \$('#' + fieldset).hide() : \$('#' + fieldset).show();\n\t\t\t\t\t\tv !== value ? \$('a[href*=' + fieldset + ']').hide() : \$('a[href*=' + fieldset + ']').show();\n\t\t\t\t\t});\n\t\t\t\t });\n\t\t\t});"; } else { $alt = $this->element['alt']; $script[] = "window.addEvent('domready', function() {\n\t\tvar s = document.id('" . $this->id . "').getElements('input').filter(function (e) {\n\t\treturn (e.checked);\n\t\t});\n\t\tif (s[0].get('value') == '" . $this->element['hide'] . "') {\n\t\t\tdocument.id('" . $this->element['toggle'] . "').hide();\n\t\t}"; if ($alt) { $script[] = "if (s[0].get('value') == '" . $this->element['show'] . "') {\n\t\t\tdocument.id('" . $alt . "').hide();\n\t\t}"; } $script[] = "document.id('" . $this->id . "').getElements('input').addEvent('change', function (e) {\n\t\t\t\tif (e.target.checked == true) {\n\t\t\t\t\tvar v = e.target.get('value');\n\t\t\t\t\tif (v == '" . $this->element['show'] . "') {\n\t\t\t\t\t\tdocument.id('" . $this->element['toggle'] . "').show();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (v == '" . $this->element['hide'] . "') {\n\t\t\t\t\t\t\tdocument.id('" . $this->element['toggle'] . "').hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t}"; if ($alt) { $script[] = "if (v == '" . $this->element['show'] . "') {\n\t\t\t\t\t\tdocument.id('" . $alt . "').hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (v == '" . $this->element['hide'] . "') {\n\t\t\t\t\t\t\tdocument.id('" . $alt . "').show();\n\t\t\t\t\t\t}\n\t\t\t\t\t}"; } $script[] = "\n\t\t\t\t}\n\t\t\t});\n\t\t})"; } FabrikHelperHTML::addScriptDeclaration(implode("\n", $script)); return parent::getInput(); }
/** * Method to attach a JForm object to the field. * * @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object. * @param mixed $value The form field value to validate. * @param string $group The field name group control value. This acts as as an array container for the field. * For example if the field has name="foo" and the group value is set to "bar" then the * full field name would end up being "bar[foo]". * * @return boolean True on success. * * @since 11.1 */ public function setup(SimpleXMLElement $element, $value, $group = null) { return parent::setup($element, $value, $group); }
/** * Method to get the field options. * * @return array The field option objects. * @since 1.2.0 */ public function getOptions() { $app = JFactory::getApplication(); // Initialize variables. $item = $app->getUserState('com_bwpostman.edit.newsletter.data', null); // prepare query $_db = JFactory::getDbo(); // Build the select list for the templates $query = $_db->getQuery(true); $query->select($_db->quoteName('id') . ' AS ' . $_db->quoteName('value')); $query->select($_db->quoteName('title') . ' AS ' . $_db->quoteName('title')); $query->select($_db->quoteName('description') . ' AS ' . $_db->quoteName('description')); $query->select($_db->quoteName('thumbnail') . ' AS ' . $_db->quoteName('thumbnail')); $query->from($_db->quoteName('#__bwpostman_templates')); // special for old newsletters with template_id < 1 if ($item->text_template_id < 1 && !is_null($item->text_template_id)) { $query->where($_db->quoteName('id') . ' >= ' . $_db->Quote('-2')); } else { $query->where($_db->quoteName('id') . ' > ' . $_db->Quote('0')); } $query->where($_db->quoteName('archive_flag') . ' = ' . $_db->Quote('0')); $query->where($_db->quoteName('published') . ' = ' . $_db->Quote('1')); $query->where($_db->quoteName('tpl_id') . ' > ' . $_db->Quote('997')); $query->order($_db->quoteName('title') . ' ASC'); $_db->setQuery($query); $options = $_db->loadObjectList(); // Check for a database error. if ($_db->getErrorNum()) { $app->enqueueMessage($_db->getErrorMsg(), 'error'); } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
/** * Method to construct the HTML of this element * * @param null * @return string */ protected function getInput() { $this->class = 'radio btn-group btn-group-yesno'; return parent::getInput(); }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { $script = "head.ready(function() {\n\t\tvar s = \$('" . $this->id . "').getElements('input').filter(function(e){\n\t\treturn (e.checked);\n\t\t});\n\t\tif(s[0].get('value') == '" . $this->element['hide'] . "'){\n\t\t\t\$('" . $this->element['toggle'] . "').hide();\n\t\t}\n\t\t\t\$('" . $this->id . "').getElements('input').addEvent('change', function(e){\n\t\t\t\tif(e.target.checked == true){\n\t\t\t\t\tvar v = e.target.get('value');\n\t\t\t\t\tif(v == '" . $this->element['show'] . "') {\n\t\t\t\t\t\t\$('" . $this->element['toggle'] . "').show();\n\t\t\t\t\t} else{\n\t\t\t\t\t\tif(v == '" . $this->element['hide'] . "') {\n\t\t\t\t\t\t\t\$('" . $this->element['toggle'] . "').hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t})"; FabrikHelperHTML::addScriptDeclaration($script); return parent::getInput(); }
protected function getInput() { 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 options. * * @return array The field option objects. * @since 1.0.1 */ public function getOptions() { $app = JFactory::getApplication(); // Initialize variables. $user_id = null; $accesslevels = array(); $subs_id = $app->getUserState('com_bwpostman.edit.subscriber.id', null); // prepare query $_db = JFactory::getDbo(); $query = $_db->getQuery(true); $query_user = $_db->getQuery(true); // get user_ids if exists if (is_array($subs_id) && !empty($subs_id)) { $query_user->select($_db->quoteName('user_id')); $query_user->from($_db->quoteName('#__bwpostman_subscribers')); $query_user->where($_db->quoteName('id') . ' = ' . (int) $subs_id[0]); $_db->setQuery($query_user); $user_id = $_db->loadResult(); } // get authorized viewlevels if ($user_id) { $accesslevels = JAccess::getAuthorisedViewLevels($user_id); } $query->select("id AS value, title, description AS text"); $query->from($_db->quoteName('#__bwpostman_mailinglists')); $query->where($_db->quoteName('published') . ' = ' . (int) 1); $query->where($_db->quoteName('archive_flag') . ' = ' . (int) 0); if (is_array($accesslevels) && !empty($accesslevels)) { $query->where($_db->quoteName('access') . ' IN (' . implode(',', $accesslevels) . ')'); } else { $query->where($_db->quoteName('access') . ' = ' . (int) 1); } $query->order('title ASC'); $_db->setQuery($query); $options = $_db->loadObjectList(); // Check for a database error. if ($_db->getErrorNum()) { $app->enqueueMessage($_db->getErrorMsg(), 'error'); } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
function getInput() { $this->value = $this->form->getValue('id') == 0 ? 1 : 0; return parent::getInput(); }