当前位置: 首页>>代码示例>>PHP>>正文


PHP Form::__construct方法代码示例

本文整理汇总了PHP中Nette\Application\UI\Form::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::__construct方法的具体用法?PHP Form::__construct怎么用?PHP Form::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Application\UI\Form的用法示例。


在下文中一共展示了Form::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($parent, $name, $action = '')
 {
     parent::__construct($parent, $name);
     $this->getElementPrototype()->class = 'login-form';
     $this->addProtection('STFU!');
     if ($action == '') {
         $request = $this->getHttpRequest();
         $value = $request->getCookie('login');
         $this->addText('login', 'Uživatelské jméno:	')->addRule(Form::FILLED, 'Prosím zadajte přihlašovací jméno.');
         $this['login']->getControlPrototype()->class = "input";
         if ($value) {
             $this->setValues(array('login' => $value));
         }
     }
     $this->addPassword('password', 'Heslo:')->addRule(Form::FILLED, 'Prosím zadajte heslo.');
     $this['password']->getControlPrototype()->addAttributes(array('class' => "input"));
     $this->addCheckbox('remember', 'Zapamatovat')->setValue(true);
     if ($action == '') {
         $this->addSubmit('send', 'Přihlásit');
         $this->onSuccess[] = array($this, 'formSubmited');
     } else {
         $this->addSubmit('send', 'Změnit');
         $this->onSuccess[] = array($this, 'editFormSubmited');
     }
     $this['send']->getControlPrototype()->addAttributes(array('class' => "submit"));
 }
开发者ID:jurasm2,项目名称:bubo-sandbox,代码行数:26,代码来源:LoginForm.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     $renderer = $this->getRenderer();
     $renderer->wrappers['controls']['container'] = '';
     $renderer->wrappers['pair']['container'] = 'div class="form-group"';
     $renderer->wrappers['label']['container'] = '';
     $renderer->wrappers['control']['container'] = 'div class="col-sm-11"';
     $renderer->wrappers['control']['.submit'] = "btn btn-default";
     $renderer->wrappers['control']['.text'] = "form-control";
     $renderer->wrappers['control']['.select'] = "form-control";
     $renderer->wrappers['control']['.password'] = "form-control";
     $renderer->wrappers['control']['.email'] = "form-control";
     $renderer->wrappers['error'] = array('container' => 'div class=errors', 'item' => NULL);
     $form = $this->getForm();
     $form->getElementPrototype()->class('form-horizontal');
     foreach ($form->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->setAttribute('class', empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->setAttribute('class', 'form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->class($control->getControlPrototype()->type);
         }
     }
 }
开发者ID:caloriscz,项目名称:caloriscms,代码行数:27,代码来源:BootstrapPHForm.php

示例3: __construct

 public function __construct(\Nette\Security\User $user)
 {
     parent::__construct();
     $this->user = $user;
     $this->createFields();
     $this->addEventListeners();
 }
开发者ID:shophp,项目名称:shophp,代码行数:7,代码来源:LogoutForm.php

