Ejemplo n.º 1
0
            $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AddForumCategory'));
            break;
        default:
            break;
    }
} else {
    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ForumCategories'));
}
Display::display_header('');
// Tool introduction
Display::display_introduction_section(TOOL_FORUM);
$form_count = 0;
if (api_is_allowed_to_edit(false, true)) {
    //if is called from a learning path lp_id
    $lp_id = isset($_REQUEST['lp_id']) ? intval($_REQUEST['lp_id']) : null;
    handle_forum_and_forumcategories($lp_id);
}
// Notification
if ($actions == 'notify' && isset($_GET['content']) && isset($_GET['id'])) {
    if (api_get_session_id() != 0 && api_is_allowed_to_session_edit(false, true) == false) {
        api_not_allowed();
    }
    $return_message = set_notification($_GET['content'], $_GET['id']);
    Display::display_confirmation_message($return_message, false);
}
get_whats_new();
$whatsnew_post_info = Session::read('whatsnew_post_info');
/* TRACKING */
Event::event_access_tool(TOOL_FORUM);
/*
    RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS
// then the user is not allowed here.
if (!api_is_allowed_to_edit(false, true) and $current_forum_category && $current_forum_category['visibility'] == 0) {
    api_not_allowed();
}
/* Action Links */
echo '<div class="actions">';
echo '<span style="float:right;">' . search_link() . '</span>';
echo '<a href="index.php?gradebook=' . $gradebook . '">' . Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM) . '</a>';
if (api_is_allowed_to_edit(false, true)) {
    echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' . $current_forum_category['cat_id'] . '&amp;action=add&amp;content=forum"> ' . Display::return_icon('new_forum.png', get_lang('AddForum'), '', ICON_SIZE_MEDIUM) . '</a>';
}
echo '</div>';
/* ACTIONS */
$action_forums = isset($_GET['action']) ? $_GET['action'] : '';
if (api_is_allowed_to_edit(false, true)) {
    handle_forum_and_forumcategories();
}
// Notification
if ($action_forums == 'notify' && isset($_GET['content']) && isset($_GET['id'])) {
    $return_message = set_notification($_GET['content'], $_GET['id']);
    Display::display_confirmation_message($return_message, false);
}
if ($action_forums != 'add') {
    /*
    RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS
    Note: We do this here just after het handling of the actions to be sure that we already incorporate the
    latest changes.
    */
    // Step 1: We store all the forum categories in an array $forum_categories.
    $forum_categories = array();
    $forum_category = get_forum_categories($_GET['forumcategory']);