|
|
|
@ -151,7 +151,6 @@ $user_id = api_get_user_id(); |
|
|
|
/* RETRIEVING ALL GROUPS AND THOSE OF THE USER */ |
|
|
|
/* RETRIEVING ALL GROUPS AND THOSE OF THE USER */ |
|
|
|
|
|
|
|
|
|
|
|
// The groups of the user. |
|
|
|
// The groups of the user. |
|
|
|
$groups_of_user = []; |
|
|
|
|
|
|
|
$groups_of_user = GroupManager::get_group_ids($_course['real_id'], $user_id); |
|
|
|
$groups_of_user = GroupManager::get_group_ids($_course['real_id'], $user_id); |
|
|
|
|
|
|
|
|
|
|
|
// All groups in the course (and sorting them as the |
|
|
|
// All groups in the course (and sorting them as the |
|
|
|
@ -240,29 +239,25 @@ if (is_array($forumCategories)) { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$forumCategoryInfo['title'] = $forumCategory['cat_title']; |
|
|
|
$forumCategoryInfo['title'] = $forumCategory['cat_title']; |
|
|
|
} |
|
|
|
} |
|
|
|
$forumCategoryInfo['icon_session'] = api_get_session_image( |
|
|
|
$forumCategoryInfo['icon_session'] = api_get_session_image($forumCategory['session_id'], $_user['status']); |
|
|
|
$forumCategory['session_id'], |
|
|
|
|
|
|
|
$_user['status'] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Validation when belongs to a session |
|
|
|
// Validation when belongs to a session |
|
|
|
$forumCategoryInfo['description'] = $forumCategory['cat_comment']; |
|
|
|
$forumCategoryInfo['description'] = $forumCategory['cat_comment']; |
|
|
|
|
|
|
|
$forumCategory['session_display'] = null; |
|
|
|
if (empty($sessionId) && !empty($forumCategory['session_name'])) { |
|
|
|
if (empty($sessionId) && !empty($forumCategory['session_name'])) { |
|
|
|
$forumCategory['session_display'] = ' ('.Security::remove_XSS($forumCategory['session_name']).')'; |
|
|
|
$forumCategory['session_display'] = ' ('.Security::remove_XSS($forumCategory['session_name']).')'; |
|
|
|
} else { |
|
|
|
|
|
|
|
$forumCategory['session_display'] = null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$tools = null; |
|
|
|
$tools = null; |
|
|
|
$idCategory = $forumCategory['cat_id']; |
|
|
|
$idCategory = (int) $forumCategory['cat_id']; |
|
|
|
$forumCategoryInfo['url'] = 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.intval($idCategory); |
|
|
|
$forumCategoryInfo['url'] = 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.$idCategory; |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($idCategory)) { |
|
|
|
if (!empty($idCategory)) { |
|
|
|
if (api_is_allowed_to_edit(false, true) && |
|
|
|
if (api_is_allowed_to_edit(false, true) && |
|
|
|
!($forumCategory['session_id'] == 0 && intval($sessionId) != 0) |
|
|
|
!($forumCategory['session_id'] == 0 && $sessionId != 0) |
|
|
|
) { |
|
|
|
) { |
|
|
|
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq() |
|
|
|
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq() |
|
|
|
.'&action=edit&content=forumcategory&id='.intval($idCategory) |
|
|
|
.'&action=edit&content=forumcategory&id='.$idCategory |
|
|
|
.'">'.Display::return_icon( |
|
|
|
.'">'.Display::return_icon( |
|
|
|
'edit.png', |
|
|
|
'edit.png', |
|
|
|
get_lang('Edit'), |
|
|
|
get_lang('Edit'), |
|
|
|
@ -272,7 +267,7 @@ if (is_array($forumCategories)) { |
|
|
|
.'</a>'; |
|
|
|
.'</a>'; |
|
|
|
|
|
|
|
|
|
|
|
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq() |
|
|
|
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq() |
|
|
|
.'&action=delete&content=forumcategory&id='.intval($idCategory) |
|
|
|
.'&action=delete&content=forumcategory&id='.$idCategory |
|
|
|
."\" onclick=\"javascript:if(!confirm('" |
|
|
|
."\" onclick=\"javascript:if(!confirm('" |
|
|
|
.addslashes(api_htmlentities( |
|
|
|
.addslashes(api_htmlentities( |
|
|
|
get_lang('DeleteForumCategory'), |
|
|
|
get_lang('DeleteForumCategory'), |
|
|
|
@ -303,6 +298,7 @@ if (is_array($forumCategories)) { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$forumCategoryInfo['tools'] = $tools; |
|
|
|
$forumCategoryInfo['tools'] = $tools; |
|
|
|
$forumCategoryInfo['forums'] = []; |
|
|
|
$forumCategoryInfo['forums'] = []; |
|
|
|
// The forums in this category. |
|
|
|
// The forums in this category. |
|
|
|
@ -310,7 +306,7 @@ if (is_array($forumCategories)) { |
|
|
|
$forumsInCategory = get_forums_in_category($forumCategory['cat_id']); |
|
|
|
$forumsInCategory = get_forums_in_category($forumCategory['cat_id']); |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($forumsInCategory)) { |
|
|
|
if (!empty($forumsInCategory)) { |
|
|
|
$forumsDetailsList = null; |
|
|
|
$forumsDetailsList = []; |
|
|
|
// We display all the forums in this category. |
|
|
|
// We display all the forums in this category. |
|
|
|
foreach ($allCourseForums as $forum) { |
|
|
|
foreach ($allCourseForums as $forum) { |
|
|
|
// Here we clean the whatnew_post_info array a little bit because to display the icon we |
|
|
|
// Here we clean the whatnew_post_info array a little bit because to display the icon we |
|
|
|
@ -468,7 +464,7 @@ if (is_array($forumCategories)) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (api_is_allowed_to_edit(false, true) |
|
|
|
if (api_is_allowed_to_edit(false, true) |
|
|
|
&& !($forum['session_id'] == 0 && intval($sessionId) != 0) |
|
|
|
&& !($forum['session_id'] == 0 && $sessionId != 0) |
|
|
|
) { |
|
|
|
) { |
|
|
|
$toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq() |
|
|
|
$toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq() |
|
|
|
.'&action=edit&content=forum&id='.$forum['forum_id'].'">' |
|
|
|
.'&action=edit&content=forum&id='.$forum['forum_id'].'">' |
|
|
|
@ -526,6 +522,13 @@ if (is_array($forumCategories)) { |
|
|
|
} |
|
|
|
} |
|
|
|
$forumCategoryInfo['forums'] = $forumsDetailsList; |
|
|
|
$forumCategoryInfo['forums'] = $forumsDetailsList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Don't show empty categories (for students) |
|
|
|
|
|
|
|
if (!api_is_allowed_to_edit()) { |
|
|
|
|
|
|
|
if (empty($forumCategoryInfo['forums'])) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
$listForumCategory[] = $forumCategoryInfo; |
|
|
|
$listForumCategory[] = $forumCategoryInfo; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|