ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
Conditional.php
Go to the documentation of this file.
1 <?php
30 if (!defined('PHPEXCEL_ROOT')) {
34  define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
35 }
36 
38 require_once PHPEXCEL_ROOT . 'PHPExcel/Style.php';
39 
41 require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
42 
43 
52 {
53  /* Condition types */
54  const CONDITION_NONE = 'none';
55  const CONDITION_CELLIS = 'cellIs';
56  const CONDITION_CONTAINSTEXT = 'containsText';
57  const CONDITION_EXPRESSION = 'expression';
58 
59  /* Operator types */
60  const OPERATOR_NONE = '';
61  const OPERATOR_BEGINSWITH = 'beginsWith';
62  const OPERATOR_ENDSWITH = 'endsWith';
63  const OPERATOR_EQUAL = 'equal';
64  const OPERATOR_GREATERTHAN = 'greaterThan';
65  const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual';
66  const OPERATOR_LESSTHAN = 'lessThan';
67  const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual';
68  const OPERATOR_NOTEQUAL = 'notEqual';
69  const OPERATOR_CONTAINSTEXT = 'containsText';
70  const OPERATOR_NOTCONTAINS = 'notContains';
71  const OPERATOR_BETWEEN = 'between';
72 
78  private $_conditionType;
79 
85  private $_operatorType;
86 
92  private $_text;
93 
99  private $_condition = array();
100 
106  private $_style;
107 
111  public function __construct()
112  {
113  // Initialise values
114  $this->_conditionType = PHPExcel_Style_Conditional::CONDITION_NONE;
115  $this->_operatorType = PHPExcel_Style_Conditional::OPERATOR_NONE;
116  $this->_text = null;
117  $this->_condition = array();
118  $this->_style = new PHPExcel_Style();
119  }
120 
126  public function getConditionType() {
127  return $this->_conditionType;
128  }
129 
137  $this->_conditionType = $pValue;
138  return $this;
139  }
140 
146  public function getOperatorType() {
147  return $this->_operatorType;
148  }
149 
157  $this->_operatorType = $pValue;
158  return $this;
159  }
160 
166  public function getText() {
167  return $this->_text;
168  }
169 
176  public function setText($value = null) {
177  $this->_text = $value;
178  return $this;
179  }
180 
187  public function getCondition() {
188  if (isset($this->_condition[0])) {
189  return $this->_condition[0];
190  }
191 
192  return '';
193  }
194 
202  public function setCondition($pValue = '') {
203  if (!is_array($pValue))
204  $pValue = array($pValue);
205 
206  return $this->setConditions($pValue);
207  }
208 
214  public function getConditions() {
215  return $this->_condition;
216  }
217 
224  public function setConditions($pValue) {
225  if (!is_array($pValue))
226  $pValue = array($pValue);
227 
228  $this->_condition = $pValue;
229  return $this;
230  }
231 
238  public function addCondition($pValue = '') {
239  $this->_condition[] = $pValue;
240  return $this;
241  }
242 
248  public function getStyle() {
249  return $this->_style;
250  }
251 
259  public function setStyle(PHPExcel_Style $pValue = null) {
260  $this->_style = $pValue;
261  return $this;
262  }
263 
269  public function getHashCode() {
270  return md5(
271  $this->_conditionType
272  . $this->_operatorType
273  . implode(';', $this->_condition)
274  . $this->_style->getHashCode()
275  . __CLASS__
276  );
277  }
278 
284  private $_hashIndex;
285 
294  public function getHashIndex() {
295  return $this->_hashIndex;
296  }
297 
306  public function setHashIndex($value) {
307  $this->_hashIndex = $value;
308  }
309 
313  public function __clone() {
314  $vars = get_object_vars($this);
315  foreach ($vars as $key => $value) {
316  if (is_object($value)) {
317  $this->$key = clone $value;
318  } else {
319  $this->$key = $value;
320  }
321  }
322  }
323 }