if ($error_secondary_school == true) {
    sleep(2);
    echo '<h4 class="alert alert-error"><i class="iconic-o-x" style="color: red"></i> Error!</h4>';
    echo '<hr>';
    echo "Your details in the Secondary School section were not saved.";
    echo '<br><hr>';
}
if ($error_olevel == true) {
    sleep(2);
    echo '<h4 class="alert alert-error"><i class="iconic-o-x" style="color: red"></i> Error!</h4>';
    echo '<hr>';
    echo "Your details in the Secondary School section were not saved.";
    echo '<br><hr>';
}
if ($error_academic_prizes == true) {
    sleep(2);
    echo '<h4 class="alert alert-error"><i class="iconic-o-x" style="color: red"></i> Error!</h4>';
    echo '<hr>';
    echo "Your details in the Secondary School section were not saved.";
    echo '<br><hr>';
}
if ($error_higher_institution == false && $error_other_relevant_qualification == false && $error_secondary_school == false && $error_olevel == false && $error_academic_prizes == false) {
    $user = new User();
    $user->applicant_id = $session->applicant_id;
    $user->updateProgress('B');
    sleep(2);
    echo '<h4 class="alert alert-success"><i class="iconic-o-check" style="color: #51A351"></i> Success</h4>';
    echo '<hr>';
    echo 'You have successfully saved your <span style=" font-weight: bold; text-shadow: 1px 1px 4px #51A351;"> Academic qualification </span> details tab.';
    echo '<br><hr>';
}
        $extension = $arrayfiledetails[sizeof($arrayfiledetails) - 1];
        $_FILES['attach_thesis_proposal']['name'] = $session->applicant_id . '-thesis.' . $extension;
        if ($files->attach_file($_FILES['attach_thesis_proposal'])) {
            $files->caption = 'Thesis Proposal';
            $files->applicant_id = $session->applicant_id;
            if ($files->save()) {
                $fileuploadmessage = 1;
            } else {
                $fileuploadmessage = 'Thesis not uploaded';
            }
        } else {
            $fileuploadmessage = 'You attached an incorrect file, please ensure that the file is in doc or pdf format';
        }
    }
    $user = new User();
    $user->applicant_id = $session->applicant_id;
    $user->updateProgress('D');
    sleep(2);
    echo '<h4 class="alert alert-success">Success</h4>';
    echo '<hr>';
    echo 'Your thesis details have been saved';
    echo '<hr>';
    if ($fileuploadmessage != 1) {
        echo $fileuploadmessage;
    }
} else {
    sleep(2);
    echo '<h4 class="alert alert-error">Error</h4>';
    echo '<hr>';
    echo 'Your thesis details were not saved';
}
} 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 '<h4 class="alert alert-success"><i class="iconic-o-check" style="color: #51A351"></i> Success</h4>';
    echo '<hr>';
    echo 'Your details for other programme details have been saved successfully';
    echo '<br><hr>';
} else {
    sleep(2);
    echo '<h4 class="alert alert-error"><i class="iconic-o-x" style="color: red"></i> Error!</h4>';
    echo '<hr>';
    echo 'Your details were not saved due to some reason';
    echo '<br><hr>';
}
        $o_pub_publisher_key = 'other_publications_publisher_' . $j;
        $o_publication->title_of_publication = $_POST[$o_pub_title_key];
        $o_publication->publisher = $_POST[$o_pub_publisher_key];
        $o_publication->applicant_id = $session->applicant_id;
        if ($o_publication->title_of_publication == '') {
            continue;
        }
        if (!$o_publication->save()) {
            $error_other_publication = true;
        }
        unset($o_publication->publication_id);
    }
    if (!$error_other_publication) {
        $user = new User();
        $user->applicant_id = $session->applicant_id;
        $user->updateProgress('E');
        sleep(2);
        echo '<h4 class="alert alert-success">Success</h4>';
        echo '<hr>';
        echo "You have successfully saved your publication details\n";
        echo "Continue";
    } else {
        sleep(2);
        echo '<h4 class="alert alert-error">Error</h4>';
        echo '<hr>';
        echo "Your publication details were not saved";
    }
} else {
    sleep(2);
    echo '<h4 class="alert alert-error">Error</h4>';
    echo '<hr>';
Example #5
0
if (!empty($photograph_details) && !empty($_FILES['picture']['name'])) {
    $photograph->image_id = $photograph_details->image_id;
    unlink(SITE_ROOT . DS . 'passport' . DS . $photograph_details->filename);
}
$arrayfiledetails = explode('.', $_FILES['picture']['name']);
$extension = $arrayfiledetails[sizeof($arrayfiledetails) - 1];
$_FILES['picture']['name'] = $session->applicant_id . '.' . $extension;
if ($photograph->attach_file($_FILES['picture'])) {
    $photograph->caption = User::applicant_fullname($session->applicant_id);
    $photograph->applicant_id = $session->applicant_id;
    //explode filename to get file extension
    $photograph->filename = $_FILES['picture']['name'];
    if ($photograph->save()) {
        $user = new User();
        $user->applicant_id = $session->applicant_id;
        $user->updateProgress('G');
        sleep(2);
        echo '<h4 class="alert alert-success"><i class="iconic-o-check" style="color: #51A351"></i> Success</h4>';
        echo '<hr>';
        echo 'Your <span style=" font-weight: bold; text-shadow: 1px 1px 4px #51A351;">Passport</span> has been successfully uploaded';
        echo '<br><hr>';
    } else {
        sleep(2);
        echo '<h4 class="alert alert-error"><i class="iconic-o-x" style="color: red"></i> Error!</h4>';
        echo '<hr>';
        echo 'Your <span style=" font-weight: bold; text-shadow: 1px 1px 4px red;">Passport</span> was not uploaded, due to some errors';
        echo '<br><hr>';
    }
} else {
    sleep(2);
    echo '<h4 class="alert alert-error"><i class="iconic-o-x" style="color: red"></i> Error!</h4>';
            break;
        default:
            // Please remeber to set i
            break;
    }
    $employment->applicant_id = $session->applicant_id;
}
$employment_details = $employment->find_by_id($employment->applicant_id);
/*set employment_id*/
if (!empty($employment_details)) {
    $employment->employment_id = $employment_details->employment_id;
}
//print_r($employment);
/*insert new record or update existing record in the employment table*/
/*check any changes to the database employment table*/
if ($employment->save()) {
    $user = new User();
    $user->applicant_id = $session->applicant_id;
    $user->updateProgress('C');
    sleep(2);
    echo '<h4 class="alert alert-success"> <i class="iconic-o-check" style="color: #51A351"></i> Success</h4>';
    echo '<hr>';
    echo 'You have successfully saved your <span style=" font-weight: bold; text-shadow: 1px 1px 4px #51A351;"> Employment Details </span> tab.';
    echo '<br><hr>';
} else {
    sleep(2);
    echo '<h4 class="alert alert-error"><i class="iconic-o-x" style="color: red"></i> Error!</h4>';
    echo '<hr>';
    echo "Your details were not saved please try again later here";
    echo '<br><hr>';
}
$user->religion_id = $_POST['religion_id'];
$user->address = $_POST['address'];
$user->applicant_id = $session->applicant_id;
if ($user->save()) {
    $next_of_kin = new NextOfKin();
    $next_of_kin_details = $next_of_kin->find_by_id($user->applicant_id);
    if (!empty($next_of_kin_details)) {
        $next_of_kin->next_kin_id = $next_of_kin_details->next_kin_id;
    }
    $next_of_kin->next_of_kin_name = $_POST['next_kin_name'];
    $next_of_kin->next_of_kin_relationship = $_POST['next_of_kin_relationship'];
    $next_of_kin->next_of_kin_number = $_POST['next_of_kin_number'];
    $next_of_kin->next_of_kin_address = $_POST['next_of_kin_address'];
    $next_of_kin->applicant_id = $user->applicant_id;
    if ($next_of_kin->save()) {
        $user->updateProgress('A');
        sleep(2);
        echo '<h4 class="alert alert-success"><i class="iconic-o-check" style="color: #51A351"></i> Success</h4>';
        echo '<hr>';
        echo 'You have successfully saved your <span style=" font-weight: bold; text-shadow: 1px 1px 4px #51A351;">Personal Details </span> tab, use the close button to continue.';
        echo "<br>";
        echo '<hr>';
    } else {
        sleep(2);
        echo '<h4 class="alert alert-error">Error</h4>';
        echo '<hr>';
        echo "Your next of kin details were not saved";
        echo "<br>";
        echo '<hr>';
    }
} else {
    $counter++;
}
/*Remove unwanted files*/
$r_counter = $counter;
$db = new MySQLDatabase();
while ($r_counter < $max) {
    $filename = SITE_ROOT . DS . $upload_dir . DS . $session->applicant_id . '-Document-' . $r_counter . '.pdf';
    if (file_exists($filename)) {
        $sql = "DELETE FROM `files` WHERE applicant_id=" . $session->applicant_id . " AND caption='Document " . $counter . "'";
        $db->query($sql);
        unlink($filename);
    }
    $r_counter++;
}
/*User Feedback*/
echo "<table>";
if ($empty_file_msg > 0) {
    echo '<h4 class="alert alert-error"><i class="iconic-o-x" style="color: red"></i> Error!</h4>';
    echo '<hr>';
    echo "<tr><td>You cannot upload an empty file.<br>Please ensure that you are not uploading any empty file and that you do not save the details of this page without choosing one or more file(s).</td></tr>";
} else {
    if ($empty_file_msg == 0) {
        $user = new User();
        $user->applicant_id = $session->applicant_id;
        $user->updateProgress('H');
        echo '<h4 class="alert alert-success"><i class="iconic-o-check" style="color: #51A351"></i> Success</h4>';
        echo '<hr>';
        echo "<tr><td>You have successfully saved your certificate and transcript.</td></tr>";
    }
}
echo "</table>";
    } else {
        if ($i == 3) {
            $ref_ids .= $r_id . ';';
        } else {
            $ref_ids .= $r_id . ':';
        }
    }
    /*if(!$referee->sendRefereeMail())
    		{
    			$error .= 'Mail not sent to '.$referee->referee_email;
    			
    		}*/
    $i++;
}
if (!$error) {
    echo $ref_ids;
    $user = new User();
    $user->applicant_id = $session->applicant_id;
    $user->updateProgress('F');
    sleep(2);
    echo '<h4 class="alert alert-success">Success</h4>';
    echo '<hr>';
    echo "You have successfully saved your referee details<br>";
    echo "<hr>";
} else {
    sleep(2);
    echo '<h4 class="alert alert-error">Error</h4>';
    echo '<hr>';
    echo "Your referee details were not saved<br>";
    echo "<hr>";
}