Пример #1
0
 public function getAttendeesForEvent($eventId, $status = 'all', $attended = false)
 {
     $where = $this->getAdapter()->quoteInto('eventId = ?', $eventId);
     if ($status != 'all') {
         $where .= ' AND ' . $this->getAdapter()->quoteInto('status = ?', $status);
     }
     if ($attended) {
         $where .= ' AND ' . $this->getAdapter()->quoteInto('attended = ?', $attended);
     }
     $result = $this->fetchAll($where, 'timestamp ASC')->toArray();
     $accountIds = array();
     foreach ($result as $r) {
         $accountIds[] = $r['accountId'];
     }
     if (count($accountIds) == 0) {
         return array();
     }
     $account = new Ot_Account();
     $where = $account->getAdapter()->quoteInto('accountId IN (?)', $accountIds);
     $accounts = $account->fetchAll($where, array('lastName', 'firstName'))->toArray();
     $accountMap = array();
     foreach ($accounts as $a) {
         $accountMap[$a['accountId']] = $a;
     }
     foreach ($result as &$r) {
         if (!isset($accountMap[$r['accountId']])) {
             $accountMap[$r['accountId']] = array('firstName' => 'Unavailable', 'lastName' => 'Unavailable', 'username' => 'Unavailable');
         }
         $r = array_merge($r, $accountMap[$r['accountId']]);
     }
     return $result;
 }
Пример #2
0
 public function historyAction()
 {
     $account = new Ot_Account();
     $thisAccount = Zend_Auth::getInstance()->getIdentity();
     $get = Zend_Registry::get('getFilter');
     if (isset($get->accountId)) {
         if ($this->_helper->hasAccess('edit-all-reservations', 'workshop_signup')) {
             $thisAccount = $account->find($get->accountId);
         }
         if (is_null($thisAccount)) {
             throw new Ot_Exception_Data('msg-error-accountNotFound');
         }
     }
     if (is_null($thisAccount)) {
         throw new Ot_Exception_Data('msg-error-notLoggedIn');
     }
     $this->view->acl = array('editAllReservations' => $this->_helper->hasAccess('edit-all-reservations', 'workshop_signup'));
     $form = new Zend_Form();
     $form->setAttrib('id', 'accountForm')->setMethod(Zend_Form::METHOD_GET)->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'filterForm')), 'Form'));
     $accountSelect = $form->createElement('select', 'accountId', array('label' => 'default-index-history:viewReservations'));
     $accountSelect->setRequired(false);
     $account = new Ot_Account();
     $accounts = $account->fetchAll(null, array('lastName', 'firstName'));
     foreach ($accounts as $a) {
         $accountSelect->addMultiOption($a->accountId, $a->firstName . ' ' . $a->lastName . ' (' . $a->username . ')');
     }
     $submit = $form->createElement('submit', 'submitButton', array('label' => 'default-index-history:lookup'));
     $submit->setDecorators(array(array('ViewHelper', array('helper' => 'formSubmit'))));
     $form->addElements(array($accountSelect));
     $form->setElementDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'elm')), array('Label', array('tag' => 'span'))))->addElements(array($submit));
     $this->view->form = $form;
     $event = new Event();
     $myEvents = $event->getEventsForUser($thisAccount->accountId);
     $this->view->myEvents = $myEvents['currentEvents'];
     $this->view->myPastEvents = $myEvents['pastEvents'];
     $this->view->account = $thisAccount->toArray();
     $this->view->hideFeature = true;
     $this->_helper->layout->setLayout('my');
     $this->view->messages = $this->_helper->flashMessenger->getMessages();
     $this->view->headScript()->appendFile($this->view->baseUrl() . '/scripts/jquery.autocomplete.js');
     $this->view->headLink()->appendStylesheet($this->view->baseUrl() . '/css/jquery.autocomplete.css');
 }
 public function testAccountForm()
 {
     $account = new Ot_Account();
     $account->form();
 }
