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

class ElectronicService More...

Inheritance diagram for ElectronicService:
AlmaObject

Public Member Functions

  __construct ()
  create new blank Alma Object More...
 
  offsetSet ($offset, $value)
 
  loadFromAlma ($collection_id, $service_id)
  load record from Alma More...
 
  loadFromServiceListNode ($node)
  populate item record from the information in an ServiceList node More...
 
  retrieveAllPortfolios ()
 
  getPortfolios ($limit=10, $offset=0)
  get list of portfolios from Alma More...
 
  deleteAllPortfolios ($bib_treat)
  delete all portfolios from the service 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

  $number_of_portfolios
 
  $portfolios = array()
 
  $el_address
 
  $el_override = array()
 
- Public Attributes inherited from AlmaObject
  $el_access = array()
 
  $xml
 
  $templateDir = __DIR__ . "/templates"
 

Detailed Description

class ElectronicService

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

Constructor & Destructor Documentation

◆ __construct()

ElectronicService::__construct ( )

create new blank Alma Object

Reimplemented from AlmaObject.

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

3814 {
3815 // load from template
3816 }

Member Function Documentation

◆ deleteAllPortfolios()

ElectronicService::deleteAllPortfolios (   $bib_treat )

delete all portfolios from the service

Parameters
string $bib_treat - for bibs with no inventory, "retain" or "delete"

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

3897 {
3898 global $grima;
3899 while ($this->getPortfolios(100, 0)) {
3900 foreach ($this->portfolios as $portfolio) {
3901 $portfolio->deleteFromAlma($bib_treat);
3902 }
3903 $this->portfolios = array();
3904 sleep(2);
3905 }
3906 }
getPortfolios($limit=10, $offset=0)
get list of portfolios from Alma
Definition: grima-lib.php:3874
$grima
Definition: grima-lib.php:5143

References $grima, and getPortfolios().

◆ getPortfolios()

ElectronicService::getPortfolios (   $limit = 10,
  $offset = 0 
)

get list of portfolios from Alma

Parameters
Int $limit max to download (default 10, max 100)
Int $offset starting point in list for download
Returns
Int number of portfolios retrieved

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

3875 {
3876 global $grima;
3877 $ret = $grima->getElectronicPortfoliosForService($this['collection_id'], $this['service_id'], $limit, $offset);
3878 $xpath = new DOMXpath($ret);
3879 $ports = $xpath->query('//portfolio');
3880 foreach ($ports as $portnode) {
3881 $newport = new ElectronicPortfolio();
3882 $newport->loadFromPortfolioListNode($portnode);
3883 $this->portfolios[] = $newport;
3884 }
3885 return count($ports);
3886 }
class ElectronicPortfolio
Definition: grima-lib.php:3937

References $grima.

Referenced by deleteAllPortfolios(), and retrieveAllPortfolios().

◆ loadFromAlma()

ElectronicService::loadFromAlma (   $collection_id,
  $service_id 
)

load record from Alma

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

3832 {
3833 global $grima;
3834 $this->xml = $grima->getElectronicService($collection_id, $service_id);
3835 $this['collection_id'] = $collection_id;
3836 }

References $grima.

◆ loadFromServiceListNode()

ElectronicService::loadFromServiceListNode (   $node )

populate item record from the information in an ServiceList node

Parameters
DomNode $node node from an ItemList

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

3846 {
3847 $this->xml = new DomDocument();
3848 $this->xml->appendChild($this->xml->importNode($node, true));
3849 $xpath = new DomXPath($this->xml);
3850 $service_link = $xpath->query('//electronic_service')->item(0)->attributes['link']->nodeValue;
3851 preg_match('!/e-collections/(.*)/e-services/!', $service_link, $m);
3852 $this['collection_id'] = $m[1];
3853 }

◆ offsetSet()

ElectronicService::offsetSet (   $offset,
  $value 
)

Reimplemented from AlmaObject.

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

3819 {
3820 if ($offset == "collection_id") {
3821 $this->el_override['collection_id'] = $value;
3822 } else {
3823 parent::offsetSet($offset, $value);
3824 }
3825 }

◆ retrieveAllPortfolios()

ElectronicService::retrieveAllPortfolios ( )

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

3856 {
3857 $curr_offset = 0;
3858 do {
3859 $retrieved = $this->getPortfolios(100, $curr_offset);
3860 $curr_offset += 100;
3861 } while ($retrieved == 100);
3862 }

References getPortfolios().

Member Data Documentation

◆ $el_address

ElectronicService::$el_address
Initial value:
= array(
'id' => '//id',
'service_id' => '//id',
)

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

◆ $el_override

ElectronicService::$el_override = array()

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

◆ $number_of_portfolios

ElectronicService::$number_of_portfolios

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

◆ $portfolios

ElectronicService::$portfolios = array()

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


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