function getOtherEditions() { global $interface; global $analytics; $id = $_REQUEST['id']; $isEContent = $_REQUEST['isEContent']; if ($isEContent == 'true') { require_once ROOT_DIR . '/sys/eContent/EContentRecord.php'; $econtentRecord = new EContentRecord(); $econtentRecord->id = $id; if ($econtentRecord->find(true)) { $otherEditions = OtherEditionHandler::getEditions($econtentRecord->id, $econtentRecord->getIsbn(), $econtentRecord->getIssn(), 10); } else { $error = "Sorry we couldn't find that record in the catalog."; } } else { $resource = new Resource(); $resource->record_id = $id; $resource->source = 'VuFind'; $solrId = $id; if ($resource->find(true)) { $otherEditions = OtherEditionHandler::getEditions($solrId, $resource->isbn, null, 10); } else { $error = "Sorry we couldn't find that record in the catalog."; } } if (isset($otherEditions)) { //Get resource for each edition $editionResources = array(); if (is_array($otherEditions)) { foreach ($otherEditions as $edition) { /** @var Resource $editionResource */ $editionResource = new Resource(); if (preg_match('/econtentRecord(\\d+)/', $edition['id'], $matches)) { $editionResource->source = 'eContent'; $editionResource->record_id = trim($matches[1]); } else { $editionResource->record_id = $edition['id']; $editionResource->source = 'VuFind'; } if ($editionResource->find(true)) { $editionResources[] = $editionResource; } else { $logger = new Logger(); $logger->log("Could not find resource {$editionResource->source} {$editionResource->record_id} - {$edition['id']}", PEAR_LOG_DEBUG); } } $analytics->addEvent('Enrichment', 'Other Editions', count($otherEditions)); } else { $analytics->addEvent('Enrichment', 'Other Editions Error'); } $interface->assign('otherEditions', $editionResources); $interface->assign('popupTitle', 'Other Editions'); $interface->assign('popupTemplate', 'Resource/otherEditions.tpl'); echo $interface->fetch('popup-wrapper.tpl'); } elseif (isset($error)) { $analytics->addEvent('Enrichment', 'Other Editions Error', $error); echo $error; } else { echo "There are no other editions for this title currently in the catalog."; $analytics->addEvent('Enrichment', 'Other Editions', 0, 'No Other ISBNs'); } }