/** * Constructor * @param Nette\Application\UI\Control $parent * @param string $name */ public function __construct($parent, $name) { parent::__construct($parent, $name); $media = $this->lookup('Bubo\\Media'); $langs = $this->presenter->langManagerService->getLangs(); $config = $media->getConfig(); $allTitles = $this->addContainer('titles'); foreach ($langs as $code => $langTitle) { $langContainer = $allTitles->addContainer($code); foreach ($config['titles'] as $titleName => $title) { switch ($title['control']) { case 'text': $langContainer->addText($titleName, $title['title']); break; case 'textArea': $langContainer->addTextArea($titleName, $title['title']); break; } } } $file = $this->presenter->mediaManagerService->getFile($this->parent->id); $defaults = array('titles' => Utils\Multivalues::unserialize($file['ext'])); if ($defaults['titles']) { $this->setDefaults((array) $defaults); } $this->addHidden('fileId', $this->parent->id); $this->addSubmit('send', 'Uložit'); $this->onSuccess[] = array($this, 'formSubmited'); $this->getElementPrototype()->class = 'ajax'; $this['send']->getControlPrototype()->class = "submit"; }
/** * Constructor * @param Nette\Application\UI\Control $parent * @param string $name */ public function __construct($parent, $name) { parent::__construct($parent, $name); $folderId = $this->parent->getId(); $folder = $this->presenter->mediaManagerService->getFolder($folderId); $this->addText('folderName', 'Nový název galerie')->setDefaultValue($folder['name'])->setRequired('Zadejte název galerie'); $this->addSubmit('send', 'OK'); $this->addHidden('folderId', $folderId); $this->onSuccess[] = array($this, 'formSubmited'); }
/** * Constructor * @param Nette\Application\UI\Control $parent * @param string $name */ public function __construct($parent, $name) { parent::__construct($parent, $name); $parentFolderId = $this->parent->getFolderId(); $currentSection = $this->parent->getCurrentSection(); $this->addText('folderName', 'Název složky')->setRequired('Zadejte název složky'); $this->addSubmit('send', 'OK'); $this->addHidden('parentFolderId', $parentFolderId); $this->addHidden('currentSection', $currentSection); $this->onSuccess[] = array($this, 'formSubmited'); }