diff --git a/modules/api/php/endpoints/project/project.class.inc b/modules/api/php/endpoints/project/project.class.inc index 0c57bfc981c..05d7ac75d11 100644 --- a/modules/api/php/endpoints/project/project.class.inc +++ b/modules/api/php/endpoints/project/project.class.inc @@ -101,24 +101,24 @@ class Project extends Endpoint implements \LORIS\Middleware\ETagCalculator // Delegate to sub-endpoints $subendpoint = array_shift($pathparts); switch($subendpoint) { - case 'candidates': - $handler = new Candidates($this->_project); - break; - case 'images': - $handler = new Images($this->_project); - break; - case 'instruments': - $handler = new Instruments($this->_project); - break; - case 'visits': - $handler = new Visits($this->_project); - break; - case 'recordings': - $handler = new Recordings($this->_project); - break; - case 'dicoms': - $handler = new Dicoms($this->_project); - break; + case 'candidates': + $handler = new Candidates($this->_project); + break; + case 'images': + $handler = new Images($this->_project); + break; + case 'instruments': + $handler = new Instruments($this->_project); + break; + case 'visits': + $handler = new Visits($this->_project); + break; + case 'recordings': + $handler = new Recordings($this->_project); + break; + case 'dicoms': + $handler = new Dicoms($this->_project); + break; default: return new \LORIS\Http\Response\JSON\NotFound(); } diff --git a/modules/api/php/models/projectdicomsrow.class.inc b/modules/api/php/models/projectdicomsrow.class.inc index fe20663c5d4..6871e1d0a56 100644 --- a/modules/api/php/models/projectdicomsrow.class.inc +++ b/modules/api/php/models/projectdicomsrow.class.inc @@ -33,14 +33,10 @@ class ProjectDicomsRow implements \LORIS\Data\DataInstance private $_scantype; private $_qcstatus; private $_selected; - /** - * @var mixed|null - */ private $_tarname; - /** - * @var mixed|null - */ private $_dicomarchiveid; + private $_source; + private $_archive; /** * Create a new ProjectDicomsRow @@ -49,21 +45,21 @@ class ProjectDicomsRow implements \LORIS\Data\DataInstance */ public function __construct(array $row) { - $this->_candid = $row['Candidate'] ?? null; - $this->_pscid = $row['PSCID'] ?? null; - $this->_entitytype = $row['Entity_type'] ?? null; - $this->_visitlabel = $row['Visit'] ?? null; - $this->_visitdate = $row['Visit_date'] ?? null; - $this->_centerid = $row['CenterID'] ?? null; - $this->_centername = $row['Site'] ?? null; - $this->_tarname = $row['tarchiveid'] ?? null; - $this->_dicomarchiveid = $row['DicomArchiveID'] ?? null; - $this->_source = $row['Source'] ?? null; - $this->_archive = $row['Archive'] ?? null; - $this->_inserttime = $row['InsertTime'] ?? null; - $this->_scantype = $row['ScanType'] ?? null; - $this->_qcstatus = $row['QC_status'] ?? null; - $this->_selected = $row['Selected'] ?? null; + $this->_candid = $row['Candidate'] ?? null; + $this->_pscid = $row['PSCID'] ?? null; + $this->_entitytype = $row['Entity_type'] ?? null; + $this->_visitlabel = $row['Visit'] ?? null; + $this->_visitdate = $row['Visit_date'] ?? null; + $this->_centerid = $row['CenterID'] ?? null; + $this->_centername = $row['Site'] ?? null; + $this->_tarname = $row['tarchiveid'] ?? null; + $this->_dicomarchiveid = $row['DicomArchiveID'] ?? null; + $this->_source = $row['Source'] ?? null; + $this->_archive = $row['Archive'] ?? null; + $this->_inserttime = $row['InsertTime'] ?? null; + $this->_scantype = $row['ScanType'] ?? null; + $this->_qcstatus = $row['QC_status'] ?? null; + $this->_selected = $row['Selected'] ?? null; } /** @@ -73,27 +69,26 @@ class ProjectDicomsRow implements \LORIS\Data\DataInstance */ public function toJSON() : string { - $obj = [ - 'Candidate' => $this->_candid, - 'PSCID' => $this->_pscid, - 'Visit' => $this->_visitlabel, - 'Visit_date' => $this->_visitdate, - 'Site' => $this->_centername, - 'InsertTime' => $this->_inserttime, - 'ScanType' => $this->_scantype, - 'QC_status' => $this->_qcstatus, - 'Selected' => $this->_selected, - 'TarchiveID' => $this->_tarname, - 'Source' => $this->_source, - 'Archive' => $this->_archive, - 'DicomArchiveID' => $this->_dicomarchiveid + $obj = [ + 'Candidate' => $this->_candid, + 'PSCID' => $this->_pscid, + 'Visit' => $this->_visitlabel, + 'Visit_date' => $this->_visitdate, + 'Site' => $this->_centername, + 'InsertTime' => $this->_inserttime, + 'ScanType' => $this->_scantype, + 'QC_status' => $this->_qcstatus, + 'Selected' => $this->_selected, + 'TarchiveID' => $this->_tarname, + 'Source' => $this->_source, + 'Archive' => $this->_archive, + 'DicomArchiveID' => $this->_dicomarchiveid ]; - $filename = explode('/', $this->_archive)[1]; - $candid = $obj['Candidate']; - $visit = $obj['Visit']; - - $obj['tarname'] = $filename; - $obj['Path'] = "/candidates/$candid/$visit/dicoms/$filename"; + $filename = explode('/', $this->_archive)[1]; + $candid = $obj['Candidate']; + $visit = $obj['Visit']; + $obj['tarname'] = $filename; + $obj['Path'] = "/candidates/$candid/$visit/dicoms/$filename"; $obj['InsertTime'] = date('c', (int) $obj['InsertTime']); return json_encode($obj); diff --git a/modules/api/php/provisioners/projectdicomsrowprovisioner.class.inc b/modules/api/php/provisioners/projectdicomsrowprovisioner.class.inc index 1f1a66e6e77..9e895da4c28 100644 --- a/modules/api/php/provisioners/projectdicomsrowprovisioner.class.inc +++ b/modules/api/php/provisioners/projectdicomsrowprovisioner.class.inc @@ -38,7 +38,7 @@ class ProjectDicomsRowProvisioner extends DBRowProvisioner */ function __construct(\Project $project, \DateTime $since) { - parent::__construct( + parent::__construct( ' SELECT s.CandID as Candidate,