Пример #4
0
 /**
  * Allows a user to view the details of a workshop
  *
  */
 public function detailsAction()
 {
     $get = Zend_Registry::get('getFilter');
     if (!isset($get->workshopId)) {
         throw new Ot_Exception_Input('msg-error-workshopIdNotSet');
     }
     $workshop = new Workshop();
     $thisWorkshop = $workshop->find($get->workshopId);
     if (is_null($thisWorkshop)) {
         throw new Ot_Exception_Data('msg-error-noWorkshop');
     }
     $document = new Workshop_Document();
     $this->view->documents = $document->getDocumentsForWorkshop($thisWorkshop->workshopId);
     $tag = new Tag();
     $this->view->tags = $tag->getTagsForAttribute('workshopId', $thisWorkshop->workshopId);
     $event = new Event();
     $events = $event->getEvents($thisWorkshop->workshopId, null, null, time(), null, 'open')->toArray();
     $auth = Zend_Auth::getInstance();
     foreach ($events as &$e) {
         if ($auth->hasIdentity()) {
             $e['status'] = $event->getStatusOfUserForEvent($auth->getIdentity()->accountId, $e['eventId']);
         } else {
             $e['status'] = '';
         }
         $e['workshop'] = $thisWorkshop->toArray();
     }
     $this->view->events = $events;
     $wl = new Workshop_Link();
     $this->view->links = $wl->getLinksForWorkshop($thisWorkshop->workshopId)->toArray();
     $location = new Location();
     $locations = $location->fetchAll();
     $locs = array();
     foreach ($locations as $l) {
         $locs[$l->locationId] = $l->toArray();
     }
     $this->view->locations = $locs;
     $we = new Workshop_Editor();
     $isEditor = false;
     if ($this->_helper->hasAccess('edit-all-workshops')) {
         $isEditor = true;
     } elseif ($auth->hasIdentity()) {
         $isEditor = $we->isEditor($thisWorkshop->workshopId, $auth->getIdentity()->accountId);
     }
     $this->view->acl = array('edit' => $isEditor, 'addDocuments' => $isEditor, 'editDocument' => $isEditor, 'deleteDocument' => $isEditor, 'addLink' => $isEditor, 'deleteLink' => $isEditor, 'editLink' => $isEditor, 'reorderLink' => $isEditor, 'addEvent' => $this->_helper->hasAccess('index', 'workshop_schedule'), 'options' => $this->_helper->hasAccess('options'));
     if ($this->view->acl['edit']) {
         $we = new Workshop_Editor();
         $where = $we->getAdapter()->quoteInto('workshopId = ?', $thisWorkshop->workshopId);
         $results = $we->fetchAll($where);
         $currentEditors = array();
         foreach ($results as $r) {
             $currentEditors[] = $r->accountId;
         }
         if (count($currentEditors) != 0) {
             $account = new Ot_Account();
             $accounts = $account->fetchAll($account->getAdapter()->quoteInto('accountId IN (?)', $currentEditors), array('lastName', 'firstName'));
             $currentEditors = $accounts->toArray();
         }
         $this->view->editors = $currentEditors;
     }
     $category = new Category();
     $thisCategory = $category->find($thisWorkshop->categoryId);
     $this->view->layout()->setLayout('twocolumn');
     $this->view->layout()->rightContent = $this->view->render('index/right.phtml');
     $this->view->messages = $this->_helper->flashMessenger->getMessages();
     $this->view->title = $thisWorkshop->title;
     $this->view->workshop = $thisWorkshop->toArray();
     $this->view->category = $thisCategory;
 }
