Path : /home/vishqocm/pcib.in/admin/
File Upload :
Current File : //home/vishqocm/pcib.in/admin/question_import_export_help.php

<?php
// Initialize the session
session_start();

// Check if the user is logged in, if not then redirect to login page
if (!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true) {
    header("location: login.php");
    exit;
}

// Check if user is admin or director
if ($_SESSION["role"] != "admin" && $_SESSION["role"] != "director") {
    header("location: ../dashboard.php");
    exit;
}

// Include config file
require_once "includes/config.php";
require_once "includes/header.php";
?>

<div class="container-fluid">
    <div class="d-sm-flex align-items-center justify-content-between mb-4">
        <h1 class="h3 mb-0 text-gray-800">Question Import/Export Help</h1>
        <a href="javascript:history.back()" class="d-none d-sm-inline-block btn btn-sm btn-secondary shadow-sm">
            <i class="fas fa-arrow-left fa-sm text-white-50"></i> Back
        </a>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <div class="card shadow mb-4">
                <div class="card-header py-3">
                    <h6 class="m-0 font-weight-bold text-primary">Import Format Guide</h6>
                </div>
                <div class="card-body">
                    <h5>Required CSV/Excel Format</h5>
                    <p>To successfully import questions, your file must contain the following columns:</p>
                    
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th>Column Name</th>
                                    <th>Description</th>
                                    <th>Example</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td><code>question_text</code></td>
                                    <td>The text of the question</td>
                                    <td>What is the capital of France?</td>
                                </tr>
                                <tr>
                                    <td><code>question_type</code></td>
                                    <td>The type of question (must be one of: <code>multiple_choice</code>, <code>true_false</code>, <code>short_answer</code>, or <code>essay</code>)</td>
                                    <td>multiple_choice</td>
                                </tr>
                                <tr>
                                    <td><code>options</code></td>
                                    <td>For multiple choice questions, separate options with the pipe character "|"<br>For true/false questions, use "True|False"<br>For short_answer and essay, leave blank</td>
                                    <td>London|Paris|Berlin|Madrid</td>
                                </tr>
                                <tr>
                                    <td><code>correct_answer</code></td>
                                    <td>For multiple_choice: the text of the correct option<br>For true_false: "True" or "False"<br>For short_answer: the expected answer<br>For essay: leave blank (will be manually graded)</td>
                                    <td>Paris</td>
                                </tr>
                                <tr>
                                    <td><code>marks</code></td>
                                    <td>The number of marks for the question</td>
                                    <td>1</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    
                    <div class="mt-4 mb-4">
                        <h5>Download Templates</h5>
                        <p>You can download template files to help you format your questions correctly:</p>
                        <a href="templates/question_import_template.csv" class="btn btn-primary mr-2">
                            <i class="fas fa-file-csv mr-1"></i> CSV Template
                        </a>
                        <a href="templates/question_import_template.xlsx" class="btn btn-success">
                            <i class="fas fa-file-excel mr-1"></i> Excel Template
                        </a>
                    </div>
                </div>
            </div>
            
            <div class="card shadow mb-4">
                <div class="card-header py-3">
                    <h6 class="m-0 font-weight-bold text-primary">Example Questions</h6>
                </div>
                <div class="card-body">
                    <h5>Multiple Choice Example</h5>
                    <div class="alert alert-light">
                        <strong>question_text:</strong> What is the capital of France?<br>
                        <strong>question_type:</strong> multiple_choice<br>
                        <strong>options:</strong> London|Paris|Berlin|Madrid<br>
                        <strong>correct_answer:</strong> Paris<br>
                        <strong>marks:</strong> 1
                    </div>
                    
                    <h5>True/False Example</h5>
                    <div class="alert alert-light">
                        <strong>question_text:</strong> The Pacific Ocean is the largest ocean on Earth.<br>
                        <strong>question_type:</strong> true_false<br>
                        <strong>options:</strong> True|False<br>
                        <strong>correct_answer:</strong> True<br>
                        <strong>marks:</strong> 1
                    </div>
                    
                    <h5>Short Answer Example</h5>
                    <div class="alert alert-light">
                        <strong>question_text:</strong> What is the chemical symbol for gold?<br>
                        <strong>question_type:</strong> short_answer<br>
                        <strong>options:</strong> [leave blank]<br>
                        <strong>correct_answer:</strong> Au<br>
                        <strong>marks:</strong> 2
                    </div>
                    
                    <h5>Essay Example</h5>
                    <div class="alert alert-light">
                        <strong>question_text:</strong> Explain the water cycle and its importance to Earth's ecosystem.<br>
                        <strong>question_type:</strong> essay<br>
                        <strong>options:</strong> [leave blank]<br>
                        <strong>correct_answer:</strong> [leave blank]<br>
                        <strong>marks:</strong> 5
                    </div>
                </div>
            </div>
            
            <div class="card shadow mb-4">
                <div class="card-header py-3">
                    <h6 class="m-0 font-weight-bold text-primary">Troubleshooting</h6>
                </div>
                <div class="card-body">
                    <h5>Common Import Issues</h5>
                    <div class="accordion" id="troubleshootingAccordion">
                        <div class="card">
                            <div class="card-header" id="headingOne">
                                <h2 class="mb-0">
                                    <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                        Missing Columns
                                    </button>
                                </h2>
                            </div>
                            <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#troubleshootingAccordion">
                                <div class="card-body">
                                    Make sure your file contains all required columns: <code>question_text</code>, <code>question_type</code>, <code>options</code>, <code>correct_answer</code>, and <code>marks</code>. The column names must match exactly.
                                </div>
                            </div>
                        </div>
                        <div class="card">
                            <div class="card-header" id="headingTwo">
                                <h2 class="mb-0">
                                    <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
                                        Invalid Question Types
                                    </button>
                                </h2>
                            </div>
                            <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#troubleshootingAccordion">
                                <div class="card-body">
                                    The <code>question_type</code> must be one of: <code>multiple_choice</code>, <code>true_false</code>, <code>short_answer</code>, or <code>essay</code>. Check for typos or incorrect values.
                                </div>
                            </div>
                        </div>
                        <div class="card">
                            <div class="card-header" id="headingThree">
                                <h2 class="mb-0">
                                    <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
                                        Incorrect Option Format
                                    </button>
                                </h2>
                            </div>
                            <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#troubleshootingAccordion">
                                <div class="card-body">
                                    For multiple choice questions, options must be separated with the pipe character (|). Make sure the <code>correct_answer</code> exactly matches one of the options provided.
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<?php
require_once "includes/footer.php";
?>