<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'default', 'common/layout.tpl', 16, false),)), $this); ?>
<!DOCTYPE html>
<html<?php if ($this->_tpl_vars['common']->getDirection()): ?> dir="<?php echo $this->_tpl_vars['common']->getDirection(); ?>
"<?php endif; ?>>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <?php if ($this->_tpl_vars['common']->getContentEncoding()): ?>
        <meta charset="<?php echo $this->_tpl_vars['common']->getContentEncoding(); ?>
">
    <?php endif; ?>
    <?php echo $this->_tpl_vars['common']->getCustomHead(); ?>

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <?php if ($this->_tpl_vars['common']): ?>
        <title><?php echo $this->_tpl_vars['common']->getTitle(); ?>
</title>
    <?php else: ?>
        <title>Error</title>
    <?php endif; ?>

    <link rel="stylesheet" type="text/css" href="<?php echo ((is_array($_tmp=@$this->_tpl_vars['StyleFile'])) ? $this->_run_mod_handler('default', true, $_tmp, 'components/assets/css/main.css') : smarty_modifier_default($_tmp, 'components/assets/css/main.css')); ?>
" />
    <script type="text/javascript" src="components/js/require-config.js"></script>
    <?php if ($this->_tpl_vars['common']->getMainScript()): ?>
        <script type="text/javascript" data-main="<?php echo $this->_tpl_vars['common']->getMainScript(); ?>
" src="components/js/libs/require.js"></script>
    <?php else: ?>
        <script type="text/javascript" src="components/js/libs/require.js"></script>
    <?php endif; ?>
</head>

<?php if ($this->_tpl_vars['Page']): ?>
    <?php $this->assign('PageListObj', $this->_tpl_vars['Page']->GetReadyPageList()); ?>
    <?php if ($this->_tpl_vars['PageListObj'] && $this->_tpl_vars['Page']->GetShowPageList()): ?>
        <?php if ($this->_tpl_vars['PageListObj']->isTypeSidebar()): ?>
            <?php ob_start(); ?>
                <?php echo $this->_tpl_vars['PageList']; ?>

            <?php $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('SideBar', ob_get_contents());ob_end_clean(); ?>
        <?php endif; ?>

        <?php if ($this->_tpl_vars['PageListObj']->isTypeMenu()): ?>
            <?php ob_start(); ?>
                <?php echo $this->_tpl_vars['PageList']; ?>

            <?php $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('Menu', ob_get_contents());ob_end_clean(); ?>
        <?php endif; ?>
    <?php endif; ?>
<?php endif; ?>

<body>
<nav id="navbar" class="navbar navbar-default navbar-fixed-top">
    <div class="container-fluid">

        <?php if ($this->_tpl_vars['SideBar']): ?>
            <button type="button" class="navbar-link navbar-btn btn navbar-toggle pull-left visible-xs toggle-sidebar">
                <span class="icon-chevron-right"></span>
            </button>
        <?php endif; ?>

        <div class="navbar-header">
            <?php if ($this->_tpl_vars['common']): ?>
                <?php echo $this->_tpl_vars['common']->getHeader(); ?>

            <?php endif; ?>
            <?php if ($this->_tpl_vars['Menu'] || $this->_tpl_vars['Authentication']['Enabled']): ?>
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navnav" aria-expanded="false" aria-controls="navbar">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            <?php endif; ?>
        </div>

        <div class="navbar-collapse collapse" id="navnav">

            <?php if ($this->_tpl_vars['Authentication']['Enabled']): ?>
                <ul id="nav-menu" class="nav navbar-nav navbar-right">
                    <?php if ($this->_tpl_vars['Authentication']['LoggedIn']): ?>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                <i class="icon-user"></i>
                                <?php if ($this->_tpl_vars['Authentication']['CurrentUser']['Name'] == 'guest'): ?>
                                    <?php echo $this->_tpl_vars['Captions']->GetMessageString('Guest'); ?>

                                <?php else: ?>
                                    <?php echo $this->_tpl_vars['Authentication']['CurrentUser']['Name']; ?>

                                <?php endif; ?>
                                <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu">
                                <?php if ($this->_tpl_vars['Authentication']['isAdminPanelVisible']): ?>
                                    <li><a href="phpgen_admin.php" title="<?php echo $this->_tpl_vars['Captions']->GetMessageString('AdminPage'); ?>
