Grima  2018-08
Whispering into Alma's ear
Public Member Functions | Public Attributes | List of all members
AnalyticsReport Class Reference

class AnalyticsReport More...

Inheritance diagram for AnalyticsReport:
AlmaObject

Public Member Functions

  runReport ($filter_params=array(), $limit=-1, $token="")
  pull Analytics report from Alma More...
 
- Public Member Functions inherited from AlmaObject
  __construct ()
  create new blank Alma Object More...
 
  offsetExists ($offset)
 
  offsetGet ($offset)
 
  offsetSet ($offset, $value)
 
  offsetUnset ($offset)
 

Public Attributes

  $path
 
  $filter
 
  $reportXml
 
  $rows = array()
 
- Public Attributes inherited from AlmaObject
  $el_access = array()
 
  $xml
 
  $templateDir = __DIR__ . "/templates"
 

Detailed Description

class AnalyticsReport

Definition at line 3824 of file grima-lib.php.

Member Function Documentation

◆ runReport()

AnalyticsReport::runReport (   $filter_params = array(),
  $limit = -1,
  $token = "" 
)

pull Analytics report from Alma

Parameters
String $code - code of location to pull from Alma

Definition at line 3837 of file grima-lib.php.

References $grima.

3837  {
3838  global $grima;
3839  if (isset($this->filter)) {
3840  $passfilter = $this->filter;
3841  foreach ($filter_params as $k => $v) {
3842  $passfilter = str_replace('{'.$k.'}',urlencode($v),$passfilter);
3843  }
3844  } else {
3845  $passfilter = null;
3846  }
3847 
3848  if ($limit == -1) { $limit = 1000; } # no limit
3849  if ($limit < 25) { $limit = 25; } # must be in chunks of 25
3850  $this->reportXml = $grima->getAnalytics($this->path, $passfilter, $limit, $token);
3851 
3852  $xpath = new DomXpath($this->reportXml);
3853  $xpath->registerNamespace("x", "urn:schemas-microsoft-com:xml-analysis:rowset");
3854 
3855  $rows = $xpath->query('//x:Row');
3856  foreach ($rows as $row) {
3857  $newrow = array();
3858  $cols = $xpath->query("./*[contains(name(),'Column')]", $row);
3859  foreach ($cols as $col) {
3860  $newrow[] = $col->nodeValue;
3861  }
3862  $this->rows[] = $newrow;
3863  }
3864 
3865  }
$grima
Definition: grima-lib.php:4293

Member Data Documentation

◆ $filter

AnalyticsReport::$filter

Definition at line 3827 of file grima-lib.php.

◆ $path

AnalyticsReport::$path

Definition at line 3826 of file grima-lib.php.

◆ $reportXml

AnalyticsReport::$reportXml

Definition at line 3828 of file grima-lib.php.

◆ $rows

AnalyticsReport::$rows = array()

Definition at line 3829 of file grima-lib.php.


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