<commit_before><?php

namespace CrewCallBundle\Menu;

use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

use CrewCallBundle\Lib\ExternalEntityConfig;

class Builder implements ContainerAwareInterface
{
    use ContainerAwareTrait;

    private $custom_builder = null;
    private $sakonnin_builder = null;
    private $common_builder = null;

    public function __construct()
    {
        if (class_exists('CustomBundle\Menu\Builder')) {
            $this->custom_builder = new \CustomBundle\Menu\Builder();
        }
        if (class_exists('BisonLab\SakonninBundle\Menu\Builder')) {
            $this->sakonnin_builder = new \BisonLab\SakonninBundle\Menu\Builder();
        }
        if (class_exists('BisonLab\CommonBundle\Menu\Builder')) {
            $this->common_builder = new \BisonLab\CommonBundle\Menu\Builder();
        }
    }

    public function mainMenu(FactoryInterface $factory, array $options)
    {
        $menu = $factory->createItem('root');

        $menu->addChild('Dashboard', array('route' => 'homepage'));
        if ($this->container->get('security.authorization_checker')->isGranted('ROLE_ADMIN')) {
            $eventsmenu = $menu->addChild('Events');
            $eventsmenu->addChild('List', array('route' => 'event_index'));
            $eventsmenu->addChild('List old events', array('route' => 'event_index', 'routeParameters' => array('past' => 'true')));
            $eventsmenu->addChild('Add new event', array('route' => 'event_new'));
            $eventsmenu->addChild('Calendar', array('route' => 'event_calendar'));

            $crewmenu = $menu->addChild("Crew",
                array('route' => 'person_function_type',
                'routeParameters' => array('function_type' => "CREW")));
            $menu->addChild('Organizations', array('route' => 'organization_index'));
            $menu->addChild('Locations', array('route' => 'location_index'));

            $adminmenu = $menu->addChild('Admin Stuff', array('route' => ''));
            $adminmenu->addChild('Functions', array('route' => 'function_index'));
            $adminmenu->addChild('Report generator', array('route' => 'reports'));
            $adminmenu->addChild('Mail and SMS templates',
                array('route' => 'sakonnintemplate_index'));

            $sakonnin = $this->container->get('sakonnin.messages');
            // Do we have a message for the front page?
            $anns = $sakonnin->getMessageType('Front page not logged in');

            if (count($anns->getMessages()) > 0) {
                $fpm = $anns->getMessages()[0];
                $adminmenu->addChild('Edit front page message',
                    array('route' => 'message_edit',
                    'routeParameters' => array('id' => $fpm->getId())));
            }

            $adminmenu->addChild('Message Types',
                array('route' => 'messagetype'));
            $adminmenu->addChild('Playfront', array('route' => 'frontplay'));
            $adminmenu->addChild('Mobilefront', array('uri' => '/public/userfront/'));
                $peoplemenu = $adminmenu->addChild('People');
                $em = $this->container->get('doctrine')->getManager();
                $peoplemenu->addChild('All', array('route' => 'person_index'));
                foreach (ExternalEntityConfig::getTypesFor('FunctionEntity', 'FunctionType') as $ftname => $ftarr) {
                    // Spot the ugliness.
                    $peoplemenu->addChild($ftarr['label'] . "s",
                        array('route' => 'person_function_type',
                        'routeParameters' => array('function_type' => $ftname)));
                }
                if ($this->container->getParameter('allow_registration')) {
                    $peoplemenu->addChild('Applicants', array('route' => 'person_applicants'));
                }
                $peoplemenu->addChild('Add person', array('route' => 'person_new'));
            $menu->addChild('Jobs view', array('route' => 'jobsview_index'));
        }
        $options['menu']      = $menu;
        $options['container'] = $this->container;<commit_msg>Add fron page announcement, again.<commit_after><?php

namespace CrewCallBundle\Menu;

use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

use CrewCallBundle\Lib\ExternalEntityConfig;

class Builder implements ContainerAwareInterface
{
    use ContainerAwareTrait;

    private $custom_builder = null;
    private $sakonnin_builder = null;
    private $common_builder = null;

    public function __construct()
    {
        if (class_exists('CustomBundle\Menu\Builder')) {
            $this->custom_builder = new \CustomBundle\Menu\Builder();
        }
        if (class_exists('BisonLab\SakonninBundle\Menu\Builder')) {
            $this->sakonnin_builder = new \BisonLab\SakonninBundle\Menu\Builder();
        }
        if (class_exists('BisonLab\CommonBundle\Menu\Builder')) {
            $this->common_builder = new \BisonLab\CommonBundle\Menu\Builder();
        }
    }

    public function mainMenu(FactoryInterface $factory, array $options)
    {
        $menu = $factory->createItem('root');

        $menu->addChild('Dashboard', array('route' => 'homepage'));
        if ($this->container->get('security.authorization_checker')->isGranted('ROLE_ADMIN')) {
            $eventsmenu = $menu->addChild('Events');
            $eventsmenu->addChild('List', array('route' => 'event_index'));
            $eventsmenu->addChild('List old events', array('route' => 'event_index', 'routeParameters' => array('past' => 'true')));
            $eventsmenu->addChild('Add new event', array('route' => 'event_new'));
            $eventsmenu->addChild('Calendar', array('route' => 'event_calendar'));

            $crewmenu = $menu->addChild("Crew",
                array('route' => 'person_function_type',
                'routeParameters' => array('function_type' => "CREW")));
            $menu->addChild('Organizations', array('route' => 'organization_index'));
            $menu->addChild('Locations', array('route' => 'location_index'));

            $adminmenu = $menu->addChild('Admin Stuff', array('route' => ''));
            $adminmenu->addChild('Functions', array('route' => 'function_index'));
            $adminmenu->addChild('Report generator', array('route' => 'reports'));
            $adminmenu->addChild('Mail and SMS templates',
                array('route' => 'sakonnintemplate_index'));

            $sakonnin = $this->container->get('sakonnin.messages');
            // Do we have a message for the front page?
            $fpnl_type = $sakonnin->getMessageType('Front page not logged in');

            if (count($fpnl_type->getMessages()) > 0) {
                $fpm = $fpnl_type->getMessages()[0];
                $adminmenu->addChild('Edit front page message',
                    array('route' => 'message_edit',
                    'routeParameters' => array('id' => $fpm->getId())));
            } else {
                $admin->addChild('Add front page message (not logged in)',
                    array('route' => 'message_new',
                    'routeParameters' => array('message_type' => $fpnl_type)));
            }

            $adminmenu->addChild('Message Types',
                array('route' => 'messagetype'));
            $adminmenu->addChild('Playfront', array('route' => 'frontplay'));
            $adminmenu->addChild('Mobilefront', array('uri' => '/public/userfront/'));
                $peoplemenu = $adminmenu->addChild('People');
                $em = $this->container->get('doctrine')->getManager();
                $peoplemenu->addChild('All', array('route' => 'person_index'));
                foreach (ExternalEntityConfig::getTypesFor('FunctionEntity', 'FunctionType') as $ftname => $ftarr) {
                    // Spot the ugliness.
                    $peoplemenu->addChild($ftarr['label'] . "s",
                        array('route' => 'person_function_type',
                        'routeParameters' => array('function_type' => $ftname)));
                }
                if ($this->container->getParameter('allow_registration')) {
                    $peoplemenu->addChild('Applicants', array('route' => 'person_applicants'));
                }
                $peoplemenu->addChild('Add person', array('route' => 'person_new'));
            $menu->addChild('Jobs view', array('route' => 'jobsview_index'));
        }
        $options['menu']      = $menu;
        $options['container'] = $this->container;
{'fraction_non_alphanumeric': 0.16390614216701174, 'fraction_numerical': 0.00046008741660915573, 'mean_word_length': 2.6304801670146136, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 153, 'https://': 0, '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': '866403', 'n_tokens_mistral': 2426, 'n_tokens_neox': 2337, 'n_words': 394}