Esempio 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);
 }
Esempio n. 2
0
 public function getInput()
 {
     $attrs = array('class' => @$this->element['class'], 'id' => $this->id);
     $disable = '';
     if (isset($this->element['disabled']) && $this->element['disabled'] == 'true') {
         $attrs['class'] .= ' disabled';
         $attrs['disabled'] = 'disabled';
         $disable = 'disabled';
     }
     $html = '<div class="input-append jsn-media-input">';
     $html .= JSNTplFormHelper::input($this->name, $this->value, $attrs);
     $html .= '<a href="index.php?widget=image-selector" id="' . $this->id . '_select" class="add-on btn btn-media ' . $disable . '" data-target="#' . $this->id . '"> ... </a>';
     $html .= '<a href="javascript:void(0)" class="add-on btn btn-media-clear ' . $disable . '" id="' . $this->id . '_clear" data-default="' . (string) $this->element['defaultValue'] . '" data-target="#' . $this->id . '">' . JText::_('JSN_TPLFW_DEFAULT') . '</a>';
     $html .= '</div>';
     return $html;
 }
 /**
  * Parse field declaration to render input.
  *
  * @return  void
  */
 public function getInput()
 {
     // Make sure we have options declared
     if (!isset($this->element->option)) {
         return JText::_('JSN_TPLFW_ERROR_MISSING_OPTIONS');
     }
     // Get template model
     $templateModel = class_exists('JModelLegacy') ? JModelLegacy::getInstance('Style', 'TemplatesModel') : JModel::getInstance('Style', 'TemplatesModel');
     // Get style data
     $this->data = $templateModel->getItem(JFactory::getApplication()->input->getInt('id'));
     // Instantiate helper class of JSN Template Framework
     $helper = JSNTplTemplateHelper::getInstance();
     // Finalize template parameters
     $this->data->params = $helper->loadParams($this->data->params, $this->data->template);
     // Initialize field value
     if (isset($this->data->params[(string) $this->element['name']])) {
         $this->value = $this->data->params[(string) $this->element['name']];
     } elseif (empty($this->value)) {
         $this->value = (string) $this->element['default'];
     }
     if (is_string($this->value)) {
         $this->value = (substr($this->value, 0, 1) == '{' and substr($this->value, -1) == '}') ? json_decode($this->value, true) : array($this->value => 1);
     }
     // Parse field attributes
     $options['class'] = isset($this->element['class']) ? (string) $this->element['class'] : '';
     $options['disabled'] = '';
     if (isset($this->element['disabled']) and $this->element['disabled'] == 'true') {
         $options['class'] .= ' disabled';
         $options['disabled'] = ' disabled="disabled"';
     }
     // Get all checkbox options from xml
     $data = array();
     foreach ($this->element->children() as $option) {
         // Check if option is checked
         if (is_array($this->value)) {
             $checked = (array_key_exists((string) $option['value'], $this->value) and $this->value[(string) $option['value']]);
         } else {
             $checked = (isset($option['default']) and (string) $option['default'] == 'checked');
         }
         $data[] = array('value' => (string) $option['value'], 'text' => (string) $option, 'checked' => $checked ? ' checked="checked"' : '');
     }
     return JSNTplFormHelper::checkbox($this->name, $data, $options);
 }
Esempio n. 4
0
 /**
  * Return HTML markup for the field
  *
  * @return  string
  */
 public function getInput()
 {
     // Prepare field attributes
     $this->disabled = (string) $this->element['disabled'] == 'true';
     $attrs = array('id' => $this->id, 'class' => (string) $this->element['class']);
     !$this->disabled or $attrs['disabled'] = 'disabled';
     $label = JText::_(isset($this->element['verifyLabel']) ? $this->element['verifyLabel'] : 'JSN_TPLFW_VERIFY');
     $html[] = '<div class="input-append">';
     $html[] = JSNTplFormHelper::input($this->name, $this->value, $attrs);
     if ($this->disabled) {
         $html[] = '	<span class="add-on">' . $label . '</span>';
     } else {
         $html[] = '	<a href="javascript:void(0)" class="add-on btn btn-verify-folder">' . $label . '</a>';
     }
     $html[] = '</div>';
     $html[] = '<div class="clear"></div>';
     $html[] = '<p class="pull-left label hide" style="margin-bottom:0"></p>';
     return implode("\n", $html);
 }
Esempio n. 5
0
 /**
  * Parse field declaration to render input.
  *
  * @return  void
  */
 public function getInput()
 {
     // Make sure we have options declared
     if (!isset($this->element->option)) {
         return JText::_('JSN_TPLFW_ERROR_MISSING_OPTIONS');
     }
     // Get template data
     $data = JSNTplHelper::getEditingTemplate();
     // Initialize field value
     if (isset($data->params[(string) $this->element['name']])) {
         $this->value = $data->params[(string) $this->element['name']];
     } elseif (empty($this->value)) {
         $this->value = (string) $this->element['default'];
     }
     if (is_string($this->value)) {
         $this->value = (substr($this->value, 0, 1) == '{' and substr($this->value, -1) == '}') ? json_decode($this->value, true) : array($this->value => 1);
     }
     // Parse field attributes
     $options['class'] = isset($this->element['class']) ? (string) $this->element['class'] : '';
     $options['disabled'] = '';
     if (isset($this->element['disabled']) and $this->element['disabled'] == 'true') {
         $options['class'] .= ' disabled';
         $options['disabled'] = ' disabled="disabled"';
     }
     // Get all checkbox options from xml
     $data = array();
     foreach ($this->element->children() as $option) {
         // Check if option is checked
         if (is_array($this->value)) {
             $checked = (array_key_exists((string) $option['value'], $this->value) and $this->value[(string) $option['value']]);
         } else {
             $checked = (isset($option['default']) and (string) $option['default'] == 'checked');
         }
         $data[] = array('value' => (string) $option['value'], 'text' => (string) $option, 'checked' => $checked ? ' checked="checked"' : '');
     }
     return JSNTplFormHelper::checkbox($this->name, $data, $options);
 }
Esempio n. 6
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);
    }