<?php
function template7($institutions, $branch, $students_array, $examination, $array, $academic_session, $class_name, $section_name = null)
{
?>
<div class="container_marksheet">
    <div class="content_container">

        <!-- Header Section -->
        <div class="main-header">
            <div class="header">
                <div class="logo">
                    <img src="<?php echo $institutions['logo']; ?>" alt="School Logo">
                </div>
                <h1 class="school-name"><?php echo $institutions['institution_name']; ?></h1>
            </div>
            <p class="affiliation-details"><?php echo $branch['branch_code'] ? "Affiliation Code: ".$branch['branch_code'] : ''; ?></p>
            <p class="affiliation-details"><?php echo $branch['address'] . ($branch['pincode'] ? " - ".$branch['pincode'] : ''); ?></p>
            <p class="affiliation-details" style="text-transform: lowercase;"><?php echo $branch['contact_number'] . ($branch['email'] ? ', '.strtolower($branch['email']) : ''); ?></p>
        </div>
        <hr>

        <!-- Report Title -->
        <div class="report_title">
            <h2>Progress Report</h2>
            <p class="academic_session">Academic Session <?php echo $academic_session; ?></p>
        </div>

        <!-- Student Info -->
        <div class="student-info">
            <div class="student-info-item"><span class="label">Name :-</span> <span class="value"><?php echo $students_array[0]['name']; ?></span></div>
            <div class="student-info-item"><span class="label">Admission Number :-</span> <span class="value"><?php echo $students_array[0]['admission_number']; ?></span></div>
            <div class="student-info-item"><span class="label">Class :-</span> <span class="value"><?php echo $class_name; ?></span></div>
            <div class="student-info-item"><span class="label">Section :-</span> <span class="value"><?php echo $section_name; ?></span></div>
            <div class="student-info-item"><span class="label">Father's Name :-</span> <span class="value"><?php echo $students_array[0]['fathername']; ?></span></div>
            <div class="student-info-item"><span class="label">Mother's Name :-</span> <span class="value"><?php echo $students_array[0]['mothername']; ?></span></div>
            <div class="student-info-item"><span class="label">Stream :-</span> <span class="value">Commerce</span></div>
        </div>

        <!-- Evaluation Table -->
        <div class="evaluation">
            <table class="evaluation_table">
                <thead>
                    <tr>
                        <th>Subject</th>
                        <th><?php echo ucwords(strtolower($examination)); ?><br>Maximum Marks</th>
                        <th>Marks Obtained</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $subjects = ['English', 'Physical Education', 'Economics', 'Business Studies', 'Accountancy', 'Mathematics (Add.)', 'Information Technology (Add.)'];
                    foreach ($subjects as $i => $subject) {
                        $index = $i + 1;
                        echo "<tr>";
                        echo "<td>$subject</td>";
                        echo "<td>40</td>";
                        echo "<td>" . (($array[$index] != "0" && $array[$index] != "00") ? $array[$index] : "-") . "</td>";
                        echo "</tr>";
                    }
                    ?>
                    <tr>
                        <td class="bold_text">Total</td>
                        <td>200</td>
                        <td><?php echo $array[8]; ?></td>
                    </tr>
                </tbody>
            </table>
        </div>

        <!-- Remarks -->
        <p class="remarks">Remarks: <?php echo $array[9]; ?></p>

        <!-- Signatures -->
        <div class="signatures">
            <div class="signature-item">
                <div class="signature-line"></div>
                <span class="signature-label">Class Incharge</span>
            </div>
            <div class="signature-item">
                <div class="signature-line"></div>
                <span class="signature-label">Principal / Headmistress</span>
            </div>
        </div>

        <!-- Date -->
        <p class="date-footer">Date: <?php echo date('Y-m-d'); ?></p>

        <!-- Disclaimer -->
        <div class="disclaimer">* In case of any discrepancies in marksheet, please contact school administration.</div>

    </div>
</div>
<?php
}
?>
