added functions to the events.php controller and eventsa_model.php