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

Base class for objects returned from alma APIs (mostly just array access) More...

Inheritance diagram for AlmaObject:
AlmaObjectWithMARC AnalyticsReport ElectronicCollection ElectronicPortfolio ElectronicService HoldingsList HoldingsListEntry Item ItemList Job Library Location Set

Public Member Functions

  __construct ()
  create new blank Alma Object More...
 
  offsetExists ($offset)
 
  offsetGet ($offset)
 
  offsetSet ($offset, $value)
 
  offsetUnset ($offset)
 

Public Attributes

  $el_access = array()
 
  $xml
 
  $templateDir = __DIR__ . "/templates"
 

Detailed Description

Base class for objects returned from alma APIs (mostly just array access)

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

Constructor & Destructor Documentation

◆ __construct()

AlmaObject::__construct ( )

create new blank Alma Object

Reimplemented in ElectronicService.

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

2184 {
2185 $this->xml = new DomDocument();
2186 $blankRecord = get_class($this);
2187 $this->xml->loadXML(file_get_contents("{$this->templateDir}/{$blankRecord}.xml"));
2188 }

Member Function Documentation

◆ offsetExists()

AlmaObject::offsetExists (   $offset )

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

2192 {
2193 if (isset($this->el_override)) {
2194 return array_key_exists($offset, $this->el_override);
2195 }
2196 return array_key_exists($offset, $this->el_access);
2197 }

◆ offsetGet()

AlmaObject::offsetGet (   $offset )

Reimplemented in Bib, and Holding.

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

2200 {
2201 if ((isset($this->el_override))
2202 and (isset($this->el_override[$offset]))
2203 ) {
2204 return $this->el_override[$offset];
2205 }
2206 $xpath = new DomXpath($this->xml);
2207 $node = $xpath->query($this->el_address[$offset]);
2208 if (sizeof($node) >= 1) {
2209 return $node[0]->nodeValue;
2210 }
2211 return null;
2212 }

◆ offsetSet()

AlmaObject::offsetSet (   $offset,
  $value 
)

Reimplemented in Bib, Holding, ElectronicService, and Location.

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

2216 {
2217 $xpath = new DomXpath($this->xml);
2218 $node = $xpath->query($this->el_address[$offset]);
2219 $node[0]->nodeValue =
2220 preg_replace('/&(?!#?[a-z0-9]+;)/', '&', $value); # XXX
2221 }

◆ offsetUnset()

AlmaObject::offsetUnset (   $offset )

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

2224 {
2225 $xpath = new DomXpath($this->xml);
2226 $node = $xpath->query($this->el_address[$offset]);
2227 $node[0]->nodeValue = null;
2228 }

Member Data Documentation

◆ $el_access

AlmaObject::$el_access = array()

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

◆ $templateDir

AlmaObject::$templateDir = __DIR__ . "/templates"

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

◆ $xml

AlmaObject::$xml

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