private $hlavne_menu; /** @var DbTable\User_profiles */ private $user_profiles; /** * @param DbTable\Hlavne_menu $hlavne_menu * @param DbTable\User_profiles $user_profiles */ public function __construct(DbTable\Hlavne_menu $hlavne_menu, DbTable\User_profiles $user_profiles) { $this->hlavne_menu = $hlavne_menu; $this->user_profiles = $user_profiles; }
/** Komponenta pre vypis kontaktneho formulara * @return \App\FrontModule\Components\User\Kontakt */ public function createComponentKontakt() { $kontakt = new \App\FrontModule\Components\User\Kontakt(); $kontakt->setSablona(['h4' => $this->trLang('komponent_kontakt_h4'), 'uvod' => $this->trLang('komponent_kontakt_uvod'), 'meno' => $this->trLang('komponent_kontakt_meno'), 'email' => $this->trLang('komponent_kontakt_email'), 'email_ar' => $this->trLang('komponent_kontakt_email_ar'), 'email_sr' => $this->trLang('komponent_kontakt_email_sr'), 'text' => $this->trLang('komponent_kontakt_text'), 'text_sr' => $this->trLang('komponent_kontakt_text_sr'), 'uloz' => $this->trLang('komponent_kontakt_uloz'), 'send_ok' => $this->trLang('komponent_kontakt_send_ok'), 'send_er' => $this->trLang('komponent_kontakt_send_er')]); $spravca = $this->user_profiles->findOneBy(["users.username" => "spravca"]); $kontakt->setSpravca($spravca->users->email); $kontakt->setNazovStranky($this->nazov_stranky); return $kontakt; }
* @return \Nette\Application\UI\Form */ protected function createComponentEditCategoriForm() { $form = $this->editCategoriForm->create(); $form['uloz']->onClick[] = function ($button) { $this->flashOut(!count($button->getForm()->errors), 'User:categories', 'Kategória bola uložená!', 'Došlo k chybe a kategória sa neuložila. Skúste neskôr znovu...'); }; $form['cancel']->onClick[] = function () { $this->redirect('User:categories'); }; return $this->_vzhladForm($form); } /** Filtre pre sablonu * @param type $class * @return type */ protected function createTemplate($class = NULL) { $template = parent::createTemplate($class); //Helper clenclass - vyber classu podla poctu prihlaseni $template->addFilter('clenclass', function ($pocet, $max) { $pok = 100 * $pocet / $max; return "vyb" . ($pok > 70 ? 1 : ($pok > 45 ? 2 : ($pok > 30 ? 3 : ($pok > 0 ? 4 : 5)))); }); return $template; } /** Funkcia pre spracovanie signálu vymazavania * @param int $id - id polozky v hlavnom menu * @param string $nazov - nazov polozky z hl. menu - na zrusenie? * @param string $druh - blizsia specifikacia, kde je to potrebne */ function confirmedDelete($id, $nazov, $druh = "") { if ($druh === "admin") { $path = $this->context->parameters["wwwDir"] . "/www/files/" . $id; if (is_dir($path)) { //Vymazanie adresaru s avatarom foreach (glob("{$path}*.{jpg,jpeg,gif,png}", GLOB_BRACE) as $file) {