Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15337 | Rev 15768 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

<?php
$currentUserHelper    = $this->currentUserHelper();
$user = $currentUserHelper->getUser();
$company = $currentUserHelper->getCompany();

$notify = '';
$messages = $this->flashMessenger()->getInfoMessages();
foreach ($messages as $message) {
        $notify .= "$.fn.showInfo('$message')";
}

$messages = $this->flashMessenger()->getSuccessMessages();
foreach ($messages as $message) {
        $notify .= "$.fn.showSuccess('$message')";
}

$messages = $this->flashMessenger()->getWarningMessages();
foreach ($messages as $message) {
        $notify .= " $.fn.showWarning('$message')";
}

$messages = $this->flashMessenger()->getErrorMessages();
foreach ($messages as $message) {
        $notify .= " $.fn.showError('$message')";
}

if ($notify) {
        $this->inlineScript()->captureStart();
        echo " jQuery( document ).ready(function( $ ) { $notify }); ";
        $this->inlineScript()->captureEnd();
}


$menu = [];

if ($company) {
        $baseMenu = getAclMenuCompany();
} else {
        $baseMenu = getAclMenuSystem();
}

if ($company) {
        $names = explode(' ', $company->name);
        $companyId = $company->uuid;
        $companyName = $company->name;
        $companyImg = $company->image;
}

$session_usertype_id = $user->usertype_id;
$acl = $this->viewModel()->getCurrent()->getVariable('acl');


foreach ($baseMenu as $menuLevel1) {
        if (!$acl->isAllowed($session_usertype_id,  $menuLevel1['route'])) {
                continue;
        }


        $optionLevel1 = [
                'label' => $menuLevel1['label'],
                'route' => $menuLevel1['route'],
                'class' => empty($menuLevel1['class']) ? '' :  $menuLevel1['class'],

        ];


        if (!empty($menuLevel1['pages'])) {




                $optionLevel1['pages'] = [];



                foreach ($menuLevel1['pages'] as $menuLevel2) {

                        $optionLevel2 = [
                                'label' => $menuLevel2['label'],
                                'route' => $menuLevel2['route'],
                                'class' => empty($menuLevel2['class']) ? '' :  $menuLevel2['class'],
                        ];

                        if (!$acl->isAllowed($session_usertype_id,  $menuLevel2['route'])) {
                                continue;
                        }

                        if (!empty($menuLevel2['pages'])) {
                                $optionLevel2['pages'] = [];

                                foreach ($menuLevel2['pages'] as $menuLevel3) {

                                        $optionLevel3 = [
                                                'label' => $menuLevel3['label'],
                                                'route' => $menuLevel3['route'],
                                                'class' => empty($menuLevel3['class']) ? '' :  $menuLevel3['class'],
                                        ];

                                        if (!$acl->isAllowed($session_usertype_id,  $menuLevel3['route'])) {
                                                continue;
                                        }

                                        array_push($optionLevel2['pages'], $optionLevel3);
                                }
                        }


                        array_push($optionLevel1['pages'], $optionLevel2);
                }
        }




        array_push($menu, $optionLevel1);
}


//[REQUEST_URI] => /settings/company-sizes/
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';

if ($request_uri) {
        if (substr($request_uri, 0, 1) == '/') {
                $request_uri = substr($request_uri, 1);
        }
        if (substr($request_uri, strlen($request_uri) - 1, 1) == '/') {
                $request_uri = substr($request_uri, 0, strlen($request_uri) - 1);
        }
}



$jsonMenu = json_encode($menu);

if ($company) {
        $js = <<<JS
        const backendVars= {
                menu:JSON.parse('$jsonMenu'),
                companyId: "$company->uuid",
                companyImg: "$companyImg",
                companyName: "$companyName",
                name: "$names[0]",
        }       
JS;
} else {
        $js = <<<JS
        const backendVars= {
                menu:JSON.parse('$jsonMenu'),
                companyId: "",
                companyImg: "",
                companyName: "",
                name: "",
        }       
JS;
}
$this->inlineScript()->appendScript($js);
$this->inlineScript()->appendFile('/react-bundles/menu/menuBundle.js');

