1.8
This commit is contained in:
parent
3ed0ed7aeb
commit
e6ade2ba41
@ -18,22 +18,36 @@ if (!$user) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Fetch all skills
|
||||
$skills_by_category = [];
|
||||
$stmt = db()->query("SELECT * FROM skills ORDER BY category, title");
|
||||
$all_skills = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
foreach ($all_skills as $skill) {
|
||||
$skills_by_category[$skill['category']][] = $skill;
|
||||
}
|
||||
|
||||
// Hardcoded enrolled skills for now
|
||||
$enrolled_skills = [
|
||||
['title' => 'Introduction to Python', 'progress' => 60, 'thumbnail' => 'assets/images/python.png'],
|
||||
['title' => 'Web Development Basics', 'progress' => 25, 'thumbnail' => 'assets/images/webdev.png'],
|
||||
];
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Dashboard - My SaaS</title>
|
||||
<title>Dashboard - TAP2SKILL</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
|
||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="sidebar">
|
||||
<a class="navbar-brand" href="index.php">My SaaS</a>
|
||||
<a class="navbar-brand" href="index.php">TAP2SKILL</a>
|
||||
<hr>
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item">
|
||||
@ -62,41 +76,69 @@ if (!$user) {
|
||||
<div class="main-content">
|
||||
<div class="container-fluid">
|
||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
||||
<h1 class="h2">Dashboard</h1>
|
||||
<h1 class="h2">Welcome, <?php echo htmlspecialchars($user['username']); ?>!</h1>
|
||||
</div>
|
||||
|
||||
<h2>Welcome, <?php echo htmlspecialchars($user['username']); ?>!</h2>
|
||||
<p class="lead">Here's a quick overview of your account.</p>
|
||||
<!-- Quick Access Buttons -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-4">
|
||||
<a href="#skill-explorer" class="btn btn-primary btn-lg w-100">Explore Skills</a>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<a href="#enrolled-skills" class="btn btn-success btn-lg w-100">Continue Learning</a>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<a href="#" class="btn btn-info btn-lg w-100">Community</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-4">
|
||||
<div class="card text-white bg-primary mb-3">
|
||||
<div class="card-header">Projects</div>
|
||||
<!-- Enrolled Skills Section -->
|
||||
<section id="enrolled-skills" class="mb-5">
|
||||
<h2 class="h4">My Enrolled Skills</h2>
|
||||
<div class="row">
|
||||
<?php if (empty($enrolled_skills)): ?>
|
||||
<p>You are not enrolled in any skills yet. Explore the skills below to get started!</p>
|
||||
<?php else: ?>
|
||||
<?php foreach ($enrolled_skills as $skill): ?>
|
||||
<div class="col-md-6 col-lg-4 mb-3">
|
||||
<div class="card">
|
||||
<img src="<?php echo htmlspecialchars($skill['thumbnail']); ?>" class="card-img-top" alt="<?php echo htmlspecialchars($skill['title']); ?>">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">5</h5>
|
||||
<p class="card-text">You have 5 active projects.</p>
|
||||
<h5 class="card-title"><?php echo htmlspecialchars($skill['title']); ?></h5>
|
||||
<div class="progress">
|
||||
<div class="progress-bar" role="progressbar" style="width: <?php echo $skill['progress']; ?>%;" aria-valuenow="<?php echo $skill['progress']; ?>" aria-valuemin="0" aria-valuemax="100"><?php echo $skill['progress']; ?>%</div>
|
||||
</div>
|
||||
<a href="#" class="btn btn-primary mt-3">Continue</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card text-white bg-success mb-3">
|
||||
<div class="card-header">Tasks</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">12</h5>
|
||||
<p class="card-text">You have 12 pending tasks.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card text-white bg-info mb-3">
|
||||
<div class="card-header">Team Members</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">3</h5>
|
||||
<p class="card-text">You have 3 team members.</p>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Skill Explorer Section -->
|
||||
<section id="skill-explorer">
|
||||
<h2 class="h4">Skill Explorer</h2>
|
||||
<?php foreach ($skills_by_category as $category => $skills): ?>
|
||||
<h3 class="h5 mt-4"><?php echo htmlspecialchars($category); ?></h3>
|
||||
<div class="row">
|
||||
<?php foreach ($skills as $skill): ?>
|
||||
<div class="col-md-6 col-lg-3 mb-3">
|
||||
<div class="card h-100">
|
||||
<img src="<?php echo htmlspecialchars($skill['thumbnail']); ?>" class="card-img-top" alt="<?php echo htmlspecialchars($skill['title']); ?>">
|
||||
<div class="card-body d-flex flex-column">
|
||||
<h5 class="card-title"><?php echo htmlspecialchars($skill['title']); ?></h5>
|
||||
<p class="card-text flex-grow-1"><?php echo htmlspecialchars($skill['description']); ?></p>
|
||||
<a href="#" class="btn btn-outline-primary mt-auto">Enroll</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
21
db/migrate.php
Normal file
21
db/migrate.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/config.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$migration_files = glob(__DIR__ . '/migrations/*.sql');
|
||||
sort($migration_files);
|
||||
|
||||
foreach ($migration_files as $file) {
|
||||
echo "Running migration: " . basename($file) . "...\n";
|
||||
$sql = file_get_contents($file);
|
||||
$pdo->exec($sql);
|
||||
echo "Success.\n";
|
||||
}
|
||||
|
||||
echo "\nAll migrations completed successfully!\n";
|
||||
|
||||
} catch (PDOException $e) {
|
||||
die("Database migration failed: " . $e->getMessage());
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
CREATE TABLE IF NOT EXISTS `users` (
|
||||
`id` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`username` VARCHAR(255) NOT NULL UNIQUE,
|
||||
`email` VARCHAR(255) NOT NULL UNIQUE,
|
||||
`password` VARCHAR(255) NOT NULL,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
7
db/migrations/003_create_skills_table.sql
Normal file
7
db/migrations/003_create_skills_table.sql
Normal file
@ -0,0 +1,7 @@
|
||||
CREATE TABLE IF NOT EXISTS `skills` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`category` VARCHAR(100) NOT NULL,
|
||||
`description` TEXT,
|
||||
`thumbnail` VARCHAR(255)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
8
db/migrations/004_create_user_skills_table.sql
Normal file
8
db/migrations/004_create_user_skills_table.sql
Normal file
@ -0,0 +1,8 @@
|
||||
CREATE TABLE IF NOT EXISTS `user_skills` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`user_id` int(11) unsigned NOT NULL,
|
||||
`skill_id` int(11) NOT NULL,
|
||||
`progress` INT DEFAULT 0,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id),
|
||||
FOREIGN KEY (skill_id) REFERENCES skills(id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
11
db/migrations/005_insert_sample_skills.sql
Normal file
11
db/migrations/005_insert_sample_skills.sql
Normal file
@ -0,0 +1,11 @@
|
||||
INSERT INTO `skills` (`title`, `category`, `description`, `thumbnail`) VALUES
|
||||
('Introduction to Python', 'Tech', 'Learn the fundamentals of Python programming.', 'assets/images/python.png'),
|
||||
('Web Development Basics', 'Tech', 'Understand HTML, CSS, and JavaScript.', 'assets/images/webdev.png'),
|
||||
('Data Analysis with Pandas', 'Tech', 'Analyze data effectively using the Pandas library.', 'assets/images/pandas.png'),
|
||||
('Basic Carpentry', 'Trade', 'Learn to build simple wooden furniture.', 'assets/images/carpentry.png'),
|
||||
('Electrical Wiring 101', 'Trade', 'Understand the basics of home electrical wiring.', 'assets/images/wiring.png'),
|
||||
('Digital Painting', 'Art', 'Create stunning digital art with this introductory course.', 'assets/images/digital_painting.png'),
|
||||
('Music Production Fundamentals', 'Art', 'Learn to produce your own music from scratch.', 'assets/images/music_production.png'),
|
||||
('Introduction to Business', 'Business', 'Learn the basics of starting and running a business.', 'assets/images/business.png'),
|
||||
('Marketing for Beginners', 'Business', 'Understand the fundamentals of modern marketing.', 'assets/images/marketing.png'),
|
||||
('Personal Finance Management', 'Business', 'Take control of your finances.', 'assets/images/finance.png');
|
||||
20
db/show_schema.php
Normal file
20
db/show_schema.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/config.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
|
||||
$stmt = $pdo->query("SHOW CREATE TABLE users");
|
||||
$user_table_def = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
echo "Users table definition:\n";
|
||||
print_r($user_table_def);
|
||||
|
||||
$stmt = $pdo->query("SHOW CREATE TABLE skills");
|
||||
$skill_table_def = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
echo "\nSkills table definition:\n";
|
||||
print_r($skill_table_def);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
die("Database query failed: " . $e->getMessage());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user