Personalized Timetable Tool
💡 Introduction
In today’s student life, accessing your timetable quickly and accurately is crucial. Many of us struggle with messy Excel sheets, confusing subject codes, or big PDFs. To solve this, I designed a Personalized Timetable Tool that shows exactly what each student has, based on their selected subjects — lightweight, mobile-friendly, and easy to access as a Progressive Web App (PWA).
🗄️ Backend: Database Structure and Logic
👤 Students Table
I started with a students table that stores:
-
roll_no(student roll number) -
name -
Subject codes as columns (like
22CS1157,22CS1104, etc.), where value1means opted and0means not opted.
This design allows us to dynamically determine which subjects each student has chosen.
📄 Subjects Mapping Table
We have a subjects table that maps:
-
subject_name→subject_code
This ensures we can match names in the timetable JSON to codes in the student table.
🗓️ JSON-based Master Timetable
I prepared a master_timetable.json file that contains:
-
Day-wise slots
-
Subjects possible in each slot
-
Corresponding room numbers
Each slot also contains an array of rooms, which matches the subjects list.
⚙️ Backend Script: get_timetable.php
When a student logs in and selects a day:
-
We load their roll number from the session.
-
We load
master_timetable.jsonand filter slots for that day. -
We fetch the student’s subject selections from the DB.
-
For each slot, we check:
-
If the student opted for any subject in that slot.
-
If no subject matched, we mark it as
🎉. -
Lunch and "Honors / Minors" slots are handled separately.
-
-
We prepare a personalized JSON response with time, subject, and room.
🖥️ Frontend: fetch.php
Once logged in, students land on a stylish dark-themed dashboard.
Key features:
-
Shows student’s name (fetched from DB).
-
Day selector dropdown.
-
"Check Today's" button (auto-selects today’s day using Asia/Kolkata timezone).
-
Logout button.
When a day is selected:
-
A loader (spinner) fades in, blocking until data loads.
-
Personalized timetable is displayed in a dark-themed table with white text.
-
Room information is included with each subject.
📲 Progressive Web App (PWA) Support
Manifest & Icons
-
I added a
manifest.jsoncontaining app metadata, icons (192x192,512x512), theme colors, etc. -
Ensures it appears as a real app when added to home screen.
🔥 FCM Push Notifications with Cron
Each student’s FCM token is stored when they log in (via save_fcm_token.php).
The cron job:
-
Runs every 5 minutes automatically.
-
Checks the master timetable JSON to see if any slot starts in the next 5 minutes (Asia/Kolkata timezone).
-
For each student:
-
Finds if they have opted for a subject in that slot.
-
Ignores Lunch or Honors/Minors slots.
-
Sends a high-priority push notification with subject and room number.
-
-
Uses Firebase Cloud Messaging v1 API, secured with access tokens.
🔐 Access Token Handling (Vendor & Composer)
We use the Firebase Admin SDK, installed via Composer (vendor folder in /csm/push/).
Our access_token.php:
-
Generates a new access token from Firebase service account JSON.
-
Saves it into
access_token.json. -
If expired, automatically refreshes the token on next cron run.
Ensures notifications are always authenticated securely.
⚙️ Cron Job (Server-Side Automation)
A PHP cron script runs every 5 minutes on the server.
No manual intervention needed — it auto-checks current time and slots, sends notifications to each student.
Service Worker
We created a basic service-worker.js that enables install prompts and future caching (if needed).
Add to Home Screen
-
A custom "Add to Home Screen" button is shown only if not already installed.
-
Uses
beforeinstallpromptevent to trigger native prompt. -
Hides button automatically if the app is already running in standalone mode.
🔐 Authentication
-
Login using roll number.
-
Roll number is stored in PHP session to keep students logged in.
-
Secure backend checks prevent access if not logged in.
-
A dedicated Logout button destroys the session and redirects to home.
🌟 User Experience Polishing
-
Good accent colors for headings and labels.
-
"Made with ❤️ by R Viswath" footer, linking to my personal website.
-
Clean, compact layout that feels like a native app.
-
Smooth fade-in of loader and tables for an elegant touch.
💬 Final Thoughts
This tool:
✅ Removes need for heavy Excel sheets.
✅ Automatically filters subjects based on student selections.
✅ Works seamlessly on mobile, and can be added as an app.
✅ Is fast, beautiful, and personalized!
🔗 Try It Out
✉️ Have feedback or want to build your own?
Feel free to reach out via viswath.me 💬
✨ Bonus: How "auto run" works (cron job magic)
The magic behind automated push reminders:
-
Cron job runs automatically every 5 minutes — no need for you or students to open the site.
-
Uses timezone-aware logic to check slots.
-
Your server handles all logic and fires notifications in the background.
🎁 Conclusion
With this project, we've blended PHP, Ajax, MySQL, JSON, Bootstrap, jQuery, and PWA standards into a single, modern student tool. Not only is it technically robust, it is designed with care to simplify everyday life for students.
Leave a Comment