Exemplo n.º 1
0
 /**
  *
  * @author Patrick Kohl
  * @param array $options( value & text)
  * @param string $name option name
  * @param string $defaut defaut value
  * @param string $key option value
  * @param string $text option text
  * @param boolean $zero add  a '0' value in the option
  * return a select list
  */
 public static function select($name, $options, $default = '0', $attrib = "onchange='submit();'", $key = 'value', $text = 'text', $zero = true, $chosenDropDowns = true, $tranlsate = true)
 {
     if ($zero == true) {
         $option = array($key => "0", $text => vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'));
         $options = array_merge(array($option), $options);
     }
     if ($chosenDropDowns) {
         vmJsApi::chosenDropDowns();
         $attrib .= ' class="vm-chzn-select"';
     }
     return VmHtml::genericlist($options, $name, $attrib, $key, $text, $default, false, $tranlsate);
 }
Exemplo n.º 2
0
    public static function list_option($name, $options, $list_selected = array(), $attrib = "onchange='submit();'", $key = 'value', $text = 'text', $zero = true, $tranlsate = true)
    {
        $doc = JFactory::getDocument();
        $doc->addScript(JUri::root() . '/media/system/js/jQuery-Plugin-For-Bootstrap-Button-Group-Toggles/select-toggleizer.js');
        ob_start();
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function ($) {
                $('select[name="<?php 
        echo $name;
        ?>
"]').toggleize({});
            });
        </script>
        <?php 
        $js_content = ob_get_clean();
        $js_content = TSMUtility::remove_string_javascript($js_content);
        $doc->addScriptDeclaration($js_content);
        $attrib .= ' disable_chosen="true" ';
        $html = VmHtml::genericlist($options, $name, $attrib, $key, $text, $list_selected, false, $tranlsate);
        return $html;
    }