Example #1
0
    protected function loadSortButtonJs(Url $url)
    {
        if (!$this->sort_button_js_loaded) {
            ob_start();
            ?>
            <script type="text/javascript">
            function sort_submit(column, reverse)
            {
                var form = document.getElementById('<?php 
            echo $this->form->id;
            ?>
');
                if (!form) {
                    form = document.getElementsByTagName('form')[0];
                }
                if (form) {
                    form.action = '<?php 
            echo $url;
            ?>
&sort_by=' + column + (reverse ? '&sort_reverse=1' : '');
                    form.submit();
                }
            }
            </script>
            <?php 
            $js = ob_get_clean();
            $this->cms->addHeadContent($js);
            $this->sort_button_js_loaded = true;
        }
    }
Example #2
0
    protected function createSubmitJs($form_id)
    {
        if ($form_id) {
            $form_elem = 'document.getElementById(\'' . $form_id . '\')';
        } else {
            $form_elem = 'document.getElementsByTagName(\'form\')[0]';
        }
        ob_start();
        ?>
        <script type="text/javascript">
        function pagination_submit(page_no)
        {
            <?php 
        echo $form_elem;
        ?>
.action='<?php 
        echo $this->url;
        ?>
&page=' + page_no;
            <?php 
        echo $form_elem;
        ?>
.submit();
        }
        </script>
        <?php 
        $js = ob_get_clean();
        $this->cms->addHeadContent($js);
    }
Example #3
0
    /**
     * Begin the output of a tabbed dialog
     * @param string $group_id Unique ID for this set of tabs (in case more than one group are on a page)
     * @param boolean Whether or not to collapse the tabs for narrow displays (less than 500px wide, but that could be changed by altering the tab_group.css stylesheet)
     */
    public function startTabGroup($group_id, $responsive = false)
    {
        $this->group_id = $group_id;
        ob_start();
        ?>
        <script type="text/javascript">

        function selectTab_<?php 
        echo $group_id;
        ?>
(tab_id, force_select)
        {
            if (!document.getElementById(tab_id)) {
                //If selected using shortened form, pad it out to the full ID
                tab_id = 'tab-title-<?php 
        echo $group_id;
        ?>
-' + tab_id;
                if (!document.getElementById(tab_id)) {
                    return false;
                }
            }
            if (force_select || !window.disable_tabs) {
                if (tab_id && tab_id.length > 0)
                {
                    var page_id = tab_id.split('-').pop();

                    var divs = document.getElementsByTagName('div');
                    for(var i=0; i<divs.length; i++)
                    {
                        if (divs[i].id.indexOf('tab-title-<?php 
        echo $group_id;
        ?>
') > -1 && divs[i].id != tab_id)
                        {
                            this_tab_id = divs[i].id.split('-').pop();
                            divs[i].className = divs[i].className.replace(' selected', '');
                            if (document.getElementById('tab-content-<?php 
        echo $group_id;
        ?>
-' + this_tab_id)) {
                                document.getElementById('tab-content-<?php 
        echo $group_id;
        ?>
-' + this_tab_id).style.display = 'none';
                            }
                        }
                    }
                    if (document.getElementById('tab-content-<?php 
        echo $group_id;
        ?>
-' + page_id)) {
                        document.getElementById('tab-content-<?php 
        echo $group_id;
        ?>
-' + page_id).style.display = '';
                    }
                    if (document.getElementById(tab_id).className.indexOf(' selected') == -1) {
                        document.getElementById(tab_id).className += ' selected';
                    }
                    document.getElementById('selected_tab_<?php 
        echo $group_id;
        ?>
').value = tab_id;
                }

                if (window.onresize)
                {
                    setTimeout(function(){window.onresize();}, 200); //In case the change in content affects dynamically positioned elements (eg. footer)
                }
            }
        }

        </script>
        <?php 
        $js_function = ob_get_clean();
        $this->cms->addHeadContent($js_function);
        ?>
        <div id="tab-group-<?php 
        echo $group_id;
        ?>
" class="tab-group<?php 
        if ($responsive) {
            echo ' responsive-tabs';
        }
        ?>
">
        <?php 
    }