/** * sight * * Function called to loop over an array of users and mark them as * sighted in moodle in Banner. * * @param array $args (Optional) args for population selection */ public static function sight($args = NULL) { $defaults = array('timestamp' => time(), 'termcode' => \PSU\Student::getCurrentTerm('UG')); $args = \PSU::params($args, $defaults); $BannerStudent = new \BannerStudent(\PSU::db('banner')); $successes = array(); foreach ((array) self::get_active_users($args) as $idnumber) { $pidm = \PSU::get('idmobject')->getIdentifier($idnumber, 'psu_id', 'pid'); if (\PSU::db('psc1')->GetOne("SELECT 1 FROM v_student_active WHERE pidm = :pidm", array('pidm' => $pidm))) { if ($BannerStudent->sightStudent($pidm, 'MC')) { $successes[] = $idnumber; } //end if } //end if } //end foreach return $successes; }
/** * LDISyncEnrollment * * @since version 1.0.0 * @param $pidm Person identifier */ function LDISyncEnrollment($pidm, &$banner_object = false) { if (!$banner_object) { require_once 'BannerStudent.class.php'; $banner_object = new BannerStudent($this->db); } //end if if (!is_array($this->active_terms)) { $this->active_terms = $this->getActiveTerms(); } if (count($this->active_terms) <= 0) { return false; } foreach ($this->active_terms as $term) { $schedule = $banner_object->getSchedule($pidm, $term); foreach ($schedule[$term] as $course) { $sql = "\n\t\t\t\t\tBEGIN\n\t\t\t\t\t\ticsfkldi.p_save_enrollment(term_code_in => '" . $term . "', crn_in => '" . $course['r_crn'] . "', pidm_in => " . $pidm . ", action_in => 'ENROLL');\n\t\t\t\t\t\ticsfkldi.p_send_enrollment();\n\t\t\t\t\t\tgb_common.p_commit();\n\t\t\t\t\tEND;"; $stmt = $this->db->PrepareSP($sql); if (!$this->db->Execute($stmt)) { return false; } //end if } //end foreach } //end foreach return true; }