Example #1
0
 /**
  * Filter the query by a related \Models\Idea object
  *
  * @param \Models\Idea|ObjectCollection $idea 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 filterByIdeaRelatedByApprovedBy($idea, $comparison = null)
 {
     if ($idea instanceof \Models\Idea) {
         return $this->addUsingAlias(UserTableMap::COL_ID, $idea->getApprovedBy(), $comparison);
     } elseif ($idea instanceof ObjectCollection) {
         return $this->useIdeaRelatedByApprovedByQuery()->filterByPrimaryKeys($idea->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByIdeaRelatedByApprovedBy() only accepts arguments of type \\Models\\Idea or Collection');
     }
 }
Example #2
0
 /**
  * @param ChildIdea $ideaRelatedByApprovedBy The ChildIdea object to add.
  */
 protected function doAddIdeaRelatedByApprovedBy(ChildIdea $ideaRelatedByApprovedBy)
 {
     $this->collIdeasRelatedByApprovedBy[] = $ideaRelatedByApprovedBy;
     $ideaRelatedByApprovedBy->setUserApproved($this);
 }
Example #3
0
 public function ideaSuggestion()
 {
     if (!$this->isLogged()) {
         $this->addPopup('danger', 'Pro podání návrhu na zlepšení musíte být přihlášeni.');
         redirectTo("/");
     }
     if (strlen(utf8_decode($_POST["reason"])) >= 500) {
         $this->addPopup('danger', 'Důvod je příliš dlouhý. Důvod by měl obsahovat maximálně 500 znaků.');
         redirectTo("/nastaveni/navrhnout-zlepseni");
     }
     if (strlen(utf8_decode($_POST["description"])) >= 1000) {
         $this->addPopup('danger', 'Popis návrhu je příliš dlouhý. Popis návrhu by měl obsahovat maximálně 1000 znaků.');
         redirectTo("/nastaveni/navrhnout-zlepseni");
     }
     $idea = new Idea();
     $idea->setIdUser($_SESSION["user"]->getId());
     $idea->setDescription(strip_tags($_POST["description"]));
     $idea->setReason(strip_tags($_POST["reason"]));
     $idea->save();
     $this->addPopup('success', 'Váš návrh byl úspěšně zaznamenán. Děkujeme!');
     redirectTo("/nastaveni");
 }