ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
CellDataValidation.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
8 {
12  protected static $validationTypeMap = [
13  DataValidation::TYPE_NONE => 0x00,
14  DataValidation::TYPE_WHOLE => 0x01,
15  DataValidation::TYPE_DECIMAL => 0x02,
16  DataValidation::TYPE_LIST => 0x03,
17  DataValidation::TYPE_DATE => 0x04,
18  DataValidation::TYPE_TIME => 0x05,
19  DataValidation::TYPE_TEXTLENGTH => 0x06,
20  DataValidation::TYPE_CUSTOM => 0x07,
21  ];
22 
26  protected static $errorStyleMap = [
27  DataValidation::STYLE_STOP => 0x00,
28  DataValidation::STYLE_WARNING => 0x01,
29  DataValidation::STYLE_INFORMATION => 0x02,
30  ];
31 
35  protected static $operatorMap = [
36  DataValidation::OPERATOR_BETWEEN => 0x00,
37  DataValidation::OPERATOR_NOTBETWEEN => 0x01,
38  DataValidation::OPERATOR_EQUAL => 0x02,
39  DataValidation::OPERATOR_NOTEQUAL => 0x03,
40  DataValidation::OPERATOR_GREATERTHAN => 0x04,
41  DataValidation::OPERATOR_LESSTHAN => 0x05,
42  DataValidation::OPERATOR_GREATERTHANOREQUAL => 0x06,
43  DataValidation::OPERATOR_LESSTHANOREQUAL => 0x07,
44  ];
45 
46  public static function type(DataValidation $dataValidation): int
47  {
48  $validationType = $dataValidation->getType();
49 
50  if (is_string($validationType) && array_key_exists($validationType, self::$validationTypeMap)) {
51  return self::$validationTypeMap[$validationType];
52  }
53 
54  return self::$validationTypeMap[DataValidation::TYPE_NONE];
55  }
56 
57  public static function errorStyle(DataValidation $dataValidation): int
58  {
59  $errorStyle = $dataValidation->getErrorStyle();
60 
61  if (is_string($errorStyle) && array_key_exists($errorStyle, self::$errorStyleMap)) {
62  return self::$errorStyleMap[$errorStyle];
63  }
64 
65  return self::$errorStyleMap[DataValidation::STYLE_STOP];
66  }
67 
68  public static function operator(DataValidation $dataValidation): int
69  {
70  $operator = $dataValidation->getOperator();
71 
72  if (is_string($operator) && array_key_exists($operator, self::$operatorMap)) {
73  return self::$operatorMap[$operator];
74  }
75 
76  return self::$operatorMap[DataValidation::OPERATOR_BETWEEN];
77  }
78 }
static operator(DataValidation $dataValidation)
static errorStyle(DataValidation $dataValidation)