@@ -39,20 +39,20 @@ discard block |
||
| 39 | 39 | //Set Time Limit at 3H as operation could be really long |
| 40 | 40 | set_time_limit(10800); |
| 41 | 41 | |
| 42 | - $this->client = new Client(); |
|
| 42 | + $this->client=new Client(); |
|
| 43 | 43 | //Set address of Orthanc server |
| 44 | 44 | if ($exposed) { |
| 45 | 45 | $this->url=GAELO_ORTHANC_EXPOSED_INTERNAL_ADDRESS.':'.GAELO_ORTHANC_EXPOSED_INTERNAL_PORT; |
| 46 | - $this->login = GAELO_ORTHANC_EXPOSED_INTERNAL_LOGIN; |
|
| 47 | - $this->password = GAELO_ORTHANC_EXPOSED_INTERNAL_PASSWORD; |
|
| 46 | + $this->login=GAELO_ORTHANC_EXPOSED_INTERNAL_LOGIN; |
|
| 47 | + $this->password=GAELO_ORTHANC_EXPOSED_INTERNAL_PASSWORD; |
|
| 48 | 48 | $this->context=array( |
| 49 | 49 | 'http' => array( |
| 50 | 50 | 'header' => "Authorization: Basic ".base64_encode(GAELO_ORTHANC_EXPOSED_INTERNAL_LOGIN.':'.GAELO_ORTHANC_EXPOSED_INTERNAL_PASSWORD) |
| 51 | 51 | )); |
| 52 | 52 | }else { |
| 53 | 53 | $this->url=GAELO_ORTHANC_PACS_ADDRESS.':'.GAELO_ORTHANC_PACS_PORT; |
| 54 | - $this->login = GAELO_ORTHANC_PACS_LOGIN; |
|
| 55 | - $this->password = GAELO_ORTHANC_PACS_PASSWORD; |
|
| 54 | + $this->login=GAELO_ORTHANC_PACS_LOGIN; |
|
| 55 | + $this->password=GAELO_ORTHANC_PACS_PASSWORD; |
|
| 56 | 56 | $this->context=array( |
| 57 | 57 | 'http' => array( |
| 58 | 58 | 'header' => "Authorization: Basic ".base64_encode(GAELO_ORTHANC_PACS_LOGIN.':'.GAELO_ORTHANC_PACS_PASSWORD) |
@@ -128,16 +128,16 @@ discard block |
||
| 128 | 128 | $uidList=array($uidList); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $options = [ |
|
| 131 | + $options=[ |
|
| 132 | 132 | 'auth' => [$this->login, $this->password], |
| 133 | 133 | 'headers' => ['content-type' => 'application/json', 'Accept' => 'application/zip'], |
| 134 | 134 | 'body' => json_encode(array('Transcode'=>'1.2.840.10008.1.2.1', 'Resources' => $uidList)), |
| 135 | 135 | 'stream' => true |
| 136 | 136 | ]; |
| 137 | 137 | |
| 138 | - $response = $this->client->request('POST', $this->url.'/tools/create-archive' , $options); |
|
| 138 | + $response=$this->client->request('POST', $this->url.'/tools/create-archive', $options); |
|
| 139 | 139 | |
| 140 | - $zipStream = $response->getBody(); |
|
| 140 | + $zipStream=$response->getBody(); |
|
| 141 | 141 | |
| 142 | 142 | return $zipStream; |
| 143 | 143 | } |
@@ -357,18 +357,18 @@ discard block |
||
| 357 | 357 | /** |
| 358 | 358 | * This method has the advantage to stream the content and avoid running out memory |
| 359 | 359 | */ |
| 360 | - public function importFileGuzzle(string $file){ |
|
| 361 | - try{ |
|
| 362 | - $body = fopen($file, 'r'); |
|
| 360 | + public function importFileGuzzle(string $file) { |
|
| 361 | + try { |
|
| 362 | + $body=fopen($file, 'r'); |
|
| 363 | 363 | |
| 364 | - $options = ['auth' => [$this->login, $this->password], |
|
| 364 | + $options=['auth' => [$this->login, $this->password], |
|
| 365 | 365 | 'headers' => ['content-type' => 'application/dicom', 'Accept' => 'application/json'], |
| 366 | 366 | 'body' => $body]; |
| 367 | 367 | |
| 368 | - $response = $this->client->request('POST', $this->url.'/instances' , $options); |
|
| 368 | + $response=$this->client->request('POST', $this->url.'/instances', $options); |
|
| 369 | 369 | |
| 370 | - return (string) $response->getBody(); |
|
| 371 | - } catch (Exception $e1) { |
|
| 370 | + return (string)$response->getBody(); |
|
| 371 | + }catch (Exception $e1) { |
|
| 372 | 372 | error_log("Error during import Dcm ".$e1->getMessage()); |
| 373 | 373 | } |
| 374 | 374 | } |
@@ -39,19 +39,18 @@ discard block |
||
| 39 | 39 | $json=json_decode($postdata, true); |
| 40 | 40 | //SK ICI VERIFIER QUE LES id SONT BIEN DE L ETUDE AVEC LES DROITS ? Securite |
| 41 | 41 | $ids=$json['json']; |
| 42 | -} |
|
| 43 | -else if ($_SESSION['role'] == User::REVIEWER) { |
|
| 42 | +} else if ($_SESSION['role'] == User::REVIEWER) { |
|
| 44 | 43 | $permissionCheck=$userObject->isVisitAllowed($_POST['id_visit'], $_SESSION['role']); |
| 45 | 44 | $visitObject=new Visit($_POST['id_visit'], $linkpdo); |
| 46 | 45 | $ids=$visitObject->getSeriesOrthancID(); |
| 47 | 46 | |
| 48 | -}else if ($_SESSION['role'] == User::CONTROLLER) { |
|
| 47 | +} else if ($_SESSION['role'] == User::CONTROLLER) { |
|
| 49 | 48 | $permissionCheck=$userObject->isVisitAllowed($_POST['id_visit'], $_SESSION['role']); |
| 50 | 49 | $visitObject=new Visit($_POST['id_visit'], $linkpdo); |
| 51 | 50 | if (in_array($visitObject->qcStatus, array(Visit::QC_NOT_DONE, Visit::QC_WAIT_DEFINITVE_CONCLUSION))) { |
| 52 | 51 | $ids=$visitObject->getSeriesOrthancID(); |
| 53 | 52 | } |
| 54 | -}else if ($_SESSION['role'] == User::INVESTIGATOR) { |
|
| 53 | +} else if ($_SESSION['role'] == User::INVESTIGATOR) { |
|
| 55 | 54 | $permissionCheck=$userObject->isVisitAllowed($_POST['id_visit'], $_SESSION['role']); |
| 56 | 55 | $visitObject=new Visit($_POST['id_visit'], $linkpdo); |
| 57 | 56 | if ($visitObject->uploadStatus == Visit::DONE) { |
@@ -75,7 +74,7 @@ discard block |
||
| 75 | 74 | $date=Date('Ymd_his'); |
| 76 | 75 | header('Content-Disposition: attachment; filename="Dicom-'.$_SESSION['study'].'_'.$date.'.zip"'); |
| 77 | 76 | //For reviewer file name is identified by study_visit |
| 78 | - }else { |
|
| 77 | + } else { |
|
| 79 | 78 | $name=$_SESSION['study'].$visitObject->visitType; |
| 80 | 79 | header('Content-Disposition: attachment; filename="Dicom'.$name.'.zip"'); |
| 81 | 80 | } |
@@ -84,7 +83,7 @@ discard block |
||
| 84 | 83 | echo $zipStream->read(512); |
| 85 | 84 | } |
| 86 | 85 | |
| 87 | -}else { |
|
| 86 | +} else { |
|
| 88 | 87 | header('HTTP/1.0 403 Forbidden'); |
| 89 | 88 | die('You are not allowed to access this file.'); |
| 90 | 89 | } |
| 91 | 90 | \ No newline at end of file |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | echo $zipStream->read(512); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | -} else { |
|
| 50 | +}else { |
|
| 51 | 51 | header('HTTP/1.0 403 Forbidden'); |
| 52 | 52 | die('You are not allowed to access this file.'); |
| 53 | 53 | } |
| 54 | 54 | \ No newline at end of file |