<commit_before><?php

// src/eveg/AppBundle/Menu/Builder.php
// https://gist.github.com/nateevans/9958390

 
namespace eveg\AppBundle\Menu;
 
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\Session\Session;
 
class MenuBuilder extends ContainerAware
{

    public function mainMenu(FactoryInterface $factory, array $options)
    {
      $securityContext = $this->container->get('security.context');

    	$menu = $factory->createItem('root');
    	$menu->setChildrenAttribute('class', 'nav navbar-nav');
 
		$menu->addchild('Home', array('route' => 'eveg_app_homepage', 'label' => ''))
			->setAttribute('icon', 'home');
		
		$menu->addChild('App', array('route' =>'eveg_app_start', 'label' => 'eveg.menu.browse'));

    if($securityContext->isGranted('ROLE_USER')) {
      $menu->addChild('Activities', array('route' => 'eveg_app_activity', 'label' => 'eveg.menu.activity'));
    }

    $menu->addChild('Participate', array('route' => 'eveg_app_participate', 'label' => 'eveg.menu.participate'));

		$menu->addChild('Contact', array('route' => 'eveg_app_contact', 'label' => 'eveg.menu.contact'));
 
        return $menu;
    }

    public function searchMenu(FactoryInterface $factory, array $options)
    {
      $menu = $factory->createItem('root');
      $menu->setChildrenAttribute('class', 'nav navbar-nav navbar-right');

      $menu->addChild('Search', array('route' => 'eveg_app_homepage', 'label' => 'eveg.search.title'))
        ->setAttribute('class', 'navbar-right')
        ->setAttribute('id', 'search-icon')
        ->setAttribute('icon', 'search')
        ->setAttribute('data-toggle', 'modal')
         ->setAttribute('data-target', '#modalSearch');

      return $menu;

    }

    public function filterMenu(FactoryInterface $factory, array $options)
    {

      $session     = new Session();
      $ueFilter    = $session->get('ueFilter');
      $depFrFilter = $session->get('depFrFilter');
      $filterFlag  = false;

      if(($ueFilter != '[]') or ($depFrFilter != '[]')) {
        if(($ueFilter != null) or ($depFrFilter != null)) {
          $filterFlag = true;
        }
      }
dump($ueFilter);dump($depFrFilter);dump($filterFlag);
      $menu = $factory->createItem('root');
      $menu->setChildrenAttribute('class', 'nav navbar-nav navbar-right');

      $menu->addChild('Filter', array('route' => 'eveg_app_homepage', 'label' => 'eveg.menu.filter'))
         ->setAttribute('icon', 'filter')
         ->setAttribute('id', 'filter-icon')
         ->setAttribute('class', 'navbar-right')
         ->setAttribute('data-toggle', 'modal')
         ->setAttribute('data-target', '#modalFilter')
         ;
      if($filterFlag == true) {
        $menu['Filter']->setAttribute('class', 'activeFilter')
                       ->setAttribute('iconAppend', 'asterisk')
                       ;

      }

      return $menu;
    }
 
    public function userMenu(FactoryInterface $factory, array $options)
    {
      $securityContext = $this->container->get('security.context');

    	$menu = $factory->createItem('root');
    	$menu->setChildrenAttribute('class', 'nav navbar-nav navbar-right');
 <commit_msg>remove dump<commit_after><?php

// src/eveg/AppBundle/Menu/Builder.php
// https://gist.github.com/nateevans/9958390

 
namespace eveg\AppBundle\Menu;
 
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\Session\Session;
 
class MenuBuilder extends ContainerAware
{

    public function mainMenu(FactoryInterface $factory, array $options)
    {
      $securityContext = $this->container->get('security.context');

    	$menu = $factory->createItem('root');
    	$menu->setChildrenAttribute('class', 'nav navbar-nav');
 
		$menu->addchild('Home', array('route' => 'eveg_app_homepage', 'label' => ''))
			->setAttribute('icon', 'home');
		
		$menu->addChild('App', array('route' =>'eveg_app_start', 'label' => 'eveg.menu.browse'));

    if($securityContext->isGranted('ROLE_USER')) {
      $menu->addChild('Activities', array('route' => 'eveg_app_activity', 'label' => 'eveg.menu.activity'));
    }

    $menu->addChild('Participate', array('route' => 'eveg_app_participate', 'label' => 'eveg.menu.participate'));

		$menu->addChild('Contact', array('route' => 'eveg_app_contact', 'label' => 'eveg.menu.contact'));
 
        return $menu;
    }

    public function searchMenu(FactoryInterface $factory, array $options)
    {
      $menu = $factory->createItem('root');
      $menu->setChildrenAttribute('class', 'nav navbar-nav navbar-right');

      $menu->addChild('Search', array('route' => 'eveg_app_homepage', 'label' => 'eveg.search.title'))
        ->setAttribute('class', 'navbar-right')
        ->setAttribute('id', 'search-icon')
        ->setAttribute('icon', 'search')
        ->setAttribute('data-toggle', 'modal')
         ->setAttribute('data-target', '#modalSearch');

      return $menu;

    }

    public function filterMenu(FactoryInterface $factory, array $options)
    {

      $session     = new Session();
      $ueFilter    = $session->get('ueFilter');
      $depFrFilter = $session->get('depFrFilter');
      $filterFlag  = false;

      if(($ueFilter != '[]') or ($depFrFilter != '[]')) {
        if(($ueFilter != null) or ($depFrFilter != null)) {
          $filterFlag = true;
        }
      }

      $menu = $factory->createItem('root');
      $menu->setChildrenAttribute('class', 'nav navbar-nav navbar-right');

      $menu->addChild('Filter', array('route' => 'eveg_app_homepage', 'label' => 'eveg.menu.filter'))
         ->setAttribute('icon', 'filter')
         ->setAttribute('id', 'filter-icon')
         ->setAttribute('class', 'navbar-right')
         ->setAttribute('data-toggle', 'modal')
         ->setAttribute('data-target', '#modalFilter')
         ;
      if($filterFlag == true) {
        $menu['Filter']->setAttribute('class', 'activeFilter')
                       ->setAttribute('iconAppend', 'asterisk')
                       ;

      }

      return $menu;
    }
 
    public function userMenu(FactoryInterface $factory, array $options)
    {
      $securityContext = $this->container->get('security.context');

    	$menu = $factory->createItem('root');
    	$menu->setChildrenAttribute('class', 'nav navbar-nav navbar-right');
 
{'fraction_non_alphanumeric': 0.1855864342910975, 'fraction_numerical': 0.002198147275867483, 'mean_word_length': 3.4113573407202216, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 101, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3210949', 'n_tokens_mistral': 1973, 'n_tokens_neox': 1906, 'n_words': 310}