indexSuccess.php 5.81 KB
Newer Older
Яков's avatar
first  
Яков committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php use_helper('I18N', 'Date') ?>
<?php if (!$sf_request->isXmlHttpRequest()): ?>
<?php include_partial('callback/assets') ?>

<span class="lui__h1"><?php echo __('Обратный звонок', array(), 'messages') ?></span><sup
    class="lui__list_count">&nbsp;<?php echo ($sf_request->getParameter('q') ? 'найдено:&nbsp;' : '');?><?php echo isset($pager) ? $pager->getNbResults() : ''; ?>&nbsp;</sup>

<?php include_partial('callback/flashes') ?>

    <div class="sf_admin_tabs">
        <?php
        foreach($tabs as $tab_key => $tab_val)
        {
        echo '<a href="' . (isset($tab_val['url_for']) ? url_for($tab_val['url_for']) : '?tab=' . $tab_key) . '" class="sf_admin_tab' . ($tab_key == $current_tab ? ' sf_admin_tab__active' : '') . '">' . $tab_val['label'] . '</a>';
        }
        ?>
    </div>
<span class="br15"></span>
<div class="batch_form__class">
    <?php endif; ?>

    <?php if (isset($pager)): ?>

    <div class="lui__list_actions__wrapper" data-count="<?php echo $pager->getNbResults();?>">
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <?php include_partial('callback/list_actions', array('helper' => $helper)) ?>
                <?php include_partial('callback/list_batch_actions', array('helper' => $helper)) ?>
                                    <td style="padding-right: 10px"><input style="background-color:#fff;width:360px;" type="text" autocomplete="off" value="<?php echo $sf_request->getParameter('q'); ?>"
                            class="type_search input_with_erase" id="callback_live_search" placeholder="Найти"/>
                    </td>
                                                                <?php if ($pager->haveToPaginate()): ?>
                <td align="right" width="100%">
                    <div class="lui_pager">
                        <?php include_partial('callback/pagination', array('pager' => $pager)) ?>&nbsp;
                        <b style="position:relative;top:2px"><?php echo __('%%page%%/%%nb_pages%%', array('%%page%%' => $pager->getPage(), '%%nb_pages%%' => $pager->getLastPage()), 'sf_admin') ?></b>
                    </div>
                </td>
                <?php endif; ?>
            </tr>
        </table>


    </div>


    <form id="batch_form" action="<?php echo url_for('callback_collection', array('action' => 'batch')) ?>" method="post">


        <div id="lui_scroller" class="lui_scroller">
            <div class="lui__scroller_wrapper"><?php include_partial('callback/list', array('pager' => $pager, 'sort' => $sort, 'helper' => $helper, 'tab' => $tab)) ?></div>
        </div>


        <input type="hidden" name="batch_action" id="batch_action_id"/>
        <?php $form = new BaseForm(); if ($form->isCSRFProtected()): ?>
        <input type="hidden" name="<?php echo $form->getCSRFFieldName() ?>" value="<?php echo $form->getCSRFToken() ?>"/>
        <?php endif; ?>

    </form>

    <?php endif; ?>

    <?php if (!$sf_request->isXmlHttpRequest()): ?>
</div>



    <?php if (isset($pager)): ?>
    <script type="text/javascript">
        var jqxhr = false;
        var jqxhr_o = false;
        var jqxhr_old = $('#callback_live_search').val().trim();
        var jqxhr_last_result = $('#callback_live_search').val().trim();

        var is_not_good_style_of_code = function (url) {

            var state = {
                title: $('title').html(),
                url: window.location.pathname + url
            }


            history.pushState(state, state.title, state.url);

            jqxhr_o = sOverlay($('.lui_scroller'));
            jqxhr = $.ajax(url).done(function (html) {

                var new_html = $(html);


                $('.lui_pager').html(new_html.find('.lui_pager').length > 0 ? new_html.find('.lui_pager').html() : '');
                $('.lui__scroller_wrapper').html(new_html.find('.lui__scroller_wrapper').html());

                create_custom_table_head();
                $('.lui__list_count').html('&nbsp;' + (jqxhr_old == '' ? '' : 'найдено:&nbsp;') + new_html.data('count'));
                $('.lui__list_table__sourse').removeHighlight().highlight(jqxhr_old);
                $('.export_excel').prop('href', url + '&export');
                if (new_html.data('count') == '0') {
                    $('.export_excel').hide();
                } else {
                    $('.export_excel').show();
                }

                jqxhr_last_result = $('#callback_live_search').val().trim();

                jqxhr_o.remove();
            });
        }

        $(document).ready(function () {
            $('#callback_live_search').keyup(function (event) {

                if (jqxhr_last_result == $(this).val().trim()) {
                    return;
                }

                var checked = [];
                $('.sf_admin_batch_checkbox:checked').each(function (k, v) {
                    checked.push($(v).val());
                });
                jqxhr_old = $(this).val().trim();
                try {
                    jqxhr.abort();
                    jqxhr_o.remove();
                } catch (e) {
                }

                if ($(this).val().trim() != '' && event.which == 13) {
                    is_not_good_style_of_code('?q=' + jqxhr_old + (checked.length > 0 ? '&checked=' + checked.join(':') : ''));
                } else if ($(this).val().trim() == '') {
                    is_not_good_style_of_code(checked.length > 0 ? '?checked=' + checked.join(':') : '');
                }


            });
            if (jqxhr_old != '') {
                cl(jqxhr_old);
                $('.lui__list_table__sourse').removeHighlight().highlight(jqxhr_old);
            }
        });
    </script>
    <?php endif; ?>
<?php endif; ?>
<?php if (isset($replace_content) && $replace_content !== false): ?>
    <?php echo htmlspecialchars_decode($replace_content); ?>
<?php endif; ?>