/** * 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); } }
/** * Returns a list of usernames which are currently on the waiting list * (has a valid housing application, not assigned) * * @param unknown $term * @throws DatabaseException * @return unknown */ public static function getRemainingWaitListApplications($term) { // Get the list of user names still on the waiting list, sorted by ID (first come, first served) $sql = "SELECT username FROM hms_new_application JOIN hms_lottery_application ON hms_new_application.id = hms_lottery_application.id\n LEFT OUTER JOIN (SELECT asu_username FROM hms_assignment WHERE hms_assignment.term={$term}) as foo ON hms_new_application.username = foo.asu_username\n WHERE foo.asu_username IS NULL\n AND hms_new_application.term = {$term}\n AND special_interest IS NULL\n AND waiting_list_date IS NOT NULL\n ORDER BY application_term DESC, hms_new_application.id ASC"; $applications = PHPWS_DB::getCol($sql); if (PHPWS_Error::logIfError($applications)) { throw new DatabaseException($applications->toString()); } return $applications; }
function _getIds() { if (isset($this->_table)) { $table = $this->_table; } else { $table = $this->_tables[$this->listName]; } $sql = 'SELECT id FROM ' . $table; $sort = $this->getSort(); if (isset($sort)) { $sql .= $sort; } $order = $this->getOrder(); if (isset($order)) { $sql .= $order; } return PHPWS_DB::getCol($sql); }