Sindbad~EG File Manager
-- AI Chatbot and Glossary Tables
-- Run this SQL to add chatbot support to the system
-- Glossary categories table
CREATE TABLE IF NOT EXISTS `glossary_categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`description` text,
`icon` varchar(50) DEFAULT 'fa-folder',
`sort_order` int(11) DEFAULT 0,
`is_active` tinyint(1) DEFAULT 1,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Glossary entries table
CREATE TABLE IF NOT EXISTS `glossary_entries` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`category_id` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`keywords` text NOT NULL,
`content` text NOT NULL,
`related_page` varchar(255) DEFAULT NULL,
`is_active` tinyint(1) DEFAULT 1,
`view_count` int(11) DEFAULT 0,
`created_by` int(11) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `category_id` (`category_id`),
KEY `keywords` (`keywords`(255)),
FULLTEXT KEY `search_index` (`title`, `keywords`, `content`),
CONSTRAINT `fk_glossary_category` FOREIGN KEY (`category_id`) REFERENCES `glossary_categories` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Chat conversations table
CREATE TABLE IF NOT EXISTS `chat_conversations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`title` varchar(255) DEFAULT 'New Conversation',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
CONSTRAINT `fk_chat_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Chat messages table
CREATE TABLE IF NOT EXISTS `chat_messages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`conversation_id` int(11) NOT NULL,
`role` enum('user','assistant') NOT NULL,
`message` text NOT NULL,
`matched_entries` text DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `conversation_id` (`conversation_id`),
CONSTRAINT `fk_message_conversation` FOREIGN KEY (`conversation_id`) REFERENCES `chat_conversations` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Insert default categories
INSERT INTO `glossary_categories` (`name`, `description`, `icon`, `sort_order`) VALUES
('Getting Started', 'Basic information about using the system', 'fa-rocket', 1),
('Data Entry', 'How to enter data into the system', 'fa-keyboard', 2),
('Data Editing', 'How to edit existing records', 'fa-edit', 3),
('Reports', 'Generating and exporting reports', 'fa-chart-bar', 4),
('Demography', 'Demography data entry and reports', 'fa-users', 5),
('Operational Statistics', 'Operational statistics data and reports', 'fa-chart-line', 6),
('Ministry Activities', 'Ministry activities data and reports', 'fa-hands-praying', 7),
('Estates', 'Estates and property data management', 'fa-building', 8),
('Administration', 'Admin functions and settings', 'fa-cog', 9),
('Troubleshooting', 'Common issues and solutions', 'fa-wrench', 10);
-- Insert default glossary entries
INSERT INTO `glossary_entries` (`category_id`, `title`, `keywords`, `content`, `related_page`) VALUES
-- Getting Started
(1, 'System Overview', 'overview, introduction, about, what is, system, cop madina, reports',
'The COP Madina Area Reports System is a comprehensive data entry and report generation platform for The Church of Pentecost - Madina Area. It allows users to:\n\n• Enter demographic data for assemblies\n• Record operational statistics\n• Track ministry activities\n• Manage estates information\n• Generate detailed reports\n\nThe system supports multiple user levels (Superuser, Area, District, Assembly) and roles (Admin, Data Entry, Viewer).', 'index.php'),
(1, 'Logging In', 'login, sign in, access, password, username, authentication, 2fa, verification code',
'To log into the system:\n\n1. Go to the login page\n2. Enter your username or email address\n3. Enter your password\n4. Click "Sign In"\n\nIf Two-Factor Authentication (2FA) is enabled, you will receive a 6-digit verification code via email. Enter this code to complete your login.\n\nIf you forgot your password, contact your administrator.', 'login.php'),
(1, 'Dashboard Navigation', 'dashboard, navigation, menu, sidebar, home',
'After logging in, you will see your dashboard with:\n\n• **Sidebar Menu** - Access all system features\n• **Data Entry** - Enter new records\n• **Data Edit** - Modify existing records\n• **Reports** - Generate and export reports\n• **Admin** - System settings (admin only)\n\nClick on any menu item to navigate to that section.', NULL),
-- Data Entry
(2, 'How to Enter Data', 'enter data, new record, add, create, submit, form',
'To enter new data:\n\n1. Click on "Data Entry" in the sidebar\n2. Select the data type (Demography, Operational Statistics, Ministry Activities, or Estates)\n3. Select your Area, District, and Assembly\n4. Fill in all required fields (marked with *)\n5. Click "Submit" to save the record\n\nThe system will automatically calculate totals where applicable.', NULL),
(2, 'Location Selection', 'area, district, assembly, location, dropdown, select',
'When entering data, you must select the location:\n\n• **Area** - The administrative area\n• **District** - The district within the area\n• **Assembly** - The specific assembly\n\nNote: Your available options depend on your user level. Assembly-level users can only enter data for their assigned assembly.', NULL),
-- Data Editing
(3, 'How to Edit Records', 'edit, modify, update, change, correct',
'To edit existing records:\n\n1. Click on "Data Edit" in the sidebar\n2. Select the data type you want to edit\n3. Find the record in the list (use search/filters if needed)\n4. Click the "Edit" button on the record\n5. Make your changes in the form\n6. Click "Update" to save changes\n\nAll changes are logged in the audit trail.', NULL),
(3, 'Deleting Records', 'delete, remove, erase',
'To delete a record:\n\n1. Go to the Data Edit section\n2. Find the record you want to delete\n3. Click the "Delete" button\n4. Confirm the deletion\n\n**Note:** Only administrators can delete records. Deleted records cannot be recovered.', NULL),
-- Reports
(4, 'Generating Reports', 'report, generate, view, summary, individual, exact',
'The system offers three types of reports:\n\n• **Individual Reports** - Detailed records by category\n• **Summary Reports** - Aggregated data overview\n• **Exact Reports** - End-of-year statistical format\n\nTo generate a report:\n1. Go to Reports section\n2. Select the report type\n3. Choose date range and location filters\n4. Click "Generate Report"', NULL),
(4, 'Exporting Reports', 'export, download, csv, excel, pdf, print',
'You can export reports in multiple formats:\n\n• **CSV** - For spreadsheet applications\n• **Excel** - Microsoft Excel format\n• **PDF** - For printing and sharing\n\nClick the export button after generating your report and select your preferred format.', NULL),
-- Demography
(5, 'Demography Data Entry', 'demography, membership, children, youth, adults, population',
'Demography data tracks assembly membership:\n\n• **Children** - Male and female children\n• **Teens** - Male and female teenagers\n• **Young Adults** - Male and female young adults\n• **Other Adults** - Male and female other adults\n\nThe system automatically calculates:\n• Youth totals\n• Adult totals\n• Overall membership totals', 'demography-entry.php'),
-- Operational Statistics
(6, 'Operational Statistics Overview', 'operational, statistics, worship, outreach, baptism, attendance, tithes',
'Operational Statistics tracks six key areas:\n\n1. **Assembly Worship Data** - Worship services and communion\n2. **Outreach & Souls** - Evangelism and conversions\n3. **Baptism Events** - Water and Holy Spirit baptisms\n4. **Worship Attendance** - Service attendance figures\n5. **Social Interventions** - Community support activities\n6. **Tithes & Missions** - Financial contributions', 'operational-entry.php'),
-- Ministry Activities
(7, 'Ministry Activities Overview', 'ministry, activities, groups, meetings, programs',
'Ministry Activities tracks various church ministries:\n\n• Women''s Ministry\n• Men''s Ministry\n• Youth Ministry\n• Children''s Ministry\n• Evangelism activities\n• Prayer meetings\n\nRecord attendance, meetings held, and special programs.', 'ministry-entry.php'),
-- Estates
(8, 'Estates Management', 'estates, property, land, building, worship place, mission house',
'Estates data tracks church properties:\n\n• **Land Documents** - Land ownership records\n• **Permanent Buildings** - Church buildings\n• **Worship Places** - Worship facilities\n• **Mission Houses** - Pastoral residences\n\nRecord property details, values, and documentation status.', 'estates-entry.php'),
-- Administration
(9, 'User Management', 'user, account, create user, permissions, role, level',
'Administrators can manage users:\n\n• Create new user accounts\n• Assign user levels (Area, District, Assembly)\n• Set user roles (Admin, Data Entry, Viewer)\n• Activate/deactivate accounts\n• Reset passwords\n\nGo to Admin > User Management to access these features.', 'user-management.php'),
(9, 'Location Management', 'location, area, district, assembly, add, manage',
'Administrators can manage locations:\n\n• Add new Areas, Districts, and Assemblies\n• Edit existing locations\n• Bulk upload locations via CSV\n\nGo to Admin > Location Management to access these features.', 'location-management.php'),
(9, 'Email Settings', 'email, smtp, 2fa, two factor, authentication, alerts',
'Configure email settings:\n\n• SMTP server configuration\n• Enable/disable 2FA for all users\n• Enable/disable login email alerts\n• Test email functionality\n\nGo to Admin > Email Settings to configure.', 'email-settings.php'),
-- Troubleshooting
(10, 'Cannot Login', 'cannot login, login failed, wrong password, locked out',
'If you cannot login:\n\n1. Check that your username/email is correct\n2. Verify your password (case-sensitive)\n3. If 2FA is enabled, check your email for the code\n4. Clear your browser cache and try again\n5. Contact your administrator if problems persist', NULL),
(10, 'Data Not Saving', 'not saving, error, submit failed, form error',
'If data is not saving:\n\n1. Check all required fields are filled (marked with *)\n2. Ensure numeric fields contain valid numbers\n3. Check your internet connection\n4. Try refreshing the page and re-entering\n5. Contact your administrator if the problem continues', NULL),
(10, 'Report Not Loading', 'report error, blank report, no data, loading',
'If reports are not loading:\n\n1. Check that data exists for the selected filters\n2. Try a different date range\n3. Ensure you have permission to view the data\n4. Clear browser cache and refresh\n5. Try a different browser', NULL);
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists