public function forwardAction()
    {
        $emailAddress = $this->params()->fromQuery('email');
        /* @var \Applications\Entity\Application $application */
        $application  = $this->repositories->get('Applications/Application')
                                 ->find($this->params('id'));
        
        $this->acl($application, 'forward');
        
        $translator   = $this->translator;
         
        if (!$emailAddress) {
            throw new \InvalidArgumentException('An email address must be supplied.');
        }
        
        $params = array(
            'ok' => true,
            'text' => sprintf($translator->translate('Forwarded application to %s'), $emailAddress)
        );
        
        try {
            $userName    = $this->auth('info')->getDisplayName();
            $fromAddress = $application->getJob()->getContactEmail();
            $mailOptions = array(
                'application' => $application,
                'to'          => $emailAddress,
                'from'        => array($fromAddress => $userName)
            );
            $this->mailer('Applications/Forward', $mailOptions, true);
            $this->notification()->success($params['text']);
        } catch (\Exception $ex) {
            $params = array(
                'ok' => false,
                'text' => sprintf($translator->translate('Forward application to %s failed.'), $emailAddress)
            );
            $this->notification()->error($params['text']);
        }
        $application->changeStatus($application->getStatus(), $params['text']);
        return new JsonModel($params);
    }
public function forwardAction()
    {
        $emailAddress = $this->params()->fromQuery('email');
        /* @var \Applications\Entity\Application $application */
        $application  = $this->repositories->get('Applications/Application')
                                 ->find($this->params('id'));
        
        $this->acl($application, 'forward');
        
        $translator   = $this->translator;
         
        if (!$emailAddress) {
            throw new \InvalidArgumentException('An email address must be supplied.');
        }
        
        $params = array(
            'ok' => true,
            'text' => sprintf($translator->translate('Forwarded application to %s'), $emailAddress)
        );
        
        try {
            $userName    = $this->auth('info')->getDisplayName();
            $fromAddress = $application->getJob()->getContactEmail();
            $mailOptions = array(
                'application' => $application,
                'to'          => $emailAddress,
                'from'        => array($fromAddress => $userName)
            );
            $this->mailer('Applications/Forward', $mailOptions, true);
            $this->notification()->success($params['text']);
        } catch (\Exception $ex) {
            $params = array(
                'ok' => false,
                'text' => sprintf($translator->translate('Forward application to %s failed.'), $emailAddress)
            );
            $this->notification()->error($params['text']);
        }
        $application->changeStatus($application->getStatus(), $params['text']);
        return new JsonModel($params);
    }
public function forwardAction ( ) { $ emailAddress = $ this -> params ( ) -> fromQuery ( 'email' ) ; /* @var \Applications\Entity\Application $application */ $ application = $ this -> repositories -> get ( 'Applications/Application' ) -> find ( $ this -> params ( 'id' ) ) ; $ this -> acl ( $ application , 'forward' ) ; $ translator = $ this -> translator ; if ( ! $ emailAddress ) { throw new \ InvalidArgumentException ( 'An email address must be supplied.' ) ; } $ params = array ( 'ok' => true , 'text' => sprintf ( $ translator -> translate ( 'Forwarded application to %s' ) , $ emailAddress ) ) ; try { $ userName = $ this -> auth ( 'info' ) -> getDisplayName ( ) ; $ fromAddress = $ application -> getJob ( ) -> getContactEmail ( ) ; $ mailOptions = array ( 'application' => $ application , 'to' => $ emailAddress , 'from' => array ( $ fromAddress => $ userName ) ) ; $ this -> mailer ( 'Applications/Forward' , $ mailOptions , true ) ; $ this -> notification ( ) -> success ( $ params [ 'text' ] ) ; } catch ( \ Exception $ ex ) { $ params = array ( 'ok' => false , 'text' => sprintf ( $ translator -> translate ( 'Forward application to %s failed.' ) , $ emailAddress ) ) ; $ this -> notification ( ) -> error ( $ params [ 'text' ] ) ; } $ application -> changeStatus ( $ application -> getStatus ( ) , $ params [ 'text' ] ) ; return new JsonModel ( $ params ) ; }
Forwards an application via Email

@throws \InvalidArgumentException
@return \Zend\View\Model\JsonModel
Forwards an application via Email