Code Duplication    Length = 7-8 lines in 2 locations

main/work/work.lib.php 2 locations

@@ 1408-1414 (lines=7) @@
1405
    $groupIid = (int) $groupIid;
1406
1407
    // Get list from database
1408
    if (!empty($groupIid)) {
1409
        $group_query = " WHERE w.c_id = $course_id AND post_group_id = $groupIid";
1410
        $subdirs_query = "AND parent_id = 0";
1411
    } else {
1412
        $group_query = " WHERE w.c_id = $course_id AND (post_group_id = '0' or post_group_id is NULL)  ";
1413
        $subdirs_query = "AND parent_id = 0";
1414
    }
1415
1416
    $active_condition = ' AND active IN (1, 0)';
1417
@@ 320-327 (lines=8) @@
317
                    post_group_id = $groupIid
318
                ORDER BY sent_date DESC";
319
    } else {
320
        if (!empty($group_id)) {
321
            // set to select only messages posted by the user's group
322
            $group_query = " WHERE c_id = $course_id AND post_group_id = $groupIid";
323
            $subdirs_query = " AND parent_id = 0";
324
        } else {
325
            $group_query = " WHERE c_id = $course_id AND (post_group_id = '0' OR post_group_id is NULL) ";
326
            $subdirs_query = " AND parent_id = 0";
327
        }
328
        //@todo how we can active or not an assignment?
329
        $active_condition = ' AND active IN (1, 0)';
330
        $sql = "SELECT * FROM  $work_table