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();
         }
     }
 }
 protected function set_template_variables()
 {
     parent::set_template_variables();
     $this->template_variables['form_post_url'] = $this->model->get_form_post_url();
     //user information
     $user_sid = $this->model->get_sid();
     if (!empty($user_sid)) {
         /*
          *  If the user has submitted application for all the available academic years, update the template
          * 
          */
         $already_submitted_app_qtr_ids = $this->controller->already_submitted_application_year();
         $length_already_sub_apps = count($already_submitted_app_qtr_ids);
         $count = 0;
         foreach ($already_submitted_app_qtr_ids as $key => $val) {
             if ($already_submitted_app_qtr_ids[$key] != true) {
                 break;
             }
             $count++;
         }
         if ($length_already_sub_apps == $count) {
             $this->model->set_template_uri('template/available-years-submitted-template.php');
             $this->template_variables['template_uri'] = $this->model->get_template_uri();
         }
         $year_quarter_information = $this->controller->get_academic_year_option_and_values();
         //var_dump($already_submitted_app_qtr_ids);
         $this->template_variables["already_submitted_app_qtr_ids"] = $already_submitted_app_qtr_ids;
         $this->template_variables["year_quarter_information"] = $year_quarter_information;
         //Quarters
         $quarters = $this->controller->get_all_quarter_options_available();
         $this->template_variables["quarters"] = $quarters;
         $types_of_loan = $this->model->get_types_of_loan_options();
         $this->template_variables["types_of_loan"] = $types_of_loan;
         $credit_options = $this->model->get_credit_options();
         $this->template_variables["credit_options"] = $credit_options;
         $types_of_degree = $this->model->get_types_of_degree_options();
         $this->template_variables["types_of_degree"] = $types_of_degree;
         $program_of_study_options = $this->model->get_program_of_study_options();
         $this->template_variables["program_of_study_options"] = $program_of_study_options;
         $expected_graduation_year_array = $this->model->get_expected_graduation_year_array();
         $this->template_variables["expected_graduation_year_array"] = $expected_graduation_year_array;
     } else {
         /*
         	If the logged in user does not have a record in student table, update the template
         */
         $this->model->set_template_uri('template/not-a-student-template.php');
         $this->template_variables['template_uri'] = $this->model->get_template_uri();
     }
     // Year Quarter
 }