
<?php
ini_set('display_errors', 1);

function getHeader1($conn_rjllearning,$conn_rjllearning_specific,$institution_id,$branch_id,$additional_data,$marksheet_id =  null){
    
if($marksheet_id !=  null){
    $data = getSpecificMarksheetTemplate($conn_rjllearning_specific,$institution_id,$branch_id,$marksheet_id);
    //print_r($data);die();
    //$name_color = $data['color'][0]['name_color'];
    $primary_text_color = $data['color'][0]['primary_text_color'];
    $secondary_text_color = $data['color'][0]['secondary_text_color'];
    $background_color = $data['color'][0]['background_color'];
    $border= $data['color'][0]['border'];
    $institution_title_color = $data['color'][0]['institution_title_color']; 
    $branch_title_color = $data['color'][0]['branch_title_color'];
}else{
    $background_color = '#f7f2f0';
    $institution_title_color  = '9565ed';
    $branch_title_color = '9565ed';
    $border = '1px solid #333';
    $primary_text_color = '#555';
    $secondary_text_color = '#555';
    //$name_color = '#555';
    
}

 
// Assuming getInstitution and getBranchInfo are defined functions
$institutions = getInstitution($conn_rjllearning, $institution_id);
$branch = getBranchInfo($conn_rjllearning_specific, $institution_id, $branch_id, $additional_data);
// print_r($branch);
$institutionName = $institutions['institution_name'];
$branch_code = $branch['branch_code'];
$branchName = $branch['name'];
$email = $branch['email'];
$mobile = $branch['contact_number'];
$address = $branch['address'];
$logoPath = $institutions['logo']; // Assuming the logo path is stored here

// Prepare the HTML content
$html = '<HTML
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Header Example</title>
    <style>
        body, html {
            margin: 0;
            padding: 0;
            // font-family: sans-serif;
        }

        .header-container {
            max-width: 100%;
            background-color: '.$background_color.';
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            padding: 20px 0;
        }

        .header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 20px;
             margin:10px;
        }

        .header-logo img {
            height: 80px;
        }

        .header-right {
            flex-grow: 1;
            padding-left: 20px;
            text-align: left;
        }

        .header-right h1, .header-right h2, .header-right p {
            margin: 0;
        }

        .header-right h1 {
            font-size: 24px;
            font-weight: bold;
            color: '.$institution_title_color.';
        }

        .header-right h2 {
            margin: 5px 0;
            font-size: 18px;
            font-weight: 700;
            color: '.$branch_title_color.';
        }

        .header-right p {
            font-size: 14px;
            color: '.$primary_text_color.';
            padding-top:2px;
        }
        
        .header-right p {
            margin: 2px 0;
            font-size: 14px;
             color: '.$primary_text_color.';
             padding-top:2px;
        }
    </style>
</head>
<body>
    <div class="header-container">
        <header class="header">
            <div class="header-logo">
                <img src="'.$logoPath.'" alt="Company Logo">
            </div>
            <div class="header-right">
                <h1>'.$institutionName.'</h1>
                <h2>'.$branchName.'</h2>
                <p><strong>'.$branch_code.'</strong></p>
                <p> '.$address.'</p>
                <p>'.$email.' | '.$mobile.'</p>
            </div>
        </header>
    </div>
</body>
</html>'
;

// Output the HTML
return $html;
}