} $this->redirect('this'); } /** Formular pre editaciu kategorie produktu. * @return Nette\Application\UI\Form */ public function createComponentKategorieEditForm() { $form = new Form();
$form = $this->editUserForm->create($this->user_view_fields); $form['uloz']->onClick[] = function ($button) { $this->flashOut(!count($button->getForm()->errors), 'User:'******'Údaje boli uložené!', 'Došlo k chybe a údaje sa neuložili. Skúste neskôr znovu...'); }; $form['cancel']->onClick[] = function () { $this->redirect('User:'); }; return $this->_vzhladForm($form); } /** * Edit categori form component factory. Tovarnicka na formular pre editaciu kategorie
/** * Vytvorenie spolocnych helperov pre sablony * @param type $class * @return type */ protected function createTemplate($class = NULL) { $servise = $this; $template = parent::createTemplate($class); $template->addFilter('vlastnik', function ($id_user_profiles = 0, $action = 'edit') use($servise) { $user = $servise->user; // Vrati true ak: si prihlaseny && si admin || (mas opravnenie a si valstnik) $out = $user->isLoggedIn() ? $user->isInRole('admin') ? TRUE : ($user->isAllowed($servise->name, $action) ? $id_user_profiles ? $user->getIdentity()->id == $id_user_profiles : FALSE : FALSE) : FALSE; return $out; }); return $template; }