本文整理汇总了PHP中Nette\Application\UI\Form::getHttpData方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::getHttpData方法的具体用法?PHP Form::getHttpData怎么用?PHP Form::getHttpData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::getHttpData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formSucceeded
public function formSucceeded(Form $form, $values)
{
try {
$userManager = new Model\UserManager($this->user, $this->database);
$userManager->saveprofile($form->getHttpData($form::DATA_TEXT, 'profile_email_input'), $form->getHttpData($form::DATA_TEXT, 'profile_telephone_input'), $form->getHttpData($form::DATA_TEXT, 'profile_address_input'), $form->getHttpData($form::DATA_TEXT | $form::DATA_KEYS, 'profile_comment_input'));
} catch (Nette\Security\AuthenticationException $e) {
$form->addError($e->getMessage());
}
}
示例2: changeCategoryRankFormSucceeded
public function changeCategoryRankFormSucceeded(Form $form)
{
$values = (object) $form->getHttpData();
$this->categoryFacade->changeRanks($values->categoryRank);
$form->getPresenter()->flashMessage("Pořadí kategorií bylo úspěšně změněno.", "alert-success");
$form->getPresenter()->redirect("this");
}
示例3: addCommentFormSucceded
public function addCommentFormSucceded(Form $form)
{
$values = (object) $form->getHttpData();
if (isset($values->antispam) && $values->antispam != $values->firstAddend + $values->secondAddend) {
$form->getPresenter()->getTemplate()->wrongAntispam = true;
$form->getPresenter()->getTemplate()->needsAntispam = true;
$form->getPresenter()->redrawControl("wrongAntispam");
} else {
$articleId = $form->getPresenter()->getParameter("id");
$user = UserService::loadFromSession($form->getPresenter()->getUser());
$newComment = CommentService::create($values->content, $user);
$this->commentFacade->save($newComment, $articleId);
if ($this->commentFacade->needsAntispam($user)) {
$form->getPresenter()->getTemplate()->needsAntispam = true;
$form->getPresenter()->getTemplate()->firstAddend = Antispam::generate();
$form->getPresenter()->getTemplate()->secondAddend = Antispam::generate();
}
if (!$form->getPresenter()->isAjax()) {
$form->getPresenter()->redirect("this");
} else {
$form->getPresenter()->redrawControl("addCommentForm");
$form->getPresenter()->redrawControl("comments");
$form->getPresenter()->redrawControl("metainfoArea");
$form->getPresenter()->redrawControl("metainfo");
$form->setValues([], TRUE);
}
}
}
示例4: getSelectedTag
/**
* @param Form $form
* @throws Exceptions\MissingTagException
* @return Entities\TagEntity|null
*/
protected function getSelectedTag(Form $form)
{
$tagId = $form->getHttpData(Form::DATA_LINE, 'tagId');
$tag = $tagId ? $this->tagRepository->getById($tagId) : null;
if (!$tag) {
throw new Exceptions\MissingTagException($this->translator->translate('locale.error.missing_tag'));
}
return $tag;
}
示例5: processListingSharing
public function processListingSharing(Form $form, $values)
{
$ignoredItems = $form->getHttpData(Form::DATA_TEXT, 'items[]');
try {
$this->newListings = $this->listingFacade->shareListing($this->listing, $values['description'], $values['recipients'], $ignoredItems);
} catch (\DibiException $e) {
$this->presenter->flashMessage('Nastala chyba při pokusu o sdílení výčetky. Zkuste akci opakovat později.', 'error');
$this->redirect('this');
}
$this->presenter->flashMessage('Výčetka byla úspěšně sdílena.', 'success');
}
示例6: updateSucceeded
public function updateSucceeded(Form $form)
{
$valuesForm = $form->getValues(true);
$valuesHttp = $form->getHttpData();
if (!$valuesForm['photo']->isImage() && $valuesForm['photo']->isOK()) {
$form->addError('Toto není obrázek');
return;
}
$valuesForm['underSubSection'] = (int) $valuesHttp['underSubSection'];
$valuesForm['underSerial'] = (int) $valuesHttp['underSerial'];
$values = Nette\Utils\ArrayHash::from($valuesForm);
$this->articleManager->updateArticle($values);
}
示例7: processPrivileges
public function processPrivileges(Form $form)
{
if (!$this->authorizator->isAllowed($this->user, 'user_role', 'edit')) {
$this->flashMessage('authorization.noPermission', FlashMessage::WARNING);
}
$values = $form->getHttpData();
unset($values['save'], $values['do'], $values[Form::PROTECTOR_ID]);
try {
$this->userFacade->savePermissionDefinitions($this->role, $values);
$this->flashMessage('users.roleDefinition.messages.success', FlashMessage::SUCCESS);
$this->redirect('this');
} catch (DBALException $e) {
$this->flashMessage('users.roleDefinition.messages.success', FlashMessage::WARNING);
}
}
示例8: addPhotoFormSucceeded
public function addPhotoFormSucceeded(Form $form)
{
if ($form->getPresenter()->isAjax()) {
$values = (object) $form->getHttpData();
if (!isset($values->tagPhotoList)) {
$form->getPresenter()->getTemplate()->photoMessage = "noTags";
$form->getPresenter()->redrawControl("articleWrapper");
$form->getPresenter()->redrawControl("photoFlashes");
} else {
$this->addPhoto($form, $values);
}
} else {
$form->getPresenter()->flashMessage("neeee");
$form->getPresenter()->redirect("this");
}
}
示例9: validateEmailForm
public function validateEmailForm(Form $form)
{
$values = $form->getHttpData();
$recaptchaSecret = $this->context->parameters["ReCaptchaSecret"];
$recaptcha = new \ReCaptcha\ReCaptcha($recaptchaSecret);
$httpRequest = $this->context->getByType('Nette\\Http\\Request');
$resp = $recaptcha->verify($values["g-recaptcha-response"], $httpRequest->getRemoteAddress());
if ($resp->isSuccess()) {
// verified!
} else {
$errors = $resp->getErrorCodes();
if (in_array("missing-input-response", $errors)) {
$form->addError("Prosím, zaškrtněte políčko \"Nejsem robot\"");
} else {
$form->addError("Při odesílání zprávy došlo chybě, zkuste to prosím znovu.");
}
}
}
示例10: submitted
/**
* Pass "sub"-form submission forward to custom submit function
* @param Form $form
* @return void
*/
public function submitted(Form $form)
{
if (!isset($form['group_action']['submit']) || !$form['group_action']['submit']->isSubmittedBy()) {
return;
}
$values = $form->getValues();
$values = $values['group_action'];
if ($values->group_action === 0 || is_null($values->group_action)) {
return;
}
/**
* @todo Define items IDs
*/
$http_ids = $form->getHttpData(Form::DATA_LINE | Form::DATA_KEYS, 'group_action_item[]');
$ids = array_keys($http_ids);
$id = $values->group_action;
$this->group_actions[$id]->onSelect($ids, isset($values->{$id}) ? $values->{$id} : NULL);
$form['group_action']['group_action']->setValue(NULL);
}
示例11: processMassItemsChange
public function processMassItemsChange(Form $form, $values)
{
$daysToChange = $form->getHttpData(Form::DATA_TEXT, 'items[]');
if (empty($daysToChange)) {
$this->flashMessage('Označte řádky, které chcete změnit.', 'warning');
if ($this->presenter->isAjax()) {
$this->redrawControl('flashMessage');
return;
} else {
$this->redirect('this');
}
}
try {
$workedHours = new WorkedHours($values['workStart'], $values['workEnd'], $values['lunch'], $values['otherHours']);
if ($values['newListing'] === true) {
$newListing = $this->listingsFacade->baseListingOn($this->listing, $workedHours, $daysToChange);
} else {
$changedItems = $this->listingsFacade->changeItems($this->listing, $workedHours, $daysToChange);
}
} catch (ShiftEndBeforeStartException $s) {
$form->addError('Nelze skončit směnu dříve, než začala. Zkontrolujte hodnoty
v polích Začátek a Konec');
return;
} catch (NegativeResultOfTimeCalcException $e) {
$form->addError('Položku nelze uložit. Musíte mít odpracováno více hodin,
než kolik strávíte obědem.');
return;
}
if ($values['newListing'] === true) {
$this->presenter->redirect('Listing:overview', ['year' => $newListing->getYear(), 'month' => $newListing->getMonth()]);
} else {
if ($this->presenter->isAjax()) {
$this->flashMessage('Hodnoty byly úspěšně hromadně změneny.', 'success');
$this->redrawControl('flashMessage');
$this->redrawControl('formErrors');
$this['itemsTable']->refreshTable($changedItems);
} else {
$this->redirect('this');
}
}
}
示例12: addReservationFormSucceded
public function addReservationFormSucceded(Form $form)
{
$values = (object) $form->getHttpData();
$reservation = $this->formValuesToEntity($form, $values);
$this->reservationFacade->save($reservation);
$form->getPresenter()->setupPaginator();
if ($values->reservationId == 0) {
$form->getPresenter()->flashMessage("Zápas byl úspěšně rezervován.", "alert-success");
}
if ($form->getPresenter()->isAjax()) {
if ($values->reservationId == 0) {
$form->getPresenter()->redrawControl("addReservation");
} else {
$form->getPresenter()->getTemplate()->edit = true;
$form->getPresenter()->redrawControl("editReservation");
}
$form->getPresenter()->redrawControl("paginator");
$form->getPresenter()->redrawControl("reservations");
$form->getPresenter()->redrawControl("flashes");
} else {
$form->getPresenter()->redirect("this");
}
}
示例13: processListingSharing
public function processListingSharing(Form $form, $values)
{
$ignoredDays = $form->getHttpData(Form::DATA_TEXT, 'items[]');
if (count($ignoredDays) == $this->listingResult->getWorkedDays()) {
$form->addError('Nelze odeslat prázdnou výčetku!
Nezapomeňte, zaškrtnutím se řádek výčetky nebude sdílet.');
return;
}
try {
$resultObject = $this->listingFacade->shareListing($this->listing, $values['recipient'], $values['description'], $ignoredDays);
$this->presenter->flashMessage('Výčetka byla úspěšně sdílena.', 'success');
if (!$resultObject->hasNoErrors()) {
$err = $resultObject->getFirstError();
$this->flashMessage($err['message'], $err['type']);
}
} catch (RecipientsNotFoundException $rnf) {
$form->addError('Nelze zaslat výčetku vybranému uživateli.');
return;
} catch (DBALException $e) {
$form->addError('Nastala chyba při pokusu o sdílení výčetky.
Zkuste akci opakovat později.');
}
$this->redirect('this');
}
示例14: processFiltering
public function processFiltering(Form $form)
{
$values = $form->getHttpData();
if ($this->type === null or $this->type == $values['type']) {
$this->event = $values['event'] === '' ? null : $values['event'];
} else {
$this->event = null;
}
$this->type = $values['type'];
$this->redirect('this');
}
示例15: komponentaUloz
public function komponentaUloz(Form $form)
{
$komponenta_spec_nazov = $form->getHttpData($form::DATA_TEXT, 'spec_nazov');
$komponenta = $this->nastavenie["komponenty"][$komponenta_spec_nazov];
$out = ['id_hlavne_menu' => $form->getHttpData($form::DATA_TEXT, 'id_hlavne_menu_clanku'), 'id_komponenty' => $komponenta['id'], 'spec_nazov' => $komponenta_spec_nazov, 'parametre' => ""];
foreach ($komponenta['parametre'] as $k => $v) {
$out["parametre"] .= $form->getHttpData($form::DATA_TEXT, $k) . ",";
}
$out["parametre"] = substr($out["parametre"], 0, strlen($out["parametre"]) - 1);
$this->clanok_komponenty->pridaj($out);
$this->flashRedirect("this", "Komponenta bola pridaná", "success");
}