Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
FilterSetting.inc.php
1 <?php
2 
16 import('lib.pkp.classes.form.validation.FormValidator');
17 
20  var $_name;
21 
24 
26  var $_validationMessage;
27 
29  var $_required;
30 
32  var $_isLocalized;
33 
43  function FilterSetting($name, $displayName, $validationMessage, $required = FORM_VALIDATOR_REQUIRED_VALUE, $isLocalized = false) {
44  $this->setName($name);
45  $this->setDisplayName($displayName);
46  $this->setValidationMessage($validationMessage);
47  $this->setRequired($required);
48  $this->setIsLocalized($isLocalized);
49  }
50 
51  //
52  // Setters and Getters
53  //
58  function setName($name) {
59  $this->_name = $name;
60  }
61 
66  function getName() {
67  return $this->_name;
68  }
69 
74  function setDisplayName($displayName) {
75  $this->_displayName = $displayName;
76  }
77 
82  function getDisplayName() {
83  return $this->_displayName;
84  }
85 
90  function setValidationMessage($validationMessage) {
91  $this->_validationMessage = $validationMessage;
92  }
93 
98  function getValidationMessage() {
99  return $this->_validationMessage;
100  }
101 
106  function setRequired($required) {
107  $this->_required = $required;
108  }
109 
114  function getRequired() {
115  return $this->_required;
116  }
117 
122  function setIsLocalized($isLocalized) {
123  $this->_isLocalized = $isLocalized;
124  }
125 
130  function getIsLocalized() {
131  return $this->_isLocalized;
132  }
133 
134 
135  //
136  // Protected Template Methods
137  //
142  function &getCheck(&$form) {
143  // A validator is only required if this setting is mandatory.
144  if ($this->getRequired() == FORM_VALIDATOR_OPTIONAL_VALUE) {
145  $nullVar = null;
146  return $nullVar;
147  }
148 
149  // Instantiate a simple form validator.
150  $check = new FormValidator($form, $this->getName(), $this->getRequired(), $this->getValidationMessage());
151  return $check;
152  }
153 }
154 ?>
Class that describes a configurable filter setting.
setRequired($required)
setDisplayName($displayName)
FilterSetting($name, $displayName, $validationMessage, $required=FORM_VALIDATOR_REQUIRED_VALUE, $isLocalized=false)
setValidationMessage($validationMessage)
Class to represent a form validation check.
setIsLocalized($isLocalized)