Code Duplication    Length = 29-29 lines in 2 locations

main/inc/lib/agenda.lib.php 2 locations

@@ 228-256 (lines=29) @@
225
                            );
226
                        } else {
227
                            // Storing the selected groups
228
                            if (!empty($sendTo['groups'])) {
229
                                foreach ($sendTo['groups'] as $group) {
230
                                    api_item_property_update(
231
                                        $this->course,
232
                                        TOOL_CALENDAR_EVENT,
233
                                        $id,
234
                                        "AgendaAdded",
235
                                        $senderId,
236
                                        $group,
237
                                        0,
238
                                        $start,
239
                                        $end,
240
                                        $sessionId
241
                                    );
242
243
                                    api_item_property_update(
244
                                        $this->course,
245
                                        TOOL_CALENDAR_EVENT,
246
                                        $id,
247
                                        "visible",
248
                                        $senderId,
249
                                        $group,
250
                                        0,
251
                                        $start,
252
                                        $end,
253
                                        $sessionId
254
                                    );
255
                                }
256
                            }
257
258
                            // storing the selected users
259
                            if (!empty($sendTo['users'])) {
@@ 259-287 (lines=29) @@
256
                            }
257
258
                            // storing the selected users
259
                            if (!empty($sendTo['users'])) {
260
                                foreach ($sendTo['users'] as $userId) {
261
                                    api_item_property_update(
262
                                        $this->course,
263
                                        TOOL_CALENDAR_EVENT,
264
                                        $id,
265
                                        "AgendaAdded",
266
                                        $senderId,
267
                                        $groupId,
268
                                        $userId,
269
                                        $start,
270
                                        $end,
271
                                        $sessionId
272
                                    );
273
274
                                    api_item_property_update(
275
                                        $this->course,
276
                                        TOOL_CALENDAR_EVENT,
277
                                        $id,
278
                                        "visible",
279
                                        $senderId,
280
                                        $groupId,
281
                                        $userId,
282
                                        $start,
283
                                        $end,
284
                                        $sessionId
285
                                    );
286
                                }
287
                            }
288
                        }
289
                    }
290