コード例 #1
0
 public function execute($lastRunDt = null)
 {
     $config = Zend_Registry::get('config');
     $checkDtStart = new Zend_Date($this->_lastRunDt);
     $checkDtStart->subHour($config->user->numHoursEvaluationReminder->val);
     $checkDtEnd = new Zend_Date();
     $checkDtEnd->subHour($config->user->numHoursEvaluationReminder->val);
     $event = new Event();
     $events = $event->getEvents(null, null, null, $checkDtStart->getTimestamp(), $checkDtEnd->getTimestamp(), 'open');
     $location = new Location();
     $workshop = new Workshop();
     $instructor = new Event_Instructor();
     $attendee = new Event_Attendee();
     $eu = new Evaluation_User();
     foreach ($events as $e) {
         $startDt = strtotime($e->date . ' ' . $e->startTime);
         $endDt = strtotime($e->date . ' ' . $e->endTime);
         if ($checkDtStart->getTimestamp() < $endDt && $checkDtEnd->getTimestamp() >= $endDt) {
             $evalAvailableDt = new Zend_Date($endDt);
             $evalAvailableDt->addHour($config->user->numHoursEvaluationAvailability->val);
             if ($evalAvailableDt->getTimestamp() > time()) {
                 $taken = $eu->getCompleted($e->eventId);
                 $thisLocation = $location->find($e->locationId);
                 if (is_null($thisLocation)) {
                     throw new Ot_Exception_Data('msg-error-noLocation');
                 }
                 $thisWorkshop = $workshop->find($e->workshopId);
                 if (is_null($thisWorkshop)) {
                     throw new Ot_Exception_Data('msg-error-noWorkshop');
                 }
                 $instructors = $instructor->getInstructorsForEvent($e->eventId);
                 $instructorNames = array();
                 $instructorEmails = array();
                 foreach ($instructors as $i) {
                     $instructorNames[] = $i['firstName'] . ' ' . $i['lastName'];
                     $instructorEmails[] = $i['emailAddress'];
                 }
                 $data = array('workshopName' => $thisWorkshop->title, 'workshopDate' => date('m/d/Y', $startDt), 'workshopStartTime' => date('g:i a', $startDt), 'workshopEndTime' => date('g:i a', $endDt), 'workshopMinimumEnrollment' => $e->minSize, 'workshopCurrentEnrollment' => $e->roleSize, 'locationName' => $thisLocation->name, 'locationAddress' => $thisLocation->address, 'instructorNames' => implode(', ', $instructorNames), 'instructorEmails' => implode(', ', $instructorEmails));
                 $attending = $attendee->getAttendeesForEvent($e->eventId, 'attending');
                 foreach ($attending as $a) {
                     if ($a['attended'] == 1 && !in_array($a['accountId'], $taken)) {
                         $trigger = new Ot_Trigger();
                         $trigger->setVariables($data);
                         $trigger->accountId = $a['accountId'];
                         $trigger->studentEmail = $a['emailAddress'];
                         $trigger->studentName = $a['firstName'] . ' ' . $a['lastName'];
                         $trigger->studentUsername = $a['username'];
                         $trigger->dispatch('Event_Evaluation_Reminder');
                     }
                 }
             }
         }
     }
 }
