This commit is contained in:
2022-01-27 22:20:25 +01:00
parent cddc8b970e
commit 500baf2878
10 changed files with 681 additions and 674 deletions

View File

@@ -8,12 +8,21 @@ use App\Model\Database\Entity\Attributes\TUpdatedAt;
use App\Model\Exception\Logic\InvalidArgumentException; use App\Model\Exception\Logic\InvalidArgumentException;
use App\Model\Security\Identity; use App\Model\Security\Identity;
use App\Model\Utils\DateTime; use App\Model\Utils\DateTime;
use App\Model\Utils\Strings;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* @ORM\Entity(repositoryClass="App\Model\Database\Repository\UserRepository") * @ORM\Entity(repositoryClass="App\Model\Database\Repository\UserRepository")
* @ORM\Table(name="`user`") * @ORM\Table(name="`user`")
* @ORM\HasLifecycleCallbacks * @ORM\HasLifecycleCallbacks
*
* @property int $id
* @property String $name
* @property String $surname
* @property String $email
* @property String $password
* @property String $role
* @property int $state
*/ */
class User extends AbstractEntity class User extends AbstractEntity
{ {

View File

@@ -22,8 +22,8 @@ final class HomePresenter extends BaseFrontPresenter
{ {
/** @inject @var \App\Model\Database\EntityManager */ /** @inject @var EntityManager */
public $em; public EntityManager $em;
/** @inject */ /** @inject */
public VisualPaginatorFactory $visualPaginatorFactory; public VisualPaginatorFactory $visualPaginatorFactory;
/** @inject */ /** @inject */
@@ -38,6 +38,7 @@ final class HomePresenter extends BaseFrontPresenter
/** @persistent */ /** @persistent */
public $term; public $term;
/** @persistent */ /** @persistent */
public $slug; public $slug;
@@ -58,7 +59,6 @@ final class HomePresenter extends BaseFrontPresenter
$translations[$t->getId()]["lang"] = $lang; $translations[$t->getId()]["lang"] = $lang;
$translations[$t->getId()]["t"] = $t; $translations[$t->getId()]["t"] = $t;
$slugs[$slug] = $t; $slugs[$slug] = $t;
} }
$this->translations = $translations; $this->translations = $translations;
$this->dictionaries = $drs; $this->dictionaries = $drs;
@@ -117,6 +117,7 @@ final class HomePresenter extends BaseFrontPresenter
->setRequired('Vyberte slovnik'); ->setRequired('Vyberte slovnik');
$form->addText('clen', 'Clen', 5); $form->addText('clen', 'Clen', 5);
$form->addSubmit('search', 'Vyhaľadaj'); $form->addSubmit('search', 'Vyhaľadaj');
$form->onSuccess[] = array($this, 'searchFormSucceeded');
return $form; return $form;
} }
@@ -127,6 +128,8 @@ final class HomePresenter extends BaseFrontPresenter
$term = $values->string; $term = $values->string;
$result = $this->doSearch('TermsQuery', $translation, $term, $clen); $result = $this->doSearch('TermsQuery', $translation, $term, $clen);
$this->term = $term;
dump($result);
$this->template->result = $result; $this->template->result = $result;
} }
@@ -157,7 +160,6 @@ final class HomePresenter extends BaseFrontPresenter
$basepath = $this->getHttpRequest()->url->basePath . "/media"; $basepath = $this->getHttpRequest()->url->basePath . "/media";
$oggResp = new OggResponse($id, $pron->filename); $oggResp = new OggResponse($id, $pron->filename);
return $this->sendResponse($oggResp); return $this->sendResponse($oggResp);
} }
public function beforeRender() public function beforeRender()
@@ -171,14 +173,15 @@ final class HomePresenter extends BaseFrontPresenter
public function actionDefault() public function actionDefault()
{ {
/*
if ($this->getRequest()->isMethod('GET') && $this->term) { if ($this->getRequest()->isMethod('GET') && $this->term) {
$this['searchForm']['string']->setValue($this->term); $this['searchForm']['string']->setValue($this->term);
$t = $this->slugs[$this->slug]; $t = $this->slugs[$this->slug];
$result = $this->doSearch('TermsQuery',$t->id,$this->term); $result = $this->doSearch('TermsQuery',$t->id,$this->term);
if ($result) $this->template->result = $result; if ($result) $this->template->result = $result;
} else {
//dumpe($this);
$this->term = $this['searchForm']['string']->getValue();
} }
*/
$this['searchForm']->onSuccess[] = array($this, 'searchFormSucceeded'); $this['searchForm']->onSuccess[] = array($this, 'searchFormSucceeded');
} }
@@ -199,7 +202,6 @@ final class HomePresenter extends BaseFrontPresenter
$t = $this->translations[$id]; $t = $this->translations[$id];
$this->redirect('Front:Home:select', $t["slug"], $this['searchForm']['string']->value); $this->redirect('Front:Home:select', $t["slug"], $this['searchForm']['string']->value);
} }
} }
if ($term) { if ($term) {
$query = new TermsFullQuery($translation->dictionary, $term, $translation->direction); $query = new TermsFullQuery($translation->dictionary, $term, $translation->direction);
@@ -274,13 +276,9 @@ final class HomePresenter extends BaseFrontPresenter
public function renderIpa() public function renderIpa()
{ {
} }
public function renderMerge() public function renderMerge()
{ {
} }
} }