本文整理汇总了PHP中Nette\Application\UI\Form::addDatePicker方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addDatePicker方法的具体用法?PHP Form::addDatePicker怎么用?PHP Form::addDatePicker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::addDatePicker方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createComponentDatePickerForm
/**
* DatePickerForm factory.
*
* @author Jan Tvrdík
* @return Form
*/
protected function createComponentDatePickerForm()
{
$form = new Form();
$form->addDatePicker('datePicker1');
$form->addDatePicker('datePicker2')
->addRule(Form::FILLED, 'Date is required')
->addRule(Form::VALID, 'Entered date is not valid!');
$form->addDatePicker('datePicker3')
->addRule(Form::VALID, 'Entered date is not valid!')
->addCondition(Form::FILLED)
->addRule(Form::RANGE, 'Entered date is not within allowed range.', array(new DateTime('-14 days 00:00'), new DateTime('+14 days 00:00')));
$form->addSubmit('submit');
$form->onSuccess[] = callback($this, 'datePickerFormSubmitted');
return $form;
}
示例2: __construct
public function __construct(DbTable\Oznam $oznam, DbTable\Registracia $registracia, DbTable\Ikonka $ikonka, User $user)
{
$this->oznam = $oznam;
$this->ikonka = $ikonka;
$this->urovneReg = $registracia->hladaj_urovne(0, $user->isLoggedIn() ? $user->getIdentity()->id_registracia : 0)->fetchPairs('id', 'nazov');
}
/**
* Formular pre editaciu oznamu
* @param int $oznam_ucast Povolenie potvrdenia ucasti
* @param boolean $send_e_mail_news Povolenie zasielania info e-mailov
* @param boolean $oznam_title_image_en Povolenie titulneho obrazka
* @param string $nazov_stranky Nazov stranky
* @return Form
*/
public function create($oznam_ucast, $send_e_mail_news, $oznam_title_image_en, $nazov_stranky)
{
$form = new Form();
$form->addProtection();
$form->addHidden("id");
$form->addHidden("id_user_profiles");
$form->addHidden("datum_zadania");
$form->addDatePicker('datum_platnosti', 'Dátum platnosti')->addRule(Form::FILLED, 'Dátum platnosti musí byť zadaný!');
$form->addText('nazov', 'Nadpis:', 50, 80)->addRule(Form::MIN_LENGTH, 'Nadpis musí mať spoň %d znakov!', 3)->setRequired('Názov musí byť zadaný!');
$form->addSelect('id_registracia', 'Povolené prezeranie pre min. úroveň:', $this->urovneReg);
if ($oznam_ucast) {
$form->addCheckbox('potvrdenie', ' Potvrdenie účasti');
} else {
$form->addHidden('potvrdenie');
}
if ($send_e_mail_news) {
$form->addCheckbox('posli_news', ' Posielatie NEWS o tejto aktualite');
} else {
$form->addHidden("posli_news", FALSE);
}
if (!$oznam_title_image_en) {
//$this->oznam_title_image_en
示例3: createComponentDateForm
/**
* @return \Nette\Forms\Form
*/
public function createComponentDateForm()
{
$form = new Form();
$form->getElementPrototype()->style = 'margin: 0;';
$form->addDatePicker('paginatorDate')->addRule(Form::VALID, 'Entered date is not valid!')->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Entered date is not within allowed range.', array($this->getPaginator()->getOldestDate(), $this->getPaginator()->getNewestDate()));
$form['paginatorDate']->setDefaultValue($this->getPaginator()->getDate());
$form->onSuccess[] = callback($this, 'formSubmitted');
return $form;
}
示例4: createComponentVydani
protected function createComponentVydani()
{
$form = new Form();
$form->addHidden("id");
$form->addDatePicker("datum_vydani", "Datum vydání")->setDefaultValue(date("d.m.Y"));
$form->addText("cas_vydani", "Čas vydání")->addRule(Form::PATTERN, "Zadejte prosím platný čas vydání.", "^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]\$")->setDefaultValue(date("H:i"));
$form->addSubmit("save", "Uložit");
$form->onSuccess[] = $this->publishClanek;
return $form;
}
示例5: createComponentPolozkaForm
protected function createComponentPolozkaForm($name)
{
$identifikatory = array('1' => 'prijem', '-1' => 'vydaj');
$typTransakcie = $this->ciselniktyptransakcie->findAll()->fetchPairs('id', 'nazov');
$form = new Form();
$form->addRadioList('identifikator', 'transakcia', $identifikatory)->setRequired();
$form->addText('popis', 'Popis')->setRequired();
$form->addDatePicker('datum', 'Datum:', 10, 10)->setRequired();
$form->addText('suma', 'Suma')->addRule(\Nette\Application\UI\Form::FLOAT, 'Prosim vlozte cislo')->setRequired();
$form->addSelect('idCiselnikTypTransakcie', 'Typ transakcie', $typTransakcie)->setPrompt('- Zvoľte typ transakcie -')->setRequired();
$form->addSubmit('save', 'Save')->setAttribute('class', 'default')->onClick[] = $this->vlozitTransakciuFormSucceeded;
$form->addSubmit('cancel', 'Cancel')->setValidationScope(array())->onClick[] = $this->formCancelled;
return $form;
}
示例6: createComponentOrderDateForm
public function createComponentOrderDateForm()
{
$orderDateService = $this->context->createOrderDate();
$this->orderDate = $orderDateService->getOrderDates()->where('active', 1)->order('orderdate')->limit(1)->fetch();
if ($this->orderDate == false) {
$id = NULL;
$orderdate = NULL;
} else {
$id = $this->orderDate->id;
$orderdate = $this->orderDate->orderdate;
}
$form = new Form();
$form->addHidden('id')->setDefaultValue($id);
$form->addDatePicker('orderdate', 'Datum uzavírky:')->addRule(Form::FILLED, 'Datum musí být vyplněno!')->addRule(Form::VALID, 'Zadané datum není platné!')->setDefaultValue($orderdate);
$form->addSubmit('send', 'Uložit datum uzavírky');
$form->onSuccess[] = callback($this, 'orderDateFormSubmitted');
return $form;
}
示例7: createComponentUlForm
protected function createComponentUlForm($name)
{
//$identifikatory = array('1'=>'prijem','-1'=>'vydaj');
$typUla = $this->ciselnikTypUla->findAll()->fetchPairs('id', 'nazov');
$vcelnica = $this->vcelnica->findAll()->fetchPairs('id', 'nazov');
$form = new Form();
$form->addText('nazov', 'Nazov ula');
$form->addSelect('idCiselnikTypUla', 'Typ ula', $typUla)->setPrompt('- Zvoľte typ ula -')->setRequired();
$form->addSelect('idVcelnica', 'Vcelnica', $vcelnica)->setPrompt('- Zvoľte vcelnicu -')->setRequired();
$form->addText('matkaRokLiahnutia', 'Matka rok vyliahnutia');
$form->addText('matkaLinia', 'Matka linia');
$form->addText('matkaOplodnenost', 'Matka oplodnenost');
$form->addText('matkaFarba', 'Matka Farba');
$form->addDatePicker('matkaDatumVlozenia', 'Matka datum vlozenia do vcelstva', 10, 10);
$form->addSubmit('save', 'Save')->setAttribute('class', 'default')->onClick[] = $this->vlozitTransakciuFormSucceeded;
$form->addSubmit('cancel', 'Cancel')->setValidationScope(array())->onClick[] = $this->formCancelled;
return $form;
}
示例8: create
public function create($defaults, $values)
{
$form = new Form();
$form->addText('firstName', 'Jméno: ')->setRequired();
$form->addText('surName', 'Příjmení: ')->setRequired();
$form->addText('mail', 'Email: ')->addRule(Form::EMAIL)->setRequired();
$form->addText('telNumber', 'Tel: ')->setRequired();
$form->addSelect('carMakes', 'Značka auta:', $this->carsModel->getCarsMakes())->setRequired();
$form->addText('carModel', 'Model:')->setRequired();
$form->addText('spz', 'Spz: ')->setRequired();
$form->addDatePicker('date', 'Datum:');
$form->addSelect('type', 'Typ služby:', $this->reservationManager->getReservationTypesForSelect());
$form->addSelect('time', 'Čas:', $values);
$form->addTextArea('additionalInfo', 'Doplňující informace:');
$form->addSubmit('send', 'Odeslat');
if ($defaults != NULL) {
$form->setDefaults($defaults);
}
$form->onSuccess[] = array($this, 'formSucceeded');
return $form;
}
示例9: create
/**
* @return Form
*/
public function create()
{
$boolean = array(0 => 'ne', 1 => 'ano');
$form = new Form();
$form->addHidden('id');
$form->addDatePicker('date', 'datum: ')->setAttribute('class', 'datepicker');
$form->addText('name', 'nadpis: ', 100)->addRule(Form::FILLED, 'Zadejte prosím nadpis.');
$form->addTextArea('description', 'krátký popis: ', 105);
$form->addSelect('active', 'zobrazit: ', $boolean)->setDefaultValue(1);
$form->addSubmit('submit', 'uložit');
$form->addProtection('Vypršel časový limit, odešlete formulář znovu');
//bootstrap vzhled
$renderer = $form->getRenderer();
$renderer->wrappers['controls']['container'] = NULL;
$renderer->wrappers['pair']['container'] = 'div class=form-group';
$renderer->wrappers['pair']['.error'] = 'has-error';
$renderer->wrappers['control']['container'] = '';
$renderer->wrappers['label']['container'] = 'div class=custom-label';
$renderer->wrappers['control']['description'] = 'span class=help-block';
$renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
$form->getElementPrototype()->class('form-horizontal col-sm-12');
return $form;
}
示例10: createComponentEditItemForm
/** form for editing item
*
* @return \Nette\Application\UI\Form
*/
protected function createComponentEditItemForm()
{
$form = new Form();
//$userPairs = $this->userRepository->findAll()->fetchPairs('id', 'name');
if ($this->pageConfig) {
/** for each item from configuration for this page create form item
*
*/
foreach ($this->pageConfig["form"] as $item => $params) {
$formItem = NULL;
switch ($params["type"]) {
case "calendar":
//$formItem = $form->addDate($item, $params['text'], Vodacek\Forms\Controls\DateInput::TYPE_DATE);
//$formItem = $form->addText($item, $params['text'], 40, 100);
$formItem = $form->addDatePicker($item, $params['text']);
/** check for minimal date */
$min = new DateTime('-100 years 00:00');
$max = new DateTime('+100 years 00:00');
if (isset($params["min"])) {
switch ($params["min"]) {
case 'today':
$min = new DateTime('-0 days 00:00');
break;
default:
$min = new DateTime($params["min"] . ' 00:00');
break;
}
}
/** check for maximal date */
if (isset($params["max"])) {
switch ($params["max"]) {
case 'today':
$max = new DateTime('+0 days 00:00');
break;
default:
$max = new DateTime($params["max"] . ' 00:00');
break;
}
}
$formItem->setAttribute('min', $min->format('Y-m-d'))->setAttribute('max', $max->format('Y-m-d'));
break;
case "shortText":
$formItem = $form->addText($item, $params['text'], 40, 100);
break;
case "longText":
$formItem = $form->addTextArea($item, $params['text'], 40, 5);
break;
case "location":
$formItem = $form->addTextArea($item, $params['text'], 40, 3);
break;
case "select":
$formItem = $form->addSelect($item, $params['text'])->setItems($params["options"])->setPrompt('Vyberte');
/** set default value for select if any */
if (isset($params["defaultValue"])) {
$formItem->setDefaultValue($params["defaultValue"]);
}
break;
}
/** if it is mandatory set rule */
if (isset($params["mandatory"]) && $params["mandatory"]) {
$formItem->addRule(Form::FILLED, 'Je nutné vyplnit "' . $params['text'] . '".');
}
/** if it has a hint, show it */
if (isset($params["hint"])) {
$formItem->setOption('description', $params["hint"]);
}
/** set actual value if any */
if (isset($this->editingItem->{$item})) {
if ($params["type"] == 'calendar') {
//$formItem->setDefaultValue();
if (gettype($this->editingItem->{$item}) == 'object') {
$this->editingItem->{$item} = $this->editingItem->{$item}->date;
}
}
$formItem->setDefaultValue($this->unescapeTags($this->editingItem->{$item}));
}
}
}
if (!empty($this->pageConfig['settings']['sendEmail'])) {
$text = $this->adminEdit ? 'Email' : 'Váš email';
$form->addText('email', $text, 40, 100)->setDefaultValue($this->editingRow->authorEmail)->setDisabled(TRUE);
}
$form->addSelect('delete', 'Chcete tento záznam smazat?')->setItems(array('Ne', 'ANO'));
$form->addAntispam('kontrolni', 'Následující políčko vymažte!', 'Jsi spamovací robot?!');
$form->addSubmit('save', 'Uložit');
$renderer = $form->getRenderer();
$renderer->wrappers['controls']['container'] = 'div';
$renderer->wrappers['pair']['container'] = 'dl';
$renderer->wrappers['label']['container'] = 'dt';
$renderer->wrappers['control']['container'] = 'dd';
$form->getElementPrototype()->class('ajax');
$form->onSuccess[] = $this->editItemFormSubmitted;
return $form;
}
示例11: createComponentAdvancedSearchForm
public function createComponentAdvancedSearchForm()
{
$form = new Form();
$form->addAntispam();
$form->addText('query', 'URL:*')->addRule(Form::FILLED, 'Zadejte prosím platné URL.');
$form->addCheckbox('star');
$form->addDatePicker('dateFrom', 'Od:', 10, 10)->setAttribute('class', 'text');
$form->addDatePicker('dateTill', 'Do:', 10, 10)->setAttribute('class', 'text');
$form->addSubmit('submit', 'Vyhledat');
$form->onSuccess[] = callback($this, 'processAdvancedSearchForm');
return $form;
}
示例12: createComponentNewItemForm
/** form for adding new item
*
* @return \Nette\Application\UI\Form
*/
protected function createComponentNewItemForm()
{
$form = new Form();
//$userPairs = $this->userRepository->findAll()->fetchPairs('id', 'name');
if ($this->pageConfig) {
/** for each item from configuration for this page create form item
*
*/
foreach ($this->pageConfig["form"] as $item => $params) {
$formItem = NULL;
switch ($params["type"]) {
case "calendar":
//$formItem = $form->addDate($item, $params['text'], Vodacek\Forms\Controls\DateInput::TYPE_DATE);
//$formItem = $form->addText($item, $params['text'], 40, 100);
$formItem = $form->addDatePicker($item, $params['text']);
//$formItem->addRule(Form::VALID, 'Zadané datum není platné!');
/** check for minimal date */
$min = new DateTime('-100 years 00:00');
$max = new DateTime('+100 years 00:00');
if (isset($params["min"])) {
switch ($params["min"]) {
case 'today':
$min = new DateTime('-0 days 00:00');
break;
default:
$min = new DateTime($params["min"] . ' 00:00');
break;
}
}
/** check for maximal date */
if (isset($params["max"])) {
switch ($params["max"]) {
case 'today':
$max = new DateTime('+0 days 00:00');
break;
default:
$max = new DateTime($params["max"] . ' 00:00');
break;
}
}
$formItem->setAttribute('min', $min->format('Y-m-d'))->setAttribute('max', $max->format('Y-m-d'));
break;
case "shortText":
$formItem = $form->addText($item, $params['text'], 40, 100);
break;
case "longText":
$formItem = $form->addTextArea($item, $params['text'], 40, 5);
break;
case "location":
$formItem = $form->addTextArea($item, $params['text'], 40, 3);
break;
case "select":
$formItem = $form->addSelect($item, $params['text'])->setItems($params["options"])->setPrompt('Vyberte');
/** set default value for select if any */
if (isset($params["defaultValue"])) {
$formItem->setDefaultValue($params["defaultValue"]);
}
break;
}
/** if it is mandatory set rule */
if (isset($params["mandatory"]) && $params["mandatory"]) {
$formItem->addRule(Form::FILLED, 'Je nutné vyplnit "' . $params['text'] . '".');
}
/** if it has a hint, show it */
if (isset($params["hint"])) {
$formItem->setOption('description', $params["hint"]);
if (gettype($params["hint"]) == 'string') {
$formItem->setAttribute('title', $params["hint"])->setOption('description', $params["hint"]);
}
}
/** add placeholder, if any */
if (isset($params["placeholder"])) {
$formItem->setAttribute('placeholder', $params["placeholder"]);
}
/** set default value if any */
if (isset($params["defaultValue"])) {
$formItem->setDefaultValue($params["defaultValue"]);
}
}
}
if (!empty($this->pageConfig['settings']['sendEmail'])) {
$hintText = 'Tento email nebude zveřejněn; bude vám na něj zaslán odkaz na stránku, na které můžete zde zadané hodnoty zpětně upravit.';
$session = $this->getSession('agility');
$defaultVal = '@';
//$session->email == NULL ? '@' : $session->email;
$form->addText('email', 'Váš email:', 40, 100)->setDefaultValue($defaultVal)->setType('e-mail')->addRule(Form::FILLED, 'Je nutné zadat email.')->addRule(Form::EMAIL, 'Nezadali jste platnou emailovou adresu.')->setAttribute('title', $hintText)->setOption('description', $hintText);
}
$form->addAntispam('kontrolni');
$form->addSubmit('create', 'Vytvořit');
$renderer = $form->getRenderer();
$renderer->wrappers['controls']['container'] = 'div';
$renderer->wrappers['pair']['container'] = 'dl';
$renderer->wrappers['label']['container'] = 'dt';
$renderer->wrappers['control']['container'] = 'dd';
$form->getElementPrototype()->class('ajax');
$form->onSuccess[] = $this->newItemFormSubmitted;
//.........这里部分代码省略.........
示例13: createComponentOrganizationForm
/**
* Form for organization member editation
*
* @Action("edit", "create")
* @Privilege("edit", "create")
*/
protected function createComponentOrganizationForm()
{
$form = new Form();
$form->addProtection('Vypršel časový limit, odešlete formulář znovu');
$users = $this->users->getUnconnectedUsers()->fetchPairs('id', 'username');
$form->addSelect('user_id', 'Uživatel:', $users)->setPrompt('Propojit s uživatelem');
$form->addText('nickname', 'Přezdívka:')->setRequired('Musíte zadat přezdívku');
$form->addText('title', 'Titul:')->setOption('description', \Nette\Utils\Html::el('td')->setText('Titul před jménem'));
$form->addText('name', 'Křestní jméno:')->setRequired('Musíte zadat jméno');
$form->addText('surname', 'Příjmení:')->setRequired('Musíte zadat příjmení');
$form->addUpload('file', 'Profilová fotka:')->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'Foto musí být JPEG, PNG nebo GIF.');
$form->addText('group', 'Pozice:');
$form->addSelect('stripe', 'Frčky:', ['vedouci.gif' => 'Vedoucí oddílu', 'zastupce.gif' => 'Zástupce vedoucího', 'radce_oddilu.gif' => 'Rádce oddílové družiny', 'rover.gif' => 'Rover', 'radce.gif' => 'Rádce', 'podradce.gif' => 'Podrádce'])->setPrompt('--Bez frček--')->setOption('description', \Nette\Utils\Html::el('td')->setText('Možnosti: Vedoucí oddílu, Zástupce vedoucího oddílu, Rover, Mlok, Tučňák, Nováček, Oldskaut, Rádce, Podrádce. Lze přidat více jak jednu možnost.'));
$form->addDatePicker('entered', 'Vstup do oddílu:')->setRequired('Musíte vyplnit vstup do oddílu');
$form->addTextarea('note', 'Osobní poznámka:')->setAttribute('rows', 4);
$form->addSubmit('send', 'Přidat/Upravit');
$form->onSuccess[] = $this->organizationFormSucceded;
return $form;
}
示例14: __construct
/**
* @param User $user
* @param DbTable\Registracia $registracia
* @param DbTable\Lang $lang
* @param DbTable\Hlavicka $hlavicka
* @param DbTable\Dlzka_novinky $dlzka_novinky
*/
public function __construct(User $user, DbTable\Registracia $registracia, DbTable\Lang $lang, DbTable\Hlavicka $hlavicka, DbTable\Dlzka_novinky $dlzka_novinky)
{
$this->user = $user;
$this->urovneReg = $registracia->urovneReg($this->user->isLoggedIn() ? $this->user->getIdentity()->id_registracia : 0);
$this->lang = $lang;
$this->hlavickaForm = $hlavicka->hlavickaForm();
$this->dlzkaNovinkyForm = $dlzka_novinky->dlzkaNovinkyForm();
}
/**
* Edit hlavne menu form component factory.
* @param int $uroven Uroven polozky v menu
* @param string $uloz Text tlacitka uloz
* @param boolean $vlastnik Vlastnictvo editovanej polozky
* @param boolean $edit Pre skrytie poloziek pri editacii
* @param boolean $opravnenia Opravnenia pre nevlastnikov
* @return Form
*/
public function form($uroven, $uloz, $vlastnik, $edit, $opravnenia)
{
$form = new Form();
$form->addProtection();
$form->addGroup();
$form->addHidden("id");
$form->addHidden("id_druh");
$form->addHidden("id_user_profiles");
$form->addHidden("spec_nazov");
$form->addHidden("langtxt");
$form->addHidden("id_hlavne_menu_cast");
$form->addHidden("uroven");
$form->addHidden("id_nadradenej");
$form->addHidden("modified");
if (!$edit) {
$form->addSelect('id_registracia', 'Povolené prezeranie pre min. úroveň:', $this->urovneReg);
}
if ($this->user->isInRole("admin")) {
$form->addText('nazov_ul_sub', 'Názov alternatívneho vzhľadu:', 20, 20);
$form->addText('ikonka', 'Názov class ikonky pre FontAwesome:', 90, 30);
if ($uroven) {
$form->addHidden('id_hlavicka');
} else {
$form->addSelect('id_hlavicka', 'Druh priradenej hlavičky:', $this->hlavickaForm)->addRule(Form::FILLED, 'Je nutné vybrať hlavičku.');
}
// $form->addCheckbox('zvyrazni', ' Zvýraznenie položky pri pridaní obsahu');
}
示例15: __construct
class ZmenDatumPlatnostiFormFactory
{
/** @var DbTable\Hlavne_menu */
private $hlavne_menu;
/**
* @param DbTable\Hlavne_menu $hlavne_menu */
public function __construct(DbTable\Hlavne_menu $hlavne_menu)
{
$this->hlavne_menu = $hlavne_menu;
}
/**
* Formular pre zmenu datumu platnosti polozky.
* @param int $id Id polozky v hlavnom menu
* @param Nette\Utils\DateTime $datum_platnosti Datum platnosti polozky
* @return Nette\Application\UI\Form */