Abstracted away some of modal logic.

Controllers now have a modified redirect function that does a proper
redirect on an ajax call.

Controller and all subclasses now have a renderModal method, which
generates a modal for ajax calls and a normal page for requests.

Moved the modal to the main.php layout so it is accessible everywhere.