Example #1
0
 /**
  * Find. Wrapper for findByIdOrHandle
  * @param string $id
  * @param array $options
  * @param string $outputFormat
  * @param string $inputFormat
  * @return \Jisc\apiService\Jorum\Item $item
  *
  */
 public static function find($id = '', $options = array(), $outputFormat = '', $inputFormat)
 {
     $bitstream = new Bitstream($outputFormat, $inputFormat);
     return $bitstream->findByIdOrHandle($id, $options);
 }
Example #2
0
 /**
  * Get a stream from DSPACE and make it local (cache it)
  * @param Bitstream $bitstream
  * @return mixed
  */
 public static function makeLocal(Bitstream $bitstream)
 {
     $originalName = $bitstream->getName();
     $originalName = str_replace(array(' ', '/'), '_', $originalName);
     $filePath = public_path() . '/resourcecache/' . $originalName;
     if (!file_exists($filePath)) {
         $stream = $bitstream->retrieveStream();
         if (!file_exists(public_path() . '/resourcecache/' . $originalName)) {
             file_put_contents(public_path() . '/resourcecache/' . $originalName, $stream);
         }
     } else {
     }
     return $originalName;
 }