@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function __construct($seriesOrthancID, $url, $context) { |
| 53 | 53 | //Set Orthanc http address |
| 54 | 54 | $this->url=$url; |
| 55 | - $this->context = $context; |
|
| 55 | + $this->context=$context; |
|
| 56 | 56 | |
| 57 | 57 | //Set the current serie's Orthanc ID |
| 58 | 58 | $this->serieOrthancID=$seriesOrthancID; |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | *Get Series related data and store them in this object |
| 63 | 63 | */ |
| 64 | - public function retrieveSeriesData(){ |
|
| 65 | - $context = stream_context_create($this->context); |
|
| 64 | + public function retrieveSeriesData() { |
|
| 65 | + $context=stream_context_create($this->context); |
|
| 66 | 66 | //Store all shared tags |
| 67 | - $this->sharedTags = json_decode(file_get_contents($this->url.'/series/'.$this->serieOrthancID.'/shared-tags', false, $context)); |
|
| 67 | + $this->sharedTags=json_decode(file_get_contents($this->url.'/series/'.$this->serieOrthancID.'/shared-tags', false, $context)); |
|
| 68 | 68 | //parse main series informations |
| 69 | - $json = file_get_contents($this->url.'/series/'.$this->serieOrthancID, false, $context); |
|
| 69 | + $json=file_get_contents($this->url.'/series/'.$this->serieOrthancID, false, $context); |
|
| 70 | 70 | $seriesJson=json_decode($json, true); |
| 71 | 71 | //add needed informations in the current object |
| 72 | 72 | $this->seriesManufacturer=$seriesJson['MainDicomTags']['Manufacturer']; |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | /** |
| 94 | 94 | * Get statistics of the series (size in MB) |
| 95 | 95 | */ |
| 96 | - private function retrieveSeriesStatistics(){ |
|
| 97 | - $context = stream_context_create($this->context); |
|
| 98 | - $json = file_get_contents($this->url.'/series/'.$this->serieOrthancID.'/statistics/', false, $context); |
|
| 96 | + private function retrieveSeriesStatistics() { |
|
| 97 | + $context=stream_context_create($this->context); |
|
| 98 | + $json=file_get_contents($this->url.'/series/'.$this->serieOrthancID.'/statistics/', false, $context); |
|
| 99 | 99 | $statisticsJson=json_decode($json, true); |
| 100 | 100 | $this->diskSizeMb=$statisticsJson['DiskSizeMB']; |
| 101 | 101 | $this->uncompressedSizeMb=$statisticsJson['UncompressedSizeMB']; |
@@ -106,16 +106,16 @@ discard block |
||
| 106 | 106 | * Store some data only available in the Instance level |
| 107 | 107 | * @param $instanceID |
| 108 | 108 | */ |
| 109 | - private function retrieveInstancesData($instanceID){ |
|
| 110 | - $context = stream_context_create($this->context); |
|
| 111 | - $json = file_get_contents($this->url.'/instances/'.$instanceID.'/tags/', false, $context); |
|
| 109 | + private function retrieveInstancesData($instanceID) { |
|
| 110 | + $context=stream_context_create($this->context); |
|
| 111 | + $json=file_get_contents($this->url.'/instances/'.$instanceID.'/tags/', false, $context); |
|
| 112 | 112 | $instanceJson=json_decode($json, true); |
| 113 | 113 | $this->patientWeight=$instanceJson['0010,1030']['Value']; |
| 114 | 114 | $this->seriesModelName=$instanceJson['0008,1090']['Value']; |
| 115 | 115 | $this->injectedDose=$instanceJson['0054,0016']['Value'][0]['0018,1074']['Value']; |
| 116 | 116 | //SK InjectedTime est deprecie en faveur de DateTime, A surveiller pour la suite |
| 117 | - $this->injectedTime=$instanceJson['0054,0016']['Value'][0]['0018,1072']['Value'] ; |
|
| 118 | - $this->injectedDateTime=$instanceJson['0054,0016']['Value'][0]['0018,1078']['Value'] ; |
|
| 117 | + $this->injectedTime=$instanceJson['0054,0016']['Value'][0]['0018,1072']['Value']; |
|
| 118 | + $this->injectedDateTime=$instanceJson['0054,0016']['Value'][0]['0018,1078']['Value']; |
|
| 119 | 119 | $this->injectedActivity=$instanceJson['0054,0016']['Value'][0]['0018,1077']['Value']; |
| 120 | 120 | $this->radiopharmaceutical=$instanceJson['0054,0016']['Value'][0]['0018,0031']['Value']; |
| 121 | 121 | $this->halfLife=$instanceJson['0054,0016']['Value'][0]['0018,1075']['Value']; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | if (in_array($this->sopClassUid, $scUids)) { |
| 145 | 145 | return true; |
| 146 | - } else { |
|
| 146 | + }else { |
|
| 147 | 147 | return false; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public $replyTo; |
| 35 | 35 | |
| 36 | - public function __construct(PDO $linkpdo){ |
|
| 37 | - $this->linkpdo= $linkpdo; |
|
| 36 | + public function __construct(PDO $linkpdo) { |
|
| 37 | + $this->linkpdo=$linkpdo; |
|
| 38 | 38 | |
| 39 | 39 | $this->smtp_config=array( |
| 40 | 40 | 'useSMTP'=> GAELO_USE_SMTP, |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * Set the message to send (will be included in the HTML template) |
| 59 | 59 | */ |
| 60 | - public function setMessage(string $message){ |
|
| 60 | + public function setMessage(string $message) { |
|
| 61 | 61 | $this->message=$message; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function setSubject(String $subject){ |
|
| 64 | + public function setSubject(String $subject) { |
|
| 65 | 65 | $this->subject=$subject; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -73,28 +73,28 @@ discard block |
||
| 73 | 73 | * @param string $replyTo , optional, to allow a direct response to the user sending email |
| 74 | 74 | * @return string |
| 75 | 75 | */ |
| 76 | - public function sendEmail(){ |
|
| 76 | + public function sendEmail() { |
|
| 77 | 77 | |
| 78 | - $mail = new PHPMailer(true); // Passing `true` enables exceptions |
|
| 79 | - $mail->CharSet = 'UTF-8'; |
|
| 78 | + $mail=new PHPMailer(true); // Passing `true` enables exceptions |
|
| 79 | + $mail->CharSet='UTF-8'; |
|
| 80 | 80 | |
| 81 | 81 | //Recipients |
| 82 | - if($this->smtp_config['useSMTP']){ |
|
| 83 | - $mail->IsSMTP(); // Set mailer to use SMTP |
|
| 84 | - $mail->Host = $this->smtp_config['host']; // Specify main and backup server |
|
| 85 | - $mail->Port = $this->smtp_config['port']; // Set the SMTP port |
|
| 86 | - $mail->SMTPAuth = true; // Enable SMTP authentication |
|
| 87 | - $mail->Username = $this->smtp_config['user']; // SMTP username |
|
| 88 | - $mail->Password = $this->smtp_config['password']; // SMTP password |
|
| 89 | - $mail->SMTPSecure = $this->smtp_config['SMTPSecure']; |
|
| 90 | - }else{ |
|
| 82 | + if ($this->smtp_config['useSMTP']) { |
|
| 83 | + $mail->IsSMTP(); // Set mailer to use SMTP |
|
| 84 | + $mail->Host=$this->smtp_config['host']; // Specify main and backup server |
|
| 85 | + $mail->Port=$this->smtp_config['port']; // Set the SMTP port |
|
| 86 | + $mail->SMTPAuth=true; // Enable SMTP authentication |
|
| 87 | + $mail->Username=$this->smtp_config['user']; // SMTP username |
|
| 88 | + $mail->Password=$this->smtp_config['password']; // SMTP password |
|
| 89 | + $mail->SMTPSecure=$this->smtp_config['SMTPSecure']; |
|
| 90 | + }else { |
|
| 91 | 91 | //Add DKIM private key if exist |
| 92 | - if(file_exists($_SERVER['DOCUMENT_ROOT'].'/data/_config/dkim.private')){ |
|
| 93 | - $mail->DKIM_domain = GAELO_WEB_ADDRESS; |
|
| 94 | - $mail->DKIM_private = $_SERVER['DOCUMENT_ROOT'].'/data/_config/dkim.private'; |
|
| 95 | - $mail->DKIM_selector = 'mail'; |
|
| 96 | - $mail->DKIM_passphrase = ''; |
|
| 97 | - $mail->DKIM_identity = $mail->From; |
|
| 92 | + if (file_exists($_SERVER['DOCUMENT_ROOT'].'/data/_config/dkim.private')) { |
|
| 93 | + $mail->DKIM_domain=GAELO_WEB_ADDRESS; |
|
| 94 | + $mail->DKIM_private=$_SERVER['DOCUMENT_ROOT'].'/data/_config/dkim.private'; |
|
| 95 | + $mail->DKIM_selector='mail'; |
|
| 96 | + $mail->DKIM_passphrase=''; |
|
| 97 | + $mail->DKIM_identity=$mail->From; |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -102,31 +102,31 @@ discard block |
||
| 102 | 102 | $mail->setFrom($this->adminEmail, $this->corporation, true); |
| 103 | 103 | |
| 104 | 104 | //Add Reply To |
| 105 | - try{ |
|
| 105 | + try { |
|
| 106 | 106 | $mail->addReplyTo($this->replyTo); |
| 107 | - }catch (Exception $e){ |
|
| 107 | + }catch (Exception $e) { |
|
| 108 | 108 | error_log("Reply to email problem".$e->getMessage()); |
| 109 | 109 | return false; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | //Add destinators |
| 113 | - if (sizeof($this->emailsDestinators)>1){ |
|
| 114 | - foreach ($this->emailsDestinators as $value){ |
|
| 115 | - try{ |
|
| 113 | + if (sizeof($this->emailsDestinators) > 1) { |
|
| 114 | + foreach ($this->emailsDestinators as $value) { |
|
| 115 | + try { |
|
| 116 | 116 | $mail->addBCC($value); |
| 117 | - }catch (Exception $e){ |
|
| 117 | + }catch (Exception $e) { |
|
| 118 | 118 | error_log('error adding email'.$e->getMessage()); |
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | //Add message to mail object |
| 122 | 122 | $this->buildMessage($mail); |
| 123 | - } else if(sizeof($this->emailsDestinators) == 1){ |
|
| 123 | + }else if (sizeof($this->emailsDestinators) == 1) { |
|
| 124 | 124 | //If only one add regular adress |
| 125 | - try{ |
|
| 125 | + try { |
|
| 126 | 126 | $mail->addAddress($this->emailsDestinators[0]); |
| 127 | 127 | $userObject=User::getUserByEmail($this->emailsDestinators[0], $this->linkpdo); |
| 128 | 128 | $this->buildMessage($mail, $userObject->lastName, $userObject->firstName); |
| 129 | - }catch (Exception $e){ |
|
| 129 | + }catch (Exception $e) { |
|
| 130 | 130 | error_log('error adding email'.$e->getMessage()); |
| 131 | 131 | return false; |
| 132 | 132 | } |
@@ -135,12 +135,12 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | //Content |
| 138 | - $mail->isHTML(true); // Set email format to HTML |
|
| 139 | - $mail->Subject = $this->corporation.' Imaging Platform -' . $this->subject; |
|
| 140 | - try{ |
|
| 138 | + $mail->isHTML(true); // Set email format to HTML |
|
| 139 | + $mail->Subject=$this->corporation.' Imaging Platform -'.$this->subject; |
|
| 140 | + try { |
|
| 141 | 141 | $answer=$mail->send(); |
| 142 | 142 | return $answer; |
| 143 | - }catch (Exception $e){ |
|
| 143 | + }catch (Exception $e) { |
|
| 144 | 144 | error_log("Message could not be sent. Mailer Error: {$mail->ErrorInfo}"); |
| 145 | 145 | return false; |
| 146 | 146 | } |
@@ -148,15 +148,15 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - private function buildMessage(PHPMailer $mail, $lastName=null, $firstName=null){ |
|
| 151 | + private function buildMessage(PHPMailer $mail, $lastName=null, $firstName=null) { |
|
| 152 | 152 | |
| 153 | - if($lastName==null && $firstName==null){ |
|
| 153 | + if ($lastName == null && $firstName == null) { |
|
| 154 | 154 | $nameString="user"; |
| 155 | - }else{ |
|
| 155 | + }else { |
|
| 156 | 156 | $nameString=$firstName.' '.$lastName; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - $messageToSend = |
|
| 159 | + $messageToSend= |
|
| 160 | 160 | '<!doctype html> <html lang="en"> |
| 161 | 161 | <head> |
| 162 | 162 | <meta charset="utf-8"> |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | $messageToSend=str_replace(array("\r", "\n"), '', $messageToSend); |
| 208 | 208 | |
| 209 | 209 | //Prepare Html2PlainText for email validity (both version to enhance spam validation) |
| 210 | - $htmlMessageObject = new \Html2Text\Html2Text($messageToSend); |
|
| 211 | - $mail->Body = $messageToSend; |
|
| 212 | - $mail->AltBody = $htmlMessageObject->getText(); |
|
| 210 | + $htmlMessageObject=new \Html2Text\Html2Text($messageToSend); |
|
| 211 | + $mail->Body=$messageToSend; |
|
| 212 | + $mail->AltBody=$htmlMessageObject->getText(); |
|
| 213 | 213 | $mail->AddEmbeddedImage($_SERVER['DOCUMENT_ROOT'].'/assets/images/gaelo-logo-square.png', 'logo_gaelo'); |
| 214 | 214 | |
| 215 | 215 | |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | /** |
| 219 | 219 | * Retrieve all emails of Admins users |
| 220 | 220 | */ |
| 221 | - public function getAdminsEmails(){ |
|
| 222 | - $connecter = $this->linkpdo->prepare('SELECT email FROM users WHERE is_administrator=1 AND status!="Deactivated"'); |
|
| 221 | + public function getAdminsEmails() { |
|
| 222 | + $connecter=$this->linkpdo->prepare('SELECT email FROM users WHERE is_administrator=1 AND status!="Deactivated"'); |
|
| 223 | 223 | $connecter->execute(); |
| 224 | 224 | $adminResult=$connecter->fetchAll(PDO::FETCH_COLUMN); |
| 225 | 225 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * @param string $username |
| 232 | 232 | * @return string email |
| 233 | 233 | */ |
| 234 | - public function getUserEmails(string $username){ |
|
| 234 | + public function getUserEmails(string $username) { |
|
| 235 | 235 | $userObject=new User($username, $this->linkpdo); |
| 236 | 236 | return $userObject->userEmail; |
| 237 | 237 | } |
@@ -243,15 +243,15 @@ discard block |
||
| 243 | 243 | * @param string $study |
| 244 | 244 | * @return array mails |
| 245 | 245 | */ |
| 246 | - public function getRolesEmails( string $study, string $role){ |
|
| 247 | - $connecter = $this->linkpdo->prepare('SELECT users.email FROM roles, users |
|
| 246 | + public function getRolesEmails(string $study, string $role) { |
|
| 247 | + $connecter=$this->linkpdo->prepare('SELECT users.email FROM roles, users |
|
| 248 | 248 | WHERE roles.study=:study |
| 249 | 249 | AND roles.username=users.username |
| 250 | 250 | AND roles.name=:role |
| 251 | 251 | AND users.status!="Deactivated"'); |
| 252 | 252 | $connecter->execute(array( |
| 253 | 253 | 'study'=>$study, |
| 254 | - 'role'=>$role) ); |
|
| 254 | + 'role'=>$role)); |
|
| 255 | 255 | |
| 256 | 256 | $results=$connecter->fetchAll(PDO::FETCH_COLUMN); |
| 257 | 257 | return $results; |
@@ -294,15 +294,15 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function selectInvestigatorsEmailsWithSameCenter(String $study, int $center, ?array $job=null) : Send_Email { |
| 296 | 296 | //Select All users that has a matching center |
| 297 | - $users =$this->getUsersAffiliatedToCenter($center); |
|
| 297 | + $users=$this->getUsersAffiliatedToCenter($center); |
|
| 298 | 298 | //For each user check that we match role requirement (array if investigator), string if monitor or supervisor |
| 299 | - foreach ($users as $user){ |
|
| 299 | + foreach ($users as $user) { |
|
| 300 | 300 | |
| 301 | - if( is_array($job) && !in_array($user->userJob, $job)){ |
|
| 301 | + if (is_array($job) && !in_array($user->userJob, $job)) { |
|
| 302 | 302 | continue; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - if($user->isRoleAllowed($study, User::INVESTIGATOR)){ |
|
| 305 | + if ($user->isRoleAllowed($study, User::INVESTIGATOR)) { |
|
| 306 | 306 | $this->addEmail($user->userEmail); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | public function addEmails(Array $emails) : Send_Email{ |
| 323 | 323 | |
| 324 | - foreach($emails as $email){ |
|
| 324 | + foreach ($emails as $email) { |
|
| 325 | 325 | if (!in_array($email, $this->emailsDestinators)) |
| 326 | 326 | { |
| 327 | - $this->emailsDestinators[] = $email; |
|
| 327 | + $this->emailsDestinators[]=$email; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | } |
@@ -344,55 +344,55 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | if (!in_array($email, $this->emailsDestinators)) |
| 346 | 346 | { |
| 347 | - $this->emailsDestinators[] = $email; |
|
| 347 | + $this->emailsDestinators[]=$email; |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | return $this; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - public function sendModifyUserMessage($username, $newPassword){ |
|
| 353 | + public function sendModifyUserMessage($username, $newPassword) { |
|
| 354 | 354 | |
| 355 | - $message = "Your account password is reset. Please log in at: ".$this->webAddress."<br> |
|
| 355 | + $message="Your account password is reset. Please log in at: ".$this->webAddress."<br> |
|
| 356 | 356 | Username : $username<br> |
| 357 | 357 | Temporary password : $newPassword<br> |
| 358 | 358 | You will be asked to change this password at your first log in attempt<br> |
| 359 | 359 | on the platform.<br>"; |
| 360 | 360 | |
| 361 | 361 | $this->setMessage($message); |
| 362 | - $this->subject= 'Reactivation'; |
|
| 362 | + $this->subject='Reactivation'; |
|
| 363 | 363 | $this->sendEmail(); |
| 364 | 364 | |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - public function sendNewAccountMessage($username, $password) { |
|
| 367 | + public function sendNewAccountMessage($username, $password) { |
|
| 368 | 368 | |
| 369 | - $message = "Your account is created for the upload platform used to exchange |
|
| 370 | - imaging data. Please log in at: " . $this->webAddress . " <br> |
|
| 369 | + $message="Your account is created for the upload platform used to exchange |
|
| 370 | + imaging data. Please log in at: " . $this->webAddress." <br> |
|
| 371 | 371 | Username : $username<br> |
| 372 | 372 | Temporary password : $password<br> |
| 373 | 373 | You will be asked to change this password at your first log in attempt |
| 374 | 374 | on the platform.<br><br>"; |
| 375 | 375 | |
| 376 | 376 | $this->setMessage($message); |
| 377 | - $this->subject= 'New account'; |
|
| 377 | + $this->subject='New account'; |
|
| 378 | 378 | $this->sendEmail(); |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - public function sendNewPasswordEmail($username, $password){ |
|
| 381 | + public function sendNewPasswordEmail($username, $password) { |
|
| 382 | 382 | |
| 383 | - $message = "This automatic e-mail contains your new temporary password for your |
|
| 383 | + $message="This automatic e-mail contains your new temporary password for your |
|
| 384 | 384 | user account.<br> |
| 385 | 385 | Username : ".$username." <br> |
| 386 | 386 | Temporary password : ".$password." <br> |
| 387 | 387 | You will be asked to change this password at your first connection.<br>"; |
| 388 | 388 | |
| 389 | 389 | $this->setMessage($message); |
| 390 | - $this->subject= 'New Password'; |
|
| 390 | + $this->subject='New Password'; |
|
| 391 | 391 | $this->sendEmail(); |
| 392 | 392 | |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - public function sendQCDesicionEmail(String $controlDecision, String $study, String $patientCode, String $visitType, $formDecision, $formComment, $imageDecision, $imageComment){ |
|
| 395 | + public function sendQCDesicionEmail(String $controlDecision, String $study, String $patientCode, String $visitType, $formDecision, $formComment, $imageDecision, $imageComment) { |
|
| 396 | 396 | $message="Quality Control of the following visit has been set to : ".$controlDecision."<br> |
| 397 | 397 | Study : ".$study."<br> |
| 398 | 398 | Patient Number : ".$patientCode."<br> |
@@ -401,89 +401,89 @@ discard block |
||
| 401 | 401 | Image Series : ".$imageDecision." Comment :".$imageComment." <br>"; |
| 402 | 402 | |
| 403 | 403 | $this->setMessage($message); |
| 404 | - $this->subject= 'Quality Control'; |
|
| 404 | + $this->subject='Quality Control'; |
|
| 405 | 405 | $this->sendEmail(); |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - public function sendBlockedAccountNoPasswordChangeEmail($username, $linkedStudy){ |
|
| 408 | + public function sendBlockedAccountNoPasswordChangeEmail($username, $linkedStudy) { |
|
| 409 | 409 | |
| 410 | - $message = "The password change request cannot be done because the account is Deactivated<br> |
|
| 410 | + $message="The password change request cannot be done because the account is Deactivated<br> |
|
| 411 | 411 | Username : ".$username."<br> |
| 412 | 412 | The account is linked to the following studies:".implode(',', $linkedStudy)."<br> |
| 413 | 413 | Please contact the ".$this->corporation." to activate your account:<br> |
| 414 | 414 | ".$this->adminEmail."<br>"; |
| 415 | 415 | |
| 416 | 416 | $this->setMessage($message); |
| 417 | - $this->subject= 'Blocked account'; |
|
| 417 | + $this->subject='Blocked account'; |
|
| 418 | 418 | $this->sendEmail(); |
| 419 | 419 | |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - public function sendAdminLoggedAlertEmail($username, $remoteAdress){ |
|
| 422 | + public function sendAdminLoggedAlertEmail($username, $remoteAdress) { |
|
| 423 | 423 | $message='the Admin user '.$username.' logged in from '.$remoteAdress.' |
| 424 | 424 | <br> Please review this activity'; |
| 425 | 425 | $this->setMessage($message); |
| 426 | - $this->subject= "Admin Logged In"; |
|
| 426 | + $this->subject="Admin Logged In"; |
|
| 427 | 427 | $this->sendEmail(); |
| 428 | 428 | |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - public function sendUnlockRequestMessage(String $role, String $username, String $visitType, $patientNum, String $study, String $request){ |
|
| 432 | - $message = "An Unlock " . $role . " form Request was emitted by " . $username . |
|
| 433 | - " for the " . $visitType . |
|
| 434 | - " visit of patient " . $patientNum . |
|
| 435 | - " in Study " . $study . "<br> |
|
| 436 | - Reason for request: " . $request . " <br>"; |
|
| 431 | + public function sendUnlockRequestMessage(String $role, String $username, String $visitType, $patientNum, String $study, String $request) { |
|
| 432 | + $message="An Unlock ".$role." form Request was emitted by ".$username. |
|
| 433 | + " for the ".$visitType. |
|
| 434 | + " visit of patient ".$patientNum. |
|
| 435 | + " in Study ".$study."<br> |
|
| 436 | + Reason for request: " . $request." <br>"; |
|
| 437 | 437 | $this->setMessage($message); |
| 438 | - $this->subject= 'Ask Unlock'; |
|
| 438 | + $this->subject='Ask Unlock'; |
|
| 439 | 439 | $this->sendEmail(); |
| 440 | 440 | |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - public function sendReviewReadyMessage(String $study, int $patientCode, String $visitType){ |
|
| 443 | + public function sendReviewReadyMessage(String $study, int $patientCode, String $visitType) { |
|
| 444 | 444 | $message="The following visit is ready for review in the platform: <br> |
| 445 | 445 | Study : ".$study."<br> |
| 446 | 446 | Patient Number : ".$patientCode."<br> |
| 447 | 447 | Visit : ".$visitType."<br>"; |
| 448 | 448 | $this->setMessage($message); |
| 449 | - $this->subject= "Awaiting Review"; |
|
| 449 | + $this->subject="Awaiting Review"; |
|
| 450 | 450 | $this->sendEmail(); |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - public function sendCorrectiveActionDoneMessage(bool $done, String $study, int $patientCode, String $visitType){ |
|
| 453 | + public function sendCorrectiveActionDoneMessage(bool $done, String $study, int $patientCode, String $visitType) { |
|
| 454 | 454 | |
| 455 | - if (! $done) { |
|
| 456 | - $message = "No corrective action could be applied on the following visit: <br> |
|
| 457 | - Study : " . $study . "<br> |
|
| 458 | - Patient Number : " . $patientCode . "<br> |
|
| 459 | - Uploaded visit : " . $visitType . "<br>"; |
|
| 455 | + if (!$done) { |
|
| 456 | + $message="No corrective action could be applied on the following visit: <br> |
|
| 457 | + Study : " . $study."<br> |
|
| 458 | + Patient Number : " . $patientCode."<br> |
|
| 459 | + Uploaded visit : " . $visitType."<br>"; |
|
| 460 | 460 | } |
| 461 | 461 | else { |
| 462 | - $message = "A corrective action was applied on the following visit: <br> |
|
| 463 | - Study : " . $study . "<br> |
|
| 464 | - Patient Number : " . $patientCode . "<br> |
|
| 465 | - Uploaded visit : " . $visitType . "<br>"; |
|
| 462 | + $message="A corrective action was applied on the following visit: <br> |
|
| 463 | + Study : " . $study."<br> |
|
| 464 | + Patient Number : " . $patientCode."<br> |
|
| 465 | + Uploaded visit : " . $visitType."<br>"; |
|
| 466 | 466 | |
| 467 | 467 | } |
| 468 | 468 | $this->setMessage($message); |
| 469 | - $this->subject= "Corrective Action"; |
|
| 469 | + $this->subject="Corrective Action"; |
|
| 470 | 470 | $this->sendEmail(); |
| 471 | 471 | |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - public function sendRequestMessage(String $name, String $email, String $center, String $request){ |
|
| 475 | - $message = "The following request was sent and will be processed as soon as possible:<br> |
|
| 474 | + public function sendRequestMessage(String $name, String $email, String $center, String $request) { |
|
| 475 | + $message="The following request was sent and will be processed as soon as possible:<br> |
|
| 476 | 476 | Name : ".$name."<br> |
| 477 | 477 | E-mail : ".$email."<br> |
| 478 | 478 | Investigational center : ".$center."<br> |
| 479 | 479 | Request : ".$request."<br>"; |
| 480 | 480 | |
| 481 | 481 | $this->setMessage($message); |
| 482 | - $this->subject= "Request"; |
|
| 482 | + $this->subject="Request"; |
|
| 483 | 483 | $this->sendEmail(); |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | - public function sendAwaitingAdjudicationMessage(String $study, int $patientCode , String $visitType){ |
|
| 486 | + public function sendAwaitingAdjudicationMessage(String $study, int $patientCode, String $visitType) { |
|
| 487 | 487 | $message="Review of the following visit is awaiting adjudication <br> |
| 488 | 488 | Study : ".$study."<br> |
| 489 | 489 | Patient Number : ".$patientCode."<br> |
@@ -491,47 +491,47 @@ discard block |
||
| 491 | 491 | The visit is awaiting for your adjudication review"; |
| 492 | 492 | |
| 493 | 493 | $this->setMessage($message); |
| 494 | - $this->subject= "Awaiting Adjudication"; |
|
| 494 | + $this->subject="Awaiting Adjudication"; |
|
| 495 | 495 | $this->sendEmail(); |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | - public function sendVisitConcludedMessage(String $study, int $patientCode, String $visitType, $conclusionValue){ |
|
| 498 | + public function sendVisitConcludedMessage(String $study, int $patientCode, String $visitType, $conclusionValue) { |
|
| 499 | 499 | $message="Review of the following visit is concluded <br> |
| 500 | 500 | Study : ".$study."<br> |
| 501 | 501 | Patient Number : ".$patientCode."<br> |
| 502 | 502 | Visit : ".$visitType."<br> |
| 503 | - Conclusion Value : ".$conclusionValue ; |
|
| 503 | + Conclusion Value : ".$conclusionValue; |
|
| 504 | 504 | |
| 505 | 505 | $this->setMessage($message); |
| 506 | - $this->subject= "Visit Concluded"; |
|
| 506 | + $this->subject="Visit Concluded"; |
|
| 507 | 507 | $this->sendEmail(); |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - public function sendBlockedAccountNotification($username, $studies){ |
|
| 511 | - $message = 'The following user account is blocked after too many bad password |
|
| 510 | + public function sendBlockedAccountNotification($username, $studies) { |
|
| 511 | + $message='The following user account is blocked after too many bad password |
|
| 512 | 512 | attempts.<br> |
| 513 | 513 | Username : '.$username.'<br> |
| 514 | 514 | The account is linked to the following studies:<br> |
| 515 | 515 | '. implode('<br>', $studies).' </br>'; |
| 516 | 516 | |
| 517 | 517 | $this->setMessage($message); |
| 518 | - $this->subject= "Account Blocked"; |
|
| 518 | + $this->subject="Account Blocked"; |
|
| 519 | 519 | $this->sendEmail(); |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | - public function sendUploadedVisitMessage($study, $patientCode, $visitType){ |
|
| 523 | - $message = "The following visit has been uploaded on the platform: <br> |
|
| 522 | + public function sendUploadedVisitMessage($study, $patientCode, $visitType) { |
|
| 523 | + $message="The following visit has been uploaded on the platform: <br> |
|
| 524 | 524 | Study : ".$study."<br> |
| 525 | 525 | Patient Number : ".$patientCode."<br> |
| 526 | 526 | Uploaded visit : ".$visitType."<br>"; |
| 527 | 527 | |
| 528 | 528 | $this->setMessage($message); |
| 529 | - $this->subject= "New upload"; |
|
| 529 | + $this->subject="New upload"; |
|
| 530 | 530 | $this->sendEmail(); |
| 531 | 531 | |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - public function sendDeletedFormMessage(String $study, String $patientCode, String $visitType){ |
|
| 534 | + public function sendDeletedFormMessage(String $study, String $patientCode, String $visitType) { |
|
| 535 | 535 | $message="Your form sent for study : ".$study."<br> |
| 536 | 536 | Patient : ".$patientCode."<br> |
| 537 | 537 | Visit : ".$visitType." <br> |
@@ -539,12 +539,12 @@ discard block |
||
| 539 | 539 | You can now resend a new version of this form <br>"; |
| 540 | 540 | |
| 541 | 541 | $this->setMessage($message); |
| 542 | - $this->subject= "Form Deleted"; |
|
| 542 | + $this->subject="Form Deleted"; |
|
| 543 | 543 | $this->sendEmail(); |
| 544 | 544 | |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | - public function sendUnlockedFormMessage(String $study, String $patientCode, String $visitType){ |
|
| 547 | + public function sendUnlockedFormMessage(String $study, String $patientCode, String $visitType) { |
|
| 548 | 548 | $message="Your form sent for study : ".$study."<br> |
| 549 | 549 | Patient : ".$patientCode."<br> |
| 550 | 550 | Visit : ".$visitType." <br> |
@@ -552,12 +552,12 @@ discard block |
||
| 552 | 552 | You can now resend a new version of this form <br>"; |
| 553 | 553 | |
| 554 | 554 | $this->setMessage($message); |
| 555 | - $this->subject= "Form Unlocked"; |
|
| 555 | + $this->subject="Form Unlocked"; |
|
| 556 | 556 | $this->sendEmail(); |
| 557 | 557 | |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - public function sendUploadValidationFailure($idVisit, $patientCode, String $visitType, String $study, String $zipPath, String $username, String $errorMessage){ |
|
| 560 | + public function sendUploadValidationFailure($idVisit, $patientCode, String $visitType, String $study, String $zipPath, String $username, String $errorMessage) { |
|
| 561 | 561 | $message="An Import Error occured during validation of upload <br> |
| 562 | 562 | Visit ID : ".$idVisit."<br> |
| 563 | 563 | Patient Code : ".$patientCode."<br> |
@@ -565,14 +565,14 @@ discard block |
||
| 565 | 565 | Study : ".$study."<br> |
| 566 | 566 | zipPath : ".$zipPath."<br> |
| 567 | 567 | username: ".$username."<br> |
| 568 | - error : ".$errorMessage."<br>" ; |
|
| 568 | + error : ".$errorMessage."<br>"; |
|
| 569 | 569 | |
| 570 | 570 | $this->setMessage($message); |
| 571 | - $this->subject= "Error During Import"; |
|
| 571 | + $this->subject="Error During Import"; |
|
| 572 | 572 | $this->sendEmail(); |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - public function sendCreatedNotDoneVisitNotification($patientCode, $study, $visitType, $creatorUser){ |
|
| 575 | + public function sendCreatedNotDoneVisitNotification($patientCode, $study, $visitType, $creatorUser) { |
|
| 576 | 576 | $message="A Not Done visit has been created <br> |
| 577 | 577 | Patient Number : ".$patientCode."<br> |
| 578 | 578 | Study : ".$study."<br> |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | Creating Username : ".$creatorUser."<br>"; |
| 581 | 581 | |
| 582 | 582 | $this->setMessage($message); |
| 583 | - $this->subject= "Visit Not Done"; |
|
| 583 | + $this->subject="Visit Not Done"; |
|
| 584 | 584 | $this->sendEmail(); |
| 585 | 585 | } |
| 586 | 586 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $mail->Username = $this->smtp_config['user']; // SMTP username |
| 88 | 88 | $mail->Password = $this->smtp_config['password']; // SMTP password |
| 89 | 89 | $mail->SMTPSecure = $this->smtp_config['SMTPSecure']; |
| 90 | - }else{ |
|
| 90 | + } else{ |
|
| 91 | 91 | //Add DKIM private key if exist |
| 92 | 92 | if(file_exists($_SERVER['DOCUMENT_ROOT'].'/data/_config/dkim.private')){ |
| 93 | 93 | $mail->DKIM_domain = GAELO_WEB_ADDRESS; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | //Add Reply To |
| 105 | 105 | try{ |
| 106 | 106 | $mail->addReplyTo($this->replyTo); |
| 107 | - }catch (Exception $e){ |
|
| 107 | + } catch (Exception $e){ |
|
| 108 | 108 | error_log("Reply to email problem".$e->getMessage()); |
| 109 | 109 | return false; |
| 110 | 110 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | foreach ($this->emailsDestinators as $value){ |
| 115 | 115 | try{ |
| 116 | 116 | $mail->addBCC($value); |
| 117 | - }catch (Exception $e){ |
|
| 117 | + } catch (Exception $e){ |
|
| 118 | 118 | error_log('error adding email'.$e->getMessage()); |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $mail->addAddress($this->emailsDestinators[0]); |
| 127 | 127 | $userObject=User::getUserByEmail($this->emailsDestinators[0], $this->linkpdo); |
| 128 | 128 | $this->buildMessage($mail, $userObject->lastName, $userObject->firstName); |
| 129 | - }catch (Exception $e){ |
|
| 129 | + } catch (Exception $e){ |
|
| 130 | 130 | error_log('error adding email'.$e->getMessage()); |
| 131 | 131 | return false; |
| 132 | 132 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | try{ |
| 141 | 141 | $answer=$mail->send(); |
| 142 | 142 | return $answer; |
| 143 | - }catch (Exception $e){ |
|
| 143 | + } catch (Exception $e){ |
|
| 144 | 144 | error_log("Message could not be sent. Mailer Error: {$mail->ErrorInfo}"); |
| 145 | 145 | return false; |
| 146 | 146 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | if($lastName==null && $firstName==null){ |
| 154 | 154 | $nameString="user"; |
| 155 | - }else{ |
|
| 155 | + } else{ |
|
| 156 | 156 | $nameString=$firstName.' '.$lastName; |
| 157 | 157 | } |
| 158 | 158 | |
@@ -457,8 +457,7 @@ discard block |
||
| 457 | 457 | Study : " . $study . "<br> |
| 458 | 458 | Patient Number : " . $patientCode . "<br> |
| 459 | 459 | Uploaded visit : " . $visitType . "<br>"; |
| 460 | - } |
|
| 461 | - else { |
|
| 460 | + } else { |
|
| 462 | 461 | $message = "A corrective action was applied on the following visit: <br> |
| 463 | 462 | Study : " . $study . "<br> |
| 464 | 463 | Patient Number : " . $patientCode . "<br> |
@@ -52,234 +52,234 @@ discard block |
||
| 52 | 52 | AND study = :study |
| 53 | 53 | GROUP BY patients.code'); |
| 54 | 54 | |
| 55 | - $patients->execute(array( |
|
| 56 | - 'username' => $username, |
|
| 57 | - 'study' => $this->study |
|
| 58 | - )); |
|
| 55 | + $patients->execute(array( |
|
| 56 | + 'username' => $username, |
|
| 57 | + 'study' => $this->study |
|
| 58 | + )); |
|
| 59 | 59 | |
| 60 | - $patientsCodes=$patients->fetchAll(PDO::FETCH_COLUMN); |
|
| 60 | + $patientsCodes=$patients->fetchAll(PDO::FETCH_COLUMN); |
|
| 61 | 61 | |
| 62 | - $patientObjectsArray=[]; |
|
| 62 | + $patientObjectsArray=[]; |
|
| 63 | 63 | |
| 64 | - foreach ($patientsCodes as $patientCode) { |
|
| 65 | - $patientObjectsArray[]=new Patient($patientCode, $this->linkpdo); |
|
| 66 | - } |
|
| 64 | + foreach ($patientsCodes as $patientCode) { |
|
| 65 | + $patientObjectsArray[]=new Patient($patientCode, $this->linkpdo); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - return $patientObjectsArray; |
|
| 69 | - } |
|
| 68 | + return $patientObjectsArray; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - public function getAllCreatedVisits(bool $deleted=false) { |
|
| 71 | + public function getAllCreatedVisits(bool $deleted=false) { |
|
| 72 | 72 | |
| 73 | - $possibleStudyGroups=$this->getAllPossibleVisitGroups(); |
|
| 73 | + $possibleStudyGroups=$this->getAllPossibleVisitGroups(); |
|
| 74 | 74 | |
| 75 | - $visitsObjectArray=[]; |
|
| 75 | + $visitsObjectArray=[]; |
|
| 76 | 76 | |
| 77 | - foreach ($possibleStudyGroups as $studyGroup) { |
|
| 78 | - $createdVisits=$studyGroup->getStudyVisitManager()->getCreatedVisits($deleted); |
|
| 79 | - array_push($visitsObjectArray, ...$createdVisits); |
|
| 80 | - } |
|
| 77 | + foreach ($possibleStudyGroups as $studyGroup) { |
|
| 78 | + $createdVisits=$studyGroup->getStudyVisitManager()->getCreatedVisits($deleted); |
|
| 79 | + array_push($visitsObjectArray, ...$createdVisits); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - return $visitsObjectArray; |
|
| 82 | + return $visitsObjectArray; |
|
| 83 | 83 | |
| 84 | - } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - public function getAllAwaitingUploadImagingVisit() { |
|
| 86 | + public function getAllAwaitingUploadImagingVisit() { |
|
| 87 | 87 | |
| 88 | - $possibleStudyGroups=$this->getAllPossibleVisitGroups(); |
|
| 89 | - $visitsObjectArray=[]; |
|
| 88 | + $possibleStudyGroups=$this->getAllPossibleVisitGroups(); |
|
| 89 | + $visitsObjectArray=[]; |
|
| 90 | 90 | |
| 91 | - foreach ($possibleStudyGroups as $studyGroup) { |
|
| 92 | - if (in_array($studyGroup->groupModality, array(Visit_Group::GROUP_MODALITY_CT, Visit_Group::GROUP_MODALITY_MR, Visit_Group::GROUP_MODALITY_PET))) { |
|
| 93 | - $awaitingUploadVisits=$studyGroup->getStudyVisitManager()->getAwaitingUploadVisit(); |
|
| 94 | - array_push($visitsObjectArray, ...$awaitingUploadVisits); |
|
| 95 | - } |
|
| 91 | + foreach ($possibleStudyGroups as $studyGroup) { |
|
| 92 | + if (in_array($studyGroup->groupModality, array(Visit_Group::GROUP_MODALITY_CT, Visit_Group::GROUP_MODALITY_MR, Visit_Group::GROUP_MODALITY_PET))) { |
|
| 93 | + $awaitingUploadVisits=$studyGroup->getStudyVisitManager()->getAwaitingUploadVisit(); |
|
| 94 | + array_push($visitsObjectArray, ...$awaitingUploadVisits); |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | 97 | |
| 98 | - } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - return $visitsObjectArray; |
|
| 100 | + return $visitsObjectArray; |
|
| 101 | 101 | |
| 102 | - } |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - public function getAllAwaitingReviewImagingVisit($username=null) { |
|
| 104 | + public function getAllAwaitingReviewImagingVisit($username=null) { |
|
| 105 | 105 | |
| 106 | - $possibleStudyGroups=$this->getAllPossibleVisitGroups(); |
|
| 107 | - $visitsObjectArray=[]; |
|
| 106 | + $possibleStudyGroups=$this->getAllPossibleVisitGroups(); |
|
| 107 | + $visitsObjectArray=[]; |
|
| 108 | 108 | |
| 109 | - foreach ($possibleStudyGroups as $studyGroup) { |
|
| 110 | - if (in_array($studyGroup->groupModality, array(Visit_Group::GROUP_MODALITY_CT, Visit_Group::GROUP_MODALITY_MR, Visit_Group::GROUP_MODALITY_PET))) { |
|
| 111 | - $awaitingReviewVisits=$studyGroup->getStudyVisitManager()->getAwaitingReviewVisit($username); |
|
| 112 | - array_push($visitsObjectArray, ...$awaitingReviewVisits); |
|
| 113 | - } |
|
| 109 | + foreach ($possibleStudyGroups as $studyGroup) { |
|
| 110 | + if (in_array($studyGroup->groupModality, array(Visit_Group::GROUP_MODALITY_CT, Visit_Group::GROUP_MODALITY_MR, Visit_Group::GROUP_MODALITY_PET))) { |
|
| 111 | + $awaitingReviewVisits=$studyGroup->getStudyVisitManager()->getAwaitingReviewVisit($username); |
|
| 112 | + array_push($visitsObjectArray, ...$awaitingReviewVisits); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | - } |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - return $visitsObjectArray; |
|
| 118 | + return $visitsObjectArray; |
|
| 119 | 119 | |
| 120 | - } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - public function getAllUploadedImagingVisits() { |
|
| 122 | + public function getAllUploadedImagingVisits() { |
|
| 123 | 123 | |
| 124 | - $possibleStudyGroups=$this->getAllPossibleVisitGroups(); |
|
| 125 | - $visitsObjectArray=[]; |
|
| 124 | + $possibleStudyGroups=$this->getAllPossibleVisitGroups(); |
|
| 125 | + $visitsObjectArray=[]; |
|
| 126 | 126 | |
| 127 | - foreach ($possibleStudyGroups as $studyGroup) { |
|
| 128 | - if (in_array($studyGroup->groupModality, array(Visit_Group::GROUP_MODALITY_CT, Visit_Group::GROUP_MODALITY_MR, Visit_Group::GROUP_MODALITY_PET))) { |
|
| 129 | - $uploadedVisits=$studyGroup->getStudyVisitManager()->getUploadedVisits(); |
|
| 130 | - array_push($visitsObjectArray, ...$uploadedVisits); |
|
| 131 | - } |
|
| 127 | + foreach ($possibleStudyGroups as $studyGroup) { |
|
| 128 | + if (in_array($studyGroup->groupModality, array(Visit_Group::GROUP_MODALITY_CT, Visit_Group::GROUP_MODALITY_MR, Visit_Group::GROUP_MODALITY_PET))) { |
|
| 129 | + $uploadedVisits=$studyGroup->getStudyVisitManager()->getUploadedVisits(); |
|
| 130 | + array_push($visitsObjectArray, ...$uploadedVisits); |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | 133 | |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - return $visitsObjectArray; |
|
| 136 | + return $visitsObjectArray; |
|
| 137 | 137 | |
| 138 | - } |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - public function isHavingAwaitingReviewImagingVisit($username=null) { |
|
| 141 | - $awaitingVisits=$this->getAllAwaitingReviewImagingVisit($username); |
|
| 142 | - $havingAwaitingReview=(sizeof($awaitingVisits) > 0); |
|
| 143 | - return $havingAwaitingReview; |
|
| 144 | - } |
|
| 140 | + public function isHavingAwaitingReviewImagingVisit($username=null) { |
|
| 141 | + $awaitingVisits=$this->getAllAwaitingReviewImagingVisit($username); |
|
| 142 | + $havingAwaitingReview=(sizeof($awaitingVisits) > 0); |
|
| 143 | + return $havingAwaitingReview; |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | |
| 148 | - public function getAllPossibleVisitGroups() { |
|
| 148 | + public function getAllPossibleVisitGroups() { |
|
| 149 | 149 | |
| 150 | - $allGroupsType=$this->linkpdo->prepare('SELECT id FROM visit_group WHERE study = :study'); |
|
| 151 | - $allGroupsType->execute(array('study' => $this->study)); |
|
| 152 | - $allGroupsIds=$allGroupsType->fetchall(PDO::FETCH_COLUMN); |
|
| 150 | + $allGroupsType=$this->linkpdo->prepare('SELECT id FROM visit_group WHERE study = :study'); |
|
| 151 | + $allGroupsType->execute(array('study' => $this->study)); |
|
| 152 | + $allGroupsIds=$allGroupsType->fetchall(PDO::FETCH_COLUMN); |
|
| 153 | 153 | |
| 154 | - $visitGroupArray=[]; |
|
| 155 | - foreach ($allGroupsIds as $groupId) { |
|
| 156 | - $visitGroupArray[]=new Visit_Group($this->linkpdo, $groupId); |
|
| 157 | - } |
|
| 154 | + $visitGroupArray=[]; |
|
| 155 | + foreach ($allGroupsIds as $groupId) { |
|
| 156 | + $visitGroupArray[]=new Visit_Group($this->linkpdo, $groupId); |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - return $visitGroupArray; |
|
| 159 | + return $visitGroupArray; |
|
| 160 | 160 | |
| 161 | - } |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - public function getSpecificGroup(String $groupModality) : Visit_Group { |
|
| 163 | + public function getSpecificGroup(String $groupModality) : Visit_Group { |
|
| 164 | 164 | |
| 165 | - $groupQuery=$this->linkpdo->prepare('SELECT id FROM visit_group WHERE study = :study AND group_modality=:groupModality'); |
|
| 166 | - $groupQuery->execute(array('study' => $this->study, 'groupModality'=> $groupModality)); |
|
| 167 | - $groupId=$groupQuery->fetch(PDO::FETCH_COLUMN); |
|
| 165 | + $groupQuery=$this->linkpdo->prepare('SELECT id FROM visit_group WHERE study = :study AND group_modality=:groupModality'); |
|
| 166 | + $groupQuery->execute(array('study' => $this->study, 'groupModality'=> $groupModality)); |
|
| 167 | + $groupId=$groupQuery->fetch(PDO::FETCH_COLUMN); |
|
| 168 | 168 | |
| 169 | - return new Visit_Group($this->linkpdo, $groupId); |
|
| 169 | + return new Visit_Group($this->linkpdo, $groupId); |
|
| 170 | 170 | |
| 171 | - } |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - public function getStudySpecificGroupManager(String $groupModality) : Group_Visit_Manager { |
|
| 173 | + public function getStudySpecificGroupManager(String $groupModality) : Group_Visit_Manager { |
|
| 174 | 174 | |
| 175 | - $visitGroup=$this->getSpecificGroup($groupModality); |
|
| 175 | + $visitGroup=$this->getSpecificGroup($groupModality); |
|
| 176 | 176 | |
| 177 | - return new Group_Visit_Manager($this, $visitGroup, $this->linkpdo); |
|
| 177 | + return new Group_Visit_Manager($this, $visitGroup, $this->linkpdo); |
|
| 178 | 178 | |
| 179 | - } |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - public function getReviewManager() : Study_Review_Manager { |
|
| 182 | - return new Study_Review_Manager($this); |
|
| 183 | - } |
|
| 181 | + public function getReviewManager() : Study_Review_Manager { |
|
| 182 | + return new Study_Review_Manager($this); |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - public function getExportStudyData() : Export_Study_Data{ |
|
| 186 | - return new Export_Study_Data($this); |
|
| 187 | - } |
|
| 185 | + public function getExportStudyData() : Export_Study_Data{ |
|
| 186 | + return new Export_Study_Data($this); |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | - public function getAllPatientsInStudy() { |
|
| 190 | - $allPatientQuery=$this->linkpdo->prepare('SELECT code FROM patients WHERE study = :study'); |
|
| 191 | - $allPatientQuery->execute(array('study' => $this->study)); |
|
| 192 | - $allPatients=$allPatientQuery->fetchall(PDO::FETCH_COLUMN); |
|
| 189 | + public function getAllPatientsInStudy() { |
|
| 190 | + $allPatientQuery=$this->linkpdo->prepare('SELECT code FROM patients WHERE study = :study'); |
|
| 191 | + $allPatientQuery->execute(array('study' => $this->study)); |
|
| 192 | + $allPatients=$allPatientQuery->fetchall(PDO::FETCH_COLUMN); |
|
| 193 | 193 | |
| 194 | - $patientObjectArray=[]; |
|
| 195 | - foreach ($allPatients as $patient) { |
|
| 196 | - $patientObjectArray[]=new Patient($patient, $this->linkpdo); |
|
| 197 | - } |
|
| 194 | + $patientObjectArray=[]; |
|
| 195 | + foreach ($allPatients as $patient) { |
|
| 196 | + $patientObjectArray[]=new Patient($patient, $this->linkpdo); |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - return $patientObjectArray; |
|
| 199 | + return $patientObjectArray; |
|
| 200 | 200 | |
| 201 | - } |
|
| 201 | + } |
|
| 202 | 202 | |
| 203 | - public function getDocumentation(String $role){ |
|
| 204 | - if($role==User::SUPERVISOR){ |
|
| 205 | - $documentationQuery = $this->linkpdo->prepare("SELECT id_documentation FROM documentation |
|
| 203 | + public function getDocumentation(String $role){ |
|
| 204 | + if($role==User::SUPERVISOR){ |
|
| 205 | + $documentationQuery = $this->linkpdo->prepare("SELECT id_documentation FROM documentation |
|
| 206 | 206 | WHERE study = :study"); |
| 207 | 207 | |
| 208 | - } else{ |
|
| 209 | - $documentationQuery = $this->linkpdo->prepare("SELECT id_documentation FROM documentation |
|
| 208 | + } else{ |
|
| 209 | + $documentationQuery = $this->linkpdo->prepare("SELECT id_documentation FROM documentation |
|
| 210 | 210 | WHERE study = :study |
| 211 | 211 | AND ".$role."= 1 AND deleted=0"); |
| 212 | 212 | |
| 213 | - } |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - $documentationQuery->execute(array('study' => $this->study)); |
|
| 216 | - $documentationAnswers=$documentationQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 215 | + $documentationQuery->execute(array('study' => $this->study)); |
|
| 216 | + $documentationAnswers=$documentationQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 217 | 217 | |
| 218 | - $documentationObjects=[]; |
|
| 219 | - foreach ($documentationAnswers as $documentationId) { |
|
| 220 | - $documentationObjects[]=new Documentation($this->linkpdo, $documentationId); |
|
| 221 | - } |
|
| 222 | - return $documentationObjects; |
|
| 223 | - } |
|
| 218 | + $documentationObjects=[]; |
|
| 219 | + foreach ($documentationAnswers as $documentationId) { |
|
| 220 | + $documentationObjects[]=new Documentation($this->linkpdo, $documentationId); |
|
| 221 | + } |
|
| 222 | + return $documentationObjects; |
|
| 223 | + } |
|
| 224 | 224 | |
| 225 | - /** |
|
| 226 | - * Return userObject array for all users having role in the study |
|
| 227 | - * @return User[] |
|
| 228 | - */ |
|
| 229 | - public function getUsersWithRoleInStudy() { |
|
| 230 | - $req=$this->linkpdo->prepare('SELECT DISTINCT users.username FROM roles,users |
|
| 225 | + /** |
|
| 226 | + * Return userObject array for all users having role in the study |
|
| 227 | + * @return User[] |
|
| 228 | + */ |
|
| 229 | + public function getUsersWithRoleInStudy() { |
|
| 230 | + $req=$this->linkpdo->prepare('SELECT DISTINCT users.username FROM roles,users |
|
| 231 | 231 | WHERE roles.username=users.username |
| 232 | 232 | AND roles.study=:study'); |
| 233 | - $req->execute(array('study' => $this->study)); |
|
| 234 | - $answers=$req->fetchAll(PDO::FETCH_COLUMN); |
|
| 233 | + $req->execute(array('study' => $this->study)); |
|
| 234 | + $answers=$req->fetchAll(PDO::FETCH_COLUMN); |
|
| 235 | 235 | |
| 236 | - $usersObjects=[]; |
|
| 237 | - foreach ($answers as $username) { |
|
| 238 | - $usersObjects[]=new User($username, $this->linkpdo); |
|
| 239 | - } |
|
| 240 | - return $usersObjects; |
|
| 236 | + $usersObjects=[]; |
|
| 237 | + foreach ($answers as $username) { |
|
| 238 | + $usersObjects[]=new User($username, $this->linkpdo); |
|
| 239 | + } |
|
| 240 | + return $usersObjects; |
|
| 241 | 241 | |
| 242 | - } |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | - public function getUsersByRoleInStudy(String $role) { |
|
| 245 | - $req=$this->linkpdo->prepare('SELECT username FROM roles |
|
| 244 | + public function getUsersByRoleInStudy(String $role) { |
|
| 245 | + $req=$this->linkpdo->prepare('SELECT username FROM roles |
|
| 246 | 246 | WHERE study=:study AND name=:role '); |
| 247 | - $req->execute(array('study' => $this->study, 'role'=>$role)); |
|
| 248 | - $answers=$req->fetchAll(PDO::FETCH_COLUMN); |
|
| 247 | + $req->execute(array('study' => $this->study, 'role'=>$role)); |
|
| 248 | + $answers=$req->fetchAll(PDO::FETCH_COLUMN); |
|
| 249 | 249 | |
| 250 | - $usersObjects=[]; |
|
| 251 | - foreach ($answers as $username) { |
|
| 252 | - $usersObjects[]=new User($username, $this->linkpdo); |
|
| 253 | - } |
|
| 254 | - return $usersObjects; |
|
| 250 | + $usersObjects=[]; |
|
| 251 | + foreach ($answers as $username) { |
|
| 252 | + $usersObjects[]=new User($username, $this->linkpdo); |
|
| 253 | + } |
|
| 254 | + return $usersObjects; |
|
| 255 | 255 | |
| 256 | - } |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | - public function getAllRolesByUsers() { |
|
| 259 | - $roles_query=$this->linkpdo->prepare('SELECT * FROM roles WHERE study=:study'); |
|
| 260 | - $roles_query->execute(array('study'=>$this->study)); |
|
| 261 | - $definedRoles=$roles_query->fetchall(PDO::FETCH_ASSOC); |
|
| 258 | + public function getAllRolesByUsers() { |
|
| 259 | + $roles_query=$this->linkpdo->prepare('SELECT * FROM roles WHERE study=:study'); |
|
| 260 | + $roles_query->execute(array('study'=>$this->study)); |
|
| 261 | + $definedRoles=$roles_query->fetchall(PDO::FETCH_ASSOC); |
|
| 262 | 262 | |
| 263 | - foreach ($definedRoles as $role) { |
|
| 264 | - $rolesList[$role['username']][]=$role['name']; |
|
| 265 | - } |
|
| 266 | - return $rolesList; |
|
| 267 | - } |
|
| 268 | - |
|
| 269 | - public function getStatistics(String $modality) { |
|
| 270 | - return new Statistics($this, $modality); |
|
| 271 | - } |
|
| 263 | + foreach ($definedRoles as $role) { |
|
| 264 | + $rolesList[$role['username']][]=$role['name']; |
|
| 265 | + } |
|
| 266 | + return $rolesList; |
|
| 267 | + } |
|
| 268 | + |
|
| 269 | + public function getStatistics(String $modality) { |
|
| 270 | + return new Statistics($this, $modality); |
|
| 271 | + } |
|
| 272 | 272 | |
| 273 | - public function changeStudyActivation(bool $activated) { |
|
| 274 | - $req=$this->linkpdo->prepare('UPDATE studies SET |
|
| 273 | + public function changeStudyActivation(bool $activated) { |
|
| 274 | + $req=$this->linkpdo->prepare('UPDATE studies SET |
|
| 275 | 275 | active = :active |
| 276 | 276 | WHERE name = :study'); |
| 277 | - $req->execute(array('study'=> $this->study, 'active'=>intval($activated))); |
|
| 278 | - } |
|
| 277 | + $req->execute(array('study'=> $this->study, 'active'=>intval($activated))); |
|
| 278 | + } |
|
| 279 | 279 | |
| 280 | - public function isOriginalOrthancNeverKnown($anonFromOrthancStudyId) { |
|
| 280 | + public function isOriginalOrthancNeverKnown($anonFromOrthancStudyId) { |
|
| 281 | 281 | |
| 282 | - $connecter=$this->linkpdo->prepare('SELECT Study_Orthanc_ID FROM visits |
|
| 282 | + $connecter=$this->linkpdo->prepare('SELECT Study_Orthanc_ID FROM visits |
|
| 283 | 283 | INNER JOIN visit_type ON |
| 284 | 284 | (visit_type.id=visits.visit_type_id |
| 285 | 285 | AND visit_type.group_id IN (SELECT id FROM visit_group WHERE study = :study)) |
@@ -287,30 +287,30 @@ discard block |
||
| 287 | 287 | AND orthanc_studies.Anon_From_Orthanc_ID=:Anon_From_Orthanc_ID |
| 288 | 288 | AND orthanc_studies.deleted=0 |
| 289 | 289 | AND visits.deleted=0' |
| 290 | - ); |
|
| 291 | - $connecter->execute(array( |
|
| 292 | - "study" => $this->study, |
|
| 293 | - "Anon_From_Orthanc_ID"=>$anonFromOrthancStudyId |
|
| 294 | - )); |
|
| 295 | - $result = $connecter->fetchAll(PDO::FETCH_COLUMN); |
|
| 290 | + ); |
|
| 291 | + $connecter->execute(array( |
|
| 292 | + "study" => $this->study, |
|
| 293 | + "Anon_From_Orthanc_ID"=>$anonFromOrthancStudyId |
|
| 294 | + )); |
|
| 295 | + $result = $connecter->fetchAll(PDO::FETCH_COLUMN); |
|
| 296 | 296 | |
| 297 | - if(count($result)>0) { |
|
| 298 | - return false; |
|
| 299 | - } else { |
|
| 300 | - return true; |
|
| 301 | - } |
|
| 297 | + if(count($result)>0) { |
|
| 298 | + return false; |
|
| 299 | + } else { |
|
| 300 | + return true; |
|
| 301 | + } |
|
| 302 | 302 | |
| 303 | - } |
|
| 303 | + } |
|
| 304 | 304 | |
| 305 | - public static function createStudy(string $studyName, $patientCodePrefix, PDO $linkpdo){ |
|
| 305 | + public static function createStudy(string $studyName, $patientCodePrefix, PDO $linkpdo){ |
|
| 306 | 306 | |
| 307 | - $req = $linkpdo->prepare('INSERT INTO studies (name, patient_code_prefix) VALUES(:studyName, :patientCodePrefix) '); |
|
| 307 | + $req = $linkpdo->prepare('INSERT INTO studies (name, patient_code_prefix) VALUES(:studyName, :patientCodePrefix) '); |
|
| 308 | 308 | |
| 309 | - $req->execute(array( |
|
| 310 | - 'studyName' => $studyName, |
|
| 311 | - 'patientCodePrefix' => $patientCodePrefix |
|
| 312 | - )); |
|
| 309 | + $req->execute(array( |
|
| 310 | + 'studyName' => $studyName, |
|
| 311 | + 'patientCodePrefix' => $patientCodePrefix |
|
| 312 | + )); |
|
| 313 | 313 | |
| 314 | - } |
|
| 314 | + } |
|
| 315 | 315 | |
| 316 | 316 | } |
| 317 | 317 | \ No newline at end of file |
@@ -23,24 +23,24 @@ discard block |
||
| 23 | 23 | public $study; |
| 24 | 24 | public $patientCodePrefix; |
| 25 | 25 | |
| 26 | - public function __construct(String $study, PDO $linkpdo){ |
|
| 26 | + public function __construct(String $study, PDO $linkpdo) { |
|
| 27 | 27 | |
| 28 | 28 | $this->linkpdo=$linkpdo; |
| 29 | - $connecter = $this->linkpdo->prepare('SELECT * FROM studies WHERE name=:study'); |
|
| 29 | + $connecter=$this->linkpdo->prepare('SELECT * FROM studies WHERE name=:study'); |
|
| 30 | 30 | $connecter->execute(array( |
| 31 | 31 | "study" => $study, |
| 32 | 32 | )); |
| 33 | - $result = $connecter->fetch(PDO::FETCH_ASSOC); |
|
| 33 | + $result=$connecter->fetch(PDO::FETCH_ASSOC); |
|
| 34 | 34 | |
| 35 | 35 | $this->study=$result['name']; |
| 36 | - $this->patientCodePrefix = $result['patient_code_prefix']; |
|
| 36 | + $this->patientCodePrefix=$result['patient_code_prefix']; |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function getPatientsLinkedToUserCenters($username) |
| 42 | 42 | { |
| 43 | - $patients = $this->linkpdo->prepare(' SELECT patients.code |
|
| 43 | + $patients=$this->linkpdo->prepare(' SELECT patients.code |
|
| 44 | 44 | FROM patients |
| 45 | 45 | WHERE patients.center IN (SELECT affiliated_centers.center |
| 46 | 46 | FROM affiliated_centers |
@@ -200,13 +200,13 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - public function getDocumentation(String $role){ |
|
| 204 | - if($role==User::SUPERVISOR){ |
|
| 205 | - $documentationQuery = $this->linkpdo->prepare("SELECT id_documentation FROM documentation |
|
| 203 | + public function getDocumentation(String $role) { |
|
| 204 | + if ($role == User::SUPERVISOR) { |
|
| 205 | + $documentationQuery=$this->linkpdo->prepare("SELECT id_documentation FROM documentation |
|
| 206 | 206 | WHERE study = :study"); |
| 207 | 207 | |
| 208 | - } else{ |
|
| 209 | - $documentationQuery = $this->linkpdo->prepare("SELECT id_documentation FROM documentation |
|
| 208 | + }else { |
|
| 209 | + $documentationQuery=$this->linkpdo->prepare("SELECT id_documentation FROM documentation |
|
| 210 | 210 | WHERE study = :study |
| 211 | 211 | AND ".$role."= 1 AND deleted=0"); |
| 212 | 212 | |
@@ -292,19 +292,19 @@ discard block |
||
| 292 | 292 | "study" => $this->study, |
| 293 | 293 | "Anon_From_Orthanc_ID"=>$anonFromOrthancStudyId |
| 294 | 294 | )); |
| 295 | - $result = $connecter->fetchAll(PDO::FETCH_COLUMN); |
|
| 295 | + $result=$connecter->fetchAll(PDO::FETCH_COLUMN); |
|
| 296 | 296 | |
| 297 | - if(count($result)>0) { |
|
| 297 | + if (count($result) > 0) { |
|
| 298 | 298 | return false; |
| 299 | - } else { |
|
| 299 | + }else { |
|
| 300 | 300 | return true; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - public static function createStudy(string $studyName, $patientCodePrefix, PDO $linkpdo){ |
|
| 305 | + public static function createStudy(string $studyName, $patientCodePrefix, PDO $linkpdo) { |
|
| 306 | 306 | |
| 307 | - $req = $linkpdo->prepare('INSERT INTO studies (name, patient_code_prefix) VALUES(:studyName, :patientCodePrefix) '); |
|
| 307 | + $req=$linkpdo->prepare('INSERT INTO studies (name, patient_code_prefix) VALUES(:studyName, :patientCodePrefix) '); |
|
| 308 | 308 | |
| 309 | 309 | $req->execute(array( |
| 310 | 310 | 'studyName' => $studyName, |
@@ -6,71 +6,71 @@ |
||
| 6 | 6 | class Visit_Type_Iterator implements Iterator |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - private array $visitsTypeArray=[]; |
|
| 10 | - private int $index=0; |
|
| 9 | + private array $visitsTypeArray=[]; |
|
| 10 | + private int $index=0; |
|
| 11 | 11 | |
| 12 | - public function __construct(array $visitTypeArray) |
|
| 13 | - { |
|
| 14 | - $this->visitsTypeArray=$visitTypeArray; |
|
| 15 | - } |
|
| 12 | + public function __construct(array $visitTypeArray) |
|
| 13 | + { |
|
| 14 | + $this->visitsTypeArray=$visitTypeArray; |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - public function setVisitPosition(String $visitName) |
|
| 18 | - { |
|
| 19 | - $visitNameArray=array_map(function(Visit_Type $visitTypeObject) { |
|
| 20 | - return $visitTypeObject->name; |
|
| 21 | - }, $this->visitsTypeArray); |
|
| 17 | + public function setVisitPosition(String $visitName) |
|
| 18 | + { |
|
| 19 | + $visitNameArray=array_map(function(Visit_Type $visitTypeObject) { |
|
| 20 | + return $visitTypeObject->name; |
|
| 21 | + }, $this->visitsTypeArray); |
|
| 22 | 22 | |
| 23 | - $this->index=array_search($visitName, $visitNameArray); |
|
| 24 | - } |
|
| 23 | + $this->index=array_search($visitName, $visitNameArray); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | - public function current(): Visit_Type |
|
| 28 | - { |
|
| 29 | - return $this->visitsTypeArray[$this->index]; |
|
| 30 | - } |
|
| 27 | + public function current(): Visit_Type |
|
| 28 | + { |
|
| 29 | + return $this->visitsTypeArray[$this->index]; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - public function previous() |
|
| 33 | - { |
|
| 34 | - $this->index--; |
|
| 35 | - } |
|
| 32 | + public function previous() |
|
| 33 | + { |
|
| 34 | + $this->index--; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - public function hasPrevious() |
|
| 38 | - { |
|
| 39 | - $this->previous(); |
|
| 40 | - if ($this->valid()) { |
|
| 41 | - return $this->current(); |
|
| 42 | - } else { |
|
| 43 | - return false; |
|
| 44 | - } |
|
| 45 | - } |
|
| 37 | + public function hasPrevious() |
|
| 38 | + { |
|
| 39 | + $this->previous(); |
|
| 40 | + if ($this->valid()) { |
|
| 41 | + return $this->current(); |
|
| 42 | + } else { |
|
| 43 | + return false; |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - public function next() |
|
| 48 | - { |
|
| 49 | - $this->index++; |
|
| 50 | - } |
|
| 47 | + public function next() |
|
| 48 | + { |
|
| 49 | + $this->index++; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - public function hasNext() |
|
| 53 | - { |
|
| 54 | - $this->next(); |
|
| 55 | - if ($this->valid()) { |
|
| 56 | - return $this->current(); |
|
| 57 | - } else { |
|
| 58 | - return false; |
|
| 59 | - } |
|
| 60 | - } |
|
| 52 | + public function hasNext() |
|
| 53 | + { |
|
| 54 | + $this->next(); |
|
| 55 | + if ($this->valid()) { |
|
| 56 | + return $this->current(); |
|
| 57 | + } else { |
|
| 58 | + return false; |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - public function rewind() |
|
| 63 | - { |
|
| 64 | - $this->index=0; |
|
| 65 | - } |
|
| 62 | + public function rewind() |
|
| 63 | + { |
|
| 64 | + $this->index=0; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - public function key(): int |
|
| 68 | - { |
|
| 69 | - return $this->index; |
|
| 70 | - } |
|
| 67 | + public function key(): int |
|
| 68 | + { |
|
| 69 | + return $this->index; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - public function valid(): bool |
|
| 73 | - { |
|
| 74 | - return isset($this->visitsTypeArray[$this->key()]); |
|
| 75 | - } |
|
| 72 | + public function valid(): bool |
|
| 73 | + { |
|
| 74 | + return isset($this->visitsTypeArray[$this->key()]); |
|
| 75 | + } |
|
| 76 | 76 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $this->previous(); |
| 40 | 40 | if ($this->valid()) { |
| 41 | 41 | return $this->current(); |
| 42 | - } else { |
|
| 42 | + }else { |
|
| 43 | 43 | return false; |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $this->next(); |
| 55 | 55 | if ($this->valid()) { |
| 56 | 56 | return $this->current(); |
| 57 | - } else { |
|
| 57 | + }else { |
|
| 58 | 58 | return false; |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -43,21 +43,21 @@ discard block |
||
| 43 | 43 | private $url; |
| 44 | 44 | private $context; |
| 45 | 45 | |
| 46 | - public function __construct($studyOrthancId, $url, $context){ |
|
| 46 | + public function __construct($studyOrthancId, $url, $context) { |
|
| 47 | 47 | //Set http adress of orthanc |
| 48 | - if($url==null && $context==null){ |
|
| 48 | + if ($url == null && $context == null) { |
|
| 49 | 49 | $linkpdo=Session::getLinkpdo(); |
| 50 | 50 | |
| 51 | 51 | $this->url=GAELO_ORTHANC_PACS_ADDRESS.':'.GAELO_ORTHANC_PACS_PORT; |
| 52 | - $this->context = array( |
|
| 52 | + $this->context=array( |
|
| 53 | 53 | 'http' => array( |
| 54 | - 'header' => "Authorization: Basic " . base64_encode( GAELO_ORTHANC_PACS_LOGIN.':'.GAELO_ORTHANC_PACS_PASSWORD ) |
|
| 54 | + 'header' => "Authorization: Basic ".base64_encode(GAELO_ORTHANC_PACS_LOGIN.':'.GAELO_ORTHANC_PACS_PASSWORD) |
|
| 55 | 55 | ) |
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | - }else{ |
|
| 58 | + }else { |
|
| 59 | 59 | $this->url=$url; |
| 60 | - $this->context = $context; |
|
| 60 | + $this->context=$context; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | //put current study orthanc ID in memory |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | /** |
| 69 | 69 | *Get study related tags and store them in this object |
| 70 | 70 | */ |
| 71 | - public function retrieveStudyData(){ |
|
| 72 | - $context = stream_context_create($this->context); |
|
| 73 | - $json = file_get_contents($this->url.'/studies/'.$this->studyOrthancID, false, $context); |
|
| 71 | + public function retrieveStudyData() { |
|
| 72 | + $context=stream_context_create($this->context); |
|
| 73 | + $json=file_get_contents($this->url.'/studies/'.$this->studyOrthancID, false, $context); |
|
| 74 | 74 | //On le decode |
| 75 | 75 | $studiesJson=json_decode($json, true); |
| 76 | 76 | //On cree un object patient avec les information |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | /** |
| 96 | 96 | *Get study statistics info (size in MB, number of instances) and store them in this object |
| 97 | 97 | */ |
| 98 | - private function retrieveStudyStatistics(){ |
|
| 99 | - $context = stream_context_create($this->context); |
|
| 100 | - $json = file_get_contents($this->url.'/studies/'.$this->studyOrthancID.'/statistics/', false, $context); |
|
| 98 | + private function retrieveStudyStatistics() { |
|
| 99 | + $context=stream_context_create($this->context); |
|
| 100 | + $json=file_get_contents($this->url.'/studies/'.$this->studyOrthancID.'/statistics/', false, $context); |
|
| 101 | 101 | //On le decode |
| 102 | 102 | $statisticsJson=json_decode($json, true); |
| 103 | 103 | $this->countInstances=$statisticsJson['CountInstances']; |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | ) |
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | - }else{ |
|
| 58 | + } else{ |
|
| 59 | 59 | $this->url=$url; |
| 60 | 60 | $this->context = $context; |
| 61 | 61 | } |
@@ -112,37 +112,37 @@ |
||
| 112 | 112 | AND review_available=1 |
| 113 | 113 | ORDER BY visit_type.visit_order '); |
| 114 | 114 | |
| 115 | - $idVisitsQuery->execute(array( |
|
| 116 | - 'visitGroupId' => $this->visitGroupObject->groupId |
|
| 117 | - )); |
|
| 115 | + $idVisitsQuery->execute(array( |
|
| 116 | + 'visitGroupId' => $this->visitGroupObject->groupId |
|
| 117 | + )); |
|
| 118 | 118 | |
| 119 | - $visitList = $idVisitsQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 119 | + $visitList = $idVisitsQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 120 | 120 | |
| 121 | - $visitObjectArray = []; |
|
| 121 | + $visitObjectArray = []; |
|
| 122 | 122 | |
| 123 | - foreach ($visitList as $visitId) { |
|
| 124 | - $visitObject = new Visit($visitId, $this->linkpdo); |
|
| 123 | + foreach ($visitList as $visitId) { |
|
| 124 | + $visitObject = new Visit($visitId, $this->linkpdo); |
|
| 125 | 125 | |
| 126 | - if (!empty($username)) { |
|
| 127 | - if ($visitObject->isAwaitingReviewForReviewerUser($username)) { |
|
| 128 | - $visitObjectArray[] = $visitObject; |
|
| 129 | - } |
|
| 130 | - } else { |
|
| 131 | - $visitObjectArray[] = $visitObject; |
|
| 132 | - } |
|
| 133 | - } |
|
| 126 | + if (!empty($username)) { |
|
| 127 | + if ($visitObject->isAwaitingReviewForReviewerUser($username)) { |
|
| 128 | + $visitObjectArray[] = $visitObject; |
|
| 129 | + } |
|
| 130 | + } else { |
|
| 131 | + $visitObjectArray[] = $visitObject; |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - return $visitObjectArray; |
|
| 136 | - } |
|
| 135 | + return $visitObjectArray; |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - /** |
|
| 139 | - * For controller tree |
|
| 140 | - * List all visits that awaiting QC Action (QC not done or waiting definitive conclusion) |
|
| 141 | - */ |
|
| 142 | - public function getVisitForControllerAction(): array |
|
| 143 | - { |
|
| 138 | + /** |
|
| 139 | + * For controller tree |
|
| 140 | + * List all visits that awaiting QC Action (QC not done or waiting definitive conclusion) |
|
| 141 | + */ |
|
| 142 | + public function getVisitForControllerAction(): array |
|
| 143 | + { |
|
| 144 | 144 | |
| 145 | - $visitsQuery=$this->linkpdo->prepare('SELECT id_visit FROM visits |
|
| 145 | + $visitsQuery=$this->linkpdo->prepare('SELECT id_visit FROM visits |
|
| 146 | 146 | INNER JOIN visit_type ON |
| 147 | 147 | (visit_type.id=visits.visit_type_id |
| 148 | 148 | AND visit_type.group_id = :visitGroupId) |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function __construct(Study $studyObject, Visit_Group $visitGroupObject, PDO $linkpdo) |
| 30 | 30 | { |
| 31 | - $this->linkpdo = $linkpdo; |
|
| 32 | - $this->studyObject = $studyObject; |
|
| 33 | - $this->visitGroupObject = $visitGroupObject; |
|
| 31 | + $this->linkpdo=$linkpdo; |
|
| 32 | + $this->studyObject=$studyObject; |
|
| 33 | + $this->visitGroupObject=$visitGroupObject; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function getVisitGroupObject(): Visit_Group |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | public function getUploadedVisits(): array |
| 45 | 45 | { |
| 46 | 46 | |
| 47 | - $uploadedVisitQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits |
|
| 47 | + $uploadedVisitQuery=$this->linkpdo->prepare('SELECT id_visit FROM visits |
|
| 48 | 48 | INNER JOIN visit_type ON |
| 49 | 49 | (visit_type.id=visits.visit_type_id |
| 50 | 50 | AND visit_type.group_id = :visitGroupId) |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | 'visitGroupId' => $this->visitGroupObject->groupId |
| 56 | 56 | )); |
| 57 | 57 | |
| 58 | - $uploadedVisitIds = $uploadedVisitQuery->fetchall(PDO::FETCH_COLUMN); |
|
| 58 | + $uploadedVisitIds=$uploadedVisitQuery->fetchall(PDO::FETCH_COLUMN); |
|
| 59 | 59 | |
| 60 | - $visitObjectArray = []; |
|
| 60 | + $visitObjectArray=[]; |
|
| 61 | 61 | foreach ($uploadedVisitIds as $id_visit) { |
| 62 | - $visitObjectArray[] = new Visit($id_visit, $this->linkpdo); |
|
| 62 | + $visitObjectArray[]=new Visit($id_visit, $this->linkpdo); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | return $visitObjectArray; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function getAwaitingUploadVisit(): array |
| 72 | 72 | { |
| 73 | 73 | |
| 74 | - $uploadedVisitQuery = $this->linkpdo->prepare("SELECT id_visit FROM visits |
|
| 74 | + $uploadedVisitQuery=$this->linkpdo->prepare("SELECT id_visit FROM visits |
|
| 75 | 75 | INNER JOIN visit_type ON |
| 76 | 76 | (visit_type.id=visits.visit_type_id |
| 77 | 77 | AND visit_type.group_id = :visitGroupId) |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | 'visitGroupId' => $this->visitGroupObject->groupId |
| 85 | 85 | ) |
| 86 | 86 | ); |
| 87 | - $uploadedVisitIds = $uploadedVisitQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 87 | + $uploadedVisitIds=$uploadedVisitQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 88 | 88 | |
| 89 | - $visitObjectArray = []; |
|
| 89 | + $visitObjectArray=[]; |
|
| 90 | 90 | foreach ($uploadedVisitIds as $id_visit) { |
| 91 | - $visitObjectArray[] = new Visit($id_visit, $this->linkpdo); |
|
| 91 | + $visitObjectArray[]=new Visit($id_visit, $this->linkpdo); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | return $visitObjectArray; |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | * @param string $username |
| 101 | 101 | * @return Visit[] |
| 102 | 102 | */ |
| 103 | - public function getAwaitingReviewVisit(string $username = null): array |
|
| 103 | + public function getAwaitingReviewVisit(string $username=null): array |
|
| 104 | 104 | { |
| 105 | 105 | |
| 106 | 106 | //Query visit to analyze visit awaiting a review |
| 107 | - $idVisitsQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits |
|
| 107 | + $idVisitsQuery=$this->linkpdo->prepare('SELECT id_visit FROM visits |
|
| 108 | 108 | INNER JOIN visit_type ON |
| 109 | 109 | (visit_type.id=visits.visit_type_id |
| 110 | 110 | AND visit_type.group_id = :visitGroupId) |
@@ -116,19 +116,19 @@ discard block |
||
| 116 | 116 | 'visitGroupId' => $this->visitGroupObject->groupId |
| 117 | 117 | )); |
| 118 | 118 | |
| 119 | - $visitList = $idVisitsQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 119 | + $visitList=$idVisitsQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 120 | 120 | |
| 121 | - $visitObjectArray = []; |
|
| 121 | + $visitObjectArray=[]; |
|
| 122 | 122 | |
| 123 | 123 | foreach ($visitList as $visitId) { |
| 124 | - $visitObject = new Visit($visitId, $this->linkpdo); |
|
| 124 | + $visitObject=new Visit($visitId, $this->linkpdo); |
|
| 125 | 125 | |
| 126 | 126 | if (!empty($username)) { |
| 127 | 127 | if ($visitObject->isAwaitingReviewForReviewerUser($username)) { |
| 128 | - $visitObjectArray[] = $visitObject; |
|
| 128 | + $visitObjectArray[]=$visitObject; |
|
| 129 | 129 | } |
| 130 | - } else { |
|
| 131 | - $visitObjectArray[] = $visitObject; |
|
| 130 | + }else { |
|
| 131 | + $visitObjectArray[]=$visitObject; |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | 'visitGroupId' => $this->visitGroupObject->groupId |
| 158 | 158 | )); |
| 159 | 159 | |
| 160 | - $visits = $visitsQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 160 | + $visits=$visitsQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 161 | 161 | |
| 162 | - $visitObjectArray = []; |
|
| 162 | + $visitObjectArray=[]; |
|
| 163 | 163 | foreach ($visits as $visit) { |
| 164 | - $visitObjectArray[] = new Visit($visit, $this->linkpdo); |
|
| 164 | + $visitObjectArray[]=new Visit($visit, $this->linkpdo); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | return $visitObjectArray; |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | public function getVisitWithQCStatus($qcStatus): array |
| 174 | 174 | { |
| 175 | 175 | |
| 176 | - $visitQuery = $this->linkpdo->prepare("SELECT id_visit FROM visits |
|
| 176 | + $visitQuery=$this->linkpdo->prepare("SELECT id_visit FROM visits |
|
| 177 | 177 | INNER JOIN visit_type ON |
| 178 | 178 | (visit_type.id=visits.visit_type_id |
| 179 | 179 | AND visit_type.group_id = :visitGroupId) |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | 'qcStatus' => $qcStatus, |
| 186 | 186 | 'visitGroupId' => $this->visitGroupObject->groupId |
| 187 | 187 | )); |
| 188 | - $visitIds = $visitQuery->fetchall(PDO::FETCH_COLUMN); |
|
| 188 | + $visitIds=$visitQuery->fetchall(PDO::FETCH_COLUMN); |
|
| 189 | 189 | |
| 190 | - $visitObjectArray = []; |
|
| 190 | + $visitObjectArray=[]; |
|
| 191 | 191 | foreach ($visitIds as $id_visit) { |
| 192 | - $visitObjectArray[] = new Visit($id_visit, $this->linkpdo); |
|
| 192 | + $visitObjectArray[]=new Visit($id_visit, $this->linkpdo); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | return $visitObjectArray; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | public function getVisitsMissingInvestigatorForm(): array |
| 202 | 202 | { |
| 203 | 203 | |
| 204 | - $visitQuery = $this->linkpdo->prepare("SELECT id_visit FROM visits |
|
| 204 | + $visitQuery=$this->linkpdo->prepare("SELECT id_visit FROM visits |
|
| 205 | 205 | INNER JOIN visit_type ON |
| 206 | 206 | (visit_type.id=visits.visit_type_id |
| 207 | 207 | AND visit_type.group_id = :visitGroupId) |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | 'visitGroupId' => $this->visitGroupObject->groupId |
| 214 | 214 | )); |
| 215 | 215 | |
| 216 | - $visitIds = $visitQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 216 | + $visitIds=$visitQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 217 | 217 | |
| 218 | - $visitObjectArray = []; |
|
| 218 | + $visitObjectArray=[]; |
|
| 219 | 219 | foreach ($visitIds as $id_visit) { |
| 220 | - $visitObjectArray[] = new Visit($id_visit, $this->linkpdo); |
|
| 220 | + $visitObjectArray[]=new Visit($id_visit, $this->linkpdo); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | return $visitObjectArray; |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | /** |
| 227 | 227 | * Return studie's created visits |
| 228 | 228 | */ |
| 229 | - public function getCreatedVisits(bool $deleted = false): array |
|
| 229 | + public function getCreatedVisits(bool $deleted=false): array |
|
| 230 | 230 | { |
| 231 | 231 | |
| 232 | - $uploadedVisitQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits |
|
| 232 | + $uploadedVisitQuery=$this->linkpdo->prepare('SELECT id_visit FROM visits |
|
| 233 | 233 | INNER JOIN visit_type ON |
| 234 | 234 | (visit_type.id=visits.visit_type_id |
| 235 | 235 | AND visit_type.group_id = :visitGroupId) |
@@ -241,11 +241,11 @@ discard block |
||
| 241 | 241 | 'visitGroupId' => $this->visitGroupObject->groupId |
| 242 | 242 | )); |
| 243 | 243 | |
| 244 | - $uploadedVisitIds = $uploadedVisitQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 244 | + $uploadedVisitIds=$uploadedVisitQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 245 | 245 | |
| 246 | - $visitObjectArray = []; |
|
| 246 | + $visitObjectArray=[]; |
|
| 247 | 247 | foreach ($uploadedVisitIds as $id_visit) { |
| 248 | - $visitObjectArray[] = new Visit($id_visit, $this->linkpdo); |
|
| 248 | + $visitObjectArray[]=new Visit($id_visit, $this->linkpdo); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | return $visitObjectArray; |
@@ -258,26 +258,26 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | |
| 260 | 260 | //Get patients list in this study |
| 261 | - $allPatients = $this->studyObject->getAllPatientsInStudy(); |
|
| 261 | + $allPatients=$this->studyObject->getAllPatientsInStudy(); |
|
| 262 | 262 | |
| 263 | - $results = []; |
|
| 263 | + $results=[]; |
|
| 264 | 264 | |
| 265 | 265 | foreach ($allPatients as $patient) { |
| 266 | 266 | |
| 267 | - $patientCenter = $patient->getPatientCenter(); |
|
| 268 | - $visitManager = $patient->getPatientVisitManager($this->visitGroupObject); |
|
| 267 | + $patientCenter=$patient->getPatientCenter(); |
|
| 268 | + $visitManager=$patient->getPatientVisitManager($this->visitGroupObject); |
|
| 269 | 269 | |
| 270 | - $patientData = []; |
|
| 271 | - $patientData['center'] = $patientCenter->name; |
|
| 272 | - $patientData['country'] = $patientCenter->countryName; |
|
| 273 | - $patientData['firstname'] = $patient->patientFirstName; |
|
| 274 | - $patientData['lastname'] = $patient->patientLastName; |
|
| 275 | - $patientData['birthdate'] = $patient->patientBirthDate; |
|
| 276 | - $patientData['registration_date'] = $patient->patientRegistrationDate; |
|
| 270 | + $patientData=[]; |
|
| 271 | + $patientData['center']=$patientCenter->name; |
|
| 272 | + $patientData['country']=$patientCenter->countryName; |
|
| 273 | + $patientData['firstname']=$patient->patientFirstName; |
|
| 274 | + $patientData['lastname']=$patient->patientLastName; |
|
| 275 | + $patientData['birthdate']=$patient->patientBirthDate; |
|
| 276 | + $patientData['registration_date']=$patient->patientRegistrationDate; |
|
| 277 | 277 | |
| 278 | - $visitStatus = $visitManager->determineVisitStatus($visitType->name); |
|
| 278 | + $visitStatus=$visitManager->determineVisitStatus($visitType->name); |
|
| 279 | 279 | |
| 280 | - $results[$patient->patientCode] = array_merge($patientData, $visitStatus); |
|
| 280 | + $results[$patient->patientCode]=array_merge($patientData, $visitStatus); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | return $results; |
@@ -290,15 +290,15 @@ discard block |
||
| 290 | 290 | { |
| 291 | 291 | |
| 292 | 292 | //Get ordered list of possible visits in this study |
| 293 | - $allVisitsType = $this->visitGroupObject->getAllVisitTypesOfGroup(); |
|
| 293 | + $allVisitsType=$this->visitGroupObject->getAllVisitTypesOfGroup(); |
|
| 294 | 294 | |
| 295 | - $results = []; |
|
| 295 | + $results=[]; |
|
| 296 | 296 | |
| 297 | 297 | foreach ($allVisitsType as $visitType) { |
| 298 | 298 | |
| 299 | - $allPatientStatus = $this->getPatientVisitStatusForVisitType($visitType); |
|
| 299 | + $allPatientStatus=$this->getPatientVisitStatusForVisitType($visitType); |
|
| 300 | 300 | |
| 301 | - $results[$visitType->name] = $allPatientStatus; |
|
| 301 | + $results[$visitType->name]=$allPatientStatus; |
|
| 302 | 302 | //array_push($results, ...$allPatientStatus); |
| 303 | 303 | } |
| 304 | 304 | |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | * @param string $study |
| 28 | 28 | * @return array |
| 29 | 29 | */ |
| 30 | - public static function getTrackerByRoleStudy(string $role, PDO $linkpdo, $study=null){ |
|
| 31 | - if($study==null){ |
|
| 32 | - $queryTracker = $linkpdo->prepare('SELECT * FROM tracker WHERE role=:role'); |
|
| 30 | + public static function getTrackerByRoleStudy(string $role, PDO $linkpdo, $study=null) { |
|
| 31 | + if ($study == null) { |
|
| 32 | + $queryTracker=$linkpdo->prepare('SELECT * FROM tracker WHERE role=:role'); |
|
| 33 | 33 | $queryTracker->execute(array( |
| 34 | 34 | 'role' => $role |
| 35 | 35 | )); |
| 36 | 36 | |
| 37 | - }else{ |
|
| 38 | - $queryTracker = $linkpdo->prepare('SELECT * FROM tracker WHERE study = :study AND role=:role'); |
|
| 37 | + }else { |
|
| 38 | + $queryTracker=$linkpdo->prepare('SELECT * FROM tracker WHERE study = :study AND role=:role'); |
|
| 39 | 39 | $queryTracker->execute(array('study' => $study, |
| 40 | 40 | 'role' => $role, |
| 41 | 41 | )); |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | * @param PDO $linkpdo |
| 53 | 53 | * @return array |
| 54 | 54 | */ |
| 55 | - public static function getMessageStudy(string $study, PDO $linkpdo){ |
|
| 56 | - $queryTracker = $linkpdo->prepare('SELECT * FROM tracker WHERE study = :study AND action_type="Send Message"'); |
|
| 55 | + public static function getMessageStudy(string $study, PDO $linkpdo) { |
|
| 56 | + $queryTracker=$linkpdo->prepare('SELECT * FROM tracker WHERE study = :study AND action_type="Send Message"'); |
|
| 57 | 57 | $queryTracker->execute(array('study' => $study)); |
| 58 | 58 | $trackerResult=$queryTracker->fetchAll(PDO::FETCH_ASSOC); |
| 59 | 59 | return $trackerResult; |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | * @param PDO $linkpdo |
| 66 | 66 | * @return array |
| 67 | 67 | */ |
| 68 | - public static function getTackerForVisit(string $id_visit, PDO $linkpdo){ |
|
| 69 | - $queryTracker = $linkpdo->prepare('SELECT * FROM tracker WHERE id_visit = :id_visit ORDER BY date'); |
|
| 68 | + public static function getTackerForVisit(string $id_visit, PDO $linkpdo) { |
|
| 69 | + $queryTracker=$linkpdo->prepare('SELECT * FROM tracker WHERE id_visit = :id_visit ORDER BY date'); |
|
| 70 | 70 | $queryTracker->execute(array('id_visit' => $id_visit)); |
| 71 | 71 | $trackerResult=$queryTracker->fetchAll(PDO::FETCH_ASSOC); |
| 72 | 72 | return $trackerResult; |
@@ -76,17 +76,17 @@ discard block |
||
| 76 | 76 | * Activity logger to log user activity in database |
| 77 | 77 | * Activity should be an associative key, will be JSON encoded |
| 78 | 78 | */ |
| 79 | - public static function logActivity($username, $role, $study, $id_visit, $actionType, $actionDetails){ |
|
| 79 | + public static function logActivity($username, $role, $study, $id_visit, $actionType, $actionDetails) { |
|
| 80 | 80 | |
| 81 | 81 | $linkpdo=Session::getLinkpdo(); |
| 82 | 82 | |
| 83 | - $connecter = $linkpdo->prepare('INSERT INTO tracker (date, username, role, study, id_visit, action_type, action_details) |
|
| 83 | + $connecter=$linkpdo->prepare('INSERT INTO tracker (date, username, role, study, id_visit, action_type, action_details) |
|
| 84 | 84 | VALUES(:date, :username, :role, :study, :id_visit, :action_type, :action_details)' ); |
| 85 | 85 | |
| 86 | 86 | $connecter->execute(array( |
| 87 | 87 | "username" => $username, |
| 88 | 88 | "role" => $role, |
| 89 | - "date"=> date('Y-m-d H:i:s') . substr((string)microtime(), 1, 6), |
|
| 89 | + "date"=> date('Y-m-d H:i:s').substr((string)microtime(), 1, 6), |
|
| 90 | 90 | "study"=>$study, |
| 91 | 91 | "id_visit"=>$id_visit, |
| 92 | 92 | "action_type"=>$actionType, |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | 'role' => $role |
| 35 | 35 | )); |
| 36 | 36 | |
| 37 | - }else{ |
|
| 37 | + } else{ |
|
| 38 | 38 | $queryTracker = $linkpdo->prepare('SELECT * FROM tracker WHERE study = :study AND role=:role'); |
| 39 | 39 | $queryTracker->execute(array('study' => $study, |
| 40 | 40 | 'role' => $role, |
@@ -26,24 +26,24 @@ discard block |
||
| 26 | 26 | protected $visitGroup; |
| 27 | 27 | |
| 28 | 28 | //Constants visit status available |
| 29 | - const DONE = "Done"; |
|
| 30 | - const NOT_DONE = "Not Done"; |
|
| 31 | - const SHOULD_BE_DONE = "Should be done"; |
|
| 32 | - const PENDING = "Pending"; |
|
| 33 | - const COMPLIANCY_YES = "Yes"; |
|
| 34 | - const COMPLIANCY_NO = "No"; |
|
| 35 | - const VISIT_WITHDRAWN = "Visit Withdrawn"; |
|
| 36 | - const VISIT_POSSIBLY_WITHDRAWN = "Possibly Withdrawn"; |
|
| 37 | - const OPTIONAL_VISIT = "Optional"; |
|
| 29 | + const DONE="Done"; |
|
| 30 | + const NOT_DONE="Not Done"; |
|
| 31 | + const SHOULD_BE_DONE="Should be done"; |
|
| 32 | + const PENDING="Pending"; |
|
| 33 | + const COMPLIANCY_YES="Yes"; |
|
| 34 | + const COMPLIANCY_NO="No"; |
|
| 35 | + const VISIT_WITHDRAWN="Visit Withdrawn"; |
|
| 36 | + const VISIT_POSSIBLY_WITHDRAWN="Possibly Withdrawn"; |
|
| 37 | + const OPTIONAL_VISIT="Optional"; |
|
| 38 | 38 | //Not needed status is no make custom choice to deactivate upload reminder |
| 39 | 39 | const VISIT_NOT_NEEDED="Not Nedded"; |
| 40 | 40 | |
| 41 | 41 | public function __construct(Patient $patientObject, Visit_Group $visitGroup, $linkpdo) |
| 42 | 42 | { |
| 43 | - $this->linkpdo = $linkpdo; |
|
| 44 | - $this->patientCode = $patientObject->patientCode; |
|
| 45 | - $this->patientObject = $patientObject; |
|
| 46 | - $this->visitGroup = $visitGroup; |
|
| 43 | + $this->linkpdo=$linkpdo; |
|
| 44 | + $this->patientCode=$patientObject->patientCode; |
|
| 45 | + $this->patientObject=$patientObject; |
|
| 46 | + $this->visitGroup=$visitGroup; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | * @param bool $deletedVisits |
| 53 | 53 | * @return Visit[] |
| 54 | 54 | */ |
| 55 | - public function getCreatedPatientsVisits(bool $deletedVisits = false) : Array |
|
| 55 | + public function getCreatedPatientsVisits(bool $deletedVisits=false) : Array |
|
| 56 | 56 | { |
| 57 | 57 | |
| 58 | - $visitQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits |
|
| 58 | + $visitQuery=$this->linkpdo->prepare('SELECT id_visit FROM visits |
|
| 59 | 59 | INNER JOIN visit_type ON |
| 60 | 60 | (visit_type.id=visits.visit_type_id |
| 61 | 61 | AND visit_type.group_id = :visitGroupId) |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | 'deleted' => $deletedVisits |
| 71 | 71 | )); |
| 72 | 72 | |
| 73 | - $visitsResults = $visitQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 73 | + $visitsResults=$visitQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 74 | 74 | |
| 75 | - $visitsObjectArray = []; |
|
| 75 | + $visitsObjectArray=[]; |
|
| 76 | 76 | foreach ($visitsResults as $idVisit) { |
| 77 | - $visitsObjectArray[] = new Visit($idVisit, $this->linkpdo); |
|
| 77 | + $visitsObjectArray[]=new Visit($idVisit, $this->linkpdo); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return $visitsObjectArray; |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | * @param bool $deletedVisits |
| 86 | 86 | * @return Visit[] |
| 87 | 87 | */ |
| 88 | - public function getQcDonePatientsVisits(bool $deletedVisits = false) : Array |
|
| 88 | + public function getQcDonePatientsVisits(bool $deletedVisits=false) : Array |
|
| 89 | 89 | { |
| 90 | 90 | |
| 91 | - $visitQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits |
|
| 91 | + $visitQuery=$this->linkpdo->prepare('SELECT id_visit FROM visits |
|
| 92 | 92 | INNER JOIN visit_type ON |
| 93 | 93 | (visit_type.id=visits.visit_type_id |
| 94 | 94 | AND visit_type.group_id = :visitGroupId) |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | 'deleted' => $deletedVisits |
| 106 | 106 | )); |
| 107 | 107 | |
| 108 | - $visitsResults = $visitQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 108 | + $visitsResults=$visitQuery->fetchAll(PDO::FETCH_COLUMN); |
|
| 109 | 109 | |
| 110 | - $visitsObjectArray = []; |
|
| 110 | + $visitsObjectArray=[]; |
|
| 111 | 111 | foreach ($visitsResults as $idVisit) { |
| 112 | - $visitsObjectArray[] = new Visit($idVisit, $this->linkpdo); |
|
| 112 | + $visitsObjectArray[]=new Visit($idVisit, $this->linkpdo); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | return $visitsObjectArray; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function getAvailableVisitsToCreate() : Array |
| 124 | 124 | { |
| 125 | - $availableVisitName = []; |
|
| 125 | + $availableVisitName=[]; |
|
| 126 | 126 | |
| 127 | 127 | // if withdraw disallow visit creation |
| 128 | 128 | if ($this->patientObject->patientWithdraw) { |
@@ -130,44 +130,44 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | $allPossibleVisits=$this->visitGroup->getAllVisitTypesOfGroup(); |
| 133 | - $createdVisits = $this->getCreatedPatientsVisits(); |
|
| 134 | - $createdVisitsNameArray=array_map(function (Visit $visit) { |
|
| 133 | + $createdVisits=$this->getCreatedPatientsVisits(); |
|
| 134 | + $createdVisitsNameArray=array_map(function(Visit $visit) { |
|
| 135 | 135 | return $visit->visitType; |
| 136 | 136 | }, $createdVisits); |
| 137 | 137 | |
| 138 | - $createdVisitOrder = array_map(function (Visit $visit) { |
|
| 138 | + $createdVisitOrder=array_map(function(Visit $visit) { |
|
| 139 | 139 | return $visit->getVisitCharacteristics()->visitOrder; |
| 140 | 140 | }, $createdVisits); |
| 141 | 141 | |
| 142 | - if(empty($createdVisitOrder)){ |
|
| 143 | - $lastCreatedVisitOrder= -1; |
|
| 144 | - }else{ |
|
| 145 | - $lastCreatedVisitOrder = max($createdVisitOrder); |
|
| 142 | + if (empty($createdVisitOrder)) { |
|
| 143 | + $lastCreatedVisitOrder=-1; |
|
| 144 | + }else { |
|
| 145 | + $lastCreatedVisitOrder=max($createdVisitOrder); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | foreach ($allPossibleVisits as $possibleVisit) { |
| 149 | 149 | |
| 150 | - if(in_array($possibleVisit->name, $createdVisitsNameArray) ){ |
|
| 150 | + if (in_array($possibleVisit->name, $createdVisitsNameArray)) { |
|
| 151 | 151 | //Already created do not display it |
| 152 | 152 | continue; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if ($possibleVisit->visitOrder < $lastCreatedVisitOrder ) { |
|
| 156 | - $availableVisitName[] = $possibleVisit->name; |
|
| 157 | - } else if($possibleVisit->visitOrder > $lastCreatedVisitOrder) { |
|
| 155 | + if ($possibleVisit->visitOrder < $lastCreatedVisitOrder) { |
|
| 156 | + $availableVisitName[]=$possibleVisit->name; |
|
| 157 | + }else if ($possibleVisit->visitOrder > $lastCreatedVisitOrder) { |
|
| 158 | 158 | if ($possibleVisit->optionalVisit) { |
| 159 | 159 | //If optional add optional visit and look for the next order |
| 160 | - $availableVisitName[] = $possibleVisit->name; |
|
| 160 | + $availableVisitName[]=$possibleVisit->name; |
|
| 161 | 161 | $lastCreatedVisitOrder++; |
| 162 | - } else if ($possibleVisit->visitOrder > $lastCreatedVisitOrder) { |
|
| 163 | - $availableVisitName[] = $possibleVisit->name; |
|
| 162 | + }else if ($possibleVisit->visitOrder > $lastCreatedVisitOrder) { |
|
| 163 | + $availableVisitName[]=$possibleVisit->name; |
|
| 164 | 164 | break; |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | //Reverse to sort for the more advanced visit to create |
| 170 | - $availableVisitName = array_reverse($availableVisitName); |
|
| 170 | + $availableVisitName=array_reverse($availableVisitName); |
|
| 171 | 171 | |
| 172 | 172 | if (empty($availableVisitName)) { |
| 173 | 173 | throw new Exception('No possible visit'); |
@@ -182,8 +182,8 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function isMissingVisit() : bool |
| 184 | 184 | { |
| 185 | - try{ |
|
| 186 | - if( ! empty( $this->getAvailableVisitsToCreate() ) ) { |
|
| 185 | + try { |
|
| 186 | + if (!empty($this->getAvailableVisitsToCreate())) { |
|
| 187 | 187 | return true; |
| 188 | 188 | } |
| 189 | 189 | }catch (Exception $e) { |
@@ -200,62 +200,62 @@ discard block |
||
| 200 | 200 | public function determineVisitStatus(String $visitName) |
| 201 | 201 | { |
| 202 | 202 | |
| 203 | - $registrationDate = $this->patientObject->getImmutableRegistrationDate(); |
|
| 204 | - $visitType = Visit_Type::getVisitTypeByName($this->visitGroup->groupId, $visitName, $this->linkpdo); |
|
| 203 | + $registrationDate=$this->patientObject->getImmutableRegistrationDate(); |
|
| 204 | + $visitType=Visit_Type::getVisitTypeByName($this->visitGroup->groupId, $visitName, $this->linkpdo); |
|
| 205 | 205 | |
| 206 | - $dateDownLimit = $registrationDate->modify($visitType->limitLowDays . 'day'); |
|
| 207 | - $dateUpLimit = $registrationDate->modify($visitType->limitUpDays . 'day'); |
|
| 206 | + $dateDownLimit=$registrationDate->modify($visitType->limitLowDays.'day'); |
|
| 207 | + $dateUpLimit=$registrationDate->modify($visitType->limitUpDays.'day'); |
|
| 208 | 208 | |
| 209 | - $visitAnswer['status'] = null; |
|
| 210 | - $visitAnswer['compliancy'] = null; |
|
| 211 | - $visitAnswer['shouldBeDoneBefore'] = $dateUpLimit->format('Y-m-d'); |
|
| 212 | - $visitAnswer['shouldBeDoneAfter'] = $dateDownLimit->format('Y-m-d'); |
|
| 213 | - $visitAnswer['state_investigator_form'] = null; |
|
| 214 | - $visitAnswer['state_quality_control'] = null; |
|
| 215 | - $visitAnswer['acquisition_date'] = null; |
|
| 216 | - $visitAnswer['upload_date'] = null; |
|
| 217 | - $visitAnswer['upload_status'] = null; |
|
| 218 | - $visitAnswer['id_visit'] = null; |
|
| 209 | + $visitAnswer['status']=null; |
|
| 210 | + $visitAnswer['compliancy']=null; |
|
| 211 | + $visitAnswer['shouldBeDoneBefore']=$dateUpLimit->format('Y-m-d'); |
|
| 212 | + $visitAnswer['shouldBeDoneAfter']=$dateDownLimit->format('Y-m-d'); |
|
| 213 | + $visitAnswer['state_investigator_form']=null; |
|
| 214 | + $visitAnswer['state_quality_control']=null; |
|
| 215 | + $visitAnswer['acquisition_date']=null; |
|
| 216 | + $visitAnswer['upload_date']=null; |
|
| 217 | + $visitAnswer['upload_status']=null; |
|
| 218 | + $visitAnswer['id_visit']=null; |
|
| 219 | 219 | |
| 220 | 220 | try { |
| 221 | 221 | //Visit Created check compliancy |
| 222 | - $visitObject = $this->getCreatedVisitForVisitTypeId($visitType->id); |
|
| 223 | - $visitAnswer['state_investigator_form'] = $visitObject->stateInvestigatorForm; |
|
| 224 | - $visitAnswer['state_quality_control'] = $visitObject->stateQualityControl; |
|
| 225 | - $visitAnswer['acquisition_date'] = $visitObject->acquisitionDate; |
|
| 226 | - $visitAnswer['upload_date'] = $visitObject->uploadDate; |
|
| 227 | - $visitAnswer['upload_status'] = $visitObject->uploadStatus; |
|
| 228 | - $visitAnswer['id_visit'] = $visitObject->id_visit; |
|
| 229 | - $testedDate = $visitObject->acquisitionDate; |
|
| 230 | - $visitAnswer['status'] = Patient_Visit_Manager::DONE; |
|
| 222 | + $visitObject=$this->getCreatedVisitForVisitTypeId($visitType->id); |
|
| 223 | + $visitAnswer['state_investigator_form']=$visitObject->stateInvestigatorForm; |
|
| 224 | + $visitAnswer['state_quality_control']=$visitObject->stateQualityControl; |
|
| 225 | + $visitAnswer['acquisition_date']=$visitObject->acquisitionDate; |
|
| 226 | + $visitAnswer['upload_date']=$visitObject->uploadDate; |
|
| 227 | + $visitAnswer['upload_status']=$visitObject->uploadStatus; |
|
| 228 | + $visitAnswer['id_visit']=$visitObject->id_visit; |
|
| 229 | + $testedDate=$visitObject->acquisitionDate; |
|
| 230 | + $visitAnswer['status']=Patient_Visit_Manager::DONE; |
|
| 231 | 231 | |
| 232 | 232 | if ($testedDate >= $dateDownLimit && $testedDate <= $dateDownLimit) { |
| 233 | - $visitAnswer['compliancy'] = Patient_Visit_Manager::COMPLIANCY_YES; |
|
| 234 | - } else { |
|
| 235 | - $visitAnswer['compliancy'] = Patient_Visit_Manager::COMPLIANCY_NO; |
|
| 233 | + $visitAnswer['compliancy']=Patient_Visit_Manager::COMPLIANCY_YES; |
|
| 234 | + }else { |
|
| 235 | + $visitAnswer['compliancy']=Patient_Visit_Manager::COMPLIANCY_NO; |
|
| 236 | 236 | } |
| 237 | - } catch (Exception $e) { |
|
| 237 | + }catch (Exception $e) { |
|
| 238 | 238 | //Visit Not Created |
| 239 | 239 | //If optional visit no status determination |
| 240 | 240 | if ($visitType->optionalVisit) { |
| 241 | - $visitAnswer['status'] = Patient_Visit_Manager::OPTIONAL_VISIT; |
|
| 242 | - } else { |
|
| 241 | + $visitAnswer['status']=Patient_Visit_Manager::OPTIONAL_VISIT; |
|
| 242 | + }else { |
|
| 243 | 243 | //Compare actual time with theorical date to determine status |
| 244 | - $testedDate = new DateTime(date("Y-m-d")); |
|
| 244 | + $testedDate=new DateTime(date("Y-m-d")); |
|
| 245 | 245 | if ($testedDate <= $dateUpLimit) { |
| 246 | - $visitAnswer['status'] = Patient_Visit_Manager::PENDING; |
|
| 247 | - } else { |
|
| 248 | - $visitAnswer['status'] = Patient_Visit_Manager::SHOULD_BE_DONE; |
|
| 246 | + $visitAnswer['status']=Patient_Visit_Manager::PENDING; |
|
| 247 | + }else { |
|
| 248 | + $visitAnswer['status']=Patient_Visit_Manager::SHOULD_BE_DONE; |
|
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | //Take account of possible withdrawal if not created |
| 254 | - if ($this->patientObject->patientWithdraw && $visitAnswer['acquisition_date'] == null) { |
|
| 254 | + if ($this->patientObject->patientWithdraw && $visitAnswer['acquisition_date'] == null) { |
|
| 255 | 255 | if ($this->patientObject->patientWithdrawDate < $dateDownLimit) { |
| 256 | - $visitAnswer['status'] = Patient_Visit_Manager::VISIT_WITHDRAWN; |
|
| 257 | - } else if ($this->patientObject->patientWithdrawDate > $dateDownLimit) { |
|
| 258 | - $visitAnswer['status'] = Patient_Visit_Manager::VISIT_POSSIBLY_WITHDRAWN; |
|
| 256 | + $visitAnswer['status']=Patient_Visit_Manager::VISIT_WITHDRAWN; |
|
| 257 | + }else if ($this->patientObject->patientWithdrawDate > $dateDownLimit) { |
|
| 258 | + $visitAnswer['status']=Patient_Visit_Manager::VISIT_POSSIBLY_WITHDRAWN; |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
@@ -268,13 +268,13 @@ discard block |
||
| 268 | 268 | public function getAwaitingReviewVisits() |
| 269 | 269 | { |
| 270 | 270 | |
| 271 | - $createdVisits = $this->getCreatedPatientsVisits(); |
|
| 271 | + $createdVisits=$this->getCreatedPatientsVisits(); |
|
| 272 | 272 | |
| 273 | - $availableVisitsForReview = []; |
|
| 273 | + $availableVisitsForReview=[]; |
|
| 274 | 274 | |
| 275 | 275 | foreach ($createdVisits as $visit) { |
| 276 | 276 | if ($visit->reviewAvailable) { |
| 277 | - $availableVisitsForReview[] = $visit; |
|
| 277 | + $availableVisitsForReview[]=$visit; |
|
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
@@ -283,34 +283,34 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | public function isHavingAwaitingReviewVisit() |
| 285 | 285 | { |
| 286 | - $awaitingReviews = $this->getAwaitingReviewVisits(); |
|
| 286 | + $awaitingReviews=$this->getAwaitingReviewVisits(); |
|
| 287 | 287 | return (!empty($awaitingReviews)); |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - public function getCreatedVisitForVisitTypeId($visitTypeId){ |
|
| 291 | - $visitQuery = $this->linkpdo->prepare ( 'SELECT id_visit FROM visits WHERE patient_code=:patientCode AND visit_type_id=:visitTypeId AND deleted=0 ' ); |
|
| 290 | + public function getCreatedVisitForVisitTypeId($visitTypeId) { |
|
| 291 | + $visitQuery=$this->linkpdo->prepare('SELECT id_visit FROM visits WHERE patient_code=:patientCode AND visit_type_id=:visitTypeId AND deleted=0 '); |
|
| 292 | 292 | |
| 293 | - $visitQuery->execute ( array('patientCode' => $this->patientCode, 'visitTypeId'=>$visitTypeId) ); |
|
| 294 | - $visitId = $visitQuery->fetch(PDO::FETCH_COLUMN); |
|
| 293 | + $visitQuery->execute(array('patientCode' => $this->patientCode, 'visitTypeId'=>$visitTypeId)); |
|
| 294 | + $visitId=$visitQuery->fetch(PDO::FETCH_COLUMN); |
|
| 295 | 295 | |
| 296 | - if(empty($visitId)){ |
|
| 296 | + if (empty($visitId)) { |
|
| 297 | 297 | throw new Exception("Visit Non Existing"); |
| 298 | - }else{ |
|
| 298 | + }else { |
|
| 299 | 299 | return new Visit($visitId, $this->linkpdo); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - public function getCreatedVisitByVisitName($visitName){ |
|
| 304 | + public function getCreatedVisitByVisitName($visitName) { |
|
| 305 | 305 | |
| 306 | - $visitQuery = $this->linkpdo->prepare ( 'SELECT id_visit FROM visits, visit_type WHERE visits.visit_type_id = visit_type.id AND visits.patient_code=:patientCode AND visit_type.name=:visitName AND visits.deleted=0 ' ); |
|
| 306 | + $visitQuery=$this->linkpdo->prepare('SELECT id_visit FROM visits, visit_type WHERE visits.visit_type_id = visit_type.id AND visits.patient_code=:patientCode AND visit_type.name=:visitName AND visits.deleted=0 '); |
|
| 307 | 307 | |
| 308 | - $visitQuery->execute ( array('patientCode' => $this->patientCode, 'visitName'=>$visitName) ); |
|
| 309 | - $visitId = $visitQuery->fetch(PDO::FETCH_COLUMN); |
|
| 308 | + $visitQuery->execute(array('patientCode' => $this->patientCode, 'visitName'=>$visitName)); |
|
| 309 | + $visitId=$visitQuery->fetch(PDO::FETCH_COLUMN); |
|
| 310 | 310 | |
| 311 | - if(empty($visitId)){ |
|
| 311 | + if (empty($visitId)) { |
|
| 312 | 312 | throw new Exception("Visit Non Existing"); |
| 313 | - }else{ |
|
| 313 | + }else { |
|
| 314 | 314 | return new Visit($visitId, $this->linkpdo); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | if(empty($createdVisitOrder)){ |
| 143 | 143 | $lastCreatedVisitOrder= -1; |
| 144 | - }else{ |
|
| 144 | + } else{ |
|
| 145 | 145 | $lastCreatedVisitOrder = max($createdVisitOrder); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | if( ! empty( $this->getAvailableVisitsToCreate() ) ) { |
| 187 | 187 | return true; |
| 188 | 188 | } |
| 189 | - }catch (Exception $e) { |
|
| 189 | + } catch (Exception $e) { |
|
| 190 | 190 | //if exception happens no visits are missing |
| 191 | 191 | return false; |
| 192 | 192 | } |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | if(empty($visitId)){ |
| 297 | 297 | throw new Exception("Visit Non Existing"); |
| 298 | - }else{ |
|
| 298 | + } else{ |
|
| 299 | 299 | return new Visit($visitId, $this->linkpdo); |
| 300 | 300 | } |
| 301 | 301 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | if(empty($visitId)){ |
| 312 | 312 | throw new Exception("Visit Non Existing"); |
| 313 | - }else{ |
|
| 313 | + } else{ |
|
| 314 | 314 | return new Visit($visitId, $this->linkpdo); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -87,63 +87,63 @@ discard block |
||
| 87 | 87 | * This methods is triggered by the system at form submission and call the save specific form |
| 88 | 88 | * to define which value need to be written in the specific table |
| 89 | 89 | */ |
| 90 | - public function saveForm($data, bool $validate){ |
|
| 90 | + public function saveForm($data, bool $validate) { |
|
| 91 | 91 | |
| 92 | 92 | $this->rawDataForm=$data; |
| 93 | 93 | |
| 94 | 94 | //If reviewer check that review is available before saving process |
| 95 | - if( !$this->local && !$this->reviewAvailable){ |
|
| 96 | - return ; |
|
| 95 | + if (!$this->local && !$this->reviewAvailable) { |
|
| 96 | + return; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | //Get saved form, return either local form or reviewer's users form if exist |
| 100 | 100 | //or null if not existing |
| 101 | 101 | |
| 102 | - if(empty($this->reviewObject)){ |
|
| 102 | + if (empty($this->reviewObject)) { |
|
| 103 | 103 | $this->createReview(); |
| 104 | 104 | $update=false; |
| 105 | - }else{ |
|
| 105 | + }else { |
|
| 106 | 106 | $update=true; |
| 107 | 107 | //If already existing validated review, exit without modifying anything |
| 108 | - if($this->reviewObject->validated){ |
|
| 108 | + if ($this->reviewObject->validated) { |
|
| 109 | 109 | return; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | //Call the child redifined save specific form to save the specific data of the form |
| 115 | - try{ |
|
| 115 | + try { |
|
| 116 | 116 | $this->saveSpecificForm($data, $this->reviewObject->id_review, $update); |
| 117 | - }catch(Exception $e){ |
|
| 117 | + }catch (Exception $e) { |
|
| 118 | 118 | error_log($e->getMessage()); |
| 119 | - if(!$update){ |
|
| 119 | + if (!$update) { |
|
| 120 | 120 | $this->reviewObject->hardDeleteReview(); |
| 121 | 121 | } |
| 122 | 122 | throw new Exception("Error during save"); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if($validate) $this->reviewObject->changeReviewValidationStatus($validate); |
|
| 125 | + if ($validate) $this->reviewObject->changeReviewValidationStatus($validate); |
|
| 126 | 126 | //update the visit status if we are processing a local form |
| 127 | - if($this->local){ |
|
| 127 | + if ($this->local) { |
|
| 128 | 128 | if ($validate) $this->visitObject->changeVisitStateInvestigatorForm(Visit::LOCAL_FORM_DONE); |
| 129 | 129 | else $this->visitObject->changeVisitStateInvestigatorForm(Visit::LOCAL_FORM_DRAFT); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | //Log Activity |
| 133 | - if($this->local) $role="Investigator"; else $role="Reviewer"; |
|
| 133 | + if ($this->local) $role="Investigator"; else $role="Reviewer"; |
|
| 134 | 134 | $actionDetails['patient_code']=$this->visitObject->patientCode; |
| 135 | 135 | $actionDetails['type_visit']=$this->visitObject->visitType; |
| 136 | 136 | $actionDetails['modality_visit']=$this->visitObject->visitGroupObject->groupModality; |
| 137 | 137 | $actionDetails['id_review']=$this->reviewObject->id_review; |
| 138 | 138 | $actionDetails['local_review']=intval($this->local); |
| 139 | - $actionDetails['adjudication']=intval($this->reviewStatus==Visit::REVIEW_WAIT_ADJUDICATION); |
|
| 140 | - $actionDetails['create']= !$update; |
|
| 141 | - $actionDetails['raw_data']= $data; |
|
| 139 | + $actionDetails['adjudication']=intval($this->reviewStatus == Visit::REVIEW_WAIT_ADJUDICATION); |
|
| 140 | + $actionDetails['create']=!$update; |
|
| 141 | + $actionDetails['raw_data']=$data; |
|
| 142 | 142 | |
| 143 | - Tracker::logActivity($this->username, $role, $this->study ,$this->id_visit, "Save Form", $actionDetails); |
|
| 143 | + Tracker::logActivity($this->username, $role, $this->study, $this->id_visit, "Save Form", $actionDetails); |
|
| 144 | 144 | |
| 145 | 145 | //If central review still not at "Done" status Check if validation is reached |
| 146 | - if ($validate && !$this->local && $this->reviewStatus != Visit::REVIEW_DONE ) { |
|
| 146 | + if ($validate && !$this->local && $this->reviewStatus != Visit::REVIEW_DONE) { |
|
| 147 | 147 | $this->setVisitValidation(); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | * @param string $reviewStatus |
| 157 | 157 | * @param $conclusionValue |
| 158 | 158 | */ |
| 159 | - protected function changeVisitValidationStatus(string $reviewStatus, $conclusionValue="N/A"){ |
|
| 159 | + protected function changeVisitValidationStatus(string $reviewStatus, $conclusionValue="N/A") { |
|
| 160 | 160 | $this->visitObject->changeVisitValidationStatus($reviewStatus, $conclusionValue); |
| 161 | 161 | $this->reviewAvailabilityDecision($reviewStatus); |
| 162 | 162 | |
| 163 | 163 | //Send Notification emails |
| 164 | - if($reviewStatus == Visit::REVIEW_WAIT_ADJUDICATION){ |
|
| 164 | + if ($reviewStatus == Visit::REVIEW_WAIT_ADJUDICATION) { |
|
| 165 | 165 | |
| 166 | 166 | $email=new Send_Email($this->linkpdo); |
| 167 | 167 | //SK A AMELIORER POUR EVITER DE MAILIER LES REVIEWER QUI ONT DEJA REPONDU |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | * return all reviews (local and reviewer) of the current visit |
| 207 | 207 | * Usefull to determine visit conclusion status |
| 208 | 208 | */ |
| 209 | - public function getAllValidatedFormsOfVisit(){ |
|
| 209 | + public function getAllValidatedFormsOfVisit() { |
|
| 210 | 210 | |
| 211 | - $query = $this->linkpdo->prepare('SELECT * FROM reviews,'.$this->specificTable.' WHERE reviews.id_review='.$this->specificTable.'.id_review AND reviews.id_visit=:idVisit AND reviews.validated=1 AND reviews.deleted=0'); |
|
| 211 | + $query=$this->linkpdo->prepare('SELECT * FROM reviews,'.$this->specificTable.' WHERE reviews.id_review='.$this->specificTable.'.id_review AND reviews.id_visit=:idVisit AND reviews.validated=1 AND reviews.deleted=0'); |
|
| 212 | 212 | $query->execute(array( |
| 213 | 213 | 'idVisit'=>$this->id_visit |
| 214 | 214 | )); |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | * Can be overided if needed different condition |
| 241 | 241 | * @param string $reviewConclusion |
| 242 | 242 | */ |
| 243 | - protected function reviewAvailabilityDecision(string $reviewConclusion){ |
|
| 243 | + protected function reviewAvailabilityDecision(string $reviewConclusion) { |
|
| 244 | 244 | //If Done reached make the review unavailable for review |
| 245 | - if($reviewConclusion== Visit::REVIEW_DONE){ |
|
| 245 | + if ($reviewConclusion == Visit::REVIEW_DONE) { |
|
| 246 | 246 | $this->visitObject->changeReviewAvailability(false); |
| 247 | 247 | } |
| 248 | 248 | //Needed in case of deletion of a review (even if true by default initialy, need to come back if deletion) |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | if(empty($this->reviewObject)){ |
| 103 | 103 | $this->createReview(); |
| 104 | 104 | $update=false; |
| 105 | - }else{ |
|
| 105 | + } else{ |
|
| 106 | 106 | $update=true; |
| 107 | 107 | //If already existing validated review, exit without modifying anything |
| 108 | 108 | if($this->reviewObject->validated){ |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | //Call the child redifined save specific form to save the specific data of the form |
| 115 | 115 | try{ |
| 116 | 116 | $this->saveSpecificForm($data, $this->reviewObject->id_review, $update); |
| 117 | - }catch(Exception $e){ |
|
| 117 | + } catch(Exception $e){ |
|
| 118 | 118 | error_log($e->getMessage()); |
| 119 | 119 | if(!$update){ |
| 120 | 120 | $this->reviewObject->hardDeleteReview(); |
@@ -122,15 +122,24 @@ discard block |
||
| 122 | 122 | throw new Exception("Error during save"); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if($validate) $this->reviewObject->changeReviewValidationStatus($validate); |
|
| 125 | + if($validate) { |
|
| 126 | + $this->reviewObject->changeReviewValidationStatus($validate); |
|
| 127 | + } |
|
| 126 | 128 | //update the visit status if we are processing a local form |
| 127 | 129 | if($this->local){ |
| 128 | - if ($validate) $this->visitObject->changeVisitStateInvestigatorForm(Visit::LOCAL_FORM_DONE); |
|
| 129 | - else $this->visitObject->changeVisitStateInvestigatorForm(Visit::LOCAL_FORM_DRAFT); |
|
| 130 | + if ($validate) { |
|
| 131 | + $this->visitObject->changeVisitStateInvestigatorForm(Visit::LOCAL_FORM_DONE); |
|
| 132 | + } else { |
|
| 133 | + $this->visitObject->changeVisitStateInvestigatorForm(Visit::LOCAL_FORM_DRAFT); |
|
| 134 | + } |
|
| 130 | 135 | } |
| 131 | 136 | |
| 132 | 137 | //Log Activity |
| 133 | - if($this->local) $role="Investigator"; else $role="Reviewer"; |
|
| 138 | + if($this->local) { |
|
| 139 | + $role="Investigator"; |
|
| 140 | + } else { |
|
| 141 | + $role="Reviewer"; |
|
| 142 | + } |
|
| 134 | 143 | $actionDetails['patient_code']=$this->visitObject->patientCode; |
| 135 | 144 | $actionDetails['type_visit']=$this->visitObject->visitType; |
| 136 | 145 | $actionDetails['modality_visit']=$this->visitObject->visitGroupObject->groupModality; |
@@ -170,7 +179,7 @@ discard block |
||
| 170 | 179 | ->addGroupEmails($this->visitObject->study, User::SUPERVISOR); |
| 171 | 180 | $email->sendAwaitingAdjudicationMessage($this->visitObject->study, $this->visitObject->patientCode, $this->visitObject->visitType); |
| 172 | 181 | |
| 173 | - }else if ($reviewStatus == Visit::REVIEW_DONE) { |
|
| 182 | + } else if ($reviewStatus == Visit::REVIEW_DONE) { |
|
| 174 | 183 | |
| 175 | 184 | $email=new Send_Email($this->linkpdo); |
| 176 | 185 | $uploaderUserObject=new User($this->visitObject->uploaderUsername, $this->linkpdo); |
@@ -192,11 +201,11 @@ discard block |
||
| 192 | 201 | try { |
| 193 | 202 | if ($this->local) { |
| 194 | 203 | $this->reviewObject=$this->visitObject->getReviewsObject(true); |
| 195 | - }else { |
|
| 204 | + } else { |
|
| 196 | 205 | $this->reviewObject=$this->visitObject->queryExistingReviewForReviewer($this->username); |
| 197 | 206 | } |
| 198 | 207 | |
| 199 | - }catch (Exception $e) { } |
|
| 208 | + } catch (Exception $e) { } |
|
| 200 | 209 | |
| 201 | 210 | return $this->reviewObject; |
| 202 | 211 | |
@@ -225,7 +234,7 @@ discard block |
||
| 225 | 234 | $validatedReviewObjects=array_filter($reviewsObject, function($review) { |
| 226 | 235 | if ($review->validated) { |
| 227 | 236 | return true; |
| 228 | - }else { |
|
| 237 | + } else { |
|
| 229 | 238 | return false; |
| 230 | 239 | } |
| 231 | 240 | }); |