function forceReindex() { require_once ROOT_DIR . '/RecordDrivers/GroupedWorkDriver.php'; require_once ROOT_DIR . '/sys/Grouping/GroupedWork.php'; $id = $_REQUEST['id']; $groupedWork = new GroupedWork(); $groupedWork->permanent_id = $id; if ($groupedWork->find(true)) { $groupedWork->date_updated = null; $numRows = $groupedWork->query("UPDATE grouped_work set date_updated = null where id = " . $groupedWork->id); if ($numRows == 1) { return json_encode(array('success' => true, 'message' => 'This title will be indexed again next time the index is run.')); } else { return json_encode(array('success' => false, 'message' => 'Unable to mark the title for indexing. Could not update the title.')); } } else { return json_encode(array('success' => false, 'message' => 'Unable to mark the title for indexing. Could not find the title.')); } }
public function getIsbnsForWork($permanentId = null) { if ($permanentId == null) { $permanentId = $_REQUEST['id']; } $isbns = array(); require_once ROOT_DIR . '/sys/Grouping/GroupedWork.php'; require_once ROOT_DIR . '/sys/Grouping/GroupedWorkIdentifier.php'; require_once ROOT_DIR . '/sys/Grouping/GroupedWorkIdentifierRef.php'; $groupedWork = new GroupedWork(); $groupedWork->permanent_id = $permanentId; if ($groupedWork->find(true)) { $groupedWorkIdentifier = new GroupedWorkIdentifier(); $groupedWorkIdentifierRef = new GroupedWorkIdentifierRef(); $groupedWorkIdentifierRef->grouped_work_id = $groupedWork->id; $groupedWorkIdentifier->type = 'isbn'; $groupedWorkIdentifierRef->joinAdd($groupedWorkIdentifier); $groupedWorkIdentifierRef->find(); if ($groupedWorkIdentifierRef->N > 0) { while ($groupedWorkIdentifierRef->fetch()) { $isbns[] = $groupedWorkIdentifierRef->identifier; } } } return $isbns; }
/** * Assign necessary Smarty variables and return a template name to * load in order to display the full record information on the Staff * View tab of the record view page. * * @access public * @return string Name of Smarty template file to display. */ public function getStaffView() { global $interface; require_once ROOT_DIR . '/sys/Grouping/GroupedWork.php'; $groupedWork = new GroupedWork(); $groupedWork->permanent_id = $this->getPermanentId(); if ($groupedWork->find(true)) { $groupedWorkDetails = array(); $groupedWorkDetails['full_title'] = $groupedWork->full_title; $groupedWorkDetails['author'] = $groupedWork->author; $groupedWorkDetails['grouping_category'] = $groupedWork->grouping_category; $interface->assign('groupedWorkDetails', $groupedWorkDetails); } $fields = $this->fields; ksort($fields); $interface->assign('details', $fields); return 'RecordDrivers/GroupedWork/staff-view.tpl'; }
private function loadNoveListTitle($currentId, $item, &$titleList, &$titlesOwned, $seriesName = '') { global $user; global $timer; global $configArray; //Find the correct grouped work based on the isbns; require_once ROOT_DIR . '/sys/Grouping/GroupedWork.php'; require_once ROOT_DIR . '/sys/Grouping/GroupedWorkIdentifier.php'; require_once ROOT_DIR . '/sys/Grouping/GroupedWorkIdentifierRef.php'; $timer->logTime("Start loadNoveListTitle"); /** @var SimpleXMLElement $titleItem */ $permanentId = null; $concatenatedIsbns = "'" . implode("','", $item->isbns) . "'"; $groupedWorkIdentifier = new GroupedWorkIdentifier(); $groupedWorkIdentifier->type = "isbn"; $groupedWorkIdentifier->whereAdd("identifier in ({$concatenatedIsbns})"); if ($groupedWorkIdentifier->find()) { while ($groupedWorkIdentifier->fetch()) { $groupedWorkIdentifierRef = new GroupedWorkIdentifierRef(); $groupedWorkIdentifierRef->identifier_id = $groupedWorkIdentifier->id; $groupedWorkIdentifierRef->find(); if ($groupedWorkIdentifierRef->N == 1) { $groupedWorkIdentifierRef->fetch(); $groupedWork = new GroupedWork(); $groupedWork->id = $groupedWorkIdentifierRef->grouped_work_id; if ($groupedWork->find(true)) { $permanentId = $groupedWork->permanent_id; break; } } } } $timer->logTime("Load Novelist Title - Find Grouped Work based on identifier {$permanentId}"); $isCurrent = $currentId == $permanentId; if (isset($seriesName)) { $series = $seriesName; } else { $series = ''; } $volume = ''; if (isset($item->volume)) { $volume = $item->volume; } //We didn't find a match in the database so we don't own it if ($permanentId == null) { $isbn = reset($item->isbns); $isbn13 = strlen($isbn) == 13 ? $isbn : ISBNConverter::convertISBN10to13($isbn); $isbn10 = strlen($isbn) == 10 ? $isbn : ISBNConverter::convertISBN13to10($isbn); $curTitle = array('title' => $item->full_title, 'author' => $item->author, 'isbn' => $isbn13, 'isbn10' => $isbn10, 'recordId' => -1, 'libraryOwned' => false, 'isCurrent' => $isCurrent, 'series' => $series, 'volume' => $volume, 'reason' => isset($item->reason) ? $item->reason : '', 'smallCover' => $cover = $configArray['Site']['coverUrl'] . "/bookcover.php?size=small&isn=" . $isbn13, 'mediumCover' => $cover = $configArray['Site']['coverUrl'] . "/bookcover.php?size=medium&isn=" . $isbn13); } else { //Get more information from Solr /** @var GroupedWorkDriver $recordDriver */ $recordDriver = new GroupedWorkDriver($permanentId); $timer->logTime("Find grouped work in solr"); if ($recordDriver->isValid) { if (!isset($series)) { if (isset($ownedRecord['series'])) { $series = $ownedRecord['series'][0]; } } //Load data about the record $ratingData = $recordDriver->getRatingData($user); $timer->logTime("Get Rating data"); $fullRecordLink = $recordDriver->getLinkUrl(); //See if we can get the series title from the record $curTitle = array('title' => $recordDriver->getTitle(), 'title_short' => $recordDriver->getTitle(), 'author' => $recordDriver->getPrimaryAuthor(), 'isbn' => $recordDriver->getCleanISBN(), 'isbn10' => $recordDriver->getCleanISBN(), 'upc' => $recordDriver->getCleanUPC(), 'recordId' => $recordDriver->getPermanentId(), 'recordtype' => 'grouped_work', 'id' => $recordDriver->getPermanentId(), 'libraryOwned' => true, 'isCurrent' => $isCurrent, 'shortId' => $recordDriver->getPermanentId(), 'format_category' => $recordDriver->getFormatCategory(), 'series' => $series, 'volume' => $volume, 'ratingData' => $ratingData, 'fullRecordLink' => $fullRecordLink, 'reason' => isset($item->reason) ? $item->reason : '', 'recordDriver' => $recordDriver, 'smallCover' => $recordDriver->getBookcoverUrl('small'), 'mediumCover' => $recordDriver->getBookcoverUrl('medium')); $timer->logTime("Load title information"); $titlesOwned++; } else { $isbn = reset($item->isbns); $isbn13 = strlen($isbn) == 13 ? $isbn : ISBNConverter::convertISBN10to13($isbn); $isbn10 = strlen($isbn) == 10 ? $isbn : ISBNConverter::convertISBN13to10($isbn); $curTitle = array('title' => $item->full_title, 'author' => $item->author, 'isbn' => $isbn13, 'isbn10' => $isbn10, 'recordId' => -1, 'libraryOwned' => false, 'isCurrent' => $isCurrent, 'series' => $series, 'volume' => $volume, 'reason' => isset($item->reason) ? $item->reason : '', 'smallCover' => $cover = $configArray['Site']['coverUrl'] . "/bookcover.php?size=small&isn=" . $isbn13, 'mediumCover' => $cover = $configArray['Site']['coverUrl'] . "/bookcover.php?size=medium&isn=" . $isbn13); } } $titleList[] = $curTitle; return $curTitle; }