Added a check for edit permissions.
Added an edit link.
Updated to reflect changes to the calendar class and added checks to prevent undefined variable errors.