protected function set_template_variables()
 {
     Default_View::set_template_variables();
     $validation_form_errors = $this->controller->validate_form();
     //var_dump($validation_form_errors);
     if (empty($validation_form_errors)) {
         $save_form_return_value = $this->model->save_form();
         //var_dump($save_form_return_value);
         if ($save_form_return_value === 'record exists') {
             $this->template_variables['error_message'] = "We already have a record for the selected academic year. You can only submit one application for a particular year.";
         } else {
             if ($save_form_return_value === true) {
                 $academic_year = $this->model->get_academic_year_pv();
                 if (!empty($academic_year)) {
                     $year_range = $this->controller->get_academic_year_range($academic_year);
                     $this->template_variables['year_range'] = $year_range;
                 }
             } else {
                 if ($save_form_return_value === false) {
                     $this->template_variables['error_message'] = "An unexpected error occured due to which form did not get saved.";
                 }
             }
         }
     } else {
         if (!empty($validation_form_errors['submit'])) {
             //Form did not get submitted via standard
             $this->template_variables['error_message'] = "This is an unexpected situation. Form did not get saved.";
         } else {
             $this->model->set_template_uri('template/faform-template.php');
             $this->template_variables['template_uri'] = $this->model->get_template_uri();
             parent::set_template_variables();
             $this->template_variables['validation_form_errors'] = $validation_form_errors;
             //set the existing form values
             $this->template_variables['selected_academic_year'] = $this->model->get_academic_year_pv();
             $this->template_variables['selected_attend_summer'] = $this->model->get_attend_summer_pv();
             $this->template_variables['selected_attend_college'] = $this->model->get_attend_college_pv();
             $this->template_variables['selected_hold_college_degree'] = $this->model->get_hold_college_degree_pv();
             $this->template_variables['selected_type_of_degree'] = $this->model->get_type_of_degree_pv();
             $this->template_variables['selected_program_of_study'] = $this->model->get_program_of_study_pv();
             $this->template_variables['selected_third_party_funding'] = $this->model->get_third_party_funding_pv();
             $this->template_variables['selected_funding_amount'] = $this->model->get_funding_amount_pv();
             $this->template_variables['selected_funding_source'] = $this->model->get_funding_source_pv();
             $this->template_variables['selected_apply_for_fa'] = $this->model->get_apply_for_fa_pv();
             $this->template_variables['selected_types_of_loan'] = $this->model->get_types_of_loan_pv();
             $this->template_variables['selected_require_loan_quarters'] = $this->model->get_require_loan_quarters_pv();
             $this->template_variables['selected_anticipated_credits_for_quarter'] = $this->model->get_anticipated_credits_for_quarter_pv();
             $this->template_variables['selected_expected_graduation_date'] = $this->model->get_expected_graduation_date_pv();
             //				$this->template_variables['selected_release_student_info_box1'] = $this->model->get_release_student_info_box1_pv();
             //				$this->template_variables['selected_release_student_info_box2'] = $this->model->get_release_student_info_box2_pv();
             //				$this->template_variables['selected_auth_rep_name1'] = $this->model->get_auth_rep_name1_pv();
             //				$this->template_variables['selected_auth_rep_name2'] = $this->model->get_auth_rep_name2_pv();
             //				$this->template_variables['selected_fa_contract_agreement'] = $this->model->get_fa_contract_agreement_pv();
             //				$this->template_variables['selected_signature'] = $this->model->get_signature_pv();
         }
     }
 }
    $_SESSION["FA_USERNAME"] = $username;
} else {
    die('SSO configuration not valid');
}
$application_uri = rtrim(substr($request_uri, strlen($base_uri)), '/');
//echo '\n'. $application_uri;
switch ($application_uri) {
    /*
     * Load the financial aid application form
     */
    case 'application':
        $form_post_url = 'https://' . $request_host . $base_uri . 'application/save';
        $template_uri = 'template/faform-template.php';
        $model = new Faform_Model($template_uri, $form_post_url);
        $controller = new Faform_Controller($model);
        $view = new Faform_View($controller, $model);
        echo $view->render();
        break;
        /*
         * Save financial aid form
         */
    /*
     * Save financial aid form
     */
    case 'application/save':
        require_once 'model/form-post-model.php';
        require_once 'controller/form-post-controller.php';
        require_once 'view/form-post-view.php';
        $form_post_url = 'https://' . $request_host . $base_uri . 'application/save';
        $template_uri = 'template/after-submission-template.php';
        $model = new Form_Post_Model($template_uri, $form_post_url, $_POST);