Пример #1
0
 /**
  * Simple Input text
  * @param type $element
  * @return string
  */
 public static function render($element)
 {
     $element = parent::getExtraInfo($element);
     $label = parent::getLabel($element);
     $type = !empty($element['type_input']) ? $element['type_input'] : 'text';
     $output = "<input type='{$type}' class='{$element['class']}' value=\"" . $element['std'] . "\" id='{$element['id']}' name='{$element['id']}' DATA_INFO />";
     return parent::finalElement($element, $output, $label);
 }
    /**
     * Simple Input text
     * @param type $element
     * @return string
     */
    public static function render($element)
    {
        $element = parent::getExtraInfo($element);
        $label = parent::getLabel($element);
        $type = !empty($element['type_input']) ? $element['type_input'] : 'module';
        $output = "<div id='jsn-tpl-mm-element-module-list-container'>";
        $output .= '<input type="text" value="" disabled="disabled" id="jsn-tpl-mm-element-module-position"/>
						<div class="jsn-tpl-mm-element-module-position-wrapper jsn-megamenu-loading" id="jsn-tpl-mm-element-module-position-wrapper"> 	
							<iframe width="100%" height="500px" src="index.php?widget=megamenu&action=get-module-position&shortcode=jsn_tpl_mm_moduleposition&rformat=raw&template=' . JFactory::getApplication()->input->getString('template', '') . '" id="jsn-tpl-mm-element-module-position-iframe-content" class="hidden"></iframe>						
						</div>';
        $output .= '</div>';
        $output .= "<input type='{$type}' class='{$element['class']}' value='{$element['std']}' id='{$element['id']}' name='{$element['id']}' DATA_INFO />";
        return parent::finalElement($element, $output, $label);
    }
Пример #3
0
 /**
  * Checkbox option
  * @param type $element
  * @return type
  */
 static function render($element)
 {
     $element = parent::getExtraInfo($element);
     $label = parent::getLabel($element);
     $type = isset($element['type_input']) ? $element['type_input'] : 'checkbox';
     $element['std'] = explode('__#__', $element['std']);
     $output = $add_class = $linebreak = '';
     $_class = isset($element['class']) ? $element['class'] : 'checkbox-inline';
     $_class = str_replace('form-control', '', $_class);
     $_jsn_tpl_mm_has_depend = !empty($element['has_depend']) && $element['has_depend'] == '1' ? ' jsn_tpl_mm_has_depend' : '';
     foreach ($element['options'] as $key => $text) {
         $checked = in_array($key, $element['std']) || $element['std'][0] == 'all' ? 'checked' : '';
         $action_item = '';
         if (isset($element['popover_items']) && is_array($element['popover_items'])) {
             $action_item = in_array($key, $element['popover_items']) ? "data-popover-item='yes'" : '';
         }
         if (isset($element['label_type'])) {
             if ($element['label_type'] == 'image') {
                 // hide radio button
                 $add_class = ' hidden';
                 $option_html = '';
                 $dimension = $element['dimension'];
                 $widthHeight = "width:{$dimension[0]}px;height:{$dimension[1]}px;";
                 if (!is_array($text)) {
                     $option_html .= "<span style='{$widthHeight}' class='radio_image'></span>";
                 } else {
                     $linebreak = isset($text['linebreak']) ? '<br>' : '';
                     $background = isset($text['img']) ? "background-image:url( {$text['img']} )" : '';
                     $option_html .= "<span style='{$widthHeight} {$background}' title='{$text[0]}' class='radio_image'></span>";
                 }
                 $text = $option_html;
             }
         }
         $str = "<label class='" . $_class . "'><input class='{$_jsn_tpl_mm_has_depend}{$add_class}' type='" . $type . "' value='{$key}' id='{$element['id']}' name='{$element['id']}' {$checked} DATA_INFO {$action_item}/>{$text}</label>{$linebreak}";
         if (isset($element['wrapper_item_start'])) {
             $str = $element['wrapper_item_start'] . $str;
         }
         if (isset($element['wrapper_item_end'])) {
             $str = $str . $element['wrapper_item_end'];
         }
         $output .= $str;
     }
     if ($type == 'checkbox') {
         $output .= "<input type='hidden' value=' ' id='{$element['id']}' name='{$element['id']}' />";
     }
     return parent::finalElement($element, $output, $label);
 }
Пример #4
0
    /**
     * Simple Input text
     * @param type $element
     * @return string
     */
    public static function render($element)
    {
        $moduleInfo = self::getModuleInfoByID($element['std']);
        $element = parent::getExtraInfo($element);
        $label = parent::getLabel($element);
        $type = !empty($element['type_input']) ? $element['type_input'] : 'module';
        $output = "<div id='jsn-tpl-mm-element-module-list-container' data-start='0' data-module-total='0'>";
        $output .= '<input type="text" value="' . (string) @$moduleInfo->title . '" disabled="disabled" id="jsn-tpl-mm-element-module-name"/>
					<div class="jsn-tpl-mm-element-module-load-more">
						<div id="jsn-tpl-mm-element-module-btn-group-container">
							<button type="button" class="btn btn-default jsn-tpl-mm-element-module-btn-reset" id="jsn-tpl-mm-element-module-btn-reset">Reset</button>
							<input type="text" value="" class="input-sm pull-right" placeholder="Search..." id="jsn-tpl-mm-element-module-input-search" />
						</div>
						<div id="jsn-tpl-mm-element-module-content"></div>
						<a href="javascript:void(0);" class="jsn-add-more" id="jsn-tpl-mm-element-module-load-more-btn">' . JText::_('JSN_TPLFW_MEGAMENU_LOAD_MORE', true) . ' <i id="jsn-tpl-mm-element-module-icon-loading" class="jsn-icon16 jsn-icon-loading hidden"></i></a>						
					</div>';
        $output .= '</div>';
        $output .= "<input type='{$type}' class='{$element['class']}' value='{$element['std']}' id='{$element['id']}' name='{$element['id']}' DATA_INFO />";
        return parent::finalElement($element, $output, $label);
    }