コード例 #2
0
 public function execute($lastRunDt = null)
 {
     $config = Zend_Registry::get('config');
     $event = new Event();
     $events = $event->getEvents(null, null, null, time(), null, 'open');
     $location = new Location();
     $workshop = new Workshop();
     $instructor = new Event_Instructor();
     $checkDt = new Zend_Date($this->_lastRunDt);
     $checkDt->addHour($config->user->numHoursLowAttendanceNotification->val);
     foreach ($events as $e) {
         if ($e->roleSize < $e->minSize) {
             $startDt = strtotime($e->date . ' ' . $e->startTime);
             $endDt = strtotime($e->date . ' ' . $e->endTime);
             if ($checkDt->getTimestamp() > $startDt && $this->_lastRunDt < $startDt) {
                 $thisLocation = $location->find($e->locationId);
                 if (is_null($thisLocation)) {
                     throw new Ot_Exception_Data('msg-error-noLocation');
                 }
                 $thisWorkshop = $workshop->find($e->workshopId);
                 if (is_null($thisWorkshop)) {
                     throw new Ot_Exception_Data('msg-error-noWorkshop');
                 }
                 $instructors = $instructor->getInstructorsForEvent($e->eventId);
                 $instructorNames = array();
                 $instructorEmails = array();
                 foreach ($instructors as $i) {
                     $instructorNames[] = $i['firstName'] . ' ' . $i['lastName'];
                     $instructorEmails[] = $i['emailAddress'];
                 }
                 $data = array('workshopName' => $thisWorkshop->title, 'workshopDate' => date('m/d/Y', $startDt), 'workshopStartTime' => date('g:i a', $startDt), 'workshopEndTime' => date('g:i a', $endDt), 'workshopMinimumEnrollment' => $e->minSize, 'workshopCurrentEnrollment' => $e->roleSize, 'locationName' => $thisLocation->name, 'locationAddress' => $thisLocation->address, 'instructorNames' => implode(', ', $instructorNames), 'instructorEmails' => implode(', ', $instructorEmails));
                 $trigger = new Ot_Trigger();
                 $trigger->setVariables($data);
                 $trigger->dispatch('Event_LowAttendance');
             }
         }
     }
 }
コード例 #3
0
 public function execute($lastRunDt = null)
 {
     $config = Zend_Registry::get('config');
     $event = new Event();
     $events = $event->getEvents(null, null, null, time(), null, 'open');
     $location = new Location();
     $workshop = new Workshop();
     $instructor = new Event_Instructor();
     $attendees = new Event_Attendee();
     $lastRunDt = new Zend_Date($this->_lastRunDt);
     $currentDt = new Zend_Date();
     foreach ($events as $e) {
         $startDt = strtotime($e->date . ' ' . $e->startTime);
         $endDt = strtotime($e->date . ' ' . $e->endTime);
         $firstDt = new Zend_Date($startDt);
         $firstDt->subHour($config->user->numHoursFirstReminder->val);
         $finalDt = new Zend_Date($startDt);
         $finalDt->subHour($config->user->numHoursFinalReminder->val);
         $notification = null;
         if ($firstDt->getTimestamp() > $lastRunDt->getTimestamp() && $firstDt->getTimestamp() < $currentDt->getTimestamp()) {
             $notification = 'first';
         }
         if ($finalDt->getTimestamp() > $lastRunDt->getTimestamp() && $finalDt->getTimestamp() < $currentDt->getTimestamp()) {
             $notification = 'final';
         }
         if (!is_null($notification)) {
             $thisLocation = $location->find($e->locationId);
             if (is_null($thisLocation)) {
                 throw new Ot_Exception_Data('msg-error-noLocation');
             }
             $thisWorkshop = $workshop->find($e->workshopId);
             if (is_null($thisWorkshop)) {
                 throw new Ot_Exception_Data('msg-error-noWorkshop');
             }
             $instructors = $instructor->getInstructorsForEvent($e->eventId);
             $instructorNames = array();
             $instructorEmails = array();
             foreach ($instructors as $i) {
                 $instructorNames[] = $i['firstName'] . ' ' . $i['lastName'];
                 $instructorEmails[] = $i['emailAddress'];
             }
             $data = array('workshopName' => $thisWorkshop->title, 'workshopDate' => date('m/d/Y', $startDt), 'workshopStartTime' => date('g:i a', $startDt), 'workshopEndTime' => date('g:i a', $endDt), 'workshopMinimumEnrollment' => $e->minSize, 'workshopCurrentEnrollment' => $e->roleSize, 'locationName' => $thisLocation->name, 'locationAddress' => $thisLocation->address, 'instructorNames' => implode(', ', $instructorNames), 'instructorEmails' => implode(', ', $instructorEmails));
             $attending = $attendees->getAttendeesForEvent($e->eventId, 'attending');
             foreach ($attending as $a) {
                 $trigger = new Ot_Trigger();
                 $trigger->setVariables($data);
                 $trigger->accountId = $a['accountId'];
                 $trigger->studentEmail = $a['emailAddress'];
                 $trigger->studentName = $a['firstName'] . ' ' . $a['lastName'];
                 if ($notification == 'final') {
                     $trigger->dispatch('Event_Attendee_Final_Reminder');
                 } else {
                     $trigger->dispatch('Event_Attendee_First_Reminder');
                 }
             }
             $trigger = new Ot_Trigger();
             $trigger->setVariables($data);
             if ($notification == 'final') {
                 $trigger->dispatch('Event_Instructor_Final_Reminder');
             } else {
                 $trigger->dispatch('Event_Instructor_First_Reminder');
             }
         }
     }
 }
