Code Duplication    Length = 5-8 lines in 2 locations

main/inc/lib/course.lib.php 1 location

@@ 1386-1390 (lines=5) @@
1383
            }
1384
        }
1385
1386
        if (!empty($userIdList)) {
1387
            $userIdList = array_map('intval', $userIdList);
1388
            $userIdList = implode('","', $userIdList);
1389
            $sql .= ' AND user.user_id IN ("' . $userIdList . '")';
1390
        }
1391
1392
        if (isset($filterByActive)) {
1393
            $filterByActive = intval($filterByActive);

main/work/work.lib.php 1 location

@@ 513-520 (lines=8) @@
510
511
    $studentCondition = null;
512
513
    if (!empty($onlyUserList)) {
514
        $onlyUserList = array_map('intval', $onlyUserList);
515
        $studentCondition = "AND u.user_id IN ('".implode("', '", $onlyUserList)."') ";
516
    } else {
517
        if (empty($userId)) {
518
            return 0;
519
        }
520
    }
521
522
    $sql = "SELECT count(*) FROM (
523
                SELECT count(*), w.parent_id