示例4: __construct

 /**
  * @param \Nette\ComponentModel\IContainer $parent
  * @param string $name
  * @param \Nette\Localization\ITranslator $translator
  */
 public function __construct(IContainer $parent = NULL, $name = NULL, ITranslator $translator)
 {
     parent::__construct($parent, $name);
     $this->mode = FormMode::CREATE_MODE;
     $this->setTranslator($translator);
     $renderer = $this->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class=form-group';
     $renderer->wrappers['control']['container'] = 'div class=col-sm-9';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-3 control-label"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     $renderer->wrappers['control']['erroritem'] = 'span class="label label-danger"';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['.submit'] = 'btn btn-lg btn-primary';
     $renderer->wrappers['control']['.button'] = 'btn btn-lg btn-default';
     //$renderer->wrappers['control']['.text'] = 'form-control';
     //	dd($renderer);
     //	dd($renderer->wrappers['controls']);
     //	dd($renderer->wrappers['control']);
     // make form and controls compatible with Twitter Bootstrap
     $this->getElementPrototype()->class('form-horizontal');
     foreach ($this->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
 }
开发者ID:fuca,项目名称:sportsclub,代码行数:38,代码来源:BaseForm.php

示例5: __construct

 public function __construct(CategoryService $categoryService, Category $editedCategory = null)
 {
     parent::__construct();
     $this->categoryService = $categoryService;
     $this->editedCategory = $editedCategory;
     $this->createFields();
 }
开发者ID:shophp,项目名称:shophp,代码行数:7,代码来源:CategoriesForm.php

示例6: __construct

 /**
  * FormBootstrap constructor.
  *
  * @param null|ITranslator $translator
  * @param null|string      $type null, inline, vertical
  */
 public function __construct($translator, $type = null)
 {
     if ($translator) {
         $this->setTranslator($translator);
     }
     parent::__construct();
 }
开发者ID:mepatek,项目名称:application,代码行数:13,代码来源:Form.php

示例7: __construct

 public function __construct()
 {
     parent::__construct();
     $this->addText('login', 'Login:')->setRequired();
     $this->addPassword('password', 'Heslo:')->setRequired();
     $this->addSubmit('submit', 'Přihlásit se')->getControlPrototype()->class('btn btn-primary btn-block');
 }
开发者ID:ondrs,项目名称:nette-bootstrap,代码行数:7,代码来源:SignInForm.php

示例8: __construct

 public function __construct(CategoryService $categoryService, Product $editedProduct = null)
 {
     parent::__construct();
     $this->categoryService = $categoryService;
     $this->editedProduct = $editedProduct;
     $this->createFields();
 }
开发者ID:shophp,项目名称:shophp,代码行数:7,代码来源:ProductForm.php

示例9: __construct

 public function __construct()
 {
     parent::__construct();
     $this->addText('title', 'Názov')->addRule(self::MAX_LENGTH, '"%label" môže mať maximálnu dĺžku %value.', 255)->setRequired('Prosím, vyplňte povinné pole %label.');
     $this->addTextArea('content', 'Obsah');
     $this->addSubmit('save', 'Uložiť');
 }
开发者ID:josiff,项目名称:fri-sandbox,代码行数:7,代码来源:ArticleForm.php

示例10: __construct

 public function __construct(\Nette\ComponentModel\IContainer $parent, $name)
 {
     parent::__construct($parent, $name);
     $field = new \Netxten\Forms\Controls\HiddenFieldWithLabel('Search:');
     $field->setHtmlId('search');
     $this->addComponent($field, 'search');
     $this->addSubmit('submit', 'Search');
 }
开发者ID:spaze,项目名称:cotel,代码行数:8,代码来源:SearchForm.php

示例11: __construct

 public function __construct(Nette\ComponentModel\IContainer $parent = NULL, $name = NULL)
 {
     parent::__construct();
     $this->monitor('Nette\\Application\\UI\\Presenter');
     if ($parent !== NULL) {
         $parent->addComponent($this, $name);
     }
 }
开发者ID:soundake,项目名称:pd,代码行数:8,代码来源:MyForm.php

示例12: __construct

 /**
  * @param string $permanentLoginExpiration
  */
 public function __construct(CurrentCartService $currentCartService, \Nette\Security\User $user, $permanentLoginExpiration)
 {
     parent::__construct();
     $this->currentCartService = $currentCartService;
     $this->user = $user;
     $this->createFields();
     $this->addEventListeners($permanentLoginExpiration);
 }
开发者ID:shophp,项目名称:shophp,代码行数:11,代码来源:LoginForm.php

示例13: __construct

 public function __construct(ShipmentService $shipmentService, ShipmentHelper $shipmentHelper, Shipment $shipment = null, User $user = null)
 {
     parent::__construct();
     $this->shipmentService = $shipmentService;
     $this->shipmentHelper = $shipmentHelper;
     $this->shipment = $shipment;
     $this->user = $user;
     $this->createFields();
 }
开发者ID:shophp,项目名称:shophp,代码行数:9,代码来源:ShipmentForm.php

示例14: __construct

 public function __construct()
 {
     parent::__construct();
     $this->addHidden('articleId');
     $this->addText('nick', 'Přezdívka')->addRule(Form::MAX_LENGTH, 'Maximálně 30 znaků', 30)->setRequired('Přezdívka je povinná');
     $this->addTextArea('content', 'Obsah')->setRequired('Obsah je povinný');
     $this->addSubmit('send', 'Potvrdit');
     $this->onSuccess[] = [$this, 'success'];
     return $this;
 }
开发者ID:KennyDaren,项目名称:Nette_Lessons,代码行数:10,代码来源:AddCommentControl.php

示例15: __construct

 public function __construct()
 {
     parent::__construct();
     $renderer = $this->getRenderer();
     $renderer->wrappers['controls']['container'] = '';
     $renderer->wrappers['pair']['container'] = '';
     $renderer->wrappers['label']['container'] = '';
     $renderer->wrappers['control']['container'] = '';
     $renderer->wrappers['control']['.submit'] = 'btn';
 }
开发者ID:caloriscz,项目名称:caloriscms,代码行数:10,代码来源:BootstrapForm.php


注:本文中的Nette\Application\UI\Form::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。