示例#1
0
    public function renderContinueForm($btn = null, $context = null)
    {
        if (empty($btn)) {
            $btn = ___("Yes, continue");
        }
        $vars = $this->grid->getCompleteRequest()->toArray();
        $vars[$this->grid->getId() . '_confirm'] = 'yes';
        if ($context !== null) {
            $vars[$this->grid->getId() . '_group_context'] = $context;
        }
        $hidden = Am_Controller::renderArrayAsInputHiddens($vars);
        $btn = $this->grid->escape($btn);
        $url_yes = $this->grid->makeUrl(null);
        return <<<CUT
<form method="post" action="{$url_yes}" style="display: inline;">
    {$hidden}
    <input type="submit" value="{$btn}" id='group-action-continue' />
</form>
CUT;
    }
示例#2
0
    public function renderConfirmationForm($btn = null, $page = null, $addHtml = null)
    {
        if (empty($btn)) {
            $btn = ___("Yes, continue");
        }
        $vars = $this->grid->getCompleteRequest()->toArray();
        $vars[$this->grid->getId() . '_confirm'] = 'yes';
        if ($page !== null) {
            $vars[$this->grid->getId() . '_group_page'] = (int) $page;
        }
        $hidden = Am_Controller::renderArrayAsInputHiddens($vars);
        $btn = $this->grid->escape($btn);
        $url_yes = $this->grid->makeUrl(null);
        return <<<CUT
<form method="post" action="{$url_yes}" style="margin: 10px; display: inline;">
    {$hidden}
    {$addHtml}
    <input type="submit" value="{$btn}" />
</form>
CUT;
    }
示例#3
0
文件: Abstract.php 项目: grlf/eyedock
    public function renderContent(&$out, Am_Grid_Editable $grid)
    {
        $url = json_encode($grid->makeUrl());
        $grid_id = $this->grid->getId();
        $msg = ___("Drag&Drop rows to change display order. You may want to temporary change setting '%sRecords per Page (for grids)%s' to some big value so all records were on one page and you can arrange all items.", '<a class="link" href="' . REL_ROOT_URL . '/admin-setup" target="_top">', '</a>');
        $out .= <<<CUT
<div class="am-grid-drag-sort-message"><i>{$msg}</i></div>
<script type="text/javascript">
jQuery(function(\$){
    \$(".grid-wrap").ngrid("onLoad", function(){
        if (\$(this).find("th .sorted-asc, th .sorted-desc").length)
        {
            \$('.am-grid-drag-sort-message').remove();
            \$(this).sortable( "destroy" );
            return;
        }

        //prepend mousedown event to td.record-sort
        //the handlers of ancestors are called before
        //the event reaches the element
        var grid = \$(this);
        \$(this).mousedown(function(event) {
            if (\$(event.target).hasClass('record-sort')) {
                var offset = 0;
                grid.find('.expandable-data-row').each(function(){
                    offset += \$(this).offset().top > event.pageY ?
                                0 :
                                \$(this).outerHeight();
                })
                grid.find('.expanded').click();
                event.pageY -= offset;
            }
        });

        \$(this).sortable({
            items: "tbody > tr.grid-row",
            handle: "td.record-sort",
            update: function(event, ui) {
                var item = \$(ui.item);
                var url = {$url};
                var params = item.data('params');
                \$.each(item.closest('table').find('tr.grid-row'), function(index, el) {
                    \$(el).removeClass('odd');
                    ((index+1) % 2) || \$(el).addClass('odd');
                })

                params.{$grid_id}_move_item = {};
                \$.each(item.data('sort-record'), function(index, value) {
                    params.{$grid_id}_move_item[index] = value;
                })

                if(item.prev().data('sort-record')) {
                    params.{$grid_id}_move_after = {};
                    \$.each(item.prev().data('sort-record'), function(index, value) {
                        params.{$grid_id}_move_after[index] = value;
                    })
                }

                if (item.next().data('sort-record')) {
                    params.{$grid_id}_move_before = {};
                    \$.each(item.next().data('sort-record'), function(index, value) {
                        params.{$grid_id}_move_before[index] = value;
                    })
                }

                \$.post(url, params, function(response){});
            },
        });
    });
});
</script>
CUT;
    }