Example #1
0
 function GetHoldingsInfo()
 {
     global $interface;
     global $configArray;
     $interface->assign('showOtherEditionsPopup', $configArray['Content']['showOtherEditionsPopup']);
     $id = strip_tags($_REQUEST['id']);
     $interface->assign('id', $id);
     //Load holdings information from the driver
     require_once ROOT_DIR . '/Drivers/EContentDriver.php';
     require_once ROOT_DIR . '/sys/eContent/EContentRecord.php';
     $driver = new EContentDriver();
     //Get any items that are stored for the record
     $eContentRecord = new EContentRecord();
     $eContentRecord->id = $id;
     $eContentRecord->find(true);
     /** @var EContentItem[] $holdings */
     $holdings = $driver->getHolding($id);
     $showEContentNotes = false;
     foreach ($holdings as $holding) {
         if (strlen($holding->notes) > 0) {
             $showEContentNotes = true;
         }
     }
     $interface->assign('record', $eContentRecord);
     $availability = $driver->getScopedAvailability($eContentRecord);
     $interface->assign('availability', $availability['mine']);
     $interface->assign('availabilityOther', $availability['other']);
     $showAvailability = true;
     $showAvailabilityOther = true;
     if ($eContentRecord->accessType == 'external' && strcasecmp($eContentRecord->source, 'OverDrive') != 0) {
         $showAvailability = false;
         $showAvailabilityOther = false;
     }
     $interface->assign('showAvailability', $showAvailability);
     $interface->assign('showAvailabilityOther', $showAvailabilityOther);
     $interface->assign('source', $eContentRecord->source);
     $interface->assign('accessType', $eContentRecord->accessType);
     $interface->assign('showEContentNotes', $showEContentNotes);
     if ($eContentRecord->getIsbn() == null || strlen($eContentRecord->getIsbn()) == 0) {
         $interface->assign('showOtherEditionsPopup', false);
     }
     $showOverDriveConsole = false;
     $showAdobeDigitalEditions = false;
     foreach ($holdings as $item) {
         if (strcasecmp($item->getSource(), 'overdrive') == 0) {
             if (in_array($item->externalFormatId, array('ebook-epub-adobe', 'ebook-pdf-adobe'))) {
                 $showAdobeDigitalEditions = true;
             } else {
                 if (in_array($item->externalFormatId, array('video-wmv', 'music-wma', 'music-wma', 'audiobook-wma', 'audiobook-mp3'))) {
                     $showOverDriveConsole = true;
                 }
             }
         } else {
             if (in_array($item->item_type, array('epub', 'pdf'))) {
                 $showAdobeDigitalEditions = true;
             }
         }
     }
     $interface->assign('showOverDriveConsole', $showOverDriveConsole);
     $interface->assign('showAdobeDigitalEditions', $showAdobeDigitalEditions);
     $interface->assign('holdings', $holdings);
     //Load status summary
     $result = $driver->getStatusSummary($id, $holdings);
     if (PEAR_Singleton::isError($result)) {
         PEAR_Singleton::raiseError($result);
     }
     $interface->assign('holdingsSummary', $result);
     return $interface->fetch('EcontentRecord/ajax-holdings.tpl');
 }