ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
DataValidation.php
Go to the documentation of this file.
1 <?php
37 {
38  /* Data validation types */
39  const TYPE_NONE = 'none';
40  const TYPE_CUSTOM = 'custom';
41  const TYPE_DATE = 'date';
42  const TYPE_DECIMAL = 'decimal';
43  const TYPE_LIST = 'list';
44  const TYPE_TEXTLENGTH = 'textLength';
45  const TYPE_TIME = 'time';
46  const TYPE_WHOLE = 'whole';
47 
48  /* Data validation error styles */
49  const STYLE_STOP = 'stop';
50  const STYLE_WARNING = 'warning';
51  const STYLE_INFORMATION = 'information';
52 
53  /* Data validation operators */
54  const OPERATOR_BETWEEN = 'between';
55  const OPERATOR_EQUAL = 'equal';
56  const OPERATOR_GREATERTHAN = 'greaterThan';
57  const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual';
58  const OPERATOR_LESSTHAN = 'lessThan';
59  const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual';
60  const OPERATOR_NOTBETWEEN = 'notBetween';
61  const OPERATOR_NOTEQUAL = 'notEqual';
62 
68  private $_formula1;
69 
75  private $_formula2;
76 
83 
90 
96  private $_operator;
97 
103  private $_allowBlank;
104 
110  private $_showDropDown;
111 
118 
125 
131  private $_errorTitle;
132 
138  private $_error;
139 
145  private $_promptTitle;
146 
152  private $_prompt;
153 
159  public function __construct()
160  {
161  // Initialise member variables
162  $this->_formula1 = '';
163  $this->_formula2 = '';
165  $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
166  $this->_operator = '';
167  $this->_allowBlank = false;
168  $this->_showDropDown = false;
169  $this->_showInputMessage = false;
170  $this->_showErrorMessage = false;
171  $this->_errorTitle = '';
172  $this->_error = '';
173  $this->_promptTitle = '';
174  $this->_prompt = '';
175  }
176 
182  public function getFormula1() {
183  return $this->_formula1;
184  }
185 
192  public function setFormula1($value = '') {
193  $this->_formula1 = $value;
194  return $this;
195  }
196 
202  public function getFormula2() {
203  return $this->_formula2;
204  }
205 
212  public function setFormula2($value = '') {
213  $this->_formula2 = $value;
214  return $this;
215  }
216 
222  public function getType() {
223  return $this->_type;
224  }
225 
233  $this->_type = $value;
234  return $this;
235  }
236 
242  public function getErrorStyle() {
243  return $this->_errorStyle;
244  }
245 
253  $this->_errorStyle = $value;
254  return $this;
255  }
256 
262  public function getOperator() {
263  return $this->_operator;
264  }
265 
272  public function setOperator($value = '') {
273  $this->_operator = $value;
274  return $this;
275  }
276 
282  public function getAllowBlank() {
283  return $this->_allowBlank;
284  }
285 
292  public function setAllowBlank($value = false) {
293  $this->_allowBlank = $value;
294  return $this;
295  }
296 
302  public function getShowDropDown() {
303  return $this->_showDropDown;
304  }
305 
312  public function setShowDropDown($value = false) {
313  $this->_showDropDown = $value;
314  return $this;
315  }
316 
322  public function getShowInputMessage() {
324  }
325 
332  public function setShowInputMessage($value = false) {
333  $this->_showInputMessage = $value;
334  return $this;
335  }
336 
342  public function getShowErrorMessage() {
344  }
345 
352  public function setShowErrorMessage($value = false) {
353  $this->_showErrorMessage = $value;
354  return $this;
355  }
356 
362  public function getErrorTitle() {
363  return $this->_errorTitle;
364  }
365 
372  public function setErrorTitle($value = '') {
373  $this->_errorTitle = $value;
374  return $this;
375  }
376 
382  public function getError() {
383  return $this->_error;
384  }
385 
392  public function setError($value = '') {
393  $this->_error = $value;
394  return $this;
395  }
396 
402  public function getPromptTitle() {
403  return $this->_promptTitle;
404  }
405 
412  public function setPromptTitle($value = '') {
413  $this->_promptTitle = $value;
414  return $this;
415  }
416 
422  public function getPrompt() {
423  return $this->_prompt;
424  }
425 
432  public function setPrompt($value = '') {
433  $this->_prompt = $value;
434  return $this;
435  }
436 
442  public function getHashCode() {
443  return md5(
444  $this->_formula1
445  . $this->_formula2
447  . $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP
448  . $this->_operator
449  . ($this->_allowBlank ? 't' : 'f')
450  . ($this->_showDropDown ? 't' : 'f')
451  . ($this->_showInputMessage ? 't' : 'f')
452  . ($this->_showErrorMessage ? 't' : 'f')
453  . $this->_errorTitle
454  . $this->_error
455  . $this->_promptTitle
456  . $this->_prompt
457  . __CLASS__
458  );
459  }
460 
464  public function __clone() {
465  $vars = get_object_vars($this);
466  foreach ($vars as $key => $value) {
467  if (is_object($value)) {
468  $this->$key = clone $value;
469  } else {
470  $this->$key = $value;
471  }
472  }
473  }
474 }