Code Duplication    Length = 7-14 lines in 3 locations

main/gradebook/lib/be/category.class.php 1 location

@@ 1856-1862 (lines=7) @@
1853
1854
     * @return bool
1855
     * */
1856
    public function lock($locked)
1857
    {
1858
        $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
1859
        $sql = "UPDATE $table SET locked = '".intval($locked)."'
1860
                WHERE id='".intval($this->id)."'";
1861
        Database::query($sql);
1862
    }
1863
1864
    /**
1865
     * @param $locked

main/inc/lib/course.lib.php 2 locations

@@ 331-344 (lines=14) @@
328
     *
329
     * @return mixed
330
     */
331
    public static function getUserCourseInfo($userId, $courseId)
332
    {
333
334
        $result = Database::fetch_array(
335
            Database::query("
336
                SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . "
337
                WHERE
338
                    c_id  = '" . intval($courseId). "' AND
339
                    user_id = " . intval($userId)
340
            )
341
        );
342
343
        return $result;
344
    }
345
346
    /**
347
     * @param int  $userId
@@ 380-393 (lines=14) @@
377
     *
378
     * @return mixed
379
     */
380
    public static function get_tutor_in_course_status($user_id, $course_code)
381
    {
382
        $result = Database::fetch_array(
383
            Database::query("
384
                SELECT is_tutor
385
                FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . "
386
                WHERE
387
                    course_code = '" . Database::escape_string($course_code) . "' AND
388
                    user_id = " . intval($user_id)
389
            )
390
        );
391
392
        return $result['is_tutor'];
393
    }
394
395
    /**
396
     * Unsubscribe one or more users from a course