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 3060 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 3073 of file grima-lib.php.

References $filter, $grima, and $rows.

3073  {
3074  global $grima;
3075  if (isset($this->filter)) {
3076  $passfilter = $this->filter;
3077  foreach ($filter_params as $k => $v) {
3078  $passfilter = str_replace('{'.$k.'}',urlencode($v),$passfilter);
3079  }
3080  } else {
3081  $passfilter = null;
3082  }
3083 
3084  if ($limit == -1) { $limit = 1000; } # no limit
3085  if ($limit < 25) { $limit = 25; } # must be in chunks of 25
3086  $this->reportXml = $grima->getAnalytics($this->path, $passfilter, $limit, $token);
3087 
3088  $xpath = new DomXpath($this->reportXml);
3089  $xpath->registerNamespace("x", "urn:schemas-microsoft-com:xml-analysis:rowset");
3090 
3091  $rows = $xpath->query('//x:Row');
3092  foreach ($rows as $row) {
3093  $newrow = array();
3094  $cols = $xpath->query("./*[contains(name(),'Column')]", $row);
3095  foreach ($cols as $col) {
3096  $newrow[] = $col->nodeValue;
3097  }
3098  $this->rows[] = $newrow;
3099  }
3100 
3101  }
$grima
Definition: grima-lib.php:1166

Member Data Documentation

◆ $filter

AnalyticsReport::$filter

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

Referenced by runReport().

◆ $path

AnalyticsReport::$path

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

◆ $reportXml

AnalyticsReport::$reportXml

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

◆ $rows

AnalyticsReport::$rows = array()

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

Referenced by runReport().


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