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 ()
 
  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 3123 of file grima-lib.php.

Constructor & Destructor Documentation

◆ __construct()

ElectronicService::__construct ( )

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

3135  {
3136  # load from template
3137  }

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

References $grima.

3213  {
3214  global $grima;
3215  while ($this->getPortfolios(100,0)) {
3216  foreach($this->portfolios as $portfolio) {
3217  $portfolio->deleteFromAlma($bib_treat);
3218  }
3219  $this->portfolios = array();
3220  sleep(2);
3221  }
3222  }
getPortfolios($limit=10, $offset=0)
get list of portfolios from Alma
Definition: grima-lib.php:3192
$grima
Definition: grima-lib.php:4293

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

References $grima.

3192  {
3193  global $grima;
3194  $ret = $grima->getElectronicPortfoliosForService($this['collection_id'],$this['service_id'],$limit,$offset);
3195  $xpath = new DOMXpath($ret);
3196  $ports = $xpath->query('//portfolio');
3197  foreach ($ports as $portnode) {
3198  $newport = new ElectronicPortfolio();
3199  $newport->loadFromPortfolioListNode($portnode);
3200  $this->portfolios[] = $newport;
3201  }
3202  return count($ports);
3203  }
class ElectronicPortfolio
Definition: grima-lib.php:3248
$grima
Definition: grima-lib.php:4293

◆ loadFromAlma()

ElectronicService::loadFromAlma (   $collection_id,
  $service_id 
)

load record from Alma

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

References $grima.

3152  {
3153  global $grima;
3154  $this->xml = $grima->getElectronicService($collection_id,$service_id);
3155  $this['collection_id'] = $collection_id;
3156  }
$grima
Definition: grima-lib.php:4293

◆ loadFromServiceListNode()

ElectronicService::loadFromServiceListNode (   $node )

populate item record from the information in an ServiceList node

Parameters
DomNode $node node from an ItemList

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

3165  {
3166  $this->xml = new DomDocument();
3167  $this->xml->appendChild($this->xml->importNode($node,true));
3168  $xpath = new DomXPath($this->xml);
3169  $service_link = $xpath->query('//electronic_service')->item(0)->attributes['link']->nodeValue;
3170  preg_match('!/e-collections/(.*)/e-services/!',$service_link,$m);
3171  $this['collection_id'] = $m[1];
3172  }

◆ offsetSet()

ElectronicService::offsetSet (   $offset,
  $value 
)

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

3139  {
3140  if ($offset == "collection_id") {
3141  $this->el_override['collection_id'] = $value;
3142  } else {
3143  parent::offsetSet($offset,$value);
3144  }
3145  }

◆ retrieveAllPortfolios()

ElectronicService::retrieveAllPortfolios ( )

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

3174  {
3175  $curr_offset = 0;
3176  do {
3177  $retrieved = $this->getPortfolios(100, $curr_offset);
3178  $curr_offset += 100;
3179  } while ($retrieved == 100);
3180  }
getPortfolios($limit=10, $offset=0)
get list of portfolios from Alma
Definition: grima-lib.php:3192

Member Data Documentation

◆ $el_address

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

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

◆ $el_override

ElectronicService::$el_override = array()

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

◆ $number_of_portfolios

ElectronicService::$number_of_portfolios

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

◆ $portfolios

ElectronicService::$portfolios = array()

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


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