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

Constructor & Destructor Documentation

◆ __construct()

AlmaObject::__construct ( )

create new blank Alma Object

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

1887  {
1888  $this->xml = new DomDocument();
1889  $blankRecord = get_class($this);
1890  $this->xml->loadXML(file_get_contents("{$this->templateDir}/{$blankRecord}.xml"));
1891  }

Member Function Documentation

◆ offsetExists()

AlmaObject::offsetExists (   $offset )

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

1894  {
1895  if (isset($this->el_override)) {
1896  return array_key_exists($offset, $this->el_override);
1897  }
1898  return array_key_exists($offset, $this->el_access);
1899  }

◆ offsetGet()

AlmaObject::offsetGet (   $offset )

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

1901  {
1902  if ((isset($this->el_override)) and
1903  (isset($this->el_override[$offset]))) {
1904  return $this->el_override[$offset];
1905  }
1906  $xpath = new DomXpath($this->xml);
1907  $node = $xpath->query($this->el_address[$offset]);
1908  if (sizeof($node) >= 1) {
1909  return $node[0]->nodeValue;
1910  }
1911  return null;
1912  }

◆ offsetSet()

AlmaObject::offsetSet (   $offset,
  $value 
)

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

1915  {
1916  $xpath = new DomXpath($this->xml);
1917  $node = $xpath->query($this->el_address[$offset]);
1918  $node[0]->nodeValue = $value;
1919  }

◆ offsetUnset()

AlmaObject::offsetUnset (   $offset )

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

1921  {
1922  $xpath = new DomXpath($this->xml);
1923  $node = $xpath->query($this->el_address[$offset]);
1924  $node[0]->nodeValue = null;
1925  }

Member Data Documentation

◆ $el_access

AlmaObject::$el_access = array()

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

◆ $templateDir

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

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

◆ $xml

AlmaObject::$xml

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


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