Beispiel #1
0
 public function executeCreate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post'));
     $this->forward404Unless($this->room = RoomPeer::retrieveByPk($request->getParameter('roomId')), sprintf('Object room does not exist (%s).', $request->getParameter('roomId')));
     $this->form = new RoomprofileForm();
     $this->processForm($request, $this->form);
     $this->form->setDefaultRoom($this->room);
     $this->setTemplate('new');
 }
Beispiel #2
0
 public function executeCreate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post'));
     $this->forward404Unless($this->room = RoomPeer::retrieveByPk($request->getParameter('roomId')), sprintf('Object room does not exist (%s).', $request->getParameter('roomId')));
     $this->form = new DayperiodForm();
     $day = $request->getParameter('day');
     if (!is_null($day)) {
         $this->form->setDefaultWeekDay($day);
     }
     $this->processForm($request, $this->form);
     $this->form->setDefaultRoom($this->room);
     $this->setTemplate('new');
 }
 public function executeDelete(sfWebRequest $request)
 {
     $room = RoomPeer::retrieveByPk(Utility::DecryptQueryString($request->getParameter('id')));
     if ($room) {
         $room->setStatus(Constant::RECORD_STATUS_DELETED);
         if ($room->save()) {
             $this->getUser()->setFlash('SUCCESS_MESSAGE', Constant::RECORD_STATUS_DELETED_SUCCESSFULLY);
         } else {
             $this->getUser()->setFlash('ERROR_MESSAGE', Constant::DB_ERROR);
         }
     } else {
         $this->getUser()->setFlash('ERROR_MESSAGE', Constant::INVALID_REQUEST);
     }
     $this->redirect('Room/list');
 }
Beispiel #4
0
 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);
 }
Beispiel #5
0
 protected function processCopyForm(sfWebRequest $request, sfForm $form, Room $room)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $this->forward404Unless($copyRoom = RoomPeer::retrieveByPk($form->getValue('copyRoom_id')), sprintf('Object room does not exist (%s).', $form->getValue('copyRoom_id')));
         if ($copyRoom->getId() != $room->getId()) {
             $room->copyDayperiodsFromRoom($copyRoom);
             $room->save();
         }
         $this->redirect('dayperiod/index?roomId=' . $room->getId());
     }
 }