Esempio n. 1
0
 /**
  * executes student query and returns a result set for looping
  */
 public static function query($args = array(), $return_results = true, $debug = false)
 {
     if (!is_array($args)) {
         $args = array('term_code' => $args);
     }
     //end if
     $valid_args = array('term_code', 'last_name', 'first_name', 'gender', 'veteran', 'advisor_first_name', 'advisor_last_name', 'continuing_ed', 'class1', 'class2', 'class3', 'class4', 'confirmed_status', 'pt_ft', 'age_low', 'age_high', 'gpa_low', 'gpa_high', 'credit_low', 'credit_high', 'state_code', 'degree', 'department', 'major', 'option', 'minor', 'degs', 'sport', 'teacher_cert', 'c_age', 'c_commute', 'c_sex', 'c_dean', 'c_styp', 'c_advr', 'c_conf', 'c_ma', 'c_pt_cred', 'c_t_cred', 'c_birth', 'c_cred', 'c_majr', 'c_pt_gpa', 'c_t_gpa', 'c_ca', 'c_gpa', 'c_min', 'c_sport', 'c_vet', 'c_ca_ph', 'c_degr', 'c_opt', 'c_sport_comments', 'c_webreg', 'c_citz', 'c_dept', 'c_pa', 'c_sport_eligibility', 'c_class', 'c_email', 'c_load', 'c_stat', 'c_degs', 'c_cat');
     $validated_args = array();
     foreach ($args as $key => $value) {
         if (in_array($key, $valid_args)) {
             $validated_args['ps_' . $key] = $value;
         }
         //end if
     }
     //end foreach
     if (!$validated_args['ps_term_code']) {
         $validated_args['ps_term_code'] = self::getCurrentTerm('UG');
     }
     //end if
     $sql = "BEGIN pkg_student_utility.p_query(pb_load_address => TRUE";
     foreach ($validated_args as $key => $value) {
         $sql .= ", " . $key . " => :" . $key;
     }
     //end foreach
     $sql .= "); END;";
     $stmt = \PSU::db('banner')->PrepareSP($sql);
     foreach ($validated_args as $key => $value) {
         \PSU::db('banner')->InParameter($stmt, $value, $key);
     }
     //end foreach
     \PSU::db('banner')->Execute($stmt);
     if ($debug) {
         psu::dbug(psu::db('banner')->GetOne("SELECT pkg_student_utility.f_get_unexclude() FROM dual"));
     }
     //end if
     $sql = "SELECT * FROM gt_student_query WHERE exclude IS NULL";
     if ($return_results) {
         return \PSU::db('banner')->Execute($sql);
     } else {
         return $sql;
     }
     //end if
 }