/** @return $scans [OmekaFile] Returns an array of OmekaFile representing the scans an AOI belongs to. */ public function getScans() { if ($this->scans === null) { $this->scans = array(); foreach ($this->getScanUrns() as $urn) { $file = OmekaFile::getFileFromDb($urn); if ($file !== null) { array_push($this->scans, $file); } } } return $this->scans; }
<?php /** This file is concerend with displaying a single OmekaFile. To do so, it expects a urn GET parameter to be given. If the urn parameter is missing, errors/noGet.php will be required. If the urn parameter is invalid, errors/invalidUrn.php will be required. Else the page will be displayed as expected. */ require_once 'config.php'; if (!isset($_GET['urn']) || !$_GET['urn']) { require 'errors/noGet.php'; } else { if (is_null(Config::getUserManager()->verify())) { require 'errors/loginRequired.php'; } else { $file = OmekaFile::getFileFromDb($_GET['urn']); if ($file === null) { require 'errors/invalidUrn.php'; } else { //We need to hand out some file info as JSON: $json = array(); //Function to add an OmekaFile $file to a $field String in the $json array. $addFile = function ($field, $file) use(&$json) { $arr = array('urn' => $file->getUrn(), 'img' => $file->getFullsizeFileUrl(), 'aois' => array()); foreach ($file->getAOIs() as $aoi) { $urn = $aoi->getUrn(); $arr['aois'][$urn] = $aoi->toArray(); } $json[$field] = $arr; }; //Adding {current, prev, main}: