Пример #1
0
 public function testSetCurrent()
 {
     $object = new \Foundation\Navigation\Link('');
     $object->setCurrent(true);
     $this->assertTrue($object->getCurrent());
     $object->setCurrent(false);
     $this->assertFalse($object->getCurrent());
     $value = uniqid();
     $object->addClass($value);
     $this->assertEquals($value, $object->getClass());
     $object->setCurrent(true);
     $this->assertEquals($value . ' current', $object->getClass());
 }
Пример #2
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;
 }
Пример #3
0
 /**
  * Navigation
  * @return Navigation
  */
 public function getNavigation()
 {
     $navigation = new \Foundation\Navigation\Container();
     $menu = new \Foundation\Navigation\Menu();
     $menu->setTitle('Navigation');
     $link = new \Foundation\Navigation\Link('Back to Application');
     reset($this->_pages);
     $first = key($this->_pages);
     $link->setHref($this->applyPath('page/' . $first));
     $menu->addLink($link);
     $link = new \Foundation\Navigation\Link('Logout');
     $link->setHref($this->applyPath('applicant/logout'));
     $menu->addLink($link);
     $navigation->addMenu($menu);
     return $navigation;
 }
Пример #4
0
 public function getNavigation()
 {
     $navigation = new \Foundation\Navigation\Container();
     $menu = new \Foundation\Navigation\Menu();
     $menu->setTitle('Navigation');
     $link = new \Foundation\Navigation\Link('Welcome');
     $link->setHref($this->applyPath(''));
     $menu->addLink($link);
     $link = new \Foundation\Navigation\Link('Other Cycles');
     $link->setHref($this->path('apply/' . $this->_application->getProgram()->getShortName()));
     $menu->addLink($link);
     $link = new \Foundation\Navigation\Link('Returning Applicants');
     $link->setHref($this->applyPath('applicant/login'));
     $menu->addLink($link);
     if (!$this->_application->isByInvitationOnly()) {
         $link = new \Foundation\Navigation\Link('Start a New Application');
         $link->setHref($this->applyPath('applicant/new'));
         $link->addClass('highlight');
         $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;
 }
Пример #5
0
 /**
  * Create the navigation from pages
  * @param array $pages
  * @return Navigation
  */
 public function getNavigation()
 {
     $navigation = new \Foundation\Navigation\Container();
     $menu = new \Foundation\Navigation\Menu();
     $navigation->addMenu($menu);
     $menu->setTitle('Application Pages');
     foreach ($this->_pages as $page) {
         $link = new \Foundation\Navigation\Link($page->getTitle());
         $link->setHref($this->applyPath('page/' . $page->getId()));
         if ($this->_page->getId() == $page->getId()) {
             $link->setCurrent(true);
         }
         switch ($page->getJazzeePage()->getStatus()) {
             case \Jazzee\Interfaces\Page::INCOMPLETE:
                 $link->addClass('incomplete');
                 break;
             case \Jazzee\Interfaces\Page::COMPLETE:
                 $link->addClass('complete');
                 break;
             case \Jazzee\Interfaces\Page::SKIPPED:
                 $link->addClass('skipped');
                 break;
         }
         $menu->addLink($link);
     }
     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);
         $link = new \Foundation\Navigation\Link('Lock Application');
         $link->setHref($this->applyPath('preview/lock'));
         $menu->addLink($link);
     }
     return $navigation;
 }
Пример #6
0
 /**
  * Get Navigation
  */
 public function getNavigation()
 {
     if (isset($this->_store->AdminControllerGetNavigation)) {
         return $this->_store->AdminControllerGetNavigation;
     }
     $navigation = new \Foundation\Navigation\Container();
     $link = new \Foundation\Navigation\Link('Home');
     $link->setHref($this->path('welcome'));
     $navigation->addLink($link);
     $menus = array();
     foreach ($this->listControllers() as $controller) {
         if ($this->checkIsAllowed($controller)) {
             \Foundation\VC\Config::includeController($controller);
             $class = \Foundation\VC\Config::getControllerClassName($controller);
             if (!is_null($class::MENU)) {
                 if (!isset($menus[$class::MENU])) {
                     $menus[$class::MENU] = new \Foundation\Navigation\Menu();
                     $menus[$class::MENU]->setTitle($class::MENU);
                     $navigation->addMenu($menus[$class::MENU]);
                 }
                 $link = new \Foundation\Navigation\Link($class::TITLE);
                 $link->setHref($this->path($class::PATH));
                 $menus[$class::MENU]->addLink($link);
             }
         }
     }
     foreach ($menus as $menu) {
         $menu->sortLinks();
     }
     if (empty($menus)) {
         return false;
         //if there are no controllers or no authorization there are no menus
     }
     $this->_store->AdminControllerGetNavigation = $navigation;
     return $navigation;
 }
Пример #7
0
 /**
  * Navigation
  * @return Navigation
  */
 public function getNavigation()
 {
     $navigation = new \Foundation\Navigation\Container();
     $menu = new \Foundation\Navigation\Menu();
     $menu->setTitle('Navigation');
     $link = new \Foundation\Navigation\Link('Your Status');
     $link->setHref($this->applyPath('status'));
     $menu->addLink($link);
     if ($this->_applicant->getDecision() and $this->_applicant->getDecision()->status() == 'finalAdmit') {
         $link = new \Foundation\Navigation\Link('Confirm Enrollment');
         $link->setHref($this->applyPath('status/sir'));
         $menu->addLink($link);
     }
     if ($this->_applicant->getDecision() and $this->_applicant->getDecision()->getFinalAdmit()) {
         $link = new \Foundation\Navigation\Link('View Decision Letter');
         $link->setHref($this->applyPath('status/admitLetter'));
         $menu->addLink($link);
     }
     if ($this->_applicant->getDecision() and $this->_applicant->getDecision()->getFinalDeny()) {
         $link = new \Foundation\Navigation\Link('View Decision Letter');
         $link->setHref($this->applyPath('status/denyLetter'));
         $menu->addLink($link);
     }
     $navigation->addMenu($menu);
     if ($this->_config->getAllowApplicantPrintApplication()) {
         $actions = new \Foundation\Navigation\Menu();
         $actions->setTitle('Actions');
         $print = new \Foundation\Navigation\Link('Print Application');
         $print->setHref($this->applyPath('account/printApplication'));
         $actions->addLink($print);
         $navigation->addMenu($actions);
     }
     if ($this->isPreviewMode()) {
         $menu = new \Foundation\Navigation\Menu();
         $navigation->addMenu($menu);
         $menu->setTitle('Preview Functions');
         $link = new \Foundation\Navigation\Link('Unlock Application');
         $link->setHref($this->applyPath('preview/unlock'));
         $menu->addLink($link);
     }
     return $navigation;
 }