Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 520-534 (lines=15) @@
517
     * @return int Current max ID + 1 (we start from 0)
518
     * @assert (0, '') === 1
519
     */
520
    public function get_max_order($field_id)
521
    {
522
        $field_id = intval($field_id);
523
        $sql = "SELECT MAX(option_order)
524
                FROM {$this->table}
525
                WHERE field_id = $field_id";
526
        $res = Database::query($sql);
527
        $max = 1;
528
        if (Database::num_rows($res) > 0) {
529
            $row = Database::fetch_array($res);
530
            $max = $row[0] + 1;
531
        }
532
533
        return $max;
534
    }
535
536
    /**
537
     * Update the option using the given params

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