public function __construct() { parent::__construct(); $this->tags = array(); $tags = PagesModel::getPageById(27)->getMeta('tag_options'); foreach (explode("\n", $tags) as $t) { $t = trim($t); $this->tags[$t] = $t; } $this->projects = PagesModel::getPagesByMeta("project_tag")->getPairs(''); $this->addText('username', 'OSM.org username')->setDisabled(); $this->addText('fullname', 'Celé jméno')->setOption('description', 'Ať se poznáme!')->addRule(Form::FILLED, '%label není vyplněn.')->addRule(Form::MIN_LENGTH, '%label musí mít alespoň 5 znaků.', 5); $this->addText('email', 'Talk-cz')->setOption('description', 'Email použivaný pro spočítání příspěvků v talk-cz (neveřejný)')->addRule(Form::FILLED, '%label není vyplněn.')->addRule(Form::EMAIL, '%label není validní.'); $this->addText('contact', 'Veřejný e-mail')->setOption('description', '(nepovinné)')->addCondition(Form::FILLED)->addRule(Form::EMAIL, '%label není validní.'); $this->addText('twitter', 'Twitter')->setOption('description', '(nepovinné) Uživatelské jméno bez zavináče'); $this->addText('github', 'Github')->setOption('description', '(nepovinné) Uživatelské jméno'); $this->addText('places', 'Výskyt')->setOption('description', '(nepovinné) Kde se vyskystuju - typicky jaká města.'); $this['places']->getControlPrototype()->placeholder = 'oddělené čárkou'; $this['places']->getControlPrototype()->style = 'width: 40%'; $this->addText('tags', 'Oblasti zájmu')->setOption('description', '(nepovinné)'); $this['tags']->getControlPrototype()->placeholder = 'oddělené čárkou'; $this['tags']->getControlPrototype()->style = 'width: 60%'; $this['tags']->getControlPrototype()->{'data-options'} = Json::encode(array_values($this->tags)); $this->addMultiSelect('projects', 'Projekty', $this->projects)->setOption('description', '(nepovinné) Projektovou stránku možno přidat v administraci. Případně napiš na dev@openstreetmap.cz')->getControlPrototype()->style = 'height:150px;width:40%'; $this->addCheckbox('public', 'Zveřejnit údaje na openstreetmap.cz'); $this->addSubmit('submit', 'Uložit údaje'); $this->onSuccess[] = callback($this, 'submitted'); $renderer = $this->getRenderer(); $renderer->wrappers['controls']['container'] = 'table class="table form-inline"'; $renderer->wrappers['error']['container'] = 'ul class="bg-danger"'; $renderer->wrappers['control']['.text'] = 'form-control'; $renderer->wrappers['control']['.email'] = 'form-control'; $renderer->wrappers['control']['.submit'] = 'btn btn-primary'; }
public function __construct($parent = null, $name = null) { parent::__construct($parent, $name); $this->addText('query', 'Query'); $this->addSubmit('btnSubmit', 'Search'); $this->onSubmit[] = array($this, 'handleSubmit'); }
public function __construct(IComponentContainer $parent = null, $name = null) { parent::__construct($parent, $name); $script = new LiveClientScript($this); $this->setTranslator(new Translator(Environment::getApplication()->getPresenter()->lang)); $this->getRenderer()->setClientScript($script); $renderer = $this->getRenderer(); $renderer->wrappers['label']['suffix'] = ':'; }
public function __construct() { parent::__construct(); $this->lang = Environment::getApplication()->getPresenter()->lang; $this->addText('email', 'email')->addRule(Form::FILLED, 'Please, fill in the email')->addRule(Form::EMAIL, 'E-mail is not valid'); $this->addSubmit('submit', 'subscribe the newsletter'); $this->onSuccess[] = callback($this, 'submitted'); $this->setTranslator(new TranslationsModel($this->lang)); }
public function __construct(IComponentContainer $parent = null, $name = null) { parent::__construct($parent, $name); $this->addProtection(); $script = new LiveClientScript($this); $this->setTranslator(new Translator(Environment::getApplication()->getPresenter()->lang)); $this->getRenderer()->setClientScript($script); $this->getElementPrototype()->class = 'ajax'; }
/** * Application form constructor. */ public function __construct(IComponentContainer $parent = NULL, $name = NULL) { parent::__construct($parent, $name); Rules::$defaultMessages = array(self::MIN_LENGTH => 'Minimum length of %label is %d chars!', self::MAX_LENGTH => 'Maximum length of %label is %d chars!', self::FILLED => 'Enter %label!', self::EMAIL => 'Enter valid email address!'); }