<?php





// Prepare and execute the query to fetch profile information
$stmt = $conn->prepare("SELECT profile_picture, name FROM profiles WHERE student_id = ?");
if (!$stmt) {
    echo "Error preparing statement: " . $conn->error;
    exit;
}
$stmt->bind_param("i", $studentId);
$stmt->execute();
$result = $stmt->get_result();
$profile = $result->fetch_assoc();

// Close the statement and connection
$stmt->close();
$conn->close();

// Construct the path for the profile picture
$profilePicturePath = "/csms/student/uploads/" . htmlspecialchars($profile['profile_picture']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Social Circle Dashboard</title>
    <link rel="stylesheet" href="path/to/your/styles.css"> <!-- Ensure CSS path is correct -->
    <link rel="stylesheet" href="path/to/bootstrap.min.css"> <!-- Include Bootstrap for styling -->
    <style type="text/css">
       aside {
    width: 250px;
    float: left;
    background-color: #34495e;
    border-right: 1px solid #e1e4e8;
    padding: 20px;
}

.profile-info {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.profile-info img {
    height: 60px;
    border-radius: 50%;
    margin-right: 15px;
}

.profile-info .profile-name {
    font-size: 18px;
    font-weight: bold;
}

nav ul {
    list-style: none;
    padding: 0;
}

nav ul li {
    margin-bottom: 10px;
}

nav ul li a {
    text-decoration: none;
    color: white;
}

nav ul li a:hover {
    color: #007bff;
}

.joined {
    margin-top: 20px;
}

.joined h4 {
    font-size: 16px;
    margin-bottom: 10px;
}

.joined ul {
    list-style: none;
    padding: 0;
}

.joined ul li {
    margin-bottom: 5px;
}

.joined ul li a {
    text-decoration: none;
    color: white;
}

.joined ul li a:hover {
    color: #fff;
}

    </style>
</head>
<aside>
    <div class="sidebar">
        <div class="profile-info">
                <img src="<?php echo $profilePicturePath; ?>" alt="Profile Picture" style="max-width: 200px; height: auto;">
                <span class="profile-name"><?php echo htmlspecialchars($profile['name']); ?></span>
            </div>
        <nav>
            <ul>
                <li><a href="profile.php">Profile</a></li>
                <li><a href="friends.php">Friends</a></li>
                <li><a href="groups.php">Groups</a></li>
                <li><a href="events.php">Events</a></li>
                <li><a href="notifications.php">Notifications</a></li>
                <li><a href="pages.php">Pages</a></li>
            </ul>
        </nav>
        <div class="joined">
            <h4>Joined Groups</h4>
            <ul>
                <!-- Populate with user’s joined groups -->
                <li><a href="group.php?id=1">Group Name</a></li>
            </ul>
            <h4>Joined Pages</h4>
            <ul>
                <!-- Populate with user’s joined pages -->
                <li><a href="page.php?id=1">Page Name</a></li>
            </ul>
        </div>
    </div>
</aside>
