EPI Calendar Project 01 - Install Instructions
==============================================

ZIP FILE NAME:
epi-calendar-project-01.zip

IMPORTANT:
This project does NOT use Composer.
It uses PHP's native MongoDB extension: mongodb.
Your Namecheap/cPanel hosting must have the mongodb PHP extension enabled.
If it is not enabled, ask Namecheap/reseller support to enable the PHP mongodb extension for your cPanel account and PHP version.

WHAT IS INSIDE THIS ZIP
-----------------------
1. calendar.php
   Public 2026 calendar page.

2. eventcalendar.php
   Public monthly event list page.

3. styles.css
   Responsive styling for public and temporary manager pages.

4. lib/calendar_functions.php
   Shared PHP functions for MongoDB connection and event queries.

5. mgr/eventslist.php
   Temporary manager page that lists events.

6. mgr/addevent.php
   Temporary manager page to add an event.

7. mgr/viewevent.php
   Temporary manager page to view one event.

8. mgr/import_sample_events.php
   Temporary helper page to insert the 3 sample JSON records.

9. private_dv/mongo_config.php
   Secure MongoDB connection config file.

10. sample_events.json
   Three sample event records you can insert into MongoDB.


STEP 1 - UNZIP ON YOUR COMPUTER
-------------------------------
Right-click epi-calendar-project-01.zip and unzip it.
You will see a folder named epi-calendar-project-01.


STEP 2 - PUT THE PRIVATE CONFIG FOLDER IN THE CPANEL ROOT
---------------------------------------------------------
In cPanel File Manager, go to your account root folder.
This is usually one level ABOVE public_html.

Example:
/home/YOUR_CPANEL_USERNAME/

Upload or move this folder there:
private_dv

Final location should look like this:
/home/YOUR_CPANEL_USERNAME/private_dv/mongo_config.php

Do NOT put private_dv inside public_html if you can avoid it.
It is meant to stay outside the public website folder.


STEP 3 - EDIT YOUR MONGODB USERNAME AND PASSWORD
------------------------------------------------
Open this file in cPanel File Manager:
/home/YOUR_CPANEL_USERNAME/private_dv/mongo_config.php

Find this line:
'mongo_uri' => 'mongodb+srv://YOUR_MONGO_USERNAME:YOUR_MONGO_PASSWORD@composes-migrat-nyc1-2-15-2023-8667e735.mongo.ondigitalocean.com/admin?tls=true&authSource=admin',

Replace YOUR_MONGO_USERNAME with your real MongoDB username.
Replace YOUR_MONGO_PASSWORD with your real MongoDB password.

Save the file.

Database name is already set to:
calendar_t01

Collection name is already set to:
events


STEP 4 - UPLOAD THE PUBLIC FILES
--------------------------------
Upload these files/folders into the website folder for the domain.
This is usually public_html, or the document root for the domain.

Upload:
calendar.php
eventcalendar.php
styles.css
sample_events.json
lib
mgr

Example final locations:
/home/YOUR_CPANEL_USERNAME/public_html/calendar.php
/home/YOUR_CPANEL_USERNAME/public_html/eventcalendar.php
/home/YOUR_CPANEL_USERNAME/public_html/styles.css
/home/YOUR_CPANEL_USERNAME/public_html/lib/calendar_functions.php
/home/YOUR_CPANEL_USERNAME/public_html/mgr/eventslist.php
/home/YOUR_CPANEL_USERNAME/public_html/mgr/addevent.php
/home/YOUR_CPANEL_USERNAME/public_html/mgr/viewevent.php
/home/YOUR_CPANEL_USERNAME/public_html/mgr/import_sample_events.php
/home/YOUR_CPANEL_USERNAME/public_html/sample_events.json


STEP 5 - CREATE THE DATABASE AND COLLECTION IN MONGODB
------------------------------------------------------
In MongoDB / DigitalOcean MongoDB tools, create or use this database:
calendar_t01

Create or use this collection:
events

If the database or collection does not show yet, inserting the first event normally creates it.


STEP 6 - ADD SAMPLE DATA
------------------------
Option A: Use the temporary browser import page.
Open this URL in your browser:
https://YOURDOMAIN.com/mgr/import_sample_events.php

Click:
Import Sample Events

Option B: Manually import sample_events.json using your MongoDB tool.
Import the file into:
Database: calendar_t01
Collection: events


STEP 7 - TEST THE PUBLIC CALENDAR
---------------------------------
Open:
https://YOURDOMAIN.com/calendar.php

You should see the 2026 calendar grid.
Months with events should show a count.
Months with no events should show:
nothing scheduled

Click any month box.
It opens:
eventcalendar.php?month=MONTH_NUMBER


STEP 8 - TEST THE TEMPORARY MANAGER PAGES
-----------------------------------------
Open:
https://YOURDOMAIN.com/mgr/eventslist.php

You should see the list of events.

To add an event, open:
https://YOURDOMAIN.com/mgr/addevent.php

To view one event, click the View button from eventslist.php.


STEP 9 - REMOVE TEMPORARY MANAGER LATER
---------------------------------------
These files are temporary and can be deleted later:
/home/YOUR_CPANEL_USERNAME/public_html/mgr/

Do not delete calendar.php, eventcalendar.php, styles.css, lib, or private_dv unless you are removing the project.


TROUBLESHOOTING
---------------
Problem: White page or database error says MongoDB extension is missing.
Fix: Ask Namecheap/reseller support to enable the PHP mongodb extension.

Problem: Cannot find private_dv/mongo_config.php.
Fix: Make sure private_dv is in the cPanel account root, normally:
/home/YOUR_CPANEL_USERNAME/private_dv/mongo_config.php

Problem: Authentication failed.
Fix: Check username and password in mongo_config.php.
Also make sure the MongoDB user has access to database calendar_t01.

Problem: Calendar loads but all counts are zero.
Fix: Add sample records or add events from mgr/addevent.php.
Make sure startdate uses this format:
YYYY-MM-DD
Example:
2026-04-10
