Пример #1
0
    foreach ($group_cats as $index => $category) {
        $categoryId = $category['id'];
        $group_list = GroupManager::get_group_list($categoryId);
        $groupToShow = GroupManager::process_groups($group_list, $categoryId);
        if (empty($groupToShow)) {
            continue;
        }
        $label = Display::label(count($group_list) . ' ' . get_lang('ExistingGroups'), 'info');
        $actions = null;
        if (api_is_allowed_to_edit(false, true) && !empty($categoryId)) {
            $actions .= '<a href="group_category.php?' . api_get_cidreq() . '&id=' . $categoryId . '" title="' . get_lang('Edit') . '">' . Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL) . '</a>';
            $actions .= Display::url(Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL), 'group.php?' . api_get_cidreq() . '&action=delete_category&id=' . $categoryId, array('onclick' => 'javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;'));
            if ($index != 0) {
                $actions .= ' <a href="group.php?' . api_get_cidreq() . '&action=swap_cat_order&id1=' . $categoryId . '&id2=' . $group_cats[$index - 1]['id'] . '">' . Display::return_icon('up.png', '&nbsp;', '', ICON_SIZE_SMALL) . '</a>';
            }
            if ($index != count($group_cats) - 1) {
                $actions .= ' <a href="group.php?' . api_get_cidreq() . '&action=swap_cat_order&id1=' . $categoryId . '&id2=' . $group_cats[$index + 1]['id'] . '">' . Display::return_icon('down.png', '&nbsp;', '', ICON_SIZE_SMALL) . '</a>';
            }
        }
        echo Display::page_header(Security::remove_XSS($category['title'] . ' ' . $label . ' ') . $actions, null, 'h4', false);
        echo $category['description'];
        echo $groupToShow;
    }
} else {
    $group_list = GroupManager::get_group_list();
    echo GroupManager::process_groups($group_list);
}
if (!isset($_GET['origin']) || $_GET['origin'] != 'learnpath') {
    Display::display_footer();
}
Session::write('_gid', 0);