Code Duplication    Length = 5-5 lines in 4 locations

main/work/work.lib.php 1 location

@@ 1711-1715 (lines=5) @@
1708
    $direction = in_array(strtolower($direction), array('desc', 'asc')) ? $direction : 'desc';
1709
    $column = Database::escape_string($column);
1710
1711
    if ($getCount) {
1712
        $result = Database::query($sql);
1713
        $result = Database::fetch_array($result);
1714
        return $result['count'];
1715
    }
1716
1717
    $sql .= " ORDER BY $column $direction";
1718
    $sql .= " LIMIT $start, $limit";

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

@@ 4370-4374 (lines=5) @@
4367
        if ($getSql) {
4368
            return $sql;
4369
        }
4370
        if ($getCount) {
4371
            $result = Database::query($sql);
4372
            $row = Database::fetch_array($result);
4373
            return $row['count'];
4374
        }
4375
4376
        $orderBy = null;
4377
        if ($getOnlyUserId == false) {

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

@@ 3474-3478 (lines=5) @@
3471
		            src.session_id IN ($sessionsSQL)
3472
		            $keywordCondition
3473
		        ";
3474
        if ($getCount) {
3475
            $result = Database::query($sql);
3476
            $row = Database::fetch_array($result,'ASSOC');
3477
            return $row['count'];
3478
        }
3479
3480
        if (isset($from) && isset($limit)) {
3481
            $from = intval($from);

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

@@ 6255-6259 (lines=5) @@
6252
            $sql .= $limitCondition;
6253
        }
6254
6255
        if ($getCount) {
6256
            $result = Database::query($sql);
6257
            $row = Database::fetch_array($result);
6258
            return $row['total'];
6259
        }
6260
        $result = Database::query($sql);
6261
6262
        $html = null;