Пример #1
0
function items_list()
{
    global $layout;
    global $user;
    $navibars = new navibars();
    $navitable = new navitable("items_list");
    $navibars->title(t(22, 'Items'));
    $navibars->add_actions(array($user->permission("items.create") == 'false' ? '' : '<a href="?fid=' . $_REQUEST['fid'] . '&act=2"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> ' . t(38, 'Create') . '</a>', '<a href="?fid=' . $_REQUEST['fid'] . '&act=list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> ' . t(39, 'List') . '</a>', 'search_form'));
    if ($_REQUEST['quicksearch'] == 'true') {
        $navitable->setInitialURL("?fid=" . $_REQUEST['fid'] . '&act=json&_search=true&quicksearch=' . $_REQUEST['navigate-quicksearch']);
    }
    $navitable->setURL('?fid=' . $_REQUEST['fid'] . '&act=json');
    $navitable->sortBy('date_modified', 'DESC');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=' . $_REQUEST['fid'] . '&act=edit&id=');
    $navitable->enableSearch();
    if ($user->permission("items.delete") == 'true') {
        $navitable->enableDelete();
    }
    $navitable->setGridNotesObjectName("item");
    $navitable->addCol("ID", 'id', "40", "true", "left");
    $navitable->addCol(t(67, 'Title'), 'title', "320", "true", "left");
    $navitable->addCol(t(309, 'Social'), 'comments', "50", "true", "center");
    $navitable->addCol(t(78, 'Category'), 'category', "210", "true", "left");
    //$navitable->addCol(t(266, 'Author'), 'author_username', "80", "true", "left");
    $navitable->addCol(t(551, 'Date to display'), 'date_to_display', "60", "true", "center");
    $navitable->addCol(t(85, 'Date published'), 'dates', "100", "true", "center");
    $navitable->addCol(t(68, 'Status'), 'permission', "80", "true", "center");
    $navitable->addCol(t(168, 'Notes'), 'note', "50", "false", "center");
    $navitable->setLoadCallback('
        $("td[aria-describedby=\'items_list_category\']").truncate({
            "width": "auto",
            "token": "…",
            "side": "center",
            "addtitle": true
        });

        if($("#jqgh_items_list_category button").length < 1)
        {
            $("#jqgh_items_list_category").prepend("<button><i class=\\"fa fa-bars\\"></i></button>");
            $("#jqgh_items_list_category button")
            	.button()
            	.css(
            	{
                	"float": "right",
                	"margin-top": "0px",
                	"padding": "0px"
            	})
            	.on("click", items_list_choose_categories);

            $("#jqgh_items_list_category span.ui-button-text").css({"padding-top": "0", "padding-bottom": "0"});
        }
    ');
    // add categories filter
    $hierarchy = structure::hierarchy();
    $hierarchy = structure::hierarchyListClasses($hierarchy);
    $navibars->add_content('<div id="filter_categories_window" style="display: none;">' . $hierarchy . '</div>');
    $layout->add_script('$("#filter_categories_window ul").attr("data-name", "filter_categories_field");');
    $layout->add_script('
        $("#filter_categories_window ul").jAutochecklist({
            popup: false,
            absolutePosition: true,
            width: 0,
            listWidth: 400,
            listMaxHeight: 400,
            onItemClick: function(nval, li, selected_before, selected_after)
            {
                selected_after = selected_after.join(",");
                var filters = {
                    "groupOp" : "AND",
                    "rules": [
                        {
                            "field" : "category",
                            "op" : "in",
                            "data" : selected_after
                        },
                        {
                            "field" : "title",
                            "op" : "cn",
                            "data" : $("#navigate-quicksearch").val()
                        }
                    ]
                };

                $("#items_list").jqGrid(
                    "setGridParam",
                    {
                        search: true,
                        postData: { "filters": filters }
                    }
                ).trigger("reloadGrid");
            }
        });');
    $layout->add_script('
        function items_list_choose_categories()
        {
            $("#navigate-quicksearch").parent().on("submit", function(){
                $("#filter_categories_window ul").jAutochecklist("deselectAll");
            });

            $("#filter_categories_window ul").jAutochecklist("open");
            $(".jAutochecklist_list").css({"position": "absolute"});
            $(".jAutochecklist_list").css($("#jqgh_items_list_category button").offset());
            $(".jAutochecklist_dropdown_wrapper").hide();
            $(".jAutochecklist_list").css({
                "border-radius": "8px",
                "margin-left": "-373px",
                "margin-top": "16px"
            });
            $(".jAutochecklist_list").addClass("navi-ui-widget-shadow ui-menu ui-widget ui-widget-content ui-corner-all");

            return false;
        }
    ');
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}
Пример #2
0
function blocks_list()
{
    global $events;
    global $user;
    $navibars = new navibars();
    $navitable = new navitable("blocks_list");
    $navibars->title(t(23, 'Blocks'));
    // retrieve block groups, if more than 10, do not show quickmenu
    $group_blocks_links = array();
    list($bg_rs, $bg_total) = block_group::paginated_list(0, 10, 'title', 'desc');
    if ($bg_total > 0 && $bg_total <= 10) {
        foreach ($bg_rs as $bg) {
            $group_blocks_links[] = '<a class="ui-menu-action-bigger" href="?fid=' . $_REQUEST['fid'] . '&act=block_group_edit&id=' . $bg['id'] . '"><i class="fa fa-fw fa-caret-right"></i> ' . $bg['title'] . '</a>';
        }
        $events->add_actions('blocks', array('item' => null, 'navibars' => &$navibars), $group_blocks_links, '<a class="content-actions-submenu-trigger" href="?fid=' . $_REQUEST['fid'] . '&act=block_groups_list">
                <img height="16" align="absmiddle" width="16" src="img/icons/silk/bricks.png"> ' . t(506, 'Groups') . ' &#9662;
            </a>');
    }
    $navibars->add_actions(array(!empty($group_blocks_links) ? '' : '<a href="?fid=' . $_REQUEST['fid'] . '&act=block_groups_list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/bricks.png"> ' . t(506, 'Groups') . '</a>', '<a href="?fid=' . $_REQUEST['fid'] . '&act=block_types_list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/brick_edit.png"> ' . t(167, 'Types') . '</a>'));
    $navibars->add_actions(array('<a href="?fid=' . $_REQUEST['fid'] . '&act=2"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> ' . t(38, 'Create') . '</a>', '<a href="?fid=' . $_REQUEST['fid'] . '&act=0"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> ' . t(39, 'List') . '</a>', 'search_form'));
    if (@$_REQUEST['quicksearch'] == 'true') {
        $navitable->setInitialURL("?fid=" . $_REQUEST['fid'] . '&act=json&_search=true&quicksearch=' . $_REQUEST['navigate-quicksearch']);
    }
    $navitable->setURL('?fid=' . $_REQUEST['fid'] . '&act=json');
    $navitable->sortBy('date_modified', 'desc');
    $navitable->setDataIndex('id');
    $navitable->setEditUrl('id', '?fid=' . $_REQUEST['fid'] . '&act=2&id=');
    $navitable->enableSearch();
    if ($user->permission("blocks.delete") == 'true') {
        $navitable->enableDelete();
    }
    $navitable->setGridNotesObjectName("block");
    $navitable->addCol("ID", 'id', "40", "true", "left");
    $navitable->addCol(t(160, 'Type'), 'type', "120", "true", "center");
    $navitable->addCol(t(67, 'Title'), 'title', "400", "true", "left");
    $navitable->addCol(t(85, 'Date published'), 'dates', "100", "true", "center");
    $navitable->addCol(t(364, 'Access'), 'access', "40", "true", "center");
    $navitable->addCol(t(65, 'Enabled'), 'enabled', "40", "true", "center");
    $navitable->addCol(t(168, 'Notes'), 'note', "50", "false", "center");
    $navibars->add_content($navitable->generate());
    return $navibars->generate();
}