public function getProjectPosition($con = null)
 {
     if ($this->aProjectPosition === null && $this->position_id !== null) {
         include_once 'lib/model/om/BaseProjectPositionPeer.php';
         $this->aProjectPosition = ProjectPositionPeer::retrieveByPK($this->position_id, $con);
     }
     return $this->aProjectPosition;
 }
Beispiel #2
0
 public function handleNewApplicant($position_id, $user_id)
 {
     $position = ProjectPositionPeer::retrieveByPK($position_id);
     $user = sfGuardUserPeer::retrieveByPK($user_id);
     // Alert the project owner of the application
     $profile = $this->getSfGuardUserRelatedByOwnerId()->getProfile();
     $profile->addHistoryEvent('New application for project "' . $this->getTitle() . '"', $user->getProfile()->getFullName() . ' has applied for a project you currently own. ' . ucfirst($user->getProfile()->getGenderSubject()) . ' would like to join your project as "' . $position->getTitle() . '". Please review the application using the applicaiton manager found on the project\'s page.', 'projects');
     $message = array();
     $message["from"] = $user->getId();
     $message["to"] = $this->getOwnerId();
     $message["owner"] = $this->getOwnerId();
     $message["folder"] = "inbox";
     $message["parent"] = null;
     $message["subject"] = 'New application for project "' . $this . '"';
     $message["text"] = $user->getProfile()->getFullName() . ' has applied for a project you currently own. ' . ucfirst($user->getProfile()->getGenderSubject()) . ' would like to join your project as "' . $position->getTitle() . '". Please review the application using the applicaiton manager found on the project\'s page.';
     $options = array();
     $options["copyTo"] = "none";
     $projectUser = new ProjectUser();
     $projectUser->setUserId($user->getId());
     $projectUser->setPositionId($position->getId());
     $projectUser->setStatus(sfConfig::get('app_project_user_status_pending'));
     // Status(3): pending review
     $projectUser->save();
     MessagePeer::sendSimpleMessage($message, $options);
 }