Code Duplication    Length = 11-12 lines in 3 locations

main/attendance/attendance_controller.php 3 locations

@@ 184-195 (lines=12) @@
181
     * render to attendance_list view
182
     * @param int $attendanceId
183
     */
184
    public function attendanceSetVisible($attendanceId)
185
    {
186
        $attendance = new Attendance();
187
        $affectedRows = null;
188
        if (!empty($attendanceId)) {
189
            $affectedRows = $attendance->changeVisibility($attendanceId, 1);
190
        }
191
        if ($affectedRows) {
192
            $message['message_attendance_delete'] = true;
193
        }
194
        $this->attendance_list();
195
    }
196
197
    /**
198
     * It's used for make attendance invisible
@@ 202-212 (lines=11) @@
199
     * render to attendance_list view
200
     * @param int $attendanceId
201
     */
202
    public function attendanceSetInvisible($attendanceId)
203
    {
204
        $attendance = new Attendance();
205
        if (!empty($attendanceId)) {
206
            $affectedRows = $attendance->changeVisibility($attendanceId, 0);
207
        }
208
        if ($affectedRows) {
209
            $message['message_attendance_delete'] = true;
210
        }
211
        $this->attendance_list();
212
    }
213
214
    /**
215
     * Restores an attendance entry and fallback to attendances rendering
@@ 218-229 (lines=12) @@
215
     * Restores an attendance entry and fallback to attendances rendering
216
     * @param int $attendance_id
217
     */
218
    public function attendance_restore($attendance_id)
219
    {
220
        $attendance = new Attendance();
221
        $affected_rows = false;
222
        if (!empty($attendance_id)) {
223
            $affected_rows = $attendance->attendance_restore($attendance_id);
224
        }
225
        if ($affected_rows) {
226
            $message['message_attendance_restore'] = true;
227
        }
228
        $this->attendance_list();
229
    }
230
231
    /**
232
     * Lock or unlock an attendance