|
Revision 251, 1.9 kB
(checked in by argh, 3 years ago)
|
Added french translations
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
class patForms_Rule_Retype extends patForms_Rule |
|---|
| 24 |
{ |
|---|
| 25 |
|
|---|
| 26 |
* define error codes and messages for the rule |
|---|
| 27 |
* |
|---|
| 28 |
* @access private |
|---|
| 29 |
* @var array $validatorErrorCodes |
|---|
| 30 |
* @todo translate error messages |
|---|
| 31 |
*/ |
|---|
| 32 |
var $validatorErrorCodes = array( |
|---|
| 33 |
"C" => array( |
|---|
| 34 |
1 => "The fields '[FIELD1_LABEL]' and '[FIELD2_LABEL]' do not match.", |
|---|
| 35 |
), |
|---|
| 36 |
"de" => array( |
|---|
| 37 |
1 => "Ihre Angaben in den Feldern '[FIELD1_LABEL]' und '[FIELD2_LABEL]' stimmen nicht überein.", |
|---|
| 38 |
), |
|---|
| 39 |
"fr" => array( |
|---|
| 40 |
1 => "Les champs '[FIELD1_LABEL]' et '[FIELD2_LABEL]' ne correspondent pas.", |
|---|
| 41 |
) |
|---|
| 42 |
); |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
* fields that have to match |
|---|
| 46 |
* @access private |
|---|
| 47 |
* @var array |
|---|
| 48 |
*/ |
|---|
| 49 |
var $_fieldNames; |
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
* set the names of the fields that have to match |
|---|
| 53 |
* |
|---|
| 54 |
* @access public |
|---|
| 55 |
* @param string field 1 |
|---|
| 56 |
* @param string field 2 |
|---|
| 57 |
*/ |
|---|
| 58 |
function setFieldnames( $field1, $field2 ) |
|---|
| 59 |
{ |
|---|
| 60 |
$this->_fieldNames = array( $field1, $field2 ); |
|---|
| 61 |
} |
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
* method called by patForms or any patForms_Element to validate the |
|---|
| 65 |
* element or the form. |
|---|
| 66 |
* |
|---|
| 67 |
* @access public |
|---|
| 68 |
* @param object patForms form object |
|---|
| 69 |
*/ |
|---|
| 70 |
function applyRule( &$form, $type = PATFORMS_RULE_BEFORE_VALIDATION ) |
|---|
| 71 |
{ |
|---|
| 72 |
$el1 = &$form->getElement( $this->_fieldNames[0] ); |
|---|
| 73 |
$el2 = &$form->getElement( $this->_fieldNames[1] ); |
|---|
| 74 |
|
|---|
| 75 |
if( $el1->getValue() == $el2->getValue() ) |
|---|
| 76 |
{ |
|---|
| 77 |
return true; |
|---|
| 78 |
} |
|---|
| 79 |
|
|---|
| 80 |
$vars = array( |
|---|
| 81 |
'field1_label' => $el1->getAttribute( 'label' ), |
|---|
| 82 |
'field2_label' => $el2->getAttribute( 'label' ) |
|---|
| 83 |
); |
|---|
| 84 |
|
|---|
| 85 |
$this->addValidationError( 1, $vars ); |
|---|
| 86 |
return false; |
|---|
| 87 |
} |
|---|
| 88 |
} |
|---|
| 89 |
?> |
|---|