You are here

public function PHPExcel_Worksheet_AutoFilter_Column_Rule::setValue in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php \PHPExcel_Worksheet_AutoFilter_Column_Rule::setValue()

* Set AutoFilter Rule Value * *

Parameters

string|string[] $pValue: * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_AutoFilter_Column_Rule

1 call to PHPExcel_Worksheet_AutoFilter_Column_Rule::setValue()
PHPExcel_Worksheet_AutoFilter_Column_Rule::setRule in vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php
* Set AutoFilter Rule * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php, line 322

Class

PHPExcel_Worksheet_AutoFilter_Column_Rule
PHPExcel_Worksheet_AutoFilter_Column_Rule

Code

public function setValue($pValue = '') {
  if (is_array($pValue)) {
    $grouping = -1;
    foreach ($pValue as $key => $value) {

      //	Validate array entries
      if (!in_array($key, self::$_dateTimeGroups)) {

        //	Remove any invalid entries from the value array
        unset($pValue[$key]);
      }
      else {

        //	Work out what the dateTime grouping will be
        $grouping = max($grouping, array_search($key, self::$_dateTimeGroups));
      }
    }
    if (count($pValue) == 0) {
      throw new PHPExcel_Exception('Invalid rule value for column AutoFilter Rule.');
    }

    //	Set the dateTime grouping that we've anticipated
    $this
      ->setGrouping(self::$_dateTimeGroups[$grouping]);
  }
  $this->_value = $pValue;
  return $this;
}