Code Duplication    Length = 5-8 lines in 2 locations

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

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

main/work/work.lib.php 1 location

@@ 499-506 (lines=8) @@
496
497
    $studentCondition = null;
498
499
    if (!empty($onlyUserList)) {
500
        $onlyUserList = array_map('intval', $onlyUserList);
501
        $studentCondition = "AND u.user_id IN ('".implode("', '", $onlyUserList)."') ";
502
    } else {
503
        if (empty($userId)) {
504
            return 0;
505
        }
506
    }
507
508
    $sql = "SELECT count(*) FROM (
509
                SELECT count(*), w.parent_id