Adding Sessions to the course main page

Re: Adding Sessions to the course main page

by Steve Messinger -
Number of replies: 2

I've also been looking at displaying the face-to-face sessions in the course page for Moodle 2.5.

The previous message (which referred to https://moodle.org/mod/forum/discuss.php?d=200970) called out a location in course/lib.php.

The code has changed, however, and I believe in Moodle 2.5 the place is in course/renderer.php, in the course_session_cm_text() function, at about line 775. 

However, just adding this code at that spot still leaves the link to the face-to-face activity in place, so you see both the list of sessions and the link to the activity.  I didn't like that, so I made another change, as follows. 

In the same course/renderer.php file, but in the course_section_cm_name() function, near line 670, there is code like this:

   $url = $mod->get_url();
if (!$url) {
return $output;
}

Following that code, I added a clause like this:

  if ($mod->modname == 'facetoface') {
return $output;
}

Between these two changes it seems to do what I want.

However, I tried turning on debug messages, and found a number of warning messages, even though it appears to work well enough as described in the link above.  I have not yet had a chance to try to fix those warnings.

 

In reply to Steve Messinger

Re: Adding Sessions to the course main page

by Roger Mepham -

Hi

Please could you or another kind moodler advise the exact code change needed in the renderer.php file to get sessions displayed on a course page.

The 2.5 help doc mentions:

2.5

The code for displaying the course information has been moved to the renderer.php file.

Now, in course/renderer.php, function course_section_cm_text(), near line 775, the current code is:

       if ($mod->get_url()) {
           if ($content) {
               // If specified, display extra content after link.
               $output = html_writer::tag('div', $content, array('class' =>
                       trim('contentafterlink ' . $textclasses)));
           }
       } else {
           // No link, so display only content.  

Add the code to display facetoface sessions following the "if ($mod->get_url()) {" line.

 But the 2.6 doc omits this.

I tried adding:

if ($mod->get_url()) {
if ($mod->modname == 'facetoface') {
include_once($CFG->dirroot.'/mod/facetoface/lib.php');
echo facetofacee_print_coursemodule_info($mod);
}
if ($content) {
// If specified, display extra content after link.
$output = html_writer::tag('div', $content, array('class' =>
trim('contentafterlink ' . $textclasses)));
}

With no luck

It would be great to get this to work, any assistance gratefully received.

Thanks

In reply to Roger Mepham

Re: Adding Sessions to the course main page

by Stacey Walker -

Hi All,

I have just pushed a patch for Moodle 2.6 that should ensure that the sessions are displayed on the course page according to the display number set in the instance configuration.  It is available on branch MOODLE_26_STABLE at https://github.com/catalyst/facetoface-2.0/commits/MOODLE_26_STABLE

Apologies for the delay!

Thanks,

Stacey