Display of group events

Display of group events

by Daniel Schimrik -
Number of replies: 7
Hello,

I have created several groups in one course and have assigned as trainer group events. For participants it works pretty well, they only see events from groups they are in.

But me as Trainer have a problem: I see all group events, but without any notice on each event to what group it belongs. This is also a problem on editing of group events.

Would it be possible for trainer to:
- have a group-dropdown box on the calendar page
- have a notice on every group event showing the belonging group

regards, Daniel
Average of ratings: -
In reply to Daniel Schimrik

Re: Display of group events

by Adam Campbell -

Hey,

I am also looking to use the calendar in this way.

Anyone have any suggestions?

regards,

Adam

In reply to Daniel Schimrik

Re: Display of group events

by Toshihiro KITA -
Picture of Plugin developers Picture of Translators
This might be somewhat different from what you want, but I made some modification as:
- On the month view, a group-dependent symbol (like playing cards symbols) is added to the head of each event title
- On the day view, the group name is displayed like '(group: xxx)'
- the background color for each group is also different, that you can specify in theme/standard/styles_color.css

You need 2 patch files, Attached is the first one (for calendar/lib.php, calendar/view.php).
Average of ratings: Useful (4)
In reply to Toshihiro KITA

Re: Display of group events

by Toshihiro KITA -
Picture of Plugin developers Picture of Translators
This is an example screenshot.

Attachment calendar1.png
Average of ratings: Useful (1)
In reply to Toshihiro KITA

Re: Display of group events

by Toshihiro KITA -
Picture of Plugin developers Picture of Translators
...and another screenshot. This is the end of my posting. smile

This modification is according to the student-interaction needs in the online graduate school (Kumamoto University GSIS http://www.gsis.kumamoto-u.ac.jp/en/index.html) to which I belong.
Attachment calendar2.png
Average of ratings: Useful (1)
In reply to Toshihiro KITA

Re: Display of group events

by A.J. Colianni -
Sorry I am a bit of a newbie about this, but what is the best way to apply this patch? Can you point me at a document that would be helpful.
In reply to A.J. Colianni

Re: Display of group events

by Toshihiro KITA -
Picture of Plugin developers Picture of Translators
If you are using Linux (UNIX) Server, put the patch file in the Moodle directory, and execute the command
patch -p0 < patchfile
(-p0 might be -p1 or something, depending on the patchfile location.)


In case you can not execute the command, following is the interpretation of calendar_group.patch to manually patch files:

Open calendar/lib.php.
Find the lines

        $event->icon = '<img height="16" width="16" src="'.$CFG->pixpath.'/c/group.gif" alt="'.get_string('groupevent', 'calendar').'" style="vertical-align: middle;" />';
        $event->cssclass = 'event_group';

and replace the second line with

        $event->cssclass = 'event_group groupid'.$event->groupid;

Also find the lines

    } else {
        echo '<div class="name">'.$event->name."</div>";
    }

and replace them all with

    } else {
      if ($event->groupid) {
      echo '<div class="name">'.$event->name." (group: ".get_record('groups','id', $event->groupid)->name.")"."</div>";
      }else{
        echo '<div class="name">'.$event->name."</div>";
      }
    }
and save it.
Then open calendar/view.php and find the lines

                if (!empty($events[$eventindex]->class)) {
                    $eventclass = ' class="'.$events[$eventindex]->class.'"';

and replace the second line with

                    $eventclass = ' class="'.$events[$eventindex]->class.' groupid'.$events[$eventindex]->groupid.'"';

Also find the line

                echo '<li'.$eventclass.'><a href="'.$dayhref.'#event_'.$events[$eventindex]->id.'">'.format_string($events[$eventindex]->name, true).'</a></li>';

and replace it with the lines

              if ($events[$eventindex]->class == "event_group"){
                $groupid_mark= '<span style="font-size:large">&#'.(0x265f+$events[$eventindex]->groupid).';</span> ';
              }else{
                $groupid_mark= '';
              }
              echo '<li'.$eventclass.'><a href="'.$dayhref.'#event_'.$events[$eventindex]->id.'">'.$groupid_mark.format_string($events[$eventindex]->name, true).'</a></li>';

and save the file.


# the meaning of '-' and '+' at the head of each line in a patch file is 'delete' and 'add' respectively.


Average of ratings: Useful (3)