. * * @category Event * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ if (!defined('GNUSOCIAL')) { exit(1); } /** * RSVP for an event * * @category Event * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ class CancelrsvpAction extends FormAction { protected $form = 'CancelRSVP'; function title() { // TRANS: Title for RSVP ("please respond") action. return _m('TITLE','Cancel RSVP'); } // FIXME: Merge this action with RSVPAction and add a 'cancel' thing there... protected function doPreparation() { $rsvpId = $this->trimmed('rsvp'); if (empty($rsvpId)) { // TRANS: Client exception thrown when referring to a non-existing RSVP ("please respond") item. throw new ClientException(_m('No such RSVP.')); } $this->rsvp = RSVP::getKV('id', $rsvpId); if (empty($this->rsvp)) { // TRANS: Client exception thrown when referring to a non-existing RSVP ("please respond") item. throw new ClientException(_m('No such RSVP.')); } $this->formOpts['rsvp'] = $this->rsvp; } protected function doPost() { $this->event = Happening::getKV('uri', $this->rsvp->event_uri); if (empty($this->event)) { // TRANS: Client exception thrown when referring to a non-existing event. throw new ClientException(_m('No such event.')); } $notice = $this->rsvp->getNotice(); // NB: this will delete the rsvp, too if (!empty($notice)) { common_log(LOG_DEBUG, "Deleting notice..."); $notice->deleteAs($this->scoped); } else { common_log(LOG_DEBUG, "Deleting RSVP alone..."); $this->rsvp->delete(); } } }