Пример #5
0
 public function addAttendeeForm($values = array())
 {
     if (!isset($values['eventId'])) {
         throw new Ot_Exception_Input('The event ID must be provided.');
     }
     $form = new Zend_Form();
     $form->setAttrib('id', 'locationForm')->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'zend_form')), 'Form'));
     $eventId = $form->createElement('hidden', 'eventId');
     $eventId->setValue($values['eventId']);
     $eventId->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden'))));
     $form->addElement($eventId);
     $type = $form->createElement('select', 'type', array('label' => 'How to Add:'));
     $type->addMultiOption('firstAvailable', 'First Available Spot')->addMultiOption('attending', 'Add To Attending List')->setValue(isset($values['type']) ? $values['type'] : '');
     // get all the users available for the instructor list
     $otAccount = new Ot_Account();
     $accounts = $otAccount->fetchAll(null, array('lastName', 'firstName'))->toArray();
     $userList = array();
     foreach ($accounts as $a) {
         $userList[$a['accountId']] = $a['lastName'] . ", " . $a['firstName'];
     }
     // remove anyone who's either in the attendee list, waitlist, or an instructor
     // for this event so they can't be added to the list
     $attendee = new Event_Attendee();
     $attendeeList = $attendee->getAttendeesForEvent($values['eventId'], 'attending');
     $waitlist = $attendee->getAttendeesForEvent($values['eventId'], 'waitlist');
     $instructors = $this->getInstructorsForEvent($values['eventId']);
     foreach ($attendeeList as $a) {
         unset($userList[$a['accountId']]);
     }
     foreach ($waitlist as $w) {
         unset($userList[$w['accountId']]);
     }
     foreach ($instructors as $i) {
         unset($userList[$i['accountId']]);
     }
     $users = $form->createElement('multiselect', 'users', array('label' => 'User Search:'));
     $users->setMultiOptions($userList)->setAttrib('size', 10)->setValue(isset($values['accountIds']) ? $values['accountIds'] : '');
     $submit = $form->createElement('submit', 'submitButton', array('label' => 'Submit'));
     $submit->setDecorators(array(array('ViewHelper', array('helper' => 'formSubmit'))));
     $cancel = $form->createElement('button', 'cancel', array('label' => 'Cancel'));
     $cancel->setAttrib('id', 'cancel');
     $cancel->setDecorators(array(array('ViewHelper', array('helper' => 'formButton'))));
     $form->addElements(array($type, $users));
     $form->setElementDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'elm')), array('Label', array('tag' => 'span'))))->addElements(array($submit, $cancel));
     return $form;
 }
Пример #6
0
 /**
  * The main scheduler page.  This allows a user to view and edit the schedule.  Users
  * will almost certainly need access to this entire controller to make the
  * scheduler work properly and look right.
  *
  */
 public function indexAction()
 {
     $this->view->acl = array('addEvent' => $this->_helper->hasAccess('add-event'));
     $get = Zend_Registry::get('getFilter');
     if (isset($get->workshopId)) {
         $workshopId = $get->workshopId;
         $this->view->workshopId = $workshopId;
         $this->view->startInAddMode = 1;
     }
     if (isset($get->startYear)) {
         $this->view->startYear = $get->startYear;
     } else {
         $this->view->startYear = date('Y');
     }
     if (isset($get->startMonth)) {
         $this->view->startMonth = $get->startMonth;
     } else {
         $this->view->startMonth = date('m');
     }
     $eventId = null;
     if (isset($get->eventId)) {
         $eventId = $get->eventId;
         $this->view->eventId = $eventId;
         $this->view->startInEditMode = 1;
         $e = new Event();
         $thisEvent = $e->find($eventId)->toArray();
         $this->view->locationId = $thisEvent['locationId'];
     }
     $zd = new Zend_Date();
     $this->view->workshopLength = mktime(1, 0, 0, 1, 1, 1970);
     $this->view->startTime = mktime(0, 0, 0, 1, 1, 1970);
     $this->view->endTime = mktime(23, 30, 0, 1, 1, 1970);
     $this->view->baseTime = mktime(0, 0, 0, 1, 1, 1970);
     $this->view->today = $zd->get(Zend_Date::MONTH) . "/" . $zd->get(Zend_Date::DAY) . "/" . $zd->get(Zend_Date::YEAR);
     $this->view->thisYear = $zd->get(Zend_Date::YEAR);
     $this->view->thisWeek = $zd->get(Zend_Date::WEEK);
     if (!is_null($eventId)) {
         $tmpDate = explode('-', $thisEvent['date']);
         $zd->setYear($tmpDate[0]);
         $zd->setMonth($tmpDate[1]);
         $zd->setDay($tmpDate[2]);
     }
     $this->view->year = $zd->get(Zend_Date::YEAR);
     $this->view->week = $zd->get(Zend_Date::WEEK);
     $this->_helper->pageTitle('workshop-schedule-index:title');
     $workshop = new Workshop();
     $where = $workshop->getAdapter()->quoteInto('status = ?', 'enabled');
     $workshops = $workshop->fetchAll($where, 'title');
     $workshopList = array();
     $workshopList[0] = "";
     foreach ($workshops as $w) {
         $workshopList[$w->workshopId] = $w->title;
     }
     $this->view->workshops = $workshopList;
     $location = new Location();
     $where = $location->getAdapter()->quoteInto('status = ?', 'enabled');
     $locations = $location->fetchAll($where, 'name');
     if (count($locations) == 0) {
         $this->_helper->redirector->gotoUrl('/workshop/schedule/noLocationsFound');
     }
     foreach ($locations as $l) {
         $locationList[$l->locationId] = $l->name;
     }
     $this->view->locationList = $locationList;
     //get all the users available for the instructor list
     $profile = new Ot_Account();
     $profiles = $profile->fetchAll(null, array('lastName', 'firstName'))->toArray();
     $instructors = array();
     foreach ($profiles as $p) {
         $instructors[$p['username']] = $p['lastName'] . ", " . $p['firstName'];
     }
     $this->view->messages = $this->_helper->flashMessenger->getMessages();
     $this->view->instructors = $instructors;
     $this->view->headScript()->appendFile($this->view->baseUrl() . '/public/scripts/jMonthCalendar-1.1.0.js');
     //$this->view->headScript()->appendFile($this->view->baseUrl() . '/scripts/jMonthCalendar-1.2.2.js');
     $this->view->headScript()->appendFile($this->view->baseUrl() . '/public/scripts/jquery.bt.min.js');
 }
