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

function getHeader2($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($institutions);
$institutionName = $institutions['institution_name'];
$branchName = $branch['name'];
$branch_code = $branch['branch_code'];
$email = $branch['email'];
$mobile = $branch['contact_number'];
$address = $branch['address'];
// $link= "https://rejoicebilldesk.in/rjllearning_development/";
$logoPath =  $institutions['logo']; // Assuming the logo path is stored here
// print_r($institutions['logo']);
// Prepare the HTML content
$html = '<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Centered Header Example</title>
    <style>
        body, html {
            margin: 0;
            padding: 0;
            // font-family: Arial, sans-serif;
        }

        .header2 {
            background-color: '.$background_color.';
            padding: 20px;
            display: flex;
            justify-content: center; /* Centers content horizontally */
            align-items: center; /* Centers content vertically */
            margin:10px;
           
        }

        .header-content2 {
            <!-- display: flex; -->
            align-items: center; /* Aligns logo and text vertically in center */
            text-align: center; /* Centers text under the image */
          
        }

        .header-logo2 img {
            height: 80px;
            margin-right: 20px; /* Space between the logo and the text */
        }

        .header-right2 {
            text-align: center; /* Aligns text to the left */
        }

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

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

        .header-right2 p {
            margin: 2px 0;
            font-size: 14px;
             color: '.$primary_text_color.';
             padding-top:2px;
        }

        .header-right2 p:first-of-type {
            margin-top: 10px;
        }
    </style>
</head>
<body >
    <header class="header2" >
        <div class="header-content2">
            <div class="header-logo2">
                 <img src="'.$logoPath.'" alt="Company Logo">
            </div>
            <div class="header-right2">
                   <h1>'.$institutionName.'</h1>
                <h2>'.$branchName.'</h2>
                <p><strong>'.$branch_code.'</strong></p>
                 <p> '.$address.'</p>
                <p>'.$email.' | '.$mobile.'</p>
               
            </div>
        </div>
    </header>
</body>
</html>';
// Output the HTML
return $html;
}
