當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。