public function executeIndex(sfWebRequest $request) { $this->forward404Unless($this->room = RoomPeer::retrieveByPk($request->getParameter('roomId')), sprintf('Object room does not exist (%s).', $request->getParameter('roomId'))); $this->getUserAttributes(); if ($request->hasParameter('activityId')) { $this->forward404Unless($this->activity = ActivityPeer::retrieveByPk($request->getParameter('activityId')), sprintf('Object activity does not exist (%s).', $request->getParameter('activityId'))); $this->forward404Unless($this->person->hasActivity($this->activity->getId()), sprintf('Cannot access entry ("%s").', $this->activity)); $this->getUser()->setAttribute('activityId', $this->activity->getId()); } else { $this->forward404Unless($this->activity = ActivityPeer::retrieveByPk($this->getUser()->getAttribute('activityId')), sprintf('Object activity does not exist (%s).', $this->getUser()->getAttribute('activityId'))); } $this->checkRoomAccess($this->room->getId(), $this->activity->getId()); $this->forward404Unless($this->realPerson = $this->getUser()->getPerson(), 'No user or card logged-in.'); $this->is_admin = $this->isAdmin(); $this->getUser()->syncParameters($this, 'reservation', 'index', array('displayPeriod'), $request); $this->getUser()->syncParameters($this, 'general', 'index', array('date'), $request); if (is_null($this->date)) { $this->date = time(); } else { $this->date = strtotime($this->date); } if ($request->hasParameter('displayPeriod')) { $this->displayPeriod = $request->getParameter('displayPeriod'); } else { $this->displayPeriod = 'week'; } if ($this->displayPeriod == 'week') { $this->weekStart = ReservationPeer::getWeekStart($this->date); $this->reservation_list = ReservationPeer::doSelectWeekOrderbyDate($this->room->getId(), $this->date); } else { $this->forward404(sprintf('No valid display period set (%s).', $this->displayPeriod)); } if ($this->getUser()->hasFlash('deleteError')) { $this->deleteError = $this->getUser()->getFlash('deleteError'); } }