Пример #7
0
 /**
  * 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;
 }
Пример #8
0
 public function rollForm($values = array())
 {
     if (!isset($values['eventId'])) {
         throw new Ot_Exception_Data('Event ID must be provided');
     }
     $form = new Zend_Form();
     $form->setAttrib('id', 'rollForm')->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'zend_form')), 'Form'));
     $attendee = new Event_Attendee();
     $attendees = $attendee->getAttendeesForEvent($values['eventId'], 'attending');
     $otAccount = new Ot_Account();
     $attendeeList = array();
     foreach ($attendees as $a) {
         $thisAccount = $otAccount->find($a['accountId']);
         if (!is_null($thisAccount)) {
             $attendeeList[$a['accountId']] = $thisAccount->firstName . ' ' . $thisAccount->lastName . ' (' . $thisAccount->username . ')';
         }
     }
     $attendeeElement = $form->createElement('multiCheckbox', 'attendees');
     $attendeeElement->setMultiOptions($attendeeList)->setValue(isset($values['attendees']) ? $values['attendees'] : '');
     $submit = $form->createElement('submit', 'submitButton', array('label' => 'Submit'));
     $submit->setDecorators(array(array('ViewHelper', array('helper' => 'formSubmit'))));
     $cancel = $form->createElement('button', 'cancel', array('label' => 'Cancel'));
     $cancel->setAttrib('id', 'cancel');
     $cancel->setDecorators(array(array('ViewHelper', array('helper' => 'formButton'))));
     $form->addElements(array($attendeeElement));
     $form->setElementDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'elm')), array('Label', array('tag' => 'span'))))->addElements(array($submit, $cancel));
     $eventId = $form->createElement('hidden', 'eventId');
     $eventId->setValue($values['eventId']);
     $eventId->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden'))));
     $form->addElement($eventId);
     return $form;
 }
Пример #9
0
 /**
  * Gets the form for adding and editing a location
  *
  * @param array $values
  * @return Zend_Form
  */
 public function form($values = array())
 {
     require_once APPLICATION_PATH . '/models/Workshop/Category.php';
     $form = new Zend_Form();
     $form->setAttrib('id', 'workshopForm')->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'zend_form')), 'Form'));
     $title = $form->createElement('text', 'title', array('label' => 'Workshop Title:'));
     $title->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->setAttrib('maxlength', '255')->setValue(isset($values['title']) ? $values['title'] : '');
     $group = $form->createElement('select', 'group', array('label' => 'Offered By:'));
     $group->addMultiOption('groupId1', 'Test Group1');
     $group->addMultiOption('groupId2', 'Test Group2');
     $group->setValue(isset($values['group']) ? $values['group'] : null);
     //TODO: change this to add all the enabled groups in the database
     $tags = $form->createElement('text', 'tags', array('label' => 'Tags:'));
     $tags->setRequired(false)->addFilter('StringTrim')->addFilter('StripTags')->setValue(isset($values['tags']) ? implode(', ', $values['tags']) : '');
     $status = $form->createElement('select', 'status', array('label' => 'Status:'));
     $status->addMultiOption('enabled', 'Enabled');
     $status->addMultiOption('disabled', 'Disabled');
     $status->setValue(isset($values['status']) ? $values['status'] : 'enabled');
     $category = new Category();
     $categoryList = $category->fetchAll(null, 'name');
     $categories = $form->createElement('select', 'categoryId', array('label' => 'Worshop Category: '));
     $categories->setRequired(true);
     foreach ($categoryList as $category) {
         $categories->addMultiOption($category->categoryId, $category->name);
     }
     $categories->setValue(isset($values['categoryId']) ? $values['categoryId'] : '');
     $prerequisites = $form->createElement('textarea', 'prerequisites', array('label' => 'workshop-index-add:preRequisites'));
     $prerequisites->setRequired(false)->addFilter('StringTrim')->setAttrib('style', 'width: 95%; height: 200px;')->setValue(isset($values['prerequisites']) ? $values['prerequisites'] : '');
     $featured = $form->createElement('checkbox', 'features', array('label' => 'Featured?'));
     $featured->setValue(isset($values['featured']) ? $values['featured'] : null);
     $description = $form->createElement('textarea', 'description', array('label' => 'Description:'));
     $description->setRequired(false)->addFilter('StringTrim')->setAttrib('style', 'width: 95%; height: 200px;')->setValue(isset($values['description']) ? $values['description'] : '');
     $editors = $form->createElement('multiselect', 'editors', array('label' => 'Workshop Editors:'));
     $editors->setRequired(false)->setAttrib('size', '10');
     $account = new Ot_Account();
     $accounts = $account->fetchAll(null, array('lastName', 'firstName'));
     foreach ($accounts as $a) {
         $editors->addMultiOption($a->accountId, $a->firstName . ' ' . $a->lastName . ' (' . $a->username . ')');
     }
     $editors->setValue(isset($values['editors']) ? $values['editors'] : '');
     $submit = $form->createElement('submit', 'submitButton', array('label' => 'Submit'));
     $submit->setDecorators(array(array('ViewHelper', array('helper' => 'formSubmit'))));
     $cancel = $form->createElement('button', 'cancel', array('label' => 'Cancel'));
     $cancel->setAttrib('id', 'cancel');
     $cancel->setDecorators(array(array('ViewHelper', array('helper' => 'formButton'))));
     $form->addElements(array($status, $title, $categories, $group, $tags, $description, $prerequisites, $editors));
     $form->setElementDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'elm')), array('Label', array('tag' => 'span'))))->addElements(array($submit, $cancel));
     if (isset($values['workshopId'])) {
         $workshopId = $form->createElement('hidden', 'workshopId');
         $workshopId->setValue($values['workshopId']);
         $workshopId->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden'))));
         $form->addElement($workshopId);
     }
     return $form;
 }