コード例 #4
0
 /**
  * Handles the evaluation for an event.  Shows the user the evaluation and
  * saves the data from the evaluation.
  *
  */
 public function indexAction()
 {
     $get = Zend_Registry::get('getFilter');
     if (!isset($get->eventId)) {
         throw new Ot_Exception_Input('msg-error-eventIdNotSet');
     }
     $event = new Event();
     $eu = new Evaluation_User();
     $evaluation = new Evaluation();
     $thisEvent = $event->find($get->eventId);
     if (is_null($thisEvent)) {
         throw new Ot_Exception_Data('msg-error-noEvent');
     }
     $this->view->event = $thisEvent->toArray();
     $thisAccount = Zend_Auth::getInstance()->getIdentity();
     $status = $event->getStatusOfUserForEvent($thisAccount->accountId, $thisEvent->eventId);
     if ($status == "instructor") {
         throw new Ot_Exception_Access('msg-error-cannotEval');
     }
     if ($status != "attending") {
         throw new Ot_Exception_Access('msg-error-notAttended');
     }
     $config = Zend_Registry::get('config');
     $endDt = strtotime($thisEvent->date . " " . $thisEvent->endTime);
     if (time() > $endDt + $config->user->numHoursEvaluationAvailability->val * 3600) {
         throw new Ot_Exception_Access('msg-error-evalEnded');
     }
     if ($eu->hasCompleted($thisAccount->accountId, $thisEvent->eventId)) {
         throw new Ot_Exception_Access('msg-error-alreadyEval');
     }
     $workshop = new Workshop();
     $thisWorkshop = $workshop->find($thisEvent->workshopId);
     if (is_null($thisWorkshop)) {
         throw new Ot_Exception_Data('msg-error-noWorkshop');
     }
     $this->view->workshop = $thisWorkshop->toArray();
     $instructor = new Event_Instructor();
     $instructors = $instructor->getInstructorsForEvent($thisEvent->eventId);
     $inst = array();
     foreach ($instructors as $i) {
         $inst[] = $i['firstName'] . ' ' . $i['lastName'];
     }
     $this->view->instructors = $inst;
     // lookup the location of the event
     $location = new Location();
     $thisLocation = $location->find($thisEvent->locationId);
     if (is_null($thisLocation)) {
         throw new Ot_Exception_Data('msg-error-noLocation');
     }
     $this->view->location = $thisLocation->toArray();
     if ($thisEvent->evaluationType == 'custom') {
         $form = $evaluation->form();
         $this->view->form = $form;
     }
     if ($this->_request->isPost()) {
         if ($thisEvent->evaluationType == 'custom') {
             if ($form->isValid($_POST)) {
                 $custom = new Ot_Custom();
                 $attributes = $custom->getAttributesForObject('evaluations');
                 $data = array();
                 foreach ($attributes as $a) {
                     $data[$a['attributeId']] = is_null($form->getValue('custom_' . $a['attributeId'])) ? '' : $form->getValue('custom_' . $a['attributeId']);
                 }
                 // custom attributes is the custom array that will be save by the CustomAttributes model
                 $evaluation->saveEvaluation($thisEvent->eventId, $thisAccount->accountId, $data);
                 $this->_helper->flashMessenger->addMessage('msg-info-evalThanks');
                 $this->_redirect('/');
             }
         } elseif ($thisEvent->evaluationType == 'google' && isset($_POST['googleSubmit'])) {
             $eu = new Evaluation_User();
             $dba = $eu->getAdapter();
             $dba->beginTransaction();
             $data = array('eventId' => $get->eventId, 'accountId' => $thisAccount->accountId);
             try {
                 $eu->insert($data);
             } catch (Exception $e) {
                 $dba->rollBack();
                 throw $e;
             }
             $dba->commit();
             $this->_helper->flashMessenger->addMessage('msg-info-evalThanks');
             $this->_redirect('/');
         }
     }
     if ($thisEvent->evaluationType == 'google') {
         $evaluationKeys = new Evaluation_Key();
         $keys = $evaluationKeys->find($get->eventId);
         if (is_null($keys)) {
             throw new Ot_Exception_Data('msg-error-noFormKey');
         }
         $this->view->keys = $keys->toArray();
     }
     $this->_helper->pageTitle('workshop-evaluate-index:title');
 }
