Example #1
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');
 }