public static function get_multiple($userid, array $competenciesorids = null) {
        global $DB;

        $params = array();
        $params['userid'] = $userid;
        $sql = '1 = 1';

        if (!empty($competenciesorids)) {
            $test = reset($competenciesorids);
            if (is_number($test)) {
                $ids = $competenciesorids;
            } else {
                $ids = array();
                foreach ($competenciesorids as $comp) {
                    $ids[] = $comp->get('id');
                }
            }

            list($insql, $inparams) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED);
            $params += $inparams;
            $sql = "competencyid $insql";
        }

        // Order by ID to prevent random ordering.
        return self::get_records_select("userid = :userid AND $sql", $params, 'id ASC');
    }
public static function get_multiple($userid, array $competenciesorids = null) {
        global $DB;

        $params = array();
        $params['userid'] = $userid;
        $sql = '1 = 1';

        if (!empty($competenciesorids)) {
            $test = reset($competenciesorids);
            if (is_number($test)) {
                $ids = $competenciesorids;
            } else {
                $ids = array();
                foreach ($competenciesorids as $comp) {
                    $ids[] = $comp->get('id');
                }
            }

            list($insql, $inparams) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED);
            $params += $inparams;
            $sql = "competencyid $insql";
        }

        // Order by ID to prevent random ordering.
        return self::get_records_select("userid = :userid AND $sql", $params, 'id ASC');
    }
public static function get_multiple ( $ userid , array $ competenciesorids = null ) { global $ DB ; $ params = array ( ) ; $ params [ 'userid' ] = $ userid ; $ sql = '1 = 1' ; if ( ! empty ( $ competenciesorids ) ) { $ test = reset ( $ competenciesorids ) ; if ( is_number ( $ test ) ) { $ ids = $ competenciesorids ; } else { $ ids = array ( ) ; foreach ( $ competenciesorids as $ comp ) { $ ids [ ] = $ comp -> get ( 'id' ) ; } } list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ ids , SQL_PARAMS_NAMED ) ; $ params += $ inparams ; $ sql = "competencyid $insql" ; } // Order by ID to prevent random ordering. return self :: get_records_select ( "userid = :userid AND $sql" , $ params , 'id ASC' ) ; }
Get multiple user_competency for a user.

@param  int $userid
@param  array  $competenciesorids Limit search to those competencies, or competency IDs.
@return \core_competency\user_competency[]
Get multiple user_competency for a user .