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

Constructor & Destructor Documentation

◆ __construct()

AlmaObject::__construct ( )

create new blank Alma Object

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

1580  {
1581  $this->xml = new DomDocument();
1582  $blankRecord = get_class($this);
1583  $this->xml->loadXML(file_get_contents("{$this->templateDir}/{$blankRecord}.xml"));
1584  }

Member Function Documentation

◆ offsetExists()

AlmaObject::offsetExists (   $offset)

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

1587  {
1588  if (isset($this->el_override)) {
1589  return array_key_exists($offset, $this->el_override);
1590  }
1591  return array_key_exists($offset, $this->el_access);
1592  }

◆ offsetGet()

AlmaObject::offsetGet (   $offset)

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

1594  {
1595  if ((isset($this->el_override)) and
1596  (isset($this->el_override[$offset]))) {
1597  return $this->el_override[$offset];
1598  }
1599  $xpath = new DomXpath($this->xml);
1600  $node = $xpath->query($this->el_address[$offset]);
1601  if (count($node) >= 1) {
1602  return $node[0]->nodeValue;
1603  }
1604  return null;
1605  }

◆ offsetSet()

AlmaObject::offsetSet (   $offset,
  $value 
)

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

1607  {
1608  $xpath = new DomXpath($this->xml);
1609  $node = $xpath->query($this->el_address[$offset]);
1610  $node[0]->nodeValue = $value;
1611  }

◆ offsetUnset()

AlmaObject::offsetUnset (   $offset)

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

1613  {
1614  $xpath = new DomXpath($this->xml);
1615  $node = $xpath->query($this->el_address[$offset]);
1616  $node[0]->nodeValue = null;
1617  }

Member Data Documentation

◆ $el_access

AlmaObject::$el_access = array()

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

◆ $templateDir

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

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

◆ $xml

AlmaObject::$xml

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

Referenced by ItemList\__construct(), and Item\addToAlmaHolding().


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