function addFileToAcsServer() { global $configArray; require_once ROOT_DIR . '/sys/AdobeContentServer.php'; if (!isset($_REQUEST['filename'])) { return array('error' => 'Filename parameter was not provided. Please provide the filename in the library to add to the ACS server.'); } if (!isset($_REQUEST['availableCopies'])) { return array('error' => 'availableCopies parameter was not provided. Please provide the availableCopies in the library to add to the ACS server.'); } $filename = $_REQUEST['filename']; $availableCopies = $_REQUEST['availableCopies']; $fullFilename = $configArray['EContent']['library'] . '/' . $filename; if (!file_exists($fullFilename)) { return array('error' => 'Filename does not exist in the library. Unable to add to the ACS server.'); } $ret = AdobeContentServer::packageFile($fullFilename, '', 1, '', $availableCopies); return $ret; }
function update() { if ($this->reviewStatus == 0) { $this->reviewStatus = 'Not Reviewed'; } if ($this->getAccessType() == 'acs' && ($this->item_type == 'epub' || $this->item_type == 'pdf')) { require_once ROOT_DIR . '/sys/AdobeContentServer.php'; global $configArray; $uploadResults = AdobeContentServer::packageFile($configArray['EContent']['library'] . '/' . $this->filename, $this->recordId, $this->id, $this->acsId, $this->getAvailableCopies()); if ($uploadResults['success']) { $oldAcs = $this->acsId; $this->acsId = $uploadResults['acsId']; $fileUploaded = true; $deleteResults = AdobeContentServer::deleteResource($oldAcs); } else { $fileUploaded = false; } } $ret = parent::update(); if ($ret > 0) { //Make sure to also update the record this is attached to so the full text can be generated if ($this->item_type == 'epub' || $this->item_type == 'pdf') { $record = $this->getRecord(); $record->update(); } } return $ret; }