예제 #1
0
 /**
  * Sends a notification to the Future RD involved in a room change request
  * letting them know they need to log in and approve
  *
  * Template Tags:
  * {STUDENT_NAME}
  * {FUTURE_ASSIGNMENT}
  * {CELL_PHONE}
  *
  * @param $rd string The username of the RD
  * @param $participant RoomChangeParticipant The Participant object involved
  */
 public static function sendRoomChangeFutureRDNotice(RoomChangeRequest $request)
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
     $subject = 'Room Change Approval Required';
     $template = 'email/roomChangeFutureRDNotice.tpl';
     $tags = array('PARTICIPANTS' => array());
     $rds = array();
     $term = Term::getCurrentTerm();
     foreach ($request->getParticipants() as $p) {
         // Add participant's future RD(s) to recipients
         $rds = array_merge($rds, $p->getFutureRdList());
         $bid = $p->getBannerId();
         $student = StudentFactory::getStudentByBannerID($bid, $term);
         $assign = HMS_Assignment::getAssignmentByBannerID($bid, $term);
         $future = new HMS_Bed($p->getToBed());
         $participantTags = array('BANNER_ID' => $student->getBannerId(), 'NAME' => $student->getName(), 'CURRENT' => $assign->where_am_i(), 'DESTINATION' => $future->where_am_i());
         $tags['PARTICIPANTS'][] = $participantTags;
     }
     // In case an RD ends up in here several times, no need for dup emails
     $recips = array_unique($rds);
     $message = self::makeSwiftmailMessage(null, $subject, $tags, $template);
     foreach ($recips as $recip) {
         $message->setTo($recip . TO_DOMAIN);
         self::sendSwiftmailMessage($message);
     }
 }