<?php
$this->ciext->load_bootstrap();
$ciext_assets_dir = '/' . $this->config->item('assets_folder') . '/' . $this->config->item('components_folder') . '/ciext';
$this->js_css->add_css($ciext_assets_dir . '/css/reset.css');
$this->js_css->add_css($ciext_assets_dir . '/css/main.css');
if (!empty($menu) && is_array($menu)) {
    $this->js_css->add_css($ciext_assets_dir . '/css/menu.css');
    $this->js_css->add_js($ciext_assets_dir . '/js/menu.js');
}
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>{title}</title>
        <?php echo $this->js_css->get_js_string(); ?>
        <?php echo $this->js_css->get_css_string(); ?>
    </head>
    <body>
        <div class="fake-header"></div>
        <div class="container">
            <header>
                <a href="/" target="_blank"><div class="logo"></div></a>
                <ul class="topnav">
                    {top_menu}
                    <li class="{active} {non-active}"><a href="{href}" {id}>{name}</a></li>
                    {/top_menu}
                </ul>
                {user_info}
            </header>            
            <div class="wrapper">
                <h1>{title}</h1>
                <hr/>

                <?php if (!empty($menu) && is_array($menu)) : ?>
                    <div class="left-menu">
                        <ul class="sub-menu">
                            <?php foreach ($menu as $item) : ?>
                                <li <?php echo (!empty($item['children']) ? 'class="sub-level"' : (strpos($this->uri->uri_string(), $item['page']) ? 'class="active"' : '')); ?>>
                                    <a href="/<?php echo $this->config->item('admin_page') . '/' . $item['page']; ?>">
                                        <?php echo $this->lang->line($item['translate']); ?>
                                    </a>
                                    <?php if (!empty($item['children'])) : ?>
                                        <ul>
                                            <?php foreach ($item['children'] as $citem) : ?>
                                                <li <?php echo (strpos($this->uri->uri_string(), $citem['page']) ? 'class="active"' : ''); ?>>
                                                    <a href="/<?php echo $this->config->item('admin_page') . '/' . $citem['page']; ?>">
                                                        <?php echo $this->lang->line($citem['translate']); ?>
                                                    </a>
                                                </li>
                                            <?php endforeach; ?>
                                        </ul>
                                    <?php endif; ?>
                                </li>
                            <?php endforeach; ?>
                        </ul>
                    </div>
                <?php else : ?>
                    <?php echo $menu; ?>
                <?php endif; ?>

                <div class="content">{content}</div>
            </div>
            <footer>
                {admin_footer}
            </footer>
        </div>

    </body>
</html>