Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 430-444 (lines=15) @@
427
     * @param array $skill_list
428
     * @return array
429
     */
430
    public function get_user_by_skills($skill_list)
431
    {
432
        $users = array();
433
        if (!empty($skill_list)) {
434
            $skill_list = array_map('intval', $skill_list);
435
            $skill_list = implode("', '", $skill_list);
436
437
            $sql = "SELECT user_id FROM {$this->table}
438
                    WHERE skill_id IN ('$skill_list') ";
439
440
            $result = Database::query($sql);
441
            $users  = Database::store_result($result, 'ASSOC');
442
        }
443
        return $users;
444
    }
445
446
    /**
447
     * Get the achieved skills for the user

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

@@ 564-578 (lines=15) @@
561
     * @return int Current max ID + 1 (we start from 0)
562
     * @assert (0, '') === 1
563
     */
564
    public function get_max_order($field_id)
565
    {
566
        $field_id = intval($field_id);
567
        $sql = "SELECT MAX(option_order)
568
                FROM {$this->table}
569
                WHERE field_id = $field_id";
570
        $res = Database::query($sql);
571
        $max = 1;
572
        if (Database::num_rows($res) > 0) {
573
            $row = Database::fetch_array($res);
574
            $max = $row[0] + 1;
575
        }
576
577
        return $max;
578
    }
579
580
    /**
581
     * Update the option using the given params