fixed different login
This commit is contained in:
@@ -9,8 +9,7 @@ if (!empty($_SESSION['school_id'])) {
|
||||
$stmt_school = $pdo->prepare("SELECT name, logo FROM schools WHERE id = ?");
|
||||
$stmt_school->execute([$school_id]);
|
||||
$current_school = $stmt_school->fetch(PDO::FETCH_ASSOC);
|
||||
echo $current_school['name'];
|
||||
echo "Ciao";
|
||||
|
||||
if ($current_school) {
|
||||
$school_display_name = $current_school['name'];
|
||||
|
||||
@@ -24,6 +23,14 @@ if (!empty($_SESSION['school_id'])) {
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
// Gate per mostrare logo + menu Utente
|
||||
// - Admin e User: sempre
|
||||
// - school_owner: solo se ha record in user_schools
|
||||
$showUserArea = (Auth::user()->hasRole('Admin') || Auth::user()->hasRole('User'))
|
||||
|| (Auth::user()->hasRole('school_owner') && !empty($hasUserSchools));
|
||||
?>
|
||||
|
||||
<style>
|
||||
.school-info {
|
||||
background: #f8f9fa;
|
||||
@@ -55,26 +62,28 @@ if (!empty($_SESSION['school_id'])) {
|
||||
<!--navigation-->
|
||||
<ul class="metismenu" id="menu">
|
||||
<!-- Logo e nome scuola corrente -->
|
||||
<!-- Logo e nome scuola corrente (rettangolare, naturale) -->
|
||||
<div class="school-info text-center py-3 px-2 border-bottom">
|
||||
<?php if ($logoRaw): ?>
|
||||
<img src="<?= htmlspecialchars($logoRaw) ?>"
|
||||
alt="Logo <?= htmlspecialchars($school_display_name) ?>"
|
||||
class="img-fluid mb-2"
|
||||
style="max-height: 80px; width: auto; object-fit: contain; border-radius: 8px; border: 1px solid #e9ecef; box-shadow: 0 2px 6px rgba(0,0,0,0.08);">
|
||||
<?php else: ?>
|
||||
<div class="bg-light d-inline-block p-3 mb-2 rounded-3" style="width: 60px; height: 60px;">
|
||||
<i class="bx bx-building-house bx-md text-muted"></i>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($showUserArea): ?>
|
||||
<div class="school-info text-center py-3 px-2 border-bottom">
|
||||
<?php if (!empty($logoRaw)): ?>
|
||||
<img src="<?= htmlspecialchars($logoRaw) ?>"
|
||||
alt="Logo <?= htmlspecialchars($school_display_name) ?>"
|
||||
class="img-fluid mb-2"
|
||||
style="max-height: 80px; width: auto; object-fit: contain; border-radius: 8px; border: 1px solid #e9ecef; box-shadow: 0 2px 6px rgba(0,0,0,0.08);">
|
||||
<?php else: ?>
|
||||
<div class="bg-light d-inline-block p-3 mb-2 rounded-3" style="width: 60px; height: 60px;">
|
||||
<i class="bx bx-building-house bx-md text-muted"></i>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="fw-bold text-truncate" style="font-size: 1rem; max-width: 180px; margin: 0 auto;">
|
||||
<?= htmlspecialchars($school_display_name) ?>
|
||||
<div class="fw-bold text-truncate" style="font-size: 1rem; max-width: 180px; margin: 0 auto;">
|
||||
<?= htmlspecialchars($school_display_name) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
//menù user
|
||||
if ((Auth::user()->hasRole('User')) || (Auth::user()->hasRole('Admin'))) : ?>
|
||||
if ($showUserArea) : ?>
|
||||
<li class="menu-label">Utente</li>
|
||||
<li>
|
||||
<a href="user_dashboard.php">
|
||||
@@ -145,12 +154,12 @@ if (!empty($_SESSION['school_id'])) {
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<li class="menu-label">Insegnanti</li>
|
||||
|
||||
<?php
|
||||
//menù teacher
|
||||
|
||||
if ((Auth::user()->hasRole('school_owner')) || (Auth::user()->hasRole('Admin'))) : ?>
|
||||
|
||||
<li class="menu-label">Insegnanti</li>
|
||||
<li>
|
||||
<a href="teacher_list.php">
|
||||
<div class="parent-icon"><i class="bx bx-chalkboard"></i></div>
|
||||
|
||||
Reference in New Issue
Block a user