/** * * @param string $bannerID * @param integer $term * @param ApcDataProvider|LocalCacheDataProvider $provider * @return Student */ public static function getStudentByBannerID($bannerID, $term, $provider = NULL) { if (is_null($provider)) { $provider = StudentDataProvider::getInstance(); } return $provider->getStudentById($bannerID, $term); }
public function execute(CommandContext $context) { PHPWS_Core::initModClass('hms', 'StudentDataProvider.php'); $provider = StudentDataProvider::getInstance(); $provider->clearCache(); NQ::simple('hms', hms\NotificationView::SUCCESS, 'Cache cleared.'); }
/** * Main searching function. Does the database lookup and then checks each student though the various functions. */ public function doSearch() { // Clear all the caches StudentDataProvider::clearAllCache(); $term = $this->term; $query = "select DISTINCT * FROM (select hms_new_application.username from hms_new_application WHERE term={$term} AND cancelled != 1 UNION select hms_assignment.asu_username from hms_assignment WHERE term={$term}) as foo"; $result = PHPWS_DB::getCol($query); if (PHPWS_Error::logIfError($result)) { throw new Exception($result->toString()); } foreach ($result as $username) { $student = null; try { $student = StudentFactory::getStudentByUsername($username, $term); } catch (Exception $e) { $this->actions[$username][] = 'WARNING!! Unknown student!'; // Commenting out the NQ line, since this doesn't work when the search is run from cron/Pulse //NQ::simple('hms', hms\NotificationView::WARNING, 'Unknown student: ' . $username); continue; } if ($student->getType() != TYPE_WITHDRAWN && $student->getAdmissionDecisionCode() != ADMISSION_WITHDRAWN_PAID && $student->getAdmissionDecisionCode() != ADMISSION_RESCIND) { continue; } $this->actions[$username][] = $student->getBannerId() . ' (' . $student->getUsername() . ')'; $this->withdrawnCount++; $this->handleApplication($student); $this->handleAssignment($student); $this->handleRoommate($student); $this->handleRlcAssignment($student); $this->handleRlcApplication($student); } }
public static function getInstance() { if (!is_null(self::$instance)) { return self::$instance; } PHPWS_Core::initModClass('hms', 'ApcDataProvider.php'); PHPWS_Core::initModClass('hms', 'SOAPDataProvider.php'); PHPWS_Core::initModClass('hms', 'LocalCacheDataProvider.php'); if (extension_loaded('apc')) { self::$instance = new ApcDataProvider(new LocalCacheDataProvider(new SOAPDataProvider())); } else { self::$instance = new LocalCacheDataProvider(new SOAPDataProvider()); } return self::$instance; }