diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..499b1df --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,43 @@ +/* Psychological Testing System Custom Styles */ +:root { + --primary: #3B82F6; + --secondary: #10B981; + --background: #F9FAFB; + --surface: #FFFFFF; + --text-primary: #1F2937; + --text-secondary: #4B5563; + --border: #E5E7EB; +} + +body { + font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; + background-color: var(--background); + color: var(--text-primary); +} + +.navbar { + background-color: var(--surface); + border-bottom: 1px solid var(--border); +} + +.test-card { + background-color: var(--surface); + border: 1px solid var(--border); + border-radius: 0.5rem; + transition: all 0.2s ease-in-out; +} + +.test-card:hover { + transform: translateY(-5px); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); +} + +.btn-primary { + background-color: var(--primary); + border-color: var(--primary); +} +.btn-primary:hover { + opacity: 0.9; + background-color: var(--primary); + border-color: var(--primary); +} diff --git a/create_test.php b/create_test.php new file mode 100644 index 0000000..6d73995 --- /dev/null +++ b/create_test.php @@ -0,0 +1,163 @@ +beginTransaction(); + + // Insert test + $stmt = $pdo->prepare("INSERT INTO tests (user_id, title, description, is_public) VALUES (?, ?, ?, ?)"); + $stmt->execute([$user_id, $title, $description, $is_public]); + $test_id = $pdo->lastInsertId(); + + // Insert questions and options + foreach ($questions as $q_data) { + $question_text = trim($q_data['text'] ?? ''); + if (empty($question_text)) continue; + + $stmt = $pdo->prepare("INSERT INTO questions (test_id, question_text) VALUES (?, ?)"); + $stmt->execute([$test_id, $question_text]); + $question_id = $pdo->lastInsertId(); + + $options = $q_data['options'] ?? []; + $correct_option_index = isset($q_data['correct']) ? intval($q_data['correct']) : -1; + + foreach ($options as $index => $option_text) { + $option_text = trim($option_text); + if(empty($option_text)) continue; + + $is_correct = ($index === $correct_option_index); + $stmt = $pdo->prepare("INSERT INTO options (question_id, option_text, is_correct) VALUES (?, ?, ?)"); + $stmt->execute([$question_id, $option_text, $is_correct]); + } + } + + $pdo->commit(); + $message = "Test created successfully!"; + } catch (PDOException $e) { + $pdo->rollBack(); + $error = "Database error: " . $e->getMessage(); + } + } else { + $error = "Could not connect to the database."; + } + } +} +?> + + + + + Create a New Test + + + + + + + + + + + Test Title + + + + Description + + + + + Make this test public + + + + + Questions + + + + Add Question + + + + Create Test + + + + + + + + +