ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
Conditional.php
Go to the documentation of this file.
1 <?php
37 {
38  /* Condition types */
39  const CONDITION_NONE = 'none';
40  const CONDITION_CELLIS = 'cellIs';
41  const CONDITION_CONTAINSTEXT = 'containsText';
42  const CONDITION_EXPRESSION = 'expression';
43 
44  /* Operator types */
45  const OPERATOR_NONE = '';
46  const OPERATOR_BEGINSWITH = 'beginsWith';
47  const OPERATOR_ENDSWITH = 'endsWith';
48  const OPERATOR_EQUAL = 'equal';
49  const OPERATOR_GREATERTHAN = 'greaterThan';
50  const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual';
51  const OPERATOR_LESSTHAN = 'lessThan';
52  const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual';
53  const OPERATOR_NOTEQUAL = 'notEqual';
54  const OPERATOR_CONTAINSTEXT = 'containsText';
55  const OPERATOR_NOTCONTAINS = 'notContains';
56  const OPERATOR_BETWEEN = 'between';
57 
63  private $_conditionType;
64 
70  private $_operatorType;
71 
77  private $_text;
78 
84  private $_condition = array();
85 
91  private $_style;
92 
96  public function __construct()
97  {
98  // Initialise values
99  $this->_conditionType = PHPExcel_Style_Conditional::CONDITION_NONE;
100  $this->_operatorType = PHPExcel_Style_Conditional::OPERATOR_NONE;
101  $this->_text = null;
102  $this->_condition = array();
103  $this->_style = new PHPExcel_Style();
104  }
105 
111  public function getConditionType() {
112  return $this->_conditionType;
113  }
114 
122  $this->_conditionType = $pValue;
123  return $this;
124  }
125 
131  public function getOperatorType() {
132  return $this->_operatorType;
133  }
134 
142  $this->_operatorType = $pValue;
143  return $this;
144  }
145 
151  public function getText() {
152  return $this->_text;
153  }
154 
161  public function setText($value = null) {
162  $this->_text = $value;
163  return $this;
164  }
165 
172  public function getCondition() {
173  if (isset($this->_condition[0])) {
174  return $this->_condition[0];
175  }
176 
177  return '';
178  }
179 
187  public function setCondition($pValue = '') {
188  if (!is_array($pValue))
189  $pValue = array($pValue);
190 
191  return $this->setConditions($pValue);
192  }
193 
199  public function getConditions() {
200  return $this->_condition;
201  }
202 
209  public function setConditions($pValue) {
210  if (!is_array($pValue))
211  $pValue = array($pValue);
212 
213  $this->_condition = $pValue;
214  return $this;
215  }
216 
223  public function addCondition($pValue = '') {
224  $this->_condition[] = $pValue;
225  return $this;
226  }
227 
233  public function getStyle() {
234  return $this->_style;
235  }
236 
244  public function setStyle(PHPExcel_Style $pValue = null) {
245  $this->_style = $pValue;
246  return $this;
247  }
248 
254  public function getHashCode() {
255  return md5(
256  $this->_conditionType
257  . $this->_operatorType
258  . implode(';', $this->_condition)
259  . $this->_style->getHashCode()
260  . __CLASS__
261  );
262  }
263 
267  public function __clone() {
268  $vars = get_object_vars($this);
269  foreach ($vars as $key => $value) {
270  if (is_object($value)) {
271  $this->$key = clone $value;
272  } else {
273  $this->$key = $value;
274  }
275  }
276  }
277 }