ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Calculation_Database Class Reference
+ Collaboration diagram for PHPExcel_Calculation_Database:

Static Public Member Functions

static DAVERAGE ($database, $field, $criteria)
 DAVERAGE.
static DCOUNT ($database, $field, $criteria)
 DCOUNT.
static DCOUNTA ($database, $field, $criteria)
 DCOUNTA.
static DGET ($database, $field, $criteria)
 DGET.
static DMAX ($database, $field, $criteria)
 DMAX.
static DMIN ($database, $field, $criteria)
 DMIN.
static DPRODUCT ($database, $field, $criteria)
 DPRODUCT.
static DSTDEV ($database, $field, $criteria)
 DSTDEV.
static DSTDEVP ($database, $field, $criteria)
 DSTDEVP.
static DSUM ($database, $field, $criteria)
 DSUM.
static DVAR ($database, $field, $criteria)
 DVAR.
static DVARP ($database, $field, $criteria)
 DVARP.

Static Private Member Functions

static __fieldExtract ($database, $field)
static __filter ($database, $criteria)

Detailed Description

Definition at line 46 of file Database.php.

Member Function Documentation

static PHPExcel_Calculation_Database::__fieldExtract (   $database,
  $field 
)
staticprivate

Definition at line 49 of file Database.php.

References PHPExcel_Calculation_Functions\flattenSingleValue().

Referenced by DAVERAGE(), DCOUNT(), DCOUNTA(), DGET(), DMAX(), DMIN(), DPRODUCT(), DSTDEV(), DSTDEVP(), DSUM(), DVAR(), and DVARP().

{
$fieldNames = array_map('strtoupper',array_shift($database));
if (is_numeric($field)) {
$keys = array_keys($fieldNames);
return $keys[$field-1];
}
$key = array_search($field,$fieldNames);
return ($key) ? $key : null;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Database::__filter (   $database,
  $criteria 
)
staticprivate

Definition at line 61 of file Database.php.

References $row, PHPExcel_Calculation_Functions\_ifCondition(), PHPExcel_Calculation\_wrapResult(), and PHPExcel_Calculation\getInstance().

Referenced by DAVERAGE(), DCOUNT(), DCOUNTA(), DGET(), DMAX(), DMIN(), DPRODUCT(), DSTDEV(), DSTDEVP(), DSUM(), DVAR(), and DVARP().

{
$fieldNames = array_shift($database);
$criteriaNames = array_shift($criteria);
// Convert the criteria into a set of AND/OR conditions with [:placeholders]
$testConditions = $testValues = array();
$testConditionsCount = 0;
foreach($criteriaNames as $key => $criteriaName) {
$testCondition = array();
$testConditionCount = 0;
foreach($criteria as $row => $criterion) {
if ($criterion[$key] > '') {
$testCondition[] = '[:'.$criteriaName.']'.PHPExcel_Calculation_Functions::_ifCondition($criterion[$key]);
$testConditionCount++;
}
}
if ($testConditionCount > 1) {
$testConditions[] = 'OR('.implode(',',$testCondition).')';
$testConditionsCount++;
} elseif($testConditionCount == 1) {
$testConditions[] = $testCondition[0];
$testConditionsCount++;
}
}
if ($testConditionsCount > 1) {
$testConditionSet = 'AND('.implode(',',$testConditions).')';
} elseif($testConditionsCount == 1) {
$testConditionSet = $testConditions[0];
}
// Loop through each row of the database
foreach($database as $dataRow => $dataValues) {
// Substitute actual values from the database row for our [:placeholders]
$testConditionList = $testConditionSet;
foreach($criteriaNames as $key => $criteriaName) {
$k = array_search($criteriaName,$fieldNames);
if (isset($dataValues[$k])) {
$dataValue = $dataValues[$k];
$dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::_wrapResult(strtoupper($dataValue)) : $dataValue;
$testConditionList = str_replace('[:'.$criteriaName.']',$dataValue,$testConditionList);
}
}
// evaluate the criteria against the row data
$result = PHPExcel_Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList);
// If the row failed to meet the criteria, remove it from the database
if (!$result) {
unset($database[$dataRow]);
}
}
return $database;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Database::DAVERAGE (   $database,
  $field,
  $criteria 
)
static

DAVERAGE.

Definition at line 119 of file Database.php.

References $row, __fieldExtract(), __filter(), and PHPExcel_Calculation_Statistical\AVERAGE().

{
$field = self::__fieldExtract($database,$field);
if (is_null($field)) {
return NULL;
}
// reduce the database to a set of rows that match all the criteria
$database = self::__filter($database,$criteria);
// extract an array of values for the requested column
$colData = array();
foreach($database as $row) {
$colData[] = $row[$field];
}
// Return
} // function DAVERAGE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Database::DCOUNT (   $database,
  $field,
  $criteria 
)
static

DCOUNT.

Definition at line 141 of file Database.php.

References $row, __fieldExtract(), __filter(), and PHPExcel_Calculation_Statistical\COUNT().

{
$field = self::__fieldExtract($database,$field);
if (is_null($field)) {
return NULL;
}
// reduce the database to a set of rows that match all the criteria
$database = self::__filter($database,$criteria);
// extract an array of values for the requested column
$colData = array();
foreach($database as $row) {
$colData[] = $row[$field];
}
// Return
} // function DCOUNT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Database::DCOUNTA (   $database,
  $field,
  $criteria 
)
static

DCOUNTA.

Definition at line 163 of file Database.php.

References $row, __fieldExtract(), __filter(), and PHPExcel_Calculation_Statistical\COUNTA().

