em->getRepository(Translation::class)->findBy([], ['id' => 'ASC', 'direction' => 'ASC']); $drs = $this->em->getRepository(Dictionary::class)->findPairs('id', 'name'); $select = []; $translations = []; foreach ($trs as $t) { $lang1 = $t->getLangName1(); $lang2 = $t->getLangName2(); $lang = mb_substr($lang1, 0, -1); $lang .= "o-" . $lang2; $slug = Strings::webalize($lang); $select[$drs[$t->getDictionary()->id]][$t->id] = $lang; $translations[$t->id]["slug"] = $slug; $translations[$t->id]["lang"] = $lang; $translations[$t->id]["t"] = $t; $slugs[$slug] = $t; } $this->slug= $translations[1]["slug"]; $this->translations = $translations; $this->dictionaries = $drs; $this->drsSelect = $select; $this->slugs = $slugs; parent::startup(); } public function handleGetInfo($id) { $term = $this->repoTerms->find($id); $termFlags = $this->repoTermFlags->findAssoc([], 'id'); $dictionary = $term->dictionary; $query = new TermsFullQuery($dictionary, $term->string1, 1, false); $result = $this->repoTerms->fetch($query); $this->template->result = $result; $this->template->termFlags = $termFlags; $this->setView('info'); } public function beforeRender() { $dicttypes = $this->em->getDictTypeRepository()->findAssoc([], 'id'); $this->template->dicttypes = $dicttypes; $this->template->dictionaries = $this->dictionaries; $this->template->translations = $this->translations; // $this->template->paginator = $this->paginator; } protected function createComponentSearchForm() { $form = new UI\Form; $form->addText('string', 'Výraz') ->setRequired('Zadajte výray'); $form->addSelect('translation', 'Preklad', $this->drsSelect) ->setDefaultValue(1) ->setRequired('Vyberte slovnik'); $form->addText('clen', 'Clen', 5); $form->addSubmit('search', 'Vyhaľadaj'); $form->onSuccess[] = array($this, 'searchFormSucceeded'); return $form; } public function searchFormSucceeded(UI\Form $form, $values) { $translation = $values->translation; $clen = $values->clen; $term = $values->string; $this->redirect('Search:default',$translation,$term,$clen); } }