× Feature Requests

Please do NOT use this section of the forum to request help if Joomdle does not work for you in some particular way. Your post will be deleted.

[Closed] all forums on one page

12 years 1 month ago 8 years 11 months ago by Antonio Durán.
red
Posts: 38
More
Topic Author
[Closed] all forums on one page #1
I know this is not a joomdle issue, but here goes:

This mod makes it possible for a user to see all of his forums at one page without having to go to the courses in moodle. and offers a way to make a nice central forums system for joomla just link to
moodle/mod/forum

to use:
open moodle/mod/forum/index.php

find:
/// Output the page
    $navlinks = array();
    $navlinks[] = array('name' => $strforums, 'link' => '', 'type' => 'activity');

    print_header("$course->shortname: $strforums", $course->fullname,
                    build_navigation($navlinks),
                    "", "", true, $searchform, navmenu($course));

    

    if ($generalforums) {
        print_heading(get_string('generalforums', 'forum'));
        print_table($generaltable);
    }

    if ($learningforums) {
        print_heading(get_string('learningforums', 'forum'));
        print_table($learningtable);
    }

and AFTER add:
///////////////////////
    //////// HACK START
    ///////////////////////
    if ($id!=0)
    {

         $myCourses = get_my_courses($USER->id, 'visible DESC,sortorder ASC');

	 foreach ($myCourses as $course) {
   			 
   			$myForums = get_records('forum', 'course', $course->id);
			 unset($mytable);
   			 $mytable->head	 = array ($strforum, $strdescription, $strdiscussions);
			$mytable->align = array ('left', 'left', 'center');

			if ($usetracking) {
				$mytable->head[] = $strunreadposts;
				$mytable->align[] = 'center';

				$mytable->head[] = $strtracking;
				$mytable->align[] = 'center';
			}

			if ($can_subscribe) {
				$mytable->head[] = $strsubscribed;
				$mytable->align[] = 'center';
			}

			if ($show_rss = (($can_subscribe || $course->id == SITEID) &&
							 isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) &&
					 		$CFG->enablerssfeeds && $CFG->forum_enablerssfeeds)) {
				$mytable->head[] = $strrss;
				$mytable->align[] = 'center';
			}
			
$modinfo =& get_fast_modinfo($course);
		 	foreach ($myForums as $forum) {
		 	
		 	
	 		 $cm		 = $modinfo->instances['forum'][$forum->id];
			$context = get_context_instance(CONTEXT_MODULE, $cm->id);

			$count = forum_count_discussions($forum, $cm, $course);

			if ($usetracking) {
				if ($forum->trackingtype == FORUM_TRACKING_OFF) {
					$unreadlink	 = '-';
					$trackedlink = '-';

				} else {
					if (isset($untracked[$forum->id])) {
							$unreadlink	 = '-';
					} else if ($unread = forum_tp_count_forum_unread_posts($cm, $course)) {
							$unreadlink = '<span class="unread"><a href="view.php?f='.$forum->id.'">'.$unread.'</a>';
						$unreadlink .= '<a title="'.$strmarkallread.'" href="markposts.php?f='.
									   $forum->id.'&amp;mark=read"><img src="'.$CFG->pixpath.'/t/clear.gif" alt="'.$strmarkallread.'" /></a></span>';
					} else {
						$unreadlink = '<span class="read">0</span>';
					}

					if ($forum->trackingtype == FORUM_TRACKING_ON) {
						$trackedlink = $stryes;

					} else {
						$options = array('id'=>$forum->id);
						if (!isset($untracked[$forum->id])) {
							$trackedlink = print_single_button($CFG->wwwroot.'/mod/forum/settracking.php', $options, $stryes, 'post', '_self', true, $strnotrackforum);
						} else {
							$trackedlink = print_single_button($CFG->wwwroot.'/mod/forum/settracking.php', $options, $strno, 'post', '_self', true, $strtrackforum);
						}
					}
				}
			}

			$forum->intro = shorten_text(trim(format_text($forum->intro, FORMAT_HTML, $introoptions)), $CFG->forum_shortpost);
			$forumname = format_string($forum->name, true);;

			if ($cm->visible) {
				$style = '';
			} else {
				$style = 'class="dimmed"';
			}
			$forumlink = "<a href=\"view.php?f=$forum->id\" $style>".format_string($forum->name,true)."</a>";
			$discussionlink = "<a href=\"view.php?f=$forum->id\" $style>".$count."</a>";

			$row = array ($forumlink, $forum->intro, $discussionlink);
			if ($usetracking) {
				$row[] = $unreadlink;
				$row[] = $trackedlink;	  // Tracking.
			}

			if ($can_subscribe) {
				if ($forum->forcesubscribe != FORUM_DISALLOWSUBSCRIBE) {
					$row[] = forum_get_subscribe_link($forum, $context, array('subscribed' => $stryes,
							'unsubscribed' => $strno, 'forcesubscribed' => $stryes,
							'cantsubscribe' => '-'), false, false, true, $subscribed_forums);
				} else {
					$row[] = '-';
				}
			}

			//If this forum has RSS activated, calculate it
			if ($show_rss) {
				if ($forum->rsstype and $forum->rssarticles) {
					//Calculate the tolltip text
					if ($forum->rsstype == 1) {
						$tooltiptext = get_string('rsssubscriberssdiscussions', 'forum', format_string($forum->name));
					} else {
						$tooltiptext = get_string('rsssubscriberssposts', 'forum', format_string($forum->name));
					}
					//Get html code for RSS link
					$row[] = rss_get_link($course->id, $USER->id, 'forum', $forum->id, $tooltiptext);
				} else {
					$row[] = '&nbsp;';
				}
			}

			$mytable->data[] = $row;
		}
			 print_heading($course->fullname);
			 print_table($mytable);

	 }
     }
    ////////