{
$field = self::__fieldExtract($database,$field);
if (is_null($field)) {
return NULL;
}
// reduce the database to a set of rows that match all the criteria
$database = self::__filter($database,$criteria);
// extract an array of values for the requested column
$colData = array();
foreach($database as $row) {
$colData[] = $row[$field];
}
// Return
} // function DCOUNTA()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Database::DGET (   $database,
  $field,
  $criteria 
)
static

DGET.

Definition at line 185 of file Database.php.

References $row, __fieldExtract(), __filter(), and PHPExcel_Calculation_Functions\NaN().

{
$field = self::__fieldExtract($database,$field);
if (is_null($field)) {
return NULL;
}
// reduce the database to a set of rows that match all the criteria
$database = self::__filter($database,$criteria);
// extract an array of values for the requested column
$colData = array();
foreach($database as $row) {
$colData[] = $row[$field];
}
// Return
if (count($colData) > 1) {
}
return $colData[0];
} // function DGET()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Database::DMAX (   $database,
  $field,
  $criteria 
)
static

DMAX.

Definition at line 211 of file Database.php.

References $row, __fieldExtract(), __filter(), and PHPExcel_Calculation_Statistical\MAX().

{
$field = self::__fieldExtract($database,$field);
if (is_null($field)) {
return NULL;
}
// reduce the database to a set of rows that match all the criteria
$database = self::__filter($database,$criteria);
// extract an array of values for the requested column
$colData = array();
foreach($database as $row) {
$colData[] = $row[$field];
}
// Return
} // function DMAX()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Database::DMIN (   $database,
  $field,
  $criteria 
)
static

DMIN.

Definition at line 233 of file Database.php.

References $row, __fieldExtract(), __filter(), and PHPExcel_Calculation_Statistical\MIN().

{
$field = self::__fieldExtract($database,$field);
if (is_null($field)) {
return NULL;
}
// reduce the database to a set of rows that match all the criteria
$database = self::__filter($database,$criteria);
// extract an array of values for the requested column
$colData = array();
foreach($database as $row) {
$colData[] = $row[$field];
}
// Return
} // function DMIN()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Database::DPRODUCT (   $database,
  $field,
  $criteria 
)
static

DPRODUCT.

Definition at line 255 of file Database.php.

References $row, __fieldExtract(), __filter(), and PHPExcel_Calculation_MathTrig\PRODUCT().

{
$field = self::__fieldExtract($database,$field);
if (is_null($field)) {
return NULL;
}
// reduce the database to a set of rows that match all the criteria
$database = self::__filter($database,$criteria);
// extract an array of values for the requested column
$colData = array();
foreach($database as $row) {
$colData[] = $row[$field];
}
// Return
} // function DPRODUCT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Database::DSTDEV (   $database,
  $field,
  $criteria 
)
static

DSTDEV.

Definition at line 277 of file Database.php.

References $row, __fieldExtract(), __filter(), and PHPExcel_Calculation_Statistical\STDEV().

{
$field = self::__fieldExtract($database,$field);
if (is_null($field)) {
return NULL;
}
// reduce the database to a set of rows that match all the criteria
$database = self::__filter($database,$criteria);
// extract an array of values for the requested column
$colData = array();
foreach($database as $row) {
$colData[] = $row[$field];
}
// Return
} // function DSTDEV()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Database::DSTDEVP (   $database,
  $field,
  $criteria 
)
static

DSTDEVP.

Definition at line 299 of file Database.php.

References $row, __fieldExtract(), __filter(), and PHPExcel_Calculation_Statistical\STDEVP().

{
$field = self::__fieldExtract($database,$field);
if (is_null($field)) {
return NULL;
}
// reduce the database to a set of rows that match all the criteria
$database = self::__filter($database,$criteria);
// extract an array of values for the requested column
$colData = array();
foreach($database as $row) {
$colData[] = $row[$field];
}
// Return
} // function DSTDEVP()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Database::DSUM (   $database,
  $field,
  $criteria 
)
static

DSUM.

Definition at line 321 of file Database.php.

References $row, __fieldExtract(), __filter(), and PHPExcel_Calculation_MathTrig\SUM().

{
$field = self::__fieldExtract($database,$field);
if (is_null($field)) {
return NULL;
}
// reduce the database to a set of rows that match all the criteria
$database = self::__filter($database,$criteria);
// extract an array of values for the requested column
$colData = array();
foreach($database as $row) {
$colData[] = $row[$field];
}
// Return
} // function DSUM()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Database::DVAR (   $database,
  $field,
  $criteria 
)
static

DVAR.

Definition at line 343 of file Database.php.

References $row, __fieldExtract(), __filter(), and PHPExcel_Calculation_Statistical\VARFunc().

{
$field = self::__fieldExtract($database,$field);
if (is_null($field)) {
return NULL;
}
// reduce the database to a set of rows that match all the criteria
$database = self::__filter($database,$criteria);
// extract an array of values for the requested column
$colData = array();
foreach($database as $row) {
$colData[] = $row[$field];
}
// Return
} // function DVAR()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Database::DVARP (   $database,
  $field,
  $criteria 
)
static

DVARP.

Definition at line 365 of file Database.php.

References $row, __fieldExtract(), __filter(), and PHPExcel_Calculation_Statistical\VARP().

{
$field = self::__fieldExtract($database,$field);
if (is_null($field)) {
return NULL;
}
// reduce the database to a set of rows that match all the criteria
$database = self::__filter($database,$criteria);
// extract an array of values for the requested column
$colData = array();
foreach($database as $row) {
$colData[] = $row[$field];
}
// Return
} // function DVARP()

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: