Fixed database, models, views, controllers

Fixed database, models, views, controllers for correct CakePHP
associations.
Fixed views