diff --git a/db/migrations/001_create_feedback_submissions_table.sql b/db/migrations/001_create_feedback_submissions_table.sql index 9a7d885..9ab8f35 100644 --- a/db/migrations/001_create_feedback_submissions_table.sql +++ b/db/migrations/001_create_feedback_submissions_table.sql @@ -3,5 +3,5 @@ CREATE TABLE IF NOT EXISTS feedback_submissions ( name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, message TEXT NOT NULL, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP -); \ No newline at end of file + submitted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/db/migrations/002_create_surveys_table.sql b/db/migrations/002_create_surveys_table.sql index 64ad19d..cd98392 100644 --- a/db/migrations/002_create_surveys_table.sql +++ b/db/migrations/002_create_surveys_table.sql @@ -1,6 +1,6 @@ -CREATE TABLE IF NOT EXISTS `surveys` ( - `id` INT AUTO_INCREMENT PRIMARY KEY, - `title` VARCHAR(255) NOT NULL, - `description` TEXT, - `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file +CREATE TABLE IF NOT EXISTS surveys ( + id INT AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL, + description TEXT, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/db/migrations/003_create_survey_questions_table.sql b/db/migrations/003_create_survey_questions_table.sql index 65a3ad4..fde0ea6 100644 --- a/db/migrations/003_create_survey_questions_table.sql +++ b/db/migrations/003_create_survey_questions_table.sql @@ -1,9 +1,8 @@ -CREATE TABLE IF NOT EXISTS `survey_questions` ( - `id` INT AUTO_INCREMENT PRIMARY KEY, - `survey_id` INT NOT NULL, - `question_text` TEXT NOT NULL, - `question_type` VARCHAR(50) NOT NULL, -- e.g., 'text', 'textarea', 'rating', 'multiple-choice' - `options` TEXT, -- For multiple-choice questions, store options as a JSON array or comma-separated values - `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (`survey_id`) REFERENCES `surveys`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file +CREATE TABLE IF NOT EXISTS survey_questions ( + id INT AUTO_INCREMENT PRIMARY KEY, + survey_id INT NOT NULL, + question_text TEXT NOT NULL, + question_type VARCHAR(50) NOT NULL, -- e.g., 'text', 'multiple-choice', 'rating' + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (survey_id) REFERENCES surveys(id) ON DELETE CASCADE +); diff --git a/db/migrations/005_create_survey_answers_table.sql b/db/migrations/005_create_survey_answers_table.sql index 925c314..81c8cc8 100644 --- a/db/migrations/005_create_survey_answers_table.sql +++ b/db/migrations/005_create_survey_answers_table.sql @@ -1,9 +1,9 @@ -CREATE TABLE IF NOT EXISTS `survey_answers` ( - `id` INT AUTO_INCREMENT PRIMARY KEY, - `submission_id` INT NOT NULL, - `question_id` INT NOT NULL, - `answer_text` TEXT, - `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (`submission_id`) REFERENCES `feedback_submissions`(`id`) ON DELETE CASCADE, - FOREIGN KEY (`question_id`) REFERENCES `survey_questions`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file +CREATE TABLE IF NOT EXISTS survey_answers ( + id INT AUTO_INCREMENT PRIMARY KEY, + submission_id INT NOT NULL, + question_id INT NOT NULL, + answer_text TEXT, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (submission_id) REFERENCES feedback_submissions(id) ON DELETE CASCADE, + FOREIGN KEY (question_id) REFERENCES survey_questions(id) ON DELETE CASCADE +); diff --git a/db/migrations/006_create_users_table.sql b/db/migrations/006_create_users_table.sql index 195077e..24ff762 100644 --- a/db/migrations/006_create_users_table.sql +++ b/db/migrations/006_create_users_table.sql @@ -1,7 +1,7 @@ -CREATE TABLE IF NOT EXISTS `users` ( - `id` INT AUTO_INCREMENT PRIMARY KEY, - `username` VARCHAR(50) NOT NULL UNIQUE, - `email` VARCHAR(100) NOT NULL UNIQUE, - `password` VARCHAR(255) NOT NULL, - `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file +CREATE TABLE IF NOT EXISTS users ( + id INT AUTO_INCREMENT PRIMARY KEY, + username VARCHAR(255) NOT NULL UNIQUE, + password VARCHAR(255) NOT NULL, + email VARCHAR(255) NOT NULL UNIQUE, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/db/migrations/007_create_roles_table.sql b/db/migrations/007_create_roles_table.sql index df1956e..e288213 100644 --- a/db/migrations/007_create_roles_table.sql +++ b/db/migrations/007_create_roles_table.sql @@ -1,4 +1,4 @@ -CREATE TABLE IF NOT EXISTS `roles` ( - `id` INT AUTO_INCREMENT PRIMARY KEY, - `role_name` VARCHAR(50) NOT NULL UNIQUE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file +CREATE TABLE IF NOT EXISTS roles ( + id INT AUTO_INCREMENT PRIMARY KEY, + role_name VARCHAR(50) NOT NULL UNIQUE +); diff --git a/db/migrations/008_create_user_roles_table.sql b/db/migrations/008_create_user_roles_table.sql index 6bdb97d..89c3428 100644 --- a/db/migrations/008_create_user_roles_table.sql +++ b/db/migrations/008_create_user_roles_table.sql @@ -1,7 +1,7 @@ -CREATE TABLE IF NOT EXISTS `user_roles` ( - `user_id` INT NOT NULL, - `role_id` INT NOT NULL, - PRIMARY KEY (`user_id`, `role_id`), - FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE, - FOREIGN KEY (`role_id`) REFERENCES `roles`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file +CREATE TABLE IF NOT EXISTS user_roles ( + id INT AUTO_INCREMENT PRIMARY KEY, + user_id INT NOT NULL, + role_id INT NOT NULL, + FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, + FOREIGN KEY (role_id) REFERENCES roles(id) ON DELETE CASCADE +); diff --git a/db/migrations/009_insert_default_roles.sql b/db/migrations/009_insert_default_roles.sql index 6438db4..3bbd1a1 100644 --- a/db/migrations/009_insert_default_roles.sql +++ b/db/migrations/009_insert_default_roles.sql @@ -1 +1 @@ -INSERT INTO `roles` (`role_name`) VALUES ('Admin'), ('Respondent'); \ No newline at end of file +INSERT IGNORE INTO `roles` (`role_name`) VALUES ('Admin'), ('Respondent'); \ No newline at end of file diff --git a/templates/footer.php b/templates/footer.php index f15c979..0b3af49 100644 --- a/templates/footer.php +++ b/templates/footer.php @@ -1,10 +1,11 @@ - - - + + + + + - + \ No newline at end of file diff --git a/templates/header.php b/templates/header.php index 1632c9c..aa74677 100644 --- a/templates/header.php +++ b/templates/header.php @@ -1,47 +1,31 @@ - - <?php echo htmlspecialchars($pageTitle); ?> - - - - - - - - - - - - - - - - + <?= isset($pageTitle) ? htmlspecialchars($pageTitle) : 'Your Real Feedback' ?> + + - -
-
- - +
+
+ +
\ No newline at end of file