private function checkPersistent() { if ($this->serverRepo->findById($this->selectedServerId)->count() == 0) { $servers = $this->permRepo->findBy(array('user_id' => $this->user->id)); if (count($servers) != 0) { $srv = $servers->fetch(); $this->flashMessage("Vybrán server " . $srv->server->name, 'info'); $this->handleSwitchServer($srv->server_id); } } }
/** * @return Nette\Application\UI\Form */ protected function createComponentServerParams() { $form = new Form(); $form->addGroup('runtime'); $form->addText('name', 'Jméno: ', 30, 20)->addRule(Form::FILLED, 'server musí mít jméno'); $form->addText('path', 'Cesta: ', 30)->addRule(Form::FILLED, 'je nutné specifikovat cestu')->addRule(Form::PATTERN, "Toto není platná cesta ke složce, ty začínají a končí lomítkem.", "^/[^/].*/\$"); $form->addText('executable', 'jméno .jar: ', 30)->addRule(Form::FILLED, 'je nutno specifikovat jméno .jar souboru'); $form->addSubmit('update', 'Upravit')->setAttribute('class', 'ajax'); if ($this->commonStorage) { $form['path']->setDisabled(); $form['executable']->setDisabled(); } if (!$this->user->isAllowed('server-settings', 'edit')) { $form['update']->setDisabled(); } //defaults $values = $this->serverRepo->findById($this->selectedServerId)->fetch(); $form->setValues($values); $form->onSuccess[] = $this->serverParamsFormSubmitted; return $form; }