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
Hey,
I am also looking to use the calendar in this way.
Anyone have any suggestions?
regards,
Adam
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).
- 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).
... And the second patch file (for theme/standard/styles_color.css). This patch is not necessary if you do not need the background color difference.
...and another screenshot. This is the end of my posting. 
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.
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.

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.
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.
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.