Exemple #1
0
 /**
  * Check credentials and intialize members
  */
 public function beforeAction()
 {
     parent::beforeAction();
     $this->_store = $this->_session->getStore('apply', $this->_config->getApplicantSessionLifetime());
     $this->_application = $this->_em->getRepository('Jazzee\\Entity\\Application')->findEasy($this->actionParams['programShortName'], $this->actionParams['cycleName']);
     if (!$this->_application) {
         throw new \Jazzee\Exception("Unable to load {$this->actionParams['programShortName']} {$this->actionParams['cycleName']} application", E_USER_NOTICE, 'That is not a valid application');
     }
     if (!$this->_application->isPublished() or $this->_application->getOpen() > new \DateTime('now')) {
         $this->addMessage('error', $this->_application->getCycle()->getName() . ' ' . $this->_application->getProgram()->getName() . ' is not open for applicants');
         $this->redirectPath('apply/' . $this->_application->getProgram()->getShortName());
     }
     foreach ($this->_application->getApplicationPages(\Jazzee\Entity\ApplicationPage::APPLICATION) as $applicationPage) {
         $this->_pages[$applicationPage->getId()] = $applicationPage;
         $applicationPage->getJazzeePage()->setController($this);
     }
     $this->setLayoutVar('layoutTitle', $this->_application->getCycle()->getName() . ' ' . $this->_application->getProgram()->getName() . ' Application');
     $this->addCss($this->path('resource/styles/apply.css'));
     $this->setVar('application', $this->_application);
 }
Exemple #2
0
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     if ($application and $application->isPublished()) {
         $action = 'liveIndex';
     } else {
         $action = 'index';
     }
     //all action authorizations are controlled by the index action
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }
Exemple #3
0
 /**
  * Use the index action to controll acccess
  * require a published application
  * @param type $controller
  * @param string $action
  * @param \Jazzee\Entity\User $user
  * @param \Jazzee\Entity\Program $program
  * @param \Jazzee\Entity\Application $application
  * @return type
  */
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     if (!$application || !$application->isPublished()) {
         return false;
     }
     //several views are controller by the index action
     if (in_array($action, array('bulk', 'sampleFile'))) {
         $action = 'index';
     }
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }