Example #1
0
 public function executeViewEmail(sfWebRequest $request)
 {
     sfConfig::set('sf_web_debug', false);
     $this->setLayout(false);
     $reservation_id = $request->getParameter('id');
     $template = $request->getParameter('template');
     $type = $request->getParameter('type');
     $reservation = Doctrine::getTable('Reservation')->find($reservation_id);
     //	  $url = sprintf('http://%s/access/%s',
     //  	  sfConfig::get('app_domain_name', $_SERVER['SERVER_NAME']),
     //  	  Encryption::encodeUrl('reservation', 'access', array(
     //  	    'user_id' => $reservation->Client->User->id,
     //  	    'uniqid'  => $reservation->uniqid
     //  	  ))
     //	  );
     $url = sprintf('http://%s/access/%s', sfConfig::get('app_domain_name', $_SERVER['SERVER_NAME']), Encryption::getEncryptedUrlFromUri('@reservation_show?uniqid=' . $reservation->uniqid, $reservation->Client->User->id));
     $data['reservation'] = $reservation;
     $data['url'] = $url;
     $data['subject'] = 'Subject';
     $filename = $template . '_' . $type;
     $message = new esEmailMessage('Test Email');
     $message->setFrom(sfConfig::get('app_email_from'));
     $message->setTo('*****@*****.**');
     $message->setAutoEmbedImages(false);
     $message->setBodyFromTemplate($this->getController(), 'reservation', $filename, $data, $type == 'html' ? 'email_layout' : 'none');
     return $this->renderText($message->getBody());
 }
 public static function handleEvent(sfEvent $event)
 {
     $reservation = $event->getSubject();
     switch ($event->getName()) {
         case 'reservation.pre_update':
             break;
         case 'reservation.post_update':
             break;
         case 'reservation.created':
             $url = Encryption::getEncryptedUrlFromUri('@reservation_show?uniqid=' . $reservation->uniqid, $reservation->Client->User->id);
             if ($reservation->Client->email_confirmed) {
                 $subject = 'ATC: Reservation Confirmation #' . $reservation->uniqid;
                 $template = 'confirm_reservation';
             } else {
                 $subject = 'ATC: please confirm your reservation';
                 $template = 'request_confirmation';
             }
             $data = array('email_address' => $reservation->Client->email_address, 'subject' => $subject, 'url' => $url, 'reservation' => $reservation);
             self::sendNotification($template, $data);
             break;
     }
 }
 public function executeTest(sfWebRequest $request)
 {
     $this->url = Encryption::getEncryptedUrlFromUri('@encryption_test1?param1=12345');
 }
Example #4
0
 public function executeShow(sfWebRequest $request)
 {
     $this->forward404Unless($this->reservation = Doctrine_Core::getTable('Reservation')->find(array($request->getParameter('id'))), sprintf('Object reservation does not exist (%s).', $request->getParameter('id')));
     $this->transactions = $this->reservation->PaypalTransactions;
     $this->reservationUrl = Encryption::getEncryptedUrlFromUri('@reservation_show?uniqid=' . $this->reservation->uniqid, $this->reservation->Client->User->id, false);
 }