Пример #5
0
 /**
  * get HTML of Modal Settings Box of Shortcode
  * @param array $options
  * @return string
  */
 public static function getShortcodeModalSettings($settings, $shortcode = '', $input_params = null, $raw_shortcode = null)
 {
     $i = 0;
     $tabs = $contents = $actions = $general_actions = array();
     if ($shortcode != '') {
         $shortcodeName = strtolower(JSNTplMMHelperShortcode::shortcodeName($shortcode));
         if ($shortcodeName != '') {
             JSNTplMMLoader::register(JSN_PATH_TPLFRAMEWORK_MEGAMENU_LIBRARIES . '/shortcodes/elements/' . $shortcodeName . '/html', 'JSNTplHelperHtml');
         }
     }
     foreach ($settings as $tab => $options) {
         $options = self::ignoreSettings($options);
         if ($tab == 'action') {
             foreach ($options as $option) {
                 $actions[] = JSNTplMMHelperShortcode::renderParameter($option['type'], $option);
             }
         } else {
             if ($tab == 'generalaction') {
                 foreach ($options as $option) {
                     $option['id'] = isset($option['id']) ? 'param-' . $option['id'] : '';
                     $general_actions[] = JSNTplMMHelperShortcode::renderParameter($option['type'], $option);
                 }
             } else {
                 $active = $i++ == 0 ? 'active' : '';
                 if (strtolower($tab) != 'notab') {
                     $data_ = isset($settings[$tab]['settings']) ? $settings[$tab]['settings'] : array();
                     $data_['href'] = "#{$tab}";
                     $data_['data-toggle'] = 'tab';
                     $content_ = ucfirst($tab);
                     $tabs[] = "<li class='{$active}'>" . self::tabSettings('a', $data_, $content_) . '</li>';
                 }
                 $has_margin = 0;
                 $param_html = array();
                 foreach ($options as $idx => $option) {
                     // check if this element has Margin param (1)
                     if (isset($option['name']) && $option['name'] == 'Margin' && $option['id'] != 'div_margin') {
                         $has_margin = 1;
                     }
                     // if (1), don't use the 'auto extended margin ( top, bottom ) option'
                     if ($has_margin && isset($option['id']) && $option['id'] == 'div_margin') {
                         continue;
                     }
                     $type = $option['type'];
                     $option['id'] = isset($option['id']) ? 'param-' . $option['id'] : "{$idx}";
                     if (!is_array($type)) {
                         $param_html[$option['id']] = JSNTplMMHelperShortcode::renderParameter($type, $option, $input_params);
                     } else {
                         $output_inner = '';
                         foreach ($type as $sub_options) {
                             $sub_options['id'] = isset($sub_options['id']) ? 'param-' . $sub_options['id'] : '';
                             /* for sub option, auto assign bound = 0 {not wrapped by <div class='controls'></div> } */
                             $sub_options['bound'] = '0';
                             /* for sub option, auto assign 'input-small' class */
                             $sub_options['class'] = isset($sub_options['class']) ? $sub_options['class'] : '';
                             $type = $sub_options['type'];
                             $output_inner .= JSNTplMMHelperShortcode::renderParameter($type, $sub_options);
                         }
                         $option = JSNTplMMHelperHtml::getExtraInfo($option);
                         $label = JSNTplMMHelperHtml::getLabel($option);
                         $param_html[$option['id']] = JSNTplMMHelperHtml::finalElement($option, $output_inner, $label);
                     }
                 }
                 if (!empty($param_html['param-copy_style_from'])) {
                     array_pop($param_html);
                     // move "auto extended margin ( top, bottom ) option" to top of output
                     $style_copy = array_shift($param_html);
                     // Shift Preview frame from the array
                     $preview = array_shift($param_html);
                     if (!empty($param_html['param-div_margin'])) {
                         $margin = $param_html['param-div_margin'];
                         $param_html = array_merge(array($preview, $style_copy, $margin), $param_html);
                     } else {
                         $param_html = array_merge(array($preview, $style_copy), $param_html);
                     }
                 }
                 $param_html = implode('', $param_html);
                 $content_tab = "<div class='tab-pane {$active} jsn-mm-setting-tab' id='{$tab}'>{$param_html}</div>";
                 $contents[] = $content_tab;
             }
         }
     }
     return self::settingTabHtml($shortcode, $tabs, $contents, $general_actions, $settings, $actions);
 }