本文整理汇总了PHP中Nette\Application\UI\Form::setMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::setMethod方法的具体用法?PHP Form::setMethod怎么用?PHP Form::setMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::setMethod方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createComponentSearch
public function createComponentSearch()
{
$form = new Form();
$form->setMethod('get');
$form->addText('search', '');
$form->addSubmit('submit', 'Hľadaj');
return $form;
}
示例2: createComponentForm
protected function createComponentForm()
{
$form = new Form();
$form->setMethod(Form::GET);
$form->addPassword('password', 'Password')->setRequired();
$form->addSubmit('submit', 'Generate');
return $form;
}
示例3: createComponentQuickSearchForm
/**
* Quick Search form factory.
*
* @return \Nette\Application\UI\Form
*/
protected function createComponentQuickSearchForm()
{
$form = new Form();
$form->setMethod('GET');
$form->addText('q', 'Query:');
$form->addCheckboxList('filter', 'filter', ['light' => 'LIGHT', 'large' => 'LARGE']);
$form->addSubmit('search', 'Search');
$filter = [];
if ($this->filterLight) {
$filter[] = 'light';
}
if ($this->filterLarge) {
$filter[] = 'large';
}
$form->setDefaults(['q' => $this->fulltextQuery, 'filter' => $filter]);
$form->onSuccess[] = $this->quickSearchFormSucceeded;
return $form;
}
示例4: createComponentForm
public function createComponentForm()
{
$form = new Form();
$form->setMethod('get')->setAction($this->parent->link('this'));
$semestre = FlatArray::toArray($this->semesterSource->getAll());
$serie = $this->seriaSource->getAll();
$items = array();
foreach ($semestre as &$sem) {
$sem['serie'] = array();
}
foreach ($serie as $seria) {
$semestre[$seria['semester']]['serie'][] = $seria;
}
foreach ($semestre as $semester) {
$name = "{$semester['rok']} " . ($semester['cast'] == 1 ? 'leto' : 'zima');
$items[$name] = array();
foreach ($semester['serie'] as $seria) {
$items[$name][$seria['id']] = "{$seria['cislo']}. séria";
}
}
$form->addSelect('seria', 'Séria:', $items)->setValue($this->selected);
$form->addSubmit('submit', 'Načítaj');
return $form;
}
示例5: createComponentFilter
/**
* FilterAndGroupAction form factory
* @return Form
*/
public function createComponentFilter()
{
$form = new Form($this, 'filter');
$form->setMethod('get');
/**
* Filter part
*/
$filter_container = $form->addContainer('filter');
foreach ($this->filters as $filter) {
$filter->addToFormContainer($filter_container, $filter_container);
}
/**
* Group action part
*/
$group_action_container = $form->addContainer('group_action');
if ($this->hasGroupActions()) {
$this->getGroupActionCollection()->addToFormContainer($group_action_container, $form, $this->getTranslator());
}
$form->setDefaults(['filter' => $this->filter]);
$form->onSubmit[] = [$this, 'filterSucceeded'];
return $form;
}
示例6: createComponentFilter
/**
* FilterAndGroupAction form factory
* @return Form
*/
public function createComponentFilter()
{
$form = new Form($this, 'filter');
$form->setMethod('get');
$form->setTranslator($this->getTranslator());
/**
* InlineEdit part
*/
$inline_edit_container = $form->addContainer('inline_edit');
if ($this->inlineEdit instanceof InlineEdit) {
$inline_edit_container->addSubmit('submit', 'ublaboo_datagrid.save');
$inline_edit_container->addSubmit('cancel', 'ublaboo_datagrid.cancel')->setValidationScope(FALSE);
$this->inlineEdit->onControlAdd($inline_edit_container);
}
/**
* InlineAdd part
*/
$inline_add_container = $form->addContainer('inline_add');
if ($this->inlineAdd instanceof InlineEdit) {
$inline_add_container->addSubmit('submit', 'ublaboo_datagrid.save');
$inline_add_container->addSubmit('cancel', 'ublaboo_datagrid.cancel')->setValidationScope(FALSE)->setAttribute('data-datagrid-cancel-inline-add', TRUE);
$this->inlineAdd->onControlAdd($inline_add_container);
}
/**
* ItemDetail form part
*/
$items_detail_form = $this->getItemDetailForm();
if ($items_detail_form instanceof Nette\Forms\Container) {
$form['items_detail_form'] = $items_detail_form;
}
/**
* Filter part
*/
$filter_container = $form->addContainer('filter');
foreach ($this->filters as $filter) {
$filter->addToFormContainer($filter_container);
}
/**
* Group action part
*/
$group_action_container = $form->addContainer('group_action');
if ($this->hasGroupActions()) {
$this->getGroupActionCollection()->addToFormContainer($group_action_container);
}
$form->setDefaults(['filter' => $this->filter]);
$form->onSubmit[] = [$this, 'filterSucceeded'];
return $form;
}
示例7: createComponentFilter
/**
* FilterAndGroupAction form factory
* @return Form
*/
public function createComponentFilter()
{
$form = new Form($this, 'filter');
$form->setMethod(static::$form_method);
$form->setTranslator($this->getTranslator());
/**
* InlineEdit part
*/
$inline_edit_container = $form->addContainer('inline_edit');
if ($this->inlineEdit instanceof InlineEdit) {
$inline_edit_container->addSubmit('submit', 'ublaboo_datagrid.save');
$inline_edit_container->addSubmit('cancel', 'ublaboo_datagrid.cancel')->setValidationScope(FALSE);
$this->inlineEdit->onControlAdd($inline_edit_container);
$this->inlineEdit->onControlAfterAdd($inline_edit_container);
}
/**
* InlineAdd part
*/
$inline_add_container = $form->addContainer('inline_add');
if ($this->inlineAdd instanceof InlineEdit) {
$inline_add_container->addSubmit('submit', 'ublaboo_datagrid.save');
$inline_add_container->addSubmit('cancel', 'ublaboo_datagrid.cancel')->setValidationScope(FALSE)->setAttribute('data-datagrid-cancel-inline-add', TRUE);
$this->inlineAdd->onControlAdd($inline_add_container);
$this->inlineAdd->onControlAfterAdd($inline_add_container);
}
/**
* ItemDetail form part
*/
$items_detail_form = $this->getItemDetailForm();
if ($items_detail_form instanceof Nette\Forms\Container) {
$form['items_detail_form'] = $items_detail_form;
}
/**
* Filter part
*/
$filter_container = $form->addContainer('filter');
foreach ($this->filters as $filter) {
$filter->addToFormContainer($filter_container);
}
if (!$this->hasAutoSubmit()) {
$filter_container['submit'] = $this->getFilterSubmitButton();
}
/**
* Group action part
*/
$group_action_container = $form->addContainer('group_action');
if ($this->hasGroupActions()) {
$this->getGroupActionCollection()->addToFormContainer($group_action_container);
}
if (!$form->isSubmitted()) {
$this->setFilterContainerDefaults($form['filter'], $this->filter);
}
/**
* Per page part
*/
$form->addSelect('per_page', '', $this->getItemsPerPageList())->setTranslator(NULL);
if (!$form->isSubmitted()) {
$form['per_page']->setValue($this->getPerPage());
}
$form->addSubmit('per_page_submit', 'ublaboo_datagrid.per_page_submit');
$form->onSubmit[] = [$this, 'filterSucceeded'];
}
示例8: createComponentLoginForm
/**
* Login form factory.
* @return \Nette\Application\UI\Form
*/
protected function createComponentLoginForm()
{
$form = new Nette\Application\UI\Form();
$form->setMethod('POST');
$form->addText('email', 'E-mail:')->setRequired('You have to input your e-mail!')->setAttribute('type', 'email')->setAttribute('placeholder', 'E-mail')->setAttribute('class', 'text');
$form->addPassword('password', 'Password:')->setRequired('You have to input password!')->setAttribute('placeholder', 'Password')->setAttribute('class', 'text');
$form->addCheckbox('remember', ' Keep me logged in for 2 week...');
$form->addSubmit('submit', 'Log in...')->setAttribute('class', 'button');
// call method signInFormSucceeded() on success
$form->onSuccess[] = function (Nette\Application\UI\Form $form, $values) {
if ($values->remember) {
$this->getUser()->setExpiration('14 days', false, true);
} else {
$this->getUser()->setExpiration('20 minutes', true, true);
}
try {
$this->getUser()->login($values->email, $values->password);
$this->usersFacade->cleanForgottenPasswords($this->getUser()->id);
$this->flashMessageLoginSuccess();
$this->finalRedirect();
} catch (Nette\Security\AuthenticationException $e) {
$form->addError($e->getMessage());
}
};
return $form;
}
示例9: createComponentSemesterSelect
public function createComponentSemesterSelect()
{
$form = new Form();
$form->setMethod('get');
$semestre = $this->context->sources->semesterSource->getAll();
$items = array();
$cast = array(1 => 'leto', 2 => 'zima');
foreach ($semestre as $id => $semester) {
$items[$id] = "{$semester['rok']} {$cast[$semester['cast']]}";
}
$form->addSelect('semester', 'Semester:', $items)->setValue($this->getSemesterId());
$form->addSubmit('nacitaj', 'Načítaj');
return $form;
}
示例10: createComponentForumTopicsForm
/**
* Form to show list of topics with checkboxes
*
* @access protected
* @return Nette\Application\UI\Form
* @since 1.0.0
*/
protected function createComponentForumTopicsForm()
{
$form = new UI\Form();
$form->setMethod('get');
$container = $form->addContainer($this->forumSelectedTopicsContainer);
foreach ($this->forumThreads as $thread) {
$container->addCheckbox($thread->id_thread, $thread->title);
}
$form->addSubmit('show', 'View selected');
return $form;
}