コード例 #5
0
 /**
  * Allows a user to cancel an event 
  * 
  */
 public function cancelEventAction()
 {
     $get = Zend_Registry::get('getFilter');
     if (!isset($get->eventId)) {
         throw new Ot_Exception_Input('msg-error-eventIdNotSet');
     }
     $workshop = new Workshop();
     $event = new Event();
     $location = new Location();
     $thisEvent = $event->find($get->eventId);
     if (is_null($thisEvent)) {
         throw new Ot_Exception_Data('msg-error-noEvent');
     }
     $i = new Event_Instructor();
     $where = $i->getAdapter()->quoteInto('eventId = ?', $get->eventId);
     $results = $i->fetchAll($where);
     $currentInstructors = array();
     foreach ($results as $r) {
         $currentInstructors[] = $r->accountId;
     }
     if (!$this->_helper->hasAccess('view-all-instructor-pages') && !in_array(Zend_Auth::getInstance()->getIdentity()->accountId, $currentInstructors)) {
         throw new Ot_Exception_Access('msg-error-noWorkshopAccess');
     }
     $thisEvent = $thisEvent->toArray();
     $thisEvent['startTime'] = strftime('%l:%M %p', strtotime($thisEvent['startTime']));
     $thisEvent['endTime'] = strftime('%l:%M %p', strtotime($thisEvent['endTime']));
     $thisEvent['location'] = $location->find($thisEvent['locationId'])->toArray();
     $thisEvent['workshop'] = $workshop->find($thisEvent['workshopId'])->toArray();
     $this->view->event = $thisEvent;
     $form = Ot_Form_Template::delete('eventDelete', 'workshop-schedule-cancelEvent:cancel');
     if ($this->_request->isPost() && $form->isValid($_POST)) {
         $dba = $event->getAdapter();
         $dba->beginTransaction();
         $where = $dba->quoteInto('eventId = ?', $get->eventId);
         $data = array('status' => 'canceled');
         try {
             $result = $event->update($data, $where);
         } catch (Exception $e) {
             $dba->rollback();
             throw $e;
         }
         $attendee = new Event_Attendee();
         try {
             $attendee->update($data, $where);
         } catch (Exception $e) {
             $dba->rollback();
             throw $e;
         }
         $dba->commit();
         $this->_helper->flashMessenger->addMessage('msg-info-eventCanceled');
         $date = explode('-', $thisEvent['date']);
         $this->_helper->redirector->gotoUrl('/workshop/schedule?startYear=' . $date[0] . '&startMonth=' . (int) $date[1]);
     }
     $this->_helper->pageTitle('workshop-schedule-cancelEvent:title');
     $this->view->form = $form;
 }
