<?php
/**
 * YAWIK
 * Layout template file
 *
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
 * @license   MIT
 */
?>
<?php
/* @var $options \Core\Options\ModuleOptions */
$options = $this->services('Core/Options');
$operator = $options->getOperator();
$lang = $this->params('lang');

// See: http://yawik.readthedocs.org/en/latest/modules/core/notifications.html

$notifications = $this->partial('core/notifications');

$this->configHeadScript()->prependScript('var lang="' . $lang . '";'
    . 'var basePath="' . $this->basePath() . '";');

$this->headLink()->prependStylesheet($this->basePath('dist/css/core.min.css'));
$this->configHeadScript()->prependFile($this->basepath('dist/js/core.js'));

/*
@TODO: remove this comment when grunt command is implemented
$this->configHeadScript()->prependFile($this->basepath('modules/Core/js/core.init.js'));
$this->configHeadScript()->prependFile($this->basePath('/assets/pnotify/pnotify.custom.min.js'), 'text/javascript');
$this->configHeadScript()->prependFile($this->basePath('/assets/bootstrap/js/bootstrap.min.js'));
$this->configHeadScript()->prependFile($this->basePath('/assets/jquery/jquery.min.js'));
$this->configHeadScript()->appendFile($this->basePath('/assets/select2/js/select2.min.js'));
*/
$langScript = 'dist/locales/' . $lang . '.js';
$this->configHeadScript()->appendFile($this->basePath($langScript));


//$this->headLink()->prependStylesheet($this->basePath('/assets/pnotify/pnotify.custom.min.css'));
//$this->headLink()->appendStylesheet($this->basePath('/assets/select2/css/select2.css'));

?>
<?php echo $this->doctype(); ?>
<html lang="<?=$lang?>">
    <head>
        <meta charset="utf-8">
        <?php echo $this->headTitle($this->translate('YAWIK'))->setSeparator(' - ')->setAutoEscape(false) ?>

        <?php echo $this->headMeta()->appendName('viewport', 'width=device-width, initial-scale=1.0') ?>

        <?php echo $this->configHeadScript();?>
        <?php

        // See: http://yawik.readthedocs.org/en/latest/customize.html#css

        echo $this->headLink();

        ?>
        <?php echo $this->headStyle() ?>
    </head>
    <body>
    <?php echo $this->partial('noscript-notice') ?>
	<a class="sr-only" href="#content">Skip to main content</a>
	<header id="yk-topbar" role="banner">
         <div class="cam-container">
   	       <div class="navbar-header">
                    <button class="navbar-toggle collapsed" data-target=".navbar-collapse" data-toggle="collapse" type="button">
			<span class="sr-only">Toggle navigation</span>
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand hidden-xs" href="<?php echo $this->basepath('/' . $lang )?>">
                        <div><?=$options->getSiteName()?></div>
                    </a>
                    <a class="navbar-brand visible-xs" href="<?php echo $this->basepath('/' . $lang )?>">Y</a>
               </div>
                  <nav id="main-navigation" class="navbar-collapse collapse navbar-collapse" role="navigation">
                     <?php
                        echo $this->navigation('Core/Navigation')
                                  ->setAcl($this->services('Acl'))
                                  ->setRole($this->auth('role'))
                                  ->menu()
                                  ->setMaxDepth(0)
                                  ->setUlClass('nav navbar-nav pull-left')//renderPartial(null, 'main-navigation')?>

                     <?php echo $this->loginInfo(array('lang' => $lang )) ?>
                 </nav> <!-- /main-navigation -->
		</div>
            </header>
          <div class="container col-md-2">
<!-- SIDEBAR -->
<nav id="sidebar">
    <?=$this->languageSwitcher()?>
<p><a href="https://www.transifex.com/projects/p/yawik/">
<?php echo $this->translate('Help to translate YAWIK');?></a></p>
<div id="sub-nav">
<?php
    echo $this->navigation()->menu()
              ->setOnlyActiveBranch(true)
              ->setMaxDepth(null)
              ->setMinDepth(1)
              ->setRenderParents(false)
              ->setUlClass('nav nav-pills nav-stacked');
?>
<?php foreach ($this->layout()->getChildren() as $child):
    /** @var $child \Laminas\View\Model\ModelInterface */
    if (0 === strpos($child->captureTo(), "sidebar_")):
        echo $this->{$child->captureTo()};
    endif;
endforeach;?>

</div>
</nav>
<!-- /SIDEBAR -->
                    </div>

<main id="content" class="col-md-10">
<?php echo $notifications?>
<?php echo $this->content; ?>
</main>

<!-- /container -->
            <footer id="yk-footer">
                <div class="container">
		            <span class="pull-left">
                        <small>
                            &copy;<?php echo date("Y")?>
                            <a href="<?php echo $operator['homepage']?>"><?php echo $operator['companyFullName']?></a>.
                                <?php echo $this->translate('All rights reserved.') ?> |
                            <a href="<?php echo  $this->basePath($lang .'/content/imprint')?>"><?php echo $this->translate('Imprint') ?></a> |
                            <version>
                                <?php echo $this->moduleVersion() ?>
                                Env: <strong><?php echo getenv('APPLICATION_ENV') ?></strong>
                            </version>
                        </small></span>
                            <span class="pull-right"><small>Powered by <a href="http://yawik.org">YAWIK</a></small></span>
                </div>
            </footer>
    </body>
</html>