?>
<!DOCTYPE html>
<html lang="es">

<head>
                <?php 
        echo $this->headTitle();
        ?>
        <link rel="icon" href="<?php echo $this->networkFavicoHelper(); ?>">
        <?php
        echo $this->headMeta()->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
                ->appendHttpEquiv('expires', '0')
                ->appendHttpEquiv('expires', 'Tue, 01 Jan 1980 1:00:00 GMT')
                ->appendHttpEquiv('pragma', 'no-cache')
                ->appendHttpEquiv('Cache-Control', 'no-store')
                ->appendHttpEquiv('Cache-Control', 'max-age=0')
                ->appendHttpEquiv('Cache-Control', 'no-cache')
                ->appendHttpEquiv('charset', 'UTF-8')
                ->appendName('viewport', 'width=device-width, initial-scale=1.0');
        ?>

        <!-- Google Font: Source Sans Pro -->
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
        <!-- Font Awesome -->
        <link rel="stylesheet" href="<?php echo $this->basePath('plugins/font-awesome/css/font-awesome.css') ?>">
        <!-- Theme style -->
        <link rel="stylesheet" href="<?php echo $this->basePath('css/adminlte.min.css') ?>">
        <!-- App style -->
        <link rel="stylesheet" href="<?php echo $this->basePath('/react-bundles/menu/main.css') ?>">
        <script src="<?php echo $this->basePath('plugins/ckeditor/ckeditor.js') ?>"></script>

        <?php if ($currentUserHelper->hasIdentity()) :  ?>
                <link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('css/icons.css') ?>" />
                <link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('vendors/smiley/assets/sprites/emojione.sprites.css') ?>" />
                <link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('vendors/uploader/jquery.ui.plupload/css/jquery-ui.css') ?>" />
                <link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('vendors/uploader/jquery.ui.plupload/css/jquery.ui.plupload.css') ?>" />

                <link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('css/chat.css') ?>" />
                <link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('css/style-cesa.css') ?>" />
                <link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('css/responsive-cesa.css') ?>" />
                <link rel="stylesheet" href="<?php echo $this->basePath('css/main.css') ?>">
                
        <?php endif; ?>
        <?php
        echo $this->headStyle();
        echo $this->networkStylesAndColorsHelper();
        echo $this->headLink();
        echo $this->headScript();
        ?>

</head>

<body class="hold-transition sidebar-mini">
        <!-- Site wrapper -->
        <div class="wrapper">

                <div id="menu-sidebar"></div>

                <!-- Content Wrapper. Contains page content -->
                <div class="content-wrapper">
                        <section class="content">
                                <?php echo $this->content ?>
                        </section>


                        <?php
                        if ($currentUserHelper->hasIdentity()) {
                                echo $this->chatHelper($user->id);
                        }
                        ?>

                        <!-- /.content -->
                </div>
                <!-- /.content-wrapper -->
        </div>
        <!-- jQuery -->
        <script src="<?php echo $this->basePath('plugins/jquery/jquery.js') ?>"></script>
        <!-- Bootstrap 4 -->
        <script src="<?php echo $this->basePath('plugins/bootstrap/js/bootstrap.bundle.min.js') ?>"></script>
        <!-- AdminLTE App -->
        <script src="<?php echo $this->basePath('js/adminlte.min.js') ?>"></script>
        <!--  Aplicacion -->
        <script src="<?php echo $this->basePath('plugins/bootstrap-notify/bootstrap-notify.min.js') ?>"></script>
        <script src="<?php echo $this->basePath('js/app.js') ?>"></script>
        <?php if ($currentUserHelper->hasIdentity()) :  ?>
                <script type="text/javascript" src="<?php echo $this->basePath('vendors/smiley/smiley.js') ?>"></script>
                <script type="text/javascript" src="<?php echo $this->basePath('vendors/smiley/js/emojione.min.js') ?>"></script>
        <?php endif; ?>
        <?php
        echo $this->inlineScript();
        ?>


</body>

</html>