The topic has been locked.
12 years 1 month ago
Chris
Posts: 2118
More
[Closed] all forums on one page #2
Thanks very much for sharing.

Along this line, we have been thinking about whether it would make sense to have Moodle forums appear in Kunena (as well as / instead of) which would allow you to do something similar. This of course would be more effective when Joomla 1.6 comes out so that we can apply proper permissions and create course groups in Kunena.
The topic has been locked.
12 years 1 month ago
red
Posts: 38
More
Topic Author
[Closed] all forums on one page #3
I find it counter-productive to manage two forum systems when you can use only one...

I have some more ideas on how to get the moodle forums nicer and more up to par with other forum systems.. more hacks will come soon!
The topic has been locked.
12 years 1 month ago
Chris
Posts: 2118
More
[Closed] all forums on one page #4
I agreed that two forums should not be managed.

And since there is likely to be a larger user base in joomla than in moodle (ie not all ppl will enroll in courses), it may, in some situations, be better to not use the moodle forum but rather use the joomla forum. In this case I would not enable forums in moodle. I believe this would also be more functional as the joomla forums are specialised at being forums.
The topic has been locked.
12 years 1 month ago
red
Posts: 38
More
Topic Author
[Closed] all forums on one page #5
In a moodle + joomla integrated site, it is more likely that most forum activity will happen inside the courses themselves, and not by joomla guests. Of course if you use moodle for managing 1 or 2 courses that is not the case, but then you don't really need moodle.

It is near-impossible to disable moodle's forum activity, since it is interwoven across the course structure and is not used just as classic forums but supports the whole moodle way of managing your courses.

As far as i know, joomla comes without any forum or community tools installed.
The few forum tools that it does have, are not something i would like to install on my joomla system, as they are all very heavy, not well written, would bloat my database even more, and decentralize my user data.

Joomla is not meant to be a community system, its a content management system, and i like to keep my joomla clean from un needed extensions.

Moodle, on the other hand, is soon going 2.0 and IMO there is no time better to hack it than now, and submitting those hacks to the final release. It has all of the tools a community needs... I am just tweaking it a tad so it feels good with joomla
The topic has been locked.
12 years 1 month ago
Chris
Posts: 2118
More
[Closed] all forums on one page #6
OK good to hear your opinion on this. I will look at 2.0 further and see what suggestions can be put forth.
The topic has been locked.
12 years 1 month ago 12 years 1 month ago by red.
red
Posts: 38
More
Topic Author
[Closed] all forums on one page #7
I have extended my hack into two:

The first hack makes it possible to see a public course which is separate from the front page course. (if no Course ID is specified)
The second hack creates a table for logged in users with all of the forums of the courses they are registered to. (if no course ID is specified and user is enrolled to a course)

These two hacks make for a very nice centralized forums section, that combines public and private forums.


how to install
Find:
if ($learningforums) {
 print_heading(get_string('learningforums', 'forum'));
 print_table($learningtable);
 }

And AFTER, paste the attached file (formhack.h)

File Attachment:

File Name: forumhack.txt
File Size:9 KB
Attachments:
The topic has been locked.