public function handleSave(Form $form) { $values = $form->getValues(); if ($values['api']['keyFile']->isOk()) { $values['api']['keyFile']->move($this->googleanalyticsDir . '/key.p12'); } unset($form['api']['keyFile']); unset($form['api']['keyFileNew']); }
public function handleSave(Form $form) { /** @var $entity CategoryEntity */ $entity = $form->data; $data = $form->getValues(); $sort = json_decode($data['sort'], TRUE); foreach ($entity->getItems() as $photo) { if (($pos = array_search($photo->id, $sort)) !== false) { $photo->position = $pos; } } parent::handleSave($form); }
public function handleSave(Form $form) { /** @var $entity CategoryEntity */ $entity = $form->data; $data = $form->getValues(); foreach ($data['_photos'] as $fileEntity) { if ($fileEntity) { $entity->items[] = $photoEntity = new ItemEntity($form->data->extendedPage); $photoEntity->route->setPhoto($fileEntity); $photoEntity->route->setParent($entity->route); $photoEntity->setCategory($entity); } } parent::handleSave($form); }
public function processForm(Form $form) { $this->tryCall('handleClear', array()); $values = $form->getValues(); if ($values['section'] === 'all') { $this->cacheManager->clean(); } elseif ($values['section'] === 'namespace') { try { $this->cacheManager->cleanNamespace($values['namespace']); } catch (InvalidArgumentException $e) { $this->flashMessage($e->getMessage(), 'warning'); return; } } elseif ($values['section'] === 'sessions') { $this->cacheManager->cleanSessions(); } $this->flashMessage($this->translator->translate('Cache has been cleared.'), 'success'); if (!$this->isAjax()) { $this->redirect('this'); } }
public function formSuccess(Form $form) { $values = $form->getValues(); $button = $form->isSubmitted(); if ($values->remember) { $form->presenter->user->setExpiration('+ 14 days', FALSE); } else { $form->presenter->user->setExpiration('+ 20 minutes', TRUE); } if ($button === $form->getSaveButton()) { try { $form->presenter->user->login($values->username, $values->password); } catch (AuthenticationException $e) { $this->onError($this, $e->getMessage()); } } else { $this->redirect('login!', str_replace('_', ' ', $button->name)); } $this->onSuccess($this); $this->redirect('this'); }
public function handleSuccess(Form $form) { $values = $form->getValues(); $oldPath = $this->moduleHelpers->expandPath($form->data, 'Resources/layouts'); $form->data = $this->getKeyByValues($values); $path = $this->moduleHelpers->expandPath($form->data, 'Resources/layouts'); umask(00); if (!file_exists(dirname($path))) { if (!@mkdir(dirname($path), 0777, TRUE)) { $form->addError("File '{$path}' is not writable."); } } file_put_contents($path, $values['text']); if ($oldPath && $oldPath !== $path) { @unlink($oldPath); } }