public function executeDelete(sfWebRequest $request) { $request->checkCSRFProtection(); $this->forward404Unless($activity = ActivityPeer::retrieveByPk($request->getParameter('id')), sprintf('Object activity does not exist (%s).', $request->getParameter('id'))); $activity->delete(); $this->redirect('activity/index'); }
public function executeCreate(sfWebRequest $request) { $this->forward404Unless($request->isMethod('post')); $this->forward404Unless($this->activity = ActivityPeer::retrieveByPk($request->getParameter('activityId')), sprintf('Object activity does not exist (%s).', $request->getParameter('activityId'))); $this->form = new ReservationreasonForm(); $this->processForm($request, $this->form); $this->form->setDefaultActivity($this->activity); $this->setTemplate('new'); }
public function executeNavigation() { $this->person = $this->getUser()->getPerson(); $activityId = $this->getUser()->getAttribute('activityId'); if ($this->getUser()->hasActivity($activityId)) { $this->activity = ActivityPeer::retrieveByPk($activityId); } else { $this->activity = null; } $this->usergroup = UsergroupPeer::retrieveByPk($this->getUser()->getAttribute('usergroupId')); $this->user = UserPeer::retrieveByPk($this->getUser()->getAttribute('userId')); }
public function executeSendDeleteMessage(sfWebRequest $request) { $this->forward404Unless($this->user = UserPeer::retrieveByPk($request->getParameter('userId')), sprintf('Object user does not exist (%s).', $request->getParameter('userId'))); $this->forward404Unless($this->room = RoomPeer::retrieveByPk($request->getParameter('roomId')), sprintf('Object room does not exist (%s).', $request->getParameter('roomId'))); $this->forward404Unless($this->activity = ActivityPeer::retrieveByPk($this->getUser()->getAttribute('activityId')), sprintf('Object activity does not exist (%s).', $this->getUser()->getAttribute('activityId'))); $sender = $this->getUser()->getTemposUser(); $this->form = new MessageForm(); $this->form->setRecipient($this->user); $this->form->setSender($sender); }
protected function handleZoneParameters(sfWebRequest $request) { if ($request->hasParameter('self')) { $this->getUser()->getAttributeHolder()->remove('userId'); $this->getUser()->getAttributeHolder()->remove('usergroupId'); } $this->forward404Unless($this->activity = ActivityPeer::retrieveByPk($request->getParameter('activityId')), sprintf('Object activity does not exist (%s).', $request->getParameter('activityId'))); if ($this->getUser()->hasAttribute('userId')) { $this->forward404Unless($this->usergroup = UsergroupPeer::retrieveByPk($this->getUser()->getAttribute('usergroupId')), sprintf('Object usergroup does not exist (%s).', $this->getUser()->getAttribute('usergroupId'))); $this->forward404Unless($this->usergroup->hasActivity($this->activity->getId()), sprintf('User group does not have this entry (\'%s\')', $this->activity->getName())); $this->forward404Unless($this->user = UserPeer::retrieveByPk($this->getUser()->getAttribute('userId')), sprintf('Object user does not exist (%s).', $this->getUser()->getAttribute('userId'))); $this->forward404Unless($this->user->isMember($this->usergroup), 'The user is not member of the specified usergroup.'); $this->forward404Unless($this->getUser()->getTemposUser()->isLeader($this->usergroup), 'The logged user is not leader of the specified usergroup.'); $this->person = $this->user; } else { $this->forward404Unless($this->person = $this->getUser()->getPerson(), 'No user or card logged-in.'); } $this->forward404Unless($this->person->hasActivity($this->activity->getId()), sprintf('Cannot access entry ("%s").', $this->activity)); $this->getUser()->setAttribute('activityId', $this->activity->getId()); }