/** Upgrade an account
  * @access public
  * @return void
  */
 public function upgradeAction()
 {
     $allowed = array('public', 'member');
     if (in_array($this->getRole(), $allowed)) {
         $user = $this->getAccount();
         $form = new AccountUpgradeForm();
         $this->view->form = $form;
         if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
             if ($form->isValid($form->getValues())) {
                 $where = array();
                 $where[] = $this->_users->getAdapter()->quoteInto('id = ?', (int) $this->getAccount()->id);
                 $updateData = $form->getValues();
                 $updateData['higherLevel'] = 1;
                 $this->_users->update($updateData, $where);
                 $to = array(array('email' => $user->email, 'name' => $user->fullname));
                 $advisers = new Contacts();
                 $emails = $advisers->getAdvisersEmails();
                 $central = $advisers->getCentralEmails();
                 $emails = array_merge($to, $emails, $central);
                 $attachments = array(ROOT_PATH . '/public_html/documents/tac.pdf');
                 $assignData = array_merge($to[0], $form->getValues());
                 $toReferee = array(array('email' => $form->getValue('referenceEmail'), 'name' => $form->getValue('reference')));
                 //data, template, to, cc, from, bcc, attachments, subject
                 $this->sendAdvisers($assignData, $toReferee, $emails, $attachments);
                 $this->getFlash()->addMessage('Thank you! We have received your request.');
                 $this->redirect('/users/account/');
             } else {
                 $form->populate($form->getValues());
                 $this->getFlash()->addMessage('There are a few problems with your registration<br>
                 Please review and correct them.');
             }
         }
     } else {
         $this->getFlash()->addMessage('You can\'t request an upgrade as you already have ' . $this->getRole() . ' status!');
         $this->redirect('/users/account/');
     }
 }
    /** Upgrade an account
     */
    public function upgradeAction()
    {
        $role = $this->getRole();
        $allowed = array('public', 'member');
        if (in_array($role, $allowed)) {
            $user = $this->getAccount();
            $form = new AccountUpgradeForm();
            $this->view->form = $form;
            if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
                if ($form->isValid($form->getValues())) {
                    $where = array();
                    $where[] = $this->_users->getAdapter()->quoteInto('id = ?', (int) $this->_getParam('id'));
                    $update = $this->_users->update($updateData, $where);
                    $to = array(array('email' => $user->email, 'name' => $user->fullname));
                    $attachments = array('/home/beowulf/public_html/documents/tac.pdf');
                    $assignData = array_merge($to[0], $form->getValues());
                    $this->_helper->mailer($assignData, 'upgradeRequested', null, $to, $to, null, $attachments);
                    $this->_flashMessenger->addMessage('Thank you! We have received your request.');
                    $this->_redirect('/users/account/');
                } else {
                    $form->populate($form->getValues());
                    $this->_flashMessenger->addMessage('There are a few problems with your registration<br>
	Please review and correct them.');
                }
            }
        } else {
            $this->_flashMessenger->addMessage('You can\'t request an upgrade as you already have ' . $role . ' status!');
            $this->_redirect('/users/account/');
        }
    }