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

Constructor & Destructor Documentation

◆ __construct()

ElectronicService::__construct ( )

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

2675  {
2676  # load from template
2677  }

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

References $grima, and getPortfolios().

2753  {
2754  global $grima;
2755  while ($this->getPortfolios(100,0)) {
2756  foreach($this->portfolios as $portfolio) {
2757  $portfolio->deleteFromAlma($bib_treat);
2758  }
2759  $this->portfolios = array();
2760  sleep(2);
2761  }
2762  }
getPortfolios($limit=10, $offset=0)
get list of portfolios from Alma
Definition: grima-lib.php:2732
$grima
Definition: grima-lib.php:1166

◆ getPortfolios()

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

get list of portfolios from Alma

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

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

References $grima.

Referenced by deleteAllPortfolios(), and retrieveAllPortfolios().

2732  {
2733  global $grima;
2734  $ret = $grima->getElectronicPortfoliosForService($this['collection_id'],$this['service_id'],$limit,$offset);
2735  $xpath = new DOMXpath($ret);
2736  $ports = $xpath->query('//portfolio');
2737  foreach ($ports as $portnode) {
2738  $newport = new ElectronicPortfolio();
2739  $newport->loadFromPortfolioListNode($portnode);
2740  $this->portfolios[] = $newport;
2741  }
2742  return count($ports);
2743  }
class ElectronicPortfolio
Definition: grima-lib.php:2788
$grima
Definition: grima-lib.php:1166

◆ loadFromAlma()

ElectronicService::loadFromAlma (   $collection_id,
  $service_id 
)

load record from Alma

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

References $grima.

2692  {
2693  global $grima;
2694  $this->xml = $grima->getElectronicService($collection_id,$service_id);
2695  $this['collection_id'] = $collection_id;
2696  }
$grima
Definition: grima-lib.php:1166

◆ loadFromServiceListNode()

ElectronicService::loadFromServiceListNode (   $node)

populate item record from the information in an ServiceList node

Parameters
DomNode$nodenode from an ItemList

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

2705  {
2706  $this->xml = new DomDocument();
2707  $this->xml->appendChild($this->xml->importNode($node,true));
2708  $xpath = new DomXPath($this->xml);
2709  $service_link = $xpath->query('//electronic_service')->item(0)->attributes['link']->nodeValue;
2710  preg_match('!/e-collections/(.*)/e-services/!',$service_link,$m);
2711  $this['collection_id'] = $m[1];
2712  }

◆ offsetSet()

ElectronicService::offsetSet (   $offset,
  $value 
)

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

2679  {
2680  if ($offset == "collection_id") {
2681  $this->el_override['collection_id'] = $value;
2682  } else {
2683  parent::offsetSet($offset,$value);
2684  }
2685  }

◆ retrieveAllPortfolios()

ElectronicService::retrieveAllPortfolios ( )

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

References getPortfolios().

2714  {
2715  $curr_offset = 0;
2716  do {
2717  $retrieved = $this->getPortfolios(100, $curr_offset);
2718  $curr_offset += 100;
2719  } while ($retrieved == 100);
2720  }
getPortfolios($limit=10, $offset=0)
get list of portfolios from Alma
Definition: grima-lib.php:2732

Member Data Documentation

◆ $el_address

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

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

◆ $el_override

ElectronicService::$el_override = array()

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

◆ $number_of_portfolios

ElectronicService::$number_of_portfolios

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

◆ $portfolios

ElectronicService::$portfolios = array()

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


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