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 4586 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 4600 of file grima-lib.php.

4601 {
4602 global $grima;
4603 if (isset($this->filter)) {
4604 $passfilter = $this->filter;
4605 foreach ($filter_params as $k => $v) {
4606 $passfilter = str_replace('{'.$k.'}', urlencode($v), $passfilter);
4607 }
4608 } else {
4609 $passfilter = null;
4610 }
4611
4612 if ($limit == -1) { $limit = 1000;
4613 } // no limit
4614 if ($limit < 25) { $limit = 25;
4615 } // must be in chunks of 25
4616 $this->reportXml = $grima->getAnalytics($this->path, $passfilter, $limit, $token);
4617
4618 $xpath = new DomXpath($this->reportXml);
4619 $xpath->registerNamespace("x", "urn:schemas-microsoft-com:xml-analysis:rowset");
4620
4621 $rows = $xpath->query('//x:Row');
4622 foreach ($rows as $row) {
4623 $newrow = array();
4624 $cols = $xpath->query("./*[contains(name(),'Column')]", $row);
4625 foreach ($cols as $col) {
4626 $newrow[] = $col->nodeValue;
4627 }
4628 $this->rows[] = $newrow;
4629 }
4630 }
$grima
Definition: grima-lib.php:5143

References $filter, $grima, and $rows.

Member Data Documentation

◆ $filter

AnalyticsReport::$filter

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

Referenced by runReport().

◆ $path

AnalyticsReport::$path

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

◆ $reportXml

AnalyticsReport::$reportXml

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

◆ $rows

AnalyticsReport::$rows = array()

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

Referenced by runReport().


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