Пример #10
0
 /**
  * Allows a user to cancel their reservation for an event.
  *
  */
 public function cancelAction()
 {
     $get = Zend_Registry::get('getFilter');
     if (!isset($get->eventId)) {
         throw new Ot_Exception_Input('msg-error-eventIdNotSet');
     }
     $event = new Event();
     $location = new Location();
     $workshop = new Workshop();
     $instructor = new Event_Instructor();
     $attendee = new Event_Attendee();
     $thisEvent = $event->find($get->eventId);
     if (is_null($thisEvent)) {
         throw new Ot_Exception_Data('msg-error-noEvent');
     }
     $this->view->event = $thisEvent->toArray();
     $status = $event->getStatusOfUserForEvent(Zend_Auth::getInstance()->getIdentity()->accountId, $thisEvent->eventId);
     if ($status != 'waitlist' && $status != 'attending') {
         throw new Ot_Exception_Data('msg-error-notAttending');
     }
     $this->view->status = $status;
     $this->view->reservationCancelable = $event->isReservationCancelable($thisEvent->eventId);
     $thisLocation = $location->find($thisEvent->locationId);
     if (is_null($thisLocation)) {
         throw new Ot_Exception_Data('msg-error-noLocation');
     }
     $this->view->location = $thisLocation->toArray();
     $thisWorkshop = $workshop->find($thisEvent->workshopId);
     if (is_null($thisWorkshop)) {
         throw new Ot_Exception_Data('msg-error-noWorkshop');
     }
     $this->view->workshop = $thisWorkshop->toArray();
     $instructors = $instructor->getInstructorsForEvent($thisEvent->eventId);
     $inst = array();
     foreach ($instructors as $i) {
         $inst[] = $i['firstName'] . ' ' . $i['lastName'];
     }
     $this->view->instructors = $inst;
     $events = $event->getEvents($thisWorkshop->workshopId, null, null, time(), null, 'open')->toArray();
     $newEvents = array();
     foreach ($events as $e) {
         if ($e['eventId'] != $thisEvent->eventId) {
             $e['status'] = $event->getStatusOfUserForEvent(Zend_Auth::getInstance()->getIdentity()->accountId, $e['eventId']);
             $e['workshop'] = $thisWorkshop->toArray();
             $newEvents[] = $e;
         }
     }
     $this->view->events = $newEvents;
     $form = Ot_Form_Template::delete('cancelReservation', 'workshop-signup-cancel:cancel', 'workshop-signup-cancel:keep');
     if ($this->_request->isPost() && $form->isValid($_POST)) {
         $instructorNames = array();
         $instructorEmails = array();
         foreach ($instructors as $i) {
             $instructorNames[] = $i['firstName'] . ' ' . $i['lastName'];
             $instructorEmails[] = $i['emailAddress'];
         }
         $attendee->cancelReservation(Zend_Auth::getInstance()->getIdentity()->accountId, $thisEvent->eventId);
         $startDt = strtotime($thisEvent->date . ' ' . $thisEvent->startTime);
         $endDt = strtotime($thisEvent->date . ' ' . $thisEvent->endTime);
         $data = array('workshopName' => $thisWorkshop->title, 'workshopDate' => date('m/d/Y', $startDt), 'workshopStartTime' => date('g:i a', $startDt), 'workshopEndTime' => date('g:i a', $endDt), 'workshopMinimumEnrollment' => $thisEvent->minSize, 'locationName' => $thisLocation->name, 'locationAddress' => $thisLocation->address, 'instructorNames' => implode(', ', $instructorNames), 'instructorEmails' => implode(', ', $instructorEmails), 'studentEmail' => Zend_Auth::getInstance()->getIdentity()->emailAddress, 'studentName' => Zend_Auth::getInstance()->getIdentity()->firstName . ' ' . Zend_Auth::getInstance()->getIdentity()->lastName, 'studentUsername' => Zend_Auth::getInstance()->getIdentity()->username);
         $this->_helper->flashMessenger->addMessage($this->view->translate('msg-info-canceled', $thisWorkshop->title));
         $trigger = new Ot_Trigger();
         $trigger->setVariables($data);
         $trigger->dispatch('Event_Cancel_Reservation');
         $account = new Ot_Account();
         if ($status != 'waitlist') {
             $waiting = $attendee->getAttendeesForEvent($thisEvent->eventId, 'waitlist');
             if (count($waiting) != 0) {
                 $newAccount = $account->find($waiting[0]['accountId']);
                 if (!is_null($newAccount)) {
                     $attendee->makeReservation($newAccount->accountId, $thisEvent->eventId);
                     $data['studentEmail'] = $newAccount->emailAddress;
                     $data['studentName'] = $newAccount->firstName . ' ' . $newAccount->lastName;
                     $data['studentUsername'] = $newAccount->username;
                     $trigger = new Ot_Trigger();
                     $trigger->setVariables($data);
                     $trigger->dispatch('Event_Waitlist_To_Attending');
                 }
             }
         }
         $this->_redirect('/');
     }
     $this->view->form = $form;
     $this->view->layout()->setLayout('twocolumn');
     $this->view->layout()->rightContent = $this->view->render('signup/right.phtml');
 }