<?php

$session = new Session();
$ArrayOtherProgrammeDetails = OtherProgramme::find_by_id($session->applicant_id);
?>
<h3 align="center">Other Programme Details</h3>
<hr>
<h6 align="center">All Fields are Required </h6>
<div class="row-fluid">
	<div class="span6 offset3">

		<form action="" method="POST" class="other_programme_details form-horizontal" >
		
		<h5>Sponsor and Guidance Details</h5>
			<hr>
			<!-- Fullname -->
			<div class="control-group">
				<label class="control-label" for="inputFullName">Fullname</label> 
				<div class="controls">
					<div class="input-prepend">
						<span class="add-on"><i class="icon-user"></i></span>
						<input type="text" class="input-xlarge" value="<?php 
if (isset($ArrayOtherProgrammeDetails->sponsor_fullname)) {
    echo $ArrayOtherProgrammeDetails->sponsor_fullname;
}
?>
" name="fullname_id" id="fullname_id" />
					</div>
				</div>
			</div>
			
<?php

require_once '../inc/initialize.php';
$other_programme = new OtherProgramme();
$other_programme->applicant_id = $session->applicant_id;
$other_programme->sponsor_fullname = $_POST['fullname_id'];
$other_programme->sponsor_occupation = $_POST['occupation'];
$other_programme->sponsor_address = $_POST['address'];
$other_programme->applied_to_other_institution = $_POST['applied_to_other_institution'];
if ($other_programme->applied_to_other_institution == 0) {
    $other_programme->denied_admission = $other_programme->institution_name = $other_programme->institution_address = $other_programme->other_details = $other_programme->name_of_institution = $other_programme->address_of_institution = $other_programme->date_of_admission = $other_programme->course_of_study = '';
} else {
    $other_programme->denied_admission = $_POST['denied_admission'];
    $other_programme->institution_name = $_POST['institution_name'];
    $other_programme->institution_address = $_POST['institution_address'];
    $other_programme->other_details = $_POST['other_details'];
    $other_programme->name_of_institution = $_POST['name_of_institution'];
    $other_programme->address_of_institution = $_POST['address_of_institution'];
    $other_programme->date_of_admission = $_POST['date_of_adm'];
    $other_programme->course_of_study = $_POST['Present_Course_of_Study'];
}
$other_programme->reasons = $_POST['reasons_for_seeking_admission'];
$other_programme_details = $other_programme->find_by_id($other_programme->applicant_id);
if (!empty($other_programme_details)) {
    $other_programme->other_details_id = $other_programme_details->other_details_id;
}
if ($other_programme->save()) {
    $user = new User();
    $user->applicant_id = $session->applicant_id;
    $user->updateProgress('I');
    sleep(2);
        }
        echo '</tbody>

            </table>';
    }
    ?>
    <?php 
} else {
    ?>
	
	
	<h4 align="center" class="alert alert-success">Fees</h4>
	  <?php 
    $default = "No Information Supplied";
    $other_programme = "SELECT * FROM  other_programme_details WHERE applicant_id='" . $session->applicant_id . "'";
    $other_programme_details = OtherProgramme::find_by_sql($other_programme);
    foreach ($other_programme_details as $other_programme_detail) {
        $other_programme_detail->sponsor_occupation;
        $other_programme_detail->sponsor_address;
    }
    ?>

<table class="table table-bordered table-hover">
  <tbody>
      <tr>
          <td width="2%">Name of person or body who will be responsible for your fees: 
     <span style=" font-weight: bold; text-shadow: 1px 1px 4px #51A351;"><?php 
    echo $other_programme_detail->sponsor_fullname;
    ?>
</span>
     Address: <span style=" font-weight: bold; text-shadow: 1px 1px 4px #51A351;"><?php