public function getMyTransactions($user) { $return = array(); $eContentCheckout = new EContentCheckout(); $eContentCheckout->userId = $user->id; $eContentCheckout->status = 'out'; $eContentCheckout->find(); $return['transactions'] = array(); $return['numTransactions'] = $eContentCheckout->find(); while ($eContentCheckout->fetch()) { $eContentRecord = new EContentRecord(); $eContentRecord->id = $eContentCheckout->recordId; if ($eContentRecord->find(true)) { $daysUntilDue = ceil(($eContentCheckout->dateDue - time()) / (24 * 60 * 60)); $overdue = $daysUntilDue < 0; $waitList = $this->getWaitList($eContentRecord->id); $links = $this->_getCheckedOutEContentLinks($eContentRecord, null, $eContentCheckout); //Get Ratings require_once ROOT_DIR . '/sys/eContent/EContentRating.php'; $econtentRating = new EContentRating(); $econtentRating->recordId = $eContentRecord->id; $ratingData = $econtentRating->getRatingData($user, false); $return['transactions'][] = array('id' => $eContentRecord->id, 'recordId' => 'econtentRecord' . $eContentRecord->id, 'source' => $eContentRecord->source, 'title' => $eContentRecord->title, 'author' => $eContentRecord->author, 'duedate' => $eContentCheckout->dateDue, 'checkoutdate' => $eContentCheckout->dateCheckedOut, 'daysUntilDue' => $daysUntilDue, 'holdQueueLength' => $waitList, 'links' => $links, 'ratingData' => $ratingData); } } return $return; }
public function getMyTransactions($user) { $return = array(); $eContentCheckout = new EContentCheckout(); $eContentCheckout->userId = $user->id; $eContentCheckout->status = 'out'; $eContentCheckout->find(); $return['transactions'] = array(); $return['numTransactions'] = $eContentCheckout->find(); while ($eContentCheckout->fetch()) { if ($eContentCheckout->protectionType == 'free') { require_once ROOT_DIR . '/RecordDrivers/PublicEContentDriver.php'; $recordDriver = new PublicEContentDriver($eContentCheckout->recordId); } else { require_once ROOT_DIR . '/RecordDrivers/RestrictedEContentDriver.php'; $recordDriver = new RestrictedEContentDriver($eContentCheckout->recordId); } if ($recordDriver->isValid()) { $daysUntilDue = ceil(($eContentCheckout->dateDue - time()) / (24 * 60 * 60)); $overdue = $daysUntilDue < 0; $items = $recordDriver->getItems(); if ($eContentCheckout->protectionType == 'free') { $links['return'] = array('text' => 'Return Now', 'onclick' => "if (confirm('Are you sure you want to cancel this hold?')){VuFind.LocalEContent.returnPublicEContent('{$eContentCheckout->recordId}', '{$eContentCheckout->itemId}')};return false;", 'typeReturn' => 0); } else { $links['return'] = array('text' => 'Return Now', 'onclick' => "if (confirm('Are you sure you want to cancel this hold?')){VuFind.LocalEContent.returnRestrictedEContent('{$eContentCheckout->recordId}', '{$eContentCheckout->itemId}')};return false;", 'typeReturn' => 0); } //Get Ratings $return['transactions'][] = array('id' => $eContentCheckout->recordId, 'groupedWorkId' => $recordDriver->getGroupedWorkId(), 'recordId' => $recordDriver->getUniqueID(), 'recordType' => $eContentCheckout->protectionType == 'free' ? 'PublicEContent' : 'RestrictedEContent', 'checkoutSource' => 'eContent', 'title' => $recordDriver->getTitle(), 'author' => $recordDriver->getPrimaryAuthor(), 'format' => $recordDriver->getFormatCategory(), 'duedate' => $eContentCheckout->dateDue, 'checkoutdate' => $eContentCheckout->dateCheckedOut, 'daysUntilDue' => $daysUntilDue, 'links' => $links, 'items' => $items, 'ratingData' => $recordDriver->getRatingData(), 'overdue' => $overdue, 'recordUrl' => $recordDriver->getLinkUrl(), 'bookcoverUrl' => $recordDriver->getBookcoverUrl('medium')); } } return $return; }