public function onSubmit() { $form = $this['form']; $record = new \SkolaRecord(\FlatArray::inflate($form->getValues())); $record['adresa']['stat'] = 'SR'; if (!empty($record['id'])) { $this->context->sources->skolaSource->update($record); $this['grid']->flashMessage("Zmenená škola {$record['nazov']}"); } else { $this->context->sources->skolaSource->insert($record); $this['grid']->flashMessage("Pridaná škola {$record['nazov']}"); } $this->redirect('this'); }
public function onSubmit() { $sources = $this->context->sources; $record = new \RiesitelRecord(\FlatArray::inflate($this['form']->values)); if ($record['koresp_kam'] != \RiesitelRecord::KORESP_ELSE) { $record['koresp_adresa'] = null; } else { $record['koresp_adresa']['stat'] = 'SR'; } $record['osoba']['adresa']['stat'] = 'SR'; $record['typ_studia'] = $sources->typStudiaSource->getById($record['typ_studia']); $record['datum'] = new \Nette\DateTime(); $osoba = $record['osoba']; if (!empty($record['id'])) { $sources->riesitelSource->update($record); $this['grid']->flashMessage("Zmenený riešiteľ {$osoba['meno']} {$osoba['priezvisko']}"); } else { $sources->riesitelSource->insert($record); $this['grid']->flashMessage("Pridaný riešiteľ {$osoba['meno']} {$osoba['priezvisko']}"); } $this->redirect('this'); }
public function createRiesitelRecord($udajeForm) { $sources = $this->context->sources; $record = new \RiesitelRecord(\FlatArray::inflate($udajeForm->values)); if ($record['koresp_kam'] != \RiesitelRecord::KORESP_ELSE) { $record['koresp_adresa'] = null; } else { $record['koresp_adresa']['stat'] = 'SR'; } $record['osoba']['adresa']['stat'] = 'SR'; $record['typ_studia'] = $sources->typStudiaSource->getById($record['typ_studia']); $record['datum'] = new \Nette\DateTime(); return $record; }
public function submitOboduj() { $this['grid']->flashMessage('Nahodené body'); $form = $this['obodujForm']; $values = \FlatArray::inflate($form->values); foreach ($values['riesitel'] as $id => $body) { if ($body === '') { $body = null; } $this->context->sources->riesitelSeriaSource->setPrikladById($id, $values['priklad'], $body); } $this->redirect('default'); }
public function onSubmit() { $riesitelSource = $this->context->sources->riesitelSeriaSource; $data = \FlatArray::inflate($this['form']->getValues()); $record = new \RiesitelSeriaRecord($data); foreach ($data['priklad'] as $key => $priklad) { if ($priklad) { $record[$key] = null; } } $this->context->sources->riesitelSeriaSource->insert($record); $this['grid']->flashMessage('Odobálkovaný riešiteľ'); $this->redirect('this'); }
/** * @dataProvider flatProvider */ public function testInflate($flat, $inflat) { $this->assertEquals(FlatArray::inflate($flat), $inflat); }