コード例 #1
0
ファイル: ControllerBase.php プロジェクト: netshine/scaffold
 public function __construct(ICms $cms, Request $request, ViewBase $view = null, FormBase $form = null, ServiceBase $service = null)
 {
     $this->cms = $cms;
     $this->request = $request;
     $this->view = $view;
     $this->form = $form;
     $this->service = $service;
     $this->user_id = $cms->getCurrentUserId();
     if ($this->form && !$this->form->record_id) {
         $record_id = $this->request->getRequestParam('id');
         $this->form->record_id = $record_id == 'new' ? $record_id : intval($record_id);
     }
     $_REQUEST['page'] = $request->getRequestParam('page', $request->getRequestParam('filter_pagination_page'));
     $records_per_page = intval($request->getRequestParam('records_per_page', $request->getRequestParam('filter_pagination_records', 0)));
     if ($records_per_page) {
         $_REQUEST['records_per_page'] = $records_per_page;
     }
     $_REQUEST['sort_by'] = $request->getRequestParam('sort_by', $request->getRequestParam('filter_sort_by'));
     $_REQUEST['sort_reverse'] = $request->getRequestParam('sort_reverse', $request->getRequestParam('filter_sort_reverse'));
     $this->filters = $this->request->getRequestFilters();
     if ($this->view) {
         $this->view->filters = $this->filters;
     }
     $this->preserveFilters();
     $this->initialise();
 }
コード例 #2
0
ファイル: FieldRenderer.php プロジェクト: netshine/scaffold
    protected function loadJsFiles()
    {
        if (!self::$js_loaded) {
            $this->cms->addJavascript($this->language->routing['bare_entry_url'] . '&resource=js&id=modernizr/modernizr.custom.js');
            $this->cms->addJavascript($this->language->routing['bare_entry_url'] . '&resource=js&id=webshim/polyfiller.js');
            //$this->cms->addJavascript('//cdn.jsdelivr.net/webshim/1.14.5/polyfiller.js');
            ?>
            <script type="text/javascript">
                webshim.setOptions('basePath', '<?php 
            echo $this->language->routing['bare_entry_url'] . '&resource=js&id=webshim/shims/';
            ?>
')
                webshim.activeLang('<?php 
            echo $this->language->getCurrentLanguage();
            ?>
');
                //Configure forms features
                webshim.setOptions("forms", {
                    lazyCustomMessages: true,
                    replaceValidationUI: true,
                    customDatalist: "auto",
                    list: {
                        "filter": "^"
                    }
                });

                //Configure forms-ext features
                webshim.setOptions("forms-ext", {
                    replaceUI: "auto",
                    types: "date range number",
                    date: {
                        startView: 2,
                        openOnFocus: true,
                        classes: "show-week",
                        dateSigns: '-',
                        dateFormat: 'yy-mm-dd'
                    },
                    number: {
                        calculateWidth: false
                    },
                    range: {
                        classes: "show-activevaluetooltip"
                    },
                    datepicker: {
                        dateFormat: 'yy-mm-dd'
                    }
                });

                //Load forms and forms-ext features
                webshim.polyfill('forms forms-ext');
            </script>
            <?php 
            self::$js_loaded = true;
        }
    }
コード例 #3
0
ファイル: FormBase.php プロジェクト: netshine/scaffold
 function __construct(FieldFactory $factory, ICms $cms, Language $language, $form_resource, $form_method, $name = '', $id = '')
 {
     $this->factory = $factory;
     $this->cms = $cms;
     $this->language = $language;
     $this->form_resource = $form_resource;
     $this->form_method = $form_method;
     $this->name = $name ? $name : $form_resource;
     $this->id = $id ? $id : $this->name;
     $submission_id = htmlentities(@$_REQUEST['submission_id']);
     $this->submission_id = strlen($submission_id) == 13 ? $submission_id : uniqid();
     $js = htmlentities($language->routing['bare_entry_url'] . '&resource=js&id=form');
     $this->cms->addJavascript($js);
 }
コード例 #4
0
ファイル: Pagination.php プロジェクト: netshine/scaffold
    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);
    }
コード例 #5
0
ファイル: ViewBase.php プロジェクト: netshine/scaffold
    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;
        }
    }
コード例 #6
0
ファイル: TabGroup.php プロジェクト: netshine/scaffold
    /**
     * 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 
    }