Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules/
20 changes: 20 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Route to select a course
app.post('/select-course', (req, res) => {
const userId = req.user.id;
const courseId = req.body.courseId;
const query = 'INSERT INTO user_courses (user_id, course_id) VALUES (?, ?)';
db.query(query, [userId, courseId], (err) => {
if (err) throw err;
res.redirect('/courses');
});
});

// Route to display selected courses
app.get('/my-courses', (req, res) => {
const userId = req.user.id;
const query = 'SELECT * FROM courses WHERE id IN (SELECT course_id FROM user_courses WHERE user_id = ?)';
db.query(query, [userId], (err, results) => {
if (err) throw err;
res.render('courses', { courses: results });
});
});
8 changes: 6 additions & 2 deletions course-content.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ <h1 id="course-name">Course Name</h1>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/course-content">Course Content</a></li>
<li><a href="course-content.html">Course Content</a></li>
<li><a href="leader-board.html">Leaderboard</a></li>
<!-- Add more navigation links as needed -->
</ul>
</nav>
</header>
<main id="course-content">
<!-- Course content will be dynamically populated here -->
<section id="selected-courses">
<h2>Selected Courses</h2>
<!-- This will be dynamically populated with user's selected courses -->
</section>
</main>
<footer>
<p>&copy; 2024 Your LMS</p>
Expand Down
25 changes: 25 additions & 0 deletions courses.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Courses</title>
</head>
<body>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/course-content">Course Content</a></li>
<li><a href="/courses.html">Course Content</a></li>
<!-- Add more navigation links as needed -->
</ul>
</nav>
<ul>
<li><a href="/course-content">Course 1</a></li>
<li><a href="/course-content">Course 2</a></li>
<li><a href="/course-content">Course 3</a></li>
<li><a href="/course-content">Course 4</a></li>
<li><a href="/course-content">Course 5</a></li>
</ul>
</body>
</html>
5 changes: 5 additions & 0 deletions dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ <h1>Welcome to Your Dashboard</h1>
<ul>
<li><a href="/leaderboard">Leaderboard</a></li>
<li><a href="/course-content">Course Content</a></li>
<li><a href="leaderboard.html">Leaderboard</a></li>
<!-- Add more navigation links as needed -->
</ul>
</nav>
Expand All @@ -22,6 +23,10 @@ <h1>Welcome to Your Dashboard</h1>
<h2>Hello, <span id="user-fullname"></span>!</h2>
<p>Welcome to your personalized dashboard.</p>
</section>
<section id="selected-courses">
<h2>Selected Courses</h2>
<!-- This will be dynamically populated with user's selected courses -->
</section>
</main>
<footer>
<p>&copy; 2024 Your LMS</p>
Expand Down
13 changes: 12 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,20 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Learning Management App</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="./style.css">
</head>
<body>
<header>
<h1>Learning Management App</h1>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="course-content.html">Course Content</a></li>
<li><a href="leaderboard.html">Leaderboard</a></li>
<li><a href="courses.html">My Courses</a></li>
</ul>
</nav>
</header>
<h1>Learning Management App</h1>
<form id="register-form">
<h2>Register</h2>
Expand Down
61 changes: 31 additions & 30 deletions leader-board.html → leaderboard.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Leaderboard</title>
<link rel="stylesheet" href="styles.css"> <!-- Include your CSS file -->
</head>
<body>
<header>
<h1>Leaderboard</h1>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/course-content">Course Content</a></li>
<!-- Add more navigation links as needed -->
</ul>
</nav>
</header>
<main id="leaderboard">
<!-- Leaderboard data will be dynamically populated here -->
</main>
<footer>
<p>&copy; 2024 Your LMS</p>
</footer>

<!-- Include your client-side JavaScript file -->
<script src="script.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Leaderboard</title>
<link rel="stylesheet" href="styles.css"> <!-- Include your CSS file -->
</head>
<body>
<header>
<h1>Leaderboard</h1>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/course-content">Course Content</a></li>
<li><a href="courses.html">My Courses</a></li>
<!-- Add more navigation links as needed -->
</ul>
</nav>
</header>
<main id="leaderboard">
<!-- Leaderboard data will be dynamically populated here -->
</main>
<footer>
<p>&copy; 2024 Your LMS</p>
</footer>

<!-- Include your client-side JavaScript file -->
<script src="script.js"></script>
</body>
</html>
Loading