public function execute(CommandContext $context) { if (!Current_User::allow('withdrawn_search')) { PHPWS_Core::initModClass('hms', 'exception/PermissionException.php'); throw new PermissionException('You do not have permission to makr applications withdrawn.'); } $id = $context->get('appId'); if (!isset($id) || is_null($id)) { throw new InvalidArugumentException('Missing application id.'); } PHPWS_Core::initModclass('hms', 'HousingApplicationFactory.php'); $app = HousingApplicationFactory::getApplicationById($context->get('appId')); $app->setWithdrawn(1); $app->save(); NQ::simple('hms', hms\NotificationView::SUCCESS, 'Application successfully marked as withdrawn.'); $context->goBack(); }
public static function send_roommate_reminder_emails($term) { PHPWS_Core::initModClass('hms', 'HMS_Bed.php'); PHPWS_Core::initModclass('hms', 'StudentFactory.php'); // Get a list of outstanding roommate requests, send them reminder emails $query = "select hms_lottery_reservation.* FROM hms_lottery_reservation\n LEFT OUTER JOIN (SELECT asu_username FROM hms_assignment WHERE term={$term} AND lottery = 1) as foo ON hms_lottery_reservation.asu_username = foo.asu_username\n WHERE foo.asu_username IS NULL\n AND hms_lottery_reservation.expires_on > " . time(); $result = PHPWS_DB::getAll($query); if (PEAR::isError($result)) { PHPWS_Error::log($result); test($result, 1); } $year = Term::toString($term) . ' - ' . Term::toString(Term::getNextTerm($term)); foreach ($result as $row) { $student = StudentFactory::getStudentByUsername($row['asu_username'], $term); $requestor = StudentFactory::getStudentByUsername($row['requestor'], $term); $bed = new HMS_Bed($row['bed_id']); $hall_room = $bed->where_am_i(); HMS_Email::send_lottery_roommate_reminder($row['asu_username'], $student->getName(), $row['expires_on'], $requestor->getName(), $hall_room, $year); HMS_Activity_Log::log_activity($row['asu_username'], ACTIVITY_LOTTERY_ROOMMATE_REMINDED, 'hms'); } }