wefra-odoo11/themes/materialize/index.php

242 lines
10 KiB
PHP
Raw Permalink Normal View History

2019-10-02 21:28:58 +00:00
<?php
if(isset($_POST['formLoginButtonSubmit'])){
$url = $_SESSION['erp']['url'];
$db = $_SESSION['erp']['db'];
$username = $_POST['formLoginFieldEmail'];
$user = $oUser->login($_POST);
if(isset($user['email']) && $user['email'] == $username){
$password = $user['password'];
$common = ripcord::client($url."xmlrpc/2/common");
$user['ext_id'] = $common->authenticate($db, $username, $password, array());
$models = ripcord::client($url."xmlrpc/2/object");
$user['erp'] = $models->execute_kw($db, $user['ext_id'], $password, 'res.users', 'search_read', array(array(array('id', '=', $user['ext_id']))), array('fields'=>array())); //, 'limit'=>5
$_SESSION['translations'] = $oTrans->listTranslations($user['lang_code']);
$_SESSION['user'] = $user;
$_SESSION['features'] = $oFeat->getFeaturesOfUser($user['id'], $user['lang_code']);
header("Location:".$oConf->getURLRoot());
} else {
$_SESSION['user'] = $user;
$_SESSION['message']['status'] = "orange";
$_SESSION['message']['content'] = "<b>Bad login or password</b>";
}
}
$session_lifetime = 60*60*8;
if(isset($_SESSION['user']) and isset($_SESSION['user']['stay_connected']) and $_SESSION['user']['stay_connected'] == true){
$session_lifetime = 60*60*24*365*5;
}
setcookie(session_name(),session_id(),time() + $session_lifetime);
$lang_code = (isset($_SESSION['user']['lang_code']))?$_SESSION['user']['lang_code']:$_SESSION['config']['default_lang_code'];
?>
<!DOCTYPE html>
<html lang="<?php echo substr($lang_code, 0, 2); ?>">
<head>
<!--META-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Code & Make CASH</title>
<!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="<?php echo $oConf->getURLRoot('lib/materialize/materialize-1.1.0.min.css'); ?>" type="text/css" rel="stylesheet" media="screen,projection"/>
2019-10-02 21:28:58 +00:00
<link href="<?php echo $oConf->getURLRoot('themes/materialize/css/style.css'); ?>" type="text/css" rel="stylesheet" media="screen,projection"/>
<!--JQUERY and addons-->
<script src="<?php echo $oConf->getURLRoot('lib/jquery/jquery-3.2.1.js'); ?>"></script>
<script src="<?php echo $oConf->getURLRoot('lib/jquery/jquery-ui.js'); ?>"></script>
<script src="<?php echo $oConf->getURLRoot('lib/materialize/materialize-1.1.0.min.js'); ?>"></script>
2019-10-02 21:28:58 +00:00
<script src="<?php echo $oConf->getURLRoot('themes/materialize/js/init.js'); ?>"></script>
<!--D3JS v5-->
<script src="<?php echo $oConf->getURLRoot('lib/d3-v5/d3.min.js'); ?>"></script>
<script src="<?php echo $oConf->getURLRoot('scripts/config.js'); ?>"></script>
</head>
<body class="">
<?php
if(isset($display_cookie_message)){
echo '<div class="alert alert-warning" style="margin:0px;">'.$oTrans->getTranslation('display_cookie_message', $_SESSION['config']['default_lang_code']).'</div>';
unset($display_cookie_message);
}
?>
<nav class="orange darken-4" role="navigation">
<div class="nav-wrapper container">
<a id="logo-container" href="<?php echo $oConf->getURLRoot(); ?>" class="brand-logo"><img src="<?php echo $oConf->getURLRoot("./images/logos/logo_high_resolution.png"); ?>" height="25" padding-top="-2"; class="d-inline-block" alt=""></a>
<ul class="right hide-on-med-and-down">
<!--<li><a href="#">Navbar Link</a></li>-->
<?php
foreach($_SESSION['features'] as $k=>$v){
// condition for guest features
if ($_SESSION['features'][$k]->is_menu_display == true){
// condition for logout
if ($_SESSION['features'][$k]->code == 'logout'){
echo '
<li class="">
<a class="nav-link" href="'.$oConf->getURLScript('logout.php').'">'.$_SESSION['features'][$k]->menu_label.'
</a>
</li>';
// and condition for others (not logout)
} else {
if($_SESSION['features'][$k]->is_parent==true){
$subFeatures = (isset($_SESSION['user']))
?$oFeat->getSubFeaturesForUser($_SESSION['features'][$k]->id, $_SESSION['user']['lang_code'])
:$oFeat->getSubFeatures($_SESSION['features'][$k]->id, $_SESSION['config']['default_lang_code']);
// <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"
echo '
<li class="dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"
href="'.$oConf->getURLRoot($_SESSION['features'][$k]->url).'">
<span class="'.$_SESSION['features'][$k]->menu_icon.'"></span>'.$_SESSION['features'][$k]->menu_label.'
</a>
<ul class="dropdown-menu">';
foreach($subFeatures as $subFeature){
echo '
<li class="nav-item-submenu">
<a class="nav-link" href="'.$oConf->getURLRoot($subFeature->url).'">
<span class="'.$subFeature->menu_icon.'"></span>'.$subFeature->menu_label.'
</a>
</li>';
}
echo '</ul>
</li>';
} else {
echo '
<li class="nav-item">
<a class="nav-link" href="'.$oConf->getURLRoot($_SESSION['features'][$k]->url).'">
<span class="'.$_SESSION['features'][$k]->menu_icon.'"></span>'.$_SESSION['features'][$k]->menu_label.'
</a>
</li>';
}
}
}
} //ENDOF foreach($_SESSION['features'] as $k=>$v){
$li_list = '';
foreach($_SESSION['activeLanguages'] as $language){
if($language['code'] == $_SESSION['config']['default_lang_code']){
$li_active_language = '<img src="'.$oConf->getURLRoot("images/flags/default/".$language['code']).'.png" style="width:25px;">';
} else {
$li_list .= '<li><a href="'.$oConf->getURLRoot("scripts/changeLang.php?lang=".$language['code']).'"><img src="'.$oConf->getURLRoot("images/flags/default/".$language['code']).'.png" style="width:25px;"></a></li>';
}
}
2019-10-02 21:28:58 +00:00
?>
<!--DISPLAYS FLAGS FOR LANGUAGES-->
<ul id="dropdown1" class="dropdown-content">
<?php echo $li_list; ?>
</ul>
<li><a class="dropdown-trigger" href="#!" data-target="dropdown1"><?php echo $li_active_language; ?><i class="material-icons right">arrow_drop_down</i></a></li>
2019-10-02 21:28:58 +00:00
</ul>
<ul id="nav-mobile" class="sidenav">
<!--<li><a href="#">Navbar Link</a></li>-->
2019-10-02 21:28:58 +00:00
<?php
foreach($_SESSION['features'] as $k=>$v){
// condition for guest features
if ($_SESSION['features'][$k]->is_menu_display == true){
2019-10-02 21:28:58 +00:00
// condition for logout
if ($_SESSION['features'][$k]->code == 'logout'){
echo '
<li class="">
<a class="nav-link" href="'.$oConf->getURLScript('logout.php').'">'.$_SESSION['features'][$k]->menu_label.'
</a>
</li>';
// and condition for others (not logout)
} else {
if($_SESSION['features'][$k]->is_parent==true){
$subFeatures = (isset($_SESSION['user']))
?$oFeat->getSubFeaturesForUser($_SESSION['features'][$k]->id, $_SESSION['user']['lang_code'])
:$oFeat->getSubFeatures($_SESSION['features'][$k]->id, $_SESSION['config']['default_lang_code']);
// <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"
echo '
<li class="dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"
href="'.$oConf->getURLRoot($_SESSION['features'][$k]->url).'">
<span class="'.$_SESSION['features'][$k]->menu_icon.'"></span>'.$_SESSION['features'][$k]->menu_label.'
</a>
<ul class="dropdown-menu">';
foreach($subFeatures as $subFeature){
echo '
<li class="nav-item-submenu">
<a class="nav-link" href="'.$oConf->getURLRoot($subFeature->url).'">
<span class="'.$subFeature->menu_icon.'"></span>'.$subFeature->menu_label.'
</a>
</li>';
}
echo '</ul>
</li>';
} else {
echo '
<li class="nav-item">
<a class="nav-link" href="'.$oConf->getURLRoot($_SESSION['features'][$k]->url).'">
<span class="'.$_SESSION['features'][$k]->menu_icon.'"></span>'.$_SESSION['features'][$k]->menu_label.'
</a>
</li>';
}
}
}
} //ENDOF foreach($_SESSION['features'] as $k=>$v){
?>
</ul>
<a href="#" data-target="nav-mobile" class="sidenav-trigger"><i class="material-icons">menu</i></a>
</div>
</nav>
<!--ENDOF nav tag-->
<!-- get and displays content of requested web page -->
<main>
<?php $oController->getPage("materialize", $lang_code); ?>
</main>
<!-- FOOTER SECTION -->
<footer class="page-footer orange darken-2">
<div class="container">
<div class="row">
<div class="col l6 s12">
<h5 class="grey-text text-darken-3">Company Bio</h5>
<p class="grey-text text-darken-4">JMDN Solutions Sàrl is a Swiss based company and provide services in Information Technology/Systems, Data Visualisation and everything related to Software Development</p>
</div>
<!--
<div class="col l6 s12">
<h5 class="grey-text text-darken-3">Legal</h5>
<ul>
<li><a class="grey-text text-darken-4" href="terms-of-services" target="_blank">Terms of services</a></li>
<li><a class="grey-text text-darken-4" href="privacy-policy" target="_blank">Privacy Policy</a></li>
<li><a class="grey-text text-darken-4" href="cookies-policy" target="_blank">Cookies Policy</a></li>
</ul>
</div>
-->
</div>
</div>
<div class="footer-copyright">
<div class="container">
Made by <a class="brown-text text-lighten-3" href="https://www.jmdn-group.com">JMDN Solutions Sàrl</a>
</div>
</div>
</footer>
<!-- Scripts-->
<script type="text/javascript">
$(document).ready(function(){
$('select').formSelect();
2019-10-02 21:28:58 +00:00
});
</script>
</body>
</html>