/** * Filter the query by a related \Models\UserReport object * * @param \Models\UserReport|ObjectCollection $userReport 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 filterByUserReportRelatedByIdUserReported($userReport, $comparison = null) { if ($userReport instanceof \Models\UserReport) { return $this->addUsingAlias(UserTableMap::COL_ID, $userReport->getIdUserReported(), $comparison); } elseif ($userReport instanceof ObjectCollection) { return $this->useUserReportRelatedByIdUserReportedQuery()->filterByPrimaryKeys($userReport->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByUserReportRelatedByIdUserReported() only accepts arguments of type \\Models\\UserReport or Collection'); } }
/** * @param ChildUserReport $userReportRelatedByIdUserReported The ChildUserReport object to add. */ protected function doAddUserReportRelatedByIdUserReported(ChildUserReport $userReportRelatedByIdUserReported) { $this->collUserReportsRelatedByIdUserReported[] = $userReportRelatedByIdUserReported; $userReportRelatedByIdUserReported->setUserReported($this); }
public function reportUser() { if (!$this->isLogged()) { $this->addPopup('danger', 'Pro nahlášení uživatele musíte být přihlášeni.'); redirectTo("/"); } if ($_POST["user"] == 0) { $this->addPopup('danger', 'Pro nahlášení uživatele musíte nějakého zvolit.'); redirectTo("/nastaveni/nahlasit-uzivatele"); } if ($_POST["user"] == $_SESSION["user"]->getId()) { $this->addPopup('danger', 'Nemůžete nahlásit sami sebe...'); redirectTo("/nastaveni/nahlasit-uzivatele"); } if (strlen(utf8_decode($_POST["reason"])) >= 500) { $this->addPopup('danger', 'Důvod nahlášení je příliš dlouhý. Důvod nahlášení by měl obsahovat maximálně 500 znaků.'); redirectTo("/nastaveni/nahlasit-uzivatele"); } $report = new UserReport(); $report->setIdUser($_SESSION["user"]->getId()); $report->setIdUserReported(strip_tags($_POST["user"])); $report->setReason(strip_tags($_POST["reason"])); $report->save(); $user = UserQuery::create()->findPk($_POST["user"]); $this->addPopup('success', 'Uživatel ' . $user->getUsername() . ' byl úspěšně nahlášen. Děkujeme!'); redirectTo("/nastaveni"); }