Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
As stated before, with the API's available to App Store developers, it is not possible. With that said, if you jailbreak your iPhone, there is an App called 'MyProfiles' which lets you define certain profiles based on nearby WiFi networks (really cool and useful!,) GPS location, time, whether your iPhone is charging, battery level, bluetooth devices within range, etc.

It's out on Cydia for $12.99, and if you're lucky enough, you can find a cracked copy to demo it out. I've been using it for a while now and it's really useful because not only does it control ringer/volume, but also your 3G, WiFi, Push Email, and Auto-Lock settings.

MPRules.png

Check it out here: http://intelliborn.com/products.html
 
For the love of all that is silicon, why on Earth can't Apple manage to provide a similar utility? I love the iPhone (OK, maybe 'love' is a little overdoing it for an inanimate object), but this is a glaring omission. And actually, why can't it use GPS to sort out where a given profile should be active?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.