Skip to content

Commit

Permalink
Fix agenda event id issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Sep 30, 2016
1 parent 9d0be94 commit dddf99e
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions main/inc/lib/agenda.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function __construct($senderId = 0, $courseId = 0, $sessionId = 0)
$this->event_session_color = '#00496D'; // kind of green
$this->eventOtherSessionColor = '#999';
$this->event_personal_color = 'steel blue'; //steel blue

}

/**
Expand Down Expand Up @@ -195,6 +194,11 @@ public function addEvent(
Database::query($sql);

$groupId = api_get_group_id();
$groupIid = 0;
if ($groupId) {
$groupInfo = GroupManager::get_group_properties($groupId);
$groupIid = $groupInfo['iid'];
}

if (!empty($usersToSend)) {
$sendTo = $this->parseSendToArray($usersToSend);
Expand All @@ -204,9 +208,9 @@ public function addEvent(
$this->course,
TOOL_CALENDAR_EVENT,
$id,
"AgendaAdded",
'AgendaAdded',
$senderId,
$groupId,
$groupIid,
'',
$start,
$end,
Expand All @@ -216,9 +220,9 @@ public function addEvent(
$this->course,
TOOL_CALENDAR_EVENT,
$id,
"visible",
'visible',
$senderId,
$groupId,
$groupIid,
'',
$start,
$end,
Expand All @@ -228,13 +232,19 @@ public function addEvent(
// Storing the selected groups
if (!empty($sendTo['groups'])) {
foreach ($sendTo['groups'] as $group) {
$groupIidItem = 0;
if ($group) {
$groupInfo = GroupManager::get_group_properties($group);
$groupIidItem = $groupInfo['iid'];
}

api_item_property_update(
$this->course,
TOOL_CALENDAR_EVENT,
$id,
"AgendaAdded",
'AgendaAdded',
$senderId,
$group,
$groupIidItem,
0,
$start,
$end,
Expand All @@ -245,9 +255,9 @@ public function addEvent(
$this->course,
TOOL_CALENDAR_EVENT,
$id,
"visible",
'visible',
$senderId,
$group,
$groupIidItem,
0,
$start,
$end,
Expand All @@ -263,9 +273,9 @@ public function addEvent(
$this->course,
TOOL_CALENDAR_EVENT,
$id,
"AgendaAdded",
'AgendaAdded',
$senderId,
$groupId,
$groupIid,
$userId,
$start,
$end,
Expand All @@ -276,9 +286,9 @@ public function addEvent(
$this->course,
TOOL_CALENDAR_EVENT,
$id,
"visible",
'visible',
$senderId,
$groupId,
$groupIid,
$userId,
$start,
$end,
Expand Down

0 comments on commit dddf99e

Please sign in to comment.