Code Duplication    Length = 29-29 lines in 2 locations

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

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