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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $grima.

2540  {
2541 
2542  global $grima;
2543  $curr_offset = 0;
2544  $req_limit = ($limit == -1)?100:$limit;
2545 
2546  do {
2547  if ($curr_offset > 0) {
2548  if (($curr_offset+1)*100 > $limit) {
2549  $req_limit = $limit - $curr_offset*100;
2550  } else {
2551  $req_limit = 100;
2552  }
2553  }
2554  $xml = $grima->getItemList($mms_id,$holding_id,$req_limit,$curr_offset*100);
2555  $xpath = new DomXpath($xml);
2556  $is = $xpath->query('//item');
2557  foreach ($is as $i) {
2558  $new_item = new Item();
2559  $new_item->loadFromItemListNode($i);
2560  $this->items[] = $new_item;
2561  }
2562  $xpath = new DomXPath($xml);
2563  if (!$curr_offset) {
2564  $length = $xpath->query('//items/@total_record_count')[0]->nodeValue;
2565  if ($limit == -1) { $limit = $length; }
2566  }
2567  $curr_offset++;
2568 
2569  } while (($curr_offset*100 < $length) and ($curr_offset*100 < $limit));
2570 
2571  }
$grima
Definition: grima-lib.php:4293
class Item
Definition: grima-lib.php:2869

Member Data Documentation

◆ $items

ItemList::$items = array()

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


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