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

class ItemList More...

Inheritance diagram for ItemList:
AlmaObject

Public Member Functions

 __construct ($mms_id, $holding_id, $limit=-1)
 
- Public Member Functions inherited from AlmaObject
 __construct ()
 create new blank Alma Object More...
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 

Public Attributes

 $items = array()
 
- Public Attributes inherited from AlmaObject
 $el_access = array()
 
 $xml
 
 $templateDir = __DIR__ . "/templates"
 

Detailed Description

class ItemList

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

Constructor & Destructor Documentation

◆ __construct()

ItemList::__construct (   $mms_id,
  $holding_id,
  $limit = -1 
)

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

References $grima, and AlmaObject\$xml.

2137  {
2138 
2139  global $grima;
2140  $curr_offset = 0;
2141  $req_limit = ($limit == -1)?100:$limit;
2142 
2143  do {
2144  if ($curr_offset > 0) {
2145  if (($curr_offset+1)*100 > $limit) {
2146  $req_limit = $limit - $curr_offset*100;
2147  } else {
2148  $req_limit = 100;
2149  }
2150  }
2151  $xml = $grima->getItemList($mms_id,$holding_id,$req_limit,$curr_offset*100);
2152  $xpath = new DomXpath($xml);
2153  $is = $xpath->query('//item');
2154  foreach ($is as $i) {
2155  $new_item = new Item();
2156  $new_item->loadFromItemListNode($i);
2157  $this->items[] = $new_item;
2158  }
2159  $xpath = new DomXPath($xml);
2160  if (!$curr_offset) {
2161  $length = $xpath->query('//items/@total_record_count')[0]->nodeValue;
2162  if ($limit == -1) { $limit = $length; }
2163  }
2164  $curr_offset++;
2165 
2166  } while (($curr_offset*100 < $length) and ($curr_offset*100 < $limit));
2167 
2168  }
$grima
Definition: grima-lib.php:1166
class Item
Definition: grima-lib.php:2435

Member Data Documentation

◆ $items

ItemList::$items = array()

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


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