public function executeApplicationBrowser() { $this->forward404Unless($this->getRequest()->isXMLHttpRequest(), 'Not an XMLHttp request, not authorized'); $this->forward404Unless($this->position = ProjectPositionPeer::retrieveByUuid($this->getRequestParameter('position')), 'Position not found'); $this->project = $this->position->getProject(); $this->forward404Unless($this->getUser()->isAuthenticated() && $this->project->isAuthorized('handle-applications', $this->getUser()->getId()), 'User not logged in or does not have permission to handle applications'); }
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; }
public static function doSelectJoinAll(Criteria $c, $con = null) { foreach (sfMixer::getCallables('BasePositionMilestonePeer:doSelectJoinAll:doSelectJoinAll') as $callable) { call_user_func($callable, 'BasePositionMilestonePeer', $c, $con); } $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } PositionMilestonePeer::addSelectColumns($c); $startcol2 = PositionMilestonePeer::NUM_COLUMNS - PositionMilestonePeer::NUM_LAZY_LOAD_COLUMNS + 1; ProjectPositionPeer::addSelectColumns($c); $startcol3 = $startcol2 + ProjectPositionPeer::NUM_COLUMNS; $c->addJoin(PositionMilestonePeer::POSITION_ID, ProjectPositionPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = PositionMilestonePeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = ProjectPositionPeer::getOMClass(); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol2); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj2 = $temp_obj1->getProjectPosition(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addPositionMilestone($obj1); break; } } if ($newObject) { $obj2->initPositionMilestones(); $obj2->addPositionMilestone($obj1); } $results[] = $obj1; } return $results; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ProjectPositionPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setUuid($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setProjectId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setUserId($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setTitle($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setQualifications($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setDescription($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setDeadline($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setWeeklyHours($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setStatus($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setFilled($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setMilestoneCount($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setCampusPreference($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setUpdatedAt($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setDeletedAt($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { $this->setCreatedAt($arr[$keys[15]]); } }
/** * Executes handleErrorUpdateMilestone action * */ public function handleErrorUpdateMilestone() { $this->forward404Unless($this->project = ProjectPeer::retrieveBySlug($this->getRequestParameter('project')), 'Project does not exist, using slug [' . $this->getRequestParameter('project') . ']'); $this->tab = sfConfig::get('app_tab_project_team'); $this->position = ProjectPositionPeer::retrieveByUuid($this->getRequestParameter('position')); if ($this->position == null) { $this->position = new ProjectPosition(); } $this->setTemplate('updateMilestone'); return sfView::SUCCESS; }
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); }
public function getProjectPositionsJoinCampus($criteria = null, $con = null) { include_once 'lib/model/om/BaseProjectPositionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collProjectPositions === null) { if ($this->isNew()) { $this->collProjectPositions = array(); } else { $criteria->add(ProjectPositionPeer::PROJECT_ID, $this->getId()); $this->collProjectPositions = ProjectPositionPeer::doSelectJoinCampus($criteria, $con); } } else { $criteria->add(ProjectPositionPeer::PROJECT_ID, $this->getId()); if (!isset($this->lastProjectPositionCriteria) || !$this->lastProjectPositionCriteria->equals($criteria)) { $this->collProjectPositions = ProjectPositionPeer::doSelectJoinCampus($criteria, $con); } } $this->lastProjectPositionCriteria = $criteria; return $this->collProjectPositions; }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(ProjectPositionPeer::ID, $pks, Criteria::IN); $objs = ProjectPositionPeer::doSelect($criteria, $con); } return $objs; }