Ejemplo n.º 1
0
 public function getInput()
 {
     $data = array();
     $options = array('default' => $this->value == '' ? (int) $this->element['default'] : $this->value);
     if (isset($this->element['disabled']) && $this->element['disabled'] == 'true') {
         $options['class'] = 'disabled';
         $options['disabled'] = 'disabled';
     }
     // Get all radio options from xml
     foreach ($this->element->children() as $option) {
         $data[] = array('value' => $option['value'], 'text' => (string) $option);
     }
     return JSNTplFormHelper::radio($this->name, $data, $options);
 }
Ejemplo n.º 2
0
    /**
     * 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()
    {
        $request = JFactory::getApplication()->input;
        if (class_exists('JModelLegacy')) {
            $templateModel = JModelLegacy::getInstance('Style', 'TemplatesModel');
        } else {
            $templateModel = JModel::getInstance('Style', 'TemplatesModel');
        }
        $templateData = $templateModel->getItem($request->getInt('id'));
        $templateXml = JSNTplHelper::getManifest($templateData->template);
        $mobileMenuIconType = (string) $templateXml->mobileMenuIconType;
        if (strtolower($mobileMenuIconType) != 'yes') {
            $html[] = '<script type="text/javascript">
				(function($) {
					$(document).ready(function() {
						$("#jsn_mobileMenuIconTypeText").parent().parent().prev().hide();
						$("#jsn_mobileMenuIconTypeText").parent().parent().hide();
					});
				})(jQuery);
			</script>';
        } else {
            $html[] = '<script type="text/javascript">
				(function($) {
					$(document).ready(function() {

						if ($("input[name=\'jsn[mobileMenuIconType]\']:checked").val() == "text")
						{
							$("#jsn_mobileMenuIconTypeText").parent().parent().show();
						} else {
							$("#jsn_mobileMenuIconTypeText").parent().parent().hide();
						}

						$(".radio input[name=\'jsn[mobileMenuIconType]\']").click(function(){
						    if ($(this).val() == "text") {
						    	$("#jsn_mobileMenuIconTypeText").parent().parent().show();
						    } else {
						    	$("#jsn_mobileMenuIconTypeText").parent().parent().hide();
						    }
						});
					});
				})(jQuery);
			</script>';
        }
        $data = array();
        $options = array('default' => $this->value == '' ? (int) $this->element['default'] : $this->value);
        if (isset($this->element['disabled']) && $this->element['disabled'] == 'true') {
            $options['class'] = 'disabled';
            $options['disabled'] = 'disabled';
        }
        // Get all radio options from xml
        foreach ($this->element->children() as $option) {
            $data[] = array('value' => $option['value'], 'text' => (string) $option);
        }
        $html[] = JSNTplFormHelper::radio($this->name, $data, $options);
        return implode($html);
    }