コード例 #1
0
ファイル: UserQuery.php プロジェクト: OneTimeCZ/DofE
 /**
  * Filter the query by a related \Models\MembershipApplication object
  *
  * @param \Models\MembershipApplication|ObjectCollection $membershipApplication the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildUserQuery The current query, for fluid interface
  */
 public function filterByMembershipApplication($membershipApplication, $comparison = null)
 {
     if ($membershipApplication instanceof \Models\MembershipApplication) {
         return $this->addUsingAlias(UserTableMap::COL_ID, $membershipApplication->getIdUser(), $comparison);
     } elseif ($membershipApplication instanceof ObjectCollection) {
         return $this->useMembershipApplicationQuery()->filterByPrimaryKeys($membershipApplication->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByMembershipApplication() only accepts arguments of type \\Models\\MembershipApplication or Collection');
     }
 }
コード例 #2
0
ファイル: User.php プロジェクト: OneTimeCZ/DofE
 /**
  * @param ChildMembershipApplication $membershipApplication The ChildMembershipApplication object to add.
  */
 protected function doAddMembershipApplication(ChildMembershipApplication $membershipApplication)
 {
     $this->collMembershipApplications[] = $membershipApplication;
     $membershipApplication->setUser($this);
 }
コード例 #3
0
ファイル: UserController.php プロジェクト: OneTimeCZ/DofE
 public function applyForMembership()
 {
     if ($_SESSION["user"]->getIdMember() != NULL) {
         $this->addPopup('danger', 'Nemůžete žádat o členství, protože již jste členem organizace.');
         redirectTo('/nastaveni');
     }
     $existing = MembershipApplicationQuery::create()->filterByIdUser($_SESSION["user"]->getId())->filterByState("pending")->find();
     if (!$existing->isEmpty()) {
         $this->addPopup('danger', 'Nemůžete žádat o členství, protože jste již o členství zažádali.');
         redirectTo('/nastaveni');
     }
     $app = new MembershipApplication();
     $app->setName(strip_tags($_POST["name"]));
     $app->setSurname(strip_tags($_POST["surname"]));
     $app->setIdUser($_SESSION["user"]->getId());
     $app->setState("pending");
     $app->save();
     $this->addPopup("success", "Vaše žádost byla úspěšně odeslána.");
     redirectTo("/nastaveni");
 }