|
@@ -6533,7 +6533,16 @@ class learnpath
|
|
|
$dir = $_SESSION['oLP']->display_item_form('dir', get_lang('EnterDataNewChapter'), 'add_item');
|
|
|
echo Display::tabs(
|
|
|
$headers,
|
|
|
- array($documents, $exercises, $links, $works, $forums, $dir, $finish), 'resource_tab'
|
|
|
+ array(
|
|
|
+ $documents,
|
|
|
+ $exercises,
|
|
|
+ $links,
|
|
|
+ $works,
|
|
|
+ $forums,
|
|
|
+ $dir,
|
|
|
+ $finish,
|
|
|
+ ),
|
|
|
+ 'resource_tab'
|
|
|
);
|
|
|
|
|
|
return true;
|
|
@@ -9087,11 +9096,39 @@ class learnpath
|
|
|
require_once '../forum/forumfunction.inc.php';
|
|
|
require_once '../forum/forumconfig.inc.php';
|
|
|
|
|
|
- $a_forums = get_forums();
|
|
|
+ $forumCategories = get_forum_categories();
|
|
|
+ $forumsInNoCategory = get_forums_in_category(0);
|
|
|
+ if (!empty($forumsInNoCategory)) {
|
|
|
+ $forumCategories = array_merge(
|
|
|
+ $forumCategories,
|
|
|
+ array(
|
|
|
+ array(
|
|
|
+ 'cat_id' => 0,
|
|
|
+ 'session_id' => 0,
|
|
|
+ 'visibility' => 1,
|
|
|
+ 'cat_comment' => null,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $forumList = get_forums();
|
|
|
+ $a_forums = [];
|
|
|
+ foreach ($forumCategories as $forumCategory) {
|
|
|
+ // The forums in this category.
|
|
|
+ $forumsInCategory = get_forums_in_category($forumCategory['cat_id']);
|
|
|
+ if (!empty($forumsInCategory)) {
|
|
|
+ foreach ($forumList as $forum) {
|
|
|
+ if (isset($forum['forum_category']) && $forum['forum_category'] == $forumCategory['cat_id']) {
|
|
|
+ $a_forums[] = $forum;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
$return = '<ul class="lp_resource">';
|
|
|
|
|
|
- //First add link
|
|
|
+ // First add link
|
|
|
$return .= '<li class="lp_resource_element">';
|
|
|
$return .= Display::return_icon('new_forum.png');
|
|
|
$return .= Display::url(
|
|
@@ -9106,27 +9143,25 @@ class learnpath
|
|
|
$return .= '</li>';
|
|
|
|
|
|
$return .= '<script>
|
|
|
- function toggle_forum(forum_id){
|
|
|
- if(document.getElementById("forum_"+forum_id+"_content").style.display == "none"){
|
|
|
+ function toggle_forum(forum_id) {
|
|
|
+ if (document.getElementById("forum_"+forum_id+"_content").style.display == "none") {
|
|
|
document.getElementById("forum_"+forum_id+"_content").style.display = "block";
|
|
|
- document.getElementById("forum_"+forum_id+"_opener").src = "' . Display::returnIconPath('remove.gif').'";
|
|
|
+ document.getElementById("forum_"+forum_id+"_opener").src = "' . Display::returnIconPath('remove.gif').'";
|
|
|
} else {
|
|
|
document.getElementById("forum_"+forum_id+"_content").style.display = "none";
|
|
|
- document.getElementById("forum_"+forum_id+"_opener").src = "' . Display::returnIconPath('add.gif').'";
|
|
|
+ document.getElementById("forum_"+forum_id+"_opener").src = "' . Display::returnIconPath('add.gif').'";
|
|
|
}
|
|
|
}
|
|
|
</script>';
|
|
|
|
|
|
foreach ($a_forums as $forum) {
|
|
|
if (!empty($forum['forum_id'])) {
|
|
|
-
|
|
|
$link = Display::url(
|
|
|
Display::return_icon('preview_view.png', get_lang('Preview')),
|
|
|
api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.api_get_cidreq().'&forum='.$forum['forum_id'],
|
|
|
['target' => '_blank']
|
|
|
);
|
|
|
|
|
|
-
|
|
|
$return .= '<li class="lp_resource_element" data_id="'.$forum['forum_id'].'" data_type="'.TOOL_FORUM.'" title="'.$forum['forum_title'].'" >';
|
|
|
$return .= '<a class="moved" href="#">';
|
|
|
$return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
|
|
@@ -9144,7 +9179,6 @@ class learnpath
|
|
|
$a_threads = get_threads($forum['forum_id']);
|
|
|
if (is_array($a_threads)) {
|
|
|
foreach ($a_threads as $thread) {
|
|
|
-
|
|
|
$link = Display::url(
|
|
|
Display::return_icon('preview_view.png', get_lang('Preview')),
|
|
|
api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.api_get_cidreq().'&forum='.$forum['forum_id'].'&thread='.$thread['thread_id'],
|