コード例 #6
0
 /**
  * Displays the results of an evaluation as long as the user requesting the
  * page is an instructor of the event.
  *
  */
 public function evaluationResultsAction()
 {
     $get = Zend_Registry::get('getFilter');
     if (!isset($get->eventId)) {
         throw new Ot_Exception_Input('msg-error-eventIdNotSet');
     }
     $event = new Event();
     $thisEvent = $event->find($get->eventId);
     if (is_null($thisEvent)) {
         throw new Ot_Exception_Data('msg-error-noEvent');
     }
     $this->view->event = $thisEvent->toArray();
     $workshop = new Workshop();
     $thisWorkshop = $workshop->find($thisEvent->workshopId);
     if (is_null($thisWorkshop)) {
         throw new Ot_Exception_Data('msg-error-noWorkshop');
     }
     $this->view->workshop = $thisWorkshop->toArray();
     $location = new Location();
     $thisLocation = $location->find($thisEvent->locationId);
     if (is_null($thisLocation)) {
         throw new Ot_Exception_Data('msg-error-noLocation');
     }
     $this->view->location = $thisLocation->toArray();
     $instructor = new Event_Instructor();
     $instructors = $instructor->getInstructorsForEvent($thisEvent->eventId);
     $instructorList = array();
     foreach ($instructors as $i) {
         $instructorList[] = $i['firstName'] . ' ' . $i['lastName'];
     }
     $this->view->instructors = $instructorList;
     $this->_checkValidViewer($instructors);
     if ($thisEvent['evaluationType'] == 'custom') {
         // get the evaluationId from the eventId
         $evaluation = new Evaluation();
         $where = $evaluation->getAdapter()->quoteInto('eventId = ?', $thisEvent->eventId);
         $evaluations = $evaluation->fetchAll($where);
         if ($evaluations->count() == 0) {
             $this->view->noEvaluationsYet = true;
         }
         $this->view->totalEvaluations = $evaluations->count();
         $ca = new Ot_Custom();
         $questions = $ca->getAttributesForObject('evaluations');
         foreach ($questions as &$q) {
             $q['options'] = $ca->convertOptionsToArray($q['options']);
             $answers = array();
             foreach ($evaluations as $e) {
                 $tmpAnswers = $ca->getData($q['objectId'], $e->evaluationId);
                 $tmp = array();
                 foreach ($tmpAnswers as $ta) {
                     $tmp[$ta['attribute']['attributeId']] = $ta['value'];
                 }
                 $answers[] = $tmp;
             }
             if ($q['type'] == 'ranking' || $q['type'] == 'select' || $q['type'] == 'radio') {
                 foreach ($q['options'] as $value) {
                     $answerCount = 0;
                     foreach ($answers as $a) {
                         if ($a[$q['attributeId']] == $value) {
                             $answerCount++;
                         }
                     }
                     $q['results'][] = array('answerLabel' => $value, 'answerCount' => $answerCount);
                 }
             } else {
                 foreach ($answers as $a) {
                     $q['results'][] = $a[$q['attributeId']];
                 }
             }
         }
         $this->view->evaluationResults = $questions;
     } elseif ($thisEvent['evaluationType'] == 'google') {
         $evaluationKeys = new Evaluation_Key();
         $keys = $evaluationKeys->find($get->eventId);
         if (is_null($keys)) {
             throw new Ot_Exception_Data('msg-error-noFormKey');
         }
         $this->view->keys = $keys->toArray();
     }
     $this->view->headScript()->appendFile($this->view->baseUrl() . '/scripts/jquery.gchart.min.js');
 }