"><?php echo $this->_tpl_vars['Captions']->GetMessageString('AdminPage'); ?>
</a></li>
                                    <li role="separator" class="divider"></li>
                                <?php endif; ?>
                                <?php if ($this->_tpl_vars['Authentication']['CanChangeOwnPassword']): ?>
                                    <li><a id="self-change-password" href="#" title="<?php echo $this->_tpl_vars['Captions']->GetMessageString('ChangePassword'); ?>
">
                                            <?php echo $this->_tpl_vars['Captions']->GetMessageString('ChangePassword'); ?>

                                        </a>
                                    </li>
                                <?php endif; ?>
                                <li><a href="login.php?operation=logout"><?php echo $this->_tpl_vars['Captions']->GetMessageString('Logout'); ?>
</a></li>
                            </ul>
                        </li>
                    <?php else: ?>
                        <li><a href="login.php"><?php echo $this->_tpl_vars['Captions']->GetMessageString('Login'); ?>
</a></li>
                    <?php endif; ?>
                </ul>
            <?php endif; ?>

            <?php if ($this->_tpl_vars['Menu']): ?>
                <?php echo $this->_tpl_vars['Menu']; ?>

            <?php endif; ?>

        </div>
    </div>
</nav>


<?php if (! isset ( $this->_tpl_vars['HideSideBarByDefault'] )): ?>
    <?php $this->assign('HideSideBarByDefault', false); ?>
<?php endif; ?>


<div class="container-fluid">

    <div class="row<?php if ($this->_tpl_vars['SideBar']): ?> sidebar-owner<?php endif; ?><?php if ($this->_tpl_vars['SideBar']): ?> <?php if ($this->_tpl_vars['HideSideBarByDefault']): ?>sidebar-inactive<?php else: ?>sidebar-active<?php endif; ?><?php endif; ?>">

        <?php if ($this->_tpl_vars['SideBar']): ?>

            <div class="sidebar hidden-xs">

                <a href="#" class="sidebar-close"><i class="icon-chevron-left"></i>
                    <i class="icon-chevron-right"></i></a>

                <div class="sidebar-content">
                    <div class="content">
                        <?php echo $this->_tpl_vars['SideBar']; ?>

                    </div>
                </div>

            </div>

            <script>
                window.PG_HIDE_SIDEBAR_BY_DEFAULT = <?php if ($this->_tpl_vars['HideSideBarByDefault']): ?>true<?php else: ?>false<?php endif; ?>;
            </script>

        <?php endif; ?>

        <div class="<?php if (isset ( $this->_tpl_vars['ContentBlockClass'] )): ?><?php echo $this->_tpl_vars['ContentBlockClass']; ?>
<?php else: ?>col-md-12<?php endif; ?>">
            <?php if ($this->_tpl_vars['SideBar']): ?><div class="sidebar-outer"><?php endif; ?>
                <div class="container-padding">
                    <?php echo $this->_tpl_vars['ContentBlock']; ?>

                    <?php echo $this->_tpl_vars['Variables']; ?>

                    <hr>
                    <footer><p><?php echo $this->_tpl_vars['common']->getFooter(); ?>
</p></footer>
                </div>
            <?php if ($this->_tpl_vars['SideBar']): ?></div><?php endif; ?>
        </div>

    </div>
</div>

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => 'common/change_password_dialog.tpl', 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

<?php if ($this->_tpl_vars['common']): ?>
    <script>
        <?php echo $this->_tpl_vars['common']->getValidationScripts(); ?>

        require(['jquery', 'bootstrap'], function() <?php echo '{'; ?>

            <?php echo $this->_tpl_vars['common']->getClientSideScript('OnBeforeLoadEvent'); ?>

            <?php echo '
                $(function () {
            '; ?>

                <?php echo $this->_tpl_vars['common']->getClientSideScript('OnAfterLoadEvent'); ?>

            <?php echo '
                });
            '; ?>

        <?php echo '}'; ?>
);
    </script>
<?php endif; ?>

<script type="text/javascript"><?php echo '
    require([
        \'components/js/pgui.user_management_api.js\',
        \'components/js/pgui.change_password_dialog.js\',
        \'components/js/pgui.password_dialog_utils.js\',
        \'components/js/pgui.self_change_password.js\'
    ], function() {});
'; ?>
</script>

</body>
</html>