public function delete() { $flash = Flash::Instance(); $ce = $this->_uses['CalendarEvent']; $ce->load($this->_data['id']); if ($ce->owner != EGS_USERNAME) { $csc = new CalendarShareCollection(new CalendarShare()); $sh = new SearchHandler($csc); $sh->addConstraint(new Constraint('username', '=', EGS_USERNAME)); $csc->load($sh); if ($csc->count() == 0) { $flash->addError('You do not have permission to edit that entry'); sendBack(); } } parent::delete('CalendarEvent'); sendTo('index', 'index', array('calendar')); }