コード例 #7
0
ファイル: Event.php プロジェクト: ncsuwebdev/classmate
 public function getEventsForUser($accountId)
 {
     $config = Zend_Registry::get('config');
     $attendee = new Event_Attendee();
     $instructor = new Event_Instructor();
     $location = new Location();
     $document = new Workshop_Document();
     $account = new Ot_Account();
     $eu = new Evaluation_User();
     $stayOpen = new Zend_Date();
     $stayOpen->subHour($config->user->numHoursEvaluationAvailability->val);
     $locationCache = array();
     $reservations = $attendee->getEventsForAttendee($accountId);
     $time = time();
     foreach ($reservations as &$r) {
         $r['active'] = false;
         // we determine if the class is open
         $startDt = new Zend_Date(strtotime($r['date'] . ' ' . $r['startTime']));
         $endDt = new Zend_Date(strtotime($r['date'] . ' ' . $r['endTime']));
         $endDt->addHour($config->user->numHoursEvaluationAvailability->val);
         $r['evaluatable'] = $this->isEvaluatable($r['eventId']);
         // checks to see if its possible that the class is open for evaluation
         if ($r['evaluatable'] && !$eu->hasCompleted($accountId, $r['eventId'])) {
             $r['active'] = true;
         } elseif ($startDt->getTimestamp() > $time) {
             $r['active'] = true;
         }
         $r = array_merge(array('startDt' => $startDt->getTimestamp()), $r);
         $r['hasHandouts'] = false;
         $documents = $document->getDocumentsForWorkshop($r['workshopId']);
         if (count($documents) > 0) {
             $r['hasHandouts'] = true;
         }
         $r['cancelable'] = false;
         if ($r['active']) {
             $startDt->subHour($config->user->numHoursEventCancel->val);
             $r['cancelable'] = $startDt->getTimestamp() > $time;
             if ($r['status'] == 'waitlist') {
                 $waiting = $attendee->getAttendeesForEvent($r['eventId'], 'waitlist');
                 $position = 1;
                 foreach ($waiting as $w) {
                     if ($accountId == $w['accountId']) {
                         break;
                     }
                     $position++;
                 }
                 $r['waitlistPosition'] = $position;
             }
         }
     }
     // Get presently taught classes
     $teaching = $instructor->getEventsForInstructor($accountId);
     foreach ($teaching as &$t) {
         $startDt = new Zend_Date(strtotime($t['date'] . ' ' . $t['startTime']));
         $endDt = new Zend_Date(strtotime($t['date'] . ' ' . $t['endTime']));
         $endDt->addHour($config->user->numHoursEvaluationAvailability->val);
         $t = array_merge(array('startDt' => $startDt->getTimestamp()), $t);
         $t['active'] = false;
         // checks to see if its possible that the class is open for evaluation
         if ($endDt->getTimestamp() > $time) {
             $t['active'] = true;
         }
         $t['status'] = 'instructor';
     }
     $events = array_merge($reservations, $teaching);
     // sort by event order
     $eDates = array();
     foreach ($events as $key => $value) {
         $eDates[$key] = $value['startDt'];
     }
     asort($eDates);
     $newEvents = array();
     foreach (array_keys($eDates) as $key) {
         $newEvents[] = $events[$key];
     }
     $events = $newEvents;
     $currentEvents = array();
     $pastEvents = array();
     foreach ($events as $e) {
         $where = $instructor->getAdapter()->quoteInto('eventId = ?', $e['eventId']);
         $instructors = $instructor->fetchAll($where);
         $instructorIds = array();
         foreach ($instructors as $i) {
             $instructorIds[] = $i->accountId;
         }
         if (count($instructorIds) != 0) {
             $accounts = $account->fetchAll($account->getAdapter()->quoteInto('accountId IN (?)', $instructorIds), array('lastName', 'firstName'));
             foreach ($accounts as $a) {
                 $e['instructors'][] = $a->firstName . ' ' . $a->lastName;
             }
         }
         if (isset($locationCache[$e['locationId']])) {
             $e['location'] = $locationCache[$e['locationId']];
         } else {
             $thisLocation = $location->find($e['locationId']);
             if (is_null($thisLocation)) {
                 throw new Ot_Exception_Data('Location not found');
             }
             $e['location'] = $thisLocation->toArray();
             $locationCache[$e['locationId']] = $e['location'];
         }
         if ($e['active']) {
             $currentEvents[] = $e;
         } else {
             if ($e['status'] != 'waitlist') {
                 $pastEvents[] = $e;
             }
         }
     }
     $ret = array('currentEvents' => $currentEvents, 'pastEvents' => array_reverse($pastEvents));
     return $ret;
 }
コード例 #8
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');
 }