public static function set_user_device_type($newdevice) {
        $devicetype = self::get_device_type();
        if ($newdevice == $devicetype) {
            unset_user_preference('switchdevice'.$devicetype);
            return true;
        } else {
            $devicetypes = self::get_device_type_list();
            if (in_array($newdevice, $devicetypes)) {
                set_user_preference('switchdevice'.$devicetype, $newdevice);
                return true;
            }
        }
        throw new coding_exception('Invalid device type provided to set_user_device_type');
    }
public static function set_user_device_type($newdevice) {
        $devicetype = self::get_device_type();
        if ($newdevice == $devicetype) {
            unset_user_preference('switchdevice'.$devicetype);
            return true;
        } else {
            $devicetypes = self::get_device_type_list();
            if (in_array($newdevice, $devicetypes)) {
                set_user_preference('switchdevice'.$devicetype, $newdevice);
                return true;
            }
        }
        throw new coding_exception('Invalid device type provided to set_user_device_type');
    }
public static function set_user_device_type ( $ newdevice ) { $ devicetype = self :: get_device_type ( ) ; if ( $ newdevice == $ devicetype ) { unset_user_preference ( 'switchdevice' . $ devicetype ) ; return true ; } else { $ devicetypes = self :: get_device_type_list ( ) ; if ( in_array ( $ newdevice , $ devicetypes ) ) { set_user_preference ( 'switchdevice' . $ devicetype , $ newdevice ) ; return true ; } } throw new coding_exception ( 'Invalid device type provided to set_user_device_type' ) ; }
Switches the device type we think the user is using to what ever was given.
@param string $newdevice
@return bool
@throws coding_exception
Switches the device type we think the user is using to what ever was given .