<?php
$pathinfo = $sf_request->getPathInfo();
$module = $sf_request->getParameter('module');
if ($module == 'product')
{
    $module = 'catalog';
}
if (count($menus) > 0) {
    echo '<ul' . ($type == 'bottom' ? ' class="footer_table_link__ul"' : '') . '>';
    foreach ($menus as $key => $menu) {
        $url = ((strpos( $menu['url'], $module)) || ($pathinfo == url_for($menu['url'])) != false ? '' : url_for($menu['url']));
        $sub_class = (isset($menu['sub']) && (is_object($menu['sub']) || is_array($menu['sub'])) && count($menu['sub']) > 0 ? ' top_menu__elem_full' : '');
        echo '<li class="' . ($type != 'bottom' ? 'top_menu__elem' : '') . '' . $sub_class . '"><' . ($url ? 'a' : 'span') . ' ' . ($type == 'bottom' ? 'class="black_link big"' : '') . ' href="' . url_for($menu['url']) . '">' . $menu['title'] . '</' . ($url ? 'a' : 'span') . '>';
        if ($sub_class != '') {
            echo '<div class="top_menu_sub">';
            echo '<div class="max_width">';
            echo '<ul>';
            foreach ($menu['sub'] as $sub) {
                $url = ($pathinfo == url_for('@catalog_show?alias=' . $sub['alias']) ? '' : url_for('@catalog_show?alias=' . $sub['alias']));
                echo '<li><' . ($url ? 'a' : 'span') . ' href="' . url_for('@catalog_show?alias=' . $sub['alias']) . '" class="white_link">' . mb_strtoupper(mb_substr($sub['Translation'][$sf_user->getCulture()]['title'], 0, 1)) . mb_substr($sub['Translation'][$sf_user->getCulture()]['title'], 1) . '</' . ($url ? 'a' : 'span') . '></li>';
            }
            echo '</ul>';
            echo '</div>';
            echo '</div>';
        }
        echo '</li>';

    }
    echo '</ul>';
}
?>