|
Revision 394, 2.5 kB
(checked in by gerd, 1 year ago)
|
Switched to patI18n
- removed all setLocale / getLocale functions from patForms, elements etc.
- use patI18n::dgettext with textdomain "patForms"
- added patI18n example
- added helper script to setup patI18n
- mended examples accordingly
|
- Property svn:keywords set to
"Id"
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
include_once 'patExampleGen/prepend.php'; |
|---|
| 19 |
$exampleGen->displayHead( 'Example' ); |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
require_once $neededFiles['patForms']; |
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
require_once $neededFiles['patErrorManager']; |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
require_once $neededFiles['patI18n_configure']; |
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
$elementsDefinition = array( |
|---|
| 42 |
'username' => array( |
|---|
| 43 |
'type' => 'String', |
|---|
| 44 |
'attributes' => array( |
|---|
| 45 |
'required' => 'yes', |
|---|
| 46 |
'display' => 'yes', |
|---|
| 47 |
'edit' => 'yes', |
|---|
| 48 |
'label' => 'Nickname', |
|---|
| 49 |
'description' => 'Enter your nickname here.', |
|---|
| 50 |
'maxlength' => '5', |
|---|
| 51 |
'minlength' => '4', |
|---|
| 52 |
'default' => 'The Argh', |
|---|
| 53 |
'title' => 'Username', |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
'switch' => array( |
|---|
| 57 |
'type' => 'Switch', |
|---|
| 58 |
'attributes' => array( |
|---|
| 59 |
'required' => 'yes', |
|---|
| 60 |
'display' => 'yes', |
|---|
| 61 |
'edit' => 'yes', |
|---|
| 62 |
'label' => 'Trigger', |
|---|
| 63 |
'description' => 'Pull the trigger', |
|---|
| 64 |
'title' => 'Trigger', |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
"Er, just some sample output to warm up...<br /><br />"; |
|---|
| 71 |
'E-Mail domain could not be found: <b>' . dgettext( 'patForms', 'E-Mail domain could not be found.' ) . "</b><br />\n"; |
|---|
| 72 |
'A choice is required, please select an option from the list: <b>' . dgettext( 'patForms', 'A choice is required, please select an option from the list.' ) . "</b><br />\n"; |
|---|
| 73 |
"<br /><br />"; |
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
$form =& patForms::createForm( $elementsDefinition ); |
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
$form->setSubmitted( true ); |
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
$form->validateForm(); |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
displayErrors( $form ); |
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
$exampleGen->displayFooter(); |
|---|
| 91 |
?> |
|---|
| 92 |
|
|---|