Example #1
0
 /**
  * Get the navigation
  * @return Navigation
  */
 public function getNavigation()
 {
     if (empty($this->program) and empty($this->application)) {
         return null;
     }
     $navigation = new \Foundation\Navigation\Container();
     $menu = new \Foundation\Navigation\Menu();
     $menu->setTitle('Navigation');
     if (empty($this->application)) {
         $link = new \Foundation\Navigation\Link('Welcome');
         $link->setHref($this->path('apply'));
         $menu->addLink($link);
     } else {
         $path = 'apply/' . $this->program->getShortName() . '/' . $this->cycle->getName();
         $link = new \Foundation\Navigation\Link('Welcome');
         $link->setHref($this->path($path));
         $link->setCurrent(true);
         $menu->addLink($link);
         //Only show the other cycles link if there are other published visible cycles
         $applications = $this->_em->getRepository('Jazzee\\Entity\\Application')->findByProgram($this->program, false, true, array($this->application->getId()));
         if (count($applications) > 0) {
             $link = new \Foundation\Navigation\Link('Other Cycles');
             $link->setHref($this->path('apply/' . $this->program->getShortName()));
             $menu->addLink($link);
         }
         $link = new \Foundation\Navigation\Link('Returning Applicants');
         $link->setHref($this->path($path . '/applicant/login'));
         $menu->addLink($link);
         if (!$this->application->isByInvitationOnly()) {
             $link = new \Foundation\Navigation\Link('Start a New Application');
             $link->addClass('highlight');
             $link->setHref($this->path($path . '/applicant/new'));
             $menu->addLink($link);
         }
     }
     $navigation->addMenu($menu);
     if ($this->isPreviewMode()) {
         $menu = new \Foundation\Navigation\Menu();
         $navigation->addMenu($menu);
         $menu->setTitle('Preview Functions');
         $link = new \Foundation\Navigation\Link('Become Administrator');
         $link->setHref($this->path('admin/login'));
         $menu->addLink($link);
     }
     return $navigation;
 }