/** * Method to get the field input markup. * * @return string The field input markup. * @since 11.1 */ protected function getInput() { if ($this->element['check']) { $check_result = MEFormHelper::checkExtension($this->element['check']); if ($check_result) { return $check_result; } } // Initialize variables. $html = array(); // Initialize some field attributes. $class = $this->element['class'] ? ' class="radio ' . (string) $this->element['class'] . '"' : ' class="radio"'; // Start the radio field output. $html[] = $this->element['prepend'] . ' <fieldset id="' . $this->id . '"' . $class . '>'; // Get the field options. $options = $this->getOptions(); // Build the radio field output. foreach ($options as $i => $option) { // Initialize some option attributes. $checked = (string) $option->value == (string) $this->value ? ' checked="checked"' : ''; $class = !empty($option->class) ? ' class="' . $option->class . '"' : ''; $disabled = !empty($option->disable) ? ' disabled="disabled"' : ''; // Initialize some JavaScript option attributes. $onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : ''; $html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>'; $html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . JText::alt($option->text, preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)) . '</label>'; } // End the radio field output. $html[] = '</fieldset>' . $this->element['append']; return implode($html); }
public function onToolGetForm($context, $form, $name, $id) { if ($name != 'toolset') { return; } $tool = $this->_getTool($id); if (!JFile::exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'saved' . DIRECTORY_SEPARATOR . $id . '.conf')) { JFile::write(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'saved' . DIRECTORY_SEPARATOR . $id . '.conf', @$a); } $params = new JRegistry(); $params->loadFile(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'saved' . DIRECTORY_SEPARATOR . $id . '.conf'); $form_object = JForm::getInstance('plg_toolset.form', JPATH_PLUGINS . DIRECTORY_SEPARATOR . 'mint' . DIRECTORY_SEPARATOR . 'toolset' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'forms.xml', array('control' => 'jform')); $form = MEFormHelper::renderFieldset($form_object, 'toolset' . $id, $params, null, FORM_STYLE_TABLE); }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 11.1 */ protected function getInput() { if ($this->element['check']) { $check_result = MEFormHelper::checkExtension($this->element['check']); if ($check_result) { return $check_result; } } // Initialize some field attributes. $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : ''; $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $readonly = (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : ''; $disabled = (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : ''; // Initialize JavaScript field attributes. $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; return $this->element['prepend'] . ' <input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $disabled . $readonly . $onchange . $maxLength . '/> ' . $this->element['append']; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 11.1 */ protected function getInput() { if ($this->element['check']) { $check_result = MEFormHelper::checkExtension($this->element['check']); if ($check_result) { return $check_result; } } $opt = array(); $opt[] = JHTML::_('select.option', '', JText::_('Do not use')); $opt[] = JHTML::_('select.option', '(###) ### #######', JText::_('Phone')); $opt[] = JHTML::_('select.option', '(###) ###-####', JText::_('Phone US')); $opt[] = JHTML::_('select.option', 'mm/dd/yyyy', JText::_('Date')); $opt[] = JHTML::_('select.option', '#####-###', JText::_('Code')); $opt[] = JHTML::_('select.option', '#### #### #### ####', JText::_('Credit Card')); $opt[] = JHTML::_('select.option', '#', JText::_('Integer')); $opt[] = JHTML::_('select.option', '#####.##', JText::_('Decimal')); $opt[] = JHTML::_('select.option', '#,###.##', JText::_('Numeric with format')); $opt[] = JHTML::_('select.option', '$#,###.##', JText::_('Dollar')); $opt[] = JHTML::_('select.option', '€#,###.##', JText::_('Euro')); $opt[] = JHTML::_('select.option', 'custom', JText::_('Custom')); if (!$this->value) { $this->value = new stdClass(); } if (!isset($this->value->type)) { $this->value->type = false; } if (!isset($this->value->mask_type)) { $this->value->mask_type = false; } if (!isset($this->value->mask)) { $this->value->mask = false; } $out = ''; $add = '<br><input style="float:none;" type="radio" name="' . $this->name . '[type]" value="string" ' . (!$this->value->type || $this->value->type == 'string' ? 'checked' : '') . '> ' . JText::_('String'); $add .= ' <input style="float:none;" type="radio" name="' . $this->name . '[type]" value="date" ' . ($this->value->type == 'date' ? 'checked' : '') . '> ' . JText::_('Date'); $add .= ' <input style="float:none;" type="radio" name="' . $this->name . '[type]" value="number" ' . ($this->value->type == 'number' ? 'checked' : '') . '> ' . JText::_('Number'); $display = $this->value->mask_type ? 'block' : 'none'; $readonly = $this->value->mask_type && $this->value->mask_type != 'custom' ? 'readonly' : ''; $out .= JHtml::_('select.genericlist', $opt, $this->name . '[mask_type]', 'onchange="changeMask' . $this->id . '(this.value)"', 'value', 'text', $this->value->mask_type, $this->id . "mask_type"); $out .= '<input type="text" style="display: ' . $display . '" name="' . $this->name . '[mask]" id="' . $this->id . '_mask" value="' . $this->value->mask . '" size="40" ' . $readonly . '>'; $out .= '<br><span id="add_' . $this->id . '"></span>'; $out .= ' <script type="text/javascript"> function changeMask' . $this->id . '(value) { if(value == "custom") { value = "' . ($this->value->mask && $this->value->mask_type == 'custom' ? $this->value->mask : '') . '"; $("add_' . $this->id . '").set("html", \'' . $add . '\'); $("' . $this->id . '_mask").setStyle("display", "block"); $("' . $this->id . '_mask").removeProperty("readonly"); } else if(!value) { value = ""; $("' . $this->id . '_mask").setStyle("display", "none"); $("add_' . $this->id . '").set("html", ""); $("' . $this->id . '_mask").setProperty("readonly", "true"); } else { $("add_' . $this->id . '").set("html", ""); $("' . $this->id . '_mask").setStyle("display", "block"); $("' . $this->id . '_mask").setProperty("readonly", "true"); } $("' . $this->id . '_mask").value = value; } ' . ($this->value->mask_type && $this->value->mask_type == 'custom' ? 'changeMask' . $this->id . '("' . $this->value->mask_type . '")' : '') . ' </script> '; return $out; }