/**
  * Allows a user to contact all the people in their event.
  *
  */
 public function contactAction()
 {
     if ($this->_request->isXmlHttpRequest()) {
         $this->_helper->layout->disableLayout();
     } else {
         $this->_helper->pageTitle('workshop-instructor-contact:title');
     }
     $get = Zend_Registry::get('getFilter');
     if (!isset($get->eventId)) {
         throw new Ot_Exception_Input('msg-error-eventIdNotSet');
     }
     $messages = array();
     $event = new Event();
     $eventId = $get->eventId;
     $thisEvent = $event->find($eventId);
     if (is_null($thisEvent)) {
         throw new Ot_Exception_Data('msg-error-noEvent');
     }
     $otAccount = new Ot_Account();
     $thisAccount = $otAccount->find(Zend_Auth::getInstance()->getIdentity()->accountId);
     $status = $event->getStatusOfUserForEvent($thisAccount->accountId, $eventId);
     if ($status != 'instructor' && !$this->_helper->hasAccess('view-all-instructor-pages')) {
         throw new Ot_Exception_Access('msg-error-notInstructor');
     }
     $form = $event->contactForm(array('eventId' => $eventId));
     if ($this->_request->isPost()) {
         if ($form->isValid($_POST)) {
             $recipients = array();
             $attendees = new Event_Attendee();
             $recipients = $attendees->getAttendeesForEvent($thisEvent->eventId, $form->getValue('recipients'));
             if ($form->getValue('emailInstructors')) {
                 $instructor = new Event_Instructor();
                 $instructorList = $instructor->getInstructorsForEvent($thisEvent->eventId);
                 $recipients = array_merge($recipients, $instructorList);
             }
             $this->_checkValidViewer($instructorList);
             $mail = new Zend_Mail();
             $mail->setFrom($thisAccount->emailAddress, $thisAccount->firstName . ' ' . $thisAccount->lastName);
             $mail->setSubject($form->getValue('subject'));
             $mail->setBodyText($form->getValue('message'));
             $mail->addTo($thisAccount->emailAddress);
             foreach ($recipients as $r) {
                 $mail->addBcc($r['emailAddress']);
             }
             $eq = new Ot_Email_Queue();
             $data = array('attributeName' => 'eventId', 'attributeId' => $thisEvent->eventId, 'zendMailObject' => $mail);
             $eq->queueEmail($data);
             //$mail->send();
             $this->_helper->flashMessenger->addMessage('msg-info-emailQueued');
             $this->_redirect('/workshop/instructor/?eventId=' . $thisEvent->eventId);
         } else {
             $messages[] = "msg-error-formSubmitProblem";
         }
     }
     $this->view->messages = $messages;
     $this->view->thisAccount = $thisAccount;
     $this->view->form = $form;
 }