function search($isbnList) { $bl = new BulkLookupQuery(); if (!is_array($isbnList)) { return false; } foreach ($isbnList as $one) { // Check existing ISBN. $existBibid = $bl->getExistBiblio($one['isbn']); if ($existBibid > 0) { for ($i = 0; $i < $one['amount']; $i++) { $bl->addCopy($existBibid); } $bl->setLookupStatus('copy', $one['isbn']); continue; } $list = $this->_getLookupServers(); $retry = false; if (!is_array($list) || count($list) < 1) { $bl->setLookupStatus('manual', $one['isbn'], $one['amount']); } foreach ($list as $server) { $result = $this->_getLookupResult($server, $one['isbn']); if (!$result || isset($result['error'])) { if (preg_match('/not connect/', $result['error']) || preg_match('/response error/', $result['error'])) { $retry = true; } continue; } $book = array('isbn' => $one['isbn'], 'data' => $result, 'amount' => $one['amount']); $this->_addResult($book); break; } if (isset($result['error'])) { $book = array('isbn' => $one['isbn'], 'data' => NULL); $this->_addResult($book); if ($retry) { $bl->setLookupStatus('retry', $one['isbn']); } else { $bl->setLookupStatus('manual', $one['isbn'], $one['amount']); } } } $bl->saveResults($this->_results); }
$total = $bl->countQueue('manual_list'); if (0 + $_GET['page'] < 1 || ($p - 1) * $limit >= $total) { $p = 1; } else { $p = 0 + $_GET['page']; } $bl->getManualList($limit, ($p - 1) * $limit); $rows = array(); while ($row = $bl->fetch()) { $rows[] = $row; } if (count($rows) < 1) { echo "<tr><td colspan=\"7\" class=\"primary\">" . $loc->getText('bulkReportNoItem') . "</td></tr>"; } foreach ($rows as $row) { $bibid = $bl->getExistBiblio($row['isbn']); $status = $bibid > 0 ? "yes" : "no"; echo "<tr>" . " <td class=\"primary\">{$row['isbn']}</td>" . " <td class=\"primary center\">{$row['hits']}</td>" . " <td class=\"primary\">{$row['created']}</td>" . " <td class=\"primary\"><a href=\"../catalog/biblio_new.php?isbn={$row['isbn']}&hits={$row['hits']}\">" . $loc->getText('add') . "</a></td>" . " <td class=\"primary\">" . " <a href=\"?del={$row['isbn']}&type=manual\" onclick=\"return confirm('" . $loc->getText('bulkReportConfirmRemoveISBN', array('isbn' => $row['isbn'])) . "')\">" . $loc->getText('remove') . "</a>" . " </td>" . ($bibid < 1 ? " <td class=\"primary\"> </td>" : " <td class=\"primary\">" . " <a href=\"../catalog/biblio_copy_new_form.php?bibid={$bibid}&isbn={$row['isbn']}&hits={$row['hits']}\">copy</a>" . " </td>") . " <td class=\"primary\">{$status}</td>" . "</tr>"; } ?> </table> <?php // Paging link if ($p > 1) { $prev = "<a href=\"?type=manual&page=" . ($p - 1) . "\">Previous</a>"; } if ($p * $limit < $total) { $next = "<a href=\"?type=manual&page=" . ($p + 1) . "\">Next</a>"; } echo $prev . ($prev && $next ? ' | ' : '') . $next;